2020-10-17 02:53:59 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2019-2020 Cobham Gaisler AB
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <kernel.h>
|
|
|
|
#include <kernel_internal.h>
|
|
|
|
#include <kswap.h>
|
|
|
|
#include <logging/log.h>
|
2020-11-27 02:32:34 +08:00
|
|
|
LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL);
|
2020-10-17 02:53:59 +08:00
|
|
|
|
|
|
|
FUNC_NORETURN void z_irq_spurious(const void *unused)
|
|
|
|
{
|
|
|
|
uint32_t tbr;
|
|
|
|
|
|
|
|
ARG_UNUSED(unused);
|
|
|
|
|
|
|
|
__asm__ volatile (
|
|
|
|
"rd %%tbr, %0" :
|
|
|
|
"=r" (tbr)
|
|
|
|
);
|
|
|
|
LOG_ERR("Spurious interrupt detected! IRQ: %d", (tbr >> 4) & 0xf);
|
|
|
|
z_sparc_fatal_error(K_ERR_SPURIOUS_IRQ, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
void z_sparc_enter_irq(uint32_t irl)
|
|
|
|
{
|
|
|
|
struct _isr_table_entry *ite;
|
|
|
|
|
|
|
|
_current_cpu->nested++;
|
|
|
|
|
|
|
|
#ifdef CONFIG_IRQ_OFFLOAD
|
2021-04-03 13:56:30 +08:00
|
|
|
if (irl != 141U) {
|
2020-10-17 02:53:59 +08:00
|
|
|
irl = z_sparc_int_get_source(irl);
|
|
|
|
ite = &_sw_isr_table[irl];
|
|
|
|
ite->isr(ite->arg);
|
|
|
|
} else {
|
|
|
|
z_irq_do_offload();
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
/* Get the actual interrupt source from the interrupt controller */
|
|
|
|
irl = z_sparc_int_get_source(irl);
|
|
|
|
ite = &_sw_isr_table[irl];
|
|
|
|
ite->isr(ite->arg);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
_current_cpu->nested--;
|
|
|
|
#ifdef CONFIG_STACK_SENTINEL
|
|
|
|
z_check_stack_sentinel();
|
|
|
|
#endif
|
|
|
|
}
|