3      Copyright (C) Dean Camera, 2014. 
   5   dean [at] fourwalledcubicle [dot] com 
  10   Copyright 2014  Dean Camera (dean [at] fourwalledcubicle [dot] com) 
  12   Permission to use, copy, modify, distribute, and sell this 
  13   software and its documentation for any purpose is hereby granted 
  14   without fee, provided that the above copyright notice appear in 
  15   all copies and that both that the copyright notice and this 
  16   permission notice and warranty disclaimer appear in supporting 
  17   documentation, and that the name of the author not be used in 
  18   advertising or publicity pertaining to distribution of the 
  19   software without specific, written prior permission. 
  21   The author disclaims all warranties with regard to this 
  22   software, including all implied warranties of merchantability 
  23   and fitness.  In no event shall the author be liable for any 
  24   special, indirect or consequential damages or any damages 
  25   whatsoever resulting from loss of use, data or profits, whether 
  26   in an action of contract, negligence or other tortious action, 
  27   arising out of or in connection with the use or performance of 
  32  *  \brief Common standard USB Descriptor definitions for all architectures. 
  33  *  \copydetails Group_StdDescriptors 
  35  *  \note This file should not be included directly. It is automatically included as needed by the USB driver 
  36  *        dispatch header located in LUFA/Drivers/USB/USB.h. 
  39 /** \ingroup Group_USB 
  40  *  \defgroup Group_StdDescriptors USB Descriptors 
  41  *  \brief Standard USB Descriptor definitions. 
  43  *  Standard USB device descriptor defines and retrieval routines, for USB devices. This module contains 
  44  *  structures and macros for the easy creation of standard USB descriptors in USB device projects. 
  49 #ifndef __USBDESCRIPTORS_H__ 
  50 #define __USBDESCRIPTORS_H__ 
  53                 #include "../../../Common/Common.h" 
  57         /* Enable C linkage for C++ Compilers: */ 
  58                 #if defined(__cplusplus) 
  62         /* Preprocessor Checks: */ 
  63                 #if !defined(__INCLUDE_FROM_USB_DRIVER) 
  64                         #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. 
  67         /* Public Interface - May be used in end-application: */ 
  69                         /** Indicates that a given descriptor does not exist in the device. This can be used inside descriptors 
  70                          *  for string descriptor indexes, or may be use as a return value for GetDescriptor when the specified 
  71                          *  descriptor does not exist. 
  73                         #define NO_DESCRIPTOR                     0 
  75                         /** Macro to calculate the power value for the configuration descriptor, from a given number of milliamperes. 
  77                          *  \param[in] mA  Maximum number of milliamps the device consumes when the given configuration is selected. 
  79                         #define USB_CONFIG_POWER_MA(mA)           ((mA) >> 1) 
  81                         /** Macro to calculate the Unicode length of a string with a given number of Unicode characters. 
  82                          *  Should be used in string descriptor's headers for giving the string descriptor's byte length. 
  84                          *  \param[in] UnicodeChars  Number of Unicode characters in the string text. 
  86                         #define USB_STRING_LEN(UnicodeChars)      (sizeof(USB_Descriptor_Header_t) + ((UnicodeChars) << 1)) 
  88                         /** Convenience macro to easily create \ref USB_Descriptor_String_t instances from a wide character string. 
  90                          *  \note This macro is for little-endian systems only. 
  92                          *  \param[in] String  String to initialize a USB String Descriptor structure with. 
  94                         #define USB_STRING_DESCRIPTOR(String)     { .Header = {.Size = sizeof(USB_Descriptor_Header_t) + (sizeof(String) - 2), .Type = DTYPE_String}, .UnicodeString = String } 
  96                         /** Convenience macro to easily create \ref USB_Descriptor_String_t instances from an array of characters. 
  98                          *  \param[in] ...  Characters to initialize a USB String Descriptor structure with. 
 100                         #define USB_STRING_DESCRIPTOR_ARRAY(...)  { .Header = {.Size = sizeof(USB_Descriptor_Header_t) + sizeof((uint16_t){__VA_ARGS__}), .Type = DTYPE_String}, .UnicodeString = {__VA_ARGS__} } 
 102                         /** Macro to encode a given major/minor/revision version number into Binary Coded Decimal format for descriptor 
 103                          *  fields requiring BCD encoding, such as the USB version number in the standard device descriptor. 
 105                          *  \note This value is automatically converted into Little Endian, suitable for direct use inside device 
 106                          *        descriptors on all architectures without endianness conversion macros. 
 108                          *  \param[in]  Major     Major version number to encode. 
 109                          *  \param[in]  Minor     Minor version number to encode. 
 110                          *  \param[in]  Revision  Revision version number to encode. 
 112                         #define VERSION_BCD(Major, Minor, Revision) \ 
 113                                                                   CPU_TO_LE16( ((Major & 0xFF) << 8) | \ 
 114                                                                                ((Minor & 0x0F) << 4) | \ 
 117                         /** String language ID for the English language. Should be used in \ref USB_Descriptor_String_t descriptors 
 118                          *  to indicate that the English language is supported by the device in its string descriptors. 
 120                         #define LANGUAGE_ID_ENG                   0x0409 
 122                         /** \name USB Configuration Descriptor Attribute Masks */ 
 124                         /** Mask for the reserved bit in the Configuration Descriptor's \c ConfigAttributes field, which must be set on all 
 125                          *  devices for historical purposes. 
 127                         #define USB_CONFIG_ATTR_RESERVED          0x80 
 129                         /** Can be masked with other configuration descriptor attributes for a \ref USB_Descriptor_Configuration_Header_t 
 130                          *  descriptor's \c ConfigAttributes value to indicate that the specified configuration can draw its power 
 131                          *  from the device's own power source. 
 133                         #define USB_CONFIG_ATTR_SELFPOWERED       0x40 
 135                         /** Can be masked with other configuration descriptor attributes for a \ref USB_Descriptor_Configuration_Header_t 
 136                          *  descriptor's \c ConfigAttributes value to indicate that the specified configuration supports the 
 137                          *  remote wakeup feature of the USB standard, allowing a suspended USB device to wake up the host upon 
 140                         #define USB_CONFIG_ATTR_REMOTEWAKEUP      0x20 
 143                         /** \name Endpoint Descriptor Attribute Masks */ 
 145                         /** Can be masked with other endpoint descriptor attributes for a \ref USB_Descriptor_Endpoint_t descriptor's 
 146                          *  \c Attributes value to indicate that the specified endpoint is not synchronized. 
 148                          *  \see The USB specification for more details on the possible Endpoint attributes. 
 150                         #define ENDPOINT_ATTR_NO_SYNC             (0 << 2) 
 152                         /** Can be masked with other endpoint descriptor attributes for a \ref USB_Descriptor_Endpoint_t descriptor's 
 153                          *  \c Attributes value to indicate that the specified endpoint is asynchronous. 
 155                          *  \see The USB specification for more details on the possible Endpoint attributes. 
 157                         #define ENDPOINT_ATTR_ASYNC               (1 << 2) 
 159                         /** Can be masked with other endpoint descriptor attributes for a \ref USB_Descriptor_Endpoint_t descriptor's 
 160                          *  \c Attributes value to indicate that the specified endpoint is adaptive. 
 162                          *  \see The USB specification for more details on the possible Endpoint attributes. 
 164                         #define ENDPOINT_ATTR_ADAPTIVE            (2 << 2) 
 166                         /** Can be masked with other endpoint descriptor attributes for a \ref USB_Descriptor_Endpoint_t descriptor's 
 167                          *  \c Attributes value to indicate that the specified endpoint is synchronized. 
 169                          *  \see The USB specification for more details on the possible Endpoint attributes. 
 171                         #define ENDPOINT_ATTR_SYNC                (3 << 2) 
 174                         /** \name Endpoint Descriptor Usage Masks */ 
 176                         /** Can be masked with other endpoint descriptor attributes for a \ref USB_Descriptor_Endpoint_t descriptor's 
 177                          *  \c Attributes value to indicate that the specified endpoint is used for data transfers. 
 179                          *  \see The USB specification for more details on the possible Endpoint usage attributes. 
 181                         #define ENDPOINT_USAGE_DATA               (0 << 4) 
 183                         /** Can be masked with other endpoint descriptor attributes for a \ref USB_Descriptor_Endpoint_t descriptor's 
 184                          *  \c Attributes value to indicate that the specified endpoint is used for feedback. 
 186                          *  \see The USB specification for more details on the possible Endpoint usage attributes. 
 188                         #define ENDPOINT_USAGE_FEEDBACK           (1 << 4) 
 190                         /** Can be masked with other endpoint descriptor attributes for a \ref USB_Descriptor_Endpoint_t descriptor's 
 191                          *  \c Attributes value to indicate that the specified endpoint is used for implicit feedback. 
 193                          *  \see The USB specification for more details on the possible Endpoint usage attributes. 
 195                         #define ENDPOINT_USAGE_IMPLICIT_FEEDBACK  (2 << 4) 
 199                         /** Enum for the possible standard descriptor types, as given in each descriptor's header. */ 
 200                         enum USB_DescriptorTypes_t
 
 202                                 DTYPE_Device                    
= 0x01, /**< Indicates that the descriptor is a device descriptor. */ 
 203                                 DTYPE_Configuration             
= 0x02, /**< Indicates that the descriptor is a configuration descriptor. */ 
 204                                 DTYPE_String                    
= 0x03, /**< Indicates that the descriptor is a string descriptor. */ 
 205                                 DTYPE_Interface                 
= 0x04, /**< Indicates that the descriptor is an interface descriptor. */ 
 206                                 DTYPE_Endpoint                  
= 0x05, /**< Indicates that the descriptor is an endpoint descriptor. */ 
 207                                 DTYPE_DeviceQualifier           
= 0x06, /**< Indicates that the descriptor is a device qualifier descriptor. */ 
 208                                 DTYPE_Other                     
= 0x07, /**< Indicates that the descriptor is of other type. */ 
 209                                 DTYPE_InterfacePower            
= 0x08, /**< Indicates that the descriptor is an interface power descriptor. */ 
 210                                 DTYPE_InterfaceAssociation      
= 0x0B, /**< Indicates that the descriptor is an interface association descriptor. */ 
 211                                 DTYPE_CSInterface               
= 0x24, /**< Indicates that the descriptor is a class specific interface descriptor. */ 
 212                                 DTYPE_CSEndpoint                
= 0x25, /**< Indicates that the descriptor is a class specific endpoint descriptor. */ 
 215                         /** Enum for possible Class, Subclass and Protocol values of device and interface descriptors. */ 
 216                         enum USB_Descriptor_ClassSubclassProtocol_t
 
 218                                 USB_CSCP_NoDeviceClass          
= 0x00, /**< Descriptor Class value indicating that the device does not belong 
 219                                                                          *   to a particular class at the device level. 
 221                                 USB_CSCP_NoDeviceSubclass       
= 0x00, /**< Descriptor Subclass value indicating that the device does not belong 
 222                                                                          *   to a particular subclass at the device level. 
 224                                 USB_CSCP_NoDeviceProtocol       
= 0x00, /**< Descriptor Protocol value indicating that the device does not belong 
 225                                                                          *   to a particular protocol at the device level. 
 227                                 USB_CSCP_VendorSpecificClass    
= 0xFF, /**< Descriptor Class value indicating that the device/interface belongs 
 228                                                                          *   to a vendor specific class. 
 230                                 USB_CSCP_VendorSpecificSubclass 
= 0xFF, /**< Descriptor Subclass value indicating that the device/interface belongs 
 231                                                                          *   to a vendor specific subclass. 
 233                                 USB_CSCP_VendorSpecificProtocol 
= 0xFF, /**< Descriptor Protocol value indicating that the device/interface belongs 
 234                                                                          *   to a vendor specific protocol. 
 236                                 USB_CSCP_IADDeviceClass         
= 0xEF, /**< Descriptor Class value indicating that the device belongs to the 
 237                                                                          *   Interface Association Descriptor class. 
 239                                 USB_CSCP_IADDeviceSubclass      
= 0x02, /**< Descriptor Subclass value indicating that the device belongs to the 
 240                                                                          *   Interface Association Descriptor subclass. 
 242                                 USB_CSCP_IADDeviceProtocol      
= 0x01, /**< Descriptor Protocol value indicating that the device belongs to the 
 243                                                                          *   Interface Association Descriptor protocol. 
 248                         /** \brief Standard USB Descriptor Header (LUFA naming conventions). 
 250              *  Type define for all descriptors' standard header, indicating the descriptor's length and type. This structure 
 251                          *  uses LUFA-specific element names to make each element's purpose clearer. 
 253                          *  \see \ref USB_StdDescriptor_Header_t for the version of this type with standard element names. 
 255                          *  \note Regardless of CPU architecture, these values should be stored as little endian. 
 259                                 uint8_t Size
; /**< Size of the descriptor, in bytes. */ 
 260                                 uint8_t Type
; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a value 
 261                                                *   given by the specific class. 
 263                         } ATTR_PACKED USB_Descriptor_Header_t
; 
 265                         /** \brief Standard USB Descriptor Header (USB-IF naming conventions). 
 267                          *  Type define for all descriptors' standard header, indicating the descriptor's length and type. This structure 
 268                          *  uses the relevant standard's given element names to ensure compatibility with the standard. 
 270                          *  \see \ref USB_Descriptor_Header_t for the version of this type with non-standard LUFA specific element names. 
 272                          *  \note Regardless of CPU architecture, these values should be stored as little endian. 
 276                                 uint8_t bLength
; /**< Size of the descriptor, in bytes. */ 
 277                                 uint8_t bDescriptorType
; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a value 
 278                                                           *   given by the specific class. 
 280                         } ATTR_PACKED USB_StdDescriptor_Header_t
; 
 282                         /** \brief Standard USB Device Descriptor (LUFA naming conventions). 
 284                          *  Type define for a standard Device Descriptor. This structure uses LUFA-specific element names to make each 
 285                          *  element's purpose clearer. 
 287                          *  \see \ref USB_StdDescriptor_Device_t for the version of this type with standard element names. 
 289                          *  \note Regardless of CPU architecture, these values should be stored as little endian. 
 293                                 USB_Descriptor_Header_t Header
; /**< Descriptor header, including type and size. */ 
 295                                 uint16_t USBSpecification
; /**< BCD of the supported USB specification. 
 297                                                             *   \see \ref VERSION_BCD() utility macro. 
 299                                 uint8_t  Class
; /**< USB device class. */ 
 300                                 uint8_t  SubClass
; /**< USB device subclass. */ 
 301                                 uint8_t  Protocol
; /**< USB device protocol. */ 
 303                                 uint8_t  Endpoint0Size
; /**< Size of the control (address 0) endpoint's bank in bytes. */ 
 305                                 uint16_t VendorID
; /**< Vendor ID for the USB product. */ 
 306                                 uint16_t ProductID
; /**< Unique product ID for the USB product. */ 
 307                                 uint16_t ReleaseNumber
; /**< Product release (version) number. 
 309                                                          *   \see \ref VERSION_BCD() utility macro. 
 311                                 uint8_t  ManufacturerStrIndex
; /**< String index for the manufacturer's name. The 
 312                                                                 *   host will request this string via a separate 
 313                                                                 *   control request for the string descriptor. 
 315                                                                 *   \note If no string supplied, use \ref NO_DESCRIPTOR. 
 317                                 uint8_t  ProductStrIndex
; /**< String index for the product name/details. 
 319                                                            *  \see ManufacturerStrIndex structure entry. 
 321                                 uint8_t  SerialNumStrIndex
; /**< String index for the product's globally unique hexadecimal 
 322                                                              *   serial number, in uppercase Unicode ASCII. 
 324                                                              *  \note On some microcontroller models, there is an embedded serial number 
 325                                                              *        in the chip which can be used for the device serial number. 
 326                                                              *        To use this serial number, set this to \c USE_INTERNAL_SERIAL. 
 327                                                              *        On unsupported devices, this will evaluate to \ref NO_DESCRIPTOR 
 328                                                              *        and will cause the host to generate a pseudo-unique value for the 
 329                                                              *        device upon insertion. 
 331                                                              *  \see \c ManufacturerStrIndex structure entry. 
 333                                 uint8_t  NumberOfConfigurations
; /**< Total number of configurations supported by 
 336                         } ATTR_PACKED USB_Descriptor_Device_t
; 
 338                         /** \brief Standard USB Device Descriptor (USB-IF naming conventions). 
 340                          *  Type define for a standard Device Descriptor. This structure uses the relevant standard's given element names 
 341                          *  to ensure compatibility with the standard. 
 343                          *  \see \ref USB_Descriptor_Device_t for the version of this type with non-standard LUFA specific element names. 
 345                          *  \note Regardless of CPU architecture, these values should be stored as little endian. 
 349                                 uint8_t  bLength
; /**< Size of the descriptor, in bytes. */ 
 350                                 uint8_t  bDescriptorType
; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a value 
 351                                                               *   given by the specific class. 
 353                                 uint16_t bcdUSB
; /**< BCD of the supported USB specification. 
 355                                                   *   \see \ref VERSION_BCD() utility macro. 
 357                                 uint8_t  bDeviceClass
; /**< USB device class. */ 
 358                                 uint8_t  bDeviceSubClass
; /**< USB device subclass. */ 
 359                                 uint8_t  bDeviceProtocol
; /**< USB device protocol. */ 
 360                                 uint8_t  bMaxPacketSize0
; /**< Size of the control (address 0) endpoint's bank in bytes. */ 
 361                                 uint16_t idVendor
; /**< Vendor ID for the USB product. */ 
 362                                 uint16_t idProduct
; /**< Unique product ID for the USB product. */ 
 363                                 uint16_t bcdDevice
; /**< Product release (version) number. 
 365                                                      *   \see \ref VERSION_BCD() utility macro. 
 367                                 uint8_t  iManufacturer
; /**< String index for the manufacturer's name. The 
 368                                                          *   host will request this string via a separate 
 369                                                          *   control request for the string descriptor. 
 371                                                          *   \note If no string supplied, use \ref NO_DESCRIPTOR. 
 373                                 uint8_t  iProduct
; /**< String index for the product name/details. 
 375                                                     *  \see ManufacturerStrIndex structure entry. 
 377                                 uint8_t iSerialNumber
; /**< String index for the product's globally unique hexadecimal 
 378                                                         *   serial number, in uppercase Unicode ASCII. 
 380                                                         *  \note On some microcontroller models, there is an embedded serial number 
 381                                                         *        in the chip which can be used for the device serial number. 
 382                                                         *        To use this serial number, set this to \c USE_INTERNAL_SERIAL. 
 383                                                         *        On unsupported devices, this will evaluate to \ref NO_DESCRIPTOR 
 384                                                         *        and will cause the host to generate a pseudo-unique value for the 
 385                                                         *        device upon insertion. 
 387                                                         *  \see \c ManufacturerStrIndex structure entry. 
 389                                 uint8_t  bNumConfigurations
; /**< Total number of configurations supported by 
 392                         } ATTR_PACKED USB_StdDescriptor_Device_t
; 
 394                         /** \brief Standard USB Device Qualifier Descriptor (LUFA naming conventions). 
 396                          *  Type define for a standard Device Qualifier Descriptor. This structure uses LUFA-specific element names 
 397                          *  to make each element's purpose clearer. 
 399                          *  \see \ref USB_StdDescriptor_DeviceQualifier_t for the version of this type with standard element names. 
 403                                 USB_Descriptor_Header_t Header
; /**< Descriptor header, including type and size. */ 
 405                                 uint16_t USBSpecification
; /**< BCD of the supported USB specification. 
 407                                                             *   \see \ref VERSION_BCD() utility macro. 
 409                                 uint8_t  Class
; /**< USB device class. */ 
 410                                 uint8_t  SubClass
; /**< USB device subclass. */ 
 411                                 uint8_t  Protocol
; /**< USB device protocol. */ 
 413                                 uint8_t  Endpoint0Size
; /**< Size of the control (address 0) endpoint's bank in bytes. */ 
 414                                 uint8_t  NumberOfConfigurations
; /**< Total number of configurations supported by 
 417                                 uint8_t  Reserved
; /**< Reserved for future use, must be 0. */ 
 418                         } ATTR_PACKED USB_Descriptor_DeviceQualifier_t
; 
 420                         /** \brief Standard USB Device Qualifier Descriptor (USB-IF naming conventions). 
 422                          *  Type define for a standard Device Qualifier Descriptor. This structure uses the relevant standard's given element names 
 423                          *  to ensure compatibility with the standard. 
 425                          *  \see \ref USB_Descriptor_DeviceQualifier_t for the version of this type with non-standard LUFA specific element names. 
 429                                 uint8_t  bLength
; /**< Size of the descriptor, in bytes. */ 
 430                                 uint8_t  bDescriptorType
; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a value 
 431                                                            *   given by the specific class. 
 433                                 uint16_t bcdUSB
; /**< BCD of the supported USB specification. 
 435                                                   *   \see \ref VERSION_BCD() utility macro. 
 437                                 uint8_t  bDeviceClass
; /**< USB device class. */ 
 438                                 uint8_t  bDeviceSubClass
; /**< USB device subclass. */ 
 439                                 uint8_t  bDeviceProtocol
; /**< USB device protocol. */ 
 440                                 uint8_t  bMaxPacketSize0
; /**< Size of the control (address 0) endpoint's bank in bytes. */ 
 441                                 uint8_t  bNumConfigurations
; /**< Total number of configurations supported by 
 444                                 uint8_t  bReserved
; /**< Reserved for future use, must be 0. */ 
 445                         } ATTR_PACKED USB_StdDescriptor_DeviceQualifier_t
; 
 447                         /** \brief Standard USB Configuration Descriptor (LUFA naming conventions). 
 449                          *  Type define for a standard Configuration Descriptor header. This structure uses LUFA-specific element names 
 450                          *  to make each element's purpose clearer. 
 452                          *  \see \ref USB_StdDescriptor_Configuration_Header_t for the version of this type with standard element names. 
 454                          *  \note Regardless of CPU architecture, these values should be stored as little endian. 
 458                                 USB_Descriptor_Header_t Header
; /**< Descriptor header, including type and size. */ 
 460                                 uint16_t TotalConfigurationSize
; /**< Size of the configuration descriptor header, 
 461                                                                   *   and all sub descriptors inside the configuration. 
 463                                 uint8_t  TotalInterfaces
; /**< Total number of interfaces in the configuration. */ 
 465                                 uint8_t  ConfigurationNumber
; /**< Configuration index of the current configuration. */ 
 466                                 uint8_t  ConfigurationStrIndex
; /**< Index of a string descriptor describing the configuration. */ 
 468                                 uint8_t  ConfigAttributes
; /**< Configuration attributes, comprised of a mask of \c USB_CONFIG_ATTR_* masks. 
 469                                                             *   On all devices, this should include USB_CONFIG_ATTR_RESERVED at a minimum. 
 472                                 uint8_t  MaxPowerConsumption
; /**< Maximum power consumption of the device while in the 
 473                                                                *   current configuration, calculated by the \ref USB_CONFIG_POWER_MA() 
 476                         } ATTR_PACKED USB_Descriptor_Configuration_Header_t
; 
 478                         /** \brief Standard USB Configuration Descriptor (USB-IF naming conventions). 
 480                          *  Type define for a standard Configuration Descriptor header. This structure uses the relevant standard's given element names 
 481                          *  to ensure compatibility with the standard. 
 483                          *  \see \ref USB_Descriptor_Device_t for the version of this type with non-standard LUFA specific element names. 
 485                          *  \note Regardless of CPU architecture, these values should be stored as little endian. 
 489                                 uint8_t  bLength
; /**< Size of the descriptor, in bytes. */ 
 490                                 uint8_t  bDescriptorType
; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a value 
 491                                                            *   given by the specific class. 
 493                                 uint16_t wTotalLength
; /**< Size of the configuration descriptor header, 
 494                                                            *   and all sub descriptors inside the configuration. 
 496                                 uint8_t  bNumInterfaces
; /**< Total number of interfaces in the configuration. */ 
 497                                 uint8_t  bConfigurationValue
; /**< Configuration index of the current configuration. */ 
 498                                 uint8_t  iConfiguration
; /**< Index of a string descriptor describing the configuration. */ 
 499                                 uint8_t  bmAttributes
; /**< Configuration attributes, comprised of a mask of \c USB_CONFIG_ATTR_* masks. 
 500                                                         *   On all devices, this should include USB_CONFIG_ATTR_RESERVED at a minimum. 
 502                                 uint8_t  bMaxPower
; /**< Maximum power consumption of the device while in the 
 503                                                      *   current configuration, calculated by the \ref USB_CONFIG_POWER_MA() 
 506                         } ATTR_PACKED USB_StdDescriptor_Configuration_Header_t
; 
 508                         /** \brief Standard USB Interface Descriptor (LUFA naming conventions). 
 510                          *  Type define for a standard Interface Descriptor. This structure uses LUFA-specific element names 
 511                          *  to make each element's purpose clearer. 
 513                          *  \see \ref USB_StdDescriptor_Interface_t for the version of this type with standard element names. 
 515                          *  \note Regardless of CPU architecture, these values should be stored as little endian. 
 519                                 USB_Descriptor_Header_t Header
; /**< Descriptor header, including type and size. */ 
 521                                 uint8_t InterfaceNumber
; /**< Index of the interface in the current configuration. */ 
 522                                 uint8_t AlternateSetting
; /**< Alternate setting for the interface number. The same 
 523                                                            *   interface number can have multiple alternate settings 
 524                                                            *   with different endpoint configurations, which can be 
 525                                                            *   selected by the host. 
 527                                 uint8_t TotalEndpoints
; /**< Total number of endpoints in the interface. */ 
 529                                 uint8_t Class
; /**< Interface class ID. */ 
 530                                 uint8_t SubClass
; /**< Interface subclass ID. */ 
 531                                 uint8_t Protocol
; /**< Interface protocol ID. */ 
 533                                 uint8_t InterfaceStrIndex
; /**< Index of the string descriptor describing the interface. */ 
 534                         } ATTR_PACKED USB_Descriptor_Interface_t
; 
 536                         /** \brief Standard USB Interface Descriptor (USB-IF naming conventions). 
 538                          *  Type define for a standard Interface Descriptor. This structure uses the relevant standard's given element names 
 539                          *  to ensure compatibility with the standard. 
 541                          *  \see \ref USB_Descriptor_Interface_t for the version of this type with non-standard LUFA specific element names. 
 543                          *  \note Regardless of CPU architecture, these values should be stored as little endian. 
 547                                 uint8_t bLength
; /**< Size of the descriptor, in bytes. */ 
 548                                 uint8_t bDescriptorType
; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a value 
 549                                                           *   given by the specific class. 
 551                                 uint8_t bInterfaceNumber
; /**< Index of the interface in the current configuration. */ 
 552                                 uint8_t bAlternateSetting
; /**< Alternate setting for the interface number. The same 
 553                                                             *   interface number can have multiple alternate settings 
 554                                                             *   with different endpoint configurations, which can be 
 555                                                             *   selected by the host. 
 557                                 uint8_t bNumEndpoints
; /**< Total number of endpoints in the interface. */ 
 558                                 uint8_t bInterfaceClass
; /**< Interface class ID. */ 
 559                                 uint8_t bInterfaceSubClass
; /**< Interface subclass ID. */ 
 560                                 uint8_t bInterfaceProtocol
; /**< Interface protocol ID. */ 
 561                                 uint8_t iInterface
; /**< Index of the string descriptor describing the 
 564                         } ATTR_PACKED USB_StdDescriptor_Interface_t
; 
 566                         /** \brief Standard USB Interface Association Descriptor (LUFA naming conventions). 
 568                          *  Type define for a standard Interface Association Descriptor. This structure uses LUFA-specific element names 
 569                          *  to make each element's purpose clearer. 
 571                          *  This descriptor has been added as a supplement to the USB2.0 standard, in the ECN located at 
 572                          *  <a>http://www.usb.org/developers/docs/InterfaceAssociationDescriptor_ecn.pdf</a>. It allows composite 
 573                          *  devices with multiple interfaces related to the same function to have the multiple interfaces bound 
 574                          *  together at the point of enumeration, loading one generic driver for all the interfaces in the single 
 575                          *  function. Read the ECN for more information. 
 577                          *  \see \ref USB_StdDescriptor_Interface_Association_t for the version of this type with standard element names. 
 579                          *  \note Regardless of CPU architecture, these values should be stored as little endian. 
 583                                 USB_Descriptor_Header_t Header
; /**< Descriptor header, including type and size. */ 
 585                                 uint8_t FirstInterfaceIndex
; /**< Index of the first associated interface. */ 
 586                                 uint8_t TotalInterfaces
; /**< Total number of associated interfaces. */ 
 588                                 uint8_t Class
; /**< Interface class ID. */ 
 589                                 uint8_t SubClass
; /**< Interface subclass ID. */ 
 590                                 uint8_t Protocol
; /**< Interface protocol ID. */ 
 592                                 uint8_t IADStrIndex
; /**< Index of the string descriptor describing the 
 593                                                       *   interface association. 
 595                         } ATTR_PACKED USB_Descriptor_Interface_Association_t
; 
 597                         /** \brief Standard USB Interface Association Descriptor (USB-IF naming conventions). 
 599                          *  Type define for a standard Interface Association Descriptor. This structure uses the relevant standard's given 
 600                          *  element names to ensure compatibility with the standard. 
 602                          *  This descriptor has been added as a supplement to the USB2.0 standard, in the ECN located at 
 603                          *  <a>http://www.usb.org/developers/docs/InterfaceAssociationDescriptor_ecn.pdf</a>. It allows composite 
 604                          *  devices with multiple interfaces related to the same function to have the multiple interfaces bound 
 605                          *  together at the point of enumeration, loading one generic driver for all the interfaces in the single 
 606                          *  function. Read the ECN for more information. 
 608                          *  \see \ref USB_Descriptor_Interface_Association_t for the version of this type with non-standard LUFA specific 
 611                          *  \note Regardless of CPU architecture, these values should be stored as little endian. 
 615                                 uint8_t bLength
; /**< Size of the descriptor, in bytes. */ 
 616                                 uint8_t bDescriptorType
; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a value 
 617                                                           *   given by the specific class. 
 619                                 uint8_t bFirstInterface
; /**< Index of the first associated interface. */ 
 620                                 uint8_t bInterfaceCount
; /**< Total number of associated interfaces. */ 
 621                                 uint8_t bFunctionClass
; /**< Interface class ID. */ 
 622                                 uint8_t bFunctionSubClass
; /**< Interface subclass ID. */ 
 623                                 uint8_t bFunctionProtocol
; /**< Interface protocol ID. */ 
 624                                 uint8_t iFunction
; /**< Index of the string descriptor describing the 
 625                                                     *   interface association. 
 627                         } ATTR_PACKED USB_StdDescriptor_Interface_Association_t
; 
 629                         /** \brief Standard USB Endpoint Descriptor (LUFA naming conventions). 
 631                          *  Type define for a standard Endpoint Descriptor. This structure uses LUFA-specific element names 
 632                          *  to make each element's purpose clearer. 
 634                          *  \see \ref USB_StdDescriptor_Endpoint_t for the version of this type with standard element names. 
 636                          *  \note Regardless of CPU architecture, these values should be stored as little endian. 
 640                                 USB_Descriptor_Header_t Header
; /**< Descriptor header, including type and size. */ 
 642                                 uint8_t  EndpointAddress
; /**< Logical address of the endpoint within the device for the current 
 643                                                            *   configuration, including direction mask. 
 645                                 uint8_t  Attributes
; /**< Endpoint attributes, comprised of a mask of the endpoint type (EP_TYPE_*) 
 646                                                       *   and attributes (ENDPOINT_ATTR_*) masks. 
 648                                 uint16_t EndpointSize
; /**< Size of the endpoint bank, in bytes. This indicates the maximum packet 
 649                                                         *   size that the endpoint can receive at a time. 
 651                                 uint8_t  PollingIntervalMS
; /**< Polling interval in milliseconds for the endpoint if it is an INTERRUPT 
 652                                                              *   or ISOCHRONOUS type. 
 654                         } ATTR_PACKED USB_Descriptor_Endpoint_t
; 
 656                         /** \brief Standard USB Endpoint Descriptor (USB-IF naming conventions). 
 658                          *  Type define for a standard Endpoint Descriptor. This structure uses the relevant standard's given 
 659                          *  element names to ensure compatibility with the standard. 
 661                          *  \see \ref USB_Descriptor_Endpoint_t for the version of this type with non-standard LUFA specific 
 664                          *  \note Regardless of CPU architecture, these values should be stored as little endian. 
 668                                 uint8_t  bLength
; /**< Size of the descriptor, in bytes. */ 
 669                                 uint8_t  bDescriptorType
; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a 
 670                                                            *   value given by the specific class. 
 672                                 uint8_t  bEndpointAddress
; /**< Logical address of the endpoint within the device for the current 
 673                                                             *   configuration, including direction mask. 
 675                                 uint8_t  bmAttributes
; /**< Endpoint attributes, comprised of a mask of the endpoint type (EP_TYPE_*) 
 676                                                         *   and attributes (ENDPOINT_ATTR_*) masks. 
 678                                 uint16_t wMaxPacketSize
; /**< Size of the endpoint bank, in bytes. This indicates the maximum packet size 
 679                                                           *   that the endpoint can receive at a time. 
 681                                 uint8_t  bInterval
; /**< Polling interval in milliseconds for the endpoint if it is an INTERRUPT or 
 684                         } ATTR_PACKED USB_StdDescriptor_Endpoint_t
; 
 686                         /** \brief Standard USB String Descriptor (LUFA naming conventions). 
 688                          *  Type define for a standard string descriptor. Unlike other standard descriptors, the length 
 689                          *  of the descriptor for placement in the descriptor header must be determined by the \ref USB_STRING_LEN() 
 690                          *  macro rather than by the size of the descriptor structure, as the length is not fixed. 
 692                          *  This structure should also be used for string index 0, which contains the supported language IDs for 
 693                          *  the device as an array. 
 695                          *  This structure uses LUFA-specific element names to make each element's purpose clearer. 
 697                          *  \see \ref USB_StdDescriptor_String_t for the version of this type with standard element names. 
 699                          *  \note Regardless of CPU architecture, these values should be stored as little endian. 
 703                                 USB_Descriptor_Header_t Header
; /**< Descriptor header, including type and size. */ 
 705                                 #if (((ARCH == ARCH_AVR8) || (ARCH == ARCH_XMEGA)) && !defined(__DOXYGEN__)) 
 706                                 wchar_t  UnicodeString
[]; 
 708                                 uint16_t UnicodeString
[]; /**< String data, as unicode characters (alternatively, 
 709                                                            *   string language IDs). If normal ASCII characters are 
 710                                                            *   to be used, they must be added as an array of characters 
 711                                                            *   rather than a normal C string so that they are widened to 
 714                                                            *   Under GCC, strings prefixed with the "L" character (before 
 715                                                            *   the opening string quotation mark) are considered to be 
 716                                                            *   Unicode strings, and may be used instead of an explicit 
 717                                                            *   array of ASCII characters on little endian devices with 
 718                                                            *   UTF-16-LE \c wchar_t encoding. 
 721                         } ATTR_PACKED USB_Descriptor_String_t
; 
 723                         /** \brief Standard USB String Descriptor (USB-IF naming conventions). 
 725                          *  Type define for a standard string descriptor. Unlike other standard descriptors, the length 
 726                          *  of the descriptor for placement in the descriptor header must be determined by the \ref USB_STRING_LEN() 
 727                          *  macro rather than by the size of the descriptor structure, as the length is not fixed. 
 729                          *  This structure should also be used for string index 0, which contains the supported language IDs for 
 730                          *  the device as an array. 
 732                          *  This structure uses the relevant standard's given element names to ensure compatibility with the standard. 
 734                          *  \see \ref USB_Descriptor_String_t for the version of this type with with non-standard LUFA specific 
 737                          *  \note Regardless of CPU architecture, these values should be stored as little endian. 
 741                                 uint8_t bLength
; /**< Size of the descriptor, in bytes. */ 
 742                                 uint8_t bDescriptorType
; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t 
 743                                                           *   or a value given by the specific class. 
 745                                 uint16_t bString
[]; /**< String data, as unicode characters (alternatively, string language IDs). 
 746                                                      *   If normal ASCII characters are to be used, they must be added as an array 
 747                                                      *   of characters rather than a normal C string so that they are widened to 
 750                                                      *   Under GCC, strings prefixed with the "L" character (before the opening string 
 751                                                      *   quotation mark) are considered to be Unicode strings, and may be used instead 
 752                                                      *   of an explicit array of ASCII characters. 
 754                         } ATTR_PACKED USB_StdDescriptor_String_t
; 
 757         /* Disable C linkage for C++ Compilers: */ 
 758                 #if defined(__cplusplus)