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 #define TRUE    1
14 #define FALSE   0
15 
16 struct cv2_thread {
17 	sys_dnode_t node;
18 	struct k_thread z_thread;
19 	struct k_poll_signal poll_signal;
20 	struct k_poll_event poll_event;
21 	uint32_t signal_results;
22 	char name[16];
23 	uint32_t attr_bits;
24 	struct k_sem join_guard;
25 	char has_joined;
26 };
27 
28 struct cv2_timer {
29 	struct k_timer z_timer;
30 	osTimerType_t type;
31 	uint32_t status;
32 	char name[16];
33 	void (*callback_function)(void *argument);
34 	void *arg;
35 };
36 
37 struct cv2_mutex {
38 	struct k_mutex z_mutex;
39 	char name[16];
40 	uint32_t state;
41 };
42 
43 struct cv2_sem {
44 	struct k_sem z_semaphore;
45 	char name[16];
46 };
47 
48 struct cv2_mslab {
49 	struct k_mem_slab z_mslab;
50 	void *pool;
51 	char is_dynamic_allocation;
52 	char name[16];
53 };
54 
55 struct cv2_msgq {
56 	struct k_msgq z_msgq;
57 	void *pool;
58 	char is_dynamic_allocation;
59 	char name[16];
60 };
61 
62 struct cv2_event_flags {
63 	struct k_poll_signal poll_signal;
64 	struct k_poll_event poll_event;
65 	uint32_t signal_results;
66 	char name[16];
67 };
68 
69 extern osThreadId_t get_cmsis_thread_id(k_tid_t tid);
70 extern void *is_cmsis_rtos_v2_thread(void *thread_id);
71 
72 #endif
73