Zephyr API Documentation
2.7.0-rc2
A Scalable Open Source RTOS
|
Data Structures | |
struct | timeout_info |
Macros | |
#define | SEM_INIT_VAL (0U) |
#define | SEM_MAX_VAL (10U) |
#define | THREAD_TEST_PRIORITY 0 |
#define | sem_give_from_isr(sema) irq_offload(isr_sem_give, (const void *)sema) |
#define | sem_take_from_isr(sema) irq_offload(isr_sem_take, (const void *)sema) |
#define | SEM_TIMEOUT (K_MSEC(100)) |
#define | STACK_SIZE (512 + CONFIG_TEST_EXTRA_STACKSIZE) |
#define | TOTAL_THREADS_WAITING (5) |
#define | SEC2MS(s) ((s) * 1000) |
#define | QSEC2MS(s) ((s) * 250) |
#define | expect_k_sem_take(sem, timeout, exp, str) |
#define | expect_k_sem_init(sem, init, max, exp, str) |
#define | expect_k_sem_count_get(sem, exp, str) |
#define | expect_k_sem_take_nomsg(sem, timeout, exp) expect_k_sem_take((sem), (timeout), (exp), "k_sem_take incorrect return value: %d != %d") |
#define | expect_k_sem_init_nomsg(sem, init, max, exp) |
#define | expect_k_sem_count_get_nomsg(sem, exp) expect_k_sem_count_get((sem), (exp), "k_sem_count_get incorrect return value: %u != %u") |
Variables | |
uint32_t | critical_var |
struct k_thread sem_tid_1 sem_tid_2 sem_tid_3 | sem_tid_4 |
struct k_thread | multiple_tid [(5)] |
struct k_sem sema | mut_sem |
struct k_thread | tdata |
#define expect_k_sem_count_get | ( | sem, | |
exp, | |||
str | |||
) |
#define expect_k_sem_count_get_nomsg | ( | sem, | |
exp | |||
) | expect_k_sem_count_get((sem), (exp), "k_sem_count_get incorrect return value: %u != %u") |
#define expect_k_sem_init | ( | sem, | |
init, | |||
max, | |||
exp, | |||
str | |||
) |
#define expect_k_sem_init_nomsg | ( | sem, | |
init, | |||
max, | |||
exp | |||
) |
#define expect_k_sem_take_nomsg | ( | sem, | |
timeout, | |||
exp | |||
) | expect_k_sem_take((sem), (timeout), (exp), "k_sem_take incorrect return value: %d != %d") |
#define sem_give_from_isr | ( | sema | ) | irq_offload(isr_sem_give, (const void *)sema) |
#define SEM_INIT_VAL (0U) |
#define SEM_MAX_VAL (10U) |
#define sem_take_from_isr | ( | sema | ) | irq_offload(isr_sem_take, (const void *)sema) |
#define SEM_TIMEOUT (K_MSEC(100)) |
#define STACK_SIZE (512 + CONFIG_TEST_EXTRA_STACKSIZE) |
#define THREAD_TEST_PRIORITY 0 |
#define TOTAL_THREADS_WAITING (5) |
K_PIPE_DEFINE | ( | timeout_info_pipe | , |
sizeof(struct timeout_info) *(5) | , | ||
4 | |||
) |
K_SEM_DEFINE | ( | high_prio_long_sem | , |
(0U) | , | ||
(10U) | |||
) |
K_SEM_DEFINE | ( | high_prio_sem | , |
(0U) | , | ||
(10U) | |||
) |
K_SEM_DEFINE | ( | ksema | , |
(0U) | , | ||
(10U) | |||
) |
K_SEM_DEFINE | ( | low_prio_sem | , |
(0U) | , | ||
(10U) | |||
) |
K_SEM_DEFINE | ( | mid_prio_sem | , |
(0U) | , | ||
(10U) | |||
) |
K_SEM_DEFINE | ( | multiple_thread_sem | , |
(0U) | , | ||
(10U) | |||
) |
K_SEM_DEFINE | ( | simple_sem | , |
(0U) | , | ||
(10U) | |||
) |
K_THREAD_STACK_ARRAY_DEFINE | ( | multiple_stack | , |
(5) | , | ||
(512+CONFIG_TEST_EXTRA_STACKSIZE) | |||
) |
K_THREAD_STACK_DEFINE | ( | stack_1 | , |
(512+CONFIG_TEST_EXTRA_STACKSIZE) | |||
) |
K_THREAD_STACK_DEFINE | ( | stack_2 | , |
(512+CONFIG_TEST_EXTRA_STACKSIZE) | |||
) |
K_THREAD_STACK_DEFINE | ( | stack_3 | , |
(512+CONFIG_TEST_EXTRA_STACKSIZE) | |||
) |
K_THREAD_STACK_DEFINE | ( | stack_4 | , |
(512+CONFIG_TEST_EXTRA_STACKSIZE) | |||
) |
|
static |
Test the max value a semaphore can be given and taken.
Test semaphore defined at compile time.
Test semaphore initialization at running time.
Test k_sem_count_get() API.
TESTPOINT: semaphore count get upon init
TESTPOINT: sem count get after give
TESTPOINT: sem count get after take
TESTPOINT: semaphore give above limit
Test k_sem_count_get() API.
Create a thread and set k_sem_count_get() input to NULL
Test whether a semaphore can be given by an ISR.
Test semaphore count when given by thread.
Test semaphore give and take and its count from ISR.
Test timeout of semaphore from thread.
Test semaphore timeout period.
Test sequence of multiple semaphore timeouts.
Test multiple semaphore take with timeouts.
Test multiple semaphore take and give with wait.
Test thread mutual exclusion by semaphore.
Test is using to see how mutual exclusion is made by semaphore Made two threads, with two functions which use common variable. That variable is a critical section and can't be changed by two threads at the same time.
Test k_sem_reset() API.
TESTPOINT: semaphore take return -EBUSY
TESTPOINT: semaphore take return -EAGAIN
Test semaphore take operation by multiple threads.
Test if k_sem_take() decreases semaphore count.
Test k_sem_take() when there is no semaphore to take.
Test the semaphore take operation with specified timeout.
Test a semaphore take operation with an unavailable semaphore.
Test the semaphore take operation with forever wait.
Test k_sem_take() with timeout in ISR context.
Test synchronization between thread and irq.
TESTPOINT: test k_sem_init sema
TESTPOINT: test K_SEM_DEFINE sema
Test synchronization of threads with semaphore.
TESTPOINT: test k_sem_init sema
TESTPOINT: test K_SEM_DEFINE sema
|
static |
TESTPOINT: thread-isr sync via sema
|
static |
TESTPOINT: thread-thread sync via sema
uint32_t critical_var |
struct k_thread multiple_tid[(5)] |
struct k_sem sema mut_sem |
struct k_thread tdata |