Interface for USB device controller drivers.
More...
|
| #define | PBL_UDC_STATE_DEFINE(sym) |
| | Define the runtime state of a controller.
|
| |
| #define | PBL_UDC_INIT(sym, _name, _parent, _ops, _num_eps, _max_speed, _caps, _vbus_charger) |
| | Initializer of a controller.
|
| |
|
| void | pbl_udc_event (const struct pbl_udc *udc, enum pbl_udc_event evt, const uint8_t *setup) |
| | Report a bus event, from the controller's interrupt.
|
| |
| void | pbl_udc_vbus_changed (const struct pbl_udc *udc, bool present) |
| | Report USB power coming or going, from thread context, for a controller that senses it.
|
| |
| void | pbl_udc_xfer_done (const struct pbl_udc *udc, uint8_t ep, int ret) |
| | Report the end of a transfer, from the controller's interrupt.
|
| |
Interface for USB device controller drivers.
A driver embeds a struct pbl_udc in its instance, sets it up with PBL_UDC_STATE_DEFINE() and PBL_UDC_INIT(), and implements the struct pbl_udc_ops the class calls.
◆ pbl_udc
| Data Fields |
|
uint8_t |
caps |
Capabilities, as PBL_UDC_CAP_EP_ONE_DIR. |
|
struct pbl_device |
dev |
Device. |
|
enum pbl_udc_speed |
max_speed |
Fastest speed the controller and its PHY run at. |
|
uint8_t |
num_eps |
Number of endpoints in each direction, endpoint 0 included. |
|
const struct pbl_udc_ops * |
ops |
Driver operations. |
|
struct pbl_udc_state * |
state |
Runtime state. |
|
const struct pbl_charger * |
vbus_charger |
Charger on the connector's VBUS, or NULL when the board does not sense USB power. |
◆ PBL_UDC_INIT
| #define PBL_UDC_INIT |
( |
|
sym, |
|
|
|
_name, |
|
|
|
_parent, |
|
|
|
_ops, |
|
|
|
_num_eps, |
|
|
|
_max_speed, |
|
|
|
_caps, |
|
|
|
_vbus_charger |
|
) |
| |
Value: { \
.ops = (_ops), \
.state = &sym##_udc_state, \
.num_eps = (_num_eps), \
.max_speed = (_max_speed), \
.caps = (_caps), \
.vbus_charger = (_vbus_charger), \
}
#define PBL_DEVICE_INIT_CLASS(sym, _name, _init, _parent, _cls)
Initializer for the struct pbl_device of device instance sym, in class _cls.
Definition device.h:153
Initializer of a controller.
- Parameters
-
| sym | Symbol of the controller. |
| _name | Name. |
| _parent | Parent device, or NULL. |
| _ops | Driver operations. |
| _num_eps | Number of endpoints in each direction. |
| _max_speed | Fastest speed, one of pbl_udc_speed. |
| _caps | Capabilities, as PBL_UDC_CAP_EP_ONE_DIR, or 0. |
| _vbus_charger | Charger on the connector's VBUS, or NULL. |
◆ PBL_UDC_STATE_DEFINE
| #define PBL_UDC_STATE_DEFINE |
( |
|
sym | ) |
|
Value:
static struct pbl_udc_state sym##_udc_state
#define PBL_DEVICE_STATE_DEFINE(sym)
Define the runtime state of device instance sym.
Definition device.h:132
Define the runtime state of a controller.
- Parameters
-
| sym | Symbol of the controller. |
◆ pbl_udc_event()
Report a bus event, from the controller's interrupt.
- Parameters
-
◆ pbl_udc_vbus_changed()
| void pbl_udc_vbus_changed |
( |
const struct pbl_udc * |
udc, |
|
|
bool |
present |
|
) |
| |
Report USB power coming or going, from thread context, for a controller that senses it.
The controller reports power absent from its init when it is.
- Parameters
-
| udc | Controller. |
| present | Whether USB power is present. |
◆ pbl_udc_xfer_done()
| void pbl_udc_xfer_done |
( |
const struct pbl_udc * |
udc, |
|
|
uint8_t |
ep, |
|
|
int |
ret |
|
) |
| |
Report the end of a transfer, from the controller's interrupt.
- Parameters
-
| udc | Controller. |
| ep | Endpoint address. |
| ret | Bytes moved, or a negative errno. |