2015-04-11 01:44:37 +02:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2014 Wind River Systems, Inc.
|
|
|
|
*
|
2017-01-19 02:01:01 +01:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
2015-04-11 01:44:37 +02:00
|
|
|
*/
|
|
|
|
|
2015-12-04 16:09:39 +01:00
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* @brief Interrupt helper functions (ARC)
|
|
|
|
*
|
2016-12-18 15:42:55 +01:00
|
|
|
* This file contains private kernel structures definitions and various
|
2015-04-11 01:44:37 +02:00
|
|
|
* other definitions for the ARCv2 processor architecture.
|
|
|
|
*/
|
|
|
|
|
2018-09-14 19:43:44 +02:00
|
|
|
#ifndef ZEPHYR_ARCH_ARC_INCLUDE_V2_IRQ_H_
|
|
|
|
#define ZEPHYR_ARCH_ARC_INCLUDE_V2_IRQ_H_
|
2015-04-11 01:44:37 +02:00
|
|
|
|
2022-05-06 10:49:15 +02:00
|
|
|
#include <zephyr/arch/cpu.h>
|
2019-08-01 06:39:35 +02:00
|
|
|
|
2016-01-22 18:38:49 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2015-04-11 01:44:37 +02: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 10:13:09 +01:00
|
|
|
#define _ARC_V2_AUX_IRQ_CTRL_U (1 << 11)
|
2016-10-07 20:51:41 +02:00
|
|
|
#define _ARC_V2_AUX_IRQ_CTRL_LP (1 << 13)
|
2015-04-11 01:44:37 +02: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 09:18:51 +02:00
|
|
|
|
2019-08-01 06:39:35 +02:00
|
|
|
#ifdef CONFIG_ARC_SECURE_FIRMWARE
|
|
|
|
#define _ARC_V2_DEF_IRQ_LEVEL (ARC_N_IRQ_START_LEVEL - 1)
|
|
|
|
#else
|
2019-06-13 11:21:52 +02:00
|
|
|
#define _ARC_V2_DEF_IRQ_LEVEL (CONFIG_NUM_IRQ_PRIO_LEVELS - 1)
|
2019-08-01 06:39:35 +02:00
|
|
|
#endif
|
|
|
|
|
2016-09-24 01:10:07 +02:00
|
|
|
#define _ARC_V2_WAKE_IRQ_LEVEL _ARC_V2_DEF_IRQ_LEVEL
|
2015-04-11 01:44:37 +02:00
|
|
|
|
2019-06-13 11:21:52 +02:00
|
|
|
/*
|
|
|
|
* INIT_IRQ_LOCK_KEY is init interrupt level setting of a thread.
|
|
|
|
* It's configured by seti instruction when a thread starts to run
|
|
|
|
*, i.e., z_thread_entry_wrapper and z_user_thread_entry_wrapper
|
|
|
|
*/
|
|
|
|
#define _ARC_V2_INIT_IRQ_LOCK_KEY (0x10 | _ARC_V2_DEF_IRQ_LEVEL)
|
|
|
|
|
2015-04-11 01:44:37 +02:00
|
|
|
#ifndef _ASMLANGUAGE
|
|
|
|
/*
|
2019-03-14 16:20:46 +01:00
|
|
|
* z_irq_setup
|
2015-04-11 01:44:37 +02:00
|
|
|
*
|
|
|
|
* Configures interrupt handling parameters
|
|
|
|
*/
|
2019-03-14 16:20:46 +01:00
|
|
|
static ALWAYS_INLINE void z_irq_setup(void)
|
2015-04-11 01:44:37 +02:00
|
|
|
{
|
2020-05-27 18:26:57 +02:00
|
|
|
uint32_t aux_irq_ctrl_value = (
|
2021-04-07 18:23:23 +02:00
|
|
|
#ifdef CONFIG_ARC_HAS_ZOL
|
2015-04-11 01:44:37 +02:00
|
|
|
_ARC_V2_AUX_IRQ_CTRL_LOOP_REGS | /* save lp_xxx registers */
|
2021-04-07 18:23:23 +02:00
|
|
|
#endif /* CONFIG_ARC_HAS_ZOL */
|
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 09:18:51 +02:00
|
|
|
#ifdef CONFIG_CODE_DENSITY
|
|
|
|
_ARC_V2_AUX_IRQ_CTRL_LP | /* save code density registers */
|
|
|
|
#endif
|
2015-04-11 01:44:37 +02:00
|
|
|
_ARC_V2_AUX_IRQ_CTRL_BLINK | /* save blink */
|
|
|
|
_ARC_V2_AUX_IRQ_CTRL_14_REGS /* save r0 -> r13 (caller-saved) */
|
|
|
|
);
|
|
|
|
|
2019-09-22 03:07:07 +02:00
|
|
|
z_arc_cpu_sleep_mode = _ARC_V2_WAKE_IRQ_LEVEL;
|
2019-08-01 06:39:35 +02:00
|
|
|
|
|
|
|
#ifdef CONFIG_ARC_NORMAL_FIRMWARE
|
|
|
|
/* normal mode cannot write irq_ctrl, ignore it */
|
|
|
|
aux_irq_ctrl_value = aux_irq_ctrl_value;
|
|
|
|
#else
|
2019-03-08 22:19:05 +01:00
|
|
|
z_arc_v2_aux_reg_write(_ARC_V2_AUX_IRQ_CTRL, aux_irq_ctrl_value);
|
2019-08-01 06:39:35 +02:00
|
|
|
#endif
|
2015-04-11 01:44:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* _ASMLANGUAGE */
|
2016-01-22 18:38:49 +01:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2018-09-14 19:43:44 +02:00
|
|
|
#endif /* ZEPHYR_ARCH_ARC_INCLUDE_V2_IRQ_H_ */
|