1/* 	Copyright 2000 Be Incorporated. All Rights Reserved.
2**	This file may be used under the terms of the Be Sample Code
3**	License.
4*/
5
6#ifndef _USB_AUDIO_H_
7#define _USB_AUDIO_H_
8
9/* See: Universal Serial Bus Device Class Definition for Audio Devices, Release 1.0 */
10
11
12/* A.1 Audio Interface Class Code */
13#define AC_AUDIO 0x01
14
15/* A.2 Audio Interface Subclass Codes */
16#define AC_SUBCLASS_UNDEFINED 0x00
17#define AC_AUDIOCONTROL 0x01
18#define AC_AUDIOSTREAMING 0x02
19#define AC_MIDISTREAMING 0x03
20
21/* A.3 Audio Interface Protocol Codes */
22#define AC_PR_PROTOCOL_UNDEFINED 0x00
23
24/* A.4 Audio Class-Specific Descriptor Types */
25#define AC_CS_UNDEFINED 0x20
26#define AC_CS_DEVICE 0x21
27#define AC_CS_CONFIGURATION 0x22
28#define AC_CS_STRING 0x23
29#define AC_CS_INTERFACE 0x24
30#define AC_CS_ENDPOINT 0x25
31
32/* A.5 Audio Class-Specific AC Interface Descriptor Subtypes */
33#define AC_AC_DESCRIPTOR_UNDEFINED 0x00
34#define AC_HEADER 0x01
35#define AC_INPUT_TERMINAL 0x02
36#define AC_OUTPUT_TERMINAL 0x03
37#define AC_MIXER_UNIT 0x04
38#define AC_SELECTOR_UNIT 0x05
39#define AC_FEATURE_UNIT 0x06
40#define AC_PROCESSING_UNIT 0x07
41#define AC_EXTENSION_UNIT 0x08
42
43/* A.6 Audio Class-Specific AS Interface Descriptor Subtypes */
44#define AC_AS_DESCRIPTOR_UNDEFINED 0x00
45#define AC_AS_GENERAL 0x01
46#define AC_FORMAT_TYPE 0x02
47#define AC_FORMAT_SPECIFIC 0x03
48
49/* A.7 Processing Unit Process Types */
50#define AC_PROCESS_UNDEFINED 0x00
51#define AC_UPDOWNMIX_PROCESS 0x01
52#define AC_DOLBY_PROLOGIC_PROCESS 0x02
53#define AC_3D_STEREO_EXTENDER_PROCESS 0x03
54#define AC_REVERBERATION_PROCESS 0x04
55#define AC_CHORUS_PROCESS 0x05
56#define AC_DYN_RANGE_COMP_PROCESS 0x07
57
58/* A.8 Audio Class-Specific Endpoint Descriptor Subtypes */
59#define AC_DESCRIPTOR_UNDEFINED 0x00
60#define AC_EP_GENERAL 0x01
61
62/* A.9 Audio Class-Specific Request Codes */
63#define AC_REQUEST_CODE_UNDEFINED 0x00
64#define AC_SET_CUR 0x01
65#define AC_GET_CUR 0x81
66#define AC_SET_MIN 0x02
67#define AC_GET_MIN 0x82
68#define AC_SET_MAX 0x03
69#define AC_GET_MAX 0x83
70#define AC_SET_RES 0x04
71#define AC_GET_RES 0x84
72#define AC_SET_MEM 0x05
73#define AC_GET_MEM 0x85
74#define AC_GET_STAT 0xFF
75
76/* A.10.1 Terminal Control Selectors */
77#define AC_TE_CONTROL_UNDEFINED 0x00
78#define AC_COPY_PROTECT_CONTROL 0x01
79
80/* A.10.2 Feature Unit Control Selectors */
81#define AC_FU_CONTROL_UNDEFINED 0x00
82#define AC_MUTE_CONTROL 0x01
83#define AC_VOLUME_CONTROL 0x02
84#define AC_BASS_CONTROL 0x03
85#define AC_MID_CONTROL 0x04
86#define AC_TREBLE_CONTROL 0x05
87#define AC_GRAPHIC_EQUALIZER_CONTROL 0x06
88#define AC_AUTOMATIC_GAIN_CONTROL 0x07
89#define AC_DELAY_CONTROL 0x08
90#define AC_BASS_BOOST_CONTROL 0x09
91#define AC_LOUDNESS_CONTROL 0x0A
92
93/* A.10.3.1 Up/Down-mix Processing Unit Control Selectors */
94#define AC_UD_CONTROL_UNDEFINED 0x00
95#define AC_UD_ENABLED_CONTROL 0x01
96#define AC_UD_MODE_SELECT_CONTROL 0x02
97
98/* A.10.3.2 Dolby Prologic(tm) Processing Unit Control Selectors */
99#define AC_DP_CONTROL_UNDEFINED 0x00
100#define AC_DP_ENABLE_CONTROL 0x01
101#define AC_DP_MODE_SELECT_CONTROL 0x02
102
103/* A.10.3.3 3D Stereo Extender Processing Unit Control Selectors */
104#define AC_3D_CONTROL_UNDEFINED 0x00
105#define AC_3D_ENABLED_CONTROL 0x01
106#define AC_3D_SPACIOUSNESS_CONTROL 0x03
107
108/* A.10.3.4 Reverberation Processing Unit Control Selectors */
109#define AC_RV_CONTROL_UNDEFINED 0x00
110#define AC_RV_ENABLE_CONTROL 0x01
111#define AC_RV_REVERB_LEVEL_CONTROL 0x02
112#define AC_RV_REVERB_TIME_CONTROL 0x03
113#define AC_RV_REVERB_FEEDBACK_CONTROL 0x04
114
115/* A.10.3.5 Chorus Processing Unit Control Selectors */
116#define AC_CH_CONTROL_UNDEFINED 0x00
117#define AC_CH_ENABLE_CONTROL 0x01
118#define AC_CHORUS_LEVEL_CONTROL 0x02
119#define AC_CHORUS_RATE_CONTROL 0x03
120#define AC_CHORUS_DETH_CONTROL 0x04
121
122/* A.10.3.6 Dynamic Range Compressor Processing Unit Control Selectors */
123#define AC_DR_CONTROL_UNDEFINED 0x00
124#define AC_DR_ENABLE_CONTROL 0x01
125#define AC_COMPRESSION_RATE_CONTROL 0x02
126#define AC_MAXAMPL_CONTROL 0x03
127#define AC_THRESHOLD_CONTROL 0x04
128#define AC_ATTACK_TIME 0x05
129#define AC_RELEASE_TIME 0x06
130
131/* A.10.4 Extension Unit Control Selectors */
132#define AC_XU_CONTROL_UNDEFINED 0x00
133#define AC_XU_ENABLE_CONTROL 0x01
134
135/* A.10.5 Endpoint Control Selectors */
136#define AC_EP_CONTROL_UNDEFINED 0x00
137#define AC_SAMPLING_FREQ_CONTROL 0x01
138#define AC_PITCH_CONTROL 0x02
139
140typedef struct
141{
142	uint8 length;
143	uint8 type;
144	uint8 subtype;
145	uint8 unit_id;
146	uint8 source_id;
147	uint8 control_size;
148	uint16 controls[0];
149} _PACKED usb_feature_unit_descr;
150
151typedef struct
152{
153	uint8 length;
154	uint8 type;
155	uint8 subtype;
156	uint8 format_type;
157	uint8 num_channels;
158	uint8 subframe_size;
159	uint8 bit_resolution;
160	uint8 sample_freq_type;
161	uint8 lower_sample_freq[3];
162	uint8 upper_sample_freq[3];
163} _PACKED usb_format_type_descr;
164
165#endif
166