5#ifndef ZEPHYR_INCLUDE_ATOMIC_XTENSA_H_
6#define ZEPHYR_INCLUDE_ATOMIC_XTENSA_H_
26 __asm__
volatile(
"l32ai %0, %1, 0"
35 __asm__
volatile(
"wsr %1, SCOMPARE1; s32c1i %0, %2, 0"
36 :
"+r"(newval),
"+r"(oldval) :
"r"(addr) :
"memory");
61#define Z__GEN_ATOMXCHG(expr) ({ \
62 atomic_val_t res, cur; \
65 res = xtensa_cas(target, cur, (expr)); \
66 } while (res != cur); \
72 return Z__GEN_ATOMXCHG(value);
78 return Z__GEN_ATOMXCHG(
cur + value);
84 return Z__GEN_ATOMXCHG(
cur - value);
90 return Z__GEN_ATOMXCHG(
cur + 1);
96 return Z__GEN_ATOMXCHG(
cur - 1);
102 return Z__GEN_ATOMXCHG(
cur | value);
108 return Z__GEN_ATOMXCHG(
cur ^ value);
114 return Z__GEN_ATOMXCHG(
cur & value);
120 return Z__GEN_ATOMXCHG(~(
cur & value));
atomic_t atomic_val_t
Definition: atomic.h:22
void * atomic_ptr_t
Definition: atomic.h:23
int atomic_t
Definition: atomic.h:21
static ALWAYS_INLINE void * atomic_ptr_set(atomic_ptr_t *target, void *value)
Definition: atomic_xtensa.h:128
static ALWAYS_INLINE atomic_val_t atomic_inc(atomic_t *target)
Definition: atomic_xtensa.h:88
static ALWAYS_INLINE atomic_val_t atomic_and(atomic_t *target, atomic_val_t value)
Definition: atomic_xtensa.h:111
static ALWAYS_INLINE atomic_val_t xtensa_cas(atomic_t *addr, atomic_val_t oldval, atomic_val_t newval)
Definition: atomic_xtensa.h:32
static ALWAYS_INLINE atomic_val_t atomic_sub(atomic_t *target, atomic_val_t value)
Definition: atomic_xtensa.h:82
static ALWAYS_INLINE atomic_val_t atomic_set(atomic_t *target, atomic_val_t value)
Definition: atomic_xtensa.h:70
static ALWAYS_INLINE void * atomic_ptr_get(const atomic_ptr_t *target)
Definition: atomic_xtensa.h:123
static ALWAYS_INLINE bool atomic_cas(atomic_t *target, atomic_val_t oldval, atomic_val_t newval)
Definition: atomic_xtensa.h:42
static ALWAYS_INLINE atomic_val_t atomic_get(const atomic_t *target)
Definition: atomic_xtensa.h:16
static ALWAYS_INLINE atomic_val_t atomic_add(atomic_t *target, atomic_val_t value)
Definition: atomic_xtensa.h:76
static ALWAYS_INLINE atomic_val_t atomic_clear(atomic_t *target)
Definition: atomic_xtensa.h:133
static ALWAYS_INLINE atomic_val_t atomic_xor(atomic_t *target, atomic_val_t value)
Definition: atomic_xtensa.h:105
static ALWAYS_INLINE atomic_val_t atomic_nand(atomic_t *target, atomic_val_t value)
Definition: atomic_xtensa.h:117
static ALWAYS_INLINE bool atomic_ptr_cas(atomic_ptr_t *target, void *oldval, void *newval)
Definition: atomic_xtensa.h:48
static ALWAYS_INLINE atomic_val_t atomic_or(atomic_t *target, atomic_val_t value)
Definition: atomic_xtensa.h:99
static ALWAYS_INLINE atomic_val_t atomic_dec(atomic_t *target)
Definition: atomic_xtensa.h:94
static ALWAYS_INLINE void * atomic_ptr_clear(atomic_ptr_t *target)
Definition: atomic_xtensa.h:138
#define ALWAYS_INLINE
Definition: common.h:116
static ZTEST_BMEM volatile int ret
Definition: k_float_disable.c:28
int target
Definition: main.c:68
static int cur
Definition: timeout_order.c:16