1.00
The mxusb library is an USB device stack for the Miosix kernel. It is designed using a "descriptor oriented" configuration model. The same way the USB host can infer all device information by parsing endpoints, this library tries to automagically configure the USB hardware of a microcontroller given the descriptors only.
As a result application developers need only to understand how USB works and not how the USB peripheral specific to a microcontroller works.
List of implemented features
- Provides a public API (usb.h) that does not contain implementation details that depend on the underlying USB peripheral.
- Provides a blocking API (Endpoint::read() and Endpoint::write()) to transfer data through endpoints. If code should be reading from multiple endpoints at the same time it is possible to use multiple Miosix threads.
- Provides a nonblocking API (Endpoint::IRQread() and Endpoint::IRQwrite()) to access endpoints in a nonblocking way. As the function name implies, they can be called only when interrupts are disabled.
- Provides an event based API (class Callbacks) with callbacks that are called directly from the USB interrupt handler for high speed data transfer. Within those callbacks the nonblocking API can be used to read/write data.
- Provides an event based API (ep0.h) for handling class/vendor specific requests on endpoint zero.
- Provides a descriptor validation option (in usb_config.h) that prints debug information while writing the descriptors, and can be disabled once descriptors are correct, to minimize code size.
- Provides an USB tracer. The USB code has been instrumented with tracepoints that push debug data in a locked queue which is read by a kernel thread and printed out to debug USB code, especially during enumeration. As usual trace code can be disabled in usb_config.h to minimize code size in release builds.
- It currently supports only the USB device of the stm32 microcontrollers, but as the API does not include implementation details, ports for other microcontrollers are possible.
List of features not yet implemented
- Support for the remote wakeup feature not yet implemented.
- Support for stalling endpoints and recovering them with host intervention through endpoint zero is not yet implemented. Active endpoints are either VALID or NAK.
- Support for isochronous endpoints and control endpoints other than endpoint zero not yet implemented.
- Alternate settings for interfaces not supported.
- Bulk endpoints are monodirectional. There can't be two bulk endpoints with opposite direction and same endpoint number (example 0x01 and 0x81). Interrupt bidirectional endpoints are fine, though.
- Author:
- Terraneo Federico