diff options
Diffstat (limited to 'LUFA/Drivers/USB/Class/Common/Audio.h')
-rw-r--r-- | LUFA/Drivers/USB/Class/Common/Audio.h | 131 |
1 files changed, 66 insertions, 65 deletions
diff --git a/LUFA/Drivers/USB/Class/Common/Audio.h b/LUFA/Drivers/USB/Class/Common/Audio.h index 0b023b019..5e65865a0 100644 --- a/LUFA/Drivers/USB/Class/Common/Audio.h +++ b/LUFA/Drivers/USB/Class/Common/Audio.h @@ -1,7 +1,7 @@ /* LUFA Library Copyright (C) Dean Camera, 2010. - + dean [at] fourwalledcubicle [dot] com www.fourwalledcubicle.com */ @@ -9,13 +9,13 @@ /* Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com) - Permission to use, copy, modify, distribute, and sell this + Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in + without fee, provided that the above copyright notice appear in all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the software without specific, written prior permission. The author disclaim all warranties with regard to this @@ -52,7 +52,7 @@ /* Includes: */ #include "../../USB.h" - + #include <string.h> /* Enable C linkage for C++ Compilers: */ @@ -72,7 +72,7 @@ */ #define AUDIO_TOTAL_SAMPLE_RATES 1 #endif - + /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */ #define AUDIO_CHANNEL_LEFT_FRONT (1 << 0) @@ -139,58 +139,58 @@ /** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */ #define AUDIO_FEATURE_BASS_LOUDNESS (1 << 9) - /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ + /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ #define AUDIO_TERMINAL_UNDEFINED 0x0100 - /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ + /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ #define AUDIO_TERMINAL_STREAMING 0x0101 - /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ + /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ #define AUDIO_TERMINAL_VENDOR 0x01FF - /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ + /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ #define AUDIO_TERMINAL_IN_UNDEFINED 0x0200 - /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ + /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ #define AUDIO_TERMINAL_IN_MIC 0x0201 - /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ + /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ #define AUDIO_TERMINAL_IN_DESKTOP_MIC 0x0202 - /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ + /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ #define AUDIO_TERMINAL_IN_PERSONAL_MIC 0x0203 - /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ + /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ #define AUDIO_TERMINAL_IN_OMNIDIR_MIC 0x0204 - /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ + /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ #define AUDIO_TERMINAL_IN_MIC_ARRAY 0x0205 - /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ + /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ #define AUDIO_TERMINAL_IN_PROCESSING_MIC 0x0206 - /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ + /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ #define AUDIO_TERMINAL_IN_OUT_UNDEFINED 0x0300 - /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ + /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ #define AUDIO_TERMINAL_OUT_SPEAKER 0x0301 - /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ + /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ #define AUDIO_TERMINAL_OUT_HEADPHONES 0x0302 - /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ + /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ #define AUDIO_TERMINAL_OUT_HEAD_MOUNTED 0x0303 - /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ + /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ #define AUDIO_TERMINAL_OUT_DESKTOP 0x0304 - /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ + /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ #define AUDIO_TERMINAL_OUT_ROOM 0x0305 - /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ + /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ #define AUDIO_TERMINAL_OUT_COMMUNICATION 0x0306 - /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ + /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ #define AUDIO_TERMINAL_OUT_LOWFREQ 0x0307 /** Convenience macro to fill a 24-bit \ref USB_Audio_SampleFreq_t structure with the given sample rate as a 24-bit number. @@ -198,7 +198,7 @@ * \param[in] freq Required audio sampling frequency in HZ */ #define AUDIO_SAMPLE_FREQ(freq) {((uint32_t)freq & 0x00FFFF), (((uint32_t)freq >> 16) & 0x0000FF)} - + /** Mask for the attributes parameter of an Audio class-specific Endpoint descriptor, indicating that the endpoint * accepts only filled endpoint packets of audio samples. */ @@ -208,7 +208,7 @@ * will accept partially filled endpoint packets of audio samples. */ #define AUDIO_EP_ACCEPTS_SMALL_PACKETS (0 << 7) - + /* Enums: */ /** Audio class specific interface description subtypes, for the Audio Control interface. */ enum Audio_CSInterface_AC_SubTypes_t @@ -236,7 +236,7 @@ { AUDIO_DSUBTYPE_CSEndpoint_General = 0x01, /**< Audio class specific endpoint general descriptor. */ }; - + /* Type Defines: */ /** \brief Audio class-specific Input Terminal Descriptor (LUFA naming conventions). * @@ -252,7 +252,7 @@ uint8_t Subtype; /**< Sub type value used to distinguish between audio class-specific descriptors, * must be \ref AUDIO_DSUBTYPE_CSInterface_InputTerminal. */ - + uint8_t TerminalID; /**< ID value of this terminal unit - must be a unique value within the device. */ uint16_t TerminalType; /**< Type of terminal, a TERMINAL_* mask. */ uint8_t AssociatedOutputTerminal; /**< ID of associated output terminal, for physically grouped terminals @@ -260,7 +260,7 @@ */ uint8_t TotalChannels; /**< Total number of separate audio channels within this interface (right, left, etc.) */ uint16_t ChannelConfig; /**< CHANNEL_* masks indicating what channel layout is supported by this terminal. */ - + uint8_t ChannelStrIndex; /**< Index of a string descriptor describing this channel within the device. */ uint8_t TerminalStrIndex; /**< Index of a string descriptor describing this descriptor within the device. */ } USB_Audio_Descriptor_InputTerminal_t; @@ -291,7 +291,7 @@ */ uint8_t bNrChannels; /**< Total number of separate audio channels within this interface (right, left, etc.) */ uint16_t wChannelConfig; /**< CHANNEL_* masks indicating what channel layout is supported by this terminal. */ - + uint8_t iChannelNames; /**< Index of a string descriptor describing this channel within the device. */ uint8_t iTerminal; /**< Index of a string descriptor describing this descriptor within the device. */ } USB_Audio_StdDescriptor_InputTerminal_t; @@ -310,14 +310,14 @@ uint8_t Subtype; /**< Sub type value used to distinguish between audio class-specific descriptors, * must be \ref AUDIO_DSUBTYPE_CSInterface_OutputTerminal. */ - + uint8_t TerminalID; /**< ID value of this terminal unit - must be a unique value within the device. */ uint16_t TerminalType; /**< Type of terminal, a TERMINAL_* mask. */ uint8_t AssociatedInputTerminal; /**< ID of associated input terminal, for physically grouped terminals * such as the speaker and microphone of a phone handset. */ uint8_t SourceID; /**< ID value of the unit this terminal's audio is sourced from. */ - + uint8_t TerminalStrIndex; /**< Index of a string descriptor describing this descriptor within the device. */ } USB_Audio_Descriptor_OutputTerminal_t; @@ -346,7 +346,7 @@ * such as the speaker and microphone of a phone handset. */ uint8_t bSourceID; /**< ID value of the unit this terminal's audio is sourced from. */ - + uint8_t iTerminal; /**< Index of a string descriptor describing this descriptor within the device. */ } USB_Audio_StdDescriptor_OutputTerminal_t; @@ -367,7 +367,7 @@ uint16_t ACSpecification; /**< Binary coded decimal value, indicating the supported Audio Class specification version. */ uint16_t TotalLength; /**< Total length of the Audio class-specific descriptors, including this descriptor. */ - + uint8_t InCollection; /**< Total number of Audio Streaming interfaces linked to this Audio Control interface (must be 1). */ uint8_t InterfaceNumber; /**< Interface number of the associated Audio Streaming interface. */ } USB_Audio_Descriptor_Interface_AC_t; @@ -394,11 +394,11 @@ uint16_t bcdADC; /**< Binary coded decimal value, indicating the supported Audio Class specification version. */ uint16_t wTotalLength; /**< Total length of the Audio class-specific descriptors, including this descriptor. */ - + uint8_t bInCollection; /**< Total number of Audio Streaming interfaces linked to this Audio Control interface (must be 1). */ uint8_t bInterfaceNumbers; /**< Interface number of the associated Audio Streaming interface. */ } USB_Audio_StdDescriptor_Interface_AC_t; - + /** \brief Audio class-specific Feature Unit Descriptor (LUFA naming conventions). * * Type define for an Audio class-specific Feature Unit descriptor. This indicates to the host what features @@ -413,13 +413,13 @@ uint8_t Subtype; /**< Sub type value used to distinguish between audio class-specific descriptors, * must be \ref AUDIO_DSUBTYPE_CSInterface_Feature. */ - + uint8_t UnitID; /**< ID value of this feature unit - must be a unique value within the device. */ uint8_t SourceID; /**< Source ID value of the audio source input into this feature unit. */ - + uint8_t ControlSize; /**< Size of each element in the ChanelControlls array. */ uint8_t ChannelControls[3]; /**< Feature masks for the control channel, and each separate audio channel. */ - + uint8_t FeatureUnitStrIndex; /**< Index of a string descriptor describing this descriptor within the device. */ } USB_Audio_Descriptor_FeatureUnit_t; @@ -442,16 +442,16 @@ uint8_t bDescriptorSubtype; /**< Sub type value used to distinguish between audio class-specific descriptors, * must be \ref AUDIO_DSUBTYPE_CSInterface_Feature. */ - + uint8_t bUnitID; /**< ID value of this feature unit - must be a unique value within the device. */ uint8_t bSourceID; /**< Source ID value of the audio source input into this feature unit. */ - + uint8_t bControlSize; /**< Size of each element in the ChanelControlls array. */ uint8_t bmaControls[3]; /**< Feature masks for the control channel, and each separate audio channel. */ - + uint8_t iFeature; /**< Index of a string descriptor describing this descriptor within the device. */ } USB_Audio_StdDescriptor_FeatureUnit_t; - + /** \brief Audio class-specific Streaming Audio Interface Descriptor (LUFA naming conventions). * * Type define for an Audio class-specific streaming interface descriptor. This indicates to the host @@ -465,9 +465,9 @@ uint8_t Subtype; /**< Sub type value used to distinguish between audio class-specific descriptors, * a value from the \ref Audio_CSInterface_AS_SubTypes_t enum. */ - + uint8_t TerminalLink; /**< ID value of the output terminal this descriptor is describing. */ - + uint8_t FrameDelay; /**< Delay in frames resulting from the complete sample processing from input to output. */ uint16_t AudioFormat; /**< Format of the audio stream, see Audio Device Formats specification. */ } USB_Audio_Descriptor_Interface_AS_t; @@ -490,13 +490,13 @@ uint8_t bDescriptorSubtype; /**< Sub type value used to distinguish between audio class-specific descriptors, * a value from the \ref Audio_CSInterface_AS_SubTypes_t enum. */ - + uint8_t bTerminalLink; /**< ID value of the output terminal this descriptor is describing. */ - + uint8_t bDelay; /**< Delay in frames resulting from the complete sample processing from input to output. */ uint16_t wFormatTag; /**< Format of the audio stream, see Audio Device Formats specification. */ } USB_Audio_StdDescriptor_Interface_AS_t; - + /** \brief 24-Bit Audio Frequency Structure. * * Type define for a 24bit audio sample frequency structure. GCC does not contain a built in 24bit datatype, @@ -522,14 +522,14 @@ uint8_t Subtype; /**< Sub type value used to distinguish between audio class-specific descriptors, * must be \ref AUDIO_DSUBTYPE_CSInterface_FormatType. */ - + uint8_t FormatType; /**< Format of the audio stream, see Audio Device Formats specification. */ uint8_t Channels; /**< Total number of discrete channels in the stream. */ - + uint8_t SubFrameSize; /**< Size in bytes of each channel's sample data in the stream. */ uint8_t BitResolution; /**< Bits of resolution of each channel's samples in the stream. */ - uint8_t SampleFrequencyType; /**< Total number of sample frequencies supported by the device. */ + uint8_t SampleFrequencyType; /**< Total number of sample frequencies supported by the device. */ USB_Audio_SampleFreq_t SampleFrequencies[AUDIO_TOTAL_SAMPLE_RATES]; /**< Sample frequencies supported by the device (must be 24-bit). */ } USB_Audio_Descriptor_Format_t; @@ -555,17 +555,17 @@ uint8_t bFormatType; /**< Format of the audio stream, see Audio Device Formats specification. */ uint8_t bNrChannels; /**< Total number of discrete channels in the stream. */ - + uint8_t bSubFrameSize; /**< Size in bytes of each channel's sample data in the stream. */ uint8_t bBitResolution; /**< Bits of resolution of each channel's samples in the stream. */ - uint8_t bSampleFrequencyType; /**< Total number of sample frequencies supported by the device. */ + uint8_t bSampleFrequencyType; /**< Total number of sample frequencies supported by the device. */ uint8_t SampleFrequencies[AUDIO_TOTAL_SAMPLE_RATES * 3]; /**< Sample frequencies supported by the device (must be 24-bit). */ } USB_Audio_StdDescriptor_Format_t; - + /** \brief Audio class-specific Streaming Endpoint Descriptor (LUFA naming conventions). * - * Type define for an Audio class-specific endpoint descriptor. This contains a regular endpoint + * Type define for an Audio class-specific endpoint descriptor. This contains a regular endpoint * descriptor with a few Audio-class-specific extensions. See the USB Audio specification for more details. * * \see \ref USB_Audio_StdDescriptor_StreamEndpoint_Std_t for the version of this type with standard element names. @@ -580,7 +580,7 @@ /** \brief Audio class-specific Streaming Endpoint Descriptor (USB-IF naming conventions). * - * Type define for an Audio class-specific endpoint descriptor. This contains a regular endpoint + * Type define for an Audio class-specific endpoint descriptor. This contains a regular endpoint * descriptor with a few Audio-class-specific extensions. See the USB Audio specification for more details. * * \see \ref USB_Audio_Descriptor_StreamEndpoint_Std_t for the version of this type with non-standard LUFA specific @@ -592,10 +592,10 @@ uint8_t bDescriptorType; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a * value given by the specific class. */ - uint8_t bEndpointAddress; /**< Logical address of the endpoint within the device for the current + uint8_t bEndpointAddress; /**< Logical address of the endpoint within the device for the current * configuration, including direction mask. */ - uint8_t bmAttributes; /**< Endpoint attributes, comprised of a mask of the endpoint type (EP_TYPE_*) + uint8_t bmAttributes; /**< Endpoint attributes, comprised of a mask of the endpoint type (EP_TYPE_*) * and attributes (ENDPOINT_ATTR_*) masks. */ uint16_t wMaxPacketSize; /**< Size of the endpoint bank, in bytes. This indicates the maximum packet size @@ -604,7 +604,7 @@ uint8_t bInterval; /**< Polling interval in milliseconds for the endpoint if it is an INTERRUPT or * ISOCHRONOUS type. */ - + uint8_t bRefresh; /**< Always set to zero for Audio class devices. */ uint8_t bSynchAddress; /**< Endpoint address to send synchronization information to, if needed (zero otherwise). */ } USB_Audio_StdDescriptor_StreamEndpoint_Std_t; @@ -623,7 +623,7 @@ uint8_t Subtype; /**< Sub type value used to distinguish between audio class-specific descriptors, * a value from the \ref Audio_CSEndpoint_SubTypes_t enum. */ - + uint8_t Attributes; /**< Audio class-specific endpoint attributes, such as ACCEPTS_SMALL_PACKETS. */ uint8_t LockDelayUnits; /**< Units used for the LockDelay field, see Audio class specification. */ @@ -649,18 +649,19 @@ uint8_t bDescriptorSubtype; /**< Sub type value used to distinguish between audio class-specific descriptors, * a value from the \ref Audio_CSEndpoint_SubTypes_t enum. */ - + uint8_t bmAttributes; /**< Audio class-specific endpoint attributes, such as ACCEPTS_SMALL_PACKETS. */ uint8_t bLockDelayUnits; /**< Units used for the LockDelay field, see Audio class specification. */ uint16_t wLockDelay; /**< Time required to internally lock endpoint's internal clock recovery circuitry. */ } USB_Audio_StdDescriptor_StreamEndpoint_Spc_t; - + /* Disable C linkage for C++ Compilers: */ #if defined(__cplusplus) } #endif - + #endif /** @} */ + |