|
PebbleOS v4.47.0-757-g12b6c531f
|
The device side of USB, on the board's USB device controller, its UDC role. More...
Modules | |
| USB serial port | |
| A serial port over USB, CDC ACM, as a UART: a board's roles can give it to the console. | |
| USB firmware upgrade | |
| Device Firmware Upgrade 1.1, in DFU mode: a host downloads an image to a flash partition and uploads it back, as with dfu-util. | |
Data Structures | |
| struct | pbl_usbd_function |
| A function of the device: a class, on interfaces and endpoints of its own. More... | |
Macros | |
| #define | PBL_USBD_FUNCTION_DEFINE(name) |
| Define a function of the device. | |
Functions | |
| int | pbl_usbd_enable (void) |
| Connect the device to the bus, once: the controller first, if it is not up yet. | |
| uint16_t | pbl_usbd_bulk_mps (void) |
| Maximum packet size of the bulk endpoints, at the speed the bus runs. | |
The device side of USB, on the board's USB device controller, its UDC role.
The device has one configuration, made of the functions defined with PBL_USBD_FUNCTION_DEFINE(), in the order of their names. Each function gives its interface and endpoint descriptors, with its interface numbers and endpoint addresses: the functions of a device do not share any. The stack sets the maximum packet size of their bulk endpoints for the bus speed, enables their endpoints when the host configures the device, and hands them the class requests to their interfaces and the end of the transfers on their endpoints. Everything the stack calls runs from the controller's interrupt.
An interface can have alternate settings: its interface descriptor is followed by others with the same interface number and a higher bAlternateSetting, each with its own endpoints. Two settings may use the same endpoint addresses. Configuring the device selects setting 0 of every interface; SET_INTERFACE then disables the endpoints of the current setting, enables those of the new one and calls pbl_usbd_function::set_alt.
A function names its strings with its own indices, from 1, in the iInterface field of its interface descriptors and the iFunction field of its interface association descriptor: index n is pbl_usbd_function::strings[n - 1]. The stack gives them indices of the device when it sends the configuration descriptor. Strings in class-specific descriptors are not mapped.
| #define PBL_USBD_FUNCTION_DEFINE | ( | name | ) |
Define a function of the device.
| name | Name, which also orders the functions. |
| uint16_t pbl_usbd_bulk_mps | ( | void | ) |
Maximum packet size of the bulk endpoints, at the speed the bus runs.
| int pbl_usbd_enable | ( | void | ) |
Connect the device to the bus, once: the controller first, if it is not up yet.
-ENODEV when the controller failed.