3      Copyright (C) Dean Camera, 2010. 
   5   dean [at] fourwalledcubicle [dot] com 
   6       www.fourwalledcubicle.com 
  10   Copyright 2010  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 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 
  32  *  \brief USB standard descriptor definitions. 
  34  *  This file contains structures and macros for the easy creation of standard USB descriptors in USB device projects. 
  36  *  \note This file should not be included directly. It is automatically included as needed by the USB driver 
  37  *        dispatch header located in LUFA/Drivers/USB/USB.h. 
  40 /** \ingroup Group_USB 
  41  *  @defgroup Group_Descriptors USB Descriptors 
  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 <avr/pgmspace.h> 
  57                 #include "../../../Common/Common.h" 
  61                 #if defined(USB_CAN_BE_DEVICE) 
  62                         #include "../LowLevel/Device.h" 
  65         /* Enable C linkage for C++ Compilers: */ 
  66                 #if defined(__cplusplus) 
  70         /* Preprocessor Checks: */ 
  71                 #if !defined(__INCLUDE_FROM_USB_DRIVER) 
  72                         #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. 
  75         /* Public Interface - May be used in end-application: */ 
  77                         /** Indicates that a given descriptor does not exist in the device. This can be used inside descriptors 
  78                          *  for string descriptor indexes, or may be use as a return value for GetDescriptor when the specified 
  79                          *  descriptor does not exist. 
  81                         #define NO_DESCRIPTOR                     0 
  83                         #if (!defined(NO_INTERNAL_SERIAL) && \ 
  84                              (defined(__AVR_AT90USB647__) || defined(__AVR_AT90USB1287__) || \ 
  85                               defined(__AVR_ATmega32U6__) || defined(__AVR_AT90USB646__)  || defined(__AVR_AT90USB1286__) ||  \ 
  86                               defined(__AVR_ATmega32U2__) || defined(__AVR_ATmega16U2__)  || defined(__AVR_ATmega8U2__))) 
  87                                 /** String descriptor index for the device's unique serial number string descriptor within the device. 
  88                                  *  This unique serial number is used by the host to associate resources to the device (such as drivers or COM port 
  89                                  *  number allocations) to a device regardless of the port it is plugged in to on the host. Some USB AVRs contain 
  90                                  *  a unique serial number internally, and setting the device descriptors serial number string index to this value 
  91                                  *  will cause it to use the internal serial number. 
  93                                  *  On unsupported devices, this will evaluate to NO_DESCRIPTOR and so will force the host to create a pseudo-serial 
  94                                  *  number for the device. 
  96                                 #define USE_INTERNAL_SERIAL           0xDC 
  98                                 #define USE_INTERNAL_SERIAL           NO_DESCRIPTOR 
 101                         /** Macro to calculate the power value for the configuration descriptor, from a given number of milliamps. */ 
 102                         #define USB_CONFIG_POWER_MA(mA)           ((mA) >> 1) 
 104                         /** Macro to calculate the Unicode length of a string with a given number of Unicode characters. 
 105                          *  Should be used in string descriptor's headers for giving the string descriptor's byte length. 
 107                         #define USB_STRING_LEN(str)               (sizeof(USB_Descriptor_Header_t) + ((str) << 1)) 
 109                         /** Macro to encode a given four digit floating point version number (e.g. 01.23) into Binary Coded 
 110                          *  Decimal format for descriptor fields requiring BCD encoding, such as the USB version number in the 
 111                          *  standard device descriptor. 
 113                         #define VERSION_BCD(x)                    ((((VERSION_TENS(x) << 4) | VERSION_ONES(x)) << 8) | \ 
 114                                                                   ((VERSION_TENTHS(x) << 4) | VERSION_HUNDREDTHS(x))) 
 116                         /** String language ID for the English language. Should be used in \ref USB_Descriptor_String_t descriptors 
 117                          *  to indicate that the English language is supported by the device in its string descriptors. 
 119                         #define LANGUAGE_ID_ENG                   0x0409 
 121                         /** Can be masked with an endpoint address for a \ref USB_Descriptor_Endpoint_t endpoint descriptor's 
 122                          *  EndpointAddress value to indicate to the host that the endpoint is of the IN direction (i.e, from 
 125                         #define ENDPOINT_DESCRIPTOR_DIR_IN        0x80 
 127                         /** Can be masked with an endpoint address for a \ref USB_Descriptor_Endpoint_t endpoint descriptor's 
 128                          *  EndpointAddress value to indicate to the host that the endpoint is of the OUT direction (i.e, from 
 131                         #define ENDPOINT_DESCRIPTOR_DIR_OUT       0x00           
 133                         /** Can be masked with other configuration descriptor attributes for a \ref USB_Descriptor_Configuration_Header_t 
 134                          *  descriptor's ConfigAttributes value to indicate that the specified configuration can draw its power 
 135                          *  from the host's VBUS line. 
 137                         #define USB_CONFIG_ATTR_BUSPOWERED        0x80 
 139                         /** Can be masked with other configuration descriptor attributes for a \ref USB_Descriptor_Configuration_Header_t 
 140                          *  descriptor's ConfigAttributes value to indicate that the specified configuration can draw its power 
 141                          *  from the device's own power source. 
 143                         #define USB_CONFIG_ATTR_SELFPOWERED       0x40 
 145                         /** Can be masked with other configuration descriptor attributes for a \ref USB_Descriptor_Configuration_Header_t 
 146                          *  descriptor's ConfigAttributes value to indicate that the specified configuration supports the 
 147                          *  remote wakeup feature of the USB standard, allowing a suspended USB device to wake up the host upon 
 150                         #define USB_CONFIG_ATTR_REMOTEWAKEUP      0x20 
 152                         /** Can be masked with other endpoint descriptor attributes for a \ref USB_Descriptor_Endpoint_t descriptor's 
 153                          *  Attributes value to indicate that the specified endpoint is not synchronized. 
 155                          *  \see The USB specification for more details on the possible Endpoint attributes. 
 157                         #define ENDPOINT_ATTR_NO_SYNC             (0 << 2) 
 159                         /** Can be masked with other endpoint descriptor attributes for a \ref USB_Descriptor_Endpoint_t descriptor's 
 160                          *  Attributes value to indicate that the specified endpoint is asynchronous. 
 162                          *  \see The USB specification for more details on the possible Endpoint attributes. 
 164                         #define ENDPOINT_ATTR_ASYNC               (1 << 2) 
 166                         /** Can be masked with other endpoint descriptor attributes for a \ref USB_Descriptor_Endpoint_t descriptor's 
 167                          *  Attributes value to indicate that the specified endpoint is adaptive. 
 169                          *  \see The USB specification for more details on the possible Endpoint attributes. 
 171                         #define ENDPOINT_ATTR_ADAPTIVE            (2 << 2) 
 173                         /** Can be masked with other endpoint descriptor attributes for a \ref USB_Descriptor_Endpoint_t descriptor's 
 174                          *  Attributes value to indicate that the specified endpoint is synchronized. 
 176                          *  \see The USB specification for more details on the possible Endpoint attributes. 
 178                         #define ENDPOINT_ATTR_SYNC                (3 << 2) 
 180                         /** Can be masked with other endpoint descriptor attributes for a \ref USB_Descriptor_Endpoint_t descriptor's 
 181                          *  Attributes value to indicate that the specified endpoint is used for data transfers. 
 183                          *  \see The USB specification for more details on the possible Endpoint usage attributes. 
 185                         #define ENDPOINT_USAGE_DATA               (0 << 4) 
 187                         /** Can be masked with other endpoint descriptor attributes for a \ref USB_Descriptor_Endpoint_t descriptor's 
 188                          *  Attributes value to indicate that the specified endpoint is used for feedback. 
 190                          *  \see The USB specification for more details on the possible Endpoint usage attributes. 
 192                         #define ENDPOINT_USAGE_FEEDBACK           (1 << 4) 
 194                         /** Can be masked with other endpoint descriptor attributes for a \ref USB_Descriptor_Endpoint_t descriptor's 
 195                          *  Attributes value to indicate that the specified endpoint is used for implicit feedback. 
 197                          *  \see The USB specification for more details on the possible Endpoint usage attributes. 
 199                         #define ENDPOINT_USAGE_IMPLICIT_FEEDBACK  (2 << 4) 
 202                         /** Enum for the possible standard descriptor types, as given in each descriptor's header. */ 
 203                         enum USB_DescriptorTypes_t
 
 205                                 DTYPE_Device               
= 0x01, /**< Indicates that the descriptor is a device descriptor. */ 
 206                                 DTYPE_Configuration        
= 0x02, /**< Indicates that the descriptor is a configuration descriptor. */ 
 207                                 DTYPE_String               
= 0x03, /**< Indicates that the descriptor is a string descriptor. */ 
 208                                 DTYPE_Interface            
= 0x04, /**< Indicates that the descriptor is an interface descriptor. */ 
 209                                 DTYPE_Endpoint             
= 0x05, /**< Indicates that the descriptor is an endpoint descriptor. */ 
 210                                 DTYPE_DeviceQualifier      
= 0x06, /**< Indicates that the descriptor is a device qualifier descriptor. */ 
 211                                 DTYPE_Other                
= 0x07, /**< Indicates that the descriptor is of other type. */ 
 212                                 DTYPE_InterfacePower       
= 0x08, /**< Indicates that the descriptor is an interface power descriptor. */ 
 213                                 DTYPE_InterfaceAssociation 
= 0x0B, /**< Indicates that the descriptor is an interface association descriptor. */ 
 217                         /** \brief Standard USB Descriptor Header (LUFA naming conventions). 
 219              *  Type define for all descriptors' standard header, indicating the descriptor's length and type. This structure 
 220                          *  uses LUFA-specific element names to make each element's purpose clearer. 
 222                          *  \see \ref USB_StdDescriptor_Header_t for the version of this define with standard element names. 
 226                                 uint8_t     Size
; /**< Size of the descriptor, in bytes. */ 
 227                                 uint8_t     Type
; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a value 
 228                                                    *   given by the specific class. 
 230                         } USB_Descriptor_Header_t
; 
 232                         /** \brief Standard USB Descriptor Header (USB-IF naming conventions). 
 234                          *  Type define for all descriptors' standard header, indicating the descriptor's length and type. This structure 
 235                          *  uses the relevant standard's given element names to ensure compatibility with the standard. 
 237                          *  \see \ref USB_Descriptor_Header_t for the version of this define with non-standard LUFA specific element names. 
 241                                 uint8_t     bLength
; /**< Size of the descriptor, in bytes. */ 
 242                                 uint8_t     bDescriptorType
; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a value 
 243                                                               *   given by the specific class. 
 245                         } USB_StdDescriptor_Header_t
; 
 247                         /** \brief Standard USB Device Descriptor (LUFA naming conventions). 
 249                          *  Type define for a standard Device Descriptor. This structure uses LUFA-specific element names to make each 
 250                          *  element's purpose clearer. 
 252                          *  \see \ref USB_StdDescriptor_Device_t for the version of this define with standard element names. 
 256                                 USB_Descriptor_Header_t Header
; /**< Descriptor header, including type and size. */ 
 258                                 uint16_t    USBSpecification
; /**< BCD of the supported USB specification. */ 
 259                                 uint8_t     Class
; /**< USB device class. */ 
 260                                 uint8_t     SubClass
; /**< USB device subclass. */ 
 261                                 uint8_t     Protocol
; /**< USB device protocol. */ 
 263                                 uint8_t     Endpoint0Size
; /**< Size of the control (address 0) endpoint's bank in bytes. */ 
 265                                 uint16_t    VendorID
; /**< Vendor ID for the USB product. */ 
 266                                 uint16_t    ProductID
; /**< Unique product ID for the USB product. */ 
 267                                 uint16_t    ReleaseNumber
; /**< Product release (version) number. */ 
 269                                 uint8_t     ManufacturerStrIndex
; /**< String index for the manufacturer's name. The 
 270                                                                    *   host will request this string via a separate 
 271                                                                    *   control request for the string descriptor. 
 273                                                                    *   \note If no string supplied, use \ref NO_DESCRIPTOR. 
 275                                 uint8_t     ProductStrIndex
; /**< String index for the product name/details. 
 277                                                               *  \see ManufacturerStrIndex structure entry. 
 279                                 uint8_t     SerialNumStrIndex
; /**< String index for the product's globally unique hexadecimal 
 280                                                                 *   serial number, in uppercase Unicode ASCII. 
 282                                                                 *  \note On some AVR models, there is an embedded serial number 
 283                                                                 *        in the chip which can be used for the device serial number. 
 284                                                                 *        To use this serial number, set this to USE_INTERNAL_SERIAL. 
 285                                                                 *        On unsupported devices, this will evaluate to 0 and will cause 
 286                                                                 *        the host to generate a pseudo-unique value for the device upon 
 289                                                                 *  \see ManufacturerStrIndex structure entry. 
 291                                 uint8_t     NumberOfConfigurations
; /**< Total number of configurations supported by 
 294                         } USB_Descriptor_Device_t
; 
 296                         /** \brief Standard USB Device Descriptor (USB-IF naming conventions). 
 298                          *  Type define for a standard Device Descriptor. This structure uses the relevant standard's given element names 
 299                          *  to ensure compatibility with the standard. 
 301                          *  \see \ref USB_Descriptor_Device_t for the version of this define with non-standard LUFA specific element names. 
 305                                 uint8_t     bLength
; /**< Size of the descriptor, in bytes. */ 
 306                                 uint8_t     bDescriptorType
; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a value 
 307                                                               *   given by the specific class. 
 309                                 uint16_t    bcdUSB
; /**< BCD of the supported USB specification. */ 
 310                                 uint8_t     bDeviceClass
; /**< USB device class. */ 
 311                                 uint8_t     bDeviceSubClass
; /**< USB device subclass. */ 
 312                                 uint8_t     bDeviceProtocol
; /**< USB device protocol. */ 
 313                                 uint8_t     bMaxPacketSize0
; /**< Size of the control (address 0) endpoint's bank in bytes. */ 
 314                                 uint16_t    idVendor
; /**< Vendor ID for the USB product. */ 
 315                                 uint16_t    idProduct
; /**< Unique product ID for the USB product. */ 
 316                                 uint16_t    bcdDevice
; /**< Product release (version) number. */ 
 317                                 uint8_t     iManufacturer
; /**< String index for the manufacturer's name. The 
 318                                                             *   host will request this string via a separate 
 319                                                             *   control request for the string descriptor. 
 321                                                             *   \note If no string supplied, use \ref NO_DESCRIPTOR. 
 323                                 uint8_t     iProduct
; /**< String index for the product name/details. 
 325                                                        *  \see ManufacturerStrIndex structure entry. 
 327                                 uint8_t     iSerialNumber
; /**< String index for the product's globally unique hexadecimal 
 328                                                             *   serial number, in uppercase Unicode ASCII. 
 330                                                             *  \note On some AVR models, there is an embedded serial number 
 331                                                             *        in the chip which can be used for the device serial number. 
 332                                                             *        To use this serial number, set this to USE_INTERNAL_SERIAL. 
 333                                                             *        On unsupported devices, this will evaluate to 0 and will cause 
 334                                                             *        the host to generate a pseudo-unique value for the device upon 
 337                                                             *  \see ManufacturerStrIndex structure entry. 
 339                                 uint8_t     bNumConfigurations
; /**< Total number of configurations supported by 
 342                         } USB_StdDescriptor_Device_t
; 
 344                         /** \brief Standard USB Configuration Descriptor (LUFA naming conventions). 
 346                          *  Type define for a standard Configuration Descriptor header. This structure uses LUFA-specific element names 
 347                          *  to make each element's purpose clearer. 
 349                          *  \see \ref USB_StdDescriptor_Configuration_Header_t for the version of this define with standard element names. 
 353                                 USB_Descriptor_Header_t Header
; /**< Descriptor header, including type and size. */ 
 355                                 uint16_t    TotalConfigurationSize
; /**< Size of the configuration descriptor header, 
 356                                                                      *   and all sub descriptors inside the configuration. 
 358                                 uint8_t     TotalInterfaces
; /**< Total number of interfaces in the configuration. */ 
 360                                 uint8_t     ConfigurationNumber
; /**< Configuration index of the current configuration. */ 
 361                                 uint8_t     ConfigurationStrIndex
; /**< Index of a string descriptor describing the configuration. */ 
 363                                 uint8_t     ConfigAttributes
; /**< Configuration attributes, comprised of a mask of zero or 
 364                                                                *   more USB_CONFIG_ATTR_* masks. 
 367                                 uint8_t     MaxPowerConsumption
; /**< Maximum power consumption of the device while in the 
 368                                                                   *   current configuration, calculated by the \ref USB_CONFIG_POWER_MA() 
 371                         } USB_Descriptor_Configuration_Header_t
; 
 373                         /** \brief Standard USB Configuration Descriptor (USB-IF naming conventions). 
 375                          *  Type define for a standard Configuration Descriptor header. This structure uses the relevant standard's given element names 
 376                          *  to ensure compatibility with the standard. 
 378                          *  \see \ref USB_Descriptor_Device_t for the version of this define with non-standard LUFA specific element names. 
 382                                 uint8_t     bLength
; /**< Size of the descriptor, in bytes. */ 
 383                                 uint8_t     bDescriptorType
; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a value 
 384                                                               *   given by the specific class. 
 386                                 uint16_t    wTotalLength
; /**< Size of the configuration descriptor header, 
 387                                                            *   and all sub descriptors inside the configuration. 
 389                                 uint8_t     bNumInterfaces
; /**< Total number of interfaces in the configuration. */ 
 390                                 uint8_t     bConfigurationValue
; /**< Configuration index of the current configuration. */ 
 391                                 uint8_t     iConfiguration
; /**< Index of a string descriptor describing the configuration. */ 
 392                                 uint8_t     bmAttributes
; /**< Configuration attributes, comprised of a mask of zero or 
 393                                                            *   more USB_CONFIG_ATTR_* masks. 
 395                                 uint8_t     bMaxPower
; /**< Maximum power consumption of the device while in the 
 396                                                         *   current configuration, calculated by the \ref USB_CONFIG_POWER_MA() 
 399                         } USB_StdDescriptor_Configuration_Header_t
; 
 401                         /** \brief Standard USB Interface Descriptor (LUFA naming conventions). 
 403                          *  Type define for a standard Interface Descriptor. This structure uses LUFA-specific element names 
 404                          *  to make each element's purpose clearer. 
 406                          *  \see \ref USB_StdDescriptor_Interface_t for the version of this define with standard element names. 
 410                                 USB_Descriptor_Header_t Header
; /**< Descriptor header, including type and size. */ 
 412                                 uint8_t     InterfaceNumber
; /**< Index of the interface in the current configuration. */ 
 413                                 uint8_t     AlternateSetting
; /**< Alternate setting for the interface number. The same 
 414                                                                *   interface number can have multiple alternate settings 
 415                                                                *   with different endpoint configurations, which can be 
 416                                                                *   selected by the host. 
 418                                 uint8_t     TotalEndpoints
; /**< Total number of endpoints in the interface. */ 
 420                                 uint8_t     Class
; /**< Interface class ID. */ 
 421                                 uint8_t     SubClass
; /**< Interface subclass ID. */ 
 422                                 uint8_t     Protocol
; /**< Interface protocol ID. */ 
 424                                 uint8_t     InterfaceStrIndex
; /**< Index of the string descriptor describing the 
 427                         } USB_Descriptor_Interface_t
; 
 429                         /** \brief Standard USB Interface Descriptor (USB-IF naming conventions). 
 431                          *  Type define for a standard Interface Descriptor. This structure uses the relevant standard's given element names 
 432                          *  to ensure compatibility with the standard. 
 434                          *  \see \ref USB_Descriptor_Interface_t for the version of this define with non-standard LUFA specific element names. 
 438                                 uint8_t     bLength
; /**< Size of the descriptor, in bytes. */ 
 439                                 uint8_t     bDescriptorType
; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a value 
 440                                                               *   given by the specific class. 
 442                                 uint8_t     bInterfaceNumber
; /**< Index of the interface in the current configuration. */ 
 443                                 uint8_t     bAlternateSetting
; /**< Alternate setting for the interface number. The same 
 444                                                                 *   interface number can have multiple alternate settings 
 445                                                                 *   with different endpoint configurations, which can be 
 446                                                                 *   selected by the host. 
 448                                 uint8_t     bNumEndpoints
; /**< Total number of endpoints in the interface. */ 
 449                                 uint8_t     bInterfaceClass
; /**< Interface class ID. */ 
 450                                 uint8_t     bInterfaceSubClass
; /**< Interface subclass ID. */ 
 451                                 uint8_t     bInterfaceProtocol
; /**< Interface protocol ID. */ 
 452                                 uint8_t     iInterface
; /**< Index of the string descriptor describing the 
 455                         } USB_StdDescriptor_Interface_t
; 
 457                         /** \brief Standard USB Interface Association Descriptor (LUFA naming conventions). 
 459                          *  Type define for a standard Interface Association Descriptor. This structure uses LUFA-specific element names 
 460                          *  to make each element's purpose clearer. 
 462                          *  This descriptor has been added as a supplement to the USB2.0 standard, in the ECN located at 
 463                          *  <a>http://www.usb.org/developers/docs/InterfaceAssociationDescriptor_ecn.pdf</a>. It allows compound 
 464                          *  devices with multiple interfaces related to the same function to have the multiple interfaces bound 
 465                          *  together at the point of enumeration, loading one generic driver for all the interfaces in the single 
 466                          *  function. Read the ECN for more information. 
 468                          *  \see \ref USB_StdDescriptor_Interface_Association_t for the version of this define with standard element names. 
 472                                 USB_Descriptor_Header_t Header
; /**< Descriptor header, including type and size. */ 
 474                                 uint8_t     FirstInterfaceIndex
; /**< Index of the first associated interface. */ 
 475                                 uint8_t     TotalInterfaces
; /**< Total number of associated interfaces. */ 
 477                                 uint8_t     Class
; /**< Interface class ID. */ 
 478                                 uint8_t     SubClass
; /**< Interface subclass ID. */ 
 479                                 uint8_t     Protocol
; /**< Interface protocol ID. */ 
 481                                 uint8_t     IADStrIndex
; /**< Index of the string descriptor describing the 
 482                                                           *   interface association. 
 484                         } USB_Descriptor_Interface_Association_t
; 
 486                         /** \brief Standard USB Interface Association Descriptor (USB-IF naming conventions). 
 488                          *  Type define for a standard Interface Association Descriptor. This structure uses the relevant standard's given 
 489                          *  element names to ensure compatibility with the standard. 
 491                          *  This descriptor has been added as a supplement to the USB2.0 standard, in the ECN located at 
 492                          *  <a>http://www.usb.org/developers/docs/InterfaceAssociationDescriptor_ecn.pdf</a>. It allows compound 
 493                          *  devices with multiple interfaces related to the same function to have the multiple interfaces bound 
 494                          *  together at the point of enumeration, loading one generic driver for all the interfaces in the single 
 495                          *  function. Read the ECN for more information. 
 497                          *  \see \ref USB_Descriptor_Interface_Association_t for the version of this define with non-standard LUFA specific 
 502                                 uint8_t     bLength
; /**< Size of the descriptor, in bytes. */ 
 503                                 uint8_t     bDescriptorType
; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a value 
 504                                                               *   given by the specific class. 
 506                                 uint8_t     bFirstInterface
; /**< Index of the first associated interface. */ 
 507                                 uint8_t     bInterfaceCount
; /**< Total number of associated interfaces. */ 
 508                                 uint8_t     bFunctionClass
; /**< Interface class ID. */ 
 509                                 uint8_t     bFunctionSubClass
; /**< Interface subclass ID. */ 
 510                                 uint8_t     bFunctionProtocol
; /**< Interface protocol ID. */ 
 511                                 uint8_t     iFunction
; /**< Index of the string descriptor describing the 
 512                                                         *   interface association. 
 514                         } USB_StdDescriptor_Interface_Association_t
; 
 516                         /** \brief Standard USB Endpoint Descriptor (LUFA naming conventions). 
 518                          *  Type define for a standard Endpoint Descriptor. This structure uses LUFA-specific element names 
 519                          *  to make each element's purpose clearer. 
 521                          *  \see \ref USB_StdDescriptor_Endpoint_t for the version of this define with standard element names. 
 525                                 USB_Descriptor_Header_t Header
; /**< Descriptor header, including type and size. */ 
 527                                 uint8_t     EndpointAddress
; /**< Logical address of the endpoint within the device 
 528                                                               *   for the current configuration, including direction 
 531                                 uint8_t     Attributes
; /**< Endpoint attributes, comprised of a mask of the 
 532                                                          *   endpoint type (EP_TYPE_*) and attributes (ENDPOINT_ATTR_*) 
 535                                 uint16_t    EndpointSize
; /**< Size of the endpoint bank, in bytes. This indicates the 
 536                                                            *   maximum packet size that the endpoint can receive at a time. 
 539                                 uint8_t     PollingIntervalMS
; /**< Polling interval in milliseconds for the endpoint 
 540                                                                 *   if it is an INTERRUPT or ISOCHRONOUS type. 
 542                         } USB_Descriptor_Endpoint_t
; 
 544                         /** \brief Standard USB Endpoint Descriptor (USB-IF naming conventions). 
 546                          *  Type define for a standard Endpoint Descriptor. This structure uses the relevant standard's given 
 547                          *  element names to ensure compatibility with the standard. 
 549                          *  \see \ref USB_Descriptor_Endpoint_t for the version of this define with non-standard LUFA specific 
 554                                 uint8_t     bLength
; /**< Size of the descriptor, in bytes. */ 
 555                                 uint8_t     bDescriptorType
; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a value 
 556                                                               *   given by the specific class. 
 558                                 uint8_t     bEndpointAddress
; /**< Logical address of the endpoint within the device 
 559                                                                *   for the current configuration, including direction 
 562                                 uint8_t     bmAttributes
; /**< Endpoint attributes, comprised of a mask of the 
 563                                                            *   endpoint type (EP_TYPE_*) and attributes (ENDPOINT_ATTR_*) 
 566                                 uint16_t    wMaxPacketSize
; /**< Size of the endpoint bank, in bytes. This indicates the 
 567                                                              *   maximum packet size that the endpoint can receive at a time. 
 569                                 uint8_t     bInterval
; /**< Polling interval in milliseconds for the endpoint 
 570                                                         *   if it is an INTERRUPT or ISOCHRONOUS type. 
 572                         } USB_StdDescriptor_Endpoint_t
; 
 574                         /** \brief Standard USB String Descriptor (LUFA naming conventions). 
 576                          *  Type define for a standard string descriptor. Unlike other standard descriptors, the length 
 577                          *  of the descriptor for placement in the descriptor header must be determined by the \ref USB_STRING_LEN() 
 578                          *  macro rather than by the size of the descriptor structure, as the length is not fixed. 
 580                          *  This structure should also be used for string index 0, which contains the supported language IDs for 
 581                          *  the device as an array. 
 583                          *  This structure uses LUFA-specific element names to make each element's purpose clearer. 
 585                          *  \see \ref USB_StdDescriptor_String_t for the version of this define with standard element names. 
 589                                 USB_Descriptor_Header_t Header
; /**< Descriptor header, including type and size. */ 
 591                                 wchar_t UnicodeString
[];  /**< String data, as unicode characters (alternatively, 
 592                                                            *   string language IDs). If normal ASCII characters are 
 593                                                            *   to be used, they must be added as an array of characters 
 594                                                            *   rather than a normal C string so that they are widened to 
 597                                                            *   Under GCC, strings prefixed with the "L" character (before 
 598                                                            *   the opening string quotation mark) are considered to be 
 599                                                            *   Unicode strings, and may be used instead of an explicit 
 600                                                            *   array of ASCII characters. 
 602                         } USB_Descriptor_String_t
; 
 604                         /** \brief Standard USB String Descriptor (USB-IF naming conventions). 
 606                          *  Type define for a standard string descriptor. Unlike other standard descriptors, the length 
 607                          *  of the descriptor for placement in the descriptor header must be determined by the \ref USB_STRING_LEN() 
 608                          *  macro rather than by the size of the descriptor structure, as the length is not fixed. 
 610                          *  This structure should also be used for string index 0, which contains the supported language IDs for 
 611                          *  the device as an array. 
 613                          *  This structure uses the relevant standard's given element names to ensure compatibility with the standard. 
 615                          *  \see \ref USB_Descriptor_String_t for the version of this define with with non-standard LUFA specific 
 620                                         uint8_t                 bLength
; /**< Size of the descriptor, in bytes. */ 
 621                                         uint8_t                 bDescriptorType
; /**< Type of the descriptor, either a value in 
 622                                                                                   *   \ref USB_DescriptorTypes_t or a value 
 623                                                                               *   given by the specific class. 
 625                                         int16_t                 bString
[]; /**< String data, as unicode characters (alternatively, 
 626                                                                         *   string language IDs). If normal ASCII characters are 
 627                                                                         *   to be used, they must be added as an array of characters 
 628                                                                         *   rather than a normal C string so that they are widened to 
 631                                                                         *   Under GCC, strings prefixed with the "L" character (before 
 632                                                                         *   the opening string quotation mark) are considered to be 
 633                                                                         *   Unicode strings, and may be used instead of an explicit 
 634                                                                         *   array of ASCII characters. 
 636                         } USB_StdDescriptor_String_t
; 
 638         /* Private Interface - For use in library only: */ 
 639         #if !defined(__DOXYGEN__) 
 641                         #define VERSION_TENS(x)                   (int)((x) / 10) 
 642                         #define VERSION_ONES(x)                   (int)((x) - (10 * VERSION_TENS(x))) 
 643                         #define VERSION_TENTHS(x)                 (int)(((x) - (int)(x)) * 10) 
 644                         #define VERSION_HUNDREDTHS(x)             (int)((((x) - (int)(x)) * 100) - (10 * VERSION_TENTHS(x))) 
 647         /* Disable C linkage for C++ Compilers: */ 
 648                 #if defined(__cplusplus)