2015-04-11 07:44:37 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2014 Wind River Systems, Inc.
|
|
|
|
*
|
2017-01-19 09:01:01 +08:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
2015-04-11 07:44:37 +08:00
|
|
|
*/
|
|
|
|
|
2015-12-04 23:09:39 +08:00
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* @brief Interrupt helper functions (ARC)
|
|
|
|
*
|
2016-12-18 22:42:55 +08:00
|
|
|
* This file contains private kernel structures definitions and various
|
2015-04-11 07:44:37 +08:00
|
|
|
* other definitions for the ARCv2 processor architecture.
|
|
|
|
*/
|
|
|
|
|
2018-09-15 01:43:44 +08:00
|
|
|
#ifndef ZEPHYR_ARCH_ARC_INCLUDE_V2_IRQ_H_
|
|
|
|
#define ZEPHYR_ARCH_ARC_INCLUDE_V2_IRQ_H_
|
2015-04-11 07:44:37 +08:00
|
|
|
|
2016-01-23 01:38:49 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2015-04-11 07:44:37 +08:00
|
|
|
#define _ARC_V2_AUX_IRQ_CTRL_BLINK (1 << 9)
|
|
|
|
#define _ARC_V2_AUX_IRQ_CTRL_LOOP_REGS (1 << 10)
|
arch: arc: add user space support for arc
* add the implementation of syscall
* based on 'trap_s' intruction, id = 3
* add the privilege stack
* the privilege stack is allocted with thread stack
* for the kernel thread, the privilege stack is also a
part of thread stack, the start of stack can be configured
as stack guard
* for the user thread, no stack guard, when the user stack is
overflow, it will fall into kernel memory area which requires
kernel privilege, privilege violation will be raised
* modify the linker template and add MPU_ADDR_ALIGN
* add user space corresponding codes in mpu
* the user sp aux reg will be part of thread context
* When user thread is interruptted for the 1st time, the context is
saved in user stack (U bit of IRQ_CTLR is set to 1). When nest
interrupt comes, the context is saved in thread's privilege stack
* the arc_mpu_regions.c is moved to board folder, as it's board
specific
* the above codes have been tested through tests/kernel/mem_protect/
userspace for MPU version 2
Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
2018-01-23 17:13:09 +08:00
|
|
|
#define _ARC_V2_AUX_IRQ_CTRL_U (1 << 11)
|
2016-10-08 02:51:41 +08:00
|
|
|
#define _ARC_V2_AUX_IRQ_CTRL_LP (1 << 13)
|
2015-04-11 07:44:37 +08:00
|
|
|
#define _ARC_V2_AUX_IRQ_CTRL_14_REGS 7
|
|
|
|
#define _ARC_V2_AUX_IRQ_CTRL_16_REGS 8
|
|
|
|
#define _ARC_V2_AUX_IRQ_CTRL_32_REGS 16
|
|
|
|
|
boards: Update arc em_starterkit support from 2.2 to 2.3
Here are the main changes:
* board: Update EMSK onboard resources such as Button, Switch and LEDs
+ update soc.h for em7d, em9d, em11d
+ update board.h for em_starterkit board
* arc: Add floating point support and code density support
+ add kconfig configuration
+ add compiler options
+ add register definitions, marcos, assembly codes
+ fixes in existing codes and configurations.
* arc: Update detailed board configurations for cores of emsk 2.3
* script: Provide arc_debugger.sh for debugging em_starterkit board
+ make BOARD=em_starterkit debug
This will start openocd server for emsk, and arc gdb will connect
to this debug server, user can run `continue` command if user just
want to run the application, or other commands if debugging needed.
+ make BOARD=em_starterkit debugserver
This will start an openocd debugger server for emsk, and user can
connect to this debugserver using arc gdb and do what they want to.
+ make BOARD=em_starterkit flash
This will download the zephyr application elf file to emsk,
and run it.
Signed-off-by: Huaqi Fang <huaqi.fang@synopsys.com>
2017-05-17 15:18:51 +08:00
|
|
|
|
2016-09-24 07:10:07 +08:00
|
|
|
#define _ARC_V2_DEF_IRQ_LEVEL (CONFIG_NUM_IRQ_PRIO_LEVELS-1)
|
|
|
|
#define _ARC_V2_WAKE_IRQ_LEVEL _ARC_V2_DEF_IRQ_LEVEL
|
2015-04-11 07:44:37 +08:00
|
|
|
|
|
|
|
#ifndef _ASMLANGUAGE
|
|
|
|
|
2017-07-26 09:47:07 +08:00
|
|
|
extern K_THREAD_STACK_DEFINE(_interrupt_stack, CONFIG_ISR_STACK_SIZE);
|
2015-04-11 07:44:37 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* _irq_setup
|
|
|
|
*
|
|
|
|
* Configures interrupt handling parameters
|
|
|
|
*/
|
|
|
|
static ALWAYS_INLINE void _irq_setup(void)
|
|
|
|
{
|
2017-04-21 02:30:33 +08:00
|
|
|
u32_t aux_irq_ctrl_value = (
|
2015-04-11 07:44:37 +08:00
|
|
|
_ARC_V2_AUX_IRQ_CTRL_LOOP_REGS | /* save lp_xxx registers */
|
boards: Update arc em_starterkit support from 2.2 to 2.3
Here are the main changes:
* board: Update EMSK onboard resources such as Button, Switch and LEDs
+ update soc.h for em7d, em9d, em11d
+ update board.h for em_starterkit board
* arc: Add floating point support and code density support
+ add kconfig configuration
+ add compiler options
+ add register definitions, marcos, assembly codes
+ fixes in existing codes and configurations.
* arc: Update detailed board configurations for cores of emsk 2.3
* script: Provide arc_debugger.sh for debugging em_starterkit board
+ make BOARD=em_starterkit debug
This will start openocd server for emsk, and arc gdb will connect
to this debug server, user can run `continue` command if user just
want to run the application, or other commands if debugging needed.
+ make BOARD=em_starterkit debugserver
This will start an openocd debugger server for emsk, and user can
connect to this debugserver using arc gdb and do what they want to.
+ make BOARD=em_starterkit flash
This will download the zephyr application elf file to emsk,
and run it.
Signed-off-by: Huaqi Fang <huaqi.fang@synopsys.com>
2017-05-17 15:18:51 +08:00
|
|
|
#ifdef CONFIG_CODE_DENSITY
|
|
|
|
_ARC_V2_AUX_IRQ_CTRL_LP | /* save code density registers */
|
|
|
|
#endif
|
2015-04-11 07:44:37 +08:00
|
|
|
_ARC_V2_AUX_IRQ_CTRL_BLINK | /* save blink */
|
|
|
|
_ARC_V2_AUX_IRQ_CTRL_14_REGS /* save r0 -> r13 (caller-saved) */
|
|
|
|
);
|
|
|
|
|
2016-12-15 02:04:36 +08:00
|
|
|
k_cpu_sleep_mode = _ARC_V2_WAKE_IRQ_LEVEL;
|
2015-04-11 07:44:37 +08:00
|
|
|
_arc_v2_aux_reg_write(_ARC_V2_AUX_IRQ_CTRL, aux_irq_ctrl_value);
|
|
|
|
|
2017-07-26 09:47:07 +08:00
|
|
|
_kernel.irq_stack =
|
|
|
|
K_THREAD_STACK_BUFFER(_interrupt_stack) + CONFIG_ISR_STACK_SIZE;
|
2015-04-11 07:44:37 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* _ASMLANGUAGE */
|
2016-01-23 01:38:49 +08:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2018-09-15 01:43:44 +08:00
|
|
|
#endif /* ZEPHYR_ARCH_ARC_INCLUDE_V2_IRQ_H_ */
|