TMS570: Add ESM interrupt handler

This commit is contained in:
Gregory Nutt 2015-12-27 08:34:14 -06:00
parent e0214f9d62
commit c3758286d7
4 changed files with 50 additions and 17 deletions

View File

@ -58,18 +58,6 @@
#include "sched/sched.h"
#include "up_internal.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Private Data
****************************************************************************/
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/

View File

@ -48,14 +48,16 @@
#include <sys/types.h>
#include <stdint.h>
#include <debug.h>
#include <arch/irq.h>
#include "up_internal.h"
#include "up_arch.h"
#include "chip/tms570_esm.h"
#include "tms570_esm.h"
#include <arch/board/board.h>
/****************************************************************************
* 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 */
}

View File

@ -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)
}

View File

@ -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