21 #ifndef _UAPI__LINUX_USB_AUDIO_H
22 #define _UAPI__LINUX_USB_AUDIO_H
24 #include <linux/types.h>
27 #define UAC_VERSION_1 0x00
28 #define UAC_VERSION_2 0x20
31 #define USB_SUBCLASS_AUDIOCONTROL 0x01
32 #define USB_SUBCLASS_AUDIOSTREAMING 0x02
33 #define USB_SUBCLASS_MIDISTREAMING 0x03
36 #define UAC_HEADER 0x01
37 #define UAC_INPUT_TERMINAL 0x02
38 #define UAC_OUTPUT_TERMINAL 0x03
39 #define UAC_MIXER_UNIT 0x04
40 #define UAC_SELECTOR_UNIT 0x05
41 #define UAC_FEATURE_UNIT 0x06
42 #define UAC1_PROCESSING_UNIT 0x07
43 #define UAC1_EXTENSION_UNIT 0x08
46 #define UAC_AS_GENERAL 0x01
47 #define UAC_FORMAT_TYPE 0x02
48 #define UAC_FORMAT_SPECIFIC 0x03
51 #define UAC_PROCESS_UNDEFINED 0x00
52 #define UAC_PROCESS_UP_DOWNMIX 0x01
53 #define UAC_PROCESS_DOLBY_PROLOGIC 0x02
54 #define UAC_PROCESS_STEREO_EXTENDER 0x03
55 #define UAC_PROCESS_REVERB 0x04
56 #define UAC_PROCESS_CHORUS 0x05
57 #define UAC_PROCESS_DYN_RANGE_COMP 0x06
60 #define UAC_EP_GENERAL 0x01
72 #define UAC_SET_CUR (UAC_SET_ | UAC__CUR)
73 #define UAC_GET_CUR (UAC_GET_ | UAC__CUR)
74 #define UAC_SET_MIN (UAC_SET_ | UAC__MIN)
75 #define UAC_GET_MIN (UAC_GET_ | UAC__MIN)
76 #define UAC_SET_MAX (UAC_SET_ | UAC__MAX)
77 #define UAC_GET_MAX (UAC_GET_ | UAC__MAX)
78 #define UAC_SET_RES (UAC_SET_ | UAC__RES)
79 #define UAC_GET_RES (UAC_GET_ | UAC__RES)
80 #define UAC_SET_MEM (UAC_SET_ | UAC__MEM)
81 #define UAC_GET_MEM (UAC_GET_ | UAC__MEM)
83 #define UAC_GET_STAT 0xff
88 #define UAC_TERM_COPY_PROTECT 0x01
91 #define UAC_FU_MUTE 0x01
92 #define UAC_FU_VOLUME 0x02
93 #define UAC_FU_BASS 0x03
94 #define UAC_FU_MID 0x04
95 #define UAC_FU_TREBLE 0x05
96 #define UAC_FU_GRAPHIC_EQUALIZER 0x06
97 #define UAC_FU_AUTOMATIC_GAIN 0x07
98 #define UAC_FU_DELAY 0x08
99 #define UAC_FU_BASS_BOOST 0x09
100 #define UAC_FU_LOUDNESS 0x0a
102 #define UAC_CONTROL_BIT(CS) (1 << ((CS) - 1))
105 #define UAC_UD_ENABLE 0x01
106 #define UAC_UD_MODE_SELECT 0x02
109 #define UAC_DP_ENABLE 0x01
110 #define UAC_DP_MODE_SELECT 0x02
113 #define UAC_3D_ENABLE 0x01
114 #define UAC_3D_SPACE 0x02
117 #define UAC_REVERB_ENABLE 0x01
118 #define UAC_REVERB_LEVEL 0x02
119 #define UAC_REVERB_TIME 0x03
120 #define UAC_REVERB_FEEDBACK 0x04
123 #define UAC_CHORUS_ENABLE 0x01
124 #define UAC_CHORUS_LEVEL 0x02
125 #define UAC_CHORUS_RATE 0x03
126 #define UAC_CHORUS_DEPTH 0x04
129 #define UAC_DCR_ENABLE 0x01
130 #define UAC_DCR_RATE 0x02
131 #define UAC_DCR_MAXAMPL 0x03
132 #define UAC_DCR_THRESHOLD 0x04
133 #define UAC_DCR_ATTACK_TIME 0x05
134 #define UAC_DCR_RELEASE_TIME 0x06
137 #define UAC_XU_ENABLE 0x01
140 #define UAC_MS_HEADER 0x01
141 #define UAC_MIDI_IN_JACK 0x02
142 #define UAC_MIDI_OUT_JACK 0x03
145 #define UAC_MS_GENERAL 0x01
148 #define UAC_TERMINAL_UNDEFINED 0x100
149 #define UAC_TERMINAL_STREAMING 0x101
150 #define UAC_TERMINAL_VENDOR_SPEC 0x1FF
164 #define UAC_DT_AC_HEADER_SIZE(n) (8 + (n))
167 #define DECLARE_UAC_AC_HEADER_DESCRIPTOR(n) \
168 struct uac1_ac_header_descriptor_##n { \
170 __u8 bDescriptorType; \
171 __u8 bDescriptorSubtype; \
173 __le16 wTotalLength; \
174 __u8 bInCollection; \
175 __u8 baInterfaceNr[n]; \
176 } __attribute__ ((packed))
192 #define UAC_DT_INPUT_TERMINAL_SIZE 12
195 #define UAC_INPUT_TERMINAL_UNDEFINED 0x200
196 #define UAC_INPUT_TERMINAL_MICROPHONE 0x201
197 #define UAC_INPUT_TERMINAL_DESKTOP_MICROPHONE 0x202
198 #define UAC_INPUT_TERMINAL_PERSONAL_MICROPHONE 0x203
199 #define UAC_INPUT_TERMINAL_OMNI_DIR_MICROPHONE 0x204
200 #define UAC_INPUT_TERMINAL_MICROPHONE_ARRAY 0x205
201 #define UAC_INPUT_TERMINAL_PROC_MICROPHONE_ARRAY 0x206
205 #define UAC_TERMINAL_CS_COPY_PROTECT_CONTROL 0x01
219 #define UAC_DT_OUTPUT_TERMINAL_SIZE 9
222 #define UAC_OUTPUT_TERMINAL_UNDEFINED 0x300
223 #define UAC_OUTPUT_TERMINAL_SPEAKER 0x301
224 #define UAC_OUTPUT_TERMINAL_HEADPHONES 0x302
225 #define UAC_OUTPUT_TERMINAL_HEAD_MOUNTED_DISPLAY_AUDIO 0x303
226 #define UAC_OUTPUT_TERMINAL_DESKTOP_SPEAKER 0x304
227 #define UAC_OUTPUT_TERMINAL_ROOM_SPEAKER 0x305
228 #define UAC_OUTPUT_TERMINAL_COMMUNICATION_SPEAKER 0x306
229 #define UAC_OUTPUT_TERMINAL_LOW_FREQ_EFFECTS_SPEAKER 0x307
232 #define UAC_DT_FEATURE_UNIT_SIZE(ch) (7 + ((ch) + 1) * 2)
235 #define DECLARE_UAC_FEATURE_UNIT_DESCRIPTOR(ch) \
236 struct uac_feature_unit_descriptor_##ch { \
238 __u8 bDescriptorType; \
239 __u8 bDescriptorSubtype; \
243 __le16 bmaControls[ch + 1]; \
245 } __attribute__ ((packed))
386 __u8 control_size = uac_processing_unit_bControlSize(desc, protocol);
393 __u8 control_size = uac_processing_unit_bControlSize(desc, protocol);
407 #define UAC_DT_AS_HEADER_SIZE 7
410 #define UAC_FORMAT_TYPE_I_UNDEFINED 0x0
411 #define UAC_FORMAT_TYPE_I_PCM 0x1
412 #define UAC_FORMAT_TYPE_I_PCM8 0x2
413 #define UAC_FORMAT_TYPE_I_IEEE_FLOAT 0x3
414 #define UAC_FORMAT_TYPE_I_ALAW 0x4
415 #define UAC_FORMAT_TYPE_I_MULAW 0x5
430 #define UAC_FORMAT_TYPE_I_CONTINUOUS_DESC_SIZE 14
444 #define DECLARE_UAC_FORMAT_TYPE_I_DISCRETE_DESC(n) \
445 struct uac_format_type_i_discrete_descriptor_##n { \
447 __u8 bDescriptorType; \
448 __u8 bDescriptorSubtype; \
451 __u8 bSubframeSize; \
452 __u8 bBitResolution; \
454 __u8 tSamFreq[n][3]; \
455 } __attribute__ ((packed))
457 #define UAC_FORMAT_TYPE_I_DISCRETE_DESC_SIZE(n) (8 + (n * 3))
473 #define UAC_FORMAT_TYPE_II_MPEG 0x1001
474 #define UAC_FORMAT_TYPE_II_AC3 0x1002
499 #define UAC_FORMAT_TYPE_III_IEC1937_AC3 0x2001
500 #define UAC_FORMAT_TYPE_III_IEC1937_MPEG1_LAYER1 0x2002
501 #define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_NOEXT 0x2003
502 #define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_EXT 0x2004
503 #define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_LAYER1_LS 0x2005
504 #define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_LAYER23_LS 0x2006
507 #define UAC_FORMAT_TYPE_UNDEFINED 0x0
508 #define UAC_FORMAT_TYPE_I 0x1
509 #define UAC_FORMAT_TYPE_II 0x2
510 #define UAC_FORMAT_TYPE_III 0x3
511 #define UAC_EXT_FORMAT_TYPE_I 0x81
512 #define UAC_EXT_FORMAT_TYPE_II 0x82
513 #define UAC_EXT_FORMAT_TYPE_III 0x83
523 #define UAC_ISO_ENDPOINT_DESC_SIZE 7
525 #define UAC_EP_CS_ATTR_SAMPLE_RATE 0x01
526 #define UAC_EP_CS_ATTR_PITCH_CONTROL 0x02
527 #define UAC_EP_CS_ATTR_FILL_MAX 0x80
531 #define UAC1_STATUS_TYPE_ORIG_MASK 0x0f
532 #define UAC1_STATUS_TYPE_ORIG_AUDIO_CONTROL_IF 0x0
533 #define UAC1_STATUS_TYPE_ORIG_AUDIO_STREAM_IF 0x1
534 #define UAC1_STATUS_TYPE_ORIG_AUDIO_STREAM_EP 0x2
536 #define UAC1_STATUS_TYPE_IRQ_PENDING (1 << 7)
537 #define UAC1_STATUS_TYPE_MEM_CHANGED (1 << 6)