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