Expand PMF_FN_* macros.
[netbsd-mini2440.git] / sys / dev / usb / uaudioreg.h
blob0a362d0d7b54b59616842614bd73181452f46567
1 /* $NetBSD: uaudioreg.h,v 1.14 2007/02/26 13:15:32 drochner Exp $ */
3 /*
4 * Copyright (c) 1999 The NetBSD Foundation, Inc.
5 * All rights reserved.
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Lennart Augustsson (lennart@augustsson.net) at
9 * Carlstedt Research & Technology.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
20 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
21 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
24 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE.
33 #define UAUDIO_VERSION 0x100
35 #define UDESC_CS_CONFIG 0x22
36 #define UDESC_CS_STRING 0x23
37 #define UDESC_CS_INTERFACE 0x24
38 #define UDESC_CS_ENDPOINT 0x25
40 #define UDESCSUB_AC_HEADER 1
41 #define UDESCSUB_AC_INPUT 2
42 #define UDESCSUB_AC_OUTPUT 3
43 #define UDESCSUB_AC_MIXER 4
44 #define UDESCSUB_AC_SELECTOR 5
45 #define UDESCSUB_AC_FEATURE 6
46 #define UDESCSUB_AC_PROCESSING 7
47 #define UDESCSUB_AC_EXTENSION 8
49 /* The first fields are identical to usb_endpoint_descriptor_t */
50 typedef struct {
51 uByte bLength;
52 uByte bDescriptorType;
53 uByte bEndpointAddress;
54 uByte bmAttributes;
55 uWord wMaxPacketSize;
56 uByte bInterval;
58 * The following two entries are only used by the Audio Class.
59 * And according to the specs the Audio Class is the only one
60 * allowed to extend the endpoint descriptor.
61 * Who knows what goes on in the minds of the people in the USB
62 * standardization? :-(
64 uByte bRefresh;
65 uByte bSynchAddress;
66 } UPACKED usb_endpoint_descriptor_audio_t;
68 /* generic, for iteration */
69 typedef struct {
70 uByte bLength;
71 uByte bDescriptorType;
72 uByte bDescriptorSubtype;
73 } UPACKED uaudio_cs_descriptor_t;
75 struct usb_audio_control_descriptor {
76 uByte bLength;
77 uByte bDescriptorType;
78 uByte bDescriptorSubtype;
79 uWord bcdADC;
80 uWord wTotalLength;
81 uByte bInCollection;
82 uByte baInterfaceNr[1];
83 } UPACKED;
85 struct usb_audio_streaming_interface_descriptor {
86 uByte bLength;
87 uByte bDescriptorType;
88 uByte bDescriptorSubtype;
89 uByte bTerminalLink;
90 uByte bDelay;
91 uWord wFormatTag;
92 } UPACKED;
94 struct usb_audio_streaming_endpoint_descriptor {
95 uByte bLength;
96 uByte bDescriptorType;
97 uByte bDescriptorSubtype;
98 uByte bmAttributes;
99 #define UA_SED_FREQ_CONTROL 0x01
100 #define UA_SED_PITCH_CONTROL 0x02
101 #define UA_SED_MAXPACKETSONLY 0x80
102 uByte bLockDelayUnits;
103 uWord wLockDelay;
104 } UPACKED;
106 struct 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;
122 struct usb_audio_cluster {
123 uByte bNrChannels;
124 uWord wChannelConfig;
125 #define UA_CHANNEL_LEFT 0x0001
126 #define UA_CHANNEL_RIGHT 0x0002
127 #define UA_CHANNEL_CENTER 0x0004
128 #define UA_CHANNEL_LFE 0x0008
129 #define UA_CHANNEL_L_SURROUND 0x0010
130 #define UA_CHANNEL_R_SURROUND 0x0020
131 #define UA_CHANNEL_L_CENTER 0x0040
132 #define UA_CHANNEL_R_CENTER 0x0080
133 #define UA_CHANNEL_SURROUND 0x0100
134 #define UA_CHANNEL_L_SIDE 0x0200
135 #define UA_CHANNEL_R_SIDE 0x0400
136 #define UA_CHANNEL_TOP 0x0800
137 uByte iChannelNames;
138 } UPACKED;
140 /* Shared by all units and terminals */
141 struct usb_audio_unit {
142 uByte bLength;
143 uByte bDescriptorType;
144 uByte bDescriptorSubtype;
145 uByte bUnitId;
148 /* UDESCSUB_AC_INPUT */
149 struct usb_audio_input_terminal {
150 uByte bLength;
151 uByte bDescriptorType;
152 uByte bDescriptorSubtype;
153 uByte bTerminalId;
154 uWord wTerminalType;
155 uByte bAssocTerminal;
156 uByte bNrChannels;
157 uWord wChannelConfig;
158 uByte iChannelNames;
159 uByte iTerminal;
160 } UPACKED;
162 /* UDESCSUB_AC_OUTPUT */
163 struct usb_audio_output_terminal {
164 uByte bLength;
165 uByte bDescriptorType;
166 uByte bDescriptorSubtype;
167 uByte bTerminalId;
168 uWord wTerminalType;
169 uByte bAssocTerminal;
170 uByte bSourceId;
171 uByte iTerminal;
172 } UPACKED;
174 /* UDESCSUB_AC_MIXER */
175 struct usb_audio_mixer_unit {
176 uByte bLength;
177 uByte bDescriptorType;
178 uByte bDescriptorSubtype;
179 uByte bUnitId;
180 uByte bNrInPins;
181 uByte baSourceId[255]; /* [bNrInPins] */
182 /* struct usb_audio_mixer_unit_1 */
183 } UPACKED;
184 struct usb_audio_mixer_unit_1 {
185 uByte bNrChannels;
186 uWord wChannelConfig;
187 uByte iChannelNames;
188 uByte bmControls[255]; /* [bNrChannels] */
189 /*uByte iMixer;*/
190 } UPACKED;
192 /* UDESCSUB_AC_SELECTOR */
193 struct usb_audio_selector_unit {
194 uByte bLength;
195 uByte bDescriptorType;
196 uByte bDescriptorSubtype;
197 uByte bUnitId;
198 uByte bNrInPins;
199 uByte baSourceId[255]; /* [bNrInPins] */
200 /* uByte iSelector; */
201 } UPACKED;
203 /* UDESCSUB_AC_FEATURE */
204 struct usb_audio_feature_unit {
205 uByte bLength;
206 uByte bDescriptorType;
207 uByte bDescriptorSubtype;
208 uByte bUnitId;
209 uByte bSourceId;
210 uByte bControlSize;
211 uByte bmaControls[255]; /* size for more than enough */
212 /* uByte iFeature; */
213 } UPACKED;
215 /* UDESCSUB_AC_PROCESSING */
216 struct usb_audio_processing_unit {
217 uByte bLength;
218 uByte bDescriptorType;
219 uByte bDescriptorSubtype;
220 uByte bUnitId;
221 uWord wProcessType;
222 uByte bNrInPins;
223 uByte baSourceId[255]; /* [bNrInPins] */
224 /* struct usb_audio_processing_unit_1 */
225 } UPACKED;
226 struct usb_audio_processing_unit_1{
227 uByte bNrChannels;
228 uWord wChannelConfig;
229 uByte iChannelNames;
230 uByte bControlSize;
231 uByte bmControls[255]; /* [bControlSize] */
232 #define UA_PROC_ENABLE_MASK 1
233 } UPACKED;
235 struct usb_audio_processing_unit_updown {
236 uByte iProcessing;
237 uByte bNrModes;
238 uWord waModes[255]; /* [bNrModes] */
239 } UPACKED;
241 /* UDESCSUB_AC_EXTENSION */
242 struct usb_audio_extension_unit {
243 uByte bLength;
244 uByte bDescriptorType;
245 uByte bDescriptorSubtype;
246 uByte bUnitId;
247 uWord wExtensionCode;
248 uByte bNrInPins;
249 uByte baSourceId[255]; /* [bNrInPins] */
250 /* struct usb_audio_extension_unit_1 */
251 } UPACKED;
252 struct usb_audio_extension_unit_1 {
253 uByte bNrChannels;
254 uWord wChannelConfig;
255 uByte iChannelNames;
256 uByte bControlSize;
257 uByte bmControls[255]; /* [bControlSize] */
258 #define UA_EXT_ENABLE_MASK 1
259 #define UA_EXT_ENABLE 1
260 /*uByte iExtension;*/
261 } UPACKED;
263 /* USB terminal types */
264 #define UAT_UNDEFINED 0x0100
265 #define UAT_STREAM 0x0101
266 #define UAT_VENDOR 0x01ff
267 /* input terminal types */
268 #define UATI_UNDEFINED 0x0200
269 #define UATI_MICROPHONE 0x0201
270 #define UATI_DESKMICROPHONE 0x0202
271 #define UATI_PERSONALMICROPHONE 0x0203
272 #define UATI_OMNIMICROPHONE 0x0204
273 #define UATI_MICROPHONEARRAY 0x0205
274 #define UATI_PROCMICROPHONEARR 0x0206
275 /* output terminal types */
276 #define UATO_UNDEFINED 0x0300
277 #define UATO_SPEAKER 0x0301
278 #define UATO_HEADPHONES 0x0302
279 #define UATO_DISPLAYAUDIO 0x0303
280 #define UATO_DESKTOPSPEAKER 0x0304
281 #define UATO_ROOMSPEAKER 0x0305
282 #define UATO_COMMSPEAKER 0x0306
283 #define UATO_SUBWOOFER 0x0307
284 /* bidir terminal types */
285 #define UATB_UNDEFINED 0x0400
286 #define UATB_HANDSET 0x0401
287 #define UATB_HEADSET 0x0402
288 #define UATB_SPEAKERPHONE 0x0403
289 #define UATB_SPEAKERPHONEESUP 0x0404
290 #define UATB_SPEAKERPHONEECANC 0x0405
291 /* telephony terminal types */
292 #define UATT_UNDEFINED 0x0500
293 #define UATT_PHONELINE 0x0501
294 #define UATT_TELEPHONE 0x0502
295 #define UATT_DOWNLINEPHONE 0x0503
296 /* external terminal types */
297 #define UATE_UNDEFINED 0x0600
298 #define UATE_ANALOGCONN 0x0601
299 #define UATE_DIGITALAUIFC 0x0602
300 #define UATE_LINECONN 0x0603
301 #define UATE_LEGACYCONN 0x0604
302 #define UATE_SPDIF 0x0605
303 #define UATE_1394DA 0x0606
304 #define UATE_1394DV 0x0607
305 /* embedded function terminal types */
306 #define UATF_UNDEFINED 0x0700
307 #define UATF_CALIBNOISE 0x0701
308 #define UATF_EQUNOISE 0x0702
309 #define UATF_CDPLAYER 0x0703
310 #define UATF_DAT 0x0704
311 #define UATF_DCC 0x0705
312 #define UATF_MINIDISK 0x0706
313 #define UATF_ANALOGTAPE 0x0707
314 #define UATF_PHONOGRAPH 0x0708
315 #define UATF_VCRAUDIO 0x0709
316 #define UATF_VIDEODISCAUDIO 0x070a
317 #define UATF_DVDAUDIO 0x070b
318 #define UATF_TVTUNERAUDIO 0x070c
319 #define UATF_SATELLITE 0x070d
320 #define UATF_CABLETUNER 0x070e
321 #define UATF_DSS 0x070f
322 #define UATF_RADIORECV 0x0710
323 #define UATF_RADIOXMIT 0x0711
324 #define UATF_MULTITRACK 0x0712
325 #define UATF_SYNTHESIZER 0x0713
328 #define SET_CUR 0x01
329 #define GET_CUR 0x81
330 #define SET_MIN 0x02
331 #define GET_MIN 0x82
332 #define SET_MAX 0x03
333 #define GET_MAX 0x83
334 #define SET_RES 0x04
335 #define GET_RES 0x84
336 #define SET_MEM 0x05
337 #define GET_MEM 0x85
338 #define GET_STAT 0xff
340 #define MUTE_CONTROL 0x01
341 #define VOLUME_CONTROL 0x02
342 #define BASS_CONTROL 0x03
343 #define MID_CONTROL 0x04
344 #define TREBLE_CONTROL 0x05
345 #define GRAPHIC_EQUALIZER_CONTROL 0x06
346 #define AGC_CONTROL 0x07
347 #define DELAY_CONTROL 0x08
348 #define BASS_BOOST_CONTROL 0x09
349 #define LOUDNESS_CONTROL 0x0a
351 #define FU_MASK(u) (1 << ((u)-1))
353 #define MASTER_CHAN 0
355 #define AS_GENERAL 1
356 #define FORMAT_TYPE 2
357 #define FORMAT_SPECIFIC 3
359 #define UA_FMT_PCM 1
360 #define UA_FMT_PCM8 2
361 #define UA_FMT_IEEE_FLOAT 3
362 #define UA_FMT_ALAW 4
363 #define UA_FMT_MULAW 5
364 #define UA_FMT_MPEG 0x1001
365 #define UA_FMT_AC3 0x1002
367 #define SAMPLING_FREQ_CONTROL 0x01
368 #define PITCH_CONTROL 0x02
370 #define FORMAT_TYPE_UNDEFINED 0
371 #define FORMAT_TYPE_I 1
372 #define FORMAT_TYPE_II 2
373 #define FORMAT_TYPE_III 3
375 #define UA_PROC_MASK(n) (1<< ((n)-1))
376 #define PROCESS_UNDEFINED 0
377 #define XX_ENABLE_CONTROL 1
378 #define UPDOWNMIX_PROCESS 1
379 #define UD_ENABLE_CONTROL 1
380 #define UD_MODE_SELECT_CONTROL 2
381 #define DOLBY_PROLOGIC_PROCESS 2
382 #define DP_ENABLE_CONTROL 1
383 #define DP_MODE_SELECT_CONTROL 2
384 #define P3D_STEREO_EXTENDER_PROCESS 3
385 #define P3D_ENABLE_CONTROL 1
386 #define P3D_SPACIOUSNESS_CONTROL 2
387 #define REVERBATION_PROCESS 4
388 #define RV_ENABLE_CONTROL 1
389 #define RV_LEVEL_CONTROL 2
390 #define RV_TIME_CONTROL 3
391 #define RV_FEEDBACK_CONTROL 4
392 #define CHORUS_PROCESS 5
393 #define CH_ENABLE_CONTROL 1
394 #define CH_LEVEL_CONTROL 2
395 #define CH_RATE_CONTROL 3
396 #define CH_DEPTH_CONTROL 4
397 #define DYN_RANGE_COMP_PROCESS 6
398 #define DR_ENABLE_CONTROL 1
399 #define DR_COMPRESSION_RATE_CONTROL 2
400 #define DR_MAXAMPL_CONTROL 3
401 #define DR_THRESHOLD_CONTROL 4
402 #define DR_ATTACK_TIME_CONTROL 5
403 #define DR_RELEASE_TIME_CONTROL 6