Yahoo Groups archive

Lpc2000

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

Message

Re: [lpc2000] Interrupt function declaration

2006-05-10 by Tom Walsh

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..."
----------------------------------------------------

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.