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