API of the utility functions for atomic accesses. More...
API of the utility functions for atomic accesses.
Definition in file atomic_utils.h.
#include <stdint.h>
#include "irq.h"
#include "macros/utils.h"
#include "sched.h"
#include "atomic_utils_arch.h"
Go to the source code of this file.
Data Structures | |
struct | atomic_bit_u8_t |
Type specifying a bit in an uint8_t More... | |
struct | atomic_bit_u16_t |
Type specifying a bit in an uint16_t More... | |
struct | atomic_bit_u32_t |
Type specifying a bit in an uint32_t More... | |
struct | atomic_bit_u64_t |
Type specifying a bit in an uint64_t More... | |
Macros | |
#define | ATOMIC_LOAD_IMPL(name, type) |
Generates a static inline function implementing atomic_load_u<width>() | |
#define | ATOMIC_STORE_IMPL(name, type) |
Generates a static inline function implementing atomic_store_u<width>() | |
#define | ATOMIC_FETCH_OP_IMPL(opname, op, name, type) |
Generates a static inline function implementing atomic_fecth_<op>_u<width>() | |
Atomic Loads | |
static uint8_t | atomic_load_u8 (const volatile uint8_t *var) |
Load an uint8_t atomically. | |
static uint16_t | atomic_load_u16 (const volatile uint16_t *var) |
Load an uint16_t atomically. | |
static uint32_t | atomic_load_u32 (const volatile uint32_t *var) |
Load an uint32_t atomically. | |
static uint64_t | atomic_load_u64 (const volatile uint64_t *var) |
Load an uint64_t atomically. | |
static uintptr_t | atomic_load_uintptr (const volatile uintptr_t *var) |
Load an uintptr_t atomically. | |
static void * | atomic_load_ptr (void **ptr_addr) |
Load an void * atomically. | |
static kernel_pid_t | atomic_load_kernel_pid (const volatile kernel_pid_t *var) |
Load an kernel_pid_t atomically. | |
Atomic Stores | |
static void | atomic_store_u8 (volatile uint8_t *dest, uint8_t val) |
Store an uint8_t atomically. | |
static void | atomic_store_u16 (volatile uint16_t *dest, uint16_t val) |
Store an uint16_t atomically. | |
static void | atomic_store_u32 (volatile uint32_t *dest, uint32_t val) |
Store an uint32_t atomically. | |
static void | atomic_store_u64 (volatile uint64_t *dest, uint64_t val) |
Store an uint64_t atomically. | |
static void | atomic_store_uintptr (volatile uintptr_t *dest, uintptr_t val) |
Store an uintptr_t atomically. | |
static void | atomic_store_ptr (void **dest, const void *val) |
Store an void * atomically. | |
static void | atomic_store_kernel_pid (volatile kernel_pid_t *dest, kernel_pid_t val) |
Store an kernel_pid_t atomically. | |
Atomic In-Place Addition | |
static uint8_t | atomic_fetch_add_u8 (volatile uint8_t *dest, uint8_t summand) |
Atomically add a value onto a given value. | |
static uint16_t | atomic_fetch_add_u16 (volatile uint16_t *dest, uint16_t summand) |
Atomically add a value onto a given value. | |
static uint32_t | atomic_fetch_add_u32 (volatile uint32_t *dest, uint32_t summand) |
Atomically add a value onto a given value. | |
static uint64_t | atomic_fetch_add_u64 (volatile uint64_t *dest, uint64_t summand) |
Atomically add a value onto a given value. | |
Atomic In-Place Subtraction | |
static uint8_t | atomic_fetch_sub_u8 (volatile uint8_t *dest, uint8_t subtrahend) |
Atomically subtract a value from a given value. | |
static uint16_t | atomic_fetch_sub_u16 (volatile uint16_t *dest, uint16_t subtrahend) |
Atomically subtract a value from a given value. | |
static uint32_t | atomic_fetch_sub_u32 (volatile uint32_t *dest, uint32_t subtrahend) |
Atomically subtract a value from a given value. | |
static uint64_t | atomic_fetch_sub_u64 (volatile uint64_t *dest, uint64_t subtrahend) |
Atomically subtract a value from a given value. | |
Atomic In-Place Bitwise OR | |
static uint8_t | atomic_fetch_or_u8 (volatile uint8_t *dest, uint8_t val) |
Atomic version of *dest |= val | |
static uint16_t | atomic_fetch_or_u16 (volatile uint16_t *dest, uint16_t val) |
Atomic version of *dest |= val | |
static uint32_t | atomic_fetch_or_u32 (volatile uint32_t *dest, uint32_t val) |
Atomic version of *dest |= val | |
static uint64_t | atomic_fetch_or_u64 (volatile uint64_t *dest, uint64_t val) |
Atomic version of *dest |= val | |
Atomic In-Place Bitwise XOR | |
static uint8_t | atomic_fetch_xor_u8 (volatile uint8_t *dest, uint8_t val) |
Atomic version of *dest ^= val | |
static uint16_t | atomic_fetch_xor_u16 (volatile uint16_t *dest, uint16_t val) |
Atomic version of *dest ^= val | |
static uint32_t | atomic_fetch_xor_u32 (volatile uint32_t *dest, uint32_t val) |
Atomic version of *dest ^= val | |
static uint64_t | atomic_fetch_xor_u64 (volatile uint64_t *dest, uint64_t val) |
Atomic version of *dest ^= val | |
Atomic In-Place Bitwise AND | |
static uint8_t | atomic_fetch_and_u8 (volatile uint8_t *dest, uint8_t val) |
Atomic version of *dest &= val | |
static uint16_t | atomic_fetch_and_u16 (volatile uint16_t *dest, uint16_t val) |
Atomic version of *dest &= val | |
static uint32_t | atomic_fetch_and_u32 (volatile uint32_t *dest, uint32_t val) |
Atomic version of *dest &= val | |
static uint64_t | atomic_fetch_and_u64 (volatile uint64_t *dest, uint64_t val) |
Atomic version of *dest &= val | |
Helper Functions to Handle Atomic Bit References | |
static atomic_bit_u8_t | atomic_bit_u8 (volatile uint8_t *dest, uint8_t bit) |
Create a reference to a bit in an uint8_t | |
static atomic_bit_u16_t | atomic_bit_u16 (volatile uint16_t *dest, uint8_t bit) |
Create a reference to a bit in an uint16_t | |
static atomic_bit_u32_t | atomic_bit_u32 (volatile uint32_t *dest, uint8_t bit) |
Create a reference to a bit in an uint32_t | |
static atomic_bit_u64_t | atomic_bit_u64 (volatile uint64_t *dest, uint8_t bit) |
Create a reference to a bit in an uint64_t | |
Atomic Bit Setting | |
static void | atomic_set_bit_u8 (atomic_bit_u8_t bit) |
Atomic version of *dest |= (1 << bit) | |
static void | atomic_set_bit_u16 (atomic_bit_u16_t bit) |
Atomic version of *dest |= (1 << bit) | |
static void | atomic_set_bit_u32 (atomic_bit_u32_t bit) |
Atomic version of *dest |= (1 << bit) | |
static void | atomic_set_bit_u64 (atomic_bit_u64_t bit) |
Atomic version of *dest |= (1 << bit) | |
Atomic Bit Clearing | |
static void | atomic_clear_bit_u8 (atomic_bit_u8_t bit) |
Atomic version of *dest &= ~(1 << bit) | |
static void | atomic_clear_bit_u16 (atomic_bit_u16_t bit) |
Atomic version of *dest &= ~(1 << bit) | |
static void | atomic_clear_bit_u32 (atomic_bit_u32_t bit) |
Atomic version of *dest &= ~(1 << bit) | |
static void | atomic_clear_bit_u64 (atomic_bit_u64_t bit) |
Atomic version of *dest &= ~(1 << bit) | |
Semi-Atomic In-Place Addition | |
static uint8_t | semi_atomic_fetch_add_u8 (volatile uint8_t *dest, uint8_t summand) |
Semi-atomically add a value onto a given value. | |
static uint16_t | semi_atomic_fetch_add_u16 (volatile uint16_t *dest, uint16_t summand) |
Semi-atomically add a value onto a given value. | |
static uint32_t | semi_atomic_fetch_add_u32 (volatile uint32_t *dest, uint32_t summand) |
Semi-atomically add a value onto a given value. | |
static uint64_t | semi_atomic_fetch_add_u64 (volatile uint64_t *dest, uint64_t summand) |
Semi-atomically add a value onto a given value. | |
Semi-Atomic In-Place Subtraction | |
static uint8_t | semi_atomic_fetch_sub_u8 (volatile uint8_t *dest, uint8_t subtrahend) |
Semi-atomically subtract a value from a given value. | |
static uint16_t | semi_atomic_fetch_sub_u16 (volatile uint16_t *dest, uint16_t subtrahend) |
Semi-atomically subtract a value from a given value. | |
static uint32_t | semi_atomic_fetch_sub_u32 (volatile uint32_t *dest, uint32_t subtrahend) |
Semi-atomically subtract a value from a given value. | |
static uint64_t | semi_atomic_fetch_sub_u64 (volatile uint64_t *dest, uint64_t subtrahend) |
Semi-atomically subtract a value from a given value. | |
Semi-atomic In-Place Bitwise OR | |
static uint8_t | semi_atomic_fetch_or_u8 (volatile uint8_t *dest, uint8_t val) |
Semi-atomic version of *dest |= val | |
static uint16_t | semi_atomic_fetch_or_u16 (volatile uint16_t *dest, uint16_t val) |
Semi-atomic version of *dest |= val | |
static uint32_t | semi_atomic_fetch_or_u32 (volatile uint32_t *dest, uint32_t val) |
Semi-atomic version of *dest |= val | |
static uint64_t | semi_atomic_fetch_or_u64 (volatile uint64_t *dest, uint64_t val) |
Semi-atomic version of *dest |= val | |
Semi-Atomic In-Place Bitwise XOR | |
static uint8_t | semi_atomic_fetch_xor_u8 (volatile uint8_t *dest, uint8_t val) |
Semi-atomic version of *dest ^= val | |
static uint16_t | semi_atomic_fetch_xor_u16 (volatile uint16_t *dest, uint16_t val) |
Semi-atomic version of *dest ^= val | |
static uint32_t | semi_atomic_fetch_xor_u32 (volatile uint32_t *dest, uint32_t val) |
Semi-atomic version of *dest ^= val | |
static uint64_t | semi_atomic_fetch_xor_u64 (volatile uint64_t *dest, uint64_t val) |
Semi-atomic version of *dest ^= val | |
Semi-Atomic In-Place Bitwise AND | |
static uint8_t | semi_atomic_fetch_and_u8 (volatile uint8_t *dest, uint8_t val) |
Semi-atomic version of *dest &= val | |
static uint16_t | semi_atomic_fetch_and_u16 (volatile uint16_t *dest, uint16_t val) |
Semi-atomic version of *dest &= val | |
static uint32_t | semi_atomic_fetch_and_u32 (volatile uint32_t *dest, uint32_t val) |
Semi-atomic version of *dest &= val | |
static uint64_t | semi_atomic_fetch_and_u64 (volatile uint64_t *dest, uint64_t val) |
Semi-atomic version of *dest &= val | |