Skip to content

Commit

Permalink
arch: arm: Add vectored interrupt support for Cortex-R.
Browse files Browse the repository at this point in the history
This commit defines a new Cortex-R configuration 'VIC_IRQ_VECTOR' and
implements IRQ initialisation routine to configure SCTLR.VE.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
  • Loading branch information
stephanosio committed Nov 4, 2019
1 parent 74ed57c commit 4581910
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 9 deletions.
1 change: 1 addition & 0 deletions arch/arm/core/cortex_r/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ zephyr_library_sources(
vector_table.S
reset.S
fault.c
irq_init.c
irq_manage.c
reboot.c
stacks.c
Expand Down
11 changes: 8 additions & 3 deletions arch/arm/core/cortex_r/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,6 @@ config ARMV7_SYS_STACK_SIZE
help
This option specifies the size of the stack used by the system mode.

if CPU_CORTEX_R

config RUNTIME_NMI
default y

Expand All @@ -90,6 +88,13 @@ config GEN_ISR_TABLES
config GEN_IRQ_VECTOR_TABLE
default n

endif # CPU_CORTEX_R
config VIC_IRQ_VECTOR
bool "Enable VIC port hardware IRQ vector"
depends on (CPU_CORTEX_R4 || CPU_CORTEX_R5)
help
Enable hardware IRQ vector using the handler address provided by the
the system interrupt controller through VIC port. When this option is
selected, the IRQ vector (offset 0x18) in the CPU exception vector table
is not used.

endif # CPU_CORTEX_R
30 changes: 30 additions & 0 deletions arch/arm/core/cortex_r/irq_init.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Copyright (c) 2019 Stephanos Ioannidis <root@stephanos.io>
*
* SPDX-License-Identifier: Apache-2.0
*/

/**
* @file
* @brief ARM Cortex-R interrupt initialization
*/

#include <arch/cpu.h>

/**
* @brief Initialize interrupts
*
* @return N/A
*/

void z_arm_int_lib_init(void)
{
/* Configure hardware vectored interrupt mode.*/
#if defined(CONFIG_VIC_IRQ_VECTOR)
__asm__ volatile(
"mrc p15, #0, r0, c1, c0, #0;"
"orr r0, r0, #0x01000000;" /* [24] VE bit */
"mcr p15, #0, r0, c1, c0, #0;"
: : : "memory");
#endif
}
6 changes: 0 additions & 6 deletions include/arch/arm/irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,7 @@ extern int z_arch_irq_is_enabled(unsigned int irq);

extern void z_arm_int_exit(void);

#if defined(CONFIG_CPU_CORTEX_R)
static ALWAYS_INLINE void z_arm_int_lib_init(void)
{
}
#else
extern void z_arm_int_lib_init(void);
#endif

/* macros convert value of it's argument to a string */
#define DO_TOSTR(s) #s
Expand Down

0 comments on commit 4581910

Please sign in to comment.