1 /*
2  * Copyright (c) 2018 Intel Corporation
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #ifndef __WRAPPER_H__
8 #define __WRAPPER_H__
9 
10 #include <zephyr/kernel.h>
11 #include <cmsis_os2.h>
12 
13 #ifndef TRUE
14 #define TRUE    1
15 #endif
16 #ifndef FALSE
17 #define FALSE   0
18 #endif
19 
20 struct cv2_thread {
21 	sys_dnode_t node;
22 	struct k_thread z_thread;
23 	struct k_poll_signal poll_signal;
24 	struct k_poll_event poll_event;
25 	uint32_t signal_results;
26 	char name[16];
27 	uint32_t attr_bits;
28 	struct k_sem join_guard;
29 	char has_joined;
30 };
31 
32 struct cv2_timer {
33 	struct k_timer z_timer;
34 	osTimerType_t type;
35 	uint32_t status;
36 	char name[16];
37 	void (*callback_function)(void *argument);
38 	void *arg;
39 };
40 
41 struct cv2_mutex {
42 	struct k_mutex z_mutex;
43 	char name[16];
44 	uint32_t state;
45 };
46 
47 struct cv2_sem {
48 	struct k_sem z_semaphore;
49 	char name[16];
50 };
51 
52 struct cv2_mslab {
53 	struct k_mem_slab z_mslab;
54 	void *pool;
55 	char is_dynamic_allocation;
56 	char name[16];
57 };
58 
59 struct cv2_msgq {
60 	struct k_msgq z_msgq;
61 	void *pool;
62 	char is_dynamic_allocation;
63 	char name[16];
64 };
65 
66 struct cv2_event_flags {
67 	struct k_poll_signal poll_signal;
68 	struct k_poll_event poll_event;
69 	uint32_t signal_results;
70 	char name[16];
71 };
72 
73 extern osThreadId_t get_cmsis_thread_id(k_tid_t tid);
74 extern void *is_cmsis_rtos_v2_thread(void *thread_id);
75 
76 #endif
77