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