Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
main.c File Reference
#include <ztest.h>
#include <ztest_error_hook.h>

Macros

#define STACK_SIZE   (512 + CONFIG_TEST_EXTRA_STACKSIZE)
 
#define SEM_INIT_VAL   (0U)
 
#define SEM_MAX_VAL   (3U)
 
#define TOTAL_MAX   (4U)
 
#define STACK_NUMS   5
 
#define PRIO   5
 
#define LOW_PRIO   8
 
#define HIGH_PRIO   2
 

Functions

static K_THREAD_STACK_ARRAY_DEFINE (multi_stack_give, 5,(512+CONFIG_TEST_EXTRA_STACKSIZE))
 
static K_THREAD_STACK_ARRAY_DEFINE (multi_stack_take, 5,(512+CONFIG_TEST_EXTRA_STACKSIZE))
 
static void sem_thread_give_uninit (void *p1, void *p2, void *p3)
 
static void sem_thread_give (void *p1, void *p2, void *p3)
 
static void thread_low_prio_sem_take (void *p1, void *p2, void *p3)
 
static void thread_high_prio_sem_take (void *p1, void *p2, void *p3)
 
void test_multiple_thread_sem_usage (void)
 Test semaphore usage with multiple thread. More...
 
static void multi_thread_sem_give (void *p1, void *p2, void *p3)
 
static void multi_thread_sem_take (void *p1, void *p2, void *p3)
 
void test_multi_thread_sem_limit (void)
 Test max semaphore can be give and take with multiple thread. More...
 
void test_main (void)
 

Variables

static struct k_thread multi_tid_give [5]
 
static struct k_thread multi_tid_take [5]
 
static struct k_sem usage_sem sync_sem limit_sem uninit_sem
 
static ZTEST_DMEM int flag
 
static ZTEST_DMEM int count
 

Macro Definition Documentation

◆ HIGH_PRIO

#define HIGH_PRIO   2

◆ LOW_PRIO

#define LOW_PRIO   8

◆ PRIO

#define PRIO   5

◆ SEM_INIT_VAL

#define SEM_INIT_VAL   (0U)

◆ SEM_MAX_VAL

#define SEM_MAX_VAL   (3U)

◆ STACK_NUMS

#define STACK_NUMS   5

◆ STACK_SIZE

#define STACK_SIZE   (512 + CONFIG_TEST_EXTRA_STACKSIZE)

◆ TOTAL_MAX

#define TOTAL_MAX   (4U)

Function Documentation

◆ K_THREAD_STACK_ARRAY_DEFINE() [1/2]

static K_THREAD_STACK_ARRAY_DEFINE ( multi_stack_give  ,
,
(512+CONFIG_TEST_EXTRA_STACKSIZE)   
)
static

◆ K_THREAD_STACK_ARRAY_DEFINE() [2/2]

static K_THREAD_STACK_ARRAY_DEFINE ( multi_stack_take  ,
,
(512+CONFIG_TEST_EXTRA_STACKSIZE)   
)
static

◆ multi_thread_sem_give()

static void multi_thread_sem_give ( void p1,
void p2,
void p3 
)
static

◆ multi_thread_sem_take()

static void multi_thread_sem_take ( void p1,
void p2,
void p3 
)
static

◆ sem_thread_give()

static void sem_thread_give ( void p1,
void p2,
void p3 
)
static

◆ sem_thread_give_uninit()

static void sem_thread_give_uninit ( void p1,
void p2,
void p3 
)
static

◆ test_main()

void test_main ( void  )

test case main entry

◆ thread_high_prio_sem_take()

static void thread_high_prio_sem_take ( void p1,
void p2,
void p3 
)
static

◆ thread_low_prio_sem_take()

static void thread_low_prio_sem_take ( void p1,
void p2,
void p3 
)
static

Variable Documentation

◆ count

ZTEST_DMEM int count
static

◆ flag

ZTEST_DMEM int flag
static

◆ multi_tid_give

struct k_thread multi_tid_give[5]
static

◆ multi_tid_take

struct k_thread multi_tid_take[5]
static

◆ uninit_sem

struct k_sem usage_sem sync_sem limit_sem uninit_sem
static