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
This commit is contained in:
Steven Wallace 1995-03-12 23:34:12 +00:00
parent c14b1eb830
commit 1e25d964d2
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=7044
17 changed files with 240 additions and 171 deletions

View File

@ -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 */ 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: <MS Sound System>", hw_config->io_base + 4,
hw_config->irq, hw_config->irq,
hw_config->dma, hw_config->dma,
hw_config->dma); hw_config->dma);

View File

@ -241,7 +241,7 @@ struct sound_timer_operations {
#ifndef EXCLUDE_AUDIO #ifndef EXCLUDE_AUDIO
{SNDCARD_SB16, "SoundBlaster16", sb16_dsp_init, sb16_dsp_detect}, {SNDCARD_SB16, "SoundBlaster16", sb16_dsp_init, sb16_dsp_detect},
#endif #endif
#ifndef EXCLUDE_MIDI #if !defined(EXCLUDE_MIDI) && !defined(EXCLUDE_SB16MIDI)
{SNDCARD_SB16MIDI,"SB16 MIDI", attach_sb16midi, probe_sb16midi}, {SNDCARD_SB16MIDI,"SB16 MIDI", attach_sb16midi, probe_sb16midi},
#endif #endif
#endif #endif

View File

@ -34,8 +34,6 @@
#include "gus_hw.h" #include "gus_hw.h"
void gusintr (int);
int gus_base, gus_irq, gus_dma; int gus_base, gus_irq, gus_dma;
extern int gus_wave_volume; extern int gus_wave_volume;
extern int gus_pcm_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_pcm_volume = 100;
gus_wave_volume = 90; gus_wave_volume = 90;
ad1848_init ("GUS 16 bit sampling", hw_config->io_base, ad1848_init ("gusxvi0: <GUS 16 bit sampling>", hw_config->io_base,
hw_config->irq, hw_config->irq,
hw_config->dma, hw_config->dma,
hw_config->dma); hw_config->dma);

View File

@ -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_mic_vol = gus_line_vol = gus_pcm_volume = 100;
gus_wave_volume = 90; gus_wave_volume = 90;
have_gus_max = 1; have_gus_max = 1;
ad1848_init ("GUS MAX", gus_base + 0x10c, ad1848_init ("gusmax0: <GUS MAX>", gus_base + 0x10c,
-irq, -irq,
dma, dma,
dma); dma);

View File

@ -2,106 +2,99 @@
/* /*
* $Id: local.h,v 1.11 1994/11/01 17:26:50 ache Exp * $Id: local.h,v 1.11 1994/11/01 17:26:50 ache Exp
*/ */
#include "snd.h"
#include <param.h>
#include <systm.h>
#include <machine/cpufunc.h>
#include <vm/vm.h>
#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 DSP_BUFFSIZE 65536
#define SELECTED_SOUND_OPTIONS 0xffffffff #define SELECTED_SOUND_OPTIONS 0xffffffff
#define SOUND_VERSION_STRING "2.90-2" #define SOUND_VERSION_STRING "2.90-2"
#define SOUND_CONFIG_DATE "Sun Feb 5 14:38:12 EST 1995" #define SOUND_CONFIG_DATE "Sun Feb 5 14:38:12 EST 1995"
#define SOUND_CONFIG_BY "freebsd-hackers" #define SOUND_CONFIG_BY "freebsd-hackers"
#define SOUND_CONFIG_HOST "freebsd.org" #define SOUND_CONFIG_HOST "freefall.cdrom.com"
#define SOUND_CONFIG_DOMAIN "freebsd.org" #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) */ /* PSS code does not work */
#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
#ifndef EXCLUDE_PSS #ifndef EXCLUDE_PSS
#define EXCLUDE_PSS #define EXCLUDE_PSS
#endif #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 #define EXCLUDE_GUS16
#endif #endif
#ifndef EXCLUDE_GUSMAX
#include "gusmax.h"
#if NGUSMAX == 0 && !defined(EXCLUDE_GUSMAX)
#define EXCLUDE_GUSMAX #define EXCLUDE_GUSMAX
#endif #endif
#ifndef EXCLUDE_MSS
#define EXCLUDE_MSS #include <sb.h>
#if NSB == 0 && !defined(EXCLUDE_SB)
#define EXCLUDE_SB
#endif #endif
#ifndef EXCLUDE_SBPRO
#define EXCLUDE_SBPRO #include "sbxvi.h"
#endif #if NSBXVI == 0 && !defined(EXCLUDE_SB16)
#ifndef EXCLUDE_SB16
#define EXCLUDE_SB16 #define EXCLUDE_SB16
#endif #endif
#ifndef EXCLUDE_YM3812
#include "sbmidi.h"
#if NSBMIDI == 0 && !defined(EXCLUDE_SB16MIDI)
#define EXCLUDE_SB16MIDI
#endif
#include <pas.h>
#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 #define EXCLUDE_YM3812
#endif #endif
#ifdef AUDIO_PAS #include "mss.h"
#undef EXCLUDE_PAS #if NMSS == 0 && !defined(EXCLUDE_MSS)
#define EXCLUDE_MSS
#endif #endif
#ifdef AUDIO_SB
#undef EXCLUDE_SB #include "uart.h"
#if NUART == 0 && !defined(EXCLUDE_UART6850)
#define EXCLUDE_UART6850
#endif #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 #endif
#ifdef AUDIO_MPU401 #ifndef EXCLUDE_AUDIO
#undef EXCLUDE_MPU401 #define EXCLUDE_AUDIO
#endif #endif
#ifdef AUDIO_UART6850
#undef EXCLUDE_UART6850
#endif #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 #endif
#ifdef AUDIO_GUS16 #ifndef EXCLUDE_AUDIO
#undef EXCLUDE_GUS #define EXCLUDE_AUDIO
#undef EXCLUDE_GUS16
#endif #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 #endif

View File

@ -1050,7 +1050,7 @@ attach_mpu401 (long mem_start, struct address_info *hw_config)
revision_char = (devc->revision == 0x7f) ? 'M' : ' '; revision_char = (devc->revision == 0x7f) ? 'M' : ' ';
#ifdef __FreeBSD__ #ifdef __FreeBSD__
printk ("snd5: <MQX-%d%c MIDI Interface>", printk ("mpu0: <MQX-%d%c MIDI Interface>",
#else #else
printk (" <MQX-%d%c MIDI Interface>", printk (" <MQX-%d%c MIDI Interface>",
#endif #endif
@ -1074,7 +1074,7 @@ attach_mpu401 (long mem_start, struct address_info *hw_config)
devc->capabilities |= MPU_CAP_SYNC | MPU_CAP_FSK; devc->capabilities |= MPU_CAP_SYNC | MPU_CAP_FSK;
#ifdef __FreeBSD__ #ifdef __FreeBSD__
printk ("snd5: <MPU-401 MIDI Interface %d.%d%c>", printk ("mpu0: <MPU-401 MIDI Interface %d.%d%c>",
#else #else
printk (" <MPU-401 MIDI Interface %d.%d%c>", printk (" <MPU-401 MIDI Interface %d.%d%c>",
#endif #endif

View File

@ -1175,7 +1175,7 @@ opl3_init (long mem_start)
if (opl3_enabled) if (opl3_enabled)
{ {
#ifdef __FreeBSD__ #ifdef __FreeBSD__
printk ("snd1: <Yamaha OPL-3 FM>"); printk ("opl0: <Yamaha OPL-3 FM>");
#else #else
printk (" <Yamaha OPL-3 FM>"); printk (" <Yamaha OPL-3 FM>");
#endif #endif
@ -1202,7 +1202,7 @@ opl3_init (long mem_start)
else else
{ {
#ifdef __FreeBSD__ #ifdef __FreeBSD__
printk ("snd1: <Yamaha 2-OP FM>"); printk ("opl0: <Yamaha 2-OP FM>");
#else #else
printk (" <Yamaha 2-OP FM>"); printk (" <Yamaha 2-OP FM>");
#endif #endif

View File

@ -44,21 +44,20 @@
* Insert here the includes required by your kernel. * Insert here the includes required by your kernel.
*/ */
#include "param.h" #include <sys/param.h>
#include "systm.h" #include <sys/systm.h>
#include "ioctl.h" #include <sys/proc.h>
#include "tty.h" #include <sys/user.h>
#include "proc.h" #include <sys/conf.h>
#include "user.h" #include <sys/file.h>
#include "conf.h" #include <sys/uio.h>
#include "file.h" #include <sys/kernel.h>
#include "uio.h" #include <sys/syslog.h>
#include "kernel.h" #include <sys/errno.h>
#include "syslog.h" #include <sys/malloc.h>
#include "errno.h" #include <sys/buf.h>
#include "malloc.h" #include <i386/isa/isa_device.h>
#include "buf.h" #include <machine/cpufunc.h>
#include "i386/isa/isa_device.h"
/* /*
* Rest of the file is compiled only if the driver is really required. * Rest of the file is compiled only if the driver is really required.

View File

@ -384,7 +384,7 @@ attach_pas_card (long mem_start, struct address_info *hw_config)
if (pas_model = pas_read (CHIP_REV)) if (pas_model = pas_read (CHIP_REV))
{ {
#ifdef __FreeBSD__ #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__ */ #else /* __FreeBSD__ */
printk (" <%s rev %d>", pas_model_names[(int) pas_model], pas_read (BOARD_REV_ID)); printk (" <%s rev %d>", pas_model_names[(int) pas_model], pas_read (BOARD_REV_ID));
#endif /* __FreeBSD__ */ #endif /* __FreeBSD__ */

View File

@ -478,7 +478,7 @@ sb16_dsp_init (long mem_start, struct address_info *hw_config)
#endif #endif
#ifdef __FreeBSD__ #ifdef __FreeBSD__
printk ("snd6: <%s>", sb16_dsp_operations.name); printk ("sbxvi0: <%s>", sb16_dsp_operations.name);
#else #else
printk (" <%s>", sb16_dsp_operations.name); printk (" <%s>", sb16_dsp_operations.name);
#endif #endif

View File

@ -32,7 +32,7 @@
#ifdef CONFIGURE_SOUNDCARD #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" #include "sb.h"
@ -226,7 +226,7 @@ attach_sb16midi (long mem_start, struct address_info *hw_config)
} }
#ifdef __FreeBSD__ #ifdef __FreeBSD__
printk ("snd7: <SoundBlaster MPU-401>"); printk ("sbmidi: <SoundBlaster MPU-401>");
#else #else
printk (" <SoundBlaster MPU-401>"); printk (" <SoundBlaster MPU-401>");
#endif #endif

View File

@ -91,7 +91,6 @@ volatile int sb_intr_active = 0;
static int dsp_speed (int); static int dsp_speed (int);
static int dsp_set_stereo (int mode); static int dsp_set_stereo (int mode);
int sb_dsp_command (unsigned char val);
#if !defined(EXCLUDE_MIDI) || !defined(EXCLUDE_AUDIO) #if !defined(EXCLUDE_MIDI) || !defined(EXCLUDE_AUDIO)
@ -825,7 +824,7 @@ sb_dsp_init (long mem_start, struct address_info *hw_config)
} }
#ifdef __FreeBSD__ #ifdef __FreeBSD__
printk ("snd2: <%s>", sb_dsp_operations.name); printk ("sb0: <%s>", sb_dsp_operations.name);
#else #else
printk (" <%s>", sb_dsp_operations.name); printk (" <%s>", sb_dsp_operations.name);
#endif #endif

View File

@ -1,62 +1,65 @@
$Id: sound.doc Exp $
Instructions on using audio on a FreeBSD 2.1 (or 2.0-current) system. Instructions on using audio on a FreeBSD 2.1 (or 2.0-current) system.
See also /sys/i386/conf/LINT. 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 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_... want compiled into your kernel. Note: Excluding things with EXCLUDE_...
is NOT recommended unless you really know what you're doing. is NOT recommended unless you really know what you're doing.
options "AUDIO_MPU401" # INCLUDE MPU401 support #options EXCLUDE_AUDIO # NO digital audio support
options AUDIO_GUS # INCLUDE GUS support #options EXCLUDE_SEQUENCER # NO sequencer support
options AUDIO_SBPRO # INCLUDE SB Pro support #options EXCLUDE_MIDI # NO MIDI support whatsoever
options "AUDIO_SB16" # INCLUDE SB 16 support #options EXCLUDE_SBPRO # EXCLUDE SB Pro support
options "AUDIO_YM3812" # INCLUDE AdLib support #options EXCLUDE_SB_EMULATION # NO PAS SB emulation support
options AUDIO_PAS # INCLUDE Pro Audio Studio support #options EXCLUDE_GUS_IODETECT # NO GUS io detection
options AUDIO_SB # INCLUDE SB support #options EXCLUDE_PRO_MIDI # NO PAS MIDI 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
NOTE: The MPU-401 driver may or may not work, and is unfortunately 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, unverifiable since no one I know has one. If you can test this,

View File

@ -53,9 +53,9 @@
#endif #endif
#ifdef EXCLUDE_SEQUENCER #ifdef EXCLUDE_SEQUENCER
#define EXCLUDE_MIDI #ifndef EXCLUDE_YM3812
#define EXCLUDE_YM3812 #define EXCLUDE_YM3812
#define EXCLUDE_OPL3 #endif
#endif #endif
#ifndef SND_DEFAULT_ENABLE #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 #define MSS_DMA 1
#endif #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 *******************/ /************* PCM DMA buffer sizes *******************/
/* If you are using high playback or recording speeds, the default buffersize /* If you are using high playback or recording speeds, the default buffersize

View File

@ -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); return audio_read (dev, file, buf, count);
break; break;
#ifndef EXCLUDE_SEQUENCER
case SND_DEV_SEQ: case SND_DEV_SEQ:
case SND_DEV_SEQ2: case SND_DEV_SEQ2:
return sequencer_read (dev, file, buf, count); return sequencer_read (dev, file, buf, count);
break; break;
#endif
#ifndef EXCLUDE_MIDI #ifndef EXCLUDE_MIDI
case SND_DEV_MIDIN: 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) switch (dev & 0x0f)
{ {
#ifndef EXCLUDE_SEQUENCER
case SND_DEV_SEQ: case SND_DEV_SEQ:
case SND_DEV_SEQ2: case SND_DEV_SEQ2:
return sequencer_write (dev, file, buf, count); return sequencer_write (dev, file, buf, count);
break; break;
#endif
case SND_DEV_DSP: case SND_DEV_DSP:
case SND_DEV_DSP16: case SND_DEV_DSP16:
@ -380,11 +384,13 @@ sound_open_sw (int dev, struct fileinfo *file)
return 0; return 0;
break; break;
#ifndef EXCLUDE_SEQUENCER
case SND_DEV_SEQ: case SND_DEV_SEQ:
case SND_DEV_SEQ2: case SND_DEV_SEQ2:
if ((retval = sequencer_open (dev, file)) < 0) if ((retval = sequencer_open (dev, file)) < 0)
return retval; return retval;
break; break;
#endif
#ifndef EXCLUDE_MIDI #ifndef EXCLUDE_MIDI
case SND_DEV_MIDIN: case SND_DEV_MIDIN:
@ -436,10 +442,12 @@ sound_release_sw (int dev, struct fileinfo *file)
case SND_DEV_CTL: case SND_DEV_CTL:
break; break;
#ifndef EXCLUDE_SEQUENCER
case SND_DEV_SEQ: case SND_DEV_SEQ:
case SND_DEV_SEQ2: case SND_DEV_SEQ2:
sequencer_release (dev, file); sequencer_release (dev, file);
break; break;
#endif
#ifndef EXCLUDE_MIDI #ifndef EXCLUDE_MIDI
case SND_DEV_MIDIN: case SND_DEV_MIDIN:
@ -495,10 +503,12 @@ sound_ioctl_sw (int dev, struct fileinfo *file,
return mixer_devs[dev]->ioctl (dev, cmd, arg); return mixer_devs[dev]->ioctl (dev, cmd, arg);
break; break;
#ifndef EXCLUDE_SEQUENCER
case SND_DEV_SEQ: case SND_DEV_SEQ:
case SND_DEV_SEQ2: case SND_DEV_SEQ2:
return sequencer_ioctl (dev, file, cmd, arg); return sequencer_ioctl (dev, file, cmd, arg);
break; break;
#endif
case SND_DEV_DSP: case SND_DEV_DSP:
case SND_DEV_DSP16: case SND_DEV_DSP16:

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * 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" #include "sound_config.h"
@ -66,6 +66,18 @@ int sndwrite (int dev, struct uio *uio);
int sndselect (int dev, int rw, struct proc *p); int sndselect (int dev, int rw, struct proc *p);
static void sound_mem_init(void); 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 unsigned
long long
get_time(void) get_time(void)
@ -192,38 +204,74 @@ ipri_to_irq (unsigned short ipri)
return -1; /* Invalid argument */ 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 int
sndprobe (struct isa_device *dev) sndprobe (struct isa_device *dev)
{ {
struct address_info hw_config; struct address_info hw_config;
int unit;
unit = driver_to_voxunit(dev->id_driver);
hw_config.io_base = dev->id_iobase; hw_config.io_base = dev->id_iobase;
hw_config.irq = ipri_to_irq (dev->id_irq); hw_config.irq = ipri_to_irq (dev->id_irq);
hw_config.dma = dev->id_drq; 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 int
sndattach (struct isa_device *dev) sndattach (struct isa_device *dev)
{ {
int i; int i, unit;
static int midi_initialized = 0; static int midi_initialized = 0;
static int seq_initialized = 0; static int seq_initialized = 0;
static int generic_midi_initialized = 0; static int generic_midi_initialized = 0;
unsigned long mem_start = 0xefffffffUL; unsigned long mem_start = 0xefffffffUL;
struct address_info hw_config; struct address_info hw_config;
unit = driver_to_voxunit(dev->id_driver);
hw_config.io_base = dev->id_iobase; hw_config.io_base = dev->id_iobase;
hw_config.irq = ipri_to_irq (dev->id_irq); hw_config.irq = ipri_to_irq (dev->id_irq);
hw_config.dma = dev->id_drq; hw_config.dma = dev->id_drq;
if (dev->id_unit) /* Card init */ if(!unit)
if (!sndtable_init_card (dev->id_unit, &hw_config)) return FALSE;
{ if (!sndtable_init_card (unit, &hw_config))
printf (" <Driver not configured>"); {
return FALSE; printf (" <Driver not configured>");
} return FALSE;
}
/* /*
* Init the high level sound driver * Init the high level sound driver
@ -248,17 +296,21 @@ sndattach (struct isa_device *dev)
soundcard_configured = 1; soundcard_configured = 1;
#endif #endif
#ifndef EXCLUDE_MIDI
if (num_midis && !midi_initialized) if (num_midis && !midi_initialized)
{ {
midi_initialized = 1; midi_initialized = 1;
mem_start = MIDIbuf_init (mem_start); mem_start = MIDIbuf_init (mem_start);
} }
#endif
#ifndef EXCLUDE_SEQUENCER
if ((num_midis + num_synths) && !seq_initialized) if ((num_midis + num_synths) && !seq_initialized)
{ {
seq_initialized = 1; seq_initialized = 1;
mem_start = sequencer_init (mem_start); mem_start = sequencer_init (mem_start);
} }
#endif
return TRUE; return TRUE;
} }
@ -272,6 +324,7 @@ tenmicrosec (void)
inb (0x80); inb (0x80);
} }
#ifndef EXCLUDE_SEQUENCER
void void
request_sound_timer (int count) request_sound_timer (int count)
{ {
@ -305,6 +358,7 @@ sound_stop_timer (void)
untimeout ((timeout_func_t)sequencer_timer, 0); untimeout ((timeout_func_t)sequencer_timer, 0);
timer_running = 0; timer_running = 0;
} }
#endif
#ifndef EXCLUDE_AUDIO #ifndef EXCLUDE_AUDIO
static void static void
@ -365,9 +419,6 @@ sound_mem_init (void)
#endif #endif
struct isa_driver snddriver =
{sndprobe, sndattach, "snd"};
int int
snd_ioctl_return (int *addr, int value) snd_ioctl_return (int *addr, int value)
{ {

View File

@ -285,7 +285,11 @@ attach_uart6850 (long mem_start, struct address_info *hw_config)
RESTORE_INTR (flags); RESTORE_INTR (flags);
#ifdef __FreeBSD__
printk ("uart0: <6850 Midi Interface>");
#else
printk (" <6850 Midi Interface>"); printk (" <6850 Midi Interface>");
#endif
std_midi_synth.midi_dev = my_dev = num_midis; std_midi_synth.midi_dev = my_dev = num_midis;
midi_devs[num_midis++] = &uart6850_operations; midi_devs[num_midis++] = &uart6850_operations;