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;
187typedef struct ac_itd_t
189 __packed uint8_t bLength;
190 __packed uint8_t bDescriptorType;
191 __packed uint8_t bDescriptorSubtype;
192 __packed uint8_t bTerminalID;
193 __packed uint16_t wTerminalType;
194 __packed uint8_t bAssocTerminal;
195 __packed uint8_t bNrChannels;
196 __packed uint16_t wChannelConfig;
197 __packed uint8_t iChannelNames;
198 __packed uint8_t iTerminal;
204 uint8_t bDescriptorType;
205 uint8_t bDescriptorSubtype;
207 uint16_t wTerminalType;
208 uint8_t bAssocTerminal;
210 uint16_t wChannelConfig;
211 uint8_t iChannelNames;
220typedef struct ac_otd_t
222 __packed uint8_t bLength;
223 __packed uint8_t bDescriptorType;
224 __packed uint8_t bDescriptorSubtype;
225 __packed uint8_t bTerminalID;
226 __packed uint16_t wTerminalType;
227 __packed uint8_t bAssocTerminal;
228 __packed uint8_t bSourceID;
229 __packed uint8_t iTerminal;
235 uint8_t bDescriptorType;
236 uint8_t bDescriptorSubtype;
238 uint16_t wTerminalType;
239 uint8_t bAssocTerminal;
249#define UAC_TT_USB_UNDEFINED 0x0100
250#define UAC_TT_USB_STREAMING 0x0101
251#define UAC_TT_USB_VENDOR 0x01FF
253#define UAC_TT_INPUT_UNDEFINED 0x0200
254#define UAC_TT_MICROPHONE 0x0201
255#define UAC_TT_DESKTOP_MICROPHONE 0x0202
256#define UAC_TT_PERSONAL_MICROPHONE 0x0203
257#define UAC_TT_OMNI_MICROPHONE 0x0204
258#define UAC_TT_MICROPHONE_ARRAY 0x0205
260#define UAC_TT_OUTPUT_UNDEFINED 0x0300
261#define UAC_TT_SPEAKER 0x0301
262#define UAC_TT_HEADPHONES 0x0302
263#define UAC_TT_HEAD_MOUNTED 0x0303
264#define UAC_TT_DESKTOP_SPEAKER 0x0304
265#define UAC_TT_ROOM_SPEAKER 0x0305
266#define UAC_TT_COMM_SPEAKER 0x0306
267#define UAC_TT_LFE_SPEAKER 0x0307
274typedef struct ac_mxr_t
276 __packed uint8_t bLength;
277 __packed uint8_t bDescriptorType;
278 __packed uint8_t bDescriptorSubtype;
279 __packed uint8_t bUnitID;
280 __packed uint8_t bNrInPins;
286 uint8_t bDescriptorType;
287 uint8_t bDescriptorSubtype;
297typedef struct ac_su_t
299 __packed uint8_t bLength;
300 __packed uint8_t bDescriptorType;
301 __packed uint8_t bDescriptorSubtype;
302 __packed uint8_t bUnitID;
303 __packed uint8_t bNrInPins;
309 uint8_t bDescriptorType;
310 uint8_t bDescriptorSubtype;
320typedef struct ac_fu_t
322 __packed uint8_t bLength;
323 __packed uint8_t bDescriptorType;
324 __packed uint8_t bDescriptorSubtype;
325 __packed uint8_t bUnitID;
326 __packed uint8_t bSourceID;
327 __packed uint8_t bControlSize;
333 uint8_t bDescriptorType;
334 uint8_t bDescriptorSubtype;
337 uint8_t bControlSize;
342#define FU_CONTROL_UNDEFINED 0x00
343#define MUTE_CONTROL 0x01
344#define VOLUME_CONTROL 0x02
345#define BASS_CONTROL 0x03
346#define MID_CONTROL 0x04
347#define TREBLE_CONTROL 0x05
348#define GRAPHIC_EQUALIZER_CONTROL 0x06
349#define AUTOMATIC_GAIN_CONTROL 0x07
350#define DELAY_CONTROL 0x08
351#define BASS_BOOST_CONTROL 0x09
352#define LOUDNESS_CONTROL 0x0A
358typedef struct as_gen_t
360 __packed uint8_t bLength;
361 __packed uint8_t bDescriptorType;
362 __packed uint8_t bDescriptorSubtype;
363 __packed uint8_t bTerminalLink;
364 __packed uint8_t bDelay;
365 __packed uint16_t wFormatTag;
371 uint8_t bDescriptorType;
372 uint8_t bDescriptorSubtype;
373 uint8_t bTerminalLink;
383typedef struct ac_pu_t
385 __packed uint8_t bLength;
386 __packed uint8_t bDescriptorType;
387 __packed uint8_t bDescriptorSubtype;
388 __packed uint8_t bUnitID;
389 __packed uint16_t wProcessType;
390 __packed uint8_t bNrInPins;
396 uint8_t bDescriptorType;
397 uint8_t bDescriptorSubtype;
399 uint16_t wProcessType;
408typedef struct as_ep_t
410 __packed uint8_t bLength;
411 __packed uint8_t bDescriptorType;
412 __packed uint8_t bDescriptorSubtype;
413 __packed uint8_t bmAttributes;
414 __packed uint8_t bLockDelayUnits;
415 __packed uint16_t wLockDelay;
421 uint8_t bDescriptorType;
422 uint8_t bDescriptorSubtype;
423 uint8_t bmAttributes;
424 uint8_t bLockDelayUnits;
433typedef struct ac_ft1_t
435 __packed uint8_t bLength;
436 __packed uint8_t bDescriptorType;
437 __packed uint8_t bDescriptorSubtype;
438 __packed uint8_t bFormatType;
439 __packed uint8_t bNrChannels;
440 __packed uint8_t bSubframeSize;
441 __packed uint8_t bBitResolution;
442 __packed uint8_t bSamFreqType;
443 __packed uint8_t tSamFreq[16][3];
449 uint8_t bDescriptorType;
450 uint8_t bDescriptorSubtype;
453 uint8_t bSubframeSize;
454 uint8_t bBitResolution;
455 uint8_t bSamFreqType;
456 uint8_t tSamFreq[16][3];
464typedef struct ac_ft2_t
466 __packed uint8_t bLength;
467 __packed uint8_t bDescriptorType;
468 __packed uint8_t bDescriptorSubtype;
469 __packed uint8_t bFormatType;
470 __packed uint16_t wMaxBitRate;
471 __packed uint16_t wSamplesPerFrame;
472 __packed uint8_t bSamFreqType;
478 uint8_t bDescriptorType;
479 uint8_t bDescriptorSubtype;
481 uint16_t wMaxBitRate;
482 uint16_t wSamplesPerFrame;
483 uint8_t bSamFreqType;
491typedef struct ac_ft3_t
493 __packed uint8_t bLength;
494 __packed uint8_t bDescriptorType;
495 __packed uint8_t bDescriptorSubtype;
496 __packed uint8_t bFormatType;
497 __packed uint8_t bNrChannels;
498 __packed uint8_t bSubframeSize;
499 __packed uint8_t bBitResolution;
500 __packed uint8_t bSamFreqType;
501 __packed uint8_t tLowerSamFreq[3];
502 __packed uint8_t tUpperSamFreq[3];
508 uint8_t bDescriptorType;
509 uint8_t bDescriptorSubtype;
512 uint8_t bSubframeSize;
513 uint8_t bBitResolution;
514 uint8_t bSamFreqType;
515 uint8_t tLowerSamFreq[3];
516 uint8_t tUpperSamFreq[3];
520typedef struct uac_info_t
540 AC_IT_T *it_microphone;
548int 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.