-
Notifications
You must be signed in to change notification settings - Fork 3
/
cmsis_rtthread.h
98 lines (84 loc) · 2.23 KB
/
cmsis_rtthread.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2018-04-12 misonyo the first version
*/
#ifndef __RTTHREAD_OS2_H__
#define __RTTHREAD_OS2_H__
#include <rtthread.h>
#include <cmsis_os2.h>
#ifdef __cplusplus
extern "C" {
#endif
///< RT-Thread Kernel version
#if defined(RT_VERSION_CHECK) && (RTTHREAD_VERSION >= RT_VERSION_CHECK(5, 0, 2))
#define KERNEL_VERSION (((rt_uint32_t)RT_VERSION_MAJOR * 10000000UL) | \
((rt_uint32_t)RT_VERSION_MINOR * 10000UL) | \
((rt_uint32_t)RT_VERSION_PATCH * 1UL))
#define thread_rt_list_entry(node, rt_thread) rt_list_entry(node, struct rt_thread, tlist)
#define THREAD_NAME(thread_cb) thread_cb->thread.parent.name
#define RT_WEAK rt_weak
#else /* legacy version macros (<5.0.2) */
#define KERNEL_VERSION (((rt_uint32_t)RT_VERSION * 10000000UL) | \
((rt_uint32_t)RT_SUBVERSION * 10000UL) | \
((rt_uint32_t)RT_REVISION * 1UL))
#define thread_rt_list_entry(node, rt_thread) rt_list_entry(node, struct rt_thread, list)
#define THREAD_NAME(thread_cb) thread_cb->thread.name
#endif
typedef struct
{
rt_uint8_t flags;
struct rt_thread thread;
rt_sem_t joinable_sem; ///< semaphore for joinable thread
rt_uint8_t flag_set; ///< thread flag set
rt_uint8_t prio;
}thread_cb_t;
typedef struct
{
rt_uint8_t flags;
struct rt_timer timer;
}timer_cb_t;
#ifdef RT_USING_EVENT
typedef struct
{
rt_uint8_t flags;
struct rt_event event;
}event_cb_t;
#endif
#ifdef RT_USING_MUTEX
typedef struct
{
rt_uint8_t flags;
struct rt_mutex mutex;
}mutex_cb_t;
#endif
#ifdef RT_USING_SEMAPHORE
typedef struct
{
rt_uint8_t flags;
struct rt_semaphore sem;
}sem_cb_t;
#endif
#ifdef RT_USING_MEMPOOL
typedef struct
{
rt_uint8_t flags;
struct rt_mempool mp;
}mempool_cb_t;
#endif
#ifdef RT_USING_MESSAGEQUEUE
typedef struct
{
rt_uint32_t init_msg_size;
rt_uint8_t flags;
struct rt_messagequeue mq;
}mq_cb_t;
#endif
#ifdef __cplusplus
}
#endif
#endif