diff --git a/arch/arm/src/armv7-r/arm_prefetchabort.c b/arch/arm/src/armv7-r/arm_prefetchabort.c index ced1c68ea5..1e3171a80f 100644 --- a/arch/arm/src/armv7-r/arm_prefetchabort.c +++ b/arch/arm/src/armv7-r/arm_prefetchabort.c @@ -58,18 +58,6 @@ #include "sched/sched.h" #include "up_internal.h" -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - /**************************************************************************** * Public Functions ****************************************************************************/ diff --git a/arch/arm/src/tms570/tms570_esm.c b/arch/arm/src/tms570/tms570_esm.c index cbbaa1e4f2..b7f17ab52b 100644 --- a/arch/arm/src/tms570/tms570_esm.c +++ b/arch/arm/src/tms570/tms570_esm.c @@ -48,14 +48,16 @@ #include #include +#include +#include + +#include "up_internal.h" #include "up_arch.h" #include "chip/tms570_esm.h" #include "tms570_esm.h" -#include - /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -113,12 +115,12 @@ int tms570_esm_initialize(void) putreg32(0, TMS570_ESM_EKR); } - /* Clear interrupt level */ + /* Clear interrupt level. All channels set to low level interrupt. */ putreg32(0xffffffff, TMS570_ESM_ILCR1); putreg32(0xffffffff, TMS570_ESM_ILCR4); - /* Set interrupt level */ + /* Set interrupt level (Writing zero does nothing) */ putreg32(0, TMS570_ESM_ILSR1); putreg32(0, TMS570_ESM_ILSR4); @@ -134,3 +136,26 @@ int tms570_esm_initialize(void) putreg32(0, TMS570_ESM_IESR4); return OK; } + +/**************************************************************************** + * Name: tms570_esm_interrupt + * + * Description: + * ESM interrupt handler + * + ****************************************************************************/ + +int tms570_esm_interrupt(int irq, void *context) +{ + /* Save the saved processor context in current_regs where it can be accessed + * for register dumps and possibly context switching. + */ + + current_regs = (uint32_t *)context; + + /* Crash -- possibly showing diagnostic debug information. */ + + lldbg("ESM Interrupt. PC: %08x\n", current_regs[REG_PC]); + PANIC(); + return OK; /* To keep the compiler happy */ +} diff --git a/arch/arm/src/tms570/tms570_esm.h b/arch/arm/src/tms570/tms570_esm.h index b5fd706c8e..7222cc17fe 100644 --- a/arch/arm/src/tms570/tms570_esm.h +++ b/arch/arm/src/tms570/tms570_esm.h @@ -71,6 +71,16 @@ extern "C" int tms570_esm_initialize(void); +/**************************************************************************** + * Name: tms570_esm_interrupt + * + * Description: + * ESM interrupt handler + * + ****************************************************************************/ + +int tms570_esm_interrupt(int irq, void *context); + #undef EXTERN #if defined(__cplusplus) } diff --git a/arch/arm/src/tms570/tms570_irq.c b/arch/arm/src/tms570/tms570_irq.c index ed569c74b3..af617894ae 100644 --- a/arch/arm/src/tms570/tms570_irq.c +++ b/arch/arm/src/tms570/tms570_irq.c @@ -53,6 +53,7 @@ #include "chip/tms570_vim.h" #include "tms570_gio.h" +#include "tms570_esm.h" #include "tms570_irq.h" /**************************************************************************** @@ -182,7 +183,16 @@ void up_irqinitialize(void) tms570_gioirq_initialize(); #endif - /* And finally, enable interrupts */ + /* Attach and enable ESM interrupts. The high level interrupt is really + * an NMI. + */ + + (void)irq_attach(TMS570_REQ_ESMHIGH, tms570_esm_interrupt); + (void)irq_attach(TMS570_REQ_ESMLO, tms570_esm_interrupt); + up_enable_irq(TMS570_REQ_ESMHIGH); + up_enable_irq(TMS570_REQ_ESMLO); + + /* And finally, enable interrupts globally */ irqenable(); #endif