audio.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547
  1. /*
  2. * <linux/usb/audio.h> -- USB Audio definitions.
  3. *
  4. * Copyright (C) 2006 Thumtronics Pty Ltd.
  5. * Developed for Thumtronics by Grey Innovation
  6. * Ben Williamson <ben.williamson@greyinnovation.com>
  7. *
  8. * This software is distributed under the terms of the GNU General Public
  9. * License ("GPL") version 2, as published by the Free Software Foundation.
  10. *
  11. * This file holds USB constants and structures defined
  12. * by the USB Device Class Definition for Audio Devices.
  13. * Comments below reference relevant sections of that document:
  14. *
  15. * http://www.usb.org/developers/devclass_docs/audio10.pdf
  16. *
  17. * Types and defines in this file are either specific to version 1.0 of
  18. * this standard or common for newer versions.
  19. */
  20. #ifndef _UAPI__LINUX_USB_AUDIO_H
  21. #define _UAPI__LINUX_USB_AUDIO_H
  22. #include <linux/types.h>
  23. /* bInterfaceProtocol values to denote the version of the standard used */
  24. #define UAC_VERSION_1 0x00
  25. #define UAC_VERSION_2 0x20
  26. /* A.2 Audio Interface Subclass Codes */
  27. #define USB_SUBCLASS_AUDIOCONTROL 0x01
  28. #define USB_SUBCLASS_AUDIOSTREAMING 0x02
  29. #define USB_SUBCLASS_MIDISTREAMING 0x03
  30. /* A.5 Audio Class-Specific AC Interface Descriptor Subtypes */
  31. #define UAC_HEADER 0x01
  32. #define UAC_INPUT_TERMINAL 0x02
  33. #define UAC_OUTPUT_TERMINAL 0x03
  34. #define UAC_MIXER_UNIT 0x04
  35. #define UAC_SELECTOR_UNIT 0x05
  36. #define UAC_FEATURE_UNIT 0x06
  37. #define UAC1_PROCESSING_UNIT 0x07
  38. #define UAC1_EXTENSION_UNIT 0x08
  39. /* A.6 Audio Class-Specific AS Interface Descriptor Subtypes */
  40. #define UAC_AS_GENERAL 0x01
  41. #define UAC_FORMAT_TYPE 0x02
  42. #define UAC_FORMAT_SPECIFIC 0x03
  43. /* A.7 Processing Unit Process Types */
  44. #define UAC_PROCESS_UNDEFINED 0x00
  45. #define UAC_PROCESS_UP_DOWNMIX 0x01
  46. #define UAC_PROCESS_DOLBY_PROLOGIC 0x02
  47. #define UAC_PROCESS_STEREO_EXTENDER 0x03
  48. #define UAC_PROCESS_REVERB 0x04
  49. #define UAC_PROCESS_CHORUS 0x05
  50. #define UAC_PROCESS_DYN_RANGE_COMP 0x06
  51. /* A.8 Audio Class-Specific Endpoint Descriptor Subtypes */
  52. #define UAC_EP_GENERAL 0x01
  53. /* A.9 Audio Class-Specific Request Codes */
  54. #define UAC_SET_ 0x00
  55. #define UAC_GET_ 0x80
  56. #define UAC__CUR 0x1
  57. #define UAC__MIN 0x2
  58. #define UAC__MAX 0x3
  59. #define UAC__RES 0x4
  60. #define UAC__MEM 0x5
  61. #define UAC_SET_CUR (UAC_SET_ | UAC__CUR)
  62. #define UAC_GET_CUR (UAC_GET_ | UAC__CUR)
  63. #define UAC_SET_MIN (UAC_SET_ | UAC__MIN)
  64. #define UAC_GET_MIN (UAC_GET_ | UAC__MIN)
  65. #define UAC_SET_MAX (UAC_SET_ | UAC__MAX)
  66. #define UAC_GET_MAX (UAC_GET_ | UAC__MAX)
  67. #define UAC_SET_RES (UAC_SET_ | UAC__RES)
  68. #define UAC_GET_RES (UAC_GET_ | UAC__RES)
  69. #define UAC_SET_MEM (UAC_SET_ | UAC__MEM)
  70. #define UAC_GET_MEM (UAC_GET_ | UAC__MEM)
  71. #define UAC_GET_STAT 0xff
  72. /* A.10 Control Selector Codes */
  73. /* A.10.1 Terminal Control Selectors */
  74. #define UAC_TERM_COPY_PROTECT 0x01
  75. /* A.10.2 Feature Unit Control Selectors */
  76. #define UAC_FU_MUTE 0x01
  77. #define UAC_FU_VOLUME 0x02
  78. #define UAC_FU_BASS 0x03
  79. #define UAC_FU_MID 0x04
  80. #define UAC_FU_TREBLE 0x05
  81. #define UAC_FU_GRAPHIC_EQUALIZER 0x06
  82. #define UAC_FU_AUTOMATIC_GAIN 0x07
  83. #define UAC_FU_DELAY 0x08
  84. #define UAC_FU_BASS_BOOST 0x09
  85. #define UAC_FU_LOUDNESS 0x0a
  86. #define UAC_CONTROL_BIT(CS) (1 << ((CS) - 1))
  87. /* A.10.3.1 Up/Down-mix Processing Unit Controls Selectors */
  88. #define UAC_UD_ENABLE 0x01
  89. #define UAC_UD_MODE_SELECT 0x02
  90. /* A.10.3.2 Dolby Prologic (tm) Processing Unit Controls Selectors */
  91. #define UAC_DP_ENABLE 0x01
  92. #define UAC_DP_MODE_SELECT 0x02
  93. /* A.10.3.3 3D Stereo Extender Processing Unit Control Selectors */
  94. #define UAC_3D_ENABLE 0x01
  95. #define UAC_3D_SPACE 0x02
  96. /* A.10.3.4 Reverberation Processing Unit Control Selectors */
  97. #define UAC_REVERB_ENABLE 0x01
  98. #define UAC_REVERB_LEVEL 0x02
  99. #define UAC_REVERB_TIME 0x03
  100. #define UAC_REVERB_FEEDBACK 0x04
  101. /* A.10.3.5 Chorus Processing Unit Control Selectors */
  102. #define UAC_CHORUS_ENABLE 0x01
  103. #define UAC_CHORUS_LEVEL 0x02
  104. #define UAC_CHORUS_RATE 0x03
  105. #define UAC_CHORUS_DEPTH 0x04
  106. /* A.10.3.6 Dynamic Range Compressor Unit Control Selectors */
  107. #define UAC_DCR_ENABLE 0x01
  108. #define UAC_DCR_RATE 0x02
  109. #define UAC_DCR_MAXAMPL 0x03
  110. #define UAC_DCR_THRESHOLD 0x04
  111. #define UAC_DCR_ATTACK_TIME 0x05
  112. #define UAC_DCR_RELEASE_TIME 0x06
  113. /* A.10.4 Extension Unit Control Selectors */
  114. #define UAC_XU_ENABLE 0x01
  115. /* MIDI - A.1 MS Class-Specific Interface Descriptor Subtypes */
  116. #define UAC_MS_HEADER 0x01
  117. #define UAC_MIDI_IN_JACK 0x02
  118. #define UAC_MIDI_OUT_JACK 0x03
  119. /* MIDI - A.1 MS Class-Specific Endpoint Descriptor Subtypes */
  120. #define UAC_MS_GENERAL 0x01
  121. /* Terminals - 2.1 USB Terminal Types */
  122. #define UAC_TERMINAL_UNDEFINED 0x100
  123. #define UAC_TERMINAL_STREAMING 0x101
  124. #define UAC_TERMINAL_VENDOR_SPEC 0x1FF
  125. /* Terminal Control Selectors */
  126. /* 4.3.2 Class-Specific AC Interface Descriptor */
  127. struct uac1_ac_header_descriptor {
  128. __u8 bLength; /* 8 + n */
  129. __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
  130. __u8 bDescriptorSubtype; /* UAC_MS_HEADER */
  131. __le16 bcdADC; /* 0x0100 */
  132. __le16 wTotalLength; /* includes Unit and Terminal desc. */
  133. __u8 bInCollection; /* n */
  134. __u8 baInterfaceNr[]; /* [n] */
  135. } __attribute__ ((packed));
  136. #define UAC_DT_AC_HEADER_SIZE(n) (8 + (n))
  137. /* As above, but more useful for defining your own descriptors: */
  138. #define DECLARE_UAC_AC_HEADER_DESCRIPTOR(n) \
  139. struct uac1_ac_header_descriptor_##n { \
  140. __u8 bLength; \
  141. __u8 bDescriptorType; \
  142. __u8 bDescriptorSubtype; \
  143. __le16 bcdADC; \
  144. __le16 wTotalLength; \
  145. __u8 bInCollection; \
  146. __u8 baInterfaceNr[n]; \
  147. } __attribute__ ((packed))
  148. /* 4.3.2.1 Input Terminal Descriptor */
  149. struct uac_input_terminal_descriptor {
  150. __u8 bLength; /* in bytes: 12 */
  151. __u8 bDescriptorType; /* CS_INTERFACE descriptor type */
  152. __u8 bDescriptorSubtype; /* INPUT_TERMINAL descriptor subtype */
  153. __u8 bTerminalID; /* Constant uniquely terminal ID */
  154. __le16 wTerminalType; /* USB Audio Terminal Types */
  155. __u8 bAssocTerminal; /* ID of the Output Terminal associated */
  156. __u8 bNrChannels; /* Number of logical output channels */
  157. __le16 wChannelConfig;
  158. __u8 iChannelNames;
  159. __u8 iTerminal;
  160. } __attribute__ ((packed));
  161. #define UAC_DT_INPUT_TERMINAL_SIZE 12
  162. /* Terminals - 2.2 Input Terminal Types */
  163. #define UAC_INPUT_TERMINAL_UNDEFINED 0x200
  164. #define UAC_INPUT_TERMINAL_MICROPHONE 0x201
  165. #define UAC_INPUT_TERMINAL_DESKTOP_MICROPHONE 0x202
  166. #define UAC_INPUT_TERMINAL_PERSONAL_MICROPHONE 0x203
  167. #define UAC_INPUT_TERMINAL_OMNI_DIR_MICROPHONE 0x204
  168. #define UAC_INPUT_TERMINAL_MICROPHONE_ARRAY 0x205
  169. #define UAC_INPUT_TERMINAL_PROC_MICROPHONE_ARRAY 0x206
  170. /* Terminals - control selectors */
  171. #define UAC_TERMINAL_CS_COPY_PROTECT_CONTROL 0x01
  172. /* 4.3.2.2 Output Terminal Descriptor */
  173. struct uac1_output_terminal_descriptor {
  174. __u8 bLength; /* in bytes: 9 */
  175. __u8 bDescriptorType; /* CS_INTERFACE descriptor type */
  176. __u8 bDescriptorSubtype; /* OUTPUT_TERMINAL descriptor subtype */
  177. __u8 bTerminalID; /* Constant uniquely terminal ID */
  178. __le16 wTerminalType; /* USB Audio Terminal Types */
  179. __u8 bAssocTerminal; /* ID of the Input Terminal associated */
  180. __u8 bSourceID; /* ID of the connected Unit or Terminal*/
  181. __u8 iTerminal;
  182. } __attribute__ ((packed));
  183. #define UAC_DT_OUTPUT_TERMINAL_SIZE 9
  184. /* Terminals - 2.3 Output Terminal Types */
  185. #define UAC_OUTPUT_TERMINAL_UNDEFINED 0x300
  186. #define UAC_OUTPUT_TERMINAL_SPEAKER 0x301
  187. #define UAC_OUTPUT_TERMINAL_HEADPHONES 0x302
  188. #define UAC_OUTPUT_TERMINAL_HEAD_MOUNTED_DISPLAY_AUDIO 0x303
  189. #define UAC_OUTPUT_TERMINAL_DESKTOP_SPEAKER 0x304
  190. #define UAC_OUTPUT_TERMINAL_ROOM_SPEAKER 0x305
  191. #define UAC_OUTPUT_TERMINAL_COMMUNICATION_SPEAKER 0x306
  192. #define UAC_OUTPUT_TERMINAL_LOW_FREQ_EFFECTS_SPEAKER 0x307
  193. /* Set bControlSize = 2 as default setting */
  194. #define UAC_DT_FEATURE_UNIT_SIZE(ch) (7 + ((ch) + 1) * 2)
  195. /* As above, but more useful for defining your own descriptors: */
  196. #define DECLARE_UAC_FEATURE_UNIT_DESCRIPTOR(ch) \
  197. struct uac_feature_unit_descriptor_##ch { \
  198. __u8 bLength; \
  199. __u8 bDescriptorType; \
  200. __u8 bDescriptorSubtype; \
  201. __u8 bUnitID; \
  202. __u8 bSourceID; \
  203. __u8 bControlSize; \
  204. __le16 bmaControls[ch + 1]; \
  205. __u8 iFeature; \
  206. } __attribute__ ((packed))
  207. /* 4.3.2.3 Mixer Unit Descriptor */
  208. struct uac_mixer_unit_descriptor {
  209. __u8 bLength;
  210. __u8 bDescriptorType;
  211. __u8 bDescriptorSubtype;
  212. __u8 bUnitID;
  213. __u8 bNrInPins;
  214. __u8 baSourceID[];
  215. } __attribute__ ((packed));
  216. static inline __u8 uac_mixer_unit_bNrChannels(struct uac_mixer_unit_descriptor *desc)
  217. {
  218. return desc->baSourceID[desc->bNrInPins];
  219. }
  220. static inline __u32 uac_mixer_unit_wChannelConfig(struct uac_mixer_unit_descriptor *desc,
  221. int protocol)
  222. {
  223. if (protocol == UAC_VERSION_1)
  224. return (desc->baSourceID[desc->bNrInPins + 2] << 8) |
  225. desc->baSourceID[desc->bNrInPins + 1];
  226. else
  227. return (desc->baSourceID[desc->bNrInPins + 4] << 24) |
  228. (desc->baSourceID[desc->bNrInPins + 3] << 16) |
  229. (desc->baSourceID[desc->bNrInPins + 2] << 8) |
  230. (desc->baSourceID[desc->bNrInPins + 1]);
  231. }
  232. static inline __u8 uac_mixer_unit_iChannelNames(struct uac_mixer_unit_descriptor *desc,
  233. int protocol)
  234. {
  235. return (protocol == UAC_VERSION_1) ?
  236. desc->baSourceID[desc->bNrInPins + 3] :
  237. desc->baSourceID[desc->bNrInPins + 5];
  238. }
  239. static inline __u8 *uac_mixer_unit_bmControls(struct uac_mixer_unit_descriptor *desc,
  240. int protocol)
  241. {
  242. return (protocol == UAC_VERSION_1) ?
  243. &desc->baSourceID[desc->bNrInPins + 4] :
  244. &desc->baSourceID[desc->bNrInPins + 6];
  245. }
  246. static inline __u8 uac_mixer_unit_iMixer(struct uac_mixer_unit_descriptor *desc)
  247. {
  248. __u8 *raw = (__u8 *) desc;
  249. return raw[desc->bLength - 1];
  250. }
  251. /* 4.3.2.4 Selector Unit Descriptor */
  252. struct uac_selector_unit_descriptor {
  253. __u8 bLength;
  254. __u8 bDescriptorType;
  255. __u8 bDescriptorSubtype;
  256. __u8 bUintID;
  257. __u8 bNrInPins;
  258. __u8 baSourceID[];
  259. } __attribute__ ((packed));
  260. static inline __u8 uac_selector_unit_iSelector(struct uac_selector_unit_descriptor *desc)
  261. {
  262. __u8 *raw = (__u8 *) desc;
  263. return raw[desc->bLength - 1];
  264. }
  265. /* 4.3.2.5 Feature Unit Descriptor */
  266. struct uac_feature_unit_descriptor {
  267. __u8 bLength;
  268. __u8 bDescriptorType;
  269. __u8 bDescriptorSubtype;
  270. __u8 bUnitID;
  271. __u8 bSourceID;
  272. __u8 bControlSize;
  273. __u8 bmaControls[0]; /* variable length */
  274. } __attribute__((packed));
  275. static inline __u8 uac_feature_unit_iFeature(struct uac_feature_unit_descriptor *desc)
  276. {
  277. __u8 *raw = (__u8 *) desc;
  278. return raw[desc->bLength - 1];
  279. }
  280. /* 4.3.2.6 Processing Unit Descriptors */
  281. struct uac_processing_unit_descriptor {
  282. __u8 bLength;
  283. __u8 bDescriptorType;
  284. __u8 bDescriptorSubtype;
  285. __u8 bUnitID;
  286. __u16 wProcessType;
  287. __u8 bNrInPins;
  288. __u8 baSourceID[];
  289. } __attribute__ ((packed));
  290. static inline __u8 uac_processing_unit_bNrChannels(struct uac_processing_unit_descriptor *desc)
  291. {
  292. return desc->baSourceID[desc->bNrInPins];
  293. }
  294. static inline __u32 uac_processing_unit_wChannelConfig(struct uac_processing_unit_descriptor *desc,
  295. int protocol)
  296. {
  297. if (protocol == UAC_VERSION_1)
  298. return (desc->baSourceID[desc->bNrInPins + 2] << 8) |
  299. desc->baSourceID[desc->bNrInPins + 1];
  300. else
  301. return (desc->baSourceID[desc->bNrInPins + 4] << 24) |
  302. (desc->baSourceID[desc->bNrInPins + 3] << 16) |
  303. (desc->baSourceID[desc->bNrInPins + 2] << 8) |
  304. (desc->baSourceID[desc->bNrInPins + 1]);
  305. }
  306. static inline __u8 uac_processing_unit_iChannelNames(struct uac_processing_unit_descriptor *desc,
  307. int protocol)
  308. {
  309. return (protocol == UAC_VERSION_1) ?
  310. desc->baSourceID[desc->bNrInPins + 3] :
  311. desc->baSourceID[desc->bNrInPins + 5];
  312. }
  313. static inline __u8 uac_processing_unit_bControlSize(struct uac_processing_unit_descriptor *desc,
  314. int protocol)
  315. {
  316. return (protocol == UAC_VERSION_1) ?
  317. desc->baSourceID[desc->bNrInPins + 4] :
  318. 2; /* in UAC2, this value is constant */
  319. }
  320. static inline __u8 *uac_processing_unit_bmControls(struct uac_processing_unit_descriptor *desc,
  321. int protocol)
  322. {
  323. return (protocol == UAC_VERSION_1) ?
  324. &desc->baSourceID[desc->bNrInPins + 5] :
  325. &desc->baSourceID[desc->bNrInPins + 6];
  326. }
  327. static inline __u8 uac_processing_unit_iProcessing(struct uac_processing_unit_descriptor *desc,
  328. int protocol)
  329. {
  330. __u8 control_size = uac_processing_unit_bControlSize(desc, protocol);
  331. return *(uac_processing_unit_bmControls(desc, protocol)
  332. + control_size);
  333. }
  334. static inline __u8 *uac_processing_unit_specific(struct uac_processing_unit_descriptor *desc,
  335. int protocol)
  336. {
  337. __u8 control_size = uac_processing_unit_bControlSize(desc, protocol);
  338. return uac_processing_unit_bmControls(desc, protocol)
  339. + control_size + 1;
  340. }
  341. /* 4.5.2 Class-Specific AS Interface Descriptor */
  342. struct uac1_as_header_descriptor {
  343. __u8 bLength; /* in bytes: 7 */
  344. __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
  345. __u8 bDescriptorSubtype; /* AS_GENERAL */
  346. __u8 bTerminalLink; /* Terminal ID of connected Terminal */
  347. __u8 bDelay; /* Delay introduced by the data path */
  348. __le16 wFormatTag; /* The Audio Data Format */
  349. } __attribute__ ((packed));
  350. #define UAC_DT_AS_HEADER_SIZE 7
  351. /* Formats - A.1.1 Audio Data Format Type I Codes */
  352. #define UAC_FORMAT_TYPE_I_UNDEFINED 0x0
  353. #define UAC_FORMAT_TYPE_I_PCM 0x1
  354. #define UAC_FORMAT_TYPE_I_PCM8 0x2
  355. #define UAC_FORMAT_TYPE_I_IEEE_FLOAT 0x3
  356. #define UAC_FORMAT_TYPE_I_ALAW 0x4
  357. #define UAC_FORMAT_TYPE_I_MULAW 0x5
  358. struct uac_format_type_i_continuous_descriptor {
  359. __u8 bLength; /* in bytes: 8 + (ns * 3) */
  360. __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
  361. __u8 bDescriptorSubtype; /* FORMAT_TYPE */
  362. __u8 bFormatType; /* FORMAT_TYPE_1 */
  363. __u8 bNrChannels; /* physical channels in the stream */
  364. __u8 bSubframeSize; /* */
  365. __u8 bBitResolution;
  366. __u8 bSamFreqType;
  367. __u8 tLowerSamFreq[3];
  368. __u8 tUpperSamFreq[3];
  369. } __attribute__ ((packed));
  370. #define UAC_FORMAT_TYPE_I_CONTINUOUS_DESC_SIZE 14
  371. struct uac_format_type_i_discrete_descriptor {
  372. __u8 bLength; /* in bytes: 8 + (ns * 3) */
  373. __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
  374. __u8 bDescriptorSubtype; /* FORMAT_TYPE */
  375. __u8 bFormatType; /* FORMAT_TYPE_1 */
  376. __u8 bNrChannels; /* physical channels in the stream */
  377. __u8 bSubframeSize; /* */
  378. __u8 bBitResolution;
  379. __u8 bSamFreqType;
  380. __u8 tSamFreq[][3];
  381. } __attribute__ ((packed));
  382. #define DECLARE_UAC_FORMAT_TYPE_I_DISCRETE_DESC(n) \
  383. struct uac_format_type_i_discrete_descriptor_##n { \
  384. __u8 bLength; \
  385. __u8 bDescriptorType; \
  386. __u8 bDescriptorSubtype; \
  387. __u8 bFormatType; \
  388. __u8 bNrChannels; \
  389. __u8 bSubframeSize; \
  390. __u8 bBitResolution; \
  391. __u8 bSamFreqType; \
  392. __u8 tSamFreq[n][3]; \
  393. } __attribute__ ((packed))
  394. #define UAC_FORMAT_TYPE_I_DISCRETE_DESC_SIZE(n) (8 + (n * 3))
  395. struct uac_format_type_i_ext_descriptor {
  396. __u8 bLength;
  397. __u8 bDescriptorType;
  398. __u8 bDescriptorSubtype;
  399. __u8 bFormatType;
  400. __u8 bSubslotSize;
  401. __u8 bBitResolution;
  402. __u8 bHeaderLength;
  403. __u8 bControlSize;
  404. __u8 bSideBandProtocol;
  405. } __attribute__((packed));
  406. /* Formats - Audio Data Format Type I Codes */
  407. #define UAC_FORMAT_TYPE_II_MPEG 0x1001
  408. #define UAC_FORMAT_TYPE_II_AC3 0x1002
  409. struct uac_format_type_ii_discrete_descriptor {
  410. __u8 bLength;
  411. __u8 bDescriptorType;
  412. __u8 bDescriptorSubtype;
  413. __u8 bFormatType;
  414. __le16 wMaxBitRate;
  415. __le16 wSamplesPerFrame;
  416. __u8 bSamFreqType;
  417. __u8 tSamFreq[][3];
  418. } __attribute__((packed));
  419. struct uac_format_type_ii_ext_descriptor {
  420. __u8 bLength;
  421. __u8 bDescriptorType;
  422. __u8 bDescriptorSubtype;
  423. __u8 bFormatType;
  424. __u16 wMaxBitRate;
  425. __u16 wSamplesPerFrame;
  426. __u8 bHeaderLength;
  427. __u8 bSideBandProtocol;
  428. } __attribute__((packed));
  429. /* type III */
  430. #define UAC_FORMAT_TYPE_III_IEC1937_AC3 0x2001
  431. #define UAC_FORMAT_TYPE_III_IEC1937_MPEG1_LAYER1 0x2002
  432. #define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_NOEXT 0x2003
  433. #define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_EXT 0x2004
  434. #define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_LAYER1_LS 0x2005
  435. #define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_LAYER23_LS 0x2006
  436. /* Formats - A.2 Format Type Codes */
  437. #define UAC_FORMAT_TYPE_UNDEFINED 0x0
  438. #define UAC_FORMAT_TYPE_I 0x1
  439. #define UAC_FORMAT_TYPE_II 0x2
  440. #define UAC_FORMAT_TYPE_III 0x3
  441. #define UAC_EXT_FORMAT_TYPE_I 0x81
  442. #define UAC_EXT_FORMAT_TYPE_II 0x82
  443. #define UAC_EXT_FORMAT_TYPE_III 0x83
  444. struct uac_iso_endpoint_descriptor {
  445. __u8 bLength; /* in bytes: 7 */
  446. __u8 bDescriptorType; /* USB_DT_CS_ENDPOINT */
  447. __u8 bDescriptorSubtype; /* EP_GENERAL */
  448. __u8 bmAttributes;
  449. __u8 bLockDelayUnits;
  450. __le16 wLockDelay;
  451. } __attribute__((packed));
  452. #define UAC_ISO_ENDPOINT_DESC_SIZE 7
  453. #define UAC_EP_CS_ATTR_SAMPLE_RATE 0x01
  454. #define UAC_EP_CS_ATTR_PITCH_CONTROL 0x02
  455. #define UAC_EP_CS_ATTR_FILL_MAX 0x80
  456. /* status word format (3.7.1.1) */
  457. #define UAC1_STATUS_TYPE_ORIG_MASK 0x0f
  458. #define UAC1_STATUS_TYPE_ORIG_AUDIO_CONTROL_IF 0x0
  459. #define UAC1_STATUS_TYPE_ORIG_AUDIO_STREAM_IF 0x1
  460. #define UAC1_STATUS_TYPE_ORIG_AUDIO_STREAM_EP 0x2
  461. #define UAC1_STATUS_TYPE_IRQ_PENDING (1 << 7)
  462. #define UAC1_STATUS_TYPE_MEM_CHANGED (1 << 6)
  463. struct uac1_status_word {
  464. __u8 bStatusType;
  465. __u8 bOriginator;
  466. } __attribute__((packed));
  467. #endif /* _UAPI__LINUX_USB_AUDIO_H */