From 4fb1d90a9574b35a16be16886727444776ddb8ad Mon Sep 17 00:00:00 2001 From: "Jordan K. Hubbard" Date: Fri, 1 Sep 1995 19:09:11 +0000 Subject: [PATCH] Jim's attempt to fix the new sound code somewhat. Tested with the pas-16, GUS, and GUS-MAX cards. Sound blaster owners, please test also! Submitted by: Jim Lowe --- sys/i386/isa/sound/ad1848.c | 4 +-- sys/i386/isa/sound/dmabuf.c | 4 ++- sys/i386/isa/sound/local.h | 2 +- sys/i386/isa/sound/pas2_pcm.c | 4 +++ sys/i386/isa/sound/sb16_dsp.c | 4 +++ sys/i386/isa/sound/sound.doc | 57 ++++++++++++++++++++++++---------- sys/i386/isa/sound/soundcard.c | 23 ++++++++++++-- 7 files changed, 75 insertions(+), 23 deletions(-) diff --git a/sys/i386/isa/sound/ad1848.c b/sys/i386/isa/sound/ad1848.c index 3aa02ed8db99..c76a3575dce2 100644 --- a/sys/i386/isa/sound/ad1848.c +++ b/sys/i386/isa/sound/ad1848.c @@ -475,7 +475,7 @@ static struct audio_operations ad1848_pcm_operations[MAX_AUDIO_DEV] = { "Generic AD1848 codec", #if defined(__FreeBSD__) - NEEDS_RESTART, + NEEDS_RESTART,/* disable automode for now until we get this working right */ #else DMA_AUTOMODE, #endif @@ -1196,7 +1196,7 @@ ad1848_init (char *name, int io_base, int irq, int dma_playback, int dma_capture "Generic audio codec (%s)", devc->chip_name); #if defined(__FreeBSD__) - printk ("gus0: <%s>\n", ad1848_pcm_operations[nr_ad1848_devs].name); + printk ("\ngus0: <%s>", ad1848_pcm_operations[nr_ad1848_devs].name); #else printk (" <%s>", ad1848_pcm_operations[nr_ad1848_devs].name); #endif diff --git a/sys/i386/isa/sound/dmabuf.c b/sys/i386/isa/sound/dmabuf.c index 52e29e3b9b8a..f696de7d3bae 100644 --- a/sys/i386/isa/sound/dmabuf.c +++ b/sys/i386/isa/sound/dmabuf.c @@ -702,7 +702,7 @@ DMAbuf_start_dma (int dev, unsigned long physaddr, int count, int dma_mode) #if defined(__FreeBSD__) - isa_dmastart (B_RAW + (dma_mode == DMA_MODE_READ) ? B_READ : B_WRITE, + isa_dmastart (B_RAW | ((dma_mode == DMA_MODE_READ) ? B_READ : B_WRITE), (caddr_t)dmap->raw_buf_phys[0], dmap->bytes_in_use, chan); @@ -870,7 +870,9 @@ DMAbuf_inputintr (int dev) if (dmap->qlen == (dmap->nbufs - 1)) { +#if !defined(__FreeBSD__) /* ignore console message. */ printk ("Sound: Recording overrun\n"); +#endif dmap->underrun_count++; audio_devs[dev]->halt_xfer (dev); dmap->flags &= ~DMA_ACTIVE; diff --git a/sys/i386/isa/sound/local.h b/sys/i386/isa/sound/local.h index b45b0ac81099..23d09dd35b08 100644 --- a/sys/i386/isa/sound/local.h +++ b/sys/i386/isa/sound/local.h @@ -48,7 +48,7 @@ #define EXCLUDE_SSCAPE #endif -#if !defined(GUSMAX) && !defined(EXCLUDE_GUSMAX) +#if NGUS == 0 && !defined(EXCLUDE_GUSMAX) # define EXCLUDE_GUSMAX # if defined(EXCLUDE_GUS16) && defined(EXCLUDE_MSS) && !defined(EXCLUDE_AD1848) # define EXCLUDE_AD1848 diff --git a/sys/i386/isa/sound/pas2_pcm.c b/sys/i386/isa/sound/pas2_pcm.c index 26fc94172d36..46b4055584e8 100644 --- a/sys/i386/isa/sound/pas2_pcm.c +++ b/sys/i386/isa/sound/pas2_pcm.c @@ -373,7 +373,11 @@ pas_pcm_prepare_for_output (int dev, int bsize, int bcount) static struct audio_operations pas_pcm_operations = { "Pro Audio Spectrum", +#if defined(__FreeBSD__) + 0, /* disable automode for now until we get this working right */ +#else DMA_AUTOMODE, +#endif AFMT_U8 | AFMT_S16_LE, NULL, pas_pcm_open, diff --git a/sys/i386/isa/sound/sb16_dsp.c b/sys/i386/isa/sound/sb16_dsp.c index d093efb7e5ea..9d483af8c1c9 100644 --- a/sys/i386/isa/sound/sb16_dsp.c +++ b/sys/i386/isa/sound/sb16_dsp.c @@ -84,7 +84,11 @@ static void dsp_cleanup (void); static struct audio_operations sb16_dsp_operations = { "SoundBlaster 16", +#if defined(__FreeBSD__) + 0, /* disable automode for now until we get this working right */ +#else DMA_AUTOMODE, +#endif AFMT_U8 | AFMT_S16_LE, NULL, sb16_dsp_open, diff --git a/sys/i386/isa/sound/sound.doc b/sys/i386/isa/sound/sound.doc index 6eb177c1c9aa..60343105751c 100644 --- a/sys/i386/isa/sound/sound.doc +++ b/sys/i386/isa/sound/sound.doc @@ -1,4 +1,4 @@ -$Id: sound.doc,v 1.2 1995/03/12 23:34:06 swallace Exp $ +$Id: sound.doc,v 1.3 1995/03/13 18:49:37 swallace Exp $ Instructions on using audio on a FreeBSD 2.1 (or 2.0-current) system. See also /sys/i386/conf/LINT. @@ -13,6 +13,9 @@ controller snd0 Uncomment one or more of these device entries, depending on what type of sound card you have: +# ProAudioSpectrum PCM and Midi - for PAS +#device pas0 at isa? port 0x388 irq 10 drq 6 vector pasintr + # SoundBlaster DSP driver - for SB, SB Pro, SB16, PAS(emulating SB) #device sb0 at isa? port 0x220 irq 7 drq 1 vector sbintr @@ -22,19 +25,13 @@ sound card you have: # SoundBlaster 16 MIDI - for SB16 - requires sb0 device #device sbmidi0 at isa? port 0x300 -# ProAudioSpectrum PCM and Midi - for PAS -#device pas0 at isa? port 0x388 irq 10 drq 6 vector pasintr - # Gravis UltraSound - for GUS, GUS16, GUSMAX -#device gus0 at isa? port 0x220 irq 11 drq 1 vector gusintr +#device gus0 at isa? port 0x220 irq 11 drq 1 flags 0x3 vector gusintr # Gravis UltraSound 16 bit option - for GUS16 - requires gus0 #device gusxvi0 at isa? port 0x530 irq 7 drq 3 vector adintr -# Gravis UltraSound MAX - for GUSMAX - requires gus0 -#device gusmax0 at isa? port 0x32c - -# MS Sound System +# MS Sound System (AD1848 Based Boards) #device mss0 at isa? port 0x530 irq 10 drq 1 vector adintr # Yamaha OPL-2/OPL-3 FM - for SB, SB Pro, SB16, PAS @@ -58,6 +55,38 @@ is NOT recommended unless you really know what you're doing. #options EXCLUDE_GUS_IODETECT # NO GUS io detection #options EXCLUDE_PRO_MIDI # NO PAS MIDI support +Other Options: + +#options SYMPHONY_PAS + Adds some code to make pas work with Symphony chipsets. Only use + this if your pas doesn't work and you have a Symphony chipset. + +#options BROKEN_BUS_CLOCK + Some systems with the OPTI chipset and a PAS will require you to + use this option. Symptoms are that you will hear a lot of clicking and + popping sounds, like a geiger counter, coming out of the PAS even when + it is not playing anything. + +#options MOZART_PORT + Adds support for Mozart (OAK OTI-601). (Part of the MSS driver) + +#options OPTI_MAD16_PORT + Adds support for the OPTI MAD16 Chip. (Part of the MSS driver) + +#options __SGNXPRO__ + Adds support for the SG NX Pro mixer. (Part of the SB driver) + +#options JAZZ16 + Adds support for the MV Jazz16 (ProSonic etc). (Part of the SB Driver) + +#options SM_WAVE + Adds support for the SoundMan Wave (Part of the SB Driver) + Note: You will need to do some work to get this to work. + See i386/isa/sound/configure.c + +#options SM_GAMES + Adds support for the Logitech SoundMan Games (Part of the SB Driver) + NOTE: The MPU-401 driver may or may not work, and is unfortunately unverifiable since no one I know has one. If you can test this, please let me know! Also note that you will have to change these @@ -66,21 +95,17 @@ Please check your documentation (or verify with any provided DOS utilities that may have come with your card) and set the IRQ or address fields accordingly. -Also: Some systems with the OPTI chipset will require you to #define -BROKEN_BUS_CLOCK in /sys/i386/sound/pas2_card.c. Symptoms are that -you will hear a lot of clicking and popping sounds, like a geiger counter, -coming out of the PAS even when is not playing anything. Also: You can configure more then one card on a single DMA using -ALLOW_CONFLICT_DMA. +ALLOW_CONFLICT_DMA. This is useful for boards with more then one type of +emulation. + Probing problems: Since the SB16 uses the same IRQ and addresses for the different drivers, some of the snd dirvers will not be probed because the kernel thinks there is a conflict. This can be worked-around by setting the ALLOW_CONFLICT_IOADDR or ALLOW_CONFLICT_IRQ options. -Warning: Setting the ALLOW_* options will will bypass checks for ALL drivers, -so be careful when you use them! - Jordan Hubbard (jkh@freefall.cdrom.com) - Steven Wallace (swallace@freefall.cdrom.com) diff --git a/sys/i386/isa/sound/soundcard.c b/sys/i386/isa/sound/soundcard.c index 9443c6ed10d9..06c9f6fd7b8d 100644 --- a/sys/i386/isa/sound/soundcard.c +++ b/sys/i386/isa/sound/soundcard.c @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: soundcard.c,v 1.24 1995/03/12 23:34:10 swallace Exp $ + * $Id: soundcard.c,v 1.27 1995/07/28 21:40:26 jkh Exp $ */ #include "sound_config.h" @@ -34,6 +34,7 @@ #ifdef CONFIGURE_SOUNDCARD #include "dev_table.h" +#include u_int snd1_imask; u_int snd2_imask; @@ -78,11 +79,27 @@ struct isa_driver gusmaxdriver = {sndprobe, sndattach, "gusmax"}; struct isa_driver uartdriver = {sndprobe, sndattach, "uart"}; struct isa_driver mssdriver = {sndprobe, sndattach, "mss"}; +static unsigned short +ipri_to_irq (unsigned short ipri); + void -adintr(INT_HANDLER_PARMS(irq,dummy)) +adintr(INT_HANDLER_PARMS(unit,dummy)) { #ifndef EXCLUDE_AD1848 - ad1848_interrupt(INT_HANDLER_CALL(irq)); + static short unit_to_irq[4] = { -1, -1, -1, -1 }; + struct isa_device *dev; + + if (unit_to_irq [unit] > 0) + ad1848_interrupt(INT_HANDLER_CALL (unit_to_irq [unit])); + else { + dev = find_isadev (isa_devtab_null, &mssdriver, unit); + if (!dev) + printk ("ad1848: Couldn't determine unit\n"); + else { + unit_to_irq [unit] = ipri_to_irq (dev->id_irq); + ad1848_interrupt(INT_HANDLER_CALL (unit_to_irq [unit])); + } + } #endif }