13#ifndef ZEPHYR_INCLUDE_DRIVERS_MBOX_H_
14#define ZEPHYR_INCLUDE_DRIVERS_MBOX_H_
124#define MBOX_DT_CHANNEL_GET(node_id, name) \
126 .dev = DEVICE_DT_GET(MBOX_DT_CTLR_BY_NAME(node_id, name)), \
127 .id = MBOX_DT_CHANNEL_ID_BY_NAME(node_id, name), \
157#define MBOX_DT_CTLR_BY_NAME(node_id, name) \
158 DT_PHANDLE_BY_NAME(node_id, mboxes, name)
194#define MBOX_DT_CHANNEL_ID_BY_NAME(node_id, name) \
195 DT_PHA_BY_NAME_OR(node_id, mboxes, name, channel, 0)
339 if (api->
send == NULL) {
395static inline int z_impl_mbox_mtu_get(
const struct device *dev)
432static inline int z_impl_mbox_set_enabled(
const struct mbox_channel *channel,
bool enable)
456static inline uint32_t z_impl_mbox_max_channels_get(
const struct device *dev)
476#include <syscalls/mbox.h>
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:257
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:230
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:214
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:240
static void mbox_init_channel(struct mbox_channel *channel, const struct device *dev, uint32_t ch_id)
Initialize a channel struct.
Definition: mbox.h:306
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:275
uint32_t(* mbox_max_channels_get_t)(const struct device *dev)
Callback API to get maximum number of channels.
Definition: mbox.h:284
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:360
uint32_t mbox_max_channels_get(const struct device *dev)
Return the maximum number of channels.
#define ENOSYS
Definition: errno.h:83
__UINT32_TYPE__ uint32_t
Definition: stdint.h:60
Runtime device structure (in ROM) per driver instance.
Definition: device.h:450
const void * api
Definition: device.h:456
Provides a type to hold an MBOX channel.
Definition: mbox.h:92
uint32_t id
Definition: mbox.h:97
const struct device * dev
Definition: mbox.h:94
mbox_send_t send
Definition: mbox.h:287
mbox_mtu_get_t mtu_get
Definition: mbox.h:289
mbox_max_channels_get_t max_channels_get
Definition: mbox.h:290
mbox_register_callback_t register_callback
Definition: mbox.h:288
mbox_set_enabled_t set_enabled
Definition: mbox.h:291
Message struct (to hold data and its size).
Definition: mbox.h:79
size_t size
Definition: mbox.h:84
const void * data
Definition: mbox.h:81
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:590