Zephyr Project
A Scalable Open Source RTOS for IoT Embedded Devices
main.c File Reference
#include <stdbool.h>
#include <toolchain.h>
#include <zephyr.h>
#include <ztest.h>
#include <tc_util.h>
#include <sys/util.h>

Data Structures

struct  delayed_test_item
 
struct  triggered_test_item
 

Macros

#define NUM_TEST_ITEMS   6
 
#define WORK_ITEM_WAIT   100
 
#define WORK_ITEM_WAIT_ALIGNED   k_ticks_to_ms_floor64(k_ms_to_ticks_ceil32(WORK_ITEM_WAIT) + _TICK_ALIGN)
 
#define SUBMIT_WAIT   50
 
#define STACK_SIZE   (1024 + CONFIG_TEST_EXTRA_STACKSIZE)
 
#define CHECK_WAIT   ((NUM_TEST_ITEMS + 1) * WORK_ITEM_WAIT_ALIGNED)
 

Functions

static K_THREAD_STACK_DEFINE (co_op_stack,(1024+CONFIG_TEST_EXTRA_STACKSIZE))
 
static void work_handler (struct k_work *work)
 
static void delayed_test_items_init (void)
 
static void reset_results (void)
 
static void coop_work_main (int arg1, int arg2)
 
static void delayed_test_items_submit (void)
 
static void check_results (int num_tests)
 
static void test_sequence (void)
 Test work queue items submission sequence. More...
 
static void resubmit_work_handler (struct k_work *work)
 
static void test_resubmit (void)
 Test work queue item resubmission. More...
 
static void delayed_work_handler (struct k_work *work)
 
static void test_delayed_init (void)
 Test delayed work queue init. More...
 
static void coop_delayed_work_main (int arg1, int arg2)
 
static void test_delayed_submit (void)
 Test delayed workqueue submit. More...
 
static void coop_delayed_work_cancel_main (int arg1, int arg2)
 
static void test_delayed_cancel (void)
 Test work queue delayed cancel. More...
 
static void test_delayed_pending (void)
 
static void test_delayed (void)
 Test delayed work items. More...
 
static void triggered_work_handler (struct k_work *work)
 
static void test_triggered_init (void)
 Test triggered work queue init. More...
 
static void test_triggered_submit (k_timeout_t timeout)
 Test triggered workqueue submit. More...
 
static void test_triggered_trigger (void)
 Trigger triggered workqueue execution. More...
 
static void test_triggered (void)
 Test triggered work items. More...
 
static void test_already_triggered (void)
 Test already triggered work items. More...
 
static void triggered_resubmit_work_handler (struct k_work *work)
 
static void test_triggered_resubmit (void)
 Test resubmission of triggered work queue item. More...
 
static void test_triggered_no_wait (void)
 Test triggered work items with K_NO_WAIT timeout. More...
 
static void test_triggered_no_wait_expired (void)
 Test expired triggered work items with K_NO_WAIT timeout. More...
 
static void test_triggered_wait (void)
 Test triggered work items with arbitrary timeout. More...
 
static void test_triggered_wait_expired (void)
 Test expired triggered work items with arbitrary timeout. More...
 
void test_delayed_work_define (void)
 Test delayed work queue define macro. More...
 
void test_main (void)
 

Variables

static struct k_thread co_op_data
 
static struct delayed_test_item delayed_tests [6]
 
static struct triggered_test_item triggered_tests [6]
 
static int results [6]
 
static int num_results
 
static int expected_poll_result
 

Macro Definition Documentation

◆ CHECK_WAIT

#define CHECK_WAIT   ((NUM_TEST_ITEMS + 1) * WORK_ITEM_WAIT_ALIGNED)

◆ NUM_TEST_ITEMS

#define NUM_TEST_ITEMS   6

◆ STACK_SIZE

#define STACK_SIZE   (1024 + CONFIG_TEST_EXTRA_STACKSIZE)

◆ SUBMIT_WAIT

#define SUBMIT_WAIT   50

◆ WORK_ITEM_WAIT

#define WORK_ITEM_WAIT   100

◆ WORK_ITEM_WAIT_ALIGNED

#define WORK_ITEM_WAIT_ALIGNED   k_ticks_to_ms_floor64(k_ms_to_ticks_ceil32(WORK_ITEM_WAIT) + _TICK_ALIGN)

Function Documentation

◆ check_results()

static void check_results ( int  num_tests)
static

◆ coop_delayed_work_cancel_main()

static void coop_delayed_work_cancel_main ( int  arg1,
int  arg2 
)
static

◆ coop_delayed_work_main()

static void coop_delayed_work_main ( int  arg1,
int  arg2 
)
static

◆ coop_work_main()

static void coop_work_main ( int  arg1,
int  arg2 
)
static

◆ delayed_work_handler()

static void delayed_work_handler ( struct k_work work)
static

◆ K_THREAD_STACK_DEFINE()

static K_THREAD_STACK_DEFINE ( co_op_stack  ,
(1024+CONFIG_TEST_EXTRA_STACKSIZE)   
)
static

◆ reset_results()

static void reset_results ( void  )
static

◆ resubmit_work_handler()

static void resubmit_work_handler ( struct k_work work)
static

◆ test_delayed_pending()

static void test_delayed_pending ( void  )
static

◆ test_main()

void test_main ( void  )

test case main entry

◆ triggered_resubmit_work_handler()

static void triggered_resubmit_work_handler ( struct k_work work)
static

◆ triggered_work_handler()

static void triggered_work_handler ( struct k_work work)
static

◆ work_handler()

static void work_handler ( struct k_work work)
static

Variable Documentation

◆ co_op_data

struct k_thread co_op_data
static

◆ delayed_tests

struct delayed_test_item delayed_tests[6]
static

◆ expected_poll_result

int expected_poll_result
static

◆ num_results

int num_results
static

◆ results

int results[6]
static

◆ triggered_tests

struct triggered_test_item triggered_tests[6]
static