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 <daniel.leung@intel.com>
This commit is contained in:
Daniel Leung 2023-12-06 15:01:22 -08:00 committed by Carles Cufí
commit d9b34c6108
2 changed files with 27 additions and 22 deletions

View file

@ -8,6 +8,11 @@
#include <zephyr/arch/xtensa/irq.h> #include <zephyr/arch/xtensa/irq.h>
#include <zephyr/sys/__assert.h> #include <zephyr/sys/__assert.h>
#include <kernel_arch_func.h>
#include <zephyr/logging/log.h>
LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL);
/** /**
* @internal * @internal
* *
@ -56,3 +61,25 @@ int z_arch_irq_connect_dynamic(unsigned int irq, unsigned int priority,
} }
#endif /* !CONFIG_MULTI_LEVEL_INTERRUPTS */ #endif /* !CONFIG_MULTI_LEVEL_INTERRUPTS */
#endif /* CONFIG_DYNAMIC_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;
}

View file

@ -30,19 +30,6 @@ static const struct z_exc_handle exceptions[] = {
}; };
#endif /* CONFIG_USERSPACE */ #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) void z_xtensa_dump_stack(const z_arch_esf_t *stack)
{ {
_xtensa_irq_stack_frame_raw_t *frame = (void *)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); return return_to(interrupted_stack);
} }
#endif #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;
}