1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32 #ifndef _DEV_TABLE_H_
33 #define _DEV_TABLE_H_
34
35
36
37
38
39
40
41
42
43 struct driver_info {
44 char *driver_id;
45 int card_type;
46 char *name;
47 long (*attach) (long mem_start, struct address_info *hw_config);
48 int (*probe) (struct address_info *hw_config);
49 void (*unload) (struct address_info *hw_config);
50 };
51
52 struct card_info {
53 int card_type;
54 struct address_info config;
55 int enabled;
56 void *for_driver_use;
57 };
58
59 typedef struct pnp_sounddev
60 {
61 int id;
62 void (*setup)(void *dev);
63 char *driver_name;
64 }pnp_sounddev;
65
66
67
68
69 #define MAX_SUB_BUFFERS (32*MAX_REALTIME_FACTOR)
70
71 #define DMODE_NONE 0
72 #define DMODE_OUTPUT 1
73 #define DMODE_INPUT 2
74
75 struct dma_buffparms {
76 int dma_mode;
77
78
79
80
81
82 char *raw_buf;
83 unsigned long raw_buf_phys;
84
85
86
87
88
89 unsigned long flags;
90 #define DMA_BUSY 0x00000001
91 #define DMA_RESTART 0x00000002
92 #define DMA_ACTIVE 0x00000004
93 #define DMA_STARTED 0x00000008
94 #define DMA_ALLOC_DONE 0x00000020
95
96 int open_mode;
97
98
99
100
101 int qlen;
102 int qhead;
103 int qtail;
104
105 int nbufs;
106 int counts[MAX_SUB_BUFFERS];
107 int subdivision;
108
109 int fragment_size;
110 int max_fragments;
111
112 int bytes_in_use;
113
114 int underrun_count;
115 int byte_counter;
116
117 int mapping_flags;
118 #define DMA_MAP_MAPPED 0x00000001
119 char neutral_byte;
120 };
121
122
123
124
125
126 typedef struct coproc_operations {
127 char name[32];
128 int (*open) (void *devc, int sub_device);
129 void (*close) (void *devc, int sub_device);
130 int (*ioctl) (void *devc, unsigned int cmd, ioctl_arg arg, int local);
131 void (*reset) (void *devc);
132
133 void *devc;
134 } coproc_operations;
135
136 struct audio_operations {
137 char name[32];
138 int flags;
139 #define NOTHING_SPECIAL 0
140 #define NEEDS_RESTART 1
141 #define DMA_AUTOMODE 2
142 #define DMA_DUPLEX 4
143 int format_mask;
144 void *devc;
145 int (*open) (int dev, int mode);
146 void (*close) (int dev);
147 void (*output_block) (int dev, unsigned long buf,
148 int count, int intrflag, int dma_restart);
149 void (*start_input) (int dev, unsigned long buf,
150 int count, int intrflag, int dma_restart);
151 int (*ioctl) (int dev, unsigned int cmd, ioctl_arg arg, int local);
152 int (*prepare_for_input) (int dev, int bufsize, int nbufs);
153 int (*prepare_for_output) (int dev, int bufsize, int nbufs);
154 void (*reset) (int dev);
155 void (*halt_xfer) (int dev);
156 int (*local_qlen)(int dev);
157 void (*copy_from_user)(int dev, char *localbuf, int localoffs,
158 const snd_rw_buf *userbuf, int useroffs, int len);
159 void (*halt_input) (int dev);
160 void (*halt_output) (int dev);
161 void (*trigger) (int dev, int bits);
162 long buffsize;
163 int dmachan1, dmachan2;
164 struct dma_buffparms *dmap_in, *dmap_out;
165 struct coproc_operations *coproc;
166 int mixer_dev;
167 int enable_bits;
168 int open_mode;
169 int go;
170 };
171
172 struct mixer_operations {
173 char name[32];
174 int (*ioctl) (int dev, unsigned int cmd, ioctl_arg arg);
175 };
176
177 struct synth_operations {
178 struct synth_info *info;
179 int midi_dev;
180 int synth_type;
181 int synth_subtype;
182
183 int (*open) (int dev, int mode);
184 void (*close) (int dev);
185 int (*ioctl) (int dev, unsigned int cmd, ioctl_arg arg);
186 int (*kill_note) (int dev, int voice, int note, int velocity);
187 int (*start_note) (int dev, int voice, int note, int velocity);
188 int (*set_instr) (int dev, int voice, int instr);
189 void (*reset) (int dev);
190 void (*hw_control) (int dev, unsigned char *event);
191 int (*load_patch) (int dev, int format, const snd_rw_buf *addr,
192 int offs, int count, int pmgr_flag);
193 void (*aftertouch) (int dev, int voice, int pressure);
194 void (*controller) (int dev, int voice, int ctrl_num, int value);
195 void (*panning) (int dev, int voice, int value);
196 void (*volume_method) (int dev, int mode);
197 int (*pmgr_interface) (int dev, struct patmgr_info *info);
198 void (*bender) (int dev, int chn, int value);
199 int (*alloc_voice) (int dev, int chn, int note, struct voice_alloc_info *alloc);
200 void (*setup_voice) (int dev, int voice, int chn);
201 int (*send_sysex)(int dev, unsigned char *bytes, int len);
202
203 struct voice_alloc_info alloc;
204 struct channel_info chn_info[16];
205 };
206
207 struct midi_input_info {
208 #define MI_MAX 10
209 int m_busy;
210 unsigned char m_buf[MI_MAX];
211 unsigned char m_prev_status;
212 int m_ptr;
213 #define MST_INIT 0
214 #define MST_DATA 1
215 #define MST_SYSEX 2
216 int m_state;
217 int m_left;
218 };
219
220 struct midi_operations {
221 struct midi_info info;
222 struct synth_operations *converter;
223 struct midi_input_info in_info;
224 int (*open) (int dev, int mode,
225 void (*inputintr)(int dev, unsigned char data),
226 void (*outputintr)(int dev)
227 );
228 void (*close) (int dev);
229 int (*ioctl) (int dev, unsigned int cmd, ioctl_arg arg);
230 int (*putc) (int dev, unsigned char data);
231 int (*start_read) (int dev);
232 int (*end_read) (int dev);
233 void (*kick)(int dev);
234 int (*command) (int dev, unsigned char *data);
235 int (*buffer_status) (int dev);
236 int (*prefix_cmd) (int dev, unsigned char status);
237 struct coproc_operations *coproc;
238 };
239
240 struct sound_lowlev_timer {
241 int dev;
242 unsigned int (*tmr_start)(int dev, unsigned int usecs);
243 void (*tmr_disable)(int dev);
244 void (*tmr_restart)(int dev);
245 };
246
247 struct sound_timer_operations {
248 struct sound_timer_info info;
249 int priority;
250 int devlink;
251 int (*open)(int dev, int mode);
252 void (*close)(int dev);
253 int (*event)(int dev, unsigned char *ev);
254 unsigned long (*get_time)(int dev);
255 int (*ioctl) (int dev, unsigned int cmd, ioctl_arg arg);
256 void (*arm_timer)(int dev, long time);
257 };
258
259 #ifdef _DEV_TABLE_C_
260 struct audio_operations *audio_devs[MAX_AUDIO_DEV] = {NULL}; int num_audiodevs = 0;
261 struct mixer_operations *mixer_devs[MAX_MIXER_DEV] = {NULL}; int num_mixers = 0;
262 struct synth_operations *synth_devs[MAX_SYNTH_DEV+MAX_MIDI_DEV] = {NULL}; int num_synths = 0;
263 struct midi_operations *midi_devs[MAX_MIDI_DEV] = {NULL}; int num_midis = 0;
264
265 #ifndef EXCLUDE_SEQUENCER
266 extern struct sound_timer_operations default_sound_timer;
267 struct sound_timer_operations *sound_timer_devs[MAX_TIMER_DEV] =
268 {&default_sound_timer, NULL};
269 int num_sound_timers = 1;
270 #else
271 struct sound_timer_operations *sound_timer_devs[MAX_TIMER_DEV] =
272 {NULL};
273 int num_sound_timers = 0;
274 #endif
275
276
277
278
279
280 struct driver_info sound_drivers[] = {
281 #ifndef EXCLUDE_PSS
282 {"PSSECHO", SNDCARD_PSS, "Echo Personal Sound System PSS (ESC614)", attach_pss, probe_pss, unload_pss},
283 # ifdef PSS_MPU_BASE
284 {"PSSMPU", SNDCARD_PSS_MPU, "PSS-MPU", attach_pss_mpu, probe_pss_mpu, unload_pss_mpu},
285 # endif
286 # ifdef PSS_MSS_BASE
287 {"PSSMSS", SNDCARD_PSS_MSS, "PSS-MSS", attach_pss_mss, probe_pss_mss, unload_pss_mss},
288 # endif
289 #endif
290 #ifndef EXCLUDE_MSS
291 {"MSS", SNDCARD_MSS, "MS Sound System", attach_ms_sound, probe_ms_sound, unload_ms_sound},
292 {"PCXBJ", SNDCARD_MSS, "MS Sound System", attach_ms_sound, probe_ms_sound, unload_ms_sound},
293 #endif
294 #ifndef EXCLUDE_MAD16
295 {"MAD16", SNDCARD_MAD16, "MAD16/Mozart (MSS)", attach_mad16, probe_mad16, unload_mad16},
296 {"MAD16MPU", SNDCARD_MAD16_MPU, "MAD16/Mozart (MPU)", attach_mad16_mpu, probe_mad16_mpu, unload_mad16_mpu},
297 #endif
298 #ifndef EXCLUDE_CS4232
299 {"CS4232", SNDCARD_CS4232, "CS4232", attach_cs4232, probe_cs4232, unload_cs4232},
300 {"CS4232MPU", SNDCARD_CS4232_MPU, "CS4232 MIDI", attach_cs4232_mpu, probe_cs4232_mpu, unload_cs4232_mpu},
301 #endif
302 #ifndef EXCLUDE_YM3812
303 {"OPL3", SNDCARD_ADLIB, "OPL-2/OPL-3 FM", attach_adlib_card, probe_adlib, unload_adlib},
304 #endif
305 #ifndef EXCLUDE_PAS
306 {"PAS16", SNDCARD_PAS, "ProAudioSpectrum", attach_pas_card, probe_pas, unload_pas},
307 #endif
308 #if !defined(EXCLUDE_MPU401) && !defined(EXCLUDE_MIDI)
309 {"MPU401", SNDCARD_MPU401,"Roland MPU-401", attach_mpu401, probe_mpu401, unload_mpu401},
310 #endif
311 #if !defined(EXCLUDE_MAUI)
312 {"MAUI", SNDCARD_MAUI,"TB Maui", attach_maui, probe_maui, unload_maui},
313 #endif
314 #if !defined(EXCLUDE_UART6850) && !defined(EXCLUDE_MIDI)
315 {"MIDI6850", SNDCARD_UART6850,"6860 UART Midi", attach_uart6850, probe_uart6850, unload_uart6850},
316 #endif
317 #ifndef EXCLUDE_SB
318 {"SBLAST", SNDCARD_SB, "SoundBlaster", attach_sb_card, probe_sb, unload_sb},
319 #endif
320 #if !defined(EXCLUDE_SB) && !defined(EXCLUDE_SB16)
321 #ifndef EXCLUDE_AUDIO
322 {"SB16", SNDCARD_SB16, "SoundBlaster16", sb16_dsp_init, sb16_dsp_detect, unload_sb16},
323 #endif
324 #ifndef EXCLUDE_MIDI
325 {"SB16MIDI", SNDCARD_SB16MIDI,"SB16 MIDI", attach_sb16midi, probe_sb16midi, unload_sb16midi},
326 #endif
327 #endif
328 #ifndef EXCLUDE_GUS16
329 {"GUS16", SNDCARD_GUS16, "Ultrasound 16-bit opt.", attach_gus_db16, probe_gus_db16, unload_gus_db16},
330 #endif
331 #ifndef EXCLUDE_GUS
332 {"GUS", SNDCARD_GUS, "Gravis Ultrasound", attach_gus_card, probe_gus, unload_gus},
333 #endif
334 #ifndef EXCLUDE_SSCAPE
335 {"SSCAPE", SNDCARD_SSCAPE, "Ensoniq Soundscape", attach_sscape, probe_sscape, unload_sscape},
336 {"SCAPEMSS", SNDCARD_SSCAPE_MSS, "MS Sound System (SoundScape)", attach_ss_ms_sound, probe_ss_ms_sound, unload_ss_ms_sound},
337 #endif
338 #ifndef EXCLUDE_TRIX
339 {"TRXPRO", SNDCARD_TRXPRO, "MediaTriX AudioTriX Pro", attach_trix_wss, probe_trix_wss, unload_trix_wss},
340 {"TRXPROSB", SNDCARD_TRXPRO_SB, "AudioTriX (SB mode)", attach_trix_sb, probe_trix_sb, unload_trix_sb},
341 {"TRXPROMPU", SNDCARD_TRXPRO_MPU, "AudioTriX MIDI", attach_trix_mpu, probe_trix_mpu, unload_trix_mpu},
342 #endif
343 #ifndef EXCLUDE_PNP
344 {"AD1848", 1000, "PnP MSS", attach_pnp_ad1848, probe_pnp_ad1848, unload_pnp_ad1848},
345 #endif
346 {NULL, 0, "*?*", NULL, NULL, NULL}
347 };
348
349
350 #ifndef FULL_SOUND
351
352
353
354
355
356
357 struct card_info snd_installed_cards[] = {
358 #ifndef EXCLUDE_PSS
359 {SNDCARD_PSS, {PSS_BASE, PSS_IRQ, PSS_DMA, -1}, SND_DEFAULT_ENABLE},
360 # ifdef PSS_MPU_BASE
361 {SNDCARD_PSS_MPU, {PSS_MPU_BASE, PSS_MPU_IRQ, 0, -1}, SND_DEFAULT_ENABLE},
362 # endif
363 # ifdef PSS_MSS_BASE
364 {SNDCARD_PSS_MSS, {PSS_MSS_BASE, PSS_MSS_IRQ, PSS_MSS_DMA, -1}, SND_DEFAULT_ENABLE},
365 # endif
366 #endif
367 #ifndef EXCLUDE_TRIX
368 {SNDCARD_TRXPRO, {TRIX_BASE, TRIX_IRQ, TRIX_DMA, TRIX_DMA2}, SND_DEFAULT_ENABLE},
369 # ifdef TRIX_SB_BASE
370 {SNDCARD_TRXPRO_SB, {TRIX_SB_BASE, TRIX_SB_IRQ, TRIX_SB_DMA, -1}, SND_DEFAULT_ENABLE},
371 # endif
372 # ifdef TRIX_MPU_BASE
373 {SNDCARD_TRXPRO_MPU, {TRIX_MPU_BASE, TRIX_MPU_IRQ, 0, -1}, SND_DEFAULT_ENABLE},
374 # endif
375 #endif
376 #ifndef EXCLUDE_SSCAPE
377 {SNDCARD_SSCAPE, {SSCAPE_BASE, SSCAPE_IRQ, SSCAPE_DMA, -1}, SND_DEFAULT_ENABLE},
378 {SNDCARD_SSCAPE_MSS, {SSCAPE_MSS_BASE, SSCAPE_MSS_IRQ, SSCAPE_MSS_DMA, -1}, SND_DEFAULT_ENABLE},
379 #endif
380 #ifndef EXCLUDE_MAD16
381 {SNDCARD_MAD16, {MAD16_BASE, MAD16_IRQ, MAD16_DMA, MAD16_DMA2}, SND_DEFAULT_ENABLE},
382 # ifdef MAD16_MPU_BASE
383 {SNDCARD_MAD16_MPU, {MAD16_MPU_BASE, MAD16_MPU_IRQ, 0, -1}, SND_DEFAULT_ENABLE},
384 # endif
385 #endif
386
387 #ifndef EXCLUDE_CS4232
388 # ifdef CS4232_MPU_BASE
389 {SNDCARD_CS4232_MPU, {CS4232_MPU_BASE, CS4232_MPU_IRQ, 0, -1}, SND_DEFAULT_ENABLE},
390 # endif
391 {SNDCARD_CS4232, {CS4232_BASE, CS4232_IRQ, CS4232_DMA, CS4232_DMA2}, SND_DEFAULT_ENABLE},
392 #endif
393
394 #ifndef EXCLUDE_MSS
395 {SNDCARD_MSS, {MSS_BASE, MSS_IRQ, MSS_DMA, -1}, SND_DEFAULT_ENABLE},
396 # ifdef MSS2_BASE
397 {SNDCARD_MSS, {MSS2_BASE, MSS2_IRQ, MSS2_DMA, -1}, SND_DEFAULT_ENABLE},
398 # endif
399 #endif
400
401 #ifndef EXCLUDE_PAS
402 {SNDCARD_PAS, {PAS_BASE, PAS_IRQ, PAS_DMA, -1}, SND_DEFAULT_ENABLE},
403 #endif
404
405 #ifndef EXCLUDE_SB
406 # ifndef SBC_DMA
407 # define SBC_DMA 1
408 # endif
409 {SNDCARD_SB, {SBC_BASE, SBC_IRQ, SBC_DMA, -1}, SND_DEFAULT_ENABLE},
410 #endif
411 #if !defined(EXCLUDE_MAUI)
412 {SNDCARD_MAUI, {MAUI_BASE, MAUI_IRQ, 0, -1}, SND_DEFAULT_ENABLE},
413 #endif
414
415 #if !defined(EXCLUDE_MPU401) && !defined(EXCLUDE_MIDI)
416 {SNDCARD_MPU401, {MPU_BASE, MPU_IRQ, 0, -1}, SND_DEFAULT_ENABLE},
417 #ifdef MPU2_BASE
418 {SNDCARD_MPU401, {MPU2_BASE, MPU2_IRQ, 0, -1}, SND_DEFAULT_ENABLE},
419 #endif
420 #ifdef MPU3_BASE
421 {SNDCARD_MPU401, {MPU3_BASE, MPU2_IRQ, 0, -1}, SND_DEFAULT_ENABLE},
422 #endif
423 #endif
424
425 #if !defined(EXCLUDE_UART6850) && !defined(EXCLUDE_MIDI)
426 {SNDCARD_UART6850, {U6850_BASE, U6850_IRQ, 0, -1}, SND_DEFAULT_ENABLE},
427 #endif
428
429 #if !defined(EXCLUDE_SB) && !defined(EXCLUDE_SB16)
430 #ifndef EXCLUDE_AUDIO
431 {SNDCARD_SB16, {SBC_BASE, SBC_IRQ, SB16_DMA, -1}, SND_DEFAULT_ENABLE},
432 #endif
433 #ifndef EXCLUDE_MIDI
434 {SNDCARD_SB16MIDI,{SB16MIDI_BASE, SBC_IRQ, 0, -1}, SND_DEFAULT_ENABLE},
435 #endif
436 #endif
437
438 #ifndef EXCLUDE_GUS
439 #ifndef EXCLUDE_GUS16
440 {SNDCARD_GUS16, {GUS16_BASE, GUS16_IRQ, GUS16_DMA, -1}, SND_DEFAULT_ENABLE},
441 #endif
442 {SNDCARD_GUS, {GUS_BASE, GUS_IRQ, GUS_DMA, GUS_DMA2}, SND_DEFAULT_ENABLE},
443 #endif
444
445 #ifndef EXCLUDE_YM3812
446 {SNDCARD_ADLIB, {FM_MONO, 0, 0, -1}, SND_DEFAULT_ENABLE},
447 #endif
448
449 {0, {0}, 0},
450 {0, {0}, 0},
451 {0, {0}, 0},
452 {0, {0}, 0},
453 {0, {0}, 0}
454 };
455
456 int num_sound_cards =
457 sizeof(snd_installed_cards) / sizeof (struct card_info);
458 int max_sound_cards =
459 sizeof(snd_installed_cards) / sizeof (struct card_info);
460
461 #else
462 int num_sound_cards = 0;
463 struct card_info snd_installed_cards[20] = {{0}};
464 int max_sound_cards = 20;
465 #endif
466
467 int num_sound_drivers =
468 sizeof(sound_drivers) / sizeof (struct driver_info);
469
470 #else
471 extern struct audio_operations * audio_devs[MAX_AUDIO_DEV]; int num_audiodevs;
472 extern struct mixer_operations * mixer_devs[MAX_MIXER_DEV]; extern int num_mixers;
473 extern struct synth_operations * synth_devs[MAX_SYNTH_DEV+MAX_MIDI_DEV]; extern int num_synths;
474 extern struct midi_operations * midi_devs[MAX_MIDI_DEV]; extern int num_midis;
475 extern struct sound_timer_operations * sound_timer_devs[MAX_SYNTH_DEV+MAX_MIDI_DEV]; extern int num_sound_timers;
476
477 extern struct driver_info sound_drivers[];
478 extern int num_sound_drivers;
479 extern struct card_info snd_installed_cards[];
480 extern int num_sound_cards;
481 extern int max_sound_cards;
482
483 long sndtable_init(long mem_start);
484 int sndtable_get_cardcount (void);
485 struct address_info *sound_getconf(int card_type);
486 void sound_chconf(int card_type, int ioaddr, int irq, int dma);
487 int snd_find_driver(int type);
488 void sound_unload_drivers(void);
489 int sndtable_identify_card(char *name);
490 void sound_setup (char *str, int *ints);
491
492 int sound_alloc_dmap (int dev, struct dma_buffparms *dmap, int chan);
493 void sound_free_dmap (int dev, struct dma_buffparms *dmap);
494 extern int soud_map_buffer (int dev, struct dma_buffparms *dmap, buffmem_desc *info);
495 void install_pnp_sounddrv(struct pnp_sounddev *drv);
496 int sndtable_probe (int unit, struct address_info *hw_config);
497 int sndtable_init_card (int unit, struct address_info *hw_config);
498 void sound_timer_init (struct sound_lowlev_timer *t, char *name);
499
500 #endif
501 #endif