4 * The low level driver for the SoundBlaster DSP chip (SB1.0 to 2.1, SB Pro).
6 * Copyright by Hannu Savolainen 1994
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are
10 * met: 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 2.
12 * Redistributions in binary form must reproduce the above copyright notice,
13 * this list of conditions and the following disclaimer in the documentation
14 * and/or other materials provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
20 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * Modified: Hunyue Yau Jan 6 1994 Added code to support Sound Galaxy NX
31 * JRA Gibson April 1995 Code added for MV ProSonic/Jazz 16 in 16 bit mode
33 * $FreeBSD: src/sys/i386/isa/sound/sb_dsp.c,v 1.42 1999/12/27 04:37:19 tanimura Exp $
34 * $DragonFly: src/sys/dev/sound/isa/i386/sb/Attic/sb_dsp.c,v 1.2 2003/06/17 04:28:38 dillon Exp $
37 #include <i386/isa/sound/sound_config.h>
45 #include <i386/isa/sound/sbcard.h>
46 #include <i386/isa/sound/sb_mixer.h>
47 #include <machine/clock.h>
52 * XXX note -- only one sb-like device is supported until these
53 * variables are put in a struct sb_unit[] array
59 static int sbc_irq = 0;
60 static int open_mode = 0; /* Read, write or both */
61 int Jazz16_detected = 0;
62 int sb_no_recording = 0;
63 static int dsp_count = 0;
64 static int trigger_bits;
67 * The DSP channel can be used either for input or output. Variable
68 * 'sb_irq_mode' will be set when the program calls read or write first time
69 * after open. Current version doesn't support mode changes without closing
70 * and reopening the device. Support for this feature may be implemented in a
71 * future version of this driver.
74 int sb_dsp_ok = 0; /* Set to 1 after successful init */
75 static int midi_disabled = 0;
76 int sb_dsp_highspeed = 0;
77 int sbc_major = 1, sbc_minor = 0; /* DSP version */
78 static int dsp_stereo = 0;
79 static int dsp_current_speed = DSP_DEFAULT_SPEED;
82 int sb_midi_mode = NORMAL_MIDI;
83 int sb_midi_busy = 0; /* 1 if the process has output to * *
87 volatile int sb_irq_mode = IMODE_NONE; /* or IMODE_INPUT or IMODE_OUTPUT */
91 #ifdef JAZZ16 /* 16 bit support for JAZZ16 */
93 static int dsp_16bit = 0;
96 static int dsp_set_bits(int arg);
97 static int initialize_ProSonic16(void);
98 #endif /* end of 16 bit support for JAZZ16 */
100 int sb_duplex_midi = 0;
101 static int my_dev = 0;
103 volatile int sb_intr_active = 0;
105 static int dsp_speed(int);
106 static int dsp_set_stereo(int mode);
107 static void sb_dsp_reset(int dev);
108 sound_os_info *sb_osp = NULL;
110 #if defined(CONFIG_MIDI) || defined(CONFIG_AUDIO)
111 static void dsp_speaker(char state);
114 * Common code for the midi and pcm functions
118 sb_dsp_command(u_char val)
123 limit = get_time() + hz / 10; /* The timeout is 0.1 secods */
126 * Note! the i<500000 is an emergency exit. The sb_dsp_command() is
127 * sometimes called while interrupts are disabled. This means that
128 * the timer is disabled also. However the timeout situation is a
129 * abnormal condition. Normally the DSP should be ready to accept
130 * commands after just couple of loops.
133 for (i = 0; i < 500000 && get_time() < limit; i++) {
134 if ((inb(DSP_STATUS) & 0x80) == 0) {
135 outb(DSP_COMMAND, val);
140 printf("SoundBlaster: DSP Command(0x%02x) timeout. IRQ conflict ?\n", val);
151 u_char src = sb_getmixer(IRQ_STAT); /* Interrupt source register */
154 sb16_dsp_interrupt(irq);
157 sb16midiintr(irq); /* SB MPU401 interrupt */
158 #endif /* CONFIG_MIDI */
159 #endif /* CONFIG_SB16 */
161 return; /* Not a DSP interupt */
163 #endif /* CONFIG_SBPRO */
165 status = inb(DSP_DATA_AVAIL); /* Clear interrupt */
168 switch (sb_irq_mode) {
171 DMAbuf_outputintr(my_dev, 1);
176 DMAbuf_inputintr(my_dev);
178 * A complete buffer has been input. Let's start new one
188 sb_midi_interrupt(irq);
193 printf("SoundBlaster: Unexpected interrupt\n");
209 for (loopc = 0; loopc < 100 && !(inb(DSP_DATA_AVAIL) & 0x80); loopc++)
212 if (inb(DSP_READ) != 0xAA) {
213 printf("sb_reset_dsp failed\n");
214 return 0; /* Sorry */
225 dsp_speaker(char state)
228 sb_dsp_command(DSP_CMD_SPKON);
230 sb_dsp_command(DSP_CMD_SPKOFF);
238 int max_speed = 44100;
244 * Older SB models don't support higher speeds than 22050.
247 if (sbc_major < 2 || (sbc_major == 2 && sbc_minor == 0))
251 * SB models earlier than SB Pro have low limit for the input speed.
253 if (open_mode != OPEN_WRITE) { /* Recording is possible */
254 if (sbc_major < 3) { /* Limited input speed with these cards */
255 if (sbc_major == 2 && sbc_minor > 0)
261 if (speed > max_speed)
262 speed = max_speed; /* Invalid speed */
265 * Logitech SoundMan Games and Jazz16 cards can support 44.1kHz
268 #if !defined (SM_GAMES)
270 * Max. stereo speed is 22050
272 if (dsp_stereo && speed > 22050 && Jazz16_detected == 0)
276 if ((speed > 22050) && sb_midi_busy) {
277 printf("SB Warning: High speed DSP not possible simultaneously with MIDI output\n");
284 * Now the speed should be valid
287 if (speed > 22050) { /* High speed mode */
290 tconst = (u_char) ((65536 - ((256000000 + speed / 2) / speed)) >> 8);
291 sb_dsp_highspeed = 1;
294 if (sb_dsp_command(DSP_CMD_TCONST))
295 sb_dsp_command(tconst);
298 tmp = 65536 - (tconst << 8);
299 speed = (256000000 + tmp / 2) / tmp;
303 sb_dsp_highspeed = 0;
304 tconst = (256 - ((1000000 + speed / 2) / speed)) & 0xff;
307 if (sb_dsp_command(DSP_CMD_TCONST)) /* Set time constant */
308 sb_dsp_command(tconst);
312 speed = (1000000 + tmp / 2) / tmp;
318 dsp_current_speed = speed;
323 dsp_set_stereo(int mode)
330 if (sbc_major < 3 || sb16)
331 return 0; /* Sorry no stereo */
333 if (mode && sb_midi_busy) {
334 printf("SB Warning: Stereo DSP not possible simultaneously with MIDI output\n");
343 sb_dsp_output_block(int dev, u_long buf, int count,
344 int intrflag, int restart_dma)
351 DMAbuf_start_dma(dev, buf, count, 1);
355 if (audio_devs[dev]->dmachan1 > 3)
360 sb_irq_mode = IMODE_OUTPUT;
361 if (sb_dsp_highspeed) {
363 if (sb_dsp_command(DSP_CMD_HSSIZE)) { /* High speed size */
364 sb_dsp_command((u_char) (dsp_count & 0xff));
365 sb_dsp_command((u_char) ((dsp_count >> 8) & 0xff));
366 sb_dsp_command(DSP_CMD_HSDAC); /* High speed 8 bit DAC */
368 printf("SB Error: Unable to start (high speed) DAC\n");
372 if (sb_dsp_command(DSP_CMD_DAC8)) { /* 8-bit DAC (DMA) */
373 sb_dsp_command((u_char) (dsp_count & 0xff));
374 sb_dsp_command((u_char) ((dsp_count >> 8) & 0xff));
376 printf("SB Error: Unable to start DAC\n");
383 sb_dsp_start_input(int dev, u_long buf, int count, int intrflag,
388 if (sb_no_recording) {
389 printf("SB Error: This device doesn't support recording\n");
393 * Start a DMA input to the buffer pointed by dmaqtail
399 DMAbuf_start_dma(dev, buf, count, 0);
402 if (audio_devs[dev]->dmachan1 > 3)
407 sb_irq_mode = IMODE_INPUT;
408 if (sb_dsp_highspeed) {
410 if (sb_dsp_command(DSP_CMD_HSSIZE)) { /* High speed size */
411 sb_dsp_command((u_char) (dsp_count & 0xff));
412 sb_dsp_command((u_char) ((dsp_count >> 8) & 0xff));
413 sb_dsp_command(DSP_CMD_HSADC); /* High speed 8 bit ADC */
415 printf("SB Error: Unable to start (high speed) ADC\n");
419 if (sb_dsp_command(DSP_CMD_ADC8)) { /* 8-bit ADC (DMA) */
420 sb_dsp_command((u_char) (dsp_count & 0xff));
421 sb_dsp_command((u_char) ((dsp_count >> 8) & 0xff));
423 printf("SB Error: Unable to start ADC\n");
431 sb_dsp_trigger(int dev, int bits)
433 if (bits == trigger_bits)
437 sb_dsp_command(0xd0); /* Halt DMA */
438 else if (bits & sb_irq_mode)
439 sb_dsp_command(0xd4); /* Continue DMA */
451 sb_dsp_prepare_for_input(int dev, int bsize, int bcount)
454 struct dma_buffparms *dmap = audio_devs[dev]->dmap_in;
459 if (sbc_major == 3) { /* SB Pro */
462 * Select correct dma channel for 16/8 bit acccess
464 audio_devs[my_dev]->dmachan1 = dsp_16bit ? dma16 : dma8;
466 sb_dsp_command(dsp_16bit ? 0xac : 0xa8);
468 sb_dsp_command(dsp_16bit ? 0xa4 : 0xa0);
471 * 8 bit only cards use this
474 sb_dsp_command(0xa8);
476 sb_dsp_command(0xa0);
478 dsp_speed(dsp_current_speed); /* Speed must be recalculated
479 * if #channels * changes */
482 fudge = audio_devs[my_dev]->dmachan1;
483 if (dmap->dma_chan != fudge ) {
484 isa_dma_release( dmap->dma_chan);
485 isa_dma_acquire(fudge);
486 dmap->dma_chan = fudge;
490 sb_dsp_command(DSP_CMD_DMAHALT); /* Halt DMA */
495 sb_dsp_prepare_for_output(int dev, int bsize, int bcount)
499 struct dma_buffparms *dmap = audio_devs[dev]->dmap_out;
505 if (sbc_major == 3) { /* SB Pro */
508 * 16 bit specific instructions
510 audio_devs[my_dev]->dmachan1 = dsp_16bit ? dma16 : dma8;
512 if (Jazz16_detected != 2) /* SM Wave */
513 sb_mixer_set_stereo(dsp_stereo);
515 sb_dsp_command(dsp_16bit ? 0xac : 0xa8);
517 sb_dsp_command(dsp_16bit ? 0xa4 : 0xa0);
519 sb_mixer_set_stereo(dsp_stereo);
521 dsp_speed(dsp_current_speed); /* Speed must be recalculated
522 * if #channels * changes */
525 fudge = audio_devs[my_dev]->dmachan1;
527 if (dmap->dma_chan != fudge ) {
528 isa_dma_release( dmap->dma_chan);
529 isa_dma_acquire(fudge);
530 dmap->dma_chan = fudge;
534 sb_dsp_command(DSP_CMD_DMAHALT); /* Halt DMA */
539 sb_dsp_halt_xfer(int dev)
544 sb_dsp_open(int dev, int mode)
547 printf("SB Error: SoundBlaster board not installed\n");
550 if (sb_no_recording && mode & OPEN_READ) {
551 printf("SB Warning: Recording not supported by this device\n");
553 if (sb_intr_active || (sb_midi_busy && sb_midi_mode == UART_MIDI)) {
554 printf("SB: PCM not possible during MIDI input\n");
561 audio_devs[my_dev]->dmachan1 = dma8;
563 * Allocate 16 bit dma
565 if (Jazz16_detected != 0)
573 sb_irq_mode = IMODE_NONE;
583 sb_dsp_close(int dev)
587 * Release 16 bit dma channel
589 if (Jazz16_detected) {
590 audio_devs[my_dev]->dmachan1 = dma8;
598 sb_dsp_highspeed = 0;
605 * Function dsp_set_bits() only required for 16 bit cards
608 dsp_set_bits(int arg)
611 if (Jazz16_detected == 0)
624 return dsp_16bit ? 16 : 8;
627 #endif /* ifdef JAZZ16 */
630 sb_dsp_ioctl(int dev, u_int cmd, ioctl_arg arg, int local)
633 case SOUND_PCM_WRITE_RATE:
635 return dsp_speed((int) arg);
636 return *(int *) arg = dsp_speed((*(int *) arg));
639 case SOUND_PCM_READ_RATE:
641 return dsp_current_speed;
642 return *(int *) arg = dsp_current_speed;
645 case SOUND_PCM_WRITE_CHANNELS:
647 return dsp_set_stereo((int) arg - 1) + 1;
648 return *(int *) arg = dsp_set_stereo((*(int *) arg) - 1) + 1;
651 case SOUND_PCM_READ_CHANNELS:
653 return dsp_stereo + 1;
654 return *(int *) arg = dsp_stereo + 1;
657 case SNDCTL_DSP_STEREO:
659 return dsp_set_stereo((int) arg);
660 return *(int *) arg = dsp_set_stereo((*(int *) arg));
665 * Word size specific cases here.
666 * SNDCTL_DSP_SETFMT=SOUND_PCM_WRITE_BITS
668 case SNDCTL_DSP_SETFMT:
670 return dsp_set_bits((int) arg);
671 return *(int *) arg = dsp_set_bits((*(int *) arg));
674 case SOUND_PCM_READ_BITS:
676 return dsp_16bit ? 16 : 8;
677 return *(int *) arg = dsp_16bit ? 16 : 8;
680 case SOUND_PCM_WRITE_BITS:
681 case SOUND_PCM_READ_BITS:
684 return *(int *) (int) arg = 8; /* Only 8 bits/sample supported */
686 #endif /* ifdef JAZZ16 */
688 case SOUND_PCM_WRITE_FILTER:
689 case SOUND_PCM_READ_FILTER:
700 sb_dsp_reset(int dev)
707 dsp_speed(dsp_current_speed);
719 * Initialization of a Media Vision ProSonic 16 Soundcard. The function
720 * initializes a ProSonic 16 like PROS.EXE does for DOS. It sets the base
721 * address, the DMA-channels, interrupts and enables the joystickport.
723 * Also used by Jazz 16 (same card, different name)
725 * written 1994 by Rainer Vranken E-Mail:
726 * rvranken@polaris.informatik.uni-essen.de
734 for (i = 1000; i; i--)
735 if (inb(DSP_DATA_AVAIL) & 0x80) {
736 return inb(DSP_READ);
743 * Logitech Soundman Wave detection and initialization by Hannu Savolainen.
745 * There is a microcontroller (8031) in the SM Wave card for MIDI emulation.
746 * it's located at address MPU_BASE+4. MPU_BASE+7 is a SM Wave specific
747 * control register for MC reset, SCSI, OPL4 and DSP (future expansion)
748 * address decoding. Otherwise the SM Wave is just a ordinary MV Jazz16 based
753 smw_putmem(int base, int addr, u_char val)
759 outb(base + 1, addr & 0xff); /* Low address bits */
760 outb(base + 2, addr >> 8); /* High address bits */
761 outb(base, val); /* Data */
767 smw_getmem(int base, int addr)
774 outb(base + 1, addr & 0xff); /* Low address bits */
775 outb(base + 2, addr >> 8); /* High address bits */
776 val = inb(base); /* Data */
782 #ifdef SMW_MIDI0001_INCLUDED
783 #include </sys/i386/isa/sound/smw-midi0001.h>
785 u_char *smw_ucode = NULL;
786 int smw_ucodeLen = 0;
791 initialize_smw(int mpu_base)
794 int mp_base = mpu_base + 4; /* Microcontroller base */
800 * Reset the microcontroller so that the RAM can be accessed
803 control = inb(mpu_base + 7);
804 outb(mpu_base + 7, control | 3); /* Set last two bits to 1 (?) */
805 outb(mpu_base + 7, (control & 0xfe) | 2); /* xxxxxxx0 resets the mc */
806 DELAY(3000); /* Wait at least 1ms */
808 outb(mpu_base + 7, control & 0xfc); /* xxxxxx00 enables RAM */
811 * Detect microcontroller by probing the 8k RAM area
813 smw_putmem(mp_base, 0, 0x00);
814 smw_putmem(mp_base, 1, 0xff);
817 if (smw_getmem(mp_base, 0) != 0x00 || smw_getmem(mp_base, 1) != 0xff) {
818 printf("\nSM Wave: No microcontroller RAM detected (%02x, %02x)\n",
819 smw_getmem(mp_base, 0), smw_getmem(mp_base, 1));
820 return 0; /* No RAM */
823 * There is RAM so assume it's really a SM Wave
826 if (smw_ucodeLen > 0) {
827 if (smw_ucodeLen != 8192) {
828 printf("\nSM Wave: Invalid microcode (MIDI0001.BIN) length\n");
835 for (i = 0; i < 8192; i++)
836 smw_putmem(mp_base, i, smw_ucode[i]);
842 for (i = 0; i < 8192; i++)
843 if (smw_getmem(mp_base, i) != smw_ucode[i]) {
844 printf("SM Wave: Microcode verification failed\n");
851 * Set the SCSI interrupt (IRQ2/9, IRQ3 or IRQ10). The SCSI interrupt
852 * is disabled by default.
854 * Btw the Zilog 5380 SCSI controller is located at MPU base + 0x10.
857 static u_char scsi_irq_bits[] =
858 {0, 0, 3, 1, 0, 0, 0, 0, 0, 3, 2, 0, 0, 0, 0, 0};
860 control |= scsi_irq_bits[SMW_SCSI_IRQ] << 6;
864 #ifdef SMW_OPL4_ENABLE
866 * Make the OPL4 chip visible on the PC bus at 0x380.
868 * There is no need to enable this feature since VoxWare doesn't support
869 * OPL4 yet. Also there is no RAM in SM Wave so enabling OPL4 is
872 control |= 0x10; /* Uses IRQ12 if bit 0x20 == 0 */
873 /* control |= 0x20; Uncomment this if you want to use IRQ7 */
876 outb(mpu_base + 7, control | 0x03); /* xxxxxx11 restarts */
883 initialize_ProSonic16(void)
886 static u_char int_translat[16] =
887 {0, 0, 2, 3, 0, 1, 0, 4, 0, 2, 5, 0, 0, 0, 0, 6},
889 {0, 1, 0, 2, 0, 3, 0, 4};
891 struct address_info *mpu_config;
893 int mpu_base, mpu_irq;
895 if ((mpu_config = sound_getconf(SNDCARD_MPU401))) {
896 mpu_base = mpu_config->io_base;
897 mpu_irq = mpu_config->irq;
899 mpu_base = mpu_irq = 0;
902 outb(0x201, 0xAF); /* ProSonic/Jazz16 wakeup */
903 DELAY(15000); /* wait at least 10 milliseconds */
905 outb(0x201, (sbc_base & 0x70) | ((mpu_base & 0x30) >> 4));
907 if (sb_reset_dsp()) { /* OK. We have at least a SB */
909 /* Check the version number of ProSonic (I guess) */
911 if (!sb_dsp_command(0xFA))
913 if (get_sb_byte() != 0x12)
916 if (sb_dsp_command(0xFB) && /* set DMA-channels and Interrupts */
917 sb_dsp_command((dma_translat[JAZZ_DMA16]<<4)|dma_translat[dma8]) &&
918 sb_dsp_command((int_translat[mpu_irq]<<4)|int_translat[sbc_irq])) {
921 printf("Jazz16: No MPU401 devices configured - MIDI port not initialized\n");
925 if (initialize_smw(mpu_base))
928 sb_dsp_disable_midi();
930 return 1; /* There was at least a SB */
932 return 0; /* No SB or ProSonic16 detected */
935 #endif /* ifdef JAZZ16 */
938 sb_dsp_detect(struct address_info * hw_config)
940 sbc_base = hw_config->io_base;
941 sbc_irq = hw_config->irq;
942 sb_osp = hw_config->osp;
946 return 0; /* Already initialized */
947 dma8 = hw_config->dma;
952 if (!initialize_ProSonic16())
961 sb_setmixer (IRQ_NR, 1);
964 sb_setmixer (IRQ_NR, 8);
967 sb_setmixer (IRQ_NR, 2);
970 switch (hw_config->dma) {
972 sb_setmixer (DMA_NR, 1);
975 sb_setmixer (DMA_NR, 2);
980 return 1; /* Detected */
984 static struct audio_operations sb_dsp_operations =
988 AFMT_U8, /* Just 8 bits. Poor old SB */
995 sb_dsp_prepare_for_input,
996 sb_dsp_prepare_for_output,
999 NULL, /* local_qlen */
1000 NULL, /* copy_from_user */
1009 sb_dsp_init(struct address_info * hw_config)
1019 sb_osp = hw_config->osp;
1020 sbc_major = sbc_minor = 0;
1021 sb_dsp_command(DSP_CMD_GETVER); /* Get version */
1023 for (i = 10000; i; i--) { /* perhaps wait longer on a fast machine ? */
1024 if (inb(DSP_DATA_AVAIL) & 0x80) { /* wait for Data Ready */
1026 sbc_major = inb(DSP_READ);
1028 sbc_minor = inb(DSP_READ);
1035 if (sbc_major == 0) {
1036 printf("\n\nFailed to get SB version (%x) - possible I/O conflict\n\n",
1037 inb(DSP_DATA_AVAIL));
1040 if (sbc_major == 2 || sbc_major == 3)
1046 if (sbc_major == 3 && sbc_minor == 1) {
1047 int ess_major = 0, ess_minor = 0;
1050 * Try to detect ESS chips.
1053 sb_dsp_command(DSP_CMD_GETID); /* Return identification bytes. */
1055 for (i = 1000; i; i--) {
1056 if (inb(DSP_DATA_AVAIL) & 0x80) { /* wait for Data Ready */
1058 ess_major = inb(DSP_READ);
1060 ess_minor = inb(DSP_READ);
1066 if (ess_major == 0x48 && (ess_minor & 0xf0) == 0x80)
1067 printf("Hmm... Could this be an ESS488 based card (rev %d)\n",
1069 else if (ess_major == 0x68 && (ess_minor & 0xf0) == 0x80)
1070 printf("Hmm... Could this be an ESS688 based card (rev %d)\n",
1073 if (snd_set_irq_handler(sbc_irq, sbintr, sb_osp) < 0)
1074 printf("sb_dsp: Can't allocate IRQ\n");;
1078 mixer_type = sb_mixer_init(sbc_major);
1081 printf("\nNOTE! SB Pro support required with your soundcard!\n");
1086 if (sbc_major >= 3) {
1087 if (Jazz16_detected) {
1088 if (Jazz16_detected == 2)
1089 fmt = "SoundMan Wave %d.%d";
1091 fmt = "MV Jazz16 %d.%d";
1092 sb_dsp_operations.format_mask |= AFMT_S16_LE; /* 16 bits */
1095 if (mixer_type == 2)
1096 fmt = "Sound Galaxy NX Pro %d.%d" ;
1098 #endif /* __SGNXPRO__ */
1100 fmt = "SoundBlaster 16 %d.%d";
1102 fmt = "SoundBlaster Pro %d.%d";
1104 fmt = "SoundBlaster %d.%d" ;
1107 snprintf(sb_dsp_operations.name, sizeof(sb_dsp_operations.name),
1108 fmt, sbc_major, sbc_minor);
1109 conf_printf(sb_dsp_operations.name, hw_config);
1111 #if defined(CONFIG_SB16) && defined(CONFIG_SBPRO)
1112 if (!sb16) { /* There is a better driver for SB16 */
1113 #endif /* CONFIG_SB16 && CONFIG_SBPRO */
1114 if (num_audiodevs < MAX_AUDIO_DEV) {
1115 audio_devs[my_dev = num_audiodevs++] = &sb_dsp_operations;
1116 audio_devs[my_dev]->buffsize = DSP_BUFFSIZE;
1117 dma8 = audio_devs[my_dev]->dmachan1 = hw_config->dma;
1118 audio_devs[my_dev]->dmachan2 = -1;
1121 * Allocate 16 bit dma
1123 if (Jazz16_detected != 0)
1124 if (dma16 != dma8) {
1126 printf("Jazz16: Can't allocate 16 bit DMA channel\n");
1131 printf("SB: Too many DSP devices available\n");
1132 #if defined(CONFIG_SB16) && defined(CONFIG_SBPRO)
1134 #endif /* CONFIG_SB16 && CONFIG_SBPRO */
1136 conf_printf("SoundBlaster (configured without audio support)", hw_config);
1140 if (!midi_disabled && !sb16) {
1142 * Midi don't work in the SB emulation mode of PAS,
1143 * SB16 has better midi interface
1145 sb_midi_init(sbc_major);
1147 #endif /* CONFIG_MIDI */
1152 sb_dsp_disable_midi(void)