asound.h 55 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272
  1. /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
  2. /*
  3. * Advanced Linux Sound Architecture - ALSA - Driver
  4. * Copyright (c) 1994-2003 by Jaroslav Kysela <perex@perex.cz>,
  5. * Abramo Bagnara <abramo@alsa-project.org>
  6. */
  7. #ifndef _UAPI__SOUND_ASOUND_H
  8. #define _UAPI__SOUND_ASOUND_H
  9. #if defined(__KERNEL__) || defined(__linux__)
  10. #include <linux/types.h>
  11. #include <asm/byteorder.h>
  12. #else
  13. #include <endian.h>
  14. #include <sys/ioctl.h>
  15. #endif
  16. #ifndef __KERNEL__
  17. #include <stdlib.h>
  18. #include <time.h>
  19. #endif
  20. /*
  21. * protocol version
  22. */
  23. #define SNDRV_PROTOCOL_VERSION(major, minor, subminor) (((major)<<16)|((minor)<<8)|(subminor))
  24. #define SNDRV_PROTOCOL_MAJOR(version) (((version)>>16)&0xffff)
  25. #define SNDRV_PROTOCOL_MINOR(version) (((version)>>8)&0xff)
  26. #define SNDRV_PROTOCOL_MICRO(version) ((version)&0xff)
  27. #define SNDRV_PROTOCOL_INCOMPATIBLE(kversion, uversion) \
  28. (SNDRV_PROTOCOL_MAJOR(kversion) != SNDRV_PROTOCOL_MAJOR(uversion) || \
  29. (SNDRV_PROTOCOL_MAJOR(kversion) == SNDRV_PROTOCOL_MAJOR(uversion) && \
  30. SNDRV_PROTOCOL_MINOR(kversion) != SNDRV_PROTOCOL_MINOR(uversion)))
  31. /****************************************************************************
  32. * *
  33. * Digital audio interface *
  34. * *
  35. ****************************************************************************/
  36. #define AES_IEC958_STATUS_SIZE 24
  37. struct snd_aes_iec958 {
  38. unsigned char status[AES_IEC958_STATUS_SIZE]; /* AES/IEC958 channel status bits */
  39. unsigned char subcode[147]; /* AES/IEC958 subcode bits */
  40. unsigned char pad; /* nothing */
  41. unsigned char dig_subframe[4]; /* AES/IEC958 subframe bits */
  42. };
  43. /****************************************************************************
  44. * *
  45. * CEA-861 Audio InfoFrame. Used in HDMI and DisplayPort *
  46. * *
  47. ****************************************************************************/
  48. struct snd_cea_861_aud_if {
  49. unsigned char db1_ct_cc; /* coding type and channel count */
  50. unsigned char db2_sf_ss; /* sample frequency and size */
  51. unsigned char db3; /* not used, all zeros */
  52. unsigned char db4_ca; /* channel allocation code */
  53. unsigned char db5_dminh_lsv; /* downmix inhibit & level-shift values */
  54. };
  55. /****************************************************************************
  56. * *
  57. * Section for driver hardware dependent interface - /dev/snd/hw? *
  58. * *
  59. ****************************************************************************/
  60. #define SNDRV_HWDEP_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 1)
  61. enum {
  62. SNDRV_HWDEP_IFACE_OPL2 = 0,
  63. SNDRV_HWDEP_IFACE_OPL3,
  64. SNDRV_HWDEP_IFACE_OPL4,
  65. SNDRV_HWDEP_IFACE_SB16CSP, /* Creative Signal Processor */
  66. SNDRV_HWDEP_IFACE_EMU10K1, /* FX8010 processor in EMU10K1 chip */
  67. SNDRV_HWDEP_IFACE_YSS225, /* Yamaha FX processor */
  68. SNDRV_HWDEP_IFACE_ICS2115, /* Wavetable synth */
  69. SNDRV_HWDEP_IFACE_SSCAPE, /* Ensoniq SoundScape ISA card (MC68EC000) */
  70. SNDRV_HWDEP_IFACE_VX, /* Digigram VX cards */
  71. SNDRV_HWDEP_IFACE_MIXART, /* Digigram miXart cards */
  72. SNDRV_HWDEP_IFACE_USX2Y, /* Tascam US122, US224 & US428 usb */
  73. SNDRV_HWDEP_IFACE_EMUX_WAVETABLE, /* EmuX wavetable */
  74. SNDRV_HWDEP_IFACE_BLUETOOTH, /* Bluetooth audio */
  75. SNDRV_HWDEP_IFACE_USX2Y_PCM, /* Tascam US122, US224 & US428 rawusb pcm */
  76. SNDRV_HWDEP_IFACE_PCXHR, /* Digigram PCXHR */
  77. SNDRV_HWDEP_IFACE_SB_RC, /* SB Extigy/Audigy2NX remote control */
  78. SNDRV_HWDEP_IFACE_HDA, /* HD-audio */
  79. SNDRV_HWDEP_IFACE_USB_STREAM, /* direct access to usb stream */
  80. SNDRV_HWDEP_IFACE_FW_DICE, /* TC DICE FireWire device */
  81. SNDRV_HWDEP_IFACE_FW_FIREWORKS, /* Echo Audio Fireworks based device */
  82. SNDRV_HWDEP_IFACE_FW_BEBOB, /* BridgeCo BeBoB based device */
  83. SNDRV_HWDEP_IFACE_FW_OXFW, /* Oxford OXFW970/971 based device */
  84. SNDRV_HWDEP_IFACE_FW_DIGI00X, /* Digidesign Digi 002/003 family */
  85. SNDRV_HWDEP_IFACE_FW_TASCAM, /* TASCAM FireWire series */
  86. SNDRV_HWDEP_IFACE_LINE6, /* Line6 USB processors */
  87. SNDRV_HWDEP_IFACE_FW_MOTU, /* MOTU FireWire series */
  88. SNDRV_HWDEP_IFACE_FW_FIREFACE, /* RME Fireface series */
  89. /* Don't forget to change the following: */
  90. SNDRV_HWDEP_IFACE_LAST = SNDRV_HWDEP_IFACE_FW_FIREFACE
  91. };
  92. struct snd_hwdep_info {
  93. unsigned int device; /* WR: device number */
  94. int card; /* R: card number */
  95. unsigned char id[64]; /* ID (user selectable) */
  96. unsigned char name[80]; /* hwdep name */
  97. int iface; /* hwdep interface */
  98. unsigned char reserved[64]; /* reserved for future */
  99. };
  100. /* generic DSP loader */
  101. struct snd_hwdep_dsp_status {
  102. unsigned int version; /* R: driver-specific version */
  103. unsigned char id[32]; /* R: driver-specific ID string */
  104. unsigned int num_dsps; /* R: number of DSP images to transfer */
  105. unsigned int dsp_loaded; /* R: bit flags indicating the loaded DSPs */
  106. unsigned int chip_ready; /* R: 1 = initialization finished */
  107. unsigned char reserved[16]; /* reserved for future use */
  108. };
  109. struct snd_hwdep_dsp_image {
  110. unsigned int index; /* W: DSP index */
  111. unsigned char name[64]; /* W: ID (e.g. file name) */
  112. unsigned char __user *image; /* W: binary image */
  113. size_t length; /* W: size of image in bytes */
  114. unsigned long driver_data; /* W: driver-specific data */
  115. };
  116. #define SNDRV_HWDEP_IOCTL_PVERSION _IOR ('H', 0x00, int)
  117. #define SNDRV_HWDEP_IOCTL_INFO _IOR ('H', 0x01, struct snd_hwdep_info)
  118. #define SNDRV_HWDEP_IOCTL_DSP_STATUS _IOR('H', 0x02, struct snd_hwdep_dsp_status)
  119. #define SNDRV_HWDEP_IOCTL_DSP_LOAD _IOW('H', 0x03, struct snd_hwdep_dsp_image)
  120. /*****************************************************************************
  121. * *
  122. * Digital Audio (PCM) interface - /dev/snd/pcm?? *
  123. * *
  124. *****************************************************************************/
  125. #define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 18)
  126. typedef unsigned long snd_pcm_uframes_t;
  127. typedef signed long snd_pcm_sframes_t;
  128. enum {
  129. SNDRV_PCM_CLASS_GENERIC = 0, /* standard mono or stereo device */
  130. SNDRV_PCM_CLASS_MULTI, /* multichannel device */
  131. SNDRV_PCM_CLASS_MODEM, /* software modem class */
  132. SNDRV_PCM_CLASS_DIGITIZER, /* digitizer class */
  133. /* Don't forget to change the following: */
  134. SNDRV_PCM_CLASS_LAST = SNDRV_PCM_CLASS_DIGITIZER,
  135. };
  136. enum {
  137. SNDRV_PCM_SUBCLASS_GENERIC_MIX = 0, /* mono or stereo subdevices are mixed together */
  138. SNDRV_PCM_SUBCLASS_MULTI_MIX, /* multichannel subdevices are mixed together */
  139. /* Don't forget to change the following: */
  140. SNDRV_PCM_SUBCLASS_LAST = SNDRV_PCM_SUBCLASS_MULTI_MIX,
  141. };
  142. enum {
  143. SNDRV_PCM_STREAM_PLAYBACK = 0,
  144. SNDRV_PCM_STREAM_CAPTURE,
  145. SNDRV_PCM_STREAM_LAST = SNDRV_PCM_STREAM_CAPTURE,
  146. };
  147. typedef int __bitwise snd_pcm_access_t;
  148. #define SNDRV_PCM_ACCESS_MMAP_INTERLEAVED ((__force snd_pcm_access_t) 0) /* interleaved mmap */
  149. #define SNDRV_PCM_ACCESS_MMAP_NONINTERLEAVED ((__force snd_pcm_access_t) 1) /* noninterleaved mmap */
  150. #define SNDRV_PCM_ACCESS_MMAP_COMPLEX ((__force snd_pcm_access_t) 2) /* complex mmap */
  151. #define SNDRV_PCM_ACCESS_RW_INTERLEAVED ((__force snd_pcm_access_t) 3) /* readi/writei */
  152. #define SNDRV_PCM_ACCESS_RW_NONINTERLEAVED ((__force snd_pcm_access_t) 4) /* readn/writen */
  153. #define SNDRV_PCM_ACCESS_LAST SNDRV_PCM_ACCESS_RW_NONINTERLEAVED
  154. typedef int __bitwise snd_pcm_format_t;
  155. #define SNDRV_PCM_FORMAT_S8 ((__force snd_pcm_format_t) 0)
  156. #define SNDRV_PCM_FORMAT_U8 ((__force snd_pcm_format_t) 1)
  157. #define SNDRV_PCM_FORMAT_S16_LE ((__force snd_pcm_format_t) 2)
  158. #define SNDRV_PCM_FORMAT_S16_BE ((__force snd_pcm_format_t) 3)
  159. #define SNDRV_PCM_FORMAT_U16_LE ((__force snd_pcm_format_t) 4)
  160. #define SNDRV_PCM_FORMAT_U16_BE ((__force snd_pcm_format_t) 5)
  161. #define SNDRV_PCM_FORMAT_S24_LE ((__force snd_pcm_format_t) 6) /* low three bytes */
  162. #define SNDRV_PCM_FORMAT_S24_BE ((__force snd_pcm_format_t) 7) /* low three bytes */
  163. #define SNDRV_PCM_FORMAT_U24_LE ((__force snd_pcm_format_t) 8) /* low three bytes */
  164. #define SNDRV_PCM_FORMAT_U24_BE ((__force snd_pcm_format_t) 9) /* low three bytes */
  165. /*
  166. * For S32/U32 formats, 'msbits' hardware parameter is often used to deliver information about the
  167. * available bit count in most significant bit. It's for the case of so-called 'left-justified' or
  168. * `right-padding` sample which has less width than 32 bit.
  169. */
  170. #define SNDRV_PCM_FORMAT_S32_LE ((__force snd_pcm_format_t) 10)
  171. #define SNDRV_PCM_FORMAT_S32_BE ((__force snd_pcm_format_t) 11)
  172. #define SNDRV_PCM_FORMAT_U32_LE ((__force snd_pcm_format_t) 12)
  173. #define SNDRV_PCM_FORMAT_U32_BE ((__force snd_pcm_format_t) 13)
  174. #define SNDRV_PCM_FORMAT_FLOAT_LE ((__force snd_pcm_format_t) 14) /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */
  175. #define SNDRV_PCM_FORMAT_FLOAT_BE ((__force snd_pcm_format_t) 15) /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */
  176. #define SNDRV_PCM_FORMAT_FLOAT64_LE ((__force snd_pcm_format_t) 16) /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */
  177. #define SNDRV_PCM_FORMAT_FLOAT64_BE ((__force snd_pcm_format_t) 17) /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */
  178. #define SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE ((__force snd_pcm_format_t) 18) /* IEC-958 subframe, Little Endian */
  179. #define SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE ((__force snd_pcm_format_t) 19) /* IEC-958 subframe, Big Endian */
  180. #define SNDRV_PCM_FORMAT_MU_LAW ((__force snd_pcm_format_t) 20)
  181. #define SNDRV_PCM_FORMAT_A_LAW ((__force snd_pcm_format_t) 21)
  182. #define SNDRV_PCM_FORMAT_IMA_ADPCM ((__force snd_pcm_format_t) 22)
  183. #define SNDRV_PCM_FORMAT_MPEG ((__force snd_pcm_format_t) 23)
  184. #define SNDRV_PCM_FORMAT_GSM ((__force snd_pcm_format_t) 24)
  185. #define SNDRV_PCM_FORMAT_S20_LE ((__force snd_pcm_format_t) 25) /* in four bytes, LSB justified */
  186. #define SNDRV_PCM_FORMAT_S20_BE ((__force snd_pcm_format_t) 26) /* in four bytes, LSB justified */
  187. #define SNDRV_PCM_FORMAT_U20_LE ((__force snd_pcm_format_t) 27) /* in four bytes, LSB justified */
  188. #define SNDRV_PCM_FORMAT_U20_BE ((__force snd_pcm_format_t) 28) /* in four bytes, LSB justified */
  189. /* gap in the numbering for a future standard linear format */
  190. #define SNDRV_PCM_FORMAT_SPECIAL ((__force snd_pcm_format_t) 31)
  191. #define SNDRV_PCM_FORMAT_S24_3LE ((__force snd_pcm_format_t) 32) /* in three bytes */
  192. #define SNDRV_PCM_FORMAT_S24_3BE ((__force snd_pcm_format_t) 33) /* in three bytes */
  193. #define SNDRV_PCM_FORMAT_U24_3LE ((__force snd_pcm_format_t) 34) /* in three bytes */
  194. #define SNDRV_PCM_FORMAT_U24_3BE ((__force snd_pcm_format_t) 35) /* in three bytes */
  195. #define SNDRV_PCM_FORMAT_S20_3LE ((__force snd_pcm_format_t) 36) /* in three bytes */
  196. #define SNDRV_PCM_FORMAT_S20_3BE ((__force snd_pcm_format_t) 37) /* in three bytes */
  197. #define SNDRV_PCM_FORMAT_U20_3LE ((__force snd_pcm_format_t) 38) /* in three bytes */
  198. #define SNDRV_PCM_FORMAT_U20_3BE ((__force snd_pcm_format_t) 39) /* in three bytes */
  199. #define SNDRV_PCM_FORMAT_S18_3LE ((__force snd_pcm_format_t) 40) /* in three bytes */
  200. #define SNDRV_PCM_FORMAT_S18_3BE ((__force snd_pcm_format_t) 41) /* in three bytes */
  201. #define SNDRV_PCM_FORMAT_U18_3LE ((__force snd_pcm_format_t) 42) /* in three bytes */
  202. #define SNDRV_PCM_FORMAT_U18_3BE ((__force snd_pcm_format_t) 43) /* in three bytes */
  203. #define SNDRV_PCM_FORMAT_G723_24 ((__force snd_pcm_format_t) 44) /* 8 samples in 3 bytes */
  204. #define SNDRV_PCM_FORMAT_G723_24_1B ((__force snd_pcm_format_t) 45) /* 1 sample in 1 byte */
  205. #define SNDRV_PCM_FORMAT_G723_40 ((__force snd_pcm_format_t) 46) /* 8 Samples in 5 bytes */
  206. #define SNDRV_PCM_FORMAT_G723_40_1B ((__force snd_pcm_format_t) 47) /* 1 sample in 1 byte */
  207. #define SNDRV_PCM_FORMAT_DSD_U8 ((__force snd_pcm_format_t) 48) /* DSD, 1-byte samples DSD (x8) */
  208. #define SNDRV_PCM_FORMAT_DSD_U16_LE ((__force snd_pcm_format_t) 49) /* DSD, 2-byte samples DSD (x16), little endian */
  209. #define SNDRV_PCM_FORMAT_DSD_U32_LE ((__force snd_pcm_format_t) 50) /* DSD, 4-byte samples DSD (x32), little endian */
  210. #define SNDRV_PCM_FORMAT_DSD_U16_BE ((__force snd_pcm_format_t) 51) /* DSD, 2-byte samples DSD (x16), big endian */
  211. #define SNDRV_PCM_FORMAT_DSD_U32_BE ((__force snd_pcm_format_t) 52) /* DSD, 4-byte samples DSD (x32), big endian */
  212. #define SNDRV_PCM_FORMAT_LAST SNDRV_PCM_FORMAT_DSD_U32_BE
  213. #define SNDRV_PCM_FORMAT_FIRST SNDRV_PCM_FORMAT_S8
  214. #ifdef SNDRV_LITTLE_ENDIAN
  215. #define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_LE
  216. #define SNDRV_PCM_FORMAT_U16 SNDRV_PCM_FORMAT_U16_LE
  217. #define SNDRV_PCM_FORMAT_S24 SNDRV_PCM_FORMAT_S24_LE
  218. #define SNDRV_PCM_FORMAT_U24 SNDRV_PCM_FORMAT_U24_LE
  219. #define SNDRV_PCM_FORMAT_S32 SNDRV_PCM_FORMAT_S32_LE
  220. #define SNDRV_PCM_FORMAT_U32 SNDRV_PCM_FORMAT_U32_LE
  221. #define SNDRV_PCM_FORMAT_FLOAT SNDRV_PCM_FORMAT_FLOAT_LE
  222. #define SNDRV_PCM_FORMAT_FLOAT64 SNDRV_PCM_FORMAT_FLOAT64_LE
  223. #define SNDRV_PCM_FORMAT_IEC958_SUBFRAME SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE
  224. #define SNDRV_PCM_FORMAT_S20 SNDRV_PCM_FORMAT_S20_LE
  225. #define SNDRV_PCM_FORMAT_U20 SNDRV_PCM_FORMAT_U20_LE
  226. #endif
  227. #ifdef SNDRV_BIG_ENDIAN
  228. #define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_BE
  229. #define SNDRV_PCM_FORMAT_U16 SNDRV_PCM_FORMAT_U16_BE
  230. #define SNDRV_PCM_FORMAT_S24 SNDRV_PCM_FORMAT_S24_BE
  231. #define SNDRV_PCM_FORMAT_U24 SNDRV_PCM_FORMAT_U24_BE
  232. #define SNDRV_PCM_FORMAT_S32 SNDRV_PCM_FORMAT_S32_BE
  233. #define SNDRV_PCM_FORMAT_U32 SNDRV_PCM_FORMAT_U32_BE
  234. #define SNDRV_PCM_FORMAT_FLOAT SNDRV_PCM_FORMAT_FLOAT_BE
  235. #define SNDRV_PCM_FORMAT_FLOAT64 SNDRV_PCM_FORMAT_FLOAT64_BE
  236. #define SNDRV_PCM_FORMAT_IEC958_SUBFRAME SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE
  237. #define SNDRV_PCM_FORMAT_S20 SNDRV_PCM_FORMAT_S20_BE
  238. #define SNDRV_PCM_FORMAT_U20 SNDRV_PCM_FORMAT_U20_BE
  239. #endif
  240. typedef int __bitwise snd_pcm_subformat_t;
  241. #define SNDRV_PCM_SUBFORMAT_STD ((__force snd_pcm_subformat_t) 0)
  242. #define SNDRV_PCM_SUBFORMAT_MSBITS_MAX ((__force snd_pcm_subformat_t) 1)
  243. #define SNDRV_PCM_SUBFORMAT_MSBITS_20 ((__force snd_pcm_subformat_t) 2)
  244. #define SNDRV_PCM_SUBFORMAT_MSBITS_24 ((__force snd_pcm_subformat_t) 3)
  245. #define SNDRV_PCM_SUBFORMAT_LAST SNDRV_PCM_SUBFORMAT_MSBITS_24
  246. #define SNDRV_PCM_INFO_MMAP 0x00000001 /* hardware supports mmap */
  247. #define SNDRV_PCM_INFO_MMAP_VALID 0x00000002 /* period data are valid during transfer */
  248. #define SNDRV_PCM_INFO_DOUBLE 0x00000004 /* Double buffering needed for PCM start/stop */
  249. #define SNDRV_PCM_INFO_BATCH 0x00000010 /* double buffering */
  250. #define SNDRV_PCM_INFO_SYNC_APPLPTR 0x00000020 /* need the explicit sync of appl_ptr update */
  251. #define SNDRV_PCM_INFO_PERFECT_DRAIN 0x00000040 /* silencing at the end of stream is not required */
  252. #define SNDRV_PCM_INFO_INTERLEAVED 0x00000100 /* channels are interleaved */
  253. #define SNDRV_PCM_INFO_NONINTERLEAVED 0x00000200 /* channels are not interleaved */
  254. #define SNDRV_PCM_INFO_COMPLEX 0x00000400 /* complex frame organization (mmap only) */
  255. #define SNDRV_PCM_INFO_BLOCK_TRANSFER 0x00010000 /* hardware transfer block of samples */
  256. #define SNDRV_PCM_INFO_OVERRANGE 0x00020000 /* hardware supports ADC (capture) overrange detection */
  257. #define SNDRV_PCM_INFO_RESUME 0x00040000 /* hardware supports stream resume after suspend */
  258. #define SNDRV_PCM_INFO_PAUSE 0x00080000 /* pause ioctl is supported */
  259. #define SNDRV_PCM_INFO_HALF_DUPLEX 0x00100000 /* only half duplex */
  260. #define SNDRV_PCM_INFO_JOINT_DUPLEX 0x00200000 /* playback and capture stream are somewhat correlated */
  261. #define SNDRV_PCM_INFO_SYNC_START 0x00400000 /* pcm support some kind of sync go */
  262. #define SNDRV_PCM_INFO_NO_PERIOD_WAKEUP 0x00800000 /* period wakeup can be disabled */
  263. #define SNDRV_PCM_INFO_HAS_WALL_CLOCK 0x01000000 /* (Deprecated)has audio wall clock for audio/system time sync */
  264. #define SNDRV_PCM_INFO_HAS_LINK_ATIME 0x01000000 /* report hardware link audio time, reset on startup */
  265. #define SNDRV_PCM_INFO_HAS_LINK_ABSOLUTE_ATIME 0x02000000 /* report absolute hardware link audio time, not reset on startup */
  266. #define SNDRV_PCM_INFO_HAS_LINK_ESTIMATED_ATIME 0x04000000 /* report estimated link audio time */
  267. #define SNDRV_PCM_INFO_HAS_LINK_SYNCHRONIZED_ATIME 0x08000000 /* report synchronized audio/system time */
  268. #define SNDRV_PCM_INFO_EXPLICIT_SYNC 0x10000000 /* needs explicit sync of pointers and data */
  269. #define SNDRV_PCM_INFO_NO_REWINDS 0x20000000 /* hardware can only support monotonic changes of appl_ptr */
  270. #define SNDRV_PCM_INFO_DRAIN_TRIGGER 0x40000000 /* internal kernel flag - trigger in drain */
  271. #define SNDRV_PCM_INFO_FIFO_IN_FRAMES 0x80000000 /* internal kernel flag - FIFO size is in frames */
  272. #if (__BITS_PER_LONG == 32 && defined(__USE_TIME_BITS64)) || defined __KERNEL__
  273. #define __SND_STRUCT_TIME64
  274. #endif
  275. typedef int __bitwise snd_pcm_state_t;
  276. #define SNDRV_PCM_STATE_OPEN ((__force snd_pcm_state_t) 0) /* stream is open */
  277. #define SNDRV_PCM_STATE_SETUP ((__force snd_pcm_state_t) 1) /* stream has a setup */
  278. #define SNDRV_PCM_STATE_PREPARED ((__force snd_pcm_state_t) 2) /* stream is ready to start */
  279. #define SNDRV_PCM_STATE_RUNNING ((__force snd_pcm_state_t) 3) /* stream is running */
  280. #define SNDRV_PCM_STATE_XRUN ((__force snd_pcm_state_t) 4) /* stream reached an xrun */
  281. #define SNDRV_PCM_STATE_DRAINING ((__force snd_pcm_state_t) 5) /* stream is draining */
  282. #define SNDRV_PCM_STATE_PAUSED ((__force snd_pcm_state_t) 6) /* stream is paused */
  283. #define SNDRV_PCM_STATE_SUSPENDED ((__force snd_pcm_state_t) 7) /* hardware is suspended */
  284. #define SNDRV_PCM_STATE_DISCONNECTED ((__force snd_pcm_state_t) 8) /* hardware is disconnected */
  285. #define SNDRV_PCM_STATE_LAST SNDRV_PCM_STATE_DISCONNECTED
  286. enum {
  287. SNDRV_PCM_MMAP_OFFSET_DATA = 0x00000000,
  288. SNDRV_PCM_MMAP_OFFSET_STATUS_OLD = 0x80000000,
  289. SNDRV_PCM_MMAP_OFFSET_CONTROL_OLD = 0x81000000,
  290. SNDRV_PCM_MMAP_OFFSET_STATUS_NEW = 0x82000000,
  291. SNDRV_PCM_MMAP_OFFSET_CONTROL_NEW = 0x83000000,
  292. #ifdef __SND_STRUCT_TIME64
  293. SNDRV_PCM_MMAP_OFFSET_STATUS = SNDRV_PCM_MMAP_OFFSET_STATUS_NEW,
  294. SNDRV_PCM_MMAP_OFFSET_CONTROL = SNDRV_PCM_MMAP_OFFSET_CONTROL_NEW,
  295. #else
  296. SNDRV_PCM_MMAP_OFFSET_STATUS = SNDRV_PCM_MMAP_OFFSET_STATUS_OLD,
  297. SNDRV_PCM_MMAP_OFFSET_CONTROL = SNDRV_PCM_MMAP_OFFSET_CONTROL_OLD,
  298. #endif
  299. };
  300. union snd_pcm_sync_id {
  301. unsigned char id[16];
  302. unsigned short id16[8];
  303. unsigned int id32[4];
  304. } __attribute__((deprecated));
  305. struct snd_pcm_info {
  306. unsigned int device; /* RO/WR (control): device number */
  307. unsigned int subdevice; /* RO/WR (control): subdevice number */
  308. int stream; /* RO/WR (control): stream direction */
  309. int card; /* R: card number */
  310. unsigned char id[64]; /* ID (user selectable) */
  311. unsigned char name[80]; /* name of this device */
  312. unsigned char subname[32]; /* subdevice name */
  313. int dev_class; /* SNDRV_PCM_CLASS_* */
  314. int dev_subclass; /* SNDRV_PCM_SUBCLASS_* */
  315. unsigned int subdevices_count;
  316. unsigned int subdevices_avail;
  317. unsigned char pad1[16]; /* was: hardware synchronization ID */
  318. unsigned char reserved[64]; /* reserved for future... */
  319. };
  320. typedef int snd_pcm_hw_param_t;
  321. #define SNDRV_PCM_HW_PARAM_ACCESS 0 /* Access type */
  322. #define SNDRV_PCM_HW_PARAM_FORMAT 1 /* Format */
  323. #define SNDRV_PCM_HW_PARAM_SUBFORMAT 2 /* Subformat */
  324. #define SNDRV_PCM_HW_PARAM_FIRST_MASK SNDRV_PCM_HW_PARAM_ACCESS
  325. #define SNDRV_PCM_HW_PARAM_LAST_MASK SNDRV_PCM_HW_PARAM_SUBFORMAT
  326. #define SNDRV_PCM_HW_PARAM_SAMPLE_BITS 8 /* Bits per sample */
  327. #define SNDRV_PCM_HW_PARAM_FRAME_BITS 9 /* Bits per frame */
  328. #define SNDRV_PCM_HW_PARAM_CHANNELS 10 /* Channels */
  329. #define SNDRV_PCM_HW_PARAM_RATE 11 /* Approx rate */
  330. #define SNDRV_PCM_HW_PARAM_PERIOD_TIME 12 /* Approx distance between
  331. * interrupts in us
  332. */
  333. #define SNDRV_PCM_HW_PARAM_PERIOD_SIZE 13 /* Approx frames between
  334. * interrupts
  335. */
  336. #define SNDRV_PCM_HW_PARAM_PERIOD_BYTES 14 /* Approx bytes between
  337. * interrupts
  338. */
  339. #define SNDRV_PCM_HW_PARAM_PERIODS 15 /* Approx interrupts per
  340. * buffer
  341. */
  342. #define SNDRV_PCM_HW_PARAM_BUFFER_TIME 16 /* Approx duration of buffer
  343. * in us
  344. */
  345. #define SNDRV_PCM_HW_PARAM_BUFFER_SIZE 17 /* Size of buffer in frames */
  346. #define SNDRV_PCM_HW_PARAM_BUFFER_BYTES 18 /* Size of buffer in bytes */
  347. #define SNDRV_PCM_HW_PARAM_TICK_TIME 19 /* Approx tick duration in us */
  348. #define SNDRV_PCM_HW_PARAM_FIRST_INTERVAL SNDRV_PCM_HW_PARAM_SAMPLE_BITS
  349. #define SNDRV_PCM_HW_PARAM_LAST_INTERVAL SNDRV_PCM_HW_PARAM_TICK_TIME
  350. #define SNDRV_PCM_HW_PARAMS_NORESAMPLE (1<<0) /* avoid rate resampling */
  351. #define SNDRV_PCM_HW_PARAMS_EXPORT_BUFFER (1<<1) /* export buffer */
  352. #define SNDRV_PCM_HW_PARAMS_NO_PERIOD_WAKEUP (1<<2) /* disable period wakeups */
  353. #define SNDRV_PCM_HW_PARAMS_NO_DRAIN_SILENCE (1<<3) /* suppress drain with the filling
  354. * of the silence samples
  355. */
  356. struct snd_interval {
  357. unsigned int min, max;
  358. unsigned int openmin:1,
  359. openmax:1,
  360. integer:1,
  361. empty:1;
  362. };
  363. #define SNDRV_MASK_MAX 256
  364. struct snd_mask {
  365. __u32 bits[(SNDRV_MASK_MAX+31)/32];
  366. };
  367. struct snd_pcm_hw_params {
  368. unsigned int flags;
  369. struct snd_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK -
  370. SNDRV_PCM_HW_PARAM_FIRST_MASK + 1];
  371. struct snd_mask mres[5]; /* reserved masks */
  372. struct snd_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL -
  373. SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1];
  374. struct snd_interval ires[9]; /* reserved intervals */
  375. unsigned int rmask; /* W: requested masks */
  376. unsigned int cmask; /* R: changed masks */
  377. unsigned int info; /* R: Info flags for returned setup */
  378. unsigned int msbits; /* R: used most significant bits (in sample bit-width) */
  379. unsigned int rate_num; /* R: rate numerator */
  380. unsigned int rate_den; /* R: rate denominator */
  381. snd_pcm_uframes_t fifo_size; /* R: chip FIFO size in frames */
  382. unsigned char sync[16]; /* R: synchronization ID (perfect sync - one clock source) */
  383. unsigned char reserved[48]; /* reserved for future */
  384. };
  385. enum {
  386. SNDRV_PCM_TSTAMP_NONE = 0,
  387. SNDRV_PCM_TSTAMP_ENABLE,
  388. SNDRV_PCM_TSTAMP_LAST = SNDRV_PCM_TSTAMP_ENABLE,
  389. };
  390. struct snd_pcm_sw_params {
  391. int tstamp_mode; /* timestamp mode */
  392. unsigned int period_step;
  393. unsigned int sleep_min; /* min ticks to sleep */
  394. snd_pcm_uframes_t avail_min; /* min avail frames for wakeup */
  395. snd_pcm_uframes_t xfer_align; /* obsolete: xfer size need to be a multiple */
  396. snd_pcm_uframes_t start_threshold; /* min hw_avail frames for automatic start */
  397. /*
  398. * The following two thresholds alleviate playback buffer underruns; when
  399. * hw_avail drops below the threshold, the respective action is triggered:
  400. */
  401. snd_pcm_uframes_t stop_threshold; /* - stop playback */
  402. snd_pcm_uframes_t silence_threshold; /* - pre-fill buffer with silence */
  403. snd_pcm_uframes_t silence_size; /* max size of silence pre-fill; when >= boundary,
  404. * fill played area with silence immediately */
  405. snd_pcm_uframes_t boundary; /* pointers wrap point */
  406. unsigned int proto; /* protocol version */
  407. unsigned int tstamp_type; /* timestamp type (req. proto >= 2.0.12) */
  408. unsigned char reserved[56]; /* reserved for future */
  409. };
  410. struct snd_pcm_channel_info {
  411. unsigned int channel;
  412. __kernel_off_t offset; /* mmap offset */
  413. unsigned int first; /* offset to first sample in bits */
  414. unsigned int step; /* samples distance in bits */
  415. };
  416. enum {
  417. /*
  418. * first definition for backwards compatibility only,
  419. * maps to wallclock/link time for HDAudio playback and DEFAULT/DMA time for everything else
  420. */
  421. SNDRV_PCM_AUDIO_TSTAMP_TYPE_COMPAT = 0,
  422. /* timestamp definitions */
  423. SNDRV_PCM_AUDIO_TSTAMP_TYPE_DEFAULT = 1, /* DMA time, reported as per hw_ptr */
  424. SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK = 2, /* link time reported by sample or wallclock counter, reset on startup */
  425. SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_ABSOLUTE = 3, /* link time reported by sample or wallclock counter, not reset on startup */
  426. SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_ESTIMATED = 4, /* link time estimated indirectly */
  427. SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_SYNCHRONIZED = 5, /* link time synchronized with system time */
  428. SNDRV_PCM_AUDIO_TSTAMP_TYPE_LAST = SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_SYNCHRONIZED
  429. };
  430. #ifndef __KERNEL__
  431. /* explicit padding avoids incompatibility between i386 and x86-64 */
  432. typedef struct { unsigned char pad[sizeof(time_t) - sizeof(int)]; } __time_pad;
  433. struct snd_pcm_status {
  434. snd_pcm_state_t state; /* stream state */
  435. __time_pad pad1; /* align to timespec */
  436. struct timespec trigger_tstamp; /* time when stream was started/stopped/paused */
  437. struct timespec tstamp; /* reference timestamp */
  438. snd_pcm_uframes_t appl_ptr; /* appl ptr */
  439. snd_pcm_uframes_t hw_ptr; /* hw ptr */
  440. snd_pcm_sframes_t delay; /* current delay in frames */
  441. snd_pcm_uframes_t avail; /* number of frames available */
  442. snd_pcm_uframes_t avail_max; /* max frames available on hw since last status */
  443. snd_pcm_uframes_t overrange; /* count of ADC (capture) overrange detections from last status */
  444. snd_pcm_state_t suspended_state; /* suspended stream state */
  445. __u32 audio_tstamp_data; /* needed for 64-bit alignment, used for configs/report to/from userspace */
  446. struct timespec audio_tstamp; /* sample counter, wall clock, PHC or on-demand sync'ed */
  447. struct timespec driver_tstamp; /* useful in case reference system tstamp is reported with delay */
  448. __u32 audio_tstamp_accuracy; /* in ns units, only valid if indicated in audio_tstamp_data */
  449. unsigned char reserved[52-2*sizeof(struct timespec)]; /* must be filled with zero */
  450. };
  451. #endif
  452. /*
  453. * For mmap operations, we need the 64-bit layout, both for compat mode,
  454. * and for y2038 compatibility. For 64-bit applications, the two definitions
  455. * are identical, so we keep the traditional version.
  456. */
  457. #ifdef __SND_STRUCT_TIME64
  458. #define __snd_pcm_mmap_status64 snd_pcm_mmap_status
  459. #define __snd_pcm_mmap_control64 snd_pcm_mmap_control
  460. #define __snd_pcm_sync_ptr64 snd_pcm_sync_ptr
  461. #ifdef __KERNEL__
  462. #define __snd_timespec64 __kernel_timespec
  463. #else
  464. #define __snd_timespec64 timespec
  465. #endif
  466. struct __snd_timespec {
  467. __s32 tv_sec;
  468. __s32 tv_nsec;
  469. };
  470. #else
  471. #define __snd_pcm_mmap_status snd_pcm_mmap_status
  472. #define __snd_pcm_mmap_control snd_pcm_mmap_control
  473. #define __snd_pcm_sync_ptr snd_pcm_sync_ptr
  474. #define __snd_timespec timespec
  475. struct __snd_timespec64 {
  476. __s64 tv_sec;
  477. __s64 tv_nsec;
  478. };
  479. #endif
  480. struct __snd_pcm_mmap_status {
  481. snd_pcm_state_t state; /* RO: state - SNDRV_PCM_STATE_XXXX */
  482. int pad1; /* Needed for 64 bit alignment */
  483. snd_pcm_uframes_t hw_ptr; /* RO: hw ptr (0...boundary-1) */
  484. struct __snd_timespec tstamp; /* Timestamp */
  485. snd_pcm_state_t suspended_state; /* RO: suspended stream state */
  486. struct __snd_timespec audio_tstamp; /* from sample counter or wall clock */
  487. };
  488. struct __snd_pcm_mmap_control {
  489. snd_pcm_uframes_t appl_ptr; /* RW: appl ptr (0...boundary-1) */
  490. snd_pcm_uframes_t avail_min; /* RW: min available frames for wakeup */
  491. };
  492. #define SNDRV_PCM_SYNC_PTR_HWSYNC (1<<0) /* execute hwsync */
  493. #define SNDRV_PCM_SYNC_PTR_APPL (1<<1) /* get appl_ptr from driver (r/w op) */
  494. #define SNDRV_PCM_SYNC_PTR_AVAIL_MIN (1<<2) /* get avail_min from driver */
  495. struct __snd_pcm_sync_ptr {
  496. unsigned int flags;
  497. union {
  498. struct __snd_pcm_mmap_status status;
  499. unsigned char reserved[64];
  500. } s;
  501. union {
  502. struct __snd_pcm_mmap_control control;
  503. unsigned char reserved[64];
  504. } c;
  505. };
  506. #if defined(__BYTE_ORDER) ? __BYTE_ORDER == __BIG_ENDIAN : defined(__BIG_ENDIAN)
  507. typedef char __pad_before_uframe[sizeof(__u64) - sizeof(snd_pcm_uframes_t)];
  508. typedef char __pad_after_uframe[0];
  509. #endif
  510. #if defined(__BYTE_ORDER) ? __BYTE_ORDER == __LITTLE_ENDIAN : defined(__LITTLE_ENDIAN)
  511. typedef char __pad_before_uframe[0];
  512. typedef char __pad_after_uframe[sizeof(__u64) - sizeof(snd_pcm_uframes_t)];
  513. #endif
  514. struct __snd_pcm_mmap_status64 {
  515. snd_pcm_state_t state; /* RO: state - SNDRV_PCM_STATE_XXXX */
  516. __u32 pad1; /* Needed for 64 bit alignment */
  517. __pad_before_uframe __pad1;
  518. snd_pcm_uframes_t hw_ptr; /* RO: hw ptr (0...boundary-1) */
  519. __pad_after_uframe __pad2;
  520. struct __snd_timespec64 tstamp; /* Timestamp */
  521. snd_pcm_state_t suspended_state;/* RO: suspended stream state */
  522. __u32 pad3; /* Needed for 64 bit alignment */
  523. struct __snd_timespec64 audio_tstamp; /* sample counter or wall clock */
  524. };
  525. struct __snd_pcm_mmap_control64 {
  526. __pad_before_uframe __pad1;
  527. snd_pcm_uframes_t appl_ptr; /* RW: appl ptr (0...boundary-1) */
  528. __pad_before_uframe __pad2; // This should be __pad_after_uframe, but binary
  529. // backwards compatibility constraints prevent a fix.
  530. __pad_before_uframe __pad3;
  531. snd_pcm_uframes_t avail_min; /* RW: min available frames for wakeup */
  532. __pad_after_uframe __pad4;
  533. };
  534. struct __snd_pcm_sync_ptr64 {
  535. __u32 flags;
  536. __u32 pad1;
  537. union {
  538. struct __snd_pcm_mmap_status64 status;
  539. unsigned char reserved[64];
  540. } s;
  541. union {
  542. struct __snd_pcm_mmap_control64 control;
  543. unsigned char reserved[64];
  544. } c;
  545. };
  546. struct snd_xferi {
  547. snd_pcm_sframes_t result;
  548. void __user *buf;
  549. snd_pcm_uframes_t frames;
  550. };
  551. struct snd_xfern {
  552. snd_pcm_sframes_t result;
  553. void __user * __user *bufs;
  554. snd_pcm_uframes_t frames;
  555. };
  556. enum {
  557. SNDRV_PCM_TSTAMP_TYPE_GETTIMEOFDAY = 0, /* gettimeofday equivalent */
  558. SNDRV_PCM_TSTAMP_TYPE_MONOTONIC, /* posix_clock_monotonic equivalent */
  559. SNDRV_PCM_TSTAMP_TYPE_MONOTONIC_RAW, /* monotonic_raw (no NTP) */
  560. SNDRV_PCM_TSTAMP_TYPE_LAST = SNDRV_PCM_TSTAMP_TYPE_MONOTONIC_RAW,
  561. };
  562. /* channel positions */
  563. enum {
  564. SNDRV_CHMAP_UNKNOWN = 0,
  565. SNDRV_CHMAP_NA, /* N/A, silent */
  566. SNDRV_CHMAP_MONO, /* mono stream */
  567. /* this follows the alsa-lib mixer channel value + 3 */
  568. SNDRV_CHMAP_FL, /* front left */
  569. SNDRV_CHMAP_FR, /* front right */
  570. SNDRV_CHMAP_RL, /* rear left */
  571. SNDRV_CHMAP_RR, /* rear right */
  572. SNDRV_CHMAP_FC, /* front center */
  573. SNDRV_CHMAP_LFE, /* LFE */
  574. SNDRV_CHMAP_SL, /* side left */
  575. SNDRV_CHMAP_SR, /* side right */
  576. SNDRV_CHMAP_RC, /* rear center */
  577. /* new definitions */
  578. SNDRV_CHMAP_FLC, /* front left center */
  579. SNDRV_CHMAP_FRC, /* front right center */
  580. SNDRV_CHMAP_RLC, /* rear left center */
  581. SNDRV_CHMAP_RRC, /* rear right center */
  582. SNDRV_CHMAP_FLW, /* front left wide */
  583. SNDRV_CHMAP_FRW, /* front right wide */
  584. SNDRV_CHMAP_FLH, /* front left high */
  585. SNDRV_CHMAP_FCH, /* front center high */
  586. SNDRV_CHMAP_FRH, /* front right high */
  587. SNDRV_CHMAP_TC, /* top center */
  588. SNDRV_CHMAP_TFL, /* top front left */
  589. SNDRV_CHMAP_TFR, /* top front right */
  590. SNDRV_CHMAP_TFC, /* top front center */
  591. SNDRV_CHMAP_TRL, /* top rear left */
  592. SNDRV_CHMAP_TRR, /* top rear right */
  593. SNDRV_CHMAP_TRC, /* top rear center */
  594. /* new definitions for UAC2 */
  595. SNDRV_CHMAP_TFLC, /* top front left center */
  596. SNDRV_CHMAP_TFRC, /* top front right center */
  597. SNDRV_CHMAP_TSL, /* top side left */
  598. SNDRV_CHMAP_TSR, /* top side right */
  599. SNDRV_CHMAP_LLFE, /* left LFE */
  600. SNDRV_CHMAP_RLFE, /* right LFE */
  601. SNDRV_CHMAP_BC, /* bottom center */
  602. SNDRV_CHMAP_BLC, /* bottom left center */
  603. SNDRV_CHMAP_BRC, /* bottom right center */
  604. SNDRV_CHMAP_LAST = SNDRV_CHMAP_BRC,
  605. };
  606. #define SNDRV_CHMAP_POSITION_MASK 0xffff
  607. #define SNDRV_CHMAP_PHASE_INVERSE (0x01 << 16)
  608. #define SNDRV_CHMAP_DRIVER_SPEC (0x02 << 16)
  609. #define SNDRV_PCM_IOCTL_PVERSION _IOR('A', 0x00, int)
  610. #define SNDRV_PCM_IOCTL_INFO _IOR('A', 0x01, struct snd_pcm_info)
  611. #define SNDRV_PCM_IOCTL_TSTAMP _IOW('A', 0x02, int)
  612. #define SNDRV_PCM_IOCTL_TTSTAMP _IOW('A', 0x03, int)
  613. #define SNDRV_PCM_IOCTL_USER_PVERSION _IOW('A', 0x04, int)
  614. #define SNDRV_PCM_IOCTL_HW_REFINE _IOWR('A', 0x10, struct snd_pcm_hw_params)
  615. #define SNDRV_PCM_IOCTL_HW_PARAMS _IOWR('A', 0x11, struct snd_pcm_hw_params)
  616. #define SNDRV_PCM_IOCTL_HW_FREE _IO('A', 0x12)
  617. #define SNDRV_PCM_IOCTL_SW_PARAMS _IOWR('A', 0x13, struct snd_pcm_sw_params)
  618. #define SNDRV_PCM_IOCTL_STATUS _IOR('A', 0x20, struct snd_pcm_status)
  619. #define SNDRV_PCM_IOCTL_DELAY _IOR('A', 0x21, snd_pcm_sframes_t)
  620. #define SNDRV_PCM_IOCTL_HWSYNC _IO('A', 0x22)
  621. #define __SNDRV_PCM_IOCTL_SYNC_PTR _IOWR('A', 0x23, struct __snd_pcm_sync_ptr)
  622. #define __SNDRV_PCM_IOCTL_SYNC_PTR64 _IOWR('A', 0x23, struct __snd_pcm_sync_ptr64)
  623. #define SNDRV_PCM_IOCTL_SYNC_PTR _IOWR('A', 0x23, struct snd_pcm_sync_ptr)
  624. #define SNDRV_PCM_IOCTL_STATUS_EXT _IOWR('A', 0x24, struct snd_pcm_status)
  625. #define SNDRV_PCM_IOCTL_CHANNEL_INFO _IOR('A', 0x32, struct snd_pcm_channel_info)
  626. #define SNDRV_PCM_IOCTL_PREPARE _IO('A', 0x40)
  627. #define SNDRV_PCM_IOCTL_RESET _IO('A', 0x41)
  628. #define SNDRV_PCM_IOCTL_START _IO('A', 0x42)
  629. #define SNDRV_PCM_IOCTL_DROP _IO('A', 0x43)
  630. #define SNDRV_PCM_IOCTL_DRAIN _IO('A', 0x44)
  631. #define SNDRV_PCM_IOCTL_PAUSE _IOW('A', 0x45, int)
  632. #define SNDRV_PCM_IOCTL_REWIND _IOW('A', 0x46, snd_pcm_uframes_t)
  633. #define SNDRV_PCM_IOCTL_RESUME _IO('A', 0x47)
  634. #define SNDRV_PCM_IOCTL_XRUN _IO('A', 0x48)
  635. #define SNDRV_PCM_IOCTL_FORWARD _IOW('A', 0x49, snd_pcm_uframes_t)
  636. #define SNDRV_PCM_IOCTL_WRITEI_FRAMES _IOW('A', 0x50, struct snd_xferi)
  637. #define SNDRV_PCM_IOCTL_READI_FRAMES _IOR('A', 0x51, struct snd_xferi)
  638. #define SNDRV_PCM_IOCTL_WRITEN_FRAMES _IOW('A', 0x52, struct snd_xfern)
  639. #define SNDRV_PCM_IOCTL_READN_FRAMES _IOR('A', 0x53, struct snd_xfern)
  640. #define SNDRV_PCM_IOCTL_LINK _IOW('A', 0x60, int)
  641. #define SNDRV_PCM_IOCTL_UNLINK _IO('A', 0x61)
  642. /*****************************************************************************
  643. * *
  644. * MIDI v1.0 interface *
  645. * *
  646. *****************************************************************************/
  647. /*
  648. * Raw MIDI section - /dev/snd/midi??
  649. */
  650. #define SNDRV_RAWMIDI_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 5)
  651. enum {
  652. SNDRV_RAWMIDI_STREAM_OUTPUT = 0,
  653. SNDRV_RAWMIDI_STREAM_INPUT,
  654. SNDRV_RAWMIDI_STREAM_LAST = SNDRV_RAWMIDI_STREAM_INPUT,
  655. };
  656. #define SNDRV_RAWMIDI_INFO_OUTPUT 0x00000001
  657. #define SNDRV_RAWMIDI_INFO_INPUT 0x00000002
  658. #define SNDRV_RAWMIDI_INFO_DUPLEX 0x00000004
  659. #define SNDRV_RAWMIDI_INFO_UMP 0x00000008
  660. #define SNDRV_RAWMIDI_INFO_STREAM_INACTIVE 0x00000010
  661. #define SNDRV_RAWMIDI_DEVICE_UNKNOWN 0
  662. struct snd_rawmidi_info {
  663. unsigned int device; /* RO/WR (control): device number */
  664. unsigned int subdevice; /* RO/WR (control): subdevice number */
  665. int stream; /* WR: stream */
  666. int card; /* R: card number */
  667. unsigned int flags; /* SNDRV_RAWMIDI_INFO_XXXX */
  668. unsigned char id[64]; /* ID (user selectable) */
  669. unsigned char name[80]; /* name of device */
  670. unsigned char subname[32]; /* name of active or selected subdevice */
  671. unsigned int subdevices_count;
  672. unsigned int subdevices_avail;
  673. int tied_device; /* R: tied rawmidi device (UMP/legacy) */
  674. unsigned char reserved[60]; /* reserved for future use */
  675. };
  676. #define SNDRV_RAWMIDI_MODE_FRAMING_MASK (7<<0)
  677. #define SNDRV_RAWMIDI_MODE_FRAMING_SHIFT 0
  678. #define SNDRV_RAWMIDI_MODE_FRAMING_NONE (0<<0)
  679. #define SNDRV_RAWMIDI_MODE_FRAMING_TSTAMP (1<<0)
  680. #define SNDRV_RAWMIDI_MODE_CLOCK_MASK (7<<3)
  681. #define SNDRV_RAWMIDI_MODE_CLOCK_SHIFT 3
  682. #define SNDRV_RAWMIDI_MODE_CLOCK_NONE (0<<3)
  683. #define SNDRV_RAWMIDI_MODE_CLOCK_REALTIME (1<<3)
  684. #define SNDRV_RAWMIDI_MODE_CLOCK_MONOTONIC (2<<3)
  685. #define SNDRV_RAWMIDI_MODE_CLOCK_MONOTONIC_RAW (3<<3)
  686. #define SNDRV_RAWMIDI_FRAMING_DATA_LENGTH 16
  687. struct snd_rawmidi_framing_tstamp {
  688. /* For now, frame_type is always 0. Midi 2.0 is expected to add new
  689. * types here. Applications are expected to skip unknown frame types.
  690. */
  691. __u8 frame_type;
  692. __u8 length; /* number of valid bytes in data field */
  693. __u8 reserved[2];
  694. __u32 tv_nsec; /* nanoseconds */
  695. __u64 tv_sec; /* seconds */
  696. __u8 data[SNDRV_RAWMIDI_FRAMING_DATA_LENGTH];
  697. } __packed;
  698. struct snd_rawmidi_params {
  699. int stream;
  700. size_t buffer_size; /* queue size in bytes */
  701. size_t avail_min; /* minimum avail bytes for wakeup */
  702. unsigned int no_active_sensing: 1; /* do not send active sensing byte in close() */
  703. unsigned int mode; /* For input data only, frame incoming data */
  704. unsigned char reserved[12]; /* reserved for future use */
  705. };
  706. #ifndef __KERNEL__
  707. struct snd_rawmidi_status {
  708. int stream;
  709. __time_pad pad1;
  710. struct timespec tstamp; /* Timestamp */
  711. size_t avail; /* available bytes */
  712. size_t xruns; /* count of overruns since last status (in bytes) */
  713. unsigned char reserved[16]; /* reserved for future use */
  714. };
  715. #endif
  716. /* UMP EP info flags */
  717. #define SNDRV_UMP_EP_INFO_STATIC_BLOCKS 0x01
  718. /* UMP EP Protocol / JRTS capability bits */
  719. #define SNDRV_UMP_EP_INFO_PROTO_MIDI_MASK 0x0300
  720. #define SNDRV_UMP_EP_INFO_PROTO_MIDI1 0x0100 /* MIDI 1.0 */
  721. #define SNDRV_UMP_EP_INFO_PROTO_MIDI2 0x0200 /* MIDI 2.0 */
  722. #define SNDRV_UMP_EP_INFO_PROTO_JRTS_MASK 0x0003
  723. #define SNDRV_UMP_EP_INFO_PROTO_JRTS_TX 0x0001 /* JRTS Transmit */
  724. #define SNDRV_UMP_EP_INFO_PROTO_JRTS_RX 0x0002 /* JRTS Receive */
  725. /* UMP Endpoint information */
  726. struct snd_ump_endpoint_info {
  727. int card; /* card number */
  728. int device; /* device number */
  729. unsigned int flags; /* additional info */
  730. unsigned int protocol_caps; /* protocol capabilities */
  731. unsigned int protocol; /* current protocol */
  732. unsigned int num_blocks; /* # of function blocks */
  733. unsigned short version; /* UMP major/minor version */
  734. unsigned short family_id; /* MIDI device family ID */
  735. unsigned short model_id; /* MIDI family model ID */
  736. unsigned int manufacturer_id; /* MIDI manufacturer ID */
  737. unsigned char sw_revision[4]; /* software revision */
  738. unsigned short padding;
  739. unsigned char name[128]; /* endpoint name string */
  740. unsigned char product_id[128]; /* unique product id string */
  741. unsigned char reserved[32];
  742. } __packed;
  743. /* UMP direction */
  744. #define SNDRV_UMP_DIR_INPUT 0x01
  745. #define SNDRV_UMP_DIR_OUTPUT 0x02
  746. #define SNDRV_UMP_DIR_BIDIRECTION 0x03
  747. /* UMP block info flags */
  748. #define SNDRV_UMP_BLOCK_IS_MIDI1 (1U << 0) /* MIDI 1.0 port w/o restrict */
  749. #define SNDRV_UMP_BLOCK_IS_LOWSPEED (1U << 1) /* 31.25Kbps B/W MIDI1 port */
  750. /* UMP block user-interface hint */
  751. #define SNDRV_UMP_BLOCK_UI_HINT_UNKNOWN 0x00
  752. #define SNDRV_UMP_BLOCK_UI_HINT_RECEIVER 0x01
  753. #define SNDRV_UMP_BLOCK_UI_HINT_SENDER 0x02
  754. #define SNDRV_UMP_BLOCK_UI_HINT_BOTH 0x03
  755. /* UMP groups and blocks */
  756. #define SNDRV_UMP_MAX_GROUPS 16
  757. #define SNDRV_UMP_MAX_BLOCKS 32
  758. /* UMP Block information */
  759. struct snd_ump_block_info {
  760. int card; /* card number */
  761. int device; /* device number */
  762. unsigned char block_id; /* block ID (R/W) */
  763. unsigned char direction; /* UMP direction */
  764. unsigned char active; /* Activeness */
  765. unsigned char first_group; /* first group ID */
  766. unsigned char num_groups; /* number of groups */
  767. unsigned char midi_ci_version; /* MIDI-CI support version */
  768. unsigned char sysex8_streams; /* max number of sysex8 streams */
  769. unsigned char ui_hint; /* user interface hint */
  770. unsigned int flags; /* various info flags */
  771. unsigned char name[128]; /* block name string */
  772. unsigned char reserved[32];
  773. } __packed;
  774. #define SNDRV_RAWMIDI_IOCTL_PVERSION _IOR('W', 0x00, int)
  775. #define SNDRV_RAWMIDI_IOCTL_INFO _IOR('W', 0x01, struct snd_rawmidi_info)
  776. #define SNDRV_RAWMIDI_IOCTL_USER_PVERSION _IOW('W', 0x02, int)
  777. #define SNDRV_RAWMIDI_IOCTL_PARAMS _IOWR('W', 0x10, struct snd_rawmidi_params)
  778. #define SNDRV_RAWMIDI_IOCTL_STATUS _IOWR('W', 0x20, struct snd_rawmidi_status)
  779. #define SNDRV_RAWMIDI_IOCTL_DROP _IOW('W', 0x30, int)
  780. #define SNDRV_RAWMIDI_IOCTL_DRAIN _IOW('W', 0x31, int)
  781. /* Additional ioctls for UMP rawmidi devices */
  782. #define SNDRV_UMP_IOCTL_ENDPOINT_INFO _IOR('W', 0x40, struct snd_ump_endpoint_info)
  783. #define SNDRV_UMP_IOCTL_BLOCK_INFO _IOR('W', 0x41, struct snd_ump_block_info)
  784. /*
  785. * Timer section - /dev/snd/timer
  786. */
  787. #define SNDRV_TIMER_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 8)
  788. enum {
  789. SNDRV_TIMER_CLASS_NONE = -1,
  790. SNDRV_TIMER_CLASS_SLAVE = 0,
  791. SNDRV_TIMER_CLASS_GLOBAL,
  792. SNDRV_TIMER_CLASS_CARD,
  793. SNDRV_TIMER_CLASS_PCM,
  794. SNDRV_TIMER_CLASS_LAST = SNDRV_TIMER_CLASS_PCM,
  795. };
  796. /* slave timer classes */
  797. enum {
  798. SNDRV_TIMER_SCLASS_NONE = 0,
  799. SNDRV_TIMER_SCLASS_APPLICATION,
  800. SNDRV_TIMER_SCLASS_SEQUENCER, /* alias */
  801. SNDRV_TIMER_SCLASS_OSS_SEQUENCER, /* alias */
  802. SNDRV_TIMER_SCLASS_LAST = SNDRV_TIMER_SCLASS_OSS_SEQUENCER,
  803. };
  804. /* global timers (device member) */
  805. #define SNDRV_TIMER_GLOBAL_SYSTEM 0
  806. #define SNDRV_TIMER_GLOBAL_RTC 1 /* unused */
  807. #define SNDRV_TIMER_GLOBAL_HPET 2
  808. #define SNDRV_TIMER_GLOBAL_HRTIMER 3
  809. #define SNDRV_TIMER_GLOBAL_UDRIVEN 4
  810. /* info flags */
  811. #define SNDRV_TIMER_FLG_SLAVE (1<<0) /* cannot be controlled */
  812. struct snd_timer_id {
  813. int dev_class;
  814. int dev_sclass;
  815. int card;
  816. int device;
  817. int subdevice;
  818. };
  819. struct snd_timer_ginfo {
  820. struct snd_timer_id tid; /* requested timer ID */
  821. unsigned int flags; /* timer flags - SNDRV_TIMER_FLG_* */
  822. int card; /* card number */
  823. unsigned char id[64]; /* timer identification */
  824. unsigned char name[80]; /* timer name */
  825. unsigned long reserved0; /* reserved for future use */
  826. unsigned long resolution; /* average period resolution in ns */
  827. unsigned long resolution_min; /* minimal period resolution in ns */
  828. unsigned long resolution_max; /* maximal period resolution in ns */
  829. unsigned int clients; /* active timer clients */
  830. unsigned char reserved[32];
  831. };
  832. struct snd_timer_gparams {
  833. struct snd_timer_id tid; /* requested timer ID */
  834. unsigned long period_num; /* requested precise period duration (in seconds) - numerator */
  835. unsigned long period_den; /* requested precise period duration (in seconds) - denominator */
  836. unsigned char reserved[32];
  837. };
  838. struct snd_timer_gstatus {
  839. struct snd_timer_id tid; /* requested timer ID */
  840. unsigned long resolution; /* current period resolution in ns */
  841. unsigned long resolution_num; /* precise current period resolution (in seconds) - numerator */
  842. unsigned long resolution_den; /* precise current period resolution (in seconds) - denominator */
  843. unsigned char reserved[32];
  844. };
  845. struct snd_timer_select {
  846. struct snd_timer_id id; /* bind to timer ID */
  847. unsigned char reserved[32]; /* reserved */
  848. };
  849. struct snd_timer_info {
  850. unsigned int flags; /* timer flags - SNDRV_TIMER_FLG_* */
  851. int card; /* card number */
  852. unsigned char id[64]; /* timer identificator */
  853. unsigned char name[80]; /* timer name */
  854. unsigned long reserved0; /* reserved for future use */
  855. unsigned long resolution; /* average period resolution in ns */
  856. unsigned char reserved[64]; /* reserved */
  857. };
  858. #define SNDRV_TIMER_PSFLG_AUTO (1<<0) /* auto start, otherwise one-shot */
  859. #define SNDRV_TIMER_PSFLG_EXCLUSIVE (1<<1) /* exclusive use, precise start/stop/pause/continue */
  860. #define SNDRV_TIMER_PSFLG_EARLY_EVENT (1<<2) /* write early event to the poll queue */
  861. struct snd_timer_params {
  862. unsigned int flags; /* flags - SNDRV_TIMER_PSFLG_* */
  863. unsigned int ticks; /* requested resolution in ticks */
  864. unsigned int queue_size; /* total size of queue (32-1024) */
  865. unsigned int reserved0; /* reserved, was: failure locations */
  866. unsigned int filter; /* event filter (bitmask of SNDRV_TIMER_EVENT_*) */
  867. unsigned char reserved[60]; /* reserved */
  868. };
  869. #ifndef __KERNEL__
  870. struct snd_timer_status {
  871. struct timespec tstamp; /* Timestamp - last update */
  872. unsigned int resolution; /* current period resolution in ns */
  873. unsigned int lost; /* counter of master tick lost */
  874. unsigned int overrun; /* count of read queue overruns */
  875. unsigned int queue; /* used queue size */
  876. unsigned char reserved[64]; /* reserved */
  877. };
  878. #endif
  879. /*
  880. * This structure describes the userspace-driven timer. Such timers are purely virtual,
  881. * and can only be triggered from software (for instance, by userspace application).
  882. */
  883. struct snd_timer_uinfo {
  884. /* To pretend being a normal timer, we need to know the resolution in ns. */
  885. __u64 resolution;
  886. int fd;
  887. unsigned int id;
  888. unsigned char reserved[16];
  889. };
  890. #define SNDRV_TIMER_IOCTL_PVERSION _IOR('T', 0x00, int)
  891. #define SNDRV_TIMER_IOCTL_NEXT_DEVICE _IOWR('T', 0x01, struct snd_timer_id)
  892. #define SNDRV_TIMER_IOCTL_TREAD_OLD _IOW('T', 0x02, int)
  893. #define SNDRV_TIMER_IOCTL_GINFO _IOWR('T', 0x03, struct snd_timer_ginfo)
  894. #define SNDRV_TIMER_IOCTL_GPARAMS _IOW('T', 0x04, struct snd_timer_gparams)
  895. #define SNDRV_TIMER_IOCTL_GSTATUS _IOWR('T', 0x05, struct snd_timer_gstatus)
  896. #define SNDRV_TIMER_IOCTL_SELECT _IOW('T', 0x10, struct snd_timer_select)
  897. #define SNDRV_TIMER_IOCTL_INFO _IOR('T', 0x11, struct snd_timer_info)
  898. #define SNDRV_TIMER_IOCTL_PARAMS _IOW('T', 0x12, struct snd_timer_params)
  899. #define SNDRV_TIMER_IOCTL_STATUS _IOR('T', 0x14, struct snd_timer_status)
  900. /* The following four ioctls are changed since 1.0.9 due to confliction */
  901. #define SNDRV_TIMER_IOCTL_START _IO('T', 0xa0)
  902. #define SNDRV_TIMER_IOCTL_STOP _IO('T', 0xa1)
  903. #define SNDRV_TIMER_IOCTL_CONTINUE _IO('T', 0xa2)
  904. #define SNDRV_TIMER_IOCTL_PAUSE _IO('T', 0xa3)
  905. #define SNDRV_TIMER_IOCTL_TREAD64 _IOW('T', 0xa4, int)
  906. #define SNDRV_TIMER_IOCTL_CREATE _IOWR('T', 0xa5, struct snd_timer_uinfo)
  907. #define SNDRV_TIMER_IOCTL_TRIGGER _IO('T', 0xa6)
  908. #if __BITS_PER_LONG == 64
  909. #define SNDRV_TIMER_IOCTL_TREAD SNDRV_TIMER_IOCTL_TREAD_OLD
  910. #else
  911. #define SNDRV_TIMER_IOCTL_TREAD ((sizeof(__kernel_long_t) >= sizeof(time_t)) ? \
  912. SNDRV_TIMER_IOCTL_TREAD_OLD : \
  913. SNDRV_TIMER_IOCTL_TREAD64)
  914. #endif
  915. struct snd_timer_read {
  916. unsigned int resolution;
  917. unsigned int ticks;
  918. };
  919. enum {
  920. SNDRV_TIMER_EVENT_RESOLUTION = 0, /* val = resolution in ns */
  921. SNDRV_TIMER_EVENT_TICK, /* val = ticks */
  922. SNDRV_TIMER_EVENT_START, /* val = resolution in ns */
  923. SNDRV_TIMER_EVENT_STOP, /* val = 0 */
  924. SNDRV_TIMER_EVENT_CONTINUE, /* val = resolution in ns */
  925. SNDRV_TIMER_EVENT_PAUSE, /* val = 0 */
  926. SNDRV_TIMER_EVENT_EARLY, /* val = 0, early event */
  927. SNDRV_TIMER_EVENT_SUSPEND, /* val = 0 */
  928. SNDRV_TIMER_EVENT_RESUME, /* val = resolution in ns */
  929. /* master timer events for slave timer instances */
  930. SNDRV_TIMER_EVENT_MSTART = SNDRV_TIMER_EVENT_START + 10,
  931. SNDRV_TIMER_EVENT_MSTOP = SNDRV_TIMER_EVENT_STOP + 10,
  932. SNDRV_TIMER_EVENT_MCONTINUE = SNDRV_TIMER_EVENT_CONTINUE + 10,
  933. SNDRV_TIMER_EVENT_MPAUSE = SNDRV_TIMER_EVENT_PAUSE + 10,
  934. SNDRV_TIMER_EVENT_MSUSPEND = SNDRV_TIMER_EVENT_SUSPEND + 10,
  935. SNDRV_TIMER_EVENT_MRESUME = SNDRV_TIMER_EVENT_RESUME + 10,
  936. };
  937. #ifndef __KERNEL__
  938. struct snd_timer_tread {
  939. int event;
  940. __time_pad pad1;
  941. struct timespec tstamp;
  942. unsigned int val;
  943. __time_pad pad2;
  944. };
  945. #endif
  946. /****************************************************************************
  947. * *
  948. * Section for driver control interface - /dev/snd/control? *
  949. * *
  950. ****************************************************************************/
  951. #define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 9)
  952. struct snd_ctl_card_info {
  953. int card; /* card number */
  954. int pad; /* reserved for future (was type) */
  955. unsigned char id[16]; /* ID of card (user selectable) */
  956. unsigned char driver[16]; /* Driver name */
  957. unsigned char name[32]; /* Short name of soundcard */
  958. unsigned char longname[80]; /* name + info text about soundcard */
  959. unsigned char reserved_[16]; /* reserved for future (was ID of mixer) */
  960. unsigned char mixername[80]; /* visual mixer identification */
  961. unsigned char components[128]; /* card components / fine identification, delimited with one space (AC97 etc..) */
  962. };
  963. typedef int __bitwise snd_ctl_elem_type_t;
  964. #define SNDRV_CTL_ELEM_TYPE_NONE ((__force snd_ctl_elem_type_t) 0) /* invalid */
  965. #define SNDRV_CTL_ELEM_TYPE_BOOLEAN ((__force snd_ctl_elem_type_t) 1) /* boolean type */
  966. #define SNDRV_CTL_ELEM_TYPE_INTEGER ((__force snd_ctl_elem_type_t) 2) /* integer type */
  967. #define SNDRV_CTL_ELEM_TYPE_ENUMERATED ((__force snd_ctl_elem_type_t) 3) /* enumerated type */
  968. #define SNDRV_CTL_ELEM_TYPE_BYTES ((__force snd_ctl_elem_type_t) 4) /* byte array */
  969. #define SNDRV_CTL_ELEM_TYPE_IEC958 ((__force snd_ctl_elem_type_t) 5) /* IEC958 (S/PDIF) setup */
  970. #define SNDRV_CTL_ELEM_TYPE_INTEGER64 ((__force snd_ctl_elem_type_t) 6) /* 64-bit integer type */
  971. #define SNDRV_CTL_ELEM_TYPE_LAST SNDRV_CTL_ELEM_TYPE_INTEGER64
  972. typedef int __bitwise snd_ctl_elem_iface_t;
  973. #define SNDRV_CTL_ELEM_IFACE_CARD ((__force snd_ctl_elem_iface_t) 0) /* global control */
  974. #define SNDRV_CTL_ELEM_IFACE_HWDEP ((__force snd_ctl_elem_iface_t) 1) /* hardware dependent device */
  975. #define SNDRV_CTL_ELEM_IFACE_MIXER ((__force snd_ctl_elem_iface_t) 2) /* virtual mixer device */
  976. #define SNDRV_CTL_ELEM_IFACE_PCM ((__force snd_ctl_elem_iface_t) 3) /* PCM device */
  977. #define SNDRV_CTL_ELEM_IFACE_RAWMIDI ((__force snd_ctl_elem_iface_t) 4) /* RawMidi device */
  978. #define SNDRV_CTL_ELEM_IFACE_TIMER ((__force snd_ctl_elem_iface_t) 5) /* timer device */
  979. #define SNDRV_CTL_ELEM_IFACE_SEQUENCER ((__force snd_ctl_elem_iface_t) 6) /* sequencer client */
  980. #define SNDRV_CTL_ELEM_IFACE_LAST SNDRV_CTL_ELEM_IFACE_SEQUENCER
  981. #define SNDRV_CTL_ELEM_ACCESS_READ (1<<0)
  982. #define SNDRV_CTL_ELEM_ACCESS_WRITE (1<<1)
  983. #define SNDRV_CTL_ELEM_ACCESS_READWRITE (SNDRV_CTL_ELEM_ACCESS_READ|SNDRV_CTL_ELEM_ACCESS_WRITE)
  984. #define SNDRV_CTL_ELEM_ACCESS_VOLATILE (1<<2) /* control value may be changed without a notification */
  985. /* (1 << 3) is unused. */
  986. #define SNDRV_CTL_ELEM_ACCESS_TLV_READ (1<<4) /* TLV read is possible */
  987. #define SNDRV_CTL_ELEM_ACCESS_TLV_WRITE (1<<5) /* TLV write is possible */
  988. #define SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE (SNDRV_CTL_ELEM_ACCESS_TLV_READ|SNDRV_CTL_ELEM_ACCESS_TLV_WRITE)
  989. #define SNDRV_CTL_ELEM_ACCESS_TLV_COMMAND (1<<6) /* TLV command is possible */
  990. #define SNDRV_CTL_ELEM_ACCESS_INACTIVE (1<<8) /* control does actually nothing, but may be updated */
  991. #define SNDRV_CTL_ELEM_ACCESS_LOCK (1<<9) /* write lock */
  992. #define SNDRV_CTL_ELEM_ACCESS_OWNER (1<<10) /* write lock owner */
  993. #define SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK (1<<28) /* kernel use a TLV callback */
  994. #define SNDRV_CTL_ELEM_ACCESS_USER (1<<29) /* user space element */
  995. /* bits 30 and 31 are obsoleted (for indirect access) */
  996. /* for further details see the ACPI and PCI power management specification */
  997. #define SNDRV_CTL_POWER_D0 0x0000 /* full On */
  998. #define SNDRV_CTL_POWER_D1 0x0100 /* partial On */
  999. #define SNDRV_CTL_POWER_D2 0x0200 /* partial On */
  1000. #define SNDRV_CTL_POWER_D3 0x0300 /* Off */
  1001. #define SNDRV_CTL_POWER_D3hot (SNDRV_CTL_POWER_D3|0x0000) /* Off, with power */
  1002. #define SNDRV_CTL_POWER_D3cold (SNDRV_CTL_POWER_D3|0x0001) /* Off, without power */
  1003. #define SNDRV_CTL_ELEM_ID_NAME_MAXLEN 44
  1004. struct snd_ctl_elem_id {
  1005. unsigned int numid; /* numeric identifier, zero = invalid */
  1006. snd_ctl_elem_iface_t iface; /* interface identifier */
  1007. unsigned int device; /* device/client number */
  1008. unsigned int subdevice; /* subdevice (substream) number */
  1009. unsigned char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* ASCII name of item */
  1010. unsigned int index; /* index of item */
  1011. };
  1012. struct snd_ctl_elem_list {
  1013. unsigned int offset; /* W: first element ID to get */
  1014. unsigned int space; /* W: count of element IDs to get */
  1015. unsigned int used; /* R: count of element IDs set */
  1016. unsigned int count; /* R: count of all elements */
  1017. struct snd_ctl_elem_id __user *pids; /* R: IDs */
  1018. unsigned char reserved[50];
  1019. };
  1020. struct snd_ctl_elem_info {
  1021. struct snd_ctl_elem_id id; /* W: element ID */
  1022. snd_ctl_elem_type_t type; /* R: value type - SNDRV_CTL_ELEM_TYPE_* */
  1023. unsigned int access; /* R: value access (bitmask) - SNDRV_CTL_ELEM_ACCESS_* */
  1024. unsigned int count; /* count of values */
  1025. __kernel_pid_t owner; /* owner's PID of this control */
  1026. union {
  1027. struct {
  1028. long min; /* R: minimum value */
  1029. long max; /* R: maximum value */
  1030. long step; /* R: step (0 variable) */
  1031. } integer;
  1032. struct {
  1033. long long min; /* R: minimum value */
  1034. long long max; /* R: maximum value */
  1035. long long step; /* R: step (0 variable) */
  1036. } integer64;
  1037. struct {
  1038. unsigned int items; /* R: number of items */
  1039. unsigned int item; /* W: item number */
  1040. char name[64]; /* R: value name */
  1041. __u64 names_ptr; /* W: names list (ELEM_ADD only) */
  1042. unsigned int names_length;
  1043. } enumerated;
  1044. unsigned char reserved[128];
  1045. } value;
  1046. unsigned char reserved[64];
  1047. };
  1048. struct snd_ctl_elem_value {
  1049. struct snd_ctl_elem_id id; /* W: element ID */
  1050. unsigned int indirect: 1; /* W: indirect access - obsoleted */
  1051. union {
  1052. union {
  1053. long value[128];
  1054. long *value_ptr; /* obsoleted */
  1055. } integer;
  1056. union {
  1057. long long value[64];
  1058. long long *value_ptr; /* obsoleted */
  1059. } integer64;
  1060. union {
  1061. unsigned int item[128];
  1062. unsigned int *item_ptr; /* obsoleted */
  1063. } enumerated;
  1064. union {
  1065. unsigned char data[512];
  1066. unsigned char *data_ptr; /* obsoleted */
  1067. } bytes;
  1068. struct snd_aes_iec958 iec958;
  1069. } value; /* RO */
  1070. unsigned char reserved[128];
  1071. };
  1072. struct snd_ctl_tlv {
  1073. unsigned int numid; /* control element numeric identification */
  1074. unsigned int length; /* in bytes aligned to 4 */
  1075. unsigned int tlv[]; /* first TLV */
  1076. };
  1077. #define SNDRV_CTL_IOCTL_PVERSION _IOR('U', 0x00, int)
  1078. #define SNDRV_CTL_IOCTL_CARD_INFO _IOR('U', 0x01, struct snd_ctl_card_info)
  1079. #define SNDRV_CTL_IOCTL_ELEM_LIST _IOWR('U', 0x10, struct snd_ctl_elem_list)
  1080. #define SNDRV_CTL_IOCTL_ELEM_INFO _IOWR('U', 0x11, struct snd_ctl_elem_info)
  1081. #define SNDRV_CTL_IOCTL_ELEM_READ _IOWR('U', 0x12, struct snd_ctl_elem_value)
  1082. #define SNDRV_CTL_IOCTL_ELEM_WRITE _IOWR('U', 0x13, struct snd_ctl_elem_value)
  1083. #define SNDRV_CTL_IOCTL_ELEM_LOCK _IOW('U', 0x14, struct snd_ctl_elem_id)
  1084. #define SNDRV_CTL_IOCTL_ELEM_UNLOCK _IOW('U', 0x15, struct snd_ctl_elem_id)
  1085. #define SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS _IOWR('U', 0x16, int)
  1086. #define SNDRV_CTL_IOCTL_ELEM_ADD _IOWR('U', 0x17, struct snd_ctl_elem_info)
  1087. #define SNDRV_CTL_IOCTL_ELEM_REPLACE _IOWR('U', 0x18, struct snd_ctl_elem_info)
  1088. #define SNDRV_CTL_IOCTL_ELEM_REMOVE _IOWR('U', 0x19, struct snd_ctl_elem_id)
  1089. #define SNDRV_CTL_IOCTL_TLV_READ _IOWR('U', 0x1a, struct snd_ctl_tlv)
  1090. #define SNDRV_CTL_IOCTL_TLV_WRITE _IOWR('U', 0x1b, struct snd_ctl_tlv)
  1091. #define SNDRV_CTL_IOCTL_TLV_COMMAND _IOWR('U', 0x1c, struct snd_ctl_tlv)
  1092. #define SNDRV_CTL_IOCTL_HWDEP_NEXT_DEVICE _IOWR('U', 0x20, int)
  1093. #define SNDRV_CTL_IOCTL_HWDEP_INFO _IOR('U', 0x21, struct snd_hwdep_info)
  1094. #define SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE _IOR('U', 0x30, int)
  1095. #define SNDRV_CTL_IOCTL_PCM_INFO _IOWR('U', 0x31, struct snd_pcm_info)
  1096. #define SNDRV_CTL_IOCTL_PCM_PREFER_SUBDEVICE _IOW('U', 0x32, int)
  1097. #define SNDRV_CTL_IOCTL_RAWMIDI_NEXT_DEVICE _IOWR('U', 0x40, int)
  1098. #define SNDRV_CTL_IOCTL_RAWMIDI_INFO _IOWR('U', 0x41, struct snd_rawmidi_info)
  1099. #define SNDRV_CTL_IOCTL_RAWMIDI_PREFER_SUBDEVICE _IOW('U', 0x42, int)
  1100. #define SNDRV_CTL_IOCTL_UMP_NEXT_DEVICE _IOWR('U', 0x43, int)
  1101. #define SNDRV_CTL_IOCTL_UMP_ENDPOINT_INFO _IOWR('U', 0x44, struct snd_ump_endpoint_info)
  1102. #define SNDRV_CTL_IOCTL_UMP_BLOCK_INFO _IOWR('U', 0x45, struct snd_ump_block_info)
  1103. #define SNDRV_CTL_IOCTL_POWER _IOWR('U', 0xd0, int)
  1104. #define SNDRV_CTL_IOCTL_POWER_STATE _IOR('U', 0xd1, int)
  1105. /*
  1106. * Read interface.
  1107. */
  1108. enum sndrv_ctl_event_type {
  1109. SNDRV_CTL_EVENT_ELEM = 0,
  1110. SNDRV_CTL_EVENT_LAST = SNDRV_CTL_EVENT_ELEM,
  1111. };
  1112. #define SNDRV_CTL_EVENT_MASK_VALUE (1<<0) /* element value was changed */
  1113. #define SNDRV_CTL_EVENT_MASK_INFO (1<<1) /* element info was changed */
  1114. #define SNDRV_CTL_EVENT_MASK_ADD (1<<2) /* element was added */
  1115. #define SNDRV_CTL_EVENT_MASK_TLV (1<<3) /* element TLV tree was changed */
  1116. #define SNDRV_CTL_EVENT_MASK_REMOVE (~0U) /* element was removed */
  1117. struct snd_ctl_event {
  1118. int type; /* event type - SNDRV_CTL_EVENT_* */
  1119. union {
  1120. struct {
  1121. unsigned int mask;
  1122. struct snd_ctl_elem_id id;
  1123. } elem;
  1124. unsigned char data8[60];
  1125. } data;
  1126. };
  1127. /*
  1128. * Control names
  1129. */
  1130. #define SNDRV_CTL_NAME_NONE ""
  1131. #define SNDRV_CTL_NAME_PLAYBACK "Playback "
  1132. #define SNDRV_CTL_NAME_CAPTURE "Capture "
  1133. #define SNDRV_CTL_NAME_IEC958_NONE ""
  1134. #define SNDRV_CTL_NAME_IEC958_SWITCH "Switch"
  1135. #define SNDRV_CTL_NAME_IEC958_VOLUME "Volume"
  1136. #define SNDRV_CTL_NAME_IEC958_DEFAULT "Default"
  1137. #define SNDRV_CTL_NAME_IEC958_MASK "Mask"
  1138. #define SNDRV_CTL_NAME_IEC958_CON_MASK "Con Mask"
  1139. #define SNDRV_CTL_NAME_IEC958_PRO_MASK "Pro Mask"
  1140. #define SNDRV_CTL_NAME_IEC958_PCM_STREAM "PCM Stream"
  1141. #define SNDRV_CTL_NAME_IEC958(expl,direction,what) "IEC958 " expl SNDRV_CTL_NAME_##direction SNDRV_CTL_NAME_IEC958_##what
  1142. #endif /* _UAPI__SOUND_ASOUND_H */