Interface for mailbox controller drivers.
More...
Interface for mailbox controller drivers.
A driver embeds a struct pbl_mbox_controller in its instance, sets it up with PBL_MBOX_CONTROLLER_STATE_DEFINE() and PBL_MBOX_CONTROLLER_INIT(), implements the struct pbl_mbox_controller_ops the class calls, and reports received and sent messages with pbl_mbox_chan_received() and pbl_mbox_chan_txdone().
◆ pbl_mbox_chan_state
| struct pbl_mbox_chan_state |
Channel state, kept by the class.
| Data Fields |
|
const struct pbl_mbox_client * |
cl |
Client, set while the channel is requested. |
|
uint32_t |
rx_count |
Messages received. |
|
bool |
tx_active |
Whether tx_msg is in flight. |
|
uint32_t |
tx_count |
Messages sent. |
|
const void * |
tx_msg |
Message in flight. |
|
const void * |
tx_next |
Message queued behind tx_msg. |
|
bool |
tx_queued |
Whether tx_next is queued. |
◆ pbl_mbox_controller_state
| struct pbl_mbox_controller_state |
Controller state, kept by the class.
◆ pbl_mbox_controller
| struct pbl_mbox_controller |
◆ PBL_MBOX_CONTROLLER_INIT
| #define PBL_MBOX_CONTROLLER_INIT |
( |
|
sym, |
|
|
|
_name, |
|
|
|
_init, |
|
|
|
_parent, |
|
|
|
_ops, |
|
|
|
_txpoll_period_ms |
|
) |
| |
Value: { \
.ops = (_ops), \
.state = &sym##_mbox_ctrl_state, \
.chans = sym##_mbox_chans, \
.num_chans = sizeof(sym##_mbox_chans) / sizeof(sym##_mbox_chans[0]), \
.txpoll_period_ms = (_txpoll_period_ms), \
}
#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 struct pbl_mbox_controller, for providers.
- Parameters
-
| sym | Controller symbol, with its PBL_MBOX_CONTROLLER_STATE_DEFINE(). |
| _name | Device name. |
| _init | Device init function. |
| _parent | Parent device, or NULL. |
| _ops | Operations. |
| _txpoll_period_ms | Completion poll period in milliseconds, 0 for none. |
◆ PBL_MBOX_CONTROLLER_STATE_DEFINE
| #define PBL_MBOX_CONTROLLER_STATE_DEFINE |
( |
|
sym, |
|
|
|
_num_chans |
|
) |
| |
Value:
.ctrl = &sym, \
}; \
#define PBL_DEVICE_STATE_DEFINE(sym)
Define the runtime state of device instance sym.
Definition device.h:132
struct pbl_timer poll
Completion poll timer.
Definition driver.h:49
Channel state, kept by the class.
Definition driver.h:29
Mailbox controller.
Definition driver.h:69
Controller state, kept by the class.
Definition driver.h:47
#define PBL_TIMER_INITIALIZER(_fn)
Static initializer for a timer.
Definition timer.h:50
Define the state of a controller, for providers.
- Parameters
-
◆ pbl_mbox_chan_received()
| void pbl_mbox_chan_received |
( |
const struct pbl_mbox_controller * |
ctrl, |
|
|
uint8_t |
idx, |
|
|
const void * |
msg |
|
) |
| |
Report a message from the remote, for providers.
Called from interrupt context.
- Parameters
-
| ctrl | Controller. |
| idx | Channel index. |
| msg | Message, nullptr for doorbells. |
◆ pbl_mbox_chan_txdone()
Report that the remote took the last message, for providers with a completion interrupt.
Called from interrupt context.
- Parameters
-
| ctrl | Controller. |
| idx | Channel index. |
| ret | 0, or a negative errno. |