Modules | |
USB Descriptor types | |
USB release numbers | |
USB Device Attributes | |
USB Endpoint definitions | |
USB String Descriptor Definitions | |
Classes | |
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_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_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... | |
Typedefs | |
typedef uint32_t(* | USBDescriptorParseFunction) (void *descriptor, void *parseArg) |
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) |
#define BESL_10000_US 15 |
Definition at line 198 of file USBDescriptors.h.
#define BESL_1000_US 6 |
Definition at line 189 of file USBDescriptors.h.
#define BESL_125_US 0 |
Definition at line 183 of file USBDescriptors.h.
#define BESL_150_US 1 |
Definition at line 184 of file USBDescriptors.h.
#define BESL_2000_US 7 |
Definition at line 190 of file USBDescriptors.h.
#define BESL_200_US 2 |
Definition at line 185 of file USBDescriptors.h.
#define BESL_3000_US 8 |
Definition at line 191 of file USBDescriptors.h.
#define BESL_300_US 3 |
Definition at line 186 of file USBDescriptors.h.
#define BESL_4000_US 9 |
Definition at line 192 of file USBDescriptors.h.
#define BESL_400_US 4 |
Definition at line 187 of file USBDescriptors.h.
#define BESL_5000_US 10 |
Definition at line 193 of file USBDescriptors.h.
#define BESL_500_US 5 |
Definition at line 188 of file USBDescriptors.h.
#define BESL_6000_US 11 |
Definition at line 194 of file USBDescriptors.h.
#define BESL_7000_US 12 |
Definition at line 195 of file USBDescriptors.h.
#define BESL_8000_US 13 |
Definition at line 196 of file USBDescriptors.h.
#define BESL_9000_US 14 |
Definition at line 197 of file USBDescriptors.h.
#define USB_DC_EXT_BESL_BASELINE | ( | besl | ) | ((besl & 0xF) << USB_DC_EXT_BESL_BASELINE_OFFSET) |
Definition at line 181 of file USBDescriptors.h.
#define USB_DC_EXT_BESL_BASELINE_OFFSET 12 |
Definition at line 180 of file USBDescriptors.h.
#define USB_DC_EXT_BESL_DEEP | ( | besl | ) | ((besl & 0xF) << USB_DC_EXT_BESL_DEEP_OFFSET) |
Definition at line 179 of file USBDescriptors.h.
#define USB_DC_EXT_BESL_DEEP_OFFSET 8 |
Definition at line 178 of file USBDescriptors.h.
#define USB_EP_ADDR_MASK 0x0f |
Definition at line 109 of file USBDescriptors.h.
#define USB_EP_DIR_IN 0x80 |
Endpoint transfer direction is IN.
Definition at line 337 of file USBDescriptors.h.
#define USB_EP_DIR_IN 0x80 |
Endpoint transfer direction is IN.
Definition at line 337 of file USBDescriptors.h.
#define USB_EP_DIR_OUT 0x00 |
Endpoint transfer direction is OUT.
Definition at line 342 of file USBDescriptors.h.
#define USB_EP_DIR_OUT 0x00 |
Endpoint transfer direction is OUT.
Definition at line 342 of file USBDescriptors.h.
#define USB_EP_TYPE_MASK 0x03 |
USB protocol port
Definition at line 108 of file USBDescriptors.h.
#define USB_LPM_ATTRIBUT_BESL | ( | value | ) | ((value & 0xF) << 4) |
Definition at line 205 of file USBDescriptors.h.
#define USB_LPM_ATTRIBUT_BESL_MASK (0xF << 4) |
Definition at line 202 of file USBDescriptors.h.
#define USB_LPM_ATTRIBUT_BLINKSTATE | ( | value | ) | ((value & 0xF) << 0) |
Definition at line 204 of file USBDescriptors.h.
#define USB_LPM_ATTRIBUT_BLINKSTATE_L1 USB_LPM_ATTRIBUT_BLINKSTATE(1) |
Definition at line 207 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_LPM_ATTRIBUT_REMOTEWAKE | ( | value | ) | ((value & 1) << 8) |
Definition at line 206 of file USBDescriptors.h.
#define USB_LPM_ATTRIBUT_REMOTEWAKE_MASK (1 << 8) |
Definition at line 203 of file USBDescriptors.h.
#define USB_REQ_DIR_IN (1<<7) |
Device to host.
Definition at line 124 of file USBDescriptors.h.
#define USB_REQ_DIR_MASK (1<<7) |
Mask.
Definition at line 125 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_RECIP_ENDPOINT (2<<0) |
Recipient endpoint.
Definition at line 140 of file USBDescriptors.h.
#define USB_REQ_RECIP_INTERFACE (1<<0) |
Recipient interface.
Definition at line 139 of file USBDescriptors.h.
#define USB_REQ_RECIP_MASK (0x1F) |
Mask.
Definition at line 142 of file USBDescriptors.h.
#define USB_REQ_RECIP_OTHER (3<<0) |
Recipient other.
Definition at line 141 of file USBDescriptors.h.
#define USB_REQ_TYPE_CLASS (1<<5) |
Class-specific request.
Definition at line 131 of file USBDescriptors.h.
#define USB_REQ_TYPE_MASK (3<<5) |
Mask.
Definition at line 133 of file USBDescriptors.h.
#define USB_REQ_TYPE_STANDARD (0<<5) |
#define USB_REQ_TYPE_VENDOR (2<<5) |
Vendor-specific request.
Definition at line 132 of file USBDescriptors.h.
typedef uint32_t(* USBDescriptorParseFunction) (void *descriptor, void *parseArg) |
Definition at line 462 of file USBDescriptors.h.
USB Device Capability - USB 2.0 Extension To fill bmAttributes field of usb_capa_ext_desc_t structure.
Enumerator | |
---|---|
USB_DC_EXT_LPM | |
USB_DC_EXT_LPM | |
USB_DC_EXT_BESL | |
USB_DC_EXT_BESL_BASELINE_VALID | |
USB_DC_EXT_BESL_DEEP_VALID |
Definition at line 172 of file USBDescriptors.h.
enum usb_capability_type |
USB Device Capability types.
Enumerator | |
---|---|
USB_DC_USB20_EXTENSION | |
USB_DC_USB20_EXTENSION |
Definition at line 164 of file USBDescriptors.h.
enum usb_device_feature |
Standard USB device feature flags.
Definition at line 286 of file USBDescriptors.h.
enum usb_endpoint_feature |
Standard USB endpoint feature/status flags.
Enumerator | |
---|---|
USB_EP_FEATURE_HALT | |
USB_EP_FEATURE_HALT |
Definition at line 277 of file USBDescriptors.h.
enum usb_endpoint_status |
Standard USB endpoint status flags.
Enumerator | |
---|---|
USB_EP_STATUS_HALTED | |
USB_EP_STATUS_HALTED |
Definition at line 270 of file USBDescriptors.h.
enum usb_interface_status |
Standard USB Interface status flags.
Enumerator | |
---|---|
USB_IFACE_STATUS_RESERVED | |
USB_IFACE_STATUS_RESERVED |
Definition at line 262 of file USBDescriptors.h.
enum usb_reqid |
Standard USB requests (bRequest)
Definition at line 147 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. |
Definition at line 206 of file USBDescriptors.c.
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. |
Definition at line 196 of file USBDescriptors.c.
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. |
Definition at line 217 of file USBDescriptors.c.
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. |
Definition at line 242 of file USBDescriptors.c.
uint8_t USBEndpointDescriptor_GetDirection | ( | const USBEndpointDescriptor * | endpoint | ) |
Returns the direction of an endpoint given its descriptor.
endpoint | Pointer to a USBEndpointDescriptor instance. |
Definition at line 144 of file USBDescriptors.c.
uint8_t USBEndpointDescriptor_GetInterval | ( | const USBEndpointDescriptor * | endpoint | ) |
Returns the polling interval on an endpoint given its descriptor.
endpoint | - Pointer to a USBEndpointDescriptor instance. |
Definition at line 183 of file USBDescriptors.c.
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. |
Definition at line 172 of file USBDescriptors.c.
uint8_t USBEndpointDescriptor_GetNumber | ( | const USBEndpointDescriptor * | endpoint | ) |
Returns the number of an endpoint given its descriptor.
endpoint | Pointer to a USBEndpointDescriptor instance. |
Definition at line 133 of file USBDescriptors.c.
uint8_t USBEndpointDescriptor_GetType | ( | const USBEndpointDescriptor * | endpoint | ) |
Returns the type of an endpoint given its descriptor.
endpoint | Pointer to a USBEndpointDescriptor instance. |
Definition at line 160 of file USBDescriptors.c.
uint32_t USBGenericDescriptor_GetLength | ( | const USBGenericDescriptor * | descriptor | ) |
Returns the length of a descriptor.
descriptor | Pointer to a USBGenericDescriptor instance. |
Definition at line 54 of file USBDescriptors.c.
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. |
Definition at line 77 of file USBDescriptors.c.
uint8_t USBGenericDescriptor_GetType | ( | const USBGenericDescriptor * | descriptor | ) |
Returns the type of a descriptor.
descriptor | Pointer to a USBGenericDescriptor instance. |
Definition at line 65 of file USBDescriptors.c.
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. |
Definition at line 92 of file USBDescriptors.c.