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