Zephyr Project API 3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
main.c File Reference

Macros

#define DELAY   K_MSEC(50)
 
#define SHORT_TIMEOUT   K_MSEC(100)
 
#define LONG_TIMEOUT   K_MSEC(1000)
 
#define STACK_SIZE   (512 + CONFIG_TEST_EXTRA_STACK_SIZE)
 

Functions

static K_THREAD_STACK_DEFINE (sreceiver,(512+CONFIG_TEST_EXTRA_STACK_SIZE))
 
static K_THREAD_STACK_DEFINE (sextra1,(512+CONFIG_TEST_EXTRA_STACK_SIZE))
 
static K_THREAD_STACK_DEFINE (sextra2,(512+CONFIG_TEST_EXTRA_STACK_SIZE))
 
static K_EVENT_DEFINE (test_event)
 
static K_EVENT_DEFINE (sync_event)
 
static K_SEM_DEFINE (receiver_sem, 0, 1)
 
static K_SEM_DEFINE (sync_sem, 0, 1)
 
static void entry_extra1 (void *p1, void *p2, void *p3)
 
static void entry_extra2 (void *p1, void *p2, void *p3)
 
 ZTEST (sys_events, test_k_event_init)
 Test the k_event_init() API.
 
static void receive_existing_events (void)
 
static void reset_on_receive (void)
 
static void receiver (void *p1, void *p2, void *p3)
 receiver helper task
 
static void test_receive_existing_events (void)
 Works with receive_existing_events() to test the waiting for events when some events have already been sent.
 
static void test_reset_on_receive (void)
 Works with reset_on_receive() to verify that the events stored in the event object are reset at the appropriate times.
 
void test_wake_multiple_threads (void)
 
 ZTEST (sys_events, test_event_deliver)
 Test basic k_event_post() and k_event_set() APIs.
 
 ZTEST (sys_events, test_event_receive)
 Test delivery and reception of events.
 
void * sys_events_setup (void)
 
 ZTEST_SUITE (sys_events, NULL, sys_events_setup, ztest_simple_1cpu_before, ztest_simple_1cpu_after, NULL)
 

Variables

static struct k_thread treceiver
 
static struct k_thread textra1
 
static struct k_thread textra2
 
static struct k_event init_event
 
static struct k_event deliver_event
 
static volatile uint32_t test_events
 

Macro Definition Documentation

◆ DELAY

#define DELAY   K_MSEC(50)

◆ LONG_TIMEOUT

#define LONG_TIMEOUT   K_MSEC(1000)

◆ SHORT_TIMEOUT

#define SHORT_TIMEOUT   K_MSEC(100)

◆ STACK_SIZE

#define STACK_SIZE   (512 + CONFIG_TEST_EXTRA_STACK_SIZE)

Function Documentation

◆ entry_extra1()

static void entry_extra1 ( void *  p1,
void *  p2,
void *  p3 
)
static

◆ entry_extra2()

static void entry_extra2 ( void *  p1,
void *  p2,
void *  p3 
)
static

◆ K_EVENT_DEFINE() [1/2]

static K_EVENT_DEFINE ( sync_event  )
static

◆ K_EVENT_DEFINE() [2/2]

static K_EVENT_DEFINE ( test_event  )
static

◆ K_SEM_DEFINE() [1/2]

static K_SEM_DEFINE ( receiver_sem  ,
,
 
)
static

◆ K_SEM_DEFINE() [2/2]

static K_SEM_DEFINE ( sync_sem  ,
,
 
)
static

◆ K_THREAD_STACK_DEFINE() [1/3]

static K_THREAD_STACK_DEFINE ( sextra1  ,
(512+CONFIG_TEST_EXTRA_STACK_SIZE)   
)
static

◆ K_THREAD_STACK_DEFINE() [2/3]

static K_THREAD_STACK_DEFINE ( sextra2  ,
(512+CONFIG_TEST_EXTRA_STACK_SIZE)   
)
static

◆ K_THREAD_STACK_DEFINE() [3/3]

static K_THREAD_STACK_DEFINE ( sreceiver  ,
(512+CONFIG_TEST_EXTRA_STACK_SIZE)   
)
static

◆ receive_existing_events()

static void receive_existing_events ( void  )
static

◆ receiver()

static void receiver ( void *  p1,
void *  p2,
void *  p3 
)
static

receiver helper task

◆ reset_on_receive()

static void reset_on_receive ( void  )
static

◆ sys_events_setup()

void * sys_events_setup ( void  )

◆ test_receive_existing_events()

static void test_receive_existing_events ( void  )
static

Works with receive_existing_events() to test the waiting for events when some events have already been sent.

No additional events are sent to the event object during this block of testing.

◆ test_reset_on_receive()

static void test_reset_on_receive ( void  )
static

Works with reset_on_receive() to verify that the events stored in the event object are reset at the appropriate times.

◆ test_wake_multiple_threads()

void test_wake_multiple_threads ( void  )

◆ ZTEST() [1/3]

ZTEST ( sys_events  ,
test_event_deliver   
)

Test basic k_event_post() and k_event_set() APIs.

Tests the basic k_event_post() and k_event_set() API. This does not involve waking or receiving events.

◆ ZTEST() [2/3]

ZTEST ( sys_events  ,
test_event_receive   
)

Test delivery and reception of events.

Testing both the delivery and reception of events involves the use of multiple threads and uses the following event related APIs: k_event_post(), k_event_set(), k_event_wait() and k_event_wait_all().

◆ ZTEST() [3/3]

ZTEST ( sys_events  ,
test_k_event_init   
)

Test the k_event_init() API.

This is a white-box test to verify that the k_event_init() API initializes the fields of a k_event structure as expected.

◆ ZTEST_SUITE()

ZTEST_SUITE ( sys_events  ,
NULL  ,
sys_events_setup  ,
ztest_simple_1cpu_before  ,
ztest_simple_1cpu_after  ,
NULL   
)

Variable Documentation

◆ deliver_event

struct k_event deliver_event
static

◆ init_event

struct k_event init_event
static

◆ test_events

volatile uint32_t test_events
static

◆ textra1

struct k_thread textra1
static

◆ textra2

struct k_thread textra2
static

◆ treceiver

struct k_thread treceiver
static