Zephyr API Documentation
3.7.0
A Scalable Open Source RTOS
|
#include <stdbool.h>
#include <zephyr/toolchain.h>
#include <stddef.h>
#include <zephyr/sys/atomic_types.h>
#include <zephyr/types.h>
#include <zephyr/sys/util.h>
#include <zephyr/sys/atomic_builtin.h>
Go to the source code of this file.
Macros | |
#define | ATOMIC_INIT(i) (i) |
Initialize an atomic variable. | |
#define | ATOMIC_PTR_INIT(p) (p) |
Initialize an atomic pointer variable. | |
#define | ATOMIC_BITMAP_SIZE(num_bits) (ROUND_UP(num_bits, ATOMIC_BITS) / ATOMIC_BITS) |
This macro computes the number of atomic variables necessary to represent a bitmap with num_bits. | |
#define | ATOMIC_DEFINE(name, num_bits) atomic_t name[ATOMIC_BITMAP_SIZE(num_bits)] |
Define an array of atomic variables. | |
Functions | |
static bool | atomic_test_bit (const atomic_t *target, int bit) |
Atomically test a bit. | |
static bool | atomic_test_and_clear_bit (atomic_t *target, int bit) |
Atomically test and clear a bit. | |
static bool | atomic_test_and_set_bit (atomic_t *target, int bit) |
Atomically set a bit. | |
static void | atomic_clear_bit (atomic_t *target, int bit) |
Atomically clear a bit. | |
static void | atomic_set_bit (atomic_t *target, int bit) |
Atomically set a bit. | |
static void | atomic_set_bit_to (atomic_t *target, int bit, bool val) |
Atomically set a bit to a given value. | |
bool | atomic_cas (atomic_t *target, atomic_val_t old_value, atomic_val_t new_value) |
Atomic compare-and-set. | |
bool | atomic_ptr_cas (atomic_ptr_t *target, atomic_ptr_val_t old_value, atomic_ptr_val_t new_value) |
Atomic compare-and-set with pointer values. | |
atomic_val_t | atomic_add (atomic_t *target, atomic_val_t value) |
Atomic addition. | |
atomic_val_t | atomic_sub (atomic_t *target, atomic_val_t value) |
Atomic subtraction. | |
atomic_val_t | atomic_inc (atomic_t *target) |
Atomic increment. | |
atomic_val_t | atomic_dec (atomic_t *target) |
Atomic decrement. | |
atomic_val_t | atomic_get (const atomic_t *target) |
Atomic get. | |
atomic_ptr_val_t | atomic_ptr_get (const atomic_ptr_t *target) |
Atomic get a pointer value. | |
atomic_val_t | atomic_set (atomic_t *target, atomic_val_t value) |
Atomic get-and-set. | |
atomic_ptr_val_t | atomic_ptr_set (atomic_ptr_t *target, atomic_ptr_val_t value) |
Atomic get-and-set for pointer values. | |
atomic_val_t | atomic_clear (atomic_t *target) |
Atomic clear. | |
atomic_ptr_val_t | atomic_ptr_clear (atomic_ptr_t *target) |
Atomic clear of a pointer value. | |
atomic_val_t | atomic_or (atomic_t *target, atomic_val_t value) |
Atomic bitwise inclusive OR. | |
atomic_val_t | atomic_xor (atomic_t *target, atomic_val_t value) |
Atomic bitwise exclusive OR (XOR). | |
atomic_val_t | atomic_and (atomic_t *target, atomic_val_t value) |
Atomic bitwise AND. | |
atomic_val_t | atomic_nand (atomic_t *target, atomic_val_t value) |
Atomic bitwise NAND. | |