Classes | Macros | Typedefs | Enumerations | Functions | Variables
USBDescriptors.h File Reference
#include <stdint.h>
Include dependency graph for USBDescriptors.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  __attribute__
 A standard USB string descriptor structure. More...
 
struct  __attribute__
 A standard USB string descriptor structure. More...
 
struct  _USB_DeviceLPMDescriptor
 USB Device LPM Descriptor structure. More...
 
struct  _USBConfigurationDescriptor
 
struct  _USBDeviceBOSDescriptor
 
struct  _USBDeviceCapabilities
 
struct  _USBDeviceDescriptor
 
struct  _USBDeviceQualifierDescriptor
 
struct  _USBEndpointDescriptor
 
struct  _USBGenericDescriptor
 
struct  _USBInterfaceAssociationDescriptor
 
struct  _USBInterfaceDescriptor
 
struct  _USBOtgDescriptor
 

Macros

#define BESL_10000_US   15
 
#define BESL_1000_US   6
 
#define BESL_125_US   0
 
#define BESL_150_US   1
 
#define BESL_2000_US   7
 
#define BESL_200_US   2
 
#define BESL_3000_US   8
 
#define BESL_300_US   3
 
#define BESL_4000_US   9
 
#define BESL_400_US   4
 
#define BESL_5000_US   10
 
#define BESL_500_US   5
 
#define BESL_6000_US   11
 
#define BESL_7000_US   12
 
#define BESL_8000_US   13
 
#define BESL_9000_US   14
 
#define USB_DC_EXT_BESL_BASELINE(besl)   ((besl & 0xF) << USB_DC_EXT_BESL_BASELINE_OFFSET)
 
#define USB_DC_EXT_BESL_BASELINE_OFFSET   12
 
#define USB_DC_EXT_BESL_DEEP(besl)   ((besl & 0xF) << USB_DC_EXT_BESL_DEEP_OFFSET)
 
#define USB_DC_EXT_BESL_DEEP_OFFSET   8
 
#define USB_DT_BOS   0x0F
 
#define USB_EP_ADDR_MASK   0x0f
 
#define USB_EP_DIR_IN   0x80
 Endpoint transfer direction is IN. More...
 
#define USB_EP_DIR_IN   0x80
 Endpoint transfer direction is IN. More...
 
#define USB_EP_DIR_OUT   0x00
 Endpoint transfer direction is OUT. More...
 
#define USB_EP_DIR_OUT   0x00
 Endpoint transfer direction is OUT. More...
 
#define USB_EP_TYPE_MASK   0x03
 
#define USB_HOST_POWER_MAX   500
 
#define USB_LPM_ATTRIBUT_BESL(value)   ((value & 0xF) << 4)
 
#define USB_LPM_ATTRIBUT_BESL_MASK   (0xF << 4)
 
#define USB_LPM_ATTRIBUT_BLINKSTATE(value)   ((value & 0xF) << 0)
 
#define USB_LPM_ATTRIBUT_BLINKSTATE_L1   USB_LPM_ATTRIBUT_BLINKSTATE(1)
 
#define USB_LPM_ATTRIBUT_BLINKSTATE_MASK   (0xF << 0)
 
#define USB_LPM_ATTRIBUT_REMOTEWAKE(value)   ((value & 1) << 8)
 
#define USB_LPM_ATTRIBUT_REMOTEWAKE_MASK   (1 << 8)
 
#define USB_REQ_DIR_IN   (1<<7)
 Device to host. More...
 
#define USB_REQ_DIR_MASK   (1<<7)
 Mask. More...
 
#define USB_REQ_DIR_OUT   (0<<7)
 USB request data transfer direction (bmRequestType) More...
 
#define USB_REQ_RECIP_DEVICE   (0<<0)
 USB recipient codes (bmRequestType) More...
 
#define USB_REQ_RECIP_ENDPOINT   (2<<0)
 Recipient endpoint. More...
 
#define USB_REQ_RECIP_INTERFACE   (1<<0)
 Recipient interface. More...
 
#define USB_REQ_RECIP_MASK   (0x1F)
 Mask. More...
 
#define USB_REQ_RECIP_OTHER   (3<<0)
 Recipient other. More...
 
#define USB_REQ_TYPE_CLASS   (1<<5)
 Class-specific request. More...
 
#define USB_REQ_TYPE_MASK   (3<<5)
 Mask. More...
 
#define USB_REQ_TYPE_STANDARD   (0<<5)
 USB request types (bmRequestType) More...
 
#define USB_REQ_TYPE_VENDOR   (2<<5)
 Vendor-specific request. More...
 
#define USBConfigurationDescriptor_BUSPOWERED_NORWAKEUP   0x80
 
#define USBConfigurationDescriptor_BUSPOWERED_RWAKEUP   0xA0
 
#define USBConfigurationDescriptor_POWER(power)   (power / 2)
 
#define USBConfigurationDescriptor_REMOTE_WAKEUP   0x20
 
#define USBConfigurationDescriptor_SELFPOWERED_NORWAKEUP   0xC0
 
#define USBConfigurationDescriptor_SELFPOWERED_RWAKEUP   0xE0
 
#define USBDeviceDescriptor_USB2_00   0x0200
 
#define USBDeviceDescriptor_USB2_01   0x0201
 
#define USBEndpointDescriptor_Adaptive_ISOCHRONOUS   (2<<2)
 
#define USBEndpointDescriptor_ADDRESS(direction, number)   (((direction & 0x01) << 7) | (number & 0xF))
 
#define USBEndpointDescriptor_Asynchronous_ISOCHRONOUS   (1<<2)
 
#define USBEndpointDescriptor_BULK   2
 
#define USBEndpointDescriptor_CONTROL   0
 
#define USBEndpointDescriptor_Explicit_Feedback_ISOCHRONOUS   (2<<2)
 
#define USBEndpointDescriptor_Feedback_ISOCHRONOUS   (1<<2)
 
#define USBEndpointDescriptor_IN   1
 
#define USBEndpointDescriptor_INTERRUPT   3
 
#define USBEndpointDescriptor_ISOCHRONOUS   1
 
#define USBEndpointDescriptor_MAXBULKSIZE_FS   64
 
#define USBEndpointDescriptor_MAXBULKSIZE_HS   512
 
#define USBEndpointDescriptor_MAXCTRLSIZE_FS   64
 
#define USBEndpointDescriptor_MAXCTRLSIZE_HS   64
 
#define USBEndpointDescriptor_MAXINTERRUPTSIZE_FS   64
 
#define USBEndpointDescriptor_MAXINTERRUPTSIZE_HS   1024
 
#define USBEndpointDescriptor_MAXISOCHRONOUSSIZE_FS   1023
 
#define USBEndpointDescriptor_MAXISOCHRONOUSSIZE_HS   1024
 
#define USBEndpointDescriptor_OUT   0
 
#define USBEndpointDescriptor_Synchronous_ISOCHRONOUS   (3<<2)
 
#define USBGenericDescriptor_CONFIGURATION   2
 
#define USBGenericDescriptor_DEBUG   10
 
#define USBGenericDescriptor_DEVICE   1
 
#define USBGenericDescriptor_DEVICE_CAPABILITY   0x10
 
#define USBGenericDescriptor_DEVICEQUALIFIER   6
 
#define USBGenericDescriptor_ENDPOINT   5
 
#define USBGenericDescriptor_INTERFACE   4
 
#define USBGenericDescriptor_INTERFACEASSOCIATION   11
 
#define USBGenericDescriptor_INTERFACEPOWER   8
 
#define USBGenericDescriptor_OTG   9
 
#define USBGenericDescriptor_OTHERSPEEDCONFIGURATION   7
 
#define USBGenericDescriptor_STRING   3
 
#define USBStringDescriptor_ENGLISH_US   0x09, 0x04
 
#define USBStringDescriptor_LENGTH(length)   ((length) * 2 + 2)
 
#define USBStringDescriptor_UNICODE(ascii)   (ascii), 0
 

Typedefs

typedef uint32_t(* USBDescriptorParseFunction) (void *descriptor, void *parseArg)
 

Enumerations

enum  usb_capability_extension_attr {
  USB_DC_EXT_LPM = 0x00000002, USB_DC_EXT_LPM = 0x00000002, USB_DC_EXT_BESL = 0x00000004, USB_DC_EXT_BESL_BASELINE_VALID = 0x00000008,
  USB_DC_EXT_BESL_DEEP_VALID = 0x00000010
}
 USB Device Capability - USB 2.0 Extension To fill bmAttributes field of usb_capa_ext_desc_t structure. More...
 
enum  usb_capability_type { USB_DC_USB20_EXTENSION = 0x02, USB_DC_USB20_EXTENSION = 0x02 }
 USB Device Capability types. More...
 
enum  usb_device_feature {
  USB_DEV_FEATURE_REMOTE_WAKEUP = 1, USB_DEV_FEATURE_TEST_MODE = 2, USB_DEV_FEATURE_OTG_B_HNP_ENABLE = 3, USB_DEV_FEATURE_OTG_A_HNP_SUPPORT = 4,
  USB_DEV_FEATURE_OTG_A_ALT_HNP_SUPPORT = 5, USB_DEV_FEATURE_REMOTE_WAKEUP = 1, USB_DEV_FEATURE_TEST_MODE = 2, USB_DEV_FEATURE_OTG_B_HNP_ENABLE = 3,
  USB_DEV_FEATURE_OTG_A_HNP_SUPPORT = 4, USB_DEV_FEATURE_OTG_A_ALT_HNP_SUPPORT = 5
}
 Standard USB device feature flags. More...
 
enum  usb_endpoint_feature { USB_EP_FEATURE_HALT = 0, USB_EP_FEATURE_HALT = 0 }
 Standard USB endpoint feature/status flags. More...
 
enum  usb_endpoint_status { USB_EP_STATUS_HALTED = 1, USB_EP_STATUS_HALTED = 1 }
 Standard USB endpoint status flags. More...
 
enum  usb_interface_status { USB_IFACE_STATUS_RESERVED = 0, USB_IFACE_STATUS_RESERVED = 0 }
 Standard USB Interface status flags. More...
 
enum  usb_reqid {
  USB_REQ_GET_STATUS = 0, USB_REQ_CLEAR_FEATURE = 1, USB_REQ_SET_FEATURE = 3, USB_REQ_SET_ADDRESS = 5,
  USB_REQ_GET_DESCRIPTOR = 6, USB_REQ_SET_DESCRIPTOR = 7, USB_REQ_GET_CONFIGURATION = 8, USB_REQ_SET_CONFIGURATION = 9,
  USB_REQ_GET_INTERFACE = 10, USB_REQ_SET_INTERFACE = 11, USB_REQ_SYNCH_FRAME = 12, USB_REQ_GET_STATUS = 0,
  USB_REQ_CLEAR_FEATURE = 1, USB_REQ_SET_FEATURE = 3, USB_REQ_SET_ADDRESS = 5, USB_REQ_GET_DESCRIPTOR = 6,
  USB_REQ_SET_DESCRIPTOR = 7, USB_REQ_GET_CONFIGURATION = 8, USB_REQ_SET_CONFIGURATION = 9, USB_REQ_GET_INTERFACE = 10,
  USB_REQ_SET_INTERFACE = 11, USB_REQ_SYNCH_FRAME = 12
}
 Standard USB requests (bRequest) More...
 

Functions

struct _USBGenericDescriptor __attribute__ ((__packed__)) USB_DeviceLPMDescriptor
 USB Device LPM Descriptor structure. More...
 
unsigned char USBConfigurationDescriptor_GetNumInterfaces (const USBConfigurationDescriptor *configuration)
 
uint32_t USBConfigurationDescriptor_GetTotalLength (const USBConfigurationDescriptor *configuration)
 
unsigned char USBConfigurationDescriptor_IsSelfPowered (const USBConfigurationDescriptor *configuration)
 
void USBConfigurationDescriptor_Parse (const USBConfigurationDescriptor *configuration, USBInterfaceDescriptor **interfaces, USBEndpointDescriptor **endpoints, USBGenericDescriptor **others)
 
uint8_t USBEndpointDescriptor_GetDirection (const USBEndpointDescriptor *endpoint)
 
uint8_t USBEndpointDescriptor_GetInterval (const USBEndpointDescriptor *endpoint)
 
uint16_t USBEndpointDescriptor_GetMaxPacketSize (const USBEndpointDescriptor *endpoint)
 
uint8_t USBEndpointDescriptor_GetNumber (const USBEndpointDescriptor *endpoint)
 
uint8_t USBEndpointDescriptor_GetType (const USBEndpointDescriptor *endpoint)
 
uint32_t USBGenericDescriptor_GetLength (const USBGenericDescriptor *descriptor)
 
USBGenericDescriptor * USBGenericDescriptor_GetNextDescriptor (const USBGenericDescriptor *descriptor)
 
uint8_t USBGenericDescriptor_GetType (const USBGenericDescriptor *descriptor)
 
USBGenericDescriptor * USBGenericDescriptor_Parse (const USBGenericDescriptor *descriptor, uint32_t totalLength, USBDescriptorParseFunction parseFunction, void *parseArg)
 

Variables

typedef __attribute__
 USB Device LPM Descriptor structure. More...
 
uint8_t bAlternateSetting
 
uint16_t bcdDevice
 
uint16_t bcdUSB
 
uint8_t bConfigurationValue
 
uint8_t bDescriptorType
 
uint8_t bDevCapabilityType
 
uint8_t bDeviceClass
 
uint8_t bDeviceProtocol
 
uint8_t bDeviceSubClass
 
uint8_t bEndpointAddress
 
uint8_t bFirstInterface
 
uint8_t bFunctionClass
 
uint8_t bFunctionProtocol
 
uint8_t bFunctionSubClass
 
uint8_t bInterfaceClass
 
uint8_t bInterfaceCount
 
uint8_t bInterfaceNumber
 
uint8_t bInterfaceProtocol
 
uint8_t bInterfaceSubClass
 
uint8_t bInterval
 
uint8_t bLength
 
uint8_t bmAttributes
 
uint8_t bMaxPacketSize0
 
uint8_t bMaxPower
 
uint8_t bNumConfigurations
 
uint8_t bNumDeviceCaps
 
uint8_t bNumEndpoints
 
uint8_t bNumInterfaces
 
USBDeviceBOSDescriptor bos
 
uint8_t bReserved
 
USBDeviceCapabilities capa_ext
 
uint8_t iConfiguration
 
uint16_t idProduct
 
uint16_t idVendor
 
uint8_t iFunction
 
uint8_t iInterface
 
uint8_t iManufacturer
 
uint8_t iProduct
 
uint8_t iSerialNumber
 
uint16_t wMaxPacketSize
 
uint16_t wTotalLength
 

Detailed Description

Purpose

Definitions and methods for USB descriptor structures described by the USB specification.

Usage

Definition in file USBDescriptors.h.

Variable Documentation

◆ bAlternateSetting

uint8_t bAlternateSetting

Value to select this alternate interface setting.

Definition at line 471 of file USBDescriptors.h.

◆ bcdDevice

uint16_t bcdDevice

Device release number in BCD format.

Definition at line 483 of file USBDescriptors.h.

◆ bcdUSB

uint16_t bcdUSB

USB specification release number in BCD format.

USB specification release number (in BCD format).

Definition at line 469 of file USBDescriptors.h.

◆ bConfigurationValue

uint8_t bConfigurationValue

Value for selecting this configuration.

Definition at line 475 of file USBDescriptors.h.

◆ bDescriptorType

uint8_t bDescriptorType

Descriptor type.

Descriptor type (USBGenericDescriptor_DEVICE).

Descriptor type (USBGenericDescriptor_OTG).

Descriptor type (USBDESC_DEVICE_QUALIFIER or "USB device types").

Descriptor type (USBDESC_CONFIGURATION of USB Descriptor types USB Descriptor types).

Descriptor type (USBGenericDescriptor_INTERFACE).

Descriptor type (USBGenericDescriptor_ENDPOINT).

Definition at line 467 of file USBDescriptors.h.

◆ bDevCapabilityType

uint8_t bDevCapabilityType

Definition at line 465 of file USBDescriptors.h.

◆ bDeviceClass

uint8_t bDeviceClass

Device class code.

Definition at line 471 of file USBDescriptors.h.

◆ bDeviceProtocol

uint8_t bDeviceProtocol

Device protocol code.

Definition at line 475 of file USBDescriptors.h.

◆ bDeviceSubClass

uint8_t bDeviceSubClass

Device subclass code.

Definition at line 473 of file USBDescriptors.h.

◆ bEndpointAddress

uint8_t bEndpointAddress

Address and direction of the endpoint.

Definition at line 469 of file USBDescriptors.h.

◆ bFirstInterface

uint8_t bFirstInterface

First Interface .

Definition at line 469 of file USBDescriptors.h.

◆ bFunctionClass

uint8_t bFunctionClass

Function function code.

Definition at line 473 of file USBDescriptors.h.

◆ bFunctionProtocol

uint8_t bFunctionProtocol

Function protocol code.

Definition at line 477 of file USBDescriptors.h.

◆ bFunctionSubClass

uint8_t bFunctionSubClass

Function subclass code.

Definition at line 475 of file USBDescriptors.h.

◆ bInterfaceClass

uint8_t bInterfaceClass

Interface class code.

Definition at line 475 of file USBDescriptors.h.

◆ bInterfaceCount

uint8_t bInterfaceCount

Interface Count.

Definition at line 471 of file USBDescriptors.h.

◆ bInterfaceNumber

uint8_t bInterfaceNumber

Number of the interface in its configuration.

Definition at line 469 of file USBDescriptors.h.

◆ bInterfaceProtocol

uint8_t bInterfaceProtocol

Interface protocol code.

Definition at line 479 of file USBDescriptors.h.

◆ bInterfaceSubClass

uint8_t bInterfaceSubClass

Interface subclass code.

Definition at line 477 of file USBDescriptors.h.

◆ bInterval

uint8_t bInterval

Polling rate of the endpoint.

Definition at line 476 of file USBDescriptors.h.

◆ bLength

uint8_t bLength

Length of the descriptor in bytes.

Size of this descriptor in bytes.

Size of the descriptor in bytes.

Definition at line 465 of file USBDescriptors.h.

◆ bmAttributes

uint8_t bmAttributes

Attribute Fields D7?: Reserved D1: HNP support D0: SRP support

Configuration characteristics.

Endpoint type and additional characteristics (for isochronous endpoints).

Definition at line 469 of file USBDescriptors.h.

◆ bMaxPacketSize0

uint8_t bMaxPacketSize0

Maximum packet size of endpoint 0 (in bytes).

Maximum packet size of endpoint 0.

Definition at line 477 of file USBDescriptors.h.

◆ bMaxPower

uint8_t bMaxPower

Maximum power consumption of the device when in this configuration.

Definition at line 481 of file USBDescriptors.h.

◆ bNumConfigurations

uint8_t bNumConfigurations

Number of possible configurations for the device.

Definition at line 491 of file USBDescriptors.h.

◆ bNumDeviceCaps

uint8_t bNumDeviceCaps

Definition at line 466 of file USBDescriptors.h.

◆ bNumEndpoints

uint8_t bNumEndpoints

Number of endpoints used by the interface (excluding endpoint 0).

Definition at line 473 of file USBDescriptors.h.

◆ bNumInterfaces

uint8_t bNumInterfaces

Number of interfaces in this configuration.

Definition at line 473 of file USBDescriptors.h.

◆ bos

USBDeviceBOSDescriptor bos

Definition at line 463 of file USBDescriptors.h.

◆ bReserved

uint8_t bReserved

Reserved.

Definition at line 481 of file USBDescriptors.h.

◆ capa_ext

USBDeviceCapabilities capa_ext

Definition at line 464 of file USBDescriptors.h.

◆ iConfiguration

uint8_t iConfiguration

Index of the configuration string descriptor.

Definition at line 477 of file USBDescriptors.h.

◆ idProduct

uint16_t idProduct

Product ID.

Definition at line 481 of file USBDescriptors.h.

◆ idVendor

uint16_t idVendor

Vendor ID.

Definition at line 479 of file USBDescriptors.h.

◆ iFunction

uint8_t iFunction

Index of the function string descriptor.

Definition at line 479 of file USBDescriptors.h.

◆ iInterface

uint8_t iInterface

Index of the interface string descriptor.

Definition at line 481 of file USBDescriptors.h.

◆ iManufacturer

uint8_t iManufacturer

Index of the manufacturer string descriptor.

Definition at line 485 of file USBDescriptors.h.

◆ iProduct

uint8_t iProduct

Index of the product string descriptor.

Definition at line 487 of file USBDescriptors.h.

◆ iSerialNumber

uint8_t iSerialNumber

Index of the serial number string descriptor.

Definition at line 489 of file USBDescriptors.h.

◆ wMaxPacketSize

uint16_t wMaxPacketSize

Maximum packet size (in bytes) of the endpoint.

Definition at line 474 of file USBDescriptors.h.

◆ wTotalLength

uint16_t wTotalLength

Length of all descriptors returned along with this configuration descriptor.

Definition at line 471 of file USBDescriptors.h.



inertial_sense_ros
Author(s):
autogenerated on Sun Feb 28 2021 03:18:00