The following diagram is a high-level overview of the USB subsystem architecture. The left side of the "USB Library" box is the USB Device framework, while the right side is the USB Host framework. An application may choose to use both or just one of the frameworks. The "OTG / transceiver" part is optional, but usually present when using a dual-role controller.
For more information, please see one of the following pages:
Each request may have a callback associated with it, which is called when all the buffers have been transferred or cancelled. The submitter may use usb_request::context to hold arbitrary data associated with the request.
Before a USB request can be (re)used, it must be initialized by calling usb_req_init().
USB requests can also be allocated dynamically from the USB request pool using the following functions. These functions will automatically initialize the request, so there's no need to call usb_req_init() on a freshly allocated request.
Finally, the following function can be used to associate another buffer with a request.
1.5.8