home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / KERNEL-S / V1.0 / LINUX-1.0 / LINUX-1 / linux / drivers / sound / dev_table.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-01-21  |  8.5 KB  |  270 lines

  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 card_info {
  44.     int card_type;    /*    From soundcard.c    */
  45.     char *name;
  46.     long (*attach) (long mem_start, struct address_info *hw_config);
  47.     int (*probe) (struct address_info *hw_config);
  48.     struct address_info config;
  49.     int enabled;
  50. };
  51.  
  52. /** UWM -- new  MIDI structure here.. **/
  53.  
  54. struct generic_midi_info{
  55.         char *name;    /* Name of the MIDI device.. */
  56.         long (*attach) (long mem_start);
  57. };
  58.  
  59. struct audio_operations {
  60.         char name[32];
  61.     int (*open) (int dev, int mode);
  62.     void (*close) (int dev);
  63.     void (*output_block) (int dev, unsigned long buf, 
  64.                   int count, int intrflag, int dma_restart);
  65.     void (*start_input) (int dev, unsigned long buf, 
  66.                  int count, int intrflag, int dma_restart);
  67.     int (*ioctl) (int dev, unsigned int cmd, unsigned int arg, int local);
  68.     int (*prepare_for_input) (int dev, int bufsize, int nbufs);
  69.     int (*prepare_for_output) (int dev, int bufsize, int nbufs);
  70.     void (*reset) (int dev);
  71.     void (*halt_xfer) (int dev);
  72.     int (*has_output_drained)(int dev);
  73.         void (*copy_from_user)(int dev, char *localbuf, int localoffs,
  74.                                snd_rw_buf *userbuf, int useroffs, int len);
  75. };
  76.  
  77. struct mixer_operations {
  78.     int (*ioctl) (int dev, unsigned int cmd, unsigned int arg);
  79. };
  80.  
  81. struct synth_operations {
  82.     struct synth_info *info;
  83.     int synth_type;
  84.     int synth_subtype;
  85.  
  86.     int (*open) (int dev, int mode);
  87.     void (*close) (int dev);
  88.     int (*ioctl) (int dev, unsigned int cmd, unsigned int arg);
  89.     int (*kill_note) (int dev, int voice, int velocity);
  90.     int (*start_note) (int dev, int voice, int note, int velocity);
  91.     int (*set_instr) (int dev, int voice, int instr);
  92.     void (*reset) (int dev);
  93.     void (*hw_control) (int dev, unsigned char *event);
  94.     int (*load_patch) (int dev, int format, snd_rw_buf *addr,
  95.          int offs, int count, int pmgr_flag);
  96.     void (*aftertouch) (int dev, int voice, int pressure);
  97.     void (*controller) (int dev, int voice, int ctrl_num, int value);
  98.     void (*panning) (int dev, int voice, int value);
  99.     int (*pmgr_interface) (int dev, struct patmgr_info *info);
  100. };
  101.  
  102. struct midi_operations {
  103.     struct midi_info info;
  104.     int (*open) (int dev, int mode,
  105.         void (*inputintr)(int dev, unsigned char data),
  106.         void (*outputintr)(int dev)
  107.         );
  108.     void (*close) (int dev);
  109.     int (*ioctl) (int dev, unsigned int cmd, unsigned int arg);
  110.     int (*putc) (int dev, unsigned char data);
  111.     int (*start_read) (int dev);
  112.     int (*end_read) (int dev);
  113.     void (*kick)(int dev);
  114.     int (*command) (int dev, unsigned char data);
  115.     int (*buffer_status) (int dev);
  116. };
  117.  
  118. /** UWM -- new structure for MIDI  **/
  119.  
  120. struct generic_midi_operations {
  121.     struct midi_info info;
  122.     int (*open) (int dev, int mode);
  123.     void (*close) (int dev);
  124.     int (*write) (int dev, snd_rw_buf *data);
  125.     int (*read)  (int dev, snd_rw_buf *data);
  126. };    
  127.  
  128. #ifndef ALL_EXTERNAL_TO_ME
  129.  
  130. #ifdef _MIDI_TABLE_C_
  131.  
  132. /** UWM **/
  133.        struct generic_midi_operations * generic_midi_devs[MAX_MIDI_DEV] = {NULL}; 
  134.        int num_generic_midis = 0, pro_midi_dev = 0; 
  135.  
  136.       struct generic_midi_info midi_supported[] = {
  137.  
  138. #ifndef EXCLUDE_PRO_MIDI
  139.         {"ProAudioSpectrum MV101",pro_midi_attach}
  140. #endif
  141.         }; 
  142.  
  143.         int num_midi_drivers = 
  144.             sizeof (midi_supported) / sizeof(struct generic_midi_info);
  145.  
  146. #endif
  147.  
  148.  
  149. #ifdef _DEV_TABLE_C_   
  150.     struct audio_operations * dsp_devs[MAX_DSP_DEV] = {NULL}; int num_dspdevs = 0;
  151.     struct mixer_operations * mixer_devs[MAX_MIXER_DEV] = {NULL}; int num_mixers = 0;
  152.     struct synth_operations * synth_devs[MAX_SYNTH_DEV] = {NULL}; int num_synths = 0;
  153.     struct midi_operations * midi_devs[MAX_MIDI_DEV] = {NULL}; int num_midis = 0;
  154.  
  155.  
  156. #   ifndef EXCLUDE_MPU401
  157.         int mpu401_dev = 0;
  158. #   endif
  159.  
  160. /*
  161.  *    Note! The detection order is significant. Don't change it.
  162.  */
  163.  
  164.     struct card_info supported_drivers[] = {
  165. #if !defined(EXCLUDE_MPU401) && !defined(EXCLUDE_MIDI)
  166.         {SNDCARD_MPU401,"Roland MPU-401",    attach_mpu401, probe_mpu401,
  167.             {MPU_BASE, MPU_IRQ, 0}, SND_DEFAULT_ENABLE},
  168. #endif
  169.  
  170. #ifndef EXCLUDE_PAS
  171.         {SNDCARD_PAS,    "ProAudioSpectrum",    attach_pas_card, probe_pas,
  172.             {PAS_BASE, PAS_IRQ, PAS_DMA}, SND_DEFAULT_ENABLE},
  173. #endif
  174.  
  175. #ifndef EXCLUDE_SB
  176.         {SNDCARD_SB,    "SoundBlaster",        attach_sb_card, probe_sb,
  177.             {SBC_BASE, SBC_IRQ, SBC_DMA}, SND_DEFAULT_ENABLE},
  178. #endif
  179.  
  180. #if !defined(EXCLUDE_SB) && !defined(EXCLUDE_SB16)
  181. #ifndef EXCLUDE_AUDIO
  182.         {SNDCARD_SB16,    "SoundBlaster16",    sb16_dsp_init, sb16_dsp_detect,
  183.             {SBC_BASE, SBC_IRQ, SB16_DMA}, SND_DEFAULT_ENABLE},
  184. #endif
  185. #ifndef EXCLUDE_MIDI
  186.         {SNDCARD_SB16MIDI,"SB16 MPU-401",    attach_sb16midi, probe_sb16midi,
  187.             {SB16MIDI_BASE, SBC_IRQ, 0}, SND_DEFAULT_ENABLE},
  188. #endif
  189. #endif
  190.  
  191. #ifndef EXCLUDE_GUS
  192.         {SNDCARD_GUS,    "Gravis Ultrasound",    attach_gus_card, probe_gus,
  193.             {GUS_BASE, GUS_IRQ, GUS_DMA}, SND_DEFAULT_ENABLE},
  194. #endif
  195.  
  196. #ifndef EXCLUDE_YM3812
  197.         {SNDCARD_ADLIB,    "AdLib",        attach_adlib_card, probe_adlib,
  198.             {FM_MONO, 0, 0}, SND_DEFAULT_ENABLE},
  199. #endif
  200.         {0,            "*?*",            NULL, 0}
  201.     };
  202.  
  203.     int num_sound_drivers =
  204.         sizeof(supported_drivers) / sizeof (struct card_info);
  205.  
  206.  
  207. # ifndef EXCLUDE_AUDIO 
  208.     int sound_buffcounts[MAX_DSP_DEV] = {0};
  209.     long sound_buffsizes[MAX_DSP_DEV] = {0};
  210.     int sound_dsp_dmachan[MAX_DSP_DEV] = {0};
  211.     int sound_dma_automode[MAX_DSP_DEV] = {0};
  212. # endif
  213. #else
  214.     extern struct audio_operations * dsp_devs[MAX_DSP_DEV]; int num_dspdevs;
  215.     extern struct mixer_operations * mixer_devs[MAX_MIXER_DEV]; extern int num_mixers;
  216.     extern struct synth_operations * synth_devs[MAX_SYNTH_DEV]; extern int num_synths;
  217.     extern struct midi_operations * midi_devs[MAX_MIDI_DEV]; extern int num_midis;
  218. #   ifndef EXCLUDE_MPU401
  219.         extern int mpu401_dev;
  220. #   endif
  221.  
  222.     extern struct card_info supported_drivers[];
  223.     extern int num_sound_drivers;
  224.  
  225. # ifndef EXCLUDE_AUDIO
  226.     extern int sound_buffcounts[MAX_DSP_DEV];
  227.     extern long sound_buffsizes[MAX_DSP_DEV];
  228.     extern int sound_dsp_dmachan[MAX_DSP_DEV];
  229.     extern int sound_dma_automode[MAX_DSP_DEV];
  230. # endif
  231.  
  232. #endif
  233.  
  234. long sndtable_init(long mem_start);
  235. int sndtable_get_cardcount (void);
  236. long CMIDI_init(long mem_start); /* */
  237. struct address_info *sound_getconf(int card_type);
  238. void sound_chconf(int card_type, int ioaddr, int irq, int dma);
  239. #endif
  240.  
  241. #endif
  242.  
  243. /* If external to me.... :) */
  244.  
  245. #ifdef ALL_EXTERNAL_TO_ME
  246.  
  247.     extern struct audio_operations * dsp_devs[MAX_DSP_DEV]; int num_dspdevs;
  248.         extern struct mixer_operations * mixer_devs[MAX_MIXER_DEV]; extern int num_mixers;
  249.         extern struct synth_operations * synth_devs[MAX_SYNTH_DEV]; extern int num_synths;
  250.         extern struct midi_operations * midi_devs[MAX_MIDI_DEV]; extern int num_midis;
  251.     extern struct generic_midi_operations *generic_midi_devs[]; 
  252.     extern int num_generic_midis, pro_midi_dev;
  253.  
  254. #ifndef EXCLUDE_MPU401
  255.         extern int mpu401_dev;
  256. #endif
  257.  
  258.     extern struct generic_midi_info midi_supported[];
  259.     extern struct card_info supported_drivers[];
  260.         extern int num_sound_drivers;
  261.     extern int num_midi_drivers;    
  262. #ifndef EXCLUDE_AUDIO
  263.         extern int sound_buffcounts[MAX_DSP_DEV];
  264.         extern long sound_buffsizes[MAX_DSP_DEV];
  265.         extern int sound_dsp_dmachan[MAX_DSP_DEV];
  266.         extern int sound_dma_automode[MAX_DSP_DEV];
  267. #endif
  268.  
  269. #endif
  270.