Yahoo Groups archive

Lpc2000

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

Message

Re: Interrupt Handline

2004-11-09 by Randy Ott

It also keeps you from fiddling with the startup code when you want 
to write apps with or without IRQ.

I should also mention that if you are using GCC you will need to use 
something like "__attribute__((interrupt)(IRQ))" instead of 
the "__irq" and "__arm" modifiers.

Randy

--- In lpc2000@yahoogroups.com, "microbit" <microbit@c...> wrote:
> Hi Randy,
> 
> Thanks, I must have overlooked something, because I was in the 
belief that
> the VICVectAddr was "lost" once in the "irq_handler", thought 
could only
> handle
> it in ASM - must have gotten confused somewhere.
> 
> B rgds
> Kris
> 
> 
> > Here's the way I do it:
> >
> > // IRQ exception handler. Calls the interrupt handlers.
> > __irq __arm void irq_handler(void)
> > {
> >       void (*interrupt_function)();
> >       unsigned int vector;
> >
> >       vector = VICVectAddr;      // Get interrupt vector.
> >       interrupt_function = (void(*)())vector;
> >       (*interrupt_function)(); // Call vectored interrupt 
function.
> >       VICVectAddr = 0;      // Clear interrupt in VIC.
> > }
> >
> > That way you can write the individual ISRs in thumb mode.  The 
IRQ
> > handler must be written in ARM mode because the processor is in 
that
> > mode when an exception occurs.  During linking the weak link to
> > irq_handler (or whatever it is called) gets replaced with the C
> > function.
> >
> > Randy Ott

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.