Generic USB Control Requests
More...
|
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
- Version
- 1.0.0
- Author
- © 2010 Gareth McMullin garet.nosp@m.h@bl.nosp@m.acksp.nosp@m.here.nosp@m..co.n.nosp@m.z
- Date
- 10 March 2013
LGPL License Terms libopencm3 License
◆ needs_zlp()
static bool needs_zlp |
( |
uint16_t |
len, |
|
|
uint16_t |
wLength, |
|
|
uint8_t |
ep_size |
|
) |
| |
|
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.
- Parameters
-
len | how much data we want to transfer |
wLength | how much the host asked for |
ep_size | |
- Returns
Definition at line 62 of file usb_control.c.
Referenced by usb_control_setup_read().
◆ stall_transaction()
static void stall_transaction |
( |
usbd_device * |
usbd_dev | ) |
|
|
static |
◆ usb_control_recv_chunk()
static int usb_control_recv_chunk |
( |
usbd_device * |
usbd_dev | ) |
|
|
static |
◆ usb_control_request_dispatch()
◆ usb_control_send_chunk()
static void usb_control_send_chunk |
( |
usbd_device * |
usbd_dev | ) |
|
|
static |
◆ usb_control_setup_read()
◆ usb_control_setup_write()
◆ usbd_register_control_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)).
- See also
- usbd_register_set_config_callback
- Parameters
-
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 |
- Returns
- 0 if successful
Definition at line 73 of file usb_control.c.
References usbd_dev.
Referenced by msc_set_config().