2017-10-03 22:31:55 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2010-2014 Wind River Systems, Inc.
|
|
|
|
* Copyright (c) 2017 Oticon A/S
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* @brief POSIX arch specific kernel interface header
|
|
|
|
* This header contains the POSIX arch specific kernel interface.
|
|
|
|
* It is included by the generic kernel interface header (include/arch/cpu.h)
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2018-09-15 01:43:44 +08:00
|
|
|
#ifndef ZEPHYR_INCLUDE_ARCH_POSIX_ARCH_H_
|
|
|
|
#define ZEPHYR_INCLUDE_ARCH_POSIX_ARCH_H_
|
2017-10-03 22:31:55 +08:00
|
|
|
|
|
|
|
#include <toolchain.h>
|
|
|
|
#include <irq.h>
|
|
|
|
#include <arch/posix/asm_inline.h>
|
|
|
|
#include <board_irq.h> /* Each board must define this */
|
|
|
|
#include <sw_isr_table.h>
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define STACK_ALIGN 4
|
|
|
|
#define STACK_ALIGN_SIZE 4
|
|
|
|
|
|
|
|
#define _NANO_ERR_CPU_EXCEPTION (0) /* Any unhandled exception */
|
|
|
|
#define _NANO_ERR_INVALID_TASK_EXIT (1) /* Invalid task exit */
|
|
|
|
#define _NANO_ERR_STACK_CHK_FAIL (2) /* Stack corruption detected */
|
|
|
|
#define _NANO_ERR_ALLOCATION_FAIL (3) /* Kernel Allocation Failure */
|
|
|
|
#define _NANO_ERR_SPURIOUS_INT (4) /* Spurious interrupt */
|
|
|
|
#define _NANO_ERR_KERNEL_OOPS (5) /* Kernel oops (fatal to thread) */
|
|
|
|
#define _NANO_ERR_KERNEL_PANIC (6) /* Kernel panic (fatal to system) */
|
|
|
|
|
|
|
|
struct __esf {
|
|
|
|
u32_t dummy; /*maybe we will want to add somethign someday*/
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct __esf NANO_ESF;
|
|
|
|
extern const NANO_ESF _default_esf;
|
|
|
|
|
|
|
|
extern u32_t _timer_cycle_get_32(void);
|
|
|
|
#define _arch_k_cycle_get_32() _timer_cycle_get_32()
|
|
|
|
|
|
|
|
FUNC_NORETURN void _SysFatalErrorHandler(unsigned int reason,
|
|
|
|
const NANO_ESF *esf);
|
|
|
|
|
|
|
|
FUNC_NORETURN void _NanoFatalErrorHandler(unsigned int reason,
|
|
|
|
const NANO_ESF *esf);
|
|
|
|
|
2018-12-05 09:15:27 +08:00
|
|
|
/**
|
|
|
|
* @brief Explicitly nop operation.
|
|
|
|
*/
|
|
|
|
static ALWAYS_INLINE void arch_nop(void)
|
|
|
|
{
|
|
|
|
__asm__ volatile("nop");
|
|
|
|
}
|
|
|
|
|
2017-10-03 22:31:55 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2018-09-15 01:43:44 +08:00
|
|
|
#endif /* ZEPHYR_INCLUDE_ARCH_POSIX_ARCH_H_ */
|