Zephyr Project API 3.7.0-rc1
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
main.c File Reference
#include <zephyr/toolchain.h>
#include <zephyr/ztest.h>

Data Structures

struct  test_running_cancel_timer
 
struct  test_drain_wait_timer
 
struct  state_1cpu_basic_schedule_running
 

Macros

#define STACK_SIZE   (1024 + CONFIG_TEST_EXTRA_STACK_SIZE)
 
#define COOPHI_PRIORITY   K_PRIO_COOP(0) /* = -4 */
 
#define COOPLO_PRIORITY   K_PRIO_COOP(3) /* = -1 */
 
#define PREEMPT_PRIORITY   K_PRIO_PREEMPT(1) /* = 1 */
 
#define DELAY_MS   100
 
#define DELAY_TIMEOUT   K_MSEC(DELAY_MS)
 

Functions

static K_THREAD_STACK_DEFINE (coophi_stack,(1024+CONFIG_TEST_EXTRA_STACK_SIZE))
 
static int coophi_counter (void)
 
static K_THREAD_STACK_DEFINE (cooplo_stack,(1024+CONFIG_TEST_EXTRA_STACK_SIZE))
 
static int cooplo_counter (void)
 
static int coop_counter (struct k_work_q *wq)
 
static K_THREAD_STACK_DEFINE (preempt_stack,(1024+CONFIG_TEST_EXTRA_STACK_SIZE))
 
static int preempt_counter (void)
 
static K_THREAD_STACK_DEFINE (invalid_test_stack,(1024+CONFIG_TEST_EXTRA_STACK_SIZE))
 
static int system_counter (void)
 
static void reset_counters (void)
 
static void counter_handler (struct k_work *work)
 
static void handler_release (void)
 
static void async_release_cb (struct k_timer *timer)
 
static K_TIMER_DEFINE (async_releaser, async_release_cb, NULL)
 
static void async_release (void)
 
static void rel_handler (struct k_work *work)
 
static void delay_handler (struct k_work *work)
 
static void test_work_init (void)
 
static void test_delayable_init (void)
 
 ZTEST (work, test_unstarted)
 
static void test_queue_start (void)
 
 ZTEST (work, test_null_queue)
 
 ZTEST (work_1cpu, test_1cpu_simple_queue)
 
 ZTEST (work, test_smp_simple_queue)
 
 ZTEST (work_1cpu, test_1cpu_sync_queue)
 
 ZTEST (work_1cpu, test_1cpu_reentrant_queue)
 
 ZTEST (work_1cpu, test_1cpu_queued_flush)
 
 ZTEST (work_1cpu, test_1cpu_running_flush)
 
 ZTEST (work_1cpu, test_1cpu_delayed_flush)
 
 ZTEST (work_1cpu, test_1cpu_queued_cancel)
 
 ZTEST (work_1cpu, test_1cpu_queued_cancel_sync)
 
 ZTEST (work_1cpu, test_1cpu_delayed_cancel)
 
 ZTEST (work_1cpu, test_1cpu_delayed_cancel_sync)
 
 ZTEST (work_1cpu, test_1cpu_delayed_cancel_sync_wait)
 
static void test_running_cancel_cb (struct k_timer *timer)
 
 ZTEST (work_1cpu, test_1cpu_running_cancel)
 
 ZTEST (work_1cpu, test_1cpu_running_cancel_sync)
 
 ZTEST (work, test_smp_running_cancel)
 
 ZTEST (work, test_drain_empty)
 
static void test_drain_wait_cb (struct k_timer *timer)
 
 ZTEST (work_1cpu, test_1cpu_drain_wait)
 
 ZTEST (work_1cpu, test_1cpu_plugged_drain)
 
 ZTEST (work_1cpu, test_1cpu_basic_schedule)
 
static void handle_1cpu_basic_schedule_running (struct k_work *work)
 
 ZTEST (work_1cpu, test_1cpu_basic_schedule_running)
 
 ZTEST (work_1cpu, test_1cpu_immed_schedule)
 
 ZTEST (work_1cpu, test_1cpu_basic_reschedule)
 
 ZTEST (work_1cpu, test_1cpu_immed_reschedule)
 
static bool try_queue_no_yield (struct k_work_q *wq)
 
 ZTEST (work_1cpu, test_1cpu_queue_no_yield)
 
 ZTEST (work_1cpu, test_1cpu_system_queue)
 
 ZTEST (work_1cpu, test_1cpu_system_schedule)
 
 ZTEST (work_1cpu, test_1cpu_system_reschedule)
 
 ZTEST (work, test_nop)
 
void * workq_setup (void)
 
 ZTEST_SUITE (work_1cpu, NULL, workq_setup, ztest_simple_1cpu_before, ztest_simple_1cpu_after, NULL)
 
 ZTEST_SUITE (work, NULL, workq_setup, NULL, NULL, NULL)
 

Variables

static struct k_sem sync_sem
 
static bool run_flag = true
 
static struct k_sem rel_sem
 
static struct k_work common_work
 
static struct k_work common_work1
 
static struct k_work_delayable dwork
 
static struct k_work_sync work_sync
 
static struct k_threadmain_thread
 
static atomic_t resubmits_left
 
static uint32_t volatile last_handle_ms
 
static struct k_work_q coophi_queue
 
static struct k_work_q not_start_queue
 
static atomic_t coophi_ctr
 
static struct k_work_q cooplo_queue
 
static atomic_t cooplo_ctr
 
static struct k_work_q preempt_queue
 
static atomic_t preempt_ctr
 
static struct k_work_q invalid_test_queue
 
static atomic_t system_ctr
 
static struct test_running_cancel_timer test_running_cancel_ctx
 
static struct test_drain_wait_timer test_drain_wait_ctx
 

Macro Definition Documentation

◆ COOPHI_PRIORITY

#define COOPHI_PRIORITY   K_PRIO_COOP(0) /* = -4 */

◆ COOPLO_PRIORITY

#define COOPLO_PRIORITY   K_PRIO_COOP(3) /* = -1 */

◆ DELAY_MS

#define DELAY_MS   100

◆ DELAY_TIMEOUT

#define DELAY_TIMEOUT   K_MSEC(DELAY_MS)

◆ PREEMPT_PRIORITY

#define PREEMPT_PRIORITY   K_PRIO_PREEMPT(1) /* = 1 */

◆ STACK_SIZE

#define STACK_SIZE   (1024 + CONFIG_TEST_EXTRA_STACK_SIZE)

Function Documentation

◆ async_release()

static void async_release ( void  )
inlinestatic

◆ async_release_cb()

static void async_release_cb ( struct k_timer *  timer)
static

◆ coop_counter()

static int coop_counter ( struct k_work_q wq)
inlinestatic

◆ coophi_counter()

static int coophi_counter ( void  )
inlinestatic

◆ cooplo_counter()

static int cooplo_counter ( void  )
inlinestatic

◆ counter_handler()

static void counter_handler ( struct k_work work)
static

◆ delay_handler()

static void delay_handler ( struct k_work work)
static

◆ handle_1cpu_basic_schedule_running()

static void handle_1cpu_basic_schedule_running ( struct k_work work)
static

◆ handler_release()

static void handler_release ( void  )
inlinestatic

◆ K_THREAD_STACK_DEFINE() [1/4]

static K_THREAD_STACK_DEFINE ( coophi_stack  ,
(1024+CONFIG_TEST_EXTRA_STACK_SIZE)   
)
static

◆ K_THREAD_STACK_DEFINE() [2/4]

static K_THREAD_STACK_DEFINE ( cooplo_stack  ,
(1024+CONFIG_TEST_EXTRA_STACK_SIZE)   
)
static

◆ K_THREAD_STACK_DEFINE() [3/4]

static K_THREAD_STACK_DEFINE ( invalid_test_stack  ,
(1024+CONFIG_TEST_EXTRA_STACK_SIZE)   
)
static

◆ K_THREAD_STACK_DEFINE() [4/4]

static K_THREAD_STACK_DEFINE ( preempt_stack  ,
(1024+CONFIG_TEST_EXTRA_STACK_SIZE)   
)
static

◆ K_TIMER_DEFINE()

static K_TIMER_DEFINE ( async_releaser  ,
async_release_cb  ,
NULL   
)
static

◆ preempt_counter()

static int preempt_counter ( void  )
inlinestatic

◆ rel_handler()

static void rel_handler ( struct k_work work)
static

◆ reset_counters()

static void reset_counters ( void  )
inlinestatic

◆ system_counter()

static int system_counter ( void  )
inlinestatic

◆ test_delayable_init()

static void test_delayable_init ( void  )
static

◆ test_drain_wait_cb()

static void test_drain_wait_cb ( struct k_timer *  timer)
static

◆ test_queue_start()

static void test_queue_start ( void  )
static

◆ test_running_cancel_cb()

static void test_running_cancel_cb ( struct k_timer *  timer)
static

◆ test_work_init()

static void test_work_init ( void  )
static

◆ try_queue_no_yield()

static bool try_queue_no_yield ( struct k_work_q wq)
static

◆ workq_setup()

void * workq_setup ( void  )

◆ ZTEST() [1/30]

ZTEST ( work  ,
test_drain_empty   
)

◆ ZTEST() [2/30]

ZTEST ( work  ,
test_nop   
)

◆ ZTEST() [3/30]

ZTEST ( work  ,
test_null_queue   
)

◆ ZTEST() [4/30]

ZTEST ( work  ,
test_smp_running_cancel   
)

◆ ZTEST() [5/30]

ZTEST ( work  ,
test_smp_simple_queue   
)

◆ ZTEST() [6/30]

ZTEST ( work  ,
test_unstarted   
)

◆ ZTEST() [7/30]

ZTEST ( work_1cpu  ,
test_1cpu_basic_reschedule   
)

◆ ZTEST() [8/30]

ZTEST ( work_1cpu  ,
test_1cpu_basic_schedule   
)

◆ ZTEST() [9/30]

ZTEST ( work_1cpu  ,
test_1cpu_basic_schedule_running   
)

◆ ZTEST() [10/30]

ZTEST ( work_1cpu  ,
test_1cpu_delayed_cancel   
)

◆ ZTEST() [11/30]

ZTEST ( work_1cpu  ,
test_1cpu_delayed_cancel_sync   
)

◆ ZTEST() [12/30]

ZTEST ( work_1cpu  ,
test_1cpu_delayed_cancel_sync_wait   
)

◆ ZTEST() [13/30]

ZTEST ( work_1cpu  ,
test_1cpu_delayed_flush   
)

◆ ZTEST() [14/30]

ZTEST ( work_1cpu  ,
test_1cpu_drain_wait   
)

◆ ZTEST() [15/30]

ZTEST ( work_1cpu  ,
test_1cpu_immed_reschedule   
)

◆ ZTEST() [16/30]

ZTEST ( work_1cpu  ,
test_1cpu_immed_schedule   
)

◆ ZTEST() [17/30]

ZTEST ( work_1cpu  ,
test_1cpu_plugged_drain   
)

◆ ZTEST() [18/30]

ZTEST ( work_1cpu  ,
test_1cpu_queue_no_yield   
)

◆ ZTEST() [19/30]

ZTEST ( work_1cpu  ,
test_1cpu_queued_cancel   
)

◆ ZTEST() [20/30]

ZTEST ( work_1cpu  ,
test_1cpu_queued_cancel_sync   
)

◆ ZTEST() [21/30]

ZTEST ( work_1cpu  ,
test_1cpu_queued_flush   
)

◆ ZTEST() [22/30]

ZTEST ( work_1cpu  ,
test_1cpu_reentrant_queue   
)

◆ ZTEST() [23/30]

ZTEST ( work_1cpu  ,
test_1cpu_running_cancel   
)

◆ ZTEST() [24/30]

ZTEST ( work_1cpu  ,
test_1cpu_running_cancel_sync   
)

◆ ZTEST() [25/30]

ZTEST ( work_1cpu  ,
test_1cpu_running_flush   
)

◆ ZTEST() [26/30]

ZTEST ( work_1cpu  ,
test_1cpu_simple_queue   
)

◆ ZTEST() [27/30]

ZTEST ( work_1cpu  ,
test_1cpu_sync_queue   
)

◆ ZTEST() [28/30]

ZTEST ( work_1cpu  ,
test_1cpu_system_queue   
)

◆ ZTEST() [29/30]

ZTEST ( work_1cpu  ,
test_1cpu_system_reschedule   
)

◆ ZTEST() [30/30]

ZTEST ( work_1cpu  ,
test_1cpu_system_schedule   
)

◆ ZTEST_SUITE() [1/2]

ZTEST_SUITE ( work  ,
NULL  ,
workq_setup  ,
NULL  ,
NULL  ,
NULL   
)

◆ ZTEST_SUITE() [2/2]

ZTEST_SUITE ( work_1cpu  ,
NULL  ,
workq_setup  ,
ztest_simple_1cpu_before  ,
ztest_simple_1cpu_after  ,
NULL   
)

Variable Documentation

◆ common_work

struct k_work common_work
static

◆ common_work1

struct k_work common_work1
static

◆ coophi_ctr

atomic_t coophi_ctr
static

◆ coophi_queue

struct k_work_q coophi_queue
static

◆ cooplo_ctr

atomic_t cooplo_ctr
static

◆ cooplo_queue

struct k_work_q cooplo_queue
static

◆ dwork

struct k_work_delayable dwork
static

◆ invalid_test_queue

struct k_work_q invalid_test_queue
static

◆ last_handle_ms

uint32_t volatile last_handle_ms
static

◆ main_thread

struct k_thread* main_thread
static

◆ not_start_queue

struct k_work_q not_start_queue
static

◆ preempt_ctr

atomic_t preempt_ctr
static

◆ preempt_queue

struct k_work_q preempt_queue
static

◆ rel_sem

struct k_sem rel_sem
static

◆ resubmits_left

atomic_t resubmits_left
static

◆ run_flag

bool run_flag = true
static

◆ sync_sem

struct k_sem sync_sem
static

◆ system_ctr

atomic_t system_ctr
static

◆ test_drain_wait_ctx

struct test_drain_wait_timer test_drain_wait_ctx
static

◆ test_running_cancel_ctx

struct test_running_cancel_timer test_running_cancel_ctx
static

◆ work_sync

struct k_work_sync work_sync
static