cleanup: include/: move atomic.h to sys/atomic.h
move atomic.h to sys/atomic.h and create a shim for backward-compatibility. No functional changes to the headers. A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES. Related to #16539 Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
parent
52e0efac97
commit
e1e05a2eac
59 changed files with 531 additions and 516 deletions
|
@ -34,7 +34,7 @@ extern "C" {
|
||||||
#include <kernel_internal.h>
|
#include <kernel_internal.h>
|
||||||
#include <zephyr/types.h>
|
#include <zephyr/types.h>
|
||||||
#include <misc/dlist.h>
|
#include <misc/dlist.h>
|
||||||
#include <atomic.h>
|
#include <sys/atomic.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef _ASMLANGUAGE
|
#ifndef _ASMLANGUAGE
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#define ZEPHYR_DRIVERS_ADC_ADC_CONTEXT_H_
|
#define ZEPHYR_DRIVERS_ADC_ADC_CONTEXT_H_
|
||||||
|
|
||||||
#include <adc.h>
|
#include <adc.h>
|
||||||
#include <atomic.h>
|
#include <sys/atomic.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <zephyr.h>
|
#include <zephyr.h>
|
||||||
#include <atomic.h>
|
#include <sys/atomic.h>
|
||||||
#include <can.h>
|
#include <can.h>
|
||||||
#include <clock_control.h>
|
#include <clock_control.h>
|
||||||
#include <device.h>
|
#include <device.h>
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
#include <soc.h>
|
#include <soc.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <atomic.h>
|
#include <sys/atomic.h>
|
||||||
#include <device.h>
|
#include <device.h>
|
||||||
#include <clock_control.h>
|
#include <clock_control.h>
|
||||||
#include <misc/__assert.h>
|
#include <misc/__assert.h>
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
#include <drivers/console/uart_console.h>
|
#include <drivers/console/uart_console.h>
|
||||||
#include <toolchain.h>
|
#include <toolchain.h>
|
||||||
#include <linker/sections.h>
|
#include <linker/sections.h>
|
||||||
#include <atomic.h>
|
#include <sys/atomic.h>
|
||||||
#include <misc/printk.h>
|
#include <misc/printk.h>
|
||||||
#ifdef CONFIG_UART_CONSOLE_MCUMGR
|
#ifdef CONFIG_UART_CONSOLE_MCUMGR
|
||||||
#include "mgmt/serial.h"
|
#include "mgmt/serial.h"
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <entropy.h>
|
#include <entropy.h>
|
||||||
#include <atomic.h>
|
#include <sys/atomic.h>
|
||||||
#include <soc.h>
|
#include <soc.h>
|
||||||
#include "nrf_rng.h"
|
#include "nrf_rng.h"
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
#define ZEPHYR_DRIVERS_IEEE802154_IEEE802154_CC1200_H_
|
#define ZEPHYR_DRIVERS_IEEE802154_IEEE802154_CC1200_H_
|
||||||
|
|
||||||
#include <linker/sections.h>
|
#include <linker/sections.h>
|
||||||
#include <atomic.h>
|
#include <sys/atomic.h>
|
||||||
#include <spi.h>
|
#include <spi.h>
|
||||||
|
|
||||||
#include <ieee802154/cc1200.h>
|
#include <ieee802154/cc1200.h>
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
#define ZEPHYR_DRIVERS_IEEE802154_IEEE802154_CC2520_H_
|
#define ZEPHYR_DRIVERS_IEEE802154_IEEE802154_CC2520_H_
|
||||||
|
|
||||||
#include <linker/sections.h>
|
#include <linker/sections.h>
|
||||||
#include <atomic.h>
|
#include <sys/atomic.h>
|
||||||
#include <spi.h>
|
#include <spi.h>
|
||||||
|
|
||||||
#include <ieee802154/cc2520.h>
|
#include <ieee802154/cc2520.h>
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#define ZEPHYR_DRIVERS_IEEE802154_IEEE802154_MCR20A_H_
|
#define ZEPHYR_DRIVERS_IEEE802154_IEEE802154_MCR20A_H_
|
||||||
|
|
||||||
#include <linker/sections.h>
|
#include <linker/sections.h>
|
||||||
#include <atomic.h>
|
#include <sys/atomic.h>
|
||||||
#include <spi.h>
|
#include <spi.h>
|
||||||
|
|
||||||
/* Runtime context structure
|
/* Runtime context structure
|
||||||
|
|
|
@ -151,7 +151,7 @@ extern "C" {
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
#include <atomic.h>
|
#include <sys/atomic.h>
|
||||||
|
|
||||||
/** @brief Atomic 32-bit unsigned type. */
|
/** @brief Atomic 32-bit unsigned type. */
|
||||||
#define nrfx_atomic_t atomic_t
|
#define nrfx_atomic_t atomic_t
|
||||||
|
|
463
include/atomic.h
463
include/atomic.h
|
@ -1,470 +1,15 @@
|
||||||
/* atomic operations */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1997-2015, Wind River Systems, Inc.
|
* Copyright (c) 2019 Intel Corporation
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef ZEPHYR_INCLUDE_ATOMIC_H_
|
#ifndef ZEPHYR_INCLUDE_ATOMIC_H_
|
||||||
#define ZEPHYR_INCLUDE_ATOMIC_H_
|
#define ZEPHYR_INCLUDE_ATOMIC_H_
|
||||||
|
|
||||||
#include <stdbool.h>
|
#ifndef CONFIG_COMPAT_INCLUDES
|
||||||
#include <toolchain.h>
|
#warning "This header file has moved, include <sys/atomic.h> instead."
|
||||||
|
|
||||||
#include <zephyr/types.h>
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef int atomic_t;
|
#include <sys/atomic.h>
|
||||||
typedef atomic_t atomic_val_t;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @defgroup atomic_apis Atomic Services APIs
|
|
||||||
* @ingroup kernel_apis
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Atomic compare-and-set.
|
|
||||||
*
|
|
||||||
* This routine performs an atomic compare-and-set on @a target. If the current
|
|
||||||
* value of @a target equals @a old_value, @a target is set to @a new_value.
|
|
||||||
* If the current value of @a target does not equal @a old_value, @a target
|
|
||||||
* is left unchanged.
|
|
||||||
*
|
|
||||||
* @param target Address of atomic variable.
|
|
||||||
* @param old_value Original value to compare against.
|
|
||||||
* @param new_value New value to store.
|
|
||||||
* @return true if @a new_value is written, false otherwise.
|
|
||||||
*/
|
|
||||||
#ifdef CONFIG_ATOMIC_OPERATIONS_BUILTIN
|
|
||||||
static inline bool atomic_cas(atomic_t *target, atomic_val_t old_value,
|
|
||||||
atomic_val_t new_value)
|
|
||||||
{
|
|
||||||
return __atomic_compare_exchange_n(target, &old_value, new_value,
|
|
||||||
0, __ATOMIC_SEQ_CST,
|
|
||||||
__ATOMIC_SEQ_CST);
|
|
||||||
}
|
|
||||||
#elif defined(CONFIG_ATOMIC_OPERATIONS_C)
|
|
||||||
__syscall int atomic_cas(atomic_t *target, atomic_val_t old_value,
|
|
||||||
atomic_val_t new_value);
|
|
||||||
|
|
||||||
#else
|
|
||||||
extern int atomic_cas(atomic_t *target, atomic_val_t old_value,
|
|
||||||
atomic_val_t new_value);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @brief Atomic addition.
|
|
||||||
*
|
|
||||||
* This routine performs an atomic addition on @a target.
|
|
||||||
*
|
|
||||||
* @param target Address of atomic variable.
|
|
||||||
* @param value Value to add.
|
|
||||||
*
|
|
||||||
* @return Previous value of @a target.
|
|
||||||
*/
|
|
||||||
#ifdef CONFIG_ATOMIC_OPERATIONS_BUILTIN
|
|
||||||
static inline atomic_val_t atomic_add(atomic_t *target, atomic_val_t value)
|
|
||||||
{
|
|
||||||
return __atomic_fetch_add(target, value, __ATOMIC_SEQ_CST);
|
|
||||||
}
|
|
||||||
#elif defined(CONFIG_ATOMIC_OPERATIONS_C)
|
|
||||||
__syscall atomic_val_t atomic_add(atomic_t *target, atomic_val_t value);
|
|
||||||
#else
|
|
||||||
extern atomic_val_t atomic_add(atomic_t *target, atomic_val_t value);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @brief Atomic subtraction.
|
|
||||||
*
|
|
||||||
* This routine performs an atomic subtraction on @a target.
|
|
||||||
*
|
|
||||||
* @param target Address of atomic variable.
|
|
||||||
* @param value Value to subtract.
|
|
||||||
*
|
|
||||||
* @return Previous value of @a target.
|
|
||||||
*/
|
|
||||||
#ifdef CONFIG_ATOMIC_OPERATIONS_BUILTIN
|
|
||||||
static inline atomic_val_t atomic_sub(atomic_t *target, atomic_val_t value)
|
|
||||||
{
|
|
||||||
return __atomic_fetch_sub(target, value, __ATOMIC_SEQ_CST);
|
|
||||||
}
|
|
||||||
#elif defined(CONFIG_ATOMIC_OPERATIONS_C)
|
|
||||||
__syscall atomic_val_t atomic_sub(atomic_t *target, atomic_val_t value);
|
|
||||||
#else
|
|
||||||
extern atomic_val_t atomic_sub(atomic_t *target, atomic_val_t value);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @brief Atomic increment.
|
|
||||||
*
|
|
||||||
* This routine performs an atomic increment by 1 on @a target.
|
|
||||||
*
|
|
||||||
* @param target Address of atomic variable.
|
|
||||||
*
|
|
||||||
* @return Previous value of @a target.
|
|
||||||
*/
|
|
||||||
#if defined(CONFIG_ATOMIC_OPERATIONS_BUILTIN) || defined (CONFIG_ATOMIC_OPERATIONS_C)
|
|
||||||
static inline atomic_val_t atomic_inc(atomic_t *target)
|
|
||||||
{
|
|
||||||
return atomic_add(target, 1);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
extern atomic_val_t atomic_inc(atomic_t *target);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @brief Atomic decrement.
|
|
||||||
*
|
|
||||||
* This routine performs an atomic decrement by 1 on @a target.
|
|
||||||
*
|
|
||||||
* @param target Address of atomic variable.
|
|
||||||
*
|
|
||||||
* @return Previous value of @a target.
|
|
||||||
*/
|
|
||||||
#if defined(CONFIG_ATOMIC_OPERATIONS_BUILTIN) || defined (CONFIG_ATOMIC_OPERATIONS_C)
|
|
||||||
static inline atomic_val_t atomic_dec(atomic_t *target)
|
|
||||||
{
|
|
||||||
return atomic_sub(target, 1);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
extern atomic_val_t atomic_dec(atomic_t *target);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @brief Atomic get.
|
|
||||||
*
|
|
||||||
* This routine performs an atomic read on @a target.
|
|
||||||
*
|
|
||||||
* @param target Address of atomic variable.
|
|
||||||
*
|
|
||||||
* @return Value of @a target.
|
|
||||||
*/
|
|
||||||
#ifdef CONFIG_ATOMIC_OPERATIONS_BUILTIN
|
|
||||||
static inline atomic_val_t atomic_get(const atomic_t *target)
|
|
||||||
{
|
|
||||||
return __atomic_load_n(target, __ATOMIC_SEQ_CST);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
extern atomic_val_t atomic_get(const atomic_t *target);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @brief Atomic get-and-set.
|
|
||||||
*
|
|
||||||
* This routine atomically sets @a target to @a value and returns
|
|
||||||
* the previous value of @a target.
|
|
||||||
*
|
|
||||||
* @param target Address of atomic variable.
|
|
||||||
* @param value Value to write to @a target.
|
|
||||||
*
|
|
||||||
* @return Previous value of @a target.
|
|
||||||
*/
|
|
||||||
#ifdef CONFIG_ATOMIC_OPERATIONS_BUILTIN
|
|
||||||
static inline atomic_val_t atomic_set(atomic_t *target, atomic_val_t value)
|
|
||||||
{
|
|
||||||
/* This builtin, as described by Intel, is not a traditional
|
|
||||||
* test-and-set operation, but rather an atomic exchange operation. It
|
|
||||||
* writes value into *ptr, and returns the previous contents of *ptr.
|
|
||||||
*/
|
|
||||||
return __atomic_exchange_n(target, value, __ATOMIC_SEQ_CST);
|
|
||||||
}
|
|
||||||
#elif defined(CONFIG_ATOMIC_OPERATIONS_C)
|
|
||||||
__syscall atomic_val_t atomic_set(atomic_t *target, atomic_val_t value);
|
|
||||||
#else
|
|
||||||
extern atomic_val_t atomic_set(atomic_t *target, atomic_val_t value);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @brief Atomic clear.
|
|
||||||
*
|
|
||||||
* This routine atomically sets @a target to zero and returns its previous
|
|
||||||
* value. (Hence, it is equivalent to atomic_set(target, 0).)
|
|
||||||
*
|
|
||||||
* @param target Address of atomic variable.
|
|
||||||
*
|
|
||||||
* @return Previous value of @a target.
|
|
||||||
*/
|
|
||||||
#if defined(CONFIG_ATOMIC_OPERATIONS_BUILTIN) || defined (CONFIG_ATOMIC_OPERATIONS_C)
|
|
||||||
static inline atomic_val_t atomic_clear(atomic_t *target)
|
|
||||||
{
|
|
||||||
return atomic_set(target, 0);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
extern atomic_val_t atomic_clear(atomic_t *target);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @brief Atomic bitwise inclusive OR.
|
|
||||||
*
|
|
||||||
* This routine atomically sets @a target to the bitwise inclusive OR of
|
|
||||||
* @a target and @a value.
|
|
||||||
*
|
|
||||||
* @param target Address of atomic variable.
|
|
||||||
* @param value Value to OR.
|
|
||||||
*
|
|
||||||
* @return Previous value of @a target.
|
|
||||||
*/
|
|
||||||
#ifdef CONFIG_ATOMIC_OPERATIONS_BUILTIN
|
|
||||||
static inline atomic_val_t atomic_or(atomic_t *target, atomic_val_t value)
|
|
||||||
{
|
|
||||||
return __atomic_fetch_or(target, value, __ATOMIC_SEQ_CST);
|
|
||||||
}
|
|
||||||
#elif defined(CONFIG_ATOMIC_OPERATIONS_C)
|
|
||||||
__syscall atomic_val_t atomic_or(atomic_t *target, atomic_val_t value);
|
|
||||||
|
|
||||||
#else
|
|
||||||
extern atomic_val_t atomic_or(atomic_t *target, atomic_val_t value);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @brief Atomic bitwise exclusive OR (XOR).
|
|
||||||
*
|
|
||||||
* This routine atomically sets @a target to the bitwise exclusive OR (XOR) of
|
|
||||||
* @a target and @a value.
|
|
||||||
*
|
|
||||||
* @param target Address of atomic variable.
|
|
||||||
* @param value Value to XOR
|
|
||||||
*
|
|
||||||
* @return Previous value of @a target.
|
|
||||||
*/
|
|
||||||
#ifdef CONFIG_ATOMIC_OPERATIONS_BUILTIN
|
|
||||||
static inline atomic_val_t atomic_xor(atomic_t *target, atomic_val_t value)
|
|
||||||
{
|
|
||||||
return __atomic_fetch_xor(target, value, __ATOMIC_SEQ_CST);
|
|
||||||
}
|
|
||||||
#elif defined(CONFIG_ATOMIC_OPERATIONS_C)
|
|
||||||
__syscall atomic_val_t atomic_xor(atomic_t *target, atomic_val_t value);
|
|
||||||
#else
|
|
||||||
extern atomic_val_t atomic_xor(atomic_t *target, atomic_val_t value);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @brief Atomic bitwise AND.
|
|
||||||
*
|
|
||||||
* This routine atomically sets @a target to the bitwise AND of @a target
|
|
||||||
* and @a value.
|
|
||||||
*
|
|
||||||
* @param target Address of atomic variable.
|
|
||||||
* @param value Value to AND.
|
|
||||||
*
|
|
||||||
* @return Previous value of @a target.
|
|
||||||
*/
|
|
||||||
#ifdef CONFIG_ATOMIC_OPERATIONS_BUILTIN
|
|
||||||
static inline atomic_val_t atomic_and(atomic_t *target, atomic_val_t value)
|
|
||||||
{
|
|
||||||
return __atomic_fetch_and(target, value, __ATOMIC_SEQ_CST);
|
|
||||||
}
|
|
||||||
#elif defined(CONFIG_ATOMIC_OPERATIONS_C)
|
|
||||||
__syscall atomic_val_t atomic_and(atomic_t *target, atomic_val_t value);
|
|
||||||
#else
|
|
||||||
extern atomic_val_t atomic_and(atomic_t *target, atomic_val_t value);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @brief Atomic bitwise NAND.
|
|
||||||
*
|
|
||||||
* This routine atomically sets @a target to the bitwise NAND of @a target
|
|
||||||
* and @a value. (This operation is equivalent to target = ~(target & value).)
|
|
||||||
*
|
|
||||||
* @param target Address of atomic variable.
|
|
||||||
* @param value Value to NAND.
|
|
||||||
*
|
|
||||||
* @return Previous value of @a target.
|
|
||||||
*/
|
|
||||||
#ifdef CONFIG_ATOMIC_OPERATIONS_BUILTIN
|
|
||||||
static inline atomic_val_t atomic_nand(atomic_t *target, atomic_val_t value)
|
|
||||||
{
|
|
||||||
return __atomic_fetch_nand(target, value, __ATOMIC_SEQ_CST);
|
|
||||||
}
|
|
||||||
#elif defined(CONFIG_ATOMIC_OPERATIONS_C)
|
|
||||||
__syscall atomic_val_t atomic_nand(atomic_t *target, atomic_val_t value);
|
|
||||||
#else
|
|
||||||
extern atomic_val_t atomic_nand(atomic_t *target, atomic_val_t value);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Initialize an atomic variable.
|
|
||||||
*
|
|
||||||
* This macro can be used to initialize an atomic variable. For example,
|
|
||||||
* @code atomic_t my_var = ATOMIC_INIT(75); @endcode
|
|
||||||
*
|
|
||||||
* @param i Value to assign to atomic variable.
|
|
||||||
*/
|
|
||||||
#define ATOMIC_INIT(i) (i)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @cond INTERNAL_HIDDEN
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define ATOMIC_BITS (sizeof(atomic_val_t) * 8)
|
|
||||||
#define ATOMIC_MASK(bit) (1 << ((u32_t)(bit) & (ATOMIC_BITS - 1)))
|
|
||||||
#define ATOMIC_ELEM(addr, bit) ((addr) + ((bit) / ATOMIC_BITS))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* INTERNAL_HIDDEN @endcond
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Define an array of atomic variables.
|
|
||||||
*
|
|
||||||
* This macro defines an array of atomic variables containing at least
|
|
||||||
* @a num_bits bits.
|
|
||||||
*
|
|
||||||
* @note
|
|
||||||
* If used from file scope, the bits of the array are initialized to zero;
|
|
||||||
* if used from within a function, the bits are left uninitialized.
|
|
||||||
*
|
|
||||||
* @param name Name of array of atomic variables.
|
|
||||||
* @param num_bits Number of bits needed.
|
|
||||||
*/
|
|
||||||
#define ATOMIC_DEFINE(name, num_bits) \
|
|
||||||
atomic_t name[1 + ((num_bits) - 1) / ATOMIC_BITS]
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Atomically test a bit.
|
|
||||||
*
|
|
||||||
* This routine tests whether bit number @a bit of @a target is set or not.
|
|
||||||
* The target may be a single atomic variable or an array of them.
|
|
||||||
*
|
|
||||||
* @param target Address of atomic variable or array.
|
|
||||||
* @param bit Bit number (starting from 0).
|
|
||||||
*
|
|
||||||
* @return true if the bit was set, false if it wasn't.
|
|
||||||
*/
|
|
||||||
static inline bool atomic_test_bit(const atomic_t *target, int bit)
|
|
||||||
{
|
|
||||||
atomic_val_t val = atomic_get(ATOMIC_ELEM(target, bit));
|
|
||||||
|
|
||||||
return (1 & (val >> (bit & (ATOMIC_BITS - 1)))) != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Atomically test and clear a bit.
|
|
||||||
*
|
|
||||||
* Atomically clear bit number @a bit of @a target and return its old value.
|
|
||||||
* The target may be a single atomic variable or an array of them.
|
|
||||||
*
|
|
||||||
* @param target Address of atomic variable or array.
|
|
||||||
* @param bit Bit number (starting from 0).
|
|
||||||
*
|
|
||||||
* @return true if the bit was set, false if it wasn't.
|
|
||||||
*/
|
|
||||||
static inline bool atomic_test_and_clear_bit(atomic_t *target, int bit)
|
|
||||||
{
|
|
||||||
atomic_val_t mask = ATOMIC_MASK(bit);
|
|
||||||
atomic_val_t old;
|
|
||||||
|
|
||||||
old = atomic_and(ATOMIC_ELEM(target, bit), ~mask);
|
|
||||||
|
|
||||||
return (old & mask) != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Atomically set a bit.
|
|
||||||
*
|
|
||||||
* Atomically set bit number @a bit of @a target and return its old value.
|
|
||||||
* The target may be a single atomic variable or an array of them.
|
|
||||||
*
|
|
||||||
* @param target Address of atomic variable or array.
|
|
||||||
* @param bit Bit number (starting from 0).
|
|
||||||
*
|
|
||||||
* @return true if the bit was set, false if it wasn't.
|
|
||||||
*/
|
|
||||||
static inline bool atomic_test_and_set_bit(atomic_t *target, int bit)
|
|
||||||
{
|
|
||||||
atomic_val_t mask = ATOMIC_MASK(bit);
|
|
||||||
atomic_val_t old;
|
|
||||||
|
|
||||||
old = atomic_or(ATOMIC_ELEM(target, bit), mask);
|
|
||||||
|
|
||||||
return (old & mask) != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Atomically clear a bit.
|
|
||||||
*
|
|
||||||
* Atomically clear bit number @a bit of @a target.
|
|
||||||
* The target may be a single atomic variable or an array of them.
|
|
||||||
*
|
|
||||||
* @param target Address of atomic variable or array.
|
|
||||||
* @param bit Bit number (starting from 0).
|
|
||||||
*
|
|
||||||
* @return N/A
|
|
||||||
*/
|
|
||||||
static inline void atomic_clear_bit(atomic_t *target, int bit)
|
|
||||||
{
|
|
||||||
atomic_val_t mask = ATOMIC_MASK(bit);
|
|
||||||
|
|
||||||
(void)atomic_and(ATOMIC_ELEM(target, bit), ~mask);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Atomically set a bit.
|
|
||||||
*
|
|
||||||
* Atomically set bit number @a bit of @a target.
|
|
||||||
* The target may be a single atomic variable or an array of them.
|
|
||||||
*
|
|
||||||
* @param target Address of atomic variable or array.
|
|
||||||
* @param bit Bit number (starting from 0).
|
|
||||||
*
|
|
||||||
* @return N/A
|
|
||||||
*/
|
|
||||||
static inline void atomic_set_bit(atomic_t *target, int bit)
|
|
||||||
{
|
|
||||||
atomic_val_t mask = ATOMIC_MASK(bit);
|
|
||||||
|
|
||||||
(void)atomic_or(ATOMIC_ELEM(target, bit), mask);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Atomically set a bit to a given value.
|
|
||||||
*
|
|
||||||
* Atomically set bit number @a bit of @a target to value @a val.
|
|
||||||
* The target may be a single atomic variable or an array of them.
|
|
||||||
*
|
|
||||||
* @param target Address of atomic variable or array.
|
|
||||||
* @param bit Bit number (starting from 0).
|
|
||||||
* @param val true for 1, false for 0.
|
|
||||||
*
|
|
||||||
* @return N/A
|
|
||||||
*/
|
|
||||||
static inline void atomic_set_bit_to(atomic_t *target, int bit, bool val)
|
|
||||||
{
|
|
||||||
atomic_val_t mask = ATOMIC_MASK(bit);
|
|
||||||
|
|
||||||
if (val) {
|
|
||||||
(void)atomic_or(ATOMIC_ELEM(target, bit), mask);
|
|
||||||
} else {
|
|
||||||
(void)atomic_and(ATOMIC_ELEM(target, bit), ~mask);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef CONFIG_ATOMIC_OPERATIONS_C
|
|
||||||
#include <syscalls/atomic.h>
|
|
||||||
#endif
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* ZEPHYR_INCLUDE_ATOMIC_H_ */
|
#endif /* ZEPHYR_INCLUDE_ATOMIC_H_ */
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <atomic.h>
|
#include <sys/atomic.h>
|
||||||
#include <bluetooth/buf.h>
|
#include <bluetooth/buf.h>
|
||||||
#include <bluetooth/conn.h>
|
#include <bluetooth/conn.h>
|
||||||
#include <bluetooth/hci.h>
|
#include <bluetooth/hci.h>
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <toolchain.h>
|
#include <toolchain.h>
|
||||||
#include <linker/sections.h>
|
#include <linker/sections.h>
|
||||||
#include <atomic.h>
|
#include <sys/atomic.h>
|
||||||
#include <misc/__assert.h>
|
#include <misc/__assert.h>
|
||||||
#include <sched_priq.h>
|
#include <sched_priq.h>
|
||||||
#include <misc/dlist.h>
|
#include <misc/dlist.h>
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#define ZEPHYR_INCLUDE_LOGGING_LOG_MSG_H_
|
#define ZEPHYR_INCLUDE_LOGGING_LOG_MSG_H_
|
||||||
|
|
||||||
#include <kernel.h>
|
#include <kernel.h>
|
||||||
#include <atomic.h>
|
#include <sys/atomic.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_USERSPACE
|
#ifdef CONFIG_USERSPACE
|
||||||
#include <atomic.h>
|
#include <sys/atomic.h>
|
||||||
#include <zephyr/types.h>
|
#include <zephyr/types.h>
|
||||||
|
|
||||||
struct sys_mutex {
|
struct sys_mutex {
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
#include <kernel.h>
|
#include <kernel.h>
|
||||||
#include <zephyr/types.h>
|
#include <zephyr/types.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <atomic.h>
|
#include <sys/atomic.h>
|
||||||
|
|
||||||
#include <net/net_ip.h>
|
#include <net/net_ip.h>
|
||||||
#include <net/net_pkt.h>
|
#include <net/net_pkt.h>
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <kernel.h>
|
#include <kernel.h>
|
||||||
#include <atomic.h>
|
#include <sys/atomic.h>
|
||||||
|
|
||||||
#include <net/net_ip.h>
|
#include <net/net_ip.h>
|
||||||
#include <net/net_if.h>
|
#include <net/net_if.h>
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
#include <zephyr.h>
|
#include <zephyr.h>
|
||||||
#include <logging/log_backend.h>
|
#include <logging/log_backend.h>
|
||||||
#include <logging/log_output.h>
|
#include <logging/log_output.h>
|
||||||
#include <atomic.h>
|
#include <sys/atomic.h>
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
#include <shell/shell.h>
|
#include <shell/shell.h>
|
||||||
#include <ring_buffer.h>
|
#include <ring_buffer.h>
|
||||||
#include <atomic.h>
|
#include <sys/atomic.h>
|
||||||
#ifdef CONFIG_MCUMGR_SMP_SHELL
|
#ifdef CONFIG_MCUMGR_SMP_SHELL
|
||||||
#include "mgmt/smp_shell.h"
|
#include "mgmt/smp_shell.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#ifndef ZEPHYR_INCLUDE_SPINLOCK_H_
|
#ifndef ZEPHYR_INCLUDE_SPINLOCK_H_
|
||||||
#define ZEPHYR_INCLUDE_SPINLOCK_H_
|
#define ZEPHYR_INCLUDE_SPINLOCK_H_
|
||||||
|
|
||||||
#include <atomic.h>
|
#include <sys/atomic.h>
|
||||||
|
|
||||||
/* These stubs aren't provided by the mocking framework, and I can't
|
/* These stubs aren't provided by the mocking framework, and I can't
|
||||||
* find a proper place to put them as mocking seems not to have a
|
* find a proper place to put them as mocking seems not to have a
|
||||||
|
|
470
include/sys/atomic.h
Normal file
470
include/sys/atomic.h
Normal file
|
@ -0,0 +1,470 @@
|
||||||
|
/* atomic operations */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 1997-2015, Wind River Systems, Inc.
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef ZEPHYR_INCLUDE_SYS_ATOMIC_H_
|
||||||
|
#define ZEPHYR_INCLUDE_SYS_ATOMIC_H_
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <toolchain.h>
|
||||||
|
|
||||||
|
#include <zephyr/types.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef int atomic_t;
|
||||||
|
typedef atomic_t atomic_val_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @defgroup atomic_apis Atomic Services APIs
|
||||||
|
* @ingroup kernel_apis
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Atomic compare-and-set.
|
||||||
|
*
|
||||||
|
* This routine performs an atomic compare-and-set on @a target. If the current
|
||||||
|
* value of @a target equals @a old_value, @a target is set to @a new_value.
|
||||||
|
* If the current value of @a target does not equal @a old_value, @a target
|
||||||
|
* is left unchanged.
|
||||||
|
*
|
||||||
|
* @param target Address of atomic variable.
|
||||||
|
* @param old_value Original value to compare against.
|
||||||
|
* @param new_value New value to store.
|
||||||
|
* @return true if @a new_value is written, false otherwise.
|
||||||
|
*/
|
||||||
|
#ifdef CONFIG_ATOMIC_OPERATIONS_BUILTIN
|
||||||
|
static inline bool atomic_cas(atomic_t *target, atomic_val_t old_value,
|
||||||
|
atomic_val_t new_value)
|
||||||
|
{
|
||||||
|
return __atomic_compare_exchange_n(target, &old_value, new_value,
|
||||||
|
0, __ATOMIC_SEQ_CST,
|
||||||
|
__ATOMIC_SEQ_CST);
|
||||||
|
}
|
||||||
|
#elif defined(CONFIG_ATOMIC_OPERATIONS_C)
|
||||||
|
__syscall int atomic_cas(atomic_t *target, atomic_val_t old_value,
|
||||||
|
atomic_val_t new_value);
|
||||||
|
|
||||||
|
#else
|
||||||
|
extern int atomic_cas(atomic_t *target, atomic_val_t old_value,
|
||||||
|
atomic_val_t new_value);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @brief Atomic addition.
|
||||||
|
*
|
||||||
|
* This routine performs an atomic addition on @a target.
|
||||||
|
*
|
||||||
|
* @param target Address of atomic variable.
|
||||||
|
* @param value Value to add.
|
||||||
|
*
|
||||||
|
* @return Previous value of @a target.
|
||||||
|
*/
|
||||||
|
#ifdef CONFIG_ATOMIC_OPERATIONS_BUILTIN
|
||||||
|
static inline atomic_val_t atomic_add(atomic_t *target, atomic_val_t value)
|
||||||
|
{
|
||||||
|
return __atomic_fetch_add(target, value, __ATOMIC_SEQ_CST);
|
||||||
|
}
|
||||||
|
#elif defined(CONFIG_ATOMIC_OPERATIONS_C)
|
||||||
|
__syscall atomic_val_t atomic_add(atomic_t *target, atomic_val_t value);
|
||||||
|
#else
|
||||||
|
extern atomic_val_t atomic_add(atomic_t *target, atomic_val_t value);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @brief Atomic subtraction.
|
||||||
|
*
|
||||||
|
* This routine performs an atomic subtraction on @a target.
|
||||||
|
*
|
||||||
|
* @param target Address of atomic variable.
|
||||||
|
* @param value Value to subtract.
|
||||||
|
*
|
||||||
|
* @return Previous value of @a target.
|
||||||
|
*/
|
||||||
|
#ifdef CONFIG_ATOMIC_OPERATIONS_BUILTIN
|
||||||
|
static inline atomic_val_t atomic_sub(atomic_t *target, atomic_val_t value)
|
||||||
|
{
|
||||||
|
return __atomic_fetch_sub(target, value, __ATOMIC_SEQ_CST);
|
||||||
|
}
|
||||||
|
#elif defined(CONFIG_ATOMIC_OPERATIONS_C)
|
||||||
|
__syscall atomic_val_t atomic_sub(atomic_t *target, atomic_val_t value);
|
||||||
|
#else
|
||||||
|
extern atomic_val_t atomic_sub(atomic_t *target, atomic_val_t value);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @brief Atomic increment.
|
||||||
|
*
|
||||||
|
* This routine performs an atomic increment by 1 on @a target.
|
||||||
|
*
|
||||||
|
* @param target Address of atomic variable.
|
||||||
|
*
|
||||||
|
* @return Previous value of @a target.
|
||||||
|
*/
|
||||||
|
#if defined(CONFIG_ATOMIC_OPERATIONS_BUILTIN) || defined (CONFIG_ATOMIC_OPERATIONS_C)
|
||||||
|
static inline atomic_val_t atomic_inc(atomic_t *target)
|
||||||
|
{
|
||||||
|
return atomic_add(target, 1);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
extern atomic_val_t atomic_inc(atomic_t *target);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @brief Atomic decrement.
|
||||||
|
*
|
||||||
|
* This routine performs an atomic decrement by 1 on @a target.
|
||||||
|
*
|
||||||
|
* @param target Address of atomic variable.
|
||||||
|
*
|
||||||
|
* @return Previous value of @a target.
|
||||||
|
*/
|
||||||
|
#if defined(CONFIG_ATOMIC_OPERATIONS_BUILTIN) || defined (CONFIG_ATOMIC_OPERATIONS_C)
|
||||||
|
static inline atomic_val_t atomic_dec(atomic_t *target)
|
||||||
|
{
|
||||||
|
return atomic_sub(target, 1);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
extern atomic_val_t atomic_dec(atomic_t *target);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @brief Atomic get.
|
||||||
|
*
|
||||||
|
* This routine performs an atomic read on @a target.
|
||||||
|
*
|
||||||
|
* @param target Address of atomic variable.
|
||||||
|
*
|
||||||
|
* @return Value of @a target.
|
||||||
|
*/
|
||||||
|
#ifdef CONFIG_ATOMIC_OPERATIONS_BUILTIN
|
||||||
|
static inline atomic_val_t atomic_get(const atomic_t *target)
|
||||||
|
{
|
||||||
|
return __atomic_load_n(target, __ATOMIC_SEQ_CST);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
extern atomic_val_t atomic_get(const atomic_t *target);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @brief Atomic get-and-set.
|
||||||
|
*
|
||||||
|
* This routine atomically sets @a target to @a value and returns
|
||||||
|
* the previous value of @a target.
|
||||||
|
*
|
||||||
|
* @param target Address of atomic variable.
|
||||||
|
* @param value Value to write to @a target.
|
||||||
|
*
|
||||||
|
* @return Previous value of @a target.
|
||||||
|
*/
|
||||||
|
#ifdef CONFIG_ATOMIC_OPERATIONS_BUILTIN
|
||||||
|
static inline atomic_val_t atomic_set(atomic_t *target, atomic_val_t value)
|
||||||
|
{
|
||||||
|
/* This builtin, as described by Intel, is not a traditional
|
||||||
|
* test-and-set operation, but rather an atomic exchange operation. It
|
||||||
|
* writes value into *ptr, and returns the previous contents of *ptr.
|
||||||
|
*/
|
||||||
|
return __atomic_exchange_n(target, value, __ATOMIC_SEQ_CST);
|
||||||
|
}
|
||||||
|
#elif defined(CONFIG_ATOMIC_OPERATIONS_C)
|
||||||
|
__syscall atomic_val_t atomic_set(atomic_t *target, atomic_val_t value);
|
||||||
|
#else
|
||||||
|
extern atomic_val_t atomic_set(atomic_t *target, atomic_val_t value);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @brief Atomic clear.
|
||||||
|
*
|
||||||
|
* This routine atomically sets @a target to zero and returns its previous
|
||||||
|
* value. (Hence, it is equivalent to atomic_set(target, 0).)
|
||||||
|
*
|
||||||
|
* @param target Address of atomic variable.
|
||||||
|
*
|
||||||
|
* @return Previous value of @a target.
|
||||||
|
*/
|
||||||
|
#if defined(CONFIG_ATOMIC_OPERATIONS_BUILTIN) || defined (CONFIG_ATOMIC_OPERATIONS_C)
|
||||||
|
static inline atomic_val_t atomic_clear(atomic_t *target)
|
||||||
|
{
|
||||||
|
return atomic_set(target, 0);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
extern atomic_val_t atomic_clear(atomic_t *target);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @brief Atomic bitwise inclusive OR.
|
||||||
|
*
|
||||||
|
* This routine atomically sets @a target to the bitwise inclusive OR of
|
||||||
|
* @a target and @a value.
|
||||||
|
*
|
||||||
|
* @param target Address of atomic variable.
|
||||||
|
* @param value Value to OR.
|
||||||
|
*
|
||||||
|
* @return Previous value of @a target.
|
||||||
|
*/
|
||||||
|
#ifdef CONFIG_ATOMIC_OPERATIONS_BUILTIN
|
||||||
|
static inline atomic_val_t atomic_or(atomic_t *target, atomic_val_t value)
|
||||||
|
{
|
||||||
|
return __atomic_fetch_or(target, value, __ATOMIC_SEQ_CST);
|
||||||
|
}
|
||||||
|
#elif defined(CONFIG_ATOMIC_OPERATIONS_C)
|
||||||
|
__syscall atomic_val_t atomic_or(atomic_t *target, atomic_val_t value);
|
||||||
|
|
||||||
|
#else
|
||||||
|
extern atomic_val_t atomic_or(atomic_t *target, atomic_val_t value);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @brief Atomic bitwise exclusive OR (XOR).
|
||||||
|
*
|
||||||
|
* This routine atomically sets @a target to the bitwise exclusive OR (XOR) of
|
||||||
|
* @a target and @a value.
|
||||||
|
*
|
||||||
|
* @param target Address of atomic variable.
|
||||||
|
* @param value Value to XOR
|
||||||
|
*
|
||||||
|
* @return Previous value of @a target.
|
||||||
|
*/
|
||||||
|
#ifdef CONFIG_ATOMIC_OPERATIONS_BUILTIN
|
||||||
|
static inline atomic_val_t atomic_xor(atomic_t *target, atomic_val_t value)
|
||||||
|
{
|
||||||
|
return __atomic_fetch_xor(target, value, __ATOMIC_SEQ_CST);
|
||||||
|
}
|
||||||
|
#elif defined(CONFIG_ATOMIC_OPERATIONS_C)
|
||||||
|
__syscall atomic_val_t atomic_xor(atomic_t *target, atomic_val_t value);
|
||||||
|
#else
|
||||||
|
extern atomic_val_t atomic_xor(atomic_t *target, atomic_val_t value);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @brief Atomic bitwise AND.
|
||||||
|
*
|
||||||
|
* This routine atomically sets @a target to the bitwise AND of @a target
|
||||||
|
* and @a value.
|
||||||
|
*
|
||||||
|
* @param target Address of atomic variable.
|
||||||
|
* @param value Value to AND.
|
||||||
|
*
|
||||||
|
* @return Previous value of @a target.
|
||||||
|
*/
|
||||||
|
#ifdef CONFIG_ATOMIC_OPERATIONS_BUILTIN
|
||||||
|
static inline atomic_val_t atomic_and(atomic_t *target, atomic_val_t value)
|
||||||
|
{
|
||||||
|
return __atomic_fetch_and(target, value, __ATOMIC_SEQ_CST);
|
||||||
|
}
|
||||||
|
#elif defined(CONFIG_ATOMIC_OPERATIONS_C)
|
||||||
|
__syscall atomic_val_t atomic_and(atomic_t *target, atomic_val_t value);
|
||||||
|
#else
|
||||||
|
extern atomic_val_t atomic_and(atomic_t *target, atomic_val_t value);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @brief Atomic bitwise NAND.
|
||||||
|
*
|
||||||
|
* This routine atomically sets @a target to the bitwise NAND of @a target
|
||||||
|
* and @a value. (This operation is equivalent to target = ~(target & value).)
|
||||||
|
*
|
||||||
|
* @param target Address of atomic variable.
|
||||||
|
* @param value Value to NAND.
|
||||||
|
*
|
||||||
|
* @return Previous value of @a target.
|
||||||
|
*/
|
||||||
|
#ifdef CONFIG_ATOMIC_OPERATIONS_BUILTIN
|
||||||
|
static inline atomic_val_t atomic_nand(atomic_t *target, atomic_val_t value)
|
||||||
|
{
|
||||||
|
return __atomic_fetch_nand(target, value, __ATOMIC_SEQ_CST);
|
||||||
|
}
|
||||||
|
#elif defined(CONFIG_ATOMIC_OPERATIONS_C)
|
||||||
|
__syscall atomic_val_t atomic_nand(atomic_t *target, atomic_val_t value);
|
||||||
|
#else
|
||||||
|
extern atomic_val_t atomic_nand(atomic_t *target, atomic_val_t value);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Initialize an atomic variable.
|
||||||
|
*
|
||||||
|
* This macro can be used to initialize an atomic variable. For example,
|
||||||
|
* @code atomic_t my_var = ATOMIC_INIT(75); @endcode
|
||||||
|
*
|
||||||
|
* @param i Value to assign to atomic variable.
|
||||||
|
*/
|
||||||
|
#define ATOMIC_INIT(i) (i)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @cond INTERNAL_HIDDEN
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define ATOMIC_BITS (sizeof(atomic_val_t) * 8)
|
||||||
|
#define ATOMIC_MASK(bit) (1 << ((u32_t)(bit) & (ATOMIC_BITS - 1)))
|
||||||
|
#define ATOMIC_ELEM(addr, bit) ((addr) + ((bit) / ATOMIC_BITS))
|
||||||
|
|
||||||
|
/**
|
||||||
|
* INTERNAL_HIDDEN @endcond
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Define an array of atomic variables.
|
||||||
|
*
|
||||||
|
* This macro defines an array of atomic variables containing at least
|
||||||
|
* @a num_bits bits.
|
||||||
|
*
|
||||||
|
* @note
|
||||||
|
* If used from file scope, the bits of the array are initialized to zero;
|
||||||
|
* if used from within a function, the bits are left uninitialized.
|
||||||
|
*
|
||||||
|
* @param name Name of array of atomic variables.
|
||||||
|
* @param num_bits Number of bits needed.
|
||||||
|
*/
|
||||||
|
#define ATOMIC_DEFINE(name, num_bits) \
|
||||||
|
atomic_t name[1 + ((num_bits) - 1) / ATOMIC_BITS]
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Atomically test a bit.
|
||||||
|
*
|
||||||
|
* This routine tests whether bit number @a bit of @a target is set or not.
|
||||||
|
* The target may be a single atomic variable or an array of them.
|
||||||
|
*
|
||||||
|
* @param target Address of atomic variable or array.
|
||||||
|
* @param bit Bit number (starting from 0).
|
||||||
|
*
|
||||||
|
* @return true if the bit was set, false if it wasn't.
|
||||||
|
*/
|
||||||
|
static inline bool atomic_test_bit(const atomic_t *target, int bit)
|
||||||
|
{
|
||||||
|
atomic_val_t val = atomic_get(ATOMIC_ELEM(target, bit));
|
||||||
|
|
||||||
|
return (1 & (val >> (bit & (ATOMIC_BITS - 1)))) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Atomically test and clear a bit.
|
||||||
|
*
|
||||||
|
* Atomically clear bit number @a bit of @a target and return its old value.
|
||||||
|
* The target may be a single atomic variable or an array of them.
|
||||||
|
*
|
||||||
|
* @param target Address of atomic variable or array.
|
||||||
|
* @param bit Bit number (starting from 0).
|
||||||
|
*
|
||||||
|
* @return true if the bit was set, false if it wasn't.
|
||||||
|
*/
|
||||||
|
static inline bool atomic_test_and_clear_bit(atomic_t *target, int bit)
|
||||||
|
{
|
||||||
|
atomic_val_t mask = ATOMIC_MASK(bit);
|
||||||
|
atomic_val_t old;
|
||||||
|
|
||||||
|
old = atomic_and(ATOMIC_ELEM(target, bit), ~mask);
|
||||||
|
|
||||||
|
return (old & mask) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Atomically set a bit.
|
||||||
|
*
|
||||||
|
* Atomically set bit number @a bit of @a target and return its old value.
|
||||||
|
* The target may be a single atomic variable or an array of them.
|
||||||
|
*
|
||||||
|
* @param target Address of atomic variable or array.
|
||||||
|
* @param bit Bit number (starting from 0).
|
||||||
|
*
|
||||||
|
* @return true if the bit was set, false if it wasn't.
|
||||||
|
*/
|
||||||
|
static inline bool atomic_test_and_set_bit(atomic_t *target, int bit)
|
||||||
|
{
|
||||||
|
atomic_val_t mask = ATOMIC_MASK(bit);
|
||||||
|
atomic_val_t old;
|
||||||
|
|
||||||
|
old = atomic_or(ATOMIC_ELEM(target, bit), mask);
|
||||||
|
|
||||||
|
return (old & mask) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Atomically clear a bit.
|
||||||
|
*
|
||||||
|
* Atomically clear bit number @a bit of @a target.
|
||||||
|
* The target may be a single atomic variable or an array of them.
|
||||||
|
*
|
||||||
|
* @param target Address of atomic variable or array.
|
||||||
|
* @param bit Bit number (starting from 0).
|
||||||
|
*
|
||||||
|
* @return N/A
|
||||||
|
*/
|
||||||
|
static inline void atomic_clear_bit(atomic_t *target, int bit)
|
||||||
|
{
|
||||||
|
atomic_val_t mask = ATOMIC_MASK(bit);
|
||||||
|
|
||||||
|
(void)atomic_and(ATOMIC_ELEM(target, bit), ~mask);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Atomically set a bit.
|
||||||
|
*
|
||||||
|
* Atomically set bit number @a bit of @a target.
|
||||||
|
* The target may be a single atomic variable or an array of them.
|
||||||
|
*
|
||||||
|
* @param target Address of atomic variable or array.
|
||||||
|
* @param bit Bit number (starting from 0).
|
||||||
|
*
|
||||||
|
* @return N/A
|
||||||
|
*/
|
||||||
|
static inline void atomic_set_bit(atomic_t *target, int bit)
|
||||||
|
{
|
||||||
|
atomic_val_t mask = ATOMIC_MASK(bit);
|
||||||
|
|
||||||
|
(void)atomic_or(ATOMIC_ELEM(target, bit), mask);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Atomically set a bit to a given value.
|
||||||
|
*
|
||||||
|
* Atomically set bit number @a bit of @a target to value @a val.
|
||||||
|
* The target may be a single atomic variable or an array of them.
|
||||||
|
*
|
||||||
|
* @param target Address of atomic variable or array.
|
||||||
|
* @param bit Bit number (starting from 0).
|
||||||
|
* @param val true for 1, false for 0.
|
||||||
|
*
|
||||||
|
* @return N/A
|
||||||
|
*/
|
||||||
|
static inline void atomic_set_bit_to(atomic_t *target, int bit, bool val)
|
||||||
|
{
|
||||||
|
atomic_val_t mask = ATOMIC_MASK(bit);
|
||||||
|
|
||||||
|
if (val) {
|
||||||
|
(void)atomic_or(ATOMIC_ELEM(target, bit), mask);
|
||||||
|
} else {
|
||||||
|
(void)atomic_and(ATOMIC_ELEM(target, bit), ~mask);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_ATOMIC_OPERATIONS_C
|
||||||
|
#include <syscalls/atomic.h>
|
||||||
|
#endif
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* ZEPHYR_INCLUDE_SYS_ATOMIC_H_ */
|
|
@ -18,7 +18,7 @@
|
||||||
* (originally from x86's atomic.c)
|
* (originally from x86's atomic.c)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <atomic.h>
|
#include <sys/atomic.h>
|
||||||
#include <toolchain.h>
|
#include <toolchain.h>
|
||||||
#include <arch/cpu.h>
|
#include <arch/cpu.h>
|
||||||
#include <spinlock.h>
|
#include <spinlock.h>
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <device.h>
|
#include <device.h>
|
||||||
#include <misc/util.h>
|
#include <misc/util.h>
|
||||||
#include <atomic.h>
|
#include <sys/atomic.h>
|
||||||
#include <syscall_handler.h>
|
#include <syscall_handler.h>
|
||||||
|
|
||||||
extern struct device __device_init_start[];
|
extern struct device __device_init_start[];
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
#include <kernel.h>
|
#include <kernel.h>
|
||||||
|
|
||||||
#if !defined(_ASMLANGUAGE)
|
#if !defined(_ASMLANGUAGE)
|
||||||
#include <atomic.h>
|
#include <sys/atomic.h>
|
||||||
#include <misc/dlist.h>
|
#include <misc/dlist.h>
|
||||||
#include <misc/rb.h>
|
#include <misc/rb.h>
|
||||||
#include <misc/util.h>
|
#include <misc/util.h>
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
#include <drivers/timer/system_timer.h>
|
#include <drivers/timer/system_timer.h>
|
||||||
#include <ksched.h>
|
#include <ksched.h>
|
||||||
#include <wait_q.h>
|
#include <wait_q.h>
|
||||||
#include <atomic.h>
|
#include <sys/atomic.h>
|
||||||
#include <syscall_handler.h>
|
#include <syscall_handler.h>
|
||||||
#include <kernel_internal.h>
|
#include <kernel_internal.h>
|
||||||
#include <kswap.h>
|
#include <kswap.h>
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <kernel_structs.h>
|
#include <kernel_structs.h>
|
||||||
#include <atomic.h>
|
#include <sys/atomic.h>
|
||||||
#include <cmsis_os.h>
|
#include <cmsis_os.h>
|
||||||
|
|
||||||
#define TOTAL_CMSIS_THREAD_PRIORITIES (osPriorityRealtime - osPriorityIdle + 1)
|
#define TOTAL_CMSIS_THREAD_PRIORITIES (osPriorityRealtime - osPriorityIdle + 1)
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <kernel_structs.h>
|
#include <kernel_structs.h>
|
||||||
#include <ksched.h>
|
#include <ksched.h>
|
||||||
#include <atomic.h>
|
#include <sys/atomic.h>
|
||||||
#include <misc/stack.h>
|
#include <misc/stack.h>
|
||||||
#include "wrapper.h"
|
#include "wrapper.h"
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include <kernel.h>
|
#include <kernel.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <atomic.h>
|
#include <sys/atomic.h>
|
||||||
#include <posix/time.h>
|
#include <posix/time.h>
|
||||||
#include <posix/mqueue.h>
|
#include <posix/mqueue.h>
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#include <kernel.h>
|
#include <kernel.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <atomic.h>
|
#include <sys/atomic.h>
|
||||||
#include <ksched.h>
|
#include <ksched.h>
|
||||||
#include <wait_q.h>
|
#include <wait_q.h>
|
||||||
#include <posix/pthread.h>
|
#include <posix/pthread.h>
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <atomic.h>
|
#include <sys/atomic.h>
|
||||||
#include <misc/util.h>
|
#include <misc/util.h>
|
||||||
#include <misc/byteorder.h>
|
#include <misc/byteorder.h>
|
||||||
#include <misc/stack.h>
|
#include <misc/stack.h>
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
#include <soc.h>
|
#include <soc.h>
|
||||||
#include <toolchain.h>
|
#include <toolchain.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <atomic.h>
|
#include <sys/atomic.h>
|
||||||
#include <bluetooth/hci.h>
|
#include <bluetooth/hci.h>
|
||||||
#include <bluetooth/hci_vs.h>
|
#include <bluetooth/hci_vs.h>
|
||||||
#include <bluetooth/buf.h>
|
#include <bluetooth/buf.h>
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
#include <init.h>
|
#include <init.h>
|
||||||
#include <device.h>
|
#include <device.h>
|
||||||
#include <clock_control.h>
|
#include <clock_control.h>
|
||||||
#include <atomic.h>
|
#include <sys/atomic.h>
|
||||||
|
|
||||||
#include <misc/util.h>
|
#include <misc/util.h>
|
||||||
#include <misc/stack.h>
|
#include <misc/stack.h>
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#include <zephyr.h>
|
#include <zephyr.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <atomic.h>
|
#include <sys/atomic.h>
|
||||||
#include <misc/byteorder.h>
|
#include <misc/byteorder.h>
|
||||||
#include <misc/util.h>
|
#include <misc/util.h>
|
||||||
#include <misc/printk.h>
|
#include <misc/printk.h>
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <atomic.h>
|
#include <sys/atomic.h>
|
||||||
#include <misc/byteorder.h>
|
#include <misc/byteorder.h>
|
||||||
#include <misc/util.h>
|
#include <misc/util.h>
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <atomic.h>
|
#include <sys/atomic.h>
|
||||||
#include <misc/byteorder.h>
|
#include <misc/byteorder.h>
|
||||||
#include <misc/util.h>
|
#include <misc/util.h>
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <atomic.h>
|
#include <sys/atomic.h>
|
||||||
#include <misc/byteorder.h>
|
#include <misc/byteorder.h>
|
||||||
#include <misc/util.h>
|
#include <misc/util.h>
|
||||||
#include <misc/slist.h>
|
#include <misc/slist.h>
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <atomic.h>
|
#include <sys/atomic.h>
|
||||||
#include <misc/byteorder.h>
|
#include <misc/byteorder.h>
|
||||||
#include <misc/util.h>
|
#include <misc/util.h>
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <atomic.h>
|
#include <sys/atomic.h>
|
||||||
#include <misc/util.h>
|
#include <misc/util.h>
|
||||||
#include <misc/slist.h>
|
#include <misc/slist.h>
|
||||||
#include <misc/byteorder.h>
|
#include <misc/byteorder.h>
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <zephyr.h>
|
#include <zephyr.h>
|
||||||
#include <atomic.h>
|
#include <sys/atomic.h>
|
||||||
#include <misc/stack.h>
|
#include <misc/stack.h>
|
||||||
#include <misc/byteorder.h>
|
#include <misc/byteorder.h>
|
||||||
#include <tinycrypt/constants.h>
|
#include <tinycrypt/constants.h>
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <atomic.h>
|
#include <sys/atomic.h>
|
||||||
|
|
||||||
#include <bluetooth/hci_driver.h>
|
#include <bluetooth/hci_driver.h>
|
||||||
#include <bluetooth/hci_raw.h>
|
#include <bluetooth/hci_raw.h>
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
*/
|
*/
|
||||||
#include <zephyr.h>
|
#include <zephyr.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <atomic.h>
|
#include <sys/atomic.h>
|
||||||
#include <misc/byteorder.h>
|
#include <misc/byteorder.h>
|
||||||
#include <misc/util.h>
|
#include <misc/util.h>
|
||||||
#include <misc/printk.h>
|
#include <misc/printk.h>
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#include <zephyr.h>
|
#include <zephyr.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <atomic.h>
|
#include <sys/atomic.h>
|
||||||
#include <misc/util.h>
|
#include <misc/util.h>
|
||||||
|
|
||||||
#include <settings/settings.h>
|
#include <settings/settings.h>
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
#include <zephyr.h>
|
#include <zephyr.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <atomic.h>
|
#include <sys/atomic.h>
|
||||||
#include <misc/util.h>
|
#include <misc/util.h>
|
||||||
|
|
||||||
#include <bluetooth/bluetooth.h>
|
#include <bluetooth/bluetooth.h>
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#include <zephyr.h>
|
#include <zephyr.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <atomic.h>
|
#include <sys/atomic.h>
|
||||||
#include <misc/byteorder.h>
|
#include <misc/byteorder.h>
|
||||||
#include <misc/util.h>
|
#include <misc/util.h>
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#include <zephyr.h>
|
#include <zephyr.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <atomic.h>
|
#include <sys/atomic.h>
|
||||||
#include <misc/byteorder.h>
|
#include <misc/byteorder.h>
|
||||||
#include <misc/util.h>
|
#include <misc/util.h>
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <atomic.h>
|
#include <sys/atomic.h>
|
||||||
#include <misc/util.h>
|
#include <misc/util.h>
|
||||||
#include <misc/byteorder.h>
|
#include <misc/byteorder.h>
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
#include <zephyr.h>
|
#include <zephyr.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <atomic.h>
|
#include <sys/atomic.h>
|
||||||
#include <misc/util.h>
|
#include <misc/util.h>
|
||||||
#include <misc/byteorder.h>
|
#include <misc/byteorder.h>
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#include <zephyr.h>
|
#include <zephyr.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <atomic.h>
|
#include <sys/atomic.h>
|
||||||
#include <misc/byteorder.h>
|
#include <misc/byteorder.h>
|
||||||
#include <misc/util.h>
|
#include <misc/util.h>
|
||||||
#include <misc/stack.h>
|
#include <misc/stack.h>
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <atomic.h>
|
#include <sys/atomic.h>
|
||||||
#include <misc/util.h>
|
#include <misc/util.h>
|
||||||
#include <misc/byteorder.h>
|
#include <misc/byteorder.h>
|
||||||
#include <misc/stack.h>
|
#include <misc/stack.h>
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
#include <zephyr.h>
|
#include <zephyr.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <atomic.h>
|
#include <sys/atomic.h>
|
||||||
#include <misc/util.h>
|
#include <misc/util.h>
|
||||||
|
|
||||||
#include <bluetooth/bluetooth.h>
|
#include <bluetooth/bluetooth.h>
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
#include <misc/printk.h>
|
#include <misc/printk.h>
|
||||||
#include <init.h>
|
#include <init.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <atomic.h>
|
#include <sys/atomic.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
LOG_MODULE_REGISTER(log);
|
LOG_MODULE_REGISTER(log);
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#include <zephyr.h>
|
#include <zephyr.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <device.h>
|
#include <device.h>
|
||||||
#include <atomic.h>
|
#include <sys/atomic.h>
|
||||||
#include "policy/pm_policy.h"
|
#include "policy/pm_policy.h"
|
||||||
|
|
||||||
#define LOG_LEVEL CONFIG_SYS_PM_LOG_LEVEL /* From power module Kconfig */
|
#define LOG_LEVEL CONFIG_SYS_PM_LOG_LEVEL /* From power module Kconfig */
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <atomic.h>
|
#include <sys/atomic.h>
|
||||||
#include <kernel.h>
|
#include <kernel.h>
|
||||||
#include <entropy.h>
|
#include <entropy.h>
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
#include <random/rand32.h>
|
#include <random/rand32.h>
|
||||||
#include <drivers/timer/system_timer.h>
|
#include <drivers/timer/system_timer.h>
|
||||||
#include <kernel.h>
|
#include <kernel.h>
|
||||||
#include <atomic.h>
|
#include <sys/atomic.h>
|
||||||
|
|
||||||
#if defined(__GNUC__)
|
#if defined(__GNUC__)
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <atomic.h>
|
#include <sys/atomic.h>
|
||||||
#include <shell/shell.h>
|
#include <shell/shell.h>
|
||||||
#include <shell/shell_dummy.h>
|
#include <shell/shell_dummy.h>
|
||||||
#include "shell_ops.h"
|
#include "shell_ops.h"
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <atomic.h>
|
#include <sys/atomic.h>
|
||||||
#include <zephyr/types.h>
|
#include <zephyr/types.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ztest.h>
|
#include <ztest.h>
|
||||||
#include <atomic.h>
|
#include <sys/atomic.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @addtogroup kernel_common_tests
|
* @addtogroup kernel_common_tests
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ztest.h>
|
#include <ztest.h>
|
||||||
#include <atomic.h>
|
#include <sys/atomic.h>
|
||||||
#define THREAD_NUM 4
|
#define THREAD_NUM 4
|
||||||
#define STACK_SIZE (512 + CONFIG_TEST_EXTRA_STACKSIZE)
|
#define STACK_SIZE (512 + CONFIG_TEST_EXTRA_STACKSIZE)
|
||||||
#define POOL_NUM 2
|
#define POOL_NUM 2
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ztest.h>
|
#include <ztest.h>
|
||||||
#include <atomic.h>
|
#include <sys/atomic.h>
|
||||||
#define LOOP 10
|
#define LOOP 10
|
||||||
#define STACK_SIZE (512 + CONFIG_TEST_EXTRA_STACKSIZE)
|
#define STACK_SIZE (512 + CONFIG_TEST_EXTRA_STACKSIZE)
|
||||||
#define THREAD_NUM 4
|
#define THREAD_NUM 4
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue