Zephyr API Documentation
2.7.0-rc2
A Scalable Open Source RTOS
|
Offload to the Kernel workqueue. More...
Macros | |
#define | NUM_MILLISECONDS 50 |
#define | TEST_TIMEOUT 200 |
#define | OFFLOAD_WORKQUEUE_STACK_SIZE 1024 |
#define | STACK_SIZE (1024 + CONFIG_TEST_EXTRA_STACKSIZE) |
Functions | |
static | K_THREAD_STACK_DEFINE (offload_work_q_stack, 1024) |
static | K_THREAD_STACK_DEFINE (stack1,(1024+CONFIG_TEST_EXTRA_STACKSIZE)) |
static | K_THREAD_STACK_DEFINE (stack2,(1024+CONFIG_TEST_EXTRA_STACKSIZE)) |
K_SEM_DEFINE (ALT_SEM, 0, UINT_MAX) | |
K_SEM_DEFINE (REGRESS_SEM, 0, UINT_MAX) | |
K_SEM_DEFINE (TEST_SEM, 0, UINT_MAX) | |
void | critical_rtn (struct k_work *unused) |
Routine to be called from a workqueue. More... | |
uint32_t | critical_loop (const char *tag, uint32_t count) |
Common code for invoking work. More... | |
void | alternate_thread (void *arg1, void *arg2, void *arg3) |
Alternate thread. More... | |
void | regression_thread (void *arg1, void *arg2, void *arg3) |
Regression thread. More... | |
void | test_offload_workqueue (void) |
Verify thread context. More... | |
void | test_main (void) |
Variables | |
static uint32_t | critical_var |
static uint32_t | alt_thread_iterations |
static struct k_work_q | offload_work_q |
static struct k_thread | thread1 |
static struct k_thread | thread2 |
Offload to the Kernel workqueue.
This test verifies that the kernel workqueue operates as expected.
This test has two threads that increment a counter. The routine that increments the counter is invoked from workqueue due to the two threads calling using it. The final result of the counter is expected to be the the number of times work item was called to increment the counter.
This is done with time slicing both disabled and enabled to ensure that the result always matches the number of times the workqueue is called.
#define NUM_MILLISECONDS 50 |
#define OFFLOAD_WORKQUEUE_STACK_SIZE 1024 |
#define STACK_SIZE (1024 + CONFIG_TEST_EXTRA_STACKSIZE) |
#define TEST_TIMEOUT 200 |
Alternate thread.
This routine invokes the workqueue many times.
Common code for invoking work.
tag | text identifying the invocation context |
count | number of critical section calls made thus far |
Routine to be called from a workqueue.
This routine increments the global variable critical_var.
K_SEM_DEFINE | ( | ALT_SEM | , |
0 | , | ||
UINT_MAX | |||
) |
K_SEM_DEFINE | ( | REGRESS_SEM | , |
0 | , | ||
UINT_MAX | |||
) |
K_SEM_DEFINE | ( | TEST_SEM | , |
0 | , | ||
UINT_MAX | |||
) |
|
static |
|
static |
|
static |
Regression thread.
This routine invokes the workqueue many times. It also checks to ensure that the number of times it is called matches the global variable critical_var.
|
static |
|
static |
|
static |
|
static |
|
static |