-
Notifications
You must be signed in to change notification settings - Fork 350
Expand file tree
/
Copy pathkernel.h
More file actions
56 lines (41 loc) · 1.05 KB
/
kernel.h
File metadata and controls
56 lines (41 loc) · 1.05 KB
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
/* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright(c) 2022 Intel Corporation. All rights reserved.
*
* Author: Jyri Sarha <jyri.sarha@intel.com>
*/
#ifndef __POSIX_RTOS_KERNEL_H__
#define __POSIX_RTOS_KERNEL_H__
#include <rtos/wait.h>
#include <stdint.h>
#ifdef __ZEPHYR__
#error "This file should only be included in XTOS builds."
#endif
typedef uint32_t k_ticks_t;
typedef struct {
k_ticks_t ticks;
} k_timeout_t;
#define Z_TIMEOUT_TICKS(t) ((k_timeout_t) { .ticks = (t) })
#define Z_TIMEOUT_US(t) ((k_timeout_t) { .ticks = clock_us_to_ticks(PLATFORM_DEFAULT_CLOCK, t) })
#define Z_TIMEOUT_MS(t) ((k_timeout_t) { .ticks = clock_ms_to_ticks(PLATFORM_DEFAULT_CLOCK, t) })
struct k_thread;
static inline bool thread_is_userspace(struct k_thread *thread)
{
return false;
}
static inline void k_sleep(k_timeout_t timeout)
{
wait_delay(timeout.ticks);
}
static inline void k_msleep(int32_t ms)
{
wait_delay_ms(ms);
}
static inline void k_usleep(int32_t us)
{
wait_delay_us(us);
}
struct k_heap {
int unused;
};
#endif /* __POSIX_RTOS_KERNEL_H__ */