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