2015-04-10 16:44:37 -07:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2014 Wind River Systems, Inc.
|
|
|
|
*
|
2017-01-18 17:01:01 -08:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
2015-04-10 16:44:37 -07:00
|
|
|
*/
|
|
|
|
|
2015-12-04 10:09:39 -05:00
|
|
|
/**
|
|
|
|
* @file
|
2016-12-23 07:32:56 -05:00
|
|
|
* @brief ARC specific kernel interface header
|
2015-12-04 10:09:39 -05:00
|
|
|
*
|
2016-12-23 07:32:56 -05:00
|
|
|
* This header contains the ARC specific kernel interface. It is
|
|
|
|
* included by the kernel interface architecture-abstraction header
|
|
|
|
* include/arch/cpu.h)
|
2015-07-01 17:22:39 -04:00
|
|
|
*/
|
2015-04-10 16:44:37 -07:00
|
|
|
|
|
|
|
#ifndef _ARC_ARCH__H_
|
|
|
|
#define _ARC_ARCH__H_
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2017-04-18 16:22:55 -07:00
|
|
|
/* APIs need to support non-byte addressable architectures */
|
2015-06-01 13:39:43 -04:00
|
|
|
|
|
|
|
#define OCTET_TO_SIZEOFUNIT(X) (X)
|
|
|
|
#define SIZEOFUNIT_TO_OCTET(X) (X)
|
|
|
|
|
2017-09-22 00:15:14 +05:30
|
|
|
#include <generated_dts_board.h>
|
2015-11-24 17:02:50 -06:00
|
|
|
#include <sw_isr_table.h>
|
2015-04-10 16:44:37 -07:00
|
|
|
#ifdef CONFIG_CPU_ARCV2
|
2015-05-28 10:56:47 -07:00
|
|
|
#include <arch/arc/v2/exc.h>
|
|
|
|
#include <arch/arc/v2/irq.h>
|
|
|
|
#include <arch/arc/v2/ffs.h>
|
|
|
|
#include <arch/arc/v2/error.h>
|
|
|
|
#include <arch/arc/v2/misc.h>
|
|
|
|
#include <arch/arc/v2/aux_regs.h>
|
|
|
|
#include <arch/arc/v2/arcv2_irq_unit.h>
|
2015-08-25 14:39:56 +03:00
|
|
|
#include <arch/arc/v2/asm_inline.h>
|
2015-10-29 16:20:28 -04:00
|
|
|
#include <arch/arc/v2/addr_types.h>
|
2015-04-10 16:44:37 -07:00
|
|
|
#endif
|
|
|
|
|
2017-08-15 12:20:42 +08:00
|
|
|
#if defined(CONFIG_MPU_STACK_GUARD)
|
|
|
|
#if defined(CONFIG_ARC_CORE_MPU)
|
|
|
|
#if CONFIG_ARC_MPU_VER == 2
|
2017-08-16 16:59:54 +08:00
|
|
|
/*
|
|
|
|
* The minimum MPU region of MPU v2 is 2048 bytes. The
|
|
|
|
* start address of MPU region should be aligned to the
|
|
|
|
* region size
|
|
|
|
*/
|
|
|
|
/* The STACK_GUARD_SIZE is the size of stack guard region */
|
2017-08-15 12:20:42 +08:00
|
|
|
#define STACK_ALIGN 2048
|
2017-08-16 16:59:54 +08:00
|
|
|
#define STACK_GUARD_SIZE 2048
|
2017-08-15 12:20:42 +08:00
|
|
|
#elif CONFIG_ARC_MPU_VER == 3
|
|
|
|
#define STACK_ALIGN 32
|
2017-08-16 16:59:54 +08:00
|
|
|
#define STACK_GUARD_SIZE 32
|
2017-08-15 12:20:42 +08:00
|
|
|
#endif
|
|
|
|
#else /* CONFIG_ARC_CORE_MPU */
|
|
|
|
#error "Unsupported STACK_ALIGN"
|
|
|
|
#endif
|
|
|
|
#else /* CONFIG_MPU_STACK_GUARD */
|
2015-05-26 10:21:42 -04:00
|
|
|
#define STACK_ALIGN 4
|
2017-08-16 16:59:54 +08:00
|
|
|
#define STACK_GUARD_SIZE 0
|
2017-08-15 12:20:42 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define _ARCH_THREAD_STACK_DEFINE(sym, size) \
|
|
|
|
struct _k_thread_stack_element __noinit __aligned(STACK_ALIGN) \
|
2017-08-16 16:59:54 +08:00
|
|
|
sym[size+STACK_GUARD_SIZE]
|
2017-08-15 12:20:42 +08:00
|
|
|
|
|
|
|
#define _ARCH_THREAD_STACK_ARRAY_DEFINE(sym, nmemb, size) \
|
|
|
|
struct _k_thread_stack_element __noinit __aligned(STACK_ALIGN) \
|
2017-08-16 16:59:54 +08:00
|
|
|
sym[nmemb][size+STACK_GUARD_SIZE]
|
2017-08-15 12:20:42 +08:00
|
|
|
|
|
|
|
#define _ARCH_THREAD_STACK_MEMBER(sym, size) \
|
|
|
|
struct _k_thread_stack_element __aligned(STACK_ALIGN) \
|
2017-08-16 16:59:54 +08:00
|
|
|
sym[size+STACK_GUARD_SIZE]
|
2017-08-15 12:20:42 +08:00
|
|
|
|
2017-08-16 16:59:54 +08:00
|
|
|
#define _ARCH_THREAD_STACK_SIZEOF(sym) (sizeof(sym) - STACK_GUARD_SIZE)
|
2017-08-15 12:20:42 +08:00
|
|
|
|
2017-08-16 16:59:54 +08:00
|
|
|
#define _ARCH_THREAD_STACK_BUFFER(sym) ((char *)(sym + STACK_GUARD_SIZE))
|
2017-08-15 12:20:42 +08:00
|
|
|
|
2015-05-26 10:21:42 -04:00
|
|
|
|
2015-04-10 16:44:37 -07:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif /* _ARC_ARCH__H_ */
|