uaudioreg.h revision 1.3 1 /* $NetBSD: uaudioreg.h,v 1.3 2000/01/06 21:13:56 augustss Exp $ */
2
3 /*
4 * Copyright (c) 1999 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * Author: Lennart Augustsson <augustss (at) carlstedt.se>
8 * Carlstedt Research & Technology
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. All advertising materials mentioning features or use of this software
19 * must display the following acknowledgement:
20 * This product includes software developed by the NetBSD
21 * Foundation, Inc. and its contributors.
22 * 4. Neither the name of The NetBSD Foundation nor the names of its
23 * contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE.
37 */
38
39 #define UAUDIO_VERSION 0x100
40
41 #define UDESC_CS_DEVICE 0x21
42 #define UDESC_CS_CONFIG 0x22
43 #define UDESC_CS_STRING 0x23
44 #define UDESC_CS_INTERFACE 0x24
45 #define UDESC_CS_ENDPOINT 0x25
46
47 #define UDESCSUB_AC_HEADER 1
48 #define UDESCSUB_AC_INPUT 2
49 #define UDESCSUB_AC_OUTPUT 3
50 #define UDESCSUB_AC_MIXER 4
51 #define UDESCSUB_AC_SELECTOR 5
52 #define UDESCSUB_AC_FEATURE 6
53 #define UDESCSUB_AC_PROCESSING 7
54 #define UDESCSUB_AC_EXTENSION 8
55
56 /* The first fields are identical to usb_endpoint_descriptor_t */
57 typedef struct {
58 uByte bLength;
59 uByte bDescriptorType;
60 uByte bEndpointAddress;
61 uByte bmAttributes;
62 uWord wMaxPacketSize;
63 uByte bInterval;
64 /*
65 * The following two entries are only used by the Audio Class.
66 * And according to the specs the Audio Class is the only one
67 * allowed to extend the endpoint descriptor.
68 * Who knows what goes on in the minds of the people in the USB
69 * standardization? :-(
70 */
71 uByte bRefresh;
72 uByte bSynchAddress;
73 } usb_endpoint_descriptor_audio_t;
74
75 struct usb_audio_control_descriptor {
76 uByte bLength;
77 uByte bDescriptorType;
78 uByte bDescriptorSubtype;
79 uWord bcdADC;
80 uWord wTotalLength;
81 uByte bInCollection;
82 uByte baInterfaceNr[1];
83 };
84
85 struct usb_audio_streaming_interface_descriptor {
86 uByte bLength;
87 uByte bDescriptorType;
88 uByte bDescriptorSubtype;
89 uByte bTerminalLink;
90 uByte bDelay;
91 uWord wFormatTag;
92 };
93
94 struct usb_audio_streaming_endpoint_descriptor {
95 uByte bLength;
96 uByte bDescriptorType;
97 uByte bDescriptorSubtype;
98 uByte bmAttributes;
99 uByte bLockDelayUnits;
100 uWord wLockDelay;
101 };
102
103 struct usb_audio_streaming_type1_descriptor {
104 uByte bLength;
105 uByte bDescriptorType;
106 uByte bDescriptorSubtype;
107 uByte bFormatType;
108 uByte bNrChannels;
109 uByte bSubFrameSize;
110 uByte bBitResolution;
111 uByte bSamFreqType;
112 #define UA_SAMP_CONTNUOUS 0
113 uByte tSamFreq[3*2]; /* room for low and high */
114 #define UA_GETSAMP(p, n) ((p)->tSamFreq[(n)*3+0] | ((p)->tSamFreq[(n)*3+1] << 8) | ((p)->tSamFreq[(n)*3+2] << 16))
115 #define UA_SAMP_LO(p) UA_GETSAMP(p, 0)
116 #define UA_SAMP_HI(p) UA_GETSAMP(p, 1)
117 };
118
119 struct usb_audio_cluster {
120 uByte bNrChannels;
121 uWord wChannelConfig;
122 uByte iChannelNames;
123 };
124
125 /* UDESCSUB_AC_INPUT */
126 struct usb_audio_input_terminal {
127 uByte bLength;
128 uByte bDescriptorType;
129 uByte bDescriptorSubtype;
130 uByte bTerminalId;
131 uWord wTerminalType;
132 uByte bAssocTerminal;
133 uByte bNrChannels;
134 uWord wChannelConfig;
135 uByte iChannelNames;
136 uByte iTerminal;
137 };
138
139 /* UDESCSUB_AC_OUTPUT */
140 struct usb_audio_output_terminal {
141 uByte bLength;
142 uByte bDescriptorType;
143 uByte bDescriptorSubtype;
144 uByte bTerminalId;
145 uWord wTerminalType;
146 uByte bAssocTerminal;
147 uByte bSourceId;
148 uByte iTerminal;
149 };
150
151 /* UDESCSUB_AC_MIXER */
152 struct usb_audio_mixer_unit {
153 uByte bLength;
154 uByte bDescriptorType;
155 uByte bDescriptorSubtype;
156 uByte bUnitId;
157 uByte bNrInPins;
158 uByte baSourceId[255]; /* length is really bNrInPins */
159 /* struct usb_audio_mixer_unit_1 */
160 };
161 struct usb_audio_mixer_unit_1 {
162 uByte bNrChannels;
163 uWord wChannelConfig;
164 uByte iChannelNames;
165 uByte bmControls[255];
166 /*uByte iMixer;*/
167 };
168
169 /* UDESCSUB_AC_SELECTOR */
170 struct usb_audio_selector_unit {
171 uByte bLength;
172 uByte bDescriptorType;
173 uByte bDescriptorSubtype;
174 uByte bUnitId;
175 uByte bNrInPins;
176 uByte baSourceId[255];
177 /* uByte iSelector; */
178 };
179
180 /* UDESCSUB_AC_FEATURE */
181 struct usb_audio_feature_unit {
182 uByte bLength;
183 uByte bDescriptorType;
184 uByte bDescriptorSubtype;
185 uByte bUnitId;
186 uByte bSourceId;
187 uByte bControlSize;
188 uByte bmaControls[255]; /* size for more than enough */
189 /* uByte iFeature; */
190 };
191
192 /* UDESCSUB_AC_PROCESSING */
193 struct usb_audio_processing_unit {
194 uByte bLength;
195 uByte bDescriptorType;
196 uByte bDescriptorSubtype;
197 uByte bUnitId;
198 uWord wProcessType;
199 uByte bNrInPins;
200 uByte baSourceId[255];
201 /* struct usb_audio_processing_unit_1 */
202 };
203 struct usb_audio_processing_unit_1{
204 uByte bNrChannels;
205 uWord wChannelConfig;
206 uByte iChannelNames;
207 uByte bControlSize;
208 uByte bmControls[255];
209 #define UA_PROC_ENABLE_MASK 1
210 /*uByte iProcessing;*/
211 };
212
213 /* UDESCSUB_AC_EXTENSION */
214 struct usb_audio_extension_unit {
215 uByte bLength;
216 uByte bDescriptorType;
217 uByte bDescriptorSubtype;
218 uByte bUnitId;
219 uWord wExtensionCode;
220 uByte bNrInPins;
221 uByte baSourceId[255];
222 /* struct usb_audio_extension_unit_1 */
223 };
224 struct usb_audio_extension_unit_1 {
225 uByte bNrChannels;
226 uWord wChannelConfig;
227 uByte iChannelNames;
228 uByte bControlSize;
229 uByte bmControls[255];
230 #define UA_EXT_ENABLE_MASK 1
231 #define UA_EXT_ENABLE 1
232 /*uByte iExtension;*/
233 };
234
235 #define UAT_STREAM 0x0101
236
237 #define SET_CUR 0x01
238 #define GET_CUR 0x81
239 #define SET_MIN 0x02
240 #define GET_MIN 0x82
241 #define SET_MAX 0x03
242 #define GET_MAX 0x83
243 #define SET_RES 0x04
244 #define GET_RES 0x84
245 #define SET_MEM 0x05
246 #define GET_MEM 0x85
247 #define GET_STAT 0xff
248
249 #define MUTE_CONTROL 0x01
250 #define VOLUME_CONTROL 0x02
251 #define BASS_CONTROL 0x03
252 #define MID_CONTROL 0x04
253 #define TREBLE_CONTROL 0x05
254 #define GRAPHIC_EQUALIZER_CONTROL 0x06
255 #define AGC_CONTROL 0x07
256 #define DELAY_CONTROL 0x08
257 #define BASS_BOOST_CONTROL 0x09
258 #define LOUDNESS_CONTROL 0x0a
259
260 #define FU_MASK(u) (1 << ((u)-1))
261
262 #define MASTER_CHAN 0
263
264 #define AS_GENERAL 1
265 #define FORMAT_TYPE 2
266 #define FORMAT_SPECIFIC 3
267
268 #define UA_FMT_PCM 1
269 #define UA_FMT_PCM8 2
270 #define UA_FMT_IEEE_FLOAT 3
271 #define UA_FMT_ALAW 4
272 #define UA_FMT_MULAW 5
273
274 #define SAMPLING_FREQ_CONTROL 0x01
275
276 #define FORMAT_TYPE_UNDEFINED 0
277 #define FORMAT_TYPE_I 1
278 #define FORMAT_TYPE_II 2
279 #define FORMAT_TYPE_III 3
280
281 #define PROCESS_UNDEFINED 0
282 #define XX_ENABLE_CONTROL 1
283 #define UPDOWNMIX_PROCESS 1
284 #define UD_ENABLE_CONTROL 1
285 #define UD_MODE_SELECT_CONTROL 2
286 #define DOLBY_PROLOGIC_PROCESS 2
287 #define DP_ENABLE_CONTROL 1
288 #define DP_MODE_SELECT_CONTROL 2
289 #define P3D_STEREO_EXTENDER_PROCESS 3
290 #define P3D_ENABLE_CONTROL 1
291 #define P3D_SPACIOUSNESS_CONTROL 2
292 #define REVERBATION_PROCESS 4
293 #define RV_ENABLE_CONTROL 1
294 #define RV_LEVEL_CONTROL 2
295 #define RV_TIME_CONTROL 3
296 #define RV_FEEDBACK_CONTROL 4
297 #define CHORUS_PROCESS 5
298 #define CH_ENABLE_CONTROL 1
299 #define CH_LEVEL_CONTROL 2
300 #define CH_RATE_CONTROL 3
301 #define CH_DEPTH_CONTROL 4
302 #define DYN_RANGE_COMP_PROCESS 6
303 #define DR_ENABLE_CONTROL 1
304 #define DR_COMPRESSION_RATE_CONTROL 2
305 #define DR_MAXAMPL_CONTROL 3
306 #define DR_THRESHOLD_CONTROL 4
307 #define DR_ATTACK_TIME_CONTROL 5
308 #define DR_RELEASE_TIME_CONTROL 6
309