uaudioreg.h revision 1.6 1 1.6 augustss /* $NetBSD: uaudioreg.h,v 1.6 2000/05/30 10:10:17 augustss Exp $ */
2 1.1 augustss
3 1.1 augustss /*
4 1.1 augustss * Copyright (c) 1999 The NetBSD Foundation, Inc.
5 1.1 augustss * All rights reserved.
6 1.1 augustss *
7 1.5 augustss * This code is derived from software contributed to The NetBSD Foundation
8 1.5 augustss * by Lennart Augustsson (lennart (at) augustsson.net) at
9 1.5 augustss * Carlstedt Research & Technology.
10 1.1 augustss *
11 1.1 augustss * Redistribution and use in source and binary forms, with or without
12 1.1 augustss * modification, are permitted provided that the following conditions
13 1.1 augustss * are met:
14 1.1 augustss * 1. Redistributions of source code must retain the above copyright
15 1.1 augustss * notice, this list of conditions and the following disclaimer.
16 1.1 augustss * 2. Redistributions in binary form must reproduce the above copyright
17 1.1 augustss * notice, this list of conditions and the following disclaimer in the
18 1.1 augustss * documentation and/or other materials provided with the distribution.
19 1.1 augustss * 3. All advertising materials mentioning features or use of this software
20 1.1 augustss * must display the following acknowledgement:
21 1.1 augustss * This product includes software developed by the NetBSD
22 1.1 augustss * Foundation, Inc. and its contributors.
23 1.1 augustss * 4. Neither the name of The NetBSD Foundation nor the names of its
24 1.1 augustss * contributors may be used to endorse or promote products derived
25 1.1 augustss * from this software without specific prior written permission.
26 1.1 augustss *
27 1.1 augustss * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
28 1.1 augustss * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
29 1.1 augustss * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
30 1.1 augustss * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
31 1.1 augustss * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32 1.1 augustss * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
33 1.1 augustss * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
34 1.1 augustss * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
35 1.1 augustss * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
36 1.1 augustss * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37 1.1 augustss * POSSIBILITY OF SUCH DAMAGE.
38 1.1 augustss */
39 1.1 augustss
40 1.1 augustss #define UAUDIO_VERSION 0x100
41 1.1 augustss
42 1.1 augustss #define UDESC_CS_DEVICE 0x21
43 1.1 augustss #define UDESC_CS_CONFIG 0x22
44 1.1 augustss #define UDESC_CS_STRING 0x23
45 1.1 augustss #define UDESC_CS_INTERFACE 0x24
46 1.1 augustss #define UDESC_CS_ENDPOINT 0x25
47 1.1 augustss
48 1.1 augustss #define UDESCSUB_AC_HEADER 1
49 1.1 augustss #define UDESCSUB_AC_INPUT 2
50 1.1 augustss #define UDESCSUB_AC_OUTPUT 3
51 1.1 augustss #define UDESCSUB_AC_MIXER 4
52 1.1 augustss #define UDESCSUB_AC_SELECTOR 5
53 1.1 augustss #define UDESCSUB_AC_FEATURE 6
54 1.1 augustss #define UDESCSUB_AC_PROCESSING 7
55 1.1 augustss #define UDESCSUB_AC_EXTENSION 8
56 1.1 augustss
57 1.1 augustss /* The first fields are identical to usb_endpoint_descriptor_t */
58 1.1 augustss typedef struct {
59 1.1 augustss uByte bLength;
60 1.1 augustss uByte bDescriptorType;
61 1.1 augustss uByte bEndpointAddress;
62 1.1 augustss uByte bmAttributes;
63 1.1 augustss uWord wMaxPacketSize;
64 1.1 augustss uByte bInterval;
65 1.1 augustss /*
66 1.1 augustss * The following two entries are only used by the Audio Class.
67 1.1 augustss * And according to the specs the Audio Class is the only one
68 1.1 augustss * allowed to extend the endpoint descriptor.
69 1.1 augustss * Who knows what goes on in the minds of the people in the USB
70 1.1 augustss * standardization? :-(
71 1.1 augustss */
72 1.1 augustss uByte bRefresh;
73 1.1 augustss uByte bSynchAddress;
74 1.6 augustss } UPACKED usb_endpoint_descriptor_audio_t;
75 1.1 augustss
76 1.1 augustss struct usb_audio_control_descriptor {
77 1.1 augustss uByte bLength;
78 1.1 augustss uByte bDescriptorType;
79 1.1 augustss uByte bDescriptorSubtype;
80 1.1 augustss uWord bcdADC;
81 1.1 augustss uWord wTotalLength;
82 1.1 augustss uByte bInCollection;
83 1.1 augustss uByte baInterfaceNr[1];
84 1.6 augustss } UPACKED;
85 1.1 augustss
86 1.1 augustss struct usb_audio_streaming_interface_descriptor {
87 1.1 augustss uByte bLength;
88 1.1 augustss uByte bDescriptorType;
89 1.1 augustss uByte bDescriptorSubtype;
90 1.1 augustss uByte bTerminalLink;
91 1.1 augustss uByte bDelay;
92 1.1 augustss uWord wFormatTag;
93 1.6 augustss } UPACKED;
94 1.1 augustss
95 1.1 augustss struct usb_audio_streaming_endpoint_descriptor {
96 1.1 augustss uByte bLength;
97 1.1 augustss uByte bDescriptorType;
98 1.1 augustss uByte bDescriptorSubtype;
99 1.1 augustss uByte bmAttributes;
100 1.1 augustss uByte bLockDelayUnits;
101 1.1 augustss uWord wLockDelay;
102 1.6 augustss } UPACKED;
103 1.1 augustss
104 1.1 augustss struct usb_audio_streaming_type1_descriptor {
105 1.1 augustss uByte bLength;
106 1.1 augustss uByte bDescriptorType;
107 1.1 augustss uByte bDescriptorSubtype;
108 1.1 augustss uByte bFormatType;
109 1.1 augustss uByte bNrChannels;
110 1.1 augustss uByte bSubFrameSize;
111 1.1 augustss uByte bBitResolution;
112 1.1 augustss uByte bSamFreqType;
113 1.1 augustss #define UA_SAMP_CONTNUOUS 0
114 1.1 augustss uByte tSamFreq[3*2]; /* room for low and high */
115 1.1 augustss #define UA_GETSAMP(p, n) ((p)->tSamFreq[(n)*3+0] | ((p)->tSamFreq[(n)*3+1] << 8) | ((p)->tSamFreq[(n)*3+2] << 16))
116 1.1 augustss #define UA_SAMP_LO(p) UA_GETSAMP(p, 0)
117 1.1 augustss #define UA_SAMP_HI(p) UA_GETSAMP(p, 1)
118 1.6 augustss } UPACKED;
119 1.1 augustss
120 1.1 augustss struct usb_audio_cluster {
121 1.1 augustss uByte bNrChannels;
122 1.1 augustss uWord wChannelConfig;
123 1.1 augustss uByte iChannelNames;
124 1.6 augustss } UPACKED;
125 1.1 augustss
126 1.1 augustss /* UDESCSUB_AC_INPUT */
127 1.1 augustss struct usb_audio_input_terminal {
128 1.1 augustss uByte bLength;
129 1.1 augustss uByte bDescriptorType;
130 1.1 augustss uByte bDescriptorSubtype;
131 1.1 augustss uByte bTerminalId;
132 1.1 augustss uWord wTerminalType;
133 1.1 augustss uByte bAssocTerminal;
134 1.1 augustss uByte bNrChannels;
135 1.1 augustss uWord wChannelConfig;
136 1.1 augustss uByte iChannelNames;
137 1.1 augustss uByte iTerminal;
138 1.6 augustss } UPACKED;
139 1.1 augustss
140 1.1 augustss /* UDESCSUB_AC_OUTPUT */
141 1.1 augustss struct usb_audio_output_terminal {
142 1.1 augustss uByte bLength;
143 1.1 augustss uByte bDescriptorType;
144 1.1 augustss uByte bDescriptorSubtype;
145 1.1 augustss uByte bTerminalId;
146 1.1 augustss uWord wTerminalType;
147 1.1 augustss uByte bAssocTerminal;
148 1.1 augustss uByte bSourceId;
149 1.1 augustss uByte iTerminal;
150 1.6 augustss } UPACKED;
151 1.1 augustss
152 1.1 augustss /* UDESCSUB_AC_MIXER */
153 1.1 augustss struct usb_audio_mixer_unit {
154 1.1 augustss uByte bLength;
155 1.1 augustss uByte bDescriptorType;
156 1.1 augustss uByte bDescriptorSubtype;
157 1.1 augustss uByte bUnitId;
158 1.1 augustss uByte bNrInPins;
159 1.4 augustss uByte baSourceId[255]; /* [bNrInPins] */
160 1.1 augustss /* struct usb_audio_mixer_unit_1 */
161 1.6 augustss } UPACKED;
162 1.1 augustss struct usb_audio_mixer_unit_1 {
163 1.1 augustss uByte bNrChannels;
164 1.1 augustss uWord wChannelConfig;
165 1.1 augustss uByte iChannelNames;
166 1.4 augustss uByte bmControls[255]; /* [bNrChannels] */
167 1.1 augustss /*uByte iMixer;*/
168 1.6 augustss } UPACKED;
169 1.1 augustss
170 1.1 augustss /* UDESCSUB_AC_SELECTOR */
171 1.1 augustss struct usb_audio_selector_unit {
172 1.1 augustss uByte bLength;
173 1.1 augustss uByte bDescriptorType;
174 1.1 augustss uByte bDescriptorSubtype;
175 1.1 augustss uByte bUnitId;
176 1.1 augustss uByte bNrInPins;
177 1.4 augustss uByte baSourceId[255]; /* [bNrInPins] */
178 1.1 augustss /* uByte iSelector; */
179 1.6 augustss } UPACKED;
180 1.1 augustss
181 1.1 augustss /* UDESCSUB_AC_FEATURE */
182 1.1 augustss struct usb_audio_feature_unit {
183 1.1 augustss uByte bLength;
184 1.1 augustss uByte bDescriptorType;
185 1.1 augustss uByte bDescriptorSubtype;
186 1.1 augustss uByte bUnitId;
187 1.1 augustss uByte bSourceId;
188 1.1 augustss uByte bControlSize;
189 1.1 augustss uByte bmaControls[255]; /* size for more than enough */
190 1.1 augustss /* uByte iFeature; */
191 1.6 augustss } UPACKED;
192 1.1 augustss
193 1.1 augustss /* UDESCSUB_AC_PROCESSING */
194 1.1 augustss struct usb_audio_processing_unit {
195 1.1 augustss uByte bLength;
196 1.1 augustss uByte bDescriptorType;
197 1.1 augustss uByte bDescriptorSubtype;
198 1.1 augustss uByte bUnitId;
199 1.1 augustss uWord wProcessType;
200 1.1 augustss uByte bNrInPins;
201 1.4 augustss uByte baSourceId[255]; /* [bNrInPins] */
202 1.1 augustss /* struct usb_audio_processing_unit_1 */
203 1.6 augustss } UPACKED;
204 1.1 augustss struct usb_audio_processing_unit_1{
205 1.1 augustss uByte bNrChannels;
206 1.1 augustss uWord wChannelConfig;
207 1.1 augustss uByte iChannelNames;
208 1.1 augustss uByte bControlSize;
209 1.4 augustss uByte bmControls[255]; /* [bControlSize] */
210 1.3 augustss #define UA_PROC_ENABLE_MASK 1
211 1.6 augustss } UPACKED;
212 1.4 augustss
213 1.4 augustss struct usb_audio_processing_unit_updown {
214 1.4 augustss uByte iProcessing;
215 1.4 augustss uByte bNrModes;
216 1.4 augustss uWord waModes[255]; /* [bNrModes] */
217 1.6 augustss } UPACKED;
218 1.1 augustss
219 1.1 augustss /* UDESCSUB_AC_EXTENSION */
220 1.1 augustss struct usb_audio_extension_unit {
221 1.1 augustss uByte bLength;
222 1.1 augustss uByte bDescriptorType;
223 1.1 augustss uByte bDescriptorSubtype;
224 1.1 augustss uByte bUnitId;
225 1.1 augustss uWord wExtensionCode;
226 1.1 augustss uByte bNrInPins;
227 1.4 augustss uByte baSourceId[255]; /* [bNrInPins] */
228 1.1 augustss /* struct usb_audio_extension_unit_1 */
229 1.6 augustss } UPACKED;
230 1.1 augustss struct usb_audio_extension_unit_1 {
231 1.1 augustss uByte bNrChannels;
232 1.1 augustss uWord wChannelConfig;
233 1.1 augustss uByte iChannelNames;
234 1.1 augustss uByte bControlSize;
235 1.4 augustss uByte bmControls[255]; /* [bControlSize] */
236 1.3 augustss #define UA_EXT_ENABLE_MASK 1
237 1.3 augustss #define UA_EXT_ENABLE 1
238 1.1 augustss /*uByte iExtension;*/
239 1.6 augustss } UPACKED;
240 1.1 augustss
241 1.1 augustss #define UAT_STREAM 0x0101
242 1.1 augustss
243 1.1 augustss #define SET_CUR 0x01
244 1.1 augustss #define GET_CUR 0x81
245 1.1 augustss #define SET_MIN 0x02
246 1.1 augustss #define GET_MIN 0x82
247 1.1 augustss #define SET_MAX 0x03
248 1.1 augustss #define GET_MAX 0x83
249 1.1 augustss #define SET_RES 0x04
250 1.1 augustss #define GET_RES 0x84
251 1.1 augustss #define SET_MEM 0x05
252 1.1 augustss #define GET_MEM 0x85
253 1.1 augustss #define GET_STAT 0xff
254 1.1 augustss
255 1.1 augustss #define MUTE_CONTROL 0x01
256 1.1 augustss #define VOLUME_CONTROL 0x02
257 1.1 augustss #define BASS_CONTROL 0x03
258 1.1 augustss #define MID_CONTROL 0x04
259 1.1 augustss #define TREBLE_CONTROL 0x05
260 1.1 augustss #define GRAPHIC_EQUALIZER_CONTROL 0x06
261 1.1 augustss #define AGC_CONTROL 0x07
262 1.1 augustss #define DELAY_CONTROL 0x08
263 1.1 augustss #define BASS_BOOST_CONTROL 0x09
264 1.1 augustss #define LOUDNESS_CONTROL 0x0a
265 1.1 augustss
266 1.1 augustss #define FU_MASK(u) (1 << ((u)-1))
267 1.1 augustss
268 1.2 augustss #define MASTER_CHAN 0
269 1.1 augustss
270 1.2 augustss #define AS_GENERAL 1
271 1.2 augustss #define FORMAT_TYPE 2
272 1.1 augustss #define FORMAT_SPECIFIC 3
273 1.1 augustss
274 1.2 augustss #define UA_FMT_PCM 1
275 1.2 augustss #define UA_FMT_PCM8 2
276 1.2 augustss #define UA_FMT_IEEE_FLOAT 3
277 1.2 augustss #define UA_FMT_ALAW 4
278 1.2 augustss #define UA_FMT_MULAW 5
279 1.1 augustss
280 1.1 augustss #define SAMPLING_FREQ_CONTROL 0x01
281 1.2 augustss
282 1.2 augustss #define FORMAT_TYPE_UNDEFINED 0
283 1.2 augustss #define FORMAT_TYPE_I 1
284 1.2 augustss #define FORMAT_TYPE_II 2
285 1.2 augustss #define FORMAT_TYPE_III 3
286 1.3 augustss
287 1.4 augustss #define UA_PROC_MASK(n) (1<< ((n)-1))
288 1.3 augustss #define PROCESS_UNDEFINED 0
289 1.3 augustss #define XX_ENABLE_CONTROL 1
290 1.3 augustss #define UPDOWNMIX_PROCESS 1
291 1.3 augustss #define UD_ENABLE_CONTROL 1
292 1.3 augustss #define UD_MODE_SELECT_CONTROL 2
293 1.3 augustss #define DOLBY_PROLOGIC_PROCESS 2
294 1.3 augustss #define DP_ENABLE_CONTROL 1
295 1.3 augustss #define DP_MODE_SELECT_CONTROL 2
296 1.3 augustss #define P3D_STEREO_EXTENDER_PROCESS 3
297 1.3 augustss #define P3D_ENABLE_CONTROL 1
298 1.3 augustss #define P3D_SPACIOUSNESS_CONTROL 2
299 1.3 augustss #define REVERBATION_PROCESS 4
300 1.3 augustss #define RV_ENABLE_CONTROL 1
301 1.3 augustss #define RV_LEVEL_CONTROL 2
302 1.3 augustss #define RV_TIME_CONTROL 3
303 1.3 augustss #define RV_FEEDBACK_CONTROL 4
304 1.3 augustss #define CHORUS_PROCESS 5
305 1.3 augustss #define CH_ENABLE_CONTROL 1
306 1.3 augustss #define CH_LEVEL_CONTROL 2
307 1.3 augustss #define CH_RATE_CONTROL 3
308 1.3 augustss #define CH_DEPTH_CONTROL 4
309 1.3 augustss #define DYN_RANGE_COMP_PROCESS 6
310 1.3 augustss #define DR_ENABLE_CONTROL 1
311 1.3 augustss #define DR_COMPRESSION_RATE_CONTROL 2
312 1.3 augustss #define DR_MAXAMPL_CONTROL 3
313 1.3 augustss #define DR_THRESHOLD_CONTROL 4
314 1.3 augustss #define DR_ATTACK_TIME_CONTROL 5
315 1.3 augustss #define DR_RELEASE_TIME_CONTROL 6
316