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