/*********************************************************************
*
* Linux multisound pinnacle/fiji driver for ALSA.
*
* 2002/06/30 Karsten Wiese:
* for now this is only used to build a pinnacle / fiji driver.
* the OSS parent of this code is designed to also support
* the multisound classic via the file msnd_classic.c.
* to make it easier for some brave heart to implemt classic
* support in alsa, i left all the MSND_CLASSIC tokens in this file.
* but for now this untested & undone.
*
*
* ripped from linux kernel 2.4.18 by Karsten Wiese.
*
* the following is a copy of the 2.4.18 OSS FREE file-heading comment:
*
* Turtle Beach MultiSound Sound Card Driver for Linux
* msnd_pinnacle.c / msnd_classic.c
*
* -- If MSND_CLASSIC is defined:
*
* -> driver for Turtle Beach Classic/Monterey/Tahiti
*
* -- Else
*
* -> driver for Turtle Beach Pinnacle/Fiji
*
* 12-3-2000 Modified IO port validation Steve Sycamore
*
* Copyright (C) 1998 Andrew Veliath
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
********************************************************************/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/interrupt.h>
#include <linux/types.h>
#include <linux/delay.h>
#include <linux/ioport.h>
#include <linux/firmware.h>
#include <linux/isa.h>
#include <linux/isapnp.h>
#include <linux/irq.h>
#include <linux/io.h>
#include <sound/core.h>
#include <sound/initval.h>
#include <sound/asound.h>
#include <sound/pcm.h>
#include <sound/mpu401.h>
#ifdef MSND_CLASSIC
# ifndef __alpha__
# define SLOWIO
# endif
#endif
#include "msnd.h"
#ifdef MSND_CLASSIC
# include "msnd_classic.h"
# define LOGNAME "msnd_classic"
#else
# include "msnd_pinnacle.h"
# define LOGNAME "snd_msnd_pinnacle"
#endif
static void __devinit set_default_audio_parameters(struct snd_msnd *chip)
{
chip->play_sample_size = DEFSAMPLESIZE;
chip->play_sample_rate = DEFSAMPLERATE;
chip->play_channels = DEFCHANNELS;
chip->capture_sample_size = DEFSAMPLESIZE;
chip->capture_sample_rate = DEFSAMPLERATE;
chip->capture_channels = DEFCHANNELS;
}
static void snd_msnd_eval_dsp_msg(struct snd_msnd *chip, u16 wMessage)
{
switch (HIBYTE(wMessage)) {
case HIMT_PLAY_DONE: {
if (chip->banksPlayed < 3)
snd_printdd("%08X: HIMT_PLAY_DONE: %i\n",
(unsigned)jiffies, LOBYTE(wMessage));
if (chip->last_playbank == LOBYTE(wMessage)) {
snd_printdd("chip.last_playbank == LOBYTE(wMessage)\n");
break;
}
chip->banksPlayed++;
if (test_bit(F_WRITING, &chip->flags))
snd_msnd_DAPQ(chip, 0);
chip->last_playbank = LOBYTE(wMessage);
chip->playDMAPos += chip->play_period_bytes;
if (chip->playDMAPos > chip->playLimit)
chip->playDMAPos = 0;
snd_pcm_period_elapsed(chip->playback_substream);
break;
}
case HIMT_RECORD_DONE:
if (chip->last_recbank == LOBYTE(wMessage))
break;
chip->last_recbank = LOBYTE(wMessage);
chip->captureDMAPos += chip->capturePeriodBytes;
if (chip->captureDMAPos > (chip->captureLimit))
chip->captureDMAPos = 0;