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 1
75 #define DMODE_INPUT 2
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
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 #define DMA_PSEUDO_AUTOMODE 8
152 int format_mask;
153 void *devc;
154 int (*open) (int dev, int mode);
155 void (*close) (int dev);
156 void (*output_block) (int dev, unsigned long buf,
157 int count, int intrflag, int dma_restart);
158 void (*start_input) (int dev, unsigned long buf,
159 int count, int intrflag, int dma_restart);
160 int (*ioctl) (int dev, unsigned int cmd, caddr_t arg, int local);
161 int (*prepare_for_input) (int dev, int bufsize, int nbufs);
162 int (*prepare_for_output) (int dev, int bufsize, int nbufs);
163 void (*reset) (int dev);
164 void (*halt_xfer) (int dev);
165 int (*local_qlen)(int dev);
166 void (*copy_from_user)(int dev, char *localbuf, int localoffs,
167 const char *userbuf, int useroffs, int len);
168 void (*halt_input) (int dev);
169 void (*halt_output) (int dev);
170 void (*trigger) (int dev, int bits);
171 long buffsize;
172 int dmachan1, dmachan2;
173 struct dma_buffparms *dmap_in, *dmap_out;
174 struct coproc_operations *coproc;
175 int mixer_dev;
176 int enable_bits;
177 int open_mode;
178 int go;
179 };
180
181 struct mixer_operations {
182 char name[32];
183 int (*ioctl) (int dev, unsigned int cmd, caddr_t arg);
184 };
185
186 struct synth_operations {
187 struct synth_info *info;
188 int midi_dev;
189 int synth_type;
190 int synth_subtype;
191
192 int (*open) (int dev, int mode);
193 void (*close) (int dev);
194 int (*ioctl) (int dev, unsigned int cmd, caddr_t arg);
195 int (*kill_note) (int dev, int voice, int note, int velocity);
196 int (*start_note) (int dev, int voice, int note, int velocity);
197 int (*set_instr) (int dev, int voice, int instr);
198 void (*reset) (int dev);
199 void (*hw_control) (int dev, unsigned char *event);
200 int (*load_patch) (int dev, int format, const char *addr,
201 int offs, int count, int pmgr_flag);
202 void (*aftertouch) (int dev, int voice, int pressure);
203 void (*controller) (int dev, int voice, int ctrl_num, int value);
204 void (*panning) (int dev, int voice, int value);
205 void (*volume_method) (int dev, int mode);
206 int (*pmgr_interface) (int dev, struct patmgr_info *info);
207 void (*bender) (int dev, int chn, int value);
208 int (*alloc_voice) (int dev, int chn, int note, struct voice_alloc_info *alloc);
209 void (*setup_voice) (int dev, int voice, int chn);
210 int (*send_sysex)(int dev, unsigned char *bytes, int len);
211
212 struct voice_alloc_info alloc;
213 struct channel_info chn_info[16];
214 };
215
216 struct midi_input_info {
217 #define MI_MAX 10
218 int m_busy;
219 unsigned char m_buf[MI_MAX];
220 unsigned char m_prev_status;
221 int m_ptr;
222 #define MST_INIT 0
223 #define MST_DATA 1
224 #define MST_SYSEX 2
225 int m_state;
226 int m_left;
227 };
228
229 struct midi_operations {
230 struct midi_info info;
231 struct synth_operations *converter;
232 struct midi_input_info in_info;
233 int (*open) (int dev, int mode,
234 void (*inputintr)(int dev, unsigned char data),
235 void (*outputintr)(int dev)
236 );
237 void (*close) (int dev);
238 int (*ioctl) (int dev, unsigned int cmd, caddr_t arg);
239 int (*putc) (int dev, unsigned char data);
240 int (*start_read) (int dev);
241 int (*end_read) (int dev);
242 void (*kick)(int dev);
243 int (*command) (int dev, unsigned char *data);
244 int (*buffer_status) (int dev);
245 int (*prefix_cmd) (int dev, unsigned char status);
246 struct coproc_operations *coproc;
247 };
248
249 struct sound_lowlev_timer {
250 int dev;
251 unsigned int (*tmr_start)(int dev, unsigned int usecs);
252 void (*tmr_disable)(int dev);
253 void (*tmr_restart)(int dev);
254 };
255
256 struct sound_timer_operations {
257 struct sound_timer_info info;
258 int priority;
259 int devlink;
260 int (*open)(int dev, int mode);
261 void (*close)(int dev);
262 int (*event)(int dev, unsigned char *ev);
263 unsigned long (*get_time)(int dev);
264 int (*ioctl) (int dev, unsigned int cmd, caddr_t arg);
265 void (*arm_timer)(int dev, long time);
266 };
267
268 #ifdef _DEV_TABLE_C_
269 struct audio_operations *audio_devs[MAX_AUDIO_DEV] = {NULL}; int num_audiodevs = 0;
270 struct mixer_operations *mixer_devs[MAX_MIXER_DEV] = {NULL}; int num_mixers = 0;
271 struct synth_operations *synth_devs[MAX_SYNTH_DEV+MAX_MIDI_DEV] = {NULL}; int num_synths = 0;
272 struct midi_operations *midi_devs[MAX_MIDI_DEV] = {NULL}; int num_midis = 0;
273
274 #ifdef CONFIG_SEQUENCER
275 extern struct sound_timer_operations default_sound_timer;
276 struct sound_timer_operations *sound_timer_devs[MAX_TIMER_DEV] =
277 {&default_sound_timer, NULL};
278 int num_sound_timers = 1;
279 #else
280 struct sound_timer_operations *sound_timer_devs[MAX_TIMER_DEV] =
281 {NULL};
282 int num_sound_timers = 0;
283 #endif
284
285
286
287
288
289 struct driver_info sound_drivers[] = {
290 #ifdef CONFIG_PSS
291 {"PSSECHO", 0, SNDCARD_PSS, "Echo Personal Sound System PSS (ESC614)", attach_pss, probe_pss, unload_pss},
292 {"PSSMPU", 0, SNDCARD_PSS_MPU, "PSS-MPU", attach_pss_mpu, probe_pss_mpu, unload_pss_mpu},
293 {"PSSMSS", 0, SNDCARD_PSS_MSS, "PSS-MSS", attach_pss_mss, probe_pss_mss, unload_pss_mss},
294 #endif
295 #ifdef CONFIG_MSS
296 {"MSS", 0, SNDCARD_MSS, "MS Sound System", attach_ms_sound, probe_ms_sound, unload_ms_sound},
297
298 {"PCXBJ", 1, SNDCARD_PSEUDO_MSS, "MS Sound System (AXP)", attach_ms_sound, probe_ms_sound, unload_ms_sound},
299 #endif
300 #ifdef CONFIG_MAD16
301 {"MAD16", 0, SNDCARD_MAD16, "MAD16/Mozart (MSS)", attach_mad16, probe_mad16, unload_mad16},
302 {"MAD16MPU", 0, SNDCARD_MAD16_MPU, "MAD16/Mozart (MPU)", attach_mad16_mpu, probe_mad16_mpu, unload_mad16_mpu},
303 #endif
304 #ifdef CONFIG_CS4232
305 {"CS4232", 0, SNDCARD_CS4232, "CS4232", attach_cs4232, probe_cs4232, unload_cs4232},
306 {"CS4232MPU", 0, SNDCARD_CS4232_MPU, "CS4232 MIDI", attach_cs4232_mpu, probe_cs4232_mpu, unload_cs4232_mpu},
307 #endif
308 #ifdef CONFIG_YM3812
309 {"OPL3", 0, SNDCARD_ADLIB, "OPL-2/OPL-3 FM", attach_adlib_card, probe_adlib, unload_adlib},
310 #endif
311 #ifdef CONFIG_PAS
312 {"PAS16", 0, SNDCARD_PAS, "ProAudioSpectrum", attach_pas_card, probe_pas, unload_pas},
313 #endif
314 #if defined(CONFIG_MPU401) && defined(CONFIG_MIDI)
315 {"MPU401", 0, SNDCARD_MPU401,"Roland MPU-401", attach_mpu401, probe_mpu401, unload_mpu401},
316 #endif
317 #if defined(CONFIG_MAUI)
318 {"MAUI", 0, SNDCARD_MAUI,"TB Maui", attach_maui, probe_maui, unload_maui},
319 #endif
320 #if defined(CONFIG_UART6850) && defined(CONFIG_MIDI)
321 {"MIDI6850", 0, SNDCARD_UART6850,"6860 UART Midi", attach_uart6850, probe_uart6850, unload_uart6850},
322 #endif
323 #ifdef CONFIG_SB
324 {"SBLAST", 0, SNDCARD_SB, "SoundBlaster", attach_sb_card, probe_sb, unload_sb},
325 #ifdef CONFIG_AUDIO
326 {"SBX", 0, SNDCARD_SB16, "SoundBlaster 16bit", sb16_dsp_init, sb16_dsp_detect, unload_sb16},
327 #endif
328 #ifdef CONFIG_MIDI
329 {"SBMPU", 0, SNDCARD_SB16MIDI,"SB MPU", attach_sb16midi, probe_sb16midi, unload_sb16midi},
330 #endif
331 #endif
332 #ifdef CONFIG_GUS16
333 {"GUS16", 0, SNDCARD_GUS16, "Ultrasound 16-bit opt.", attach_gus_db16, probe_gus_db16, unload_gus_db16},
334 #endif
335 #ifdef CONFIG_GUS
336 {"GUS", 0, SNDCARD_GUS, "Gravis Ultrasound", attach_gus_card, probe_gus, unload_gus},
337 {"GUSPNP", 1, SNDCARD_GUSPNP, "GUS PnP", 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 {SNDCARD_MSS, {MSS_BASE, MSS_IRQ, MSS_DMA, -1}, SND_DEFAULT_ENABLE},
415 # ifdef MSS2_BASE
416 {SNDCARD_MSS, {MSS2_BASE, MSS2_IRQ, MSS2_DMA, -1}, SND_DEFAULT_ENABLE},
417 # endif
418 #endif
419
420 #ifdef CONFIG_PAS
421 {SNDCARD_PAS, {PAS_BASE, PAS_IRQ, PAS_DMA, -1}, SND_DEFAULT_ENABLE},
422 #endif
423
424 #ifdef CONFIG_SB
425 # ifndef SBC_DMA
426 # define SBC_DMA 1
427 # endif
428 # ifndef SB_DMA2
429 # define SB_DMA2 -1
430 # endif
431 {SNDCARD_SB, {SBC_BASE, SBC_IRQ, SBC_DMA, SB_DMA2}, SND_DEFAULT_ENABLE},
432 #endif
433 #if defined(CONFIG_MAUI)
434 {SNDCARD_MAUI, {MAUI_BASE, MAUI_IRQ, 0, -1}, SND_DEFAULT_ENABLE},
435 #endif
436
437 #if defined(CONFIG_MPU401) && defined(CONFIG_MIDI)
438 {SNDCARD_MPU401, {MPU_BASE, MPU_IRQ, 0, -1}, SND_DEFAULT_ENABLE},
439 #ifdef MPU2_BASE
440 {SNDCARD_MPU401, {MPU2_BASE, MPU2_IRQ, 0, -1}, SND_DEFAULT_ENABLE},
441 #endif
442 #ifdef MPU3_BASE
443 {SNDCARD_MPU401, {MPU3_BASE, MPU2_IRQ, 0, -1}, SND_DEFAULT_ENABLE},
444 #endif
445 #endif
446
447 #if defined(CONFIG_UART6850) && defined(CONFIG_MIDI)
448 {SNDCARD_UART6850, {U6850_BASE, U6850_IRQ, 0, -1}, SND_DEFAULT_ENABLE},
449 #endif
450
451 #if defined(CONFIG_SB)
452 #if defined(CONFIG_MIDI) && defined(SB_MPU_BASE)
453 {SNDCARD_SB16MIDI,{SB_MPU_BASE, SB_MPU_IRQ, 0, -1}, SND_DEFAULT_ENABLE},
454 #endif
455 #endif
456
457 #ifdef CONFIG_GUS
458 #ifndef GUS_DMA2
459 #define GUS_DMA2 GUS_DMA
460 #endif
461 #ifdef CONFIG_GUS16
462 {SNDCARD_GUS16, {GUS16_BASE, GUS16_IRQ, GUS16_DMA, -1}, SND_DEFAULT_ENABLE},
463 #endif
464 {SNDCARD_GUS, {GUS_BASE, GUS_IRQ, GUS_DMA, GUS_DMA2}, SND_DEFAULT_ENABLE},
465 #endif
466
467 #ifdef CONFIG_YM3812
468 {SNDCARD_ADLIB, {FM_MONO, 0, 0, -1}, SND_DEFAULT_ENABLE},
469 #endif
470
471 {0, {0}, 0},
472 {0, {0}, 0},
473 {0, {0}, 0},
474 {0, {0}, 0},
475 {0, {0}, 0}
476 };
477
478 int num_sound_cards =
479 sizeof(snd_installed_cards) / sizeof (struct card_info);
480 int max_sound_cards =
481 sizeof(snd_installed_cards) / sizeof (struct card_info);
482
483 #else
484 int num_sound_cards = 0;
485 struct card_info snd_installed_cards[20] = {{0}};
486 int max_sound_cards = 20;
487 #endif
488
489 # ifdef MODULE
490 int trace_init = 0;
491 # else
492 int trace_init = 1;
493 # endif
494 #else
495 extern struct audio_operations * audio_devs[MAX_AUDIO_DEV]; extern int num_audiodevs;
496 extern struct mixer_operations * mixer_devs[MAX_MIXER_DEV]; extern int num_mixers;
497 extern struct synth_operations * synth_devs[MAX_SYNTH_DEV+MAX_MIDI_DEV]; extern int num_synths;
498 extern struct midi_operations * midi_devs[MAX_MIDI_DEV]; extern int num_midis;
499 extern struct sound_timer_operations * sound_timer_devs[MAX_TIMER_DEV]; extern int num_sound_timers;
500
501 extern struct driver_info sound_drivers[];
502 extern int num_sound_drivers;
503 extern int max_sound_drivers;
504 extern struct card_info snd_installed_cards[];
505 extern int num_sound_cards;
506 extern int max_sound_cards;
507
508 extern int trace_init;
509
510 long sndtable_init(long mem_start);
511 int sndtable_get_cardcount (void);
512 struct address_info *sound_getconf(int card_type);
513 void sound_chconf(int card_type, int ioaddr, int irq, int dma);
514 int snd_find_driver(int type);
515 void sound_unload_drivers(void);
516 void sound_unload_driver(int type);
517 int sndtable_identify_card(char *name);
518 void sound_setup (char *str, int *ints);
519
520 int sound_alloc_dmap (int dev, struct dma_buffparms *dmap, int chan);
521 void sound_free_dmap (int dev, struct dma_buffparms *dmap);
522 extern int soud_map_buffer (int dev, struct dma_buffparms *dmap, buffmem_desc *info);
523 void install_pnp_sounddrv(struct pnp_sounddev *drv);
524 int sndtable_probe (int unit, struct address_info *hw_config);
525 int sndtable_init_card (int unit, struct address_info *hw_config);
526 void sound_timer_init (struct sound_lowlev_timer *t, char *name);
527 int sound_start_dma ( int dev, struct dma_buffparms *dmap, int chan,
528 unsigned long physaddr,
529 int count, int dma_mode, int autoinit);
530 void sound_dma_intr (int dev, struct dma_buffparms *dmap, int chan);
531
532 #endif
533 #endif