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