*/
/** \file
- * \brief USB standard descriptor definitions.
- *
- * This file contains structures and macros for the easy creation of standard USB descriptors in USB device projects.
+ * \brief Common standard USB Descriptor definitions for all architectures.
+ * \copydetails Group_StdDescriptors
*
* \note This file should not be included directly. It is automatically included as needed by the USB driver
* dispatch header located in LUFA/Drivers/USB/USB.h.
*/
/** \ingroup Group_USB
- * \defgroup Group_Descriptors USB Descriptors
+ * \defgroup Group_StdDescriptors USB Descriptors
+ * \brief Standard USB Descriptor definitions.
*
* Standard USB device descriptor defines and retrieval routines, for USB devices. This module contains
* structures and macros for the easy creation of standard USB descriptors in USB device projects.
* Decimal format for descriptor fields requiring BCD encoding, such as the USB version number in the
* standard device descriptor.
*/
- #define VERSION_BCD(x) ((((VERSION_TENS(x) << 4) | VERSION_ONES(x)) << 8) | \
+ #define VERSION_BCD(x) CPU_TO_LE16((((VERSION_TENS(x) << 4) | VERSION_ONES(x)) << 8) | \
((VERSION_TENTHS(x) << 4) | VERSION_HUNDREDTHS(x)))
/** String language ID for the English language. Should be used in \ref USB_Descriptor_String_t descriptors
* to indicate that the English language is supported by the device in its string descriptors.
*/
- #define LANGUAGE_ID_ENG 0x0409
+ #define LANGUAGE_ID_ENG CPU_TO_LE16(0x0409)
/** \name Endpoint Address Direction Masks */
//@{
uint8_t Type; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a value
* given by the specific class.
*/
- } USB_Descriptor_Header_t;
+ } ATTR_PACKED USB_Descriptor_Header_t;
/** \brief Standard USB Descriptor Header (USB-IF naming conventions).
*
uint8_t bDescriptorType; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a value
* given by the specific class.
*/
- } USB_StdDescriptor_Header_t;
+ } ATTR_PACKED USB_StdDescriptor_Header_t;
/** \brief Standard USB Device Descriptor (LUFA naming conventions).
*
uint8_t SerialNumStrIndex; /**< String index for the product's globally unique hexadecimal
* serial number, in uppercase Unicode ASCII.
*
- * \note On some AVR models, there is an embedded serial number
+ * \note On some microcontroller models, there is an embedded serial number
* in the chip which can be used for the device serial number.
* To use this serial number, set this to USE_INTERNAL_SERIAL.
* On unsupported devices, this will evaluate to 0 and will cause
uint8_t NumberOfConfigurations; /**< Total number of configurations supported by
* the device.
*/
- } USB_Descriptor_Device_t;
+ } ATTR_PACKED USB_Descriptor_Device_t;
/** \brief Standard USB Device Descriptor (USB-IF naming conventions).
*
uint8_t iSerialNumber; /**< String index for the product's globally unique hexadecimal
* serial number, in uppercase Unicode ASCII.
*
- * \note On some AVR models, there is an embedded serial number
+ * \note On some microcontroller models, there is an embedded serial number
* in the chip which can be used for the device serial number.
* To use this serial number, set this to USE_INTERNAL_SERIAL.
* On unsupported devices, this will evaluate to 0 and will cause
uint8_t bNumConfigurations; /**< Total number of configurations supported by
* the device.
*/
- } USB_StdDescriptor_Device_t;
+ } ATTR_PACKED USB_StdDescriptor_Device_t;
/** \brief Standard USB Configuration Descriptor (LUFA naming conventions).
*
* current configuration, calculated by the \ref USB_CONFIG_POWER_MA()
* macro.
*/
- } USB_Descriptor_Configuration_Header_t;
+ } ATTR_PACKED USB_Descriptor_Configuration_Header_t;
/** \brief Standard USB Configuration Descriptor (USB-IF naming conventions).
*
* current configuration, calculated by the \ref USB_CONFIG_POWER_MA()
* macro.
*/
- } USB_StdDescriptor_Configuration_Header_t;
+ } ATTR_PACKED USB_StdDescriptor_Configuration_Header_t;
/** \brief Standard USB Interface Descriptor (LUFA naming conventions).
*
uint8_t Protocol; /**< Interface protocol ID. */
uint8_t InterfaceStrIndex; /**< Index of the string descriptor describing the interface. */
- } USB_Descriptor_Interface_t;
+ } ATTR_PACKED USB_Descriptor_Interface_t;
/** \brief Standard USB Interface Descriptor (USB-IF naming conventions).
*
uint8_t iInterface; /**< Index of the string descriptor describing the
* interface.
*/
- } USB_StdDescriptor_Interface_t;
+ } ATTR_PACKED USB_StdDescriptor_Interface_t;
/** \brief Standard USB Interface Association Descriptor (LUFA naming conventions).
*
uint8_t IADStrIndex; /**< Index of the string descriptor describing the
* interface association.
*/
- } USB_Descriptor_Interface_Association_t;
+ } ATTR_PACKED USB_Descriptor_Interface_Association_t;
/** \brief Standard USB Interface Association Descriptor (USB-IF naming conventions).
*
uint8_t iFunction; /**< Index of the string descriptor describing the
* interface association.
*/
- } USB_StdDescriptor_Interface_Association_t;
+ } ATTR_PACKED USB_StdDescriptor_Interface_Association_t;
/** \brief Standard USB Endpoint Descriptor (LUFA naming conventions).
*
uint8_t PollingIntervalMS; /**< Polling interval in milliseconds for the endpoint if it is an INTERRUPT
* or ISOCHRONOUS type.
*/
- } USB_Descriptor_Endpoint_t;
+ } ATTR_PACKED USB_Descriptor_Endpoint_t;
/** \brief Standard USB Endpoint Descriptor (USB-IF naming conventions).
*
uint8_t bInterval; /**< Polling interval in milliseconds for the endpoint if it is an INTERRUPT or
* ISOCHRONOUS type.
*/
- } USB_StdDescriptor_Endpoint_t;
+ } ATTR_PACKED USB_StdDescriptor_Endpoint_t;
/** \brief Standard USB String Descriptor (LUFA naming conventions).
*
* Unicode strings, and may be used instead of an explicit
* array of ASCII characters.
*/
- } USB_Descriptor_String_t;
+ } ATTR_PACKED USB_Descriptor_String_t;
/** \brief Standard USB String Descriptor (USB-IF naming conventions).
*
* quotation mark) are considered to be Unicode strings, and may be used instead
* of an explicit array of ASCII characters.
*/
- } USB_StdDescriptor_String_t;
+ } ATTR_PACKED USB_StdDescriptor_String_t;
/* Private Interface - For use in library only: */
#if !defined(__DOXYGEN__)