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

Macros

#define STACK_SIZE   (512 + CONFIG_TEST_EXTRA_STACK_SIZE)
 
#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_STACK_SIZE))
 
static K_THREAD_STACK_ARRAY_DEFINE (multi_stack_take, 5,(512+CONFIG_TEST_EXTRA_STACK_SIZE))
 
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)
 
 ZTEST_USER (kernel_sys_sem, test_multiple_thread_sem_usage)
 Test semaphore usage with multiple thread.
 
static void multi_thread_sem_give (void *p1, void *p2, void *p3)
 
static void multi_thread_sem_take (void *p1, void *p2, void *p3)
 
 ZTEST_USER (kernel_sys_sem, test_multi_thread_sem_limit)
 Test max semaphore can be give and take with multiple thread.
 
void * test_init (void)
 
 ZTEST_SUITE (kernel_sys_sem, NULL, test_init, ztest_simple_1cpu_before, ztest_simple_1cpu_after, NULL)
 

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 atomic_t atomic_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_STACK_SIZE)

◆ 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_STACK_SIZE)   
)
static

◆ K_THREAD_STACK_ARRAY_DEFINE() [2/2]

static K_THREAD_STACK_ARRAY_DEFINE ( multi_stack_take  ,
,
(512+CONFIG_TEST_EXTRA_STACK_SIZE)   
)
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_init()

void * test_init ( void  )

◆ 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

◆ ZTEST_SUITE()

ZTEST_SUITE ( kernel_sys_sem  ,
NULL  ,
test_init  ,
ztest_simple_1cpu_before  ,
ztest_simple_1cpu_after  ,
NULL   
)

Variable Documentation

◆ atomic_count

ZTEST_DMEM atomic_t atomic_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