1/* 2 * Advanced Linux Sound Architecture - ALSA - Driver 3 * Copyright (c) 1994-2003 by Jaroslav Kysela <perex@perex.cz>, 4 * Abramo Bagnara <abramo@alsa-project.org> 5 * 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation; either version 2 of the License, or 10 * (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 * 21 */ 22 23#ifndef __SOUND_ASOUND_H 24#define __SOUND_ASOUND_H 25 26#if defined(LINUX) || defined(__LINUX__) || defined(__linux__) 27 28#include <linux/ioctl.h> 29#include <linux/types.h> 30 31#ifdef __KERNEL__ 32 33#include <linux/time.h> 34#include <asm/byteorder.h> 35 36#if __LITTLE_ENDIAN == 1234 37#define SNDRV_LITTLE_ENDIAN 38#elif __BIG_ENDIAN == 4321 39#define SNDRV_BIG_ENDIAN 40#else 41#error "Unsupported endian..." 42#endif 43 44#else /* !__KERNEL__ */ 45 46#include <endian.h> 47#if __BYTE_ORDER == __LITTLE_ENDIAN 48#define SNDRV_LITTLE_ENDIAN 49#elif __BYTE_ORDER == __BIG_ENDIAN 50#define SNDRV_BIG_ENDIAN 51#else 52#error "Unsupported endian..." 53#endif 54 55#endif /* __KERNEL **/ 56 57#endif /* LINUX */ 58 59#ifndef __KERNEL__ 60#include <sys/time.h> 61#include <sys/types.h> 62#include <sys/ioctl.h> 63#endif 64 65/* 66 * protocol version 67 */ 68 69#define SNDRV_PROTOCOL_VERSION(major, minor, subminor) (((major)<<16)|((minor)<<8)|(subminor)) 70#define SNDRV_PROTOCOL_MAJOR(version) (((version)>>16)&0xffff) 71#define SNDRV_PROTOCOL_MINOR(version) (((version)>>8)&0xff) 72#define SNDRV_PROTOCOL_MICRO(version) ((version)&0xff) 73#define SNDRV_PROTOCOL_INCOMPATIBLE(kversion, uversion) \ 74 (SNDRV_PROTOCOL_MAJOR(kversion) != SNDRV_PROTOCOL_MAJOR(uversion) || \ 75 (SNDRV_PROTOCOL_MAJOR(kversion) == SNDRV_PROTOCOL_MAJOR(uversion) && \ 76 SNDRV_PROTOCOL_MINOR(kversion) != SNDRV_PROTOCOL_MINOR(uversion))) 77 78/**************************************************************************** 79 * * 80 * Digital audio interface * 81 * * 82 ****************************************************************************/ 83 84struct sndrv_aes_iec958 { 85 unsigned char status[24]; /* AES/IEC958 channel status bits */ 86 unsigned char subcode[147]; /* AES/IEC958 subcode bits */ 87 unsigned char pad; /* nothing */ 88 unsigned char dig_subframe[4]; /* AES/IEC958 subframe bits */ 89}; 90 91/**************************************************************************** 92 * * 93 * Section for driver hardware dependent interface - /dev/snd/hw? * 94 * * 95 ****************************************************************************/ 96 97#define SNDRV_HWDEP_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 1) 98 99enum sndrv_hwdep_iface { 100 SNDRV_HWDEP_IFACE_OPL2 = 0, 101 SNDRV_HWDEP_IFACE_OPL3, 102 SNDRV_HWDEP_IFACE_OPL4, 103 SNDRV_HWDEP_IFACE_SB16CSP, /* Creative Signal Processor */ 104 SNDRV_HWDEP_IFACE_EMU10K1, /* FX8010 processor in EMU10K1 chip */ 105 SNDRV_HWDEP_IFACE_YSS225, /* Yamaha FX processor */ 106 SNDRV_HWDEP_IFACE_ICS2115, /* Wavetable synth */ 107 SNDRV_HWDEP_IFACE_SSCAPE, /* Ensoniq SoundScape ISA card (MC68EC000) */ 108 SNDRV_HWDEP_IFACE_VX, /* Digigram VX cards */ 109 SNDRV_HWDEP_IFACE_MIXART, /* Digigram miXart cards */ 110 SNDRV_HWDEP_IFACE_USX2Y, /* Tascam US122, US224 & US428 usb */ 111 SNDRV_HWDEP_IFACE_EMUX_WAVETABLE, /* EmuX wavetable */ 112 SNDRV_HWDEP_IFACE_BLUETOOTH, /* Bluetooth audio */ 113 SNDRV_HWDEP_IFACE_USX2Y_PCM, /* Tascam US122, US224 & US428 rawusb pcm */ 114 SNDRV_HWDEP_IFACE_PCXHR, /* Digigram PCXHR */ 115 SNDRV_HWDEP_IFACE_SB_RC, /* SB Extigy/Audigy2NX remote control */ 116 SNDRV_HWDEP_IFACE_HDA, /* HD-audio */ 117 SNDRV_HWDEP_IFACE_USB_STREAM, /* direct access to usb stream */ 118 119 /* Don't forget to change the following: */ 120 SNDRV_HWDEP_IFACE_LAST = SNDRV_HWDEP_IFACE_USB_STREAM 121}; 122 123struct sndrv_hwdep_info { 124 unsigned int device; /* WR: device number */ 125 int card; /* R: card number */ 126 unsigned char id[64]; /* ID (user selectable) */ 127 unsigned char name[80]; /* hwdep name */ 128 int iface; /* hwdep interface */ 129 unsigned char reserved[64]; /* reserved for future */ 130}; 131 132/* generic DSP loader */ 133struct sndrv_hwdep_dsp_status { 134 unsigned int version; /* R: driver-specific version */ 135 unsigned char id[32]; /* R: driver-specific ID string */ 136 unsigned int num_dsps; /* R: number of DSP images to transfer */ 137 unsigned int dsp_loaded; /* R: bit flags indicating the loaded DSPs */ 138 unsigned int chip_ready; /* R: 1 = initialization finished */ 139 unsigned char reserved[16]; /* reserved for future use */ 140}; 141 142struct sndrv_hwdep_dsp_image { 143 unsigned int index; /* W: DSP index */ 144 unsigned char name[64]; /* W: ID (e.g. file name) */ 145 unsigned char *image; /* W: binary image */ 146 size_t length; /* W: size of image in bytes */ 147 unsigned long driver_data; /* W: driver-specific data */ 148}; 149 150enum { 151 SNDRV_HWDEP_IOCTL_PVERSION = _IOR ('H', 0x00, int), 152 SNDRV_HWDEP_IOCTL_INFO = _IOR ('H', 0x01, struct sndrv_hwdep_info), 153 SNDRV_HWDEP_IOCTL_DSP_STATUS = _IOR('H', 0x02, struct sndrv_hwdep_dsp_status), 154 SNDRV_HWDEP_IOCTL_DSP_LOAD = _IOW('H', 0x03, struct sndrv_hwdep_dsp_image) 155}; 156 157/***************************************************************************** 158 * * 159 * Digital Audio (PCM) interface - /dev/snd/pcm?? * 160 * * 161 *****************************************************************************/ 162 163#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 10) 164 165typedef unsigned long sndrv_pcm_uframes_t; 166typedef long sndrv_pcm_sframes_t; 167 168enum sndrv_pcm_class { 169 SNDRV_PCM_CLASS_GENERIC = 0, /* standard mono or stereo device */ 170 SNDRV_PCM_CLASS_MULTI, /* multichannel device */ 171 SNDRV_PCM_CLASS_MODEM, /* software modem class */ 172 SNDRV_PCM_CLASS_DIGITIZER, /* digitizer class */ 173 /* Don't forget to change the following: */ 174 SNDRV_PCM_CLASS_LAST = SNDRV_PCM_CLASS_DIGITIZER, 175}; 176 177enum sndrv_pcm_subclass { 178 SNDRV_PCM_SUBCLASS_GENERIC_MIX = 0, /* mono or stereo subdevices are mixed together */ 179 SNDRV_PCM_SUBCLASS_MULTI_MIX, /* multichannel subdevices are mixed together */ 180 /* Don't forget to change the following: */ 181 SNDRV_PCM_SUBCLASS_LAST = SNDRV_PCM_SUBCLASS_MULTI_MIX, 182}; 183 184enum sndrv_pcm_stream { 185 SNDRV_PCM_STREAM_PLAYBACK = 0, 186 SNDRV_PCM_STREAM_CAPTURE, 187 SNDRV_PCM_STREAM_LAST = SNDRV_PCM_STREAM_CAPTURE, 188}; 189 190enum sndrv_pcm_access { 191 SNDRV_PCM_ACCESS_MMAP_INTERLEAVED = 0, /* interleaved mmap */ 192 SNDRV_PCM_ACCESS_MMAP_NONINTERLEAVED, /* noninterleaved mmap */ 193 SNDRV_PCM_ACCESS_MMAP_COMPLEX, /* complex mmap */ 194 SNDRV_PCM_ACCESS_RW_INTERLEAVED, /* readi/writei */ 195 SNDRV_PCM_ACCESS_RW_NONINTERLEAVED, /* readn/writen */ 196 SNDRV_PCM_ACCESS_LAST = SNDRV_PCM_ACCESS_RW_NONINTERLEAVED, 197}; 198 199enum sndrv_pcm_format { 200 SNDRV_PCM_FORMAT_S8 = 0, 201 SNDRV_PCM_FORMAT_U8, 202 SNDRV_PCM_FORMAT_S16_LE, 203 SNDRV_PCM_FORMAT_S16_BE, 204 SNDRV_PCM_FORMAT_U16_LE, 205 SNDRV_PCM_FORMAT_U16_BE, 206 SNDRV_PCM_FORMAT_S24_LE, /* low three bytes */ 207 SNDRV_PCM_FORMAT_S24_BE, /* low three bytes */ 208 SNDRV_PCM_FORMAT_U24_LE, /* low three bytes */ 209 SNDRV_PCM_FORMAT_U24_BE, /* low three bytes */ 210 SNDRV_PCM_FORMAT_S32_LE, 211 SNDRV_PCM_FORMAT_S32_BE, 212 SNDRV_PCM_FORMAT_U32_LE, 213 SNDRV_PCM_FORMAT_U32_BE, 214 SNDRV_PCM_FORMAT_FLOAT_LE, /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */ 215 SNDRV_PCM_FORMAT_FLOAT_BE, /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */ 216 SNDRV_PCM_FORMAT_FLOAT64_LE, /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */ 217 SNDRV_PCM_FORMAT_FLOAT64_BE, /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */ 218 SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE, /* IEC-958 subframe, Little Endian */ 219 SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE, /* IEC-958 subframe, Big Endian */ 220 SNDRV_PCM_FORMAT_MU_LAW, 221 SNDRV_PCM_FORMAT_A_LAW, 222 SNDRV_PCM_FORMAT_IMA_ADPCM, 223 SNDRV_PCM_FORMAT_MPEG, 224 SNDRV_PCM_FORMAT_GSM, 225 SNDRV_PCM_FORMAT_SPECIAL = 31, 226 SNDRV_PCM_FORMAT_S24_3LE = 32, /* in three bytes */ 227 SNDRV_PCM_FORMAT_S24_3BE, /* in three bytes */ 228 SNDRV_PCM_FORMAT_U24_3LE, /* in three bytes */ 229 SNDRV_PCM_FORMAT_U24_3BE, /* in three bytes */ 230 SNDRV_PCM_FORMAT_S20_3LE, /* in three bytes */ 231 SNDRV_PCM_FORMAT_S20_3BE, /* in three bytes */ 232 SNDRV_PCM_FORMAT_U20_3LE, /* in three bytes */ 233 SNDRV_PCM_FORMAT_U20_3BE, /* in three bytes */ 234 SNDRV_PCM_FORMAT_S18_3LE, /* in three bytes */ 235 SNDRV_PCM_FORMAT_S18_3BE, /* in three bytes */ 236 SNDRV_PCM_FORMAT_U18_3LE, /* in three bytes */ 237 SNDRV_PCM_FORMAT_U18_3BE, /* in three bytes */ 238 SNDRV_PCM_FORMAT_G723_24, /* 8 samples in 3 bytes */ 239 SNDRV_PCM_FORMAT_G723_24_1B, /* 1 sample in 1 byte */ 240 SNDRV_PCM_FORMAT_G723_40, /* 8 Samples in 5 bytes */ 241 SNDRV_PCM_FORMAT_G723_40_1B, /* 1 sample in 1 byte */ 242 SNDRV_PCM_FORMAT_LAST = SNDRV_PCM_FORMAT_G723_40_1B, 243 244#ifdef SNDRV_LITTLE_ENDIAN 245 SNDRV_PCM_FORMAT_S16 = SNDRV_PCM_FORMAT_S16_LE, 246 SNDRV_PCM_FORMAT_U16 = SNDRV_PCM_FORMAT_U16_LE, 247 SNDRV_PCM_FORMAT_S24 = SNDRV_PCM_FORMAT_S24_LE, 248 SNDRV_PCM_FORMAT_U24 = SNDRV_PCM_FORMAT_U24_LE, 249 SNDRV_PCM_FORMAT_S32 = SNDRV_PCM_FORMAT_S32_LE, 250 SNDRV_PCM_FORMAT_U32 = SNDRV_PCM_FORMAT_U32_LE, 251 SNDRV_PCM_FORMAT_FLOAT = SNDRV_PCM_FORMAT_FLOAT_LE, 252 SNDRV_PCM_FORMAT_FLOAT64 = SNDRV_PCM_FORMAT_FLOAT64_LE, 253 SNDRV_PCM_FORMAT_IEC958_SUBFRAME = SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE, 254#endif 255#ifdef SNDRV_BIG_ENDIAN 256 SNDRV_PCM_FORMAT_S16 = SNDRV_PCM_FORMAT_S16_BE, 257 SNDRV_PCM_FORMAT_U16 = SNDRV_PCM_FORMAT_U16_BE, 258 SNDRV_PCM_FORMAT_S24 = SNDRV_PCM_FORMAT_S24_BE, 259 SNDRV_PCM_FORMAT_U24 = SNDRV_PCM_FORMAT_U24_BE, 260 SNDRV_PCM_FORMAT_S32 = SNDRV_PCM_FORMAT_S32_BE, 261 SNDRV_PCM_FORMAT_U32 = SNDRV_PCM_FORMAT_U32_BE, 262 SNDRV_PCM_FORMAT_FLOAT = SNDRV_PCM_FORMAT_FLOAT_BE, 263 SNDRV_PCM_FORMAT_FLOAT64 = SNDRV_PCM_FORMAT_FLOAT64_BE, 264 SNDRV_PCM_FORMAT_IEC958_SUBFRAME = SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE, 265#endif 266}; 267 268enum sndrv_pcm_subformat { 269 SNDRV_PCM_SUBFORMAT_STD = 0, 270 SNDRV_PCM_SUBFORMAT_LAST = SNDRV_PCM_SUBFORMAT_STD, 271}; 272 273#define SNDRV_PCM_INFO_MMAP 0x00000001 /* hardware supports mmap */ 274#define SNDRV_PCM_INFO_MMAP_VALID 0x00000002 /* period data are valid during transfer */ 275#define SNDRV_PCM_INFO_DOUBLE 0x00000004 /* Double buffering needed for PCM start/stop */ 276#define SNDRV_PCM_INFO_BATCH 0x00000010 /* double buffering */ 277#define SNDRV_PCM_INFO_INTERLEAVED 0x00000100 /* channels are interleaved */ 278#define SNDRV_PCM_INFO_NONINTERLEAVED 0x00000200 /* channels are not interleaved */ 279#define SNDRV_PCM_INFO_COMPLEX 0x00000400 /* complex frame organization (mmap only) */ 280#define SNDRV_PCM_INFO_BLOCK_TRANSFER 0x00010000 /* hardware transfer block of samples */ 281#define SNDRV_PCM_INFO_OVERRANGE 0x00020000 /* hardware supports ADC (capture) overrange detection */ 282#define SNDRV_PCM_INFO_RESUME 0x00040000 /* hardware supports stream resume after suspend */ 283#define SNDRV_PCM_INFO_PAUSE 0x00080000 /* pause ioctl is supported */ 284#define SNDRV_PCM_INFO_HALF_DUPLEX 0x00100000 /* only half duplex */ 285#define SNDRV_PCM_INFO_JOINT_DUPLEX 0x00200000 /* playback and capture stream are somewhat correlated */ 286#define SNDRV_PCM_INFO_SYNC_START 0x00400000 /* pcm support some kind of sync go */ 287#define SNDRV_PCM_INFO_NO_PERIOD_WAKEUP 0x00800000 /* period wakeup can be disabled */ 288 289enum sndrv_pcm_state { 290 SNDRV_PCM_STATE_OPEN = 0, /* stream is open */ 291 SNDRV_PCM_STATE_SETUP, /* stream has a setup */ 292 SNDRV_PCM_STATE_PREPARED, /* stream is ready to start */ 293 SNDRV_PCM_STATE_RUNNING, /* stream is running */ 294 SNDRV_PCM_STATE_XRUN, /* stream reached an xrun */ 295 SNDRV_PCM_STATE_DRAINING, /* stream is draining */ 296 SNDRV_PCM_STATE_PAUSED, /* stream is paused */ 297 SNDRV_PCM_STATE_SUSPENDED, /* hardware is suspended */ 298 SNDRV_PCM_STATE_DISCONNECTED, /* hardware is disconnected */ 299 SNDRV_PCM_STATE_LAST = SNDRV_PCM_STATE_DISCONNECTED, 300}; 301 302enum { 303 SNDRV_PCM_MMAP_OFFSET_DATA = 0x00000000, 304 SNDRV_PCM_MMAP_OFFSET_STATUS = 0x80000000, 305 SNDRV_PCM_MMAP_OFFSET_CONTROL = 0x81000000, 306}; 307 308union sndrv_pcm_sync_id { 309 unsigned char id[16]; 310 unsigned short id16[8]; 311 unsigned int id32[4]; 312}; 313 314struct sndrv_pcm_info { 315 unsigned int device; /* RO/WR (control): device number */ 316 unsigned int subdevice; /* RO/WR (control): subdevice number */ 317 int stream; /* RO/WR (control): stream direction */ 318 int card; /* R: card number */ 319 unsigned char id[64]; /* ID (user selectable) */ 320 unsigned char name[80]; /* name of this device */ 321 unsigned char subname[32]; /* subdevice name */ 322 int dev_class; /* SNDRV_PCM_CLASS_* */ 323 int dev_subclass; /* SNDRV_PCM_SUBCLASS_* */ 324 unsigned int subdevices_count; 325 unsigned int subdevices_avail; 326 union sndrv_pcm_sync_id sync; /* hardware synchronization ID */ 327 unsigned char reserved[64]; /* reserved for future... */ 328}; 329 330enum sndrv_pcm_hw_param { 331 SNDRV_PCM_HW_PARAM_ACCESS = 0, /* Access type */ 332 SNDRV_PCM_HW_PARAM_FIRST_MASK = SNDRV_PCM_HW_PARAM_ACCESS, 333 SNDRV_PCM_HW_PARAM_FORMAT, /* Format */ 334 SNDRV_PCM_HW_PARAM_SUBFORMAT, /* Subformat */ 335 SNDRV_PCM_HW_PARAM_LAST_MASK = SNDRV_PCM_HW_PARAM_SUBFORMAT, 336 337 SNDRV_PCM_HW_PARAM_SAMPLE_BITS = 8, /* Bits per sample */ 338 SNDRV_PCM_HW_PARAM_FIRST_INTERVAL = SNDRV_PCM_HW_PARAM_SAMPLE_BITS, 339 SNDRV_PCM_HW_PARAM_FRAME_BITS, /* Bits per frame */ 340 SNDRV_PCM_HW_PARAM_CHANNELS, /* Channels */ 341 SNDRV_PCM_HW_PARAM_RATE, /* Approx rate */ 342 SNDRV_PCM_HW_PARAM_PERIOD_TIME, /* Approx distance between interrupts 343 in us */ 344 SNDRV_PCM_HW_PARAM_PERIOD_SIZE, /* Approx frames between interrupts */ 345 SNDRV_PCM_HW_PARAM_PERIOD_BYTES, /* Approx bytes between interrupts */ 346 SNDRV_PCM_HW_PARAM_PERIODS, /* Approx interrupts per buffer */ 347 SNDRV_PCM_HW_PARAM_BUFFER_TIME, /* Approx duration of buffer in us */ 348 SNDRV_PCM_HW_PARAM_BUFFER_SIZE, /* Size of buffer in frames */ 349 SNDRV_PCM_HW_PARAM_BUFFER_BYTES, /* Size of buffer in bytes */ 350 SNDRV_PCM_HW_PARAM_TICK_TIME, /* Approx tick duration in us */ 351 SNDRV_PCM_HW_PARAM_LAST_INTERVAL = SNDRV_PCM_HW_PARAM_TICK_TIME 352}; 353 354#define SNDRV_PCM_HW_PARAMS_NORESAMPLE (1<<0) /* avoid rate resampling */ 355#define SNDRV_PCM_HW_PARAMS_EXPORT_BUFFER (1<<1) /* export buffer */ 356#define SNDRV_PCM_HW_PARAMS_NO_PERIOD_WAKEUP (1<<2) /* disable period wakeups */ 357 358struct sndrv_interval { 359 unsigned int min, max; 360 unsigned int openmin:1, 361 openmax:1, 362 integer:1, 363 empty:1; 364}; 365 366#define SNDRV_MASK_MAX 256 367 368struct sndrv_mask { 369 u_int32_t bits[(SNDRV_MASK_MAX+31)/32]; 370}; 371 372struct sndrv_pcm_hw_params { 373 unsigned int flags; 374 struct sndrv_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK - 375 SNDRV_PCM_HW_PARAM_FIRST_MASK + 1]; 376 struct sndrv_mask mres[5]; /* reserved masks */ 377 struct sndrv_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL - 378 SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1]; 379 struct sndrv_interval ires[9]; /* reserved intervals */ 380 unsigned int rmask; /* W: requested masks */ 381 unsigned int cmask; /* R: changed masks */ 382 unsigned int info; /* R: Info flags for returned setup */ 383 unsigned int msbits; /* R: used most significant bits */ 384 unsigned int rate_num; /* R: rate numerator */ 385 unsigned int rate_den; /* R: rate denominator */ 386 sndrv_pcm_uframes_t fifo_size; /* R: chip FIFO size in frames */ 387 unsigned char reserved[64]; /* reserved for future */ 388}; 389 390enum sndrv_pcm_tstamp { 391 SNDRV_PCM_TSTAMP_NONE = 0, 392 SNDRV_PCM_TSTAMP_ENABLE, 393 SNDRV_PCM_TSTAMP_LAST = SNDRV_PCM_TSTAMP_ENABLE, 394}; 395 396struct sndrv_pcm_sw_params { 397 int tstamp_mode; /* timestamp mode */ 398 unsigned int period_step; 399 unsigned int sleep_min; /* min ticks to sleep */ 400 sndrv_pcm_uframes_t avail_min; /* min avail frames for wakeup */ 401 sndrv_pcm_uframes_t xfer_align; /* xfer size need to be a multiple */ 402 sndrv_pcm_uframes_t start_threshold; /* min hw_avail frames for automatic start */ 403 sndrv_pcm_uframes_t stop_threshold; /* min avail frames for automatic stop */ 404 sndrv_pcm_uframes_t silence_threshold; /* min distance from noise for silence filling */ 405 sndrv_pcm_uframes_t silence_size; /* silence block size */ 406 sndrv_pcm_uframes_t boundary; /* pointers wrap point */ 407 unsigned char reserved[60]; /* reserved for future */ 408 unsigned int period_event; /* for alsa-lib implementation */ 409}; 410 411struct sndrv_pcm_channel_info { 412 unsigned int channel; 413 long offset; /* mmap offset */ 414 unsigned int first; /* offset to first sample in bits */ 415 unsigned int step; /* samples distance in bits */ 416}; 417 418struct sndrv_pcm_status { 419 int state; /* stream state */ 420 struct timespec trigger_tstamp; /* time when stream was started/stopped/paused */ 421 struct timespec tstamp; /* reference timestamp */ 422 sndrv_pcm_uframes_t appl_ptr; /* appl ptr */ 423 sndrv_pcm_uframes_t hw_ptr; /* hw ptr */ 424 sndrv_pcm_sframes_t delay; /* current delay in frames */ 425 sndrv_pcm_uframes_t avail; /* number of frames available */ 426 sndrv_pcm_uframes_t avail_max; /* max frames available on hw since last status */ 427 sndrv_pcm_uframes_t overrange; /* count of ADC (capture) overrange detections from last status */ 428 int suspended_state; /* suspended stream state */ 429 unsigned char reserved[60]; /* must be filled with zero */ 430}; 431 432struct sndrv_pcm_mmap_status { 433 int state; /* RO: state - SNDRV_PCM_STATE_XXXX */ 434 int pad1; /* Needed for 64 bit alignment */ 435 sndrv_pcm_uframes_t hw_ptr; /* RO: hw ptr (0...boundary-1) */ 436 struct timespec tstamp; /* Timestamp */ 437 int suspended_state; /* RO: suspended stream state */ 438}; 439 440struct sndrv_pcm_mmap_control { 441 sndrv_pcm_uframes_t appl_ptr; /* RW: appl ptr (0...boundary-1) */ 442 sndrv_pcm_uframes_t avail_min; /* RW: min available frames for wakeup */ 443}; 444 445#define SNDRV_PCM_SYNC_PTR_HWSYNC (1<<0) /* execute hwsync */ 446#define SNDRV_PCM_SYNC_PTR_APPL (1<<1) /* get appl_ptr from driver (r/w op) */ 447#define SNDRV_PCM_SYNC_PTR_AVAIL_MIN (1<<2) /* get avail_min from driver */ 448 449struct sndrv_pcm_sync_ptr { 450 unsigned int flags; 451 union { 452 struct sndrv_pcm_mmap_status status; 453 unsigned char reserved[64]; 454 } s; 455 union { 456 struct sndrv_pcm_mmap_control control; 457 unsigned char reserved[64]; 458 } c; 459}; 460 461struct sndrv_xferi { 462 sndrv_pcm_sframes_t result; 463 void *buf; 464 sndrv_pcm_uframes_t frames; 465}; 466 467struct sndrv_xfern { 468 sndrv_pcm_sframes_t result; 469 void **bufs; 470 sndrv_pcm_uframes_t frames; 471}; 472 473 474enum { 475 SNDRV_PCM_TSTAMP_TYPE_GETTIMEOFDAY = 0, /* gettimeofday equivalent */ 476 SNDRV_PCM_TSTAMP_TYPE_MONOTONIC, /* posix_clock_monotonic equivalent */ 477 SNDRV_PCM_TSTAMP_TYPE_LAST = SNDRV_PCM_TSTAMP_TYPE_MONOTONIC, 478}; 479 480enum { 481 SNDRV_PCM_IOCTL_PVERSION = _IOR('A', 0x00, int), 482 SNDRV_PCM_IOCTL_INFO = _IOR('A', 0x01, struct sndrv_pcm_info), 483 SNDRV_PCM_IOCTL_TSTAMP = _IOW('A', 0x02, int), 484 SNDRV_PCM_IOCTL_TTSTAMP = _IOW('A', 0x03, int), 485 SNDRV_PCM_IOCTL_HW_REFINE = _IOWR('A', 0x10, struct sndrv_pcm_hw_params), 486 SNDRV_PCM_IOCTL_HW_PARAMS = _IOWR('A', 0x11, struct sndrv_pcm_hw_params), 487 SNDRV_PCM_IOCTL_HW_FREE = _IO('A', 0x12), 488 SNDRV_PCM_IOCTL_SW_PARAMS = _IOWR('A', 0x13, struct sndrv_pcm_sw_params), 489 SNDRV_PCM_IOCTL_STATUS = _IOR('A', 0x20, struct sndrv_pcm_status), 490 SNDRV_PCM_IOCTL_DELAY = _IOR('A', 0x21, sndrv_pcm_sframes_t), 491 SNDRV_PCM_IOCTL_HWSYNC = _IO('A', 0x22), 492 SNDRV_PCM_IOCTL_SYNC_PTR = _IOWR('A', 0x23, struct sndrv_pcm_sync_ptr), 493 SNDRV_PCM_IOCTL_CHANNEL_INFO = _IOR('A', 0x32, struct sndrv_pcm_channel_info), 494 SNDRV_PCM_IOCTL_PREPARE = _IO('A', 0x40), 495 SNDRV_PCM_IOCTL_RESET = _IO('A', 0x41), 496 SNDRV_PCM_IOCTL_START = _IO('A', 0x42), 497 SNDRV_PCM_IOCTL_DROP = _IO('A', 0x43), 498 SNDRV_PCM_IOCTL_DRAIN = _IO('A', 0x44), 499 SNDRV_PCM_IOCTL_PAUSE = _IOW('A', 0x45, int), 500 SNDRV_PCM_IOCTL_REWIND = _IOW('A', 0x46, sndrv_pcm_uframes_t), 501 SNDRV_PCM_IOCTL_RESUME = _IO('A', 0x47), 502 SNDRV_PCM_IOCTL_XRUN = _IO('A', 0x48), 503 SNDRV_PCM_IOCTL_FORWARD = _IOW('A', 0x49, sndrv_pcm_uframes_t), 504 SNDRV_PCM_IOCTL_WRITEI_FRAMES = _IOW('A', 0x50, struct sndrv_xferi), 505 SNDRV_PCM_IOCTL_READI_FRAMES = _IOR('A', 0x51, struct sndrv_xferi), 506 SNDRV_PCM_IOCTL_WRITEN_FRAMES = _IOW('A', 0x52, struct sndrv_xfern), 507 SNDRV_PCM_IOCTL_READN_FRAMES = _IOR('A', 0x53, struct sndrv_xfern), 508 SNDRV_PCM_IOCTL_LINK = _IOW('A', 0x60, int), 509 SNDRV_PCM_IOCTL_UNLINK = _IO('A', 0x61), 510}; 511 512/* Trick to make alsa-lib/acinclude.m4 happy */ 513#define SNDRV_PCM_IOCTL_REWIND SNDRV_PCM_IOCTL_REWIND 514 515/***************************************************************************** 516 * * 517 * MIDI v1.0 interface * 518 * * 519 *****************************************************************************/ 520 521/* 522 * Raw MIDI section - /dev/snd/midi?? 523 */ 524 525#define SNDRV_RAWMIDI_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 0) 526 527enum sndrv_rawmidi_stream { 528 SNDRV_RAWMIDI_STREAM_OUTPUT = 0, 529 SNDRV_RAWMIDI_STREAM_INPUT, 530 SNDRV_RAWMIDI_STREAM_LAST = SNDRV_RAWMIDI_STREAM_INPUT, 531}; 532 533#define SNDRV_RAWMIDI_INFO_OUTPUT 0x00000001 534#define SNDRV_RAWMIDI_INFO_INPUT 0x00000002 535#define SNDRV_RAWMIDI_INFO_DUPLEX 0x00000004 536 537struct sndrv_rawmidi_info { 538 unsigned int device; /* RO/WR (control): device number */ 539 unsigned int subdevice; /* RO/WR (control): subdevice number */ 540 int stream; /* WR: stream */ 541 int card; /* R: card number */ 542 unsigned int flags; /* SNDRV_RAWMIDI_INFO_XXXX */ 543 unsigned char id[64]; /* ID (user selectable) */ 544 unsigned char name[80]; /* name of device */ 545 unsigned char subname[32]; /* name of active or selected subdevice */ 546 unsigned int subdevices_count; 547 unsigned int subdevices_avail; 548 unsigned char reserved[64]; /* reserved for future use */ 549}; 550 551struct sndrv_rawmidi_params { 552 int stream; 553 size_t buffer_size; /* queue size in bytes */ 554 size_t avail_min; /* minimum avail bytes for wakeup */ 555 unsigned int no_active_sensing: 1; /* do not send active sensing byte in close() */ 556 unsigned char reserved[16]; /* reserved for future use */ 557}; 558 559struct sndrv_rawmidi_status { 560 int stream; 561 struct timespec tstamp; /* Timestamp */ 562 size_t avail; /* available bytes */ 563 size_t xruns; /* count of overruns since last status (in bytes) */ 564 unsigned char reserved[16]; /* reserved for future use */ 565}; 566 567enum { 568 SNDRV_RAWMIDI_IOCTL_PVERSION = _IOR('W', 0x00, int), 569 SNDRV_RAWMIDI_IOCTL_INFO = _IOR('W', 0x01, struct sndrv_rawmidi_info), 570 SNDRV_RAWMIDI_IOCTL_PARAMS = _IOWR('W', 0x10, struct sndrv_rawmidi_params), 571 SNDRV_RAWMIDI_IOCTL_STATUS = _IOWR('W', 0x20, struct sndrv_rawmidi_status), 572 SNDRV_RAWMIDI_IOCTL_DROP = _IOW('W', 0x30, int), 573 SNDRV_RAWMIDI_IOCTL_DRAIN = _IOW('W', 0x31, int), 574}; 575 576/* 577 * Timer section - /dev/snd/timer 578 */ 579 580#define SNDRV_TIMER_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 6) 581 582enum sndrv_timer_class { 583 SNDRV_TIMER_CLASS_NONE = -1, 584 SNDRV_TIMER_CLASS_SLAVE = 0, 585 SNDRV_TIMER_CLASS_GLOBAL, 586 SNDRV_TIMER_CLASS_CARD, 587 SNDRV_TIMER_CLASS_PCM, 588 SNDRV_TIMER_CLASS_LAST = SNDRV_TIMER_CLASS_PCM, 589}; 590 591/* slave timer classes */ 592enum sndrv_timer_slave_class { 593 SNDRV_TIMER_SCLASS_NONE = 0, 594 SNDRV_TIMER_SCLASS_APPLICATION, 595 SNDRV_TIMER_SCLASS_SEQUENCER, /* alias */ 596 SNDRV_TIMER_SCLASS_OSS_SEQUENCER, /* alias */ 597 SNDRV_TIMER_SCLASS_LAST = SNDRV_TIMER_SCLASS_OSS_SEQUENCER, 598}; 599 600/* global timers (device member) */ 601#define SNDRV_TIMER_GLOBAL_SYSTEM 0 602#define SNDRV_TIMER_GLOBAL_RTC 1 603#define SNDRV_TIMER_GLOBAL_HPET 2 604#define SNDRV_TIMER_GLOBAL_HRTIMER 3 605 606/* info flags */ 607#define SNDRV_TIMER_FLG_SLAVE (1<<0) /* cannot be controlled */ 608 609struct sndrv_timer_id { 610 int dev_class; 611 int dev_sclass; 612 int card; 613 int device; 614 int subdevice; 615}; 616 617struct sndrv_timer_ginfo { 618 struct sndrv_timer_id tid; /* requested timer ID */ 619 unsigned int flags; /* timer flags - SNDRV_TIMER_FLG_* */ 620 int card; /* card number */ 621 unsigned char id[64]; /* timer identification */ 622 unsigned char name[80]; /* timer name */ 623 unsigned long reserved0; /* reserved for future use */ 624 unsigned long resolution; /* average period resolution in ns */ 625 unsigned long resolution_min; /* minimal period resolution in ns */ 626 unsigned long resolution_max; /* maximal period resolution in ns */ 627 unsigned int clients; /* active timer clients */ 628 unsigned char reserved[32]; 629}; 630 631struct sndrv_timer_gparams { 632 struct sndrv_timer_id tid; /* requested timer ID */ 633 unsigned long period_num; /* requested precise period duration (in seconds) - numerator */ 634 unsigned long period_den; /* requested precise period duration (in seconds) - denominator */ 635 unsigned char reserved[32]; 636}; 637 638struct sndrv_timer_gstatus { 639 struct sndrv_timer_id tid; /* requested timer ID */ 640 unsigned long resolution; /* current period resolution in ns */ 641 unsigned long resolution_num; /* precise current period resolution (in seconds) - numerator */ 642 unsigned long resolution_den; /* precise current period resolution (in seconds) - denominator */ 643 unsigned char reserved[32]; 644}; 645 646struct sndrv_timer_select { 647 struct sndrv_timer_id id; /* bind to timer ID */ 648 unsigned char reserved[32]; /* reserved */ 649}; 650 651struct sndrv_timer_info { 652 unsigned int flags; /* timer flags - SNDRV_TIMER_FLG_* */ 653 int card; /* card number */ 654 unsigned char id[64]; /* timer identificator */ 655 unsigned char name[80]; /* timer name */ 656 unsigned long reserved0; /* reserved for future use */ 657 unsigned long resolution; /* average period resolution in ns */ 658 unsigned char reserved[64]; /* reserved */ 659}; 660 661#define SNDRV_TIMER_PSFLG_AUTO (1<<0) /* auto start, otherwise one-shot */ 662#define SNDRV_TIMER_PSFLG_EXCLUSIVE (1<<1) /* exclusive use, precise start/stop/pause/continue */ 663#define SNDRV_TIMER_PSFLG_EARLY_EVENT (1<<2) /* write early event to the poll queue */ 664 665struct sndrv_timer_params { 666 unsigned int flags; /* flags - SNDRV_MIXER_PSFLG_* */ 667 unsigned int ticks; /* requested resolution in ticks */ 668 unsigned int queue_size; /* total size of queue (32-1024) */ 669 unsigned int reserved0; /* reserved, was: failure locations */ 670 unsigned int filter; /* event filter (bitmask of SNDRV_TIMER_EVENT_*) */ 671 unsigned char reserved[60]; /* reserved */ 672}; 673 674struct sndrv_timer_status { 675 struct timespec tstamp; /* Timestamp - last update */ 676 unsigned int resolution; /* current period resolution in ns */ 677 unsigned int lost; /* counter of master tick lost */ 678 unsigned int overrun; /* count of read queue overruns */ 679 unsigned int queue; /* used queue size */ 680 unsigned char reserved[64]; /* reserved */ 681}; 682 683enum { 684 SNDRV_TIMER_IOCTL_PVERSION = _IOR('T', 0x00, int), 685 SNDRV_TIMER_IOCTL_NEXT_DEVICE = _IOWR('T', 0x01, struct sndrv_timer_id), 686 SNDRV_TIMER_IOCTL_TREAD = _IOW('T', 0x02, int), 687 SNDRV_TIMER_IOCTL_GINFO = _IOWR('T', 0x03, struct sndrv_timer_ginfo), 688 SNDRV_TIMER_IOCTL_GPARAMS = _IOW('T', 0x04, struct sndrv_timer_gparams), 689 SNDRV_TIMER_IOCTL_GSTATUS = _IOWR('T', 0x05, struct sndrv_timer_gstatus), 690 SNDRV_TIMER_IOCTL_SELECT = _IOW('T', 0x10, struct sndrv_timer_select), 691 SNDRV_TIMER_IOCTL_INFO = _IOR('T', 0x11, struct sndrv_timer_info), 692 SNDRV_TIMER_IOCTL_PARAMS = _IOW('T', 0x12, struct sndrv_timer_params), 693 SNDRV_TIMER_IOCTL_STATUS = _IOR('T', 0x14, struct sndrv_timer_status), 694 /* The following four ioctls are changed since 1.0.9 due to confliction */ 695 SNDRV_TIMER_IOCTL_START = _IO('T', 0xa0), 696 SNDRV_TIMER_IOCTL_STOP = _IO('T', 0xa1), 697 SNDRV_TIMER_IOCTL_CONTINUE = _IO('T', 0xa2), 698 SNDRV_TIMER_IOCTL_PAUSE = _IO('T', 0xa3), 699}; 700 701struct sndrv_timer_read { 702 unsigned int resolution; 703 unsigned int ticks; 704}; 705 706enum sndrv_timer_event { 707 SNDRV_TIMER_EVENT_RESOLUTION = 0, /* val = resolution in ns */ 708 SNDRV_TIMER_EVENT_TICK, /* val = ticks */ 709 SNDRV_TIMER_EVENT_START, /* val = resolution in ns */ 710 SNDRV_TIMER_EVENT_STOP, /* val = 0 */ 711 SNDRV_TIMER_EVENT_CONTINUE, /* val = resolution in ns */ 712 SNDRV_TIMER_EVENT_PAUSE, /* val = 0 */ 713 SNDRV_TIMER_EVENT_EARLY, /* val = 0, early event */ 714 SNDRV_TIMER_EVENT_SUSPEND, /* val = 0 */ 715 SNDRV_TIMER_EVENT_RESUME, /* val = resolution in ns */ 716 /* master timer events for slave timer instances */ 717 SNDRV_TIMER_EVENT_MSTART = SNDRV_TIMER_EVENT_START + 10, 718 SNDRV_TIMER_EVENT_MSTOP = SNDRV_TIMER_EVENT_STOP + 10, 719 SNDRV_TIMER_EVENT_MCONTINUE = SNDRV_TIMER_EVENT_CONTINUE + 10, 720 SNDRV_TIMER_EVENT_MPAUSE = SNDRV_TIMER_EVENT_PAUSE + 10, 721 SNDRV_TIMER_EVENT_MSUSPEND = SNDRV_TIMER_EVENT_SUSPEND + 10, 722 SNDRV_TIMER_EVENT_MRESUME = SNDRV_TIMER_EVENT_RESUME + 10, 723}; 724 725struct sndrv_timer_tread { 726 int event; 727 struct timespec tstamp; 728 unsigned int val; 729}; 730 731/**************************************************************************** 732 * * 733 * Section for driver control interface - /dev/snd/control? * 734 * * 735 ****************************************************************************/ 736 737#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 7) 738 739struct sndrv_ctl_card_info { 740 int card; /* card number */ 741 int pad; /* reserved for future (was type) */ 742 unsigned char id[16]; /* ID of card (user selectable) */ 743 unsigned char driver[16]; /* Driver name */ 744 unsigned char name[32]; /* Short name of soundcard */ 745 unsigned char longname[80]; /* name + info text about soundcard */ 746 unsigned char reserved_[16]; /* reserved for future (was ID of mixer) */ 747 unsigned char mixername[80]; /* visual mixer identification */ 748 unsigned char components[128]; /* card components / fine identification, delimited with one space (AC97 etc..) */ 749}; 750 751enum sndrv_ctl_elem_type { 752 SNDRV_CTL_ELEM_TYPE_NONE = 0, /* invalid */ 753 SNDRV_CTL_ELEM_TYPE_BOOLEAN, /* boolean type */ 754 SNDRV_CTL_ELEM_TYPE_INTEGER, /* integer type */ 755 SNDRV_CTL_ELEM_TYPE_ENUMERATED, /* enumerated type */ 756 SNDRV_CTL_ELEM_TYPE_BYTES, /* byte array */ 757 SNDRV_CTL_ELEM_TYPE_IEC958, /* IEC958 (S/PDIF) setup */ 758 SNDRV_CTL_ELEM_TYPE_INTEGER64, /* 64-bit integer type */ 759 SNDRV_CTL_ELEM_TYPE_LAST = SNDRV_CTL_ELEM_TYPE_INTEGER64, 760}; 761 762enum sndrv_ctl_elem_iface { 763 SNDRV_CTL_ELEM_IFACE_CARD = 0, /* global control */ 764 SNDRV_CTL_ELEM_IFACE_HWDEP, /* hardware dependent device */ 765 SNDRV_CTL_ELEM_IFACE_MIXER, /* virtual mixer device */ 766 SNDRV_CTL_ELEM_IFACE_PCM, /* PCM device */ 767 SNDRV_CTL_ELEM_IFACE_RAWMIDI, /* RawMidi device */ 768 SNDRV_CTL_ELEM_IFACE_TIMER, /* timer device */ 769 SNDRV_CTL_ELEM_IFACE_SEQUENCER, /* sequencer client */ 770 SNDRV_CTL_ELEM_IFACE_LAST = SNDRV_CTL_ELEM_IFACE_SEQUENCER, 771}; 772 773#define SNDRV_CTL_ELEM_ACCESS_READ (1<<0) 774#define SNDRV_CTL_ELEM_ACCESS_WRITE (1<<1) 775#define SNDRV_CTL_ELEM_ACCESS_READWRITE (SNDRV_CTL_ELEM_ACCESS_READ|SNDRV_CTL_ELEM_ACCESS_WRITE) 776#define SNDRV_CTL_ELEM_ACCESS_VOLATILE (1<<2) /* control value may be changed without a notification */ 777#define SNDRV_CTL_ELEM_ACCESS_TIMESTAMP (1<<3) /* when was control changed */ 778#define SNDRV_CTL_ELEM_ACCESS_TLV_READ (1<<4) /* TLV read is possible */ 779#define SNDRV_CTL_ELEM_ACCESS_TLV_WRITE (1<<5) /* TLV write is possible */ 780#define SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE (SNDRV_CTL_ELEM_ACCESS_TLV_READ|SNDRV_CTL_ELEM_ACCESS_TLV_WRITE) 781#define SNDRV_CTL_ELEM_ACCESS_TLV_COMMAND (1<<6) /* TLV command is possible */ 782#define SNDRV_CTL_ELEM_ACCESS_INACTIVE (1<<8) /* control does actually nothing, but may be updated */ 783#define SNDRV_CTL_ELEM_ACCESS_LOCK (1<<9) /* write lock */ 784#define SNDRV_CTL_ELEM_ACCESS_OWNER (1<<10) /* write lock owner */ 785#define SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK (1<<28) /* kernel use a TLV callback */ 786#define SNDRV_CTL_ELEM_ACCESS_USER (1<<29) /* user space element */ 787/* bits 30 and 31 are obsoleted (for indirect access) */ 788 789/* for further details see the ACPI and PCI power management specification */ 790#define SNDRV_CTL_POWER_D0 0x0000 /* full On */ 791#define SNDRV_CTL_POWER_D1 0x0100 /* partial On */ 792#define SNDRV_CTL_POWER_D2 0x0200 /* partial On */ 793#define SNDRV_CTL_POWER_D3 0x0300 /* Off */ 794#define SNDRV_CTL_POWER_D3hot (SNDRV_CTL_POWER_D3|0x0000) /* Off, with power */ 795#define SNDRV_CTL_POWER_D3cold (SNDRV_CTL_POWER_D3|0x0001) /* Off, without power */ 796 797struct sndrv_ctl_elem_id { 798 unsigned int numid; /* numeric identifier, zero = invalid */ 799 int iface; /* interface identifier */ 800 unsigned int device; /* device/client number */ 801 unsigned int subdevice; /* subdevice (substream) number */ 802 unsigned char name[44]; /* ASCII name of item */ 803 unsigned int index; /* index of item */ 804}; 805 806struct sndrv_ctl_elem_list { 807 unsigned int offset; /* W: first element ID to get */ 808 unsigned int space; /* W: count of element IDs to get */ 809 unsigned int used; /* R: count of element IDs set */ 810 unsigned int count; /* R: count of all elements */ 811 struct sndrv_ctl_elem_id *pids; /* R: IDs */ 812 unsigned char reserved[50]; 813}; 814 815struct sndrv_ctl_elem_info { 816 struct sndrv_ctl_elem_id id; /* W: element ID */ 817 int type; /* R: value type - SNDRV_CTL_ELEM_TYPE_* */ 818 unsigned int access; /* R: value access (bitmask) - SNDRV_CTL_ELEM_ACCESS_* */ 819 unsigned int count; /* count of values */ 820 pid_t owner; /* owner's PID of this control */ 821 union { 822 struct { 823 long min; /* R: minimum value */ 824 long max; /* R: maximum value */ 825 long step; /* R: step (0 variable) */ 826 } integer; 827 struct { 828 long long min; /* R: minimum value */ 829 long long max; /* R: maximum value */ 830 long long step; /* R: step (0 variable) */ 831 } integer64; 832 struct { 833 unsigned int items; /* R: number of items */ 834 unsigned int item; /* W: item number */ 835 char name[64]; /* R: value name */ 836 __u64 names_ptr; /* W: names list (ELEM_ADD only) */ 837 unsigned int names_length; 838 } enumerated; 839 unsigned char reserved[128]; 840 } value; 841 union { 842 unsigned short d[4]; /* dimensions */ 843 unsigned short *d_ptr; /* indirect - obsoleted */ 844 } dimen; 845 unsigned char reserved[64-4*sizeof(unsigned short)]; 846}; 847 848struct sndrv_ctl_elem_value { 849 struct sndrv_ctl_elem_id id; /* W: element ID */ 850 unsigned int indirect: 1; /* W: indirect access - obsoleted */ 851 union { 852 union { 853 long value[128]; 854 long *value_ptr; /* obsoleted */ 855 } integer; 856 union { 857 long long value[64]; 858 long long *value_ptr; /* obsoleted */ 859 } integer64; 860 union { 861 unsigned int item[128]; 862 unsigned int *item_ptr; /* obsoleted */ 863 } enumerated; 864 union { 865 unsigned char data[512]; 866 unsigned char *data_ptr; /* obsoleted */ 867 } bytes; 868 struct sndrv_aes_iec958 iec958; 869 } value; /* RO */ 870 struct timespec tstamp; 871 unsigned char reserved[128-sizeof(struct timespec)]; 872}; 873 874struct sndrv_ctl_tlv { 875 unsigned int numid; /* control element numeric identification */ 876 unsigned int length; /* in bytes aligned to 4 */ 877 unsigned int tlv[0]; /* first TLV */ 878}; 879 880enum { 881 SNDRV_CTL_IOCTL_PVERSION = _IOR('U', 0x00, int), 882 SNDRV_CTL_IOCTL_CARD_INFO = _IOR('U', 0x01, struct sndrv_ctl_card_info), 883 SNDRV_CTL_IOCTL_ELEM_LIST = _IOWR('U', 0x10, struct sndrv_ctl_elem_list), 884 SNDRV_CTL_IOCTL_ELEM_INFO = _IOWR('U', 0x11, struct sndrv_ctl_elem_info), 885 SNDRV_CTL_IOCTL_ELEM_READ = _IOWR('U', 0x12, struct sndrv_ctl_elem_value), 886 SNDRV_CTL_IOCTL_ELEM_WRITE = _IOWR('U', 0x13, struct sndrv_ctl_elem_value), 887 SNDRV_CTL_IOCTL_ELEM_LOCK = _IOW('U', 0x14, struct sndrv_ctl_elem_id), 888 SNDRV_CTL_IOCTL_ELEM_UNLOCK = _IOW('U', 0x15, struct sndrv_ctl_elem_id), 889 SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS = _IOWR('U', 0x16, int), 890 SNDRV_CTL_IOCTL_ELEM_ADD = _IOWR('U', 0x17, struct sndrv_ctl_elem_info), 891 SNDRV_CTL_IOCTL_ELEM_REPLACE = _IOWR('U', 0x18, struct sndrv_ctl_elem_info), 892 SNDRV_CTL_IOCTL_ELEM_REMOVE = _IOWR('U', 0x19, struct sndrv_ctl_elem_id), 893 SNDRV_CTL_IOCTL_TLV_READ = _IOWR('U', 0x1a, struct sndrv_ctl_tlv), 894 SNDRV_CTL_IOCTL_TLV_WRITE = _IOWR('U', 0x1b, struct sndrv_ctl_tlv), 895 SNDRV_CTL_IOCTL_TLV_COMMAND = _IOWR('U', 0x1c, struct sndrv_ctl_tlv), 896 SNDRV_CTL_IOCTL_HWDEP_NEXT_DEVICE = _IOWR('U', 0x20, int), 897 SNDRV_CTL_IOCTL_HWDEP_INFO = _IOR('U', 0x21, struct sndrv_hwdep_info), 898 SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE = _IOR('U', 0x30, int), 899 SNDRV_CTL_IOCTL_PCM_INFO = _IOWR('U', 0x31, struct sndrv_pcm_info), 900 SNDRV_CTL_IOCTL_PCM_PREFER_SUBDEVICE = _IOW('U', 0x32, int), 901 SNDRV_CTL_IOCTL_RAWMIDI_NEXT_DEVICE = _IOWR('U', 0x40, int), 902 SNDRV_CTL_IOCTL_RAWMIDI_INFO = _IOWR('U', 0x41, struct sndrv_rawmidi_info), 903 SNDRV_CTL_IOCTL_RAWMIDI_PREFER_SUBDEVICE = _IOW('U', 0x42, int), 904 SNDRV_CTL_IOCTL_POWER = _IOWR('U', 0xd0, int), 905 SNDRV_CTL_IOCTL_POWER_STATE = _IOR('U', 0xd1, int), 906}; 907 908/* 909 * Read interface. 910 */ 911 912enum sndrv_ctl_event_type { 913 SNDRV_CTL_EVENT_ELEM = 0, 914 SNDRV_CTL_EVENT_LAST = SNDRV_CTL_EVENT_ELEM, 915}; 916 917#define SNDRV_CTL_EVENT_MASK_VALUE (1<<0) /* element value was changed */ 918#define SNDRV_CTL_EVENT_MASK_INFO (1<<1) /* element info was changed */ 919#define SNDRV_CTL_EVENT_MASK_ADD (1<<2) /* element was added */ 920#define SNDRV_CTL_EVENT_MASK_TLV (1<<3) /* element TLV tree was changed */ 921#define SNDRV_CTL_EVENT_MASK_REMOVE (~0U) /* element was removed */ 922 923struct sndrv_ctl_event { 924 int type; /* event type - SNDRV_CTL_EVENT_* */ 925 union { 926 struct { 927 unsigned int mask; 928 struct sndrv_ctl_elem_id id; 929 } elem; 930 unsigned char data8[60]; 931 } data; 932}; 933 934/* 935 * Control names 936 */ 937 938#define SNDRV_CTL_NAME_NONE "" 939#define SNDRV_CTL_NAME_PLAYBACK "Playback " 940#define SNDRV_CTL_NAME_CAPTURE "Capture " 941 942#define SNDRV_CTL_NAME_IEC958_NONE "" 943#define SNDRV_CTL_NAME_IEC958_SWITCH "Switch" 944#define SNDRV_CTL_NAME_IEC958_VOLUME "Volume" 945#define SNDRV_CTL_NAME_IEC958_DEFAULT "Default" 946#define SNDRV_CTL_NAME_IEC958_MASK "Mask" 947#define SNDRV_CTL_NAME_IEC958_CON_MASK "Con Mask" 948#define SNDRV_CTL_NAME_IEC958_PRO_MASK "Pro Mask" 949#define SNDRV_CTL_NAME_IEC958_PCM_STREAM "PCM Stream" 950#define SNDRV_CTL_NAME_IEC958(expl,direction,what) "IEC958 " expl SNDRV_CTL_NAME_##direction SNDRV_CTL_NAME_IEC958_##what 951 952#endif /* __SOUND_ASOUND_H */ 953