1 /* 2 * Copyright (c) 2021 Demant A/S 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #ifndef ZEPHYR_INCLUDE_SYS_ATOMIC_ARCH_H_ 8 #define ZEPHYR_INCLUDE_SYS_ATOMIC_ARCH_H_ 9 10 /* Included from <atomic.h> */ 11 12 /* Arch specific atomic primitives */ 13 14 extern bool atomic_cas(atomic_t *target, atomic_val_t old_value, 15 atomic_val_t new_value); 16 17 extern bool atomic_ptr_cas(atomic_ptr_t *target, void *old_value, 18 void *new_value); 19 20 extern atomic_val_t atomic_add(atomic_t *target, atomic_val_t value); 21 22 extern atomic_val_t atomic_sub(atomic_t *target, atomic_val_t value); 23 24 extern atomic_val_t atomic_inc(atomic_t *target); 25 26 extern atomic_val_t atomic_dec(atomic_t *target); 27 28 extern atomic_val_t atomic_get(const atomic_t *target); 29 30 extern void *atomic_ptr_get(const atomic_ptr_t *target); 31 32 extern atomic_val_t atomic_set(atomic_t *target, atomic_val_t value); 33 34 extern void *atomic_ptr_set(atomic_ptr_t *target, void *value); 35 36 extern atomic_val_t atomic_clear(atomic_t *target); 37 38 extern void *atomic_ptr_clear(atomic_ptr_t *target); 39 40 extern atomic_val_t atomic_or(atomic_t *target, atomic_val_t value); 41 42 extern atomic_val_t atomic_xor(atomic_t *target, atomic_val_t value); 43 44 extern atomic_val_t atomic_and(atomic_t *target, atomic_val_t value); 45 46 extern atomic_val_t atomic_nand(atomic_t *target, atomic_val_t value); 47 48 49 #endif /* ZEPHYR_INCLUDE_SYS_ATOMIC_ARCH_H_ */ 50