Line data Source code
1 1 : /*
2 : * Copyright (c) 2010-2014 Wind River Systems, Inc.
3 : * Copyright (c) 2017 Oticon A/S
4 : *
5 : * SPDX-License-Identifier: Apache-2.0
6 : */
7 :
8 : /**
9 : * @file
10 : * @brief POSIX arch specific kernel interface header
11 : *
12 : * This header contains the POSIX arch specific kernel interface. It is
13 : * included by the kernel interface architecture-abstraction header
14 : * (include/zephyr/arch/cpu.h).
15 : */
16 :
17 : #ifndef ZEPHYR_INCLUDE_ARCH_POSIX_ARCH_H_
18 : #define ZEPHYR_INCLUDE_ARCH_POSIX_ARCH_H_
19 :
20 : /* Add include for DTS generated information */
21 : #include <zephyr/devicetree.h>
22 :
23 : #include <zephyr/toolchain.h>
24 : #include <zephyr/irq.h>
25 : #include <zephyr/arch/exception.h>
26 : #include <zephyr/arch/posix/asm_inline.h>
27 : #include <zephyr/arch/posix/thread.h>
28 : #include <board_irq.h> /* Each board must define this */
29 : #include <zephyr/sw_isr_table.h>
30 : #include <zephyr/arch/posix/posix_soc_if.h>
31 :
32 : #ifdef __cplusplus
33 : extern "C" {
34 : #endif
35 :
36 : #ifdef CONFIG_64BIT
37 : #define ARCH_STACK_PTR_ALIGN 8
38 : #else
39 0 : #define ARCH_STACK_PTR_ALIGN 4
40 : #endif
41 :
42 0 : extern uint32_t sys_clock_cycle_get_32(void);
43 :
44 0 : static inline uint32_t arch_k_cycle_get_32(void)
45 : {
46 : return sys_clock_cycle_get_32();
47 : }
48 :
49 0 : extern uint64_t sys_clock_cycle_get_64(void);
50 :
51 0 : static inline uint64_t arch_k_cycle_get_64(void)
52 : {
53 : return sys_clock_cycle_get_64();
54 : }
55 :
56 0 : static ALWAYS_INLINE void arch_nop(void)
57 : {
58 : __asm__ volatile("nop");
59 : }
60 :
61 0 : static ALWAYS_INLINE bool arch_irq_unlocked(unsigned int key)
62 : {
63 : return key == false;
64 : }
65 :
66 0 : static ALWAYS_INLINE unsigned int arch_irq_lock(void)
67 : {
68 : return posix_irq_lock();
69 : }
70 :
71 :
72 0 : static ALWAYS_INLINE void arch_irq_unlock(unsigned int key)
73 : {
74 : posix_irq_unlock(key);
75 : }
76 :
77 : #ifdef __cplusplus
78 : }
79 : #endif
80 :
81 : #endif /* ZEPHYR_INCLUDE_ARCH_POSIX_ARCH_H_ */
|