From d9b34c61089f3b8e10ec90074750f1c77cb79e8d Mon Sep 17 00:00:00 2001 From: Daniel Leung Date: Wed, 6 Dec 2023 15:01:22 -0800 Subject: [PATCH] xtensa: move irq management stuff into irq_manage.c... ... from xtensa_asm2.c. Other architectures have z_irq_spurious() and *_irq_is_enabled() test in irq_manage.c. So follow the trend here. Signed-off-by: Daniel Leung --- arch/xtensa/core/irq_manage.c | 27 +++++++++++++++++++++++++++ arch/xtensa/core/xtensa_asm2.c | 22 ---------------------- 2 files changed, 27 insertions(+), 22 deletions(-) diff --git a/arch/xtensa/core/irq_manage.c b/arch/xtensa/core/irq_manage.c index 1c592734084..32dfc583dc9 100644 --- a/arch/xtensa/core/irq_manage.c +++ b/arch/xtensa/core/irq_manage.c @@ -8,6 +8,11 @@ #include #include +#include + +#include +LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL); + /** * @internal * @@ -56,3 +61,25 @@ int z_arch_irq_connect_dynamic(unsigned int irq, unsigned int priority, } #endif /* !CONFIG_MULTI_LEVEL_INTERRUPTS */ #endif /* CONFIG_DYNAMIC_INTERRUPTS */ + +void z_irq_spurious(const void *arg) +{ + int irqs, ie; + + ARG_UNUSED(arg); + + __asm__ volatile("rsr.interrupt %0" : "=r"(irqs)); + __asm__ volatile("rsr.intenable %0" : "=r"(ie)); + LOG_ERR(" ** Spurious INTERRUPT(s) %p, INTENABLE = %p", + (void *)irqs, (void *)ie); + z_xtensa_fatal_error(K_ERR_SPURIOUS_IRQ, NULL); +} + +int z_xtensa_irq_is_enabled(unsigned int irq) +{ + uint32_t ie; + + __asm__ volatile("rsr.intenable %0" : "=r"(ie)); + + return (ie & (1 << irq)) != 0U; +} diff --git a/arch/xtensa/core/xtensa_asm2.c b/arch/xtensa/core/xtensa_asm2.c index 0b2eb3117ec..99b05d8e203 100644 --- a/arch/xtensa/core/xtensa_asm2.c +++ b/arch/xtensa/core/xtensa_asm2.c @@ -30,19 +30,6 @@ static const struct z_exc_handle exceptions[] = { }; #endif /* CONFIG_USERSPACE */ -void z_irq_spurious(const void *arg) -{ - int irqs, ie; - - ARG_UNUSED(arg); - - __asm__ volatile("rsr.interrupt %0" : "=r"(irqs)); - __asm__ volatile("rsr.intenable %0" : "=r"(ie)); - LOG_ERR(" ** Spurious INTERRUPT(s) %p, INTENABLE = %p", - (void *)irqs, (void *)ie); - z_xtensa_fatal_error(K_ERR_SPURIOUS_IRQ, NULL); -} - void z_xtensa_dump_stack(const z_arch_esf_t *stack) { _xtensa_irq_stack_frame_raw_t *frame = (void *)stack; @@ -398,12 +385,3 @@ void *xtensa_debugint_c(int *interrupted_stack) return return_to(interrupted_stack); } #endif - -int z_xtensa_irq_is_enabled(unsigned int irq) -{ - uint32_t ie; - - __asm__ volatile("rsr.intenable %0" : "=r"(ie)); - - return (ie & (1 << irq)) != 0U; -}