X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/a7eca42996418a7fd87b3411deb368e41615f9a1..77a9df36a77d2523dd2bc24fa17f9f04c6c175c5:/LUFA/Drivers/USB/Core/StdDescriptors.h diff --git a/LUFA/Drivers/USB/Core/StdDescriptors.h b/LUFA/Drivers/USB/Core/StdDescriptors.h index 32777cc0f..1cb85d5cb 100644 --- a/LUFA/Drivers/USB/Core/StdDescriptors.h +++ b/LUFA/Drivers/USB/Core/StdDescriptors.h @@ -54,10 +54,6 @@ #include "USBMode.h" #include "Events.h" - #if defined(USB_CAN_BE_DEVICE) - #include "Device.h" - #endif - /* Enable C linkage for C++ Compilers: */ #if defined(__cplusplus) extern "C" { @@ -93,6 +89,9 @@ * Decimal format for descriptor fields requiring BCD encoding, such as the USB version number in the * standard device descriptor. * + * \note This value is automatically converted into Little Endian, suitable for direct use inside device + * descriptors on all architectures without endianness conversion macros. + * * \param[in] x Version number to encode as a 16-bit little-endian number, as a floating point number. */ #define VERSION_BCD(x) CPU_TO_LE16((((VERSION_TENS(x) << 4) | VERSION_ONES(x)) << 8) | \ @@ -101,7 +100,7 @@ /** 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 CPU_TO_LE16(0x0409) + #define LANGUAGE_ID_ENG 0x0409 /** \name Endpoint Address Direction Masks */ //@{ @@ -251,6 +250,8 @@ * uses LUFA-specific element names to make each element's purpose clearer. * * \see \ref USB_StdDescriptor_Header_t for the version of this type with standard element names. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. */ typedef struct { @@ -266,6 +267,8 @@ * uses the relevant standard's given element names to ensure compatibility with the standard. * * \see \ref USB_Descriptor_Header_t for the version of this type with non-standard LUFA specific element names. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. */ typedef struct { @@ -281,6 +284,8 @@ * element's purpose clearer. * * \see \ref USB_StdDescriptor_Device_t for the version of this type with standard element names. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. */ typedef struct { @@ -330,6 +335,8 @@ * to ensure compatibility with the standard. * * \see \ref USB_Descriptor_Device_t for the version of this type with non-standard LUFA specific element names. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. */ typedef struct { @@ -372,12 +379,61 @@ */ } ATTR_PACKED USB_StdDescriptor_Device_t; + /** \brief Standard USB Device Qualifier Descriptor (LUFA naming conventions). + * + * Type define for a standard Device Qualifier Descriptor. This structure uses LUFA-specific element names + * to make each element's purpose clearer. + * + * \see \ref USB_StdDescriptor_DeviceQualifier_t for the version of this type with standard element names. + */ + typedef struct + { + USB_Descriptor_Header_t Header; /**< Descriptor header, including type and size. */ + + uint16_t USBSpecification; /**< BCD of the supported USB specification. */ + uint8_t Class; /**< USB device class. */ + uint8_t SubClass; /**< USB device subclass. */ + uint8_t Protocol; /**< USB device protocol. */ + + uint8_t Endpoint0Size; /**< Size of the control (address 0) endpoint's bank in bytes. */ + uint8_t NumberOfConfigurations; /**< Total number of configurations supported by + * the device. + */ + uint8_t Reserved; /**< Reserved for future use, must be 0. */ + } ATTR_PACKED USB_Descriptor_DeviceQualifier_t; + + /** \brief Standard USB Device Qualifier Descriptor (USB-IF naming conventions). + * + * Type define for a standard Device Qualifier Descriptor. This structure uses the relevant standard's given element names + * to ensure compatibility with the standard. + * + * \see \ref USB_Descriptor_DeviceQualifier_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. + */ + uint16_t bcdUSB; /**< BCD of the supported USB specification. */ + uint8_t bDeviceClass; /**< USB device class. */ + uint8_t bDeviceSubClass; /**< USB device subclass. */ + uint8_t bDeviceProtocol; /**< USB device protocol. */ + uint8_t bMaxPacketSize0; /**< Size of the control (address 0) endpoint's bank in bytes. */ + uint8_t bNumConfigurations; /**< Total number of configurations supported by + * the device. + */ + uint8_t bReserved; /**< Reserved for future use, must be 0. */ + } ATTR_PACKED USB_StdDescriptor_DeviceQualifier_t; + /** \brief Standard USB Configuration Descriptor (LUFA naming conventions). * * Type define for a standard Configuration Descriptor header. This structure uses LUFA-specific element names * to make each element's purpose clearer. * * \see \ref USB_StdDescriptor_Configuration_Header_t for the version of this type with standard element names. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. */ typedef struct { @@ -407,6 +463,8 @@ * to ensure compatibility with the standard. * * \see \ref USB_Descriptor_Device_t for the version of this type with non-standard LUFA specific element names. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. */ typedef struct { @@ -435,6 +493,8 @@ * to make each element's purpose clearer. * * \see \ref USB_StdDescriptor_Interface_t for the version of this type with standard element names. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. */ typedef struct { @@ -461,6 +521,8 @@ * to ensure compatibility with the standard. * * \see \ref USB_Descriptor_Interface_t for the version of this type with non-standard LUFA specific element names. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. */ typedef struct { @@ -495,6 +557,8 @@ * function. Read the ECN for more information. * * \see \ref USB_StdDescriptor_Interface_Association_t for the version of this type with standard element names. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. */ typedef struct { @@ -525,6 +589,8 @@ * * \see \ref USB_Descriptor_Interface_Association_t for the version of this type with non-standard LUFA specific * element names. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. */ typedef struct { @@ -548,6 +614,8 @@ * to make each element's purpose clearer. * * \see \ref USB_StdDescriptor_Endpoint_t for the version of this type with standard element names. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. */ typedef struct { @@ -574,6 +642,8 @@ * * \see \ref USB_Descriptor_Endpoint_t for the version of this type with non-standard LUFA specific * element names. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. */ typedef struct { @@ -607,22 +677,28 @@ * This structure uses LUFA-specific element names to make each element's purpose clearer. * * \see \ref USB_StdDescriptor_String_t for the version of this type with standard element names. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. */ typedef struct { USB_Descriptor_Header_t Header; /**< Descriptor header, including type and size. */ - wchar_t UnicodeString[]; /**< String data, as unicode characters (alternatively, - * string language IDs). If normal ASCII characters are - * to be used, they must be added as an array of characters - * rather than a normal C string so that they are widened to - * Unicode size. - * - * Under GCC, strings prefixed with the "L" character (before - * the opening string quotation mark) are considered to be - * Unicode strings, and may be used instead of an explicit - * array of ASCII characters. - */ + #if ((ARCH == ARCH_AVR8) || (ARCH == ARCH_XMEGA)) + wchar_t UnicodeString[]; + #else + uint16_t UnicodeString[]; /**< String data, as unicode characters (alternatively, + * string language IDs). If normal ASCII characters are + * to be used, they must be added as an array of characters + * rather than a normal C string so that they are widened to + * Unicode size. + * + * Under GCC, strings prefixed with the "L" character (before + * the opening string quotation mark) are considered to be + * Unicode strings, and may be used instead of an explicit + * array of ASCII characters. + */ + #endif } ATTR_PACKED USB_Descriptor_String_t; /** \brief Standard USB String Descriptor (USB-IF naming conventions). @@ -638,6 +714,8 @@ * * \see \ref USB_Descriptor_String_t for the version of this type with with non-standard LUFA specific * element names. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. */ typedef struct {