xref: /onnv-gate/usr/src/uts/common/sys/usb/clients/audio/usb_audio.h (revision 10398:1df1b43027bb)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
57492SZhigang.Lu@Sun.COM  * Common Development and Distribution License (the "License").
67492SZhigang.Lu@Sun.COM  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
22*10398SBinzi.Cao@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate 
270Sstevel@tonic-gate #ifndef _SYS_USB_AUDIO_H
280Sstevel@tonic-gate #define	_SYS_USB_AUDIO_H
290Sstevel@tonic-gate 
300Sstevel@tonic-gate 
310Sstevel@tonic-gate #ifdef __cplusplus
320Sstevel@tonic-gate extern "C" {
330Sstevel@tonic-gate #endif
340Sstevel@tonic-gate 
350Sstevel@tonic-gate /*
360Sstevel@tonic-gate  * macros from audio spec 1.0
370Sstevel@tonic-gate  *
380Sstevel@tonic-gate  * audio class-specific descriptor types (Appendix A.4)
390Sstevel@tonic-gate  */
400Sstevel@tonic-gate #define	USB_AUDIO_CS_DEVICE		0x21
410Sstevel@tonic-gate #define	USB_AUDIO_CS_CONFIGURATION	0x22
420Sstevel@tonic-gate #define	USB_AUDIO_CS_STRING		0x23
430Sstevel@tonic-gate #define	USB_AUDIO_CS_INTERFACE		0x24
440Sstevel@tonic-gate #define	USB_AUDIO_CS_ENDPOINT		0x25
450Sstevel@tonic-gate 
460Sstevel@tonic-gate /* audio class-specific AC Interface Descriptor Subtypes (A.5) */
470Sstevel@tonic-gate #define	USB_AUDIO_HEADER		0x01
480Sstevel@tonic-gate #define	USB_AUDIO_INPUT_TERMINAL	0x02
490Sstevel@tonic-gate #define	USB_AUDIO_OUTPUT_TERMINAL	0x03
500Sstevel@tonic-gate #define	USB_AUDIO_MIXER_UNIT		0x04
510Sstevel@tonic-gate #define	USB_AUDIO_SELECTOR_UNIT		0x05
520Sstevel@tonic-gate #define	USB_AUDIO_FEATURE_UNIT		0x06
530Sstevel@tonic-gate #define	USB_AUDIO_PROCESSING_UNIT	0x07
540Sstevel@tonic-gate #define	USB_AUDIO_EXTENSION_UNIT	0x08
550Sstevel@tonic-gate 
560Sstevel@tonic-gate /* audio class-specific AS Interface descriptor Subtypes (A.6) */
570Sstevel@tonic-gate #define	USB_AUDIO_AS_GENERAL		0x01
580Sstevel@tonic-gate #define	USB_AUDIO_AS_FORMAT_TYPE	0x02
590Sstevel@tonic-gate #define	USB_AUDIO_AS_FORMAT_SPECIFIC	0x03
600Sstevel@tonic-gate 
610Sstevel@tonic-gate /* Processing Uniti Process Types (A.7) */
620Sstevel@tonic-gate #define	USB_AUDIO_UP_DOWNMIX_PROCESS		0x01
630Sstevel@tonic-gate #define	USB_AUDIO_DOLBY_PROLOGIC_PROCESS	0x02
640Sstevel@tonic-gate #define	USB_AUDIO_3D_STEREO_EXTENDER_PROCESS	0x03
650Sstevel@tonic-gate #define	USB_AUDIO_REVERBERATION_PROCESS		0x04
660Sstevel@tonic-gate #define	USB_AUDIO_CHORUS_PROCESS		0x05
670Sstevel@tonic-gate #define	USB_AUDIO_DYN_RANGE_COMP_PROCESS	0x06
680Sstevel@tonic-gate 
690Sstevel@tonic-gate /* Audio Class-specific endpoint descriptor Subtypes (A.8) */
700Sstevel@tonic-gate #define	USB_AUDIO_EP_GENERAL		0x07
710Sstevel@tonic-gate 
720Sstevel@tonic-gate /* Audio Class-specific Request Codes */
730Sstevel@tonic-gate #define	USB_AUDIO_SET_CUR		0x01
740Sstevel@tonic-gate #define	USB_AUDIO_GET_CUR		0x81
750Sstevel@tonic-gate #define	USB_AUDIO_SET_MIN		0x02
760Sstevel@tonic-gate #define	USB_AUDIO_GET_MIN		0x82
770Sstevel@tonic-gate #define	USB_AUDIO_SET_MAX		0x03
780Sstevel@tonic-gate #define	USB_AUDIO_GET_MAX		0x83
790Sstevel@tonic-gate #define	USB_AUDIO_SET_RES		0x04
800Sstevel@tonic-gate #define	USB_AUDIO_GET_RES		0x84
810Sstevel@tonic-gate #define	USB_AUDIO_SET_MEM		0x05
820Sstevel@tonic-gate #define	USB_AUDIO_GET_MEM		0x85
830Sstevel@tonic-gate #define	USB_AUDIO_GET_STAT		0xff
840Sstevel@tonic-gate 
850Sstevel@tonic-gate /* Terminal Control Selectors (A.10.1) */
860Sstevel@tonic-gate #define	USB_AUDIO_COPY_PROTECT_CONTROL	0x01
870Sstevel@tonic-gate 
880Sstevel@tonic-gate /* Feature Unit Control Selectors (A.1.10.2) */
890Sstevel@tonic-gate #define	USB_AUDIO_MUTE_CONTROL		0x01
900Sstevel@tonic-gate #define	USB_AUDIO_VOLUME_CONTROL	0x02
910Sstevel@tonic-gate #define	USB_AUDIO_BASS_CONTROL		0x03
920Sstevel@tonic-gate #define	USB_AUDIO_MID_CONTROL		0x04
930Sstevel@tonic-gate #define	USB_AUDIO_TREBLE_CONTROL	0x05
940Sstevel@tonic-gate #define	USB_AUDIO_GRAPHIC_CONTROL	0x06
950Sstevel@tonic-gate #define	USB_AUDIO_AUTOMATIC_GAIN_CONTROL 0x07
960Sstevel@tonic-gate #define	USB_AUDIO_DELAY_CONTROL		0x08
970Sstevel@tonic-gate #define	USB_AUDIO_BASS_BOOST_CONTROL	0x09
980Sstevel@tonic-gate #define	USB_AUDIO_LOUDNESS_CONTROL	0x0A
990Sstevel@tonic-gate 
1000Sstevel@tonic-gate /* the spec defines volume control value of 0x8000 as silence */
1010Sstevel@tonic-gate #define	USB_AUDIO_VOLUME_SILENCE	0x8000
1020Sstevel@tonic-gate 
1030Sstevel@tonic-gate /* Up/Down-mix Processing Unit Control Selectors (A.10.3.1) */
1040Sstevel@tonic-gate #define	USB_AUDIO_UD_ENABLE_CONTROL	0x01
1050Sstevel@tonic-gate #define	USB_AUDIO_UD_MODE_SELECT_CONTROL 0x02
1060Sstevel@tonic-gate 
1070Sstevel@tonic-gate /* Dolby Prologic Processing Unit Control Selectors (A.10.3.2) */
1080Sstevel@tonic-gate #define	USB_AUDIO_DP_ENABLE_CONTROL	0x01
1090Sstevel@tonic-gate #define	USB_AUDIO_DP_MODE_SELECT_CONTROL 0x02
1100Sstevel@tonic-gate 
1110Sstevel@tonic-gate /* Reverberation Processing Unit Control Selectors (A.10.3.3) */
1120Sstevel@tonic-gate #define	USB_AUDIO_RV_ENABLE_CONTROL	0x01
1130Sstevel@tonic-gate #define	USB_AUDIO_REVERB_LEVEL_CONTROL	0x02
1140Sstevel@tonic-gate #define	USB_AUDIO_REVERB_TIME_CONTROL	0x03
1150Sstevel@tonic-gate #define	USB_AUDIO_REVERB_FEEDBACK_CONTROL 0x04
1160Sstevel@tonic-gate 
1170Sstevel@tonic-gate /* Chorus Processing Unit Control Selectors (A.10.3.5) */
1180Sstevel@tonic-gate #define	USB_AUDIO_CH_ENABLE_CONTROL	0x01
1190Sstevel@tonic-gate #define	USB_AUDIO_CHORUS_LEVEL_CONTROL	0x02
1200Sstevel@tonic-gate #define	USB_AUDIO_CHORUS_RATE_CONTROL	0x03
1210Sstevel@tonic-gate #define	USB_AUDIO_CHORUS_DEPTH_CONTROL	0x04
1220Sstevel@tonic-gate 
1230Sstevel@tonic-gate /* Dynamic range compressor Processing Unit Control Selectors (A.10.3.6) */
1240Sstevel@tonic-gate #define	USB_AUDIO_DR_ENABLE_CONTROL	0x01
1250Sstevel@tonic-gate #define	USB_AUDIO_COMPRESSION_RATE_CONTROL 0x02
1260Sstevel@tonic-gate #define	USB_AUDIO_MAXAMPL_CONTROL	0x03
1270Sstevel@tonic-gate #define	USB_AUDIO_THRESHOLD_CONTROL	0x04
1280Sstevel@tonic-gate #define	USB_AUDIO_ATTACK_TIME		0x05
1290Sstevel@tonic-gate #define	USB_AUDIO_RELEASE_TIME		0x06
1300Sstevel@tonic-gate 
1310Sstevel@tonic-gate /* Extension Unit Control Selectors (A.10.4) */
1320Sstevel@tonic-gate #define	USB_AUDIO_XU_ENABLE_CONTROL	0x01
1330Sstevel@tonic-gate 
1340Sstevel@tonic-gate /* Endpoint Control Selectors (A.10.5) */
1350Sstevel@tonic-gate #define	USB_AUDIO_SAMPLING_FREQ_CONTROL	0x01
1360Sstevel@tonic-gate #define	USB_AUDIO_PITCH_CONTROL		0x02
1370Sstevel@tonic-gate 
1380Sstevel@tonic-gate /* descriptors */
1390Sstevel@tonic-gate /* Class specific AC interface header descriptor (4.3.2) */
1400Sstevel@tonic-gate typedef struct usb_audio_cs_if_descr {
1410Sstevel@tonic-gate 	uint8_t	bLength;	/* size */
1420Sstevel@tonic-gate 	uint8_t	bDescriptorType; /* CS_INTERFACE */
1430Sstevel@tonic-gate 	uint8_t bDescriptorSubType; /* HEADER */
1440Sstevel@tonic-gate 	uint16_t bcdADC;	/* release # */
1450Sstevel@tonic-gate 	uint16_t wTotalLength;	/* the whole wad */
1460Sstevel@tonic-gate 	uint8_t blnCollection;	/* # interfaces */
1470Sstevel@tonic-gate 	uint8_t baInterfaceNr[1]; /* interface # */
1480Sstevel@tonic-gate } usb_audio_cs_if_descr_t;
1490Sstevel@tonic-gate 
1500Sstevel@tonic-gate #define	CS_AC_IF_HEADER_FORMAT "cccsscc"
151880Sfrits #define	CS_AC_IF_HEADER_SIZE 9
1520Sstevel@tonic-gate 
1530Sstevel@tonic-gate /* input terminal descriptor (4.3.2.1) */
1540Sstevel@tonic-gate typedef struct usb_audio_input_term_descr {
1550Sstevel@tonic-gate 	uint8_t	bLength;	/* size */
1560Sstevel@tonic-gate 	uint8_t	bDescriptorType; /* CS_INTERFACE */
1570Sstevel@tonic-gate 	uint8_t bDescriptorSubType; /* INPUT_TERMINAL */
1580Sstevel@tonic-gate 	uint8_t bTerminalID;	/* unique identifier */
1590Sstevel@tonic-gate 	uint16_t wTerminalType;	/* type of terminal */
1600Sstevel@tonic-gate 	uint8_t bAssocTerminal; /* identifier */
1610Sstevel@tonic-gate 	uint8_t bNrChannels;	/* # channels */
1620Sstevel@tonic-gate 	uint16_t wChannelConfig; /* logical channel loc */
1630Sstevel@tonic-gate 	uint8_t iChannelNames;	/* string index */
1640Sstevel@tonic-gate 	uint8_t iTerminal;	/* terminal string index */
1650Sstevel@tonic-gate } usb_audio_input_term_descr_t;
1660Sstevel@tonic-gate 
1670Sstevel@tonic-gate #define	CS_AC_INPUT_TERM_FORMAT "ccccsccscc"
1680Sstevel@tonic-gate #define	CS_AC_INPUT_TERM_SIZE 12
1690Sstevel@tonic-gate 
1700Sstevel@tonic-gate /* output terminal descriptor (4.3.2.2) */
1710Sstevel@tonic-gate typedef struct usb_audio_output_term_descr {
1720Sstevel@tonic-gate 	uint8_t	bLength;	/* size */
1730Sstevel@tonic-gate 	uint8_t	bDescriptorType; /* CS_INTERFACE */
1740Sstevel@tonic-gate 	uint8_t bDescriptorSubType; /* OUTPUT_TERMINAL */
1750Sstevel@tonic-gate 	uint8_t bTerminalID;	/* unique identifier */
1760Sstevel@tonic-gate 	uint16_t wTerminalType;	/* type of terminal */
1770Sstevel@tonic-gate 	uint8_t bAssocTerminal; /* identifier */
1780Sstevel@tonic-gate 	uint8_t bSourceID;	/* identifier */
1790Sstevel@tonic-gate 	uint8_t iTerminal;	/* terminal string index */
1800Sstevel@tonic-gate } usb_audio_output_term_descr_t;
1810Sstevel@tonic-gate 
1820Sstevel@tonic-gate #define	CS_AC_OUTPUT_TERM_FORMAT "ccccsccc"
1830Sstevel@tonic-gate #define	CS_AC_OUTPUT_TERM_SIZE 9
1840Sstevel@tonic-gate 
1850Sstevel@tonic-gate /*
1860Sstevel@tonic-gate  * mixer unit descriptor (4.3.2.3)
1870Sstevel@tonic-gate  * this is awkward descriptors because of the variable size array in
1880Sstevel@tonic-gate  * the middle (baSourceID).
1890Sstevel@tonic-gate  */
1900Sstevel@tonic-gate typedef struct usb_audio_mixer_unit_descr1 {
1910Sstevel@tonic-gate 	uint8_t	bLength;	/* size */
1920Sstevel@tonic-gate 	uint8_t	bDescriptorType; /* CS_INTERFACE */
1930Sstevel@tonic-gate 	uint8_t bDescriptorSubType; /* MIXER_UNIT */
1940Sstevel@tonic-gate 	uint8_t bUnitID;	/* identifier */
1950Sstevel@tonic-gate 	uint8_t bNrInPins;	/* # input pins */
1960Sstevel@tonic-gate 	uint8_t baSourceID[1];	/* idenfifiers */
1970Sstevel@tonic-gate } usb_audio_mixer_unit_descr1_t;
1980Sstevel@tonic-gate 
1990Sstevel@tonic-gate #define	CS_AC_MIXER_UNIT_DESCR1_FORMAT "cccccc"
2000Sstevel@tonic-gate #define	CS_AC_MIXER_UNIT_DESCR1_SIZE 6
2010Sstevel@tonic-gate 
2020Sstevel@tonic-gate typedef struct usb_audio_mixer_unit_descr2 {
2030Sstevel@tonic-gate 	uint8_t bNrChannels;	/* # channels */
2040Sstevel@tonic-gate 	uint16_t wChannelConfig; /* location of channels */
2050Sstevel@tonic-gate 	uint8_t iChannelNames;	/* string index */
2060Sstevel@tonic-gate 	uint8_t	bmControls[1];	/* bitmap prog. ctlrs */
2070Sstevel@tonic-gate } usb_audio_mixer_unit_descr2_t;
2080Sstevel@tonic-gate 
2090Sstevel@tonic-gate typedef struct usb_audio_mixer_unit_descr3 {
2100Sstevel@tonic-gate 	uint8_t iMixer;	/* string index */
2110Sstevel@tonic-gate } usb_audio_mixer_unit_descr3_t;
2120Sstevel@tonic-gate 
2130Sstevel@tonic-gate /* selector unit descriptor (4.3.2.4) */
2140Sstevel@tonic-gate typedef struct usb_audio_selector_unit_descr1 {
2150Sstevel@tonic-gate 	uint8_t	bLength;	/* size */
2160Sstevel@tonic-gate 	uint8_t	bDescriptorType; /* CS_INTERFACE */
2170Sstevel@tonic-gate 	uint8_t bDescriptorSubType; /* SELECTOR_UNIT */
2180Sstevel@tonic-gate 	uint8_t bUnitID;	/* identifier */
2190Sstevel@tonic-gate 	uint8_t bNrInPins;	/* input pins on the unit */
2200Sstevel@tonic-gate 	uint8_t baSourceID[1];	/* ID of pins */
2210Sstevel@tonic-gate } usb_audio_selector_unit_descr1_t;
2220Sstevel@tonic-gate 
2230Sstevel@tonic-gate #define	CS_AC_SELECTOR_UNIT_DESCR1_FORMAT "cccccc"
2240Sstevel@tonic-gate #define	CS_AC_SELECTOR_UNIT_DESCR1_SIZE 6
2250Sstevel@tonic-gate 
2260Sstevel@tonic-gate typedef struct usb_audio_selector_unit_descr2 {
2270Sstevel@tonic-gate 	uint8_t iSelector[1];	/* string index */
2280Sstevel@tonic-gate } usb_audio_selector_unit_descr2_t;
2290Sstevel@tonic-gate 
2300Sstevel@tonic-gate /* feature unit descriptor (4.3.2.5) */
2310Sstevel@tonic-gate typedef struct usb_audio_feature_unit_descr1 {
2320Sstevel@tonic-gate 	uint8_t	bLength;	/* size */
2330Sstevel@tonic-gate 	uint8_t	bDescriptorType; /* CS_INTERFACE */
2340Sstevel@tonic-gate 	uint8_t bDescriptorSubType; /* FEATURE_UNIT */
2350Sstevel@tonic-gate 	uint8_t bUnitID;	/* identifier */
2360Sstevel@tonic-gate 	uint8_t bSourceID;	/* identifier */
2370Sstevel@tonic-gate 	uint8_t bControlSize;	/* size of bmaControls */
2380Sstevel@tonic-gate 	uint8_t bmaControls[1];	/* bitmap of features */
2390Sstevel@tonic-gate } usb_audio_feature_unit_descr1_t;
2400Sstevel@tonic-gate 
2410Sstevel@tonic-gate #define	CS_AC_FEATURE_UNIT_FORMAT	"ccccccc"
2420Sstevel@tonic-gate #define	CS_AC_FEATURE_UNIT_SIZE		7
2430Sstevel@tonic-gate 
2440Sstevel@tonic-gate typedef struct usb_audio_feature_unit_descr2 {
2450Sstevel@tonic-gate 	uint8_t iFeature;	/* string index */
2460Sstevel@tonic-gate } usb_audio_feature_unit_descr2_t;
2470Sstevel@tonic-gate 
2480Sstevel@tonic-gate /* processing unit descriptor (4.3.2.6) */
2490Sstevel@tonic-gate typedef struct usb_audio_processing_unit_descr1 {
2500Sstevel@tonic-gate 	uint8_t	bLength;	/* size */
2510Sstevel@tonic-gate 	uint8_t	bDescriptorType; /* CS_INTERFACE */
2520Sstevel@tonic-gate 	uint8_t bDescriptorSubType; /* PROCESSING_UNIT */
2530Sstevel@tonic-gate 	uint8_t bUnitID;	/* identifier */
2540Sstevel@tonic-gate 	uint8_t	wProcessType;	/* type of processing */
2550Sstevel@tonic-gate 	uint8_t bNrInPins;	/* input pins on the unit */
2560Sstevel@tonic-gate 	uint8_t baSourceID[1];	/* ID of pins */
2570Sstevel@tonic-gate } usb_audio_processing_unit_descr1_t;
2580Sstevel@tonic-gate 
259880Sfrits #define	CS_AC_PROCESSING_UNIT_DESCR1_FORMAT	"ccccccc"
260880Sfrits #define	CS_AC_PROCESSING_UNIT_DESCR1_SIZE	7
2610Sstevel@tonic-gate 
2620Sstevel@tonic-gate typedef struct usb_audio_processing_unit_descr2 {
2630Sstevel@tonic-gate 	uint8_t	bNrChannels;	/* # log. output channels */
2640Sstevel@tonic-gate 	uint16_t wChannelConfig; /* spatial location */
2650Sstevel@tonic-gate 	uint8_t iChannelnames;	/* index to name */
2660Sstevel@tonic-gate 	uint8_t bControlSize;	/* size in bytes */
2670Sstevel@tonic-gate 	uint8_t bmControls[1];	/* control bits */
2680Sstevel@tonic-gate } usb_audio_processing_unit_descr2_t;
2690Sstevel@tonic-gate 
2700Sstevel@tonic-gate typedef struct usb_audio_processing_unit_descr3 {
2710Sstevel@tonic-gate 	uint8_t iProcessing;	/* index to string descr */
2720Sstevel@tonic-gate 	uint8_t Process_specific[1];
2730Sstevel@tonic-gate } usb_audio_processing_unit_descr3_t;
2740Sstevel@tonic-gate 
2750Sstevel@tonic-gate /* extension unit descriptor (4.3.2.7) */
2760Sstevel@tonic-gate typedef struct usb_audio_extension_unit_descr1 {
2770Sstevel@tonic-gate 	uint8_t	bLength;	/* size */
2780Sstevel@tonic-gate 	uint8_t	bDescriptorType; /* CS_INTERFACE */
2790Sstevel@tonic-gate 	uint8_t bDescriptorSubType; /* PROCESSING_UNIT */
2800Sstevel@tonic-gate 	uint8_t wExtensionCode; /* vendor spec. */
2810Sstevel@tonic-gate 	uint8_t bUnitID;	/* identifier */
2820Sstevel@tonic-gate 	uint8_t bNrInPins;	/* input pins on the unit */
2830Sstevel@tonic-gate 	uint8_t baSourceID[1];	/* ID of pins */
2840Sstevel@tonic-gate } usb_audio_extension_unit_descr1_t;
2850Sstevel@tonic-gate 
286880Sfrits #define	CS_AC_EXTENSION_UNIT_DESCR1_FORMAT	"ccccccc"
287880Sfrits #define	CS_AC_EXTENSION_UNIT_DESCR1_SIZE	7
2880Sstevel@tonic-gate 
2890Sstevel@tonic-gate typedef struct usb_audio_extension_unit_descr2 {
2900Sstevel@tonic-gate 	uint8_t	bNrChannels;	/* # log. output channels */
2910Sstevel@tonic-gate 	uint16_t wChannelConfig; /* spatial location */
2920Sstevel@tonic-gate 	uint8_t iChannelnames;	/* index to name */
2930Sstevel@tonic-gate 	uint8_t bControlSize;	/* size in bytes */
2940Sstevel@tonic-gate 	uint8_t bmControls[1];	/* control bits */
2950Sstevel@tonic-gate } usb_audio_extension_unit_descr2_t;
2960Sstevel@tonic-gate 
2970Sstevel@tonic-gate typedef struct usb_audio_extension_unit_descr3 {
2980Sstevel@tonic-gate 	uint8_t iExtension;	/* index to string descr */
2990Sstevel@tonic-gate } usb_audio_extension_unit_descr3_t;
3000Sstevel@tonic-gate 
3010Sstevel@tonic-gate 
3020Sstevel@tonic-gate 
3030Sstevel@tonic-gate /* associated interface descriptor (4.3.2.8) */
3040Sstevel@tonic-gate typedef struct usb_audio_associated_if_descr {
3050Sstevel@tonic-gate 	uint8_t	blength;	/* size */
3060Sstevel@tonic-gate 	uint8_t	bDescriptorType; /* CS_INTERFACE */
3070Sstevel@tonic-gate 	uint8_t bDescriptorSubType; /* ASSOC Interface */
3080Sstevel@tonic-gate 	uint8_t bInterfaceNr;	/* interface number */
3090Sstevel@tonic-gate } usb_audio_associated_if_descr_t;
3100Sstevel@tonic-gate 
3110Sstevel@tonic-gate 
3120Sstevel@tonic-gate /*
3130Sstevel@tonic-gate  * class specific AS interface descriptor (4.5.2)
3140Sstevel@tonic-gate  */
3150Sstevel@tonic-gate typedef struct usb_audio_as_if_descr {
3160Sstevel@tonic-gate 	uint8_t	blength;	/* size */
3170Sstevel@tonic-gate 	uint8_t	bDescriptorType; /* CS_INTERFACE */
3180Sstevel@tonic-gate 	uint8_t bDescriptorSubType; /* AS_GENERAL */
3190Sstevel@tonic-gate 	uint8_t bTerminalLink;	/* identifier */
3200Sstevel@tonic-gate 	uint8_t bDelay;		/* delay in data path */
3210Sstevel@tonic-gate 	uint16_t wFormatTag;	/* data format */
3220Sstevel@tonic-gate } usb_audio_as_if_descr_t;
3230Sstevel@tonic-gate 
3240Sstevel@tonic-gate #define	AS_IF_DESCR_FORMAT	"cccccs"
325880Sfrits #define	AS_IF_DESCR_SIZE	7
3260Sstevel@tonic-gate 
3270Sstevel@tonic-gate 
3280Sstevel@tonic-gate /* class specific AS isochronous audio data ep descr (4.6.1.2) */
3290Sstevel@tonic-gate typedef struct usb_audio_as_isoc_ep_descr {
3300Sstevel@tonic-gate 	uint8_t	blength;	/* size */
3310Sstevel@tonic-gate 	uint8_t	bDescriptorType; /* CS_ENDPOINT */
3320Sstevel@tonic-gate 	uint8_t bDescriptorSubType; /* EP_GENERAL */
3330Sstevel@tonic-gate 	uint8_t bmAttributes;	/* bitmap of attributes */
3340Sstevel@tonic-gate 	uint8_t bLockDelayUnits; /* type of units */
335880Sfrits 	uint16_t wLockDelay;	/* lock of internal clock */
3360Sstevel@tonic-gate } usb_audio_as_isoc_ep_descr_t;
3370Sstevel@tonic-gate 
338880Sfrits #define	AS_ISOC_EP_DESCR_FORMAT "5cs"
339880Sfrits #define	AS_ISOC_EP_DESCR_SIZE 7
3400Sstevel@tonic-gate 
3410Sstevel@tonic-gate /*
3420Sstevel@tonic-gate  * data format descriptor, no need for parse format since
3430Sstevel@tonic-gate  * all fields are chars
3440Sstevel@tonic-gate  */
3450Sstevel@tonic-gate typedef struct usb_audio_type1_format_descr {
3460Sstevel@tonic-gate 	uint8_t	blength;	/* size */
3470Sstevel@tonic-gate 	uint8_t	bDescriptorType; /* CS_INTERFACE */
3480Sstevel@tonic-gate 	uint8_t bDescriptorSubType; /* FORMAT_TYPE */
3490Sstevel@tonic-gate 	uint8_t	bFormatType;	/* FORMAT_TYPE_1 */
3500Sstevel@tonic-gate 	uint8_t bNrChannels;	/* #phys channels */
3510Sstevel@tonic-gate 	uint8_t bSubFrameSize;	/* bytes per frame */
3520Sstevel@tonic-gate 	uint8_t bBitResolution;	/* bits in subframe */
3530Sstevel@tonic-gate 	uint8_t bSamFreqType;	/* sampling freq type */
3540Sstevel@tonic-gate 	uint8_t bSamFreqs[6];	/* sampling freqs */
3550Sstevel@tonic-gate } usb_audio_type1_format_descr_t;
3560Sstevel@tonic-gate 
357880Sfrits #define	AUDIO_TYPE1_FORMAT_FORMAT "10c"
3580Sstevel@tonic-gate #define	AUDIO_TYPE1_FORMAT_SIZE	10
3590Sstevel@tonic-gate 
3600Sstevel@tonic-gate /* audio data format codes */
3610Sstevel@tonic-gate #define	USB_AUDIO_FORMAT_TYPE1_PCM		0x0001
3620Sstevel@tonic-gate #define	USB_AUDIO_FORMAT_TYPE1_PCM8		0x0002
3630Sstevel@tonic-gate #define	USB_AUDIO_FORMAT_TYPE1_IEEE_FLOAT	0x0003
3640Sstevel@tonic-gate #define	USB_AUDIO_FORMAT_TYPE1_ALAW		0x0004
3650Sstevel@tonic-gate #define	USB_AUDIO_FORMAT_TYPE1_MULAW		0x0005
3660Sstevel@tonic-gate 
3670Sstevel@tonic-gate #define	USB_AUDIO_FORMAT_TYPE2_MPEG		0x1001
3680Sstevel@tonic-gate #define	USB_AUDIO_FORMAT_TYPE2_AC		0x1002
3690Sstevel@tonic-gate 
3700Sstevel@tonic-gate #define	USB_AUDIO_FORMAT_TYPE3_IEC1937_AC_3	0x2001
3710Sstevel@tonic-gate #define	USB_AUDIO_FORMAT_TYPE3_IEC1937_MPEG1_L1	0x2002
3720Sstevel@tonic-gate #define	USB_AUDIO_FORMAT_TYPE3_IEC1937_MPEG1_L2	0x2003
3730Sstevel@tonic-gate #define	USB_AUDIO_FORMAT_TYPE3_IEC1937_MPEG2_NOEXT 0x2003
3740Sstevel@tonic-gate #define	USB_AUDIO_FORMAT_TYPE3_IEC1937_MPEG2_EXT 0x2004
3750Sstevel@tonic-gate #define	USB_AUDIO_FORMAT_TYPE3_IEC1937_MPEG2_L1_LS 0x2005
3760Sstevel@tonic-gate #define	USB_AUDIO_FORMAT_TYPE3_IEC1937_MPEG2_L2_LS 0x2006
3770Sstevel@tonic-gate 
3780Sstevel@tonic-gate #define	USB_AUDIO_FORMAT_TYPE_1			0x01
3790Sstevel@tonic-gate #define	USB_AUDIO_FORMAT_TYPE_2			0x02
3800Sstevel@tonic-gate #define	USB_AUDIO_FORMAT_TYPE_3			0x03
3810Sstevel@tonic-gate 
3820Sstevel@tonic-gate /* format specific control selectors */
3830Sstevel@tonic-gate #define	USB_AUDIO_MP_DUAL_CHANNEL_CONTROL	0x01
3840Sstevel@tonic-gate #define	USB_AUDIO_MP_SECOND_STEREO_CONTROL	0x02
3850Sstevel@tonic-gate #define	USB_AUDIO_MP_MULTILINGUAL		0x03
3860Sstevel@tonic-gate #define	USB_AUDIO_MP_DYN_RANGE_CONTROL		0x04
3870Sstevel@tonic-gate #define	USB_AUDIO_MP_SCALING_CONTROL		0x05
3880Sstevel@tonic-gate #define	USB_AUDIO_MP_HILO_SCALING_CONTROL	0x06
3890Sstevel@tonic-gate 
3900Sstevel@tonic-gate #define	USB_AUDIO_AC_MODE_CONTROL		0x01
3910Sstevel@tonic-gate #define	USB_AUDIO_AC_DYN_RANGE_CONTROL		0x02
3920Sstevel@tonic-gate #define	USB_AUDIO_AC_SCALING_CONTROL		0x03
3930Sstevel@tonic-gate #define	USB_AUDIO_AC_HILO_SCALING_CONTROL	0x04
3940Sstevel@tonic-gate 
3950Sstevel@tonic-gate /* From USB Device Class Definition for Terminal Types */
3960Sstevel@tonic-gate /* USB Terminal Types (2.1) */
3970Sstevel@tonic-gate #define	USB_AUDIO_TERM_TYPE_STREAMING		0x0101
3980Sstevel@tonic-gate #define	USB_AUDIO_TERM_TYPE_VS			0x01ff
3990Sstevel@tonic-gate 
4000Sstevel@tonic-gate /* Input term types (2.2) */
4010Sstevel@tonic-gate #define	USB_AUDIO_TERM_TYPE_MICROPHONE		0x0201
4020Sstevel@tonic-gate #define	USB_AUDIO_TERM_TYPE_DT_MICROPHONE	0x0202
4030Sstevel@tonic-gate #define	USB_AUDIO_TERM_TYPE_PERS_MICROPHONE	0x0203
4040Sstevel@tonic-gate #define	USB_AUDIO_TERM_TYPE_OMNI_DIR_MICROPHONE	0x0204
4050Sstevel@tonic-gate #define	USB_AUDIO_TERM_TYPE_MICROPHONE_ARRAY	0x0205
4060Sstevel@tonic-gate #define	USB_AUDIO_TERM_TYPE_PROCESSING_MIC_ARRAY 0x0206
4070Sstevel@tonic-gate 
4080Sstevel@tonic-gate /* output term types (2.3) */
4090Sstevel@tonic-gate #define	USB_AUDIO_TERM_TYPE_SPEAKER		0x0301
4100Sstevel@tonic-gate #define	USB_AUDIO_TERM_TYPE_HEADPHONES		0x0302
4110Sstevel@tonic-gate #define	USB_AUDIO_TERM_TYPE_DISPLAY_AUDIO	0x0303
4120Sstevel@tonic-gate #define	USB_AUDIO_TERM_TYPE_DT_SPEAKER		0x0304
4130Sstevel@tonic-gate #define	USB_AUDIO_TERM_TYPE_ROOM_SPEAKER	0x0305
4140Sstevel@tonic-gate #define	USB_AUDIO_TERM_TYPE_COMM_SPEAKER	0x0306
4150Sstevel@tonic-gate #define	USB_AUDIO_TERM_TYPE_LF_EFFECTS_SPEAKER	0x0307
4160Sstevel@tonic-gate 
4170Sstevel@tonic-gate /* bi-directional terminal types (2.4) */
4180Sstevel@tonic-gate #define	USB_AUDIO_TERM_TYPE_HANDSET		0x0401
4190Sstevel@tonic-gate #define	USB_AUDIO_TERM_TYPE_HEADSET		0x0402
4200Sstevel@tonic-gate #define	USB_AUDIO_TERM_TYPE_SPEAKERPHONE	0x0403
4210Sstevel@tonic-gate #define	USB_AUDIO_TERM_TYPE_ECHO_SUPP_SPEAKERPHONE 0x0404
4220Sstevel@tonic-gate #define	USB_AUDIO_TERM_TYPE_ECHO_CANCEL_SPEAKERPHONE 0x0405
4230Sstevel@tonic-gate 
4240Sstevel@tonic-gate /* telephony terminal types (2.5) */
4250Sstevel@tonic-gate #define	USB_AUDIO_TERM_TYPE_PHONE_LINE		0x0501
4260Sstevel@tonic-gate #define	USB_AUDIO_TERM_TYPE_TELEPHONE		0x0502
4270Sstevel@tonic-gate #define	USB_AUDIO_TERM_TYPE_DOWN_LINE_PHONE	0x0503
4280Sstevel@tonic-gate 
4290Sstevel@tonic-gate /* external terminal types (2.6) */
4300Sstevel@tonic-gate #define	USB_AUDIO_TERM_TYPE_ANALOG_CONNECTOR	0x0601
4310Sstevel@tonic-gate #define	USB_AUDIO_TERM_TYPE_DIGITAL_AUDIO_IF	0x0602
4320Sstevel@tonic-gate #define	USB_AUDIO_TERM_TYPE_LINE_CONNECTOR	0x0603
4330Sstevel@tonic-gate #define	USB_AUDIO_TERM_TYPE_LEGACY_AUDIO_CONNECTOR 0x0604
4340Sstevel@tonic-gate #define	USB_AUDIO_TERM_TYPE_SPDIF_IF		0x0605
4350Sstevel@tonic-gate #define	USB_AUDIO_TERM_TYPE_1394_DA_STREAM	0x0606
4360Sstevel@tonic-gate #define	USB_AUDIO_TERM_TYPE_1394_DV_STREAM_SNDTRCK 0x0607
4370Sstevel@tonic-gate 
4380Sstevel@tonic-gate /* embedded function term types (2.7) */
4390Sstevel@tonic-gate #define	USB_AUDIO_TERM_TYPE_LVL_CAL_NOISE_SRC	0x0701
4400Sstevel@tonic-gate #define	USB_AUDIO_TERM_TYPE_EQUAL_NOISE		0x0702
4410Sstevel@tonic-gate #define	USB_AUDIO_TERM_TYPE_CD_PLAYER		0x0703
4420Sstevel@tonic-gate #define	USB_AUDIO_TERM_TYPE_DAT			0x0704
4430Sstevel@tonic-gate #define	USB_AUDIO_TERM_TYPE_DCC			0x0705
4440Sstevel@tonic-gate #define	USB_AUDIO_TERM_TYPE_MINIDISK		0x0706
4450Sstevel@tonic-gate #define	USB_AUDIO_TERM_TYPE_ANALOG_TAPE		0x0707
4460Sstevel@tonic-gate #define	USB_AUDIO_TERM_TYPE_PHONOGRAPH		0x0708
4470Sstevel@tonic-gate #define	USB_AUDIO_TERM_TYPE_VCR_AUDIO		0x0709
4480Sstevel@tonic-gate #define	USB_AUDIO_TERM_TYPE_VIDEO_DISK_AUDIO	0x070A
4490Sstevel@tonic-gate #define	USB_AUDIO_TERM_TYPE_DVD_AUDIO		0x070B
4500Sstevel@tonic-gate #define	USB_AUDIO_TERM_TYPE_TV_TUNER_AUDIO	0x070C
4510Sstevel@tonic-gate #define	USB_AUDIO_TERM_TYPE_SATELLITE_RCV_AUDIO	0x070D
4520Sstevel@tonic-gate #define	USB_AUDIO_TERM_TYPE_CABLE_TUNER_AUDIO	0x070E
4530Sstevel@tonic-gate #define	USB_AUDIO_TERM_TYPE_CABLE_DSS_AUDIO	0x070F
4540Sstevel@tonic-gate #define	USB_AUDIO_TERM_TYPE_RADIO_RECEIVER	0x0710
4550Sstevel@tonic-gate #define	USB_AUDIO_TERM_TYPE_RADIO_TRANSMITTER	0x0711
4560Sstevel@tonic-gate #define	USB_AUDIO_TERM_TYPE_MULTI_TRACK_RECORDER 0x0712
4570Sstevel@tonic-gate #define	USB_AUDIO_TERM_TYPE_SYNTHESIZER		0x0713
4580Sstevel@tonic-gate 
4590Sstevel@tonic-gate #define	PRINT_MASK_ATTA		0x00000001
4600Sstevel@tonic-gate #define	PRINT_MASK_CLOSE	0x00000002
4610Sstevel@tonic-gate #define	PRINT_MASK_OPEN		0x00000004
4620Sstevel@tonic-gate #define	PRINT_MASK_EVENTS	0x00000008
4630Sstevel@tonic-gate #define	PRINT_MASK_PM		0x00000010
4640Sstevel@tonic-gate #define	PRINT_MASK_CB		0x00000020
4650Sstevel@tonic-gate #define	PRINT_MASK_ALL		0xFFFFFFFF
4660Sstevel@tonic-gate 
4670Sstevel@tonic-gate #define	USB_AUDIO_MIN_PKTSZ	0
4680Sstevel@tonic-gate #define	USB_AUDIO_MAX_PKTSZ	(4 * 1024)
4690Sstevel@tonic-gate 
4700Sstevel@tonic-gate #define	USB_AUDIO_MUTE_ON	1
4710Sstevel@tonic-gate #define	USB_AUDIO_MUTE_OFF	0
4720Sstevel@tonic-gate 
473*10398SBinzi.Cao@Sun.COM #define	USB_AUDIO_PRECISION_8	8
474*10398SBinzi.Cao@Sun.COM #define	USB_AUDIO_PRECISION_16	16
475*10398SBinzi.Cao@Sun.COM 
476*10398SBinzi.Cao@Sun.COM #define	USB_AUDIO_PLAY		0x0001
477*10398SBinzi.Cao@Sun.COM #define	USB_AUDIO_RECORD	0x0002
478*10398SBinzi.Cao@Sun.COM 
4790Sstevel@tonic-gate #ifdef __cplusplus
4800Sstevel@tonic-gate }
4810Sstevel@tonic-gate #endif
4820Sstevel@tonic-gate 
4830Sstevel@tonic-gate #endif	/* _SYS_USB_AUDIO_H */
484