libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
|
Generic USB Control Requests More...
Functions | |
static void | stall_transaction (usbd_device *usbd_dev) |
static bool | needs_zlp (uint16_t len, uint16_t wLength, uint8_t ep_size) |
If we're replying with some data, but less than the host is expecting, then we normally just do a short transfer. More... | |
int | usbd_register_control_callback (usbd_device *usbd_dev, uint8_t type, uint8_t type_mask, usbd_control_callback callback) |
Registers a control callback. More... | |
static void | usb_control_send_chunk (usbd_device *usbd_dev) |
static int | usb_control_recv_chunk (usbd_device *usbd_dev) |
static enum usbd_request_return_codes | usb_control_request_dispatch (usbd_device *usbd_dev, struct usb_setup_data *req) |
static void | usb_control_setup_read (usbd_device *usbd_dev, struct usb_setup_data *req) |
static void | usb_control_setup_write (usbd_device *usbd_dev, struct usb_setup_data *req) |
Generic USB Control Requests
LGPL License Terms libopencm3 License
|
static |
If we're replying with some data, but less than the host is expecting, then we normally just do a short transfer.
But if it's short, but a multiple of the endpoint max packet size, we need an explicit ZLP.
len | how much data we want to transfer |
wLength | how much the host asked for |
ep_size |
Definition at line 62 of file usb_control.c.
Referenced by usb_control_setup_read().
|
static |
Definition at line 47 of file usb_control.c.
References usbd_dev, and usbd_ep_stall_set().
Referenced by _usbd_control_in(), _usbd_control_out(), usb_control_recv_chunk(), usb_control_setup_read(), and usb_control_setup_write().
|
static |
Definition at line 121 of file usb_control.c.
References stall_transaction(), usbd_dev, and usbd_ep_read_packet().
Referenced by _usbd_control_out().
|
static |
Definition at line 142 of file usb_control.c.
References _usbd_standard_request(), usb_setup_data::bmRequestType, usbd_dev, USBD_REQ_HANDLED, and USBD_REQ_NOTSUPP.
Referenced by _usbd_control_out(), and usb_control_setup_read().
|
static |
Definition at line 93 of file usb_control.c.
References usbd_dev, and usbd_ep_write_packet().
Referenced by _usbd_control_in(), and usb_control_setup_read().
|
static |
Definition at line 173 of file usb_control.c.
References needs_zlp(), stall_transaction(), usb_control_request_dispatch(), usb_control_send_chunk(), usbd_dev, usbd_ep_write_packet(), and usb_setup_data::wLength.
Referenced by _usbd_control_setup().
|
static |
Definition at line 198 of file usb_control.c.
References stall_transaction(), usbd_dev, usbd_ep_nak_set(), and usb_setup_data::wLength.
Referenced by _usbd_control_setup().
int usbd_register_control_callback | ( | usbd_device * | usbd_dev, |
uint8_t | type, | ||
uint8_t | type_mask, | ||
usbd_control_callback | callback | ||
) |
Registers a control callback.
Since the list of user control callbacks is cleared every time device configuration is set (inside usb_standard_set_configuration()), control callback registration must happen inside (or after) the config callback. The specified callback will be called if (type == (bmRequestType & type_mask)).
usbd_dev | the usb device handle returned from usbd_init |
type | Handled request type |
type_mask | Mask to apply before matching request type |
callback | your desired callback function |
Definition at line 73 of file usb_control.c.
References usbd_dev.
Referenced by msc_set_config().