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 $
36 #include <i386/isa/sound/sound_config.h>
44 #include <i386/isa/sound/sbcard.h>
45 #include <i386/isa/sound/sb_mixer.h>
46 #include <machine/clock.h>
51 * XXX note -- only one sb-like device is supported until these
52 * variables are put in a struct sb_unit[] array
58 static int sbc_irq = 0;
59 static int open_mode = 0; /* Read, write or both */
60 int Jazz16_detected = 0;
61 int sb_no_recording = 0;
62 static int dsp_count = 0;
63 static int trigger_bits;
66 * The DSP channel can be used either for input or output. Variable
67 * 'sb_irq_mode' will be set when the program calls read or write first time
68 * after open. Current version doesn't support mode changes without closing
69 * and reopening the device. Support for this feature may be implemented in a
70 * future version of this driver.
73 int sb_dsp_ok = 0; /* Set to 1 after successful init */
74 static int midi_disabled = 0;
75 int sb_dsp_highspeed = 0;
76 int sbc_major = 1, sbc_minor = 0; /* DSP version */
77 static int dsp_stereo = 0;
78 static int dsp_current_speed = DSP_DEFAULT_SPEED;
81 int sb_midi_mode = NORMAL_MIDI;
82 int sb_midi_busy = 0; /* 1 if the process has output to * *
86 volatile int sb_irq_mode = IMODE_NONE; /* or IMODE_INPUT or IMODE_OUTPUT */
90 #ifdef JAZZ16 /* 16 bit support for JAZZ16 */
92 static int dsp_16bit = 0;
95 static int dsp_set_bits(int arg);
96 static int initialize_ProSonic16(void);
97 #endif /* end of 16 bit support for JAZZ16 */
99 int sb_duplex_midi = 0;
100 static int my_dev = 0;
102 volatile int sb_intr_active = 0;
104 static int dsp_speed(int);
105 static int dsp_set_stereo(int mode);
106 static void sb_dsp_reset(int dev);
107 sound_os_info *sb_osp = NULL;
109 #if defined(CONFIG_MIDI) || defined(CONFIG_AUDIO)
110 static void dsp_speaker(char state);
113 * Common code for the midi and pcm functions
117 sb_dsp_command(u_char val)
122 limit = get_time() + hz / 10; /* The timeout is 0.1 secods */
125 * Note! the i<500000 is an emergency exit. The sb_dsp_command() is
126 * sometimes called while interrupts are disabled. This means that
127 * the timer is disabled also. However the timeout situation is a
128 * abnormal condition. Normally the DSP should be ready to accept
129 * commands after just couple of loops.
132 for (i = 0; i < 500000 && get_time() < limit; i++) {
133 if ((inb(DSP_STATUS) & 0x80) == 0) {
134 outb(DSP_COMMAND, val);
139 printf("SoundBlaster: DSP Command(0x%02x) timeout. IRQ conflict ?\n", val);
150 u_char src = sb_getmixer(IRQ_STAT); /* Interrupt source register */
153 sb16_dsp_interrupt(irq);
156 sb16midiintr(irq); /* SB MPU401 interrupt */
157 #endif /* CONFIG_MIDI */
158 #endif /* CONFIG_SB16 */
160 return; /* Not a DSP interupt */
162 #endif /* CONFIG_SBPRO */
164 status = inb(DSP_DATA_AVAIL); /* Clear interrupt */
167 switch (sb_irq_mode) {
170 DMAbuf_outputintr(my_dev, 1);
175 DMAbuf_inputintr(my_dev);
177 * A complete buffer has been input. Let's start new one
187 sb_midi_interrupt(irq);
192 printf("SoundBlaster: Unexpected interrupt\n");
208 for (loopc = 0; loopc < 100 && !(inb(DSP_DATA_AVAIL) & 0x80); loopc++)
211 if (inb(DSP_READ) != 0xAA) {
212 printf("sb_reset_dsp failed\n");
213 return 0; /* Sorry */
224 dsp_speaker(char state)
227 sb_dsp_command(DSP_CMD_SPKON);
229 sb_dsp_command(DSP_CMD_SPKOFF);
237 int max_speed = 44100;
243 * Older SB models don't support higher speeds than 22050.
246 if (sbc_major < 2 || (sbc_major == 2 && sbc_minor == 0))
250 * SB models earlier than SB Pro have low limit for the input speed.
252 if (open_mode != OPEN_WRITE) { /* Recording is possible */
253 if (sbc_major < 3) { /* Limited input speed with these cards */
254 if (sbc_major == 2 && sbc_minor > 0)
260 if (speed > max_speed)
261 speed = max_speed; /* Invalid speed */
264 * Logitech SoundMan Games and Jazz16 cards can support 44.1kHz
267 #if !defined (SM_GAMES)
269 * Max. stereo speed is 22050
271 if (dsp_stereo && speed > 22050 && Jazz16_detected == 0)
275 if ((speed > 22050) && sb_midi_busy) {
276 printf("SB Warning: High speed DSP not possible simultaneously with MIDI output\n");
283 * Now the speed should be valid
286 if (speed > 22050) { /* High speed mode */
289 tconst = (u_char) ((65536 - ((256000000 + speed / 2) / speed)) >> 8);
290 sb_dsp_highspeed = 1;
293 if (sb_dsp_command(DSP_CMD_TCONST))
294 sb_dsp_command(tconst);
297 tmp = 65536 - (tconst << 8);
298 speed = (256000000 + tmp / 2) / tmp;
302 sb_dsp_highspeed = 0;
303 tconst = (256 - ((1000000 + speed / 2) / speed)) & 0xff;
306 if (sb_dsp_command(DSP_CMD_TCONST)) /* Set time constant */
307 sb_dsp_command(tconst);
311 speed = (1000000 + tmp / 2) / tmp;
317 dsp_current_speed = speed;
322 dsp_set_stereo(int mode)
329 if (sbc_major < 3 || sb16)
330 return 0; /* Sorry no stereo */
332 if (mode && sb_midi_busy) {
333 printf("SB Warning: Stereo DSP not possible simultaneously with MIDI output\n");
342 sb_dsp_output_block(int dev, u_long buf, int count,
343 int intrflag, int restart_dma)
350 DMAbuf_start_dma(dev, buf, count, 1);
354 if (audio_devs[dev]->dmachan1 > 3)
359 sb_irq_mode = IMODE_OUTPUT;
360 if (sb_dsp_highspeed) {
362 if (sb_dsp_command(DSP_CMD_HSSIZE)) { /* High speed size */
363 sb_dsp_command((u_char) (dsp_count & 0xff));
364 sb_dsp_command((u_char) ((dsp_count >> 8) & 0xff));
365 sb_dsp_command(DSP_CMD_HSDAC); /* High speed 8 bit DAC */
367 printf("SB Error: Unable to start (high speed) DAC\n");
371 if (sb_dsp_command(DSP_CMD_DAC8)) { /* 8-bit DAC (DMA) */
372 sb_dsp_command((u_char) (dsp_count & 0xff));
373 sb_dsp_command((u_char) ((dsp_count >> 8) & 0xff));
375 printf("SB Error: Unable to start DAC\n");
382 sb_dsp_start_input(int dev, u_long buf, int count, int intrflag,
387 if (sb_no_recording) {
388 printf("SB Error: This device doesn't support recording\n");
392 * Start a DMA input to the buffer pointed by dmaqtail
398 DMAbuf_start_dma(dev, buf, count, 0);
401 if (audio_devs[dev]->dmachan1 > 3)
406 sb_irq_mode = IMODE_INPUT;
407 if (sb_dsp_highspeed) {
409 if (sb_dsp_command(DSP_CMD_HSSIZE)) { /* High speed size */
410 sb_dsp_command((u_char) (dsp_count & 0xff));
411 sb_dsp_command((u_char) ((dsp_count >> 8) & 0xff));
412 sb_dsp_command(DSP_CMD_HSADC); /* High speed 8 bit ADC */
414 printf("SB Error: Unable to start (high speed) ADC\n");
418 if (sb_dsp_command(DSP_CMD_ADC8)) { /* 8-bit ADC (DMA) */
419 sb_dsp_command((u_char) (dsp_count & 0xff));
420 sb_dsp_command((u_char) ((dsp_count >> 8) & 0xff));
422 printf("SB Error: Unable to start ADC\n");
430 sb_dsp_trigger(int dev, int bits)
432 if (bits == trigger_bits)
436 sb_dsp_command(0xd0); /* Halt DMA */
437 else if (bits & sb_irq_mode)
438 sb_dsp_command(0xd4); /* Continue DMA */
450 sb_dsp_prepare_for_input(int dev, int bsize, int bcount)
453 struct dma_buffparms *dmap = audio_devs[dev]->dmap_in;
458 if (sbc_major == 3) { /* SB Pro */
461 * Select correct dma channel for 16/8 bit acccess
463 audio_devs[my_dev]->dmachan1 = dsp_16bit ? dma16 : dma8;
465 sb_dsp_command(dsp_16bit ? 0xac : 0xa8);
467 sb_dsp_command(dsp_16bit ? 0xa4 : 0xa0);
470 * 8 bit only cards use this
473 sb_dsp_command(0xa8);
475 sb_dsp_command(0xa0);
477 dsp_speed(dsp_current_speed); /* Speed must be recalculated
478 * if #channels * changes */
481 fudge = audio_devs[my_dev]->dmachan1;
482 if (dmap->dma_chan != fudge ) {
483 isa_dma_release( dmap->dma_chan);
484 isa_dma_acquire(fudge);
485 dmap->dma_chan = fudge;
489 sb_dsp_command(DSP_CMD_DMAHALT); /* Halt DMA */
494 sb_dsp_prepare_for_output(int dev, int bsize, int bcount)
498 struct dma_buffparms *dmap = audio_devs[dev]->dmap_out;
504 if (sbc_major == 3) { /* SB Pro */
507 * 16 bit specific instructions
509 audio_devs[my_dev]->dmachan1 = dsp_16bit ? dma16 : dma8;
511 if (Jazz16_detected != 2) /* SM Wave */
512 sb_mixer_set_stereo(dsp_stereo);
514 sb_dsp_command(dsp_16bit ? 0xac : 0xa8);
516 sb_dsp_command(dsp_16bit ? 0xa4 : 0xa0);
518 sb_mixer_set_stereo(dsp_stereo);
520 dsp_speed(dsp_current_speed); /* Speed must be recalculated
521 * if #channels * changes */
524 fudge = audio_devs[my_dev]->dmachan1;
526 if (dmap->dma_chan != fudge ) {
527 isa_dma_release( dmap->dma_chan);
528 isa_dma_acquire(fudge);
529 dmap->dma_chan = fudge;
533 sb_dsp_command(DSP_CMD_DMAHALT); /* Halt DMA */
538 sb_dsp_halt_xfer(int dev)
543 sb_dsp_open(int dev, int mode)
546 printf("SB Error: SoundBlaster board not installed\n");
549 if (sb_no_recording && mode & OPEN_READ) {
550 printf("SB Warning: Recording not supported by this device\n");
552 if (sb_intr_active || (sb_midi_busy && sb_midi_mode == UART_MIDI)) {
553 printf("SB: PCM not possible during MIDI input\n");
560 audio_devs[my_dev]->dmachan1 = dma8;
562 * Allocate 16 bit dma
564 if (Jazz16_detected != 0)
572 sb_irq_mode = IMODE_NONE;
582 sb_dsp_close(int dev)
586 * Release 16 bit dma channel
588 if (Jazz16_detected) {
589 audio_devs[my_dev]->dmachan1 = dma8;
597 sb_dsp_highspeed = 0;
604 * Function dsp_set_bits() only required for 16 bit cards
607 dsp_set_bits(int arg)
610 if (Jazz16_detected == 0)
623 return dsp_16bit ? 16 : 8;
626 #endif /* ifdef JAZZ16 */
629 sb_dsp_ioctl(int dev, u_int cmd, ioctl_arg arg, int local)
632 case SOUND_PCM_WRITE_RATE:
634 return dsp_speed((int) arg);
635 return *(int *) arg = dsp_speed((*(int *) arg));
638 case SOUND_PCM_READ_RATE:
640 return dsp_current_speed;
641 return *(int *) arg = dsp_current_speed;
644 case SOUND_PCM_WRITE_CHANNELS:
646 return dsp_set_stereo((int) arg - 1) + 1;
647 return *(int *) arg = dsp_set_stereo((*(int *) arg) - 1) + 1;
650 case SOUND_PCM_READ_CHANNELS:
652 return dsp_stereo + 1;
653 return *(int *) arg = dsp_stereo + 1;
656 case SNDCTL_DSP_STEREO:
658 return dsp_set_stereo((int) arg);
659 return *(int *) arg = dsp_set_stereo((*(int *) arg));
664 * Word size specific cases here.
665 * SNDCTL_DSP_SETFMT=SOUND_PCM_WRITE_BITS
667 case SNDCTL_DSP_SETFMT:
669 return dsp_set_bits((int) arg);
670 return *(int *) arg = dsp_set_bits((*(int *) arg));
673 case SOUND_PCM_READ_BITS:
675 return dsp_16bit ? 16 : 8;
676 return *(int *) arg = dsp_16bit ? 16 : 8;
679 case SOUND_PCM_WRITE_BITS:
680 case SOUND_PCM_READ_BITS:
683 return *(int *) (int) arg = 8; /* Only 8 bits/sample supported */
685 #endif /* ifdef JAZZ16 */
687 case SOUND_PCM_WRITE_FILTER:
688 case SOUND_PCM_READ_FILTER:
699 sb_dsp_reset(int dev)
706 dsp_speed(dsp_current_speed);
718 * Initialization of a Media Vision ProSonic 16 Soundcard. The function
719 * initializes a ProSonic 16 like PROS.EXE does for DOS. It sets the base
720 * address, the DMA-channels, interrupts and enables the joystickport.
722 * Also used by Jazz 16 (same card, different name)
724 * written 1994 by Rainer Vranken E-Mail:
725 * rvranken@polaris.informatik.uni-essen.de
733 for (i = 1000; i; i--)
734 if (inb(DSP_DATA_AVAIL) & 0x80) {
735 return inb(DSP_READ);
742 * Logitech Soundman Wave detection and initialization by Hannu Savolainen.
744 * There is a microcontroller (8031) in the SM Wave card for MIDI emulation.
745 * it's located at address MPU_BASE+4. MPU_BASE+7 is a SM Wave specific
746 * control register for MC reset, SCSI, OPL4 and DSP (future expansion)
747 * address decoding. Otherwise the SM Wave is just a ordinary MV Jazz16 based
752 smw_putmem(int base, int addr, u_char val)
758 outb(base + 1, addr & 0xff); /* Low address bits */
759 outb(base + 2, addr >> 8); /* High address bits */
760 outb(base, val); /* Data */
766 smw_getmem(int base, int addr)
773 outb(base + 1, addr & 0xff); /* Low address bits */
774 outb(base + 2, addr >> 8); /* High address bits */
775 val = inb(base); /* Data */
781 #ifdef SMW_MIDI0001_INCLUDED
782 #include </sys/i386/isa/sound/smw-midi0001.h>
784 u_char *smw_ucode = NULL;
785 int smw_ucodeLen = 0;
790 initialize_smw(int mpu_base)
793 int mp_base = mpu_base + 4; /* Microcontroller base */
799 * Reset the microcontroller so that the RAM can be accessed
802 control = inb(mpu_base + 7);
803 outb(mpu_base + 7, control | 3); /* Set last two bits to 1 (?) */
804 outb(mpu_base + 7, (control & 0xfe) | 2); /* xxxxxxx0 resets the mc */
805 DELAY(3000); /* Wait at least 1ms */
807 outb(mpu_base + 7, control & 0xfc); /* xxxxxx00 enables RAM */
810 * Detect microcontroller by probing the 8k RAM area
812 smw_putmem(mp_base, 0, 0x00);
813 smw_putmem(mp_base, 1, 0xff);
816 if (smw_getmem(mp_base, 0) != 0x00 || smw_getmem(mp_base, 1) != 0xff) {
817 printf("\nSM Wave: No microcontroller RAM detected (%02x, %02x)\n",
818 smw_getmem(mp_base, 0), smw_getmem(mp_base, 1));
819 return 0; /* No RAM */
822 * There is RAM so assume it's really a SM Wave
825 if (smw_ucodeLen > 0) {
826 if (smw_ucodeLen != 8192) {
827 printf("\nSM Wave: Invalid microcode (MIDI0001.BIN) length\n");
834 for (i = 0; i < 8192; i++)
835 smw_putmem(mp_base, i, smw_ucode[i]);
841 for (i = 0; i < 8192; i++)
842 if (smw_getmem(mp_base, i) != smw_ucode[i]) {
843 printf("SM Wave: Microcode verification failed\n");
850 * Set the SCSI interrupt (IRQ2/9, IRQ3 or IRQ10). The SCSI interrupt
851 * is disabled by default.
853 * Btw the Zilog 5380 SCSI controller is located at MPU base + 0x10.
856 static u_char scsi_irq_bits[] =
857 {0, 0, 3, 1, 0, 0, 0, 0, 0, 3, 2, 0, 0, 0, 0, 0};
859 control |= scsi_irq_bits[SMW_SCSI_IRQ] << 6;
863 #ifdef SMW_OPL4_ENABLE
865 * Make the OPL4 chip visible on the PC bus at 0x380.
867 * There is no need to enable this feature since VoxWare doesn't support
868 * OPL4 yet. Also there is no RAM in SM Wave so enabling OPL4 is
871 control |= 0x10; /* Uses IRQ12 if bit 0x20 == 0 */
872 /* control |= 0x20; Uncomment this if you want to use IRQ7 */
875 outb(mpu_base + 7, control | 0x03); /* xxxxxx11 restarts */
882 initialize_ProSonic16(void)
885 static u_char int_translat[16] =
886 {0, 0, 2, 3, 0, 1, 0, 4, 0, 2, 5, 0, 0, 0, 0, 6},
888 {0, 1, 0, 2, 0, 3, 0, 4};
890 struct address_info *mpu_config;
892 int mpu_base, mpu_irq;
894 if ((mpu_config = sound_getconf(SNDCARD_MPU401))) {
895 mpu_base = mpu_config->io_base;
896 mpu_irq = mpu_config->irq;
898 mpu_base = mpu_irq = 0;
901 outb(0x201, 0xAF); /* ProSonic/Jazz16 wakeup */
902 DELAY(15000); /* wait at least 10 milliseconds */
904 outb(0x201, (sbc_base & 0x70) | ((mpu_base & 0x30) >> 4));
906 if (sb_reset_dsp()) { /* OK. We have at least a SB */
908 /* Check the version number of ProSonic (I guess) */
910 if (!sb_dsp_command(0xFA))
912 if (get_sb_byte() != 0x12)
915 if (sb_dsp_command(0xFB) && /* set DMA-channels and Interrupts */
916 sb_dsp_command((dma_translat[JAZZ_DMA16]<<4)|dma_translat[dma8]) &&
917 sb_dsp_command((int_translat[mpu_irq]<<4)|int_translat[sbc_irq])) {
920 printf("Jazz16: No MPU401 devices configured - MIDI port not initialized\n");
924 if (initialize_smw(mpu_base))
927 sb_dsp_disable_midi();
929 return 1; /* There was at least a SB */
931 return 0; /* No SB or ProSonic16 detected */
934 #endif /* ifdef JAZZ16 */
937 sb_dsp_detect(struct address_info * hw_config)
939 sbc_base = hw_config->io_base;
940 sbc_irq = hw_config->irq;
941 sb_osp = hw_config->osp;
945 return 0; /* Already initialized */
946 dma8 = hw_config->dma;
951 if (!initialize_ProSonic16())
960 sb_setmixer (IRQ_NR, 1);
963 sb_setmixer (IRQ_NR, 8);
966 sb_setmixer (IRQ_NR, 2);
969 switch (hw_config->dma) {
971 sb_setmixer (DMA_NR, 1);
974 sb_setmixer (DMA_NR, 2);
979 return 1; /* Detected */
983 static struct audio_operations sb_dsp_operations =
987 AFMT_U8, /* Just 8 bits. Poor old SB */
994 sb_dsp_prepare_for_input,
995 sb_dsp_prepare_for_output,
998 NULL, /* local_qlen */
999 NULL, /* copy_from_user */
1008 sb_dsp_init(struct address_info * hw_config)
1018 sb_osp = hw_config->osp;
1019 sbc_major = sbc_minor = 0;
1020 sb_dsp_command(DSP_CMD_GETVER); /* Get version */
1022 for (i = 10000; i; i--) { /* perhaps wait longer on a fast machine ? */
1023 if (inb(DSP_DATA_AVAIL) & 0x80) { /* wait for Data Ready */
1025 sbc_major = inb(DSP_READ);
1027 sbc_minor = inb(DSP_READ);
1034 if (sbc_major == 0) {
1035 printf("\n\nFailed to get SB version (%x) - possible I/O conflict\n\n",
1036 inb(DSP_DATA_AVAIL));
1039 if (sbc_major == 2 || sbc_major == 3)
1045 if (sbc_major == 3 && sbc_minor == 1) {
1046 int ess_major = 0, ess_minor = 0;
1049 * Try to detect ESS chips.
1052 sb_dsp_command(DSP_CMD_GETID); /* Return identification bytes. */
1054 for (i = 1000; i; i--) {
1055 if (inb(DSP_DATA_AVAIL) & 0x80) { /* wait for Data Ready */
1057 ess_major = inb(DSP_READ);
1059 ess_minor = inb(DSP_READ);
1065 if (ess_major == 0x48 && (ess_minor & 0xf0) == 0x80)
1066 printf("Hmm... Could this be an ESS488 based card (rev %d)\n",
1068 else if (ess_major == 0x68 && (ess_minor & 0xf0) == 0x80)
1069 printf("Hmm... Could this be an ESS688 based card (rev %d)\n",
1072 if (snd_set_irq_handler(sbc_irq, sbintr, sb_osp) < 0)
1073 printf("sb_dsp: Can't allocate IRQ\n");;
1077 mixer_type = sb_mixer_init(sbc_major);
1080 printf("\nNOTE! SB Pro support required with your soundcard!\n");
1085 if (sbc_major >= 3) {
1086 if (Jazz16_detected) {
1087 if (Jazz16_detected == 2)
1088 fmt = "SoundMan Wave %d.%d";
1090 fmt = "MV Jazz16 %d.%d";
1091 sb_dsp_operations.format_mask |= AFMT_S16_LE; /* 16 bits */
1094 if (mixer_type == 2)
1095 fmt = "Sound Galaxy NX Pro %d.%d" ;
1097 #endif /* __SGNXPRO__ */
1099 fmt = "SoundBlaster 16 %d.%d";
1101 fmt = "SoundBlaster Pro %d.%d";
1103 fmt = "SoundBlaster %d.%d" ;
1106 snprintf(sb_dsp_operations.name, sizeof(sb_dsp_operations.name),
1107 fmt, sbc_major, sbc_minor);
1108 conf_printf(sb_dsp_operations.name, hw_config);
1110 #if defined(CONFIG_SB16) && defined(CONFIG_SBPRO)
1111 if (!sb16) { /* There is a better driver for SB16 */
1112 #endif /* CONFIG_SB16 && CONFIG_SBPRO */
1113 if (num_audiodevs < MAX_AUDIO_DEV) {
1114 audio_devs[my_dev = num_audiodevs++] = &sb_dsp_operations;
1115 audio_devs[my_dev]->buffsize = DSP_BUFFSIZE;
1116 dma8 = audio_devs[my_dev]->dmachan1 = hw_config->dma;
1117 audio_devs[my_dev]->dmachan2 = -1;
1120 * Allocate 16 bit dma
1122 if (Jazz16_detected != 0)
1123 if (dma16 != dma8) {
1125 printf("Jazz16: Can't allocate 16 bit DMA channel\n");
1130 printf("SB: Too many DSP devices available\n");
1131 #if defined(CONFIG_SB16) && defined(CONFIG_SBPRO)
1133 #endif /* CONFIG_SB16 && CONFIG_SBPRO */
1135 conf_printf("SoundBlaster (configured without audio support)", hw_config);
1139 if (!midi_disabled && !sb16) {
1141 * Midi don't work in the SB emulation mode of PAS,
1142 * SB16 has better midi interface
1144 sb_midi_init(sbc_major);
1146 #endif /* CONFIG_MIDI */
1151 sb_dsp_disable_midi(void)