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