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

Macros

#define STACK_SIZE   (512 + CONFIG_TEST_EXTRA_STACK_SIZE)
 
#define STACK_LEN   4
 
#define HIGH_T1   0xaaa
 
#define HIGH_T2   0xbbb
 
#define LOW_PRIO   0xccc
 

Functions

 K_STACK_DEFINE (kstack, 4)
 TESTPOINT: init via K_STACK_DEFINE.
 
 K_STACK_DEFINE (kstack_test_alloc, 4)
 
 K_THREAD_STACK_DEFINE (threadstack1,(512+CONFIG_TEST_EXTRA_STACK_SIZE))
 
 K_THREAD_STACK_DEFINE (threadstack_t1,(512+CONFIG_TEST_EXTRA_STACK_SIZE))
 
 K_THREAD_STACK_DEFINE (threadstack_t2,(512+CONFIG_TEST_EXTRA_STACK_SIZE))
 
static void tstack_push (struct k_stack *pstack)
 
static void tstack_pop (struct k_stack *pstack)
 
static void tIsr_entry_push (const void *p)
 
static void tIsr_entry_pop (const void *p)
 
static void tThread_entry (void *p1, void *p2, void *p3)
 
static void tstack_thread_thread (struct k_stack *pstack)
 
static void tstack_thread_isr (struct k_stack *pstack)
 
 ZTEST (stack_contexts, test_stack_thread2thread)
 Test to verify data passing between threads via stack.
 
 ZTEST_USER (stack_contexts, test_stack_user_thread2thread)
 Verifies data passing between user threads via stack.
 
 ZTEST (stack_contexts, test_stack_thread2isr)
 Verifies data passing between thread and ISR via stack.
 
 ZTEST (stack_contexts, test_stack_alloc_thread2thread)
 
static void low_prio_wait_for_stack (void *p1, void *p2, void *p3)
 
static void high_prio_t1_wait_for_stack (void *p1, void *p2, void *p3)
 
static void high_prio_t2_wait_for_stack (void *p1, void *p2, void *p3)
 
 ZTEST (stack_contexts, test_stack_multithread_competition)
 Test multi-threads to get data from stack.
 
 ZTEST (stack_contexts, test_stack_alloc_null)
 Test case of requesting a buffer larger than resource pool.
 

Variables

struct k_stack stack
 
struct k_thread thread_data1
 
static struct k_thread high_pro_thread_t1
 
static struct k_thread high_pro_thread_t2
 
static ZTEST_DMEM stack_data_t data [4] = { 0xABCD, 0x1234 }
 
struct k_sem end_sema1
 

Macro Definition Documentation

◆ HIGH_T1

#define HIGH_T1   0xaaa

◆ HIGH_T2

#define HIGH_T2   0xbbb

◆ LOW_PRIO

#define LOW_PRIO   0xccc

◆ STACK_LEN

#define STACK_LEN   4

◆ STACK_SIZE

#define STACK_SIZE   (512 + CONFIG_TEST_EXTRA_STACK_SIZE)

Function Documentation

◆ K_STACK_DEFINE() [1/2]

K_STACK_DEFINE ( kstack  ,
 
)

TESTPOINT: init via K_STACK_DEFINE.

◆ K_STACK_DEFINE() [2/2]

K_STACK_DEFINE ( kstack_test_alloc  ,
 
)

◆ K_THREAD_STACK_DEFINE() [1/3]

K_THREAD_STACK_DEFINE ( threadstack1  ,
(512+CONFIG_TEST_EXTRA_STACK_SIZE)   
)

◆ K_THREAD_STACK_DEFINE() [2/3]

K_THREAD_STACK_DEFINE ( threadstack_t1  ,
(512+CONFIG_TEST_EXTRA_STACK_SIZE)   
)

◆ K_THREAD_STACK_DEFINE() [3/3]

K_THREAD_STACK_DEFINE ( threadstack_t2  ,
(512+CONFIG_TEST_EXTRA_STACK_SIZE)   
)

◆ tIsr_entry_pop()

static void tIsr_entry_pop ( const void *  p)
static

◆ tIsr_entry_push()

static void tIsr_entry_push ( const void *  p)
static

◆ tstack_pop()

static void tstack_pop ( struct k_stack *  pstack)
static

TESTPOINT: stack pop

◆ tstack_push()

static void tstack_push ( struct k_stack *  pstack)
static

TESTPOINT: stack push

◆ tstack_thread_isr()

static void tstack_thread_isr ( struct k_stack *  pstack)
static

TESTPOINT: thread-isr data passing via stack

◆ tstack_thread_thread()

static void tstack_thread_thread ( struct k_stack *  pstack)
static

TESTPOINT: thread-thread data passing via stack

◆ tThread_entry()

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

Variable Documentation

◆ data

ZTEST_DMEM stack_data_t data[4] = { 0xABCD, 0x1234 }
static

◆ end_sema1

struct k_sem end_sema1

◆ high_pro_thread_t1

struct k_thread high_pro_thread_t1
static

◆ high_pro_thread_t2

struct k_thread high_pro_thread_t2
static

◆ stack

struct k_stack stack

◆ thread_data1

struct k_thread thread_data1