RTEMS
Macros | Typedefs | Functions
cpustdatomic.h File Reference

Atomic Operations CPU API. More...

#include <rtems/score/basedefs.h>
#include <stdatomic.h>

Go to the source code of this file.

Macros

#define _RTEMS_SCORE_CPUSTDATOMIC_USE_STDATOMIC
 
#define CPU_ATOMIC_ORDER_RELAXED   memory_order_relaxed
 
#define CPU_ATOMIC_ORDER_ACQUIRE   memory_order_acquire
 
#define CPU_ATOMIC_ORDER_RELEASE   memory_order_release
 
#define CPU_ATOMIC_ORDER_ACQ_REL   memory_order_acq_rel
 
#define CPU_ATOMIC_ORDER_SEQ_CST   memory_order_seq_cst
 
#define CPU_ATOMIC_INITIALIZER_UINT(value)   ATOMIC_VAR_INIT( value )
 
#define CPU_ATOMIC_INITIALIZER_ULONG(value)   ATOMIC_VAR_INIT( value )
 
#define CPU_ATOMIC_INITIALIZER_UINTPTR(value)   ATOMIC_VAR_INIT( value )
 
#define CPU_ATOMIC_INITIALIZER_FLAG   ATOMIC_FLAG_INIT
 

Typedefs

typedef atomic_uint CPU_atomic_Uint
 
typedef atomic_ulong CPU_atomic_Ulong
 
typedef atomic_uintptr_t CPU_atomic_Uintptr
 
typedef atomic_flag CPU_atomic_Flag
 
typedef memory_order CPU_atomic_Order
 

Functions

static void _CPU_atomic_Fence (CPU_atomic_Order order)
 Sets up a cpu fence. More...
 
static void _CPU_atomic_Init_uint (CPU_atomic_Uint *obj, unsigned int desired)
 Initializes Uint. More...
 
static void _CPU_atomic_Init_ulong (CPU_atomic_Ulong *obj, unsigned long desired)
 Initializes Ulong. More...
 
static void _CPU_atomic_Init_uintptr (CPU_atomic_Uintptr *obj, uintptr_t desired)
 Initializes Uintptr. More...
 
static unsigned int _CPU_atomic_Load_uint (const CPU_atomic_Uint *obj, CPU_atomic_Order order)
 Loads value of Uint considering the order. More...
 
static unsigned long _CPU_atomic_Load_ulong (const CPU_atomic_Ulong *obj, CPU_atomic_Order order)
 Loads value of Ulong considering the order. More...
 
static uintptr_t _CPU_atomic_Load_uintptr (const CPU_atomic_Uintptr *obj, CPU_atomic_Order order)
 Loads value of Uintptr considering the order. More...
 
static void _CPU_atomic_Store_uint (CPU_atomic_Uint *obj, unsigned int desired, CPU_atomic_Order order)
 Stores a value to Uint considering the order. More...
 
static void _CPU_atomic_Store_ulong (CPU_atomic_Ulong *obj, unsigned long desired, CPU_atomic_Order order)
 Stores a value to Ulong considering the order. More...
 
static void _CPU_atomic_Store_uintptr (CPU_atomic_Uintptr *obj, uintptr_t desired, CPU_atomic_Order order)
 Stores a value to Uintptr considering the order. More...
 
static unsigned int _CPU_atomic_Fetch_add_uint (CPU_atomic_Uint *obj, unsigned int arg, CPU_atomic_Order order)
 Fetches current value of Uint and adds a value to the stored value. More...
 
static unsigned long _CPU_atomic_Fetch_add_ulong (CPU_atomic_Ulong *obj, unsigned long arg, CPU_atomic_Order order)
 Fetches current value of Ulong and adds a value to the stored value. More...
 
static uintptr_t _CPU_atomic_Fetch_add_uintptr (CPU_atomic_Uintptr *obj, uintptr_t arg, CPU_atomic_Order order)
 Fetches current value of Uintptr and adds a value to the stored value. More...
 
static unsigned int _CPU_atomic_Fetch_sub_uint (CPU_atomic_Uint *obj, unsigned int arg, CPU_atomic_Order order)
 Fetches current value of Uint and subtracts a value from the stored value. More...
 
static unsigned long _CPU_atomic_Fetch_sub_ulong (CPU_atomic_Ulong *obj, unsigned long arg, CPU_atomic_Order order)
 Fetches current value of Ulong and subtracts a value from the stored value. More...
 
static uintptr_t _CPU_atomic_Fetch_sub_uintptr (CPU_atomic_Uintptr *obj, uintptr_t arg, CPU_atomic_Order order)
 Fetches current value of Uintptr and subtracts a value from the stored value. More...
 
static unsigned int _CPU_atomic_Fetch_or_uint (CPU_atomic_Uint *obj, unsigned int arg, CPU_atomic_Order order)
 Fetches current value of Uint and ORs a value with the stored value. More...
 
static unsigned long _CPU_atomic_Fetch_or_ulong (CPU_atomic_Ulong *obj, unsigned long arg, CPU_atomic_Order order)
 Fetches current value of Ulong and ORs a value with the stored value. More...
 
static uintptr_t _CPU_atomic_Fetch_or_uintptr (CPU_atomic_Uintptr *obj, uintptr_t arg, CPU_atomic_Order order)
 Fetches current value of Uintptr and ORs a value with the stored value. More...
 
static unsigned int _CPU_atomic_Fetch_and_uint (CPU_atomic_Uint *obj, unsigned int arg, CPU_atomic_Order order)
 Fetches current value of Uint and ANDs a value with the stored value. More...
 
static unsigned long _CPU_atomic_Fetch_and_ulong (CPU_atomic_Ulong *obj, unsigned long arg, CPU_atomic_Order order)
 Fetches current value of Ulong and ANDs a value with the stored value. More...
 
static uintptr_t _CPU_atomic_Fetch_and_uintptr (CPU_atomic_Uintptr *obj, uintptr_t arg, CPU_atomic_Order order)
 Fetches current value of Uintptr and ANDs a value with the stored value. More...
 
static unsigned int _CPU_atomic_Exchange_uint (CPU_atomic_Uint *obj, unsigned int desired, CPU_atomic_Order order)
 Fetches current value of Uint and sets its value. More...
 
static unsigned long _CPU_atomic_Exchange_ulong (CPU_atomic_Ulong *obj, unsigned long desired, CPU_atomic_Order order)
 Fetches current value of Ulong and sets its value. More...
 
static uintptr_t _CPU_atomic_Exchange_uintptr (CPU_atomic_Uintptr *obj, uintptr_t desired, CPU_atomic_Order order)
 Fetches current value of Uintptr and sets its value. More...
 
static bool _CPU_atomic_Compare_exchange_uint (CPU_atomic_Uint *obj, unsigned int *expected, unsigned int desired, CPU_atomic_Order succ, CPU_atomic_Order fail)
 Checks if value of Uint is as expected. More...
 
static bool _CPU_atomic_Compare_exchange_ulong (CPU_atomic_Ulong *obj, unsigned long *expected, unsigned long desired, CPU_atomic_Order succ, CPU_atomic_Order fail)
 Checks if value of Ulong is as expected. More...
 
static bool _CPU_atomic_Compare_exchange_uintptr (CPU_atomic_Uintptr *obj, uintptr_t *expected, uintptr_t desired, CPU_atomic_Order succ, CPU_atomic_Order fail)
 Checks if value of Uintptr is as expected. More...
 
static void _CPU_atomic_Flag_clear (CPU_atomic_Flag *obj, CPU_atomic_Order order)
 Clears the atomic flag. More...
 
static bool _CPU_atomic_Flag_test_and_set (CPU_atomic_Flag *obj, CPU_atomic_Order order)
 Returns current flag state and sets it. More...
 

Detailed Description

Atomic Operations CPU API.

Definition in file cpustdatomic.h.