Browse Source

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>
pull/17120/head
Anas Nashif 6 years ago
parent
commit
e1e05a2eac
  1. 2
      arch/arm/include/kernel_arch_data.h
  2. 2
      drivers/adc/adc_context.h
  3. 2
      drivers/can/can_mcux_flexcan.c
  4. 2
      drivers/clock_control/nrf_power_clock.c
  5. 2
      drivers/console/uart_console.c
  6. 2
      drivers/entropy/entropy_nrf5.c
  7. 2
      drivers/ieee802154/ieee802154_cc1200.h
  8. 2
      drivers/ieee802154/ieee802154_cc2520.h
  9. 2
      drivers/ieee802154/ieee802154_mcr20a.h
  10. 2
      ext/hal/nordic/nrfx_glue.h
  11. 463
      include/atomic.h
  12. 2
      include/bluetooth/l2cap.h
  13. 2
      include/kernel_includes.h
  14. 2
      include/logging/log_msg.h
  15. 2
      include/misc/mutex.h
  16. 2
      include/net/ethernet.h
  17. 2
      include/net/net_context.h
  18. 2
      include/shell/shell_log_backend.h
  19. 2
      include/shell/shell_uart.h
  20. 2
      include/spinlock.h
  21. 470
      include/sys/atomic.h
  22. 2
      kernel/atomic_c.c
  23. 2
      kernel/device.c
  24. 2
      kernel/include/kernel_structs.h
  25. 2
      kernel/thread.c
  26. 2
      lib/cmsis_rtos_v1/cmsis_thread.c
  27. 2
      lib/cmsis_rtos_v2/thread.c
  28. 2
      lib/posix/mqueue.c
  29. 2
      lib/posix/pthread.c
  30. 2
      subsys/bluetooth/common/rpa.c
  31. 2
      subsys/bluetooth/controller/hci/hci.c
  32. 2
      subsys/bluetooth/controller/hci/hci_driver.c
  33. 2
      subsys/bluetooth/host/a2dp.c
  34. 2
      subsys/bluetooth/host/att.c
  35. 2
      subsys/bluetooth/host/avdtp.c
  36. 2
      subsys/bluetooth/host/conn.c
  37. 2
      subsys/bluetooth/host/gatt.c
  38. 2
      subsys/bluetooth/host/hci_core.c
  39. 2
      subsys/bluetooth/host/hci_ecc.c
  40. 2
      subsys/bluetooth/host/hci_raw.c
  41. 2
      subsys/bluetooth/host/hfp_hf.c
  42. 2
      subsys/bluetooth/host/keys.c
  43. 2
      subsys/bluetooth/host/keys_br.c
  44. 2
      subsys/bluetooth/host/l2cap.c
  45. 2
      subsys/bluetooth/host/l2cap_br.c
  46. 2
      subsys/bluetooth/host/mesh/net.c
  47. 2
      subsys/bluetooth/host/mesh/prov.c
  48. 2
      subsys/bluetooth/host/rfcomm.c
  49. 2
      subsys/bluetooth/host/smp.c
  50. 2
      subsys/bluetooth/host/smp_null.c
  51. 2
      subsys/logging/log_core.c
  52. 2
      subsys/power/pm_ctrl.c
  53. 2
      subsys/random/rand32_entropy_device.c
  54. 2
      subsys/random/rand32_timer.c
  55. 2
      subsys/shell/shell.c
  56. 2
      tests/bluetooth/tester/src/gap.c
  57. 2
      tests/kernel/common/src/atomic.c
  58. 2
      tests/kernel/mem_pool/mem_pool_threadsafe/src/main.c
  59. 2
      tests/kernel/mem_slab/mslab_threadsafe/src/test_mslab_threadsafe.c

2
arch/arm/include/kernel_arch_data.h

@ -34,7 +34,7 @@ extern "C" { @@ -34,7 +34,7 @@ extern "C" {
#include <kernel_internal.h>
#include <zephyr/types.h>
#include <misc/dlist.h>
#include <atomic.h>
#include <sys/atomic.h>
#endif
#ifndef _ASMLANGUAGE

2
drivers/adc/adc_context.h

@ -9,7 +9,7 @@ @@ -9,7 +9,7 @@
#define ZEPHYR_DRIVERS_ADC_ADC_CONTEXT_H_
#include <adc.h>
#include <atomic.h>
#include <sys/atomic.h>
#ifdef __cplusplus
extern "C" {

2
drivers/can/can_mcux_flexcan.c

@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
*/
#include <zephyr.h>
#include <atomic.h>
#include <sys/atomic.h>
#include <can.h>
#include <clock_control.h>
#include <device.h>

2
drivers/clock_control/nrf_power_clock.c

@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
#include <soc.h>
#include <errno.h>
#include <atomic.h>
#include <sys/atomic.h>
#include <device.h>
#include <clock_control.h>
#include <misc/__assert.h>

2
drivers/console/uart_console.c

@ -28,7 +28,7 @@ @@ -28,7 +28,7 @@
#include <drivers/console/uart_console.h>
#include <toolchain.h>
#include <linker/sections.h>
#include <atomic.h>
#include <sys/atomic.h>
#include <misc/printk.h>
#ifdef CONFIG_UART_CONSOLE_MCUMGR
#include "mgmt/serial.h"

2
drivers/entropy/entropy_nrf5.c

@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
*/
#include <entropy.h>
#include <atomic.h>
#include <sys/atomic.h>
#include <soc.h>
#include "nrf_rng.h"

2
drivers/ieee802154/ieee802154_cc1200.h

@ -10,7 +10,7 @@ @@ -10,7 +10,7 @@
#define ZEPHYR_DRIVERS_IEEE802154_IEEE802154_CC1200_H_
#include <linker/sections.h>
#include <atomic.h>
#include <sys/atomic.h>
#include <spi.h>
#include <ieee802154/cc1200.h>

2
drivers/ieee802154/ieee802154_cc2520.h

@ -10,7 +10,7 @@ @@ -10,7 +10,7 @@
#define ZEPHYR_DRIVERS_IEEE802154_IEEE802154_CC2520_H_
#include <linker/sections.h>
#include <atomic.h>
#include <sys/atomic.h>
#include <spi.h>
#include <ieee802154/cc2520.h>

2
drivers/ieee802154/ieee802154_mcr20a.h

@ -11,7 +11,7 @@ @@ -11,7 +11,7 @@
#define ZEPHYR_DRIVERS_IEEE802154_IEEE802154_MCR20A_H_
#include <linker/sections.h>
#include <atomic.h>
#include <sys/atomic.h>
#include <spi.h>
/* Runtime context structure

2
ext/hal/nordic/nrfx_glue.h

@ -151,7 +151,7 @@ extern "C" { @@ -151,7 +151,7 @@ extern "C" {
//------------------------------------------------------------------------------
#include <atomic.h>
#include <sys/atomic.h>
/** @brief Atomic 32-bit unsigned type. */
#define nrfx_atomic_t atomic_t

463
include/atomic.h

@ -1,470 +1,15 @@ @@ -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
*/
#ifndef ZEPHYR_INCLUDE_ATOMIC_H_
#define ZEPHYR_INCLUDE_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>
#ifndef CONFIG_COMPAT_INCLUDES
#warning "This header file has moved, include <sys/atomic.h> instead."
#endif
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#include <sys/atomic.h>
#endif /* ZEPHYR_INCLUDE_ATOMIC_H_ */

2
include/bluetooth/l2cap.h

@ -21,7 +21,7 @@ @@ -21,7 +21,7 @@
extern "C" {
#endif
#include <atomic.h>
#include <sys/atomic.h>
#include <bluetooth/buf.h>
#include <bluetooth/conn.h>
#include <bluetooth/hci.h>

2
include/kernel_includes.h

@ -18,7 +18,7 @@ @@ -18,7 +18,7 @@
#include <limits.h>
#include <toolchain.h>
#include <linker/sections.h>
#include <atomic.h>
#include <sys/atomic.h>
#include <misc/__assert.h>
#include <sched_priq.h>
#include <misc/dlist.h>

2
include/logging/log_msg.h

@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
#define ZEPHYR_INCLUDE_LOGGING_LOG_MSG_H_
#include <kernel.h>
#include <atomic.h>
#include <sys/atomic.h>
#include <assert.h>
#include <string.h>

2
include/misc/mutex.h

@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
*/
#ifdef CONFIG_USERSPACE
#include <atomic.h>
#include <sys/atomic.h>
#include <zephyr/types.h>
struct sys_mutex {

2
include/net/ethernet.h

@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
#include <kernel.h>
#include <zephyr/types.h>
#include <stdbool.h>
#include <atomic.h>
#include <sys/atomic.h>
#include <net/net_ip.h>
#include <net/net_pkt.h>

2
include/net/net_context.h

@ -21,7 +21,7 @@ @@ -21,7 +21,7 @@
*/
#include <kernel.h>
#include <atomic.h>
#include <sys/atomic.h>
#include <net/net_ip.h>
#include <net/net_if.h>

2
include/shell/shell_log_backend.h

@ -10,7 +10,7 @@ @@ -10,7 +10,7 @@
#include <zephyr.h>
#include <logging/log_backend.h>
#include <logging/log_output.h>
#include <atomic.h>
#include <sys/atomic.h>
#ifdef __cplusplus
extern "C" {
#endif

2
include/shell/shell_uart.h

@ -9,7 +9,7 @@ @@ -9,7 +9,7 @@
#include <shell/shell.h>
#include <ring_buffer.h>
#include <atomic.h>
#include <sys/atomic.h>
#ifdef CONFIG_MCUMGR_SMP_SHELL
#include "mgmt/smp_shell.h"
#endif

2
include/spinlock.h

@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
#ifndef 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
* find a proper place to put them as mocking seems not to have a

470
include/sys/atomic.h

@ -0,0 +1,470 @@ @@ -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_ */

2
kernel/atomic_c.c

@ -18,7 +18,7 @@ @@ -18,7 +18,7 @@
* (originally from x86's atomic.c)
*/
#include <atomic.h>
#include <sys/atomic.h>
#include <toolchain.h>
#include <arch/cpu.h>
#include <spinlock.h>

2
kernel/device.c

@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
#include <string.h>
#include <device.h>
#include <misc/util.h>
#include <atomic.h>
#include <sys/atomic.h>
#include <syscall_handler.h>
extern struct device __device_init_start[];

2
kernel/include/kernel_structs.h

@ -10,7 +10,7 @@ @@ -10,7 +10,7 @@
#include <kernel.h>
#if !defined(_ASMLANGUAGE)
#include <atomic.h>
#include <sys/atomic.h>
#include <misc/dlist.h>
#include <misc/rb.h>
#include <misc/util.h>

2
kernel/thread.c

@ -24,7 +24,7 @@ @@ -24,7 +24,7 @@
#include <drivers/timer/system_timer.h>
#include <ksched.h>
#include <wait_q.h>
#include <atomic.h>
#include <sys/atomic.h>
#include <syscall_handler.h>
#include <kernel_internal.h>
#include <kswap.h>

2
lib/cmsis_rtos_v1/cmsis_thread.c

@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
*/
#include <kernel_structs.h>
#include <atomic.h>
#include <sys/atomic.h>
#include <cmsis_os.h>
#define TOTAL_CMSIS_THREAD_PRIORITIES (osPriorityRealtime - osPriorityIdle + 1)

2
lib/cmsis_rtos_v2/thread.c

@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
#include <string.h>
#include <kernel_structs.h>
#include <ksched.h>
#include <atomic.h>
#include <sys/atomic.h>
#include <misc/stack.h>
#include "wrapper.h"

2
lib/posix/mqueue.c

@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
#include <kernel.h>
#include <errno.h>
#include <string.h>
#include <atomic.h>
#include <sys/atomic.h>
#include <posix/time.h>
#include <posix/mqueue.h>

2
lib/posix/pthread.c

@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
#include <kernel.h>
#include <stdio.h>
#include <atomic.h>
#include <sys/atomic.h>
#include <ksched.h>
#include <wait_q.h>
#include <posix/pthread.h>

2
subsys/bluetooth/common/rpa.c

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
#include <stddef.h>
#include <errno.h>
#include <string.h>
#include <atomic.h>
#include <sys/atomic.h>
#include <misc/util.h>
#include <misc/byteorder.h>
#include <misc/stack.h>

2
subsys/bluetooth/controller/hci/hci.c

@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@
#include <soc.h>
#include <toolchain.h>
#include <errno.h>
#include <atomic.h>
#include <sys/atomic.h>
#include <bluetooth/hci.h>
#include <bluetooth/hci_vs.h>
#include <bluetooth/buf.h>

2
subsys/bluetooth/controller/hci/hci_driver.c

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
#include <init.h>
#include <device.h>
#include <clock_control.h>
#include <atomic.h>
#include <sys/atomic.h>
#include <misc/util.h>
#include <misc/stack.h>

2
subsys/bluetooth/host/a2dp.c

@ -11,7 +11,7 @@ @@ -11,7 +11,7 @@
#include <zephyr.h>
#include <string.h>
#include <errno.h>
#include <atomic.h>
#include <sys/atomic.h>
#include <misc/byteorder.h>
#include <misc/util.h>
#include <misc/printk.h>

2
subsys/bluetooth/host/att.c

@ -10,7 +10,7 @@ @@ -10,7 +10,7 @@
#include <string.h>
#include <errno.h>
#include <stdbool.h>
#include <atomic.h>
#include <sys/atomic.h>
#include <misc/byteorder.h>
#include <misc/util.h>

2
subsys/bluetooth/host/avdtp.c

@ -9,7 +9,7 @@ @@ -9,7 +9,7 @@
#include <string.h>
#include <strings.h>
#include <errno.h>
#include <atomic.h>
#include <sys/atomic.h>
#include <misc/byteorder.h>
#include <misc/util.h>

2
subsys/bluetooth/host/conn.c

@ -10,7 +10,7 @@ @@ -10,7 +10,7 @@
#include <string.h>
#include <errno.h>
#include <stdbool.h>
#include <atomic.h>
#include <sys/atomic.h>
#include <misc/byteorder.h>
#include <misc/util.h>
#include <misc/slist.h>

2
subsys/bluetooth/host/gatt.c

@ -11,7 +11,7 @@ @@ -11,7 +11,7 @@
#include <errno.h>
#include <stdbool.h>
#include <stdlib.h>
#include <atomic.h>
#include <sys/atomic.h>
#include <misc/byteorder.h>
#include <misc/util.h>

2
subsys/bluetooth/host/hci_core.c

@ -11,7 +11,7 @@ @@ -11,7 +11,7 @@
#include <string.h>
#include <stdio.h>
#include <errno.h>
#include <atomic.h>
#include <sys/atomic.h>
#include <misc/util.h>
#include <misc/slist.h>
#include <misc/byteorder.h>

2
subsys/bluetooth/host/hci_ecc.c

@ -10,7 +10,7 @@ @@ -10,7 +10,7 @@
*/
#include <zephyr.h>
#include <atomic.h>
#include <sys/atomic.h>
#include <misc/stack.h>
#include <misc/byteorder.h>
#include <tinycrypt/constants.h>

2
subsys/bluetooth/host/hci_raw.c

@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
*/
#include <errno.h>
#include <atomic.h>
#include <sys/atomic.h>
#include <bluetooth/hci_driver.h>
#include <bluetooth/hci_raw.h>

2
subsys/bluetooth/host/hfp_hf.c

@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
*/
#include <zephyr.h>
#include <errno.h>
#include <atomic.h>
#include <sys/atomic.h>
#include <misc/byteorder.h>
#include <misc/util.h>
#include <misc/printk.h>

2
subsys/bluetooth/host/keys.c

@ -9,7 +9,7 @@ @@ -9,7 +9,7 @@
#include <zephyr.h>
#include <string.h>
#include <stdlib.h>
#include <atomic.h>
#include <sys/atomic.h>
#include <misc/util.h>
#include <settings/settings.h>

2
subsys/bluetooth/host/keys_br.c

@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
#include <zephyr.h>
#include <string.h>
#include <atomic.h>
#include <sys/atomic.h>
#include <misc/util.h>
#include <bluetooth/bluetooth.h>

2
subsys/bluetooth/host/l2cap.c

@ -9,7 +9,7 @@ @@ -9,7 +9,7 @@
#include <zephyr.h>
#include <string.h>
#include <errno.h>
#include <atomic.h>
#include <sys/atomic.h>
#include <misc/byteorder.h>
#include <misc/util.h>

2
subsys/bluetooth/host/l2cap_br.c

@ -9,7 +9,7 @@ @@ -9,7 +9,7 @@
#include <zephyr.h>
#include <string.h>
#include <errno.h>
#include <atomic.h>
#include <sys/atomic.h>
#include <misc/byteorder.h>
#include <misc/util.h>

2
subsys/bluetooth/host/mesh/net.c

@ -10,7 +10,7 @@ @@ -10,7 +10,7 @@
#include <string.h>
#include <errno.h>
#include <stdbool.h>
#include <atomic.h>
#include <sys/atomic.h>
#include <misc/util.h>
#include <misc/byteorder.h>

2
subsys/bluetooth/host/mesh/prov.c

@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
#include <zephyr.h>
#include <errno.h>
#include <atomic.h>
#include <sys/atomic.h>
#include <misc/util.h>
#include <misc/byteorder.h>

2
subsys/bluetooth/host/rfcomm.c

@ -9,7 +9,7 @@ @@ -9,7 +9,7 @@
#include <zephyr.h>
#include <string.h>
#include <errno.h>
#include <atomic.h>
#include <sys/atomic.h>
#include <misc/byteorder.h>
#include <misc/util.h>
#include <misc/stack.h>

2
subsys/bluetooth/host/smp.c

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
#include <stddef.h>
#include <errno.h>
#include <string.h>
#include <atomic.h>
#include <sys/atomic.h>
#include <misc/util.h>
#include <misc/byteorder.h>
#include <misc/stack.h>

2
subsys/bluetooth/host/smp_null.c

@ -11,7 +11,7 @@ @@ -11,7 +11,7 @@
#include <zephyr.h>
#include <errno.h>
#include <atomic.h>
#include <sys/atomic.h>
#include <misc/util.h>
#include <bluetooth/bluetooth.h>

2
subsys/logging/log_core.c

@ -12,7 +12,7 @@ @@ -12,7 +12,7 @@
#include <misc/printk.h>
#include <init.h>
#include <assert.h>
#include <atomic.h>
#include <sys/atomic.h>
#include <ctype.h>
LOG_MODULE_REGISTER(log);

2
subsys/power/pm_ctrl.c

@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
#include <zephyr.h>
#include <string.h>
#include <device.h>
#include <atomic.h>
#include <sys/atomic.h>
#include "policy/pm_policy.h"
#define LOG_LEVEL CONFIG_SYS_PM_LOG_LEVEL /* From power module Kconfig */

2
subsys/random/rand32_entropy_device.c

@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
#include <atomic.h>
#include <sys/atomic.h>
#include <kernel.h>
#include <entropy.h>

2
subsys/random/rand32_timer.c

@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
#include <random/rand32.h>
#include <drivers/timer/system_timer.h>
#include <kernel.h>
#include <atomic.h>
#include <sys/atomic.h>
#if defined(__GNUC__)

2
subsys/shell/shell.c

@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
#include <ctype.h>
#include <stdlib.h>
#include <atomic.h>
#include <sys/atomic.h>
#include <shell/shell.h>
#include <shell/shell_dummy.h>
#include "shell_ops.h"

2
tests/bluetooth/tester/src/gap.c

@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
#include <atomic.h>
#include <sys/atomic.h>
#include <zephyr/types.h>
#include <string.h>

2
tests/kernel/common/src/atomic.c

@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
*/
#include <ztest.h>
#include <atomic.h>
#include <sys/atomic.h>
/**
* @addtogroup kernel_common_tests

2
tests/kernel/mem_pool/mem_pool_threadsafe/src/main.c

@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
*/
#include <ztest.h>
#include <atomic.h>
#include <sys/atomic.h>
#define THREAD_NUM 4
#define STACK_SIZE (512 + CONFIG_TEST_EXTRA_STACKSIZE)
#define POOL_NUM 2

2
tests/kernel/mem_slab/mslab_threadsafe/src/test_mslab_threadsafe.c

@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
*/
#include <ztest.h>
#include <atomic.h>
#include <sys/atomic.h>
#define LOOP 10
#define STACK_SIZE (512 + CONFIG_TEST_EXTRA_STACKSIZE)
#define THREAD_NUM 4

Loading…
Cancel
Save