usbdev driver functions
More...
usbdev driver functions
Helpers (such as usbdev_init) are provided and should be used instead. Directly calling these functions is not recommended.
Definition at line 244 of file usbdev.h.
#include <usbdev.h>
|
void(* | init )(usbdev_t *usbdev) |
| Initialize the USB peripheral device. More...
|
|
usbdev_ep_t *(* | new_ep )(usbdev_t *dev, usb_ep_type_t type, usb_ep_dir_t dir, size_t buf_len) |
| Retrieve an USB endpoint of the specified type. More...
|
|
int(* | get )(usbdev_t *usbdev, usbopt_t opt, void *value, size_t max_len) |
| Get an option value from a given usb device. More...
|
|
int(* | set )(usbdev_t *usbdev, usbopt_t opt, const void *value, size_t value_len) |
| Set an option value for a given usb device. More...
|
|
void(* | esr )(usbdev_t *dev) |
| a driver's user-space event service handler More...
|
|
void(* | ep_init )(usbdev_ep_t *ep) |
| Initialize the USB endpoint. More...
|
|
int(* | ep_get )(usbdev_ep_t *ep, usbopt_ep_t opt, void *value, size_t max_len) |
| Get an option value from a given usb device endpoint. More...
|
|
int(* | ep_set )(usbdev_ep_t *ep, usbopt_ep_t opt, const void *value, size_t value_len) |
| Set an option value for a given usb device endpoint. More...
|
|
void(* | ep_esr )(usbdev_ep_t *ep) |
| an endpoint's user-space event handler More...
|
|
int(* | ready )(usbdev_ep_t *ep, size_t len) |
| Signal data buffer ready for data transmission. More...
|
|
◆ ep_esr
an endpoint's user-space event handler
Must be called in response to an USBDEV_EVENT_ESR event in userspace context.
- Parameters
-
[in] | ep | USB endpoint descriptor to service |
Definition at line 355 of file usbdev.h.
◆ ep_get
Get an option value from a given usb device endpoint.
- Parameters
-
[in] | ep | USB endpoint descriptor |
[in] | opt | option type |
[out] | value | pointer to store the option's value in |
[in] | max_len | maximum number of byte that fit into value |
- Returns
- number of bytes written to
value
-
< 0
on error
Definition at line 330 of file usbdev.h.
◆ ep_init
Initialize the USB endpoint.
This initializes the USB endpoint with the settings from the usbdev_ep.
- Parameters
-
[in] | ep | USB endpoint descriptor |
Definition at line 317 of file usbdev.h.
◆ ep_set
Set an option value for a given usb device endpoint.
- Parameters
-
[in] | ep | USB endpoint descriptor |
[in] | opt | option type |
[in] | value | pointer to the value |
[in] | value_len | the length of value |
- Returns
- number of bytes used from
value
-
< 0
on error
Definition at line 344 of file usbdev.h.
◆ esr
void(* usbdev_driver::esr) (usbdev_t *dev) |
a driver's user-space event service handler
This function will be called from a USB stack's loop when being notified by usbdev_event_isr.
- Parameters
-
[in] | dev | USB device descriptor |
Definition at line 307 of file usbdev.h.
◆ get
Get an option value from a given usb device.
- Parameters
-
[in] | dev | USB device descriptor |
[in] | opt | option type |
[out] | value | pointer to store the option's value in |
[in] | max_len | maximal amount of byte that fit into value |
- Returns
- number of bytes written to
value
-
< 0
on error 0
Definition at line 282 of file usbdev.h.
◆ init
Initialize the USB peripheral device.
This initializes the USB device but must not enable the USB pull up.
- Parameters
-
[in] | dev | USB device descriptor |
Definition at line 253 of file usbdev.h.
◆ new_ep
Retrieve an USB endpoint of the specified type.
requesting an endpoint of USB_EP_TYPE_CONTROL must always return endpoint 0 of the specified direction
- Parameters
-
[in] | dev | USB device descriptor |
[in] | type | USB endpoint type |
[in] | dir | USB endpoint direction |
[in] | buf_len | optimal USB endpoint buffer size |
- Returns
- ptr to the new USB endpoint descriptor
-
NULL on error
Definition at line 269 of file usbdev.h.
◆ ready
int(* usbdev_driver::ready) (usbdev_ep_t *ep, size_t len) |
Signal data buffer ready for data transmission.
This clears the stall setting in the endpoint if that is enabled.
- Parameters
-
[in] | ep | USB endpoint descriptor |
[in] | len | length of the data to be transmitted |
Definition at line 365 of file usbdev.h.
◆ set
Set an option value for a given usb device.
- Parameters
-
[in] | dev | USB device descriptor |
[in] | opt | option type |
[in] | value | value to set |
[in] | value_len | the length of value |
- Returns
- number of bytes used from
value
-
< 0
on error
Definition at line 296 of file usbdev.h.
The documentation for this struct was generated from the following file: