atomic_arch.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * Copyright (c) 2021 Demant A/S
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. #ifndef ZEPHYR_INCLUDE_SYS_ATOMIC_ARCH_H_
  7. #define ZEPHYR_INCLUDE_SYS_ATOMIC_ARCH_H_
  8. /* Included from <atomic.h> */
  9. /* Arch specific atomic primitives */
  10. extern bool atomic_cas(atomic_t *target, atomic_val_t old_value,
  11. atomic_val_t new_value);
  12. extern bool atomic_ptr_cas(atomic_ptr_t *target, void *old_value,
  13. void *new_value);
  14. extern atomic_val_t atomic_add(atomic_t *target, atomic_val_t value);
  15. extern atomic_val_t atomic_sub(atomic_t *target, atomic_val_t value);
  16. extern atomic_val_t atomic_inc(atomic_t *target);
  17. extern atomic_val_t atomic_dec(atomic_t *target);
  18. extern atomic_val_t atomic_get(const atomic_t *target);
  19. extern void *atomic_ptr_get(const atomic_ptr_t *target);
  20. extern atomic_val_t atomic_set(atomic_t *target, atomic_val_t value);
  21. extern void *atomic_ptr_set(atomic_ptr_t *target, void *value);
  22. extern atomic_val_t atomic_clear(atomic_t *target);
  23. extern void *atomic_ptr_clear(atomic_ptr_t *target);
  24. extern atomic_val_t atomic_or(atomic_t *target, atomic_val_t value);
  25. extern atomic_val_t atomic_xor(atomic_t *target, atomic_val_t value);
  26. extern atomic_val_t atomic_and(atomic_t *target, atomic_val_t value);
  27. extern atomic_val_t atomic_nand(atomic_t *target, atomic_val_t value);
  28. #endif /* ZEPHYR_INCLUDE_SYS_ATOMIC_ARCH_H_ */