1 /* sound_config.h 2 * 3 * A driver for Soundcards, misc configuration parameters. 4 * 5 * 6 * Copyright by Hannu Savolainen 1995 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 1. Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 */ 30
31 #undefCONFIGURE_SOUNDCARD 32 #undef DYNAMIC_BUFFER
33
34 #include "local.h"
35
36 #ifdef KERNEL_SOUNDCARD
37 #defineCONFIGURE_SOUNDCARD 38 #define DYNAMIC_BUFFER
39 #undef LOADABLE_SOUNDCARD
40 #endif 41
42 #include "os.h"
43 #include "soundvers.h"
44
45 #if !defined(PSS_MPU_BASE) && defined(EXCLUDE_SSCAPE) && \
46 defined(EXCLUDE_TRIX) && !defined(MAD16_MPU_BASE) && \
47 defined(EXCLUDE_CS4232) && defined(EXCLUDE_MAUI)
48 #defineEXCLUDE_MPU_EMU 49 #endif 50
51 #ifdefined(ISC) || defined(SCO) || defined(SVR42)
52 #define GENERIC_SYSV
53 #endif 54
55 /* 56 * Disable the AD1848 driver if there are no other drivers requiring it. 57 */ 58
59 #ifdefined(EXCLUDE_GUS16) && defined(EXCLUDE_MSS) && \
60 defined(EXCLUDE_PSS) && defined(EXCLUDE_GUSMAX) && \
61 defined(EXCLUDE_SSCAPE) && defined(EXCLUDE_TRIX) && defined(EXCLUDE_MAD16) && \
62 defined(EXCLUDE_CS4232) && defined(EXCLUDE_PNP)
63 #defineEXCLUDE_AD1848 64 #endif 65
66 #ifdefPSS_MSS_BASE 67 #undefEXCLUDE_AD1848 68 #endif 69
70 #ifdefEXCLUDE_SEQUENCER 71 #defineEXCLUDE_MIDI 72 #defineEXCLUDE_YM3812 73 #define EXCLUDE_OPL3
74 #endif 75
76 #ifndefSND_DEFAULT_ENABLE 77 #defineSND_DEFAULT_ENABLE 1
78 #endif 79
80 #ifdefCONFIGURE_SOUNDCARD 81
82 #ifndefMAX_REALTIME_FACTOR 83 #defineMAX_REALTIME_FACTOR 4
84 #endif 85
86 /************* PCM DMA buffer sizes *******************/ 87
88 /* If you are using high playback or recording speeds, the default buffersize 89 is too small. DSP_BUFFSIZE must be 64k or less. 90
91 A rule of thumb is 64k for PAS16, 32k for PAS+, 16k for SB Pro and 92 4k for SB. 93
94 If you change the DSP_BUFFSIZE, don't modify this file. 95 Use the make config command instead. */ 96
97 #ifndefDSP_BUFFSIZE 98 #defineDSP_BUFFSIZE (4096)
99 #endif 100
101 #ifndefDSP_BUFFCOUNT 102 #defineDSP_BUFFCOUNT 1 /* 1 is recommended. */ 103 #endif 104
105 #defineDMA_AUTOINIT 0x10
106
107 #defineFM_MONO 0x388 /* This is the I/O address used by AdLib */ 108
109 #ifndefPAS_BASE 110 #definePAS_BASE 0x388
111 #endif 112
113 #ifdefJAZZ16 114 #ifndefJAZZ_DMA16 115 #defineJAZZ_DMA16 5
116 #endif 117 #endif 118
119 /* SEQ_MAX_QUEUE is the maximum number of sequencer events buffered by the 120 driver. (There is no need to alter this) */ 121 #defineSEQ_MAX_QUEUE 1024
122
123 #defineSBFM_MAXINSTR (256) /* Size of the FM Instrument bank */ 124 /* 128 instruments for general MIDI setup and 16 unassigned */ 125
126 /* 127 * Minor numbers for the sound driver. 128 * 129 * Unfortunately Creative called the codec chip of SB as a DSP. For this 130 * reason the /dev/dsp is reserved for digitized audio use. There is a 131 * device for true DSP processors but it will be called something else. 132 * In v3.0 it's /dev/sndproc but this could be a temporary solution. 133 */ 134
135 #defineSND_NDEVS 256 /* Number of supported devices */ 136 #defineSND_DEV_CTL 0 /* Control port /dev/mixer */ 137 #defineSND_DEV_SEQ 1 /* Sequencer output /dev/sequencer (FM 138 synthesizer and MIDI output) */ 139 #defineSND_DEV_MIDIN 2 /* Raw midi access */ 140 #defineSND_DEV_DSP 3 /* Digitized voice /dev/dsp */ 141 #defineSND_DEV_AUDIO 4 /* Sparc compatible /dev/audio */ 142 #defineSND_DEV_DSP16 5 /* Like /dev/dsp but 16 bits/sample */ 143 #defineSND_DEV_STATUS 6 /* /dev/sndstat */ 144 /* #7 not in use now. Was in 2.4. Free for use after v3.0. */ 145 #defineSND_DEV_SEQ2 8 /* /dev/sequecer, level 2 interface */ 146 #defineSND_DEV_SNDPROC 9 /* /dev/sndproc for programmable devices */ 147 #define SND_DEV_PSS SND_DEV_SNDPROC 148
149 #defineDSP_DEFAULT_SPEED 8000
150
151 #defineON 1
152 #defineOFF 0
153
154 #defineMAX_AUDIO_DEV 5
155 #defineMAX_MIXER_DEV 5
156 #defineMAX_SYNTH_DEV 3
157 #defineMAX_MIDI_DEV 6
158 #defineMAX_TIMER_DEV 3
159
160 structfileinfo{ 161 intmode; /* Open mode */ 162 structfile *filp; /* Reference to file-flags. OS-dependent. */ 163 };
164
165 structaddress_info{ 166 intio_base;
167 intirq;
168 intdma;
169 intdma2;
170 intalways_detect; /* 1=Trust me, it's there */ 171 char *name;
172 intdriver_use_1; /* Driver defined field 1 */ 173 intdriver_use_2; /* Driver defined field 2 */ 174 sound_os_info *osp; /* OS spesific info */ 175 };
176
177 #defineSYNTH_MAX_VOICES 32
178
179 structvoice_alloc_info{ 180 intmax_voice;
181 int used_voices;
182 intptr; /* For device specific use */ 183 unsignedshortmap[SYNTH_MAX_VOICES]; /* (ch << 8) | (note+1) */ 184 inttimestamp;
185 intalloc_times[SYNTH_MAX_VOICES];
186 };
187
188 structchannel_info{ 189 intpgm_num;
190 intbender_value;
191 unsignedcharcontrollers[128];
192 };
193
194 /* 195 * Process wakeup reasons 196 */ 197 #defineWK_NONE 0x00
198 #defineWK_WAKEUP 0x01
199 #defineWK_TIMEOUT 0x02
200 #define WK_SIGNAL 0x04
201 #defineWK_SLEEP 0x08
202
203 #defineOPEN_READPCM_ENABLE_INPUT 204 #defineOPEN_WRITEPCM_ENABLE_OUTPUT 205 #defineOPEN_READWRITE (OPEN_READ|OPEN_WRITE)
206
207 #include "sound_calls.h"
208 #include "dev_table.h"
209
210 #ifndefDEB 211 #defineDEB(x)
212 #endif 213
214 #ifndefDDB 215 #defineDDB(x)
216 #endif 217
218 #defineTIMER_ARMED 121234
219 #defineTIMER_NOT_ARMED 1
220
221 #endif