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

Macros

#define TIMEOUT_MS   500
 
#define POOL_SIZE   28672
 
#define STACK_OBJ_SIZE   K_THREAD_STACK_LEN(CONFIG_DYNAMIC_THREAD_STACK_SIZE)
 
#define MAX_HEAP_STACKS   (POOL_SIZE / STACK_OBJ_SIZE)
 

Functions

 K_HEAP_DEFINE (stack_heap, 28672)
 
static void func (void *arg1, void *arg2, void *arg3)
 
void test_dynamic_thread_stack_userspace_dyn_obj (void)
 Check we can create a thread from userspace, using dynamic objects.
 
void test_dynamic_thread_stack_pool (void)
 Exercise the pool-based thread stack allocator.
 
void test_dynamic_thread_stack_alloc (void)
 Exercise the heap-based thread stack allocator.
 
 K_SEM_DEFINE (perm_sem, 0, 1)
 
static void set_fault (unsigned int reason)
 
void k_sys_fatal_error_handler (unsigned int reason, const struct arch_esf *pEsf)
 Fatal error policy handler.
 
static void perm_func (void *arg1, void *arg2, void *arg3)
 
static void perm_func_violator (void *arg1, void *arg2, void *arg3)
 
void test_dynamic_thread_stack_permission (void)
 Exercise stack permissions.
 
static void * dynamic_thread_stack_setup (void)
 
 ZTEST_SUITE (dynamic_thread_stack, NULL, dynamic_thread_stack_setup, NULL, NULL, NULL)
 

Variables

ZTEST_DMEM bool tflag [MAX(CONFIG_DYNAMIC_THREAD_POOL_SIZE,(28672/K_THREAD_STACK_LEN(CONFIG_DYNAMIC_THREAD_STACK_SIZE)))]
 
static ZTEST_BMEM volatile bool expect_fault
 
static ZTEST_BMEM volatile unsigned int expected_reason
 

Macro Definition Documentation

◆ MAX_HEAP_STACKS

#define MAX_HEAP_STACKS   (POOL_SIZE / STACK_OBJ_SIZE)

◆ POOL_SIZE

#define POOL_SIZE   28672

◆ STACK_OBJ_SIZE

#define STACK_OBJ_SIZE   K_THREAD_STACK_LEN(CONFIG_DYNAMIC_THREAD_STACK_SIZE)

◆ TIMEOUT_MS

#define TIMEOUT_MS   500

Function Documentation

◆ dynamic_thread_stack_setup()

static void * dynamic_thread_stack_setup ( void )
static

◆ func()

static void func ( void * arg1,
void * arg2,
void * arg3 )
static

◆ K_HEAP_DEFINE()

K_HEAP_DEFINE ( stack_heap ,
28672  )

◆ K_SEM_DEFINE()

K_SEM_DEFINE ( perm_sem ,
0 ,
1  )

◆ perm_func()

static void perm_func ( void * arg1,
void * arg2,
void * arg3 )
static

◆ perm_func_violator()

static void perm_func_violator ( void * arg1,
void * arg2,
void * arg3 )
static

◆ set_fault()

static void set_fault ( unsigned int reason)
static

◆ test_dynamic_thread_stack_alloc()

void test_dynamic_thread_stack_alloc ( void )

Exercise the heap-based thread stack allocator.

◆ test_dynamic_thread_stack_permission()

void test_dynamic_thread_stack_permission ( void )

Exercise stack permissions.

◆ test_dynamic_thread_stack_pool()

void test_dynamic_thread_stack_pool ( void )

Exercise the pool-based thread stack allocator.

◆ test_dynamic_thread_stack_userspace_dyn_obj()

void test_dynamic_thread_stack_userspace_dyn_obj ( void )

Check we can create a thread from userspace, using dynamic objects.

◆ ZTEST_SUITE()

ZTEST_SUITE ( dynamic_thread_stack ,
NULL ,
dynamic_thread_stack_setup ,
NULL ,
NULL ,
NULL  )

Variable Documentation

◆ expect_fault

ZTEST_BMEM volatile bool expect_fault
static

◆ expected_reason

ZTEST_BMEM volatile unsigned int expected_reason
static

◆ tflag

ZTEST_DMEM bool tflag[MAX(CONFIG_DYNAMIC_THREAD_POOL_SIZE,(28672/K_THREAD_STACK_LEN(CONFIG_DYNAMIC_THREAD_STACK_SIZE)))]