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