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.
21 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
22 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
23 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE.
34 #define UAUDIO_VERSION 0x100
36 #define UDESC_CS_CONFIG 0x22
37 #define UDESC_CS_STRING 0x23
38 #define UDESC_CS_INTERFACE 0x24
39 #define UDESC_CS_ENDPOINT 0x25
41 #define UDESCSUB_AC_HEADER 1
42 #define UDESCSUB_AC_INPUT 2
43 #define UDESCSUB_AC_OUTPUT 3
44 #define UDESCSUB_AC_MIXER 4
45 #define UDESCSUB_AC_SELECTOR 5
46 #define UDESCSUB_AC_FEATURE 6
47 #define UDESCSUB_AC_PROCESSING 7
48 #define UDESCSUB_AC_EXTENSION 8
50 /* The first fields are identical to struct usb_endpoint_descriptor */
53 uByte bDescriptorType;
54 uByte bEndpointAddress;
59 * The following two entries are only used by the Audio Class.
60 * And according to the specs the Audio Class is the only one
61 * allowed to extend the endpoint descriptor.
62 * Who knows what goes on in the minds of the people in the USB
63 * standardization? :-(
67 } __packed usb_endpoint_descriptor_audio_t;
69 struct usb_audio_control_descriptor {
71 uByte bDescriptorType;
72 uByte bDescriptorSubtype;
76 uByte baInterfaceNr[1];
79 struct usb_audio_streaming_interface_descriptor {
81 uByte bDescriptorType;
82 uByte bDescriptorSubtype;
88 struct usb_audio_streaming_endpoint_descriptor {
90 uByte bDescriptorType;
91 uByte bDescriptorSubtype;
93 #define UA_SED_FREQ_CONTROL 0x01
94 #define UA_SED_PITCH_CONTROL 0x02
95 #define UA_SED_MAXPACKETSONLY 0x80
96 uByte bLockDelayUnits;
100 struct usb_audio_streaming_type1_descriptor {
102 uByte bDescriptorType;
103 uByte bDescriptorSubtype;
107 uByte bBitResolution;
109 #define UA_SAMP_CONTNUOUS 0
111 #define UA_GETSAMP(p, n) (((p)->tSamFreq[((n)*3)+0]) | \
112 ((p)->tSamFreq[((n)*3)+1] << 8) | \
113 ((p)->tSamFreq[((n)*3)+2] << 16))
114 #define UA_SAMP_LO(p) UA_GETSAMP(p, 0)
115 #define UA_SAMP_HI(p) UA_GETSAMP(p, 1)
118 struct usb_audio_cluster {
120 uWord wChannelConfig;
121 #define UA_CHANNEL_LEFT 0x0001
122 #define UA_CHANNEL_RIGHT 0x0002
123 #define UA_CHANNEL_CENTER 0x0004
124 #define UA_CHANNEL_LFE 0x0008
125 #define UA_CHANNEL_L_SURROUND 0x0010
126 #define UA_CHANNEL_R_SURROUND 0x0020
127 #define UA_CHANNEL_L_CENTER 0x0040
128 #define UA_CHANNEL_R_CENTER 0x0080
129 #define UA_CHANNEL_SURROUND 0x0100
130 #define UA_CHANNEL_L_SIDE 0x0200
131 #define UA_CHANNEL_R_SIDE 0x0400
132 #define UA_CHANNEL_TOP 0x0800
136 /* Shared by all units and terminals */
137 struct usb_audio_unit {
139 uByte bDescriptorType;
140 uByte bDescriptorSubtype;
144 /* UDESCSUB_AC_INPUT */
145 struct usb_audio_input_terminal {
147 uByte bDescriptorType;
148 uByte bDescriptorSubtype;
151 uByte bAssocTerminal;
153 uWord wChannelConfig;
155 /* uByte iTerminal; */
158 /* UDESCSUB_AC_OUTPUT */
159 struct usb_audio_output_terminal {
161 uByte bDescriptorType;
162 uByte bDescriptorSubtype;
165 uByte bAssocTerminal;
170 /* UDESCSUB_AC_MIXER */
171 struct usb_audio_mixer_unit_0 {
173 uByte bDescriptorType;
174 uByte bDescriptorSubtype;
177 uByte baSourceId[0]; /* [bNrInPins] */
178 /* struct usb_audio_mixer_unit_1 */
180 struct usb_audio_mixer_unit_1 {
182 uWord wChannelConfig;
184 uByte bmControls[0]; /* [see source code] */
188 /* UDESCSUB_AC_SELECTOR */
189 struct usb_audio_selector_unit {
191 uByte bDescriptorType;
192 uByte bDescriptorSubtype;
195 uByte baSourceId[0]; /* [bNrInPins] */
196 /* uByte iSelector; */
199 /* UDESCSUB_AC_FEATURE */
200 struct usb_audio_feature_unit {
202 uByte bDescriptorType;
203 uByte bDescriptorSubtype;
207 uByte bmaControls[0]; /* [bControlSize * x] */
208 /* uByte iFeature; */
211 /* UDESCSUB_AC_PROCESSING */
212 struct usb_audio_processing_unit_0 {
214 uByte bDescriptorType;
215 uByte bDescriptorSubtype;
219 uByte baSourceId[0]; /* [bNrInPins] */
220 /* struct usb_audio_processing_unit_1 */
222 struct usb_audio_processing_unit_1 {
224 uWord wChannelConfig;
227 uByte bmControls[0]; /* [bControlSize] */
228 #define UA_PROC_ENABLE_MASK 1
231 struct usb_audio_processing_unit_updown {
234 uWord waModes[0]; /* [bNrModes] */
237 /* UDESCSUB_AC_EXTENSION */
238 struct usb_audio_extension_unit_0 {
240 uByte bDescriptorType;
241 uByte bDescriptorSubtype;
243 uWord wExtensionCode;
245 uByte baSourceId[0]; /* [bNrInPins] */
246 /* struct usb_audio_extension_unit_1 */
248 struct usb_audio_extension_unit_1 {
250 uWord wChannelConfig;
253 uByte bmControls[0]; /* [bControlSize] */
254 #define UA_EXT_ENABLE_MASK 1
255 #define UA_EXT_ENABLE 1
256 /* uByte iExtension; */
259 /* USB terminal types */
260 #define UAT_UNDEFINED 0x0100
261 #define UAT_STREAM 0x0101
262 #define UAT_VENDOR 0x01ff
263 /* input terminal types */
264 #define UATI_UNDEFINED 0x0200
265 #define UATI_MICROPHONE 0x0201
266 #define UATI_DESKMICROPHONE 0x0202
267 #define UATI_PERSONALMICROPHONE 0x0203
268 #define UATI_OMNIMICROPHONE 0x0204
269 #define UATI_MICROPHONEARRAY 0x0205
270 #define UATI_PROCMICROPHONEARR 0x0206
271 /* output terminal types */
272 #define UATO_UNDEFINED 0x0300
273 #define UATO_SPEAKER 0x0301
274 #define UATO_HEADPHONES 0x0302
275 #define UATO_DISPLAYAUDIO 0x0303
276 #define UATO_DESKTOPSPEAKER 0x0304
277 #define UATO_ROOMSPEAKER 0x0305
278 #define UATO_COMMSPEAKER 0x0306
279 #define UATO_SUBWOOFER 0x0307
280 /* bidir terminal types */
281 #define UATB_UNDEFINED 0x0400
282 #define UATB_HANDSET 0x0401
283 #define UATB_HEADSET 0x0402
284 #define UATB_SPEAKERPHONE 0x0403
285 #define UATB_SPEAKERPHONEESUP 0x0404
286 #define UATB_SPEAKERPHONEECANC 0x0405
287 /* telephony terminal types */
288 #define UATT_UNDEFINED 0x0500
289 #define UATT_PHONELINE 0x0501
290 #define UATT_TELEPHONE 0x0502
291 #define UATT_DOWNLINEPHONE 0x0503
292 /* external terminal types */
293 #define UATE_UNDEFINED 0x0600
294 #define UATE_ANALOGCONN 0x0601
295 #define UATE_DIGITALAUIFC 0x0602
296 #define UATE_LINECONN 0x0603
297 #define UATE_LEGACYCONN 0x0604
298 #define UATE_SPDIF 0x0605
299 #define UATE_1394DA 0x0606
300 #define UATE_1394DV 0x0607
301 /* embedded function terminal types */
302 #define UATF_UNDEFINED 0x0700
303 #define UATF_CALIBNOISE 0x0701
304 #define UATF_EQUNOISE 0x0702
305 #define UATF_CDPLAYER 0x0703
306 #define UATF_DAT 0x0704
307 #define UATF_DCC 0x0705
308 #define UATF_MINIDISK 0x0706
309 #define UATF_ANALOGTAPE 0x0707
310 #define UATF_PHONOGRAPH 0x0708
311 #define UATF_VCRAUDIO 0x0709
312 #define UATF_VIDEODISCAUDIO 0x070a
313 #define UATF_DVDAUDIO 0x070b
314 #define UATF_TVTUNERAUDIO 0x070c
315 #define UATF_SATELLITE 0x070d
316 #define UATF_CABLETUNER 0x070e
317 #define UATF_DSS 0x070f
318 #define UATF_RADIORECV 0x0710
319 #define UATF_RADIOXMIT 0x0711
320 #define UATF_MULTITRACK 0x0712
321 #define UATF_SYNTHESIZER 0x0713
334 #define GET_STAT 0xff
336 #define MUTE_CONTROL 0x01
337 #define VOLUME_CONTROL 0x02
338 #define BASS_CONTROL 0x03
339 #define MID_CONTROL 0x04
340 #define TREBLE_CONTROL 0x05
341 #define GRAPHIC_EQUALIZER_CONTROL 0x06
342 #define AGC_CONTROL 0x07
343 #define DELAY_CONTROL 0x08
344 #define BASS_BOOST_CONTROL 0x09
345 #define LOUDNESS_CONTROL 0x0a
347 #define FU_MASK(u) (1 << ((u)-1))
349 #define MASTER_CHAN 0
352 #define FORMAT_TYPE 2
353 #define FORMAT_SPECIFIC 3
356 #define UA_FMT_PCM8 2
357 #define UA_FMT_IEEE_FLOAT 3
358 #define UA_FMT_ALAW 4
359 #define UA_FMT_MULAW 5
360 #define UA_FMT_MPEG 0x1001
361 #define UA_FMT_AC3 0x1002
363 #define SAMPLING_FREQ_CONTROL 0x01
364 #define PITCH_CONTROL 0x02
366 #define FORMAT_TYPE_UNDEFINED 0
367 #define FORMAT_TYPE_I 1
368 #define FORMAT_TYPE_II 2
369 #define FORMAT_TYPE_III 3
371 #define UA_PROC_MASK(n) (1<< ((n)-1))
372 #define PROCESS_UNDEFINED 0
373 #define XX_ENABLE_CONTROL 1
374 #define UPDOWNMIX_PROCESS 1
375 #define UD_ENABLE_CONTROL 1
376 #define UD_MODE_SELECT_CONTROL 2
377 #define DOLBY_PROLOGIC_PROCESS 2
378 #define DP_ENABLE_CONTROL 1
379 #define DP_MODE_SELECT_CONTROL 2
380 #define P3D_STEREO_EXTENDER_PROCESS 3
381 #define P3D_ENABLE_CONTROL 1
382 #define P3D_SPACIOUSNESS_CONTROL 2
383 #define REVERBATION_PROCESS 4
384 #define RV_ENABLE_CONTROL 1
385 #define RV_LEVEL_CONTROL 2
386 #define RV_TIME_CONTROL 3
387 #define RV_FEEDBACK_CONTROL 4
388 #define CHORUS_PROCESS 5
389 #define CH_ENABLE_CONTROL 1
390 #define CH_LEVEL_CONTROL 2
391 #define CH_RATE_CONTROL 3
392 #define CH_DEPTH_CONTROL 4
393 #define DYN_RANGE_COMP_PROCESS 6
394 #define DR_ENABLE_CONTROL 1
395 #define DR_COMPRESSION_RATE_CONTROL 2
396 #define DR_MAXAMPL_CONTROL 3
397 #define DR_THRESHOLD_CONTROL 4
398 #define DR_ATTACK_TIME_CONTROL 5
399 #define DR_RELEASE_TIME_CONTROL 6