root/include/linux/soundcard.h

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

INCLUDED FROM


   1 #ifndef SOUNDCARD_H
   2 #define SOUNDCARD_H
   3 /*
   4  *      linux/soundcard.h
   5  *
   6  *      Sound Card driver for Linux
   7  *
   8  *      (C) Hannu Savolainen 1992
   9  *
  10  */
  11 
  12 /*
  13  *      Supported card ID numbers
  14  */
  15 
  16 #define SNDCARD_ADLIB   1
  17 #define SNDCARD_SB      2
  18 #define SNDCARD_PAS     3
  19 
  20 /*
  21  * IOCTL Commands. Suffix 0x4252 is string "SB".
  22  */
  23 
  24 #define SNDCTL_CONFIGURE                                0x00014252
  25 
  26 #define SNDCTL_FM_LOAD_INSTR                            0x01014252
  27 /* #define SNDCTL_FM_RETURN_INSTR                       0x01034252      */
  28 #define SNDCTL_SEQ_SYNC                                 0x01044252
  29 #define SNDCTL_SEQ_RESET                                0x01054252
  30 #define SNDCTL_SYNTH_INFO                               0x01064252
  31 #define SNDCTL_SEQ_TESTMIDI                             0x01074252
  32 #define SNDCTL_SEQ_PERCMODE                             0x01084252
  33 
  34 #define SNDCTL_DSP_SPEED                                0x01114252
  35 #define SNDCTL_DSP_STEREO                               0x01124252
  36 #define SNDCTL_DSP_GETBLKSIZE                           0x01134252
  37 #define SNDCTL_DSP_SYNC                                 0x01144252
  38 #define SNDCTL_DSP_RESET                                0x01154252
  39 #define SNDCTL_DSP_SAMPLESIZE                           0x01164252
  40 /* 8, 12 or 16) */
  41 
  42 #define SEQ_FMNOTEOFF           0
  43 #define SEQ_FMNOTEON            1
  44 #define SEQ_WAIT                2
  45 #define SEQ_FMPGMCHANGE         3
  46 #define SEQ_SYNCTIMER           4
  47 #define SEQ_MIDIPUTC            5
  48 #define SEQ_DRUMON              6       /* Play percussive instrument */
  49 #define SEQ_DRUMOFF             7
  50 
  51 typedef unsigned char sbi_instr_data[16];
  52 
  53 struct sbi_instrument {
  54                 int             channel;        /*      Channel to be programmed        */
  55                 sbi_instr_data  operators;      /*      Register settings for operator cells (.SBI format)      */
  56         };
  57 
  58 struct synth_info {     /* Read only */
  59                 int     synth_type;
  60 #define SYNTH_TYPE_FM                   0
  61 
  62                 int     synth_subtype;
  63 #define FM_TYPE_ADLIB                   0
  64 #define FM_TYPE_OPL3                    1
  65 
  66                 int     perc_mode;      /* 0=off 1=off */
  67                 int     nr_voices;
  68                 int     nr_drums;
  69                 int     instr_bank_size;
  70                 int     dummies[20];    /* Reserve space */
  71         };
  72 /*
  73         Definitions for a "universal" sound driver 
  74         by Craig metz (cmetz@thor.tjhsst.edu)
  75 */      
  76         
  77 /*  
  78         IOCTL requests take the general form of a base address plus
  79         a device type plus a request type. The base address fills the
  80         top three bytes of the request longword and is formed from the 
  81         letters 'SND'. The top nybble of the remaining byte indicates
  82         the device type to be interacted with, and the request type
  83         indicates what the device needs to do, and bit 3 of the lower
  84         nybble distinguishes read and write. 
  85 
  86         IOCTL Calling Form:
  87 
  88                 ioctl(fh, SOUND_call, &parameter);
  89 */
  90 
  91 #define SOUND_BASE      0x534E4400
  92 
  93 #define SOUND_READ      0x00000000
  94 #define SOUND_WRITE     0x00000008
  95 
  96 /* 
  97         Mixer control - device type 0 
  98 
  99         All parameters are of type "unsigned short int" - The LSB is the 
 100         left value, the MSB is the right value. Both are in percents, 0 
 101         being mute and 100 being full power. In the event that the card 
 102         only supports mono mixer control, the LSB will be the value used.
 103 */
 104 
 105 #define SOUND_MIXER             0x00
 106 #define SOUND_MIXER_TYPE        unsigned short int
 107 
 108 #define SOUND_MIXER_VOLUME      0x0
 109 #define SOUND_MIXER_BASS        0x1
 110 #define SOUND_MIXER_TREBLE      0x2
 111 #define SOUND_MIXER_MIDI        0x3
 112 #define SOUND_MIXER_PCM         0x4
 113 #define SOUND_MIXER_SPEAKER     0x5
 114 #define SOUND_MIXER_LINE        0x6
 115 #define SOUND_MIXER_MIC         0x7
 116 
 117 #define SOUND_MIXER_READ_VOLUME         (SOUND_BASE | SOUND_MIXER | SOUND_READ  | SOUND_MIXER_VOLUME )
 118 #define SOUND_MIXER_READ_BASS           (SOUND_BASE | SOUND_MIXER | SOUND_READ  | SOUND_MIXER_BASS   )
 119 #define SOUND_MIXER_READ_TREBLE         (SOUND_BASE | SOUND_MIXER | SOUND_READ  | SOUND_MIXER_TREBLE )
 120 #define SOUND_MIXER_READ_MIDI           (SOUND_BASE | SOUND_MIXER | SOUND_READ  | SOUND_MIXER_MIDI   )
 121 #define SOUND_MIXER_READ_PCM            (SOUND_BASE | SOUND_MIXER | SOUND_READ  | SOUND_MIXER_PCM    )
 122 #define SOUND_MIXER_READ_SPEAKER        (SOUND_BASE | SOUND_MIXER | SOUND_READ  | SOUND_MIXER_SPEAKER)
 123 #define SOUND_MIXER_READ_LINE           (SOUND_BASE | SOUND_MIXER | SOUND_READ  | SOUND_MIXER_LINE   )
 124 #define SOUND_MIXER_READ_MIC            (SOUND_BASE | SOUND_MIXER | SOUND_READ  | SOUND_MIXER_MIC    )
 125 
 126 #define SOUND_MIXER_WRITE_VOLUME        (SOUND_BASE | SOUND_MIXER | SOUND_WRITE | SOUND_MIXER_VOLUME )
 127 #define SOUND_MIXER_WRITE_BASS          (SOUND_BASE | SOUND_MIXER | SOUND_WRITE | SOUND_MIXER_BASS   )
 128 #define SOUND_MIXER_WRITE_TREBLE        (SOUND_BASE | SOUND_MIXER | SOUND_WRITE | SOUND_MIXER_TREBLE )
 129 #define SOUND_MIXER_WRITE_MIDI          (SOUND_BASE | SOUND_MIXER | SOUND_WRITE | SOUND_MIXER_MIDI   )
 130 #define SOUND_MIXER_WRITE_PCM           (SOUND_BASE | SOUND_MIXER | SOUND_WRITE | SOUND_MIXER_PCM    )
 131 #define SOUND_MIXER_WRITE_SPEAKER       (SOUND_BASE | SOUND_MIXER | SOUND_WRITE | SOUND_MIXER_SPEAKER)
 132 #define SOUND_MIXER_WRITE_LINE          (SOUND_BASE | SOUND_MIXER | SOUND_WRITE | SOUND_MIXER_LINE   )
 133 #define SOUND_MIXER_WRITE_MIC           (SOUND_BASE | SOUND_MIXER | SOUND_WRITE | SOUND_MIXER_MIC    )
 134 
 135 /*
 136         PCM control - device type 1
 137 
 138         All parameters are of type "unsigned short int".
 139 
 140         RATE = sampling rate in Hz
 141         CHANNELS = number of channels (1 = mono, 2 = stereo)
 142         BITS = number of bits/sample/channel (8 = 8 bit, 
 143                 12 = 12 bit, 16 = 16 bit)
 144         FILTER = flag (0 = don't filter, 1 = use best filter)
 145 */
 146 
 147 #define SOUND_PCM               0x10
 148 #define SOUND_PCM_TYPE          unsigned short int
 149 
 150 #define SOUND_RATE              0x0
 151 #define SOUND_CHANNELS          0x1
 152 #define SOUND_BITS              0x2
 153 #define SOUND_FILTER            0x3
 154 
 155 #define SOUND_PCM_READ_RATE             (SOUND_BASE | SOUND_PCM | SOUND_READ  | SOUND_RATE    )
 156 #define SOUND_PCM_READ_CHANNELS         (SOUND_BASE | SOUND_PCM | SOUND_READ  | SOUND_CHANNELS)
 157 #define SOUND_PCM_READ_BITS             (SOUND_BASE | SOUND_PCM | SOUND_READ  | SOUND_BITS    )
 158 #define SOUND_PCM_READ_FILTER           (SOUND_BASE | SOUND_PCM | SOUND_READ  | SOUND_FILTER  )
 159         
 160 #define SOUND_PCM_WRITE_RATE            (SOUND_BASE | SOUND_PCM | SOUND_WRITE | SOUND_RATE    )
 161 #define SOUND_PCM_WRITE_CHANNELS        (SOUND_BASE | SOUND_PCM | SOUND_WRITE | SOUND_CHANNELS)
 162 #define SOUND_PCM_WRITE_BITS            (SOUND_BASE | SOUND_PCM | SOUND_WRITE | SOUND_BITS    )
 163 #define SOUND_PCM_WRITE_FILTER          (SOUND_BASE | SOUND_PCM | SOUND_WRITE | SOUND_FILTER  )
 164 
 165 /*
 166  *      The Mixer ioctl calls are compatible with mach386 driver by
 167  *        Steve Haehnichen <shaehnic@ucsd.edu>
 168  */
 169 
 170 typedef unsigned char BYTE;
 171 typedef unsigned char FLAG;
 172 struct stereo_vol
 173 {
 174   BYTE l;                       /* Left volume */
 175   BYTE r;                       /* Right volume */
 176 };
 177 #define MIXER_IOCTL_SET_LEVELS          0x02014252
 178 #define MIXER_IOCTL_SET_PARAMS          0x02024252
 179 #define MIXER_IOCTL_READ_LEVELS         0x02034252
 180 #define MIXER_IOCTL_READ_PARAMS         0x02044252
 181 #define MIXER_IOCTL_RESET               0x02054252
 182 
 183 /*
 184  * Mixer volume levels for MIXER_IOCTL_SET_VOL & MIXER_IOCTL_READ_VOL
 185  */
 186 struct sb_mixer_levels
 187 {
 188   struct stereo_vol master;     /* Master volume */
 189   struct stereo_vol voc;        /* DSP Voice volume */
 190   struct stereo_vol fm;         /* FM volume */
 191   struct stereo_vol line;       /* Line-in volume */
 192   struct stereo_vol cd;         /* CD audio */
 193   BYTE mic;                     /* Microphone level */
 194 };
 195 
 196 /*
 197  * Mixer parameters for MIXER_IOCTL_SET_PARAMS & MIXER_IOCTL_READ_PARAMS
 198  */
 199 struct sb_mixer_params
 200 {
 201   BYTE record_source;           /* Recording source (See SRC_xxx below) */
 202   FLAG hifreq_filter;           /* Filter frequency (hi/low) */
 203   FLAG filter_input;            /* ANFI input filter */
 204   FLAG filter_output;           /* DNFI output filter */
 205   FLAG dsp_stereo;              /* 1 if DSP is in Stereo mode */
 206 };
 207 
 208 #define SRC_MIC         1       /* Select Microphone recording source */
 209 #define SRC_CD          3       /* Select CD recording source */
 210 #define SRC_LINE        7       /* Use Line-in for recording source */
 211 
 212 
 213 /*
 214  *      Dynamic configuration mechanism.
 215  *      (for soundload program)
 216  */
 217 
 218 
 219 struct soundcard_config
 220 {
 221         int     config_command;
 222 #define SNDCONF_RESET                   0
 223 #define SNDCONF_START                   1
 224 #define SNDCONF_SETCARD                 2
 225 
 226         int     cardtype;       /* SNDCARD_ADLIB etc. */
 227         int     card_subtype;   /* Card dependent number */
 228 
 229         int     config_parms[100];      /* Card dependent parameters */
 230 };
 231 
 232 extern long soundcard_init(long mem_start);
 233 
 234 #endif

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