April 2012
Intermediate to advanced
352 pages
8h
English
Recall that callback is executed before and after the endpoint specified by type, endpoint, and direction transfers data. Below is its function prototype:
typedef void (usb_callback_t)(struct usb_xfer *, usb_error_t);
Here,
struct usb_xfer * contains the transfer state:
struct usb_xfer { ... uint8_t usb_state; /* Set when callback is executed before a data transfer. */ #define USB_ST_SETUP 0 /* Set when callback is executed after a data transfer. */ #define USB_ST_TRANSFERRED 1 /* Set when a transfer error occurs. */ #define ...