13#ifndef ZEPHYR_INCLUDE_DRIVERS_MBOX_H_
14#define ZEPHYR_INCLUDE_DRIVERS_MBOX_H_
125#define MBOX_DT_CHANNEL_GET(node_id, name) \
127 .dev = DEVICE_DT_GET(DT_MBOX_CTLR_BY_NAME(node_id, name)), \
128 .id = DT_MBOX_CHANNEL_BY_NAME(node_id, name), \
273 if (api->send == NULL) {
277 return api->send(channel->dev, channel->id,
msg);
329static inline int z_impl_mbox_mtu_get(
const struct device *dev)
334 if (api->mtu_get == NULL) {
338 return api->mtu_get(dev);
366static inline int z_impl_mbox_set_enabled(
const struct mbox_channel *channel,
bool enable)
371 if (api->set_enabled == NULL) {
375 return api->set_enabled(channel->dev, channel->id, enable);
390static inline uint32_t z_impl_mbox_max_channels_get(
const struct device *dev)
395 if (api->max_channels_get == NULL) {
399 return api->max_channels_get(dev);
410#include <syscalls/mbox.h>
MBOX Devicetree macro public API header file.
int(* mbox_register_callback_t)(const struct device *dev, uint32_t channel, mbox_callback_t cb, void *user_data)
Callback API upon registration.
Definition mbox.h:191
int mbox_send(const struct mbox_channel *channel, const struct mbox_msg *msg)
Try to send a message over the MBOX device.
int(* mbox_send_t)(const struct device *dev, uint32_t channel, const struct mbox_msg *msg)
Callback API to send MBOX messages.
Definition mbox.h:164
void(* mbox_callback_t)(const struct device *dev, uint32_t channel, void *user_data, struct mbox_msg *data)
Callback API for incoming MBOX messages.
Definition mbox.h:148
int mbox_set_enabled(const struct mbox_channel *channel, bool enable)
Enable (disable) interrupts and callbacks for inbound channels.
int(* mbox_mtu_get_t)(const struct device *dev)
Callback API to get maximum data size.
Definition mbox.h:174
static void mbox_init_channel(struct mbox_channel *channel, const struct device *dev, uint32_t ch_id)
Initialize a channel struct.
Definition mbox.h:240
int mbox_mtu_get(const struct device *dev)
Return the maximum number of bytes possible in an outbound message.
int(* mbox_set_enabled_t)(const struct device *dev, uint32_t channel, bool enable)
Callback API upon enablement of interrupts.
Definition mbox.h:209
uint32_t(* mbox_max_channels_get_t)(const struct device *dev)
Callback API to get maximum number of channels.
Definition mbox.h:218
static int mbox_register_callback(const struct mbox_channel *channel, mbox_callback_t cb, void *user_data)
Register a callback function on a channel for incoming messages.
Definition mbox.h:294
uint32_t mbox_max_channels_get(const struct device *dev)
Return the maximum number of channels.
#define ENOSYS
Function not implemented.
Definition errno.h:83
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
Runtime device structure (in ROM) per driver instance.
Definition device.h:381
const void * api
Address of the API structure exposed by the device instance.
Definition device.h:387
Provides a type to hold an MBOX channel.
Definition mbox.h:93
uint32_t id
Channel ID.
Definition mbox.h:98
const struct device * dev
MBOX device pointer.
Definition mbox.h:95
mbox_send_t send
Definition mbox.h:221
mbox_mtu_get_t mtu_get
Definition mbox.h:223
mbox_max_channels_get_t max_channels_get
Definition mbox.h:224
mbox_register_callback_t register_callback
Definition mbox.h:222
mbox_set_enabled_t set_enabled
Definition mbox.h:225
Message struct (to hold data and its size).
Definition mbox.h:80
size_t size
Size of the data.
Definition mbox.h:85
const void * data
Pointer to the data sent in the message.
Definition mbox.h:82
static fdata_t data[2]
Definition test_fifo_contexts.c:15
static void msg(uint64_t c64)
Definition main.c:17
static const intptr_t user_data[5]
Definition main.c:588