diff options
Diffstat (limited to 'LUFA/Drivers/USB')
21 files changed, 596 insertions, 433 deletions
diff --git a/LUFA/Drivers/USB/Class/Common/Audio.h b/LUFA/Drivers/USB/Class/Common/Audio.h index 8ee5fa2cb..f4b784908 100644 --- a/LUFA/Drivers/USB/Class/Common/Audio.h +++ b/LUFA/Drivers/USB/Class/Common/Audio.h @@ -73,30 +73,6 @@ #define AUDIO_TOTAL_SAMPLE_RATES 1 #endif - /** Descriptor header constant to indicate a Audio class interface descriptor. */ - #define DTYPE_AudioInterface 0x24 - - /** Descriptor header constant to indicate a Audio class endpoint descriptor. */ - #define DTYPE_AudioEndpoint 0x25 - - /** Audio class descriptor subtype value for a Audio class-specific header descriptor. */ - #define DSUBTYPE_Header 0x01 - - /** Audio class descriptor subtype value for an Output Terminal Audio class-specific descriptor. */ - #define DSUBTYPE_InputTerminal 0x02 - - /** Audio class descriptor subtype value for an Input Terminal Audio class-specific descriptor. */ - #define DSUBTYPE_OutputTerminal 0x03 - - /** Audio class descriptor subtype value for a Feature Unit Audio class-specific descriptor. */ - #define DSUBTYPE_FeatureUnit 0x06 - - /** Audio class descriptor subtype value for a general Audio class-specific descriptor. */ - #define DSUBTYPE_General 0x01 - - /** Audio class descriptor subtype value for an Audio class-specific descriptor indicating the format of an audio stream. */ - #define DSUBTYPE_Format 0x02 - /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */ #define CHANNEL_LEFT_FRONT (1 << 0) @@ -152,8 +128,6 @@ #define FEATURE_GRAPHIC_EQUALIZER (1 << 5) /** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */ - - /** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */ #define FEATURE_AUTOMATIC_GAIN (1 << 6) /** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */ @@ -223,7 +197,7 @@ * * \param[in] freq Required audio sampling frequency in HZ */ - #define AUDIO_SAMPLE_FREQ(freq) {LowWord: ((uint32_t)freq & 0x00FFFF), HighByte: (((uint32_t)freq >> 16) & 0x0000FF)} + #define AUDIO_SAMPLE_FREQ(freq) {LowWord: ((uint32_t)freq & 0x00FFFF), HighByte: (((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. @@ -234,102 +208,36 @@ * will accept partially filled endpoint packets of audio samples. */ #define EP_ACCEPTS_SMALL_PACKETS (0 << 7) - - /* Type Defines: */ - /** \brief Audio class-specific Interface Descriptor (LUFA naming conventions). - * - * Type define for an Audio class-specific interface descriptor. This follows a regular interface descriptor to - * supply extra information about the audio device's layout to the host. See the USB Audio specification for more - * details. - * - * \see \ref USB_Audio_StdDescriptor_Interface_AC_t for the version of this type with standard element names. - */ - typedef struct + + /* Enums: */ + /** Audio class specific interface description subtypes, for the Audio Control interface. */ + enum Audio_CSInterface_AC_SubTypes_t { - USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */ - uint8_t Subtype; /**< Sub type value used to distinguish between audio class-specific descriptors. */ - - 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 class interfaces within this device. */ - uint8_t InterfaceNumbers[1]; /**< Interface numbers of each audio interface. */ - } USB_Audio_Descriptor_Interface_AC_t; - - /** \brief Audio class-specific Interface Descriptor (USB-IF naming conventions). - * - * Type define for an Audio class-specific interface descriptor. This follows a regular interface descriptor to - * supply extra information about the audio device's layout to the host. See the USB Audio specification for more - * details. - * - * \see \ref USB_Audio_Descriptor_Interface_AC_t for the version of this type with non-standard LUFA specific - * element names. - */ - typedef struct - { - uint8_t bLength; /**< Size of the descriptor, in bytes. */ - 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 bDescriptorSubtype; /**< Sub type value used to distinguish between audio class-specific descriptors. */ - - 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 class interfaces within this device. */ - uint8_t bInterfaceNumbers[1]; /**< Interface numbers of each audio 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 - * are present in the device's audio stream for basic control, such as per-channel volume. See the USB Audio - * specification for more details. - * - * \see \ref USB_Audio_StdDescriptor_FeatureUnit_t for the version of this type with standard element names. - */ - typedef struct + AUDIO_DSUBTYPE_CSInterface_Header = 0x01, /**< Audio class specific control interface header. */ + AUDIO_DSUBTYPE_CSInterface_InputTerminal = 0x02, /**< Audio class specific control interface Input Terminal. */ + AUDIO_DSUBTYPE_CSInterface_OutputTerminal = 0x03, /**< Audio class specific control interface Output Terminal. */ + AUDIO_DSUBTYPE_CSInterface_Mixer = 0x04, /**< Audio class specific control interface Mixer Unit. */ + AUDIO_DSUBTYPE_CSInterface_Selector = 0x05, /**< Audio class specific control interface Selector Unit. */ + AUDIO_DSUBTYPE_CSInterface_Feature = 0x06, /**< Audio class specific control interface Feature Unit. */ + AUDIO_DSUBTYPE_CSInterface_Processing = 0x07, /**< Audio class specific control interface Processing Unit. */ + AUDIO_DSUBTYPE_CSInterface_Extension = 0x08, /**< Audio class specific control interface Extension Unit. */ + }; + + /** Audio class specific interface description subtypes, for the Audio Streaming interface. */ + enum Audio_CSInterface_AS_SubTypes_t { - USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */ - uint8_t Subtype; /**< Sub type value used to distinguish between audio class-specific descriptors. */ - - 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; + AUDIO_DSUBTYPE_CSInterface_General = 0x01, /**< Audio class specific streaming interface general descriptor. */ + AUDIO_DSUBTYPE_CSInterface_FormatType = 0x02, /**< Audio class specific streaming interface format type descriptor. */ + AUDIO_DSUBTYPE_CSInterface_FormatSpecific = 0x03, /**< Audio class specific streaming interface format information descriptor. */ + }; - /** \brief Audio class-specific Feature Unit Descriptor (USB-IF naming conventions). - * - * Type define for an Audio class-specific Feature Unit descriptor. This indicates to the host what features - * are present in the device's audio stream for basic control, such as per-channel volume. See the USB Audio - * specification for more details. - * - * \see \ref USB_Audio_Descriptor_FeatureUnit_t for the version of this type with non-standard LUFA specific - * element names. - */ - typedef struct + /** Audio class specific endpoint description subtypes, for the Audio Streaming interface. */ + enum Audio_CSEndpoint_SubTypes_t { - uint8_t bLength; /**< Size of the descriptor, in bytes. */ - 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 bDescriptorSubtype; /**< Sub type value used to distinguish between audio class-specific descriptors. */ - - 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; - + AUDIO_DSUBTYPE_CSEndpoint_General = 0x01, /**< Audio class specific endpoint general descriptor. */ + }; + + /* Type Defines: */ /** \brief Audio class-specific Input Terminal Descriptor (LUFA naming conventions). * * Type define for an Audio class-specific input terminal descriptor. This indicates to the host that the device @@ -341,8 +249,10 @@ typedef struct { USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */ - uint8_t Subtype; /**< Sub type value used to distinguish between audio class-specific descriptors. */ - + 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 @@ -371,7 +281,9 @@ * given by the specific class. */ - uint8_t bDescriptorSubtype; /**< Sub type value used to distinguish between audio class-specific descriptors. */ + uint8_t bDescriptorSubtype; /**< Sub type value used to distinguish between audio class-specific descriptors, + * must be \ref AUDIO_DSUBTYPE_CSInterface_InputTerminal. + */ uint8_t bTerminalID; /**< ID value of this terminal unit - must be a unique value within the device. */ uint16_t wTerminalType; /**< Type of terminal, a TERMINAL_* mask. */ uint8_t bAssocTerminal; /**< ID of associated output terminal, for physically grouped terminals @@ -395,7 +307,9 @@ typedef struct { USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */ - uint8_t Subtype; /**< Sub type value used to distinguish between audio class-specific descriptors. */ + 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. */ @@ -419,11 +333,13 @@ typedef struct { uint8_t bLength; /**< Size of the descriptor, in bytes. */ - 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 bDescriptorType; /**< Sub type value used to distinguish between audio class-specific descriptors, + * must be \ref AUDIO_DSUBTYPE_CSInterface_OutputTerminal. */ - uint8_t bDescriptorSubtype; /**< Sub type value used to distinguish between audio class-specific descriptors. */ + uint8_t bDescriptorSubtype; /**< Sub type value used to distinguish between audio class-specific descriptors, + * a value from the \ref Audio_CSInterface_AC_SubTypes_t enum. + */ uint8_t bTerminalID; /**< ID value of this terminal unit - must be a unique value within the device. */ uint16_t wTerminalType; /**< Type of terminal, a TERMINAL_* mask. */ uint8_t bAssocTerminal; /**< ID of associated input terminal, for physically grouped terminals @@ -433,6 +349,108 @@ uint8_t iTerminal; /**< Index of a string descriptor describing this descriptor within the device. */ } USB_Audio_StdDescriptor_OutputTerminal_t; + + /** \brief Audio class-specific Interface Descriptor (LUFA naming conventions). + * + * Type define for an Audio class-specific interface descriptor. This follows a regular interface descriptor to + * supply extra information about the audio device's layout to the host. See the USB Audio specification for more + * details. + * + * \see \ref USB_Audio_StdDescriptor_Interface_AC_t for the version of this type with standard element names. + */ + typedef struct + { + USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */ + 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. + */ + + 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; + + /** \brief Audio class-specific Interface Descriptor (USB-IF naming conventions). + * + * Type define for an Audio class-specific interface descriptor. This follows a regular interface descriptor to + * supply extra information about the audio device's layout to the host. See the USB Audio specification for more + * details. + * + * \see \ref USB_Audio_Descriptor_Interface_AC_t for the version of this type with non-standard LUFA specific + * element names. + */ + typedef struct + { + uint8_t bLength; /**< Size of the descriptor, in bytes. */ + 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 bDescriptorSubtype;/**< Sub type value used to distinguish between audio class-specific descriptors, + * a value from the \ref Audio_CSInterface_AS_SubTypes_t enum. + */ + + 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 + * are present in the device's audio stream for basic control, such as per-channel volume. See the USB Audio + * specification for more details. + * + * \see \ref USB_Audio_StdDescriptor_FeatureUnit_t for the version of this type with standard element names. + */ + typedef struct + { + USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */ + 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; + + /** \brief Audio class-specific Feature Unit Descriptor (USB-IF naming conventions). + * + * Type define for an Audio class-specific Feature Unit descriptor. This indicates to the host what features + * are present in the device's audio stream for basic control, such as per-channel volume. See the USB Audio + * specification for more details. + * + * \see \ref USB_Audio_Descriptor_FeatureUnit_t for the version of this type with non-standard LUFA specific + * element names. + */ + typedef struct + { + uint8_t bLength; /**< Size of the descriptor, in bytes. */ + 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 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). * @@ -444,7 +462,9 @@ typedef struct { USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */ - uint8_t Subtype; /**< Sub type value used to distinguish between audio class-specific descriptors. */ + 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. */ @@ -467,7 +487,9 @@ * given by the specific class. */ - uint8_t bDescriptorSubtype; /**< Sub type value used to distinguish between audio class-specific descriptors. */ + 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. */ @@ -482,8 +504,8 @@ */ typedef struct { - uint16_t LowWord; /**< Low 16 bits of the 24-bit value. */ - uint8_t HighByte; /**< Upper 8 bits of the 24-bit value. */ + uint16_t LowWord; /**< Low 16 bits of the 24-bit value. */ + uint8_t HighByte; /**< Upper 8 bits of the 24-bit value. */ } USB_Audio_SampleFreq_t; /** \brief Audio class-specific Format Descriptor (LUFA naming conventions). @@ -497,8 +519,10 @@ typedef struct { USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */ - uint8_t Subtype; /**< Sub type value used to distinguish between audio class-specific descriptors. */ - + 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. */ @@ -520,21 +544,23 @@ */ typedef struct { - uint8_t bLength; /**< Size of the descriptor, in bytes. */ - 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 bLength; /**< Size of the descriptor, in bytes. */ + uint8_t bDescriptorType; /**< Sub type value used to distinguish between audio class-specific descriptors, + * must be \ref AUDIO_DSUBTYPE_CSInterface_FormatType. + */ - uint8_t bDescriptorSubtype; /**< Sub type value used to distinguish between audio class-specific descriptors. */ + 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 bFormatType; /**< Format of the audio stream, see Audio Device Formats specification. */ - uint8_t bNrChannels; /**< Total number of discrete channels in the stream. */ + 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 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 SampleFrequencies[AUDIO_TOTAL_SAMPLE_RATES * 3]; /**< Sample frequencies supported by the device (must be 24-bit). */ + 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). @@ -593,13 +619,15 @@ */ typedef struct { - USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */ - uint8_t Subtype; /**< Sub type value used to distinguish between audio class-specific descriptors. */ + USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */ + 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 Attributes; /**< Audio class-specific endpoint attributes, such as ACCEPTS_SMALL_PACKETS. */ - uint8_t LockDelayUnits; /**< Units used for the LockDelay field, see Audio class specification. */ - uint16_t LockDelay; /**< Time required to internally lock endpoint's internal clock recovery circuitry. */ + uint8_t LockDelayUnits; /**< Units used for the LockDelay field, see Audio class specification. */ + uint16_t LockDelay; /**< Time required to internally lock endpoint's internal clock recovery circuitry. */ } USB_Audio_Descriptor_StreamEndpoint_Spc_t; /** \brief Audio class-specific Extended Endpoint Descriptor (USB-IF naming conventions). @@ -618,7 +646,9 @@ * given by the specific class. */ - uint8_t bDescriptorSubtype; /**< Sub type value used to distinguish between audio class-specific descriptors. */ + 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. */ diff --git a/LUFA/Drivers/USB/Class/Common/CDC.h b/LUFA/Drivers/USB/Class/Common/CDC.h index c41907f08..99a1d8f9c 100644 --- a/LUFA/Drivers/USB/Class/Common/CDC.h +++ b/LUFA/Drivers/USB/Class/Common/CDC.h @@ -66,30 +66,6 @@ #endif /* Macros: */ - /** CDC class-specific request to get the current virtual serial port configuration settings. */ - #define REQ_GetLineEncoding 0x21 - - /** CDC class-specific request to set the current virtual serial port configuration settings. */ - #define REQ_SetLineEncoding 0x20 - - /** CDC class-specific request to set the current virtual serial port handshake line states. */ - #define REQ_SetControlLineState 0x22 - - /** CDC class-specific request to send a break to the receiver via the carrier channel. */ - #define REQ_SendBreak 0x23 - - /** CDC class-specific request to send an encapsulated command to the device. */ - #define REQ_SendEncapsulatedCommand 0x00 - - /** CDC class-specific request to retrieve an encapsulated command response from the device. */ - #define REQ_GetEncapsulatedResponse 0x01 - - /** Notification type constant for a change in the virtual serial port handshake line states, for - * use with a USB_Notification_Header_t notification structure when sent to the host via the CDC - * notification endpoint. - */ - #define NOTIF_SerialState 0x20 - /** Mask for the DTR handshake line for use with the REQ_SetControlLineState class-specific request * from the host, to indicate that the DTR line state should be high. */ @@ -149,8 +125,51 @@ uint8_t SubType; \ uint8_t Data[DataSize]; \ } - + /* Enums: */ + /** Enum for the CDC class specific control requests that can be issued by the USB bus host. */ + enum CDC_ClassRequests_t + { + CDC_REQ_SendEncapsulatedCommand = 0x00, /**< CDC class-specific request to send an encapsulated command to the device. */ + CDC_REQ_GetEncapsulatedResponse = 0x01, /**< CDC class-specific request to retrieve an encapsulated command response from the device. */ + CDC_REQ_SetLineEncoding = 0x20, /**< CDC class-specific request to set the current virtual serial port configuration settings. */ + CDC_REQ_GetLineEncoding = 0x21, /**< CDC class-specific request to get the current virtual serial port configuration settings. */ + CDC_REQ_SetControlLineState = 0x22, /**< CDC class-specific request to set the current virtual serial port handshake line states. */ + CDC_REQ_SendBreak = 0x23, /**< CDC class-specific request to send a break to the receiver via the carrier channel. */ + }; + + /** Enum for the CDC class specific notification requests that can be issued by a CDC device to a host. */ + enum CDC_ClassNotifications_t + { + CDC_NOTIF_SerialState = 0x20, /**< Notification type constant for a change in the virtual serial port + * handshake line states, for use with a USB_Notification_Header_t + * notification structure when sent to the host via the CDC notification + * endpoint. + */ + }; + + /** Enum for the CDC class specific interface descriptor subtypes. */ + enum CDC_DescriptorSubtypes_t + { + CDC_DSUBTYPE_CSInterface_Header = 0x00, /**< CDC class-specific Header functional descriptor. */ + CDC_DSUBTYPE_CSInterface_CallManagement = 0x01, /**< CDC class-specific Call Managment functional descriptor. */ + CDC_DSUBTYPE_CSInterface_ACM = 0x02, /**< CDC class-specific Abstract Control Model functional descriptor. */ + CDC_DSUBTYPE_CSInterface_DirectLine = 0x03, /**< CDC class-specific Direct Line functional descriptor. */ + CDC_DSUBTYPE_CSInterface_TelephoneRinger = 0x04, /**< CDC class-specific Telephone Ringer functional descriptor. */ + CDC_DSUBTYPE_CSInterface_TelephoneCall = 0x05, /**< CDC class-specific Telephone Call functional descriptor. */ + CDC_DSUBTYPE_CSInterface_Union = 0x06, /**< CDC class-specific Union functional descriptor. */ + CDC_DSUBTYPE_CSInterface_CountrySelection = 0x07, /**< CDC class-specific Country Selection functional descriptor. */ + CDC_DSUBTYPE_CSInterface_TelephoneOpModes = 0x08, /**< CDC class-specific Telephone Operation Modes functional descriptor. */ + CDC_DSUBTYPE_CSInterface_USBTerminal = 0x09, /**< CDC class-specific USB Terminal functional descriptor. */ + CDC_DSUBTYPE_CSInterface_NetworkChannel = 0x0A, /**< CDC class-specific Network Channel functional descriptor. */ + CDC_DSUBTYPE_CSInterface_ProtocolUnit = 0x0B, /**< CDC class-specific Protocol Unit functional descriptor. */ + CDC_DSUBTYPE_CSInterface_ExtensionUnit = 0x0C, /**< CDC class-specific Extension Unit functional descriptor. */ + CDC_DSUBTYPE_CSInterface_MultiChannel = 0x0D, /**< CDC class-specific Multi-Channel Management functional descriptor. */ + CDC_DSUBTYPE_CSInterface_CAPI = 0x0E, /**< CDC class-specific Common ISDN API functional descriptor. */ + CDC_DSUBTYPE_CSInterface_Ethernet = 0x0F, /**< CDC class-specific Ethernet functional descriptor. */ + CDC_DSUBTYPE_CSInterface_ATM = 0x10, /**< CDC class-specific Asynchronous Transfer Mode functional descriptor. */ + }; + /** Enum for the possible line encoding formats of a virtual serial port. */ enum CDC_LineEncodingFormats_t { @@ -162,13 +181,134 @@ /** Enum for the possible line encoding parity settings of a virtual serial port. */ enum CDC_LineEncodingParity_t { - CDC_PARITY_None = 0, /**< No parity bit mode on each frame. */ - CDC_PARITY_Odd = 1, /**< Odd parity bit mode on each frame. */ - CDC_PARITY_Even = 2, /**< Even parity bit mode on each frame. */ - CDC_PARITY_Mark = 3, /**< Mark parity bit mode on each frame. */ - CDC_PARITY_Space = 4, /**< Space parity bit mode on each frame. */ + CDC_PARITY_None = 0, /**< No parity bit mode on each frame. */ + CDC_PARITY_Odd = 1, /**< Odd parity bit mode on each frame. */ + CDC_PARITY_Even = 2, /**< Even parity bit mode on each frame. */ + CDC_PARITY_Mark = 3, /**< Mark parity bit mode on each frame. */ + CDC_PARITY_Space = 4, /**< Space parity bit mode on each frame. */ }; + /* Type Defines: */ + /** \brief CDC class-specific Functional Header Descriptor (LUFA naming conventions). + * + * Type define for a CDC class-specific functional header descriptor. This indicates to the host that the device + * contains one or more CDC functional data descriptors, which give the CDC interface's capabilities and configuration. + * See the CDC class specification for more details. + * + * \see \ref USB_CDC_StdDescriptor_FunctionalHeader_t for the version of this type with standard element names. + */ + typedef struct + { + USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */ + uint8_t Subtype; /**< Sub type value used to distinguish between CDC class-specific descriptors, + * must be \ref CDC_DSUBTYPE_CSInterface_Header. + */ + uint16_t CDCSpecification; /**< Version number of the CDC specification implemented by the device, + * encoded in BCD format. + */ + } USB_CDC_Descriptor_FunctionalHeader_t; + + /** \brief CDC class-specific Functional Header Descriptor (USB-IF naming conventions). + * + * Type define for a CDC class-specific functional header descriptor. This indicates to the host that the device + * contains one or more CDC functional data descriptors, which give the CDC interface's capabilities and configuration. + * See the CDC class specification for more details. + * + * \see \ref USB_CDC_Descriptor_FunctionalHeader_t for the version of this type with non-standard LUFA specific + * element names. + */ + typedef struct + { + uint8_t bFunctionLength; /**< Size of the descriptor, in bytes. */ + 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 bDescriptorSubType; /**< Sub type value used to distinguish between CDC class-specific descriptors, + * must be \ref CDC_DSUBTYPE_CSInterface_Header. + */ + uint16_t bcdCDC; /**< Version number of the CDC specification implemented by the device, encoded in BCD format. */ + } USB_CDC_StdDescriptor_FunctionalHeader_t; + + /** \brief CDC class-specific Functional ACM Descriptor (LUFA naming conventions). + * + * Type define for a CDC class-specific functional ACM descriptor. This indicates to the host that the CDC interface + * supports the CDC ACM subclass of the CDC specification. See the CDC class specification for more details. + * + * \see \ref USB_CDC_StdDescriptor_FunctionalACM_t for the version of this type with standard element names. + */ + typedef struct + { + USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */ + uint8_t Subtype; /**< Sub type value used to distinguish between CDC class-specific descriptors, + * must be \ref CDC_DSUBTYPE_CSInterface_ACM. + */ + uint8_t Capabilities; /**< Capabilities of the ACM interface, given as a bit mask. For most devices, + * this should be set to a fixed value of 0x06 - for other capabiltiies, refer + * to the CDC ACM specification. + */ + } USB_CDC_Descriptor_FunctionalACM_t; + + /** \brief CDC class-specific Functional ACM Descriptor (USB-IF naming conventions). + * + * Type define for a CDC class-specific functional ACM descriptor. This indicates to the host that the CDC interface + * supports the CDC ACM subclass of the CDC specification. See the CDC class specification for more details. + * + * \see \ref USB_CDC_Descriptor_FunctionalACM_t for the version of this type with non-standard LUFA specific + * element names. + */ + typedef struct + { + uint8_t bFunctionLength; /**< Size of the descriptor, in bytes. */ + 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 bDescriptorSubType; /**< Sub type value used to distinguish between CDC class-specific descriptors, + * must be \ref CDC_DSUBTYPE_CSInterface_ACM. + */ + uint8_t bmCapabilities; /**< Capabilities of the ACM interface, given as a bit mask. For most devices, + * this should be set to a fixed value of 0x06 - for other capabiltiies, refer + * to the CDC ACM specification. + */ + } USB_CDC_StdDescriptor_FunctionalACM_t; + + /** \brief CDC class-specific Functional Union Descriptor (LUFA naming conventions). + * + * Type define for a CDC class-specific functional Union descriptor. This indicates to the host that specific + * CDC control and data interfaces are related. See the CDC class specification for more details. + * + * \see \ref USB_CDC_StdDescriptor_FunctionalUnion_t for the version of this type with standard element names. + */ + typedef struct + { + USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */ + uint8_t Subtype; /**< Sub type value used to distinguish between CDC class-specific descriptors, + * must be \ref CDC_DSUBTYPE_CSInterface_Union. + */ + uint8_t MasterInterfaceNumber; /**< Interface number of the CDC Control interface. */ + uint8_t SlaveInterfaceNumber; /**< Interface number of the CDC Data interface. */ + } USB_CDC_Descriptor_FunctionalUnion_t; + + /** \brief CDC class-specific Functional Union Descriptor (USB-IF naming conventions). + * + * Type define for a CDC class-specific functional Union descriptor. This indicates to the host that specific + * CDC control and data interfaces are related. See the CDC class specification for more details. + * + * \see \ref USB_CDC_Descriptor_FunctionalUnion_t for the version of this type with non-standard LUFA specific + * element names. + */ + typedef struct + { + uint8_t bFunctionLength; /**< Size of the descriptor, in bytes. */ + 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 bDescriptorSubType; /**< Sub type value used to distinguish between CDC class-specific descriptors, + * must be \ref CDC_DSUBTYPE_CSInterface_Union. + */ + uint8_t bMasterInterface; /**< Interface number of the CDC Control interface. */ + uint8_t bSlaveInterface0; /**< Interface number of the CDC Data interface. */ + } USB_CDC_StdDescriptor_FunctionalUnion_t; + /* Disable C linkage for C++ Compilers: */ #if defined(__cplusplus) } diff --git a/LUFA/Drivers/USB/Class/Common/HID.h b/LUFA/Drivers/USB/Class/Common/HID.h index 59e262a22..822a8b502 100644 --- a/LUFA/Drivers/USB/Class/Common/HID.h +++ b/LUFA/Drivers/USB/Class/Common/HID.h @@ -60,46 +60,7 @@ #error Do not include this file directly. Include LUFA/Drivers/Class/HID.h instead. #endif - /* Macros: */ - /** HID class-specific Request to get the current HID report from the device. */ - #define REQ_GetReport 0x01 - - /** HID class-specific Request to get the current device idle count. */ - #define REQ_GetIdle 0x02 - - /** HID class-specific Request to set the current HID report to the device. */ - #define REQ_SetReport 0x09 - - /** HID class-specific Request to set the device's idle count. */ - #define REQ_SetIdle 0x0A - - /** HID class-specific Request to get the current HID report protocol mode. */ - #define REQ_GetProtocol 0x03 - - /** HID class-specific Request to set the current HID report protocol mode. */ - #define REQ_SetProtocol 0x0B - - /** Descriptor header type value, to indicate a HID class HID descriptor. */ - #define DTYPE_HID 0x21 - - /** Descriptor header type value, to indicate a HID class HID report descriptor. */ - #define DTYPE_Report 0x22 - - /** Constant for the protocol value of a HID interface descriptor, indicating that the interface does not support - * any HID class boot protocol (see HID Class Specification). - */ - #define HID_NON_BOOT_PROTOCOL 0x00 - - /** Constant for the protocol value of a HID interface descriptor, indicating that the interface supports the - * HID class Keyboard boot protocol (see HID Class Specification). - */ - #define HID_BOOT_KEYBOARD_PROTOCOL 0x01 - - /** Constant for the protocol value of a HID interface descriptor, indicating that the interface supports the - * HID class Mouse boot protocol (see HID Class Specification). - */ - #define HID_BOOT_MOUSE_PROTOCOL 0x02 - + /* Macros: */ /** Constant for a keyboard report modifier byte, indicating that the keyboard's left control key is currently pressed. */ #define HID_KEYBOARD_MODIFER_LEFTCTRL (1 << 0) @@ -137,12 +98,47 @@ #define HID_KEYBOARD_LED_KATANA (1 << 3) /* Type Defines: */ + /** Enum for the HID class specific control requests that can be issued by the USB bus host. */ + enum HID_ClassRequests_t + { + HID_REQ_GetReport = 0x01, /**< HID class-specific Request to get the current HID report from the device. */ + HID_REQ_GetIdle = 0x02, /**< HID class-specific Request to get the current device idle count. */ + HID_REQ_SetReport = 0x09, /**< HID class-specific Request to set the current HID report to the device. */ + HID_REQ_SetIdle = 0x0A, /**< HID class-specific Request to set the device's idle count. */ + HID_REQ_GetProtocol = 0x03, /**< HID class-specific Request to get the current HID report protocol mode. */ + HID_REQ_SetProtocol = 0x0B, /**< HID class-specific Request to set the current HID report protocol mode. */ + }; + + /** Enum for the HID class specific descriptor types. */ + enum HID_DescriptorTypes_t + { + HID_DTYPE_HID = 0x21, /**< Descriptor header type value, to indicate a HID class HID descriptor. */ + HID_DTYPE_Report = 0x22, /**< Descriptor header type value, to indicate a HID class HID report descriptor. */ + }; + + /** Enum for the HID class boot protocols that may be supported by HID devices. */ + enum HID_BootProtocols_t + { + HID_BOOTP_NonBootProtocol = 0x00, /**< Constant for the protocol value of a HID interface descriptor, indicating + * that the interface does not support any HID class boot protocol (see HID + * Class Specification). + */ + HID_BOOTP_KeyboardBootProtocol = 0x01, /**< Constant for the protocol value of a HID interface descriptor, indicating + * that the interface supports the HID class Keyboard boot protocol (see HID + * Class Specification). + */ + HID_BOOTP_MouseBootProtocol = 0x02, /**< Constant for the protocol value of a HID interface descriptor, indicating + * that the interface supports the HID class Mouse boot protocol (see HID Class + * Specification). + */ + }; + /** Enum for the different types of HID reports. */ enum HID_ReportItemTypes_t { - REPORT_ITEM_TYPE_In = 0, /**< Indicates that the item is an IN report type. */ - REPORT_ITEM_TYPE_Out = 1, /**< Indicates that the item is an OUT report type. */ - REPORT_ITEM_TYPE_Feature = 2, /**< Indicates that the item is a FEATURE report type. */ + HID_REPORT_ITEM_In = 0, /**< Indicates that the item is an IN report type. */ + HID_REPORT_ITEM_Out = 1, /**< Indicates that the item is an OUT report type. */ + HID_REPORT_ITEM_Feature = 2, /**< Indicates that the item is a FEATURE report type. */ }; /** \brief HID class-specific HID Descriptor (LUFA naming conventions). @@ -161,7 +157,7 @@ uint8_t TotalReportDescriptors; /**< Total number of HID report descriptors for the interface. */ - uint8_t HIDReportType; /**< Type of HID report, set to \ref DTYPE_Report. */ + uint8_t HIDReportType; /**< Type of HID report, set to \ref HID_DTYPE_Report. */ uint16_t HIDReportLength; /**< Length of the associated HID report descriptor, in bytes. */ } USB_HID_Descriptor_HID_t; @@ -185,7 +181,7 @@ uint8_t bNumDescriptors; /**< Total number of HID report descriptors for the interface. */ - uint8_t bDescriptorType2; /**< Type of HID report, set to \ref DTYPE_Report. */ + uint8_t bDescriptorType2; /**< Type of HID report, set to \ref HID_DTYPE_Report. */ uint16_t wDescriptorLength; /**< Length of the associated HID report descriptor, in bytes. */ } USB_HID_StdDescriptor_HID_t; diff --git a/LUFA/Drivers/USB/Class/Common/MIDI.h b/LUFA/Drivers/USB/Class/Common/MIDI.h index da7b2bd76..b3a40385c 100644 --- a/LUFA/Drivers/USB/Class/Common/MIDI.h +++ b/LUFA/Drivers/USB/Class/Common/MIDI.h @@ -70,18 +70,6 @@ #endif /* Macros: */ - /** Audio class descriptor subtype value for a Audio class-specific MIDI input jack descriptor. */ - #define DSUBTYPE_InputJack 0x02 - - /** Audio class descriptor subtype value for a Audio class-specific MIDI output jack descriptor. */ - #define DSUBTYPE_OutputJack 0x03 - - /** Audio class descriptor jack type value for an embedded (logical) MIDI input or output jack. */ - #define MIDI_JACKTYPE_EMBEDDED 0x01 - - /** Audio class descriptor jack type value for an external (physical) MIDI input or output jack. */ - #define MIDI_JACKTYPE_EXTERNAL 0x02 - /** MIDI command for a note on (activation) event. */ #define MIDI_COMMAND_NOTE_ON 0x90 @@ -97,6 +85,13 @@ * \param[in] channel MIDI channel number to address. */ #define MIDI_CHANNEL(channel) ((channel) - 1) + + /* Enums: */ + enum MIDI_JackTypes_t + { + MIDI_JACKTYPE_Embedded = 0x01, /**< MIDI class descriptor jack type value for an embedded (logical) MIDI input or output jack. */ + MIDI_JACKTYPE_External = 0x02, /**< MIDI class descriptor jack type value for an external (physical) MIDI input or output jack. */ + }; /* Type Defines: */ /** \brief MIDI class-specific Streaming Interface Descriptor (LUFA naming conventions). @@ -113,8 +108,8 @@ uint8_t Subtype; /**< Sub type value used to distinguish between audio class-specific descriptors. */ uint16_t AudioSpecification; /**< Binary coded decimal value, indicating the supported Audio Class - * specification version. - */ + * specification version. + */ uint16_t TotalLength; /**< Total length of the Audio class-specific descriptors, including this descriptor. */ } USB_MIDI_Descriptor_AudioInterface_AS_t; @@ -158,7 +153,6 @@ uint8_t JackStrIndex; /**< Index of a string descriptor describing this descriptor within the device. */ } USB_MIDI_Descriptor_InputJack_t; - /** \brief MIDI class-specific Input Jack Descriptor (USB-IF naming conventions). * * Type define for an Audio class-specific MIDI IN jack. This gives information to the host on a MIDI input, either diff --git a/LUFA/Drivers/USB/Class/Common/MassStorage.h b/LUFA/Drivers/USB/Class/Common/MassStorage.h index 9a391ee07..2dc83d9d4 100644 --- a/LUFA/Drivers/USB/Class/Common/MassStorage.h +++ b/LUFA/Drivers/USB/Class/Common/MassStorage.h @@ -66,12 +66,6 @@ #endif /* Macros: */ - /** Mass Storage class-specific request to reset the Mass Storage interface, ready for the next command. */ - #define REQ_MassStorageReset 0xFF - - /** Mass Storage class-specific request to retrieve the total number of Logical Units (drives) in the SCSI device. */ - #define REQ_GetMaxLUN 0xFE - /** Magic signature for a Command Block Wrapper used in the Mass Storage Bulk-Only transport protocol. */ #define MS_CBW_SIGNATURE 0x43425355UL @@ -209,8 +203,30 @@ /** SCSI Additional Sense Qualifier Code to indicate that an operation is currently in progress. */ #define SCSI_ASENSEQ_OPERATION_IN_PROGRESS 0x07 - - /* Type defines: */ + + /* Enums: */ + /** Enum for the Mass Storage class specific control requests that can be issued by the USB bus host. */ + enum MS_ClassRequests_t + { + MS_REQ_GetMaxLUN = 0xFE, /**< Mass Storage class-specific request to retrieve the total number of Logical + * Units (drives) in the SCSI device. + */ + MS_REQ_MassStorageReset = 0xFF, /**< Mass Storage class-specific request to reset the Mass Storage interface, + * ready for the next command. + */ + }; + + /** Enum for the possible command status wrapper return status codes. */ + enum MS_CommandStatusCodes_t + { + MS_SCSI_COMMAND_Pass = 0, /**< Command completed with no error */ + MS_SCSI_COMMAND_Fail = 1, /**< Command failed to complete - host may check the exact error via a + * SCSI REQUEST SENSE command. + */ + MS_SCSI_COMMAND_PhaseError = 2, /**< Command failed due to being invalid in the current phase. */ + }; + + /* Type Defines: */ /** \brief Mass Storage Class Command Block Wrapper. * * Type define for a Command Block Wrapper, used in the Mass Storage Bulk-Only Transport protocol. */ @@ -256,13 +272,13 @@ unsigned char EOM : 1; unsigned char FileMark : 1; - uint8_t Information[4]; - uint8_t AdditionalLength; - uint8_t CmdSpecificInformation[4]; - uint8_t AdditionalSenseCode; - uint8_t AdditionalSenseQualifier; - uint8_t FieldReplaceableUnitCode; - uint8_t SenseKeySpecific[3]; + uint8_t Information[4]; + uint8_t AdditionalLength; + uint8_t CmdSpecificInformation[4]; + uint8_t AdditionalSenseCode; + uint8_t AdditionalSenseQualifier; + uint8_t FieldReplaceableUnitCode; + uint8_t SenseKeySpecific[3]; } SCSI_Request_Sense_Response_t; /** \brief Mass Storage Class SCSI Inquiry Structure. @@ -281,7 +297,7 @@ unsigned char Reserved : 7; unsigned char Removable : 1; - uint8_t Version; + uint8_t Version; unsigned char ResponseDataFormat : 4; unsigned char Reserved2 : 1; @@ -289,8 +305,8 @@ unsigned char TrmTsk : 1; unsigned char AERC : 1; - uint8_t AdditionalLength; - uint8_t Reserved3[2]; + uint8_t AdditionalLength; + uint8_t Reserved3[2]; unsigned char SoftReset : 1; unsigned char CmdQue : 1; @@ -301,21 +317,10 @@ unsigned char WideBus32Bit : 1; unsigned char RelAddr : 1; - uint8_t VendorID[8]; - uint8_t ProductID[16]; - uint8_t RevisionID[4]; + uint8_t VendorID[8]; + uint8_t ProductID[16]; + uint8_t RevisionID[4]; } SCSI_Inquiry_Response_t; - - /* Enums: */ - /** Enum for the possible command status wrapper return status codes. */ - enum MassStorage_CommandStatusCodes_t - { - SCSI_Command_Pass = 0, /**< Command completed with no error */ - SCSI_Command_Fail = 1, /**< Command failed to complete - host may check the exact error via a - * SCSI REQUEST SENSE command. - */ - SCSI_Phase_Error = 2 /**< Command failed due to being invalid in the current phase. */ - }; /* Disable C linkage for C++ Compilers: */ #if defined(__cplusplus) diff --git a/LUFA/Drivers/USB/Class/Common/RNDIS.h b/LUFA/Drivers/USB/Class/Common/RNDIS.h index a6549c5e3..98d41a2c4 100644 --- a/LUFA/Drivers/USB/Class/Common/RNDIS.h +++ b/LUFA/Drivers/USB/Class/Common/RNDIS.h @@ -76,13 +76,7 @@ /** Implemented RNDIS Version Minor. */ #define REMOTE_NDIS_VERSION_MINOR 0x00 - - /** RNDIS request to issue a host-to-device NDIS command. */ - #define REQ_SendEncapsulatedCommand 0x00 - - /** RNDIS request to issue a device-to-host NDIS response. */ - #define REQ_GetEncapsulatedResponse 0x01 - + /** Maximum size in bytes of a RNDIS control message which can be sent or received. */ #define RNDIS_MESSAGE_BUFFER_SIZE 128 @@ -93,6 +87,13 @@ #define NOTIF_ResponseAvailable 1 /* Enums: */ + /** Enum for the RNDIS class specific control requests that can be issued by the USB bus host. */ + enum RNDIS_ClassRequests_t + { + RNDIS_REQ_SendEncapsulatedCommand = 0x00, /**< RNDIS request to issue a host-to-device NDIS command. */ + RNDIS_REQ_GetEncapsulatedResponse = 0x01, /**< RNDIS request to issue a device-to-host NDIS response. */ + }; + /** Enum for the possible NDIS adapter states. */ enum RNDIS_States_t { diff --git a/LUFA/Drivers/USB/Class/Common/StillImage.h b/LUFA/Drivers/USB/Class/Common/StillImage.h index 434d65a1e..01cffbddb 100644 --- a/LUFA/Drivers/USB/Class/Common/StillImage.h +++ b/LUFA/Drivers/USB/Class/Common/StillImage.h @@ -72,53 +72,51 @@ * * \return Number of bytes of the given unicode string. */ - #define UNICODE_STRING_LENGTH(Chars) ((Chars) << 1) + #define UNICODE_STRING_LENGTH(Chars) ((Chars) << 1) /** Used in the DataLength field of a PIMA container, to give the total container size in bytes for * a command container. * * \param[in] Params Number of parameters which are to be sent in the Param field of the container. */ - #define PIMA_COMMAND_SIZE(Params) ((sizeof(SI_PIMA_Container_t) - 12) + \ - ((Params) * sizeof(uint32_t))) + #define PIMA_COMMAND_SIZE(Params) ((sizeof(SI_PIMA_Container_t) - 12) + ((Params) * sizeof(uint32_t))) /** Used in the DataLength field of a PIMA container, to give the total container size in bytes for * a data container. * * \param[in] DataLen Length in bytes of the data in the container. */ - #define PIMA_DATA_SIZE(DataLen) ((sizeof(SI_PIMA_Container_t) - 12) + \ - (DataLen)) + #define PIMA_DATA_SIZE(DataLen) ((sizeof(SI_PIMA_Container_t) - 12) + (DataLen)) /* Enums: */ /** Enum for the possible PIMA contains types. */ enum SI_PIMA_Container_Types_t { - CType_Undefined = 0, /**< Undefined container type. */ - CType_CommandBlock = 1, /**< Command Block container type. */ - CType_DataBlock = 2, /**< Data Block container type. */ - CType_ResponseBlock = 3, /**< Response container type. */ - CType_EventBlock = 4, /**< Event Block container type. */ + SI_PIMA_CONTAINER_Undefined = 0, /**< Undefined container type. */ + SI_PIMA_CONTAINER_CommandBlock = 1, /**< Command Block container type. */ + SI_PIMA_CONTAINER_DataBlock = 2, /**< Data Block container type. */ + SI_PIMA_CONTAINER_ResponseBlock = 3, /**< Response container type. */ + SI_PIMA_CONTAINER_EventBlock = 4, /**< Event Block container type. */ }; /* Enums: */ /** Enums for the possible status codes of a returned Response Block from an attached PIMA compliant Still Image device. */ enum SI_PIMA_ResponseCodes_t { - PIMA_RESPONSE_OK = 1, /**< Response code indicating no error in the issued command. */ - PIMA_RESPONSE_GeneralError = 2, /**< Response code indicating a general error while processing the - * issued command. - */ - PIMA_RESPONSE_SessionNotOpen = 3, /**< Response code indicating that the sent command requires an open - * session before being issued. - */ - PIMA_RESPONSE_InvalidTransaction = 4, /**< Response code indicating an invalid transaction occurred. */ - PIMA_RESPONSE_OperationNotSupported = 5, /**< Response code indicating that the issued command is not supported - * by the attached device. - */ - PIMA_RESPONSE_ParameterNotSupported = 6, /**< Response code indicating that one or more of the issued command's - * parameters are not supported by the device. - */ + SI_PIMA_RESPONSE_OK = 1, /**< Response code indicating no error in the issued command. */ + SI_PIMA_RESPONSE_GeneralError = 2, /**< Response code indicating a general error while processing the + * issued command. + */ + SI_PIMA_RESPONSE_SessionNotOpen = 3, /**< Response code indicating that the sent command requires an open + * session before being issued. + */ + SI_PIMA_RESPONSE_InvalidTransaction = 4, /**< Response code indicating an invalid transaction occurred. */ + SI_PIMA_RESPONSE_OperationNotSupported = 5, /**< Response code indicating that the issued command is not supported + * by the attached device. + */ + SI_PIMA_RESPONSE_ParameterNotSupported = 6, /**< Response code indicating that one or more of the issued command's + * parameters are not supported by the device. + */ }; /* Type Defines: */ diff --git a/LUFA/Drivers/USB/Class/Device/CDC.c b/LUFA/Drivers/USB/Class/Device/CDC.c index a5a296deb..44d1caa09 100644 --- a/LUFA/Drivers/USB/Class/Device/CDC.c +++ b/LUFA/Drivers/USB/Class/Device/CDC.c @@ -51,7 +51,7 @@ void CDC_Device_ProcessControlRequest(USB_ClassInfo_CDC_Device_t* const CDCInter switch (USB_ControlRequest.bRequest) { - case REQ_GetLineEncoding: + case CDC_REQ_GetLineEncoding: if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE)) { Endpoint_ClearSETUP(); @@ -60,7 +60,7 @@ void CDC_Device_ProcessControlRequest(USB_ClassInfo_CDC_Device_t* const CDCInter } break; - case REQ_SetLineEncoding: + case CDC_REQ_SetLineEncoding: if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE)) { Endpoint_ClearSETUP(); @@ -71,7 +71,7 @@ void CDC_Device_ProcessControlRequest(USB_ClassInfo_CDC_Device_t* const CDCInter } break; - case REQ_SetControlLineState: + case CDC_REQ_SetControlLineState: if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE)) { Endpoint_ClearSETUP(); @@ -83,7 +83,7 @@ void CDC_Device_ProcessControlRequest(USB_ClassInfo_CDC_Device_t* const CDCInter } break; - case REQ_SendBreak: + case CDC_REQ_SendBreak: if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE)) { Endpoint_ClearSETUP(); @@ -248,7 +248,7 @@ void CDC_Device_SendControlLineStateChange(USB_ClassInfo_CDC_Device_t* const CDC USB_Request_Header_t Notification = (USB_Request_Header_t) { .bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE), - .bRequest = NOTIF_SerialState, + .bRequest = CDC_NOTIF_SerialState, .wValue = 0, .wIndex = 0, .wLength = sizeof(CDCInterfaceInfo->State.ControlLineStates.DeviceToHost), diff --git a/LUFA/Drivers/USB/Class/Device/HID.c b/LUFA/Drivers/USB/Class/Device/HID.c index 1953d9fbc..5111eba59 100644 --- a/LUFA/Drivers/USB/Class/Device/HID.c +++ b/LUFA/Drivers/USB/Class/Device/HID.c @@ -45,7 +45,7 @@ void HID_Device_ProcessControlRequest(USB_ClassInfo_HID_Device_t* const HIDInter switch (USB_ControlRequest.bRequest) { - case REQ_GetReport: + case HID_REQ_GetReport: if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE)) { uint16_t ReportSize = 0; @@ -68,7 +68,7 @@ void HID_Device_ProcessControlRequest(USB_ClassInfo_HID_Device_t* const HIDInter } break; - case REQ_SetReport: + case HID_REQ_SetReport: if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE)) { uint16_t ReportSize = USB_ControlRequest.wLength; @@ -84,7 +84,7 @@ void HID_Device_ProcessControlRequest(USB_ClassInfo_HID_Device_t* const HIDInter } break; - case REQ_GetProtocol: + case HID_REQ_GetProtocol: if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE)) { Endpoint_ClearSETUP(); @@ -94,7 +94,7 @@ void HID_Device_ProcessControlRequest(USB_ClassInfo_HID_Device_t* const HIDInter } break; - case REQ_SetProtocol: + case HID_REQ_SetProtocol: if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE)) { Endpoint_ClearSETUP(); @@ -104,7 +104,7 @@ void HID_Device_ProcessControlRequest(USB_ClassInfo_HID_Device_t* const HIDInter } break; - case REQ_SetIdle: + case HID_REQ_SetIdle: if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE)) { Endpoint_ClearSETUP(); @@ -114,7 +114,7 @@ void HID_Device_ProcessControlRequest(USB_ClassInfo_HID_Device_t* const HIDInter } break; - case REQ_GetIdle: + case HID_REQ_GetIdle: if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE)) { Endpoint_ClearSETUP(); @@ -158,7 +158,7 @@ void HID_Device_USBTask(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo) memset(ReportINData, 0, sizeof(ReportINData)); - bool ForceSend = CALLBACK_HID_Device_CreateHIDReport(HIDInterfaceInfo, &ReportID, REPORT_ITEM_TYPE_In, + bool ForceSend = CALLBACK_HID_Device_CreateHIDReport(HIDInterfaceInfo, &ReportID, HID_REPORT_ITEM_In, ReportINData, &ReportINSize); bool StatesChanged = false; bool IdlePeriodElapsed = (HIDInterfaceInfo->State.IdleCount && !(HIDInterfaceInfo->State.IdleMSRemaining)); diff --git a/LUFA/Drivers/USB/Class/Device/HID.h b/LUFA/Drivers/USB/Class/Device/HID.h index 638dac159..e90f15d1f 100644 --- a/LUFA/Drivers/USB/Class/Device/HID.h +++ b/LUFA/Drivers/USB/Class/Device/HID.h @@ -156,7 +156,7 @@ * \param[in,out] ReportID If preset to a non-zero value, this is the report ID being requested by the host. If zero, * this should be set to the report ID of the generated HID input report (if any). If multiple * reports are not sent via the given HID interface, this parameter should be ignored. - * \param[in] ReportType Type of HID report to generate, either \ref REPORT_ITEM_TYPE_In or \ref REPORT_ITEM_TYPE_Feature. + * \param[in] ReportType Type of HID report to generate, either \ref HID_REPORT_ITEM_In or \ref HID_REPORT_ITEM_Feature. * \param[out] ReportData Pointer to a buffer where the generated HID report should be stored. * \param[out] ReportSize Number of bytes in the generated input report, or zero if no report is to be sent. * @@ -177,7 +177,7 @@ * \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class configuration and state. * \param[in] ReportID Report ID of the received output report. If multiple reports are not received via the given HID * interface, this parameter should be ignored. - * \param[in] ReportType Type of received HID report, either \ref REPORT_ITEM_TYPE_Out or \ref REPORT_ITEM_TYPE_Feature. + * \param[in] ReportType Type of received HID report, either \ref HID_REPORT_ITEM_Out or \ref HID_REPORT_ITEM_Feature. * \param[in] ReportData Pointer to a buffer where the received HID report is stored. * \param[in] ReportSize Size in bytes of the received report from the host. */ diff --git a/LUFA/Drivers/USB/Class/Device/MassStorage.c b/LUFA/Drivers/USB/Class/Device/MassStorage.c index 096a222c2..06ad2c85a 100644 --- a/LUFA/Drivers/USB/Class/Device/MassStorage.c +++ b/LUFA/Drivers/USB/Class/Device/MassStorage.c @@ -48,7 +48,7 @@ void MS_Device_ProcessControlRequest(USB_ClassInfo_MS_Device_t* const MSInterfac switch (USB_ControlRequest.bRequest) { - case REQ_MassStorageReset: + case MS_REQ_MassStorageReset: if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE)) { Endpoint_ClearSETUP(); @@ -58,7 +58,7 @@ void MS_Device_ProcessControlRequest(USB_ClassInfo_MS_Device_t* const MSInterfac } break; - case REQ_GetMaxLUN: + case MS_REQ_GetMaxLUN: if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE)) { Endpoint_ClearSETUP(); @@ -107,12 +107,12 @@ void MS_Device_USBTask(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo) Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataINEndpointNumber); MSInterfaceInfo->State.CommandStatus.Status = CALLBACK_MS_Device_SCSICommandReceived(MSInterfaceInfo) ? - SCSI_Command_Pass : SCSI_Command_Fail; + MS_SCSI_COMMAND_Pass : MS_SCSI_COMMAND_Fail; MSInterfaceInfo->State.CommandStatus.Signature = MS_CSW_SIGNATURE; MSInterfaceInfo->State.CommandStatus.Tag = MSInterfaceInfo->State.CommandBlock.Tag; MSInterfaceInfo->State.CommandStatus.DataTransferResidue = MSInterfaceInfo->State.CommandBlock.DataTransferLength; - if ((MSInterfaceInfo->State.CommandStatus.Status == SCSI_Command_Fail) && + if ((MSInterfaceInfo->State.CommandStatus.Status == MS_SCSI_COMMAND_Fail) && (MSInterfaceInfo->State.CommandStatus.DataTransferResidue)) { Endpoint_StallTransaction(); diff --git a/LUFA/Drivers/USB/Class/Device/RNDIS.c b/LUFA/Drivers/USB/Class/Device/RNDIS.c index ea9e8cf99..394827ed2 100644 --- a/LUFA/Drivers/USB/Class/Device/RNDIS.c +++ b/LUFA/Drivers/USB/Class/Device/RNDIS.c @@ -77,7 +77,7 @@ void RNDIS_Device_ProcessControlRequest(USB_ClassInfo_RNDIS_Device_t* const RNDI switch (USB_ControlRequest.bRequest) { - case REQ_SendEncapsulatedCommand: + case RNDIS_REQ_SendEncapsulatedCommand: if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE)) { Endpoint_ClearSETUP(); @@ -88,7 +88,7 @@ void RNDIS_Device_ProcessControlRequest(USB_ClassInfo_RNDIS_Device_t* const RNDI } break; - case REQ_GetEncapsulatedResponse: + case RNDIS_REQ_GetEncapsulatedResponse: if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE)) { RNDIS_Message_Header_t* MessageHeader = (RNDIS_Message_Header_t*)&RNDISInterfaceInfo->State.RNDISMessageBuffer; diff --git a/LUFA/Drivers/USB/Class/Host/CDC.c b/LUFA/Drivers/USB/Class/Host/CDC.c index b9e4c9ebf..5a87c77ee 100644 --- a/LUFA/Drivers/USB/Class/Host/CDC.c +++ b/LUFA/Drivers/USB/Class/Host/CDC.c @@ -212,7 +212,7 @@ void CDC_Host_USBTask(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo) USB_Request_Header_t Notification; Pipe_Read_Stream_LE(&Notification, sizeof(USB_Request_Header_t), NO_STREAM_CALLBACK); - if ((Notification.bRequest == NOTIF_SerialState) && + if ((Notification.bRequest == CDC_NOTIF_SerialState) && (Notification.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))) { Pipe_Read_Stream_LE(&CDCInterfaceInfo->State.ControlLineStates.DeviceToHost, @@ -239,7 +239,7 @@ uint8_t CDC_Host_SetLineEncoding(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInf USB_ControlRequest = (USB_Request_Header_t) { .bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE), - .bRequest = REQ_SetLineEncoding, + .bRequest = CDC_REQ_SetLineEncoding, .wValue = 0, .wIndex = CDCInterfaceInfo->State.ControlInterfaceNumber, .wLength = sizeof(CDCInterfaceInfo->State.LineEncoding), @@ -255,7 +255,7 @@ uint8_t CDC_Host_SendControlLineStateChange(USB_ClassInfo_CDC_Host_t* const CDCI USB_ControlRequest = (USB_Request_Header_t) { .bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE), - .bRequest = REQ_SetControlLineState, + .bRequest = CDC_REQ_SetControlLineState, .wValue = CDCInterfaceInfo->State.ControlLineStates.HostToDevice, .wIndex = CDCInterfaceInfo->State.ControlInterfaceNumber, .wLength = 0, @@ -272,7 +272,7 @@ uint8_t CDC_Host_SendBreak(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo, USB_ControlRequest = (USB_Request_Header_t) { .bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE), - .bRequest = REQ_SendBreak, + .bRequest = CDC_REQ_SendBreak, .wValue = Duration, .wIndex = CDCInterfaceInfo->State.ControlInterfaceNumber, .wLength = 0, diff --git a/LUFA/Drivers/USB/Class/Host/HID.c b/LUFA/Drivers/USB/Class/Host/HID.c index 0642ecd40..bbb32cb55 100644 --- a/LUFA/Drivers/USB/Class/Host/HID.c +++ b/LUFA/Drivers/USB/Class/Host/HID.c @@ -62,12 +62,10 @@ uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo (CurrentHIDInterface->Protocol != HIDInterfaceInfo->Config.HIDInterfaceProtocol)); HIDInterfaceInfo->State.InterfaceNumber = CurrentHIDInterface->InterfaceNumber; - HIDInterfaceInfo->State.SupportsBootProtocol = (CurrentHIDInterface->SubClass != HID_NON_BOOT_PROTOCOL); + HIDInterfaceInfo->State.SupportsBootProtocol = (CurrentHIDInterface->SubClass != HID_BOOTP_NonBootProtocol); if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, DCOMP_HID_NextHID) != DESCRIPTOR_SEARCH_COMP_Found) - { - return HID_ENUMERROR_NoHIDDescriptorFound; - } + return HID_ENUMERROR_NoHIDDescriptorFound; HIDInterfaceInfo->State.HIDReportSize = DESCRIPTOR_CAST(ConfigDescriptorData, USB_HID_Descriptor_HID_t).HIDReportLength; @@ -127,7 +125,7 @@ static uint8_t DCOMP_HID_Host_NextHIDInterface(void* const CurrentDescriptor) static uint8_t DCOMP_HID_NextHID(void* const CurrentDescriptor) { - if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_HID) + if (DESCRIPTOR_TYPE(CurrentDescriptor) == HID_DTYPE_HID) return DESCRIPTOR_SEARCH_Found; else if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface) return DESCRIPTOR_SEARCH_Fail; @@ -161,10 +159,10 @@ uint8_t HID_Host_ReceiveReportByID(USB_ClassInfo_HID_Host_t* const HIDInterfaceI USB_ControlRequest = (USB_Request_Header_t) { .bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE), - .bRequest = REQ_SetReport, - .wValue = ((REPORT_ITEM_TYPE_In + 1) << 8) | ReportID, + .bRequest = HID_REQ_SetReport, + .wValue = ((HID_REPORT_ITEM_In + 1) << 8) | ReportID, .wIndex = HIDInterfaceInfo->State.InterfaceNumber, - .wLength = USB_GetHIDReportSize(HIDInterfaceInfo->Config.HIDParserData, ReportID, REPORT_ITEM_TYPE_In), + .wLength = USB_GetHIDReportSize(HIDInterfaceInfo->Config.HIDParserData, ReportID, HID_REPORT_ITEM_In), }; Pipe_SelectPipe(PIPE_CONTROLPIPE); @@ -198,7 +196,7 @@ uint8_t HID_Host_ReceiveReport(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo, *(BufferPos++) = ReportID; } - ReportSize = USB_GetHIDReportSize(HIDInterfaceInfo->Config.HIDParserData, ReportID, REPORT_ITEM_TYPE_In); + ReportSize = USB_GetHIDReportSize(HIDInterfaceInfo->Config.HIDParserData, ReportID, HID_REPORT_ITEM_In); } else #endif @@ -227,7 +225,7 @@ uint8_t HID_Host_SendReportByID(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo if ((USB_HostState != HOST_STATE_Configured) || !(HIDInterfaceInfo->State.IsActive)) return false; - if (HIDInterfaceInfo->State.DeviceUsesOUTPipe && (ReportType == REPORT_ITEM_TYPE_Out)) + if (HIDInterfaceInfo->State.DeviceUsesOUTPipe && (ReportType == HID_REPORT_ITEM_Out)) { uint8_t ErrorCode; @@ -251,7 +249,7 @@ uint8_t HID_Host_SendReportByID(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo USB_ControlRequest = (USB_Request_Header_t) { .bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE), - .bRequest = REQ_SetReport, + .bRequest = HID_REQ_SetReport, #if !defined(HID_HOST_BOOT_PROTOCOL_ONLY) .wValue = ((ReportType + 1) << 8) | ReportID, #else @@ -291,7 +289,7 @@ uint8_t HID_Host_SetBootProtocol(USB_ClassInfo_HID_Host_t* const HIDInterfaceInf USB_ControlRequest = (USB_Request_Header_t) { .bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE), - .bRequest = REQ_SetProtocol, + .bRequest = HID_REQ_SetProtocol, .wValue = 0, .wIndex = HIDInterfaceInfo->State.InterfaceNumber, .wLength = 0, @@ -322,7 +320,7 @@ uint8_t HID_Host_SetReportProtocol(USB_ClassInfo_HID_Host_t* const HIDInterfaceI { .bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_INTERFACE), .bRequest = REQ_GetDescriptor, - .wValue = (DTYPE_Report << 8), + .wValue = (HID_DTYPE_Report << 8), .wIndex = HIDInterfaceInfo->State.InterfaceNumber, .wLength = HIDInterfaceInfo->State.HIDReportSize, }; @@ -337,7 +335,7 @@ uint8_t HID_Host_SetReportProtocol(USB_ClassInfo_HID_Host_t* const HIDInterfaceI USB_ControlRequest = (USB_Request_Header_t) { .bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE), - .bRequest = REQ_SetProtocol, + .bRequest = HID_REQ_SetProtocol, .wValue = 1, .wIndex = HIDInterfaceInfo->State.InterfaceNumber, .wLength = 0, diff --git a/LUFA/Drivers/USB/Class/Host/HID.h b/LUFA/Drivers/USB/Class/Host/HID.h index 88d16640c..914d43278 100644 --- a/LUFA/Drivers/USB/Class/Host/HID.h +++ b/LUFA/Drivers/USB/Class/Host/HID.h @@ -92,9 +92,8 @@ bool DataOUTPipeDoubleBank; /**< Indicates if the HID interface's OUT data pipe should use double banking. */ uint8_t HIDInterfaceProtocol; /**< HID interface protocol value to match against if a specific - * boot subclass protocol is required, either \ref HID_BOOT_MOUSE_PROTOCOL, - * \ref HID_BOOT_KEYBOARD_PROTOCOL or \ref HID_NON_BOOT_PROTOCOL if any - * HID device should be enumerated by the interface. + * boot subclass protocol is required, a value from the \ref HID_BootProtocols_t + * enum. */ #if !defined(HID_HOST_BOOT_PROTOCOL_ONLY) HID_ReportInfo_t* HIDParserData; /**< HID parser data to store the parsed HID report data, when boot protocol @@ -212,7 +211,7 @@ * * \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class host configuration and state. * \param[in] ReportID Report ID of the report to send to the device, or 0 if the device does not use report IDs. - * \param[in] ReportType Type of report to issue to the device, either \ref REPORT_ITEM_TYPE_Out or \ref REPORT_ITEM_TYPE_Feature. + * \param[in] ReportType Type of report to issue to the device, either \ref HID_REPORT_ITEM_Out or \ref HID_REPORT_ITEM_Feature. * \param[in] Buffer Buffer containing the report to send to the attached device. * \param[in] ReportSize Report size in bytes to send to the attached device. * diff --git a/LUFA/Drivers/USB/Class/Host/HIDParser.c b/LUFA/Drivers/USB/Class/Host/HIDParser.c index 49f9452ba..58ee00059 100644 --- a/LUFA/Drivers/USB/Class/Host/HIDParser.c +++ b/LUFA/Drivers/USB/Class/Host/HIDParser.c @@ -244,11 +244,11 @@ uint8_t USB_ProcessHIDReport(const uint8_t* ReportData, uint8_t ItemTag = (HIDReportItem & TAG_MASK); if (ItemTag == TAG_MAIN_INPUT) - NewReportItem.ItemType = REPORT_ITEM_TYPE_In; + NewReportItem.ItemType = HID_REPORT_ITEM_In; else if (ItemTag == TAG_MAIN_OUTPUT) - NewReportItem.ItemType = REPORT_ITEM_TYPE_Out; + NewReportItem.ItemType = HID_REPORT_ITEM_Out; else - NewReportItem.ItemType = REPORT_ITEM_TYPE_Feature; + NewReportItem.ItemType = HID_REPORT_ITEM_Feature; NewReportItem.BitOffset = CurrReportIDInfo->ReportSizeBits[NewReportItem.ItemType]; diff --git a/LUFA/Drivers/USB/Class/Host/MassStorage.c b/LUFA/Drivers/USB/Class/Host/MassStorage.c index dfa954c5c..0366703bb 100644 --- a/LUFA/Drivers/USB/Class/Host/MassStorage.c +++ b/LUFA/Drivers/USB/Class/Host/MassStorage.c @@ -284,7 +284,7 @@ static uint8_t MS_Host_GetReturnedStatus(USB_ClassInfo_MS_Host_t* const MSInterf Pipe_ClearIN(); Pipe_Freeze(); - if (SCSICommandStatus->Status != SCSI_Command_Pass) + if (SCSICommandStatus->Status != MS_SCSI_COMMAND_Pass) ErrorCode = MS_ERROR_LOGICAL_CMD_FAILED; return ErrorCode; diff --git a/LUFA/Drivers/USB/Class/Host/RNDIS.c b/LUFA/Drivers/USB/Class/Host/RNDIS.c index cddd5cbb5..b3d0f3070 100644 --- a/LUFA/Drivers/USB/Class/Host/RNDIS.c +++ b/LUFA/Drivers/USB/Class/Host/RNDIS.c @@ -202,7 +202,7 @@ static uint8_t RNDIS_SendEncapsulatedCommand(USB_ClassInfo_RNDIS_Host_t* const R USB_ControlRequest = (USB_Request_Header_t) { .bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE), - .bRequest = REQ_SendEncapsulatedCommand, + .bRequest = RNDIS_REQ_SendEncapsulatedCommand, .wValue = 0, .wIndex = RNDISInterfaceInfo->State.ControlInterfaceNumber, .wLength = Length, @@ -219,7 +219,7 @@ static uint8_t RNDIS_GetEncapsulatedResponse(USB_ClassInfo_RNDIS_Host_t* const R USB_ControlRequest = (USB_Request_Header_t) { .bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE), - .bRequest = REQ_GetEncapsulatedResponse, + .bRequest = RNDIS_REQ_GetEncapsulatedResponse, .wValue = 0, .wIndex = RNDISInterfaceInfo->State.ControlInterfaceNumber, .wLength = Length, diff --git a/LUFA/Drivers/USB/Class/Host/StillImage.c b/LUFA/Drivers/USB/Class/Host/StillImage.c index e08fc76af..3883d3bad 100644 --- a/LUFA/Drivers/USB/Class/Host/StillImage.c +++ b/LUFA/Drivers/USB/Class/Host/StillImage.c @@ -36,9 +36,9 @@ #define __INCLUDE_FROM_SI_DRIVER #include "StillImage.h" -uint8_t SImage_Host_ConfigurePipes(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, - uint16_t ConfigDescriptorSize, - void* DeviceConfigDescriptor) +uint8_t SI_Host_ConfigurePipes(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, + uint16_t ConfigDescriptorSize, + void* DeviceConfigDescriptor) { uint8_t FoundEndpoints = 0; @@ -145,8 +145,8 @@ uint8_t DCOMP_SI_Host_NextSIInterfaceEndpoint(void* const CurrentDescriptor) return DESCRIPTOR_SEARCH_NotFound; } -uint8_t SImage_Host_SendBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, - SI_PIMA_Container_t* const PIMAHeader) +uint8_t SI_Host_SendBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, + SI_PIMA_Container_t* const PIMAHeader) { uint8_t ErrorCode; @@ -176,8 +176,8 @@ uint8_t SImage_Host_SendBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceIn return PIPE_RWSTREAM_NoError; } -uint8_t SImage_Host_ReceiveBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, - SI_PIMA_Container_t* const PIMAHeader) +uint8_t SI_Host_ReceiveBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, + SI_PIMA_Container_t* const PIMAHeader) { uint16_t TimeoutMSRem = COMMAND_DATA_TIMEOUT_MS; uint16_t PreviousFrameNumber = USB_Host_GetFrameNumber(); @@ -226,7 +226,7 @@ uint8_t SImage_Host_ReceiveBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfac Pipe_Read_Stream_LE(PIMAHeader, PIMA_COMMAND_SIZE(0), NO_STREAM_CALLBACK); - if (PIMAHeader->Type == CType_ResponseBlock) + if (PIMAHeader->Type == SI_PIMA_CONTAINER_ResponseBlock) { uint8_t ParamBytes = (PIMAHeader->DataLength - PIMA_COMMAND_SIZE(0)); @@ -241,9 +241,9 @@ uint8_t SImage_Host_ReceiveBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfac return PIPE_RWSTREAM_NoError; } -uint8_t SImage_Host_SendData(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, - void* Buffer, - const uint16_t Bytes) +uint8_t SI_Host_SendData(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, + void* Buffer, + const uint16_t Bytes) { uint8_t ErrorCode; @@ -261,9 +261,9 @@ uint8_t SImage_Host_SendData(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, return ErrorCode; } -uint8_t SImage_Host_ReadData(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, - void* Buffer, - const uint16_t Bytes) +uint8_t SI_Host_ReadData(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, + void* Buffer, + const uint16_t Bytes) { uint8_t ErrorCode; @@ -280,7 +280,7 @@ uint8_t SImage_Host_ReadData(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, return ErrorCode; } -bool SImage_Host_IsEventReceived(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) +bool SI_Host_IsEventReceived(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) { bool IsEventReceived = false; @@ -298,8 +298,8 @@ bool SImage_Host_IsEventReceived(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) return IsEventReceived; } -uint8_t SImage_Host_ReceiveEventHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, - SI_PIMA_Container_t* const PIMAHeader) +uint8_t SI_Host_ReceiveEventHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, + SI_PIMA_Container_t* const PIMAHeader) { uint8_t ErrorCode; @@ -317,7 +317,7 @@ uint8_t SImage_Host_ReceiveEventHeader(USB_ClassInfo_SI_Host_t* const SIInterfac return ErrorCode; } -uint8_t SImage_Host_OpenSession(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) +uint8_t SI_Host_OpenSession(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) { if ((USB_HostState != HOST_STATE_Configured) || !(SIInterfaceInfo->State.IsActive)) return HOST_SENDCONTROL_DeviceDisconnected; @@ -328,20 +328,20 @@ uint8_t SImage_Host_OpenSession(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) SIInterfaceInfo->State.IsSessionOpen = false; SI_PIMA_Container_t PIMABlock = (SI_PIMA_Container_t) - { - .DataLength = PIMA_COMMAND_SIZE(1), - .Type = CType_CommandBlock, - .Code = 0x1002, - .Params = {1}, - }; - - if ((ErrorCode = SImage_Host_SendBlockHeader(SIInterfaceInfo, &PIMABlock)) != PIPE_RWSTREAM_NoError) + { + .DataLength = PIMA_COMMAND_SIZE(1), + .Type = SI_PIMA_CONTAINER_CommandBlock, + .Code = 0x1002, + .Params = {1}, + }; + + if ((ErrorCode = SI_Host_SendBlockHeader(SIInterfaceInfo, &PIMABlock)) != PIPE_RWSTREAM_NoError) return ErrorCode; - if ((ErrorCode = SImage_Host_ReceiveBlockHeader(SIInterfaceInfo, &PIMABlock)) != PIPE_RWSTREAM_NoError) + if ((ErrorCode = SI_Host_ReceiveBlockHeader(SIInterfaceInfo, &PIMABlock)) != PIPE_RWSTREAM_NoError) return ErrorCode; - if ((PIMABlock.Type != CType_ResponseBlock) || (PIMABlock.Code != 0x2001)) + if ((PIMABlock.Type != SI_PIMA_CONTAINER_ResponseBlock) || (PIMABlock.Code != 0x2001)) return SI_ERROR_LOGICAL_CMD_FAILED; SIInterfaceInfo->State.IsSessionOpen = true; @@ -349,7 +349,7 @@ uint8_t SImage_Host_OpenSession(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) return PIPE_RWSTREAM_NoError; } -uint8_t SImage_Host_CloseSession(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) +uint8_t SI_Host_CloseSession(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) { if ((USB_HostState != HOST_STATE_Configured) || !(SIInterfaceInfo->State.IsActive)) return HOST_SENDCONTROL_DeviceDisconnected; @@ -357,31 +357,31 @@ uint8_t SImage_Host_CloseSession(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) uint8_t ErrorCode; SI_PIMA_Container_t PIMABlock = (SI_PIMA_Container_t) - { - .DataLength = PIMA_COMMAND_SIZE(1), - .Type = CType_CommandBlock, - .Code = 0x1003, - .Params = {1}, - }; - - if ((ErrorCode = SImage_Host_SendBlockHeader(SIInterfaceInfo, &PIMABlock)) != PIPE_RWSTREAM_NoError) + { + .DataLength = PIMA_COMMAND_SIZE(1), + .Type = SI_PIMA_CONTAINER_CommandBlock, + .Code = 0x1003, + .Params = {1}, + }; + + if ((ErrorCode = SI_Host_SendBlockHeader(SIInterfaceInfo, &PIMABlock)) != PIPE_RWSTREAM_NoError) return ErrorCode; - if ((ErrorCode = SImage_Host_ReceiveBlockHeader(SIInterfaceInfo, &PIMABlock)) != PIPE_RWSTREAM_NoError) + if ((ErrorCode = SI_Host_ReceiveBlockHeader(SIInterfaceInfo, &PIMABlock)) != PIPE_RWSTREAM_NoError) return ErrorCode; SIInterfaceInfo->State.IsSessionOpen = false; - if ((PIMABlock.Type != CType_ResponseBlock) || (PIMABlock.Code != 0x2001)) + if ((PIMABlock.Type != SI_PIMA_CONTAINER_ResponseBlock) || (PIMABlock.Code != 0x2001)) return SI_ERROR_LOGICAL_CMD_FAILED; return PIPE_RWSTREAM_NoError; } -uint8_t SImage_Host_SendCommand(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, - const uint16_t Operation, - const uint8_t TotalParams, - uint32_t* const Params) +uint8_t SI_Host_SendCommand(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, + const uint16_t Operation, + const uint8_t TotalParams, + uint32_t* const Params) { if ((USB_HostState != HOST_STATE_Configured) || !(SIInterfaceInfo->State.IsActive)) return HOST_SENDCONTROL_DeviceDisconnected; @@ -389,21 +389,21 @@ uint8_t SImage_Host_SendCommand(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, uint8_t ErrorCode; SI_PIMA_Container_t PIMABlock = (SI_PIMA_Container_t) - { - .DataLength = PIMA_COMMAND_SIZE(TotalParams), - .Type = CType_CommandBlock, - .Code = Operation, - }; + { + .DataLength = PIMA_COMMAND_SIZE(TotalParams), + .Type = SI_PIMA_CONTAINER_CommandBlock, + .Code = Operation, + }; memcpy(&PIMABlock.Params, Params, sizeof(uint32_t) * TotalParams); - if ((ErrorCode = SImage_Host_SendBlockHeader(SIInterfaceInfo, &PIMABlock)) != PIPE_RWSTREAM_NoError) + if ((ErrorCode = SI_Host_SendBlockHeader(SIInterfaceInfo, &PIMABlock)) != PIPE_RWSTREAM_NoError) return ErrorCode; return PIPE_RWSTREAM_NoError; } -uint8_t SImage_Host_ReceiveResponse(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) +uint8_t SI_Host_ReceiveResponse(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) { uint8_t ErrorCode; SI_PIMA_Container_t PIMABlock; @@ -411,10 +411,10 @@ uint8_t SImage_Host_ReceiveResponse(USB_ClassInfo_SI_Host_t* const SIInterfaceIn if ((USB_HostState != HOST_STATE_Configured) || !(SIInterfaceInfo->State.IsActive)) return HOST_SENDCONTROL_DeviceDisconnected; - if ((ErrorCode = SImage_Host_ReceiveBlockHeader(SIInterfaceInfo, &PIMABlock)) != PIPE_RWSTREAM_NoError) + if ((ErrorCode = SI_Host_ReceiveBlockHeader(SIInterfaceInfo, &PIMABlock)) != PIPE_RWSTREAM_NoError) return ErrorCode; - if ((PIMABlock.Type != CType_ResponseBlock) || (PIMABlock.Code != 0x2001)) + if ((PIMABlock.Type != SI_PIMA_CONTAINER_ResponseBlock) || (PIMABlock.Code != 0x2001)) return SI_ERROR_LOGICAL_CMD_FAILED; return PIPE_RWSTREAM_NoError; diff --git a/LUFA/Drivers/USB/Class/Host/StillImage.h b/LUFA/Drivers/USB/Class/Host/StillImage.h index a15091b6a..c215f1072 100644 --- a/LUFA/Drivers/USB/Class/Host/StillImage.h +++ b/LUFA/Drivers/USB/Class/Host/StillImage.h @@ -97,7 +97,7 @@ struct { bool IsActive; /**< Indicates if the current interface instance is connected to an attached device, valid - * after \ref SImage_Host_ConfigurePipes() is called and the Host state machine is in the + * after \ref SI_Host_ConfigurePipes() is called and the Host state machine is in the * Configured state. */ @@ -114,7 +114,7 @@ } USB_ClassInfo_SI_Host_t; /* Enums: */ - /** Enum for the possible error codes returned by the \ref SImage_Host_ConfigurePipes() function. */ + /** Enum for the possible error codes returned by the \ref SI_Host_ConfigurePipes() function. */ enum SIHost_EnumerationFailure_ErrorCodes_t { SI_ENUMERROR_NoError = 0, /**< Configuration Descriptor was processed successfully. */ @@ -140,9 +140,9 @@ * * \return A value from the \ref SIHost_EnumerationFailure_ErrorCodes_t enum. */ - uint8_t SImage_Host_ConfigurePipes(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, - uint16_t ConfigDescriptorSize, - void* DeviceConfigDescriptor) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(3); + uint8_t SI_Host_ConfigurePipes(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, + uint16_t ConfigDescriptorSize, + void* DeviceConfigDescriptor) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(3); /** Opens a new PIMA session with the attached device. This should be used before any session-orientated PIMA commands * are issued to the device. Only one session can be open at the one time. @@ -155,7 +155,7 @@ * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum, or \ref SI_ERROR_LOGICAL_CMD_FAILED if the device * returned a logical command failure. */ - uint8_t SImage_Host_OpenSession(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); + uint8_t SI_Host_OpenSession(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); /** Closes an already opened PIMA session with the attached device. This should be used after all session-orientated * PIMA commands have been issued to the device. @@ -168,7 +168,7 @@ * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum, or \ref SI_ERROR_LOGICAL_CMD_FAILED if the device * returned a logical command failure. */ - uint8_t SImage_Host_CloseSession(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); + uint8_t SI_Host_CloseSession(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); /** Sends a raw PIMA block header to the device, filling out the transaction ID automatically. This can be used to send * arbitrary PIMA blocks to the device with or without parameters. @@ -181,9 +181,9 @@ * * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. */ - uint8_t SImage_Host_SendBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, - SI_PIMA_Container_t* const PIMAHeader) ATTR_NON_NULL_PTR_ARG(1) - ATTR_NON_NULL_PTR_ARG(2); + uint8_t SI_Host_SendBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, + SI_PIMA_Container_t* const PIMAHeader) ATTR_NON_NULL_PTR_ARG(1) + ATTR_NON_NULL_PTR_ARG(2); /** Receives a raw PIMA block header to the device. This can be used to receive arbitrary PIMA blocks from the device with * or without parameters. @@ -196,9 +196,9 @@ * * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. */ - uint8_t SImage_Host_ReceiveBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, - SI_PIMA_Container_t* const PIMAHeader) ATTR_NON_NULL_PTR_ARG(1) - ATTR_NON_NULL_PTR_ARG(2); + uint8_t SI_Host_ReceiveBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, + SI_PIMA_Container_t* const PIMAHeader) ATTR_NON_NULL_PTR_ARG(1) + ATTR_NON_NULL_PTR_ARG(2); /** Sends a given PIMA command to the attached device, filling out the PIMA command header's Transaction ID automatically. * @@ -213,10 +213,10 @@ * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum, or \ref SI_ERROR_LOGICAL_CMD_FAILED if the device * returned a logical command failure. */ - uint8_t SImage_Host_SendCommand(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, - const uint16_t Operation, - const uint8_t TotalParams, - uint32_t* const Params) ATTR_NON_NULL_PTR_ARG(1); + uint8_t SI_Host_SendCommand(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, + const uint16_t Operation, + const uint8_t TotalParams, + uint32_t* const Params) ATTR_NON_NULL_PTR_ARG(1); /** Receives and checks a response block from the attached PIMA device, once a command has been issued and all data * associated with the command has been transferred. @@ -229,7 +229,7 @@ * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum, or \ref SI_ERROR_LOGICAL_CMD_FAILED if the device * returned a logical command failure. */ - uint8_t SImage_Host_ReceiveResponse(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); + uint8_t SI_Host_ReceiveResponse(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); /** Indicates if the device has issued a PIMA event block to the host via the asynchronous events pipe. * @@ -240,7 +240,7 @@ * * \return Boolean true if an event is waiting to be read, false otherwise. */ - bool SImage_Host_IsEventReceived(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); + bool SI_Host_IsEventReceived(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); /** Receives an asynchronous event block from the device via the asynchronous events pipe. * @@ -253,9 +253,9 @@ * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum, or \ref SI_ERROR_LOGICAL_CMD_FAILED if the device * returned a logical command failure. */ - uint8_t SImage_Host_ReceiveEventHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, - SI_PIMA_Container_t* const PIMAHeader) ATTR_NON_NULL_PTR_ARG(1) - ATTR_NON_NULL_PTR_ARG(2); + uint8_t SI_Host_ReceiveEventHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, + SI_PIMA_Container_t* const PIMAHeader) ATTR_NON_NULL_PTR_ARG(1) + ATTR_NON_NULL_PTR_ARG(2); /** Sends arbitrary data to the attached device, for use in the data phase of PIMA commands which require data * transfer beyond the regular PIMA command block parameters. @@ -269,9 +269,9 @@ * * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. */ - uint8_t SImage_Host_SendData(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, - void* Buffer, - const uint16_t Bytes) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); + uint8_t SI_Host_SendData(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, + void* Buffer, + const uint16_t Bytes) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); /** Receives arbitrary data from the attached device, for use in the data phase of PIMA commands which require data * transfer beyond the regular PIMA command block parameters. @@ -285,9 +285,9 @@ * * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. */ - uint8_t SImage_Host_ReadData(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, - void* Buffer, - const uint16_t Bytes) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); + uint8_t SI_Host_ReadData(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, + void* Buffer, + const uint16_t Bytes) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); /* Inline Functions: */ /** General management task for a given Still Image host class interface, required for the correct operation of the @@ -296,8 +296,8 @@ * * \param[in,out] SIInterfaceInfo Pointer to a structure containing a Still Image Class host configuration and state. */ - static inline void SImage_Host_USBTask(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - static inline void SImage_Host_USBTask(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) + static inline void SI_Host_USBTask(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); + static inline void SI_Host_USBTask(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) { (void)SIInterfaceInfo; } diff --git a/LUFA/Drivers/USB/HighLevel/StdDescriptors.h b/LUFA/Drivers/USB/HighLevel/StdDescriptors.h index 433947997..00b60c3d3 100644 --- a/LUFA/Drivers/USB/HighLevel/StdDescriptors.h +++ b/LUFA/Drivers/USB/HighLevel/StdDescriptors.h @@ -198,7 +198,7 @@ * \see The USB specification for more details on the possible Endpoint usage attributes. */ #define ENDPOINT_USAGE_IMPLICIT_FEEDBACK (2 << 4) - + /* Enums: */ /** Enum for the possible standard descriptor types, as given in each descriptor's header. */ enum USB_DescriptorTypes_t @@ -212,6 +212,8 @@ DTYPE_Other = 0x07, /**< Indicates that the descriptor is of other type. */ DTYPE_InterfacePower = 0x08, /**< Indicates that the descriptor is an interface power descriptor. */ DTYPE_InterfaceAssociation = 0x0B, /**< Indicates that the descriptor is an interface association descriptor. */ + DTYPE_CSInterface = 0x24, /**< Indicates that the descriptor is a class specific interface descriptor. */ + DTYPE_CSEndpoint = 0x25, /**< Indicates that the descriptor is a class specific endpoint descriptor. */ }; /* Type Defines: */ |