1 /*
2  * Copyright (c) 2016 Wind River Systems, Inc.
3  * Copyright (c) 2017 Oticon A/S
4  *
5  * SPDX-License-Identifier: Apache-2.0
6  */
7 
8 /* This file is only meant to be included by kernel_structs.h */
9 
10 #ifndef ZEPHYR_ARCH_POSIX_INCLUDE_KERNEL_ARCH_FUNC_H_
11 #define ZEPHYR_ARCH_POSIX_INCLUDE_KERNEL_ARCH_FUNC_H_
12 
13 #include <kernel_arch_data.h>
14 
15 #include <zephyr/platform/hooks.h>
16 
17 #ifndef _ASMLANGUAGE
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
arch_kernel_init(void)23 static inline void arch_kernel_init(void)
24 {
25 #ifdef CONFIG_SOC_PER_CORE_INIT_HOOK
26 	soc_per_core_init_hook();
27 #endif /* CONFIG_SOC_PER_CORE_INIT_HOOK */
28 }
29 
30 static ALWAYS_INLINE void
arch_thread_return_value_set(struct k_thread * thread,unsigned int value)31 arch_thread_return_value_set(struct k_thread *thread, unsigned int value)
32 {
33 	thread->callee_saved.retval = value;
34 }
35 
36 #ifdef __cplusplus
37 }
38 #endif
39 
arch_is_in_isr(void)40 static inline bool arch_is_in_isr(void)
41 {
42 	return _kernel.cpus[0].nested != 0U;
43 }
44 
45 int arch_swap(unsigned int key);
46 
47 #endif /* _ASMLANGUAGE */
48 
49 #endif /* ZEPHYR_ARCH_POSIX_INCLUDE_KERNEL_ARCH_FUNC_H_ */
50