Remove some duplicate FreeBSD CVS IDs, move some IDs to better places.
[dragonfly.git] / sys / dev / sound / usb / uaudioreg.h
CommitLineData
984263bc
MD
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 $ */
1de703da 3/* $DragonFly: src/sys/dev/sound/usb/uaudioreg.h,v 1.2 2003/06/17 04:28:31 dillon Exp $ */
984263bc
MD
4
5/*
6 * Copyright (c) 1999 The NetBSD Foundation, Inc.
7 * All rights reserved.
8 *
9 * This code is derived from software contributed to The NetBSD Foundation
10 * by Lennart Augustsson (lennart@augustsson.net) at
11 * Carlstedt Research & Technology.
12 *
13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions
15 * are met:
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.
28 *
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.
40 */
41
42#define UAUDIO_VERSION 0x100
43
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
49
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
58
59/* The first fields are identical to usb_endpoint_descriptor_t */
60typedef struct {
61 uByte bLength;
62 uByte bDescriptorType;
63 uByte bEndpointAddress;
64 uByte bmAttributes;
65 uWord wMaxPacketSize;
66 uByte bInterval;
67 /*
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? :-(
73 */
74 uByte bRefresh;
75 uByte bSynchAddress;
76} UPACKED usb_endpoint_descriptor_audio_t;
77
78struct usb_audio_control_descriptor {
79 uByte bLength;
80 uByte bDescriptorType;
81 uByte bDescriptorSubtype;
82 uWord bcdADC;
83 uWord wTotalLength;
84 uByte bInCollection;
85 uByte baInterfaceNr[1];
86} UPACKED;
87
88struct usb_audio_streaming_interface_descriptor {
89 uByte bLength;
90 uByte bDescriptorType;
91 uByte bDescriptorSubtype;
92 uByte bTerminalLink;
93 uByte bDelay;
94 uWord wFormatTag;
95} UPACKED;
96
97struct usb_audio_streaming_endpoint_descriptor {
98 uByte bLength;
99 uByte bDescriptorType;
100 uByte bDescriptorSubtype;
101 uByte bmAttributes;
102 uByte bLockDelayUnits;
103 uWord wLockDelay;
104} UPACKED;
105
106struct usb_audio_streaming_type1_descriptor {
107 uByte bLength;
108 uByte bDescriptorType;
109 uByte bDescriptorSubtype;
110 uByte bFormatType;
111 uByte bNrChannels;
112 uByte bSubFrameSize;
113 uByte bBitResolution;
114 uByte bSamFreqType;
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)
120} UPACKED;
121
122struct usb_audio_cluster {
123 uByte bNrChannels;
124 uWord wChannelConfig;
125 uByte iChannelNames;
126} UPACKED;
127
128/* UDESCSUB_AC_INPUT */
129struct usb_audio_input_terminal {
130 uByte bLength;
131 uByte bDescriptorType;
132 uByte bDescriptorSubtype;
133 uByte bTerminalId;
134 uWord wTerminalType;
135 uByte bAssocTerminal;
136 uByte bNrChannels;
137 uWord wChannelConfig;
138 uByte iChannelNames;
139 uByte iTerminal;
140} UPACKED;
141
142/* UDESCSUB_AC_OUTPUT */
143struct usb_audio_output_terminal {
144 uByte bLength;
145 uByte bDescriptorType;
146 uByte bDescriptorSubtype;
147 uByte bTerminalId;
148 uWord wTerminalType;
149 uByte bAssocTerminal;
150 uByte bSourceId;
151 uByte iTerminal;
152} UPACKED;
153
154/* UDESCSUB_AC_MIXER */
155struct usb_audio_mixer_unit {
156 uByte bLength;
157 uByte bDescriptorType;
158 uByte bDescriptorSubtype;
159 uByte bUnitId;
160 uByte bNrInPins;
161 uByte baSourceId[255]; /* [bNrInPins] */
162 /* struct usb_audio_mixer_unit_1 */
163} UPACKED;
164struct usb_audio_mixer_unit_1 {
165 uByte bNrChannels;
166 uWord wChannelConfig;
167 uByte iChannelNames;
168 uByte bmControls[255]; /* [bNrChannels] */
169 /*uByte iMixer;*/
170} UPACKED;
171
172/* UDESCSUB_AC_SELECTOR */
173struct usb_audio_selector_unit {
174 uByte bLength;
175 uByte bDescriptorType;
176 uByte bDescriptorSubtype;
177 uByte bUnitId;
178 uByte bNrInPins;
179 uByte baSourceId[255]; /* [bNrInPins] */
180 /* uByte iSelector; */
181} UPACKED;
182
183/* UDESCSUB_AC_FEATURE */
184struct usb_audio_feature_unit {
185 uByte bLength;
186 uByte bDescriptorType;
187 uByte bDescriptorSubtype;
188 uByte bUnitId;
189 uByte bSourceId;
190 uByte bControlSize;
191 uByte bmaControls[255]; /* size for more than enough */
192 /* uByte iFeature; */
193} UPACKED;
194
195/* UDESCSUB_AC_PROCESSING */
196struct usb_audio_processing_unit {
197 uByte bLength;
198 uByte bDescriptorType;
199 uByte bDescriptorSubtype;
200 uByte bUnitId;
201 uWord wProcessType;
202 uByte bNrInPins;
203 uByte baSourceId[255]; /* [bNrInPins] */
204 /* struct usb_audio_processing_unit_1 */
205} UPACKED;
206struct usb_audio_processing_unit_1{
207 uByte bNrChannels;
208 uWord wChannelConfig;
209 uByte iChannelNames;
210 uByte bControlSize;
211 uByte bmControls[255]; /* [bControlSize] */
212#define UA_PROC_ENABLE_MASK 1
213} UPACKED;
214
215struct usb_audio_processing_unit_updown {
216 uByte iProcessing;
217 uByte bNrModes;
218 uWord waModes[255]; /* [bNrModes] */
219} UPACKED;
220
221/* UDESCSUB_AC_EXTENSION */
222struct usb_audio_extension_unit {
223 uByte bLength;
224 uByte bDescriptorType;
225 uByte bDescriptorSubtype;
226 uByte bUnitId;
227 uWord wExtensionCode;
228 uByte bNrInPins;
229 uByte baSourceId[255]; /* [bNrInPins] */
230 /* struct usb_audio_extension_unit_1 */
231} UPACKED;
232struct usb_audio_extension_unit_1 {
233 uByte bNrChannels;
234 uWord wChannelConfig;
235 uByte iChannelNames;
236 uByte bControlSize;
237 uByte bmControls[255]; /* [bControlSize] */
238#define UA_EXT_ENABLE_MASK 1
239#define UA_EXT_ENABLE 1
240 /*uByte iExtension;*/
241} UPACKED;
242
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
306
307
308#define SET_CUR 0x01
309#define GET_CUR 0x81
310#define SET_MIN 0x02
311#define GET_MIN 0x82
312#define SET_MAX 0x03
313#define GET_MAX 0x83
314#define SET_RES 0x04
315#define GET_RES 0x84
316#define SET_MEM 0x05
317#define GET_MEM 0x85
318#define GET_STAT 0xff
319
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
330
331#define FU_MASK(u) (1 << ((u)-1))
332
333#define MASTER_CHAN 0
334
335#define AS_GENERAL 1
336#define FORMAT_TYPE 2
337#define FORMAT_SPECIFIC 3
338
339#define UA_FMT_PCM 1
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
344
345#define SAMPLING_FREQ_CONTROL 0x01
346
347#define FORMAT_TYPE_UNDEFINED 0
348#define FORMAT_TYPE_I 1
349#define FORMAT_TYPE_II 2
350#define FORMAT_TYPE_III 3
351
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
381