LPCOpen Platform
LPCOpen Platform for NXP LPC Microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
StdDescriptors.h File Reference
#include "../../../Common/Common.h"
#include "USBMode.h"
#include "Events.h"

Go to the source code of this file.

Macros

#define WBVAL(x)   ((x) & 0xFF),(((x) >> 8) & 0xFF)
 
#define NO_DESCRIPTOR   0
 
#define USB_CONFIG_POWER_MA(mA)   ((mA) >> 1)
 
#define USB_STRING_LEN(UnicodeChars)   (sizeof(USB_Descriptor_Header_t) + ((UnicodeChars) << 1))
 
#define VERSION_BCD(x)
 
#define LANGUAGE_ID_ENG   0x0409
 
USB Configuration Descriptor Attribute Masks
#define USB_CONFIG_ATTR_BUSPOWERED   0x80
 
#define USB_CONFIG_ATTR_SELFPOWERED   0x40
 
#define USB_CONFIG_ATTR_REMOTEWAKEUP   0x20
 
Endpoint Descriptor Attribute Masks
#define ENDPOINT_ATTR_NO_SYNC   (0 << 2)
 
#define ENDPOINT_ATTR_ASYNC   (1 << 2)
 
#define ENDPOINT_ATTR_ADAPTIVE   (2 << 2)
 
#define ENDPOINT_ATTR_SYNC   (3 << 2)
 
Endpoint Descriptor Usage Masks
#define ENDPOINT_USAGE_DATA   (0 << 4)
 
#define ENDPOINT_USAGE_FEEDBACK   (1 << 4)
 
#define ENDPOINT_USAGE_IMPLICIT_FEEDBACK   (2 << 4)
 

Typedefs

struct {
   uint8_t   Size
 
   uint8_t   Type
 
USB_Descriptor_Header_t
 
struct {
   uint8_t   bLength
 
   uint8_t   bDescriptorType
 
USB_StdDescriptor_Header_t
 
struct {
   USB_Descriptor_Header_t   Header
 
   uint16_t   USBSpecification
 
   uint8_t   Class
 
   uint8_t   SubClass
 
   uint8_t   Protocol
 
   uint8_t   Endpoint0Size
 
   uint16_t   VendorID
 
   uint16_t   ProductID
 
   uint16_t   ReleaseNumber
 
   uint8_t   ManufacturerStrIndex
 
   uint8_t   ProductStrIndex
 
   uint8_t   SerialNumStrIndex
 
   uint8_t   NumberOfConfigurations
 
USB_Descriptor_Device_t
 
struct {
   uint8_t   bLength
 
   uint8_t   bDescriptorType
 
   uint16_t   bcdUSB
 
   uint8_t   bDeviceClass
 
   uint8_t   bDeviceSubClass
 
   uint8_t   bDeviceProtocol
 
   uint8_t   bMaxPacketSize0
 
   uint16_t   idVendor
 
   uint16_t   idProduct
 
   uint16_t   bcdDevice
 
   uint8_t   iManufacturer
 
   uint8_t   iProduct
 
   uint8_t   iSerialNumber
 
   uint8_t   bNumConfigurations
 
USB_StdDescriptor_Device_t
 
struct {
   USB_Descriptor_Header_t   Header
 
   uint16_t   USBSpecification
 
   uint8_t   Class
 
   uint8_t   SubClass
 
   uint8_t   Protocol
 
   uint8_t   Endpoint0Size
 
   uint8_t   NumberOfConfigurations
 
   uint8_t   Reserved
 
USB_Descriptor_DeviceQualifier_t
 
struct {
   uint8_t   bLength
 
   uint8_t   bDescriptorType
 
   uint16_t   bcdUSB
 
   uint8_t   bDeviceClass
 
   uint8_t   bDeviceSubClass
 
   uint8_t   bDeviceProtocol
 
   uint8_t   bMaxPacketSize0
 
   uint8_t   bNumConfigurations
 
   uint8_t   bReserved
 
USB_StdDescriptor_DeviceQualifier_t
 
struct {
   USB_Descriptor_Header_t   Header
 
   uint16_t   TotalConfigurationSize
 
   uint8_t   TotalInterfaces
 
   uint8_t   ConfigurationNumber
 
   uint8_t   ConfigurationStrIndex
 
   uint8_t   ConfigAttributes
 
   uint8_t   MaxPowerConsumption
 
USB_Descriptor_Configuration_Header_t
 
struct {
   uint8_t   bLength
 
   uint8_t   bDescriptorType
 
   uint16_t   wTotalLength
 
   uint8_t   bNumInterfaces
 
   uint8_t   bConfigurationValue
 
   uint8_t   iConfiguration
 
   uint8_t   bmAttributes
 
   uint8_t   bMaxPower
 
USB_StdDescriptor_Configuration_Header_t
 
struct {
   USB_Descriptor_Header_t   Header
 
   uint8_t   InterfaceNumber
 
   uint8_t   AlternateSetting
 
   uint8_t   TotalEndpoints
 
   uint8_t   Class
 
   uint8_t   SubClass
 
   uint8_t   Protocol
 
   uint8_t   InterfaceStrIndex
 
USB_Descriptor_Interface_t
 
struct {
   uint8_t   bLength
 
   uint8_t   bDescriptorType
 
   uint8_t   bInterfaceNumber
 
   uint8_t   bAlternateSetting
 
   uint8_t   bNumEndpoints
 
   uint8_t   bInterfaceClass
 
   uint8_t   bInterfaceSubClass
 
   uint8_t   bInterfaceProtocol
 
   uint8_t   iInterface
 
USB_StdDescriptor_Interface_t
 
struct {
   USB_Descriptor_Header_t   Header
 
   uint8_t   FirstInterfaceIndex
 
   uint8_t   TotalInterfaces
 
   uint8_t   Class
 
   uint8_t   SubClass
 
   uint8_t   Protocol
 
   uint8_t   IADStrIndex
 
USB_Descriptor_Interface_Association_t
 
struct {
   uint8_t   bLength
 
   uint8_t   bDescriptorType
 
   uint8_t   bFirstInterface
 
   uint8_t   bInterfaceCount
 
   uint8_t   bFunctionClass
 
   uint8_t   bFunctionSubClass
 
   uint8_t   bFunctionProtocol
 
   uint8_t   iFunction
 
USB_StdDescriptor_Interface_Association_t
 
struct {
   USB_Descriptor_Header_t   Header
 
   uint8_t   EndpointAddress
 
   uint8_t   Attributes
 
   uint16_t   EndpointSize
 
   uint8_t   PollingIntervalMS
 
USB_Descriptor_Endpoint_t
 
struct {
   uint8_t   bLength
 
   uint8_t   bDescriptorType
 
   uint8_t   bEndpointAddress
 
   uint8_t   bmAttributes
 
   uint16_t   wMaxPacketSize
 
   uint8_t   bInterval
 
USB_StdDescriptor_Endpoint_t
 
struct {
   USB_Descriptor_Header_t   Header
 
   uint16_t   UnicodeString []
 
USB_Descriptor_String_t
 
struct {
   uint8_t   bLength
 
   uint8_t   bDescriptorType
 
   uint16_t   bString []
 
USB_StdDescriptor_String_t
 

Enumerations

enum  USB_DescriptorTypes_t {
  DTYPE_Device = 0x01, DTYPE_Configuration = 0x02, DTYPE_String = 0x03, DTYPE_Interface = 0x04,
  DTYPE_Endpoint = 0x05, DTYPE_DeviceQualifier = 0x06, DTYPE_Other = 0x07, DTYPE_InterfacePower = 0x08,
  DTYPE_InterfaceAssociation = 0x0B, DTYPE_CSInterface = 0x24, DTYPE_CSEndpoint = 0x25
}
 
enum  USB_Descriptor_ClassSubclassProtocol_t {
  USB_CSCP_NoDeviceClass = 0x00, USB_CSCP_NoDeviceSubclass = 0x00, USB_CSCP_NoDeviceProtocol = 0x00, USB_CSCP_VendorSpecificClass = 0xFF,
  USB_CSCP_VendorSpecificSubclass = 0xFF, USB_CSCP_VendorSpecificProtocol = 0xFF, USB_CSCP_IADDeviceClass = 0xEF, USB_CSCP_IADDeviceSubclass = 0x02,
  USB_CSCP_IADDeviceProtocol = 0x01
}
 

Variable Documentation

uint8_t AlternateSetting

Alternate setting for the interface number. The same interface number can have multiple alternate settings with different endpoint configurations, which can be selected by the host.

Definition at line 489 of file StdDescriptors.h.

uint8_t Attributes

Endpoint attributes, comprised of a mask of the endpoint type (EP_TYPE_*) and attributes (ENDPOINT_ATTR_*) masks.

Definition at line 612 of file StdDescriptors.h.

uint8_t bAlternateSetting

Alternate setting for the interface number. The same interface number can have multiple alternate settings with different endpoint configurations, which can be selected by the host.

Definition at line 519 of file StdDescriptors.h.

uint16_t bcdDevice

Product release (version) number.

Definition at line 339 of file StdDescriptors.h.

uint16_t bcdUSB

BCD of the supported USB specification.

Definition at line 332 of file StdDescriptors.h.

uint8_t bConfigurationValue

Configuration index of the current configuration.

Definition at line 464 of file StdDescriptors.h.

uint8_t bDescriptorType

Type of the descriptor, either a value in USB_DescriptorTypes_t or a value given by the specific class.

Definition at line 261 of file StdDescriptors.h.

uint8_t bDeviceClass

USB device class.

Definition at line 333 of file StdDescriptors.h.

uint8_t bDeviceProtocol

USB device protocol.

Definition at line 335 of file StdDescriptors.h.

uint8_t bDeviceSubClass

USB device subclass.

Definition at line 334 of file StdDescriptors.h.

uint8_t bEndpointAddress

Logical address of the endpoint within the device for the current configuration, including direction mask.

Definition at line 639 of file StdDescriptors.h.

uint8_t bFirstInterface

Index of the first associated interface.

Definition at line 586 of file StdDescriptors.h.

uint8_t bFunctionClass

Interface class ID.

Definition at line 588 of file StdDescriptors.h.

uint8_t bFunctionProtocol

Interface protocol ID.

Definition at line 590 of file StdDescriptors.h.

uint8_t bFunctionSubClass

Interface subclass ID.

Definition at line 589 of file StdDescriptors.h.

uint8_t bInterfaceClass

Interface class ID.

Definition at line 525 of file StdDescriptors.h.

uint8_t bInterfaceCount

Total number of associated interfaces.

Definition at line 587 of file StdDescriptors.h.

uint8_t bInterfaceNumber

Index of the interface in the current configuration.

Definition at line 518 of file StdDescriptors.h.

uint8_t bInterfaceProtocol

Interface protocol ID.

Definition at line 527 of file StdDescriptors.h.

uint8_t bInterfaceSubClass

Interface subclass ID.

Definition at line 526 of file StdDescriptors.h.

uint8_t bInterval

Polling interval in milliseconds for the endpoint if it is an INTERRUPT or ISOCHRONOUS type.

Definition at line 648 of file StdDescriptors.h.

uint8_t bLength

Size of the descriptor, in bytes.

Definition at line 260 of file StdDescriptors.h.

uint8_t bmAttributes

Configuration attributes, comprised of a mask of zero or more USB_CONFIG_ATTR_* masks.

Endpoint attributes, comprised of a mask of the endpoint type (EP_TYPE_*) and attributes (ENDPOINT_ATTR_*) masks.

Definition at line 466 of file StdDescriptors.h.

uint8_t bMaxPacketSize0

Size of the control (address 0) endpoint's bank in bytes.

Definition at line 336 of file StdDescriptors.h.

uint8_t bMaxPower

Maximum power consumption of the device while in the current configuration, calculated by the USB_CONFIG_POWER_MA() macro.

Definition at line 469 of file StdDescriptors.h.

uint8_t bNumConfigurations

Total number of configurations supported by the device.

Definition at line 362 of file StdDescriptors.h.

uint8_t bNumEndpoints

Total number of endpoints in the interface.

Definition at line 524 of file StdDescriptors.h.

uint8_t bNumInterfaces

Total number of interfaces in the configuration.

Definition at line 463 of file StdDescriptors.h.

uint8_t bReserved

Reserved for future use, must be 0.

Definition at line 411 of file StdDescriptors.h.

uint16_t bString[]

String data, as unicode characters (alternatively, string language IDs). If normal ASCII characters are to be used, they must be added as an array of characters rather than a normal C string so that they are widened to Unicode size.

Under GCC, strings prefixed with the "L" character (before the opening string quotation mark) are considered to be Unicode strings, and may be used instead of an explicit array of ASCII characters.

Definition at line 712 of file StdDescriptors.h.

uint8_t Class

USB device class.

Interface class ID.

Definition at line 280 of file StdDescriptors.h.

uint8_t ConfigAttributes

Configuration attributes, comprised of a mask of zero or more USB_CONFIG_ATTR_* masks.

Definition at line 435 of file StdDescriptors.h.

uint8_t ConfigurationNumber

Configuration index of the current configuration.

Definition at line 432 of file StdDescriptors.h.

uint8_t ConfigurationStrIndex

Index of a string descriptor describing the configuration.

Definition at line 433 of file StdDescriptors.h.

uint8_t Endpoint0Size

Size of the control (address 0) endpoint's bank in bytes.

Definition at line 284 of file StdDescriptors.h.

uint8_t EndpointAddress

Logical address of the endpoint within the device for the current configuration, including direction mask.

Definition at line 609 of file StdDescriptors.h.

uint16_t EndpointSize

Size of the endpoint bank, in bytes. This indicates the maximum packet size that the endpoint can receive at a time.

Definition at line 615 of file StdDescriptors.h.

uint8_t FirstInterfaceIndex

Index of the first associated interface.

Definition at line 552 of file StdDescriptors.h.

Descriptor header, including type and size.

Definition at line 277 of file StdDescriptors.h.

uint8_t IADStrIndex

Index of the string descriptor describing the interface association.

Definition at line 559 of file StdDescriptors.h.

uint8_t iConfiguration

Index of a string descriptor describing the configuration.

Definition at line 465 of file StdDescriptors.h.

uint16_t idProduct

Unique product ID for the USB product.

Definition at line 338 of file StdDescriptors.h.

uint16_t idVendor

Vendor ID for the USB product.

Definition at line 337 of file StdDescriptors.h.

uint8_t iFunction

Index of the string descriptor describing the interface association.

Definition at line 591 of file StdDescriptors.h.

uint8_t iInterface

Index of the string descriptor describing the interface.

Definition at line 528 of file StdDescriptors.h.

uint8_t iManufacturer

String index for the manufacturer's name. The host will request this string via a separate control request for the string descriptor.

Note
If no string supplied, use NO_DESCRIPTOR.

Definition at line 340 of file StdDescriptors.h.

uint8_t InterfaceNumber

Index of the interface in the current configuration.

Definition at line 488 of file StdDescriptors.h.

uint8_t InterfaceStrIndex

Index of the string descriptor describing the interface.

Definition at line 500 of file StdDescriptors.h.

uint8_t iProduct

String index for the product name/details.

                      @see ManufacturerStrIndex structure entry.

Definition at line 346 of file StdDescriptors.h.

uint8_t iSerialNumber

String index for the product's globally unique hexadecimal serial number, in uppercase Unicode ASCII.

Note
On some microcontroller models, there is an embedded serial number in the chip which can be used for the device serial number. To use this serial number, set this to USE_INTERNAL_SERIAL. On unsupported devices, this will evaluate to 0 and will cause the host to generate a pseudo-unique value for the device upon insertion.
See Also
ManufacturerStrIndex structure entry.

Definition at line 350 of file StdDescriptors.h.

uint8_t ManufacturerStrIndex

String index for the manufacturer's name. The host will request this string via a separate control request for the string descriptor.

Note
If no string supplied, use NO_DESCRIPTOR.

Definition at line 290 of file StdDescriptors.h.

uint8_t MaxPowerConsumption

Maximum power consumption of the device while in the current configuration, calculated by the USB_CONFIG_POWER_MA() macro.

Definition at line 439 of file StdDescriptors.h.

uint8_t NumberOfConfigurations

Total number of configurations supported by the device.

Definition at line 312 of file StdDescriptors.h.

uint8_t PollingIntervalMS

Polling interval in milliseconds for the endpoint if it is an INTERRUPT or ISOCHRONOUS type.

Definition at line 618 of file StdDescriptors.h.

uint16_t ProductID

Unique product ID for the USB product.

Definition at line 287 of file StdDescriptors.h.

uint8_t ProductStrIndex

String index for the product name/details.

                             @see ManufacturerStrIndex structure entry.

Definition at line 296 of file StdDescriptors.h.

uint8_t Protocol

USB device protocol.

Interface protocol ID.

Definition at line 282 of file StdDescriptors.h.

uint16_t ReleaseNumber

Product release (version) number.

Definition at line 288 of file StdDescriptors.h.

uint8_t Reserved

Reserved for future use, must be 0.

Definition at line 387 of file StdDescriptors.h.

uint8_t SerialNumStrIndex

String index for the product's globally unique hexadecimal serial number, in uppercase Unicode ASCII.

Note
On some microcontroller models, there is an embedded serial number in the chip which can be used for the device serial number. To use this serial number, set this to USE_INTERNAL_SERIAL. On unsupported devices, this will evaluate to 0 and will cause the host to generate a pseudo-unique value for the device upon insertion.
See Also
ManufacturerStrIndex structure entry.

Definition at line 300 of file StdDescriptors.h.

uint8_t Size

Size of the descriptor, in bytes.

Definition at line 243 of file StdDescriptors.h.

uint8_t SubClass

USB device subclass.

Interface subclass ID.

Definition at line 281 of file StdDescriptors.h.

uint16_t TotalConfigurationSize

Size of the configuration descriptor header, and all sub descriptors inside the configuration.

Definition at line 427 of file StdDescriptors.h.

uint8_t TotalEndpoints

Total number of endpoints in the interface.

Definition at line 494 of file StdDescriptors.h.

uint8_t TotalInterfaces

Total number of interfaces in the configuration.

Total number of associated interfaces.

Definition at line 430 of file StdDescriptors.h.

uint8_t Type

Type of the descriptor, either a value in USB_DescriptorTypes_t or a value given by the specific class.

Definition at line 244 of file StdDescriptors.h.

uint16_t UnicodeString[]

String data, as unicode characters (alternatively, string language IDs). If normal ASCII characters are to be used, they must be added as an array of characters rather than a normal C string so that they are widened to Unicode size.

Under GCC, strings prefixed with the "L" character (before the opening string quotation mark) are considered to be Unicode strings, and may be used instead of an explicit array of ASCII characters on little endian devices with UTF-16-LE wchar_t encoding.

Definition at line 675 of file StdDescriptors.h.

uint16_t USBSpecification

BCD of the supported USB specification.

Definition at line 279 of file StdDescriptors.h.

uint16_t VendorID

Vendor ID for the USB product.

Definition at line 286 of file StdDescriptors.h.

uint16_t wMaxPacketSize

Size of the endpoint bank, in bytes. This indicates the maximum packet size that the endpoint can receive at a time.

Definition at line 645 of file StdDescriptors.h.

uint16_t wTotalLength

Size of the configuration descriptor header, and all sub descriptors inside the configuration.

Definition at line 460 of file StdDescriptors.h.