Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
icmsg.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2022 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#ifndef ZEPHYR_INCLUDE_IPC_ICMSG_H_
8#define ZEPHYR_INCLUDE_IPC_ICMSG_H_
9
10#include <stddef.h>
11#include <stdint.h>
12#include <zephyr/kernel.h>
13#include <zephyr/drivers/mbox.h>
15#include <zephyr/ipc/pbuf.h>
16#include <zephyr/sys/atomic.h>
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
34
39
41 /* Tx/Rx buffers. */
42 struct pbuf *tx_pb;
43 struct pbuf *rx_pb;
44#ifdef CONFIG_IPC_SERVICE_ICMSG_SHMEM_ACCESS_SYNC
45 struct k_mutex tx_lock;
46#endif
47
48 /* Callbacks for an endpoint. */
49 const struct ipc_service_cb *cb;
50 void *ctx;
51
52 /* General */
53 const struct icmsg_config_t *cfg;
54#ifdef CONFIG_MULTITHREADING
55 struct k_work_delayable notify_work;
56 struct k_work mbox_work;
57#endif
59};
60
85int icmsg_open(const struct icmsg_config_t *conf,
86 struct icmsg_data_t *dev_data,
87 const struct ipc_service_cb *cb, void *ctx);
88
103int icmsg_close(const struct icmsg_config_t *conf,
104 struct icmsg_data_t *dev_data);
105
124int icmsg_send(const struct icmsg_config_t *conf,
125 struct icmsg_data_t *dev_data,
126 const void *msg, size_t len);
127
132#ifdef __cplusplus
133}
134#endif
135
136#endif /* ZEPHYR_INCLUDE_IPC_ICMSG_H_ */
long atomic_t
Definition atomic_types.h:15
int icmsg_close(const struct icmsg_config_t *conf, struct icmsg_data_t *dev_data)
Close an icmsg instance.
int icmsg_send(const struct icmsg_config_t *conf, struct icmsg_data_t *dev_data, const void *msg, size_t len)
Send a message to the remote icmsg instance.
int icmsg_open(const struct icmsg_config_t *conf, struct icmsg_data_t *dev_data, const struct ipc_service_cb *cb, void *ctx)
Open an icmsg instance.
icmsg_state
Definition icmsg.h:29
@ ICMSG_STATE_BUSY
Definition icmsg.h:31
@ ICMSG_STATE_READY
Definition icmsg.h:32
@ ICMSG_STATE_OFF
Definition icmsg.h:30
Public kernel APIs.
Definition icmsg.h:35
struct mbox_dt_spec mbox_tx
Definition icmsg.h:36
struct mbox_dt_spec mbox_rx
Definition icmsg.h:37
Definition icmsg.h:40
const struct ipc_service_cb * cb
Definition icmsg.h:49
const struct icmsg_config_t * cfg
Definition icmsg.h:53
struct pbuf * tx_pb
Definition icmsg.h:42
struct pbuf * rx_pb
Definition icmsg.h:43
void * ctx
Definition icmsg.h:50
atomic_t state
Definition icmsg.h:58
Event callback structure.
Definition ipc_service.h:145
Mutex Structure.
Definition kernel.h:2994
A structure used to submit work after a delay.
Definition kernel.h:3985
A structure used to submit work.
Definition kernel.h:3957
MBOX specification from DT.
Definition mbox.h:87
Scure packed buffer.
Definition pbuf.h:96