1#ifndef __INCLUDED_UAC_H__
2#define __INCLUDED_UAC_H__
13#define USBAS_ERRMSG printf
16#define USBAS_DBGMSG printf
18#define USBAS_DBGMSG(...)
22#define UAC_IFACE_CODE 1
24#define SUBCLS_UNDEFINED 0x00
25#define SUBCLS_AUDIOCONTROL 0x01
26#define SUBCLS_AUDIOSTREAMING 0x02
27#define SUBCLS_MIDISTREAMING 0x03
30#define CS_UNDEFINED 0x20
32#define CS_CONFIGURATION 0x22
34#define CS_INTERFACE 0x24
35#define CS_ENDPOINT 0x25
38#define AC_DESCRIPTOR_UNDEFINED 0x00
40#define INPUT_TERMINAL 0x02
41#define OUTPUT_TERMINAL 0x03
42#define MIXER_UNIT 0x04
43#define SELECTOR_UNIT 0x05
44#define FEATURE_UNIT 0x06
45#define PROCESSING_UNIT 0x07
46#define EXTENSION_UNIT 0x08
49#define AS_DESCRIPTOR_UNDEFINED 0x00
50#define AS_GENERAL 0x01
51#define FORMAT_TYPE 0x02
52#define FORMAT_SPECIFIC 0x03
55#define PROCESS_UNDEFINED 0x00
56#define UP_DOWNMIX_PROCESS 0x01
57#define DOLBY_PROLOGIC_PROCESS 0x02
58#define _3D_STEREO_EXTENDER_PROCESS 0x03
59#define REVERBERATION_PROCESS 0x04
60#define CHORUS_PROCESS 0x05
61#define DYN_RANGE_COMP_PROCESS 0x06
64#define DESCRIPTOR_UNDEFINED 0x00
65#define EP_GENERAL 0x01
68#define REQUEST_CODE_UNDEFINED 0x00
82#define TE_CONTROL_UNDEFINED 0x00
83#define COPY_PROTECT_CONTROL 0x01
86#define FU_CONTROL_UNDEFINED 0x00
87#define MUTE_CONTROL 0x01
88#define VOLUME_CONTROL 0x02
89#define BASS_CONTROL 0x03
90#define MID_CONTROL 0x04
91#define TREBLE_CONTROL 0x05
92#define GRAPHIC_EQUALIZER_CONTROL 0x06
93#define AUTOMATIC_GAIN_CONTROL 0x07
94#define DELAY_CONTROL 0x08
95#define BASS_BOOST_CONTROL 0x09
96#define LOUDNESS_CONTROL 0x0A
99#define UD_CONTROL_UNDEFINED 0x00
100#define UD_ENABLE_CONTROL 0x01
101#define UD_MODE_SELECT_CONTROL 0x02
104#define DP_CONTROL_UNDEFINED 0x00
105#define DP_ENABLE_CONTROL 0x01
106#define DP_MODE_SELECT_CONTROL 0x02
109#define _3D_CONTROL_UNDEFINED 0x00
110#define _3D_ENABLE_CONTROL 0x01
111#define SPACIOUSNESS_CONTROL 0x03
114#define RV_CONTROL_UNDEFINED 0x00
115#define RV_ENABLE_CONTROL 0x01
116#define REVERB_LEVEL_CONTROL 0x02
117#define REVERB_TIME_CONTROL 0x03
118#define REVERB_FEEDBACK_CONTROL 0x04
121#define CH_CONTROL_UNDEFINED 0x00
122#define CH_ENABLE_CONTROL 0x01
123#define CHORUS_LEVEL_CONTROL 0x02
124#define CHORUS_RATE_CONTROL 0x03
125#define CHORUS_DEPTH_CONTROL 0x04
128#define DR_CONTROL_UNDEFINED 0x00
129#define DR_ENABLE_CONTROL 0x01
130#define COMPRESSION_RATE_CONTROL 0x02
131#define MAXAMPL_CONTROL 0x03
132#define THRESHOLD_CONTROL 0x04
133#define ATTACK_TIME 0x05
134#define RELEASE_TIME 0x06
137#define XU_CONTROL_UNDEFINED 0x00
138#define XU_ENABLE_CONTROL 0x01
141#define EP_CONTROL_UNDEFINED 0x00
142#define SAMPLING_FREQ_CONTROL 0x01
143#define PITCH_CONTROL 0x02
146#define FORMAT_TYPE_UNDEFINED 0x00
147#define FORMAT_TYPE_I 0x01
148#define FORMAT_TYPE_II 0x02
149#define FORMAT_TYPE_III 0x03
156typedef struct ac_if_header
158 __packed uint8_t bLength;
159 __packed uint8_t bDescriptorType;
160 __packed uint8_t bDescriptorSubtype;
161 __packed uint16_t bcdADC;
162 __packed uint16_t wTotalLength;
165 __packed uint8_t bInCollection;
172 uint8_t bDescriptorType;
173 uint8_t bDescriptorSubtype;
175 uint16_t wTotalLength;
178 uint8_t bInCollection;
188typedef struct ac_itd_t
190 __packed uint8_t bLength;
191 __packed uint8_t bDescriptorType;
192 __packed uint8_t bDescriptorSubtype;
193 __packed uint8_t bTerminalID;
194 __packed uint16_t wTerminalType;
195 __packed uint8_t bAssocTerminal;
196 __packed uint8_t bNrChannels;
197 __packed uint16_t wChannelConfig;
198 __packed uint8_t iChannelNames;
199 __packed uint8_t iTerminal;
205 uint8_t bDescriptorType;
206 uint8_t bDescriptorSubtype;
208 uint16_t wTerminalType;
209 uint8_t bAssocTerminal;
211 uint16_t wChannelConfig;
212 uint8_t iChannelNames;
222typedef struct ac_otd_t
224 __packed uint8_t bLength;
225 __packed uint8_t bDescriptorType;
226 __packed uint8_t bDescriptorSubtype;
227 __packed uint8_t bTerminalID;
228 __packed uint16_t wTerminalType;
229 __packed uint8_t bAssocTerminal;
230 __packed uint8_t bSourceID;
231 __packed uint8_t iTerminal;
237 uint8_t bDescriptorType;
238 uint8_t bDescriptorSubtype;
240 uint16_t wTerminalType;
241 uint8_t bAssocTerminal;
252#define UAC_TT_USB_UNDEFINED 0x0100
253#define UAC_TT_USB_STREAMING 0x0101
254#define UAC_TT_USB_VENDOR 0x01FF
256#define UAC_TT_INPUT_UNDEFINED 0x0200
257#define UAC_TT_MICROPHONE 0x0201
258#define UAC_TT_DESKTOP_MICROPHONE 0x0202
259#define UAC_TT_PERSONAL_MICROPHONE 0x0203
260#define UAC_TT_OMNI_MICROPHONE 0x0204
261#define UAC_TT_MICROPHONE_ARRAY 0x0205
263#define UAC_TT_OUTPUT_UNDEFINED 0x0300
264#define UAC_TT_SPEAKER 0x0301
265#define UAC_TT_HEADPHONES 0x0302
266#define UAC_TT_HEAD_MOUNTED 0x0303
267#define UAC_TT_DESKTOP_SPEAKER 0x0304
268#define UAC_TT_ROOM_SPEAKER 0x0305
269#define UAC_TT_COMM_SPEAKER 0x0306
270#define UAC_TT_LFE_SPEAKER 0x0307
277typedef struct ac_mxr_t
279 __packed uint8_t bLength;
280 __packed uint8_t bDescriptorType;
281 __packed uint8_t bDescriptorSubtype;
282 __packed uint8_t bUnitID;
283 __packed uint8_t bNrInPins;
289 uint8_t bDescriptorType;
290 uint8_t bDescriptorSubtype;
301typedef struct ac_su_t
303 __packed uint8_t bLength;
304 __packed uint8_t bDescriptorType;
305 __packed uint8_t bDescriptorSubtype;
306 __packed uint8_t bUnitID;
307 __packed uint8_t bNrInPins;
313 uint8_t bDescriptorType;
314 uint8_t bDescriptorSubtype;
325typedef struct ac_fu_t
327 __packed uint8_t bLength;
328 __packed uint8_t bDescriptorType;
329 __packed uint8_t bDescriptorSubtype;
330 __packed uint8_t bUnitID;
331 __packed uint8_t bSourceID;
332 __packed uint8_t bControlSize;
338 uint8_t bDescriptorType;
339 uint8_t bDescriptorSubtype;
342 uint8_t bControlSize;
348#define FU_CONTROL_UNDEFINED 0x00
349#define MUTE_CONTROL 0x01
350#define VOLUME_CONTROL 0x02
351#define BASS_CONTROL 0x03
352#define MID_CONTROL 0x04
353#define TREBLE_CONTROL 0x05
354#define GRAPHIC_EQUALIZER_CONTROL 0x06
355#define AUTOMATIC_GAIN_CONTROL 0x07
356#define DELAY_CONTROL 0x08
357#define BASS_BOOST_CONTROL 0x09
358#define LOUDNESS_CONTROL 0x0A
364typedef struct as_gen_t
366 __packed uint8_t bLength;
367 __packed uint8_t bDescriptorType;
368 __packed uint8_t bDescriptorSubtype;
369 __packed uint8_t bTerminalLink;
370 __packed uint8_t bDelay;
371 __packed uint16_t wFormatTag;
377 uint8_t bDescriptorType;
378 uint8_t bDescriptorSubtype;
379 uint8_t bTerminalLink;
390typedef struct ac_pu_t
392 __packed uint8_t bLength;
393 __packed uint8_t bDescriptorType;
394 __packed uint8_t bDescriptorSubtype;
395 __packed uint8_t bUnitID;
396 __packed uint16_t wProcessType;
397 __packed uint8_t bNrInPins;
403 uint8_t bDescriptorType;
404 uint8_t bDescriptorSubtype;
406 uint16_t wProcessType;
416typedef struct as_ep_t
418 __packed uint8_t bLength;
419 __packed uint8_t bDescriptorType;
420 __packed uint8_t bDescriptorSubtype;
421 __packed uint8_t bmAttributes;
422 __packed uint8_t bLockDelayUnits;
423 __packed uint16_t wLockDelay;
429 uint8_t bDescriptorType;
430 uint8_t bDescriptorSubtype;
431 uint8_t bmAttributes;
432 uint8_t bLockDelayUnits;
442typedef struct ac_ft1_t
444 __packed uint8_t bLength;
445 __packed uint8_t bDescriptorType;
446 __packed uint8_t bDescriptorSubtype;
447 __packed uint8_t bFormatType;
448 __packed uint8_t bNrChannels;
449 __packed uint8_t bSubframeSize;
450 __packed uint8_t bBitResolution;
451 __packed uint8_t bSamFreqType;
452 __packed uint8_t tSamFreq[16][3];
458 uint8_t bDescriptorType;
459 uint8_t bDescriptorSubtype;
462 uint8_t bSubframeSize;
463 uint8_t bBitResolution;
464 uint8_t bSamFreqType;
465 uint8_t tSamFreq[16][3];
474typedef struct ac_ft2_t
476 __packed uint8_t bLength;
477 __packed uint8_t bDescriptorType;
478 __packed uint8_t bDescriptorSubtype;
479 __packed uint8_t bFormatType;
480 __packed uint16_t wMaxBitRate;
481 __packed uint16_t wSamplesPerFrame;
482 __packed uint8_t bSamFreqType;
488 uint8_t bDescriptorType;
489 uint8_t bDescriptorSubtype;
491 uint16_t wMaxBitRate;
492 uint16_t wSamplesPerFrame;
493 uint8_t bSamFreqType;
502typedef struct ac_ft3_t
504 __packed uint8_t bLength;
505 __packed uint8_t bDescriptorType;
506 __packed uint8_t bDescriptorSubtype;
507 __packed uint8_t bFormatType;
508 __packed uint8_t bNrChannels;
509 __packed uint8_t bSubframeSize;
510 __packed uint8_t bBitResolution;
511 __packed uint8_t bSamFreqType;
512 __packed uint8_t tLowerSamFreq[3];
513 __packed uint8_t tUpperSamFreq[3];
519 uint8_t bDescriptorType;
520 uint8_t bDescriptorSubtype;
523 uint8_t bSubframeSize;
524 uint8_t bBitResolution;
525 uint8_t bSamFreqType;
526 uint8_t tLowerSamFreq[3];
527 uint8_t tUpperSamFreq[3];
532typedef struct uac_info_t
552 AC_IT_T *it_microphone;
560int uac_check_fu_ctrl(UAC_INFO_T *uac_info, uint8_t target,
int channel,
int control);
void *__dso_handle __attribute__((weak))
#define MAX_CFG_DESC_SIZE
USB Host core driver header file.