]>
Commit | Line | Data |
---|---|---|
7e847894 DM |
1 | /* |
2 | * Copyright (c) 2010 Daniel Mack <daniel@caiaq.de> | |
3 | * | |
4 | * This software is distributed under the terms of the GNU General Public | |
5 | * License ("GPL") version 2, as published by the Free Software Foundation. | |
6 | * | |
7 | * This file holds USB constants and structures defined | |
8 | * by the USB Device Class Definition for Audio Devices in version 2.0. | |
9 | * Comments below reference relevant sections of the documents contained | |
10 | * in http://www.usb.org/developers/devclass_docs/Audio2.0_final.zip | |
11 | */ | |
12 | ||
13 | #ifndef __LINUX_USB_AUDIO_V2_H | |
14 | #define __LINUX_USB_AUDIO_V2_H | |
15 | ||
16 | #include <linux/types.h> | |
17 | ||
18 | /* v1.0 and v2.0 of this standard have many things in common. For the rest | |
19 | * of the definitions, please refer to audio.h */ | |
20 | ||
dcbe7bcf DM |
21 | static inline bool uac2_control_is_readable(u32 bmControls, u8 control) |
22 | { | |
23 | return (bmControls >> (control * 2)) & 0x1; | |
24 | } | |
25 | ||
26 | static inline bool uac2_control_is_writeable(u32 bmControls, u8 control) | |
27 | { | |
28 | return (bmControls >> (control * 2)) & 0x2; | |
29 | } | |
30 | ||
7e847894 DM |
31 | /* 4.7.2.1 Clock Source Descriptor */ |
32 | ||
33 | struct uac_clock_source_descriptor { | |
34 | __u8 bLength; | |
35 | __u8 bDescriptorType; | |
36 | __u8 bDescriptorSubtype; | |
37 | __u8 bClockID; | |
38 | __u8 bmAttributes; | |
39 | __u8 bmControls; | |
40 | __u8 bAssocTerminal; | |
41 | __u8 iClockSource; | |
42 | } __attribute__((packed)); | |
43 | ||
44 | /* 4.7.2.2 Clock Source Descriptor */ | |
45 | ||
46 | struct uac_clock_selector_descriptor { | |
47 | __u8 bLength; | |
48 | __u8 bDescriptorType; | |
49 | __u8 bDescriptorSubtype; | |
50 | __u8 bClockID; | |
51 | __u8 bNrInPins; | |
52 | __u8 bmControls; | |
53 | __u8 baCSourceID[]; | |
54 | } __attribute__((packed)); | |
55 | ||
23caaf19 DM |
56 | /* 4.7.2.4 Input terminal descriptor */ |
57 | ||
58 | struct uac2_input_terminal_descriptor { | |
59 | __u8 bLength; | |
60 | __u8 bDescriptorType; | |
61 | __u8 bDescriptorSubtype; | |
62 | __u8 bTerminalID; | |
63 | __u16 wTerminalType; | |
64 | __u8 bAssocTerminal; | |
65 | __u8 bCSourceID; | |
66 | __u8 bNrChannels; | |
67 | __u32 bmChannelConfig; | |
68 | __u8 iChannelNames; | |
69 | __u16 bmControls; | |
70 | __u8 iTerminal; | |
71 | } __attribute__((packed)); | |
72 | ||
73 | /* 4.7.2.5 Output terminal descriptor */ | |
74 | ||
75 | struct uac2_output_terminal_descriptor { | |
76 | __u8 bLength; | |
77 | __u8 bDescriptorType; | |
78 | __u8 bDescriptorSubtype; | |
79 | __u8 bTerminalID; | |
80 | __u16 wTerminalType; | |
81 | __u8 bAssocTerminal; | |
82 | __u8 bSourceID; | |
83 | __u8 bCSourceID; | |
84 | __u16 bmControls; | |
85 | __u8 iTerminal; | |
86 | } __attribute__((packed)); | |
87 | ||
88 | ||
89 | ||
90 | /* 4.7.2.8 Feature Unit Descriptor */ | |
91 | ||
92 | struct uac2_feature_unit_descriptor { | |
93 | __u8 bLength; | |
94 | __u8 bDescriptorType; | |
95 | __u8 bDescriptorSubtype; | |
96 | __u8 bUnitID; | |
97 | __u8 bSourceID; | |
98 | /* bmaControls is actually u32, | |
99 | * but u8 is needed for the hybrid parser */ | |
100 | __u8 bmaControls[0]; /* variable length */ | |
101 | } __attribute__((packed)); | |
102 | ||
7e847894 DM |
103 | /* 4.9.2 Class-Specific AS Interface Descriptor */ |
104 | ||
105 | struct uac_as_header_descriptor_v2 { | |
106 | __u8 bLength; | |
107 | __u8 bDescriptorType; | |
108 | __u8 bDescriptorSubtype; | |
109 | __u8 bTerminalLink; | |
110 | __u8 bmControls; | |
111 | __u8 bFormatType; | |
112 | __u32 bmFormats; | |
113 | __u8 bNrChannels; | |
114 | __u32 bmChannelConfig; | |
115 | __u8 iChannelNames; | |
116 | } __attribute__((packed)); | |
117 | ||
43b8e3bc DM |
118 | /* 4.10.1.2 Class-Specific AS Isochronous Audio Data Endpoint Descriptor */ |
119 | ||
120 | struct uac2_iso_endpoint_descriptor { | |
121 | __u8 bLength; /* in bytes: 8 */ | |
122 | __u8 bDescriptorType; /* USB_DT_CS_ENDPOINT */ | |
123 | __u8 bDescriptorSubtype; /* EP_GENERAL */ | |
124 | __u8 bmAttributes; | |
125 | __u8 bmControls; | |
126 | __u8 bLockDelayUnits; | |
127 | __le16 wLockDelay; | |
128 | } __attribute__((packed)); | |
129 | ||
130 | #define UAC2_CONTROL_PITCH (3 << 0) | |
131 | #define UAC2_CONTROL_DATA_OVERRUN (3 << 2) | |
132 | #define UAC2_CONTROL_DATA_UNDERRUN (3 << 4) | |
133 | ||
e213e9cf DM |
134 | /* 6.1 Interrupt Data Message */ |
135 | ||
136 | #define UAC2_INTERRUPT_DATA_MSG_VENDOR (1 << 0) | |
137 | #define UAC2_INTERRUPT_DATA_MSG_EP (1 << 1) | |
138 | ||
139 | struct uac2_interrupt_data_msg { | |
140 | __u8 bInfo; | |
141 | __u8 bAttribute; | |
142 | __le16 wValue; | |
143 | __le16 wIndex; | |
144 | } __attribute__((packed)); | |
7e847894 DM |
145 | |
146 | /* A.7 Audio Function Category Codes */ | |
147 | #define UAC2_FUNCTION_SUBCLASS_UNDEFINED 0x00 | |
148 | #define UAC2_FUNCTION_DESKTOP_SPEAKER 0x01 | |
149 | #define UAC2_FUNCTION_HOME_THEATER 0x02 | |
150 | #define UAC2_FUNCTION_MICROPHONE 0x03 | |
151 | #define UAC2_FUNCTION_HEADSET 0x04 | |
152 | #define UAC2_FUNCTION_TELEPHONE 0x05 | |
153 | #define UAC2_FUNCTION_CONVERTER 0x06 | |
154 | #define UAC2_FUNCTION_SOUND_RECORDER 0x07 | |
155 | #define UAC2_FUNCTION_IO_BOX 0x08 | |
156 | #define UAC2_FUNCTION_MUSICAL_INSTRUMENT 0x09 | |
157 | #define UAC2_FUNCTION_PRO_AUDIO 0x0a | |
158 | #define UAC2_FUNCTION_AUDIO_VIDEO 0x0b | |
159 | #define UAC2_FUNCTION_CONTROL_PANEL 0x0c | |
160 | #define UAC2_FUNCTION_OTHER 0xff | |
161 | ||
162 | /* A.9 Audio Class-Specific AC Interface Descriptor Subtypes */ | |
163 | /* see audio.h for the rest, which is identical to v1 */ | |
164 | #define UAC2_EFFECT_UNIT 0x07 | |
165 | #define UAC2_PROCESSING_UNIT_V2 0x08 | |
166 | #define UAC2_EXTENSION_UNIT_V2 0x09 | |
167 | #define UAC2_CLOCK_SOURCE 0x0a | |
168 | #define UAC2_CLOCK_SELECTOR 0x0b | |
169 | #define UAC2_CLOCK_MULTIPLIER 0x0c | |
170 | #define UAC2_SAMPLE_RATE_CONVERTER 0x0d | |
171 | ||
172 | /* A.10 Audio Class-Specific AS Interface Descriptor Subtypes */ | |
173 | /* see audio.h for the rest, which is identical to v1 */ | |
174 | #define UAC2_ENCODER 0x03 | |
175 | #define UAC2_DECODER 0x04 | |
176 | ||
177 | /* A.11 Effect Unit Effect Types */ | |
178 | #define UAC2_EFFECT_UNDEFINED 0x00 | |
179 | #define UAC2_EFFECT_PARAM_EQ 0x01 | |
180 | #define UAC2_EFFECT_REVERB 0x02 | |
181 | #define UAC2_EFFECT_MOD_DELAY 0x03 | |
182 | #define UAC2_EFFECT_DYN_RANGE_COMP 0x04 | |
183 | ||
184 | /* A.12 Processing Unit Process Types */ | |
185 | #define UAC2_PROCESS_UNDEFINED 0x00 | |
186 | #define UAC2_PROCESS_UP_DOWNMIX 0x01 | |
187 | #define UAC2_PROCESS_DOLBY_PROLOCIC 0x02 | |
188 | #define UAC2_PROCESS_STEREO_EXTENDER 0x03 | |
189 | ||
190 | /* A.14 Audio Class-Specific Request Codes */ | |
191 | #define UAC2_CS_CUR 0x01 | |
192 | #define UAC2_CS_RANGE 0x02 | |
e213e9cf | 193 | #define UAC2_CS_MEM 0x03 |
7e847894 DM |
194 | |
195 | /* A.15 Encoder Type Codes */ | |
196 | #define UAC2_ENCODER_UNDEFINED 0x00 | |
197 | #define UAC2_ENCODER_OTHER 0x01 | |
198 | #define UAC2_ENCODER_MPEG 0x02 | |
199 | #define UAC2_ENCODER_AC3 0x03 | |
200 | #define UAC2_ENCODER_WMA 0x04 | |
201 | #define UAC2_ENCODER_DTS 0x05 | |
202 | ||
203 | /* A.16 Decoder Type Codes */ | |
204 | #define UAC2_DECODER_UNDEFINED 0x00 | |
205 | #define UAC2_DECODER_OTHER 0x01 | |
206 | #define UAC2_DECODER_MPEG 0x02 | |
207 | #define UAC2_DECODER_AC3 0x03 | |
208 | #define UAC2_DECODER_WMA 0x04 | |
209 | #define UAC2_DECODER_DTS 0x05 | |
210 | ||
211 | /* A.17.1 Clock Source Control Selectors */ | |
212 | #define UAC2_CS_UNDEFINED 0x00 | |
213 | #define UAC2_CS_CONTROL_SAM_FREQ 0x01 | |
214 | #define UAC2_CS_CONTROL_CLOCK_VALID 0x02 | |
215 | ||
216 | /* A.17.2 Clock Selector Control Selectors */ | |
217 | #define UAC2_CX_UNDEFINED 0x00 | |
218 | #define UAC2_CX_CLOCK_SELECTOR 0x01 | |
219 | ||
220 | /* A.17.3 Clock Multiplier Control Selectors */ | |
221 | #define UAC2_CM_UNDEFINED 0x00 | |
222 | #define UAC2_CM_NUMERATOR 0x01 | |
223 | #define UAC2_CM_DENOMINTATOR 0x02 | |
224 | ||
225 | /* A.17.4 Terminal Control Selectors */ | |
226 | #define UAC2_TE_UNDEFINED 0x00 | |
227 | #define UAC2_TE_COPY_PROTECT 0x01 | |
228 | #define UAC2_TE_CONNECTOR 0x02 | |
229 | #define UAC2_TE_OVERLOAD 0x03 | |
230 | #define UAC2_TE_CLUSTER 0x04 | |
231 | #define UAC2_TE_UNDERFLOW 0x05 | |
232 | #define UAC2_TE_OVERFLOW 0x06 | |
233 | #define UAC2_TE_LATENCY 0x07 | |
234 | ||
235 | /* A.17.5 Mixer Control Selectors */ | |
236 | #define UAC2_MU_UNDEFINED 0x00 | |
237 | #define UAC2_MU_MIXER 0x01 | |
238 | #define UAC2_MU_CLUSTER 0x02 | |
239 | #define UAC2_MU_UNDERFLOW 0x03 | |
240 | #define UAC2_MU_OVERFLOW 0x04 | |
241 | #define UAC2_MU_LATENCY 0x05 | |
242 | ||
243 | /* A.17.6 Selector Control Selectors */ | |
244 | #define UAC2_SU_UNDEFINED 0x00 | |
245 | #define UAC2_SU_SELECTOR 0x01 | |
246 | #define UAC2_SU_LATENCY 0x02 | |
247 | ||
248 | /* A.17.7 Feature Unit Control Selectors */ | |
249 | /* see audio.h for the rest, which is identical to v1 */ | |
250 | #define UAC2_FU_INPUT_GAIN 0x0b | |
251 | #define UAC2_FU_INPUT_GAIN_PAD 0x0c | |
252 | #define UAC2_FU_PHASE_INVERTER 0x0d | |
253 | #define UAC2_FU_UNDERFLOW 0x0e | |
254 | #define UAC2_FU_OVERFLOW 0x0f | |
255 | #define UAC2_FU_LATENCY 0x10 | |
256 | ||
257 | /* A.17.8.1 Parametric Equalizer Section Effect Unit Control Selectors */ | |
258 | #define UAC2_PE_UNDEFINED 0x00 | |
259 | #define UAC2_PE_ENABLE 0x01 | |
260 | #define UAC2_PE_CENTERFREQ 0x02 | |
261 | #define UAC2_PE_QFACTOR 0x03 | |
262 | #define UAC2_PE_GAIN 0x04 | |
263 | #define UAC2_PE_UNDERFLOW 0x05 | |
264 | #define UAC2_PE_OVERFLOW 0x06 | |
265 | #define UAC2_PE_LATENCY 0x07 | |
266 | ||
267 | /* A.17.8.2 Reverberation Effect Unit Control Selectors */ | |
268 | #define UAC2_RV_UNDEFINED 0x00 | |
269 | #define UAC2_RV_ENABLE 0x01 | |
270 | #define UAC2_RV_TYPE 0x02 | |
271 | #define UAC2_RV_LEVEL 0x03 | |
272 | #define UAC2_RV_TIME 0x04 | |
273 | #define UAC2_RV_FEEDBACK 0x05 | |
274 | #define UAC2_RV_PREDELAY 0x06 | |
275 | #define UAC2_RV_DENSITY 0x07 | |
276 | #define UAC2_RV_HIFREQ_ROLLOFF 0x08 | |
277 | #define UAC2_RV_UNDERFLOW 0x09 | |
278 | #define UAC2_RV_OVERFLOW 0x0a | |
279 | #define UAC2_RV_LATENCY 0x0b | |
280 | ||
281 | /* A.17.8.3 Modulation Delay Effect Control Selectors */ | |
282 | #define UAC2_MD_UNDEFINED 0x00 | |
283 | #define UAC2_MD_ENABLE 0x01 | |
284 | #define UAC2_MD_BALANCE 0x02 | |
285 | #define UAC2_MD_RATE 0x03 | |
286 | #define UAC2_MD_DEPTH 0x04 | |
287 | #define UAC2_MD_TIME 0x05 | |
288 | #define UAC2_MD_FEEDBACK 0x06 | |
289 | #define UAC2_MD_UNDERFLOW 0x07 | |
290 | #define UAC2_MD_OVERFLOW 0x08 | |
291 | #define UAC2_MD_LATENCY 0x09 | |
292 | ||
293 | /* A.17.8.4 Dynamic Range Compressor Effect Unit Control Selectors */ | |
294 | #define UAC2_DR_UNDEFINED 0x00 | |
295 | #define UAC2_DR_ENABLE 0x01 | |
296 | #define UAC2_DR_COMPRESSION_RATE 0x02 | |
297 | #define UAC2_DR_MAXAMPL 0x03 | |
298 | #define UAC2_DR_THRESHOLD 0x04 | |
299 | #define UAC2_DR_ATTACK_TIME 0x05 | |
300 | #define UAC2_DR_RELEASE_TIME 0x06 | |
301 | #define UAC2_DR_UNDEFLOW 0x07 | |
302 | #define UAC2_DR_OVERFLOW 0x08 | |
303 | #define UAC2_DR_LATENCY 0x09 | |
304 | ||
305 | /* A.17.9.1 Up/Down-mix Processing Unit Control Selectors */ | |
306 | #define UAC2_UD_UNDEFINED 0x00 | |
307 | #define UAC2_UD_ENABLE 0x01 | |
308 | #define UAC2_UD_MODE_SELECT 0x02 | |
309 | #define UAC2_UD_CLUSTER 0x03 | |
310 | #define UAC2_UD_UNDERFLOW 0x04 | |
311 | #define UAC2_UD_OVERFLOW 0x05 | |
312 | #define UAC2_UD_LATENCY 0x06 | |
313 | ||
314 | /* A.17.9.2 Dolby Prologic[tm] Processing Unit Control Selectors */ | |
315 | #define UAC2_DP_UNDEFINED 0x00 | |
316 | #define UAC2_DP_ENABLE 0x01 | |
317 | #define UAC2_DP_MODE_SELECT 0x02 | |
318 | #define UAC2_DP_CLUSTER 0x03 | |
319 | #define UAC2_DP_UNDERFFLOW 0x04 | |
320 | #define UAC2_DP_OVERFLOW 0x05 | |
321 | #define UAC2_DP_LATENCY 0x06 | |
322 | ||
323 | /* A.17.9.3 Stereo Expander Processing Unit Control Selectors */ | |
324 | #define UAC2_ST_EXT_UNDEFINED 0x00 | |
325 | #define UAC2_ST_EXT_ENABLE 0x01 | |
326 | #define UAC2_ST_EXT_WIDTH 0x02 | |
327 | #define UAC2_ST_EXT_UNDEFLOW 0x03 | |
328 | #define UAC2_ST_EXT_OVERFLOW 0x04 | |
329 | #define UAC2_ST_EXT_LATENCY 0x05 | |
330 | ||
331 | /* A.17.10 Extension Unit Control Selectors */ | |
332 | #define UAC2_XU_UNDEFINED 0x00 | |
333 | #define UAC2_XU_ENABLE 0x01 | |
334 | #define UAC2_XU_CLUSTER 0x02 | |
335 | #define UAC2_XU_UNDERFLOW 0x03 | |
336 | #define UAC2_XU_OVERFLOW 0x04 | |
337 | #define UAC2_XU_LATENCY 0x05 | |
338 | ||
339 | /* A.17.11 AudioStreaming Interface Control Selectors */ | |
340 | #define UAC2_AS_UNDEFINED 0x00 | |
341 | #define UAC2_AS_ACT_ALT_SETTING 0x01 | |
342 | #define UAC2_AS_VAL_ALT_SETTINGS 0x02 | |
343 | #define UAC2_AS_AUDIO_DATA_FORMAT 0x03 | |
344 | ||
345 | /* A.17.12 Encoder Control Selectors */ | |
346 | #define UAC2_EN_UNDEFINED 0x00 | |
347 | #define UAC2_EN_BIT_RATE 0x01 | |
348 | #define UAC2_EN_QUALITY 0x02 | |
349 | #define UAC2_EN_VBR 0x03 | |
350 | #define UAC2_EN_TYPE 0x04 | |
351 | #define UAC2_EN_UNDERFLOW 0x05 | |
352 | #define UAC2_EN_OVERFLOW 0x06 | |
353 | #define UAC2_EN_ENCODER_ERROR 0x07 | |
354 | #define UAC2_EN_PARAM1 0x08 | |
355 | #define UAC2_EN_PARAM2 0x09 | |
356 | #define UAC2_EN_PARAM3 0x0a | |
357 | #define UAC2_EN_PARAM4 0x0b | |
358 | #define UAC2_EN_PARAM5 0x0c | |
359 | #define UAC2_EN_PARAM6 0x0d | |
360 | #define UAC2_EN_PARAM7 0x0e | |
361 | #define UAC2_EN_PARAM8 0x0f | |
362 | ||
363 | /* A.17.13.1 MPEG Decoder Control Selectors */ | |
364 | #define UAC2_MPEG_UNDEFINED 0x00 | |
365 | #define UAC2_MPEG_DUAL_CHANNEL 0x01 | |
366 | #define UAC2_MPEG_SECOND_STEREO 0x02 | |
367 | #define UAC2_MPEG_MULTILINGUAL 0x03 | |
368 | #define UAC2_MPEG_DYN_RANGE 0x04 | |
369 | #define UAC2_MPEG_SCALING 0x05 | |
370 | #define UAC2_MPEG_HILO_SCALING 0x06 | |
371 | #define UAC2_MPEG_UNDERFLOW 0x07 | |
372 | #define UAC2_MPEG_OVERFLOW 0x08 | |
373 | #define UAC2_MPEG_DECODER_ERROR 0x09 | |
374 | ||
375 | /* A17.13.2 AC3 Decoder Control Selectors */ | |
376 | #define UAC2_AC3_UNDEFINED 0x00 | |
377 | #define UAC2_AC3_MODE 0x01 | |
378 | #define UAC2_AC3_DYN_RANGE 0x02 | |
379 | #define UAC2_AC3_SCALING 0x03 | |
380 | #define UAC2_AC3_HILO_SCALING 0x04 | |
381 | #define UAC2_AC3_UNDERFLOW 0x05 | |
382 | #define UAC2_AC3_OVERFLOW 0x06 | |
383 | #define UAC2_AC3_DECODER_ERROR 0x07 | |
384 | ||
385 | /* A17.13.3 WMA Decoder Control Selectors */ | |
386 | #define UAC2_WMA_UNDEFINED 0x00 | |
387 | #define UAC2_WMA_UNDERFLOW 0x01 | |
388 | #define UAC2_WMA_OVERFLOW 0x02 | |
389 | #define UAC2_WMA_DECODER_ERROR 0x03 | |
390 | ||
391 | /* A17.13.4 DTS Decoder Control Selectors */ | |
392 | #define UAC2_DTS_UNDEFINED 0x00 | |
393 | #define UAC2_DTS_UNDERFLOW 0x01 | |
394 | #define UAC2_DTS_OVERFLOW 0x02 | |
395 | #define UAC2_DTS_DECODER_ERROR 0x03 | |
396 | ||
397 | /* A17.14 Endpoint Control Selectors */ | |
398 | #define UAC2_EP_CS_UNDEFINED 0x00 | |
399 | #define UAC2_EP_CS_PITCH 0x01 | |
400 | #define UAC2_EP_CS_DATA_OVERRUN 0x02 | |
401 | #define UAC2_EP_CS_DATA_UNDERRUN 0x03 | |
402 | ||
403 | #endif /* __LINUX_USB_AUDIO_V2_H */ | |
404 |