8#ifndef __INCLUDED_UAC_H__
9#define __INCLUDED_UAC_H__
19#define UAC_ERRMSG printf
21#define UAC_DBGMSG printf
23#define UAC_DBGMSG(...)
31 UAC_STATE_DISCONNECTING,
36#define SUBCLS_UNDEFINED 0x00
37#define SUBCLS_AUDIOCONTROL 0x01
38#define SUBCLS_AUDIOSTREAMING 0x02
39#define SUBCLS_MIDISTREAMING 0x03
42#define PR_PROTOCOL_UNDEFINED 0x00
45#define CS_UNDEFINED 0x20
47#define CS_CONFIGURATION 0x22
49#define CS_INTERFACE 0x24
50#define CS_ENDPOINT 0x25
53#define AC_DESCRIPTOR_UNDEFINED 0x00
55#define INPUT_TERMINAL 0x02
56#define OUTPUT_TERMINAL 0x03
57#define MIXER_UNIT 0x04
58#define SELECTOR_UNIT 0x05
59#define FEATURE_UNIT 0x06
60#define PROCESSING_UNIT 0x07
61#define EXTENSION_UNIT 0x08
64#define AS_DESCRIPTOR_UNDEFINED 0x00
65#define AS_GENERAL 0x01
66#define FORMAT_TYPE 0x02
67#define FORMAT_SPECIFIC 0x03
70#define PROCESS_UNDEFINED 0x00
71#define UP_DOWNMIX_PROCESS 0x01
72#define DOLBY_PROLOGIC_PROCESS 0x02
73#define _3D_STEREO_EXTENDER_PROCESS 0x03
74#define REVERBERATION_PROCESS 0x04
75#define CHORUS_PROCESS 0x05
76#define DYN_RANGE_COMP_PROCESS 0x06
79#define DESCRIPTOR_UNDEFINED 0x00
80#define EP_GENERAL 0x01
83#define REQUEST_CODE_UNDEFINED 0x00
97#define TE_CONTROL_UNDEFINED 0x00
98#define COPY_PROTECT_CONTROL 0x01
101#define FU_CONTROL_UNDEFINED 0x00
102#define MUTE_CONTROL 0x01
103#define VOLUME_CONTROL 0x02
104#define BASS_CONTROL 0x03
105#define MID_CONTROL 0x04
106#define TREBLE_CONTROL 0x05
107#define GRAPHIC_EQUALIZER_CONTROL 0x06
108#define AUTOMATIC_GAIN_CONTROL 0x07
109#define DELAY_CONTROL 0x08
110#define BASS_BOOST_CONTROL 0x09
111#define LOUDNESS_CONTROL 0x0A
114#define UD_CONTROL_UNDEFINED 0x00
115#define UD_ENABLE_CONTROL 0x01
116#define UD_MODE_SELECT_CONTROL 0x02
119#define DP_CONTROL_UNDEFINED 0x00
120#define DP_ENABLE_CONTROL 0x01
121#define DP_MODE_SELECT_CONTROL 0x02
124#define _3D_CONTROL_UNDEFINED 0x00
125#define _3D_ENABLE_CONTROL 0x01
126#define SPACIOUSNESS_CONTROL 0x03
129#define RV_CONTROL_UNDEFINED 0x00
130#define RV_ENABLE_CONTROL 0x01
131#define REVERB_LEVEL_CONTROL 0x02
132#define REVERB_TIME_CONTROL 0x03
133#define REVERB_FEEDBACK_CONTROL 0x04
136#define CH_CONTROL_UNDEFINED 0x00
137#define CH_ENABLE_CONTROL 0x01
138#define CHORUS_LEVEL_CONTROL 0x02
139#define CHORUS_RATE_CONTROL 0x03
140#define CHORUS_DEPTH_CONTROL 0x04
143#define DR_CONTROL_UNDEFINED 0x00
144#define DR_ENABLE_CONTROL 0x01
145#define COMPRESSION_RATE_CONTROL 0x02
146#define MAXAMPL_CONTROL 0x03
147#define THRESHOLD_CONTROL 0x04
148#define ATTACK_TIME 0x05
149#define RELEASE_TIME 0x06
152#define XU_CONTROL_UNDEFINED 0x00
153#define XU_ENABLE_CONTROL 0x01
156#define EP_CONTROL_UNDEFINED 0x00
157#define SAMPLING_FREQ_CONTROL 0x01
158#define PITCH_CONTROL 0x02
161#define FORMAT_TYPE_UNDEFINED 0x00
162#define FORMAT_TYPE_I 0x01
163#define FORMAT_TYPE_II 0x02
164#define FORMAT_TYPE_III 0x03
171typedef struct cs_hdr_t
173 __packed uint8_t bLength;
174 __packed uint8_t bDescriptorType;
175 __packed uint8_t bDescriptorSubtype;
181 uint8_t bDescriptorType;
182 uint8_t bDescriptorSubtype;
190typedef struct ac_if_header
192 __packed uint8_t bLength;
193 __packed uint8_t bDescriptorType;
194 __packed uint8_t bDescriptorSubtype;
195 __packed uint16_t bcdADC;
196 __packed uint16_t wTotalLength;
199 __packed uint8_t bInCollection;
206 uint8_t bDescriptorType;
207 uint8_t bDescriptorSubtype;
209 uint16_t wTotalLength;
212 uint8_t bInCollection;
221typedef struct ac_itd_t
223 __packed uint8_t bLength;
224 __packed uint8_t bDescriptorType;
225 __packed uint8_t bDescriptorSubtype;
226 __packed uint8_t bTerminalID;
227 __packed uint16_t wTerminalType;
228 __packed uint8_t bAssocTerminal;
229 __packed uint8_t bNrChannels;
230 __packed uint16_t wChannelConfig;
231 __packed uint8_t iChannelNames;
232 __packed uint8_t iTerminal;
238 uint8_t bDescriptorType;
239 uint8_t bDescriptorSubtype;
241 uint16_t wTerminalType;
242 uint8_t bAssocTerminal;
244 uint16_t wChannelConfig;
245 uint8_t iChannelNames;
254typedef struct ac_otd_t
256 __packed uint8_t bLength;
257 __packed uint8_t bDescriptorType;
258 __packed uint8_t bDescriptorSubtype;
259 __packed uint8_t bTerminalID;
260 __packed uint16_t wTerminalType;
261 __packed uint8_t bAssocTerminal;
262 __packed uint8_t bSourceID;
263 __packed uint8_t iTerminal;
269 uint8_t bDescriptorType;
270 uint8_t bDescriptorSubtype;
272 uint16_t wTerminalType;
273 uint8_t bAssocTerminal;
283#define UAC_TT_USB_UNDEFINED 0x0100
284#define UAC_TT_USB_STREAMING 0x0101
287#define UAC_TT_USB_VENDOR 0x01FF
290#define UAC_TT_INPUT_UNDEFINED 0x0200
291#define UAC_TT_MICROPHONE 0x0201
293#define UAC_TT_DESKTOP_MICROPHONE 0x0202
295#define UAC_TT_PERSONAL_MICROPHONE 0x0203
296#define UAC_TT_OMNI_MICROPHONE 0x0204
299#define UAC_TT_MICROPHONE_ARRAY 0x0205
303#define UAC_TT_OUTPUT_UNDEFINED 0x0300
304#define UAC_TT_SPEAKER 0x0301
307#define UAC_TT_HEADPHONES 0x0302
308#define UAC_TT_HEAD_MOUNTED 0x0303
313#define UAC_TT_DESKTOP_SPEAKER 0x0304
318#define UAC_TT_ROOM_SPEAKER 0x0305
320#define UAC_TT_COMM_SPEAKER 0x0306
322#define UAC_TT_LFE_SPEAKER 0x0307
330typedef struct ac_mxr_t
332 __packed uint8_t bLength;
333 __packed uint8_t bDescriptorType;
334 __packed uint8_t bDescriptorSubtype;
335 __packed uint8_t bUnitID;
336 __packed uint8_t bNrInPins;
342 uint8_t bDescriptorType;
343 uint8_t bDescriptorSubtype;
353typedef struct ac_su_t
355 __packed uint8_t bLength;
356 __packed uint8_t bDescriptorType;
357 __packed uint8_t bDescriptorSubtype;
358 __packed uint8_t bUnitID;
359 __packed uint8_t bNrInPins;
365 uint8_t bDescriptorType;
366 uint8_t bDescriptorSubtype;
376typedef struct ac_fu_t
378 __packed uint8_t bLength;
379 __packed uint8_t bDescriptorType;
380 __packed uint8_t bDescriptorSubtype;
381 __packed uint8_t bUnitID;
382 __packed uint8_t bSourceID;
383 __packed uint8_t bControlSize;
389 uint8_t bDescriptorType;
390 uint8_t bDescriptorSubtype;
393 uint8_t bControlSize;
398#define FU_CONTROL_UNDEFINED 0x00
399#define MUTE_CONTROL 0x01
400#define VOLUME_CONTROL 0x02
401#define BASS_CONTROL 0x03
402#define MID_CONTROL 0x04
403#define TREBLE_CONTROL 0x05
404#define GRAPHIC_EQUALIZER_CONTROL 0x06
405#define AUTOMATIC_GAIN_CONTROL 0x07
406#define DELAY_CONTROL 0x08
407#define BASS_BOOST_CONTROL 0x09
408#define LOUDNESS_CONTROL 0x0A
414typedef struct as_gen_t
416 __packed uint8_t bLength;
417 __packed uint8_t bDescriptorType;
418 __packed uint8_t bDescriptorSubtype;
419 __packed uint8_t bTerminalLink;
420 __packed uint8_t bDelay;
421 __packed uint16_t wFormatTag;
427 uint8_t bDescriptorType;
428 uint8_t bDescriptorSubtype;
429 uint8_t bTerminalLink;
439typedef struct ac_pu_t
441 __packed uint8_t bLength;
442 __packed uint8_t bDescriptorType;
443 __packed uint8_t bDescriptorSubtype;
444 __packed uint8_t bUnitID;
445 __packed uint16_t wProcessType;
446 __packed uint8_t bNrInPins;
452 uint8_t bDescriptorType;
453 uint8_t bDescriptorSubtype;
455 uint16_t wProcessType;
464typedef struct cs_ep_t
466 __packed uint8_t bLength;
467 __packed uint8_t bDescriptorType;
468 __packed uint8_t bDescriptorSubtype;
469 __packed uint8_t bmAttributes;
470 __packed uint8_t bLockDelayUnits;
471 __packed uint16_t wLockDelay;
477 uint8_t bDescriptorType;
478 uint8_t bDescriptorSubtype;
479 uint8_t bmAttributes;
480 uint8_t bLockDelayUnits;
489typedef struct ac_ft1_t
491 __packed uint8_t bLength;
492 __packed uint8_t bDescriptorType;
493 __packed uint8_t bDescriptorSubtype;
494 __packed uint8_t bFormatType;
495 __packed uint8_t bNrChannels;
496 __packed uint8_t bSubframeSize;
497 __packed uint8_t bBitResolution;
498 __packed uint8_t bSamFreqType;
499 __packed uint8_t tSamFreq[16][3];
505 uint8_t bDescriptorType;
506 uint8_t bDescriptorSubtype;
509 uint8_t bSubframeSize;
510 uint8_t bBitResolution;
511 uint8_t bSamFreqType;
512 uint8_t tSamFreq[16][3];
520typedef struct ac_ft2_t
522 __packed uint8_t bLength;
523 __packed uint8_t bDescriptorType;
524 __packed uint8_t bDescriptorSubtype;
525 __packed uint8_t bFormatType;
526 __packed uint16_t wMaxBitRate;
527 __packed uint16_t wSamplesPerFrame;
528 __packed uint8_t bSamFreqType;
534 uint8_t bDescriptorType;
535 uint8_t bDescriptorSubtype;
537 uint16_t wMaxBitRate;
538 uint16_t wSamplesPerFrame;
539 uint8_t bSamFreqType;
547typedef struct ac_ft3_t
549 __packed uint8_t bLength;
550 __packed uint8_t bDescriptorType;
551 __packed uint8_t bDescriptorSubtype;
552 __packed uint8_t bFormatType;
553 __packed uint8_t bNrChannels;
554 __packed uint8_t bSubframeSize;
555 __packed uint8_t bBitResolution;
556 __packed uint8_t bSamFreqType;
557 __packed uint8_t tLowerSamFreq[3];
558 __packed uint8_t tUpperSamFreq[3];
564 uint8_t bDescriptorType;
565 uint8_t bDescriptorSubtype;
568 uint8_t bSubframeSize;
569 uint8_t bBitResolution;
570 uint8_t bSamFreqType;
571 uint8_t tLowerSamFreq[3];
572 uint8_t tUpperSamFreq[3];
void *__dso_handle __attribute__((weak))