From 75021d741d1a55013d98e8e67748009d87835341 Mon Sep 17 00:00:00 2001 From: bernie Date: Mon, 6 Sep 2004 21:48:27 +0000 Subject: [PATCH] ATOMIC(): New macro. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@188 38d2e660-2303-0410-9eaa-f027e97ec537 --- cpu.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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 -- 2.25.1