1 /* $NetBSD: uaudioreg.h,v 1.8 2002/03/07 14:37:03 kent Exp $ */ 2 3 /* 4 * Copyright (c) 1999 The NetBSD Foundation, Inc. 5 * All rights reserved. 6 * 7 * This code is derived from software contributed to The NetBSD Foundation 8 * by Lennart Augustsson (lennart@augustsson.net) at 9 * Carlstedt Research & Technology. 10 * 11 * Redistribution and use in source and binary forms, with or without 12 * modification, are permitted provided that the following conditions 13 * are met: 14 * 1. Redistributions of source code must retain the above copyright 15 * notice, this list of conditions and the following disclaimer. 16 * 2. Redistributions in binary form must reproduce the above copyright 17 * notice, this list of conditions and the following disclaimer in the 18 * documentation and/or other materials provided with the distribution. 19 * 3. All advertising materials mentioning features or use of this software 20 * must display the following acknowledgement: 21 * This product includes software developed by the NetBSD 22 * Foundation, Inc. and its contributors. 23 * 4. Neither the name of The NetBSD Foundation nor the names of its 24 * contributors may be used to endorse or promote products derived 25 * from this software without specific prior written permission. 26 * 27 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 28 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 29 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 30 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 31 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 32 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 33 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 34 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 35 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 36 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 37 * POSSIBILITY OF SUCH DAMAGE. 38 */ 39 40 #define UAUDIO_VERSION 0x100 41 42 #define UDESC_CS_DEVICE 0x21 43 #define UDESC_CS_CONFIG 0x22 44 #define UDESC_CS_STRING 0x23 45 #define UDESC_CS_INTERFACE 0x24 46 #define UDESC_CS_ENDPOINT 0x25 47 48 #define UDESCSUB_AC_HEADER 1 49 #define UDESCSUB_AC_INPUT 2 50 #define UDESCSUB_AC_OUTPUT 3 51 #define UDESCSUB_AC_MIXER 4 52 #define UDESCSUB_AC_SELECTOR 5 53 #define UDESCSUB_AC_FEATURE 6 54 #define UDESCSUB_AC_PROCESSING 7 55 #define UDESCSUB_AC_EXTENSION 8 56 57 /* The first fields are identical to usb_endpoint_descriptor_t */ 58 typedef struct { 59 uByte bLength; 60 uByte bDescriptorType; 61 uByte bEndpointAddress; 62 uByte bmAttributes; 63 uWord wMaxPacketSize; 64 uByte bInterval; 65 /* 66 * The following two entries are only used by the Audio Class. 67 * And according to the specs the Audio Class is the only one 68 * allowed to extend the endpoint descriptor. 69 * Who knows what goes on in the minds of the people in the USB 70 * standardization? :-( 71 */ 72 uByte bRefresh; 73 uByte bSynchAddress; 74 } UPACKED usb_endpoint_descriptor_audio_t; 75 76 struct usb_audio_control_descriptor { 77 uByte bLength; 78 uByte bDescriptorType; 79 uByte bDescriptorSubtype; 80 uWord bcdADC; 81 uWord wTotalLength; 82 uByte bInCollection; 83 uByte baInterfaceNr[1]; 84 } UPACKED; 85 86 struct usb_audio_streaming_interface_descriptor { 87 uByte bLength; 88 uByte bDescriptorType; 89 uByte bDescriptorSubtype; 90 uByte bTerminalLink; 91 uByte bDelay; 92 uWord wFormatTag; 93 } UPACKED; 94 95 struct usb_audio_streaming_endpoint_descriptor { 96 uByte bLength; 97 uByte bDescriptorType; 98 uByte bDescriptorSubtype; 99 uByte bmAttributes; 100 #define UA_SED_FREQ_CONTROL 0x01 101 #define UA_SED_PITCH_CONTROL 0x02 102 #define UA_SED_MAXPACKETSONLY 0x80 103 uByte bLockDelayUnits; 104 uWord wLockDelay; 105 } UPACKED; 106 107 struct usb_audio_streaming_type1_descriptor { 108 uByte bLength; 109 uByte bDescriptorType; 110 uByte bDescriptorSubtype; 111 uByte bFormatType; 112 uByte bNrChannels; 113 uByte bSubFrameSize; 114 uByte bBitResolution; 115 uByte bSamFreqType; 116 #define UA_SAMP_CONTNUOUS 0 117 uByte tSamFreq[3*2]; /* room for low and high */ 118 #define UA_GETSAMP(p, n) ((p)->tSamFreq[(n)*3+0] | ((p)->tSamFreq[(n)*3+1] << 8) | ((p)->tSamFreq[(n)*3+2] << 16)) 119 #define UA_SAMP_LO(p) UA_GETSAMP(p, 0) 120 #define UA_SAMP_HI(p) UA_GETSAMP(p, 1) 121 } UPACKED; 122 123 struct usb_audio_cluster { 124 uByte bNrChannels; 125 uWord wChannelConfig; 126 uByte iChannelNames; 127 } UPACKED; 128 129 /* UDESCSUB_AC_INPUT */ 130 struct usb_audio_input_terminal { 131 uByte bLength; 132 uByte bDescriptorType; 133 uByte bDescriptorSubtype; 134 uByte bTerminalId; 135 uWord wTerminalType; 136 uByte bAssocTerminal; 137 uByte bNrChannels; 138 uWord wChannelConfig; 139 uByte iChannelNames; 140 uByte iTerminal; 141 } UPACKED; 142 143 /* UDESCSUB_AC_OUTPUT */ 144 struct usb_audio_output_terminal { 145 uByte bLength; 146 uByte bDescriptorType; 147 uByte bDescriptorSubtype; 148 uByte bTerminalId; 149 uWord wTerminalType; 150 uByte bAssocTerminal; 151 uByte bSourceId; 152 uByte iTerminal; 153 } UPACKED; 154 155 /* UDESCSUB_AC_MIXER */ 156 struct usb_audio_mixer_unit { 157 uByte bLength; 158 uByte bDescriptorType; 159 uByte bDescriptorSubtype; 160 uByte bUnitId; 161 uByte bNrInPins; 162 uByte baSourceId[255]; /* [bNrInPins] */ 163 /* struct usb_audio_mixer_unit_1 */ 164 } UPACKED; 165 struct usb_audio_mixer_unit_1 { 166 uByte bNrChannels; 167 uWord wChannelConfig; 168 uByte iChannelNames; 169 uByte bmControls[255]; /* [bNrChannels] */ 170 /*uByte iMixer;*/ 171 } UPACKED; 172 173 /* UDESCSUB_AC_SELECTOR */ 174 struct usb_audio_selector_unit { 175 uByte bLength; 176 uByte bDescriptorType; 177 uByte bDescriptorSubtype; 178 uByte bUnitId; 179 uByte bNrInPins; 180 uByte baSourceId[255]; /* [bNrInPins] */ 181 /* uByte iSelector; */ 182 } UPACKED; 183 184 /* UDESCSUB_AC_FEATURE */ 185 struct usb_audio_feature_unit { 186 uByte bLength; 187 uByte bDescriptorType; 188 uByte bDescriptorSubtype; 189 uByte bUnitId; 190 uByte bSourceId; 191 uByte bControlSize; 192 uByte bmaControls[255]; /* size for more than enough */ 193 /* uByte iFeature; */ 194 } UPACKED; 195 196 /* UDESCSUB_AC_PROCESSING */ 197 struct usb_audio_processing_unit { 198 uByte bLength; 199 uByte bDescriptorType; 200 uByte bDescriptorSubtype; 201 uByte bUnitId; 202 uWord wProcessType; 203 uByte bNrInPins; 204 uByte baSourceId[255]; /* [bNrInPins] */ 205 /* struct usb_audio_processing_unit_1 */ 206 } UPACKED; 207 struct usb_audio_processing_unit_1{ 208 uByte bNrChannels; 209 uWord wChannelConfig; 210 uByte iChannelNames; 211 uByte bControlSize; 212 uByte bmControls[255]; /* [bControlSize] */ 213 #define UA_PROC_ENABLE_MASK 1 214 } UPACKED; 215 216 struct usb_audio_processing_unit_updown { 217 uByte iProcessing; 218 uByte bNrModes; 219 uWord waModes[255]; /* [bNrModes] */ 220 } UPACKED; 221 222 /* UDESCSUB_AC_EXTENSION */ 223 struct usb_audio_extension_unit { 224 uByte bLength; 225 uByte bDescriptorType; 226 uByte bDescriptorSubtype; 227 uByte bUnitId; 228 uWord wExtensionCode; 229 uByte bNrInPins; 230 uByte baSourceId[255]; /* [bNrInPins] */ 231 /* struct usb_audio_extension_unit_1 */ 232 } UPACKED; 233 struct usb_audio_extension_unit_1 { 234 uByte bNrChannels; 235 uWord wChannelConfig; 236 uByte iChannelNames; 237 uByte bControlSize; 238 uByte bmControls[255]; /* [bControlSize] */ 239 #define UA_EXT_ENABLE_MASK 1 240 #define UA_EXT_ENABLE 1 241 /*uByte iExtension;*/ 242 } UPACKED; 243 244 /* USB terminal types */ 245 #define UAT_UNDEFINED 0x0100 246 #define UAT_STREAM 0x0101 247 #define UAT_VENDOR 0x01ff 248 /* input terminal types */ 249 #define UATI_UNDEFINED 0x0200 250 #define UATI_MICROPHONE 0x0201 251 #define UATI_DESKMICROPHONE 0x0202 252 #define UATI_PERSONALMICROPHONE 0x0203 253 #define UATI_OMNIMICROPHONE 0x0204 254 #define UATI_MICROPHONEARRAY 0x0205 255 #define UATI_PROCMICROPHONEARR 0x0206 256 /* output terminal types */ 257 #define UATO_UNDEFINED 0x0300 258 #define UATO_SPEAKER 0x0301 259 #define UATO_HEADPHONES 0x0302 260 #define UATO_DISPLAYAUDIO 0x0303 261 #define UATO_DESKTOPSPEAKER 0x0304 262 #define UATO_ROOMSPEAKER 0x0305 263 #define UATO_COMMSPEAKER 0x0306 264 #define UATO_SUBWOOFER 0x0307 265 /* bidir terminal types */ 266 #define UATB_UNDEFINED 0x0400 267 #define UATB_HANDSET 0x0401 268 #define UATB_HEADSET 0x0402 269 #define UATB_SPEAKERPHONE 0x0403 270 #define UATB_SPEAKERPHONEESUP 0x0404 271 #define UATB_SPEAKERPHONEECANC 0x0405 272 /* telephony terminal types */ 273 #define UATT_UNDEFINED 0x0500 274 #define UATT_PHONELINE 0x0501 275 #define UATT_TELEPHONE 0x0502 276 #define UATT_DOWNLINEPHONE 0x0503 277 /* external terminal types */ 278 #define UATE_UNDEFINED 0x0600 279 #define UATE_ANALOGCONN 0x0601 280 #define UATE_DIGITALAUIFC 0x0602 281 #define UATE_LINECONN 0x0603 282 #define UATE_LEGACYCONN 0x0604 283 #define UATE_SPDIF 0x0605 284 #define UATE_1394DA 0x0606 285 #define UATE_1394DV 0x0607 286 /* embedded function terminal types */ 287 #define UATF_UNDEFINED 0x0700 288 #define UATF_CALIBNOISE 0x0701 289 #define UATF_EQUNOISE 0x0702 290 #define UATF_CDPLAYER 0x0703 291 #define UATF_DAT 0x0704 292 #define UATF_DCC 0x0705 293 #define UATF_MINIDISK 0x0706 294 #define UATF_ANALOGTAPE 0x0707 295 #define UATF_PHONOGRAPH 0x0708 296 #define UATF_VCRAUDIO 0x0709 297 #define UATF_VIDEODISCAUDIO 0x070a 298 #define UATF_DVDAUDIO 0x070b 299 #define UATF_TVTUNERAUDIO 0x070c 300 #define UATF_SATELLITE 0x070d 301 #define UATF_CABLETUNER 0x070e 302 #define UATF_DSS 0x070f 303 #define UATF_RADIORECV 0x0710 304 #define UATF_RADIOXMIT 0x0711 305 #define UATF_MULTITRACK 0x0712 306 #define UATF_SYNTHESIZER 0x0713 307 308 309 #define SET_CUR 0x01 310 #define GET_CUR 0x81 311 #define SET_MIN 0x02 312 #define GET_MIN 0x82 313 #define SET_MAX 0x03 314 #define GET_MAX 0x83 315 #define SET_RES 0x04 316 #define GET_RES 0x84 317 #define SET_MEM 0x05 318 #define GET_MEM 0x85 319 #define GET_STAT 0xff 320 321 #define MUTE_CONTROL 0x01 322 #define VOLUME_CONTROL 0x02 323 #define BASS_CONTROL 0x03 324 #define MID_CONTROL 0x04 325 #define TREBLE_CONTROL 0x05 326 #define GRAPHIC_EQUALIZER_CONTROL 0x06 327 #define AGC_CONTROL 0x07 328 #define DELAY_CONTROL 0x08 329 #define BASS_BOOST_CONTROL 0x09 330 #define LOUDNESS_CONTROL 0x0a 331 332 #define FU_MASK(u) (1 << ((u)-1)) 333 334 #define MASTER_CHAN 0 335 336 #define AS_GENERAL 1 337 #define FORMAT_TYPE 2 338 #define FORMAT_SPECIFIC 3 339 340 #define UA_FMT_PCM 1 341 #define UA_FMT_PCM8 2 342 #define UA_FMT_IEEE_FLOAT 3 343 #define UA_FMT_ALAW 4 344 #define UA_FMT_MULAW 5 345 #define UA_FMT_MPEG 0x1001 346 #define UA_FMT_AC3 0x1002 347 348 #define SAMPLING_FREQ_CONTROL 0x01 349 #define PITCH_CONTROL 0x02 350 351 #define FORMAT_TYPE_UNDEFINED 0 352 #define FORMAT_TYPE_I 1 353 #define FORMAT_TYPE_II 2 354 #define FORMAT_TYPE_III 3 355 356 #define UA_PROC_MASK(n) (1<< ((n)-1)) 357 #define PROCESS_UNDEFINED 0 358 #define XX_ENABLE_CONTROL 1 359 #define UPDOWNMIX_PROCESS 1 360 #define UD_ENABLE_CONTROL 1 361 #define UD_MODE_SELECT_CONTROL 2 362 #define DOLBY_PROLOGIC_PROCESS 2 363 #define DP_ENABLE_CONTROL 1 364 #define DP_MODE_SELECT_CONTROL 2 365 #define P3D_STEREO_EXTENDER_PROCESS 3 366 #define P3D_ENABLE_CONTROL 1 367 #define P3D_SPACIOUSNESS_CONTROL 2 368 #define REVERBATION_PROCESS 4 369 #define RV_ENABLE_CONTROL 1 370 #define RV_LEVEL_CONTROL 2 371 #define RV_TIME_CONTROL 3 372 #define RV_FEEDBACK_CONTROL 4 373 #define CHORUS_PROCESS 5 374 #define CH_ENABLE_CONTROL 1 375 #define CH_LEVEL_CONTROL 2 376 #define CH_RATE_CONTROL 3 377 #define CH_DEPTH_CONTROL 4 378 #define DYN_RANGE_COMP_PROCESS 6 379 #define DR_ENABLE_CONTROL 1 380 #define DR_COMPRESSION_RATE_CONTROL 2 381 #define DR_MAXAMPL_CONTROL 3 382 #define DR_THRESHOLD_CONTROL 4 383 #define DR_ATTACK_TIME_CONTROL 5 384 #define DR_RELEASE_TIME_CONTROL 6 385