1993-10-29 03:44:07 +00:00
|
|
|
/* sound_config.h
|
|
|
|
*
|
|
|
|
* A driver for Soundcards, misc configuration parameters.
|
|
|
|
*
|
1995-07-28 21:40:49 +00:00
|
|
|
*
|
1993-10-29 03:44:07 +00:00
|
|
|
* Copyright by Hannu Savolainen 1993
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
*/
|
1993-10-23 10:55:52 +00:00
|
|
|
|
|
|
|
#include "local.h"
|
1995-07-28 21:40:49 +00:00
|
|
|
#include "os.h"
|
|
|
|
#include "soundvers.h"
|
|
|
|
|
|
|
|
#if !defined(PSS_MPU_BASE) && defined(EXCLUDE_SSCAPE) && defined(EXCLUDE_TRIX)
|
|
|
|
#define EXCLUDE_MPU_EMU
|
|
|
|
#endif
|
1993-10-23 10:55:52 +00:00
|
|
|
|
1994-10-01 02:17:17 +00:00
|
|
|
#if defined(ISC) || defined(SCO) || defined(SVR42)
|
|
|
|
#define GENERIC_SYSV
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Disable the AD1848 driver if there are no other drivers requiring it.
|
|
|
|
*/
|
|
|
|
|
1995-07-28 21:40:49 +00:00
|
|
|
#if defined(EXCLUDE_GUS16) && defined(EXCLUDE_MSS) && defined(EXCLUDE_PSS) && defined(EXCLUDE_GUSMAX) && defined(EXCLUDE_SSCAPE) && defined(EXCLUDE_TRIX)
|
1994-10-01 02:17:17 +00:00
|
|
|
#define EXCLUDE_AD1848
|
|
|
|
#endif
|
1994-03-11 10:27:25 +00:00
|
|
|
|
1995-07-28 21:40:49 +00:00
|
|
|
#ifdef PSS_MSS_BASE
|
|
|
|
#undef EXCLUDE_AD1848
|
|
|
|
#endif
|
|
|
|
|
1994-03-11 10:27:25 +00:00
|
|
|
#undef CONFIGURE_SOUNDCARD
|
|
|
|
#undef DYNAMIC_BUFFER
|
|
|
|
|
|
|
|
#ifdef KERNEL_SOUNDCARD
|
|
|
|
#define CONFIGURE_SOUNDCARD
|
|
|
|
#define DYNAMIC_BUFFER
|
|
|
|
#undef LOADABLE_SOUNDCARD
|
|
|
|
#endif
|
|
|
|
|
1993-10-23 10:55:52 +00:00
|
|
|
#ifdef EXCLUDE_SEQUENCER
|
1995-07-28 21:40:49 +00:00
|
|
|
#define EXCLUDE_MIDI
|
1993-10-23 10:55:52 +00:00
|
|
|
#define EXCLUDE_YM3812
|
1995-07-28 21:40:49 +00:00
|
|
|
#define EXCLUDE_OPL3
|
1993-10-23 10:55:52 +00:00
|
|
|
#endif
|
|
|
|
|
1994-03-11 10:27:25 +00:00
|
|
|
#ifndef SND_DEFAULT_ENABLE
|
|
|
|
#define SND_DEFAULT_ENABLE 1
|
|
|
|
#endif
|
|
|
|
|
1993-10-23 10:55:52 +00:00
|
|
|
#ifdef CONFIGURE_SOUNDCARD
|
|
|
|
|
|
|
|
/* ****** IO-address, DMA and IRQ settings ****
|
|
|
|
|
|
|
|
If your card has nonstandard I/O address or IRQ number, change defines
|
|
|
|
for the following settings in your kernel Makefile */
|
|
|
|
|
|
|
|
#ifndef SBC_BASE
|
|
|
|
#define SBC_BASE 0x220 /* 0x220 is the factory default. */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef SBC_IRQ
|
|
|
|
#define SBC_IRQ 7 /* IQR7 is the factory default. */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef SBC_DMA
|
|
|
|
#define SBC_DMA 1
|
|
|
|
#endif
|
|
|
|
|
1994-03-11 10:27:25 +00:00
|
|
|
#ifndef SB16_DMA
|
|
|
|
#define SB16_DMA 6
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef SB16MIDI_BASE
|
|
|
|
#define SB16MIDI_BASE 0x300
|
|
|
|
#endif
|
|
|
|
|
1993-10-23 10:55:52 +00:00
|
|
|
#ifndef PAS_BASE
|
|
|
|
#define PAS_BASE 0x388
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef PAS_IRQ
|
|
|
|
#define PAS_IRQ 5
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef PAS_DMA
|
|
|
|
#define PAS_DMA 3
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef GUS_BASE
|
|
|
|
#define GUS_BASE 0x220
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef GUS_IRQ
|
|
|
|
#define GUS_IRQ 15
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef GUS_MIDI_IRQ
|
|
|
|
#define GUS_MIDI_IRQ GUS_IRQ
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef GUS_DMA
|
|
|
|
#define GUS_DMA 6
|
|
|
|
#endif
|
|
|
|
|
1995-07-28 21:40:49 +00:00
|
|
|
#ifndef GUS_DMA_READ
|
|
|
|
#define GUS_DMA_READ 3
|
1995-03-05 22:11:57 +00:00
|
|
|
#endif
|
|
|
|
|
1993-10-23 10:55:52 +00:00
|
|
|
#ifndef MPU_BASE
|
|
|
|
#define MPU_BASE 0x330
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef MPU_IRQ
|
|
|
|
#define MPU_IRQ 6
|
|
|
|
#endif
|
|
|
|
|
1994-10-01 02:17:17 +00:00
|
|
|
/* Echo Personal Sound System */
|
|
|
|
#ifndef PSS_BASE
|
|
|
|
#define PSS_BASE 0x220 /* 0x240 or */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef PSS_IRQ
|
|
|
|
#define PSS_IRQ 7
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef PSS_DMA
|
|
|
|
#define PSS_DMA 1
|
|
|
|
#endif
|
|
|
|
|
1995-07-28 21:40:49 +00:00
|
|
|
#ifndef MSS_BASE
|
|
|
|
#define MSS_BASE 0
|
1994-10-01 02:17:17 +00:00
|
|
|
#endif
|
|
|
|
|
1995-07-28 21:40:49 +00:00
|
|
|
#ifndef MSS_DMA
|
|
|
|
#define MSS_DMA 0
|
1994-10-01 02:17:17 +00:00
|
|
|
#endif
|
|
|
|
|
1995-05-30 08:16:23 +00:00
|
|
|
#ifndef MSS_IRQ
|
1995-07-28 21:40:49 +00:00
|
|
|
#define MSS_IRQ 0
|
1994-10-01 02:17:17 +00:00
|
|
|
#endif
|
|
|
|
|
1995-07-28 21:40:49 +00:00
|
|
|
#ifndef GUS16_BASE
|
|
|
|
#define GUS16_BASE 0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef GUS16_DMA
|
|
|
|
#define GUS16_DMA 0
|
1994-03-11 10:27:25 +00:00
|
|
|
#endif
|
|
|
|
|
1995-07-28 21:40:49 +00:00
|
|
|
#ifndef GUS16_IRQ
|
|
|
|
#define GUS16_IRQ 0
|
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
1995-03-12 23:34:12 +00:00
|
|
|
#endif
|
|
|
|
|
1995-07-28 21:40:49 +00:00
|
|
|
#ifndef SSCAPE_BASE
|
|
|
|
#define SSCAPE_BASE 0
|
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
1995-03-12 23:34:12 +00:00
|
|
|
#endif
|
|
|
|
|
1995-07-28 21:40:49 +00:00
|
|
|
#ifndef SSCAPE_DMA
|
|
|
|
#define SSCAPE_DMA 0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef SSCAPE_IRQ
|
|
|
|
#define SSCAPE_IRQ 0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef SSCAPE_MSS_BASE
|
|
|
|
#define SSCAPE_MSS_BASE 0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef SSCAPE_MSS_DMA
|
|
|
|
#define SSCAPE_MSS_DMA 0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef SSCAPE_MSS_IRQ
|
|
|
|
#define SSCAPE_MSS_IRQ 0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef TRIX_BASE
|
|
|
|
#define TRIX_BASE 0x530
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef TRIX_IRQ
|
|
|
|
#define TRIX_IRQ 10
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef TRIX_DMA
|
|
|
|
#define TRIX_DMA 1
|
|
|
|
#endif
|
|
|
|
|
1995-07-29 14:20:54 +00:00
|
|
|
#ifndef U6850_BASE
|
|
|
|
#define U6850_BASE 0x330
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef U6850_IRQ
|
|
|
|
#define U6850_IRQ 5
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef U6850_DMA
|
|
|
|
#define U6850_DMA 1
|
|
|
|
#endif
|
|
|
|
|
1995-07-28 21:40:49 +00:00
|
|
|
#ifndef MAX_REALTIME_FACTOR
|
|
|
|
#define MAX_REALTIME_FACTOR 4
|
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
1995-03-12 23:34:12 +00:00
|
|
|
#endif
|
|
|
|
|
1993-10-23 10:55:52 +00:00
|
|
|
/************* PCM DMA buffer sizes *******************/
|
|
|
|
|
|
|
|
/* If you are using high playback or recording speeds, the default buffersize
|
|
|
|
is too small. DSP_BUFFSIZE must be 64k or less.
|
|
|
|
|
|
|
|
A rule of thumb is 64k for PAS16, 32k for PAS+, 16k for SB Pro and
|
|
|
|
4k for SB.
|
|
|
|
|
|
|
|
If you change the DSP_BUFFSIZE, don't modify this file.
|
|
|
|
Use the make config command instead. */
|
|
|
|
|
|
|
|
#ifndef DSP_BUFFSIZE
|
|
|
|
#define DSP_BUFFSIZE (4096)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef DSP_BUFFCOUNT
|
|
|
|
#define DSP_BUFFCOUNT 2 /* 2 is recommended. */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define DMA_AUTOINIT 0x10
|
|
|
|
|
|
|
|
#define FM_MONO 0x388 /* This is the I/O address used by AdLib */
|
|
|
|
|
|
|
|
/* SEQ_MAX_QUEUE is the maximum number of sequencer events buffered by the
|
|
|
|
driver. (There is no need to alter this) */
|
1993-10-29 03:44:07 +00:00
|
|
|
#define SEQ_MAX_QUEUE 1024
|
1993-10-23 10:55:52 +00:00
|
|
|
|
1994-10-01 02:17:17 +00:00
|
|
|
#define SBFM_MAXINSTR (256) /* Size of the FM Instrument bank */
|
1993-10-23 10:55:52 +00:00
|
|
|
/* 128 instruments for general MIDI setup and 16 unassigned */
|
|
|
|
|
1994-10-01 02:17:17 +00:00
|
|
|
/*
|
|
|
|
* Minor numbers for the sound driver.
|
|
|
|
*
|
|
|
|
* Unfortunately Creative called the codec chip of SB as a DSP. For this
|
|
|
|
* reason the /dev/dsp is reserved for digitized audio use. There is a
|
|
|
|
* device for true DSP processors but it will be called something else.
|
|
|
|
* In v3.0 it's /dev/sndproc but this could be a temporary solution.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define SND_NDEVS 256 /* Number of supported devices */
|
1993-10-23 10:55:52 +00:00
|
|
|
#define SND_DEV_CTL 0 /* Control port /dev/mixer */
|
|
|
|
#define SND_DEV_SEQ 1 /* Sequencer output /dev/sequencer (FM
|
|
|
|
synthesizer and MIDI output) */
|
1994-10-01 02:17:17 +00:00
|
|
|
#define SND_DEV_MIDIN 2 /* Raw midi access */
|
1993-10-23 10:55:52 +00:00
|
|
|
#define SND_DEV_DSP 3 /* Digitized voice /dev/dsp */
|
|
|
|
#define SND_DEV_AUDIO 4 /* Sparc compatible /dev/audio */
|
|
|
|
#define SND_DEV_DSP16 5 /* Like /dev/dsp but 16 bits/sample */
|
1994-10-01 02:17:17 +00:00
|
|
|
#define SND_DEV_STATUS 6 /* /dev/sndstat */
|
|
|
|
/* #7 not in use now. Was in 2.4. Free for use after v3.0. */
|
1995-07-28 21:40:49 +00:00
|
|
|
#define SND_DEV_SEQ2 8 /* /dev/sequecer, level 2 interface */
|
1994-10-01 02:17:17 +00:00
|
|
|
#define SND_DEV_SNDPROC 9 /* /dev/sndproc for programmable devices */
|
|
|
|
#define SND_DEV_PSS SND_DEV_SNDPROC
|
1993-10-23 10:55:52 +00:00
|
|
|
|
|
|
|
#define DSP_DEFAULT_SPEED 8000
|
|
|
|
|
|
|
|
#define ON 1
|
|
|
|
#define OFF 0
|
|
|
|
|
1994-10-01 02:17:17 +00:00
|
|
|
#define MAX_AUDIO_DEV 5
|
1995-07-28 21:40:49 +00:00
|
|
|
#define MAX_MIXER_DEV 5
|
1993-10-23 10:55:52 +00:00
|
|
|
#define MAX_SYNTH_DEV 3
|
1994-10-01 02:17:17 +00:00
|
|
|
#define MAX_MIDI_DEV 6
|
|
|
|
#define MAX_TIMER_DEV 3
|
1993-10-23 10:55:52 +00:00
|
|
|
|
|
|
|
struct fileinfo {
|
1995-07-28 21:40:49 +00:00
|
|
|
int mode; /* Open mode */
|
|
|
|
DECLARE_FILE(); /* Reference to file-flags. OS-dependent. */
|
1993-10-23 10:55:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct address_info {
|
|
|
|
int io_base;
|
|
|
|
int irq;
|
1995-07-28 21:40:49 +00:00
|
|
|
int dma; /* write dma channel */
|
|
|
|
int dma_read; /* read dma channel */
|
|
|
|
int always_detect; /* 1=Trust me, it's there */
|
1993-10-23 10:55:52 +00:00
|
|
|
};
|
|
|
|
|
1994-10-01 02:17:17 +00:00
|
|
|
#define SYNTH_MAX_VOICES 32
|
|
|
|
|
|
|
|
struct voice_alloc_info {
|
|
|
|
int max_voice;
|
|
|
|
int used_voices;
|
|
|
|
int ptr; /* For device specific use */
|
|
|
|
unsigned short map[SYNTH_MAX_VOICES]; /* (ch << 8) | (note+1) */
|
1995-07-28 21:40:49 +00:00
|
|
|
int timestamp;
|
|
|
|
int alloc_times[SYNTH_MAX_VOICES];
|
1994-10-01 02:17:17 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct channel_info {
|
|
|
|
int pgm_num;
|
1995-07-28 21:40:49 +00:00
|
|
|
int bender_value;
|
1994-10-01 02:17:17 +00:00
|
|
|
unsigned char controllers[128];
|
|
|
|
};
|
|
|
|
|
1994-03-11 10:27:25 +00:00
|
|
|
/*
|
|
|
|
* Process wakeup reasons
|
|
|
|
*/
|
|
|
|
#define WK_NONE 0x00
|
|
|
|
#define WK_WAKEUP 0x01
|
|
|
|
#define WK_TIMEOUT 0x02
|
|
|
|
#define WK_SIGNAL 0x04
|
|
|
|
#define WK_SLEEP 0x08
|
|
|
|
|
1993-10-23 10:55:52 +00:00
|
|
|
#define OPEN_READ 1
|
|
|
|
#define OPEN_WRITE 2
|
|
|
|
#define OPEN_READWRITE 3
|
|
|
|
|
|
|
|
#include "sound_calls.h"
|
|
|
|
#include "dev_table.h"
|
1993-10-29 03:44:07 +00:00
|
|
|
|
|
|
|
#ifndef DEB
|
|
|
|
#define DEB(x)
|
1995-07-28 21:40:49 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef AUDIO_DDB
|
|
|
|
#define AUDIO_DDB(x)
|
|
|
|
#endif
|
1994-10-01 02:17:17 +00:00
|
|
|
|
|
|
|
#define TIMER_ARMED 121234
|
|
|
|
#define TIMER_NOT_ARMED 1
|
|
|
|
|
1993-10-23 10:55:52 +00:00
|
|
|
#endif
|