X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=cpu.h;h=562d8619aa3800134c56cbfb4249a39ebb51ad7e;hb=018b68ae17c81e82f8a1991f518c08107657bc9b;hp=4b762449c9adc67a295d5fcb8aef9b03f0aff382;hpb=6cbc8596a105e183d9f805a6deb4fae224e9baac;p=bertos.git diff --git a/cpu.h b/cpu.h index 4b762449..562d8619 100755 --- a/cpu.h +++ b/cpu.h @@ -17,6 +17,9 @@ /*#* *#* $Log$ + *#* Revision 1.17 2004/09/06 21:48:27 bernie + *#* ATOMIC(): New macro. + *#* *#* Revision 1.16 2004/08/29 21:58:33 bernie *#* Rename BITS_PER_XYZ macros; Add sanity checks. *#* @@ -154,6 +157,19 @@ #endif +/*! + * Execute \a CODE atomically with respect to interrupts. + * + * \see ENABLE_IRQSAVE DISABLE_IRQRESTORE + */ +#define ATOMIC(CODE) \ + do { \ + cpuflags_t __flags; \ + DISABLE_IRQSAVE(__flags); \ + CODE; \ + ENABLE_IRQRESTORE(__flags); \ + } while (0) + //! Default for macro not defined in the right arch section #ifndef CPU_REG_INIT_VALUE