1 /*
2  * Copyright (c) 2021, Nordic Semiconductor ASA
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #ifndef ZEPHYR_SUBSYS_IPC_RPMSG_BACKEND_H
8 #define ZEPHYR_SUBSYS_IPC_RPMSG_BACKEND_H
9 
10 #include <openamp/rpmsg_virtio.h>
11 
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15 
16 #define VDEV_START_ADDR		DT_REG_ADDR(DT_CHOSEN(zephyr_ipc_shm))
17 #define VDEV_SIZE		DT_REG_SIZE(DT_CHOSEN(zephyr_ipc_shm))
18 
19 #define VDEV_STATUS_ADDR	VDEV_START_ADDR
20 #define VDEV_STATUS_SIZE	0x400
21 
22 #define SHM_START_ADDR		(VDEV_START_ADDR + VDEV_STATUS_SIZE)
23 #define SHM_SIZE		    (VDEV_SIZE - VDEV_STATUS_SIZE)
24 #define SHM_DEVICE_NAME		"sramx.shm"
25 
26 /*
27  * @brief Initialize RPMsg backend
28  *
29  * @param io   Shared memory IO region. This is an output parameter providing
30  *             a pointer to an actual shared memory IO region structure.
31  *             Caller of this function shall pass an address at which the
32  *             pointer to the shared memory IO region structure is stored.
33  * @param vdev Pointer to the virtio device initialized by this function.
34  *
35  * @retval 0 Initialization successful
36  * @retval <0 Initialization error reported by OpenAMP
37  */
38 int rpmsg_backend_init(struct metal_io_region **io, struct virtio_device *vdev);
39 
40 #ifdef __cplusplus
41 }
42 #endif
43 
44 #endif /* ZEPHYR_SUBSYS_IPC_RPMSG_BACKEND_H */
45