4 // (Partial) USB Device Class Definition for Audio Devices
5 // R1: Release 1.0 March 18, 1998
6 // R2: Release 2.0 May 31, 2006
8 #include <SupportDefs.h>
10 #define USB_AUDIO_DEVICE_CLASS 0x01
11 #define USB_AUDIO_CLASS_VERSION 0x0100
14 USB_AUDIO_INTERFACE_AUDIO_CLASS
= 0x01
17 enum { // Audio Interface Subclasses
18 USB_AUDIO_INTERFACE_UNDEFINED_SUBCLASS
= 0x00,
19 USB_AUDIO_INTERFACE_AUDIOCONTROL_SUBCLASS
= 0x01,
20 USB_AUDIO_INTERFACE_AUDIOSTREAMING_SUBCLASS
,
21 USB_AUDIO_INTERFACE_MIDISTREAMING_SUBCLASS
24 enum { // Audio Interface Protocol Codes
25 USB_AUDIO_PROTOCOL_UNDEFINED
= 0x00
28 enum { // Audio Interface Class-Specific Descriptor Types
29 USB_AUDIO_CS_UNDEFINED
= 0x20,
30 USB_AUDIO_CS_DEVICE
= 0x21,
31 USB_AUDIO_CS_CONFIGURATION
= 0x22,
32 USB_AUDIO_CS_STRING
= 0x23,
33 USB_AUDIO_CS_INTERFACE
= 0x24,
34 USB_AUDIO_CS_ENDPOINT
= 0x25
38 enum { // Audio Class-Specific AudioControl Interface descriptor subtypes
39 USB_AUDIO_AC_DESCRIPTOR_UNDEFINED
= 0x00,
40 USB_AUDIO_AC_HEADER
= 0x01,
41 USB_AUDIO_AC_INPUT_TERMINAL
= 0x02,
42 USB_AUDIO_AC_OUTPUT_TERMINAL
= 0x03,
43 USB_AUDIO_AC_MIXER_UNIT
= 0x04,
44 USB_AUDIO_AC_SELECTOR_UNIT
= 0x05,
45 USB_AUDIO_AC_FEATURE_UNIT
= 0x06,
46 USB_AUDIO_AC_PROCESSING_UNIT
= 0x07,
47 USB_AUDIO_AC_EXTENSION_UNIT
= 0x08,
48 USB_AUDIO_AC_EFFECT_UNIT_R2
= 0x07,
49 USB_AUDIO_AC_PROCESSING_UNIT_R2
= 0x08,
50 USB_AUDIO_AC_EXTENSION_UNIT_R2
= 0x09,
51 USB_AUDIO_AC_CLOCK_SOURCE_R2
= 0x0A,
52 USB_AUDIO_AC_CLOCK_SELECTOR_R2
= 0x0B,
53 USB_AUDIO_AC_CLOCK_MULTIPLIER_R2
= 0x0C,
54 USB_AUDIO_AC_SAMPLE_RATE_CONVERTER_R2
= 0x0D
58 // Class Specific Audio Control Interface Header
59 // R1: Table 4-2 p.37 / R2: Table 4-5 p.48
62 uint8 descriptor_type
; // USB_AUDIO_CS_INTERFACE
63 uint8 descriptor_subtype
; // USB_AUDIO_AC_HEADER
64 uint16 bcd_release_no
;
69 uint8 interface_numbers
[0];
73 uint8 function_category
;
78 } _PACKED usb_audiocontrol_header_descriptor
;
81 // Input Terminal Descriptor
82 // R1: Table 4-3 p.39 / R2: Table 4-9, page 53
85 uint8 descriptor_type
; // USB_AUDIO_CS_INTERFACE
86 uint8 descriptor_subtype
; // USB_AUDIO_AC_INPUT_TERMINAL
99 uint8 clock_source_id
;
101 uint32 channel_config
;
107 } _PACKED usb_audio_input_terminal_descriptor
;
110 // Output Terminal Descriptor
111 // R1: Table 4-4 p.40 / R2: Table 4-10, page 54
114 uint8 descriptor_type
; // USB_AUDIO_CS_INTERFACE
115 uint8 descriptor_subtype
; // USB_AUDIO_AC_OUTPUT_TERMINAL
117 uint16 terminal_type
;
118 uint8 assoc_terminal
;
126 uint8 clock_source_id
;
131 } _PACKED usb_audio_output_terminal_descriptor
;
134 // pseudo-descriptor for a section corresponding to logical output channels
135 // used in mixer, processing and extension descriptions.
137 uint8 num_output_pins
; // number of mixer output pins
138 uint16 channel_config
; // location of logical channels
139 uint8 channel_names
; // id of name string of first logical channel
140 } _PACKED usb_audio_output_channels_descriptor_r1
;
143 uint8 num_output_pins
; // number of mixer output pins
144 uint32 channel_config
; // location of logical channels
145 uint8 channel_names
; // id of name string of first logical channel
146 } _PACKED usb_audio_output_channels_descriptor
;
149 // Mixer Unit Descriptor
150 // R1: Table 4-5 p.41 / R2: Table 4-11, page 57
153 uint8 descriptor_type
; // USB_AUDIO_CS_INTERFACE
154 uint8 descriptor_subtype
; // USB_AUDIO_AC_MIXER_UNIT
156 uint8 num_input_pins
;
158 // use usb_audio_output_channels_descriptor to parse the rest
159 } _PACKED usb_audio_mixer_unit_descriptor
;
162 // Selector Unit Descriptor
163 // R1: Table 4-6 p.43 / R2: Table 4-12, page 58
166 uint8 descriptor_type
; // USB_AUDIO_CS_INTERFACE
167 uint8 descriptor_subtype
; // USB_AUDIO_AC_SELECTOR_UNIT
169 uint8 num_input_pins
;
171 // uint8 selector_string;
172 } _PACKED usb_audio_selector_unit_descriptor
;
175 // Feature Unit Descriptor
176 // R1: Table 4-7 p.43 / R2: Table 4-13, page 59
179 uint8 descriptor_type
; // USB_AUDIO_CS_INTERFACE
180 uint8 descriptor_subtype
; // USB_AUDIO_AC_FEATURE_UNIT
186 uint8 bma_controls
[1];
187 // uint8 feature_string;
191 uint32 bma_controls
[1];
192 // uint8 feature_string;
195 } _PACKED usb_audio_feature_unit_descriptor
;
198 // Processing Unit Descriptor
199 // R1: Table 4-8 p.45 / R2: Table 4-20, page 66
202 uint8 descriptor_type
; // USB_AUDIO_CS_INTERFACE
203 uint8 descriptor_subtype
; // USB_AUDIO_AC_PROCESSING_UNIT
206 uint8 num_input_pins
;
208 // use usb_audio_output_channels_descriptor to parse the rest
209 // TODO - the bmControl!!!!
210 } _PACKED usb_audio_processing_unit_descriptor
;
212 // Extension Unit Descriptor
213 // R1: Table 4-15, p. 56 / R2: Table 4-24, p.73
216 uint8 descriptor_type
; // USB_AUDIO_CS_INTERFACE
217 uint8 descriptor_subtype
; // USB_AUDIO_AC_EXTENSION_UNIT
219 uint16 extension_code
;
220 uint8 num_input_pins
;
222 // use usb_audio_output_channels_descriptor to parse the rest
223 } _PACKED usb_audio_extension_unit_descriptor
;
226 enum { // Audio Class-Specific AudioStreaming Interface descriptor subtypes
227 USB_AUDIO_AS_DESCRIPTOR_UNDEFINED
= 0x00,
228 USB_AUDIO_AS_GENERAL
= 0x01,
229 USB_AUDIO_AS_FORMAT_TYPE
= 0x02,
230 USB_AUDIO_AS_FORMAT_SPECIFIC
= 0x03
233 // Class Specific Audio Streaming Interface Descriptor
234 // R1: Table 4-19 p.60 / R2: Table 4-27 p.76
237 uint8 descriptor_type
; // USB_AUDIO_CS_INTERFACE
238 uint8 descriptor_subtype
; // USB_AUDIO_AS_GENERAL
250 uint8 num_output_pins
;
251 uint32 channel_config
;
255 } _PACKED usb_audio_streaming_interface_descriptor
;
258 // Class-specific As Isochronous Audio Data Endpoint descriptor
259 // R1: Table 4-21, p. 62 / R2: Table 4-34, page 87
262 uint8 descriptor_type
; // USB_AUDIO_CS_ENDPOINT
263 uint8 descriptor_subtype
; // USB_AUDIO_EP_GENERAL
265 uint8 lock_delay_units
;
267 } _PACKED usb_audio_streaming_endpoint_descriptor
;
270 // Sampling Rate are represented as 3-byte integer
273 } _PACKED usb_audio_sampling_freq
;
276 // Format Type I/II/III Descriptors
277 // T1: Table 2-1, p.10 etc.
278 // T2: Table 2-2, p.15 etc.
281 uint8 descriptor_type
; // USB_AUDIO_CS_INTERFACE
282 uint8 descriptor_subtype
; // USB_AUDIO_AS_FORMAT_TYPE
283 uint8 format_type
; // USB_AUDIO_FORMAT_TYPE_I/II/III
288 uint8 bit_resolution
;
290 usb_audio_sampling_freq sam_freqs
[1];
295 uint16 samples_per_frame
;
297 usb_audio_sampling_freq sam_freqs
[1];
303 uint8 bit_resolution
;
305 usb_audio_sampling_freq sam_freqs
[1];
308 } _PACKED usb_audio_format_descriptor
;
311 enum { // Processing Unit Process Types (for USB_AUDIO_AC_PROCESSING_UNIT)
312 USB_AUDIO_UPDOWNMIX_PROCESS
= 0x01,
313 USB_AUDIO_DOLBY_PROLOGIC_PROCESS
,
314 USB_AUDIO_3D_STEREO_EXTENDER_PROCESS
,
315 USB_AUDIO_REVERBERATION_PROCESS
,
316 USB_AUDIO_CHORUS_PROCESS
,
317 USB_AUDIO_DYN_RANGE_COMP_PROCESS
320 enum { // Audio Class-Specific Request Codes
321 USB_AUDIO_SET_CUR
= 0x01,
322 USB_AUDIO_GET_CUR
= 0x81,
323 USB_AUDIO_SET_MIN
= 0x02,
324 USB_AUDIO_GET_MIN
= 0x82,
325 USB_AUDIO_SET_MAX
= 0x03,
326 USB_AUDIO_GET_MAX
= 0x83,
327 USB_AUDIO_SET_RES
= 0x04,
328 USB_AUDIO_GET_RES
= 0x84,
329 USB_AUDIO_SET_MEM
= 0x05,
330 USB_AUDIO_GET_MEM
= 0x85,
331 USB_AUDIO_GET_STATUS
= 0xFF
334 enum { // Terminal Control Selectors
335 USB_AUDIO_COPY_PROTECT_CONTROL
= 0x01
338 // R2: A.17.5 Mixer Unit Control Selectors
340 USB_AUDIO_MU_CONTROL_UNDEFINED
= 0x00,
341 USB_AUDIO_MIXER_CONTROL
= 0x01,
342 USB_AUDIO_CLUSTER_CONTROL
= 0x02,
343 USB_AUDIO_UNDERFLOW_CONTROL
= 0x03,
344 USB_AUDIO_OVERFLOW_CONTROL
= 0x04,
345 USB_AUDIO_LATENCY_CONTROL
= 0x05
348 /* A.10.2 Feature Unit Control Selectors */
350 USB_AUDIO_AC_FU_CONTROL_UNDEFINED
= 0x00,
351 USB_AUDIO_MUTE_CONTROL
= 0x01,
352 USB_AUDIO_VOLUME_CONTROL
= 0x02,
353 USB_AUDIO_BASS_CONTROL
= 0x03,
354 USB_AUDIO_MID_CONTROL
= 0x04,
355 USB_AUDIO_TREBLE_CONTROL
= 0x05,
356 USB_AUDIO_GRAPHIC_EQUALIZER_CONTROL
= 0x06,
357 USB_AUDIO_AUTOMATIC_GAIN_CONTROL
= 0x07,
358 USB_AUDIO_DELAY_CONTROL
= 0x08,
359 USB_AUDIO_BASS_BOOST_CONTROL
= 0x09,
360 USB_AUDIO_LOUDNESS_CONTROL
= 0x0A
363 /* A.10.3.1 Up/Down-mix Processing Unit Control Selectors */
364 #define USB_AUDIO_UD_CONTROL_UNDEFINED 0x00
365 #define USB_AUDIO_UD_ENABLED_CONTROL 0x01
366 #define USB_AUDIO_UD_MODE_SELECT_CONTROL 0x02
368 /* A.10.3.2 Dolby Prologic(tm) Processing Unit Control Selectors */
369 #define USB_AUDIO_DP_CONTROL_UNDEFINED 0x00
370 #define USB_AUDIO_DP_ENABLE_CONTROL 0x01
371 #define USB_AUDIO_DP_MODE_SELECT_CONTROL 0x02
373 /* A.10.3.3 3D Stereo Extender Processing Unit Control Selectors */
374 #define USB_AUDIO_3D_CONTROL_UNDEFINED 0x00
375 #define USB_AUDIO_3D_ENABLED_CONTROL 0x01
376 #define USB_AUDIO_3D_SPACIOUSNESS_CONTROL 0x03
378 /* A.10.3.4 Reverberation Processing Unit Control Selectors */
379 #define USB_AUDIO_RV_CONTROL_UNDEFINED 0x00
380 #define USB_AUDIO_RV_ENABLE_CONTROL 0x01
381 #define USB_AUDIO_RV_REVERB_LEVEL_CONTROL 0x02
382 #define USB_AUDIO_RV_REVERB_TIME_CONTROL 0x03
383 #define USB_AUDIO_RV_REVERB_FEEDBACK_CONTROL 0x04
385 /* A.10.3.5 Chorus Processing Unit Control Selectors */
386 #define USB_AUDIO_CH_CONTROL_UNDEFINED 0x00
387 #define USB_AUDIO_CH_ENABLE_CONTROL 0x01
388 #define USB_AUDIO_CHORUS_LEVEL_CONTROL 0x02
389 #define USB_AUDIO_CHORUS_RATE_CONTROL 0x03
390 #define USB_AUDIO_CHORUS_DETH_CONTROL 0x04
392 /* A.10.3.6 Dynamic Range Compressor Processing Unit Control Selectors */
393 #define USB_AUDIO_DR_CONTROL_UNDEFINED 0x00
394 #define USB_AUDIO_DR_ENABLE_CONTROL 0x01
395 #define USB_AUDIO_COMPRESSION_RATE_CONTROL 0x02
396 #define USB_AUDIO_MAXAMPL_CONTROL 0x03
397 #define USB_AUDIO_THRESHOLD_CONTROL 0x04
398 #define USB_AUDIO_ATTACK_TIME 0x05
399 #define USB_AUDIO_RELEASE_TIME 0x06
401 /* A.10.4 Extension Unit Control Selectors */
402 #define USB_AUDIO_XU_CONTROL_UNDEFINED 0x00
403 #define USB_AUDIO_XU_ENABLE_CONTROL 0x01
405 /* A.10.5 Endpoint Control Selectors */
407 USB_AUDIO_EP_CONTROL_UNDEFINED
= 0x00,
408 USB_AUDIO_SAMPLING_FREQ_CONTROL
= 0x01,
409 USB_AUDIO_PITCH_CONTROL
= 0x02
422 } _PACKED usb_audio_feature_unit_descriptor;
431 uint8 bit_resolution;
432 uint8 sample_freq_type;
433 uint8 sample_freq[3]; // [0] + [1] << 8 + [2] << 16
434 // if sample_freq_type != 1,
435 // (sample_freq_type - 1) x uint8 sample_freq[3] follows...
436 } _PACKED usb_audio_format_type_descriptor;
438 // bitset for feature control bitmap
439 // Table 4-7, page 44, bmaControls field
441 BMA_CTL_MUTE_R1
= 0X0001,
442 BMA_CTL_VOLUME_R1
= 0X0002,
443 BMA_CTL_BASS_R1
= 0X0004,
444 BMA_CTL_MID_R1
= 0X0008,
445 BMA_CTL_TREBLE_R1
= 0X0010,
446 BMA_CTL_GRAPHEQ_R1
= 0X0020,
447 BMA_CTL_AUTOGAIN_R1
= 0X0040,
448 BMA_CTL_DELAY_R1
= 0X0080,
449 BMA_CTL_BASSBOOST_R1
= 0X0100,
450 BMA_CTL_LOUDNESS_R1
= 0X0200,
452 BMA_CTL_MUTE
= 0X00000003,
453 BMA_CTL_VOLUME
= 0X0000000C,
454 BMA_CTL_BASS
= 0X00000030,
455 BMA_CTL_MID
= 0X000000C0,
456 BMA_CTL_TREBLE
= 0X00000300,
457 BMA_CTL_GRAPHEQ
= 0X00000C00,
458 BMA_CTL_AUTOGAIN
= 0X00003000,
459 BMA_CTL_DELAY
= 0X0000C000,
460 BMA_CTL_BASSBOOST
= 0X00030000,
461 BMA_CTL_LOUDNESS
= 0X000C0000,
462 BMA_CTL_INPUTGAIN
= 0X00300000,
463 BMA_CTL_INPUTGAINPAD
= 0X00C00000,
464 BMA_CTL_PHASEINVERTER
= 0X03000000,
465 BMA_CTL_UNDERFLOW
= 0X0C000000,
466 BMA_CTL_OVERFLOW
= 0X30000000
469 // Table A-4, page 30
472 USB_AUDIO_FORMAT_TYPE_UNDEFINED
= 0x00,
473 USB_AUDIO_FORMAT_TYPE_I
= 0x01,
474 USB_AUDIO_FORMAT_TYPE_II
= 0x02,
475 USB_AUDIO_FORMAT_TYPE_III
= 0x03
478 // Table A-1, page 29, wFormatTag
479 // Audio Data Format Type I codes
481 USB_AUDIO_FORMAT_TYPE_I_UNDEFINED
= 0x0000,
482 USB_AUDIO_FORMAT_PCM
= 0x0001,
483 USB_AUDIO_FORMAT_PCM8
= 0x0002,
484 USB_AUDIO_FORMAT_IEEE_FLOAT
= 0x0003,
485 USB_AUDIO_FORMAT_ALAW
= 0x0004,
486 USB_AUDIO_FORMAT_MULAW
= 0x0005
491 // USB Terminal Types
492 USB_AUDIO_UNDEFINED_USB_IO
= 0x100,
493 USB_AUDIO_STREAMING_USB_IO
= 0x101,
494 USB_AUDIO_VENDOR_USB_IO
= 0x1ff,
495 // Input Terminal Types
496 USB_AUDIO_UNDEFINED_IN
= 0x200,
497 USB_AUDIO_MICROPHONE_IN
= 0x201,
498 USB_AUDIO_DESKTOPMIC_IN
= 0x202,
499 USB_AUDIO_PERSONALMIC_IN
= 0x203,
500 USB_AUDIO_OMNI_MIC_IN
= 0x204,
501 USB_AUDIO_MICS_ARRAY_IN
= 0x205,
502 USB_AUDIO_PROC_MICS_ARRAY_IN
= 0x206,
503 // Output Terminal Types
504 USB_AUDIO_UNDEFINED_OUT
= 0x300,
505 USB_AUDIO_SPEAKER_OUT
= 0x301,
506 USB_AUDIO_HEAD_PHONES_OUT
= 0x302,
507 USB_AUDIO_HMD_AUDIO_OUT
= 0x303,
508 USB_AUDIO_DESKTOP_SPEAKER
= 0x304,
509 USB_AUDIO_ROOM_SPEAKER
= 0x305,
510 USB_AUDIO_COMM_SPEAKER
= 0x306,
511 USB_AUDIO_LFE_SPEAKER
= 0x307,
512 // Bi-directional Terminal Types
513 USB_AUDIO_UNDEFINED_IO
= 0x400,
514 USB_AUDIO_HANDSET_IO
= 0x401,
515 USB_AUDIO_HEADSET_IO
= 0x402,
516 USB_AUDIO_SPEAKER_PHONE_IO
= 0x403,
517 USB_AUDIO_SPEAKER_PHONEES_IO
= 0x404,
518 USB_AUDIO_SPEAKER_PHONEEC_IO
= 0x405,
519 // Telephony Terminal Types
520 USB_AUDIO_UNDEF_TELEPHONY_IO
= 0x500,
521 USB_AUDIO_PHONE_LINE_IO
= 0x501,
522 USB_AUDIO_TELEPHONE_IO
= 0x502,
523 USB_AUDIO_DOWNLINE_PHONE_IO
= 0x503,
524 // External Terminal Types
525 USB_AUDIO_UNDEFINEDEXT_IO
= 0x600,
526 USB_AUDIO_ANALOG_CONNECTOR_IO
= 0x601,
527 USB_AUDIO_DAINTERFACE_IO
= 0x602,
528 USB_AUDIO_LINE_CONNECTOR_IO
= 0x603,
529 USB_AUDIO_LEGACY_CONNECTOR_IO
= 0x604,
530 USB_AUDIO_SPDIF_INTERFACE_IO
= 0x605,
531 USB_AUDIO_DA1394_STREAM_IO
= 0x606,
532 USB_AUDIO_DV1394_STREAMSOUND_IO
= 0x607,
533 USB_AUDIO_ADAT_LIGHTPIPE_IO
= 0x608,
534 USB_AUDIO_TDIF_IO
= 0x609,
535 USB_AUDIO_MADI_IO
= 0x60a,
536 // Embedded Terminal Types
537 USB_AUDIO_UNDEF_EMBEDDED_IO
= 0x700,
538 USB_AUDIO_LC_NOISE_SOURCE_OUT
= 0x701,
539 USB_AUDIO_EQUALIZATION_NOISE_OUT
= 0x702,
540 USB_AUDIO_CDPLAYER_IN
= 0x703,
541 USB_AUDIO_DAT_IO
= 0x704,
542 USB_AUDIO_DCC_IO
= 0x705,
543 USB_AUDIO_MINI_DISK_IO
= 0x706,
544 USB_AUDIO_ANALOG_TAPE_IO
= 0x707,
545 USB_AUDIO_PHONOGRAPH_IN
= 0x708,
546 USB_AUDIO_VCR_AUDIO_IN
= 0x709,
547 USB_AUDIO_VIDEO_DISC_AUDIO_IN
= 0x70a,
548 USB_AUDIO_DVD_AUDIO_IN
= 0x70b,
549 USB_AUDIO_TV_TUNER_AUDIO_IN
= 0x70c,
550 USB_AUDIO_SAT_RECEIVER_AUDIO_IN
= 0x70d,
551 USB_AUDIO_CABLE_TUNER_AUDIO_IN
= 0x70e,
552 USB_AUDIO_DSS_AUDIO_IN
= 0x70f,
553 USB_AUDIO_RADIO_RECEIVER_IN
= 0x710,
554 USB_AUDIO_RADIO_TRANSMITTER_IN
= 0x711,
555 USB_AUDIO_MULTI_TRACK_RECORDER_IO
= 0x712,
556 USB_AUDIO_SYNTHESIZER_IO
= 0x713,
557 USB_AUDIO_PIANO_IO
= 0x714,
558 USB_AUDIO_GUITAR_IO
= 0x715,
559 USB_AUDIO_DRUMS_IO
= 0x716,
560 USB_AUDIO_INSTRUMENT_IO
= 0x717
564 #endif // USB_AUDIO_H