Yahoo Groups archive

Lpc2000

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

Message

Re: [lpc2000] Interrupt function declaration

2006-05-10 by Andy

Thanks Tom,

I'm still quite new to embedded systems generally so please bear with me.
I'm running a task scheduler based on a 1ms tick using Timer0, so need one 
interrupt for this.  In addition I require an interrupt from EINT3 due to an 
external ethernet chip which requires attention when a message is recieved.
The timer0 int is time critical and must happen on time, the external 
interrupt can wait a bit if need be.  Currently I have the follow setup, do 
you think this would be ok?

VICVectAddr0 = (tDWord)Sch_Tick_Function;
VICVectCntl0 = 0x20 | 4;
VICIntEnable |= (1 << 4);

VICVectAddr1 = (tDWord)W3100A_Int_Service;
VICVectCntl1 = 0x20 | 17;
VICIntEnable |= (1 << 17);

and using the __attribute__((interrupt)); extention for the task 
declarations.
The program sits in a while(1) loop until either of the interrupts occur.
Also, so whats the __irq; extention for?

Thanks again,
Andy



> Andy wrote:
>
>>Hi all,
>>
>>Just wondering if anyone can clear something up for me.
>>I'm using the Vectored Interrupt Controller as decribed below, just 
>>wondering what function delaration extention I should use and what the 
>>difference is?
>>
>>Thanks,
>>Andy
>>
>>// Vectored Interrupt - Using Timer 0
>>VICVectAddr0 = (tDWord)Interrupt_Function;
>>VICVectCntl0 = 0x20 | 4;
>>VICIntEnable |= 1<<4;
>>
>>void Interrupt_Function (void) __attribute__((interrupt));
>>void Interrupt_Function (void) __attribute__((interrupt ("IRQ")));
>>void Interrupt_Function (void) __attribute__((interrupt ("FIQ")));
>>
>>
> Both "IRQ" and "FIQ" should switch register contexts and save certain
> registers (FIQ stacks nothing).  "interrupt" is more a general "save
> what you use here and restore when exiting".
>
> Look at the ASM code, is the attribute doing what you need it to do?
> You need to be carefull if you are doing nested interrupts to ensure
> that you don't suffer a re-entry into the current context (IRQ) and
> forget to save things.
>
>
> TomW
>
> -- 
> Tom Walsh - WN3L - Embedded Systems Consultant
> http://openhardware.net, http://cyberiansoftware.com
> "Windows? No thanks, I have work to do..."
> ----------------------------------------------------
>
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>
>

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.