root/drivers/sound/dev_table.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   1 /*
   2  *      dev_table.h
   3  *
   4  *      Global definitions for device call tables
   5  * 
   6  * Copyright by Hannu Savolainen 1993
   7  *
   8  * Redistribution and use in source and binary forms, with or without
   9  * modification, are permitted provided that the following conditions
  10  * are met:
  11  * 1. Redistributions of source code must retain the above copyright
  12  *    notice, this list of conditions and the following disclaimer.
  13  * 2. Redistributions in binary form must reproduce the above copyright
  14  *    notice, this list of conditions and the following disclaimer in the
  15  *    documentation and/or other materials provided with the distribution.
  16  *
  17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  20  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  21  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  22  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  23  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  24  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  25  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  26  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  27  * SUCH DAMAGE.
  28  *
  29 
  30 */
  31 
  32 #ifndef _DEV_TABLE_H_
  33 #define _DEV_TABLE_H_
  34 
  35 /*
  36  *      NOTE!   NOTE!   NOTE!   NOTE!
  37  *
  38  *      If you modify this file, please check the dev_table.c also.
  39  *
  40  *      NOTE!   NOTE!   NOTE!   NOTE!
  41  */
  42 
  43 struct driver_info {
  44         int card_type;  /*      From soundcard.h        */
  45         char *name;
  46         long (*attach) (long mem_start, struct address_info *hw_config);
  47         int (*probe) (struct address_info *hw_config);
  48 };
  49 
  50 struct card_info {
  51         int card_type;  /* Link (search key) to the driver list */
  52         struct address_info config;
  53         int enabled;
  54 };
  55 
  56 /*
  57  * Device specific parameters (used only by dmabuf.c)
  58  */
  59 #define MAX_SUB_BUFFERS         (32*MAX_REALTIME_FACTOR)
  60 
  61 #define DMODE_NONE              0
  62 #define DMODE_OUTPUT            1
  63 #define DMODE_INPUT             2
  64 
  65 struct dma_buffparms {
  66         int      dma_mode;      /* DMODE_INPUT, DMODE_OUTPUT or DMODE_NONE */
  67 
  68         /*
  69          * Pointers to raw buffers
  70          */
  71 
  72         char     *raw_buf[DSP_BUFFCOUNT];
  73         unsigned long   raw_buf_phys[DSP_BUFFCOUNT];
  74         int             raw_count;
  75 
  76         /*
  77          * Device state tables
  78          */
  79 
  80         unsigned long flags;
  81 #define DMA_BUSY        0x00000001
  82 #define DMA_RESTART     0x00000002
  83 #define DMA_ACTIVE      0x00000004
  84 #define DMA_STARTED     0x00000008
  85 #define DMA_ALLOC_DONE  0x00000020
  86 
  87         int      open_mode;
  88 
  89         /*
  90          * Queue parameters.
  91          */
  92         int      qlen;
  93         int      qhead;
  94         int      qtail;
  95 
  96         int      nbufs;
  97         int      counts[MAX_SUB_BUFFERS];
  98         int      subdivision;
  99         char    *buf[MAX_SUB_BUFFERS];
 100         unsigned long buf_phys[MAX_SUB_BUFFERS];
 101 
 102         int      fragment_size;
 103         int      max_fragments;
 104 
 105         int      bytes_in_use;
 106 
 107         int      underrun_count;
 108 };
 109 
 110 /*
 111  * Structure for use with various microcontrollers and DSP processors 
 112  * in the recent soundcards.
 113  */
 114 typedef struct coproc_operations {
 115                 char name[32];
 116                 int (*open) (void *devc, int sub_device);
 117                 void (*close) (void *devc, int sub_device);
 118                 int (*ioctl) (void *devc, unsigned int cmd, unsigned int arg, int local);
 119                 void (*reset) (void *devc);
 120 
 121                 void *devc;             /* Driver specific info */
 122         } coproc_operations;
 123 
 124 struct audio_operations {
 125         char name[32];
 126         int flags;
 127 #define NOTHING_SPECIAL         0
 128 #define NEEDS_RESTART           1
 129 #define DMA_AUTOMODE            2
 130         int  format_mask;       /* Bitmask for supported audio formats */
 131         void *devc;             /* Driver specific info */
 132         int (*open) (int dev, int mode);
 133         void (*close) (int dev);
 134         void (*output_block) (int dev, unsigned long buf, 
 135                               int count, int intrflag, int dma_restart);
 136         void (*start_input) (int dev, unsigned long buf, 
 137                              int count, int intrflag, int dma_restart);
 138         int (*ioctl) (int dev, unsigned int cmd, unsigned int arg, int local);
 139         int (*prepare_for_input) (int dev, int bufsize, int nbufs);
 140         int (*prepare_for_output) (int dev, int bufsize, int nbufs);
 141         void (*reset) (int dev);
 142         void (*halt_xfer) (int dev);
 143         int (*local_qlen)(int dev);
 144         void (*copy_from_user)(int dev, char *localbuf, int localoffs,
 145                                snd_rw_buf *userbuf, int useroffs, int len);
 146         int buffcount;
 147         long buffsize;
 148         int dmachan;
 149         struct dma_buffparms *dmap;
 150         struct coproc_operations *coproc;
 151         int mixer_dev;
 152 };
 153 
 154 struct mixer_operations {
 155         char name[32];
 156         int (*ioctl) (int dev, unsigned int cmd, unsigned int arg);
 157 };
 158 
 159 struct synth_operations {
 160         struct synth_info *info;
 161         int midi_dev;
 162         int synth_type;
 163         int synth_subtype;
 164 
 165         int (*open) (int dev, int mode);
 166         void (*close) (int dev);
 167         int (*ioctl) (int dev, unsigned int cmd, unsigned int arg);
 168         int (*kill_note) (int dev, int voice, int note, int velocity);
 169         int (*start_note) (int dev, int voice, int note, int velocity);
 170         int (*set_instr) (int dev, int voice, int instr);
 171         void (*reset) (int dev);
 172         void (*hw_control) (int dev, unsigned char *event);
 173         int (*load_patch) (int dev, int format, snd_rw_buf *addr,
 174              int offs, int count, int pmgr_flag);
 175         void (*aftertouch) (int dev, int voice, int pressure);
 176         void (*controller) (int dev, int voice, int ctrl_num, int value);
 177         void (*panning) (int dev, int voice, int value);
 178         void (*volume_method) (int dev, int mode);
 179         int (*pmgr_interface) (int dev, struct patmgr_info *info);
 180         void (*bender) (int dev, int chn, int value);
 181         int (*alloc_voice) (int dev, int chn, int note, struct voice_alloc_info *alloc);
 182         void (*setup_voice) (int dev, int voice, int chn);
 183 
 184         struct voice_alloc_info alloc;
 185         struct channel_info chn_info[16];
 186 };
 187 
 188 struct midi_input_info { /* MIDI input scanner variables */
 189 #define MI_MAX  10
 190                 int             m_busy;
 191                 unsigned char   m_buf[MI_MAX];
 192                 unsigned char   m_prev_status;  /* For running status */
 193                 int             m_ptr;
 194 #define MST_INIT                        0
 195 #define MST_DATA                        1
 196 #define MST_SYSEX                       2
 197                 int             m_state;
 198                 int             m_left;
 199         };
 200 
 201 struct midi_operations {
 202         struct midi_info info;
 203         struct synth_operations *converter;
 204         struct midi_input_info in_info;
 205         int (*open) (int dev, int mode,
 206                 void (*inputintr)(int dev, unsigned char data),
 207                 void (*outputintr)(int dev)
 208                 );
 209         void (*close) (int dev);
 210         int (*ioctl) (int dev, unsigned int cmd, unsigned int arg);
 211         int (*putc) (int dev, unsigned char data);
 212         int (*start_read) (int dev);
 213         int (*end_read) (int dev);
 214         void (*kick)(int dev);
 215         int (*command) (int dev, unsigned char *data);
 216         int (*buffer_status) (int dev);
 217         int (*prefix_cmd) (int dev, unsigned char status);
 218         struct coproc_operations *coproc;
 219 };
 220 
 221 struct sound_timer_operations {
 222         struct sound_timer_info info;
 223         int priority;
 224         int devlink;
 225         int (*open)(int dev, int mode);
 226         void (*close)(int dev);
 227         int (*event)(int dev, unsigned char *ev);
 228         unsigned long (*get_time)(int dev);
 229         int (*ioctl) (int dev, unsigned int cmd, unsigned int arg);
 230         void (*arm_timer)(int dev, long time);
 231 };
 232 
 233 #ifdef _DEV_TABLE_C_   
 234         struct audio_operations *audio_devs[MAX_AUDIO_DEV] = {NULL}; int num_audiodevs = 0;
 235         struct mixer_operations *mixer_devs[MAX_MIXER_DEV] = {NULL}; int num_mixers = 0;
 236         struct synth_operations *synth_devs[MAX_SYNTH_DEV+MAX_MIDI_DEV] = {NULL}; int num_synths = 0;
 237         struct midi_operations *midi_devs[MAX_MIDI_DEV] = {NULL}; int num_midis = 0;
 238 
 239 #ifndef EXCLUDE_SEQUENCER
 240         extern struct sound_timer_operations default_sound_timer;
 241         struct sound_timer_operations *sound_timer_devs[MAX_TIMER_DEV] = 
 242                 {&default_sound_timer, NULL}; 
 243         int num_sound_timers = 1;
 244 #else
 245         struct sound_timer_operations *sound_timer_devs[MAX_TIMER_DEV] = 
 246                 {NULL}; 
 247         int num_sound_timers = 0;
 248 #endif
 249 
 250 /*
 251  * List of low level drivers compiled into the kernel.
 252  */
 253 
 254         struct driver_info sound_drivers[] = {
 255 #ifndef EXCLUDE_PSS
 256           {SNDCARD_PSS, "Echo Personal Sound System PSS (ESC614)", attach_pss, probe_pss},
 257 #       ifdef PSS_MPU_BASE
 258           {SNDCARD_PSS_MPU, "PSS-MPU", attach_pss_mpu, probe_pss_mpu},
 259 #       endif
 260 #       ifdef PSS_MSS_BASE
 261           {SNDCARD_PSS_MSS, "PSS-MSS", attach_pss_mss, probe_pss_mss},
 262 #       endif
 263 #endif
 264 #ifndef EXCLUDE_MAD16
 265                 {SNDCARD_MAD16, "MAD16/Mozart (MSS)",           attach_mad16, probe_mad16},
 266                 {SNDCARD_MAD16_MPU,     "MAD16/Mozart (MPU)",           attach_mad16_mpu, probe_mad16_mpu},
 267 #endif
 268 #ifndef EXCLUDE_YM3812
 269                 {SNDCARD_ADLIB, "OPL-2/OPL-3 FM",               attach_adlib_card, probe_adlib},
 270 #endif
 271 #ifndef EXCLUDE_PAS
 272                 {SNDCARD_PAS,   "ProAudioSpectrum",     attach_pas_card, probe_pas},
 273 #endif
 274 #if !defined(EXCLUDE_MPU401) && !defined(EXCLUDE_MIDI)
 275                 {SNDCARD_MPU401,"Roland MPU-401",       attach_mpu401, probe_mpu401},
 276 #endif
 277 #if !defined(EXCLUDE_UART6850) && !defined(EXCLUDE_MIDI)
 278                 {SNDCARD_UART6850,"6860 UART Midi",     attach_uart6850, probe_uart6850},
 279 #endif
 280 #ifndef EXCLUDE_SB
 281                 {SNDCARD_SB,    "SoundBlaster",         attach_sb_card, probe_sb},
 282 #endif
 283 #if !defined(EXCLUDE_SB) && !defined(EXCLUDE_SB16)
 284 #ifndef EXCLUDE_AUDIO
 285                 {SNDCARD_SB16,  "SoundBlaster16",       sb16_dsp_init, sb16_dsp_detect},
 286 #endif
 287 #ifndef EXCLUDE_MIDI
 288                 {SNDCARD_SB16MIDI,"SB16 MIDI",  attach_sb16midi, probe_sb16midi},
 289 #endif
 290 #endif
 291 #ifndef EXCLUDE_GUS16
 292                 {SNDCARD_GUS16, "Ultrasound 16-bit opt.",       attach_gus_db16, probe_gus_db16},
 293 #endif
 294 #ifndef EXCLUDE_MSS
 295                 {SNDCARD_MSS,   "MS Sound System",      attach_ms_sound, probe_ms_sound},
 296 #endif
 297 #ifndef EXCLUDE_GUS
 298                 {SNDCARD_GUS,   "Gravis Ultrasound",    attach_gus_card, probe_gus},
 299 #endif
 300 #ifndef EXCLUDE_SSCAPE
 301                 {SNDCARD_SSCAPE, "Ensoniq Soundscape",  attach_sscape, probe_sscape},
 302                 {SNDCARD_SSCAPE_MSS,    "MS Sound System (SoundScape)", attach_ss_ms_sound, probe_ss_ms_sound},
 303 #endif
 304 #ifndef EXCLUDE_TRIX
 305                 {SNDCARD_TRXPRO, "MediaTriX AudioTriX Pro",     attach_trix_wss, probe_trix_wss},
 306                 {SNDCARD_TRXPRO_SB, "AudioTriX (SB mode)",      attach_trix_sb, probe_trix_sb},
 307                 {SNDCARD_TRXPRO_MPU, "AudioTriX MIDI",  attach_trix_mpu, probe_trix_mpu},
 308 #endif
 309                 {0,                     "*?*",                  NULL, NULL}
 310         };
 311 
 312 #ifdef linux
 313 /*
 314  *      List of devices actually configured in the system.
 315  *
 316  *      Note! The detection order is significant. Don't change it.
 317  */
 318 
 319         struct card_info snd_installed_cards[] = {
 320 #ifndef EXCLUDE_PSS
 321              {SNDCARD_PSS, {PSS_BASE, PSS_IRQ, PSS_DMA}, SND_DEFAULT_ENABLE},
 322 #       ifdef PSS_MPU_BASE
 323              {SNDCARD_PSS_MPU, {PSS_MPU_BASE, PSS_MPU_IRQ, 0}, SND_DEFAULT_ENABLE},
 324 #       endif
 325 #       ifdef PSS_MSS_BASE
 326              {SNDCARD_PSS_MSS, {PSS_MSS_BASE, PSS_MSS_IRQ, PSS_MSS_DMA}, SND_DEFAULT_ENABLE},
 327 #       endif
 328 #endif
 329 #ifndef EXCLUDE_TRIX
 330              {SNDCARD_TRXPRO, {TRIX_BASE, TRIX_IRQ, TRIX_DMA}, SND_DEFAULT_ENABLE},
 331 #       ifdef TRIX_SB_BASE
 332              {SNDCARD_TRXPRO_SB, {TRIX_SB_BASE, TRIX_SB_IRQ, TRIX_SB_DMA}, SND_DEFAULT_ENABLE},
 333 #       endif
 334 #       ifdef TRIX_MPU_BASE
 335              {SNDCARD_TRXPRO_MPU, {TRIX_MPU_BASE, TRIX_MPU_IRQ, 0}, SND_DEFAULT_ENABLE},
 336 #       endif
 337 #endif
 338 #ifndef EXCLUDE_SSCAPE
 339              {SNDCARD_SSCAPE, {SSCAPE_BASE, SSCAPE_IRQ, SSCAPE_DMA}, SND_DEFAULT_ENABLE},
 340              {SNDCARD_SSCAPE_MSS, {SSCAPE_MSS_BASE, SSCAPE_MSS_IRQ, SSCAPE_MSS_DMA}, SND_DEFAULT_ENABLE},
 341 #endif
 342 #ifndef EXCLUDE_MAD16
 343              {SNDCARD_MAD16, {MAD16_BASE, MAD16_IRQ, MAD16_DMA}, SND_DEFAULT_ENABLE},
 344 #       ifdef MAD16_MPU_BASE
 345              {SNDCARD_MAD16_MPU, {MAD16_MPU_BASE, MAD16_MPU_IRQ, 0}, SND_DEFAULT_ENABLE},
 346 #       endif
 347 #endif
 348 
 349 #ifndef EXCLUDE_MSS
 350                 {SNDCARD_MSS, {MSS_BASE, MSS_IRQ, MSS_DMA}, SND_DEFAULT_ENABLE},
 351 #       ifdef MSS2_BASE
 352                 {SNDCARD_MSS, {MSS2_BASE, MSS2_IRQ, MSS2_DMA}, SND_DEFAULT_ENABLE},
 353 #       endif
 354 #endif
 355 
 356 #ifndef EXCLUDE_PAS
 357                 {SNDCARD_PAS, {PAS_BASE, PAS_IRQ, PAS_DMA}, SND_DEFAULT_ENABLE},
 358 #endif
 359 
 360 #ifndef EXCLUDE_SB
 361 #       ifndef SBC_DMA
 362 #               define SBC_DMA          1
 363 #       endif
 364                 {SNDCARD_SB, {SBC_BASE, SBC_IRQ, SBC_DMA}, SND_DEFAULT_ENABLE},
 365 #endif
 366 
 367 #if !defined(EXCLUDE_MPU401) && !defined(EXCLUDE_MIDI)
 368                 {SNDCARD_MPU401, {MPU_BASE, MPU_IRQ, 0}, SND_DEFAULT_ENABLE},
 369 #ifdef MPU2_BASE
 370                 {SNDCARD_MPU401, {MPU2_BASE, MPU2_IRQ, 0}, SND_DEFAULT_ENABLE},
 371 #endif
 372 #ifdef MPU3_BASE
 373                 {SNDCARD_MPU401, {MPU3_BASE, MPU2_IRQ, 0}, SND_DEFAULT_ENABLE},
 374 #endif
 375 #endif
 376 
 377 #if !defined(EXCLUDE_UART6850) && !defined(EXCLUDE_MIDI)
 378                 {SNDCARD_UART6850, {U6850_BASE, U6850_IRQ, 0}, SND_DEFAULT_ENABLE},
 379 #endif
 380 
 381 #if !defined(EXCLUDE_SB) && !defined(EXCLUDE_SB16)
 382 #ifndef EXCLUDE_AUDIO
 383                 {SNDCARD_SB16, {SBC_BASE, SBC_IRQ, SB16_DMA}, SND_DEFAULT_ENABLE},
 384 #endif
 385 #ifndef EXCLUDE_MIDI
 386                 {SNDCARD_SB16MIDI,{SB16MIDI_BASE, SBC_IRQ, 0}, SND_DEFAULT_ENABLE},
 387 #endif
 388 #endif
 389 
 390 #ifndef EXCLUDE_GUS
 391 #ifndef EXCLUDE_GUS16
 392                 {SNDCARD_GUS16, {GUS16_BASE, GUS16_IRQ, GUS16_DMA}, SND_DEFAULT_ENABLE},
 393 #endif
 394                 {SNDCARD_GUS, {GUS_BASE, GUS_IRQ, GUS_DMA}, SND_DEFAULT_ENABLE},
 395 #endif
 396 
 397 #ifndef EXCLUDE_YM3812
 398                 {SNDCARD_ADLIB, {FM_MONO, 0, 0}, SND_DEFAULT_ENABLE},
 399 #endif
 400                 {0, {0}, 0}
 401         };
 402 
 403         int num_sound_cards =
 404             sizeof(snd_installed_cards) / sizeof (struct card_info);
 405 
 406 #else
 407         int num_sound_cards = 0;
 408 #endif  /* linux */
 409 
 410         int num_sound_drivers =
 411             sizeof(sound_drivers) / sizeof (struct driver_info);
 412 
 413 #else
 414         extern struct audio_operations * audio_devs[MAX_AUDIO_DEV]; int num_audiodevs;
 415         extern struct mixer_operations * mixer_devs[MAX_MIXER_DEV]; extern int num_mixers;
 416         extern struct synth_operations * synth_devs[MAX_SYNTH_DEV+MAX_MIDI_DEV]; extern int num_synths;
 417         extern struct midi_operations * midi_devs[MAX_MIDI_DEV]; extern int num_midis;
 418         extern struct sound_timer_operations * sound_timer_devs[MAX_SYNTH_DEV+MAX_MIDI_DEV]; extern int num_sound_timers;
 419 
 420         extern struct driver_info sound_drivers[];
 421         extern int num_sound_drivers;
 422         extern struct card_info snd_installed_cards[];
 423         extern int num_sound_cards;
 424 
 425 long sndtable_init(long mem_start);
 426 int sndtable_get_cardcount (void);
 427 struct address_info *sound_getconf(int card_type);
 428 void sound_chconf(int card_type, int ioaddr, int irq, int dma);
 429 int snd_find_driver(int type);
 430 
 431 #endif  /* _DEV_TABLE_C_ */
 432 #endif  /* _DEV_TABLE_H_ */

/* [previous][next][first][last][top][bottom][index][help] */