3      Copyright (C) Dean Camera, 2011. 
   5   dean [at] fourwalledcubicle [dot] com 
  10   Copyright 2011  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 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                 #if defined(USB_CAN_BE_DEVICE) 
  61         /* Enable C linkage for C++ Compilers: */ 
  62                 #if defined(__cplusplus) 
  66         /* Preprocessor Checks: */ 
  67                 #if !defined(__INCLUDE_FROM_USB_DRIVER) 
  68                         #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. 
  71         /* Public Interface - May be used in end-application: */ 
  73                         /** Indicates that a given descriptor does not exist in the device. This can be used inside descriptors 
  74                          *  for string descriptor indexes, or may be use as a return value for GetDescriptor when the specified 
  75                          *  descriptor does not exist. 
  77                         #define NO_DESCRIPTOR                     0 
  79                         /** Macro to calculate the power value for the configuration descriptor, from a given number of milliamperes. */ 
  80                         #define USB_CONFIG_POWER_MA(mA)           ((mA) >> 1) 
  82                         /** Macro to calculate the Unicode length of a string with a given number of Unicode characters. 
  83                          *  Should be used in string descriptor's headers for giving the string descriptor's byte length. 
  85                         #define USB_STRING_LEN(str)               (sizeof(USB_Descriptor_Header_t) + ((str) << 1)) 
  87                         /** Macro to encode a given four digit floating point version number (e.g. 01.23) into Binary Coded 
  88                          *  Decimal format for descriptor fields requiring BCD encoding, such as the USB version number in the 
  89                          *  standard device descriptor. 
  91                         #define VERSION_BCD(x)                    ((((VERSION_TENS(x) << 4) | VERSION_ONES(x)) << 8) | \ 
  92                                                                   ((VERSION_TENTHS(x) << 4) | VERSION_HUNDREDTHS(x))) 
  94                         /** String language ID for the English language. Should be used in \ref USB_Descriptor_String_t descriptors 
  95                          *  to indicate that the English language is supported by the device in its string descriptors. 
  97                         #define LANGUAGE_ID_ENG                   0x0409 
  99                         /** \name Endpoint Address Direction Masks */ 
 101                         /** Can be masked with an endpoint address for a \ref USB_Descriptor_Endpoint_t endpoint descriptor's 
 102                          *  EndpointAddress value to indicate to the host that the endpoint is of the IN direction (i.e, from 
 105                         #define ENDPOINT_DESCRIPTOR_DIR_IN        0x80 
 107                         /** Can be masked with an endpoint address for a \ref USB_Descriptor_Endpoint_t endpoint descriptor's 
 108                          *  EndpointAddress value to indicate to the host that the endpoint is of the OUT direction (i.e, from 
 111                         #define ENDPOINT_DESCRIPTOR_DIR_OUT       0x00 
 114                         /** \name USB Configuration Descriptor Attribute Masks */ 
 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 
 122                         /** Can be masked with other configuration descriptor attributes for a \ref USB_Descriptor_Configuration_Header_t 
 123                          *  descriptor's ConfigAttributes value to indicate that the specified configuration can draw its power 
 124                          *  from the device's own power source. 
 126                         #define USB_CONFIG_ATTR_SELFPOWERED       0x40 
 128                         /** Can be masked with other configuration descriptor attributes for a \ref USB_Descriptor_Configuration_Header_t 
 129                          *  descriptor's ConfigAttributes value to indicate that the specified configuration supports the 
 130                          *  remote wakeup feature of the USB standard, allowing a suspended USB device to wake up the host upon 
 133                         #define USB_CONFIG_ATTR_REMOTEWAKEUP      0x20 
 136                         /** \name Endpoint Descriptor Attribute Masks */ 
 138                         /** Can be masked with other endpoint descriptor attributes for a \ref USB_Descriptor_Endpoint_t descriptor's 
 139                          *  Attributes value to indicate that the specified endpoint is not synchronized. 
 141                          *  \see The USB specification for more details on the possible Endpoint attributes. 
 143                         #define ENDPOINT_ATTR_NO_SYNC             (0 << 2) 
 145                         /** Can be masked with other endpoint descriptor attributes for a \ref USB_Descriptor_Endpoint_t descriptor's 
 146                          *  Attributes value to indicate that the specified endpoint is asynchronous. 
 148                          *  \see The USB specification for more details on the possible Endpoint attributes. 
 150                         #define ENDPOINT_ATTR_ASYNC               (1 << 2) 
 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 adaptive. 
 155                          *  \see The USB specification for more details on the possible Endpoint attributes. 
 157                         #define ENDPOINT_ATTR_ADAPTIVE            (2 << 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 synchronized. 
 162                          *  \see The USB specification for more details on the possible Endpoint attributes. 
 164                         #define ENDPOINT_ATTR_SYNC                (3 << 2) 
 167                         /** \name Endpoint Descriptor Usage Masks */ 
 169                         /** Can be masked with other endpoint descriptor attributes for a \ref USB_Descriptor_Endpoint_t descriptor's 
 170                          *  Attributes value to indicate that the specified endpoint is used for data transfers. 
 172                          *  \see The USB specification for more details on the possible Endpoint usage attributes. 
 174                         #define ENDPOINT_USAGE_DATA               (0 << 4) 
 176                         /** Can be masked with other endpoint descriptor attributes for a \ref USB_Descriptor_Endpoint_t descriptor's 
 177                          *  Attributes value to indicate that the specified endpoint is used for feedback. 
 179                          *  \see The USB specification for more details on the possible Endpoint usage attributes. 
 181                         #define ENDPOINT_USAGE_FEEDBACK           (1 << 4) 
 183                         /** Can be masked with other endpoint descriptor attributes for a \ref USB_Descriptor_Endpoint_t descriptor's 
 184                          *  Attributes value to indicate that the specified endpoint is used for implicit feedback. 
 186                          *  \see The USB specification for more details on the possible Endpoint usage attributes. 
 188                         #define ENDPOINT_USAGE_IMPLICIT_FEEDBACK  (2 << 4) 
 192                         /** Enum for the possible standard descriptor types, as given in each descriptor's header. */ 
 193                         enum USB_DescriptorTypes_t
 
 195                                 DTYPE_Device                    
= 0x01, /**< Indicates that the descriptor is a device descriptor. */ 
 196                                 DTYPE_Configuration             
= 0x02, /**< Indicates that the descriptor is a configuration descriptor. */ 
 197                                 DTYPE_String                    
= 0x03, /**< Indicates that the descriptor is a string descriptor. */ 
 198                                 DTYPE_Interface                 
= 0x04, /**< Indicates that the descriptor is an interface descriptor. */ 
 199                                 DTYPE_Endpoint                  
= 0x05, /**< Indicates that the descriptor is an endpoint descriptor. */ 
 200                                 DTYPE_DeviceQualifier           
= 0x06, /**< Indicates that the descriptor is a device qualifier descriptor. */ 
 201                                 DTYPE_Other                     
= 0x07, /**< Indicates that the descriptor is of other type. */ 
 202                                 DTYPE_InterfacePower            
= 0x08, /**< Indicates that the descriptor is an interface power descriptor. */ 
 203                                 DTYPE_InterfaceAssociation      
= 0x0B, /**< Indicates that the descriptor is an interface association descriptor. */ 
 204                                 DTYPE_CSInterface               
= 0x24, /**< Indicates that the descriptor is a class specific interface descriptor. */ 
 205                                 DTYPE_CSEndpoint                
= 0x25, /**< Indicates that the descriptor is a class specific endpoint descriptor. */ 
 208                         /** Enum for possible Class, Subclass and Protocol values of device and interface descriptors. */ 
 209                         enum USB_Descriptor_ClassSubclassProtocol_t
 
 211                                 USB_CSCP_NoDeviceClass          
= 0x00, /**< Descriptor Class value indicating that the device does not belong 
 212                                                                          *   to a particular class at the device level. 
 214                                 USB_CSCP_NoDeviceSubclass       
= 0x00, /**< Descriptor Subclass value indicating that the device does not belong 
 215                                                                          *   to a particular subclass at the device level. 
 217                                 USB_CSCP_NoDeviceProtocol       
= 0x00, /**< Descriptor Protocol value indicating that the device does not belong 
 218                                                                          *   to a particular protocol at the device level. 
 220                                 USB_CSCP_VendorSpecificClass    
= 0xFF, /**< Descriptor Class value indicating that the device/interface belongs 
 221                                                                          *   to a vendor specific class. 
 223                                 USB_CSCP_VendorSpecificSubclass 
= 0xFF, /**< Descriptor Subclass value indicating that the device/interface belongs 
 224                                                                          *   to a vendor specific subclass. 
 226                                 USB_CSCP_VendorSpecificProtocol 
= 0xFF, /**< Descriptor Protocol value indicating that the device/interface belongs 
 227                                                                          *   to a vendor specific protocol. 
 229                                 USB_CSCP_IADDeviceClass         
= 0xEF, /**< Descriptor Class value indicating that the device belongs to the 
 230                                                                          *   Interface Association Descriptor class. 
 232                                 USB_CSCP_IADDeviceSubclass      
= 0x02, /**< Descriptor Subclass value indicating that the device belongs to the 
 233                                                                          *   Interface Association Descriptor subclass. 
 235                                 USB_CSCP_IADDeviceProtocol      
= 0x01, /**< Descriptor Protocol value indicating that the device belongs to the 
 236                                                                          *   Interface Association Descriptor protocol. 
 241                         /** \brief Standard USB Descriptor Header (LUFA naming conventions). 
 243              *  Type define for all descriptors' standard header, indicating the descriptor's length and type. This structure 
 244                          *  uses LUFA-specific element names to make each element's purpose clearer. 
 246                          *  \see \ref USB_StdDescriptor_Header_t for the version of this type with standard element names. 
 250                                 uint8_t Size
; /**< Size of the descriptor, in bytes. */ 
 251                                 uint8_t Type
; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a value 
 252                                                *   given by the specific class. 
 254                         } USB_Descriptor_Header_t
; 
 256                         /** \brief Standard USB Descriptor Header (USB-IF naming conventions). 
 258                          *  Type define for all descriptors' standard header, indicating the descriptor's length and type. This structure 
 259                          *  uses the relevant standard's given element names to ensure compatibility with the standard. 
 261                          *  \see \ref USB_Descriptor_Header_t for the version of this type with non-standard LUFA specific element names. 
 265                                 uint8_t bLength
; /**< Size of the descriptor, in bytes. */ 
 266                                 uint8_t bDescriptorType
; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a value 
 267                                                           *   given by the specific class. 
 269                         } USB_StdDescriptor_Header_t
; 
 271                         /** \brief Standard USB Device Descriptor (LUFA naming conventions). 
 273                          *  Type define for a standard Device Descriptor. This structure uses LUFA-specific element names to make each 
 274                          *  element's purpose clearer. 
 276                          *  \see \ref USB_StdDescriptor_Device_t for the version of this type with standard element names. 
 280                                 USB_Descriptor_Header_t Header
; /**< Descriptor header, including type and size. */ 
 282                                 uint16_t USBSpecification
; /**< BCD of the supported USB specification. */ 
 283                                 uint8_t  Class
; /**< USB device class. */ 
 284                                 uint8_t  SubClass
; /**< USB device subclass. */ 
 285                                 uint8_t  Protocol
; /**< USB device protocol. */ 
 287                                 uint8_t  Endpoint0Size
; /**< Size of the control (address 0) endpoint's bank in bytes. */ 
 289                                 uint16_t VendorID
; /**< Vendor ID for the USB product. */ 
 290                                 uint16_t ProductID
; /**< Unique product ID for the USB product. */ 
 291                                 uint16_t ReleaseNumber
; /**< Product release (version) number. */ 
 293                                 uint8_t  ManufacturerStrIndex
; /**< 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  ProductStrIndex
; /**< String index for the product name/details. 
 301                                                            *  \see ManufacturerStrIndex structure entry. 
 303                                 uint8_t  SerialNumStrIndex
; /**< 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  NumberOfConfigurations
; /**< Total number of configurations supported by 
 318                         } USB_Descriptor_Device_t
; 
 320                         /** \brief Standard USB Device Descriptor (USB-IF naming conventions). 
 322                          *  Type define for a standard Device Descriptor. This structure uses the relevant standard's given element names 
 323                          *  to ensure compatibility with the standard. 
 325                          *  \see \ref USB_Descriptor_Device_t for the version of this type with non-standard LUFA specific element names. 
 329                                 uint8_t  bLength
; /**< Size of the descriptor, in bytes. */ 
 330                                 uint8_t  bDescriptorType
; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a value 
 331                                                               *   given by the specific class. 
 333                                 uint16_t bcdUSB
; /**< BCD of the supported USB specification. */ 
 334                                 uint8_t  bDeviceClass
; /**< USB device class. */ 
 335                                 uint8_t  bDeviceSubClass
; /**< USB device subclass. */ 
 336                                 uint8_t  bDeviceProtocol
; /**< USB device protocol. */ 
 337                                 uint8_t  bMaxPacketSize0
; /**< Size of the control (address 0) endpoint's bank in bytes. */ 
 338                                 uint16_t idVendor
; /**< Vendor ID for the USB product. */ 
 339                                 uint16_t idProduct
; /**< Unique product ID for the USB product. */ 
 340                                 uint16_t bcdDevice
; /**< Product release (version) number. */ 
 341                                 uint8_t  iManufacturer
; /**< String index for the manufacturer's name. The 
 342                                                          *   host will request this string via a separate 
 343                                                          *   control request for the string descriptor. 
 345                                                          *   \note If no string supplied, use \ref NO_DESCRIPTOR. 
 347                                 uint8_t  iProduct
; /**< String index for the product name/details. 
 349                                                     *  \see ManufacturerStrIndex structure entry. 
 351                                 uint8_t iSerialNumber
; /**< String index for the product's globally unique hexadecimal 
 352                                                         *   serial number, in uppercase Unicode ASCII. 
 354                                                         *  \note On some AVR models, there is an embedded serial number 
 355                                                         *        in the chip which can be used for the device serial number. 
 356                                                         *        To use this serial number, set this to USE_INTERNAL_SERIAL. 
 357                                                         *        On unsupported devices, this will evaluate to 0 and will cause 
 358                                                         *        the host to generate a pseudo-unique value for the device upon 
 361                                                         *  \see ManufacturerStrIndex structure entry. 
 363                                 uint8_t  bNumConfigurations
; /**< Total number of configurations supported by 
 366                         } USB_StdDescriptor_Device_t
; 
 368                         /** \brief Standard USB Configuration Descriptor (LUFA naming conventions). 
 370                          *  Type define for a standard Configuration Descriptor header. This structure uses LUFA-specific element names 
 371                          *  to make each element's purpose clearer. 
 373                          *  \see \ref USB_StdDescriptor_Configuration_Header_t for the version of this type with standard element names. 
 377                                 USB_Descriptor_Header_t Header
; /**< Descriptor header, including type and size. */ 
 379                                 uint16_t TotalConfigurationSize
; /**< Size of the configuration descriptor header, 
 380                                                                   *   and all sub descriptors inside the configuration. 
 382                                 uint8_t  TotalInterfaces
; /**< Total number of interfaces in the configuration. */ 
 384                                 uint8_t  ConfigurationNumber
; /**< Configuration index of the current configuration. */ 
 385                                 uint8_t  ConfigurationStrIndex
; /**< Index of a string descriptor describing the configuration. */ 
 387                                 uint8_t  ConfigAttributes
; /**< Configuration attributes, comprised of a mask of zero or 
 388                                                             *   more USB_CONFIG_ATTR_* masks. 
 391                                 uint8_t  MaxPowerConsumption
; /**< Maximum power consumption of the device while in the 
 392                                                                *   current configuration, calculated by the \ref USB_CONFIG_POWER_MA() 
 395                         } USB_Descriptor_Configuration_Header_t
; 
 397                         /** \brief Standard USB Configuration Descriptor (USB-IF naming conventions). 
 399                          *  Type define for a standard Configuration Descriptor header. This structure uses the relevant standard's given element names 
 400                          *  to ensure compatibility with the standard. 
 402                          *  \see \ref USB_Descriptor_Device_t for the version of this type 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                                 uint16_t wTotalLength
; /**< Size of the configuration descriptor header, 
 411                                                            *   and all sub descriptors inside the configuration. 
 413                                 uint8_t  bNumInterfaces
; /**< Total number of interfaces in the configuration. */ 
 414                                 uint8_t  bConfigurationValue
; /**< Configuration index of the current configuration. */ 
 415                                 uint8_t  iConfiguration
; /**< Index of a string descriptor describing the configuration. */ 
 416                                 uint8_t  bmAttributes
; /**< Configuration attributes, comprised of a mask of zero or 
 417                                                         *   more USB_CONFIG_ATTR_* masks. 
 419                                 uint8_t  bMaxPower
; /**< Maximum power consumption of the device while in the 
 420                                                      *   current configuration, calculated by the \ref USB_CONFIG_POWER_MA() 
 423                         } USB_StdDescriptor_Configuration_Header_t
; 
 425                         /** \brief Standard USB Interface Descriptor (LUFA naming conventions). 
 427                          *  Type define for a standard Interface Descriptor. This structure uses LUFA-specific element names 
 428                          *  to make each element's purpose clearer. 
 430                          *  \see \ref USB_StdDescriptor_Interface_t for the version of this type with standard element names. 
 434                                 USB_Descriptor_Header_t Header
; /**< Descriptor header, including type and size. */ 
 436                                 uint8_t InterfaceNumber
; /**< Index of the interface in the current configuration. */ 
 437                                 uint8_t AlternateSetting
; /**< Alternate setting for the interface number. The same 
 438                                                            *   interface number can have multiple alternate settings 
 439                                                            *   with different endpoint configurations, which can be 
 440                                                            *   selected by the host. 
 442                                 uint8_t TotalEndpoints
; /**< Total number of endpoints in the interface. */ 
 444                                 uint8_t Class
; /**< Interface class ID. */ 
 445                                 uint8_t SubClass
; /**< Interface subclass ID. */ 
 446                                 uint8_t Protocol
; /**< Interface protocol ID. */ 
 448                                 uint8_t InterfaceStrIndex
; /**< Index of the string descriptor describing the interface. */ 
 449                         } USB_Descriptor_Interface_t
; 
 451                         /** \brief Standard USB Interface Descriptor (USB-IF naming conventions). 
 453                          *  Type define for a standard Interface Descriptor. This structure uses the relevant standard's given element names 
 454                          *  to ensure compatibility with the standard. 
 456                          *  \see \ref USB_Descriptor_Interface_t for the version of this type with non-standard LUFA specific element names. 
 460                                 uint8_t bLength
; /**< Size of the descriptor, in bytes. */ 
 461                                 uint8_t bDescriptorType
; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a value 
 462                                                           *   given by the specific class. 
 464                                 uint8_t bInterfaceNumber
; /**< Index of the interface in the current configuration. */ 
 465                                 uint8_t bAlternateSetting
; /**< Alternate setting for the interface number. The same 
 466                                                             *   interface number can have multiple alternate settings 
 467                                                             *   with different endpoint configurations, which can be 
 468                                                             *   selected by the host. 
 470                                 uint8_t bNumEndpoints
; /**< Total number of endpoints in the interface. */ 
 471                                 uint8_t bInterfaceClass
; /**< Interface class ID. */ 
 472                                 uint8_t bInterfaceSubClass
; /**< Interface subclass ID. */ 
 473                                 uint8_t bInterfaceProtocol
; /**< Interface protocol ID. */ 
 474                                 uint8_t iInterface
; /**< Index of the string descriptor describing the 
 477                         } USB_StdDescriptor_Interface_t
; 
 479                         /** \brief Standard USB Interface Association Descriptor (LUFA naming conventions). 
 481                          *  Type define for a standard Interface Association Descriptor. This structure uses LUFA-specific element names 
 482                          *  to make each element's purpose clearer. 
 484                          *  This descriptor has been added as a supplement to the USB2.0 standard, in the ECN located at 
 485                          *  <a>http://www.usb.org/developers/docs/InterfaceAssociationDescriptor_ecn.pdf</a>. It allows composite 
 486                          *  devices with multiple interfaces related to the same function to have the multiple interfaces bound 
 487                          *  together at the point of enumeration, loading one generic driver for all the interfaces in the single 
 488                          *  function. Read the ECN for more information. 
 490                          *  \see \ref USB_StdDescriptor_Interface_Association_t for the version of this type with standard element names. 
 494                                 USB_Descriptor_Header_t Header
; /**< Descriptor header, including type and size. */ 
 496                                 uint8_t FirstInterfaceIndex
; /**< Index of the first associated interface. */ 
 497                                 uint8_t TotalInterfaces
; /**< Total number of associated interfaces. */ 
 499                                 uint8_t Class
; /**< Interface class ID. */ 
 500                                 uint8_t SubClass
; /**< Interface subclass ID. */ 
 501                                 uint8_t Protocol
; /**< Interface protocol ID. */ 
 503                                 uint8_t IADStrIndex
; /**< Index of the string descriptor describing the 
 504                                                       *   interface association. 
 506                         } USB_Descriptor_Interface_Association_t
; 
 508                         /** \brief Standard USB Interface Association Descriptor (USB-IF naming conventions). 
 510                          *  Type define for a standard Interface Association Descriptor. This structure uses the relevant standard's given 
 511                          *  element names to ensure compatibility with the standard. 
 513                          *  This descriptor has been added as a supplement to the USB2.0 standard, in the ECN located at 
 514                          *  <a>http://www.usb.org/developers/docs/InterfaceAssociationDescriptor_ecn.pdf</a>. It allows composite 
 515                          *  devices with multiple interfaces related to the same function to have the multiple interfaces bound 
 516                          *  together at the point of enumeration, loading one generic driver for all the interfaces in the single 
 517                          *  function. Read the ECN for more information. 
 519                          *  \see \ref USB_Descriptor_Interface_Association_t for the version of this type with non-standard LUFA specific 
 524                                 uint8_t bLength
; /**< Size of the descriptor, in bytes. */ 
 525                                 uint8_t bDescriptorType
; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a value 
 526                                                           *   given by the specific class. 
 528                                 uint8_t bFirstInterface
; /**< Index of the first associated interface. */ 
 529                                 uint8_t bInterfaceCount
; /**< Total number of associated interfaces. */ 
 530                                 uint8_t bFunctionClass
; /**< Interface class ID. */ 
 531                                 uint8_t bFunctionSubClass
; /**< Interface subclass ID. */ 
 532                                 uint8_t bFunctionProtocol
; /**< Interface protocol ID. */ 
 533                                 uint8_t iFunction
; /**< Index of the string descriptor describing the 
 534                                                     *   interface association. 
 536                         } USB_StdDescriptor_Interface_Association_t
; 
 538                         /** \brief Standard USB Endpoint Descriptor (LUFA naming conventions). 
 540                          *  Type define for a standard Endpoint Descriptor. This structure uses LUFA-specific element names 
 541                          *  to make each element's purpose clearer. 
 543                          *  \see \ref USB_StdDescriptor_Endpoint_t for the version of this type with standard element names. 
 547                                 USB_Descriptor_Header_t Header
; /**< Descriptor header, including type and size. */ 
 549                                 uint8_t  EndpointAddress
; /**< Logical address of the endpoint within the device for the current 
 550                                                            *   configuration, including direction mask. 
 552                                 uint8_t  Attributes
; /**< Endpoint attributes, comprised of a mask of the endpoint type (EP_TYPE_*) 
 553                                                       *   and attributes (ENDPOINT_ATTR_*) masks. 
 555                                 uint16_t EndpointSize
; /**< Size of the endpoint bank, in bytes. This indicates the maximum packet 
 556                                                         *   size that the endpoint can receive at a time. 
 558                                 uint8_t  PollingIntervalMS
; /**< Polling interval in milliseconds for the endpoint if it is an INTERRUPT 
 559                                                              *   or ISOCHRONOUS type. 
 561                         } USB_Descriptor_Endpoint_t
; 
 563                         /** \brief Standard USB Endpoint Descriptor (USB-IF naming conventions). 
 565                          *  Type define for a standard Endpoint Descriptor. This structure uses the relevant standard's given 
 566                          *  element names to ensure compatibility with the standard. 
 568                          *  \see \ref USB_Descriptor_Endpoint_t for the version of this type with non-standard LUFA specific 
 573                                 uint8_t  bLength
; /**< Size of the descriptor, in bytes. */ 
 574                                 uint8_t  bDescriptorType
; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a 
 575                                                            *   value given by the specific class. 
 577                                 uint8_t  bEndpointAddress
; /**< Logical address of the endpoint within the device for the current 
 578                                                             *   configuration, including direction mask. 
 580                                 uint8_t  bmAttributes
; /**< Endpoint attributes, comprised of a mask of the endpoint type (EP_TYPE_*) 
 581                                                         *   and attributes (ENDPOINT_ATTR_*) masks. 
 583                                 uint16_t wMaxPacketSize
; /**< Size of the endpoint bank, in bytes. This indicates the maximum packet size 
 584                                                           *   that the endpoint can receive at a time. 
 586                                 uint8_t  bInterval
; /**< Polling interval in milliseconds for the endpoint if it is an INTERRUPT or 
 589                         } USB_StdDescriptor_Endpoint_t
; 
 591                         /** \brief Standard USB String Descriptor (LUFA naming conventions). 
 593                          *  Type define for a standard string descriptor. Unlike other standard descriptors, the length 
 594                          *  of the descriptor for placement in the descriptor header must be determined by the \ref USB_STRING_LEN() 
 595                          *  macro rather than by the size of the descriptor structure, as the length is not fixed. 
 597                          *  This structure should also be used for string index 0, which contains the supported language IDs for 
 598                          *  the device as an array. 
 600                          *  This structure uses LUFA-specific element names to make each element's purpose clearer. 
 602                          *  \see \ref USB_StdDescriptor_String_t for the version of this type with standard element names. 
 606                                 USB_Descriptor_Header_t Header
; /**< Descriptor header, including type and size. */ 
 608                                 wchar_t UnicodeString
[]; /**< String data, as unicode characters (alternatively, 
 609                                                           *   string language IDs). If normal ASCII characters are 
 610                                                           *   to be used, they must be added as an array of characters 
 611                                                           *   rather than a normal C string so that they are widened to 
 614                                                           *   Under GCC, strings prefixed with the "L" character (before 
 615                                                           *   the opening string quotation mark) are considered to be 
 616                                                           *   Unicode strings, and may be used instead of an explicit 
 617                                                           *   array of ASCII characters. 
 619                         } USB_Descriptor_String_t
; 
 621                         /** \brief Standard USB String Descriptor (USB-IF naming conventions). 
 623                          *  Type define for a standard string descriptor. Unlike other standard descriptors, the length 
 624                          *  of the descriptor for placement in the descriptor header must be determined by the \ref USB_STRING_LEN() 
 625                          *  macro rather than by the size of the descriptor structure, as the length is not fixed. 
 627                          *  This structure should also be used for string index 0, which contains the supported language IDs for 
 628                          *  the device as an array. 
 630                          *  This structure uses the relevant standard's given element names to ensure compatibility with the standard. 
 632                          *  \see \ref USB_Descriptor_String_t for the version of this type with with non-standard LUFA specific 
 637                                 uint8_t bLength
; /**< Size of the descriptor, in bytes. */ 
 638                                 uint8_t bDescriptorType
; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t 
 639                                                           *   or a value given by the specific class. 
 641                                 int16_t bString
[]; /**< String data, as unicode characters (alternatively, string language IDs). 
 642                                                     *   If normal ASCII characters are to be used, they must be added as an array 
 643                                                     *   of characters rather than a normal C string so that they are widened to 
 646                                                     *   Under GCC, strings prefixed with the "L" character (before the opening string 
 647                                                     *   quotation mark) are considered to be Unicode strings, and may be used instead 
 648                                                     *   of an explicit array of ASCII characters. 
 650                         } USB_StdDescriptor_String_t
; 
 652         /* Private Interface - For use in library only: */ 
 653         #if !defined(__DOXYGEN__) 
 655                         #define VERSION_TENS(x)                   (int)((x) / 10) 
 656                         #define VERSION_ONES(x)                   (int)((x) - (10 * VERSION_TENS(x))) 
 657                         #define VERSION_TENTHS(x)                 (int)(((x) - (int)(x)) * 10) 
 658                         #define VERSION_HUNDREDTHS(x)             (int)((((x) - (int)(x)) * 100) - (10 * VERSION_TENTHS(x))) 
 661         /* Disable C linkage for C++ Compilers: */ 
 662                 #if defined(__cplusplus)