|
Lightweight USB stack
1.0
|
Data Structures | |
| struct | usbd_driver |
| Represents a hardware USB driver call table. More... | |
Typedefs | |
| typedef uint32_t(* | usbd_hw_getinfo) (void) |
| Get USB device status and capabilities. More... | |
| typedef void(* | usbd_hw_enable) (bool enable) |
| Enables or disables USB hardware. More... | |
| typedef uint8_t(* | usbd_hw_connect) (bool connect) |
| typedef void(* | usbd_hw_setaddr) (uint8_t address) |
| Sets USB hardware address. More... | |
| typedef bool(* | usbd_hw_ep_config) (uint8_t ep, uint8_t eptype, uint16_t epsize) |
| Configures endpoint. More... | |
| typedef void(* | usbd_hw_ep_deconfig) (uint8_t ep) |
| De-configures, cleans and disables endpoint. More... | |
| typedef int32_t(* | usbd_hw_ep_read) (uint8_t ep, void *buf, uint16_t blen) |
| Reads data from OUT or control endpoint. More... | |
| typedef int32_t(* | usbd_hw_ep_write) (uint8_t ep, void *buf, uint16_t blen) |
| Writes data to IN or control endpoint. More... | |
| typedef void(* | usbd_hw_ep_setstall) (uint8_t ep, bool stall) |
| typedef bool(* | usbd_hw_ep_isstalled) (uint8_t ep) |
| Checks endpoint for stalled state. More... | |
| typedef void(* | usbd_hw_poll) (usbd_device *dev, usbd_evt_callback callback) |
| Polls USB hardware for the events. More... | |
| typedef uint16_t(* | usbd_hw_get_frameno) (void) |
| Gets frame number from usb hardware. | |
| typedef uint16_t(* | usbd_hw_get_serialno) (void *buffer) |
| Makes a string descriptor contains unique serial number from hardware ID's. More... | |
USB device events | |
| #define | usbd_evt_reset 0 |
| Reset. | |
| #define | usbd_evt_sof 1 |
| Start of frame. | |
| #define | usbd_evt_susp 2 |
| Suspend. | |
| #define | usbd_evt_wkup 3 |
| Wakeup. | |
| #define | usbd_evt_eptx 4 |
| Data packet transmitted. | |
| #define | usbd_evt_eprx 5 |
| Data packet received. | |
| #define | usbd_evt_epsetup 6 |
| Setup packet received. | |
| #define | usbd_evt_error 7 |
| Data error. | |
| #define | usbd_evt_count 8 |
USB lanes connection states | |
| #define | usbd_lane_unk 0 |
| Unknown or proprietary charger. | |
| #define | usbd_lane_dsc 1 |
| Lanes disconnected. | |
| #define | usbd_lane_sdp 2 |
| Lanes connected to standard downstream port. | |
| #define | usbd_lane_cdp 3 |
| Lanes connected to charging downstream port. | |
| #define | usbd_lane_dcp 4 |
| Lanes connected to dedicated charging port. | |
USB HW capabilities and status | |
| #define | USBD_HW_ADDRFST (1 << 0) |
| Set address before STATUS_OUT. | |
| #define | USBD_HW_BC (1 << 1) |
| Battery charging detection supported. | |
| #define | USND_HW_HS (1 << 2) |
| High speed supported. | |
| #define | USBD_HW_ENABLED (1 << 3) |
| USB device enabled. | |
| #define | USBD_HW_ENUMSPEED (2 << 4) |
| USB device enumeration speed mask. | |
| #define | USBD_HW_SPEED_NC (0 << 4) |
| Not connected. | |
| #define | USBD_HW_SPEED_LS (1 << 4) |
| Low speed. | |
| #define | USBD_HW_SPEED_FS (2 << 4) |
| Full speed. | |
| #define | USBD_HW_SPEED_HS (3 << 4) |
| High speed. | |
| typedef uint32_t(* usbd_hw_getinfo) (void) |
Get USB device status and capabilities.
Definition at line 227 of file usbd_core.h.
| typedef void(* usbd_hw_enable) (bool enable) |
Enables or disables USB hardware.
| enable | Enables USB when TRUE disables otherwise. |
Definition at line 232 of file usbd_core.h.
| typedef uint8_t(* usbd_hw_connect) (bool connect) |
Connects or disconnects USB hardware to/from usb host
| connect | Connects USB to host if TRUE, disconnects otherwise |
Definition at line 238 of file usbd_core.h.
| typedef void(* usbd_hw_setaddr) (uint8_t address) |
Sets USB hardware address.
| address | USB address |
Definition at line 243 of file usbd_core.h.
| typedef bool(* usbd_hw_ep_config) (uint8_t ep, uint8_t eptype, uint16_t epsize) |
Configures endpoint.
| ep | endpoint address. Use USB_EPDIR_ macros to set endpoint direction |
| eptype | endpoint type. Use USB_EPTYPE_* macros. |
| epsize | endpoint size in bytes |
Definition at line 251 of file usbd_core.h.
| typedef void(* usbd_hw_ep_deconfig) (uint8_t ep) |
De-configures, cleans and disables endpoint.
| ep | endpoint index |
Definition at line 258 of file usbd_core.h.
| typedef int32_t(* usbd_hw_ep_read) (uint8_t ep, void *buf, uint16_t blen) |
Reads data from OUT or control endpoint.
| ep | endpoint index, should belong to OUT or CONTROL endpoint. |
| buf | pointer to read buffer |
| blen | size of the read buffer in bytes |
Definition at line 267 of file usbd_core.h.
| typedef int32_t(* usbd_hw_ep_write) (uint8_t ep, void *buf, uint16_t blen) |
Writes data to IN or control endpoint.
| ep | endpoint index, hould belong to IN or CONTROL endpoint |
| buf | pointer to data buffer |
| blen | size of data will be written |
Definition at line 275 of file usbd_core.h.
| typedef void(* usbd_hw_ep_setstall) (uint8_t ep, bool stall) |
Stalls and unstalls endpoint
| ep | endpoint address |
| stall | endpoint will be stalled if TRUE and unstalled otherwise. |
Definition at line 282 of file usbd_core.h.
| typedef bool(* usbd_hw_ep_isstalled) (uint8_t ep) |
Checks endpoint for stalled state.
| ep | endpoint address |
Definition at line 288 of file usbd_core.h.
| typedef void(* usbd_hw_poll) (usbd_device *dev, usbd_evt_callback callback) |
Polls USB hardware for the events.
| [in] | dev | pointer to usb device structure |
| callback | callback to event processing subroutine |
Definition at line 294 of file usbd_core.h.
| typedef uint16_t(* usbd_hw_get_serialno) (void *buffer) |
Makes a string descriptor contains unique serial number from hardware ID's.
| [in] | buffer | pointer to buffer for the descriptor |
Definition at line 304 of file usbd_core.h.