Lightweight USB stack
1.0
|
This module contains generic USB device framework definitions. More...
Modules | |
USB standard LANGID codes | |
Data Structures | |
struct | usb_header_descriptor |
common USB descriptor header More... | |
struct | usb_device_descriptor |
Represents a USB device descriptor. More... | |
struct | usb_qualifier_descriptor |
USB device qualifier descriptor. More... | |
struct | usb_config_descriptor |
USB device configuration descriptor. More... | |
struct | usb_interface_descriptor |
USB interface descriptor. More... | |
struct | usb_iad_descriptor |
USB interface association descriptor. More... | |
struct | usb_endpoint_descriptor |
USB endpoint descriptor. More... | |
struct | usb_string_descriptor |
USB string descriptor. More... | |
struct | usb_debug_descriptor |
USB debug descriptor. More... | |
Utility functional macros | |
#define | VERSION_BCD(maj, min, rev) (((maj & 0xFF) << 8) | ((min & 0x0F) << 4) | (rev & 0x0F)) |
#define | USB_ARRAY_DESC(...) |
#define | USB_STRING_DESC(s) |
#define | USB_CFG_POWER_MA(mA) ((mA) >> 1) |
Macro to set мaximum power consumption field for the usb_config_descriptor. | |
USB device configuration definitions | |
#define | USB_CFG_ATTR_RESERVED 0x80 |
#define | USB_CFG_ATTR_SELFPOWERED 0x40 |
USB endpoint attributes definitions | |
#define | USB_EPDIR_IN 0x00 |
Host-to-device endpoint direction. | |
#define | USB_EPDIR_OUT 0x80 |
Device-to-host endpoint direction. | |
#define | USB_EPTYPE_CONTROL 0x00 |
Control endpoint. | |
#define | USB_EPTYPE_ISOCHRONUS 0x01 |
Isochronous endpoint. | |
#define | USB_EPTYPE_BULK 0x02 |
Bbulk endpoint. | |
#define | USB_EPTYPE_INTERRUPT 0x03 |
Interrupt endpoint. | |
#define | USB_EPATTR_NO_SYNC 0x00 |
No synchronization. | |
#define | USB_EPATTR_ASYNC 0x04 |
Asynchronous endpoint. | |
#define | USB_EPATTR_ADAPTIVE 0x08 |
Adaptive endpoint. | |
#define | USB_EPATTR_SYNC 0x0C |
Synchronous endpoint. | |
#define | USB_EPUSAGE_DATA 0x00 |
Data endpoint. | |
#define | USB_EPUSAGE_FEEDBACK 0x10 |
Feedback endpoint. | |
#define | USB_EPUSAGE_IMP_FEEDBACK 0x20 |
Implicit feedback Data endpoint. | |
Special string descriptor indexes | |
#define | NO_DESCRIPTOR 0x00 |
String descriptor doesn't exists in the device. | |
#define | INTSERIALNO_DESCRIPTOR 0xFE |
String descriptor is an internal serial number provided by hardware driver. | |
USB class definitions | |
#define | USB_CLASS_PER_INTERFACE 0x00 |
Class defined on interface level. | |
#define | USB_SUBCLASS_NONE 0x00 |
No subclass defined. | |
#define | USB_PROTO_NONE 0x00 |
No protocol defined. | |
#define | USB_CLASS_AUDIO 0x01 |
Audio device class. | |
#define | USB_CLASS_PHYSICAL 0x05 |
Physical device class. | |
#define | USB_CLASS_STILL_IMAGE 0x06 |
Still Imaging device class. | |
#define | USB_CLASS_PRINTER 0x07 |
Printer device class. | |
#define | USB_CLASS_MASS_STORAGE 0x08 |
Mass Storage device class. | |
#define | USB_CLASS_HUB 0x09 |
HUB device class. | |
#define | USB_CLASS_CSCID 0x0B |
Smart Card device class. | |
#define | USB_CLASS_CONTENT_SEC 0x0D |
Content Security device class. | |
#define | USB_CLASS_VIDEO 0x0E |
Video device class. | |
#define | USB_CLASS_HEALTHCARE 0x0F |
Personal Healthcare device class. | |
#define | USB_CLASS_AV 0x10 |
Audio/Video device class. | |
#define | USB_CLASS_BILLBOARD 0x11 |
Billboard device class. | |
#define | USB_CLASS_CBRIDGE 0x12 |
USB Type-C Bridge device class. | |
#define | USB_CLASS_DIAGNOSTIC 0xDC |
Diagnostic device class. | |
#define | USB_CLASS_WIRELESS 0xE0 |
Wireless controller class. | |
#define | USB_CLASS_MISC 0xEF |
Miscellanious device class. | |
#define | USB_CLASS_APP_SPEC 0xFE |
Application Specific class. | |
#define | USB_CLASS_VENDOR 0xFF |
Vendor specific class. | |
#define | USB_SUBCLASS_VENDOR 0xFF |
Vendor specific subclass. | |
#define | USB_PROTO_VENDOR 0xFF |
Vendor specific protocol. | |
#define | USB_CLASS_IAD 0xEF |
Class defined on interface association level. | |
#define | USB_SUBCLASS_IAD 0x02 |
Subclass defined on interface association level. | |
#define | USB_PROTO_IAD 0x01 |
Protocol defined on interface association level. | |
USB Standard descriptor types | |
#define | USB_DTYPE_DEVICE 0x01 |
Device descriptor. | |
#define | USB_DTYPE_CONFIGURATION 0x02 |
Configuration descriptor. | |
#define | USB_DTYPE_STRING 0x03 |
String descriptor. | |
#define | USB_DTYPE_INTERFACE 0x04 |
Interface descriptor. | |
#define | USB_DTYPE_ENDPOINT 0x05 |
Endpoint descriptor. | |
#define | USB_DTYPE_QUALIFIER 0x06 |
Qualifier descriptor. | |
#define | USB_DTYPE_OTHER 0x07 |
Descriptor is of other type. | |
#define | USB_DTYPE_INTERFACEPOWER 0x08 |
Interface power descriptor. | |
#define | USB_DTYPE_OTG 0x09 |
OTG descriptor. | |
#define | USB_DTYPE_DEBUG 0x0A |
Debug descriptor. | |
#define | USB_DTYPE_INTERFASEASSOC 0x0B |
Interface association descriptor. | |
#define | USB_DTYPE_CS_INTERFACE 0x24 |
Class specific interface descriptor. | |
#define | USB_DTYPE_CS_ENDPOINT 0x25 |
Class specific endpoint descriptor. | |
USB Standard requests | |
#define | USB_STD_GET_STATUS 0x00 |
Returns status for the specified recipient. | |
#define | USB_STD_CLEAR_FEATURE 0x01 |
Used to clear or disable a specific feature. | |
#define | USB_STD_SET_FEATURE 0x03 |
Used to set or enable a specific feature. | |
#define | USB_STD_SET_ADDRESS 0x05 |
Sets the device address for all future device accesses. | |
#define | USB_STD_GET_DESCRIPTOR 0x06 |
Returns the specified descriptor if the descriptor exists. | |
#define | USB_STD_SET_DESCRIPTOR 0x07 |
This request is optional and may be used to update existing descriptors or new descriptors may be added. | |
#define | USB_STD_GET_CONFIG 0x08 |
Returns the current device configuration value. | |
#define | USB_STD_SET_CONFIG 0x09 |
Sets the device configuration. | |
#define | USB_STD_GET_INTERFACE 0x0A |
Returns the selected alternate setting for the specified interface. | |
#define | USB_STD_SET_INTERFACE 0x0B |
Allows the host to select an alternate setting for the specified interface. | |
#define | USB_STD_SYNCH_FRAME 0x0C |
Used to set and then report an endpoint's synchronization frame. | |
USB Feature selector | |
#define | USB_FEAT_ENDPOINT_HALT 0x00 |
Halt endpoint. | |
#define | USB_FEAT_REMOTE_WKUP 0x01 |
#define | USB_FEAT_TEST_MODE 0x02 |
#define | USB_FEAT_DEBUG_MODE 0x06 |
USB Test mode Selectors | |
#define | USB_TEST_J 0x01 |
Test J. | |
#define | USB_TEST_K 0x02 |
Test K. | |
#define | USB_TEST_SE0_NAK 0x03 |
Test SE0 NAK. | |
#define | USB_TEST_PACKET 0x04 |
Test Pcaket. | |
#define | USB_TEST_FORCE_ENABLE 0x05 |
Test Force Enable. | |
This module contains generic USB device framework definitions.
This module based on
#define VERSION_BCD | ( | maj, | |
min, | |||
rev | |||
) | (((maj & 0xFF) << 8) | ((min & 0x0F) << 4) | (rev & 0x0F)) |
#define USB_ARRAY_DESC | ( | ... | ) |
Macro to create usb_string_descriptor from array
#define USB_STRING_DESC | ( | s | ) |
Macro to create usb_string_descriptor from string