1 /* $NetBSD: uaudioreg.h,v 1.7 2000/12/28 00:29:58 augustss Exp $ */
2 /* $FreeBSD: src/sys/dev/sound/usb/uaudioreg.h,v 1.1.2.2 2002/11/06 21:40:31 joe Exp $ */
3 /* $DragonFly: src/sys/dev/sound/usb/uaudioreg.h,v 1.2 2003/06/17 04:28:31 dillon 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_DEVICE 0x21
45 #define UDESC_CS_CONFIG 0x22
46 #define UDESC_CS_STRING 0x23
47 #define UDESC_CS_INTERFACE 0x24
48 #define UDESC_CS_ENDPOINT 0x25
50 #define UDESCSUB_AC_HEADER 1
51 #define UDESCSUB_AC_INPUT 2
52 #define UDESCSUB_AC_OUTPUT 3
53 #define UDESCSUB_AC_MIXER 4
54 #define UDESCSUB_AC_SELECTOR 5
55 #define UDESCSUB_AC_FEATURE 6
56 #define UDESCSUB_AC_PROCESSING 7
57 #define UDESCSUB_AC_EXTENSION 8
59 /* The first fields are identical to usb_endpoint_descriptor_t */
62 uByte bDescriptorType;
63 uByte bEndpointAddress;
68 * The following two entries are only used by the Audio Class.
69 * And according to the specs the Audio Class is the only one
70 * allowed to extend the endpoint descriptor.
71 * Who knows what goes on in the minds of the people in the USB
72 * standardization? :-(
76 } UPACKED usb_endpoint_descriptor_audio_t;
78 struct usb_audio_control_descriptor {
80 uByte bDescriptorType;
81 uByte bDescriptorSubtype;
85 uByte baInterfaceNr[1];
88 struct usb_audio_streaming_interface_descriptor {
90 uByte bDescriptorType;
91 uByte bDescriptorSubtype;
97 struct usb_audio_streaming_endpoint_descriptor {
99 uByte bDescriptorType;
100 uByte bDescriptorSubtype;
102 uByte bLockDelayUnits;
106 struct usb_audio_streaming_type1_descriptor {
108 uByte bDescriptorType;
109 uByte bDescriptorSubtype;
113 uByte bBitResolution;
115 #define UA_SAMP_CONTNUOUS 0
116 uByte tSamFreq[3*2]; /* room for low and high */
117 #define UA_GETSAMP(p, n) ((p)->tSamFreq[(n)*3+0] | ((p)->tSamFreq[(n)*3+1] << 8) | ((p)->tSamFreq[(n)*3+2] << 16))
118 #define UA_SAMP_LO(p) UA_GETSAMP(p, 0)
119 #define UA_SAMP_HI(p) UA_GETSAMP(p, 1)
122 struct usb_audio_cluster {
124 uWord wChannelConfig;
128 /* UDESCSUB_AC_INPUT */
129 struct usb_audio_input_terminal {
131 uByte bDescriptorType;
132 uByte bDescriptorSubtype;
135 uByte bAssocTerminal;
137 uWord wChannelConfig;
142 /* UDESCSUB_AC_OUTPUT */
143 struct usb_audio_output_terminal {
145 uByte bDescriptorType;
146 uByte bDescriptorSubtype;
149 uByte bAssocTerminal;
154 /* UDESCSUB_AC_MIXER */
155 struct usb_audio_mixer_unit {
157 uByte bDescriptorType;
158 uByte bDescriptorSubtype;
161 uByte baSourceId[255]; /* [bNrInPins] */
162 /* struct usb_audio_mixer_unit_1 */
164 struct usb_audio_mixer_unit_1 {
166 uWord wChannelConfig;
168 uByte bmControls[255]; /* [bNrChannels] */
172 /* UDESCSUB_AC_SELECTOR */
173 struct usb_audio_selector_unit {
175 uByte bDescriptorType;
176 uByte bDescriptorSubtype;
179 uByte baSourceId[255]; /* [bNrInPins] */
180 /* uByte iSelector; */
183 /* UDESCSUB_AC_FEATURE */
184 struct usb_audio_feature_unit {
186 uByte bDescriptorType;
187 uByte bDescriptorSubtype;
191 uByte bmaControls[255]; /* size for more than enough */
192 /* uByte iFeature; */
195 /* UDESCSUB_AC_PROCESSING */
196 struct usb_audio_processing_unit {
198 uByte bDescriptorType;
199 uByte bDescriptorSubtype;
203 uByte baSourceId[255]; /* [bNrInPins] */
204 /* struct usb_audio_processing_unit_1 */
206 struct usb_audio_processing_unit_1{
208 uWord wChannelConfig;
211 uByte bmControls[255]; /* [bControlSize] */
212 #define UA_PROC_ENABLE_MASK 1
215 struct usb_audio_processing_unit_updown {
218 uWord waModes[255]; /* [bNrModes] */
221 /* UDESCSUB_AC_EXTENSION */
222 struct usb_audio_extension_unit {
224 uByte bDescriptorType;
225 uByte bDescriptorSubtype;
227 uWord wExtensionCode;
229 uByte baSourceId[255]; /* [bNrInPins] */
230 /* struct usb_audio_extension_unit_1 */
232 struct usb_audio_extension_unit_1 {
234 uWord wChannelConfig;
237 uByte bmControls[255]; /* [bControlSize] */
238 #define UA_EXT_ENABLE_MASK 1
239 #define UA_EXT_ENABLE 1
240 /*uByte iExtension;*/
243 /* USB terminal types */
244 #define UAT_UNDEFINED 0x0100
245 #define UAT_STREAM 0x0101
246 #define UAT_VENDOR 0x01ff
247 /* input terminal types */
248 #define UATI_UNDEFINED 0x0200
249 #define UATI_MICROPHONE 0x0201
250 #define UATI_DESKMICROPHONE 0x0202
251 #define UATI_PERSONALMICROPHONE 0x0203
252 #define UATI_OMNIMICROPHONE 0x0204
253 #define UATI_MICROPHONEARRAY 0x0205
254 #define UATI_PROCMICROPHONEARR 0x0206
255 /* output terminal types */
256 #define UATO_UNDEFINED 0x0300
257 #define UATO_SPEAKER 0x0301
258 #define UATO_HEADPHONES 0x0302
259 #define UATO_DISPLAYAUDIO 0x0303
260 #define UATO_DESKTOPSPEAKER 0x0304
261 #define UATO_ROOMSPEAKER 0x0305
262 #define UATO_COMMSPEAKER 0x0306
263 #define UATO_SUBWOOFER 0x0307
264 /* bidir terminal types */
265 #define UATB_UNDEFINED 0x0400
266 #define UATB_HANDSET 0x0401
267 #define UATB_HEADSET 0x0402
268 #define UATB_SPEAKERPHONE 0x0403
269 #define UATB_SPEAKERPHONEESUP 0x0404
270 #define UATB_SPEAKERPHONEECANC 0x0405
271 /* telephony terminal types */
272 #define UATT_UNDEFINED 0x0500
273 #define UATT_PHONELINE 0x0501
274 #define UATT_TELEPHONE 0x0502
275 #define UATT_DOWNLINEPHONE 0x0503
276 /* external terminal types */
277 #define UATE_UNDEFINED 0x0600
278 #define UATE_ANALOGCONN 0x0601
279 #define UATE_DIGITALAUIFC 0x0602
280 #define UATE_LINECONN 0x0603
281 #define UATE_LEGACYCONN 0x0604
282 #define UATE_SPDIF 0x0605
283 #define UATE_1394DA 0x0606
284 #define UATE_1394DV 0x0607
285 /* embedded function terminal types */
286 #define UATF_UNDEFINED 0x0700
287 #define UATF_CALIBNOISE 0x0701
288 #define UATF_EQUNOISE 0x0702
289 #define UATF_CDPLAYER 0x0703
290 #define UATF_DAT 0x0704
291 #define UATF_DCC 0x0705
292 #define UATF_MINIDISK 0x0706
293 #define UATF_ANALOGTAPE 0x0707
294 #define UATF_PHONOGRAPH 0x0708
295 #define UATF_VCRAUDIO 0x0709
296 #define UATF_VIDEODISCAUDIO 0x070a
297 #define UATF_DVDAUDIO 0x070b
298 #define UATF_TVTUNERAUDIO 0x070c
299 #define UATF_SATELLITE 0x070d
300 #define UATF_CABLETUNER 0x070e
301 #define UATF_DSS 0x070f
302 #define UATF_RADIORECV 0x0710
303 #define UATF_RADIOXMIT 0x0711
304 #define UATF_MULTITRACK 0x0712
305 #define UATF_SYNTHESIZER 0x0713
318 #define GET_STAT 0xff
320 #define MUTE_CONTROL 0x01
321 #define VOLUME_CONTROL 0x02
322 #define BASS_CONTROL 0x03
323 #define MID_CONTROL 0x04
324 #define TREBLE_CONTROL 0x05
325 #define GRAPHIC_EQUALIZER_CONTROL 0x06
326 #define AGC_CONTROL 0x07
327 #define DELAY_CONTROL 0x08
328 #define BASS_BOOST_CONTROL 0x09
329 #define LOUDNESS_CONTROL 0x0a
331 #define FU_MASK(u) (1 << ((u)-1))
333 #define MASTER_CHAN 0
336 #define FORMAT_TYPE 2
337 #define FORMAT_SPECIFIC 3
340 #define UA_FMT_PCM8 2
341 #define UA_FMT_IEEE_FLOAT 3
342 #define UA_FMT_ALAW 4
343 #define UA_FMT_MULAW 5
345 #define SAMPLING_FREQ_CONTROL 0x01
347 #define FORMAT_TYPE_UNDEFINED 0
348 #define FORMAT_TYPE_I 1
349 #define FORMAT_TYPE_II 2
350 #define FORMAT_TYPE_III 3
352 #define UA_PROC_MASK(n) (1<< ((n)-1))
353 #define PROCESS_UNDEFINED 0
354 #define XX_ENABLE_CONTROL 1
355 #define UPDOWNMIX_PROCESS 1
356 #define UD_ENABLE_CONTROL 1
357 #define UD_MODE_SELECT_CONTROL 2
358 #define DOLBY_PROLOGIC_PROCESS 2
359 #define DP_ENABLE_CONTROL 1
360 #define DP_MODE_SELECT_CONTROL 2
361 #define P3D_STEREO_EXTENDER_PROCESS 3
362 #define P3D_ENABLE_CONTROL 1
363 #define P3D_SPACIOUSNESS_CONTROL 2
364 #define REVERBATION_PROCESS 4
365 #define RV_ENABLE_CONTROL 1
366 #define RV_LEVEL_CONTROL 2
367 #define RV_TIME_CONTROL 3
368 #define RV_FEEDBACK_CONTROL 4
369 #define CHORUS_PROCESS 5
370 #define CH_ENABLE_CONTROL 1
371 #define CH_LEVEL_CONTROL 2
372 #define CH_RATE_CONTROL 3
373 #define CH_DEPTH_CONTROL 4
374 #define DYN_RANGE_COMP_PROCESS 6
375 #define DR_ENABLE_CONTROL 1
376 #define DR_COMPRESSION_RATE_CONTROL 2
377 #define DR_MAXAMPL_CONTROL 3
378 #define DR_THRESHOLD_CONTROL 4
379 #define DR_ATTACK_TIME_CONTROL 5
380 #define DR_RELEASE_TIME_CONTROL 6