xref: /nrf52832-nimble/packages/NimBLE-latest/porting/npl/rtthread/include/nimble/nimble_npl_os.h (revision 042d53a763ad75cb1465103098bb88c245d95138)
1 /*
2  * SPDX-License-Identifier: Apache-2.0
3  *
4  * Date           Author       Notes
5  * 2018-12-18     ZeroFree     first implementation
6  */
7 
8 #ifndef _NIMBLE_NPL_OS_H_
9 #define _NIMBLE_NPL_OS_H_
10 
11 #include <assert.h>
12 #include <stdint.h>
13 #include <string.h>
14 
15 /* errno definitions for RT-Thread libc*/
16 #include "libc/libc_errno.h"
17 
18 // TODO: _Static_assert support
19 #ifndef _Static_assert
20 #define _Static_assert(...)
21 #endif
22 
23 #define BLE_NPL_OS_ALIGNMENT    4
24 
25 #define BLE_NPL_TIME_FOREVER    (0xFFFFFFFF)
26 
27 typedef uint32_t ble_npl_time_t;
28 typedef int32_t ble_npl_stime_t;
29 
30 struct ble_npl_task
31 {
32     void *t;
33 };
34 
35 struct ble_npl_event
36 {
37     bool queued;
38     ble_npl_event_fn *fn;
39     void *arg;
40 };
41 
42 struct ble_npl_eventq
43 {
44     void *q;
45 };
46 
47 struct ble_npl_callout
48 {
49     void *handle;
50     struct ble_npl_eventq *evq;
51     struct ble_npl_event ev;
52 };
53 
54 struct ble_npl_mutex
55 {
56     void *handle;
57 };
58 
59 struct ble_npl_sem
60 {
61     void  *handle;
62 };
63 
ble_npl_os_started(void)64 static inline bool ble_npl_os_started(void)
65 {
66     return 1;
67 }
68 
69 #endif  /* _NPL_H_ */
70