1 /*
2  * Copyright (c) 2020-2023 Intel Corporation
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 #ifndef __DRIVERS_IPM_SEDI_H
7 #define __DRIVERS_IPM_SEDI_H
8 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 #include "sedi_driver_common.h"
13 #include "sedi_driver_ipc.h"
14 #include <zephyr/sys/atomic.h>
15 
16 /*
17  * bit 31 indicates whether message is valid, and could generate interrupt
18  * while set/clear
19  */
20 #define IPC_BUSY_BIT            31
21 
22 #define IPM_WRITE_IN_PROC_BIT   0
23 #define IPM_WRITE_BUSY_BIT      1
24 #define IPM_READ_BUSY_BIT       2
25 #define IPM_PEER_READY_BIT      3
26 
27 #define IPM_TIMEOUT_MS 1000
28 
29 struct ipm_sedi_config_t {
30 	sedi_ipc_t ipc_device;
31 	int32_t irq_num;
32 	void (*irq_config)(void);
33 };
34 
35 struct ipm_sedi_context {
36 	ipm_callback_t rx_msg_notify_cb;
37 	void *rx_msg_notify_cb_data;
38 	uint8_t incoming_data_buf[IPC_DATA_LEN_MAX];
39 	struct k_sem device_write_msg_sem;
40 	struct k_mutex device_write_lock;
41 	atomic_t status;
42 	uint32_t power_status;
43 };
44 
45 #ifdef __cplusplus
46 }
47 #endif
48 
49 #endif /* __DRIVERS_IPM_SEDI_H */
50