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

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_STACK_SIZE)
 
#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")
 

Functions

 K_SEM_DEFINE (statically_defined_sem,(0U),(10U))
 
 K_SEM_DEFINE (simple_sem,(0U),(10U))
 
 K_SEM_DEFINE (low_prio_sem,(0U),(10U))
 
 K_SEM_DEFINE (mid_prio_sem,(0U),(10U))
 
 K_SEM_DEFINE (high_prio_long_sem,(0U),(10U))
 
 K_SEM_DEFINE (high_prio_sem,(0U),(10U))
 
 K_SEM_DEFINE (multiple_thread_sem,(0U),(10U))
 
 K_THREAD_STACK_DEFINE (stack_1,(512+CONFIG_TEST_EXTRA_STACK_SIZE))
 
 K_THREAD_STACK_DEFINE (stack_2,(512+CONFIG_TEST_EXTRA_STACK_SIZE))
 
 K_THREAD_STACK_DEFINE (stack_3,(512+CONFIG_TEST_EXTRA_STACK_SIZE))
 
 K_THREAD_STACK_DEFINE (stack_4,(512+CONFIG_TEST_EXTRA_STACK_SIZE))
 
 K_THREAD_STACK_ARRAY_DEFINE (multiple_stack,(5),(512+CONFIG_TEST_EXTRA_STACK_SIZE))
 
 K_PIPE_DEFINE (timeout_info_pipe, sizeof(struct timeout_info) *(5), 4)
 
 K_SEM_DEFINE (ksema,(0U),(10U))
 
static K_THREAD_STACK_DEFINE (tstack,(512+CONFIG_TEST_EXTRA_STACK_SIZE))
 
void sem_give_task (void *p1, void *p2, void *p3)
 
void sem_reset_take_task (void *p1, void *p2, void *p3)
 
void isr_sem_give (const void *semaphore)
 
static void tsema_thread_thread (struct k_sem *psem)
 
static void tsema_thread_isr (struct k_sem *psem)
 
void isr_sem_take (const void *semaphore)
 
void sem_take_timeout_forever_helper (void *p1, void *p2, void *p3)
 
void sem_take_timeout_isr_helper (void *p1, void *p2, void *p3)
 
void sem_take_multiple_low_prio_helper (void *p1, void *p2, void *p3)
 
void sem_take_multiple_mid_prio_helper (void *p1, void *p2, void *p3)
 
void sem_take_multiple_high_prio_helper (void *p1, void *p2, void *p3)
 
void sem_queue_mutual_exclusion1 (void *p1, void *p2, void *p3)
 
void sem_queue_mutual_exclusion2 (void *p1, void *p2, void *p3)
 
void sem_take_multiple_high_prio_long_helper (void *p1, void *p2, void *p3)
 
void sem_multiple_threads_wait_helper (void *p1, void *p2, void *p3)
 
 ZTEST (semaphore, test_sem_multiple_threads_wait)
 Test multiple semaphore take and give with wait.
 
 ZTEST (semaphore, test_sem_measure_timeouts)
 Test semaphore timeout period.
 
void sem_measure_timeout_from_thread_helper (void *p1, void *p2, void *p3)
 
 ZTEST (semaphore, test_sem_measure_timeout_from_thread)
 Test timeout of semaphore from thread.
 
void sem_multiple_take_and_timeouts_helper (void *p1, void *p2, void *p3)
 
 ZTEST (semaphore_1cpu, test_sem_multiple_take_and_timeouts)
 Test multiple semaphore take with timeouts.
 
void sem_multi_take_timeout_diff_sem_helper (void *p1, void *p2, void *p3)
 
 ZTEST (semaphore, test_sem_multi_take_timeout_diff_sem)
 Test sequence of multiple semaphore timeouts.
 
 ZTEST (semaphore_1cpu, test_sem_queue_mutual_exclusion)
 Test thread mutual exclusion by semaphore.
 
static void thread_sem_give_null (void *p1, void *p2, void *p3)
 
 ZTEST_USER (semaphore_null_case, test_sem_give_null)
 Test k_sem_give() API.
 
static void thread_sem_init_null (void *p1, void *p2, void *p3)
 
 ZTEST_USER (semaphore_null_case, test_sem_init_null)
 Test k_sem_init() API.
 
static void thread_sem_take_null (void *p1, void *p2, void *p3)
 
 ZTEST_USER (semaphore_null_case, test_sem_take_null)
 Test k_sem_take() API.
 
static void thread_sem_reset_null (void *p1, void *p2, void *p3)
 
 ZTEST_USER (semaphore_null_case, test_sem_reset_null)
 Test k_sem_reset() API.
 
static void thread_sem_count_get_null (void *p1, void *p2, void *p3)
 
 ZTEST_USER (semaphore_null_case, test_sem_count_get_null)
 Test k_sem_count_get() API.
 
void * test_init (void)
 
 ZTEST_SUITE (semaphore, NULL, test_init, NULL, NULL, NULL)
 
 ZTEST_SUITE (semaphore_1cpu, NULL, NULL, ztest_simple_1cpu_before, ztest_simple_1cpu_after, NULL)
 
 ZTEST_SUITE (semaphore_null_case, NULL, test_init, NULL, NULL, NULL)
 
 ZTEST_USER (semaphore, test_k_sem_define)
 Test semaphore defined at compile time.
 
 ZTEST_USER (semaphore, test_sem_thread2thread)
 Test synchronization of threads with semaphore.
 
 ZTEST (semaphore, test_sem_thread2isr)
 Test synchronization between thread and irq.
 
 ZTEST_USER (semaphore, test_k_sem_init)
 Test semaphore initialization at running time.
 
 ZTEST_USER (semaphore, test_sem_reset)
 Test k_sem_reset() API.
 
 ZTEST_USER (semaphore, test_sem_reset_waiting)
 
 ZTEST_USER (semaphore, test_sem_count_get)
 Test k_sem_count_get() API.
 
 ZTEST (semaphore, test_sem_give_from_isr)
 Test whether a semaphore can be given by an ISR.
 
 ZTEST_USER (semaphore, test_sem_give_from_thread)
 Test semaphore count when given by thread.
 
 ZTEST_USER (semaphore, test_sem_take_no_wait)
 Test if k_sem_take() decreases semaphore count.
 
 ZTEST_USER (semaphore, test_sem_take_no_wait_fails)
 Test k_sem_take() when there is no semaphore to take.
 
 ZTEST_USER (semaphore, test_sem_take_timeout_fails)
 Test a semaphore take operation with an unavailable semaphore.
 
 ZTEST_USER (semaphore, test_sem_take_timeout)
 Test the semaphore take operation with specified timeout.
 
 ZTEST_USER (semaphore, test_sem_take_timeout_forever)
 Test the semaphore take operation with forever wait.
 
 ZTEST (semaphore_1cpu, test_sem_take_timeout_isr)
 Test k_sem_take() with timeout in ISR context.
 
 ZTEST_USER (semaphore, test_sem_take_multiple)
 Test semaphore take operation by multiple threads.
 
 ZTEST_USER (semaphore, test_k_sem_correct_count_limit)
 Test the max value a semaphore can be given and taken.
 
 ZTEST (semaphore, test_sem_give_take_from_isr)
 Test semaphore give and take and its count from ISR.
 

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 msg_sema mut_sem
 
struct k_thread tdata
 

Macro Definition Documentation

◆ expect_k_sem_count_get

#define expect_k_sem_count_get (   sem,
  exp,
  str 
)
Value:
do { \
unsigned int _act = k_sem_count_get(sem); \
unsigned int _exp = (exp); \
zassert_equal(_act, _exp, (str), _act, _exp); \
} while (0)
unsigned int k_sem_count_get(struct k_sem *sem)
Get a semaphore's count.
static struct k_sem sem[3]
Definition timeout_order.c:14

◆ expect_k_sem_count_get_nomsg

#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")

◆ expect_k_sem_init

#define expect_k_sem_init (   sem,
  init,
  max,
  exp,
  str 
)
Value:
do { \
int _act = k_sem_init((sem), (init), (max)); \
int _exp = (exp); \
zassert_equal(_act, _exp, (str), _act, _exp); \
} while (0)
int k_sem_init(struct k_sem *sem, unsigned int initial_count, unsigned int limit)
Initialize a semaphore.

◆ expect_k_sem_init_nomsg

#define expect_k_sem_init_nomsg (   sem,
  init,
  max,
  exp 
)
Value:
expect_k_sem_init((sem), (init), (max), (exp), \
"k_sem_init incorrect return value: %d != %d")
#define expect_k_sem_init(sem, init, max, exp, str)
Definition main.c:32

◆ expect_k_sem_take

#define expect_k_sem_take (   sem,
  timeout,
  exp,
  str 
)
Value:
do { \
int _act = k_sem_take((sem), (timeout)); \
int _exp = (exp); \
zassert_equal(_act, _exp, (str), _act, _exp); \
} while (0)
ZTEST_BMEM int timeout
Definition main.c:31
int k_sem_take(struct k_sem *sem, k_timeout_t timeout)
Take a semaphore.

◆ expect_k_sem_take_nomsg

#define expect_k_sem_take_nomsg (   sem,
  timeout,
  exp 
)     expect_k_sem_take((sem), (timeout), (exp), "k_sem_take incorrect return value: %d != %d")

◆ QSEC2MS

#define QSEC2MS (   s)    ((s) * 250)

◆ SEC2MS

#define SEC2MS (   s)    ((s) * 1000)

◆ sem_give_from_isr

#define sem_give_from_isr (   sema)    irq_offload(isr_sem_give, (const void *)sema)

◆ SEM_INIT_VAL

#define SEM_INIT_VAL   (0U)

◆ SEM_MAX_VAL

#define SEM_MAX_VAL   (10U)

◆ sem_take_from_isr

#define sem_take_from_isr (   sema)    irq_offload(isr_sem_take, (const void *)sema)

◆ SEM_TIMEOUT

#define SEM_TIMEOUT   (K_MSEC(100))

◆ STACK_SIZE

#define STACK_SIZE   (512 + CONFIG_TEST_EXTRA_STACK_SIZE)

◆ THREAD_TEST_PRIORITY

#define THREAD_TEST_PRIORITY   0

◆ TOTAL_THREADS_WAITING

#define TOTAL_THREADS_WAITING   (5)

Function Documentation

◆ isr_sem_give()

void isr_sem_give ( const void *  semaphore)

◆ isr_sem_take()

void isr_sem_take ( const void *  semaphore)

◆ K_PIPE_DEFINE()

K_PIPE_DEFINE ( timeout_info_pipe  ,
sizeof(struct timeout_info) *(5)  ,
 
)

◆ K_SEM_DEFINE() [1/8]

K_SEM_DEFINE ( high_prio_long_sem  ,
(0U)  ,
(10U)   
)

◆ K_SEM_DEFINE() [2/8]

K_SEM_DEFINE ( high_prio_sem  ,
(0U)  ,
(10U)   
)

◆ K_SEM_DEFINE() [3/8]

K_SEM_DEFINE ( ksema  ,
(0U)  ,
(10U)   
)

◆ K_SEM_DEFINE() [4/8]

K_SEM_DEFINE ( low_prio_sem  ,
(0U)  ,
(10U)   
)

◆ K_SEM_DEFINE() [5/8]

K_SEM_DEFINE ( mid_prio_sem  ,
(0U)  ,
(10U)   
)

◆ K_SEM_DEFINE() [6/8]

K_SEM_DEFINE ( multiple_thread_sem  ,
(0U)  ,
(10U)   
)

◆ K_SEM_DEFINE() [7/8]

K_SEM_DEFINE ( simple_sem  ,
(0U)  ,
(10U)   
)

◆ K_SEM_DEFINE() [8/8]

K_SEM_DEFINE ( statically_defined_sem  ,
(0U)  ,
(10U)   
)

◆ K_THREAD_STACK_ARRAY_DEFINE()

K_THREAD_STACK_ARRAY_DEFINE ( multiple_stack  ,
(5)  ,
(512+CONFIG_TEST_EXTRA_STACK_SIZE)   
)

◆ K_THREAD_STACK_DEFINE() [1/5]

K_THREAD_STACK_DEFINE ( stack_1  ,
(512+CONFIG_TEST_EXTRA_STACK_SIZE)   
)

◆ K_THREAD_STACK_DEFINE() [2/5]

K_THREAD_STACK_DEFINE ( stack_2  ,
(512+CONFIG_TEST_EXTRA_STACK_SIZE)   
)

◆ K_THREAD_STACK_DEFINE() [3/5]

K_THREAD_STACK_DEFINE ( stack_3  ,
(512+CONFIG_TEST_EXTRA_STACK_SIZE)   
)

◆ K_THREAD_STACK_DEFINE() [4/5]

K_THREAD_STACK_DEFINE ( stack_4  ,
(512+CONFIG_TEST_EXTRA_STACK_SIZE)   
)

◆ K_THREAD_STACK_DEFINE() [5/5]

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

◆ sem_give_task()

void sem_give_task ( void *  p1,
void *  p2,
void *  p3 
)

◆ sem_measure_timeout_from_thread_helper()

void sem_measure_timeout_from_thread_helper ( void *  p1,
void *  p2,
void *  p3 
)

◆ sem_multi_take_timeout_diff_sem_helper()

void sem_multi_take_timeout_diff_sem_helper ( void *  p1,
void *  p2,
void *  p3 
)

◆ sem_multiple_take_and_timeouts_helper()

void sem_multiple_take_and_timeouts_helper ( void *  p1,
void *  p2,
void *  p3 
)

◆ sem_multiple_threads_wait_helper()

void sem_multiple_threads_wait_helper ( void *  p1,
void *  p2,
void *  p3 
)

◆ sem_queue_mutual_exclusion1()

void sem_queue_mutual_exclusion1 ( void *  p1,
void *  p2,
void *  p3 
)

◆ sem_queue_mutual_exclusion2()

void sem_queue_mutual_exclusion2 ( void *  p1,
void *  p2,
void *  p3 
)

◆ sem_reset_take_task()

void sem_reset_take_task ( void *  p1,
void *  p2,
void *  p3 
)

◆ sem_take_multiple_high_prio_helper()

void sem_take_multiple_high_prio_helper ( void *  p1,
void *  p2,
void *  p3 
)

◆ sem_take_multiple_high_prio_long_helper()

void sem_take_multiple_high_prio_long_helper ( void *  p1,
void *  p2,
void *  p3 
)

◆ sem_take_multiple_low_prio_helper()

void sem_take_multiple_low_prio_helper ( void *  p1,
void *  p2,
void *  p3 
)

◆ sem_take_multiple_mid_prio_helper()

void sem_take_multiple_mid_prio_helper ( void *  p1,
void *  p2,
void *  p3 
)

◆ sem_take_timeout_forever_helper()

void sem_take_timeout_forever_helper ( void *  p1,
void *  p2,
void *  p3 
)

◆ sem_take_timeout_isr_helper()

void sem_take_timeout_isr_helper ( void *  p1,
void *  p2,
void *  p3 
)

◆ test_init()

void * test_init ( void  )

◆ thread_sem_count_get_null()

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

◆ thread_sem_give_null()

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

◆ thread_sem_init_null()

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

◆ thread_sem_reset_null()

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

◆ thread_sem_take_null()

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

◆ tsema_thread_isr()

static void tsema_thread_isr ( struct k_sem *  psem)
static

TESTPOINT: thread-isr sync via sema

◆ tsema_thread_thread()

static void tsema_thread_thread ( struct k_sem *  psem)
static

TESTPOINT: thread-thread sync via sema

◆ ZTEST() [1/10]

ZTEST ( semaphore  ,
test_sem_give_from_isr   
)

Test whether a semaphore can be given by an ISR.

  • Reset an initialized semaphore's count to zero
  • Create a loop, in each loop, do follow steps
  • Give the semaphore from an ISR
  • Get the semaphore's count
  • Verify whether the semaphore's count as expected
See also
k_sem_give()

◆ ZTEST() [2/10]

ZTEST ( semaphore  ,
test_sem_give_take_from_isr   
)

Test semaphore give and take and its count from ISR.

See also
k_sem_give()

◆ ZTEST() [3/10]

ZTEST ( semaphore  ,
test_sem_measure_timeout_from_thread   
)

Test timeout of semaphore from thread.

See also
k_sem_give(), k_sem_reset(), k_sem_take()

◆ ZTEST() [4/10]

ZTEST ( semaphore  ,
test_sem_measure_timeouts   
)

Test semaphore timeout period.

See also
k_sem_take(), k_sem_give(), k_sem_reset()

◆ ZTEST() [5/10]

ZTEST ( semaphore  ,
test_sem_multi_take_timeout_diff_sem   
)

Test sequence of multiple semaphore timeouts.

See also
k_sem_take(), k_sem_reset()

◆ ZTEST() [6/10]

ZTEST ( semaphore  ,
test_sem_multiple_threads_wait   
)

Test multiple semaphore take and give with wait.

See also
k_sem_take(), k_sem_give()

◆ ZTEST() [7/10]

ZTEST ( semaphore  ,
test_sem_thread2isr   
)

Test synchronization between thread and irq.

See also
k_sem_init(), K_SEM_DEFINE(x)

TESTPOINT: test k_sem_init sema

TESTPOINT: test K_SEM_DEFINE sema

◆ ZTEST() [8/10]

ZTEST ( semaphore_1cpu  ,
test_sem_multiple_take_and_timeouts   
)

Test multiple semaphore take with timeouts.

See also
k_sem_take(), k_sem_reset()

◆ ZTEST() [9/10]

ZTEST ( semaphore_1cpu  ,
test_sem_queue_mutual_exclusion   
)

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.

◆ ZTEST() [10/10]

ZTEST ( semaphore_1cpu  ,
test_sem_take_timeout_isr   
)

Test k_sem_take() with timeout in ISR context.

See also
k_sem_take()

◆ ZTEST_SUITE() [1/3]

ZTEST_SUITE ( semaphore  ,
NULL  ,
test_init  ,
NULL  ,
NULL  ,
NULL   
)

◆ ZTEST_SUITE() [2/3]

ZTEST_SUITE ( semaphore_1cpu  ,
NULL  ,
NULL  ,
ztest_simple_1cpu_before  ,
ztest_simple_1cpu_after  ,
NULL   
)

◆ ZTEST_SUITE() [3/3]

ZTEST_SUITE ( semaphore_null_case  ,
NULL  ,
test_init  ,
NULL  ,
NULL  ,
NULL   
)

◆ ZTEST_USER() [1/19]

ZTEST_USER ( semaphore  ,
test_k_sem_correct_count_limit   
)

Test the max value a semaphore can be given and taken.

  • Reset an initialized semaphore's count to zero.
  • Give the semaphore by a thread and verify the semaphore's count is as expected.
  • Verify the max count a semaphore can reach.
  • Take the semaphore by a thread and verify the semaphore's count is as expected.
  • Verify the max times a semaphore can be taken.
See also
k_sem_count_get(), k_sem_give()

◆ ZTEST_USER() [2/19]

ZTEST_USER ( semaphore  ,
test_k_sem_define   
)

Test semaphore defined at compile time.

  • Get the semaphore count.
  • Verify the semaphore count equals to initialized value.
See also
k_sem_count_get()

◆ ZTEST_USER() [3/19]

ZTEST_USER ( semaphore  ,
test_k_sem_init   
)

Test semaphore initialization at running time.

  • Initialize a semaphore with valid count and max limit.
  • Initialize a semaphore with invalid max limit.
  • Initialize a semaphore with invalid count.

◆ ZTEST_USER() [4/19]

ZTEST_USER ( semaphore  ,
test_sem_count_get   
)

Test k_sem_count_get() API.

See also
k_sem_count_get()

TESTPOINT: semaphore count get upon init

TESTPOINT: sem count get after give

TESTPOINT: sem count get after take

TESTPOINT: semaphore give above limit

◆ ZTEST_USER() [5/19]

ZTEST_USER ( semaphore  ,
test_sem_give_from_thread   
)

Test semaphore count when given by thread.

  • Reset an initialized semaphore's count to zero
  • Create a loop, in each loop, do follow steps
  • Give the semaphore from a thread
  • Get the semaphore's count
  • Verify whether the semaphore's count as expected
See also
k_sem_give()

◆ ZTEST_USER() [6/19]

ZTEST_USER ( semaphore  ,
test_sem_reset   
)

Test k_sem_reset() API.

See also
k_sem_reset()

TESTPOINT: semaphore take return -EBUSY

TESTPOINT: semaphore take return -EAGAIN

◆ ZTEST_USER() [7/19]

ZTEST_USER ( semaphore  ,
test_sem_reset_waiting   
)

◆ ZTEST_USER() [8/19]

ZTEST_USER ( semaphore  ,
test_sem_take_multiple   
)

Test semaphore take operation by multiple threads.

See also
k_sem_take()

◆ ZTEST_USER() [9/19]

ZTEST_USER ( semaphore  ,
test_sem_take_no_wait   
)

Test if k_sem_take() decreases semaphore count.

See also
k_sem_take()

◆ ZTEST_USER() [10/19]

ZTEST_USER ( semaphore  ,
test_sem_take_no_wait_fails   
)

Test k_sem_take() when there is no semaphore to take.

See also
k_sem_take()

◆ ZTEST_USER() [11/19]

ZTEST_USER ( semaphore  ,
test_sem_take_timeout   
)

Test the semaphore take operation with specified timeout.

  • Create a new thread, it will give semaphore.
  • Reset the semaphore's count to zero.
  • Take semaphore and wait it given by other threads in specified timeout.
See also
k_sem_take()

◆ ZTEST_USER() [12/19]

ZTEST_USER ( semaphore  ,
test_sem_take_timeout_fails   
)

Test a semaphore take operation with an unavailable semaphore.

  • Reset the semaphore's count to zero, let it unavailable.
  • Take an unavailable semaphore and wait it until timeout.
See also
k_sem_take()

◆ ZTEST_USER() [13/19]

ZTEST_USER ( semaphore  ,
test_sem_take_timeout_forever   
)

Test the semaphore take operation with forever wait.

  • Create a new thread, it will give semaphore.
  • Reset the semaphore's count to zero.
  • Take semaphore, wait it given by other thread forever until it's available.
See also
k_sem_take()

◆ ZTEST_USER() [14/19]

ZTEST_USER ( semaphore  ,
test_sem_thread2thread   
)

Test synchronization of threads with semaphore.

See also
k_sem_init(), K_SEM_DEFINE(x)

TESTPOINT: test k_sem_init sema

TESTPOINT: test K_SEM_DEFINE sema

◆ ZTEST_USER() [15/19]

ZTEST_USER ( semaphore_null_case  ,
test_sem_count_get_null   
)

Test k_sem_count_get() API.

Create a thread and set k_sem_count_get() input to NULL

See also
k_sem_count_get()

◆ ZTEST_USER() [16/19]

ZTEST_USER ( semaphore_null_case  ,
test_sem_give_null   
)

Test k_sem_give() API.

Create a thread and set k_sem_give() input to NULL

See also
k_sem_give()

◆ ZTEST_USER() [17/19]

ZTEST_USER ( semaphore_null_case  ,
test_sem_init_null   
)

Test k_sem_init() API.

Create a thread and set k_sem_init() input to NULL

See also
k_sem_init()

◆ ZTEST_USER() [18/19]

ZTEST_USER ( semaphore_null_case  ,
test_sem_reset_null   
)

Test k_sem_reset() API.

Create a thread and set k_sem_reset() input to NULL

See also
k_sem_reset()

◆ ZTEST_USER() [19/19]

ZTEST_USER ( semaphore_null_case  ,
test_sem_take_null   
)

Test k_sem_take() API.

Create a thread and set k_sem_take() input to NULL

See also
k_sem_take()

Variable Documentation

◆ critical_var

uint32_t critical_var

◆ multiple_tid

struct k_thread multiple_tid[(5)]

◆ mut_sem

struct k_sem msg_sema mut_sem

◆ sem_tid_4

struct k_thread sem_tid_1 sem_tid_2 sem_tid_3 sem_tid_4

◆ tdata

struct k_thread tdata