1 /* 2 * Copyright (c) 2016 Intel Corporation 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 /** 8 * @file 9 * @brief Private kernel definitions 10 * 11 * This file contains private kernel function/macro definitions and various 12 * other definitions for the Nios II processor architecture. 13 * 14 * This file is also included by assembly language files which must #define 15 * _ASMLANGUAGE before including this header file. Note that kernel 16 * assembly source files obtains structure offset values via "absolute 17 * symbols" in the offsets.o module. 18 */ 19 20 #ifndef ZEPHYR_ARCH_NIOS2_INCLUDE_KERNEL_ARCH_FUNC_H_ 21 #define ZEPHYR_ARCH_NIOS2_INCLUDE_KERNEL_ARCH_FUNC_H_ 22 23 #include <kernel_arch_data.h> 24 25 #ifdef __cplusplus 26 extern "C" { 27 #endif 28 29 #ifndef _ASMLANGUAGE 30 arch_kernel_init(void)31static ALWAYS_INLINE void arch_kernel_init(void) 32 { 33 } 34 35 static ALWAYS_INLINE void arch_thread_return_value_set(struct k_thread * thread,unsigned int value)36arch_thread_return_value_set(struct k_thread *thread, unsigned int value) 37 { 38 thread->callee_saved.retval = value; 39 } 40 41 FUNC_NORETURN void z_nios2_fatal_error(unsigned int reason, 42 const z_arch_esf_t *esf); 43 arch_is_in_isr(void)44static inline bool arch_is_in_isr(void) 45 { 46 return _kernel.cpus[0].nested != 0U; 47 } 48 49 #ifdef CONFIG_IRQ_OFFLOAD 50 void z_irq_do_offload(void); 51 #endif 52 53 #if ALT_CPU_ICACHE_SIZE > 0 54 void z_nios2_icache_flush_all(void); 55 #else 56 #define z_nios2_icache_flush_all() do { } while (false) 57 #endif 58 59 #if ALT_CPU_DCACHE_SIZE > 0 60 void z_nios2_dcache_flush_all(void); 61 void z_nios2_dcache_flush_no_writeback(void *start, uint32_t len); 62 #else 63 #define z_nios2_dcache_flush_all() do { } while (false) 64 #define z_nios2_dcache_flush_no_writeback(x, y) do { } while (false) 65 #endif 66 67 #endif /* _ASMLANGUAGE */ 68 69 #ifdef __cplusplus 70 } 71 #endif 72 73 #endif /* ZEPHYR_ARCH_NIOS2_INCLUDE_KERNEL_ARCH_FUNC_H_ */ 74