2 * @brief Common definitions and declarations for the library USB Audio 1.0 Class driver
\r
5 * Copyright(C) NXP Semiconductors, 2012
\r
6 * Copyright(C) Dean Camera, 2011, 2012
\r
7 * All rights reserved.
\r
10 * Software that is described herein is for illustrative purposes only
\r
11 * which provides customers with programming information regarding the
\r
12 * LPC products. This software is supplied "AS IS" without any warranties of
\r
13 * any kind, and NXP Semiconductors and its licensor disclaim any and
\r
14 * all warranties, express or implied, including all implied warranties of
\r
15 * merchantability, fitness for a particular purpose and non-infringement of
\r
16 * intellectual property rights. NXP Semiconductors assumes no responsibility
\r
17 * or liability for the use of the software, conveys no license or rights under any
\r
18 * patent, copyright, mask work right, or any other intellectual property rights in
\r
19 * or to any products. NXP Semiconductors reserves the right to make changes
\r
20 * in the software without notification. NXP Semiconductors also makes no
\r
21 * representation or warranty that such application will be suitable for the
\r
22 * specified use without further testing or modification.
\r
25 * Permission to use, copy, modify, and distribute this software and its
\r
26 * documentation is hereby granted, under NXP Semiconductors' and its
\r
27 * licensor's relevant copyrights in the software, without fee, provided that it
\r
28 * is used in conjunction with NXP Semiconductors microcontrollers. This
\r
29 * copyright, permission, and disclaimer notice must appear in all copies of
\r
33 /** @ingroup Group_USBClassAudio
\r
34 * @defgroup Group_USBClassAudioCommon Common Class Definitions
\r
36 * @section Sec_ModDescription Module Description
\r
37 * Constants, Types and Enum definitions that are common to both Device and Host modes for the USB
\r
43 #ifndef _AUDIO_CLASS_COMMON_H_
\r
44 #define _AUDIO_CLASS_COMMON_H_
\r
47 #include "../../Core/StdDescriptors.h"
\r
49 /* Enable C linkage for C++ Compilers: */
\r
50 #if defined(__cplusplus)
\r
54 /* Preprocessor Checks: */
\r
55 #if !defined(__INCLUDE_FROM_AUDIO_DRIVER)
\r
56 #error Do not include this file directly. Include LPCUSBlib/Drivers/USB.h instead.
\r
60 /** @name Audio Channel Masks */
\r
62 /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */
\r
63 #define AUDIO_CHANNEL_LEFT_FRONT (1 << 0)
\r
65 /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */
\r
66 #define AUDIO_CHANNEL_RIGHT_FRONT (1 << 1)
\r
68 /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */
\r
69 #define AUDIO_CHANNEL_CENTER_FRONT (1 << 2)
\r
71 /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */
\r
72 #define AUDIO_CHANNEL_LOW_FREQ_ENHANCE (1 << 3)
\r
74 /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */
\r
75 #define AUDIO_CHANNEL_LEFT_SURROUND (1 << 4)
\r
77 /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */
\r
78 #define AUDIO_CHANNEL_RIGHT_SURROUND (1 << 5)
\r
80 /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */
\r
81 #define AUDIO_CHANNEL_LEFT_OF_CENTER (1 << 6)
\r
83 /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */
\r
84 #define AUDIO_CHANNEL_RIGHT_OF_CENTER (1 << 7)
\r
86 /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */
\r
87 #define AUDIO_CHANNEL_SURROUND (1 << 8)
\r
89 /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */
\r
90 #define AUDIO_CHANNEL_SIDE_LEFT (1 << 9)
\r
92 /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */
\r
93 #define AUDIO_CHANNEL_SIDE_RIGHT (1 << 10)
\r
95 /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */
\r
96 #define AUDIO_CHANNEL_TOP (1 << 11)
\r
99 /** @name Audio Feature Masks */
\r
101 /** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */
\r
102 #define AUDIO_FEATURE_MUTE (1 << 0)
\r
104 /** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */
\r
105 #define AUDIO_FEATURE_VOLUME (1 << 1)
\r
107 /** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */
\r
108 #define AUDIO_FEATURE_BASS (1 << 2)
\r
110 /** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */
\r
111 #define AUDIO_FEATURE_MID (1 << 3)
\r
113 /** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */
\r
114 #define AUDIO_FEATURE_TREBLE (1 << 4)
\r
116 /** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */
\r
117 #define AUDIO_FEATURE_GRAPHIC_EQUALIZER (1 << 5)
\r
119 /** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */
\r
120 #define AUDIO_FEATURE_AUTOMATIC_GAIN (1 << 6)
\r
122 /** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */
\r
123 #define AUDIO_FEATURE_DELAY (1 << 7)
\r
125 /** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */
\r
126 #define AUDIO_FEATURE_BASS_BOOST (1 << 8)
\r
128 /** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */
\r
129 #define AUDIO_FEATURE_BASS_LOUDNESS (1 << 9)
\r
132 /** @name Audio Terminal Types */
\r
134 /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
\r
135 #define AUDIO_TERMINAL_UNDEFINED 0x0100
\r
137 /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
\r
138 #define AUDIO_TERMINAL_STREAMING 0x0101
\r
140 /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
\r
141 #define AUDIO_TERMINAL_VENDOR 0x01FF
\r
143 /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
\r
144 #define AUDIO_TERMINAL_IN_UNDEFINED 0x0200
\r
146 /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
\r
147 #define AUDIO_TERMINAL_IN_MIC 0x0201
\r
149 /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
\r
150 #define AUDIO_TERMINAL_IN_DESKTOP_MIC 0x0202
\r
152 /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
\r
153 #define AUDIO_TERMINAL_IN_PERSONAL_MIC 0x0203
\r
155 /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
\r
156 #define AUDIO_TERMINAL_IN_OMNIDIR_MIC 0x0204
\r
158 /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
\r
159 #define AUDIO_TERMINAL_IN_MIC_ARRAY 0x0205
\r
161 /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
\r
162 #define AUDIO_TERMINAL_IN_PROCESSING_MIC 0x0206
\r
164 /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
\r
165 #define AUDIO_TERMINAL_IN_OUT_UNDEFINED 0x0300
\r
167 /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
\r
168 #define AUDIO_TERMINAL_OUT_SPEAKER 0x0301
\r
170 /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
\r
171 #define AUDIO_TERMINAL_OUT_HEADPHONES 0x0302
\r
173 /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
\r
174 #define AUDIO_TERMINAL_OUT_HEAD_MOUNTED 0x0303
\r
176 /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
\r
177 #define AUDIO_TERMINAL_OUT_DESKTOP 0x0304
\r
179 /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
\r
180 #define AUDIO_TERMINAL_OUT_ROOM 0x0305
\r
182 /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
\r
183 #define AUDIO_TERMINAL_OUT_COMMUNICATION 0x0306
\r
185 /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
\r
186 #define AUDIO_TERMINAL_OUT_LOWFREQ 0x0307
\r
189 /** Convenience macro to fill a 24-bit @ref USB_Audio_SampleFreq_t structure with the given sample rate as a 24-bit number.
\r
191 * @param freq Required audio sampling frequency in HZ
\r
193 #define AUDIO_SAMPLE_FREQ(freq) {.Byte1 = ((uint32_t)freq & 0xFF), .Byte2 = (((uint32_t)freq >> 8) & 0xFF), .Byte3 = (((uint32_t)freq >> 16) & 0xFF)}
\r
195 /** Mask for the attributes parameter of an Audio class-specific Endpoint descriptor, indicating that the endpoint
\r
196 * accepts only filled endpoint packets of audio samples.
\r
198 #define AUDIO_EP_FULL_PACKETS_ONLY (1 << 7)
\r
200 /** Mask for the attributes parameter of an Audio class-specific Endpoint descriptor, indicating that the endpoint
\r
201 * will accept partially filled endpoint packets of audio samples.
\r
203 #define AUDIO_EP_ACCEPTS_SMALL_PACKETS (0 << 7)
\r
205 /** Mask for the attributes parameter of an Audio class-specific Endpoint descriptor, indicating that the endpoint
\r
206 * allows for sampling frequency adjustments to be made via control requests directed at the endpoint.
\r
208 #define AUDIO_EP_SAMPLE_FREQ_CONTROL (1 << 0)
\r
210 /** Mask for the attributes parameter of an Audio class-specific Endpoint descriptor, indicating that the endpoint
\r
211 * allows for pitch adjustments to be made via control requests directed at the endpoint.
\r
213 #define AUDIO_EP_PITCH_CONTROL (1 << 1)
\r
216 /** Enum for possible Class, Subclass and Protocol values of device and interface descriptors relating to the Audio
\r
219 enum Audio_Descriptor_ClassSubclassProtocol_t
\r
221 AUDIO_CSCP_AudioClass = 0x01, /**< Descriptor Class value indicating that the device or
\r
222 * interface belongs to the USB Audio 1.0 class.
\r
224 AUDIO_CSCP_ControlSubclass = 0x01, /**< Descriptor Subclass value indicating that the device or
\r
225 * interface belongs to the Audio Control subclass.
\r
227 AUDIO_CSCP_ControlProtocol = 0x00, /**< Descriptor Protocol value indicating that the device or
\r
228 * interface belongs to the Audio Control protocol.
\r
230 AUDIO_CSCP_AudioStreamingSubclass = 0x02, /**< Descriptor Subclass value indicating that the device or
\r
231 * interface belongs to the MIDI Streaming subclass.
\r
233 AUDIO_CSCP_MIDIStreamingSubclass = 0x03, /**< Descriptor Subclass value indicating that the device or
\r
234 * interface belongs to the Audio streaming subclass.
\r
236 AUDIO_CSCP_StreamingProtocol = 0x00, /**< Descriptor Protocol value indicating that the device or
\r
237 * interface belongs to the Streaming Audio protocol.
\r
241 /** Audio class specific interface description subtypes, for the Audio Control interface. */
\r
242 enum Audio_CSInterface_AC_SubTypes_t
\r
244 AUDIO_DSUBTYPE_CSInterface_Header = 0x01, /**< Audio class specific control interface header. */
\r
245 AUDIO_DSUBTYPE_CSInterface_InputTerminal = 0x02, /**< Audio class specific control interface Input Terminal. */
\r
246 AUDIO_DSUBTYPE_CSInterface_OutputTerminal = 0x03, /**< Audio class specific control interface Output Terminal. */
\r
247 AUDIO_DSUBTYPE_CSInterface_Mixer = 0x04, /**< Audio class specific control interface Mixer Unit. */
\r
248 AUDIO_DSUBTYPE_CSInterface_Selector = 0x05, /**< Audio class specific control interface Selector Unit. */
\r
249 AUDIO_DSUBTYPE_CSInterface_Feature = 0x06, /**< Audio class specific control interface Feature Unit. */
\r
250 AUDIO_DSUBTYPE_CSInterface_Processing = 0x07, /**< Audio class specific control interface Processing Unit. */
\r
251 AUDIO_DSUBTYPE_CSInterface_Extension = 0x08, /**< Audio class specific control interface Extension Unit. */
\r
254 /** Audio class specific interface description subtypes, for the Audio Streaming interface. */
\r
255 enum Audio_CSInterface_AS_SubTypes_t
\r
257 AUDIO_DSUBTYPE_CSInterface_General = 0x01, /**< Audio class specific streaming interface general descriptor. */
\r
258 AUDIO_DSUBTYPE_CSInterface_FormatType = 0x02, /**< Audio class specific streaming interface format type descriptor. */
\r
259 AUDIO_DSUBTYPE_CSInterface_FormatSpecific = 0x03, /**< Audio class specific streaming interface format information descriptor. */
\r
262 /** Audio class specific endpoint description subtypes, for the Audio Streaming interface. */
\r
263 enum Audio_CSEndpoint_SubTypes_t
\r
265 AUDIO_DSUBTYPE_CSEndpoint_General = 0x01, /**< Audio class specific endpoint general descriptor. */
\r
268 /** Enum for the Audio class specific control requests that can be issued by the USB bus host. */
\r
269 enum Audio_ClassRequests_t
\r
271 AUDIO_REQ_SetCurrent = 0x01, /**< Audio class-specific request to set the current value of a parameter within the device. */
\r
272 AUDIO_REQ_SetMinimum = 0x02, /**< Audio class-specific request to set the minimum value of a parameter within the device. */
\r
273 AUDIO_REQ_SetMaximum = 0x03, /**< Audio class-specific request to set the maximum value of a parameter within the device. */
\r
274 AUDIO_REQ_SetResolution = 0x04, /**< Audio class-specific request to set the resolution value of a parameter within the device. */
\r
275 AUDIO_REQ_SetMemory = 0x05, /**< Audio class-specific request to set the memory value of a parameter within the device. */
\r
276 AUDIO_REQ_GetCurrent = 0x81, /**< Audio class-specific request to get the current value of a parameter within the device. */
\r
277 AUDIO_REQ_GetMinimum = 0x82, /**< Audio class-specific request to get the minimum value of a parameter within the device. */
\r
278 AUDIO_REQ_GetMaximum = 0x83, /**< Audio class-specific request to get the maximum value of a parameter within the device. */
\r
279 AUDIO_REQ_GetResolution = 0x84, /**< Audio class-specific request to get the resolution value of a parameter within the device. */
\r
280 AUDIO_REQ_GetMemory = 0x85, /**< Audio class-specific request to get the memory value of a parameter within the device. */
\r
281 AUDIO_REQ_GetStatus = 0xFF, /**< Audio class-specific request to get the device status. */
\r
284 /** Enum for Audio class specific Endpoint control modifiers which can be set and retrieved by a USB host, if the corresponding
\r
285 * endpoint control is indicated to be supported in the Endpoint's Audio-class specific endpoint descriptor.
\r
287 enum Audio_EndpointControls_t
\r
289 AUDIO_EPCONTROL_SamplingFreq = 0x01, /**< Sampling frequency adjustment of the endpoint. */
\r
290 AUDIO_EPCONTROL_Pitch = 0x02, /**< Pitch adjustment of the endpoint. */
\r
293 /* Type Defines: */
\r
294 /** @brief Audio class-specific Input Terminal Descriptor (nxpUSBlib naming conventions).
\r
296 * Type define for an Audio class-specific input terminal descriptor. This indicates to the host that the device
\r
297 * contains an input audio source, either from a physical terminal on the device, or a logical terminal (for example,
\r
298 * a USB endpoint). See the USB Audio specification for more details.
\r
300 * @see @ref USB_Audio_StdDescriptor_InputTerminal_t for the version of this type with standard element names.
\r
302 * @note Regardless of CPU architecture, these values should be stored as little endian.
\r
304 typedef ATTR_IAR_PACKED struct
\r
306 USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */
\r
307 uint8_t Subtype; /**< Sub type value used to distinguish between audio class-specific descriptors,
\r
308 * must be @ref AUDIO_DSUBTYPE_CSInterface_InputTerminal.
\r
311 uint8_t TerminalID; /**< ID value of this terminal unit - must be a unique value within the device. */
\r
312 uint16_t TerminalType; /**< Type of terminal, a \c TERMINAL_* mask. */
\r
313 uint8_t AssociatedOutputTerminal; /**< ID of associated output terminal, for physically grouped terminals
\r
314 * such as the speaker and microphone of a phone handset.
\r
316 uint8_t TotalChannels; /**< Total number of separate audio channels within this interface (right, left, etc.) */
\r
317 uint16_t ChannelConfig; /**< \c CHANNEL_* masks indicating what channel layout is supported by this terminal. */
\r
319 uint8_t ChannelStrIndex; /**< Index of a string descriptor describing this channel within the device. */
\r
320 uint8_t TerminalStrIndex; /**< Index of a string descriptor describing this descriptor within the device. */
\r
321 } ATTR_PACKED USB_Audio_Descriptor_InputTerminal_t;
\r
323 /** @brief Audio class-specific Input Terminal Descriptor (USB-IF naming conventions).
\r
325 * Type define for an Audio class-specific input terminal descriptor. This indicates to the host that the device
\r
326 * contains an input audio source, either from a physical terminal on the device, or a logical terminal (for example,
\r
327 * a USB endpoint). See the USB Audio specification for more details.
\r
329 * @see @ref USB_Audio_Descriptor_InputTerminal_t for the version of this type with non-standard nxpUSBlib specific
\r
332 * @note Regardless of CPU architecture, these values should be stored as little endian.
\r
334 typedef ATTR_IAR_PACKED struct
\r
336 uint8_t bLength; /**< Size of the descriptor, in bytes. */
\r
337 uint8_t bDescriptorType; /**< Type of the descriptor, either a value in @ref USB_DescriptorTypes_t or a value
\r
338 * given by the specific class.
\r
341 uint8_t bDescriptorSubtype; /**< Sub type value used to distinguish between audio class-specific descriptors,
\r
342 * must be @ref AUDIO_DSUBTYPE_CSInterface_InputTerminal.
\r
344 uint8_t bTerminalID; /**< ID value of this terminal unit - must be a unique value within the device. */
\r
345 uint16_t wTerminalType; /**< Type of terminal, a \c TERMINAL_* mask. */
\r
346 uint8_t bAssocTerminal; /**< ID of associated output terminal, for physically grouped terminals
\r
347 * such as the speaker and microphone of a phone handset.
\r
349 uint8_t bNrChannels; /**< Total number of separate audio channels within this interface (right, left, etc.) */
\r
350 uint16_t wChannelConfig; /**< \c CHANNEL_* masks indicating what channel layout is supported by this terminal. */
\r
352 uint8_t iChannelNames; /**< Index of a string descriptor describing this channel within the device. */
\r
353 uint8_t iTerminal; /**< Index of a string descriptor describing this descriptor within the device. */
\r
354 } ATTR_PACKED USB_Audio_StdDescriptor_InputTerminal_t;
\r
356 /** @brief Audio class-specific Output Terminal Descriptor (nxpUSBlib naming conventions).
\r
358 * Type define for an Audio class-specific output terminal descriptor. This indicates to the host that the device
\r
359 * contains an output audio sink, either to a physical terminal on the device, or a logical terminal (for example,
\r
360 * a USB endpoint). See the USB Audio specification for more details.
\r
362 * @see @ref USB_Audio_StdDescriptor_OutputTerminal_t for the version of this type with standard element names.
\r
364 * @note Regardless of CPU architecture, these values should be stored as little endian.
\r
366 typedef ATTR_IAR_PACKED struct
\r
368 USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */
\r
369 uint8_t Subtype; /**< Sub type value used to distinguish between audio class-specific descriptors,
\r
370 * must be @ref AUDIO_DSUBTYPE_CSInterface_OutputTerminal.
\r
373 uint8_t TerminalID; /**< ID value of this terminal unit - must be a unique value within the device. */
\r
374 uint16_t TerminalType; /**< Type of terminal, a \c TERMINAL_* mask. */
\r
375 uint8_t AssociatedInputTerminal; /**< ID of associated input terminal, for physically grouped terminals
\r
376 * such as the speaker and microphone of a phone handset.
\r
378 uint8_t SourceID; /**< ID value of the unit this terminal's audio is sourced from. */
\r
380 uint8_t TerminalStrIndex; /**< Index of a string descriptor describing this descriptor within the device. */
\r
381 } ATTR_PACKED USB_Audio_Descriptor_OutputTerminal_t;
\r
383 /** @brief Audio class-specific Output Terminal Descriptor (USB-IF naming conventions).
\r
385 * Type define for an Audio class-specific output terminal descriptor. This indicates to the host that the device
\r
386 * contains an output audio sink, either to a physical terminal on the device, or a logical terminal (for example,
\r
387 * a USB endpoint). See the USB Audio specification for more details.
\r
389 * @see @ref USB_Audio_Descriptor_OutputTerminal_t for the version of this type with non-standard nxpUSBlib specific
\r
392 * @note Regardless of CPU architecture, these values should be stored as little endian.
\r
394 typedef ATTR_IAR_PACKED struct
\r
396 uint8_t bLength; /**< Size of the descriptor, in bytes. */
\r
397 uint8_t bDescriptorType; /**< Sub type value used to distinguish between audio class-specific descriptors,
\r
398 * must be @ref AUDIO_DSUBTYPE_CSInterface_OutputTerminal.
\r
401 uint8_t bDescriptorSubtype; /**< Sub type value used to distinguish between audio class-specific descriptors,
\r
402 * a value from the @ref Audio_CSInterface_AC_SubTypes_t enum.
\r
404 uint8_t bTerminalID; /**< ID value of this terminal unit - must be a unique value within the device. */
\r
405 uint16_t wTerminalType; /**< Type of terminal, a \c TERMINAL_* mask. */
\r
406 uint8_t bAssocTerminal; /**< ID of associated input terminal, for physically grouped terminals
\r
407 * such as the speaker and microphone of a phone handset.
\r
409 uint8_t bSourceID; /**< ID value of the unit this terminal's audio is sourced from. */
\r
411 uint8_t iTerminal; /**< Index of a string descriptor describing this descriptor within the device. */
\r
412 } ATTR_PACKED USB_Audio_StdDescriptor_OutputTerminal_t;
\r
414 /** @brief Audio class-specific Interface Descriptor (nxpUSBlib naming conventions).
\r
416 * Type define for an Audio class-specific interface descriptor. This follows a regular interface descriptor to
\r
417 * supply extra information about the audio device's layout to the host. See the USB Audio specification for more
\r
420 * @see @ref USB_Audio_StdDescriptor_Interface_AC_t for the version of this type with standard element names.
\r
422 * @note Regardless of CPU architecture, these values should be stored as little endian.
\r
424 typedef ATTR_IAR_PACKED struct
\r
426 USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */
\r
427 uint8_t Subtype; /**< Sub type value used to distinguish between audio class-specific descriptors,
\r
428 * a value from the @ref Audio_CSInterface_AS_SubTypes_t enum.
\r
431 uint16_t ACSpecification; /**< Binary coded decimal value, indicating the supported Audio Class specification version. */
\r
432 uint16_t TotalLength; /**< Total length of the Audio class-specific descriptors, including this descriptor. */
\r
434 uint8_t InCollection; /**< Total number of Audio Streaming interfaces linked to this Audio Control interface (must be 1). */
\r
435 uint8_t InterfaceNumber; /**< Interface number of the associated Audio Streaming interface. */
\r
436 } ATTR_PACKED USB_Audio_Descriptor_Interface_AC_t;
\r
438 /** @brief Audio class-specific Interface Descriptor (USB-IF naming conventions).
\r
440 * Type define for an Audio class-specific interface descriptor. This follows a regular interface descriptor to
\r
441 * supply extra information about the audio device's layout to the host. See the USB Audio specification for more
\r
444 * @see @ref USB_Audio_Descriptor_Interface_AC_t for the version of this type with non-standard nxpUSBlib specific
\r
447 * @note Regardless of CPU architecture, these values should be stored as little endian.
\r
449 typedef ATTR_IAR_PACKED struct
\r
451 uint8_t bLength; /**< Size of the descriptor, in bytes. */
\r
452 uint8_t bDescriptorType; /**< Type of the descriptor, either a value in @ref USB_DescriptorTypes_t or a value
\r
453 * given by the specific class.
\r
456 uint8_t bDescriptorSubtype;/**< Sub type value used to distinguish between audio class-specific descriptors,
\r
457 * a value from the @ref Audio_CSInterface_AS_SubTypes_t enum.
\r
460 uint16_t bcdADC; /**< Binary coded decimal value, indicating the supported Audio Class specification version. */
\r
461 uint16_t wTotalLength; /**< Total length of the Audio class-specific descriptors, including this descriptor. */
\r
463 uint8_t bInCollection; /**< Total number of Audio Streaming interfaces linked to this Audio Control interface (must be 1). */
\r
464 uint8_t bInterfaceNumbers; /**< Interface number of the associated Audio Streaming interface. */
\r
465 } ATTR_PACKED USB_Audio_StdDescriptor_Interface_AC_t;
\r
467 /** @brief Audio class-specific Feature Unit Descriptor (nxpUSBlib naming conventions).
\r
469 * Type define for an Audio class-specific Feature Unit descriptor. This indicates to the host what features
\r
470 * are present in the device's audio stream for basic control, such as per-channel volume. See the USB Audio
\r
471 * specification for more details.
\r
473 * @see @ref USB_Audio_StdDescriptor_FeatureUnit_t for the version of this type with standard element names.
\r
475 * @note Regardless of CPU architecture, these values should be stored as little endian.
\r
477 typedef ATTR_IAR_PACKED struct
\r
479 USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */
\r
480 uint8_t Subtype; /**< Sub type value used to distinguish between audio class-specific descriptors,
\r
481 * must be @ref AUDIO_DSUBTYPE_CSInterface_Feature.
\r
484 uint8_t UnitID; /**< ID value of this feature unit - must be a unique value within the device. */
\r
485 uint8_t SourceID; /**< Source ID value of the audio source input into this feature unit. */
\r
487 uint8_t ControlSize; /**< Size of each element in the \c ChannelControls array. */
\r
488 uint8_t ChannelControls[3]; /**< Feature masks for the control channel, and each separate audio channel. */
\r
490 uint8_t FeatureUnitStrIndex; /**< Index of a string descriptor describing this descriptor within the device. */
\r
491 } ATTR_PACKED USB_Audio_Descriptor_FeatureUnit_t;
\r
493 /** @brief Audio class-specific Feature Unit Descriptor (USB-IF naming conventions).
\r
495 * Type define for an Audio class-specific Feature Unit descriptor. This indicates to the host what features
\r
496 * are present in the device's audio stream for basic control, such as per-channel volume. See the USB Audio
\r
497 * specification for more details.
\r
499 * @see @ref USB_Audio_Descriptor_FeatureUnit_t for the version of this type with non-standard nxpUSBlib specific
\r
502 * @note Regardless of CPU architecture, these values should be stored as little endian.
\r
504 typedef ATTR_IAR_PACKED struct
\r
506 uint8_t bLength; /**< Size of the descriptor, in bytes. */
\r
507 uint8_t bDescriptorType; /**< Type of the descriptor, either a value in @ref USB_DescriptorTypes_t or a value
\r
508 * given by the specific class.
\r
511 uint8_t bDescriptorSubtype; /**< Sub type value used to distinguish between audio class-specific descriptors,
\r
512 * must be @ref AUDIO_DSUBTYPE_CSInterface_Feature.
\r
515 uint8_t bUnitID; /**< ID value of this feature unit - must be a unique value within the device. */
\r
516 uint8_t bSourceID; /**< Source ID value of the audio source input into this feature unit. */
\r
518 uint8_t bControlSize; /**< Size of each element in the \c ChannelControls array. */
\r
519 uint8_t bmaControls[3]; /**< Feature masks for the control channel, and each separate audio channel. */
\r
521 uint8_t iFeature; /**< Index of a string descriptor describing this descriptor within the device. */
\r
522 } ATTR_PACKED USB_Audio_StdDescriptor_FeatureUnit_t;
\r
524 /** @brief Audio class-specific Streaming Audio Interface Descriptor (nxpUSBlib naming conventions).
\r
526 * Type define for an Audio class-specific streaming interface descriptor. This indicates to the host
\r
527 * how audio streams within the device are formatted. See the USB Audio specification for more details.
\r
529 * @see @ref USB_Audio_StdDescriptor_Interface_AS_t for the version of this type with standard element names.
\r
531 * @note Regardless of CPU architecture, these values should be stored as little endian.
\r
533 typedef ATTR_IAR_PACKED struct
\r
535 USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */
\r
536 uint8_t Subtype; /**< Sub type value used to distinguish between audio class-specific descriptors,
\r
537 * a value from the @ref Audio_CSInterface_AS_SubTypes_t enum.
\r
540 uint8_t TerminalLink; /**< ID value of the output terminal this descriptor is describing. */
\r
542 uint8_t FrameDelay; /**< Delay in frames resulting from the complete sample processing from input to output. */
\r
543 uint16_t AudioFormat; /**< Format of the audio stream, see Audio Device Formats specification. */
\r
544 } ATTR_PACKED USB_Audio_Descriptor_Interface_AS_t;
\r
546 /** @brief Audio class-specific Streaming Audio Interface Descriptor (USB-IF naming conventions).
\r
548 * Type define for an Audio class-specific streaming interface descriptor. This indicates to the host
\r
549 * how audio streams within the device are formatted. See the USB Audio specification for more details.
\r
551 * @see @ref USB_Audio_Descriptor_Interface_AS_t for the version of this type with non-standard nxpUSBlib specific
\r
554 * @note Regardless of CPU architecture, these values should be stored as little endian.
\r
556 typedef ATTR_IAR_PACKED struct
\r
558 uint8_t bLength; /**< Size of the descriptor, in bytes. */
\r
559 uint8_t bDescriptorType; /**< Type of the descriptor, either a value in @ref USB_DescriptorTypes_t or a value
\r
560 * given by the specific class.
\r
563 uint8_t bDescriptorSubtype; /**< Sub type value used to distinguish between audio class-specific descriptors,
\r
564 * a value from the @ref Audio_CSInterface_AS_SubTypes_t enum.
\r
567 uint8_t bTerminalLink; /**< ID value of the output terminal this descriptor is describing. */
\r
569 uint8_t bDelay; /**< Delay in frames resulting from the complete sample processing from input to output. */
\r
570 uint16_t wFormatTag; /**< Format of the audio stream, see Audio Device Formats specification. */
\r
571 } ATTR_PACKED USB_Audio_StdDescriptor_Interface_AS_t;
\r
573 /** @brief Audio class-specific Format Descriptor (nxpUSBlib naming conventions).
\r
575 * Type define for an Audio class-specific audio format descriptor. This is used to give the host full details
\r
576 * about the number of channels, the sample resolution, acceptable sample frequencies and encoding method used
\r
577 * in the device's audio streams. See the USB Audio specification for more details.
\r
579 * @note This descriptor <b>must</b> be followed by one or more @ref USB_Audio_SampleFreq_t elements containing
\r
580 * the continuous or discrete sample frequencies.
\r
582 * @see @ref USB_Audio_StdDescriptor_Format_t for the version of this type with standard element names.
\r
584 * @note Regardless of CPU architecture, these values should be stored as little endian.
\r
586 typedef ATTR_IAR_PACKED struct
\r
588 USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */
\r
589 uint8_t Subtype; /**< Sub type value used to distinguish between audio class-specific descriptors,
\r
590 * must be @ref AUDIO_DSUBTYPE_CSInterface_FormatType.
\r
593 uint8_t FormatType; /**< Format of the audio stream, see Audio Device Formats specification. */
\r
594 uint8_t Channels; /**< Total number of discrete channels in the stream. */
\r
596 uint8_t SubFrameSize; /**< Size in bytes of each channel's sample data in the stream. */
\r
597 uint8_t BitResolution; /**< Bits of resolution of each channel's samples in the stream. */
\r
599 uint8_t TotalDiscreteSampleRates; /**< Total number of discrete sample frequencies supported by the device. When
\r
600 * zero, this must be followed by the lower and upper continuous sampling
\r
601 * frequencies supported by the device; otherwise, this must be followed
\r
602 * by the given number of discrete sampling frequencies supported.
\r
604 } ATTR_PACKED USB_Audio_Descriptor_Format_t;
\r
606 /** @brief 24-Bit Audio Frequency Structure.
\r
608 * Type define for a 24bit audio sample frequency structure. As GCC does not contain a built in 24-bit datatype,
\r
609 * this this structure is used to build up the value instead. Fill this structure with the @ref AUDIO_SAMPLE_FREQ() macro.
\r
611 * @note Regardless of CPU architecture, these values should be stored as little endian.
\r
613 typedef ATTR_IAR_PACKED struct
\r
615 uint8_t Byte1; /**< Lowest 8 bits of the 24-bit value. */
\r
616 uint8_t Byte2; /**< Middle 8 bits of the 24-bit value. */
\r
617 uint8_t Byte3; /**< Upper 8 bits of the 24-bit value. */
\r
618 } ATTR_PACKED USB_Audio_SampleFreq_t;
\r
620 /** @brief Audio class-specific Format Descriptor (USB-IF naming conventions).
\r
622 * Type define for an Audio class-specific audio format descriptor. This is used to give the host full details
\r
623 * about the number of channels, the sample resolution, acceptable sample frequencies and encoding method used
\r
624 * in the device's audio streams. See the USB Audio specification for more details.
\r
626 * @note This descriptor <b>must</b> be followed by one or more 24-bit integer elements containing the continuous
\r
627 * or discrete sample frequencies.
\r
629 * @see @ref USB_Audio_Descriptor_Format_t for the version of this type with non-standard nxpUSBlib specific
\r
632 * @note Regardless of CPU architecture, these values should be stored as little endian.
\r
634 typedef ATTR_IAR_PACKED struct
\r
636 uint8_t bLength; /**< Size of the descriptor, in bytes. */
\r
637 uint8_t bDescriptorType; /**< Sub type value used to distinguish between audio class-specific descriptors,
\r
638 * must be @ref AUDIO_DSUBTYPE_CSInterface_FormatType.
\r
641 uint8_t bDescriptorSubtype;/**< Sub type value used to distinguish between audio class-specific descriptors,
\r
642 * a value from the @ref Audio_CSInterface_AS_SubTypes_t enum.
\r
645 uint8_t bFormatType; /**< Format of the audio stream, see Audio Device Formats specification. */
\r
646 uint8_t bNrChannels; /**< Total number of discrete channels in the stream. */
\r
648 uint8_t bSubFrameSize; /**< Size in bytes of each channel's sample data in the stream. */
\r
649 uint8_t bBitResolution; /**< Bits of resolution of each channel's samples in the stream. */
\r
651 uint8_t bSampleFrequencyType; /**< Total number of sample frequencies supported by the device. When
\r
652 * zero, this must be followed by the lower and upper continuous sampling
\r
653 * frequencies supported by the device; otherwise, this must be followed
\r
654 * by the given number of discrete sampling frequencies supported.
\r
656 } ATTR_PACKED USB_Audio_StdDescriptor_Format_t;
\r
658 /** @brief Audio class-specific Streaming Endpoint Descriptor (nxpUSBlib naming conventions).
\r
660 * Type define for an Audio class-specific endpoint descriptor. This contains a regular endpoint
\r
661 * descriptor with a few Audio-class-specific extensions. See the USB Audio specification for more details.
\r
663 * @see @ref USB_Audio_StdDescriptor_StreamEndpoint_Std_t for the version of this type with standard element names.
\r
665 * @note Regardless of CPU architecture, these values should be stored as little endian.
\r
667 typedef ATTR_IAR_PACKED struct
\r
669 USB_Descriptor_Endpoint_t Endpoint; /**< Standard endpoint descriptor describing the audio endpoint. */
\r
671 uint8_t Refresh; /**< Always set to zero for Audio class devices. */
\r
672 uint8_t SyncEndpointNumber; /**< Endpoint address to send synchronization information to, if needed (zero otherwise). */
\r
673 } ATTR_PACKED USB_Audio_Descriptor_StreamEndpoint_Std_t;
\r
675 /** @brief Audio class-specific Streaming Endpoint Descriptor (USB-IF naming conventions).
\r
677 * Type define for an Audio class-specific endpoint descriptor. This contains a regular endpoint
\r
678 * descriptor with a few Audio-class-specific extensions. See the USB Audio specification for more details.
\r
680 * @see @ref USB_Audio_Descriptor_StreamEndpoint_Std_t for the version of this type with non-standard nxpUSBlib specific
\r
683 * @note Regardless of CPU architecture, these values should be stored as little endian.
\r
685 typedef ATTR_IAR_PACKED struct
\r
687 uint8_t bLength; /**< Size of the descriptor, in bytes. */
\r
688 uint8_t bDescriptorType; /**< Type of the descriptor, either a value in @ref USB_DescriptorTypes_t or a
\r
689 * value given by the specific class.
\r
691 uint8_t bEndpointAddress; /**< Logical address of the endpoint within the device for the current
\r
692 * configuration, including direction mask.
\r
694 uint8_t bmAttributes; /**< Endpoint attributes, comprised of a mask of the endpoint type (\c EP_TYPE_*)
\r
695 * and attributes (\c ENDPOINT_ATTR_*) masks.
\r
697 uint16_t wMaxPacketSize; /**< Size of the endpoint bank, in bytes. This indicates the maximum packet size
\r
698 * that the endpoint can receive at a time.
\r
700 uint8_t bInterval; /**< Polling interval in milliseconds for the endpoint if it is an INTERRUPT or
\r
701 * ISOCHRONOUS type.
\r
704 uint8_t bRefresh; /**< Always set to zero for Audio class devices. */
\r
705 uint8_t bSynchAddress; /**< Endpoint address to send synchronization information to, if needed (zero otherwise). */
\r
706 } ATTR_PACKED USB_Audio_StdDescriptor_StreamEndpoint_Std_t;
\r
708 /** @brief Audio class-specific Extended Endpoint Descriptor (nxpUSBlib naming conventions).
\r
710 * Type define for an Audio class-specific extended endpoint descriptor. This contains extra information
\r
711 * on the usage of endpoints used to stream audio in and out of the USB Audio device, and follows an Audio
\r
712 * class-specific extended endpoint descriptor. See the USB Audio specification for more details.
\r
714 * @see @ref USB_Audio_StdDescriptor_StreamEndpoint_Spc_t for the version of this type with standard element names.
\r
716 * @note Regardless of CPU architecture, these values should be stored as little endian.
\r
718 typedef ATTR_IAR_PACKED struct
\r
720 USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */
\r
721 uint8_t Subtype; /**< Sub type value used to distinguish between audio class-specific descriptors,
\r
722 * a value from the @ref Audio_CSEndpoint_SubTypes_t enum.
\r
725 uint8_t Attributes; /**< Audio class-specific endpoint attributes, such as @ref AUDIO_EP_FULL_PACKETS_ONLY. */
\r
727 uint8_t LockDelayUnits; /**< Units used for the LockDelay field, see Audio class specification. */
\r
728 uint16_t LockDelay; /**< Time required to internally lock endpoint's internal clock recovery circuitry. */
\r
729 } ATTR_PACKED USB_Audio_Descriptor_StreamEndpoint_Spc_t;
\r
731 /** @brief Audio class-specific Extended Endpoint Descriptor (USB-IF naming conventions).
\r
733 * Type define for an Audio class-specific extended endpoint descriptor. This contains extra information
\r
734 * on the usage of endpoints used to stream audio in and out of the USB Audio device, and follows an Audio
\r
735 * class-specific extended endpoint descriptor. See the USB Audio specification for more details.
\r
737 * @see @ref USB_Audio_Descriptor_StreamEndpoint_Spc_t for the version of this type with non-standard nxpUSBlib specific
\r
740 * @note Regardless of CPU architecture, these values should be stored as little endian.
\r
742 typedef ATTR_IAR_PACKED struct
\r
744 uint8_t bLength; /**< Size of the descriptor, in bytes. */
\r
745 uint8_t bDescriptorType; /**< Type of the descriptor, either a value in @ref USB_DescriptorTypes_t or a value
\r
746 * given by the specific class.
\r
749 uint8_t bDescriptorSubtype; /**< Sub type value used to distinguish between audio class-specific descriptors,
\r
750 * a value from the @ref Audio_CSEndpoint_SubTypes_t enum.
\r
753 uint8_t bmAttributes; /**< Audio class-specific endpoint attributes, such as @ref AUDIO_EP_FULL_PACKETS_ONLY. */
\r
755 uint8_t bLockDelayUnits; /**< Units used for the LockDelay field, see Audio class specification. */
\r
756 uint16_t wLockDelay; /**< Time required to internally lock endpoint's internal clock recovery circuitry. */
\r
757 } ATTR_PACKED USB_Audio_StdDescriptor_StreamEndpoint_Spc_t;
\r
759 /* Disable C linkage for C++ Compilers: */
\r
760 #if defined(__cplusplus)
\r