Zephyr Project API 3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
main.c File Reference
#include <zephyr/ztest.h>

Data Structures

struct  thread_data
 

Macros

#define INIT_COOP_PRIO   -2
 
#define INIT_COOP_STACK_SIZE   (500 + CONFIG_TEST_EXTRA_STACK_SIZE)
 
#define INIT_COOP_P1   ((void *)0xFFFF0000)
 
#define INIT_COOP_P2   ((void *)0xCDEF)
 
#define INIT_COOP_P3_static   ((void *)&static_coop_start_sema)
 
#define INIT_COOP_P3   ((void *)&coop_start_sema)
 
#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_STACK_SIZE)
 
#define INIT_PREEMPT_P1   ((void *)5)
 
#define INIT_PREEMPT_P2   ((void *)6)
 
#define INIT_PREEMPT_P3_static   ((void *)&static_preem_start_sema)
 
#define INIT_PREEMPT_P3   ((void *)&preem_start_sema)
 
#define INIT_PREEMPT_OPTION   (K_USER | K_INHERIT_PERMS)
 
#define INIT_PREEMPT_DELAY   0
 

Functions

 K_SEM_DEFINE (static_preem_start_sema, 0, 1)
 
 K_SEM_DEFINE (preem_start_sema, 0, 1)
 
 K_SEM_DEFINE (static_coop_start_sema, 0, 1)
 
 K_SEM_DEFINE (coop_start_sema, 0, 1)
 
 K_SEM_DEFINE (end_sema, 0, 1)
 
static void thread_entry (void *p1, void *p2, void *p3)
 
 K_THREAD_DEFINE (T_KDEFINE_COOP_THREAD,(500+CONFIG_TEST_EXTRA_STACK_SIZE), thread_entry,((void *) 0xFFFF0000),((void *) 0xCDEF),((void *)&static_coop_start_sema), -2,(K_USER|K_INHERIT_PERMS), 2000)
 
 K_THREAD_DEFINE (T_KDEFINE_PREEMPT_THREAD,(499+CONFIG_TEST_EXTRA_STACK_SIZE), thread_entry,((void *) 5),((void *) 6),((void *)&static_preem_start_sema), 1,(K_USER|K_INHERIT_PERMS), 0)
 
 K_THREAD_ACCESS_GRANT (T_KDEFINE_COOP_THREAD, &static_preem_start_sema, &preem_start_sema, &static_coop_start_sema, &coop_start_sema, &end_sema)
 
 K_THREAD_ACCESS_GRANT (T_KDEFINE_PREEMPT_THREAD, &static_preem_start_sema, &preem_start_sema, &static_coop_start_sema, &coop_start_sema, &end_sema)
 
static K_THREAD_STACK_DEFINE (stack_coop,(500+CONFIG_TEST_EXTRA_STACK_SIZE))
 
static K_THREAD_STACK_DEFINE (stack_preempt,(499+CONFIG_TEST_EXTRA_STACK_SIZE))
 
 ZTEST_USER (thread_init, test_kdefine_preempt_thread)
 test preempt thread initialization via K_THREAD_DEFINE
 
 ZTEST_USER (thread_init, test_kdefine_coop_thread)
 test coop thread initialization via K_THREAD_DEFINE
 
 ZTEST_USER (thread_init, test_kinit_preempt_thread)
 test preempt thread initialization via k_thread_create
 
 ZTEST (thread_init, test_kinit_coop_thread)
 test coop thread initialization via k_thread_create
 
void * thread_init_setup (void)
 
 ZTEST_SUITE (thread_init, NULL, thread_init_setup, NULL, NULL, NULL)
 

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 *)&coop_start_sema)

◆ INIT_COOP_P3_static

#define INIT_COOP_P3_static   ((void *)&static_coop_start_sema)

◆ INIT_COOP_PRIO

#define INIT_COOP_PRIO   -2

◆ INIT_COOP_STACK_SIZE

#define INIT_COOP_STACK_SIZE   (500 + CONFIG_TEST_EXTRA_STACK_SIZE)

◆ 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 *)&preem_start_sema)

◆ INIT_PREEMPT_P3_static

#define INIT_PREEMPT_P3_static   ((void *)&static_preem_start_sema)

◆ INIT_PREEMPT_PRIO

#define INIT_PREEMPT_PRIO   1

◆ INIT_PREEMPT_STACK_SIZE

#define INIT_PREEMPT_STACK_SIZE   (499 + CONFIG_TEST_EXTRA_STACK_SIZE)

Function Documentation

◆ K_SEM_DEFINE() [1/5]

K_SEM_DEFINE ( coop_start_sema  ,
,
 
)

◆ K_SEM_DEFINE() [2/5]

K_SEM_DEFINE ( end_sema  ,
,
 
)

◆ K_SEM_DEFINE() [3/5]

K_SEM_DEFINE ( preem_start_sema  ,
,
 
)

◆ K_SEM_DEFINE() [4/5]

K_SEM_DEFINE ( static_coop_start_sema  ,
,
 
)

◆ K_SEM_DEFINE() [5/5]

K_SEM_DEFINE ( static_preem_start_sema  ,
,
 
)

◆ K_THREAD_ACCESS_GRANT() [1/2]

K_THREAD_ACCESS_GRANT ( T_KDEFINE_COOP_THREAD  ,
static_preem_start_sema,
preem_start_sema,
static_coop_start_sema,
coop_start_sema,
end_sema 
)

◆ K_THREAD_ACCESS_GRANT() [2/2]

K_THREAD_ACCESS_GRANT ( T_KDEFINE_PREEMPT_THREAD  ,
static_preem_start_sema,
preem_start_sema,
static_coop_start_sema,
coop_start_sema,
end_sema 
)

◆ K_THREAD_DEFINE() [1/2]

K_THREAD_DEFINE ( T_KDEFINE_COOP_THREAD  ,
(500+CONFIG_TEST_EXTRA_STACK_SIZE)  ,
thread_entry  ,
((void *) 0xFFFF0000)  ,
((void *) 0xCDEF)  ,
((void *)&static_coop_start_sema)  ,
2,
(K_USER|K_INHERIT_PERMS ,
2000   
)

◆ K_THREAD_DEFINE() [2/2]

K_THREAD_DEFINE ( T_KDEFINE_PREEMPT_THREAD  ,
(499+CONFIG_TEST_EXTRA_STACK_SIZE)  ,
thread_entry  ,
((void *) 5)  ,
((void *) 6)  ,
((void *)&static_preem_start_sema)  ,
,
(K_USER|K_INHERIT_PERMS ,
 
)

◆ K_THREAD_STACK_DEFINE() [1/2]

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

◆ K_THREAD_STACK_DEFINE() [2/2]

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

◆ thread_entry()

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

TESTPOINT: check delay start

TESTPOINT: check priority and params

◆ thread_init_setup()

void * thread_init_setup ( void  )

◆ ZTEST_SUITE()

ZTEST_SUITE ( thread_init  ,
NULL  ,
thread_init_setup  ,
NULL  ,
NULL  ,
NULL   
)

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