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

Data Structures

struct  thread_data
 

Macros

#define INIT_COOP_PRIO   -2
 
#define INIT_COOP_STACK_SIZE   (500 + CONFIG_TEST_EXTRA_STACKSIZE)
 
#define INIT_COOP_P1   ((void *)0xFFFF0000)
 
#define INIT_COOP_P2   ((void *)0xCDEF)
 
#define INIT_COOP_P3   ((void *)0x1234)
 
#define INIT_COOP_OPTION   (K_USER | K_INHERIT_PERMS)
 
#define INIT_COOP_DELAY   2000
 
#define INIT_PREEMPT_PRIO   1
 
#define INIT_PREEMPT_STACK_SIZE   (499 + CONFIG_TEST_EXTRA_STACKSIZE)
 
#define INIT_PREEMPT_P1   ((void *)5)
 
#define INIT_PREEMPT_P2   ((void *)6)
 
#define INIT_PREEMPT_P3   ((void *)7)
 
#define INIT_PREEMPT_OPTION   (K_USER | K_INHERIT_PERMS)
 
#define INIT_PREEMPT_DELAY   0
 

Functions

static void thread_entry (void *p1, void *p2, void *p3)
 
 K_THREAD_DEFINE (T_KDEFINE_COOP_THREAD,(500+CONFIG_TEST_EXTRA_STACKSIZE), thread_entry,((void *) 0xFFFF0000),((void *) 0xCDEF),((void *) 0x1234), -2,(K_USER|K_INHERIT_PERMS), 2000)
 
 K_THREAD_DEFINE (T_KDEFINE_PREEMPT_THREAD,(499+CONFIG_TEST_EXTRA_STACKSIZE), thread_entry,((void *) 5),((void *) 6),((void *) 7), 1,(K_USER|K_INHERIT_PERMS), 0)
 
 K_SEM_DEFINE (start_sema, 0, 1)
 
 K_SEM_DEFINE (end_sema, 0, 1)
 
 K_THREAD_ACCESS_GRANT (T_KDEFINE_COOP_THREAD, &start_sema, &end_sema)
 
 K_THREAD_ACCESS_GRANT (T_KDEFINE_PREEMPT_THREAD, &start_sema, &end_sema)
 
static K_THREAD_STACK_DEFINE (stack_coop,(500+CONFIG_TEST_EXTRA_STACKSIZE))
 
static K_THREAD_STACK_DEFINE (stack_preempt,(499+CONFIG_TEST_EXTRA_STACKSIZE))
 
void test_kdefine_preempt_thread (void)
 test preempt thread initialization via K_THREAD_DEFINE More...
 
void test_kdefine_coop_thread (void)
 test coop thread initialization via K_THREAD_DEFINE More...
 
void test_kinit_preempt_thread (void)
 test preempt thread initialization via k_thread_create More...
 
void test_kinit_coop_thread (void)
 test coop thread initialization via k_thread_create More...
 
void test_main (void)
 

Variables

static struct k_thread thread_coop
 
static struct k_thread thread_preempt
 
static ZTEST_BMEM uint64_t t_create
 
static ZTEST_BMEM struct thread_data expected
 

Macro Definition Documentation

◆ INIT_COOP_DELAY

#define INIT_COOP_DELAY   2000

◆ INIT_COOP_OPTION

#define INIT_COOP_OPTION   (K_USER | K_INHERIT_PERMS)

◆ INIT_COOP_P1

#define INIT_COOP_P1   ((void *)0xFFFF0000)

◆ INIT_COOP_P2

#define INIT_COOP_P2   ((void *)0xCDEF)

◆ INIT_COOP_P3

#define INIT_COOP_P3   ((void *)0x1234)

◆ INIT_COOP_PRIO

#define INIT_COOP_PRIO   -2

◆ INIT_COOP_STACK_SIZE

#define INIT_COOP_STACK_SIZE   (500 + CONFIG_TEST_EXTRA_STACKSIZE)

◆ INIT_PREEMPT_DELAY

#define INIT_PREEMPT_DELAY   0

◆ INIT_PREEMPT_OPTION

#define INIT_PREEMPT_OPTION   (K_USER | K_INHERIT_PERMS)

◆ INIT_PREEMPT_P1

#define INIT_PREEMPT_P1   ((void *)5)

◆ INIT_PREEMPT_P2

#define INIT_PREEMPT_P2   ((void *)6)

◆ INIT_PREEMPT_P3

#define INIT_PREEMPT_P3   ((void *)7)

◆ INIT_PREEMPT_PRIO

#define INIT_PREEMPT_PRIO   1

◆ INIT_PREEMPT_STACK_SIZE

#define INIT_PREEMPT_STACK_SIZE   (499 + CONFIG_TEST_EXTRA_STACKSIZE)

Function Documentation

◆ K_SEM_DEFINE() [1/2]

K_SEM_DEFINE ( end_sema  ,
,
 
)

◆ K_SEM_DEFINE() [2/2]

K_SEM_DEFINE ( start_sema  ,
,
 
)

◆ K_THREAD_ACCESS_GRANT() [1/2]

K_THREAD_ACCESS_GRANT ( T_KDEFINE_COOP_THREAD  ,
start_sema,
end_sema 
)

◆ K_THREAD_ACCESS_GRANT() [2/2]

K_THREAD_ACCESS_GRANT ( T_KDEFINE_PREEMPT_THREAD  ,
start_sema,
end_sema 
)

◆ K_THREAD_DEFINE() [1/2]

K_THREAD_DEFINE ( T_KDEFINE_COOP_THREAD  ,
(500+CONFIG_TEST_EXTRA_STACKSIZE)  ,
thread_entry  ,
((void *) 0xFFFF0000)  ,
((void *) 0xCDEF)  ,
((void *) 0x1234)  ,
2,
(K_USER|K_INHERIT_PERMS ,
2000   
)

◆ K_THREAD_DEFINE() [2/2]

K_THREAD_DEFINE ( T_KDEFINE_PREEMPT_THREAD  ,
(499+CONFIG_TEST_EXTRA_STACKSIZE)  ,
thread_entry  ,
((void *) 5)  ,
((void *) 6)  ,
((void *) 7)  ,
,
(K_USER|K_INHERIT_PERMS ,
 
)

◆ K_THREAD_STACK_DEFINE() [1/2]

static K_THREAD_STACK_DEFINE ( stack_coop  ,
(500+CONFIG_TEST_EXTRA_STACKSIZE)   
)
static

◆ K_THREAD_STACK_DEFINE() [2/2]

static K_THREAD_STACK_DEFINE ( stack_preempt  ,
(499+CONFIG_TEST_EXTRA_STACKSIZE)   
)
static

◆ test_main()

void test_main ( void  )

test case main entry

◆ thread_entry()

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

TESTPOINT: check delay start

TESTPOINT: check priority and params

Variable Documentation

◆ expected

ZTEST_BMEM struct thread_data expected
static

◆ t_create

ZTEST_BMEM uint64_t t_create
static

◆ thread_coop

struct k_thread thread_coop
static

◆ thread_preempt

struct k_thread thread_preempt
static