uaudioreg.h revision 192984
1/* $NetBSD: uaudioreg.h,v 1.12 2004/11/05 19:08:29 kent Exp $ */ 2/* $FreeBSD: head/sys/dev/sound/usb/uaudioreg.h 192984 2009-05-28 17:36:36Z thompsa $ */ 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#define UAUDIO_VERSION 0x100 35 36#define UDESC_CS_CONFIG 0x22 37#define UDESC_CS_STRING 0x23 38#define UDESC_CS_INTERFACE 0x24 39#define UDESC_CS_ENDPOINT 0x25 40 41#define UDESCSUB_AC_HEADER 1 42#define UDESCSUB_AC_INPUT 2 43#define UDESCSUB_AC_OUTPUT 3 44#define UDESCSUB_AC_MIXER 4 45#define UDESCSUB_AC_SELECTOR 5 46#define UDESCSUB_AC_FEATURE 6 47#define UDESCSUB_AC_PROCESSING 7 48#define UDESCSUB_AC_EXTENSION 8 49 50/* The first fields are identical to struct usb_endpoint_descriptor */ 51typedef struct { 52 uByte bLength; 53 uByte bDescriptorType; 54 uByte bEndpointAddress; 55 uByte bmAttributes; 56 uWord wMaxPacketSize; 57 uByte bInterval; 58 /* 59 * The following two entries are only used by the Audio Class. 60 * And according to the specs the Audio Class is the only one 61 * allowed to extend the endpoint descriptor. 62 * Who knows what goes on in the minds of the people in the USB 63 * standardization? :-( 64 */ 65 uByte bRefresh; 66 uByte bSynchAddress; 67} __packed usb2_endpoint_descriptor_audio_t; 68 69struct usb2_audio_control_descriptor { 70 uByte bLength; 71 uByte bDescriptorType; 72 uByte bDescriptorSubtype; 73 uWord bcdADC; 74 uWord wTotalLength; 75 uByte bInCollection; 76 uByte baInterfaceNr[1]; 77} __packed; 78 79struct usb2_audio_streaming_interface_descriptor { 80 uByte bLength; 81 uByte bDescriptorType; 82 uByte bDescriptorSubtype; 83 uByte bTerminalLink; 84 uByte bDelay; 85 uWord wFormatTag; 86} __packed; 87 88struct usb2_audio_streaming_endpoint_descriptor { 89 uByte bLength; 90 uByte bDescriptorType; 91 uByte bDescriptorSubtype; 92 uByte bmAttributes; 93#define UA_SED_FREQ_CONTROL 0x01 94#define UA_SED_PITCH_CONTROL 0x02 95#define UA_SED_MAXPACKETSONLY 0x80 96 uByte bLockDelayUnits; 97 uWord wLockDelay; 98} __packed; 99 100struct usb2_audio_streaming_type1_descriptor { 101 uByte bLength; 102 uByte bDescriptorType; 103 uByte bDescriptorSubtype; 104 uByte bFormatType; 105 uByte bNrChannels; 106 uByte bSubFrameSize; 107 uByte bBitResolution; 108 uByte bSamFreqType; 109#define UA_SAMP_CONTNUOUS 0 110 uByte tSamFreq[0]; 111#define UA_GETSAMP(p, n) (((p)->tSamFreq[((n)*3)+0]) | \ 112 ((p)->tSamFreq[((n)*3)+1] << 8) | \ 113 ((p)->tSamFreq[((n)*3)+2] << 16)) 114#define UA_SAMP_LO(p) UA_GETSAMP(p, 0) 115#define UA_SAMP_HI(p) UA_GETSAMP(p, 1) 116} __packed; 117 118struct usb2_audio_cluster { 119 uByte bNrChannels; 120 uWord wChannelConfig; 121#define UA_CHANNEL_LEFT 0x0001 122#define UA_CHANNEL_RIGHT 0x0002 123#define UA_CHANNEL_CENTER 0x0004 124#define UA_CHANNEL_LFE 0x0008 125#define UA_CHANNEL_L_SURROUND 0x0010 126#define UA_CHANNEL_R_SURROUND 0x0020 127#define UA_CHANNEL_L_CENTER 0x0040 128#define UA_CHANNEL_R_CENTER 0x0080 129#define UA_CHANNEL_SURROUND 0x0100 130#define UA_CHANNEL_L_SIDE 0x0200 131#define UA_CHANNEL_R_SIDE 0x0400 132#define UA_CHANNEL_TOP 0x0800 133 uByte iChannelNames; 134} __packed; 135 136/* Shared by all units and terminals */ 137struct usb2_audio_unit { 138 uByte bLength; 139 uByte bDescriptorType; 140 uByte bDescriptorSubtype; 141 uByte bUnitId; 142}; 143 144/* UDESCSUB_AC_INPUT */ 145struct usb2_audio_input_terminal { 146 uByte bLength; 147 uByte bDescriptorType; 148 uByte bDescriptorSubtype; 149 uByte bTerminalId; 150 uWord wTerminalType; 151 uByte bAssocTerminal; 152 uByte bNrChannels; 153 uWord wChannelConfig; 154 uByte iChannelNames; 155/* uByte iTerminal; */ 156} __packed; 157 158/* UDESCSUB_AC_OUTPUT */ 159struct usb2_audio_output_terminal { 160 uByte bLength; 161 uByte bDescriptorType; 162 uByte bDescriptorSubtype; 163 uByte bTerminalId; 164 uWord wTerminalType; 165 uByte bAssocTerminal; 166 uByte bSourceId; 167 uByte iTerminal; 168} __packed; 169 170/* UDESCSUB_AC_MIXER */ 171struct usb2_audio_mixer_unit_0 { 172 uByte bLength; 173 uByte bDescriptorType; 174 uByte bDescriptorSubtype; 175 uByte bUnitId; 176 uByte bNrInPins; 177 uByte baSourceId[0]; /* [bNrInPins] */ 178 /* struct usb2_audio_mixer_unit_1 */ 179} __packed; 180struct usb2_audio_mixer_unit_1 { 181 uByte bNrChannels; 182 uWord wChannelConfig; 183 uByte iChannelNames; 184 uByte bmControls[0]; /* [see source code] */ 185 /* uByte iMixer; */ 186} __packed; 187 188/* UDESCSUB_AC_SELECTOR */ 189struct usb2_audio_selector_unit { 190 uByte bLength; 191 uByte bDescriptorType; 192 uByte bDescriptorSubtype; 193 uByte bUnitId; 194 uByte bNrInPins; 195 uByte baSourceId[0]; /* [bNrInPins] */ 196 /* uByte iSelector; */ 197} __packed; 198 199/* UDESCSUB_AC_FEATURE */ 200struct usb2_audio_feature_unit { 201 uByte bLength; 202 uByte bDescriptorType; 203 uByte bDescriptorSubtype; 204 uByte bUnitId; 205 uByte bSourceId; 206 uByte bControlSize; 207 uByte bmaControls[0]; /* [bControlSize * x] */ 208 /* uByte iFeature; */ 209} __packed; 210 211/* UDESCSUB_AC_PROCESSING */ 212struct usb2_audio_processing_unit_0 { 213 uByte bLength; 214 uByte bDescriptorType; 215 uByte bDescriptorSubtype; 216 uByte bUnitId; 217 uWord wProcessType; 218 uByte bNrInPins; 219 uByte baSourceId[0]; /* [bNrInPins] */ 220 /* struct usb2_audio_processing_unit_1 */ 221} __packed; 222struct usb2_audio_processing_unit_1 { 223 uByte bNrChannels; 224 uWord wChannelConfig; 225 uByte iChannelNames; 226 uByte bControlSize; 227 uByte bmControls[0]; /* [bControlSize] */ 228#define UA_PROC_ENABLE_MASK 1 229} __packed; 230 231struct usb2_audio_processing_unit_updown { 232 uByte iProcessing; 233 uByte bNrModes; 234 uWord waModes[0]; /* [bNrModes] */ 235} __packed; 236 237/* UDESCSUB_AC_EXTENSION */ 238struct usb2_audio_extension_unit_0 { 239 uByte bLength; 240 uByte bDescriptorType; 241 uByte bDescriptorSubtype; 242 uByte bUnitId; 243 uWord wExtensionCode; 244 uByte bNrInPins; 245 uByte baSourceId[0]; /* [bNrInPins] */ 246 /* struct usb2_audio_extension_unit_1 */ 247} __packed; 248struct usb2_audio_extension_unit_1 { 249 uByte bNrChannels; 250 uWord wChannelConfig; 251 uByte iChannelNames; 252 uByte bControlSize; 253 uByte bmControls[0]; /* [bControlSize] */ 254#define UA_EXT_ENABLE_MASK 1 255#define UA_EXT_ENABLE 1 256 /* uByte iExtension; */ 257} __packed; 258 259/* USB terminal types */ 260#define UAT_UNDEFINED 0x0100 261#define UAT_STREAM 0x0101 262#define UAT_VENDOR 0x01ff 263/* input terminal types */ 264#define UATI_UNDEFINED 0x0200 265#define UATI_MICROPHONE 0x0201 266#define UATI_DESKMICROPHONE 0x0202 267#define UATI_PERSONALMICROPHONE 0x0203 268#define UATI_OMNIMICROPHONE 0x0204 269#define UATI_MICROPHONEARRAY 0x0205 270#define UATI_PROCMICROPHONEARR 0x0206 271/* output terminal types */ 272#define UATO_UNDEFINED 0x0300 273#define UATO_SPEAKER 0x0301 274#define UATO_HEADPHONES 0x0302 275#define UATO_DISPLAYAUDIO 0x0303 276#define UATO_DESKTOPSPEAKER 0x0304 277#define UATO_ROOMSPEAKER 0x0305 278#define UATO_COMMSPEAKER 0x0306 279#define UATO_SUBWOOFER 0x0307 280/* bidir terminal types */ 281#define UATB_UNDEFINED 0x0400 282#define UATB_HANDSET 0x0401 283#define UATB_HEADSET 0x0402 284#define UATB_SPEAKERPHONE 0x0403 285#define UATB_SPEAKERPHONEESUP 0x0404 286#define UATB_SPEAKERPHONEECANC 0x0405 287/* telephony terminal types */ 288#define UATT_UNDEFINED 0x0500 289#define UATT_PHONELINE 0x0501 290#define UATT_TELEPHONE 0x0502 291#define UATT_DOWNLINEPHONE 0x0503 292/* external terminal types */ 293#define UATE_UNDEFINED 0x0600 294#define UATE_ANALOGCONN 0x0601 295#define UATE_DIGITALAUIFC 0x0602 296#define UATE_LINECONN 0x0603 297#define UATE_LEGACYCONN 0x0604 298#define UATE_SPDIF 0x0605 299#define UATE_1394DA 0x0606 300#define UATE_1394DV 0x0607 301/* embedded function terminal types */ 302#define UATF_UNDEFINED 0x0700 303#define UATF_CALIBNOISE 0x0701 304#define UATF_EQUNOISE 0x0702 305#define UATF_CDPLAYER 0x0703 306#define UATF_DAT 0x0704 307#define UATF_DCC 0x0705 308#define UATF_MINIDISK 0x0706 309#define UATF_ANALOGTAPE 0x0707 310#define UATF_PHONOGRAPH 0x0708 311#define UATF_VCRAUDIO 0x0709 312#define UATF_VIDEODISCAUDIO 0x070a 313#define UATF_DVDAUDIO 0x070b 314#define UATF_TVTUNERAUDIO 0x070c 315#define UATF_SATELLITE 0x070d 316#define UATF_CABLETUNER 0x070e 317#define UATF_DSS 0x070f 318#define UATF_RADIORECV 0x0710 319#define UATF_RADIOXMIT 0x0711 320#define UATF_MULTITRACK 0x0712 321#define UATF_SYNTHESIZER 0x0713 322 323 324#define SET_CUR 0x01 325#define GET_CUR 0x81 326#define SET_MIN 0x02 327#define GET_MIN 0x82 328#define SET_MAX 0x03 329#define GET_MAX 0x83 330#define SET_RES 0x04 331#define GET_RES 0x84 332#define SET_MEM 0x05 333#define GET_MEM 0x85 334#define GET_STAT 0xff 335 336#define MUTE_CONTROL 0x01 337#define VOLUME_CONTROL 0x02 338#define BASS_CONTROL 0x03 339#define MID_CONTROL 0x04 340#define TREBLE_CONTROL 0x05 341#define GRAPHIC_EQUALIZER_CONTROL 0x06 342#define AGC_CONTROL 0x07 343#define DELAY_CONTROL 0x08 344#define BASS_BOOST_CONTROL 0x09 345#define LOUDNESS_CONTROL 0x0a 346 347#define FU_MASK(u) (1 << ((u)-1)) 348 349#define MASTER_CHAN 0 350 351#define AS_GENERAL 1 352#define FORMAT_TYPE 2 353#define FORMAT_SPECIFIC 3 354 355#define UA_FMT_PCM 1 356#define UA_FMT_PCM8 2 357#define UA_FMT_IEEE_FLOAT 3 358#define UA_FMT_ALAW 4 359#define UA_FMT_MULAW 5 360#define UA_FMT_MPEG 0x1001 361#define UA_FMT_AC3 0x1002 362 363#define SAMPLING_FREQ_CONTROL 0x01 364#define PITCH_CONTROL 0x02 365 366#define FORMAT_TYPE_UNDEFINED 0 367#define FORMAT_TYPE_I 1 368#define FORMAT_TYPE_II 2 369#define FORMAT_TYPE_III 3 370 371#define UA_PROC_MASK(n) (1<< ((n)-1)) 372#define PROCESS_UNDEFINED 0 373#define XX_ENABLE_CONTROL 1 374#define UPDOWNMIX_PROCESS 1 375#define UD_ENABLE_CONTROL 1 376#define UD_MODE_SELECT_CONTROL 2 377#define DOLBY_PROLOGIC_PROCESS 2 378#define DP_ENABLE_CONTROL 1 379#define DP_MODE_SELECT_CONTROL 2 380#define P3D_STEREO_EXTENDER_PROCESS 3 381#define P3D_ENABLE_CONTROL 1 382#define P3D_SPACIOUSNESS_CONTROL 2 383#define REVERBATION_PROCESS 4 384#define RV_ENABLE_CONTROL 1 385#define RV_LEVEL_CONTROL 2 386#define RV_TIME_CONTROL 3 387#define RV_FEEDBACK_CONTROL 4 388#define CHORUS_PROCESS 5 389#define CH_ENABLE_CONTROL 1 390#define CH_LEVEL_CONTROL 2 391#define CH_RATE_CONTROL 3 392#define CH_DEPTH_CONTROL 4 393#define DYN_RANGE_COMP_PROCESS 6 394#define DR_ENABLE_CONTROL 1 395#define DR_COMPRESSION_RATE_CONTROL 2 396#define DR_MAXAMPL_CONTROL 3 397#define DR_THRESHOLD_CONTROL 4 398#define DR_ATTACK_TIME_CONTROL 5 399#define DR_RELEASE_TIME_CONTROL 6 400