1993-10-23 10:55:52 +00:00
|
|
|
/*
|
1994-03-11 10:27:25 +00:00
|
|
|
* sound/sb_dsp.c
|
1994-10-01 02:17:17 +00:00
|
|
|
*
|
|
|
|
* The low level driver for the SoundBlaster DSP chip (SB1.0 to 2.1, SB Pro).
|
|
|
|
*
|
|
|
|
* Copyright by Hannu Savolainen 1994
|
|
|
|
*
|
1993-10-29 03:44:07 +00:00
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions are
|
|
|
|
* met: 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer. 2.
|
|
|
|
* Redistributions in binary form must reproduce the above copyright notice,
|
|
|
|
* this list of conditions and the following disclaimer in the documentation
|
|
|
|
* and/or other materials provided with the distribution.
|
1994-10-01 02:17:17 +00:00
|
|
|
*
|
1993-10-29 03:44:07 +00:00
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
|
|
|
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
|
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
|
|
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
|
|
|
|
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
|
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
|
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
1994-10-01 02:17:17 +00:00
|
|
|
*
|
1994-04-23 01:50:14 +00:00
|
|
|
* Modified:
|
|
|
|
* Hunyue Yau Jan 6 1994
|
|
|
|
* Added code to support Sound Galaxy NX Pro
|
|
|
|
*
|
1995-03-05 22:11:57 +00:00
|
|
|
* $Id: sb_dsp.c,v 1.22 1994/12/10 22:55:50 ats Exp $
|
1993-10-23 10:55:52 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "sound_config.h"
|
|
|
|
|
|
|
|
#if defined(CONFIGURE_SOUNDCARD) && !defined(EXCLUDE_SB)
|
|
|
|
|
1994-03-11 10:27:25 +00:00
|
|
|
#include "sb.h"
|
|
|
|
#include "sb_mixer.h"
|
1993-10-23 10:55:52 +00:00
|
|
|
#undef SB_TEST_IRQ
|
|
|
|
|
1994-03-11 10:27:25 +00:00
|
|
|
int sbc_base = 0;
|
1993-10-23 10:55:52 +00:00
|
|
|
static int sbc_irq = 0;
|
1994-10-01 02:17:17 +00:00
|
|
|
static int open_mode = 0; /* Read, write or both */
|
1993-10-23 10:55:52 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* The DSP channel can be used either for input or output. Variable
|
1994-03-11 10:27:25 +00:00
|
|
|
* 'sb_irq_mode' will be set when the program calls read or write first time
|
1993-10-23 10:55:52 +00:00
|
|
|
* after open. Current version doesn't support mode changes without closing
|
|
|
|
* and reopening the device. Support for this feature may be implemented in a
|
|
|
|
* future version of this driver.
|
|
|
|
*/
|
|
|
|
|
1994-10-01 02:17:17 +00:00
|
|
|
int sb_dsp_ok = 0; /*
|
|
|
|
|
|
|
|
|
|
|
|
* * * * Set to 1 after successful
|
|
|
|
* initialization * */
|
1993-10-23 10:55:52 +00:00
|
|
|
static int midi_disabled = 0;
|
1994-03-11 10:27:25 +00:00
|
|
|
int sb_dsp_highspeed = 0;
|
1994-10-01 02:17:17 +00:00
|
|
|
int sbc_major = 1, sbc_minor = 0; /*
|
|
|
|
|
|
|
|
|
|
|
|
* * * * DSP version */
|
1994-03-11 10:27:25 +00:00
|
|
|
static int dsp_stereo = 0;
|
1993-10-23 10:55:52 +00:00
|
|
|
static int dsp_current_speed = DSP_DEFAULT_SPEED;
|
1994-03-11 10:27:25 +00:00
|
|
|
static int sb16 = 0;
|
|
|
|
static int irq_verified = 0;
|
1993-10-23 10:55:52 +00:00
|
|
|
|
1994-03-11 10:27:25 +00:00
|
|
|
int sb_midi_mode = NORMAL_MIDI;
|
1994-10-01 02:17:17 +00:00
|
|
|
int sb_midi_busy = 0; /*
|
|
|
|
|
|
|
|
|
|
|
|
* * * * 1 if the process has output
|
|
|
|
* to * * MIDI */
|
1994-03-11 10:27:25 +00:00
|
|
|
int sb_dsp_busy = 0;
|
1993-10-23 10:55:52 +00:00
|
|
|
|
1994-10-01 02:17:17 +00:00
|
|
|
volatile int sb_irq_mode = IMODE_NONE; /*
|
1993-10-23 10:55:52 +00:00
|
|
|
|
1994-10-01 02:17:17 +00:00
|
|
|
|
|
|
|
* * * * IMODE_INPUT, *
|
|
|
|
* IMODE_OUTPUT * * or *
|
|
|
|
* IMODE_NONE */
|
1993-10-23 10:55:52 +00:00
|
|
|
static volatile int irq_ok = 0;
|
|
|
|
|
1994-03-11 10:27:25 +00:00
|
|
|
int sb_duplex_midi = 0;
|
1993-10-23 10:55:52 +00:00
|
|
|
static int my_dev = 0;
|
|
|
|
|
1994-03-11 10:27:25 +00:00
|
|
|
volatile int sb_intr_active = 0;
|
1993-10-23 10:55:52 +00:00
|
|
|
|
|
|
|
static int dsp_speed (int);
|
|
|
|
static int dsp_set_stereo (int mode);
|
1995-03-04 21:11:21 +00:00
|
|
|
int sb_dsp_command (unsigned char val);
|
1993-10-23 10:55:52 +00:00
|
|
|
|
|
|
|
#if !defined(EXCLUDE_MIDI) || !defined(EXCLUDE_AUDIO)
|
|
|
|
|
1994-10-01 02:17:17 +00:00
|
|
|
/*
|
|
|
|
* Common code for the midi and pcm functions
|
|
|
|
*/
|
1993-10-23 10:55:52 +00:00
|
|
|
|
1994-03-11 10:27:25 +00:00
|
|
|
int
|
|
|
|
sb_dsp_command (unsigned char val)
|
1993-10-23 10:55:52 +00:00
|
|
|
{
|
1994-03-23 19:27:52 +00:00
|
|
|
int i;
|
|
|
|
unsigned long limit;
|
1993-10-23 10:55:52 +00:00
|
|
|
|
1994-10-01 02:17:17 +00:00
|
|
|
limit = GET_TIME () + HZ / 10;/*
|
1995-03-04 21:11:21 +00:00
|
|
|
* The timeout is 0.1 seconds
|
1994-10-01 02:17:17 +00:00
|
|
|
*/
|
1993-10-23 10:55:52 +00:00
|
|
|
|
|
|
|
/*
|
1994-03-11 10:27:25 +00:00
|
|
|
* Note! the i<500000 is an emergency exit. The sb_dsp_command() is sometimes
|
1993-10-23 10:55:52 +00:00
|
|
|
* called while interrupts are disabled. This means that the timer is
|
|
|
|
* disabled also. However the timeout situation is a abnormal condition.
|
|
|
|
* Normally the DSP should be ready to accept commands after just couple of
|
|
|
|
* loops.
|
|
|
|
*/
|
|
|
|
|
1994-03-11 10:27:25 +00:00
|
|
|
for (i = 0; i < 500000 && GET_TIME () < limit; i++)
|
1993-10-23 10:55:52 +00:00
|
|
|
{
|
|
|
|
if ((INB (DSP_STATUS) & 0x80) == 0)
|
|
|
|
{
|
|
|
|
OUTB (val, DSP_COMMAND);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1994-03-11 10:27:25 +00:00
|
|
|
printk ("SoundBlaster: DSP Command(%x) Timeout.\n", val);
|
1993-10-23 10:55:52 +00:00
|
|
|
printk ("IRQ conflict???\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
1994-03-11 10:27:25 +00:00
|
|
|
sbintr (int unit)
|
1993-10-23 10:55:52 +00:00
|
|
|
{
|
1994-04-23 01:50:14 +00:00
|
|
|
int status;
|
1993-10-23 10:55:52 +00:00
|
|
|
|
1994-03-11 10:27:25 +00:00
|
|
|
#ifndef EXCLUDE_SBPRO
|
|
|
|
if (sb16)
|
|
|
|
{
|
1994-10-01 02:17:17 +00:00
|
|
|
unsigned char src = sb_getmixer (IRQ_STAT); /*
|
|
|
|
|
|
|
|
|
|
|
|
* * * * Interrupt
|
|
|
|
* source * *
|
|
|
|
* register */
|
1994-03-11 10:27:25 +00:00
|
|
|
|
|
|
|
#ifndef EXCLUDE_SB16
|
|
|
|
if (src & 3)
|
|
|
|
sb16_dsp_interrupt (unit);
|
|
|
|
|
|
|
|
#ifndef EXCLUDE_MIDI
|
|
|
|
if (src & 4)
|
1994-10-01 02:17:17 +00:00
|
|
|
sb16midiintr (unit); /*
|
|
|
|
* SB MPU401 interrupt
|
|
|
|
*/
|
1994-03-11 10:27:25 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (!(src & 1))
|
1994-10-01 02:17:17 +00:00
|
|
|
return; /*
|
1995-03-04 21:11:21 +00:00
|
|
|
* Not a DSP interrupt
|
1994-10-01 02:17:17 +00:00
|
|
|
*/
|
1994-03-11 10:27:25 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
1994-10-01 02:17:17 +00:00
|
|
|
status = INB (DSP_DATA_AVAIL);/*
|
|
|
|
* Clear interrupt
|
|
|
|
*/
|
1993-10-23 10:55:52 +00:00
|
|
|
|
1994-03-11 10:27:25 +00:00
|
|
|
if (sb_intr_active)
|
|
|
|
switch (sb_irq_mode)
|
1993-10-23 10:55:52 +00:00
|
|
|
{
|
|
|
|
case IMODE_OUTPUT:
|
1994-03-11 10:27:25 +00:00
|
|
|
sb_intr_active = 0;
|
|
|
|
DMAbuf_outputintr (my_dev, 1);
|
1993-10-23 10:55:52 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case IMODE_INPUT:
|
1994-03-11 10:27:25 +00:00
|
|
|
sb_intr_active = 0;
|
1993-10-23 10:55:52 +00:00
|
|
|
DMAbuf_inputintr (my_dev);
|
1994-10-01 02:17:17 +00:00
|
|
|
/*
|
|
|
|
* A complete buffer has been input. Let's start new one
|
|
|
|
*/
|
1993-10-23 10:55:52 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case IMODE_INIT:
|
1994-03-11 10:27:25 +00:00
|
|
|
sb_intr_active = 0;
|
1993-10-23 10:55:52 +00:00
|
|
|
irq_ok = 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case IMODE_MIDI:
|
1994-10-01 02:17:17 +00:00
|
|
|
#ifndef EXCLUDE_MIDI
|
1994-04-23 01:50:14 +00:00
|
|
|
sb_midi_interrupt (unit);
|
1994-10-01 02:17:17 +00:00
|
|
|
#endif
|
1993-10-23 10:55:52 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
printk ("SoundBlaster: Unexpected interrupt\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1994-03-11 10:27:25 +00:00
|
|
|
static int sb_irq_usecount = 0;
|
1993-10-23 10:55:52 +00:00
|
|
|
|
1994-03-11 10:27:25 +00:00
|
|
|
int
|
|
|
|
sb_get_irq (void)
|
|
|
|
{
|
|
|
|
int ok;
|
1993-10-23 10:55:52 +00:00
|
|
|
|
1994-03-11 10:27:25 +00:00
|
|
|
if (!sb_irq_usecount)
|
|
|
|
if ((ok = snd_set_irq_handler (sbc_irq, sbintr)) < 0)
|
|
|
|
return ok;
|
1993-10-23 10:55:52 +00:00
|
|
|
|
1994-03-11 10:27:25 +00:00
|
|
|
sb_irq_usecount++;
|
1993-10-23 10:55:52 +00:00
|
|
|
|
1994-03-11 10:27:25 +00:00
|
|
|
return 0;
|
|
|
|
}
|
1993-10-23 10:55:52 +00:00
|
|
|
|
1994-03-11 10:27:25 +00:00
|
|
|
void
|
|
|
|
sb_free_irq (void)
|
|
|
|
{
|
|
|
|
if (!sb_irq_usecount)
|
|
|
|
return;
|
1993-10-23 10:55:52 +00:00
|
|
|
|
1994-03-11 10:27:25 +00:00
|
|
|
sb_irq_usecount--;
|
1993-10-23 10:55:52 +00:00
|
|
|
|
1994-03-11 10:27:25 +00:00
|
|
|
if (!sb_irq_usecount)
|
|
|
|
snd_release_irq (sbc_irq);
|
1993-10-23 10:55:52 +00:00
|
|
|
}
|
|
|
|
|
1994-03-11 10:27:25 +00:00
|
|
|
int
|
|
|
|
sb_reset_dsp (void)
|
1993-10-23 10:55:52 +00:00
|
|
|
{
|
|
|
|
int loopc;
|
|
|
|
|
|
|
|
OUTB (1, DSP_RESET);
|
|
|
|
tenmicrosec ();
|
|
|
|
OUTB (0, DSP_RESET);
|
|
|
|
tenmicrosec ();
|
|
|
|
tenmicrosec ();
|
|
|
|
tenmicrosec ();
|
|
|
|
|
1994-10-01 02:17:17 +00:00
|
|
|
for (loopc = 0; loopc < 1000 && !(INB (DSP_DATA_AVAIL) & 0x80); loopc++); /*
|
|
|
|
* Wait
|
|
|
|
* for
|
|
|
|
* data
|
|
|
|
* *
|
|
|
|
* available
|
|
|
|
* status
|
|
|
|
*/
|
1993-10-23 10:55:52 +00:00
|
|
|
|
|
|
|
if (INB (DSP_READ) != 0xAA)
|
1994-10-01 02:17:17 +00:00
|
|
|
return 0; /*
|
|
|
|
* Sorry
|
|
|
|
*/
|
1993-10-23 10:55:52 +00:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef EXCLUDE_AUDIO
|
|
|
|
|
|
|
|
static void
|
|
|
|
dsp_speaker (char state)
|
|
|
|
{
|
|
|
|
if (state)
|
1994-03-11 10:27:25 +00:00
|
|
|
sb_dsp_command (DSP_CMD_SPKON);
|
1993-10-23 10:55:52 +00:00
|
|
|
else
|
1994-03-11 10:27:25 +00:00
|
|
|
sb_dsp_command (DSP_CMD_SPKOFF);
|
1993-10-23 10:55:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
dsp_speed (int speed)
|
|
|
|
{
|
|
|
|
unsigned char tconst;
|
|
|
|
unsigned long flags;
|
1994-04-23 01:50:14 +00:00
|
|
|
int max_speed = 44100;
|
1993-10-23 10:55:52 +00:00
|
|
|
|
|
|
|
if (speed < 4000)
|
|
|
|
speed = 4000;
|
|
|
|
|
1994-04-23 01:50:14 +00:00
|
|
|
/*
|
|
|
|
* Older SB models don't support higher speeds than 22050.
|
|
|
|
*/
|
1993-10-23 10:55:52 +00:00
|
|
|
|
1994-04-23 01:50:14 +00:00
|
|
|
if (sbc_major < 2 ||
|
|
|
|
(sbc_major == 2 && sbc_minor == 0))
|
|
|
|
max_speed = 22050;
|
1993-10-23 10:55:52 +00:00
|
|
|
|
1994-04-23 01:50:14 +00:00
|
|
|
/*
|
|
|
|
* SB models earlier than SB Pro have low limit for the input speed.
|
|
|
|
*/
|
|
|
|
if (open_mode != OPEN_WRITE) /* Recording is possible */
|
|
|
|
if (sbc_major < 3) /* Limited input speed with these cards */
|
|
|
|
if (sbc_major == 2 && sbc_minor > 0)
|
|
|
|
max_speed = 15000;
|
|
|
|
else
|
|
|
|
max_speed = 13000;
|
|
|
|
|
|
|
|
if (speed > max_speed)
|
1994-10-01 02:17:17 +00:00
|
|
|
speed = max_speed; /*
|
|
|
|
* Invalid speed
|
|
|
|
*/
|
1993-10-23 10:55:52 +00:00
|
|
|
|
|
|
|
if (dsp_stereo && speed > 22050)
|
|
|
|
speed = 22050;
|
1994-10-01 02:17:17 +00:00
|
|
|
/*
|
|
|
|
* Max. stereo speed is 22050
|
|
|
|
*/
|
1993-10-23 10:55:52 +00:00
|
|
|
|
1994-03-11 10:27:25 +00:00
|
|
|
if ((speed > 22050) && sb_midi_busy)
|
1993-10-23 10:55:52 +00:00
|
|
|
{
|
|
|
|
printk ("SB Warning: High speed DSP not possible simultaneously with MIDI output\n");
|
|
|
|
speed = 22050;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dsp_stereo)
|
1994-03-11 10:27:25 +00:00
|
|
|
speed *= 2;
|
1993-10-23 10:55:52 +00:00
|
|
|
|
1994-10-01 02:17:17 +00:00
|
|
|
/*
|
|
|
|
* Now the speed should be valid
|
|
|
|
*/
|
1993-10-23 10:55:52 +00:00
|
|
|
|
|
|
|
if (speed > 22050)
|
1994-10-01 02:17:17 +00:00
|
|
|
{ /*
|
|
|
|
* High speed mode
|
|
|
|
*/
|
1994-03-11 10:27:25 +00:00
|
|
|
int tmp;
|
|
|
|
|
|
|
|
tconst = (unsigned char) ((65536 -
|
|
|
|
((256000000 + speed / 2) / speed)) >> 8);
|
|
|
|
sb_dsp_highspeed = 1;
|
1993-10-23 10:55:52 +00:00
|
|
|
|
|
|
|
DISABLE_INTR (flags);
|
1994-03-11 10:27:25 +00:00
|
|
|
if (sb_dsp_command (0x40))
|
|
|
|
sb_dsp_command (tconst);
|
1993-10-23 10:55:52 +00:00
|
|
|
RESTORE_INTR (flags);
|
|
|
|
|
1994-03-11 10:27:25 +00:00
|
|
|
tmp = 65536 - (tconst << 8);
|
|
|
|
speed = (256000000 + tmp / 2) / tmp;
|
1993-10-23 10:55:52 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1994-03-11 10:27:25 +00:00
|
|
|
int tmp;
|
|
|
|
|
|
|
|
sb_dsp_highspeed = 0;
|
|
|
|
tconst = (256 - ((1000000 + speed / 2) / speed)) & 0xff;
|
1993-10-23 10:55:52 +00:00
|
|
|
|
|
|
|
DISABLE_INTR (flags);
|
1994-10-01 02:17:17 +00:00
|
|
|
if (sb_dsp_command (0x40))/*
|
|
|
|
* Set time constant
|
|
|
|
*/
|
1994-03-11 10:27:25 +00:00
|
|
|
sb_dsp_command (tconst);
|
1993-10-23 10:55:52 +00:00
|
|
|
RESTORE_INTR (flags);
|
|
|
|
|
1994-03-11 10:27:25 +00:00
|
|
|
tmp = 256 - tconst;
|
|
|
|
speed = (1000000 + tmp / 2) / tmp;
|
1993-10-23 10:55:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (dsp_stereo)
|
1994-03-11 10:27:25 +00:00
|
|
|
speed /= 2;
|
1993-10-23 10:55:52 +00:00
|
|
|
|
|
|
|
dsp_current_speed = speed;
|
1994-03-24 22:23:51 +00:00
|
|
|
return speed;
|
1993-10-23 10:55:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
dsp_set_stereo (int mode)
|
|
|
|
{
|
|
|
|
dsp_stereo = 0;
|
|
|
|
|
1994-03-11 10:27:25 +00:00
|
|
|
#ifdef EXCLUDE_SBPRO
|
|
|
|
return 0;
|
|
|
|
#else
|
1994-04-23 01:50:14 +00:00
|
|
|
if (sbc_major < 3 || sb16)
|
1994-10-01 02:17:17 +00:00
|
|
|
return 0; /*
|
|
|
|
* Sorry no stereo
|
|
|
|
*/
|
1993-10-23 10:55:52 +00:00
|
|
|
|
1994-03-11 10:27:25 +00:00
|
|
|
if (mode && sb_midi_busy)
|
1993-10-23 10:55:52 +00:00
|
|
|
{
|
|
|
|
printk ("SB Warning: Stereo DSP not possible simultaneously with MIDI output\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
dsp_stereo = !!mode;
|
1994-03-11 10:27:25 +00:00
|
|
|
return dsp_stereo;
|
1993-10-23 10:55:52 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1994-03-11 10:27:25 +00:00
|
|
|
sb_dsp_output_block (int dev, unsigned long buf, int count,
|
|
|
|
int intrflag, int restart_dma)
|
1993-10-23 10:55:52 +00:00
|
|
|
{
|
|
|
|
unsigned long flags;
|
|
|
|
|
1994-03-11 10:27:25 +00:00
|
|
|
if (!sb_irq_mode)
|
1993-10-23 10:55:52 +00:00
|
|
|
dsp_speaker (ON);
|
|
|
|
|
1994-03-11 10:27:25 +00:00
|
|
|
sb_irq_mode = IMODE_OUTPUT;
|
1993-10-23 10:55:52 +00:00
|
|
|
DMAbuf_start_dma (dev, buf, count, DMA_MODE_WRITE);
|
|
|
|
|
1994-10-01 02:17:17 +00:00
|
|
|
if (audio_devs[dev]->dmachan > 3)
|
1993-10-23 10:55:52 +00:00
|
|
|
count >>= 1;
|
|
|
|
count--;
|
|
|
|
|
1994-03-11 10:27:25 +00:00
|
|
|
if (sb_dsp_highspeed)
|
1993-10-23 10:55:52 +00:00
|
|
|
{
|
|
|
|
DISABLE_INTR (flags);
|
1994-10-01 02:17:17 +00:00
|
|
|
if (sb_dsp_command (0x48))/*
|
|
|
|
* High speed size
|
|
|
|
*/
|
1993-10-23 10:55:52 +00:00
|
|
|
{
|
1994-03-11 10:27:25 +00:00
|
|
|
sb_dsp_command ((unsigned char) (count & 0xff));
|
|
|
|
sb_dsp_command ((unsigned char) ((count >> 8) & 0xff));
|
1994-10-01 02:17:17 +00:00
|
|
|
sb_dsp_command (0x91);/*
|
|
|
|
* High speed 8 bit DAC
|
|
|
|
*/
|
1993-10-23 10:55:52 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
printk ("SB Error: Unable to start (high speed) DAC\n");
|
|
|
|
RESTORE_INTR (flags);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
DISABLE_INTR (flags);
|
1994-10-01 02:17:17 +00:00
|
|
|
if (sb_dsp_command (0x14))/*
|
|
|
|
* 8-bit DAC (DMA)
|
|
|
|
*/
|
1993-10-23 10:55:52 +00:00
|
|
|
{
|
1994-03-11 10:27:25 +00:00
|
|
|
sb_dsp_command ((unsigned char) (count & 0xff));
|
|
|
|
sb_dsp_command ((unsigned char) ((count >> 8) & 0xff));
|
1993-10-23 10:55:52 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
printk ("SB Error: Unable to start DAC\n");
|
|
|
|
RESTORE_INTR (flags);
|
|
|
|
}
|
1994-03-11 10:27:25 +00:00
|
|
|
sb_intr_active = 1;
|
1993-10-23 10:55:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1994-03-11 10:27:25 +00:00
|
|
|
sb_dsp_start_input (int dev, unsigned long buf, int count, int intrflag,
|
|
|
|
int restart_dma)
|
1993-10-23 10:55:52 +00:00
|
|
|
{
|
1994-10-01 02:17:17 +00:00
|
|
|
/*
|
|
|
|
* Start a DMA input to the buffer pointed by dmaqtail
|
|
|
|
*/
|
1993-10-23 10:55:52 +00:00
|
|
|
|
|
|
|
unsigned long flags;
|
|
|
|
|
1994-03-11 10:27:25 +00:00
|
|
|
if (!sb_irq_mode)
|
1993-10-23 10:55:52 +00:00
|
|
|
dsp_speaker (OFF);
|
|
|
|
|
1994-03-11 10:27:25 +00:00
|
|
|
sb_irq_mode = IMODE_INPUT;
|
1993-10-23 10:55:52 +00:00
|
|
|
DMAbuf_start_dma (dev, buf, count, DMA_MODE_READ);
|
|
|
|
|
1994-10-01 02:17:17 +00:00
|
|
|
if (audio_devs[dev]->dmachan > 3)
|
1993-10-23 10:55:52 +00:00
|
|
|
count >>= 1;
|
|
|
|
count--;
|
|
|
|
|
1994-03-11 10:27:25 +00:00
|
|
|
if (sb_dsp_highspeed)
|
1993-10-23 10:55:52 +00:00
|
|
|
{
|
|
|
|
DISABLE_INTR (flags);
|
1994-10-01 02:17:17 +00:00
|
|
|
if (sb_dsp_command (0x48))/*
|
|
|
|
* High speed size
|
|
|
|
*/
|
1993-10-23 10:55:52 +00:00
|
|
|
{
|
1994-03-11 10:27:25 +00:00
|
|
|
sb_dsp_command ((unsigned char) (count & 0xff));
|
|
|
|
sb_dsp_command ((unsigned char) ((count >> 8) & 0xff));
|
1994-10-01 02:17:17 +00:00
|
|
|
sb_dsp_command (0x99);/*
|
|
|
|
* High speed 8 bit ADC
|
|
|
|
*/
|
1993-10-23 10:55:52 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
printk ("SB Error: Unable to start (high speed) ADC\n");
|
|
|
|
RESTORE_INTR (flags);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
DISABLE_INTR (flags);
|
1994-10-01 02:17:17 +00:00
|
|
|
if (sb_dsp_command (0x24))/*
|
|
|
|
* 8-bit ADC (DMA)
|
|
|
|
*/
|
1993-10-23 10:55:52 +00:00
|
|
|
{
|
1994-03-11 10:27:25 +00:00
|
|
|
sb_dsp_command ((unsigned char) (count & 0xff));
|
|
|
|
sb_dsp_command ((unsigned char) ((count >> 8) & 0xff));
|
1993-10-23 10:55:52 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
printk ("SB Error: Unable to start ADC\n");
|
|
|
|
RESTORE_INTR (flags);
|
|
|
|
}
|
|
|
|
|
1994-03-11 10:27:25 +00:00
|
|
|
sb_intr_active = 1;
|
1993-10-23 10:55:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
dsp_cleanup (void)
|
|
|
|
{
|
1994-03-11 10:27:25 +00:00
|
|
|
sb_intr_active = 0;
|
1993-10-23 10:55:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
sb_dsp_prepare_for_input (int dev, int bsize, int bcount)
|
|
|
|
{
|
|
|
|
dsp_cleanup ();
|
|
|
|
dsp_speaker (OFF);
|
1994-03-11 10:27:25 +00:00
|
|
|
|
1994-10-01 02:17:17 +00:00
|
|
|
if (sbc_major == 3) /*
|
|
|
|
* SB Pro
|
|
|
|
*/
|
1994-03-11 10:27:25 +00:00
|
|
|
{
|
|
|
|
if (dsp_stereo)
|
|
|
|
sb_dsp_command (0xa8);
|
|
|
|
else
|
|
|
|
sb_dsp_command (0xa0);
|
|
|
|
|
1994-10-01 02:17:17 +00:00
|
|
|
dsp_speed (dsp_current_speed); /*
|
|
|
|
* Speed must be recalculated if
|
|
|
|
* #channels * changes
|
|
|
|
*/
|
1994-03-11 10:27:25 +00:00
|
|
|
}
|
1993-10-23 10:55:52 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
sb_dsp_prepare_for_output (int dev, int bsize, int bcount)
|
|
|
|
{
|
|
|
|
dsp_cleanup ();
|
|
|
|
dsp_speaker (ON);
|
1994-03-11 10:27:25 +00:00
|
|
|
|
|
|
|
#ifndef EXCLUDE_SBPRO
|
1994-10-01 02:17:17 +00:00
|
|
|
if (sbc_major == 3) /*
|
|
|
|
* SB Pro
|
|
|
|
*/
|
1994-03-11 10:27:25 +00:00
|
|
|
{
|
|
|
|
sb_mixer_set_stereo (dsp_stereo);
|
1994-10-01 02:17:17 +00:00
|
|
|
dsp_speed (dsp_current_speed); /*
|
|
|
|
* Speed must be recalculated if
|
|
|
|
* #channels * changes
|
|
|
|
*/
|
1994-03-11 10:27:25 +00:00
|
|
|
}
|
|
|
|
#endif
|
1993-10-23 10:55:52 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
sb_dsp_halt_xfer (int dev)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
1994-03-11 10:27:25 +00:00
|
|
|
verify_irq (void)
|
1993-10-23 10:55:52 +00:00
|
|
|
{
|
1994-03-11 10:27:25 +00:00
|
|
|
#if 0
|
|
|
|
DEFINE_WAIT_QUEUE (testq, testf);
|
1993-10-23 10:55:52 +00:00
|
|
|
|
1994-03-11 10:27:25 +00:00
|
|
|
irq_ok = 0;
|
|
|
|
|
|
|
|
if (sb_get_irq () == -1)
|
1993-10-23 10:55:52 +00:00
|
|
|
{
|
1994-03-11 10:27:25 +00:00
|
|
|
printk ("*** SB Error: Irq %d already in use\n", sbc_irq);
|
|
|
|
return 0;
|
1993-10-23 10:55:52 +00:00
|
|
|
}
|
|
|
|
|
1994-03-11 10:27:25 +00:00
|
|
|
|
|
|
|
sb_irq_mode = IMODE_INIT;
|
|
|
|
|
1994-10-01 02:17:17 +00:00
|
|
|
sb_dsp_command (0xf2); /*
|
|
|
|
* This should cause immediate interrupt
|
|
|
|
*/
|
1994-03-11 10:27:25 +00:00
|
|
|
|
|
|
|
DO_SLEEP (testq, testf, HZ / 5);
|
|
|
|
|
|
|
|
sb_free_irq ();
|
|
|
|
|
1993-10-23 10:55:52 +00:00
|
|
|
if (!irq_ok)
|
|
|
|
{
|
1994-03-11 10:27:25 +00:00
|
|
|
printk ("SB Warning: IRQ%d test not passed!", sbc_irq);
|
|
|
|
irq_ok = 1;
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
irq_ok = 1;
|
|
|
|
#endif
|
|
|
|
return irq_ok;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
sb_dsp_open (int dev, int mode)
|
|
|
|
{
|
|
|
|
int retval;
|
|
|
|
|
|
|
|
if (!sb_dsp_ok)
|
|
|
|
{
|
|
|
|
printk ("SB Error: SoundBlaster board not installed\n");
|
1993-10-23 10:55:52 +00:00
|
|
|
return RET_ERROR (ENXIO);
|
|
|
|
}
|
|
|
|
|
1994-03-11 10:27:25 +00:00
|
|
|
if (sb_intr_active || (sb_midi_busy && sb_midi_mode == UART_MIDI))
|
1993-10-23 10:55:52 +00:00
|
|
|
{
|
|
|
|
printk ("SB: PCM not possible during MIDI input\n");
|
|
|
|
return RET_ERROR (EBUSY);
|
|
|
|
}
|
|
|
|
|
1994-03-11 10:27:25 +00:00
|
|
|
if (!irq_verified)
|
1993-10-23 10:55:52 +00:00
|
|
|
{
|
1994-03-11 10:27:25 +00:00
|
|
|
verify_irq ();
|
|
|
|
irq_verified = 1;
|
1993-10-23 10:55:52 +00:00
|
|
|
}
|
1994-03-11 10:27:25 +00:00
|
|
|
else if (!irq_ok)
|
|
|
|
printk ("SB Warning: Incorrect IRQ setting %d\n",
|
|
|
|
sbc_irq);
|
1993-10-23 10:55:52 +00:00
|
|
|
|
1994-03-11 10:27:25 +00:00
|
|
|
retval = sb_get_irq ();
|
1993-10-23 10:55:52 +00:00
|
|
|
if (retval)
|
|
|
|
return retval;
|
|
|
|
|
1994-10-01 02:17:17 +00:00
|
|
|
if (DMAbuf_open_dma (dev) < 0)
|
1993-10-23 10:55:52 +00:00
|
|
|
{
|
1994-03-11 10:27:25 +00:00
|
|
|
sb_free_irq ();
|
1993-10-23 10:55:52 +00:00
|
|
|
printk ("SB: DMA Busy\n");
|
|
|
|
return RET_ERROR (EBUSY);
|
|
|
|
}
|
|
|
|
|
1994-03-11 10:27:25 +00:00
|
|
|
sb_irq_mode = IMODE_NONE;
|
1993-10-23 10:55:52 +00:00
|
|
|
|
1994-03-11 10:27:25 +00:00
|
|
|
sb_dsp_busy = 1;
|
1994-04-23 01:50:14 +00:00
|
|
|
open_mode = mode;
|
1993-10-23 10:55:52 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
sb_dsp_close (int dev)
|
|
|
|
{
|
|
|
|
DMAbuf_close_dma (dev);
|
1994-03-11 10:27:25 +00:00
|
|
|
sb_free_irq ();
|
1993-10-23 10:55:52 +00:00
|
|
|
dsp_cleanup ();
|
|
|
|
dsp_speaker (OFF);
|
1994-03-11 10:27:25 +00:00
|
|
|
sb_dsp_busy = 0;
|
|
|
|
sb_dsp_highspeed = 0;
|
1994-04-23 01:50:14 +00:00
|
|
|
open_mode = 0;
|
1993-10-23 10:55:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
sb_dsp_ioctl (int dev, unsigned int cmd, unsigned int arg, int local)
|
|
|
|
{
|
|
|
|
switch (cmd)
|
|
|
|
{
|
|
|
|
case SOUND_PCM_WRITE_RATE:
|
|
|
|
if (local)
|
|
|
|
return dsp_speed (arg);
|
|
|
|
return IOCTL_OUT (arg, dsp_speed (IOCTL_IN (arg)));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SOUND_PCM_READ_RATE:
|
|
|
|
if (local)
|
1994-03-24 22:23:51 +00:00
|
|
|
return dsp_current_speed;
|
|
|
|
return IOCTL_OUT (arg, dsp_current_speed);
|
1993-10-23 10:55:52 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SOUND_PCM_WRITE_CHANNELS:
|
1994-03-11 10:27:25 +00:00
|
|
|
if (local)
|
|
|
|
return dsp_set_stereo (arg - 1) + 1;
|
1993-10-23 10:55:52 +00:00
|
|
|
return IOCTL_OUT (arg, dsp_set_stereo (IOCTL_IN (arg) - 1) + 1);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SOUND_PCM_READ_CHANNELS:
|
|
|
|
if (local)
|
|
|
|
return dsp_stereo + 1;
|
|
|
|
return IOCTL_OUT (arg, dsp_stereo + 1);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SNDCTL_DSP_STEREO:
|
|
|
|
if (local)
|
|
|
|
return dsp_set_stereo (arg);
|
|
|
|
return IOCTL_OUT (arg, dsp_set_stereo (IOCTL_IN (arg)));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SOUND_PCM_WRITE_BITS:
|
|
|
|
case SOUND_PCM_READ_BITS:
|
|
|
|
if (local)
|
|
|
|
return 8;
|
1994-10-01 02:17:17 +00:00
|
|
|
return IOCTL_OUT (arg, 8);/*
|
|
|
|
* Only 8 bits/sample supported
|
|
|
|
*/
|
1993-10-23 10:55:52 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SOUND_PCM_WRITE_FILTER:
|
|
|
|
case SOUND_PCM_READ_FILTER:
|
|
|
|
return RET_ERROR (EINVAL);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return RET_ERROR (EINVAL);
|
|
|
|
}
|
|
|
|
|
|
|
|
return RET_ERROR (EINVAL);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
sb_dsp_reset (int dev)
|
|
|
|
{
|
|
|
|
unsigned long flags;
|
|
|
|
|
|
|
|
DISABLE_INTR (flags);
|
|
|
|
|
1994-03-11 10:27:25 +00:00
|
|
|
sb_reset_dsp ();
|
1994-04-23 01:50:14 +00:00
|
|
|
dsp_speed (dsp_current_speed);
|
1993-10-23 10:55:52 +00:00
|
|
|
dsp_cleanup ();
|
|
|
|
|
|
|
|
RESTORE_INTR (flags);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
int
|
|
|
|
sb_dsp_detect (struct address_info *hw_config)
|
|
|
|
{
|
|
|
|
sbc_base = hw_config->io_base;
|
|
|
|
sbc_irq = hw_config->irq;
|
|
|
|
|
|
|
|
if (sb_dsp_ok)
|
1994-10-01 02:17:17 +00:00
|
|
|
return 0; /*
|
|
|
|
* Already initialized
|
|
|
|
*/
|
1993-10-23 10:55:52 +00:00
|
|
|
|
1994-03-11 10:27:25 +00:00
|
|
|
if (!sb_reset_dsp ())
|
1993-10-23 10:55:52 +00:00
|
|
|
return 0;
|
|
|
|
|
1994-10-01 02:17:17 +00:00
|
|
|
return 1; /*
|
|
|
|
* Detected
|
|
|
|
*/
|
1993-10-23 10:55:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifndef EXCLUDE_AUDIO
|
1994-04-23 01:50:14 +00:00
|
|
|
static struct audio_operations sb_dsp_operations =
|
1993-10-23 10:55:52 +00:00
|
|
|
{
|
1995-03-05 22:11:57 +00:00
|
|
|
"SoundBlaster ",
|
1994-04-23 01:50:14 +00:00
|
|
|
NOTHING_SPECIAL,
|
1994-10-01 02:17:17 +00:00
|
|
|
AFMT_U8, /* Just 8 bits. Poor old SB */
|
|
|
|
NULL,
|
1993-10-23 10:55:52 +00:00
|
|
|
sb_dsp_open,
|
|
|
|
sb_dsp_close,
|
|
|
|
sb_dsp_output_block,
|
|
|
|
sb_dsp_start_input,
|
|
|
|
sb_dsp_ioctl,
|
|
|
|
sb_dsp_prepare_for_input,
|
|
|
|
sb_dsp_prepare_for_output,
|
|
|
|
sb_dsp_reset,
|
|
|
|
sb_dsp_halt_xfer,
|
1994-10-01 02:17:17 +00:00
|
|
|
NULL, /* local_qlen */
|
1993-10-23 10:55:52 +00:00
|
|
|
NULL /* copy_from_user */
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
long
|
|
|
|
sb_dsp_init (long mem_start, struct address_info *hw_config)
|
|
|
|
{
|
1994-03-11 10:27:25 +00:00
|
|
|
int i;
|
1994-10-01 02:17:17 +00:00
|
|
|
int mixer_type = 0;
|
1993-10-23 10:55:52 +00:00
|
|
|
|
1994-04-23 01:50:14 +00:00
|
|
|
sbc_major = sbc_minor = 0;
|
1994-10-01 02:17:17 +00:00
|
|
|
sb_dsp_command (0xe1); /*
|
|
|
|
* Get version
|
|
|
|
*/
|
1993-10-23 10:55:52 +00:00
|
|
|
|
|
|
|
for (i = 1000; i; i--)
|
|
|
|
{
|
1994-03-11 10:27:25 +00:00
|
|
|
if (INB (DSP_DATA_AVAIL) & 0x80)
|
1994-10-01 02:17:17 +00:00
|
|
|
{ /*
|
|
|
|
* wait for Data Ready
|
|
|
|
*/
|
1994-04-23 01:50:14 +00:00
|
|
|
if (sbc_major == 0)
|
|
|
|
sbc_major = INB (DSP_READ);
|
1993-10-23 10:55:52 +00:00
|
|
|
else
|
|
|
|
{
|
1994-04-23 01:50:14 +00:00
|
|
|
sbc_minor = INB (DSP_READ);
|
1993-10-23 10:55:52 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
1994-03-11 10:27:25 +00:00
|
|
|
|
1994-10-01 02:17:17 +00:00
|
|
|
if (sbc_major == 2 || sbc_major == 3)
|
1994-03-11 10:27:25 +00:00
|
|
|
sb_duplex_midi = 1;
|
|
|
|
|
1994-04-23 01:50:14 +00:00
|
|
|
if (sbc_major == 4)
|
1994-03-11 10:27:25 +00:00
|
|
|
sb16 = 1;
|
|
|
|
|
1993-10-23 10:55:52 +00:00
|
|
|
#ifndef EXCLUDE_SBPRO
|
1994-10-01 02:17:17 +00:00
|
|
|
if (sbc_major >= 3)
|
|
|
|
mixer_type = sb_mixer_init (sbc_major);
|
1994-03-11 10:27:25 +00:00
|
|
|
#endif
|
1993-10-23 10:55:52 +00:00
|
|
|
|
1994-12-10 22:55:50 +00:00
|
|
|
#ifndef EXCLUDE_YM3812
|
1994-10-01 02:17:17 +00:00
|
|
|
|
1994-04-23 01:50:14 +00:00
|
|
|
if (sbc_major > 3 ||
|
1994-10-01 02:17:17 +00:00
|
|
|
(sbc_major == 3 && INB (0x388) == 0x00)) /* Should be 0x06 if not OPL-3 */
|
1994-04-23 01:50:14 +00:00
|
|
|
enable_opl3_mode (OPL3_LEFT, OPL3_RIGHT, OPL3_BOTH);
|
1994-03-11 10:27:25 +00:00
|
|
|
#endif
|
1993-10-23 10:55:52 +00:00
|
|
|
|
1994-04-23 01:50:14 +00:00
|
|
|
if (sbc_major >= 3)
|
1994-03-11 10:27:25 +00:00
|
|
|
{
|
1995-03-04 21:11:21 +00:00
|
|
|
#if !defined(SCO) && !defined(EXCLUDE_AUDIO)
|
1994-10-01 02:17:17 +00:00
|
|
|
# ifdef __SGNXPRO__
|
|
|
|
if (mixer_type == 2)
|
1994-04-23 01:50:14 +00:00
|
|
|
{
|
|
|
|
sprintf (sb_dsp_operations.name, "Sound Galaxy NX Pro %d.%d", sbc_major, sbc_minor);
|
|
|
|
}
|
|
|
|
else
|
1994-10-01 02:17:17 +00:00
|
|
|
# endif
|
1994-04-23 01:50:14 +00:00
|
|
|
{
|
|
|
|
sprintf (sb_dsp_operations.name, "SoundBlaster Pro %d.%d", sbc_major, sbc_minor);
|
|
|
|
}
|
1993-10-23 10:55:52 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
else
|
1994-03-11 10:27:25 +00:00
|
|
|
{
|
1994-04-23 01:50:14 +00:00
|
|
|
#ifndef SCO
|
|
|
|
sprintf (sb_dsp_operations.name, "SoundBlaster %d.%d", sbc_major, sbc_minor);
|
1994-04-03 22:16:38 +00:00
|
|
|
#endif
|
1994-04-23 01:50:14 +00:00
|
|
|
}
|
1993-10-23 10:55:52 +00:00
|
|
|
|
1995-03-05 22:11:57 +00:00
|
|
|
#ifdef __FreeBSD__
|
|
|
|
printk ("snd2: <%s>", sb_dsp_operations.name);
|
|
|
|
#else
|
1994-10-01 02:17:17 +00:00
|
|
|
printk (" <%s>", sb_dsp_operations.name);
|
1995-03-05 22:11:57 +00:00
|
|
|
#endif
|
1993-10-23 10:55:52 +00:00
|
|
|
|
|
|
|
#ifndef EXCLUDE_AUDIO
|
1994-03-11 10:27:25 +00:00
|
|
|
#if !defined(EXCLUDE_SB16) && !defined(EXCLUDE_SBPRO)
|
1994-10-01 02:17:17 +00:00
|
|
|
if (!sb16) /*
|
|
|
|
* There is a better driver for SB16
|
|
|
|
*/
|
1994-03-11 10:27:25 +00:00
|
|
|
#endif
|
1994-10-01 02:17:17 +00:00
|
|
|
if (num_audiodevs < MAX_AUDIO_DEV)
|
1994-03-11 10:27:25 +00:00
|
|
|
{
|
1994-10-01 02:17:17 +00:00
|
|
|
audio_devs[my_dev = num_audiodevs++] = &sb_dsp_operations;
|
|
|
|
audio_devs[my_dev]->buffcount = DSP_BUFFCOUNT;
|
|
|
|
audio_devs[my_dev]->buffsize = DSP_BUFFSIZE;
|
|
|
|
audio_devs[my_dev]->dmachan = hw_config->dma;
|
1994-03-11 10:27:25 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
printk ("SB: Too many DSP devices available\n");
|
1993-10-23 10:55:52 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef EXCLUDE_MIDI
|
1994-10-01 02:17:17 +00:00
|
|
|
if (!midi_disabled && !sb16) /*
|
|
|
|
* Midi don't work in the SB emulation mode *
|
|
|
|
* of PAS, SB16 has better midi interface
|
|
|
|
*/
|
1994-04-23 01:50:14 +00:00
|
|
|
sb_midi_init (sbc_major);
|
1993-10-23 10:55:52 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
sb_dsp_ok = 1;
|
|
|
|
return mem_start;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
sb_dsp_disable_midi (void)
|
|
|
|
{
|
|
|
|
midi_disabled = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|