avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] SIGNAL or INTERRUPT ?!


From: Lars Noschinski
Subject: Re: [avr-gcc-list] SIGNAL or INTERRUPT ?!
Date: Sun, 4 Sep 2005 09:36:58 +0200
User-agent: mutt-ng devel (Linux)

* User Tomdean <address@hidden> [2005-09-04 09:09]:
The difference is in the compiler and the code it supplies for the
handler.  Section 6.20.6, SIGNAL(...).  Section 6.20.4, INTERRUPT(...).

Lookup the respective __attribute__ in the gcc documents.

In avr/signal.h,

/** \def SIGNAL(signame)
   \ingroup avr_interrupts
   \code#include <avr/signal.h>\endcode
   Introduces an interrupt handler function that runs with global interrupts
   initially disabled.  */
...
#define SIGNAL(signame)                                 \
void signame (void) __attribute__ ((signal));           \
void signame (void)

In a really time critical interrupt (I need to do some things even
before SREG is saved), I use the following, so I can write rest of the
interrupt routine in C:

void real_signame(void) __attribute__ ((signal));

SIGNAL (signame) __attribute__ ((naked));
SIGNAL (signame) {
   asm volatile (
       ...
       "call real_signame");
}

Is this approach ok, or has it some hidden caveats and there is a better
solution?




reply via email to

[Prev in Thread] Current Thread [Next in Thread]