libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
|
Atomic operation support. More...
Macros | |
#define | __CM_SAVER(state) |
#define | CM_ATOMIC_BLOCK() for (uint32_t __CM_SAVER(true), __my = true; __my; __my = false) |
Cortex M Atomic Declare block. More... | |
#define | CM_ATOMIC_CONTEXT() uint32_t __CM_SAVER(true) |
Cortex M Atomic Declare context. More... | |
Functions | |
static uint32_t | __cm_atomic_set (uint32_t *val) |
Atomic operation support.
#define __CM_SAVER | ( | state | ) |
#define CM_ATOMIC_BLOCK | ( | ) | for (uint32_t __CM_SAVER(true), __my = true; __my; __my = false) |
Cortex M Atomic Declare block.
This macro disables interrupts for the next command or block of code. The interrupt mask is automatically restored after exit of the boundary of the code block. Therefore restore of interrupt is done automatically after call of return or goto control sentence jumping outside of the block.
Basic usage of atomic block
Use of return inside block
#define CM_ATOMIC_CONTEXT | ( | ) | uint32_t __CM_SAVER(true) |
Cortex M Atomic Declare context.
This macro disables interrupts in the current block of code from the place where it is defined to the end of the block. The interrupt mask is automatically restored after exit of the boundary of the code block. Therefore restore of interrupt is done automatically after call of return, continue, break, or goto control sentence jumping outside of the block.
Basic usage of atomic context
Usage of atomic context inside atomic reader fcn.
|
inlinestatic |
Definition at line 166 of file cortex.h.
References cm_mask_interrupts().