Zephyr API Documentation 4.1.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
atomic.c File Reference
#include <zephyr/ztest.h>
#include <zephyr/sys/atomic.h>

Macros

#define ATOMIC_WORD(val_if_64, val_if_32)
 
#define NUM_FLAG_BITS   100
 
#define TEST_CYCLE   20
 
#define THREADS_NUM   2
 
#define STACK_SIZE   (512 + CONFIG_TEST_EXTRA_STACK_SIZE)
 

Functions

static K_THREAD_STACK_ARRAY_DEFINE (stack, 2,(512+CONFIG_TEST_EXTRA_STACK_SIZE))
 
void test_atomic (void)
 Verify atomic functionalities.
 
void atomic_handler (void *p1, void *p2, void *p3)
 
void test_threads_access_atomic (void)
 Verify atomic operation with threads.
 
void test_atomic_overflow (void)
 Checks that the value of atomic_t will be the same in case of overflow if incremented in atomic and non-atomic manner.
 
void * common_setup (void)
 
 ZTEST_SUITE (atomic, NULL, common_setup, NULL, NULL, NULL)
 

Variables

static struct k_thread thread [2]
 
atomic_t total_atomic
 

Macro Definition Documentation

◆ ATOMIC_WORD

#define ATOMIC_WORD ( val_if_64,
val_if_32 )
Value:
((atomic_t)((sizeof(void *) == sizeof(uint64_t)) ? (val_if_64) : (val_if_32)))
long atomic_t
Definition atomic_types.h:15
__UINT64_TYPE__ uint64_t
Definition stdint.h:91

◆ NUM_FLAG_BITS

#define NUM_FLAG_BITS   100

◆ STACK_SIZE

#define STACK_SIZE   (512 + CONFIG_TEST_EXTRA_STACK_SIZE)

◆ TEST_CYCLE

#define TEST_CYCLE   20

◆ THREADS_NUM

#define THREADS_NUM   2

Function Documentation

◆ common_setup()

void * common_setup ( void )
extern

◆ K_THREAD_STACK_ARRAY_DEFINE()

static K_THREAD_STACK_ARRAY_DEFINE ( stack ,
2 ,
(512+CONFIG_TEST_EXTRA_STACK_SIZE)  )
static

◆ ZTEST_SUITE()

ZTEST_SUITE ( atomic ,
NULL ,
common_setup ,
NULL ,
NULL ,
NULL  )

Variable Documentation

◆ thread

struct k_thread thread[2]
static

◆ total_atomic

atomic_t total_atomic