From 1e25d964d2945ae3ff09fb94565e2a377ed8a8c2 Mon Sep 17 00:00:00 2001 From: Steven Wallace Date: Sun, 12 Mar 1995 23:34:12 +0000 Subject: [PATCH] Reorganize how sound devices are configured. Use a snd controller with individual devices for each type of sound card: opl, sb, sbxvi, sbmidi, pas, mpu, gus, gusxvi, gusmax, mss, uart EXCLUDE_* options are no longer required to be included in the config file. They are automatically determined by local.h depending on the devices included. Move #includes in local.h to os.h so files are included in the proper order to avoid warnings. soundcard.c now has additional code to reflect the device driver routines needed. Define new EXCLUDE_SB16MIDI for use in sb16_midi.c and dev_table.h. #ifndef EXCLUDE_SEQUENCER or EXCLUDE_AUDIO have been added to soundcard.c and sound_switch.c where appropriate. Probe outputs changed to reflect new device names. Readme.freebsd not needed. Update sound.doc with new config instructions. Reviewed by: wollman --- sys/i386/isa/sound/ad1848.c | 2 +- sys/i386/isa/sound/dev_table.h | 2 +- sys/i386/isa/sound/gus_card.c | 4 +- sys/i386/isa/sound/gus_wave.c | 2 +- sys/i386/isa/sound/local.h | 141 ++++++++++++++---------------- sys/i386/isa/sound/mpu401.c | 4 +- sys/i386/isa/sound/opl3.c | 4 +- sys/i386/isa/sound/os.h | 29 +++--- sys/i386/isa/sound/pas2_card.c | 2 +- sys/i386/isa/sound/sb16_dsp.c | 2 +- sys/i386/isa/sound/sb16_midi.c | 4 +- sys/i386/isa/sound/sb_dsp.c | 3 +- sys/i386/isa/sound/sound.doc | 107 ++++++++++++----------- sys/i386/isa/sound/sound_config.h | 16 +++- sys/i386/isa/sound/sound_switch.c | 10 +++ sys/i386/isa/sound/soundcard.c | 75 +++++++++++++--- sys/i386/isa/sound/uart6850.c | 4 + 17 files changed, 240 insertions(+), 171 deletions(-) diff --git a/sys/i386/isa/sound/ad1848.c b/sys/i386/isa/sound/ad1848.c index c3637e96eb80..560edc58ea85 100644 --- a/sys/i386/isa/sound/ad1848.c +++ b/sys/i386/isa/sound/ad1848.c @@ -944,7 +944,7 @@ attach_ms_sound (long mem_start, struct address_info *hw_config) OUTB (bits | dma_bits[hw_config->dma], config_port); /* Write IRQ+DMA setup */ - ad1848_init ("MS Sound System", hw_config->io_base + 4, + ad1848_init ("mss0: ", hw_config->io_base + 4, hw_config->irq, hw_config->dma, hw_config->dma); diff --git a/sys/i386/isa/sound/dev_table.h b/sys/i386/isa/sound/dev_table.h index e082ecb0d182..fbba1330c31a 100644 --- a/sys/i386/isa/sound/dev_table.h +++ b/sys/i386/isa/sound/dev_table.h @@ -241,7 +241,7 @@ struct sound_timer_operations { #ifndef EXCLUDE_AUDIO {SNDCARD_SB16, "SoundBlaster16", sb16_dsp_init, sb16_dsp_detect}, #endif -#ifndef EXCLUDE_MIDI +#if !defined(EXCLUDE_MIDI) && !defined(EXCLUDE_SB16MIDI) {SNDCARD_SB16MIDI,"SB16 MIDI", attach_sb16midi, probe_sb16midi}, #endif #endif diff --git a/sys/i386/isa/sound/gus_card.c b/sys/i386/isa/sound/gus_card.c index 42f4315e4f34..35311d2afa9b 100644 --- a/sys/i386/isa/sound/gus_card.c +++ b/sys/i386/isa/sound/gus_card.c @@ -34,8 +34,6 @@ #include "gus_hw.h" -void gusintr (int); - int gus_base, gus_irq, gus_dma; extern int gus_wave_volume; extern int gus_pcm_volume; @@ -184,7 +182,7 @@ attach_gus_db16 (long mem_start, struct address_info *hw_config) gus_pcm_volume = 100; gus_wave_volume = 90; - ad1848_init ("GUS 16 bit sampling", hw_config->io_base, + ad1848_init ("gusxvi0: ", hw_config->io_base, hw_config->irq, hw_config->dma, hw_config->dma); diff --git a/sys/i386/isa/sound/gus_wave.c b/sys/i386/isa/sound/gus_wave.c index 750a3137b842..523a7c5f9fa3 100644 --- a/sys/i386/isa/sound/gus_wave.c +++ b/sys/i386/isa/sound/gus_wave.c @@ -2919,7 +2919,7 @@ gus_wave_init (long mem_start, int irq, int dma) gus_mic_vol = gus_line_vol = gus_pcm_volume = 100; gus_wave_volume = 90; have_gus_max = 1; - ad1848_init ("GUS MAX", gus_base + 0x10c, + ad1848_init ("gusmax0: ", gus_base + 0x10c, -irq, dma, dma); diff --git a/sys/i386/isa/sound/local.h b/sys/i386/isa/sound/local.h index 7c1f8d77ac79..c2d41c76af68 100644 --- a/sys/i386/isa/sound/local.h +++ b/sys/i386/isa/sound/local.h @@ -2,106 +2,99 @@ /* * $Id: local.h,v 1.11 1994/11/01 17:26:50 ache Exp */ -#include "snd.h" - -#include -#include -#include -#include - -#if NSND > 0 -#define KERNEL_SOUNDCARD -#endif - -#ifndef EXCLUDE_UART6850 -#define EXCLUDE_UART6850 -#endif -#ifndef EXCLUDE_PSS -#define EXCLUDE_PSS -#endif #define DSP_BUFFSIZE 65536 #define SELECTED_SOUND_OPTIONS 0xffffffff #define SOUND_VERSION_STRING "2.90-2" #define SOUND_CONFIG_DATE "Sun Feb 5 14:38:12 EST 1995" #define SOUND_CONFIG_BY "freebsd-hackers" -#define SOUND_CONFIG_HOST "freebsd.org" -#define SOUND_CONFIG_DOMAIN "freebsd.org" +#define SOUND_CONFIG_HOST "freefall.cdrom.com" +#define SOUND_CONFIG_DOMAIN "cdrom.com" +/* determine if sound code should be compiled */ +#include "snd.h" +#if NSND > 0 +#define KERNEL_SOUNDCARD +#endif -/* Reversed the VoxWare EXCLUDE options -Sujal Patel (smpatel@wam.umd.edu) */ - -#ifndef EXCLUDE_PAS -#define EXCLUDE_PAS -#endif -#ifndef EXCLUDE_SB -#define EXCLUDE_SB -#endif -#ifndef EXCLUDE_GUS -#define EXCLUDE_GUS -#endif -#ifndef EXCLUDE_MPU401 -#define EXCLUDE_MPU401 -#endif -#ifndef EXCLUDE_UART6850 -#define EXCLUDE_UART6850 -#endif +/* PSS code does not work */ #ifndef EXCLUDE_PSS #define EXCLUDE_PSS #endif -#ifndef EXCLUDE_GUS16 + +#include "gus.h" +#if NGUS == 0 && !defined(EXCLUDE_GUS) +#define EXCLUDE_GUS +#endif + +#include "gusxvi.h" +#if NGUSXVI == 0 && !defined(EXCLUDE_GUS16) #define EXCLUDE_GUS16 #endif -#ifndef EXCLUDE_GUSMAX + +#include "gusmax.h" +#if NGUSMAX == 0 && !defined(EXCLUDE_GUSMAX) #define EXCLUDE_GUSMAX #endif -#ifndef EXCLUDE_MSS -#define EXCLUDE_MSS + +#include +#if NSB == 0 && !defined(EXCLUDE_SB) +#define EXCLUDE_SB #endif -#ifndef EXCLUDE_SBPRO -#define EXCLUDE_SBPRO -#endif -#ifndef EXCLUDE_SB16 + +#include "sbxvi.h" +#if NSBXVI == 0 && !defined(EXCLUDE_SB16) #define EXCLUDE_SB16 #endif -#ifndef EXCLUDE_YM3812 + +#include "sbmidi.h" +#if NSBMIDI == 0 && !defined(EXCLUDE_SB16MIDI) +#define EXCLUDE_SB16MIDI +#endif + +#include +#if NPAS == 0 && !defined(EXCLUDE_PAS) +#define EXCLUDE_PAS +#endif + +#include "mpu.h" +#if NMPU == 0 && !defined(EXCLUDE_MPU401) +#define EXCLUDE_MPU401 +#endif + +#include "opl.h" +#if NOPL == 0 && !defined(EXCLUDE_YM3812) #define EXCLUDE_YM3812 #endif -#ifdef AUDIO_PAS -#undef EXCLUDE_PAS +#include "mss.h" +#if NMSS == 0 && !defined(EXCLUDE_MSS) +#define EXCLUDE_MSS #endif -#ifdef AUDIO_SB -#undef EXCLUDE_SB + +#include "uart.h" +#if NUART == 0 && !defined(EXCLUDE_UART6850) +#define EXCLUDE_UART6850 #endif -#ifdef AUDIO_GUS -#undef EXCLUDE_GUS + +/* nothing but a sequencer (Adlib/OPL) ? */ +#if NGUS == 0 && NSB == 0 && NSBMIDI == 0 && NPAS == 0 && NMPU == 0 && \ + NUART == 0 +#ifndef EXCLUDE_MIDI +#define EXCLUDE_MIDI #endif -#ifdef AUDIO_MPU401 -#undef EXCLUDE_MPU401 +#ifndef EXCLUDE_AUDIO +#define EXCLUDE_AUDIO #endif -#ifdef AUDIO_UART6850 -#undef EXCLUDE_UART6850 #endif -#ifdef AUDIO_PSS -#undef EXCLUDE_PSS + +/* nothing but a Midi (MPU/UART) ? */ +#if NGUS == 0 && NSB == 0 && NSBMIDI == 0 && NPAS == 0 && NOPL == 0 +/* MPU depends on sequencer timer */ +#if NMPU == 0 && !defined(EXCLUDE_SEQUENCER) +#define EXCLUDE_SEQUENCER #endif -#ifdef AUDIO_GUS16 -#undef EXCLUDE_GUS -#undef EXCLUDE_GUS16 +#ifndef EXCLUDE_AUDIO +#define EXCLUDE_AUDIO #endif -#ifdef AUDIO_GUSMAX -#undef EXCLUDE_GUSMAX -#endif -#ifdef AUDIO_MSS -#undef EXCLUDE_MSS -#endif -#ifdef AUDIO_SBPRO -#undef EXCLUDE_SBPRO -#endif -#ifdef AUDIO_SB16 -#undef EXCLUDE_SB16 -#endif -#ifdef AUDIO_YM3812 -#undef EXCLUDE_YM3812 #endif diff --git a/sys/i386/isa/sound/mpu401.c b/sys/i386/isa/sound/mpu401.c index 3932b3100cbb..5d0784223f83 100644 --- a/sys/i386/isa/sound/mpu401.c +++ b/sys/i386/isa/sound/mpu401.c @@ -1050,7 +1050,7 @@ attach_mpu401 (long mem_start, struct address_info *hw_config) revision_char = (devc->revision == 0x7f) ? 'M' : ' '; #ifdef __FreeBSD__ - printk ("snd5: ", + printk ("mpu0: ", #else printk (" ", #endif @@ -1074,7 +1074,7 @@ attach_mpu401 (long mem_start, struct address_info *hw_config) devc->capabilities |= MPU_CAP_SYNC | MPU_CAP_FSK; #ifdef __FreeBSD__ - printk ("snd5: ", + printk ("mpu0: ", #else printk (" ", #endif diff --git a/sys/i386/isa/sound/opl3.c b/sys/i386/isa/sound/opl3.c index 8c943a247064..9e76ff176d9b 100644 --- a/sys/i386/isa/sound/opl3.c +++ b/sys/i386/isa/sound/opl3.c @@ -1175,7 +1175,7 @@ opl3_init (long mem_start) if (opl3_enabled) { #ifdef __FreeBSD__ - printk ("snd1: "); + printk ("opl0: "); #else printk (" "); #endif @@ -1202,7 +1202,7 @@ opl3_init (long mem_start) else { #ifdef __FreeBSD__ - printk ("snd1: "); + printk ("opl0: "); #else printk (" "); #endif diff --git a/sys/i386/isa/sound/os.h b/sys/i386/isa/sound/os.h index d35c7f56c0aa..f3f9cdfc7bb3 100644 --- a/sys/i386/isa/sound/os.h +++ b/sys/i386/isa/sound/os.h @@ -44,21 +44,20 @@ * Insert here the includes required by your kernel. */ -#include "param.h" -#include "systm.h" -#include "ioctl.h" -#include "tty.h" -#include "proc.h" -#include "user.h" -#include "conf.h" -#include "file.h" -#include "uio.h" -#include "kernel.h" -#include "syslog.h" -#include "errno.h" -#include "malloc.h" -#include "buf.h" -#include "i386/isa/isa_device.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include /* * Rest of the file is compiled only if the driver is really required. diff --git a/sys/i386/isa/sound/pas2_card.c b/sys/i386/isa/sound/pas2_card.c index b846d63ba28b..204946ed4206 100644 --- a/sys/i386/isa/sound/pas2_card.c +++ b/sys/i386/isa/sound/pas2_card.c @@ -384,7 +384,7 @@ attach_pas_card (long mem_start, struct address_info *hw_config) if (pas_model = pas_read (CHIP_REV)) { #ifdef __FreeBSD__ - printk ("snd3: <%s rev %d>", pas_model_names[(int) pas_model], board_rev_id); + printk ("pas0: <%s rev %d>", pas_model_names[(int) pas_model], board_rev_id); #else /* __FreeBSD__ */ printk (" <%s rev %d>", pas_model_names[(int) pas_model], pas_read (BOARD_REV_ID)); #endif /* __FreeBSD__ */ diff --git a/sys/i386/isa/sound/sb16_dsp.c b/sys/i386/isa/sound/sb16_dsp.c index af2878084ec0..bf956a24b94b 100644 --- a/sys/i386/isa/sound/sb16_dsp.c +++ b/sys/i386/isa/sound/sb16_dsp.c @@ -478,7 +478,7 @@ sb16_dsp_init (long mem_start, struct address_info *hw_config) #endif #ifdef __FreeBSD__ - printk ("snd6: <%s>", sb16_dsp_operations.name); + printk ("sbxvi0: <%s>", sb16_dsp_operations.name); #else printk (" <%s>", sb16_dsp_operations.name); #endif diff --git a/sys/i386/isa/sound/sb16_midi.c b/sys/i386/isa/sound/sb16_midi.c index ec412a65ef5c..f4114d933424 100644 --- a/sys/i386/isa/sound/sb16_midi.c +++ b/sys/i386/isa/sound/sb16_midi.c @@ -32,7 +32,7 @@ #ifdef CONFIGURE_SOUNDCARD -#if !defined(EXCLUDE_SB) && !defined(EXCLUDE_SB16) && !defined(EXCLUDE_MIDI) +#if !defined(EXCLUDE_SB) && !defined(EXCLUDE_SB16MIDI) && !defined(EXCLUDE_MIDI) #include "sb.h" @@ -226,7 +226,7 @@ attach_sb16midi (long mem_start, struct address_info *hw_config) } #ifdef __FreeBSD__ - printk ("snd7: "); + printk ("sbmidi: "); #else printk (" "); #endif diff --git a/sys/i386/isa/sound/sb_dsp.c b/sys/i386/isa/sound/sb_dsp.c index 7444286d3338..5db3c9b30d66 100644 --- a/sys/i386/isa/sound/sb_dsp.c +++ b/sys/i386/isa/sound/sb_dsp.c @@ -91,7 +91,6 @@ volatile int sb_intr_active = 0; static int dsp_speed (int); static int dsp_set_stereo (int mode); -int sb_dsp_command (unsigned char val); #if !defined(EXCLUDE_MIDI) || !defined(EXCLUDE_AUDIO) @@ -825,7 +824,7 @@ sb_dsp_init (long mem_start, struct address_info *hw_config) } #ifdef __FreeBSD__ - printk ("snd2: <%s>", sb_dsp_operations.name); + printk ("sb0: <%s>", sb_dsp_operations.name); #else printk (" <%s>", sb_dsp_operations.name); #endif diff --git a/sys/i386/isa/sound/sound.doc b/sys/i386/isa/sound/sound.doc index f6db243c407b..ff06ad16f59e 100644 --- a/sys/i386/isa/sound/sound.doc +++ b/sys/i386/isa/sound/sound.doc @@ -1,62 +1,65 @@ +$Id: sound.doc Exp $ + Instructions on using audio on a FreeBSD 2.1 (or 2.0-current) system. See also /sys/i386/conf/LINT. +To enable sound driver support, the controller sound code must be included +in your config file: + +# SB = SoundBlaster; PAS = ProAudioSpectrum; GUS = Gravis UltraSound +# Controls all sound devices +controller snd0 + +Uncomment one or more of these device entries, depending on what type of +sound card you have: + +# Yamaha OPL-3 FM - for SB, SB Pro, SB16, PAS +#device opl0 at isa? port 0x388 + +# Yamaha OPL-3 FM - for PAS +#device opl0 at isa? port 0x38a + +# SoundBlaster DSP driver - for SB, SB Pro, SB16, PAS(emulating SB) +#device sb0 at isa? port 0x220 irq 7 drq 1 vector sbintr + +# SoundBlaster 16 DSP driver - for SB16 - requires sb0 device +#device sbxvi0 at isa? drq 5 + +# 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 + +# MPU-401 - for MPU-401 standalone card +#device mpu0 at isa? port 0x330 irq 6 drq 0 + +# Gravis UltraSound - for GUS, GUS16, GUSMAX +#device gus0 at isa? port 0x220 irq 11 drq 1 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 +#device mss0 at isa? port 0x530 irq 10 drq 1 vector adintr + +# 6850 UART Midi +#device uart0 at isa? port 0x330 irq 5 vector "m6850intr" + You may add one or more of the following depending on what you do and don't want compiled into your kernel. Note: Excluding things with EXCLUDE_... is NOT recommended unless you really know what you're doing. - options "AUDIO_MPU401" # INCLUDE MPU401 support - options AUDIO_GUS # INCLUDE GUS support - options AUDIO_SBPRO # INCLUDE SB Pro support - options "AUDIO_SB16" # INCLUDE SB 16 support - options "AUDIO_YM3812" # INCLUDE AdLib support - options AUDIO_PAS # INCLUDE Pro Audio Studio support - options AUDIO_SB # INCLUDE SB support - options AUDIO_MSS # INCLUDE MSS support - options EXCLUDE_AUDIO # NO digital audio support - options EXCLUDE_SEQUENCER # NO sequencer support - options EXCLUDE_GUS_IODETECT # NO GUS io detection - options EXCLUDE_SB_EMULATION # NO PAS SB emulation support - options "EXCLUDE_OPL3" # NO OPL3 chip support - options EXCLUDE_PRO_MIDI # NO PAS MIDI support - options EXCLUDE_CHIP_MIDI # NO MIDI chip support - options EXCLUDE_MIDI # NO MIDI support whatsoever - -To enable sound card support, you need to uncomment and add one or more of -the following lines to your kernel configuration file according to the -directions below: - -#device snd5 at isa? port 0x330 irq 6 vector mpuintr -#device snd4 at isa? port 0x220 irq 15 drq 6 vector gusintr -#device snd3 at isa? port 0x388 irq 10 drq 6 vector pasintr -#device snd2 at isa? port 0x220 irq 7 drq 1 vector sbintr -#device snd6 at isa? port 0x220 irq 7 drq 5 vector sbintr -#device snd10 at isa? port 0x530 irq 10 drq 1 vector adintr -#device snd7 at isa? port 0x300 -#device snd1 at isa? port 0x388 - -Note for PAS user: you should change snd1 line to -#device snd1 at isa? port 0x38a -(next stereo port) to avoid conflict with snd3 - - Unit numbers are: - 1 for Yamaha FM synth - 2 for SB/SB Pro DSP - 3 for PAS PCM and Midi - 4 for GUS - 5 for MPU-401 (there is separate driver for the SB16) - 6 for SB16 (DSP) - 7 for SB16 Midi (MPU-401 emulation) - 10 for Microsoft Windows Sound System (AD1846) - - If you have ProAudioSpectrum, uncomment units 3, 2 and 1 - If you have SoundBlaster 1.0 to 2.0 or SB Pro, uncomment 2 and 1. - If you have SoundBlaster 16, uncomment 2, 1, 6 and 7. - (use the same IRQ for the cards 2, 6 and 7. The DMA of the - card 2 is the 8 bit one and the DMA of the card 6 is the 16 bit one. - the port address of the card 7 is the Midi I/O address of the SB16. - If you have GravisUltrasound, uncomment 4 - If you have MPU-401, uncomment 5 +#options EXCLUDE_AUDIO # NO digital audio support +#options EXCLUDE_SEQUENCER # NO sequencer support +#options EXCLUDE_MIDI # NO MIDI support whatsoever +#options EXCLUDE_SBPRO # EXCLUDE SB Pro support +#options EXCLUDE_SB_EMULATION # NO PAS SB emulation support +#options EXCLUDE_GUS_IODETECT # NO GUS io detection +#options EXCLUDE_PRO_MIDI # NO PAS MIDI support 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, diff --git a/sys/i386/isa/sound/sound_config.h b/sys/i386/isa/sound/sound_config.h index 23ffcfe1c95b..470bc017b41b 100644 --- a/sys/i386/isa/sound/sound_config.h +++ b/sys/i386/isa/sound/sound_config.h @@ -53,9 +53,9 @@ #endif #ifdef EXCLUDE_SEQUENCER -#define EXCLUDE_MIDI +#ifndef EXCLUDE_YM3812 #define EXCLUDE_YM3812 -#define EXCLUDE_OPL3 +#endif #endif #ifndef SND_DEFAULT_ENABLE @@ -166,6 +166,18 @@ If your card has nonstandard I/O address or IRQ number, change defines #define MSS_DMA 1 #endif +#ifndef U6850_BASE +#define U6850_BASE 0x330 +#endif + +#ifndef U6850_IRQ +#define U6850_IRQ 5 +#endif + +#ifndef U6850_DMA +#define U6850_DMA 1 +#endif + /************* PCM DMA buffer sizes *******************/ /* If you are using high playback or recording speeds, the default buffersize diff --git a/sys/i386/isa/sound/sound_switch.c b/sys/i386/isa/sound/sound_switch.c index 129ee3934273..b66cad5e6b4b 100644 --- a/sys/i386/isa/sound/sound_switch.c +++ b/sys/i386/isa/sound/sound_switch.c @@ -292,10 +292,12 @@ sound_read_sw (int dev, struct fileinfo *file, snd_rw_buf * buf, int count) return audio_read (dev, file, buf, count); break; +#ifndef EXCLUDE_SEQUENCER case SND_DEV_SEQ: case SND_DEV_SEQ2: return sequencer_read (dev, file, buf, count); break; +#endif #ifndef EXCLUDE_MIDI case SND_DEV_MIDIN: @@ -323,10 +325,12 @@ sound_write_sw (int dev, struct fileinfo *file, snd_rw_buf * buf, int count) switch (dev & 0x0f) { +#ifndef EXCLUDE_SEQUENCER case SND_DEV_SEQ: case SND_DEV_SEQ2: return sequencer_write (dev, file, buf, count); break; +#endif case SND_DEV_DSP: case SND_DEV_DSP16: @@ -380,11 +384,13 @@ sound_open_sw (int dev, struct fileinfo *file) return 0; break; +#ifndef EXCLUDE_SEQUENCER case SND_DEV_SEQ: case SND_DEV_SEQ2: if ((retval = sequencer_open (dev, file)) < 0) return retval; break; +#endif #ifndef EXCLUDE_MIDI case SND_DEV_MIDIN: @@ -436,10 +442,12 @@ sound_release_sw (int dev, struct fileinfo *file) case SND_DEV_CTL: break; +#ifndef EXCLUDE_SEQUENCER case SND_DEV_SEQ: case SND_DEV_SEQ2: sequencer_release (dev, file); break; +#endif #ifndef EXCLUDE_MIDI case SND_DEV_MIDIN: @@ -495,10 +503,12 @@ sound_ioctl_sw (int dev, struct fileinfo *file, return mixer_devs[dev]->ioctl (dev, cmd, arg); break; +#ifndef EXCLUDE_SEQUENCER case SND_DEV_SEQ: case SND_DEV_SEQ2: return sequencer_ioctl (dev, file, cmd, arg); break; +#endif case SND_DEV_DSP: case SND_DEV_DSP16: diff --git a/sys/i386/isa/sound/soundcard.c b/sys/i386/isa/sound/soundcard.c index 69b62bf1fe3c..83cf06ebde5b 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.21 1995/02/13 22:49:06 jkh Exp $ + * $Id: soundcard.c,v 1.23 1995/03/05 04:01:29 jkh Exp $ */ #include "sound_config.h" @@ -66,6 +66,18 @@ int sndwrite (int dev, struct uio *uio); int sndselect (int dev, int rw, struct proc *p); static void sound_mem_init(void); +struct isa_driver opldriver = {sndprobe, sndattach, "opl"}; +struct isa_driver sbdriver = {sndprobe, sndattach, "sb"}; +struct isa_driver sbxvidriver = {sndprobe, sndattach, "sbxvi"}; +struct isa_driver sbmididriver = {sndprobe, sndattach, "sbmidi"}; +struct isa_driver pasdriver = {sndprobe, sndattach, "pas"}; +struct isa_driver mpudriver = {sndprobe, sndattach, "mpu"}; +struct isa_driver gusdriver = {sndprobe, sndattach, "gus"}; +struct isa_driver gusxvidriver = {sndprobe, sndattach, "gusxvi"}; +struct isa_driver gusmaxdriver = {sndprobe, sndattach, "gusmax"}; +struct isa_driver uartdriver = {sndprobe, sndattach, "uart"}; +struct isa_driver mssdriver = {sndprobe, sndattach, "mss"}; + unsigned long get_time(void) @@ -192,38 +204,74 @@ ipri_to_irq (unsigned short ipri) return -1; /* Invalid argument */ } +static int +driver_to_voxunit(struct isa_driver *driver) +{ + /* converts a sound driver pointer into the equivalent + VoxWare device unit number */ + if(driver == &opldriver) + return(SNDCARD_ADLIB); + else if(driver == &sbdriver) + return(SNDCARD_SB); + else if(driver == &pasdriver) + return(SNDCARD_PAS); + else if(driver == &gusdriver) + return(SNDCARD_GUS); + else if(driver == &mpudriver) + return(SNDCARD_MPU401); + else if(driver == &sbxvidriver) + return(SNDCARD_SB16); + else if(driver == &sbmididriver) + return(SNDCARD_SB16MIDI); + else if(driver == &uartdriver) + return(SNDCARD_UART6850); + else if(driver == &gusdriver) + return(SNDCARD_GUS16); + else if(driver == &mssdriver) + return(SNDCARD_MSS); + else + return(0); +} + int sndprobe (struct isa_device *dev) { struct address_info hw_config; + int unit; + unit = driver_to_voxunit(dev->id_driver); hw_config.io_base = dev->id_iobase; hw_config.irq = ipri_to_irq (dev->id_irq); hw_config.dma = dev->id_drq; - return sndtable_probe (dev->id_unit, &hw_config); + if(unit) + return sndtable_probe (unit, &hw_config); + else + return 0; } int sndattach (struct isa_device *dev) { - int i; + int i, unit; static int midi_initialized = 0; static int seq_initialized = 0; static int generic_midi_initialized = 0; unsigned long mem_start = 0xefffffffUL; struct address_info hw_config; + unit = driver_to_voxunit(dev->id_driver); hw_config.io_base = dev->id_iobase; hw_config.irq = ipri_to_irq (dev->id_irq); hw_config.dma = dev->id_drq; - if (dev->id_unit) /* Card init */ - if (!sndtable_init_card (dev->id_unit, &hw_config)) - { - printf (" "); - return FALSE; - } + if(!unit) + return FALSE; + if (!sndtable_init_card (unit, &hw_config)) + { + printf (" "); + return FALSE; + } /* * Init the high level sound driver @@ -248,17 +296,21 @@ sndattach (struct isa_device *dev) soundcard_configured = 1; #endif +#ifndef EXCLUDE_MIDI if (num_midis && !midi_initialized) { midi_initialized = 1; mem_start = MIDIbuf_init (mem_start); } +#endif +#ifndef EXCLUDE_SEQUENCER if ((num_midis + num_synths) && !seq_initialized) { seq_initialized = 1; mem_start = sequencer_init (mem_start); } +#endif return TRUE; } @@ -272,6 +324,7 @@ tenmicrosec (void) inb (0x80); } +#ifndef EXCLUDE_SEQUENCER void request_sound_timer (int count) { @@ -305,6 +358,7 @@ sound_stop_timer (void) untimeout ((timeout_func_t)sequencer_timer, 0); timer_running = 0; } +#endif #ifndef EXCLUDE_AUDIO static void @@ -365,9 +419,6 @@ sound_mem_init (void) #endif -struct isa_driver snddriver = -{sndprobe, sndattach, "snd"}; - int snd_ioctl_return (int *addr, int value) { diff --git a/sys/i386/isa/sound/uart6850.c b/sys/i386/isa/sound/uart6850.c index 95d88a31f5be..4d8be84fee61 100644 --- a/sys/i386/isa/sound/uart6850.c +++ b/sys/i386/isa/sound/uart6850.c @@ -285,7 +285,11 @@ attach_uart6850 (long mem_start, struct address_info *hw_config) RESTORE_INTR (flags); +#ifdef __FreeBSD__ + printk ("uart0: <6850 Midi Interface>"); +#else printk (" <6850 Midi Interface>"); +#endif std_midi_synth.midi_dev = my_dev = num_midis; midi_devs[num_midis++] = &uart6850_operations;