Add CLI_SEI_BUG_MEMORY_BARRIER() macro that inserts a memory barrier for older versions of avr-libc that do not include a memory barrier as part of the definition of SEI() and CLI().

This commit is contained in:
Jim McGee 2011-05-08 21:49:44 -07:00 committed by Michael Moon
parent 4420652549
commit b6b5ced7be
1 changed files with 14 additions and 1 deletions

View File

@ -15,4 +15,17 @@
#define MEMORY_BARRIER() __asm volatile( "" ::: "memory" )
#endif
// There is a bug in the CLI/SEI functions in older versions of
// avr-libc - they should be defined to include a memory barrier.
// This macro is used to define the barrier in the code so that
// it will be easy to remove once the bug has become ancient history.
// At the moment the bug is included in most of the distributed
// compilers.
#if __AVR_LIBC_VERSION__ < 10700UL
#define CLI_SEI_BUG_MEMORY_BARRIER() MEMORY_BARRIER()
#else
#define CLI_SEI_BUG_MEMORY_BARRIER()
#endif
#endif