1184610Salfred/*	$NetBSD: uaudioreg.h,v 1.12 2004/11/05 19:08:29 kent Exp $	*/
2184610Salfred/* $FreeBSD: releng/10.3/sys/dev/sound/usb/uaudioreg.h 272423 2014-10-02 16:57:44Z hselasky $ */
3184610Salfred
4184610Salfred/*-
5184610Salfred * Copyright (c) 1999 The NetBSD Foundation, Inc.
6184610Salfred * All rights reserved.
7184610Salfred *
8184610Salfred * This code is derived from software contributed to The NetBSD Foundation
9184610Salfred * by Lennart Augustsson (lennart@augustsson.net) at
10184610Salfred * Carlstedt Research & Technology.
11184610Salfred *
12184610Salfred * Redistribution and use in source and binary forms, with or without
13184610Salfred * modification, are permitted provided that the following conditions
14184610Salfred * are met:
15184610Salfred * 1. Redistributions of source code must retain the above copyright
16184610Salfred *    notice, this list of conditions and the following disclaimer.
17184610Salfred * 2. Redistributions in binary form must reproduce the above copyright
18184610Salfred *    notice, this list of conditions and the following disclaimer in the
19184610Salfred *    documentation and/or other materials provided with the distribution.
20184610Salfred *
21184610Salfred * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
22184610Salfred * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
23184610Salfred * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24184610Salfred * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
25184610Salfred * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26184610Salfred * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27184610Salfred * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28184610Salfred * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29184610Salfred * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30184610Salfred * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31184610Salfred * POSSIBILITY OF SUCH DAMAGE.
32184610Salfred */
33184610Salfred
34240078Shselasky#ifndef _UAUDIOREG_H_
35240078Shselasky#define	_UAUDIOREG_H_
36184610Salfred
37240078Shselasky#define	UAUDIO_VERSION		0x0100
38240078Shselasky#define	UAUDIO_VERSION_20	0x0200
39240609Shselasky#define	UAUDIO_VERSION_30	0x0300
40240078Shselasky
41240078Shselasky#define	UAUDIO_PROTOCOL_20	0x20
42240078Shselasky
43240078Shselasky#define	UDESC_CS_UNDEFINED	0x20
44240078Shselasky#define	UDESC_CS_DEVICE		0x21
45184610Salfred#define	UDESC_CS_CONFIG		0x22
46184610Salfred#define	UDESC_CS_STRING		0x23
47184610Salfred#define	UDESC_CS_INTERFACE	0x24
48184610Salfred#define	UDESC_CS_ENDPOINT	0x25
49184610Salfred
50184610Salfred#define	UDESCSUB_AC_HEADER	1
51184610Salfred#define	UDESCSUB_AC_INPUT	2
52184610Salfred#define	UDESCSUB_AC_OUTPUT	3
53184610Salfred#define	UDESCSUB_AC_MIXER	4
54184610Salfred#define	UDESCSUB_AC_SELECTOR	5
55184610Salfred#define	UDESCSUB_AC_FEATURE	6
56184610Salfred#define	UDESCSUB_AC_PROCESSING	7
57184610Salfred#define	UDESCSUB_AC_EXTENSION	8
58240609Shselasky/* ==== USB audio v2.0 ==== */
59240078Shselasky#define	UDESCSUB_AC_EFFECT	7
60240078Shselasky#define	UDESCSUB_AC_PROCESSING_V2 8
61240078Shselasky#define	UDESCSUB_AC_EXTENSION_V2 9
62240078Shselasky#define	UDESCSUB_AC_CLOCK_SRC	10
63240078Shselasky#define	UDESCSUB_AC_CLOCK_SEL	11
64240078Shselasky#define	UDESCSUB_AC_CLOCK_MUL	12
65240078Shselasky#define	UDESCSUB_AC_SAMPLE_RT	13
66184610Salfred
67209452Sthompsa/* These macros check if the endpoint descriptor has additional fields */
68209452Sthompsa#define	UEP_MINSIZE	7
69209452Sthompsa#define	UEP_HAS_REFRESH(ep)	((ep)->bLength >= 8)
70209452Sthompsa#define	UEP_HAS_SYNCADDR(ep)	((ep)->bLength >= 9)
71209452Sthompsa
72192984Sthompsa/* The first fields are identical to struct usb_endpoint_descriptor */
73184610Salfredtypedef struct {
74184610Salfred	uByte	bLength;
75184610Salfred	uByte	bDescriptorType;
76184610Salfred	uByte	bEndpointAddress;
77184610Salfred	uByte	bmAttributes;
78184610Salfred	uWord	wMaxPacketSize;
79184610Salfred	uByte	bInterval;
80184610Salfred	/*
81184610Salfred	 * The following two entries are only used by the Audio Class.
82184610Salfred	 * And according to the specs the Audio Class is the only one
83184610Salfred	 * allowed to extend the endpoint descriptor.
84184610Salfred	 * Who knows what goes on in the minds of the people in the USB
85184610Salfred	 * standardization?  :-(
86184610Salfred	 */
87184610Salfred	uByte	bRefresh;
88184610Salfred	uByte	bSynchAddress;
89203678Sbrucec} __packed usb_endpoint_descriptor_audio_t;
90184610Salfred
91203678Sbrucecstruct usb_audio_control_descriptor {
92184610Salfred	uByte	bLength;
93184610Salfred	uByte	bDescriptorType;
94184610Salfred	uByte	bDescriptorSubtype;
95184610Salfred	uWord	bcdADC;
96184610Salfred	uWord	wTotalLength;
97184610Salfred	uByte	bInCollection;
98184610Salfred	uByte	baInterfaceNr[1];
99184610Salfred} __packed;
100184610Salfred
101203678Sbrucecstruct usb_audio_streaming_interface_descriptor {
102184610Salfred	uByte	bLength;
103184610Salfred	uByte	bDescriptorType;
104184610Salfred	uByte	bDescriptorSubtype;
105184610Salfred	uByte	bTerminalLink;
106184610Salfred	uByte	bDelay;
107184610Salfred	uWord	wFormatTag;
108184610Salfred} __packed;
109184610Salfred
110203678Sbrucecstruct usb_audio_streaming_endpoint_descriptor {
111184610Salfred	uByte	bLength;
112184610Salfred	uByte	bDescriptorType;
113184610Salfred	uByte	bDescriptorSubtype;
114184610Salfred	uByte	bmAttributes;
115184610Salfred#define	UA_SED_FREQ_CONTROL	0x01
116184610Salfred#define	UA_SED_PITCH_CONTROL	0x02
117184610Salfred#define	UA_SED_MAXPACKETSONLY	0x80
118184610Salfred	uByte	bLockDelayUnits;
119184610Salfred	uWord	wLockDelay;
120184610Salfred} __packed;
121184610Salfred
122272423Shselaskystruct usb_midi_streaming_endpoint_descriptor {
123272423Shselasky	uByte	bLength;
124272423Shselasky	uByte	bDescriptorType;
125272423Shselasky	uByte	bDescriptorSubtype;
126272423Shselasky	uByte	bNumEmbMIDIJack;
127272423Shselasky} __packed;
128272423Shselasky
129203678Sbrucecstruct usb_audio_streaming_type1_descriptor {
130184610Salfred	uByte	bLength;
131184610Salfred	uByte	bDescriptorType;
132184610Salfred	uByte	bDescriptorSubtype;
133184610Salfred	uByte	bFormatType;
134184610Salfred	uByte	bNrChannels;
135184610Salfred	uByte	bSubFrameSize;
136184610Salfred	uByte	bBitResolution;
137184610Salfred	uByte	bSamFreqType;
138184610Salfred#define	UA_SAMP_CONTNUOUS 0
139184610Salfred	uByte	tSamFreq[0];
140233774Shselasky#define	UA_GETSAMP(p, n) ((uint32_t)((((p)->tSamFreq[((n)*3)+0]) | \
141184610Salfred			  ((p)->tSamFreq[((n)*3)+1] << 8) | \
142233774Shselasky			  ((p)->tSamFreq[((n)*3)+2] << 16))))
143184610Salfred#define	UA_SAMP_LO(p) UA_GETSAMP(p, 0)
144184610Salfred#define	UA_SAMP_HI(p) UA_GETSAMP(p, 1)
145184610Salfred} __packed;
146184610Salfred
147203678Sbrucecstruct usb_audio_cluster {
148184610Salfred	uByte	bNrChannels;
149184610Salfred	uWord	wChannelConfig;
150184610Salfred#define	UA_CHANNEL_LEFT		0x0001
151184610Salfred#define	UA_CHANNEL_RIGHT	0x0002
152184610Salfred#define	UA_CHANNEL_CENTER	0x0004
153184610Salfred#define	UA_CHANNEL_LFE		0x0008
154184610Salfred#define	UA_CHANNEL_L_SURROUND	0x0010
155184610Salfred#define	UA_CHANNEL_R_SURROUND	0x0020
156184610Salfred#define	UA_CHANNEL_L_CENTER	0x0040
157184610Salfred#define	UA_CHANNEL_R_CENTER	0x0080
158184610Salfred#define	UA_CHANNEL_SURROUND	0x0100
159184610Salfred#define	UA_CHANNEL_L_SIDE	0x0200
160184610Salfred#define	UA_CHANNEL_R_SIDE	0x0400
161184610Salfred#define	UA_CHANNEL_TOP		0x0800
162184610Salfred	uByte	iChannelNames;
163184610Salfred} __packed;
164184610Salfred
165184610Salfred/* Shared by all units and terminals */
166203678Sbrucecstruct usb_audio_unit {
167184610Salfred	uByte	bLength;
168184610Salfred	uByte	bDescriptorType;
169184610Salfred	uByte	bDescriptorSubtype;
170184610Salfred	uByte	bUnitId;
171184610Salfred};
172184610Salfred
173184610Salfred/* UDESCSUB_AC_INPUT */
174203678Sbrucecstruct usb_audio_input_terminal {
175184610Salfred	uByte	bLength;
176184610Salfred	uByte	bDescriptorType;
177184610Salfred	uByte	bDescriptorSubtype;
178184610Salfred	uByte	bTerminalId;
179184610Salfred	uWord	wTerminalType;
180184610Salfred	uByte	bAssocTerminal;
181184610Salfred	uByte	bNrChannels;
182184610Salfred	uWord	wChannelConfig;
183184610Salfred	uByte	iChannelNames;
184184610Salfred/*	uByte		iTerminal; */
185184610Salfred} __packed;
186184610Salfred
187184610Salfred/* UDESCSUB_AC_OUTPUT */
188203678Sbrucecstruct usb_audio_output_terminal {
189184610Salfred	uByte	bLength;
190184610Salfred	uByte	bDescriptorType;
191184610Salfred	uByte	bDescriptorSubtype;
192184610Salfred	uByte	bTerminalId;
193184610Salfred	uWord	wTerminalType;
194184610Salfred	uByte	bAssocTerminal;
195184610Salfred	uByte	bSourceId;
196184610Salfred	uByte	iTerminal;
197184610Salfred} __packed;
198184610Salfred
199184610Salfred/* UDESCSUB_AC_MIXER */
200203678Sbrucecstruct usb_audio_mixer_unit_0 {
201184610Salfred	uByte	bLength;
202184610Salfred	uByte	bDescriptorType;
203184610Salfred	uByte	bDescriptorSubtype;
204184610Salfred	uByte	bUnitId;
205184610Salfred	uByte	bNrInPins;
206184610Salfred	uByte	baSourceId[0];		/* [bNrInPins] */
207203678Sbrucec	/* struct usb_audio_mixer_unit_1 */
208184610Salfred} __packed;
209203678Sbrucecstruct usb_audio_mixer_unit_1 {
210184610Salfred	uByte	bNrChannels;
211184610Salfred	uWord	wChannelConfig;
212184610Salfred	uByte	iChannelNames;
213184610Salfred	uByte	bmControls[0];		/* [see source code] */
214184610Salfred	/* uByte		iMixer; */
215184610Salfred} __packed;
216184610Salfred
217184610Salfred/* UDESCSUB_AC_SELECTOR */
218203678Sbrucecstruct usb_audio_selector_unit {
219184610Salfred	uByte	bLength;
220184610Salfred	uByte	bDescriptorType;
221184610Salfred	uByte	bDescriptorSubtype;
222184610Salfred	uByte	bUnitId;
223184610Salfred	uByte	bNrInPins;
224184610Salfred	uByte	baSourceId[0];		/* [bNrInPins] */
225184610Salfred	/* uByte	iSelector; */
226184610Salfred} __packed;
227184610Salfred
228184610Salfred/* UDESCSUB_AC_FEATURE */
229203678Sbrucecstruct usb_audio_feature_unit {
230184610Salfred	uByte	bLength;
231184610Salfred	uByte	bDescriptorType;
232184610Salfred	uByte	bDescriptorSubtype;
233184610Salfred	uByte	bUnitId;
234184610Salfred	uByte	bSourceId;
235184610Salfred	uByte	bControlSize;
236184610Salfred	uByte	bmaControls[0];		/* [bControlSize * x] */
237184610Salfred	/* uByte	iFeature; */
238184610Salfred} __packed;
239184610Salfred
240184610Salfred/* UDESCSUB_AC_PROCESSING */
241203678Sbrucecstruct usb_audio_processing_unit_0 {
242184610Salfred	uByte	bLength;
243184610Salfred	uByte	bDescriptorType;
244184610Salfred	uByte	bDescriptorSubtype;
245184610Salfred	uByte	bUnitId;
246184610Salfred	uWord	wProcessType;
247184610Salfred	uByte	bNrInPins;
248184610Salfred	uByte	baSourceId[0];		/* [bNrInPins] */
249203678Sbrucec	/* struct usb_audio_processing_unit_1 */
250184610Salfred} __packed;
251203678Sbrucecstruct usb_audio_processing_unit_1 {
252184610Salfred	uByte	bNrChannels;
253184610Salfred	uWord	wChannelConfig;
254184610Salfred	uByte	iChannelNames;
255184610Salfred	uByte	bControlSize;
256184610Salfred	uByte	bmControls[0];		/* [bControlSize] */
257184610Salfred#define	UA_PROC_ENABLE_MASK 1
258184610Salfred} __packed;
259184610Salfred
260203678Sbrucecstruct usb_audio_processing_unit_updown {
261184610Salfred	uByte	iProcessing;
262184610Salfred	uByte	bNrModes;
263184610Salfred	uWord	waModes[0];		/* [bNrModes] */
264184610Salfred} __packed;
265184610Salfred
266184610Salfred/* UDESCSUB_AC_EXTENSION */
267203678Sbrucecstruct usb_audio_extension_unit_0 {
268184610Salfred	uByte	bLength;
269184610Salfred	uByte	bDescriptorType;
270184610Salfred	uByte	bDescriptorSubtype;
271184610Salfred	uByte	bUnitId;
272184610Salfred	uWord	wExtensionCode;
273184610Salfred	uByte	bNrInPins;
274184610Salfred	uByte	baSourceId[0];		/* [bNrInPins] */
275203678Sbrucec	/* struct usb_audio_extension_unit_1 */
276184610Salfred} __packed;
277240078Shselasky
278203678Sbrucecstruct usb_audio_extension_unit_1 {
279184610Salfred	uByte	bNrChannels;
280184610Salfred	uWord	wChannelConfig;
281184610Salfred	uByte	iChannelNames;
282184610Salfred	uByte	bControlSize;
283184610Salfred	uByte	bmControls[0];		/* [bControlSize] */
284184610Salfred#define	UA_EXT_ENABLE_MASK 1
285184610Salfred#define	UA_EXT_ENABLE 1
286184610Salfred	/* uByte		iExtension; */
287184610Salfred} __packed;
288184610Salfred
289184610Salfred/* USB terminal types */
290184610Salfred#define	UAT_UNDEFINED		0x0100
291184610Salfred#define	UAT_STREAM		0x0101
292184610Salfred#define	UAT_VENDOR		0x01ff
293184610Salfred/* input terminal types */
294184610Salfred#define	UATI_UNDEFINED		0x0200
295184610Salfred#define	UATI_MICROPHONE		0x0201
296184610Salfred#define	UATI_DESKMICROPHONE	0x0202
297184610Salfred#define	UATI_PERSONALMICROPHONE	0x0203
298184610Salfred#define	UATI_OMNIMICROPHONE	0x0204
299184610Salfred#define	UATI_MICROPHONEARRAY	0x0205
300184610Salfred#define	UATI_PROCMICROPHONEARR	0x0206
301184610Salfred/* output terminal types */
302184610Salfred#define	UATO_UNDEFINED		0x0300
303184610Salfred#define	UATO_SPEAKER		0x0301
304184610Salfred#define	UATO_HEADPHONES		0x0302
305184610Salfred#define	UATO_DISPLAYAUDIO	0x0303
306184610Salfred#define	UATO_DESKTOPSPEAKER	0x0304
307184610Salfred#define	UATO_ROOMSPEAKER	0x0305
308184610Salfred#define	UATO_COMMSPEAKER	0x0306
309184610Salfred#define	UATO_SUBWOOFER		0x0307
310184610Salfred/* bidir terminal types */
311184610Salfred#define	UATB_UNDEFINED		0x0400
312184610Salfred#define	UATB_HANDSET		0x0401
313184610Salfred#define	UATB_HEADSET		0x0402
314184610Salfred#define	UATB_SPEAKERPHONE	0x0403
315184610Salfred#define	UATB_SPEAKERPHONEESUP	0x0404
316184610Salfred#define	UATB_SPEAKERPHONEECANC	0x0405
317184610Salfred/* telephony terminal types */
318184610Salfred#define	UATT_UNDEFINED		0x0500
319184610Salfred#define	UATT_PHONELINE		0x0501
320184610Salfred#define	UATT_TELEPHONE		0x0502
321184610Salfred#define	UATT_DOWNLINEPHONE	0x0503
322184610Salfred/* external terminal types */
323184610Salfred#define	UATE_UNDEFINED		0x0600
324184610Salfred#define	UATE_ANALOGCONN		0x0601
325184610Salfred#define	UATE_DIGITALAUIFC	0x0602
326184610Salfred#define	UATE_LINECONN		0x0603
327184610Salfred#define	UATE_LEGACYCONN		0x0604
328184610Salfred#define	UATE_SPDIF		0x0605
329184610Salfred#define	UATE_1394DA		0x0606
330184610Salfred#define	UATE_1394DV		0x0607
331184610Salfred/* embedded function terminal types */
332184610Salfred#define	UATF_UNDEFINED		0x0700
333184610Salfred#define	UATF_CALIBNOISE		0x0701
334184610Salfred#define	UATF_EQUNOISE		0x0702
335184610Salfred#define	UATF_CDPLAYER		0x0703
336184610Salfred#define	UATF_DAT		0x0704
337184610Salfred#define	UATF_DCC		0x0705
338184610Salfred#define	UATF_MINIDISK		0x0706
339184610Salfred#define	UATF_ANALOGTAPE		0x0707
340184610Salfred#define	UATF_PHONOGRAPH		0x0708
341184610Salfred#define	UATF_VCRAUDIO		0x0709
342184610Salfred#define	UATF_VIDEODISCAUDIO	0x070a
343184610Salfred#define	UATF_DVDAUDIO		0x070b
344184610Salfred#define	UATF_TVTUNERAUDIO	0x070c
345184610Salfred#define	UATF_SATELLITE		0x070d
346184610Salfred#define	UATF_CABLETUNER		0x070e
347184610Salfred#define	UATF_DSS		0x070f
348184610Salfred#define	UATF_RADIORECV		0x0710
349184610Salfred#define	UATF_RADIOXMIT		0x0711
350184610Salfred#define	UATF_MULTITRACK		0x0712
351184610Salfred#define	UATF_SYNTHESIZER	0x0713
352184610Salfred
353184610Salfred
354184610Salfred#define	SET_CUR 0x01
355184610Salfred#define	GET_CUR 0x81
356184610Salfred#define	SET_MIN 0x02
357184610Salfred#define	GET_MIN 0x82
358184610Salfred#define	SET_MAX 0x03
359184610Salfred#define	GET_MAX 0x83
360184610Salfred#define	SET_RES 0x04
361184610Salfred#define	GET_RES 0x84
362184610Salfred#define	SET_MEM 0x05
363184610Salfred#define	GET_MEM 0x85
364184610Salfred#define	GET_STAT 0xff
365184610Salfred
366184610Salfred#define	MUTE_CONTROL	0x01
367184610Salfred#define	VOLUME_CONTROL	0x02
368184610Salfred#define	BASS_CONTROL	0x03
369184610Salfred#define	MID_CONTROL	0x04
370184610Salfred#define	TREBLE_CONTROL	0x05
371184610Salfred#define	GRAPHIC_EQUALIZER_CONTROL	0x06
372184610Salfred#define	AGC_CONTROL	0x07
373184610Salfred#define	DELAY_CONTROL	0x08
374184610Salfred#define	BASS_BOOST_CONTROL 0x09
375184610Salfred#define	LOUDNESS_CONTROL 0x0a
376240609Shselasky/* ==== USB audio v2.0 ==== */
377240078Shselasky#define	INPUT_GAIN_CONTROL 0x0b
378240078Shselasky#define	INPUT_GAIN_PAD_CONTROL 0x0c
379240078Shselasky#define	PHASE_INVERTER_CONTROL 0x0d
380240078Shselasky#define	UNDERFLOW_CONTROL 0x0e
381240078Shselasky#define	OVERFLOW_CONTROL 0x0f
382240078Shselasky#define	LATENCY_CONTROL 0x10
383184610Salfred
384184610Salfred#define	FU_MASK(u) (1 << ((u)-1))
385184610Salfred
386184610Salfred#define	MASTER_CHAN	0
387184610Salfred
388272423Shselasky#define	MS_GENERAL	1
389184610Salfred#define	AS_GENERAL	1
390184610Salfred#define	FORMAT_TYPE	2
391184610Salfred#define	FORMAT_SPECIFIC 3
392240609Shselasky/* ==== USB audio v2.0 ==== */
393240078Shselasky#define	FORMAT_ENCODER	3
394240078Shselasky#define	FORMAT_DECODER	4
395184610Salfred
396184610Salfred#define	UA_FMT_PCM	1
397184610Salfred#define	UA_FMT_PCM8	2
398184610Salfred#define	UA_FMT_IEEE_FLOAT 3
399184610Salfred#define	UA_FMT_ALAW	4
400184610Salfred#define	UA_FMT_MULAW	5
401184610Salfred#define	UA_FMT_MPEG	0x1001
402184610Salfred#define	UA_FMT_AC3	0x1002
403184610Salfred
404184610Salfred#define	SAMPLING_FREQ_CONTROL	0x01
405184610Salfred#define	PITCH_CONTROL		0x02
406184610Salfred
407184610Salfred#define	FORMAT_TYPE_UNDEFINED 0
408184610Salfred#define	FORMAT_TYPE_I 1
409184610Salfred#define	FORMAT_TYPE_II 2
410184610Salfred#define	FORMAT_TYPE_III 3
411184610Salfred
412184610Salfred#define	UA_PROC_MASK(n) (1<< ((n)-1))
413184610Salfred#define	PROCESS_UNDEFINED		0
414184610Salfred#define	XX_ENABLE_CONTROL			1
415184610Salfred#define	UPDOWNMIX_PROCESS		1
416184610Salfred#define	UD_ENABLE_CONTROL			1
417184610Salfred#define	UD_MODE_SELECT_CONTROL			2
418184610Salfred#define	DOLBY_PROLOGIC_PROCESS		2
419184610Salfred#define	DP_ENABLE_CONTROL			1
420184610Salfred#define	DP_MODE_SELECT_CONTROL			2
421184610Salfred#define	P3D_STEREO_EXTENDER_PROCESS	3
422184610Salfred#define	P3D_ENABLE_CONTROL			1
423184610Salfred#define	P3D_SPACIOUSNESS_CONTROL		2
424184610Salfred#define	REVERBATION_PROCESS		4
425184610Salfred#define	RV_ENABLE_CONTROL			1
426184610Salfred#define	RV_LEVEL_CONTROL			2
427184610Salfred#define	RV_TIME_CONTROL			3
428184610Salfred#define	RV_FEEDBACK_CONTROL			4
429184610Salfred#define	CHORUS_PROCESS			5
430184610Salfred#define	CH_ENABLE_CONTROL			1
431184610Salfred#define	CH_LEVEL_CONTROL			2
432184610Salfred#define	CH_RATE_CONTROL			3
433184610Salfred#define	CH_DEPTH_CONTROL			4
434184610Salfred#define	DYN_RANGE_COMP_PROCESS		6
435184610Salfred#define	DR_ENABLE_CONTROL			1
436184610Salfred#define	DR_COMPRESSION_RATE_CONTROL		2
437184610Salfred#define	DR_MAXAMPL_CONTROL			3
438184610Salfred#define	DR_THRESHOLD_CONTROL			4
439184610Salfred#define	DR_ATTACK_TIME_CONTROL			5
440184610Salfred#define	DR_RELEASE_TIME_CONTROL		6
441240078Shselasky
442240078Shselasky/*------------------------------------------------------------------------*
443240078Shselasky * USB audio v2.0 definitions
444240078Shselasky *------------------------------------------------------------------------*/
445240078Shselasky
446240609Shselaskystruct usb_audio20_streaming_interface_descriptor {
447240078Shselasky	uByte	bLength;
448240078Shselasky	uByte	bDescriptorType;
449240078Shselasky	uByte	bDescriptorSubtype;
450240078Shselasky	uByte	bTerminalLink;
451240078Shselasky	uByte	bmControls;
452240078Shselasky	uByte	bFormatType;
453240078Shselasky	uDWord	bmFormats;
454240078Shselasky	uByte	bNrChannels;
455240078Shselasky	uDWord	bmChannelConfig;
456240078Shselasky	uByte	iChannelNames;
457240078Shselasky} __packed;
458240078Shselasky
459240078Shselaskystruct usb_audio20_encoder_descriptor {
460240078Shselasky	uByte	bLength;
461240078Shselasky	uByte	bDescriptorType;
462240078Shselasky	uByte	bDescriptorSubtype;
463240078Shselasky	uByte	bEncoderID;
464240078Shselasky	uByte	bEncoder;
465240078Shselasky	uDWord	bmControls;
466240078Shselasky	uByte	iParam1;
467240078Shselasky	uByte	iParam2;
468240078Shselasky	uByte	iParam3;
469240078Shselasky	uByte	iParam4;
470240078Shselasky	uByte	iParam5;
471240078Shselasky	uByte	iParam6;
472240078Shselasky	uByte	iParam7;
473240078Shselasky	uByte	iParam8;
474240078Shselasky	uByte	iEncoder;
475240078Shselasky} __packed;
476240078Shselasky
477240078Shselaskystruct usb_audio20_streaming_endpoint_descriptor {
478240078Shselasky	uByte	bLength;
479240078Shselasky	uByte	bDescriptorType;
480240078Shselasky	uByte	bDescriptorSubtype;
481240078Shselasky	uByte	bmAttributes;
482240078Shselasky#define	UA20_MPS_ONLY		0x80
483240078Shselasky	uByte	bmControls;
484240078Shselasky#define	UA20_PITCH_CONTROL_MASK	0x03
485240078Shselasky#define	UA20_DATA_OVERRUN_MASK	0x0C
486240078Shselasky#define	UA20_DATA_UNDERRUN_MASK	0x30
487240078Shselasky	uByte	bLockDelayUnits;
488240078Shselasky	uWord	wLockDelay;
489240078Shselasky} __packed;
490240078Shselasky
491240078Shselaskystruct usb_audio20_feedback_endpoint_descriptor {
492240078Shselasky	uByte	bLength;
493240078Shselasky	uByte	bDescriptorType;
494240078Shselasky	uByte	bEndpointAddress;
495240078Shselasky	uByte	bmAttributes;
496240078Shselasky	uWord	wMaxPacketSize;
497240078Shselasky	uByte	bInterval;
498240078Shselasky} __packed;
499240078Shselasky
500240609Shselasky#define	UA20_CS_CUR	0x01
501240609Shselasky#define	UA20_CS_RANGE	0x02
502240609Shselasky#define	UA20_CS_MEM	0x03
503240078Shselasky
504240078Shselaskystruct usb_audio20_cur1_parameter {
505240078Shselasky	uByte	bCur;
506240078Shselasky} __packed;
507240078Shselasky
508240078Shselaskystruct usb_audio20_ctl1_range_sub {
509240078Shselasky	uByte	bMIN;
510240078Shselasky	uByte	bMAX;
511240078Shselasky	uByte	bRES;
512240078Shselasky} __packed;
513240078Shselasky
514240078Shselaskystruct usb_audio20_ctl1_range {
515240078Shselasky	uWord	wNumSubRanges;
516240078Shselasky	struct usb_audio20_ctl1_range_sub sub[1];
517240078Shselasky} __packed;
518240078Shselasky
519240078Shselaskystruct usb_audio20_cur2_parameter {
520240078Shselasky	uWord	wCur;
521240078Shselasky} __packed;
522240078Shselasky
523240078Shselaskystruct usb_audio20_ctl2_range_sub {
524240078Shselasky	uWord	wMIN;
525240078Shselasky	uWord	wMAX;
526240078Shselasky	uWord	wRES;
527240078Shselasky} __packed;
528240078Shselasky
529240078Shselaskystruct usb_audio20_ctl2_range {
530240078Shselasky	uWord	wNumSubRanges;
531240078Shselasky	struct usb_audio20_ctl2_range_sub sub[1];
532240078Shselasky} __packed;
533240078Shselasky
534240078Shselaskystruct usb_audio20_cur4_parameter {
535240078Shselasky	uDWord	dCur;
536240078Shselasky} __packed;
537240078Shselasky
538240078Shselaskystruct usb_audio20_ctl4_range_sub {
539240078Shselasky	uDWord	dMIN;
540240078Shselasky	uDWord	dMAX;
541240078Shselasky	uDWord	dRES;
542240078Shselasky} __packed;
543240078Shselasky
544240078Shselaskystruct usb_audio20_ctl4_range {
545240078Shselasky	uWord	wNumSubRanges;
546240078Shselasky	struct usb_audio20_ctl4_range_sub sub[1];
547240078Shselasky} __packed;
548240078Shselasky
549240078Shselaskystruct usb_audio20_cc_cluster_descriptor {
550240078Shselasky	uByte	bNrChannels;
551240078Shselasky	uDWord	bmChannelConfig;
552240078Shselasky	uByte	iChannelNames;
553240078Shselasky} __packed;
554240078Shselasky
555240078Shselaskystruct usb_audio20_streaming_type1_descriptor {
556240078Shselasky	uByte	bLength;
557240078Shselasky	uByte	bDescriptorType;
558240078Shselasky	uByte	bDescriptorSubtype;
559240078Shselasky	uByte	bFormatType;
560240078Shselasky	uByte	bSubslotSize;
561240078Shselasky	uByte	bBitResolution;
562240078Shselasky} __packed;
563240078Shselasky
564240078Shselasky#define	UA20_EERROR_NONE	0
565240078Shselasky#define	UA20_EERROR_MEMORY	1
566240078Shselasky#define	UA20_EERROR_BANDWIDTH	2
567240078Shselasky#define	UA20_EERROR_CPU		3
568240078Shselasky#define	UA20_EERROR_FORMATFR_ER	4
569240078Shselasky#define	UA20_EERROR_FORMATFR_SM	5
570240078Shselasky#define	UA20_EERROR_FORMATFR_LG	6
571240078Shselasky#define	UA20_EERROR_DATAFORMAT	7
572240078Shselasky#define	UA20_EERROR_NUMCHANNELS	8
573240078Shselasky#define	UA20_EERROR_SAMPLERATE	9
574240078Shselasky#define	UA20_EERROR_BITRATE	10
575240078Shselasky#define	UA20_EERROR_PARAM	11
576240078Shselasky#define	UA20_EERROR_NREADY	12
577240078Shselasky#define	UA20_EERROR_BUSY	13
578240078Shselasky
579240078Shselaskystruct usb_audio20_cc_alt_setting {
580240078Shselasky	uByte	bControlSize;
581240078Shselasky	uDWord	bmValidAltSettings;
582240078Shselasky} __packed;
583240078Shselasky
584240078Shselaskystruct usb_audio20_interrupt_message {
585240078Shselasky	uByte	bInfo;
586240078Shselasky	uByte	bAttribute;
587240078Shselasky	uDWord	wValue;
588240078Shselasky	uDWord	wIndex;
589240078Shselasky} __packed;
590240078Shselasky
591240078Shselasky/* UDESCSUB_AC_CLOCK_SRC */
592240078Shselaskystruct usb_audio20_clock_source_unit {
593240078Shselasky	uByte	bLength;
594240078Shselasky	uByte	bDescriptorType;
595240078Shselasky	uByte	bDescriptorSubtype;
596240078Shselasky	uByte	bClockId;
597240078Shselasky	uByte	bmAttributes;
598240078Shselasky	uByte	bmControls;
599240078Shselasky	uByte	bAssocTerminal;
600240078Shselasky	uByte	iClockSource;
601240078Shselasky} __packed;
602240078Shselasky
603240078Shselasky/* UDESCSUB_AC_CLOCK_SEL */
604240609Shselaskystruct usb_audio20_clock_selector_unit_0 {
605240078Shselasky	uByte	bLength;
606240078Shselasky	uByte	bDescriptorType;
607240078Shselasky	uByte	bDescriptorSubtype;
608240078Shselasky	uByte	bClockId;
609240078Shselasky	uByte	bNrInPins;
610240609Shselasky	uByte	baCSourceId[0];
611240078Shselasky} __packed;
612240078Shselasky
613240609Shselaskystruct usb_audio20_clock_selector_unit_1 {
614240609Shselasky	uByte	bmControls;
615240609Shselasky	uByte	iClockSelector;
616240609Shselasky} __packed;
617240609Shselasky
618240078Shselasky/* UDESCSUB_AC_CLOCK_MUL */
619240078Shselaskystruct usb_audio20_clock_multiplier_unit {
620240078Shselasky	uByte	bLength;
621240078Shselasky	uByte	bDescriptorType;
622240078Shselasky	uByte	bDescriptorSubtype;
623240078Shselasky	uByte	bClockId;
624240078Shselasky	uByte	bCSourceId;
625240078Shselasky	uByte	bmControls;
626240078Shselasky	uByte	iClockMultiplier;
627240078Shselasky} __packed;
628240078Shselasky
629240078Shselasky/* UDESCSUB_AC_INPUT */
630240078Shselaskystruct usb_audio20_input_terminal {
631240078Shselasky	uByte	bLength;
632240078Shselasky	uByte	bDescriptorType;
633240078Shselasky	uByte	bDescriptorSubtype;
634240078Shselasky	uByte	bTerminalId;
635240078Shselasky	uWord	wTerminalType;
636240078Shselasky	uByte	bAssocTerminal;
637240078Shselasky	uByte	bCSourceId;
638240078Shselasky	uByte	bNrChannels;
639240078Shselasky	uDWord	bmChannelConfig;
640240078Shselasky	uByte	iCHannelNames;
641240078Shselasky	uWord	bmControls;
642240078Shselasky	uByte	iTerminal;
643240078Shselasky} __packed;
644240078Shselasky
645240078Shselasky/* UDESCSUB_AC_OUTPUT */
646240078Shselaskystruct usb_audio20_output_terminal {
647240078Shselasky	uByte	bLength;
648240078Shselasky	uByte	bDescriptorType;
649240078Shselasky	uByte	bDescriptorSubtype;
650240078Shselasky	uByte	bTerminalId;
651240078Shselasky	uWord	wTerminalType;
652240078Shselasky	uByte	bAssocTerminal;
653240078Shselasky	uByte	bSourceId;
654240078Shselasky	uByte	bCSourceId;
655240078Shselasky	uWord	bmControls;
656240078Shselasky	uByte	iTerminal;
657240078Shselasky} __packed;
658240078Shselasky
659240078Shselasky/* UDESCSUB_AC_MIXER */
660240078Shselaskystruct usb_audio20_mixer_unit_0 {
661240078Shselasky	uByte	bLength;
662240078Shselasky	uByte	bDescriptorType;
663240078Shselasky	uByte	bDescriptorSubtype;
664240078Shselasky	uByte	bUnitId;
665240078Shselasky	uByte	bNrInPins;
666240078Shselasky	uByte	baSourceId[0];
667240078Shselasky	/* struct usb_audio20_mixer_unit_1 */
668240078Shselasky} __packed;
669240078Shselasky
670240078Shselaskystruct usb_audio20_mixer_unit_1 {
671240078Shselasky	uByte	bNrChannels;
672240078Shselasky	uDWord	bmChannelConfig;
673240078Shselasky	uByte	iChannelNames;
674240078Shselasky	uByte	bmControls[0];
675240078Shselasky	/* uByte	iMixer; */
676240078Shselasky} __packed;
677240078Shselasky
678240078Shselasky/* UDESCSUB_AC_SELECTOR */
679240078Shselaskystruct usb_audio20_selector_unit {
680240078Shselasky	uByte	bLength;
681240078Shselasky	uByte	bDescriptorType;
682240078Shselasky	uByte	bDescriptorSubtype;
683240078Shselasky	uByte	bUnitId;
684240078Shselasky	uByte	bNrInPins;
685240078Shselasky	uByte	baSourceId[0];
686240078Shselasky	/* uByte	iSelector; */
687240078Shselasky} __packed;
688240078Shselasky
689240078Shselasky/* UDESCSUB_AC_FEATURE */
690240078Shselaskystruct usb_audio20_feature_unit {
691240078Shselasky	uByte	bLength;
692240078Shselasky	uByte	bDescriptorType;
693240078Shselasky	uByte	bDescriptorSubtype;
694240078Shselasky	uByte	bUnitId;
695240078Shselasky	uByte	bSourceId;
696240078Shselasky	uDWord	bmaControls[0];
697240078Shselasky	/* uByte	iFeature; */
698240078Shselasky} __packed;
699240078Shselasky
700240078Shselasky/* UDESCSUB_AC_SAMPLE_RT */
701240078Shselaskystruct usb_audio20_sample_rate_unit {
702240078Shselasky	uByte	bLength;
703240078Shselasky	uByte	bDescriptorType;
704240078Shselasky	uByte	bDescriptorSubtype;
705240078Shselasky	uByte	bUnitId;
706240078Shselasky	uByte	bSourceId;
707240078Shselasky	uByte	bSourceInId;
708240078Shselasky	uByte	bSourceOutId;
709240078Shselasky	uByte	iSrc;
710240078Shselasky} __packed;
711240078Shselasky
712240078Shselasky/* UDESCSUB_AC_EFFECT */
713240078Shselaskystruct usb_audio20_effect_unit {
714240078Shselasky	uByte	bLength;
715240078Shselasky	uByte	bDescriptorType;
716240078Shselasky	uByte	bDescriptorSubtype;
717240078Shselasky	uByte	bUnitId;
718240078Shselasky	uWord	wEffectType;
719240078Shselasky	uByte	bSourceId;
720240078Shselasky	uDWord	bmaControls[0];
721240078Shselasky	uByte	iEffects;
722240078Shselasky} __packed;
723240078Shselasky
724240078Shselasky/* UDESCSUB_AC_PROCESSING_V2 */
725240078Shselaskystruct usb_audio20_processing_unit_0 {
726240078Shselasky	uByte	bLength;
727240078Shselasky	uByte	bDescriptorType;
728240078Shselasky	uByte	bDescriptorSubtype;
729240078Shselasky	uByte	bUnitId;
730240078Shselasky	uWord	wProcessType;
731240078Shselasky	uByte	bNrInPins;
732240078Shselasky	uByte	baSourceId[0];		/* [bNrInPins] */
733240078Shselasky} __packed;
734240078Shselasky
735240078Shselaskystruct usb_audio20_processing_unit_1 {
736240078Shselasky	uByte	bNrChannels;
737240078Shselasky	uDWord	bmChannelConfig;
738240078Shselasky	uByte	iChannelNames;
739240078Shselasky	uWord	bmControls;
740240078Shselasky	uByte	iProcessing;
741240078Shselasky} __packed;
742240078Shselasky
743240078Shselasky/* UDESCSUB_AC_EXTENSION_V2 */
744240078Shselaskystruct usb_audio20_extension_unit_0 {
745240078Shselasky	uByte	bLength;
746240078Shselasky	uByte	bDescriptorType;
747240078Shselasky	uByte	bDescriptorSubtype;
748240078Shselasky	uByte	bUnitId;
749240078Shselasky	uWord	wExtensionCode;
750240078Shselasky	uByte	bNrInPins;
751240078Shselasky	uByte	baSourceId[0];
752240078Shselasky} __packed;
753240078Shselasky
754240078Shselaskystruct usb_audio20_extension_unit_1 {
755240078Shselasky	uByte	bNrChannels;
756240078Shselasky	uDWord	bmChannelConfig;
757240078Shselasky	uByte	iChannelNames;
758240078Shselasky	uByte	bmControls;
759240078Shselasky	uByte	iExtension;
760240078Shselasky} __packed;
761240078Shselasky
762240078Shselaskystruct usb_audio20_cluster {
763240078Shselasky	uByte	bNrChannels;
764240078Shselasky	uDWord	bmChannelConfig;
765240078Shselasky	uByte	iChannelNames;
766240078Shselasky} __packed;
767240078Shselasky
768240078Shselasky#define	UA20_TF_UNDEFINED		0x00
769240078Shselasky#define	UA20_TF_DESKTOP_SPEAKER		0x01
770240078Shselasky#define	UA20_TF_HOME_THEATER		0x02
771240078Shselasky#define	UA20_TF_MICROPHONE		0x03
772240078Shselasky#define	UA20_TF_HEADSET			0x04
773240078Shselasky#define	UA20_TF_TELEPHONE		0x05
774240078Shselasky#define	UA20_TF_CONVERTER		0x06
775240078Shselasky#define	UA20_TF_SOUND_RECORDER		0x07
776240078Shselasky#define	UA20_TF_IO_BOX			0x08
777240078Shselasky#define	UA20_TF_MUSICAL_INSTRUMENT	0x09
778240078Shselasky#define	UA20_TF_PRO_AUDIO		0x0A
779240078Shselasky#define	UA20_TF_AV			0x0B
780240078Shselasky#define	UA20_TF_CONTROL_PANEL		0x0C
781240078Shselasky#define	UA20_TF_OTHER			0xFF
782240078Shselasky
783240078Shselasky#define	UA20_CS_SAM_FREQ_CONTROL	0x01
784240078Shselasky#define	UA20_CS_CLOCK_VALID_CONTROL 	0x02
785240078Shselasky
786240078Shselasky#define	UA20_TE_COPY_PROTECT_CONTROL	0x01
787240078Shselasky#define	UA20_TE_CONNECTOR_CONTROL	0x02
788240078Shselasky#define	UA20_TE_OVERLOAD_CONTROL	0x03
789240078Shselasky#define	UA20_TE_CLUSTER_CONTROL		0x04
790240078Shselasky#define	UA20_TE_UNDERFLOW_CONTROL	0x05
791240078Shselasky#define	UA20_TE_OVERFLOW_CONTROL	0x06
792240078Shselasky#define	UA20_TE_LATENCY_CONTROL		0x07
793240078Shselasky
794240078Shselasky#define	UA20_MU_MIXER_CONTROL		0x01
795240078Shselasky#define	UA20_MU_CLUSTER_CONTROL		0x02
796240078Shselasky#define	UA20_MU_UNDERFLOW_CONTROL	0x03
797240078Shselasky#define	UA20_MU_OVERFLOW_CONTROL	0x04
798240078Shselasky#define	UA20_MU_LATENCY_CONTROL		0x05
799240078Shselasky
800240078Shselasky#define	UA20_FMT_PCM	(1U << 0)
801240078Shselasky#define	UA20_FMT_PCM8	(1U << 1)
802240078Shselasky#define	UA20_FMT_FLOAT	(1U << 2)
803240078Shselasky#define	UA20_FMT_ALAW	(1U << 3)
804240078Shselasky#define	UA20_FMT_MULAW	(1U << 4)
805240078Shselasky#define	UA20_FMT_RAW	(1U << 31)
806240078Shselasky
807240078Shselasky#endif					/* _UAUDIOREG_H_ */
808