![]() |
Data Structures | |
struct | _USBGenericDescriptor |
struct | _USBDeviceDescriptor |
struct | _USBOtgDescriptor |
struct | _USBDeviceQualifierDescriptor |
struct | _USBConfigurationDescriptor |
struct | _USBDeviceBOSDescriptor |
struct | _USBDeviceCapabilities |
struct | _USB_DeviceLPMDescriptor |
USB Device LPM Descriptor structure. More... | |
struct | _USBInterfaceAssociationDescriptor |
struct | _USBInterfaceDescriptor |
struct | _USBEndpointDescriptor |
struct | __attribute__ |
A standard USB string descriptor structure. More... | |
Modules | |
USB Descriptor types | |
USB release numbers | |
USB Device Attributes | |
USB Endpoint definitions | |
USB String Descriptor Definitions | |
Defines | |
#define | USB_EP_TYPE_MASK 0x03 |
#define | USB_EP_ADDR_MASK 0x0f |
#define | USB_EP_DIR_IN 0x80 |
Endpoint transfer direction is IN. | |
#define | USB_EP_DIR_IN 0x80 |
Endpoint transfer direction is IN. | |
#define | USB_EP_DIR_OUT 0x00 |
Endpoint transfer direction is OUT. | |
#define | USB_EP_DIR_OUT 0x00 |
Endpoint transfer direction is OUT. | |
#define | USB_REQ_DIR_OUT (0<<7) |
USB request data transfer direction (bmRequestType). | |
#define | USB_REQ_DIR_IN (1<<7) |
Device to host. | |
#define | USB_REQ_DIR_MASK (1<<7) |
Mask. | |
#define | USB_REQ_TYPE_STANDARD (0<<5) |
USB request types (bmRequestType). | |
#define | USB_REQ_TYPE_CLASS (1<<5) |
Class-specific request. | |
#define | USB_REQ_TYPE_VENDOR (2<<5) |
Vendor-specific request. | |
#define | USB_REQ_TYPE_MASK (3<<5) |
Mask. | |
#define | USB_REQ_RECIP_DEVICE (0<<0) |
USB recipient codes (bmRequestType). | |
#define | USB_REQ_RECIP_INTERFACE (1<<0) |
Recipient interface. | |
#define | USB_REQ_RECIP_ENDPOINT (2<<0) |
Recipient endpoint. | |
#define | USB_REQ_RECIP_OTHER (3<<0) |
Recipient other. | |
#define | USB_REQ_RECIP_MASK (0x1F) |
Mask. | |
#define | USB_DC_EXT_BESL_DEEP_OFFSET 8 |
#define | USB_DC_EXT_BESL_DEEP(besl) ((besl & 0xF) << USB_DC_EXT_BESL_DEEP_OFFSET) |
#define | USB_DC_EXT_BESL_BASELINE_OFFSET 12 |
#define | USB_DC_EXT_BESL_BASELINE(besl) ((besl & 0xF) << USB_DC_EXT_BESL_BASELINE_OFFSET) |
#define | BESL_125_US 0 |
#define | BESL_150_US 1 |
#define | BESL_200_US 2 |
#define | BESL_300_US 3 |
#define | BESL_400_US 4 |
#define | BESL_500_US 5 |
#define | BESL_1000_US 6 |
#define | BESL_2000_US 7 |
#define | BESL_3000_US 8 |
#define | BESL_4000_US 9 |
#define | BESL_5000_US 10 |
#define | BESL_6000_US 11 |
#define | BESL_7000_US 12 |
#define | BESL_8000_US 13 |
#define | BESL_9000_US 14 |
#define | BESL_10000_US 15 |
#define | USB_LPM_ATTRIBUT_BLINKSTATE_MASK (0xF << 0) |
#define | USB_LPM_ATTRIBUT_BESL_MASK (0xF << 4) |
#define | USB_LPM_ATTRIBUT_REMOTEWAKE_MASK (1 << 8) |
#define | USB_LPM_ATTRIBUT_BLINKSTATE(value) ((value & 0xF) << 0) |
#define | USB_LPM_ATTRIBUT_BESL(value) ((value & 0xF) << 4) |
#define | USB_LPM_ATTRIBUT_REMOTEWAKE(value) ((value & 1) << 8) |
#define | USB_LPM_ATTRIBUT_BLINKSTATE_L1 USB_LPM_ATTRIBUT_BLINKSTATE(1) |
Typedefs | |
typedef uint32_t(* | USBDescriptorParseFunction )(void *descriptor, void *parseArg) |
Enumerations | |
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 } |
Standard USB requests (bRequest). | |
enum | usb_capability_type { USB_DC_USB20_EXTENSION = 0x02 } |
USB Device Capability types. | |
enum | usb_capability_extension_attr { 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. | |
enum | usb_interface_status { USB_IFACE_STATUS_RESERVED = 0 } |
Standard USB Interface status flags. | |
enum | usb_endpoint_status { USB_EP_STATUS_HALTED = 1 } |
Standard USB endpoint status flags. | |
enum | usb_endpoint_feature { USB_EP_FEATURE_HALT = 0 } |
Standard USB endpoint feature/status flags. | |
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 } |
Standard USB device feature flags. More... | |
Functions | |
uint32_t | USBGenericDescriptor_GetLength (const USBGenericDescriptor *descriptor) |
uint8_t | USBGenericDescriptor_GetType (const USBGenericDescriptor *descriptor) |
USBGenericDescriptor * | USBGenericDescriptor_GetNextDescriptor (const USBGenericDescriptor *descriptor) |
USBGenericDescriptor * | USBGenericDescriptor_Parse (const USBGenericDescriptor *descriptor, uint32_t totalLength, USBDescriptorParseFunction parseFunction, void *parseArg) |
uint8_t | USBEndpointDescriptor_GetNumber (const USBEndpointDescriptor *endpoint) |
uint8_t | USBEndpointDescriptor_GetDirection (const USBEndpointDescriptor *endpoint) |
uint8_t | USBEndpointDescriptor_GetType (const USBEndpointDescriptor *endpoint) |
uint16_t | USBEndpointDescriptor_GetMaxPacketSize (const USBEndpointDescriptor *endpoint) |
uint8_t | USBEndpointDescriptor_GetInterval (const USBEndpointDescriptor *endpoint) |
uint32_t | USBConfigurationDescriptor_GetTotalLength (const USBConfigurationDescriptor *configuration) |
unsigned char | USBConfigurationDescriptor_GetNumInterfaces (const USBConfigurationDescriptor *configuration) |
unsigned char | USBConfigurationDescriptor_IsSelfPowered (const USBConfigurationDescriptor *configuration) |
void | USBConfigurationDescriptor_Parse (const USBConfigurationDescriptor *configuration, USBInterfaceDescriptor **interfaces, USBEndpointDescriptor **endpoints, USBGenericDescriptor **others) |
struct _USBGenericDescriptor | __attribute__ ((__packed__)) USB_DeviceLPMDescriptor |
USB Device LPM Descriptor structure. |
#define USB_EP_TYPE_MASK 0x03 |
USB protocol port
Definition at line 108 of file USBDescriptors.h.
#define USB_LPM_ATTRIBUT_BLINKSTATE_MASK (0xF << 0) |
Fields definition from a LPM TOKEN
Definition at line 201 of file USBDescriptors.h.
#define USB_REQ_DIR_OUT (0<<7) |
USB request data transfer direction (bmRequestType).
Host to device
Definition at line 123 of file USBDescriptors.h.
#define USB_REQ_RECIP_DEVICE (0<<0) |
USB recipient codes (bmRequestType).
Recipient device
Definition at line 138 of file USBDescriptors.h.
#define USB_REQ_TYPE_STANDARD (0<<5) |
USB request types (bmRequestType).
Standard request
Definition at line 130 of file USBDescriptors.h.
enum usb_device_feature |
Standard USB device feature flags.
USB_DEV_FEATURE_REMOTE_WAKEUP |
Remote wakeup enabled. |
USB_DEV_FEATURE_TEST_MODE |
USB test mode. |
Definition at line 286 of file USBDescriptors.h.
struct _USBGenericDescriptor __attribute__ | ( | (__packed__) | ) |
USB Device LPM Descriptor structure.
The BOS descriptor and capabilities descriptors for LPM.
uint8_t USBConfigurationDescriptor_GetNumInterfaces | ( | const USBConfigurationDescriptor * | configuration | ) |
Returns the number of interfaces in a configuration.
configuration | Pointer to a USBConfigurationDescriptor instance. |
uint32_t USBConfigurationDescriptor_GetTotalLength | ( | const USBConfigurationDescriptor * | configuration | ) |
Returns the total length of a configuration, i.e. including the descriptors following it.
configuration | Pointer to a USBConfigurationDescriptor instance. |
uint8_t USBConfigurationDescriptor_IsSelfPowered | ( | const USBConfigurationDescriptor * | configuration | ) |
Indicates if the device is self-powered when in a given configuration.
configuration | Pointer to a USBConfigurationDescriptor instance. |
void USBConfigurationDescriptor_Parse | ( | const USBConfigurationDescriptor * | configuration, | |
USBInterfaceDescriptor ** | interfaces, | |||
USBEndpointDescriptor ** | endpoints, | |||
USBGenericDescriptor ** | others | |||
) |
Parses the given Configuration descriptor (followed by relevant interface, endpoint and class-specific descriptors) into three arrays. *Each array must have its size equal or greater to the number of descriptors it stores plus one*. A null-value is inserted after the last descriptor of each type to indicate the array end.
Note that if the pointer to an array is null (0), nothing is stored in it.
configuration | Pointer to the start of the whole Configuration descriptor. | |
interfaces | Pointer to the Interface descriptor array. | |
endpoints | Pointer to the Endpoint descriptor array. | |
others | Pointer to the class-specific descriptor array. |
uint8_t USBEndpointDescriptor_GetDirection | ( | const USBEndpointDescriptor * | endpoint | ) |
Returns the direction of an endpoint given its descriptor.
endpoint | Pointer to a USBEndpointDescriptor instance. |
uint8_t USBEndpointDescriptor_GetInterval | ( | const USBEndpointDescriptor * | endpoint | ) |
Returns the polling interval on an endpoint given its descriptor.
endpoint | - Pointer to a USBEndpointDescriptor instance. |
uint16_t USBEndpointDescriptor_GetMaxPacketSize | ( | const USBEndpointDescriptor * | endpoint | ) |
Returns the maximum size of a packet (in bytes) on an endpoint given its descriptor.
endpoint | - Pointer to a USBEndpointDescriptor instance. |
uint8_t USBEndpointDescriptor_GetNumber | ( | const USBEndpointDescriptor * | endpoint | ) |
Returns the number of an endpoint given its descriptor.
endpoint | Pointer to a USBEndpointDescriptor instance. |
uint8_t USBEndpointDescriptor_GetType | ( | const USBEndpointDescriptor * | endpoint | ) |
Returns the type of an endpoint given its descriptor.
endpoint | Pointer to a USBEndpointDescriptor instance. |
uint32_t USBGenericDescriptor_GetLength | ( | const USBGenericDescriptor * | descriptor | ) |
Returns the length of a descriptor.
descriptor | Pointer to a USBGenericDescriptor instance. |
USBGenericDescriptor * USBGenericDescriptor_GetNextDescriptor | ( | const USBGenericDescriptor * | descriptor | ) |
Returns a pointer to the descriptor right after the given one, when parsing a Configuration descriptor.
descriptor | - Pointer to a USBGenericDescriptor instance. |
uint8_t USBGenericDescriptor_GetType | ( | const USBGenericDescriptor * | descriptor | ) |
Returns the type of a descriptor.
descriptor | Pointer to a USBGenericDescriptor instance. |
USBGenericDescriptor * USBGenericDescriptor_Parse | ( | const USBGenericDescriptor * | descriptor, | |
uint32_t | totalLength, | |||
USBDescriptorParseFunction | parseFunction, | |||
void * | parseArg | |||
) |
Parses the given descriptor list via customized function.
descriptor | Pointer to the start of the whole descriptors list. | |
totalLength | Total size of descriptors in bytes. | |
parseFunction | Function to parse each descriptor scanned. Return 0 to continue parsing. | |
parseArg | Argument passed to parse function. |