3      Copyright (C) Dean Camera, 2009. 
   5   dean [at] fourwalledcubicle [dot] com 
   6       www.fourwalledcubicle.com 
  10   Copyright 2009  Dean Camera (dean [at] fourwalledcubicle [dot] com) 
  12   Permission to use, copy, modify, and distribute this software 
  13   and its documentation for any purpose and without fee is hereby 
  14   granted, provided that the above copyright notice appear in all 
  15   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 disclaim 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 
  31 /** \ingroup Group_USB 
  32  *  @defgroup Group_Descriptors USB Descriptors 
  34  *  Standard USB device descriptor defines and retrieval routines, for USB devices. This module contains 
  35  *  structures and macros for the easy creation of standard USB descriptors in USB device projects. 
  40 #ifndef __USBDESCRIPTORS_H__ 
  41 #define __USBDESCRIPTORS_H__ 
  44                 #include <avr/pgmspace.h> 
  48                 #include "../../../Common/Common.h" 
  52                 #if defined(USB_CAN_BE_DEVICE) 
  53                         #include "../LowLevel/Device.h" 
  56         /* Enable C linkage for C++ Compilers: */ 
  57                 #if defined(__cplusplus) 
  61         /* Public Interface - May be used in end-application: */ 
  63                         /** Indicates that a given descriptor does not exist in the device. This can be used inside descriptors 
  64                          *  for string descriptor indexes, or may be use as a return value for GetDescriptor when the specified 
  65                          *  descriptor does not exist. 
  67                         #define NO_DESCRIPTOR                     0 
  69                         #if (!defined(NO_INTERNAL_SERIAL) && (defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR))) || defined(__DOXYGEN__) 
  70                                 /** String descriptor index for the device's unique serial number string descriptor within the device. 
  71                                  *  This unique serial number is used by the host to associate resources to the device (such as drivers or COM port 
  72                                  *  number allocations) to a device regardless of the port it is plugged in to on the host. Some USB AVRs contain 
  73                                  *  a unique serial number internally, and setting the device descriptors serial number string index to this value 
  74                                  *  will cause it to use the internal serial number. 
  76                                  *  On unsupported devices, this will evaluate to NO_DESCRIPTOR and so will force the host to create a pseudo-serial 
  77                                  *  number for the device. 
  79                                 #define USE_INTERNAL_SERIAL           0xDC 
  81                                 #define USE_INTERNAL_SERIAL           NO_DESCRIPTOR 
  84                         /** Macro to calculate the power value for the device descriptor, from a given number of milliamps. */ 
  85                         #define USB_CONFIG_POWER_MA(mA)           ((mA) >> 1) 
  87                         /** Macro to calculate the Unicode length of a string with a given number of Unicode characters. 
  88                          *  Should be used in string descriptor's headers for giving the string descriptor's byte length. 
  90                         #define USB_STRING_LEN(str)               (sizeof(USB_Descriptor_Header_t) + ((str) << 1)) 
  92                         /** Macro to encode a given four digit floating point version number (e.g. 01.23) into Binary Coded 
  93                          *  Decimal format for descriptor fields requiring BCD encoding, such as the USB version number in the 
  94                          *  standard device descriptor. 
  96                         #define VERSION_BCD(x)                    ((((VERSION_TENS(x) << 4) | VERSION_ONES(x)) << 8) | \ 
  97                                                                   ((VERSION_TENTHS(x) << 4) | VERSION_HUNDREDTHS(x))) 
  99                         /** String language ID for the English language. Should be used in \ref USB_Descriptor_String_t descriptors 
 100                          *  to indicate that the English language is supported by the device in its string descriptors. 
 102                         #define LANGUAGE_ID_ENG                   0x0409 
 104                         /** Can be masked with an endpoint address for a \ref USB_Descriptor_Endpoint_t endpoint descriptor's 
 105                          *  EndpointAddress value to indicate to the host that the endpoint is of the IN direction (i.e, from 
 108                         #define ENDPOINT_DESCRIPTOR_DIR_IN        0x80 
 110                         /** Can be masked with an endpoint address for a \ref USB_Descriptor_Endpoint_t endpoint descriptor's 
 111                          *  EndpointAddress value to indicate to the host that the endpoint is of the OUT direction (i.e, from 
 114                         #define ENDPOINT_DESCRIPTOR_DIR_OUT       0x00           
 116                         /** Can be masked with other configuration descriptor attributes for a \ref USB_Descriptor_Configuration_Header_t 
 117                          *  descriptor's ConfigAttributes value to indicate that the specified configuration can draw its power 
 118                          *  from the host's VBUS line. 
 120                         #define USB_CONFIG_ATTR_BUSPOWERED        0x80 
 123                         /** Can be masked with other configuration descriptor attributes for a \ref USB_Descriptor_Configuration_Header_t 
 124                          *  descriptor's ConfigAttributes value to indicate that the specified configuration can draw its power 
 125                          *  from the device's own power source. 
 127                         #define USB_CONFIG_ATTR_SELFPOWERED       0xC0 
 129                         /** Can be masked with other configuration descriptor attributes for a \ref USB_Descriptor_Configuration_Header_t 
 130                          *  descriptor's ConfigAttributes value to indicate that the specified configuration supports the 
 131                          *  remote wakeup feature of the USB standard, allowing a suspended USB device to wake up the host upon 
 134                         #define USB_CONFIG_ATTR_REMOTEWAKEUP      0xA0 
 136                         /** Can be masked with other endpoint descriptor attributes for a \ref USB_Descriptor_Endpoint_t descriptor's 
 137                          *  Attributes value to indicate that the specified endpoint is not synchronized. 
 139                          *  \see The USB specification for more details on the possible Endpoint attributes. 
 141                         #define ENDPOINT_ATTR_NO_SYNC             (0 << 2) 
 143                         /** Can be masked with other endpoint descriptor attributes for a \ref USB_Descriptor_Endpoint_t descriptor's 
 144                          *  Attributes value to indicate that the specified endpoint is asynchronous. 
 146                          *  \see The USB specification for more details on the possible Endpoint attributes. 
 148                         #define ENDPOINT_ATTR_ASYNC               (1 << 2) 
 150                         /** Can be masked with other endpoint descriptor attributes for a \ref USB_Descriptor_Endpoint_t descriptor's 
 151                          *  Attributes value to indicate that the specified endpoint is adaptive. 
 153                          *  \see The USB specification for more details on the possible Endpoint attributes. 
 155                         #define ENDPOINT_ATTR_ADAPTIVE            (2 << 2) 
 157                         /** Can be masked with other endpoint descriptor attributes for a \ref USB_Descriptor_Endpoint_t descriptor's 
 158                          *  Attributes value to indicate that the specified endpoint is synchronized. 
 160                          *  \see The USB specification for more details on the possible Endpoint attributes. 
 162                         #define ENDPOINT_ATTR_SYNC                (3 << 2) 
 164                         /** Can be masked with other endpoint descriptor attributes for a \ref USB_Descriptor_Endpoint_t descriptor's 
 165                          *  Attributes value to indicate that the specified endpoint is used for data transfers. 
 167                          *  \see The USB specification for more details on the possible Endpoint usage attributes. 
 169                         #define ENDPOINT_USAGE_DATA               (0 << 4) 
 171                         /** Can be masked with other endpoint descriptor attributes for a \ref USB_Descriptor_Endpoint_t descriptor's 
 172                          *  Attributes value to indicate that the specified endpoint is used for feedback. 
 174                          *  \see The USB specification for more details on the possible Endpoint usage attributes. 
 176                         #define ENDPOINT_USAGE_FEEDBACK           (1 << 4) 
 178                         /** Can be masked with other endpoint descriptor attributes for a \ref USB_Descriptor_Endpoint_t descriptor's 
 179                          *  Attributes value to indicate that the specified endpoint is used for implicit feedback. 
 181                          *  \see The USB specification for more details on the possible Endpoint usage attributes. 
 183                         #define ENDPOINT_USAGE_IMPLICIT_FEEDBACK  (2 << 4) 
 186                         /** Enum for the possible standard descriptor types, as given in each descriptor's header. */ 
 187                         enum USB_DescriptorTypes_t
 
 189                                 DTYPE_Device               
= 0x01, /**< Indicates that the descriptor is a device descriptor. */ 
 190                                 DTYPE_Configuration        
= 0x02, /**< Indicates that the descriptor is a configuration descriptor. */ 
 191                                 DTYPE_String               
= 0x03, /**< Indicates that the descriptor is a string descriptor. */ 
 192                                 DTYPE_Interface            
= 0x04, /**< Indicates that the descriptor is an interface descriptor. */ 
 193                                 DTYPE_Endpoint             
= 0x05, /**< Indicates that the descriptor is an endpoint descriptor. */ 
 194                                 DTYPE_DeviceQualifier      
= 0x06, /**< Indicates that the descriptor is a device qualifier descriptor. */ 
 195                                 DTYPE_Other                
= 0x07, /**< Indicates that the descriptor is of other type. */ 
 196                                 DTYPE_InterfacePower       
= 0x08, /**< Indicates that the descriptor is an interface power descriptor. */ 
 197                                 DTYPE_InterfaceAssociation 
= 0x0B, /**< Indicates that the descriptor is an interface association descriptor. */ 
 201                         /** Type define for all descriptors standard header, indicating the descriptor's length and type. This structure 
 202                          *  uses LUFA-specific element names to make each element's purpose clearer. 
 204                          *  \see \ref USB_StdDescriptor_Header_t for the version of this define with standard element names 
 208                                 uint8_t     Size
; /**< Size of the descriptor, in bytes. */ 
 209                                 uint8_t     Type
; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a value 
 210                                                    *   given by the specific class. 
 212                         } USB_Descriptor_Header_t
; 
 214                         /** Type define for all descriptors standard header, indicating the descriptor's length and type. This structure 
 215                          *  uses the relevant standard's given element names to ensure compatibility with the standard. 
 217                          *  \see \ref USB_Descriptor_Header_t for the version of this define with non-standard LUFA specific element names 
 221                                 uint8_t     bLength
; /**< Size of the descriptor, in bytes. */ 
 222                                 uint8_t     bDescriptorType
; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a value 
 223                                                               *   given by the specific class. 
 225                         } USB_StdDescriptor_Header_t
; 
 227                         /** Type define for a standard Device Descriptor. This structure uses LUFA-specific element names to make each 
 228                          *  element's purpose clearer. 
 230                          *  \see \ref USB_StdDescriptor_Device_t for the version of this define with standard element names 
 234                                 USB_Descriptor_Header_t Header
; /**< Descriptor header, including type and size. */ 
 236                                 uint16_t    USBSpecification
; /**< BCD of the supported USB specification. */ 
 237                                 uint8_t     Class
; /**< USB device class. */ 
 238                                 uint8_t     SubClass
; /**< USB device subclass. */ 
 239                                 uint8_t     Protocol
; /**< USB device protocol. */ 
 241                                 uint8_t     Endpoint0Size
; /**< Size of the control (address 0) endpoint's bank in bytes. */ 
 243                                 uint16_t    VendorID
; /**< Vendor ID for the USB product. */ 
 244                                 uint16_t    ProductID
; /**< Unique product ID for the USB product. */ 
 245                                 uint16_t    ReleaseNumber
; /**< Product release (version) number. */ 
 247                                 uint8_t     ManufacturerStrIndex
; /**< String index for the manufacturer's name. The 
 248                                                                    *   host will request this string via a separate 
 249                                                                    *   control request for the string descriptor. 
 251                                                                    *   \note If no string supplied, use \ref NO_DESCRIPTOR. 
 253                                 uint8_t     ProductStrIndex
; /**< String index for the product name/details. 
 255                                                               *  \see ManufacturerStrIndex structure entry. 
 257                                 uint8_t     SerialNumStrIndex
; /**< String index for the product's globally unique hexadecimal 
 258                                                                 *   serial number, in uppercase Unicode ASCII. 
 260                                                                 *  \note On some AVR models, there is an embedded serial number 
 261                                                                 *        in the chip which can be used for the device serial number. 
 262                                                                 *        To use this serial number, set this to USE_INTERNAL_SERIAL. 
 263                                                                 *        On unsupported devices, this will evaluate to 0 and will cause 
 264                                                                 *        the host to generate a pseudo-unique value for the device upon 
 267                                                                 *  \see ManufacturerStrIndex structure entry. 
 269                                 uint8_t     NumberOfConfigurations
; /**< Total number of configurations supported by 
 272                         } USB_Descriptor_Device_t
; 
 274                         /** Type define for a standard Device Descriptor. This structure uses the relevant standard's given element names 
 275                          *  to ensure compatibility with the standard. 
 277                          *  \see \ref USB_Descriptor_Device_t for the version of this define with non-standard LUFA specific element names 
 281                                 uint8_t     bLength
; /**< Size of the descriptor, in bytes. */ 
 282                                 uint8_t     bDescriptorType
; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a value 
 283                                                               *   given by the specific class. 
 285                                 uint16_t    bcdUSB
; /**< BCD of the supported USB specification. */ 
 286                                 uint8_t     bDeviceClass
; /**< USB device class. */ 
 287                                 uint8_t     bDeviceSubClass
; /**< USB device subclass. */ 
 288                                 uint8_t     bDeviceProtocol
; /**< USB device protocol. */ 
 289                                 uint8_t     bMaxPacketSize0
; /**< Size of the control (address 0) endpoint's bank in bytes. */ 
 290                                 uint16_t    idVendor
; /**< Vendor ID for the USB product. */ 
 291                                 uint16_t    idProduct
; /**< Unique product ID for the USB product. */ 
 292                                 uint16_t    bcdDevice
; /**< Product release (version) number. */ 
 293                                 uint8_t     iManufacturer
; /**< String index for the manufacturer's name. The 
 294                                                             *   host will request this string via a separate 
 295                                                             *   control request for the string descriptor. 
 297                                                             *   \note If no string supplied, use \ref NO_DESCRIPTOR. 
 299                                 uint8_t     iProduct
; /**< String index for the product name/details. 
 301                                                        *  \see ManufacturerStrIndex structure entry. 
 303                                 uint8_t     iSerialNumber
; /**< String index for the product's globally unique hexadecimal 
 304                                                             *   serial number, in uppercase Unicode ASCII. 
 306                                                             *  \note On some AVR models, there is an embedded serial number 
 307                                                             *        in the chip which can be used for the device serial number. 
 308                                                             *        To use this serial number, set this to USE_INTERNAL_SERIAL. 
 309                                                             *        On unsupported devices, this will evaluate to 0 and will cause 
 310                                                             *        the host to generate a pseudo-unique value for the device upon 
 313                                                             *  \see ManufacturerStrIndex structure entry. 
 315                                 uint8_t     bNumConfigurations
; /**< Total number of configurations supported by 
 318                         } USB_StdDescriptor_Device_t
; 
 320                         /** Type define for a standard Configuration Descriptor header. This structure uses LUFA-specific element names 
 321                          *  to make each element's purpose clearer. 
 323                          *  \see \ref USB_StdDescriptor_Configuration_Header_t for the version of this define with standard element names 
 327                                 USB_Descriptor_Header_t Header
; /**< Descriptor header, including type and size. */ 
 329                                 uint16_t    TotalConfigurationSize
; /**< Size of the configuration descriptor header, 
 330                                                                      *   and all sub descriptors inside the configuration. 
 332                                 uint8_t     TotalInterfaces
; /**< Total number of interfaces in the configuration. */ 
 334                                 uint8_t     ConfigurationNumber
; /**< Configuration index of the current configuration. */ 
 335                                 uint8_t     ConfigurationStrIndex
; /**< Index of a string descriptor describing the configuration. */ 
 337                                 uint8_t     ConfigAttributes
; /**< Configuration attributes, comprised of a mask of zero or 
 338                                                                *   more USB_CONFIG_ATTR_* masks. 
 341                                 uint8_t     MaxPowerConsumption
; /**< Maximum power consumption of the device while in the 
 342                                                                   *   current configuration, calculated by the \ref USB_CONFIG_POWER_MA() 
 345                         } USB_Descriptor_Configuration_Header_t
; 
 347                         /** Type define for a standard Configuration Descriptor header. This structure uses the relevant standard's given element names 
 348                          *  to ensure compatibility with the standard. 
 350                          *  \see \ref USB_Descriptor_Device_t for the version of this define with non-standard LUFA specific element names 
 354                                 uint8_t     bLength
; /**< Size of the descriptor, in bytes. */ 
 355                                 uint8_t     bDescriptorType
; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a value 
 356                                                               *   given by the specific class. 
 358                                 uint16_t    wTotalLength
; /**< Size of the configuration descriptor header, 
 359                                                            *   and all sub descriptors inside the configuration. 
 361                                 uint8_t     bNumInterfaces
; /**< Total number of interfaces in the configuration. */ 
 362                                 uint8_t     bConfigurationValue
; /**< Configuration index of the current configuration. */ 
 363                                 uint8_t     iConfiguration
; /**< Index of a string descriptor describing the configuration. */ 
 364                                 uint8_t     bmAttributes
; /**< Configuration attributes, comprised of a mask of zero or 
 365                                                            *   more USB_CONFIG_ATTR_* masks. 
 367                                 uint8_t     bMaxPower
; /**< Maximum power consumption of the device while in the 
 368                                                         *   current configuration, calculated by the \ref USB_CONFIG_POWER_MA() 
 371                         } USB_StdDescriptor_Configuration_Header_t
; 
 373                         /** Type define for a standard Interface Descriptor. This structure uses LUFA-specific element names 
 374                          *  to make each element's purpose clearer. 
 376                          *  \see \ref USB_StdDescriptor_Interface_t for the version of this define with standard element names 
 380                                 USB_Descriptor_Header_t Header
; /**< Descriptor header, including type and size. */ 
 382                                 uint8_t     InterfaceNumber
; /**< Index of the interface in the current configuration. */ 
 383                                 uint8_t     AlternateSetting
; /**< Alternate setting for the interface number. The same 
 384                                                                *   interface number can have multiple alternate settings 
 385                                                                *   with different endpoint configurations, which can be 
 386                                                                *   selected by the host. 
 388                                 uint8_t     TotalEndpoints
; /**< Total number of endpoints in the interface. */ 
 390                                 uint8_t     Class
; /**< Interface class ID. */ 
 391                                 uint8_t     SubClass
; /**< Interface subclass ID. */ 
 392                                 uint8_t     Protocol
; /**< Interface protocol ID. */ 
 394                                 uint8_t     InterfaceStrIndex
; /**< Index of the string descriptor describing the 
 397                         } USB_Descriptor_Interface_t
; 
 399                         /** Type define for a standard Interface Descriptor. This structure uses the relevant standard's given element names 
 400                          *  to ensure compatibility with the standard. 
 402                          *  \see \ref USB_Descriptor_Interface_t for the version of this define with non-standard LUFA specific element names 
 406                                 uint8_t     bLength
; /**< Size of the descriptor, in bytes. */ 
 407                                 uint8_t     bDescriptorType
; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a value 
 408                                                               *   given by the specific class. 
 410                                 uint8_t     bInterfaceNumber
; /**< Index of the interface in the current configuration. */ 
 411                                 uint8_t     bAlternateSetting
; /**< Alternate setting for the interface number. The same 
 412                                                                 *   interface number can have multiple alternate settings 
 413                                                                 *   with different endpoint configurations, which can be 
 414                                                                 *   selected by the host. 
 416                                 uint8_t     bNumEndpoints
; /**< Total number of endpoints in the interface. */ 
 417                                 uint8_t     bInterfaceClass
; /**< Interface class ID. */ 
 418                                 uint8_t     bInterfaceSubClass
; /**< Interface subclass ID. */ 
 419                                 uint8_t     bInterfaceProtocol
; /**< Interface protocol ID. */ 
 420                                 uint8_t     iInterface
; /**< Index of the string descriptor describing the 
 423                         } USB_StdDescriptor_Interface_t
; 
 425                         /** Type define for a standard Interface Association Descriptor. This structure uses LUFA-specific element names 
 426                          *  to make each element's purpose clearer. 
 428                          *  This descriptor has been added as a supplement to the USB2.0 standard, in the ECN located at 
 429                          *  <a>http://www.usb.org/developers/docs/InterfaceAssociationDescriptor_ecn.pdf</a>. It allows compound 
 430                          *  devices with multiple interfaces related to the same function to have the multiple interfaces bound 
 431                          *  together at the point of enumeration, loading one generic driver for all the interfaces in the single 
 432                          *  function. Read the ECN for more information. 
 434                          *  \see \ref USB_StdDescriptor_Interface_Association_t for the version of this define with standard element names 
 438                                 USB_Descriptor_Header_t Header
; /**< Descriptor header, including type and size. */ 
 440                                 uint8_t     FirstInterfaceIndex
; /**< Index of the first associated interface. */ 
 441                                 uint8_t     TotalInterfaces
; /** Total number of associated interfaces. */ 
 443                                 uint8_t     Class
; /**< Interface class ID. */ 
 444                                 uint8_t     SubClass
; /**< Interface subclass ID. */ 
 445                                 uint8_t     Protocol
; /**< Interface protocol ID. */ 
 447                                 uint8_t     IADStrIndex
; /**< Index of the string descriptor describing the 
 448                                                           *   interface association. 
 450                         } USB_Descriptor_Interface_Association_t
; 
 452                         /** Type define for a standard Interface Association Descriptor. This structure uses the relevant standard's given 
 453                          *  element names to ensure compatibility with the standard. 
 455                          *  This descriptor has been added as a supplement to the USB2.0 standard, in the ECN located at 
 456                          *  <a>http://www.usb.org/developers/docs/InterfaceAssociationDescriptor_ecn.pdf</a>. It allows compound 
 457                          *  devices with multiple interfaces related to the same function to have the multiple interfaces bound 
 458                          *  together at the point of enumeration, loading one generic driver for all the interfaces in the single 
 459                          *  function. Read the ECN for more information. 
 461                          *  \see \ref USB_Descriptor_Interface_Association_t for the version of this define with non-standard LUFA specific 
 466                                 uint8_t     bLength
; /**< Size of the descriptor, in bytes. */ 
 467                                 uint8_t     bDescriptorType
; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a value 
 468                                                               *   given by the specific class. 
 470                                 uint8_t     bFirstInterface
; /**< Index of the first associated interface. */ 
 471                                 uint8_t     bInterfaceCount
; /** Total number of associated interfaces. */ 
 472                                 uint8_t     bFunctionClass
; /**< Interface class ID. */ 
 473                                 uint8_t     bFunctionSubClass
; /**< Interface subclass ID. */ 
 474                                 uint8_t     bFunctionProtocol
; /**< Interface protocol ID. */ 
 475                                 uint8_t     iFunction
; /**< Index of the string descriptor describing the 
 476                                                         *   interface association. 
 478                         } USB_StdDescriptor_Interface_Association_t
; 
 480                         /** Type define for a standard Endpoint Descriptor. This structure uses LUFA-specific element names 
 481                          *  to make each element's purpose clearer. 
 483                          *  \see \ref USB_StdDescriptor_Endpoint_t for the version of this define with standard element names 
 487                                 USB_Descriptor_Header_t Header
; /**< Descriptor header, including type and size. */ 
 489                                 uint8_t     EndpointAddress
; /**< Logical address of the endpoint within the device 
 490                                                               *   for the current configuration, including direction 
 493                                 uint8_t     Attributes
; /**< Endpoint attributes, comprised of a mask of the 
 494                                                          *   endpoint type (EP_TYPE_*) and attributes (ENDPOINT_ATTR_*) 
 497                                 uint16_t    EndpointSize
; /**< Size of the endpoint bank, in bytes. This indicates the 
 498                                                            *   maximum packet size that the endpoint can receive at a time. 
 501                                 uint8_t     PollingIntervalMS
; /**< Polling interval in milliseconds for the endpoint 
 502                                                                 *   if it is an INTERRUPT or ISOCHRONOUS type. 
 504                         } USB_Descriptor_Endpoint_t
; 
 506                         /** Type define for a standard Endpoint Descriptor. This structure uses the relevant standard's given 
 507                          *  element names to ensure compatibility with the standard. 
 509                          *  \see \ref USB_Descriptor_Endpoint_t for the version of this define with non-standard LUFA specific 
 514                                 uint8_t     bLength
; /**< Size of the descriptor, in bytes. */ 
 515                                 uint8_t     bDescriptorType
; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a value 
 516                                                               *   given by the specific class. 
 518                                 uint8_t     bEndpointAddress
; /**< Logical address of the endpoint within the device 
 519                                                                *   for the current configuration, including direction 
 522                                 uint8_t     bmAttributes
; /**< Endpoint attributes, comprised of a mask of the 
 523                                                            *   endpoint type (EP_TYPE_*) and attributes (ENDPOINT_ATTR_*) 
 526                                 uint16_t    wMaxPacketSize
; /**< Size of the endpoint bank, in bytes. This indicates the 
 527                                                              *   maximum packet size that the endpoint can receive at a time. 
 529                                 uint8_t     bInterval
; /**< Polling interval in milliseconds for the endpoint 
 530                                                         *   if it is an INTERRUPT or ISOCHRONOUS type. 
 532                         } USB_StdDescriptor_Endpoint_t
; 
 534                         /** Type define for a standard string descriptor. Unlike other standard descriptors, the length 
 535                          *  of the descriptor for placement in the descriptor header must be determined by the \ref USB_STRING_LEN() 
 536                          *  macro rather than by the size of the descriptor structure, as the length is not fixed. 
 538                          *  This structure should also be used for string index 0, which contains the supported language IDs for 
 539                          *  the device as an array. 
 541                          *  This structure uses LUFA-specific element names to make each element's purpose clearer. 
 543                          *  \see \ref USB_StdDescriptor_String_t for the version of this define with standard element names 
 547                                 USB_Descriptor_Header_t Header
; /**< Descriptor header, including type and size. */ 
 549                                 wchar_t UnicodeString
[];  /**< String data, as unicode characters (alternatively, 
 550                                                            *   string language IDs). If normal ASCII characters are 
 551                                                            *   to be used, they must be added as an array of characters 
 552                                                            *   rather than a normal C string so that they are widened to 
 555                                                            *   Under GCC, strings prefixed with the "L" character (before 
 556                                                            *   the opening string quotation mark) are considered to be 
 557                                                            *   Unicode strings, and may be used instead of an explicit 
 558                                                            *   array of ASCII characters. 
 560                         } USB_Descriptor_String_t
; 
 562                         /** Type define for a standard string descriptor. Unlike other standard descriptors, the length 
 563                          *  of the descriptor for placement in the descriptor header must be determined by the \ref USB_STRING_LEN() 
 564                          *  macro rather than by the size of the descriptor structure, as the length is not fixed. 
 566                          *  This structure should also be used for string index 0, which contains the supported language IDs for 
 567                          *  the device as an array. 
 569                          *  This structure uses the relevant standard's given element names to ensure compatibility with the standard. 
 571                          *  \see \ref USB_Descriptor_String_t for the version of this define with with non-standard LUFA specific 
 576                                         uint8_t                 bLength
; /**< Size of the descriptor, in bytes. */ 
 577                                         uint8_t                 bDescriptorType
; /**< Type of the descriptor, either a value in 
 578                                                                                   *   \ref USB_DescriptorTypes_t or a value 
 579                                                                               *   given by the specific class. 
 581                                         int16_t                 bString
[]; /**< String data, as unicode characters (alternatively, 
 582                                                                         *   string language IDs). If normal ASCII characters are 
 583                                                                         *   to be used, they must be added as an array of characters 
 584                                                                         *   rather than a normal C string so that they are widened to 
 587                                                                         *   Under GCC, strings prefixed with the "L" character (before 
 588                                                                         *   the opening string quotation mark) are considered to be 
 589                                                                         *   Unicode strings, and may be used instead of an explicit 
 590                                                                         *   array of ASCII characters. 
 592                         } USB_StdDescriptor_String_t
; 
 594         /* Private Interface - For use in library only: */ 
 595         #if !defined(__DOXYGEN__) 
 597                         #define VERSION_TENS(x)                   (int)((x) / 10) 
 598                         #define VERSION_ONES(x)                   (int)((x) - (10 * VERSION_TENS(x))) 
 599                         #define VERSION_TENTHS(x)                 (int)(((x) - (int)(x)) * 10) 
 600                         #define VERSION_HUNDREDTHS(x)             (int)((((x) - (int)(x)) * 100) - (10 * VERSION_TENTHS(x))) 
 603         /* Disable C linkage for C++ Compilers: */ 
 604                 #if defined(__cplusplus)