xref: /freebsd/sys/dev/sound/usb/uaudioreg.h (revision c243e4902be8df1e643c76b5f18b68bb77cc5268)
1 /*	$NetBSD: uaudioreg.h,v 1.12 2004/11/05 19:08:29 kent Exp $	*/
2 /* $FreeBSD$ */
3 
4 /*-
5  * Copyright (c) 1999 The NetBSD Foundation, Inc.
6  * All rights reserved.
7  *
8  * This code is derived from software contributed to The NetBSD Foundation
9  * by Lennart Augustsson (lennart@augustsson.net) at
10  * Carlstedt Research & Technology.
11  *
12  * Redistribution and use in source and binary forms, with or without
13  * modification, are permitted provided that the following conditions
14  * are met:
15  * 1. Redistributions of source code must retain the above copyright
16  *    notice, this list of conditions and the following disclaimer.
17  * 2. Redistributions in binary form must reproduce the above copyright
18  *    notice, this list of conditions and the following disclaimer in the
19  *    documentation and/or other materials provided with the distribution.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
22  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
23  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
25  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31  * POSSIBILITY OF SUCH DAMAGE.
32  */
33 
34 #ifndef _UAUDIOREG_H_
35 #define	_UAUDIOREG_H_
36 
37 #define	UAUDIO_VERSION		0x0100
38 #define	UAUDIO_VERSION_20	0x0200
39 
40 #define	UAUDIO_PROTOCOL_20	0x20
41 
42 #define	UDESC_CS_UNDEFINED	0x20
43 #define	UDESC_CS_DEVICE		0x21
44 #define	UDESC_CS_CONFIG		0x22
45 #define	UDESC_CS_STRING		0x23
46 #define	UDESC_CS_INTERFACE	0x24
47 #define	UDESC_CS_ENDPOINT	0x25
48 
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
57 /* ==== USB audio 2.0 ==== */
58 #define	UDESCSUB_AC_EFFECT	7
59 #define	UDESCSUB_AC_PROCESSING_V2 8
60 #define	UDESCSUB_AC_EXTENSION_V2 9
61 #define	UDESCSUB_AC_CLOCK_SRC	10
62 #define	UDESCSUB_AC_CLOCK_SEL	11
63 #define	UDESCSUB_AC_CLOCK_MUL	12
64 #define	UDESCSUB_AC_SAMPLE_RT	13
65 
66 /* These macros check if the endpoint descriptor has additional fields */
67 #define	UEP_MINSIZE	7
68 #define	UEP_HAS_REFRESH(ep)	((ep)->bLength >= 8)
69 #define	UEP_HAS_SYNCADDR(ep)	((ep)->bLength >= 9)
70 
71 /* The first fields are identical to struct usb_endpoint_descriptor */
72 typedef struct {
73 	uByte	bLength;
74 	uByte	bDescriptorType;
75 	uByte	bEndpointAddress;
76 	uByte	bmAttributes;
77 	uWord	wMaxPacketSize;
78 	uByte	bInterval;
79 	/*
80 	 * The following two entries are only used by the Audio Class.
81 	 * And according to the specs the Audio Class is the only one
82 	 * allowed to extend the endpoint descriptor.
83 	 * Who knows what goes on in the minds of the people in the USB
84 	 * standardization?  :-(
85 	 */
86 	uByte	bRefresh;
87 	uByte	bSynchAddress;
88 } __packed usb_endpoint_descriptor_audio_t;
89 
90 struct usb_audio_control_descriptor {
91 	uByte	bLength;
92 	uByte	bDescriptorType;
93 	uByte	bDescriptorSubtype;
94 	uWord	bcdADC;
95 	uWord	wTotalLength;
96 	uByte	bInCollection;
97 	uByte	baInterfaceNr[1];
98 } __packed;
99 
100 struct usb_audio_streaming_interface_descriptor {
101 	uByte	bLength;
102 	uByte	bDescriptorType;
103 	uByte	bDescriptorSubtype;
104 	uByte	bTerminalLink;
105 	uByte	bDelay;
106 	uWord	wFormatTag;
107 } __packed;
108 
109 struct usb_audio_streaming_endpoint_descriptor {
110 	uByte	bLength;
111 	uByte	bDescriptorType;
112 	uByte	bDescriptorSubtype;
113 	uByte	bmAttributes;
114 #define	UA_SED_FREQ_CONTROL	0x01
115 #define	UA_SED_PITCH_CONTROL	0x02
116 #define	UA_SED_MAXPACKETSONLY	0x80
117 	uByte	bLockDelayUnits;
118 	uWord	wLockDelay;
119 } __packed;
120 
121 struct usb_audio_streaming_type1_descriptor {
122 	uByte	bLength;
123 	uByte	bDescriptorType;
124 	uByte	bDescriptorSubtype;
125 	uByte	bFormatType;
126 	uByte	bNrChannels;
127 	uByte	bSubFrameSize;
128 	uByte	bBitResolution;
129 	uByte	bSamFreqType;
130 #define	UA_SAMP_CONTNUOUS 0
131 	uByte	tSamFreq[0];
132 #define	UA_GETSAMP(p, n) ((uint32_t)((((p)->tSamFreq[((n)*3)+0]) | \
133 			  ((p)->tSamFreq[((n)*3)+1] << 8) | \
134 			  ((p)->tSamFreq[((n)*3)+2] << 16))))
135 #define	UA_SAMP_LO(p) UA_GETSAMP(p, 0)
136 #define	UA_SAMP_HI(p) UA_GETSAMP(p, 1)
137 } __packed;
138 
139 struct usb_audio_cluster {
140 	uByte	bNrChannels;
141 	uWord	wChannelConfig;
142 #define	UA_CHANNEL_LEFT		0x0001
143 #define	UA_CHANNEL_RIGHT	0x0002
144 #define	UA_CHANNEL_CENTER	0x0004
145 #define	UA_CHANNEL_LFE		0x0008
146 #define	UA_CHANNEL_L_SURROUND	0x0010
147 #define	UA_CHANNEL_R_SURROUND	0x0020
148 #define	UA_CHANNEL_L_CENTER	0x0040
149 #define	UA_CHANNEL_R_CENTER	0x0080
150 #define	UA_CHANNEL_SURROUND	0x0100
151 #define	UA_CHANNEL_L_SIDE	0x0200
152 #define	UA_CHANNEL_R_SIDE	0x0400
153 #define	UA_CHANNEL_TOP		0x0800
154 	uByte	iChannelNames;
155 } __packed;
156 
157 /* Shared by all units and terminals */
158 struct usb_audio_unit {
159 	uByte	bLength;
160 	uByte	bDescriptorType;
161 	uByte	bDescriptorSubtype;
162 	uByte	bUnitId;
163 };
164 
165 /* UDESCSUB_AC_INPUT */
166 struct usb_audio_input_terminal {
167 	uByte	bLength;
168 	uByte	bDescriptorType;
169 	uByte	bDescriptorSubtype;
170 	uByte	bTerminalId;
171 	uWord	wTerminalType;
172 	uByte	bAssocTerminal;
173 	uByte	bNrChannels;
174 	uWord	wChannelConfig;
175 	uByte	iChannelNames;
176 /*	uByte		iTerminal; */
177 } __packed;
178 
179 /* UDESCSUB_AC_OUTPUT */
180 struct usb_audio_output_terminal {
181 	uByte	bLength;
182 	uByte	bDescriptorType;
183 	uByte	bDescriptorSubtype;
184 	uByte	bTerminalId;
185 	uWord	wTerminalType;
186 	uByte	bAssocTerminal;
187 	uByte	bSourceId;
188 	uByte	iTerminal;
189 } __packed;
190 
191 /* UDESCSUB_AC_MIXER */
192 struct usb_audio_mixer_unit_0 {
193 	uByte	bLength;
194 	uByte	bDescriptorType;
195 	uByte	bDescriptorSubtype;
196 	uByte	bUnitId;
197 	uByte	bNrInPins;
198 	uByte	baSourceId[0];		/* [bNrInPins] */
199 	/* struct usb_audio_mixer_unit_1 */
200 } __packed;
201 struct usb_audio_mixer_unit_1 {
202 	uByte	bNrChannels;
203 	uWord	wChannelConfig;
204 	uByte	iChannelNames;
205 	uByte	bmControls[0];		/* [see source code] */
206 	/* uByte		iMixer; */
207 } __packed;
208 
209 /* UDESCSUB_AC_SELECTOR */
210 struct usb_audio_selector_unit {
211 	uByte	bLength;
212 	uByte	bDescriptorType;
213 	uByte	bDescriptorSubtype;
214 	uByte	bUnitId;
215 	uByte	bNrInPins;
216 	uByte	baSourceId[0];		/* [bNrInPins] */
217 	/* uByte	iSelector; */
218 } __packed;
219 
220 /* UDESCSUB_AC_FEATURE */
221 struct usb_audio_feature_unit {
222 	uByte	bLength;
223 	uByte	bDescriptorType;
224 	uByte	bDescriptorSubtype;
225 	uByte	bUnitId;
226 	uByte	bSourceId;
227 	uByte	bControlSize;
228 	uByte	bmaControls[0];		/* [bControlSize * x] */
229 	/* uByte	iFeature; */
230 } __packed;
231 
232 /* UDESCSUB_AC_PROCESSING */
233 struct usb_audio_processing_unit_0 {
234 	uByte	bLength;
235 	uByte	bDescriptorType;
236 	uByte	bDescriptorSubtype;
237 	uByte	bUnitId;
238 	uWord	wProcessType;
239 	uByte	bNrInPins;
240 	uByte	baSourceId[0];		/* [bNrInPins] */
241 	/* struct usb_audio_processing_unit_1 */
242 } __packed;
243 struct usb_audio_processing_unit_1 {
244 	uByte	bNrChannels;
245 	uWord	wChannelConfig;
246 	uByte	iChannelNames;
247 	uByte	bControlSize;
248 	uByte	bmControls[0];		/* [bControlSize] */
249 #define	UA_PROC_ENABLE_MASK 1
250 } __packed;
251 
252 struct usb_audio_processing_unit_updown {
253 	uByte	iProcessing;
254 	uByte	bNrModes;
255 	uWord	waModes[0];		/* [bNrModes] */
256 } __packed;
257 
258 /* UDESCSUB_AC_EXTENSION */
259 struct usb_audio_extension_unit_0 {
260 	uByte	bLength;
261 	uByte	bDescriptorType;
262 	uByte	bDescriptorSubtype;
263 	uByte	bUnitId;
264 	uWord	wExtensionCode;
265 	uByte	bNrInPins;
266 	uByte	baSourceId[0];		/* [bNrInPins] */
267 	/* struct usb_audio_extension_unit_1 */
268 } __packed;
269 
270 struct usb_audio_extension_unit_1 {
271 	uByte	bNrChannels;
272 	uWord	wChannelConfig;
273 	uByte	iChannelNames;
274 	uByte	bControlSize;
275 	uByte	bmControls[0];		/* [bControlSize] */
276 #define	UA_EXT_ENABLE_MASK 1
277 #define	UA_EXT_ENABLE 1
278 	/* uByte		iExtension; */
279 } __packed;
280 
281 /* USB terminal types */
282 #define	UAT_UNDEFINED		0x0100
283 #define	UAT_STREAM		0x0101
284 #define	UAT_VENDOR		0x01ff
285 /* input terminal types */
286 #define	UATI_UNDEFINED		0x0200
287 #define	UATI_MICROPHONE		0x0201
288 #define	UATI_DESKMICROPHONE	0x0202
289 #define	UATI_PERSONALMICROPHONE	0x0203
290 #define	UATI_OMNIMICROPHONE	0x0204
291 #define	UATI_MICROPHONEARRAY	0x0205
292 #define	UATI_PROCMICROPHONEARR	0x0206
293 /* output terminal types */
294 #define	UATO_UNDEFINED		0x0300
295 #define	UATO_SPEAKER		0x0301
296 #define	UATO_HEADPHONES		0x0302
297 #define	UATO_DISPLAYAUDIO	0x0303
298 #define	UATO_DESKTOPSPEAKER	0x0304
299 #define	UATO_ROOMSPEAKER	0x0305
300 #define	UATO_COMMSPEAKER	0x0306
301 #define	UATO_SUBWOOFER		0x0307
302 /* bidir terminal types */
303 #define	UATB_UNDEFINED		0x0400
304 #define	UATB_HANDSET		0x0401
305 #define	UATB_HEADSET		0x0402
306 #define	UATB_SPEAKERPHONE	0x0403
307 #define	UATB_SPEAKERPHONEESUP	0x0404
308 #define	UATB_SPEAKERPHONEECANC	0x0405
309 /* telephony terminal types */
310 #define	UATT_UNDEFINED		0x0500
311 #define	UATT_PHONELINE		0x0501
312 #define	UATT_TELEPHONE		0x0502
313 #define	UATT_DOWNLINEPHONE	0x0503
314 /* external terminal types */
315 #define	UATE_UNDEFINED		0x0600
316 #define	UATE_ANALOGCONN		0x0601
317 #define	UATE_DIGITALAUIFC	0x0602
318 #define	UATE_LINECONN		0x0603
319 #define	UATE_LEGACYCONN		0x0604
320 #define	UATE_SPDIF		0x0605
321 #define	UATE_1394DA		0x0606
322 #define	UATE_1394DV		0x0607
323 /* embedded function terminal types */
324 #define	UATF_UNDEFINED		0x0700
325 #define	UATF_CALIBNOISE		0x0701
326 #define	UATF_EQUNOISE		0x0702
327 #define	UATF_CDPLAYER		0x0703
328 #define	UATF_DAT		0x0704
329 #define	UATF_DCC		0x0705
330 #define	UATF_MINIDISK		0x0706
331 #define	UATF_ANALOGTAPE		0x0707
332 #define	UATF_PHONOGRAPH		0x0708
333 #define	UATF_VCRAUDIO		0x0709
334 #define	UATF_VIDEODISCAUDIO	0x070a
335 #define	UATF_DVDAUDIO		0x070b
336 #define	UATF_TVTUNERAUDIO	0x070c
337 #define	UATF_SATELLITE		0x070d
338 #define	UATF_CABLETUNER		0x070e
339 #define	UATF_DSS		0x070f
340 #define	UATF_RADIORECV		0x0710
341 #define	UATF_RADIOXMIT		0x0711
342 #define	UATF_MULTITRACK		0x0712
343 #define	UATF_SYNTHESIZER	0x0713
344 
345 
346 #define	SET_CUR 0x01
347 #define	GET_CUR 0x81
348 #define	SET_MIN 0x02
349 #define	GET_MIN 0x82
350 #define	SET_MAX 0x03
351 #define	GET_MAX 0x83
352 #define	SET_RES 0x04
353 #define	GET_RES 0x84
354 #define	SET_MEM 0x05
355 #define	GET_MEM 0x85
356 #define	GET_STAT 0xff
357 
358 #define	MUTE_CONTROL	0x01
359 #define	VOLUME_CONTROL	0x02
360 #define	BASS_CONTROL	0x03
361 #define	MID_CONTROL	0x04
362 #define	TREBLE_CONTROL	0x05
363 #define	GRAPHIC_EQUALIZER_CONTROL	0x06
364 #define	AGC_CONTROL	0x07
365 #define	DELAY_CONTROL	0x08
366 #define	BASS_BOOST_CONTROL 0x09
367 #define	LOUDNESS_CONTROL 0x0a
368 /* ==== USB audio 2.0 ==== */
369 #define	INPUT_GAIN_CONTROL 0x0b
370 #define	INPUT_GAIN_PAD_CONTROL 0x0c
371 #define	PHASE_INVERTER_CONTROL 0x0d
372 #define	UNDERFLOW_CONTROL 0x0e
373 #define	OVERFLOW_CONTROL 0x0f
374 #define	LATENCY_CONTROL 0x10
375 
376 #define	FU_MASK(u) (1 << ((u)-1))
377 
378 #define	MASTER_CHAN	0
379 
380 #define	AS_GENERAL	1
381 #define	FORMAT_TYPE	2
382 #define	FORMAT_SPECIFIC 3
383 /* ==== USB audio 2.0 ==== */
384 #define	FORMAT_ENCODER	3
385 #define	FORMAT_DECODER	4
386 
387 #define	UA_FMT_PCM	1
388 #define	UA_FMT_PCM8	2
389 #define	UA_FMT_IEEE_FLOAT 3
390 #define	UA_FMT_ALAW	4
391 #define	UA_FMT_MULAW	5
392 #define	UA_FMT_MPEG	0x1001
393 #define	UA_FMT_AC3	0x1002
394 
395 #define	SAMPLING_FREQ_CONTROL	0x01
396 #define	PITCH_CONTROL		0x02
397 
398 #define	FORMAT_TYPE_UNDEFINED 0
399 #define	FORMAT_TYPE_I 1
400 #define	FORMAT_TYPE_II 2
401 #define	FORMAT_TYPE_III 3
402 
403 #define	UA_PROC_MASK(n) (1<< ((n)-1))
404 #define	PROCESS_UNDEFINED		0
405 #define	XX_ENABLE_CONTROL			1
406 #define	UPDOWNMIX_PROCESS		1
407 #define	UD_ENABLE_CONTROL			1
408 #define	UD_MODE_SELECT_CONTROL			2
409 #define	DOLBY_PROLOGIC_PROCESS		2
410 #define	DP_ENABLE_CONTROL			1
411 #define	DP_MODE_SELECT_CONTROL			2
412 #define	P3D_STEREO_EXTENDER_PROCESS	3
413 #define	P3D_ENABLE_CONTROL			1
414 #define	P3D_SPACIOUSNESS_CONTROL		2
415 #define	REVERBATION_PROCESS		4
416 #define	RV_ENABLE_CONTROL			1
417 #define	RV_LEVEL_CONTROL			2
418 #define	RV_TIME_CONTROL			3
419 #define	RV_FEEDBACK_CONTROL			4
420 #define	CHORUS_PROCESS			5
421 #define	CH_ENABLE_CONTROL			1
422 #define	CH_LEVEL_CONTROL			2
423 #define	CH_RATE_CONTROL			3
424 #define	CH_DEPTH_CONTROL			4
425 #define	DYN_RANGE_COMP_PROCESS		6
426 #define	DR_ENABLE_CONTROL			1
427 #define	DR_COMPRESSION_RATE_CONTROL		2
428 #define	DR_MAXAMPL_CONTROL			3
429 #define	DR_THRESHOLD_CONTROL			4
430 #define	DR_ATTACK_TIME_CONTROL			5
431 #define	DR_RELEASE_TIME_CONTROL		6
432 
433 /*------------------------------------------------------------------------*
434  * USB audio v2.0 definitions
435  *------------------------------------------------------------------------*/
436 
437 struct usb_audio20_as_iface_descriptor {
438 	uByte	bLength;
439 	uByte	bDescriptorType;
440 	uByte	bDescriptorSubtype;
441 	uByte	bTerminalLink;
442 	uByte	bmControls;
443 	uByte	bFormatType;
444 	uDWord	bmFormats;
445 	uByte	bNrChannels;
446 	uDWord	bmChannelConfig;
447 	uByte	iChannelNames;
448 } __packed;
449 
450 struct usb_audio20_encoder_descriptor {
451 	uByte	bLength;
452 	uByte	bDescriptorType;
453 	uByte	bDescriptorSubtype;
454 	uByte	bEncoderID;
455 	uByte	bEncoder;
456 	uDWord	bmControls;
457 	uByte	iParam1;
458 	uByte	iParam2;
459 	uByte	iParam3;
460 	uByte	iParam4;
461 	uByte	iParam5;
462 	uByte	iParam6;
463 	uByte	iParam7;
464 	uByte	iParam8;
465 	uByte	iEncoder;
466 } __packed;
467 
468 struct usb_audio20_streaming_endpoint_descriptor {
469 	uByte	bLength;
470 	uByte	bDescriptorType;
471 	uByte	bDescriptorSubtype;
472 	uByte	bmAttributes;
473 #define	UA20_MPS_ONLY		0x80
474 	uByte	bmControls;
475 #define	UA20_PITCH_CONTROL_MASK	0x03
476 #define	UA20_DATA_OVERRUN_MASK	0x0C
477 #define	UA20_DATA_UNDERRUN_MASK	0x30
478 	uByte	bLockDelayUnits;
479 	uWord	wLockDelay;
480 } __packed;
481 
482 struct usb_audio20_feedback_endpoint_descriptor {
483 	uByte	bLength;
484 	uByte	bDescriptorType;
485 	uByte	bEndpointAddress;
486 	uByte	bmAttributes;
487 	uWord	wMaxPacketSize;
488 	uByte	bInterval;
489 } __packed;
490 
491 #define	UA20_GET_CUR	0x81
492 #define	UA20_SET_CUR	0x01
493 #define	UA20_GET_RANGE	0x82
494 #define	UA20_SET_RANGE	0x02
495 #define	UA20_GET_MEM	0x83
496 #define	UA20_SET_MEM	0x03
497 
498 struct usb_audio20_cur1_parameter {
499 	uByte	bCur;
500 } __packed;
501 
502 struct usb_audio20_ctl1_range_sub {
503 	uByte	bMIN;
504 	uByte	bMAX;
505 	uByte	bRES;
506 } __packed;
507 
508 struct usb_audio20_ctl1_range {
509 	uWord	wNumSubRanges;
510 	struct usb_audio20_ctl1_range_sub sub[1];
511 } __packed;
512 
513 struct usb_audio20_cur2_parameter {
514 	uWord	wCur;
515 } __packed;
516 
517 struct usb_audio20_ctl2_range_sub {
518 	uWord	wMIN;
519 	uWord	wMAX;
520 	uWord	wRES;
521 } __packed;
522 
523 struct usb_audio20_ctl2_range {
524 	uWord	wNumSubRanges;
525 	struct usb_audio20_ctl2_range_sub sub[1];
526 } __packed;
527 
528 struct usb_audio20_cur4_parameter {
529 	uDWord	dCur;
530 } __packed;
531 
532 struct usb_audio20_ctl4_range_sub {
533 	uDWord	dMIN;
534 	uDWord	dMAX;
535 	uDWord	dRES;
536 } __packed;
537 
538 struct usb_audio20_ctl4_range {
539 	uWord	wNumSubRanges;
540 	struct usb_audio20_ctl4_range_sub sub[1];
541 } __packed;
542 
543 struct usb_audio20_cc_cluster_descriptor {
544 	uByte	bNrChannels;
545 	uDWord	bmChannelConfig;
546 	uByte	iChannelNames;
547 } __packed;
548 
549 struct usb_audio20_streaming_type1_descriptor {
550 	uByte	bLength;
551 	uByte	bDescriptorType;
552 	uByte	bDescriptorSubtype;
553 	uByte	bFormatType;
554 	uByte	bSubslotSize;
555 	uByte	bBitResolution;
556 } __packed;
557 
558 #define	UA20_EERROR_NONE	0
559 #define	UA20_EERROR_MEMORY	1
560 #define	UA20_EERROR_BANDWIDTH	2
561 #define	UA20_EERROR_CPU		3
562 #define	UA20_EERROR_FORMATFR_ER	4
563 #define	UA20_EERROR_FORMATFR_SM	5
564 #define	UA20_EERROR_FORMATFR_LG	6
565 #define	UA20_EERROR_DATAFORMAT	7
566 #define	UA20_EERROR_NUMCHANNELS	8
567 #define	UA20_EERROR_SAMPLERATE	9
568 #define	UA20_EERROR_BITRATE	10
569 #define	UA20_EERROR_PARAM	11
570 #define	UA20_EERROR_NREADY	12
571 #define	UA20_EERROR_BUSY	13
572 
573 struct usb_audio20_cc_alt_setting {
574 	uByte	bControlSize;
575 	uDWord	bmValidAltSettings;
576 } __packed;
577 
578 struct usb_audio20_interrupt_message {
579 	uByte	bInfo;
580 	uByte	bAttribute;
581 	uDWord	wValue;
582 	uDWord	wIndex;
583 } __packed;
584 
585 /* UDESCSUB_AC_CLOCK_SRC */
586 struct usb_audio20_clock_source_unit {
587 	uByte	bLength;
588 	uByte	bDescriptorType;
589 	uByte	bDescriptorSubtype;
590 	uByte	bClockId;
591 	uByte	bmAttributes;
592 	uByte	bmControls;
593 	uByte	bAssocTerminal;
594 	uByte	iClockSource;
595 } __packed;
596 
597 /* UDESCSUB_AC_CLOCK_SEL */
598 struct usb_audio20_clock_selector_unit {
599 	uByte	bLength;
600 	uByte	bDescriptorType;
601 	uByte	bDescriptorSubtype;
602 	uByte	bClockId;
603 	uByte	bNrInPins;
604 } __packed;
605 
606 /* UDESCSUB_AC_CLOCK_MUL */
607 struct usb_audio20_clock_multiplier_unit {
608 	uByte	bLength;
609 	uByte	bDescriptorType;
610 	uByte	bDescriptorSubtype;
611 	uByte	bClockId;
612 	uByte	bCSourceId;
613 	uByte	bmControls;
614 	uByte	iClockMultiplier;
615 } __packed;
616 
617 /* UDESCSUB_AC_INPUT */
618 struct usb_audio20_input_terminal {
619 	uByte	bLength;
620 	uByte	bDescriptorType;
621 	uByte	bDescriptorSubtype;
622 	uByte	bTerminalId;
623 	uWord	wTerminalType;
624 	uByte	bAssocTerminal;
625 	uByte	bCSourceId;
626 	uByte	bNrChannels;
627 	uDWord	bmChannelConfig;
628 	uByte	iCHannelNames;
629 	uWord	bmControls;
630 	uByte	iTerminal;
631 } __packed;
632 
633 /* UDESCSUB_AC_OUTPUT */
634 struct usb_audio20_output_terminal {
635 	uByte	bLength;
636 	uByte	bDescriptorType;
637 	uByte	bDescriptorSubtype;
638 	uByte	bTerminalId;
639 	uWord	wTerminalType;
640 	uByte	bAssocTerminal;
641 	uByte	bSourceId;
642 	uByte	bCSourceId;
643 	uWord	bmControls;
644 	uByte	iTerminal;
645 } __packed;
646 
647 /* UDESCSUB_AC_MIXER */
648 struct usb_audio20_mixer_unit_0 {
649 	uByte	bLength;
650 	uByte	bDescriptorType;
651 	uByte	bDescriptorSubtype;
652 	uByte	bUnitId;
653 	uByte	bNrInPins;
654 	uByte	baSourceId[0];
655 	/* struct usb_audio20_mixer_unit_1 */
656 } __packed;
657 
658 struct usb_audio20_mixer_unit_1 {
659 	uByte	bNrChannels;
660 	uDWord	bmChannelConfig;
661 	uByte	iChannelNames;
662 	uByte	bmControls[0];
663 	/* uByte	iMixer; */
664 } __packed;
665 
666 /* UDESCSUB_AC_SELECTOR */
667 struct usb_audio20_selector_unit {
668 	uByte	bLength;
669 	uByte	bDescriptorType;
670 	uByte	bDescriptorSubtype;
671 	uByte	bUnitId;
672 	uByte	bNrInPins;
673 	uByte	baSourceId[0];
674 	/* uByte	iSelector; */
675 } __packed;
676 
677 /* UDESCSUB_AC_FEATURE */
678 struct usb_audio20_feature_unit {
679 	uByte	bLength;
680 	uByte	bDescriptorType;
681 	uByte	bDescriptorSubtype;
682 	uByte	bUnitId;
683 	uByte	bSourceId;
684 	uDWord	bmaControls[0];
685 	/* uByte	iFeature; */
686 } __packed;
687 
688 /* UDESCSUB_AC_SAMPLE_RT */
689 struct usb_audio20_sample_rate_unit {
690 	uByte	bLength;
691 	uByte	bDescriptorType;
692 	uByte	bDescriptorSubtype;
693 	uByte	bUnitId;
694 	uByte	bSourceId;
695 	uByte	bSourceInId;
696 	uByte	bSourceOutId;
697 	uByte	iSrc;
698 } __packed;
699 
700 /* UDESCSUB_AC_EFFECT */
701 struct usb_audio20_effect_unit {
702 	uByte	bLength;
703 	uByte	bDescriptorType;
704 	uByte	bDescriptorSubtype;
705 	uByte	bUnitId;
706 	uWord	wEffectType;
707 	uByte	bSourceId;
708 	uDWord	bmaControls[0];
709 	uByte	iEffects;
710 } __packed;
711 
712 /* UDESCSUB_AC_PROCESSING_V2 */
713 struct usb_audio20_processing_unit_0 {
714 	uByte	bLength;
715 	uByte	bDescriptorType;
716 	uByte	bDescriptorSubtype;
717 	uByte	bUnitId;
718 	uWord	wProcessType;
719 	uByte	bNrInPins;
720 	uByte	baSourceId[0];		/* [bNrInPins] */
721 } __packed;
722 
723 struct usb_audio20_processing_unit_1 {
724 	uByte	bNrChannels;
725 	uDWord	bmChannelConfig;
726 	uByte	iChannelNames;
727 	uWord	bmControls;
728 	uByte	iProcessing;
729 } __packed;
730 
731 /* UDESCSUB_AC_EXTENSION_V2 */
732 struct usb_audio20_extension_unit_0 {
733 	uByte	bLength;
734 	uByte	bDescriptorType;
735 	uByte	bDescriptorSubtype;
736 	uByte	bUnitId;
737 	uWord	wExtensionCode;
738 	uByte	bNrInPins;
739 	uByte	baSourceId[0];
740 } __packed;
741 
742 struct usb_audio20_extension_unit_1 {
743 	uByte	bNrChannels;
744 	uDWord	bmChannelConfig;
745 	uByte	iChannelNames;
746 	uByte	bmControls;
747 	uByte	iExtension;
748 } __packed;
749 
750 struct usb_audio20_cluster {
751 	uByte	bNrChannels;
752 	uDWord	bmChannelConfig;
753 	uByte	iChannelNames;
754 } __packed;
755 
756 #define	UA20_TF_UNDEFINED		0x00
757 #define	UA20_TF_DESKTOP_SPEAKER		0x01
758 #define	UA20_TF_HOME_THEATER		0x02
759 #define	UA20_TF_MICROPHONE		0x03
760 #define	UA20_TF_HEADSET			0x04
761 #define	UA20_TF_TELEPHONE		0x05
762 #define	UA20_TF_CONVERTER		0x06
763 #define	UA20_TF_SOUND_RECORDER		0x07
764 #define	UA20_TF_IO_BOX			0x08
765 #define	UA20_TF_MUSICAL_INSTRUMENT	0x09
766 #define	UA20_TF_PRO_AUDIO		0x0A
767 #define	UA20_TF_AV			0x0B
768 #define	UA20_TF_CONTROL_PANEL		0x0C
769 #define	UA20_TF_OTHER			0xFF
770 
771 #define	UA20_EP_GENERAL			0x01
772 
773 #define	UA20_CS_SAM_FREQ_CONTROL	0x01
774 #define	UA20_CS_CLOCK_VALID_CONTROL 	0x02
775 
776 #define	UA20_TE_COPY_PROTECT_CONTROL	0x01
777 #define	UA20_TE_CONNECTOR_CONTROL	0x02
778 #define	UA20_TE_OVERLOAD_CONTROL	0x03
779 #define	UA20_TE_CLUSTER_CONTROL		0x04
780 #define	UA20_TE_UNDERFLOW_CONTROL	0x05
781 #define	UA20_TE_OVERFLOW_CONTROL	0x06
782 #define	UA20_TE_LATENCY_CONTROL		0x07
783 
784 #define	UA20_MU_MIXER_CONTROL		0x01
785 #define	UA20_MU_CLUSTER_CONTROL		0x02
786 #define	UA20_MU_UNDERFLOW_CONTROL	0x03
787 #define	UA20_MU_OVERFLOW_CONTROL	0x04
788 #define	UA20_MU_LATENCY_CONTROL		0x05
789 
790 #define	UA20_FMT_PCM	(1U << 0)
791 #define	UA20_FMT_PCM8	(1U << 1)
792 #define	UA20_FMT_FLOAT	(1U << 2)
793 #define	UA20_FMT_ALAW	(1U << 3)
794 #define	UA20_FMT_MULAW	(1U << 4)
795 #define	UA20_FMT_RAW	(1U << 31)
796 
797 #endif					/* _UAUDIOREG_H_ */
798