usbdev driver functions More...

Detailed Description

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>

Data Fields

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...
 

Field Documentation

◆ ep_esr

void(* usbdev_driver::ep_esr) (usbdev_ep_t *ep)

an endpoint's user-space event handler

Must be called in response to an USBDEV_EVENT_ESR event in userspace context.

Parameters
[in]epUSB endpoint descriptor to service

Definition at line 355 of file usbdev.h.

◆ ep_get

int(* usbdev_driver::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.

Parameters
[in]epUSB endpoint descriptor
[in]optoption type
[out]valuepointer to store the option's value in
[in]max_lenmaximum 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

void(* usbdev_driver::ep_init) (usbdev_ep_t *ep)

Initialize the USB endpoint.

This initializes the USB endpoint with the settings from the usbdev_ep.

Parameters
[in]epUSB endpoint descriptor

Definition at line 317 of file usbdev.h.

◆ ep_set

int(* usbdev_driver::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.

Parameters
[in]epUSB endpoint descriptor
[in]optoption type
[in]valuepointer to the value
[in]value_lenthe 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]devUSB device descriptor

Definition at line 307 of file usbdev.h.

◆ get

int(* usbdev_driver::get) (usbdev_t *usbdev, usbopt_t opt, void *value, size_t max_len)

Get an option value from a given usb device.

Parameters
[in]devUSB device descriptor
[in]optoption type
[out]valuepointer to store the option's value in
[in]max_lenmaximal 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

void(* usbdev_driver::init) (usbdev_t *usbdev)

Initialize the USB peripheral device.

This initializes the USB device but must not enable the USB pull up.

Parameters
[in]devUSB device descriptor

Definition at line 253 of file usbdev.h.

◆ new_ep

usbdev_ep_t*(* usbdev_driver::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.

requesting an endpoint of USB_EP_TYPE_CONTROL must always return endpoint 0 of the specified direction

Parameters
[in]devUSB device descriptor
[in]typeUSB endpoint type
[in]dirUSB endpoint direction
[in]buf_lenoptimal 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]epUSB endpoint descriptor
[in]lenlength of the data to be transmitted

Definition at line 365 of file usbdev.h.

◆ set

int(* usbdev_driver::set) (usbdev_t *usbdev, usbopt_t opt, const void *value, size_t value_len)

Set an option value for a given usb device.

Parameters
[in]devUSB device descriptor
[in]optoption type
[in]valuevalue to set
[in]value_lenthe 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: