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
28 * $DragonFly: src/sys/dev/sound/isa/i386/Attic/dev_table.h,v 1.2 2005/01/31 23:44:35 joerg Exp $
35 * NOTE! NOTE! NOTE! NOTE!
37 * If you modify this file, please check the dev_table.c also.
39 * NOTE! NOTE! NOTE! NOTE!
42 extern int sound_started;
46 int card_subtype; /* Driver specific. Usually 0 */
47 int card_type; /* From soundcard.h */
49 void (*attach) (struct address_info * hw_config);
50 int (*probe) (struct address_info * hw_config);
54 int card_type; /* Link (search key) to the driver list */
55 struct address_info config;
59 typedef struct pnp_sounddev {
61 void (*setup) (void *dev);
66 * Device specific parameters (used only by dmabuf.c)
68 #define MAX_SUB_BUFFERS (32*MAX_REALTIME_FACTOR)
71 #define DMODE_OUTPUT 1
74 struct dma_buffparms {
75 int dma_mode; /* DMODE_INPUT, DMODE_OUTPUT or DMODE_NONE */
77 char *raw_buf; /* Pointers to raw buffers */
85 #define DMA_BUSY 0x00000001
86 #define DMA_RESTART 0x00000002
87 #define DMA_ACTIVE 0x00000004
88 #define DMA_STARTED 0x00000008
89 #define DMA_ALLOC_DONE 0x00000020
101 int counts[MAX_SUB_BUFFERS];
113 #define DMA_MAP_MAPPED 0x00000001
119 * Structure for use with various microcontrollers and DSP processors in the
122 typedef struct coproc_operations {
124 int (*open) (void *devc, int sub_device);
125 void (*close) (void *devc, int sub_device);
126 int (*ioctl) (void *devc, u_int cmd, ioctl_arg arg, int local);
127 void (*reset) (void *devc);
129 void *devc; /* Driver specific info */
132 struct audio_operations {
135 #define NOTHING_SPECIAL 0
136 #define NEEDS_RESTART 1
137 #define DMA_AUTOMODE 2
139 #define DMA_DISABLE 8
140 int format_mask; /* Bitmask for supported audio formats */
141 void *devc; /* Driver specific info */
142 int (*open) (int dev, int mode);
143 void (*close) (int dev);
144 void (*output_block) (int dev, unsigned long buf,
145 int count, int intrflag, int dma_restart);
146 void (*start_input) (int dev, unsigned long buf,
147 int count, int intrflag, int dma_restart);
148 int (*ioctl) (int dev, u_int cmd, ioctl_arg arg, int local);
149 int (*prepare_for_input) (int dev, int bufsize, int nbufs);
150 int (*prepare_for_output) (int dev, int bufsize, int nbufs);
151 void (*reset) (int dev);
152 void (*halt_xfer) (int dev);
153 int (*local_qlen) (int dev);
154 void (*copy_from_user) (int dev, char *localbuf, int localoffs,
155 snd_rw_buf * userbuf, int useroffs, int len);
156 void (*halt_input) (int dev);
157 void (*halt_output) (int dev);
158 void (*trigger) (int dev, int bits);
160 int dmachan1, dmachan2;
161 struct dma_buffparms *dmap_in, *dmap_out;
162 struct coproc_operations *coproc;
171 struct mixer_operations {
173 int (*ioctl) (int dev, unsigned int cmd, ioctl_arg arg);
176 struct synth_operations {
177 struct synth_info *info;
182 int (*open) (int dev, int mode);
183 void (*close) (int dev);
184 int (*ioctl) (int dev, unsigned int cmd, ioctl_arg arg);
185 int (*kill_note) (int dev, int voice, int note, int velocity);
186 int (*start_note) (int dev, int voice, int note, int velocity);
187 int (*set_instr) (int dev, int voice, int instr);
188 void (*reset) (int dev);
189 void (*hw_control) (int dev, unsigned char *event);
190 int (*load_patch) (int dev, int format, snd_rw_buf * addr,
191 int offs, int count, int pmgr_flag);
192 void (*aftertouch) (int dev, int voice, int pressure);
193 void (*controller) (int dev, int voice, int ctrl_num, int value);
194 void (*panning) (int dev, int voice, int value);
195 void (*volume_method) (int dev, int mode);
196 int (*pmgr_interface) (int dev, struct patmgr_info * info);
197 void (*bender) (int dev, int chn, int value);
198 int (*alloc_voice) (int dev, int chn, int note, struct voice_alloc_info * alloc);
199 void (*setup_voice) (int dev, int voice, int chn);
200 int (*send_sysex) (int dev, unsigned char *bytes, int len);
202 struct voice_alloc_info alloc;
203 struct channel_info chn_info[16];
206 struct midi_input_info { /* MIDI input scanner variables */
209 unsigned char m_buf[MI_MAX];
210 unsigned char m_prev_status; /* For running status */
219 struct midi_operations {
220 struct midi_info info;
221 struct synth_operations *converter;
222 struct midi_input_info in_info;
223 int (*open) (int dev, int mode,
224 void (*inputintr) (int dev, unsigned char data),
225 void (*outputintr) (int dev) );
226 void (*close) (int dev);
227 int (*ioctl) (int dev, unsigned int cmd, ioctl_arg arg);
228 int (*putc) (int dev, unsigned char data);
229 int (*start_read) (int dev);
230 int (*end_read) (int dev);
231 void (*kick) (int dev);
232 int (*command) (int dev, unsigned char *data);
233 int (*buffer_status) (int dev);
234 int (*prefix_cmd) (int dev, unsigned char status);
235 struct coproc_operations *coproc;
238 struct sound_lowlev_timer {
240 u_int (*tmr_start) (int dev, unsigned int usecs);
241 void (*tmr_disable) (int dev);
242 void (*tmr_restart) (int dev);
245 struct sound_timer_operations {
246 struct sound_timer_info info;
249 int (*open) (int dev, int mode);
250 void (*close) (int dev);
251 int (*event) (int dev, unsigned char *ev);
252 u_long (*get_time) (int dev);
253 int (*ioctl) (int dev, unsigned int cmd, ioctl_arg arg);
254 void (*arm_timer) (int dev, long time);
258 struct audio_operations *audio_devs[MAX_AUDIO_DEV] = {NULL};
259 int num_audiodevs = 0;
260 struct mixer_operations *mixer_devs[MAX_MIXER_DEV] = {NULL};
262 struct synth_operations *synth_devs[MAX_SYNTH_DEV + MAX_MIDI_DEV] = {NULL};
264 struct midi_operations *midi_devs[MAX_MIDI_DEV] = {NULL};
267 #ifdef CONFIG_SEQUENCER
268 extern struct sound_timer_operations default_sound_timer;
269 struct sound_timer_operations *sound_timer_devs[MAX_TIMER_DEV] =
270 {&default_sound_timer, NULL};
271 int num_sound_timers = 1;
273 struct sound_timer_operations *sound_timer_devs[MAX_TIMER_DEV] = {NULL};
274 int num_sound_timers = 0;
278 * List of low level drivers compiled into the kernel.
280 * remember, each entry contains:
283 int card_subtype; (Driver specific. Usually 0)
284 int card_type; (From soundcard.h)
286 void (*attach) (struct address_info * hw_config);
287 int (*probe) (struct address_info * hw_config);
291 struct driver_info sound_drivers[] = {
294 {"PSSECHO", 0, SNDCARD_PSS, "Echo Personal Sound System PSS (ESC614)",
295 attach_pss, probe_pss},
296 {"PSSMPU", 0, SNDCARD_PSS_MPU, "PSS-MPU",
297 attach_pss_mpu, probe_pss_mpu},
298 {"PSSMSS", 0, SNDCARD_PSS_MSS, "PSS-MSS",
299 attach_pss_mss, probe_pss_mss},
303 /* XXX changed type from 0 to 1 -lr 970705 */
304 {"MSS", 1, SNDCARD_MSS, "MS Sound System",
305 attach_mss, probe_mss},
306 /* MSS without IRQ/DMA config registers (for DEC Alphas) */
307 {"PCXBJ", 1, SNDCARD_PSEUDO_MSS, "MS Sound System (AXP)",
308 attach_mss, probe_mss},
312 {"MAD16", 0, SNDCARD_MAD16, "MAD16/Mozart (MSS)",
313 attach_mad16, probe_mad16},
314 {"MAD16MPU", 0, SNDCARD_MAD16_MPU, "MAD16/Mozart (MPU)",
315 attach_mad16_mpu, probe_mad16_mpu},
319 {"CS4232", 0, SNDCARD_CS4232, "CS4232",
320 attach_cs4232, probe_cs4232},
321 {"CS4232MPU", 0, SNDCARD_CS4232_MPU, "CS4232 MIDI",
322 attach_cs4232_mpu, probe_cs4232_mpu},
326 {"OPL3", 0, SNDCARD_ADLIB, "OPL-2/OPL-3 FM",
327 attach_adlib_card, probe_adlib},
331 {"PAS16", 0, SNDCARD_PAS, "ProAudioSpectrum",
332 attach_pas_card, probe_pas},
335 #if defined(CONFIG_MPU401) && defined(CONFIG_MIDI)
336 {"MPU401", 0, SNDCARD_MPU401, "Roland MPU-401",
337 attach_mpu401, probe_mpu401},
340 #if defined(CONFIG_MAUI)
341 {"MAUI", 0, SNDCARD_MAUI, "TB Maui",
342 attach_maui, probe_maui},
345 #if defined(CONFIG_UART6850) && defined(CONFIG_MIDI)
346 {"MIDI6850", 0, SNDCARD_UART6850, "6860 UART Midi",
347 attach_uart6850, probe_uart6850},
351 {"SBLAST", 0, SNDCARD_SB, "SoundBlaster",
352 attach_sb_card, probe_sb},
355 #if defined(CONFIG_SB) && defined(CONFIG_SB16)
357 {"SB16", 0, SNDCARD_SB16, "SoundBlaster16",
358 sb16_dsp_init, sb16_dsp_detect},
361 {"SB16MIDI", 0, SNDCARD_SB16MIDI, "SB16 MIDI",
362 attach_sb16midi, probe_sb16midi},
367 {"GUS16", 0, SNDCARD_GUS16, "Ultrasound 16-bit opt.",
368 attach_gus_db16, probe_gus_db16},
372 {"GUS", 0, SNDCARD_GUS, "Gravis Ultrasound",
373 attach_gus_card, probe_gus},
377 {"SSCAPE", 0, SNDCARD_SSCAPE, "Ensoniq Soundscape",
378 attach_sscape, probe_sscape},
379 {"SSCAPEMSS", 0, SNDCARD_SSCAPE_MSS, "MS Sound System (SoundScape)",
380 attach_ss_mss, probe_ss_mss},
384 {"TRXPRO", 0, SNDCARD_TRXPRO, "MediaTriX AudioTriX Pro",
385 attach_trix_wss, probe_trix_wss},
386 {"TRXPROSB", 0, SNDCARD_TRXPRO_SB, "AudioTriX (SB mode)",
387 attach_trix_sb, probe_trix_sb},
388 {"TRXPROMPU", 0, SNDCARD_TRXPRO_MPU, "AudioTriX MIDI",
389 attach_trix_mpu, probe_trix_mpu},
393 {"AD1848", 0, 500, "PnP MSS",
394 attach_pnp_ad1848, probe_pnp_ad1848},
398 {"NSS", 0, SNDCARD_NSS, "NEC PC-9801-86 Sound System",
399 attach_nss, probe_nss},
402 {NULL, 0, 0, "*?*", NULL, NULL}
405 int num_sound_drivers =
406 sizeof(sound_drivers) / sizeof(struct driver_info);
407 int max_sound_drivers =
408 sizeof(sound_drivers) / sizeof(struct driver_info);
414 * List of devices actually configured in the system.
416 * Note! The detection order is significant. Don't change it.
418 * remember, the list contains
420 * int card_type; (Link (search key) to the driver list)
421 * struct address_info config;
422 * io_base, irq, dma, dma2,
423 * always_detect, char *name, struct... *osp
425 * void *for_driver_use;
429 struct card_info snd_installed_cards[] = {
431 {SNDCARD_PSS, {PSS_BASE, 0, -1, -1}, SND_DEFAULT_ENABLE},
433 {SNDCARD_PSS_MPU, {PSS_MPU_BASE, PSS_MPU_IRQ, 0, -1}, SND_DEFAULT_ENABLE},
436 {SNDCARD_PSS_MSS, {PSS_MSS_BASE, PSS_MSS_IRQ, PSS_MSS_DMA, -1}, SND_DEFAULT_ENABLE},
438 #endif /* config PSS */
441 {SNDCARD_TRXPRO, {TRIX_BASE, TRIX_IRQ, TRIX_DMA, TRIX_DMA2}, SND_DEFAULT_ENABLE},
443 {SNDCARD_TRXPRO_SB, {TRIX_SB_BASE, TRIX_SB_IRQ, TRIX_SB_DMA, -1}, SND_DEFAULT_ENABLE},
446 {SNDCARD_TRXPRO_MPU, {TRIX_MPU_BASE, TRIX_MPU_IRQ, 0, -1}, SND_DEFAULT_ENABLE},
448 #endif /* NTRIX > 0 */
451 {SNDCARD_SSCAPE, {SSCAPE_BASE, SSCAPE_IRQ, SSCAPE_DMA, -1}, SND_DEFAULT_ENABLE},
452 {SNDCARD_SSCAPE_MSS, {SSCAPE_MSS_BASE, SSCAPE_MSS_IRQ, SSCAPE_MSS_DMA, -1}, SND_DEFAULT_ENABLE},
456 {SNDCARD_MAD16, {MAD16_BASE, MAD16_IRQ, MAD16_DMA, MAD16_DMA2}, SND_DEFAULT_ENABLE},
457 #ifdef MAD16_MPU_BASE
458 {SNDCARD_MAD16_MPU, {MAD16_MPU_BASE, MAD16_MPU_IRQ, 0, -1}, SND_DEFAULT_ENABLE},
460 #endif /* CONFIG_MAD16 */
463 #ifdef CS4232_MPU_BASE
464 {SNDCARD_CS4232_MPU, {CS4232_MPU_BASE, CS4232_MPU_IRQ, 0, -1}, SND_DEFAULT_ENABLE},
466 {SNDCARD_CS4232, {CS4232_BASE, CS4232_IRQ, CS4232_DMA, CS4232_DMA2}, SND_DEFAULT_ENABLE},
471 {SNDCARD_MSS, {MSS_BASE, MSS_IRQ, MSS_DMA, -1}, SND_DEFAULT_ENABLE},
473 {SNDCARD_PSEUDO_MSS, {MSS_BASE, MSS_IRQ, MSS_DMA, -1}, SND_DEFAULT_ENABLE},
476 {SNDCARD_MSS, {MSS2_BASE, MSS2_IRQ, MSS2_DMA, -1}, SND_DEFAULT_ENABLE},
478 #endif /* CONFIG_MSS */
481 {SNDCARD_PAS, {PAS_BASE, PAS_IRQ, PAS_DMA, -1}, SND_DEFAULT_ENABLE},
488 {SNDCARD_SB, {SBC_BASE, SBC_IRQ, SBC_DMA, -1}, SND_DEFAULT_ENABLE},
491 #if defined(CONFIG_MAUI)
492 {SNDCARD_MAUI, {MAUI_BASE, MAUI_IRQ, 0, -1}, SND_DEFAULT_ENABLE},
495 #if defined(CONFIG_MPU401) && defined(CONFIG_MIDI)
496 {SNDCARD_MPU401, {MPU_BASE, MPU_IRQ, 0, -1}, SND_DEFAULT_ENABLE},
498 {SNDCARD_MPU401, {MPU2_BASE, MPU2_IRQ, 0, -1}, SND_DEFAULT_ENABLE},
501 {SNDCARD_MPU401, {MPU3_BASE, MPU2_IRQ, 0, -1}, SND_DEFAULT_ENABLE},
505 #if defined(CONFIG_UART6850) && defined(CONFIG_MIDI)
506 {SNDCARD_UART6850, {U6850_BASE, U6850_IRQ, 0, -1}, SND_DEFAULT_ENABLE},
509 #if defined(CONFIG_SB) && defined(CONFIG_SB16)
511 {SNDCARD_SB16, {SBC_BASE, SBC_IRQ, SB16_DMA, -1}, SND_DEFAULT_ENABLE},
514 {SNDCARD_SB16MIDI, {SB16MIDI_BASE, SBC_IRQ, 0, -1}, SND_DEFAULT_ENABLE},
517 {SNDCARD_AWE32,{AWE32_BASE, 0, 0, -1}, SND_DEFAULT_ENABLE},
523 {SNDCARD_GUS16, {GUS16_BASE, GUS16_IRQ, GUS16_DMA, -1}, SND_DEFAULT_ENABLE},
525 {SNDCARD_GUS, {GUS_BASE, GUS_IRQ, GUS_DMA, GUS_DMA2}, SND_DEFAULT_ENABLE},
529 {SNDCARD_ADLIB, {FM_MONO, 0, 0, -1}, SND_DEFAULT_ENABLE},
533 {SNDCARD_NSS, {NSS_BASE, NSS_IRQ, 0, -1}, SND_DEFAULT_ENABLE},
535 /* Define some expansion space */
543 int num_sound_cards = sizeof(snd_installed_cards) / sizeof(struct card_info);
544 int max_sound_cards = sizeof(snd_installed_cards) / sizeof(struct card_info);
547 int num_sound_cards = 0;
548 struct card_info snd_installed_cards[20] = {{0}};
549 int max_sound_cards = 20;
559 extern struct audio_operations *audio_devs[MAX_AUDIO_DEV];
560 extern int num_audiodevs;
561 extern struct mixer_operations *mixer_devs[MAX_MIXER_DEV];
562 extern int num_mixers;
563 extern struct synth_operations *synth_devs[MAX_SYNTH_DEV + MAX_MIDI_DEV];
564 extern int num_synths;
565 extern struct midi_operations *midi_devs[MAX_MIDI_DEV];
566 extern int num_midis;
567 extern struct sound_timer_operations *sound_timer_devs[MAX_TIMER_DEV];
568 extern int num_sound_timers;
570 extern struct driver_info sound_drivers[];
571 extern int num_sound_drivers;
572 extern int max_sound_drivers;
573 extern struct card_info snd_installed_cards[];
574 extern int num_sound_cards;
575 extern int max_sound_cards;
577 extern int trace_init;
579 void sndtable_init(void);
580 int sndtable_get_cardcount(void);
581 struct address_info *sound_getconf(int card_type);
582 void sound_chconf(int card_type, int ioaddr, int irq, int dma);
583 int snd_find_driver(int type);
584 int sndtable_identify_card(char *name);
585 void sound_setup(char *str, int *ints);
587 int sound_alloc_dmap(int dev, struct dma_buffparms * dmap, int chan);
588 void sound_free_dmap(int dev, struct dma_buffparms * dmap);
589 extern int soud_map_buffer(int dev, struct dma_buffparms * dmap, buffmem_desc * info);
590 void install_pnp_sounddrv(struct pnp_sounddev * drv);
591 int sndtable_probe(int unit, struct address_info * hw_config);
592 int sndtable_init_card(int unit, struct address_info * hw_config);
593 void sound_timer_init(struct sound_lowlev_timer * t, char *name);
595 sound_start_dma(int dev, struct dma_buffparms * dmap, int chan,
596 unsigned long physaddr,
597 int count, int dma_mode, int autoinit);
598 void sound_dma_intr(int dev, struct dma_buffparms * dmap, int chan);
600 #endif /* _DEV_TABLE_C_ */
601 #endif /* _DEV_TABLE_H_ */