Hi everyone,
I dont know what should I do to let the keil compiler know refer to which function when interrupt occur. I know interrupt functions are followed with _irq prefix but there may be several of these functions!
So an ARM7 with an NXP/LPC Vectored Interrupt Controller (VIC).
The jump via the VIC is likely in startup.s and when you configure the VIC you put the address of your IRQ Handler into the slot/vector set aside for the UART0.
For Example:
/****************************************************************************** ** 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 ** ******************************************************************************/ DWORD install_irq( DWORD IntNumber, void *HandlerAddr, DWORD Priority ) { DWORD *vect_addr; DWORD *vect_prio; VICIntEnClr = 1 << IntNumber; /* Disable Interrupt */ if ( IntNumber >= VIC_SIZE ) { return ( FALSE ); } else { /* find first un-assigned VIC address for the handler */ vect_addr = (DWORD *)(VIC_BASE_ADDR + VECT_ADDR_INDEX + IntNumber*4); vect_prio = (DWORD *)(VIC_BASE_ADDR + VECT_PRIO_INDEX + IntNumber*4); *vect_addr = (DWORD)HandlerAddr; /* set interrupt vector */ *vect_prio = Priority; VICIntEnable = 1 << IntNumber; /* Enable Interrupt */ return( TRUE ); } /****************************************************************************** ** Function name: init_timer ** ** Descriptions: Initialize timer, set timer interval, reset timer, ** install timer interrupt handler ** ** parameters: timer number and timer interval ** Returned value: true or false, if the interrupt handler can't be ** installed, return false. ** ******************************************************************************/ DWORD init_timer ( BYTE timer_num, DWORD TimerInterval ) { if ( timer_num == 0 ) { timer0_counter = 0; T0MR0 = TimerInterval; T0MCR = 3; /* Interrupt and Reset on MR0 */ #if FIQ /* FIQ is always installed. */ VICIntSelect |= (0x1<<4); VICIntEnable = (0x1<<4); return (TRUE); #else if ( install_irq( TIMER0_INT, (void *)Timer0Handler, HIGHEST_PRIORITY ) == FALSE ) { return (FALSE); } else { return (TRUE); } #endif } else if ( timer_num == 1 ) { timer1_counter = 0; T1MR0 = TimerInterval; T1MCR = 3; /* Interrupt and Reset on MR1 */ #if FIQ VICIntSelect |= (0x1<<5); VICIntEnable = (0x1<<5); return (TRUE); #else if ( install_irq( TIMER1_INT, (void *)Timer1Handler, HIGHEST_PRIORITY ) == FALSE ) { return (FALSE); } else { return (TRUE); } #endif } return (FALSE); }