Files
diplomarbeit/Tester/SW/lib/Drivers/irq.c
T
Matthias 373a8c32b2 Added Software projects
git-svn-id: file:///srv/dev-disk-by-uuid-17e88007-4d0c-45e0-8757-cacfcc458630/repositories/svn/Diplomarbeit@55 9fe90eed-be63-e94b-8204-d34ff4c2ff93
2008-12-23 10:34:08 +00:00

79 lines
2.5 KiB
C

/*****************************************************************************
* irq.c: Interrupt handler C file for NXP LPC230x Family Microprocessors
*
* Copyright(C) 2006, NXP Semiconductor
* All rights reserved.
*
* History
* 2006.07.13 ver 1.00 Prelimnary version, first Release
*
******************************************************************************/
#include "LPC23xx.h"
#include "types.h"
#include "irq.h"
/* Initialize the interrupt controller */
/******************************************************************************
** Function name: init_VIC
**
** Descriptions: Initialize VIC interrupt controller.
** parameters: None
** Returned value: None
**
******************************************************************************/
void init_VIC(void)
{
UINT32 i = 0;
UINT32 *vect_addr, *vect_cntl;
/* initialize VIC*/
VICIntEnClr = 0xffffffff;
VICVectAddr = 0;
VICIntSelect = 0;
/* set all the vector and vector control register to 0 */
for ( i = 0; i < VIC_SIZE; i++ )
{
vect_addr = (UINT32 *)(VIC_BASE_ADDR + VECT_ADDR_INDEX + i*4);
vect_cntl = (UINT32 *)(VIC_BASE_ADDR + VECT_CNTL_INDEX + i*4);
*vect_addr = 0x0;
*vect_cntl = 0xF;
}
return;
}
/******************************************************************************
** Function name: install_irq
**
** Descriptions: Install interrupt handler
** parameters: Interrupt number, interrupt handler address,
** interrupt priority
** Returned value: true or false, return false if IntNum is out of range
**
******************************************************************************/
BOOLEAN install_irq( UINT32 IntNumber, void *HandlerAddr, UINT32 Priority )
{
UINT32 *vect_addr;
UINT32 *vect_cntl;
VICIntEnClr = 1 << IntNumber; /* Disable Interrupt */
if ( IntNumber >= VIC_SIZE )
{
return ( FALSE );
}
else
{
/* find first un-assigned VIC address for the handler */
vect_addr = (UINT32 *)(VIC_BASE_ADDR + VECT_ADDR_INDEX + IntNumber*4);
vect_cntl = (UINT32 *)(VIC_BASE_ADDR + VECT_CNTL_INDEX + IntNumber*4);
*vect_addr = (UINT32)HandlerAddr; /* set interrupt vector */
*vect_cntl = Priority;
VICIntEnable = 1 << IntNumber; /* Enable Interrupt */
return( TRUE );
}
}
/******************************************************************************
** End Of File
******************************************************************************/