4 * Global definitions for device call tables
6 * Copyright by Hannu Savolainen 1993
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are
10 * met: 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 2.
12 * Redistributions in binary form must reproduce the above copyright notice,
13 * this list of conditions and the following disclaimer in the documentation
14 * and/or other materials provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
20 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * NOTE! NOTE! NOTE! NOTE!
36 * If you modify this file, please check the dev_table.c also.
38 * NOTE! NOTE! NOTE! NOTE!
41 extern int sound_started;
45 int card_subtype; /* Driver specific. Usually 0 */
46 int card_type; /* From soundcard.h */
48 void (*attach) (struct address_info * hw_config);
49 int (*probe) (struct address_info * hw_config);
53 int card_type; /* Link (search key) to the driver list */
54 struct address_info config;
58 typedef struct pnp_sounddev {
60 void (*setup) (void *dev);
65 * Device specific parameters (used only by dmabuf.c)
67 #define MAX_SUB_BUFFERS (32*MAX_REALTIME_FACTOR)
70 #define DMODE_OUTPUT 1
73 struct dma_buffparms {
74 int dma_mode; /* DMODE_INPUT, DMODE_OUTPUT or DMODE_NONE */
76 char *raw_buf; /* Pointers to raw buffers */
84 #define DMA_BUSY 0x00000001
85 #define DMA_RESTART 0x00000002
86 #define DMA_ACTIVE 0x00000004
87 #define DMA_STARTED 0x00000008
88 #define DMA_ALLOC_DONE 0x00000020
100 int counts[MAX_SUB_BUFFERS];
112 #define DMA_MAP_MAPPED 0x00000001
118 * Structure for use with various microcontrollers and DSP processors in the
121 typedef struct coproc_operations {
123 int (*open) (void *devc, int sub_device);
124 void (*close) (void *devc, int sub_device);
125 int (*ioctl) (void *devc, u_int cmd, ioctl_arg arg, int local);
126 void (*reset) (void *devc);
128 void *devc; /* Driver specific info */
131 struct audio_operations {
134 #define NOTHING_SPECIAL 0
135 #define NEEDS_RESTART 1
136 #define DMA_AUTOMODE 2
138 #define DMA_DISABLE 8
139 int format_mask; /* Bitmask for supported audio formats */
140 void *devc; /* Driver specific info */
141 int (*open) (int dev, int mode);
142 void (*close) (int dev);
143 void (*output_block) (int dev, unsigned long buf,
144 int count, int intrflag, int dma_restart);
145 void (*start_input) (int dev, unsigned long buf,
146 int count, int intrflag, int dma_restart);
147 int (*ioctl) (int dev, u_int cmd, ioctl_arg arg, int local);
148 int (*prepare_for_input) (int dev, int bufsize, int nbufs);
149 int (*prepare_for_output) (int dev, int bufsize, int nbufs);
150 void (*reset) (int dev);
151 void (*halt_xfer) (int dev);
152 int (*local_qlen) (int dev);
153 void (*copy_from_user) (int dev, char *localbuf, int localoffs,
154 snd_rw_buf * userbuf, int useroffs, int len);
155 void (*halt_input) (int dev);
156 void (*halt_output) (int dev);
157 void (*trigger) (int dev, int bits);
159 int dmachan1, dmachan2;
160 struct dma_buffparms *dmap_in, *dmap_out;
161 struct coproc_operations *coproc;
170 struct mixer_operations {
172 int (*ioctl) (int dev, unsigned int cmd, ioctl_arg arg);
175 struct synth_operations {
176 struct synth_info *info;
181 int (*open) (int dev, int mode);
182 void (*close) (int dev);
183 int (*ioctl) (int dev, unsigned int cmd, ioctl_arg arg);
184 int (*kill_note) (int dev, int voice, int note, int velocity);
185 int (*start_note) (int dev, int voice, int note, int velocity);
186 int (*set_instr) (int dev, int voice, int instr);
187 void (*reset) (int dev);
188 void (*hw_control) (int dev, unsigned char *event);
189 int (*load_patch) (int dev, int format, snd_rw_buf * addr,
190 int offs, int count, int pmgr_flag);
191 void (*aftertouch) (int dev, int voice, int pressure);
192 void (*controller) (int dev, int voice, int ctrl_num, int value);
193 void (*panning) (int dev, int voice, int value);
194 void (*volume_method) (int dev, int mode);
195 int (*pmgr_interface) (int dev, struct patmgr_info * info);
196 void (*bender) (int dev, int chn, int value);
197 int (*alloc_voice) (int dev, int chn, int note, struct voice_alloc_info * alloc);
198 void (*setup_voice) (int dev, int voice, int chn);
199 int (*send_sysex) (int dev, unsigned char *bytes, int len);
201 struct voice_alloc_info alloc;
202 struct channel_info chn_info[16];
205 struct midi_input_info { /* MIDI input scanner variables */
208 unsigned char m_buf[MI_MAX];
209 unsigned char m_prev_status; /* For running status */
218 struct midi_operations {
219 struct midi_info info;
220 struct synth_operations *converter;
221 struct midi_input_info in_info;
222 int (*open) (int dev, int mode,
223 void (*inputintr) (int dev, unsigned char data),
224 void (*outputintr) (int dev) );
225 void (*close) (int dev);
226 int (*ioctl) (int dev, unsigned int cmd, ioctl_arg arg);
227 int (*putc) (int dev, unsigned char data);
228 int (*start_read) (int dev);
229 int (*end_read) (int dev);
230 void (*kick) (int dev);
231 int (*command) (int dev, unsigned char *data);
232 int (*buffer_status) (int dev);
233 int (*prefix_cmd) (int dev, unsigned char status);
234 struct coproc_operations *coproc;
237 struct sound_lowlev_timer {
239 u_int (*tmr_start) (int dev, unsigned int usecs);
240 void (*tmr_disable) (int dev);
241 void (*tmr_restart) (int dev);
244 struct sound_timer_operations {
245 struct sound_timer_info info;
248 int (*open) (int dev, int mode);
249 void (*close) (int dev);
250 int (*event) (int dev, unsigned char *ev);
251 u_long (*get_time) (int dev);
252 int (*ioctl) (int dev, unsigned int cmd, ioctl_arg arg);
253 void (*arm_timer) (int dev, long time);
257 struct audio_operations *audio_devs[MAX_AUDIO_DEV] = {NULL};
258 int num_audiodevs = 0;
259 struct mixer_operations *mixer_devs[MAX_MIXER_DEV] = {NULL};
261 struct synth_operations *synth_devs[MAX_SYNTH_DEV + MAX_MIDI_DEV] = {NULL};
263 struct midi_operations *midi_devs[MAX_MIDI_DEV] = {NULL};
266 #ifdef CONFIG_SEQUENCER
267 extern struct sound_timer_operations default_sound_timer;
268 struct sound_timer_operations *sound_timer_devs[MAX_TIMER_DEV] =
269 {&default_sound_timer, NULL};
270 int num_sound_timers = 1;
272 struct sound_timer_operations *sound_timer_devs[MAX_TIMER_DEV] = {NULL};
273 int num_sound_timers = 0;
277 * List of low level drivers compiled into the kernel.
279 * remember, each entry contains:
282 int card_subtype; (Driver specific. Usually 0)
283 int card_type; (From soundcard.h)
285 void (*attach) (struct address_info * hw_config);
286 int (*probe) (struct address_info * hw_config);
290 struct driver_info sound_drivers[] = {
293 {"PSSECHO", 0, SNDCARD_PSS, "Echo Personal Sound System PSS (ESC614)",
294 attach_pss, probe_pss},
295 {"PSSMPU", 0, SNDCARD_PSS_MPU, "PSS-MPU",
296 attach_pss_mpu, probe_pss_mpu},
297 {"PSSMSS", 0, SNDCARD_PSS_MSS, "PSS-MSS",
298 attach_pss_mss, probe_pss_mss},
302 /* XXX changed type from 0 to 1 -lr 970705 */
303 {"MSS", 1, SNDCARD_MSS, "MS Sound System",
304 attach_mss, probe_mss},
305 /* MSS without IRQ/DMA config registers (for DEC Alphas) */
306 {"PCXBJ", 1, SNDCARD_PSEUDO_MSS, "MS Sound System (AXP)",
307 attach_mss, probe_mss},
311 {"MAD16", 0, SNDCARD_MAD16, "MAD16/Mozart (MSS)",
312 attach_mad16, probe_mad16},
313 {"MAD16MPU", 0, SNDCARD_MAD16_MPU, "MAD16/Mozart (MPU)",
314 attach_mad16_mpu, probe_mad16_mpu},
318 {"CS4232", 0, SNDCARD_CS4232, "CS4232",
319 attach_cs4232, probe_cs4232},
320 {"CS4232MPU", 0, SNDCARD_CS4232_MPU, "CS4232 MIDI",
321 attach_cs4232_mpu, probe_cs4232_mpu},
325 {"OPL3", 0, SNDCARD_ADLIB, "OPL-2/OPL-3 FM",
326 attach_adlib_card, probe_adlib},
330 {"PAS16", 0, SNDCARD_PAS, "ProAudioSpectrum",
331 attach_pas_card, probe_pas},
334 #if defined(CONFIG_MPU401) && defined(CONFIG_MIDI)
335 {"MPU401", 0, SNDCARD_MPU401, "Roland MPU-401",
336 attach_mpu401, probe_mpu401},
339 #if defined(CONFIG_MAUI)
340 {"MAUI", 0, SNDCARD_MAUI, "TB Maui",
341 attach_maui, probe_maui},
344 #if defined(CONFIG_UART6850) && defined(CONFIG_MIDI)
345 {"MIDI6850", 0, SNDCARD_UART6850, "6860 UART Midi",
346 attach_uart6850, probe_uart6850},
350 {"SBLAST", 0, SNDCARD_SB, "SoundBlaster",
351 attach_sb_card, probe_sb},
354 #if defined(CONFIG_SB) && defined(CONFIG_SB16)
356 {"SB16", 0, SNDCARD_SB16, "SoundBlaster16",
357 sb16_dsp_init, sb16_dsp_detect},
360 {"AWE32", 0, SNDCARD_AWE32, "AWE32 Synth",
361 attach_awe, probe_awe},
364 {"SB16MIDI", 0, SNDCARD_SB16MIDI, "SB16 MIDI",
365 attach_sb16midi, probe_sb16midi},
370 {"GUS16", 0, SNDCARD_GUS16, "Ultrasound 16-bit opt.",
371 attach_gus_db16, probe_gus_db16},
375 {"GUS", 0, SNDCARD_GUS, "Gravis Ultrasound",
376 attach_gus_card, probe_gus},
380 {"SSCAPE", 0, SNDCARD_SSCAPE, "Ensoniq Soundscape",
381 attach_sscape, probe_sscape},
382 {"SSCAPEMSS", 0, SNDCARD_SSCAPE_MSS, "MS Sound System (SoundScape)",
383 attach_ss_mss, probe_ss_mss},
387 {"TRXPRO", 0, SNDCARD_TRXPRO, "MediaTriX AudioTriX Pro",
388 attach_trix_wss, probe_trix_wss},
389 {"TRXPROSB", 0, SNDCARD_TRXPRO_SB, "AudioTriX (SB mode)",
390 attach_trix_sb, probe_trix_sb},
391 {"TRXPROMPU", 0, SNDCARD_TRXPRO_MPU, "AudioTriX MIDI",
392 attach_trix_mpu, probe_trix_mpu},
396 {"AD1848", 0, 500, "PnP MSS",
397 attach_pnp_ad1848, probe_pnp_ad1848},
401 {"NSS", 0, SNDCARD_NSS, "NEC PC-9801-86 Sound System",
402 attach_nss, probe_nss},
405 {NULL, 0, 0, "*?*", NULL, NULL}
408 int num_sound_drivers =
409 sizeof(sound_drivers) / sizeof(struct driver_info);
410 int max_sound_drivers =
411 sizeof(sound_drivers) / sizeof(struct driver_info);
417 * List of devices actually configured in the system.
419 * Note! The detection order is significant. Don't change it.
421 * remember, the list contains
423 * int card_type; (Link (search key) to the driver list)
424 * struct address_info config;
425 * io_base, irq, dma, dma2,
426 * always_detect, char *name, struct... *osp
428 * void *for_driver_use;
432 struct card_info snd_installed_cards[] = {
434 {SNDCARD_PSS, {PSS_BASE, 0, -1, -1}, SND_DEFAULT_ENABLE},
436 {SNDCARD_PSS_MPU, {PSS_MPU_BASE, PSS_MPU_IRQ, 0, -1}, SND_DEFAULT_ENABLE},
439 {SNDCARD_PSS_MSS, {PSS_MSS_BASE, PSS_MSS_IRQ, PSS_MSS_DMA, -1}, SND_DEFAULT_ENABLE},
441 #endif /* config PSS */
444 {SNDCARD_TRXPRO, {TRIX_BASE, TRIX_IRQ, TRIX_DMA, TRIX_DMA2}, SND_DEFAULT_ENABLE},
446 {SNDCARD_TRXPRO_SB, {TRIX_SB_BASE, TRIX_SB_IRQ, TRIX_SB_DMA, -1}, SND_DEFAULT_ENABLE},
449 {SNDCARD_TRXPRO_MPU, {TRIX_MPU_BASE, TRIX_MPU_IRQ, 0, -1}, SND_DEFAULT_ENABLE},
451 #endif /* NTRIX > 0 */
454 {SNDCARD_SSCAPE, {SSCAPE_BASE, SSCAPE_IRQ, SSCAPE_DMA, -1}, SND_DEFAULT_ENABLE},
455 {SNDCARD_SSCAPE_MSS, {SSCAPE_MSS_BASE, SSCAPE_MSS_IRQ, SSCAPE_MSS_DMA, -1}, SND_DEFAULT_ENABLE},
459 {SNDCARD_MAD16, {MAD16_BASE, MAD16_IRQ, MAD16_DMA, MAD16_DMA2}, SND_DEFAULT_ENABLE},
460 #ifdef MAD16_MPU_BASE
461 {SNDCARD_MAD16_MPU, {MAD16_MPU_BASE, MAD16_MPU_IRQ, 0, -1}, SND_DEFAULT_ENABLE},
463 #endif /* CONFIG_MAD16 */
466 #ifdef CS4232_MPU_BASE
467 {SNDCARD_CS4232_MPU, {CS4232_MPU_BASE, CS4232_MPU_IRQ, 0, -1}, SND_DEFAULT_ENABLE},
469 {SNDCARD_CS4232, {CS4232_BASE, CS4232_IRQ, CS4232_DMA, CS4232_DMA2}, SND_DEFAULT_ENABLE},
474 {SNDCARD_MSS, {MSS_BASE, MSS_IRQ, MSS_DMA, -1}, SND_DEFAULT_ENABLE},
476 {SNDCARD_PSEUDO_MSS, {MSS_BASE, MSS_IRQ, MSS_DMA, -1}, SND_DEFAULT_ENABLE},
479 {SNDCARD_MSS, {MSS2_BASE, MSS2_IRQ, MSS2_DMA, -1}, SND_DEFAULT_ENABLE},
481 #endif /* CONFIG_MSS */
484 {SNDCARD_PAS, {PAS_BASE, PAS_IRQ, PAS_DMA, -1}, SND_DEFAULT_ENABLE},
491 {SNDCARD_SB, {SBC_BASE, SBC_IRQ, SBC_DMA, -1}, SND_DEFAULT_ENABLE},
494 #if defined(CONFIG_MAUI)
495 {SNDCARD_MAUI, {MAUI_BASE, MAUI_IRQ, 0, -1}, SND_DEFAULT_ENABLE},
498 #if defined(CONFIG_MPU401) && defined(CONFIG_MIDI)
499 {SNDCARD_MPU401, {MPU_BASE, MPU_IRQ, 0, -1}, SND_DEFAULT_ENABLE},
501 {SNDCARD_MPU401, {MPU2_BASE, MPU2_IRQ, 0, -1}, SND_DEFAULT_ENABLE},
504 {SNDCARD_MPU401, {MPU3_BASE, MPU2_IRQ, 0, -1}, SND_DEFAULT_ENABLE},
508 #if defined(CONFIG_UART6850) && defined(CONFIG_MIDI)
509 {SNDCARD_UART6850, {U6850_BASE, U6850_IRQ, 0, -1}, SND_DEFAULT_ENABLE},
512 #if defined(CONFIG_SB) && defined(CONFIG_SB16)
514 {SNDCARD_SB16, {SBC_BASE, SBC_IRQ, SB16_DMA, -1}, SND_DEFAULT_ENABLE},
517 {SNDCARD_SB16MIDI, {SB16MIDI_BASE, SBC_IRQ, 0, -1}, SND_DEFAULT_ENABLE},
520 {SNDCARD_AWE32,{AWE32_BASE, 0, 0, -1}, SND_DEFAULT_ENABLE},
526 {SNDCARD_GUS16, {GUS16_BASE, GUS16_IRQ, GUS16_DMA, -1}, SND_DEFAULT_ENABLE},
528 {SNDCARD_GUS, {GUS_BASE, GUS_IRQ, GUS_DMA, GUS_DMA2}, SND_DEFAULT_ENABLE},
532 {SNDCARD_ADLIB, {FM_MONO, 0, 0, -1}, SND_DEFAULT_ENABLE},
536 {SNDCARD_NSS, {NSS_BASE, NSS_IRQ, 0, -1}, SND_DEFAULT_ENABLE},
538 /* Define some expansion space */
546 int num_sound_cards = sizeof(snd_installed_cards) / sizeof(struct card_info);
547 int max_sound_cards = sizeof(snd_installed_cards) / sizeof(struct card_info);
550 int num_sound_cards = 0;
551 struct card_info snd_installed_cards[20] = {{0}};
552 int max_sound_cards = 20;
562 extern struct audio_operations *audio_devs[MAX_AUDIO_DEV];
563 extern int num_audiodevs;
564 extern struct mixer_operations *mixer_devs[MAX_MIXER_DEV];
565 extern int num_mixers;
566 extern struct synth_operations *synth_devs[MAX_SYNTH_DEV + MAX_MIDI_DEV];
567 extern int num_synths;
568 extern struct midi_operations *midi_devs[MAX_MIDI_DEV];
569 extern int num_midis;
570 extern struct sound_timer_operations *sound_timer_devs[MAX_TIMER_DEV];
571 extern int num_sound_timers;
573 extern struct driver_info sound_drivers[];
574 extern int num_sound_drivers;
575 extern int max_sound_drivers;
576 extern struct card_info snd_installed_cards[];
577 extern int num_sound_cards;
578 extern int max_sound_cards;
580 extern int trace_init;
582 void sndtable_init(void);
583 int sndtable_get_cardcount(void);
584 struct address_info *sound_getconf(int card_type);
585 void sound_chconf(int card_type, int ioaddr, int irq, int dma);
586 int snd_find_driver(int type);
587 int sndtable_identify_card(char *name);
588 void sound_setup(char *str, int *ints);
590 int sound_alloc_dmap(int dev, struct dma_buffparms * dmap, int chan);
591 void sound_free_dmap(int dev, struct dma_buffparms * dmap);
592 extern int soud_map_buffer(int dev, struct dma_buffparms * dmap, buffmem_desc * info);
593 void install_pnp_sounddrv(struct pnp_sounddev * drv);
594 int sndtable_probe(int unit, struct address_info * hw_config);
595 int sndtable_init_card(int unit, struct address_info * hw_config);
596 void sound_timer_init(struct sound_lowlev_timer * t, char *name);
598 sound_start_dma(int dev, struct dma_buffparms * dmap, int chan,
599 unsigned long physaddr,
600 int count, int dma_mode, int autoinit);
601 void sound_dma_intr(int dev, struct dma_buffparms * dmap, int chan);
603 #endif /* _DEV_TABLE_C_ */
604 #endif /* _DEV_TABLE_H_ */