avr-libc-dev
[Top][All Lists]
Advanced

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

[avr-libc-dev] empty interrupts


From: Artur Lipowski
Subject: [avr-libc-dev] empty interrupts
Date: Fri, 11 Apr 2003 08:20:16 +0200

Hi,

Sometimes we need to enable interrupt but nothing should be done in the ISR
(eg. using ADC noise canceler function).
Declaring a standard SIGNAL macro and leaving empty body works fine but...
There is still generated prolog and epilog for ISR and a few words of FLASH
is lost as weel as a few CPU cycles. I know this is nothing importand but
sometimes it can be significant.
Because of above I use in my projects following defines:

#ifdef __cplusplus
#define EMPTY_INTERRUPT(signame)            \
extern "C" void signame(void);                          \
void signame (void) __attribute__((naked)) ;      \
void signame (void) {  __asm__ __volatile__ ("reti" ::); }
#else
#define EMPTY_INTERRUPT(signame)                \
void signame (void) __attribute__((naked)) ;           \
void signame (void) { __asm__ __volatile__ ("reti" ::); }
#endif

and obvious usage:
EMPTY_INTERRUPT(SIG_ADC);


What about adding this to the avr-libc?

Regards,
--
Artur Lipowski





reply via email to

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