1 /* sound_config.h
2 *
3 * A driver for Soundcards, misc configuration parameters.
4 */
5 /*
6 * Copyright by Hannu Savolainen 1993-1996
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are
10 * met: 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 2.
12 * Redistributions in binary form must reproduce the above copyright notice,
13 * this list of conditions and the following disclaimer in the documentation
14 * and/or other materials provided with the distribution.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
20 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 */
28
29
30 #include "local.h"
31 #include "os.h"
32 #include "soundvers.h"
33
34 #if defined(ISC) || defined(SCO) || defined(SVR42)
35 #define GENERIC_SYSV
36 #endif
37
38
39
40
41
42
43 #ifndef SND_DEFAULT_ENABLE
44 #define SND_DEFAULT_ENABLE 1
45 #endif
46
47 #ifndef MAX_REALTIME_FACTOR
48 #define MAX_REALTIME_FACTOR 4
49 #endif
50
51 /************* PCM DMA buffer sizes *******************/
52
53 /* If you are using high playback or recording speeds, the default buffersize
54 is too small. DSP_BUFFSIZE must be 64k or less.
55
56 A rule of thumb is 64k for PAS16, 32k for PAS+, 16k for SB Pro and
57 4k for SB.
58
59 If you change the DSP_BUFFSIZE, don't modify this file.
60 Use the make config command instead. */
61
62 #ifndef DSP_BUFFSIZE
63 #define DSP_BUFFSIZE (4096)
64 #endif
65
66 #ifndef DSP_BUFFCOUNT
67 #define DSP_BUFFCOUNT 1 /* 1 is recommended. */
68 #endif
69
70 #define DMA_AUTOINIT 0x10
71
72 #define FM_MONO 0x388 /* This is the I/O address used by AdLib */
73
74 #ifndef PAS_BASE
75 #define PAS_BASE 0x388
76 #endif
77
78 #if defined(SB16_DMA) && !defined(SB_DMA2)
79 # define SB_DMA2 SB16_DMA
80 #endif
81
82 #if defined(SB16MIDI_BASE) && !defined(SB_MPU_BASE)
83 # define SB_MPU_BASE SB16MIDI_BASE
84 #endif
85
86 #ifndef SB_MPU_IRQ
87 # define SB_MPU_IRQ SBC_IRQ
88 #endif
89
90 /* SEQ_MAX_QUEUE is the maximum number of sequencer events buffered by the
91 driver. (There is no need to alter this) */
92 #define SEQ_MAX_QUEUE 1024
93
94 #define SBFM_MAXINSTR (256) /* Size of the FM Instrument bank */
95 /* 128 instruments for general MIDI setup and 16 unassigned */
96
97 /*
98 * Minor numbers for the sound driver.
99 *
100 * Unfortunately Creative called the codec chip of SB as a DSP. For this
101 * reason the /dev/dsp is reserved for digitized audio use. There is a
102 * device for true DSP processors but it will be called something else.
103 * In v3.0 it's /dev/sndproc but this could be a temporary solution.
104 */
105
106 #define SND_NDEVS 256 /* Number of supported devices */
107 #define SND_DEV_CTL 0 /* Control port /dev/mixer */
108 #define SND_DEV_SEQ 1 /* Sequencer output /dev/sequencer (FM
109 synthesizer and MIDI output) */
110 #define SND_DEV_MIDIN 2 /* Raw midi access */
111 #define SND_DEV_DSP 3 /* Digitized voice /dev/dsp */
112 #define SND_DEV_AUDIO 4 /* Sparc compatible /dev/audio */
113 #define SND_DEV_DSP16 5 /* Like /dev/dsp but 16 bits/sample */
114 #define SND_DEV_STATUS 6 /* /dev/sndstat */
115 /* #7 not in use now. Was in 2.4. Free for use after v3.0. */
116 #define SND_DEV_SEQ2 8 /* /dev/sequencer, level 2 interface */
117 #define SND_DEV_SNDPROC 9 /* /dev/sndproc for programmable devices */
118 #define SND_DEV_PSS SND_DEV_SNDPROC
119
120 #define DSP_DEFAULT_SPEED 8000
121
122 #define ON 1
123 #define OFF 0
124
125 #define MAX_AUDIO_DEV 5
126 #define MAX_MIXER_DEV 5
127 #define MAX_SYNTH_DEV 3
128 #define MAX_MIDI_DEV 6
129 #define MAX_TIMER_DEV 3
130
131 struct fileinfo {
132 int mode; /* Open mode */
133 int flags;
134 int dummy; /* Reference to file-flags. OS-dependent. */
135 };
136
137 struct address_info {
138 int io_base;
139 int irq;
140 int dma;
141 int dma2;
142 int always_detect; /* 1=Trust me, it's there */
143 char *name;
144 int driver_use_1; /* Driver defined field 1 */
145 int driver_use_2; /* Driver defined field 2 */
146 int *osp; /* OS specific info */
147 int card_subtype; /* Driver specific. Usually 0 */
148 };
149
150 #define SYNTH_MAX_VOICES 32
151
152 struct voice_alloc_info {
153 int max_voice;
154 int used_voices;
155 int ptr; /* For device specific use */
156 unsigned short map[SYNTH_MAX_VOICES]; /* (ch << 8) | (note+1) */
157 int timestamp;
158 int alloc_times[SYNTH_MAX_VOICES];
159 };
160
161 struct channel_info {
162 int pgm_num;
163 int bender_value;
164 unsigned char controllers[128];
165 };
166
167 /*
168 * Process wakeup reasons
169 */
170 #define WK_NONE 0x00
171 #define WK_WAKEUP 0x01
172 #define WK_TIMEOUT 0x02
173 #define WK_SIGNAL 0x04
174 #define WK_SLEEP 0x08
175 #define WK_SELECT 0x10
176
177 #define OPEN_READ PCM_ENABLE_INPUT
178 #define OPEN_WRITE PCM_ENABLE_OUTPUT
179 #define OPEN_READWRITE (OPEN_READ|OPEN_WRITE)
180
181 #include "sound_calls.h"
182 #include "dev_table.h"
183
184 #ifndef DEB
185 #define DEB(x)
186 #endif
187
188 #ifndef DDB
189 #define DDB(x)
190 #endif
191
192 #define TIMER_ARMED 121234
193 #define TIMER_NOT_ARMED 1