1 /* sound_config.h
2 *
3 * A driver for Soundcards, misc configuration parameters.
4 *
5 *
6 * Copyright by Hannu Savolainen 1993
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 #include "local.h"
32 #include "os.h"
33 #include "soundvers.h"
34
35 #if !defined(PSS_MPU_BASE) && defined(EXCLUDE_SSCAPE) && \
36 defined(EXCLUDE_TRIX) && !defined(MAD16_MPU_BASE)
37 #define EXCLUDE_MPU_EMU
38 #endif
39
40 #if defined(ISC) || defined(SCO) || defined(SVR42)
41 #define GENERIC_SYSV
42 #endif
43
44 /*
45 * Disable the AD1848 driver if there are no other drivers requiring it.
46 */
47
48 #if defined(EXCLUDE_GUS16) && defined(EXCLUDE_MSS) && \
49 defined(EXCLUDE_PSS) && defined(EXCLUDE_GUSMAX) && \
50 defined(EXCLUDE_SSCAPE) && defined(EXCLUDE_TRIX) && defined(EXCLUDE_MAD16)
51 #define EXCLUDE_AD1848
52 #endif
53
54 #ifdef PSS_MSS_BASE
55 #undef EXCLUDE_AD1848
56 #endif
57
58 #undef CONFIGURE_SOUNDCARD
59 #undef DYNAMIC_BUFFER
60
61 #ifdef KERNEL_SOUNDCARD
62 #define CONFIGURE_SOUNDCARD
63 #define DYNAMIC_BUFFER
64 #undef LOADABLE_SOUNDCARD
65 #endif
66
67 #ifdef EXCLUDE_SEQUENCER
68 #define EXCLUDE_MIDI
69 #define EXCLUDE_YM3812
70 #define EXCLUDE_OPL3
71 #endif
72
73 #ifndef SND_DEFAULT_ENABLE
74 #define SND_DEFAULT_ENABLE 1
75 #endif
76
77 #ifdef CONFIGURE_SOUNDCARD
78
79 #ifndef MAX_REALTIME_FACTOR
80 #define MAX_REALTIME_FACTOR 4
81 #endif
82
83 /************* PCM DMA buffer sizes *******************/
84
85 /* If you are using high playback or recording speeds, the default buffersize
86 is too small. DSP_BUFFSIZE must be 64k or less.
87
88 A rule of thumb is 64k for PAS16, 32k for PAS+, 16k for SB Pro and
89 4k for SB.
90
91 If you change the DSP_BUFFSIZE, don't modify this file.
92 Use the make config command instead. */
93
94 #ifndef DSP_BUFFSIZE
95 #define DSP_BUFFSIZE (4096)
96 #endif
97
98 #ifndef DSP_BUFFCOUNT
99 #define DSP_BUFFCOUNT 2 /* 2 is recommended. */
100 #endif
101
102 #define DMA_AUTOINIT 0x10
103
104 #define FM_MONO 0x388 /* This is the I/O address used by AdLib */
105
106 #ifndef PAS_BASE
107 #define PAS_BASE 0x388
108 #endif
109
110 /* SEQ_MAX_QUEUE is the maximum number of sequencer events buffered by the
111 driver. (There is no need to alter this) */
112 #define SEQ_MAX_QUEUE 1024
113
114 #define SBFM_MAXINSTR (256) /* Size of the FM Instrument bank */
115 /* 128 instruments for general MIDI setup and 16 unassigned */
116
117 /*
118 * Minor numbers for the sound driver.
119 *
120 * Unfortunately Creative called the codec chip of SB as a DSP. For this
121 * reason the /dev/dsp is reserved for digitized audio use. There is a
122 * device for true DSP processors but it will be called something else.
123 * In v3.0 it's /dev/sndproc but this could be a temporary solution.
124 */
125
126 #define SND_NDEVS 256 /* Number of supported devices */
127 #define SND_DEV_CTL 0 /* Control port /dev/mixer */
128 #define SND_DEV_SEQ 1 /* Sequencer output /dev/sequencer (FM
129 synthesizer and MIDI output) */
130 #define SND_DEV_MIDIN 2 /* Raw midi access */
131 #define SND_DEV_DSP 3 /* Digitized voice /dev/dsp */
132 #define SND_DEV_AUDIO 4 /* Sparc compatible /dev/audio */
133 #define SND_DEV_DSP16 5 /* Like /dev/dsp but 16 bits/sample */
134 #define SND_DEV_STATUS 6 /* /dev/sndstat */
135 /* #7 not in use now. Was in 2.4. Free for use after v3.0. */
136 #define SND_DEV_SEQ2 8 /* /dev/sequecer, level 2 interface */
137 #define SND_DEV_SNDPROC 9 /* /dev/sndproc for programmable devices */
138 #define SND_DEV_PSS SND_DEV_SNDPROC
139
140 #define DSP_DEFAULT_SPEED 8000
141
142 #define ON 1
143 #define OFF 0
144
145 #define MAX_AUDIO_DEV 5
146 #define MAX_MIXER_DEV 5
147 #define MAX_SYNTH_DEV 3
148 #define MAX_MIDI_DEV 6
149 #define MAX_TIMER_DEV 3
150
151 struct fileinfo {
152 int mode; /* Open mode */
153 DECLARE_FILE(); /* Reference to file-flags. OS-dependent. */
154 };
155
156 struct address_info {
157 int io_base;
158 int irq;
159 int dma;
160 int always_detect; /* 1=Trust me, it's there */
161 };
162
163 #define SYNTH_MAX_VOICES 32
164
165 struct voice_alloc_info {
166 int max_voice;
167 int used_voices;
168 int ptr; /* For device specific use */
169 unsigned short map[SYNTH_MAX_VOICES]; /* (ch << 8) | (note+1) */
170 int timestamp;
171 int alloc_times[SYNTH_MAX_VOICES];
172 };
173
174 struct channel_info {
175 int pgm_num;
176 int bender_value;
177 unsigned char controllers[128];
178 };
179
180 /*
181 * Process wakeup reasons
182 */
183 #define WK_NONE 0x00
184 #define WK_WAKEUP 0x01
185 #define WK_TIMEOUT 0x02
186 #define WK_SIGNAL 0x04
187 #define WK_SLEEP 0x08
188
189 #define OPEN_READ 1
190 #define OPEN_WRITE 2
191 #define OPEN_READWRITE 3
192
193 #include "sound_calls.h"
194 #include "dev_table.h"
195
196 #ifndef DEB
197 #define DEB(x)
198 #endif
199
200 #ifndef DDB
201 #define DDB(x)
202 #endif
203
204 #define TIMER_ARMED 121234
205 #define TIMER_NOT_ARMED 1
206
207 #endif