1 #ifndef DEVICES_USB_AUDIO_H 2 #define DEVICES_USB_AUDIO_H 3 /* 4 ** $VER: usb_audio.h 2.0 (15.12.07) 5 ** 6 ** usb definitions include file 7 ** 8 ** (C) Copyright 2002-2007 Chris Hodges 9 ** All Rights Reserved 10 */ 11 12 #include <exec/types.h> 13 14 #if defined(__GNUC__) 15 # pragma pack(1) 16 #endif 17 18 /* Usb Audio Requests */ 19 #define UAUDR_SET_CUR 0x01 20 #define UAUDR_GET_CUR 0x81 21 #define UAUDR_SET_MIN 0x02 22 #define UAUDR_GET_MIN 0x82 23 #define UAUDR_SET_MAX 0x03 24 #define UAUDR_GET_MAX 0x83 25 #define UAUDR_SET_RES 0x04 26 #define UAUDR_GET_RES 0x84 27 #define UAUDR_SET_MEM 0x05 28 #define UAUDR_GET_MEM 0x85 29 #define UAUDR_GET_STAT 0xff 30 31 /* Audio Ctrl class specific interface descriptor subtypes */ 32 #define UDST_AUDIO_CTRL_HEADER 0x01 33 #define UDST_AUDIO_CTRL_INPUT_TERMINAL 0x02 34 #define UDST_AUDIO_CTRL_OUTPUT_TERMINAL 0x03 35 #define UDST_AUDIO_CTRL_MIXER_UNIT 0x04 36 #define UDST_AUDIO_CTRL_SELECTOR_UNIT 0x05 37 #define UDST_AUDIO_CTRL_FEATURE_UNIT 0x06 38 #define UDST_AUDIO_CTRL_PROCESSING_UNIT 0x07 39 #define UDST_AUDIO_CTRL_EXTENSION_UNIT 0x08 40 41 /* Audio Streaming class specific interface descriptor subtypes */ 42 #define UDST_AUDIO_STREAM_GENERAL 0x01 43 #define UDST_AUDIO_STREAM_FMT_TYPE 0x02 44 #define UDST_AUDIO_STREAM_FMT_SPECIFIC 0x03 45 46 /* Audio MIDI class specific interface descriptor subtypes */ 47 #define UDST_AUDIO_MIDI_HEADER 0x01 48 #define UDST_AUDIO_MIDI_IN_JACK 0x02 49 #define UDST_AUDIO_MIDI_OUT_JACK 0x03 50 #define UDST_AUDIO_MIDI_ELEMENT 0x04 51 52 /* Audioclass specific endpoint descriptors subtypes */ 53 #define UDST_AUDIO_EP_GENERAL 0x01 54 55 /* Audio MIDI Jack-types */ 56 #define USBMIDI_JACK_TYPE_UNDEFINED 0x00 57 #define USBMIDI_JACK_EMBEDDED 0x01 58 #define USBMIDI_JACK_EXTERNAL 0x02 59 60 /* Audio classes */ 61 #define AUDIO_NO_SUBCLASS 0x00 62 #define AUDIO_CTRL_SUBCLASS 0x01 63 #define AUDIO_STREAM_SUBCLASS 0x02 64 #define AUDIO_MIDI_SUBCLASS 0x03 65 66 /* USB Audio specific stuff */ 67 68 /* USB Audio USB Terminal types */ 69 #define UAUTT_UNDEFINED 0x0100 /* USB Undefined */ 70 #define UAUTT_STREAMING 0x0101 /* USB streaming */ 71 #define UAUTT_VENDOR 0x01ff /* USB vendor specific */ 72 73 /* USB Audio Input Terminal types */ 74 #define UAITT_UNDEFINED 0x0200 /* Input Undefined */ 75 #define UAITT_MIC 0x0201 /* Microphone */ 76 #define UAITT_DESKTOP_MIC 0x0202 /* Desktop microphone */ 77 #define UAITT_PERSONAL_MIC 0x0203 /* Personal microphone */ 78 #define UAITT_OMNI_DIR_MIC 0x0204 /* Omni-directional microphone */ 79 #define UAITT_MIC_ARRAY 0x0205 /* Microphone array */ 80 #define UAITT_PROC_MIC_ARRAY 0x0206 /* Processing microphone array */ 81 82 /* USB Audio Output Terminal types */ 83 #define UAOTT_UNDEFINED 0x0300 /* Output Undefined */ 84 #define UAOTT_SPEAKER 0x0301 /* Speaker */ 85 #define UAOTT_HEADPHONES 0x0302 /* Headphones */ 86 #define UAOTT_DISPLAY 0x0303 /* Head Mounted Display Audio */ 87 #define UAOTT_DESKTOP_SPEAKER 0x0304 /* Desktop speaker */ 88 #define UAOTT_ROOM_SPEAKER 0x0305 /* Room speaker */ 89 #define UAOTT_COMM_SPEAKER 0x0306 /* Communication speaker */ 90 #define UAOTT_LOFI_SPEAKER 0x0307 /* Low frequency effects speaker */ 91 92 /* USB Audio Bi-directional Terminal types */ 93 #define UABTT_UNDEFINED 0x0400 /* Bi-directional Undefined */ 94 #define UABTT_HANDSET 0x0401 /* Handset */ 95 #define UABTT_HEADSET 0x0402 /* Headset */ 96 #define UABTT_SPEAKERPHONE_NER 0x0403 /* Speakerphone, no echo reduction */ 97 #define UABTT_SPEAKERPHONE_ES 0x0404 /* Echo-suppressing speakerphone */ 98 #define UABTT_SPEAKERPHONE_EC 0x0405 /* Echo-canceling speakerphone */ 99 100 /* USB Audio Telephony Terminal Types */ 101 #define UATTT_UNDEFINED 0x0500 /* Telephony Undefined */ 102 #define UATTT_PHONE_LINE 0x0501 /* Phone line */ 103 #define UATTT_TELEPHONE 0x0502 /* Telephone */ 104 #define UATTT_DOWN_LINE_PHONE 0x0503 /* Down Line Phone */ 105 106 /* USB Audio External Terminal Types */ 107 #define UAETT_UNDEFINED 0x0600 /* External Undefined */ 108 #define UAETT_ANALOG 0x0601 /* Analog connector */ 109 #define UAETT_DIGITAL 0x0602 /* Digital audio interface */ 110 #define UAETT_LINE 0x0603 /* Line connector */ 111 #define UAETT_LEGACY 0x0604 /* Legacy audio connector */ 112 #define UAETT_SPDIF 0x0605 /* S/PDIF interface */ 113 #define UAETT_1394DA 0x0606 /* 1394 DA stream */ 114 #define UAETT_1394DV 0x0607 /* 1394 DV stream soundtrack */ 115 116 /* USB Embedded Function Terminal Types */ 117 #define UAFTT_UNDEFINED 0x0700 /* Embedded Undefined */ 118 #define UAFTT_CALIB_NOISE 0x0701 /* Level Calibration Noise Source */ 119 #define UAFTT_EQ_NOISE 0x0702 /* Equalization Noise */ 120 #define UAFTT_CD 0x0703 /* CD player */ 121 #define UAFTT_DAT 0x0704 /* DAT */ 122 #define UAFTT_DCC 0x0705 /* DCC */ 123 #define UAFTT_MINIDISK 0x0706 /* MiniDisk */ 124 #define UAFTT_TAPE 0x0707 /* Analog Tape */ 125 #define UAFTT_PHONO 0x0708 /* Phonograph */ 126 #define UAFTT_VCR 0x0709 /* VCR Audio */ 127 #define UAFTT_VIDEODISC 0x070a /* Video Disc Audio */ 128 #define UAFTT_DVD 0x070b /* DVD Audio */ 129 #define UAFTT_TV_TUNER 0x070c /* TV Tuner Audio */ 130 #define UAFTT_SAT_RX 0x070d /* Satellite Receiver Audio */ 131 #define UAFTT_CABLE_TUNER 0x070e /* Cable Tuner Audio */ 132 #define UAFTT_DSS 0x070f /* DSS Audio */ 133 #define UAFTT_RADIO_RX 0x0710 /* Radio Receiver */ 134 #define UAFTT_RADIO_TX 0x0711 /* Radio Transmitter */ 135 #define UAFTT_MULTITRACK 0x0712 /* Multi-track Recorder */ 136 #define UAFTT_SYNTHESIZER 0x0713 /* Synthesizer */ 137 138 /* USB Audio Audio Data Formats */ 139 #define UAADF_TYPE_I_UNDEFINED 0x0000 140 #define UAADF_PCM 0x0001 141 #define UAADF_PCM8 0x0002 142 #define UAADF_IEEE_FLOAT 0x0003 143 #define UAADF_ALAW 0x0004 144 #define UAADF_MULAW 0x0005 145 146 #define UAADF_TYPE_II_UNDEFINED 0x1000 147 #define UAADF_MPEG 0x1001 148 #define UAADF_AC3 0x1002 149 150 #define UAADF_TYPE_III_UNDEFINED 0x2000 151 #define UAADF_IEC1937_AC3 0x2001 152 #define UAADF_IEC1937_MPEG1_L1 0x2002 153 #define UAADF_IEC1937_MPEG1_L2_3 0x2003 154 #define UAADF_IEC1937_MPEG2_NOEXT 0x2003 155 #define UAADF_IEC1937_MPEG2_EXT 0x2004 156 #define UAADF_IEC1937_MPEG2_L1_LS 0x2005 157 #define UAADF_IEC1937_MPEG2_L2_3_LS 0x2006 158 159 /* USB Audio Format Type Codes */ 160 #define UAFTC_UNDEFINED 0x00 161 #define UAFTC_TYPE_I 0x01 162 #define UAFTC_TYPE_II 0x02 163 #define UAFTC_TYPE_III 0x03 164 165 /* Endpoint control selectors */ 166 #define UAECS_SAMPLE_FREQ 0x01 167 #define UAECS_PITCH 0x02 168 169 /* Feature Unit Bits */ 170 #define UAFUB_MUTE 0 171 #define UAFUB_VOLUME 1 172 #define UAFUB_BASS 2 173 #define UAFUB_MID 3 174 #define UAFUB_TREBLE 4 175 #define UAFUB_EQUALIZER 5 176 #define UAFUB_AUTOMATIC_GAIN 6 177 #define UAFUB_DELAY 7 178 #define UAFUB_BASS_BOOST 8 179 #define UAFUB_LOUDNESS 9 180 181 #define UAFUF_MUTE (1<<UAFUB_MUTE) 182 #define UAFUF_VOLUME (1<<UAFUB_VOLUME) 183 #define UAFUF_BASS (1<<UAFUB_BASS) 184 #define UAFUF_MID (1<<UAFUB_MID) 185 #define UAFUF_TREBLE (1<<UAFUB_TREBLE) 186 #define UAFUF_EQUALIZER (1<<UAFUB_EQUALIZER) 187 #define UAFUF_AUTOMATIC_GAIN (1<<UAFUB_AUTOMATIC_GAIN) 188 #define UAFUF_DELAY (1<<UAFUB_DELAY) 189 #define UAFUF_BASS_BOOST (1<<UAFUB_BASS_BOOST) 190 #define UAFUF_LOUDNESS (1<<UAFUB_LOUDNESS) 191 192 /* Feature Unit Control Selectors */ 193 #define UAFUCS_MUTE 0x01 194 #define UAFUCS_VOLUME 0x02 195 #define UAFUCS_BASS 0x03 196 #define UAFUCS_MID 0x04 197 #define UAFUCS_TREBLE 0x05 198 #define UAFUCS_EQUALIZER 0x06 199 #define UAFUCS_AUTOMATIC_GAIN 0x07 200 #define UAFUCS_DELAY 0x08 201 #define UAFUCS_BASS_BOOST 0x09 202 #define UAFUCS_LOUDNESS 0x0a 203 204 /* USB Audio Spec 1.0 stuff */ 205 struct UsbAudioHeaderDesc10 206 { 207 UBYTE bLength; /* Size of this descriptor */ 208 UBYTE bDescriptorType; /* Descriptor Type (0x24) */ 209 UBYTE bDescriptorSubType; /* Subtype (0x01) */ 210 UBYTE bcdADC0; /* Low byte of spec version (0x00) */ 211 UBYTE bcdADC1; /* High byte of spec version (0x01) */ 212 UBYTE wTotalLength0; /* Total length of all descriptors (low byte) */ 213 UBYTE wTotalLength1; /* Total length of all descriptors (high byte) */ 214 UBYTE bInCollection; /* The number of Audio/MidiStreaming */ 215 UBYTE baInterfaceNr[1]; /* Interface number of the first AudioStreaming or MIDIStreaming interface */ 216 }; 217 218 struct UsbAudioInputTermDesc10 219 { 220 UBYTE bLength; /* Size of this descriptor */ 221 UBYTE bDescriptorType; /* Descriptor Type (0x24) */ 222 UBYTE bDescriptorSubType; /* Subtype (0x02) */ 223 UBYTE bTerminalID; /* unique ID */ 224 UWORD wTerminalType; /* Terminal Type */ 225 UBYTE bAssocTerminal; /* Associated Output Terminal ID */ 226 UBYTE bNrChannels; /* Number of logical output channels in the output terminal */ 227 UWORD wChannelConfig; /* Spacial location */ 228 UBYTE iChannelNames; /* String descriptor */ 229 UBYTE iTerminal; /* String descriptor */ 230 }; 231 232 struct UsbAudioOutputTermDesc10 233 { 234 UBYTE bLength; /* Size of this descriptor */ 235 UBYTE bDescriptorType; /* Descriptor Type (0x24) */ 236 UBYTE bDescriptorSubType; /* Subtype (0x03) */ 237 UBYTE bTerminalID; /* unique ID */ 238 UWORD wTerminalType; /* Terminal Type */ 239 UBYTE bAssocTerminal; /* Associated Output Terminal ID */ 240 UBYTE bSourceID; /* ID of the Unit or Terminal to which this Terminal is connected. */ 241 UBYTE iTerminal; /* String descriptor */ 242 }; 243 244 /* this data structure is of no use, as it's highly variable in size */ 245 struct UsbAudioMixerUnitDesc10 246 { 247 UBYTE bLength; /* Size of this descriptor */ 248 UBYTE bDescriptorType; /* Descriptor Type (0x24) */ 249 UBYTE bDescriptorSubType; /* Subtype (0x04) */ 250 UBYTE bUnitID; /* unique ID */ 251 UBYTE bNrInPins; /* Number of Input Pins */ 252 UBYTE baSourceID[0]; /* ID of the Unit or Terminal to which the nth Input Pin of this Mixer Unit is connected. */ 253 UBYTE bNrChannels; /* Number of logical output channels in the Mixer's output audio channel cluster. */ 254 UWORD wChannelConfig; /* Spatial location */ 255 UBYTE iChannelNames; /* String descriptor */ 256 UBYTE bmControls[0]; /* Controls bitmap */ 257 UBYTE iMixer; /* String descriptor */ 258 }; 259 260 /* this data structure is of no use, as it's highly variable in size */ 261 struct UsbAudioSelectorUnitDesc10 262 { 263 UBYTE bLength; /* Size of this descriptor */ 264 UBYTE bDescriptorType; /* Descriptor Type (0x24) */ 265 UBYTE bDescriptorSubType; /* Subtype (0x05) */ 266 UBYTE bUnitID; /* unique ID */ 267 UBYTE bNrInPins; /* Number of Input Pins */ 268 UBYTE baSourceID[0]; /* ID of the Unit or Terminal to which the nth Input Pin of this Selector Unit is connected. */ 269 UBYTE iSelector; /* String descriptor */ 270 }; 271 272 /* this data structure is of no use, as it's highly variable in size */ 273 struct UsbAudioFeatureUnitDesc10 274 { 275 UBYTE bLength; /* Size of this descriptor */ 276 UBYTE bDescriptorType; /* Descriptor Type (0x24) */ 277 UBYTE bDescriptorSubType; /* Subtype (0x06) */ 278 UBYTE bUnitID; /* unique ID */ 279 UBYTE bSourceID; /* ID of the Unit or Terminal to which this Terminal is connected. */ 280 UBYTE bControlSize; /* Size in bytes of an element of the control array */ 281 UBYTE bmaControls[0]; /* Controls matrix */ 282 UBYTE iFeature; /* String descriptor */ 283 }; 284 285 /* this data structure is of no use, as it's highly variable in size */ 286 struct UsbAudioProcessingUnitDesc10 287 { 288 UBYTE bLength; /* Size of this descriptor */ 289 UBYTE bDescriptorType; /* Descriptor Type (0x24) */ 290 UBYTE bDescriptorSubType; /* Subtype (0x07) */ 291 UBYTE bUnitID; /* unique ID */ 292 UWORD wProcessType; /* type of processing */ 293 UBYTE bNrInPins; /* Number of Input Pins */ 294 UBYTE baSourceID[0]; /* ID of the Unit or Terminal to which the nth Input Pin of this Processing Unit is connected. */ 295 UBYTE bNrChannels; /* Number of logical output channels in the Mixer's output audio channel cluster. */ 296 UWORD wChannelConfig; /* Spatial location */ 297 UBYTE iChannelNames; /* String descriptor */ 298 UBYTE bControlSize; /* Size in bytes of an element of the control array */ 299 UBYTE bmControls[0]; /* Controls bitmap */ 300 UBYTE iProcessing; /* String descriptor */ 301 }; 302 303 /* this data structure is of no use, as it's highly variable in size */ 304 struct UsbAudioExtensionUnitDesc10 305 { 306 UBYTE bLength; /* Size of this descriptor */ 307 UBYTE bDescriptorType; /* Descriptor Type (0x24) */ 308 UBYTE bDescriptorSubType; /* Subtype (0x08) */ 309 UBYTE bUnitID; /* unique ID */ 310 UWORD wExtensionCode; /* vendor specific */ 311 UBYTE bNrInPins; /* Number of Input Pins */ 312 UBYTE baSourceID[0]; /* ID of the Unit or Terminal to which the nth Input Pin of this Mixer Unit is connected. */ 313 UBYTE bNrChannels; /* Number of logical output channels in the Mixer's output audio channel cluster. */ 314 UWORD wChannelConfig; /* Spatial location */ 315 UBYTE iChannelNames; /* String descriptor */ 316 UBYTE bControlSize; /* Size in bytes of an element of the control array */ 317 UBYTE bmControls[0]; /* Controls bitmap */ 318 UBYTE iExtension; /* String descriptor */ 319 }; 320 321 /* USB Audio Spec 2.0 stuff */ 322 struct UsbAudioHeaderDesc20 323 { 324 UBYTE bLength; /* Size of this descriptor */ 325 UBYTE bDescriptorType; /* Descriptor Type (0x24) */ 326 UBYTE bDescriptorSubType; /* Subtype (0x01) */ 327 UBYTE bcdADC0; /* Low byte of spec version (0x00)*/ 328 UBYTE bcdADC1; /* High byte of spec version (0x02) */ 329 UBYTE bCategory; /* Primary use of the audio function */ 330 UWORD wTotalLength; /* Total length of all descriptors */ 331 UBYTE bmControls; /* Latency control (%00=n/a,%01=read only, %11=r/w) */ 332 }; 333 334 struct UsbAudioInputTermDesc20 335 { 336 UBYTE bLength; /* Size of this descriptor */ 337 UBYTE bDescriptorType; /* Descriptor Type (0x24) */ 338 UBYTE bDescriptorSubType; /* Subtype (0x02) */ 339 UBYTE bTerminalID; /* unique ID */ 340 UWORD wTerminalType; /* Terminal Type */ 341 UBYTE bAssocTerminal; /* Associated Output Terminal ID */ 342 UBYTE bCSourceID; /* ID of the Clock Entity */ 343 UBYTE bNrChannels; /* Number of logical output channels in the output terminal */ 344 UBYTE bmChannelConfig[4]; /* Bitmap of spacial location */ 345 UBYTE iChannelNames; /* String descriptor */ 346 UBYTE bmControls; /* Various controls */ 347 UBYTE iTerminal; /* String descriptor */ 348 }; 349 350 /* generic audio stuff */ 351 struct UsbAudioGeneralIFDesc 352 { 353 UBYTE bLength; /* Size of this descriptor */ 354 UBYTE bDescriptorType; /* Descriptor Type (0x24) */ 355 UBYTE bDescriptorSubType; /* Subtype (0x01) */ 356 UBYTE bTerminalLink; /* Terminal linked to this interface */ 357 UBYTE bDelay; /* Delay in frames */ 358 UBYTE wFormatTag0; /* Data Format (low byte) */ 359 UBYTE wFormatTag1; /* Data Format (high byte) */ 360 }; 361 362 struct UsbAudioType1FormatDesc 363 { 364 UBYTE bLength; /* Size of this descriptor */ 365 UBYTE bDescriptorType; /* Descriptor Type (0x24) */ 366 UBYTE bDescriptorSubType; /* Subtype (0x02) */ 367 UBYTE bFormatType; /* Format Type I (0x01) */ 368 UBYTE bNrChannels; /* Number of physical channels */ 369 UBYTE bSubframeSize; /* Number of bytes occubied by one audio subframe (1-4) */ 370 UBYTE bBitResolution; /* Number of bits used in a subframe */ 371 UBYTE bSamFreqType; /* 0 = continuous freq, otherwise number of discrete freqs */ 372 UBYTE tSamFreq0[3]; /* first sampling freq (or lower range) */ 373 }; 374 375 struct UsbAudioGeneralEPDesc 376 { 377 UBYTE bLength; /* Size of this descriptor */ 378 UBYTE bDescriptorType; /* Descriptor Type (0x25) */ 379 UBYTE bDescriptorSubType; /* Subtype (0x01) */ 380 UBYTE bmAttributes; /* bit 0: Sampling freq, bit 1: Pitch, bit 7 = MaxPktsOnly */ 381 UBYTE bLockDelayUnits; /* 0=undef, 1=ms, 2=PCM samples */ 382 UBYTE wLockDelay0; /* Delay until locked (low byte) */ 383 UBYTE wLockDelay1; /* Delay until locked (high byte) */ 384 }; 385 386 387 #if defined(__GNUC__) 388 # pragma pack() 389 #endif 390 391 #endif /* DEVICES_USB_AUDIO_H */