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