From owner-freebsd-multimedia Fri Oct 10 13:31:07 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id NAA06210 for multimedia-outgoing; Fri, 10 Oct 1997 13:31:07 -0700 (PDT) (envelope-from owner-freebsd-multimedia) Received: from feith1.FEITH.COM (feith1.FEITH.COM [192.251.93.1]) by hub.freebsd.org (8.8.7/8.8.7) with SMTP id NAA06199 for ; Fri, 10 Oct 1997 13:31:03 -0700 (PDT) (envelope-from john@jwlab.feith.com) Received: from jwlab.FEITH.COM by feith1.FEITH.COM (SMI-8.6/SMI-SVR4/Feith Feb 13 1997) id QAA05123; Fri, 10 Oct 1997 16:30:28 -0400 Received: by jwlab.FEITH.COM (SMI-8.6/SMI-SVR4) id QAA14454; Fri, 10 Oct 1997 16:30:27 -0400 Date: Fri, 10 Oct 1997 16:30:27 -0400 From: john@jwlab.feith.com (John Wehle) Message-Id: <199710102030.QAA14454@jwlab.FEITH.COM> To: multimedia@freebsd.org Subject: Patch to FreeBSD 3.0 Ensoniq Soundscape device driver Content-Type: text Sender: owner-freebsd-multimedia@freebsd.org X-Loop: FreeBSD.org Precedence: bulk The enclosed patch adds support for the Ensoniq Soundscape to FreeBSD. It has only been lightly tested using an Ensoniq SoundScape Elite, however so far the only problems which have turned up are some unnecesary snaps in the sound when closing the device. The snaps seem to be due to existing bugs in the ad1848 driver (they're caused by ad1848_halt entering MCE which it doesn't need to when just shutting down DMA and clearing the interrupt status according to the sample code from Ensoniq). Sincerely, John Wehle ------------------8<------------------------8<------------------------ *** sys/i386/conf/files.i386.ORIGINAL Sun Sep 21 17:34:31 1997 --- sys/i386/conf/files.i386 Thu Oct 9 16:04:41 1997 *************** *** 210,215 **** --- 210,219 ---- i386/isa/sound/midibuf.c optional uart device-driver i386/isa/sound/trix.c optional trix device-driver i386/isa/sound/sscape.c optional sscape device-driver + i386/isa/sound/ad1848.c optional sscape device-driver + i386/isa/sound/mpu401.c optional sscape device-driver + i386/isa/sound/midi_synth.c optional sscape device-driver + i386/isa/sound/midibuf.c optional sscape device-driver i386/isa/sound/awe_wave.c optional awe device-driver i386/isa/spigot.c optional spigot device-driver i386/isa/spkr.c optional speaker device-driver *** sys/i386/conf/LINT.ORIGINAL Wed Oct 8 20:53:05 1997 --- sys/i386/conf/LINT Fri Oct 10 16:01:12 1997 *************** *** 986,991 **** --- 986,993 ---- # gus: Gravis Ultrasound - Ultrasound, Ultrasound 16, Ultrasound MAX # gusxvi: Gravis Ultrasound 16-bit PCM (do not use) # mss: Microsoft Sound System + # sscape: Ensoniq Soundscape MIDI interface + # sscape_mss: Ensoniq Soundscape PCM (requires sscape) # opl: Yamaha OPL-2 and OPL-3 FM - SB, SB Pro, SB 16, ProAudioSpectrum # uart: stand-alone 6850 UART for MIDI # mpu: Roland MPU-401 stand-alone card *************** *** 1040,1052 **** device gus0 at isa? port 0x220 irq 12 drq 1 vector gusintr #device gus0 at isa? port 0x220 irq 12 drq 1 flags 0x3 vector gusintr device mss0 at isa? port 0x530 irq 10 drq 1 vector adintr device opl0 at isa? port 0x388 device mpu0 at isa? port 0x330 irq 6 drq 0 device uart0 at isa? port 0x330 irq 5 vector "m6850intr" # More undocumented sound devices with bogus configurations for linting. # broken - #device sscape0 at isa? port 0x330 irq 6 drq 0 #device trix0 at isa? port 0x330 irq 6 drq 0 vector sscapeintr # Luigi's snd code --- 1042,1055 ---- device gus0 at isa? port 0x220 irq 12 drq 1 vector gusintr #device gus0 at isa? port 0x220 irq 12 drq 1 flags 0x3 vector gusintr device mss0 at isa? port 0x530 irq 10 drq 1 vector adintr + device sscape0 at isa? port 0x330 irq 9 drq 0 vector sscapeintr + device sscape_mss0 at isa? port 0x534 irq 5 drq 1 vector sscape_mssintr device opl0 at isa? port 0x388 device mpu0 at isa? port 0x330 irq 6 drq 0 device uart0 at isa? port 0x330 irq 5 vector "m6850intr" # More undocumented sound devices with bogus configurations for linting. # broken #device trix0 at isa? port 0x330 irq 6 drq 0 vector sscapeintr # Luigi's snd code *** sys/i386/i386/userconfig.c.ORIGINAL Thu Sep 18 04:00:48 1997 --- sys/i386/i386/userconfig.c Thu Oct 9 00:08:02 1997 *************** *** 289,294 **** --- 289,296 ---- {"mss", "Microsoft Sound System", 0, CLS_MMEDIA}, {"opl", "OPL-2/3 FM, Soundblaster, SBPro, SB16, ProAudio Spectrum",0,CLS_MMEDIA}, {"mpu", "Roland MPU401 MIDI", 0, CLS_MMEDIA}, + {"sscape", "Ensoniq Soundscape MIDI interface", 0, CLS_MMEDIA}, + {"sscape_mss", "Ensoniq Soundscape PCM", 0, CLS_MMEDIA}, {"uart", "6850 MIDI UART", 0, CLS_MMEDIA}, {"pca", "PC speaker PCM audio driver", FLG_FIXED, CLS_MMEDIA}, {"ctx", "Coretex-I frame grabber", 0, CLS_MMEDIA}, *** sys/i386/isa/sound/sscape.c.ORIGINAL Tue Sep 10 04:26:07 1996 --- sys/i386/isa/sound/sscape.c Fri Oct 10 13:16:25 1997 *************** *** 33,38 **** --- 33,40 ---- #include + #define EXCLUDE_NATIVE_PCM + /* * I/O ports */ *************** *** 96,101 **** --- 98,105 ---- {0}; static struct sscape_info *devc = &dev_info; + static int sscape_mss_irq = -1; + DEFINE_WAIT_QUEUE (sscape_sleeper, sscape_sleep_flag); #ifdef REVEAL_SPEA *************** *** 489,496 **** int resid; DO_SLEEP (sscape_sleeper, sscape_sleep_flag, 1); clear_dma_ff (devc->dma); ! if ((resid = get_dma_residue (devc->dma)) == 0) done = 1; } --- 493,507 ---- int resid; DO_SLEEP (sscape_sleeper, sscape_sleep_flag, 1); + #if defined(linux) clear_dma_ff (devc->dma); ! resid = get_dma_residue (devc->dma); ! #elif defined(__FreeBSD__) ! resid = isa_dmastatus (devc->dma); ! #else ! # error This routine is not valid for this OS. ! #endif ! if (resid == 0) done = 1; } *************** *** 881,887 **** case 5: /* Don't destroy CD-ROM DMA config bits (0xc0) */ sscape_write (devc, i, (regs[i] & 0x3f) | ! (sscape_read (devc, i) & 0x0c)); break; case 6: /* CD-ROM config. Don't touch. */ --- 892,898 ---- case 5: /* Don't destroy CD-ROM DMA config bits (0xc0) */ sscape_write (devc, i, (regs[i] & 0x3f) | ! (sscape_read (devc, i) & 0xc0)); break; case 6: /* CD-ROM config. Don't touch. */ *************** *** 1065,1070 **** --- 1076,1083 ---- #endif + printk (" "); + /* * Setup the DMA polarity. */ *************** *** 1092,1098 **** if (hw_config->irq == devc->irq) printk ("SoundScape: Warning! The WSS mode can't share IRQ with MIDI\n"); ! ad1848_init ("SoundScape", hw_config->io_base, hw_config->irq, hw_config->dma, hw_config->dma); --- 1105,1113 ---- if (hw_config->irq == devc->irq) printk ("SoundScape: Warning! The WSS mode can't share IRQ with MIDI\n"); ! sscape_mss_irq = hw_config->irq; ! ! ad1848_init ("MS Sound System", hw_config->io_base, hw_config->irq, hw_config->dma, hw_config->dma); *************** *** 1115,1120 **** --- 1130,1141 ---- #endif return mem_start; + } + + void + sscape_mssintr(INT_HANDLER_PARMS(unit, dummy)) + { + ad1848_interrupt(INT_HANDLER_CALL (sscape_mss_irq)); } #endif *** sys/i386/isa/sound/soundcard.c.ORIGINAL Sun Sep 21 17:43:35 1997 --- sys/i386/isa/sound/soundcard.c Wed Oct 8 23:10:11 1997 *************** *** 90,95 **** --- 90,97 ---- struct isa_driver gusmaxdriver = {sndprobe, sndattach, "gusmax"}; struct isa_driver uartdriver = {sndprobe, sndattach, "uart"}; struct isa_driver mssdriver = {sndprobe, sndattach, "mss"}; + struct isa_driver sscapedriver = {sndprobe, sndattach, "sscape"}; + struct isa_driver sscape_mssdriver = {sndprobe, sndattach, "sscape_mss"}; #ifdef PC98 struct isa_driver pcmdriver = {sndprobe, sndattach, "pcm"}; #endif *************** *** 278,283 **** --- 280,289 ---- return(SNDCARD_GUS16); else if(driver == &mssdriver) return(SNDCARD_MSS); + else if(driver == &sscapedriver) + return(SNDCARD_SSCAPE); + else if(driver == &sscape_mssdriver) + return(SNDCARD_SSCAPE_MSS); #ifdef PC98 else if(driver == &pcmdriver) return(SNDCARD_PCM86); *** sys/i386/isa/sound/local.h.ORIGINAL Fri Nov 15 13:35:30 1996 --- sys/i386/isa/sound/local.h Thu Oct 9 16:01:13 1997 *************** *** 55,61 **** #if NGUS == 0 && !defined(EXCLUDE_GUSMAX) # define EXCLUDE_GUSMAX ! # if defined(EXCLUDE_GUS16) && defined(EXCLUDE_MSS) && !defined(EXCLUDE_AD1848) # define EXCLUDE_AD1848 # endif #else --- 55,61 ---- #if NGUS == 0 && !defined(EXCLUDE_GUSMAX) # define EXCLUDE_GUSMAX ! # if defined(EXCLUDE_GUS16) && defined(EXCLUDE_MSS) && defined(EXCLUDE_SSCAPE) && !defined(EXCLUDE_AD1848) # define EXCLUDE_AD1848 # endif #else *************** *** 112,118 **** /* nothing but a sequencer (Adlib/OPL) ? */ #if NGUS == 0 && NSB == 0 && NSBMIDI == 0 && NPAS == 0 && NMPU == 0 && \ ! NUART == 0 && NMSS == 0 #ifndef EXCLUDE_MIDI #define EXCLUDE_MIDI #endif --- 112,118 ---- /* nothing but a sequencer (Adlib/OPL) ? */ #if NGUS == 0 && NSB == 0 && NSBMIDI == 0 && NPAS == 0 && NMPU == 0 && \ ! NUART == 0 && NMSS == 0 && NSSCAPE == 0 #ifndef EXCLUDE_MIDI #define EXCLUDE_MIDI #endif *************** *** 125,131 **** /* nothing but a Midi (MPU/UART) ? */ #if NGUS == 0 && NSB == 0 && NSBMIDI == 0 && NPAS == 0 && NOPL == 0 && \ ! NMSS == 0 /* MPU depends on sequencer timer */ #if NMPU == 0 && !defined(EXCLUDE_SEQUENCER) #define EXCLUDE_SEQUENCER --- 125,131 ---- /* nothing but a Midi (MPU/UART) ? */ #if NGUS == 0 && NSB == 0 && NSBMIDI == 0 && NPAS == 0 && NOPL == 0 && \ ! NMSS == 0 && NSSCAPE == 0 /* MPU depends on sequencer timer */ #if NMPU == 0 && !defined(EXCLUDE_SEQUENCER) #define EXCLUDE_SEQUENCER ------------------------------------------------------------------------- | Feith Systems | Voice: 1-215-646-8000 | Email: john@feith.com | | John Wehle | Fax: 1-215-540-5495 | | -------------------------------------------------------------------------