mirror of
https://github.com/apache/nuttx.git
synced 2026-06-02 01:21:26 +08:00
arch/tricore: add NMI trap handler (weak)
Add support for handling non-maskable interrupts (NMI) on TriCore platforms. The NMI trap handler `tricore_nmitrap()` is provided as a weak function that prints diagnostic information and invokes a panic with register context. The main trap dispatcher will invoke `tricore_nmitrap` when an NMI trap class is detected. This change improves diagnostics when watchdog-induced NMIs or other non-maskable exceptions occur during runtime. Signed-off-by: yukangzhi <yukangzhi@xiaomi.com>
This commit is contained in:
@@ -65,6 +65,17 @@ static void tricore_trapinfo(volatile void *trap)
|
|||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
int weak_function tricore_nmitrap(uint32_t tid, void *context, void *arg)
|
||||||
|
{
|
||||||
|
_alert("PANIC!!! NMI Trap:\n");
|
||||||
|
_alert("\tClass %d TID: %d regs: %p\n",
|
||||||
|
IfxCpu_Trap_Class_nonMaskableInterrupt, tid, context);
|
||||||
|
|
||||||
|
up_irq_save();
|
||||||
|
PANIC_WITH_REGS("panic", context);
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
int tricore_mmutrap(uint32_t tid, void *context, void *arg)
|
int tricore_mmutrap(uint32_t tid, void *context, void *arg)
|
||||||
{
|
{
|
||||||
_alert("PANIC!!! MMU Trap:\n");
|
_alert("PANIC!!! MMU Trap:\n");
|
||||||
@@ -322,6 +333,13 @@ void tricore_trapcall(volatile void *trap)
|
|||||||
|
|
||||||
up_set_interrupt_context(true);
|
up_set_interrupt_context(true);
|
||||||
|
|
||||||
|
if (tclass == IfxCpu_Trap_Class_nonMaskableInterrupt)
|
||||||
|
{
|
||||||
|
tricore_nmitrap(tid, regs, NULL);
|
||||||
|
up_set_interrupt_context(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (tclass == IfxCpu_Trap_Class_memoryManagement)
|
if (tclass == IfxCpu_Trap_Class_memoryManagement)
|
||||||
{
|
{
|
||||||
tricore_mmutrap(tid, regs, NULL);
|
tricore_mmutrap(tid, regs, NULL);
|
||||||
|
|||||||
Reference in New Issue
Block a user