35#ifndef _AVR_INTERRUPT_H_
36#define _AVR_INTERRUPT_H_
40#if !defined(__DOXYGEN__) && !defined(__STRINGIFY)
42#define __STRINGIFY(x) #x
76# define sei() __asm__ __volatile__ ("sei" ::: "memory")
90# define cli() __asm__ __volatile__ ("cli" ::: "memory")
96#if defined(__DOXYGEN__)
115# define ISR(vector, [attributes])
118#if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
119# define __INTR_ATTRS __used__, __externally_visible__
121# define __INTR_ATTRS __used__
125# define ISR(vector, ...) \
126 extern "C" void vector (void) __attribute__ ((__signal__,__INTR_ATTRS)) __VA_ARGS__; \
129# define ISR(vector, ...) \
130 void vector (void) __attribute__ ((__signal__,__INTR_ATTRS)) __VA_ARGS__; \
136#if defined(__DOXYGEN__)
146# define SIGNAL(vector)
150# define SIGNAL(vector) \
151 extern "C" void vector(void) __attribute__ ((__signal__, __INTR_ATTRS)); \
154# define SIGNAL(vector) \
155 void vector (void) __attribute__ ((__signal__, __INTR_ATTRS)); \
161#if defined(__DOXYGEN__)
170# define EMPTY_INTERRUPT(vector)
174# define EMPTY_INTERRUPT(vector) \
175 extern "C" void vector(void) __attribute__ ((__signal__,__naked__,__INTR_ATTRS)); \
176 void vector (void) { __asm__ __volatile__ ("reti" ::: "memory"); }
178# define EMPTY_INTERRUPT(vector) \
179 void vector (void) __attribute__ ((__signal__,__naked__,__INTR_ATTRS)); \
180 void vector (void) { __asm__ __volatile__ ("reti" ::: "memory"); }
185#if defined(__DOXYGEN__)
214# define ISR_ALIAS(vector, target_vector)
218# define ISR_ALIAS(vector, tgt) extern "C" void vector (void) \
219 __attribute__((__signal__, __naked__, __INTR_ATTRS)); \
220 void vector (void) { __asm__ __volatile__ ("%~jmp " __STRINGIFY(tgt) ::); }
222# define ISR_ALIAS(vector, tgt) void vector (void) \
223 __attribute__((__signal__, __naked__, __INTR_ATTRS)); \
224 void vector (void) { __asm__ __volatile__ ("%~jmp " __STRINGIFY(tgt) ::); }
242# define reti() __asm__ __volatile__ ("reti" ::: "memory")
244#if defined(__DOXYGEN__)
257# define BADISR_vect __vector_default
262#if defined(__DOXYGEN__)
357# define ISR_ALIASOF(target_vector)
362# define ISR_NOBLOCK __attribute__((__interrupt__))
363# define ISR_NAKED __attribute__((__naked__))
365#if (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || (__GNUC__ >= 5)
366# define ISR_FLATTEN __attribute__((__flatten__))
371#if defined (__has_attribute)
372#if __has_attribute (__no_icf__)
373# define ISR_NOICF __attribute__((__no_icf__))
378#if __has_attribute (__no_gccisr__)
379# define ISR_NOGCCISR __attribute__((__no_gccisr__))
385# define ISR_ALIASOF(v) __attribute__((__alias__(__STRINGIFY(v))))