diff options
author | Georg-Johann Lay <avr@gjlay.de> | 2024-07-30 09:16:02 +0200 |
---|---|---|
committer | Georg-Johann Lay <avr@gjlay.de> | 2024-07-30 09:19:15 +0200 |
commit | 922083693136be9516b9f916fd00005139f419f8 (patch) | |
tree | 3b68d9133bdc7ecae72c79d9e472b9dfe864053f /gcc | |
parent | 85cff6e46d212240f9c15c2d7d614b6089be772a (diff) | |
download | gcc-922083693136be9516b9f916fd00005139f419f8.zip gcc-922083693136be9516b9f916fd00005139f419f8.tar.gz gcc-922083693136be9516b9f916fd00005139f419f8.tar.bz2 |
AVR: Propose to use attribute signal(n) via AVR-LibC's ISR_N.
gcc/
* doc/extend.texi (AVR Function Attributes): Propose to use
attribute signal(n) via AVR-LibC's ISR_N from avr/interrupt.h
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/doc/extend.texi | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 927aa24..48b27ff 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -5147,22 +5147,38 @@ the attribute, rather than providing the ISR name itself as the function name: @example __attribute__((signal(1))) -void my_handler (void) +static void my_handler (void) @{ // Code for __vector_1 @} +@end example -#include <avr/io.h> +Notice that the handler function needs not to be externally visible. +The recommended way to use these attributes is by means of the +@code{ISR_N} macro provided by @code{avr/interrupt.h} from +@w{@uref{https://www.nongnu.org/avr-libc/user-manual/group__avr__interrupts.html,,AVR-LibC}}: + +@example +#include <avr/interrupt.h> -__attribute__((__signal__(PCINT0_vect_num, PCINT1_vect_num))) -static void my_pcint0_1_handler (void) +ISR_N (PCINT0_vect_num) +static void my_pcint0_handler (void) @{ - // Code for PCINT0 and PCINT1 (__vector_3 and __vector_4 - // on ATmega328). + // Code +@} + +ISR_N (ADC_vect_num, ISR_NOBLOCK) +static void my_adc_handler (void) +@{ + // Code @} @end example -Notice that the handler function needs not to be externally visible. +@code{ISR_N} can be specified more than once, in which case several +interrupt vectors are pointing to the same handler function. This +is similar to the @code{ISR_ALIASOF} macro provided by AVR-LibC, but +without the overhead introduced by @code{ISR_ALIASOF}. + @cindex @code{noblock} function attribute, AVR @item noblock |