42 #error "include FreeRTOS.h must appear in source files before include atomic.h"
62#if defined( portSET_INTERRUPT_MASK_FROM_ISR )
65 #define ATOMIC_ENTER_CRITICAL() \
66 UBaseType_t uxCriticalSectionType = portSET_INTERRUPT_MASK_FROM_ISR()
68 #define ATOMIC_EXIT_CRITICAL() \
69 portCLEAR_INTERRUPT_MASK_FROM_ISR( uxCriticalSectionType )
74 #define ATOMIC_ENTER_CRITICAL() portENTER_CRITICAL()
75 #define ATOMIC_EXIT_CRITICAL() portEXIT_CRITICAL()
86#ifndef portFORCE_INLINE
87 #define portFORCE_INLINE
90#define ATOMIC_COMPARE_AND_SWAP_SUCCESS 0x1U
91#define ATOMIC_COMPARE_AND_SWAP_FAILURE 0x0U
112 uint32_t ulComparand )
114 uint32_t ulReturnValue;
118 if( *pulDestination == ulComparand )
120 *pulDestination = ulExchange;
130 return ulReturnValue;
153 pReturnValue = *ppvDestination;
154 *ppvDestination = pvExchange;
186 if( *ppvDestination == pvComparand )
188 *ppvDestination = pvExchange;
194 return ulReturnValue;
218 ulCurrent = *pulAddend;
219 *pulAddend += ulCount;
246 ulCurrent = *pulAddend;
247 *pulAddend -= ulCount;
271 ulCurrent = *pulAddend;
296 ulCurrent = *pulAddend;
324 ulCurrent = *pulDestination;
325 *pulDestination |= ulValue;
351 ulCurrent = *pulDestination;
352 *pulDestination &= ulValue;
378 ulCurrent = *pulDestination;
379 *pulDestination = ~( ulCurrent & ulValue );
405 ulCurrent = *pulDestination;
406 *pulDestination ^= ulValue;
static portFORCE_INLINE uint32_t Atomic_XOR_u32(uint32_t volatile *pulDestination, uint32_t ulValue)
Atomic XOR.
static portFORCE_INLINE uint32_t Atomic_CompareAndSwapPointers_p32(void *volatile *ppvDestination, void *pvExchange, void *pvComparand)
Atomic compare-and-swap (pointers).
static portFORCE_INLINE uint32_t Atomic_Add_u32(uint32_t volatile *pulAddend, uint32_t ulCount)
Atomic add.
#define ATOMIC_ENTER_CRITICAL()
#define ATOMIC_EXIT_CRITICAL()
#define ATOMIC_COMPARE_AND_SWAP_SUCCESS
Compare and swap succeeded, swapped.
static portFORCE_INLINE uint32_t Atomic_Decrement_u32(uint32_t volatile *pulAddend)
Atomic decrement.
static portFORCE_INLINE uint32_t Atomic_Increment_u32(uint32_t volatile *pulAddend)
Atomic increment.
static portFORCE_INLINE void * Atomic_SwapPointers_p32(void *volatile *ppvDestination, void *pvExchange)
Atomic swap (pointers).
static portFORCE_INLINE uint32_t Atomic_NAND_u32(uint32_t volatile *pulDestination, uint32_t ulValue)
Atomic NAND.
static portFORCE_INLINE uint32_t Atomic_AND_u32(uint32_t volatile *pulDestination, uint32_t ulValue)
Atomic AND.
#define ATOMIC_COMPARE_AND_SWAP_FAILURE
Compare and swap failed, did not swap.
static portFORCE_INLINE uint32_t Atomic_Subtract_u32(uint32_t volatile *pulAddend, uint32_t ulCount)
Atomic subtract.
static portFORCE_INLINE uint32_t Atomic_CompareAndSwap_u32(uint32_t volatile *pulDestination, uint32_t ulExchange, uint32_t ulComparand)
Atomic compare-and-swap.
static portFORCE_INLINE uint32_t Atomic_OR_u32(uint32_t volatile *pulDestination, uint32_t ulValue)
Atomic OR.