50 #error "include FreeRTOS.h must appear in source files before include atomic.h"
70#if ( portHAS_NESTED_INTERRUPTS == 1 )
73 #define ATOMIC_ENTER_CRITICAL() \
74 UBaseType_t uxCriticalSectionType = portSET_INTERRUPT_MASK_FROM_ISR()
76 #define ATOMIC_EXIT_CRITICAL() \
77 portCLEAR_INTERRUPT_MASK_FROM_ISR( uxCriticalSectionType )
82 #define ATOMIC_ENTER_CRITICAL() portENTER_CRITICAL()
83 #define ATOMIC_EXIT_CRITICAL() portEXIT_CRITICAL()
94#ifndef portFORCE_INLINE
95 #define portFORCE_INLINE
98#define ATOMIC_COMPARE_AND_SWAP_SUCCESS 0x1U
99#define ATOMIC_COMPARE_AND_SWAP_FAILURE 0x0U
120 uint32_t ulComparand )
122 uint32_t ulReturnValue;
126 if( *pulDestination == ulComparand )
128 *pulDestination = ulExchange;
138 return ulReturnValue;
161 pReturnValue = *ppvDestination;
162 *ppvDestination = pvExchange;
194 if( *ppvDestination == pvComparand )
196 *ppvDestination = pvExchange;
202 return ulReturnValue;
226 ulCurrent = *pulAddend;
227 *pulAddend += ulCount;
254 ulCurrent = *pulAddend;
255 *pulAddend -= ulCount;
279 ulCurrent = *pulAddend;
304 ulCurrent = *pulAddend;
332 ulCurrent = *pulDestination;
333 *pulDestination |= ulValue;
359 ulCurrent = *pulDestination;
360 *pulDestination &= ulValue;
386 ulCurrent = *pulDestination;
387 *pulDestination = ~( ulCurrent & ulValue );
413 ulCurrent = *pulDestination;
414 *pulDestination ^= ulValue;
static portFORCE_INLINE uint32_t Atomic_XOR_u32(uint32_t volatile *pulDestination, uint32_t ulValue)
Performs an atomic XOR operation on the specified values.
Definition atomic.h:406
static portFORCE_INLINE uint32_t Atomic_CompareAndSwapPointers_p32(void *volatile *ppvDestination, void *pvExchange, void *pvComparand)
Performs an atomic compare-and-swap operation on the specified pointer values.
Definition atomic.h:186
static portFORCE_INLINE uint32_t Atomic_Add_u32(uint32_t volatile *pulAddend, uint32_t ulCount)
Atomically adds count to the value of the specified pointer points to.
Definition atomic.h:219
#define ATOMIC_ENTER_CRITICAL()
Definition atomic.h:82
#define ATOMIC_EXIT_CRITICAL()
Definition atomic.h:83
#define ATOMIC_COMPARE_AND_SWAP_SUCCESS
Definition atomic.h:98
static portFORCE_INLINE uint32_t Atomic_Decrement_u32(uint32_t volatile *pulAddend)
Atomically decrements the value of the specified pointer points to.
Definition atomic.h:298
static portFORCE_INLINE uint32_t Atomic_Increment_u32(uint32_t volatile *pulAddend)
Atomically increments the value of the specified pointer points to.
Definition atomic.h:273
static portFORCE_INLINE void * Atomic_SwapPointers_p32(void *volatile *ppvDestination, void *pvExchange)
Atomically sets the address pointed to by *ppvDestination to the value of *pvExchange.
Definition atomic.h:154
static portFORCE_INLINE uint32_t Atomic_NAND_u32(uint32_t volatile *pulDestination, uint32_t ulValue)
Performs an atomic NAND operation on the specified values.
Definition atomic.h:379
static portFORCE_INLINE uint32_t Atomic_AND_u32(uint32_t volatile *pulDestination, uint32_t ulValue)
Performs an atomic AND operation on the specified values.
Definition atomic.h:352
#define portFORCE_INLINE
Definition atomic.h:95
#define ATOMIC_COMPARE_AND_SWAP_FAILURE
Definition atomic.h:99
static portFORCE_INLINE uint32_t Atomic_Subtract_u32(uint32_t volatile *pulAddend, uint32_t ulCount)
Atomically subtracts count from the value of the specified pointer pointers to.
Definition atomic.h:247
static portFORCE_INLINE uint32_t Atomic_CompareAndSwap_u32(uint32_t volatile *pulDestination, uint32_t ulExchange, uint32_t ulComparand)
Performs an atomic compare-and-swap operation on the specified values.
Definition atomic.h:118
static portFORCE_INLINE uint32_t Atomic_OR_u32(uint32_t volatile *pulDestination, uint32_t ulValue)
Performs an atomic OR operation on the specified values.
Definition atomic.h:325