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