Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: Multiple IRQ routines in GCC

2006-05-01 by rtstofer

--- In lpc2000@yahoogroups.com, vineet jain <vineetrvce@...> wrote:
>
> I meant the toolchains these two IDE's use. Ideally the way IRQ
interrupts are called should be the same as both use GCC.
> 
> Also how do you plan to write IRQ routine for let's say:
> 
> an RTC and a UART.
> 
> beacuse in the sample code they talk about an IRQ stub ( mentioned
in earlier mail ). 
> 
> If anyone's using GCC, please send an sample code for activating two
IRQ interrupts.
> 
> Thanks and regards,
> Vineet.

In my initialization code (substantially snipped):

	// set up I2C
	
	VICVectCntl1 = 0x00000029;	// select a priority spot for a given
interrupt
	VICVectAddr1 = (unsigned long) I2CISR;	// pass the address of the ISR
	VICIntEnable = 0x00000200;	// enable interrupt

	// set up Timer 0

	VICVectCntl3 = 0x00000024;	// set priority 3 for Timer 0
	VICVectAddr3 = (unsigned long) T0ISR;	// pass the address of the ISR
	VICIntEnable = 0x00000010;	// enable interrupt

.....

In my 'interrupt.h' where I deal with the timer interrupt prototype

void T0ISR         (void) __attribute__ ((interrupt       ));
void IRQ_Routine   (void) __attribute__ ((interrupt("IRQ")));
void FIQ_Routine   (void) __attribute__ ((interrupt("FIQ")));
void SWI_Routine   (void) __attribute__ ((interrupt("SWI")));
void UNDEF_Routine (void) __attribute__ ((interrupt("UNDEF")));


In my 'interrupt.c' where the timer interrupt does nothing:

void T0ISR(void)
{
	TIMER0_IR = 0x01;
	VICVectAddr = 0xFF;
}
	
void IRQ_Routine (void) {
	while (1) ;	
}

void FIQ_Routine (void)  {
	while (1) ;	
}

void SWI_Routine (void)  {
	while (1) ;	
}


void UNDEF_Routine (void) {
	while (1) ;	
}

In my i2c.h file where I provide the prototype for I2CISR:

  void I2CISR (void) __attribute__ ((interrupt));


And, finally, there is code in i2c.c that implements the I2C state
machine in the I2CISR interrupt handler.  Not posted here

Richard

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.