1 /* $NetBSD: uaudioreg.h,v 1.12 2004/11/05 19:08:29 kent Exp $ */
5 * Copyright (c) 1999 The NetBSD Foundation, Inc.
8 * This code is derived from software contributed to The NetBSD Foundation
9 * by Lennart Augustsson (lennart@augustsson.net) at
10 * Carlstedt Research & Technology.
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
20 * 3. All advertising materials mentioning features or use of this software
21 * must display the following acknowledgement:
22 * This product includes software developed by the NetBSD
23 * Foundation, Inc. and its contributors.
24 * 4. Neither the name of The NetBSD Foundation nor the names of its
25 * contributors may be used to endorse or promote products derived
26 * from this software without specific prior written permission.
28 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
29 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
30 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
31 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
32 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
33 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
34 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
35 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
36 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
37 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38 * POSSIBILITY OF SUCH DAMAGE.
41 #define UAUDIO_VERSION 0x100
43 #define UDESC_CS_CONFIG 0x22
44 #define UDESC_CS_STRING 0x23
45 #define UDESC_CS_INTERFACE 0x24
46 #define UDESC_CS_ENDPOINT 0x25
48 #define UDESCSUB_AC_HEADER 1
49 #define UDESCSUB_AC_INPUT 2
50 #define UDESCSUB_AC_OUTPUT 3
51 #define UDESCSUB_AC_MIXER 4
52 #define UDESCSUB_AC_SELECTOR 5
53 #define UDESCSUB_AC_FEATURE 6
54 #define UDESCSUB_AC_PROCESSING 7
55 #define UDESCSUB_AC_EXTENSION 8
57 /* The first fields are identical to usb_endpoint_descriptor_t */
60 uByte bDescriptorType;
61 uByte bEndpointAddress;
66 * The following two entries are only used by the Audio Class.
67 * And according to the specs the Audio Class is the only one
68 * allowed to extend the endpoint descriptor.
69 * Who knows what goes on in the minds of the people in the USB
70 * standardization? :-(
74 } UPACKED usb_endpoint_descriptor_audio_t;
76 struct usb_audio_control_descriptor {
78 uByte bDescriptorType;
79 uByte bDescriptorSubtype;
83 uByte baInterfaceNr[1];
86 struct usb_audio_streaming_interface_descriptor {
88 uByte bDescriptorType;
89 uByte bDescriptorSubtype;
95 struct usb_audio_streaming_endpoint_descriptor {
97 uByte bDescriptorType;
98 uByte bDescriptorSubtype;
100 #define UA_SED_FREQ_CONTROL 0x01
101 #define UA_SED_PITCH_CONTROL 0x02
102 #define UA_SED_MAXPACKETSONLY 0x80
103 uByte bLockDelayUnits;
107 struct usb_audio_streaming_type1_descriptor {
109 uByte bDescriptorType;
110 uByte bDescriptorSubtype;
114 uByte bBitResolution;
116 #define UA_SAMP_CONTNUOUS 0
117 uByte tSamFreq[3*2]; /* room for low and high */
118 #define UA_GETSAMP(p, n) ((p)->tSamFreq[(n)*3+0] | ((p)->tSamFreq[(n)*3+1] << 8) | ((p)->tSamFreq[(n)*3+2] << 16))
119 #define UA_SAMP_LO(p) UA_GETSAMP(p, 0)
120 #define UA_SAMP_HI(p) UA_GETSAMP(p, 1)
123 struct usb_audio_cluster {
125 uWord wChannelConfig;
126 #define UA_CHANNEL_LEFT 0x0001
127 #define UA_CHANNEL_RIGHT 0x0002
128 #define UA_CHANNEL_CENTER 0x0004
129 #define UA_CHANNEL_LFE 0x0008
130 #define UA_CHANNEL_L_SURROUND 0x0010
131 #define UA_CHANNEL_R_SURROUND 0x0020
132 #define UA_CHANNEL_L_CENTER 0x0040
133 #define UA_CHANNEL_R_CENTER 0x0080
134 #define UA_CHANNEL_SURROUND 0x0100
135 #define UA_CHANNEL_L_SIDE 0x0200
136 #define UA_CHANNEL_R_SIDE 0x0400
137 #define UA_CHANNEL_TOP 0x0800
141 /* Shared by all units and terminals */
142 struct usb_audio_unit {
144 uByte bDescriptorType;
145 uByte bDescriptorSubtype;
149 /* UDESCSUB_AC_INPUT */
150 struct usb_audio_input_terminal {
152 uByte bDescriptorType;
153 uByte bDescriptorSubtype;
156 uByte bAssocTerminal;
158 uWord wChannelConfig;
163 /* UDESCSUB_AC_OUTPUT */
164 struct usb_audio_output_terminal {
166 uByte bDescriptorType;
167 uByte bDescriptorSubtype;
170 uByte bAssocTerminal;
175 /* UDESCSUB_AC_MIXER */
176 struct usb_audio_mixer_unit {
178 uByte bDescriptorType;
179 uByte bDescriptorSubtype;
182 uByte baSourceId[255]; /* [bNrInPins] */
183 /* struct usb_audio_mixer_unit_1 */
185 struct usb_audio_mixer_unit_1 {
187 uWord wChannelConfig;
189 uByte bmControls[255]; /* [bNrChannels] */
193 /* UDESCSUB_AC_SELECTOR */
194 struct usb_audio_selector_unit {
196 uByte bDescriptorType;
197 uByte bDescriptorSubtype;
200 uByte baSourceId[255]; /* [bNrInPins] */
201 /* uByte iSelector; */
204 /* UDESCSUB_AC_FEATURE */
205 struct usb_audio_feature_unit {
207 uByte bDescriptorType;
208 uByte bDescriptorSubtype;
212 uByte bmaControls[255]; /* size for more than enough */
213 /* uByte iFeature; */
216 /* UDESCSUB_AC_PROCESSING */
217 struct usb_audio_processing_unit {
219 uByte bDescriptorType;
220 uByte bDescriptorSubtype;
224 uByte baSourceId[255]; /* [bNrInPins] */
225 /* struct usb_audio_processing_unit_1 */
227 struct usb_audio_processing_unit_1{
229 uWord wChannelConfig;
232 uByte bmControls[255]; /* [bControlSize] */
233 #define UA_PROC_ENABLE_MASK 1
236 struct usb_audio_processing_unit_updown {
239 uWord waModes[255]; /* [bNrModes] */
242 /* UDESCSUB_AC_EXTENSION */
243 struct usb_audio_extension_unit {
245 uByte bDescriptorType;
246 uByte bDescriptorSubtype;
248 uWord wExtensionCode;
250 uByte baSourceId[255]; /* [bNrInPins] */
251 /* struct usb_audio_extension_unit_1 */
253 struct usb_audio_extension_unit_1 {
255 uWord wChannelConfig;
258 uByte bmControls[255]; /* [bControlSize] */
259 #define UA_EXT_ENABLE_MASK 1
260 #define UA_EXT_ENABLE 1
261 /*uByte iExtension;*/
264 /* USB terminal types */
265 #define UAT_UNDEFINED 0x0100
266 #define UAT_STREAM 0x0101
267 #define UAT_VENDOR 0x01ff
268 /* input terminal types */
269 #define UATI_UNDEFINED 0x0200
270 #define UATI_MICROPHONE 0x0201
271 #define UATI_DESKMICROPHONE 0x0202
272 #define UATI_PERSONALMICROPHONE 0x0203
273 #define UATI_OMNIMICROPHONE 0x0204
274 #define UATI_MICROPHONEARRAY 0x0205
275 #define UATI_PROCMICROPHONEARR 0x0206
276 /* output terminal types */
277 #define UATO_UNDEFINED 0x0300
278 #define UATO_SPEAKER 0x0301
279 #define UATO_HEADPHONES 0x0302
280 #define UATO_DISPLAYAUDIO 0x0303
281 #define UATO_DESKTOPSPEAKER 0x0304
282 #define UATO_ROOMSPEAKER 0x0305
283 #define UATO_COMMSPEAKER 0x0306
284 #define UATO_SUBWOOFER 0x0307
285 /* bidir terminal types */
286 #define UATB_UNDEFINED 0x0400
287 #define UATB_HANDSET 0x0401
288 #define UATB_HEADSET 0x0402
289 #define UATB_SPEAKERPHONE 0x0403
290 #define UATB_SPEAKERPHONEESUP 0x0404
291 #define UATB_SPEAKERPHONEECANC 0x0405
292 /* telephony terminal types */
293 #define UATT_UNDEFINED 0x0500
294 #define UATT_PHONELINE 0x0501
295 #define UATT_TELEPHONE 0x0502
296 #define UATT_DOWNLINEPHONE 0x0503
297 /* external terminal types */
298 #define UATE_UNDEFINED 0x0600
299 #define UATE_ANALOGCONN 0x0601
300 #define UATE_DIGITALAUIFC 0x0602
301 #define UATE_LINECONN 0x0603
302 #define UATE_LEGACYCONN 0x0604
303 #define UATE_SPDIF 0x0605
304 #define UATE_1394DA 0x0606
305 #define UATE_1394DV 0x0607
306 /* embedded function terminal types */
307 #define UATF_UNDEFINED 0x0700
308 #define UATF_CALIBNOISE 0x0701
309 #define UATF_EQUNOISE 0x0702
310 #define UATF_CDPLAYER 0x0703
311 #define UATF_DAT 0x0704
312 #define UATF_DCC 0x0705
313 #define UATF_MINIDISK 0x0706
314 #define UATF_ANALOGTAPE 0x0707
315 #define UATF_PHONOGRAPH 0x0708
316 #define UATF_VCRAUDIO 0x0709
317 #define UATF_VIDEODISCAUDIO 0x070a
318 #define UATF_DVDAUDIO 0x070b
319 #define UATF_TVTUNERAUDIO 0x070c
320 #define UATF_SATELLITE 0x070d
321 #define UATF_CABLETUNER 0x070e
322 #define UATF_DSS 0x070f
323 #define UATF_RADIORECV 0x0710
324 #define UATF_RADIOXMIT 0x0711
325 #define UATF_MULTITRACK 0x0712
326 #define UATF_SYNTHESIZER 0x0713
339 #define GET_STAT 0xff
341 #define MUTE_CONTROL 0x01
342 #define VOLUME_CONTROL 0x02
343 #define BASS_CONTROL 0x03
344 #define MID_CONTROL 0x04
345 #define TREBLE_CONTROL 0x05
346 #define GRAPHIC_EQUALIZER_CONTROL 0x06
347 #define AGC_CONTROL 0x07
348 #define DELAY_CONTROL 0x08
349 #define BASS_BOOST_CONTROL 0x09
350 #define LOUDNESS_CONTROL 0x0a
352 #define FU_MASK(u) (1 << ((u)-1))
354 #define MASTER_CHAN 0
357 #define FORMAT_TYPE 2
358 #define FORMAT_SPECIFIC 3
361 #define UA_FMT_PCM8 2
362 #define UA_FMT_IEEE_FLOAT 3
363 #define UA_FMT_ALAW 4
364 #define UA_FMT_MULAW 5
365 #define UA_FMT_MPEG 0x1001
366 #define UA_FMT_AC3 0x1002
368 #define SAMPLING_FREQ_CONTROL 0x01
369 #define PITCH_CONTROL 0x02
371 #define FORMAT_TYPE_UNDEFINED 0
372 #define FORMAT_TYPE_I 1
373 #define FORMAT_TYPE_II 2
374 #define FORMAT_TYPE_III 3
376 #define UA_PROC_MASK(n) (1<< ((n)-1))
377 #define PROCESS_UNDEFINED 0
378 #define XX_ENABLE_CONTROL 1
379 #define UPDOWNMIX_PROCESS 1
380 #define UD_ENABLE_CONTROL 1
381 #define UD_MODE_SELECT_CONTROL 2
382 #define DOLBY_PROLOGIC_PROCESS 2
383 #define DP_ENABLE_CONTROL 1
384 #define DP_MODE_SELECT_CONTROL 2
385 #define P3D_STEREO_EXTENDER_PROCESS 3
386 #define P3D_ENABLE_CONTROL 1
387 #define P3D_SPACIOUSNESS_CONTROL 2
388 #define REVERBATION_PROCESS 4
389 #define RV_ENABLE_CONTROL 1
390 #define RV_LEVEL_CONTROL 2
391 #define RV_TIME_CONTROL 3
392 #define RV_FEEDBACK_CONTROL 4
393 #define CHORUS_PROCESS 5
394 #define CH_ENABLE_CONTROL 1
395 #define CH_LEVEL_CONTROL 2
396 #define CH_RATE_CONTROL 3
397 #define CH_DEPTH_CONTROL 4
398 #define DYN_RANGE_COMP_PROCESS 6
399 #define DR_ENABLE_CONTROL 1
400 #define DR_COMPRESSION_RATE_CONTROL 2
401 #define DR_MAXAMPL_CONTROL 3
402 #define DR_THRESHOLD_CONTROL 4
403 #define DR_ATTACK_TIME_CONTROL 5
404 #define DR_RELEASE_TIME_CONTROL 6