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

Data Structures

struct  mem_block
 

Macros

#define STACK_SIZE   (1024 + CONFIG_TEST_EXTRA_STACK_SIZE)
 
#define PIPE_LEN   (4 * 16)
 
#define BYTES_TO_WRITE   16
 
#define BYTES_TO_READ   BYTES_TO_WRITE
 
#define SZ   128
 

Functions

 K_HEAP_DEFINE (mpool,(4 *16) *1)
 
 K_PIPE_DEFINE (kpipe,(4 *16), 4)
 TESTPOINT: init via K_PIPE_DEFINE.
 
 K_PIPE_DEFINE (khalfpipe,((4 *16)/2), 4)
 
 K_PIPE_DEFINE (kpipe1,(4 *16), 4)
 
 K_PIPE_DEFINE (pipe_test_alloc,(4 *16), 4)
 
 K_PIPE_DEFINE (ksmallpipe, 10, 2)
 
 K_THREAD_STACK_DEFINE (tstack,(1024+CONFIG_TEST_EXTRA_STACK_SIZE))
 
 K_THREAD_STACK_DEFINE (tstack1,(1024+CONFIG_TEST_EXTRA_STACK_SIZE))
 
 K_THREAD_STACK_DEFINE (tstack2,(1024+CONFIG_TEST_EXTRA_STACK_SIZE))
 
 K_SEM_DEFINE (end_sema, 0, 1)
 
 K_HEAP_DEFINE (test_pool, 128 *4)
 
static void tpipe_put (struct k_pipe *ppipe, k_timeout_t timeout)
 
static void tpipe_get (struct k_pipe *ppipe, k_timeout_t timeout)
 
static void tThread_entry (void *p1, void *p2, void *p3)
 
static void tpipe_thread_thread (struct k_pipe *ppipe)
 
static void tpipe_kthread_to_kthread (struct k_pipe *ppipe)
 
static void tpipe_put_no_wait (struct k_pipe *ppipe)
 
static void tpipe_put_small_size (struct k_pipe *ppipe, k_timeout_t timeout)
 
static void tpipe_get_small_size (struct k_pipe *ppipe, k_timeout_t timeout)
 
static void tpipe_get_large_size (struct k_pipe *ppipe, k_timeout_t timeout)
 
 ZTEST (pipe_api_1cpu, test_pipe_alloc)
 Test Initialization and buffer allocation of pipe, with various parameters.
 
static void thread_for_get_forever (void *p1, void *p2, void *p3)
 
 ZTEST (pipe_api, test_pipe_cleanup)
 
static void thread_handler (void *p1, void *p2, void *p3)
 
 ZTEST (pipe_api_1cpu, test_pipe_thread2thread)
 Test pipe data passing between threads.
 
 ZTEST_USER (pipe_api_1cpu, test_pipe_user_thread2thread)
 Test data passing using pipes between user threads.
 
 ZTEST (pipe_api, test_resource_pool_auto_free)
 Test resource pool free.
 
static void tThread_half_pipe_put (void *p1, void *p2, void *p3)
 
static void tThread_half_pipe_get (void *p1, void *p2, void *p3)
 
 ZTEST (pipe_api, test_half_pipe_put_get)
 Test put/get with smaller pipe buffer.
 
 ZTEST (pipe_api, test_pipe_get_put)
 
 ZTEST (pipe_api, test_pipe_get_large)
 
 ZTEST (pipe_api, test_pipe_reader_wait)
 Test pending reader in pipe.
 

Variables

static ZTEST_DMEM unsigned char data []
 
struct k_pipe pipe pipe1
 
struct k_thread tdata
 
struct k_thread tdata1
 
struct k_thread tdata2
 

Macro Definition Documentation

◆ BYTES_TO_READ

#define BYTES_TO_READ   BYTES_TO_WRITE

◆ BYTES_TO_WRITE

#define BYTES_TO_WRITE   16

◆ PIPE_LEN

#define PIPE_LEN   (4 * 16)

◆ STACK_SIZE

#define STACK_SIZE   (1024 + CONFIG_TEST_EXTRA_STACK_SIZE)

◆ SZ

#define SZ   128

Function Documentation

◆ K_HEAP_DEFINE() [1/2]

K_HEAP_DEFINE ( mpool  ,
(4 *16) *  1 
)

◆ K_HEAP_DEFINE() [2/2]

K_HEAP_DEFINE ( test_pool  ,
128 *  4 
)

◆ K_PIPE_DEFINE() [1/5]

K_PIPE_DEFINE ( khalfpipe  ,
((4 *16)/2)  ,
 
)

◆ K_PIPE_DEFINE() [2/5]

K_PIPE_DEFINE ( kpipe  ,
(4 *16)  ,
 
)

TESTPOINT: init via K_PIPE_DEFINE.

◆ K_PIPE_DEFINE() [3/5]

K_PIPE_DEFINE ( kpipe1  ,
(4 *16)  ,
 
)

◆ K_PIPE_DEFINE() [4/5]

K_PIPE_DEFINE ( ksmallpipe  ,
10  ,
 
)

◆ K_PIPE_DEFINE() [5/5]

K_PIPE_DEFINE ( pipe_test_alloc  ,
(4 *16)  ,
 
)

◆ K_SEM_DEFINE()

K_SEM_DEFINE ( end_sema  ,
,
 
)

◆ K_THREAD_STACK_DEFINE() [1/3]

K_THREAD_STACK_DEFINE ( tstack  ,
(1024+CONFIG_TEST_EXTRA_STACK_SIZE)   
)

◆ K_THREAD_STACK_DEFINE() [2/3]

K_THREAD_STACK_DEFINE ( tstack1  ,
(1024+CONFIG_TEST_EXTRA_STACK_SIZE)   
)

◆ K_THREAD_STACK_DEFINE() [3/3]

K_THREAD_STACK_DEFINE ( tstack2  ,
(1024+CONFIG_TEST_EXTRA_STACK_SIZE)   
)

◆ thread_for_get_forever()

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

◆ thread_handler()

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

◆ tpipe_get()

static void tpipe_get ( struct k_pipe ppipe,
k_timeout_t  timeout 
)
static

TESTPOINT: pipe get

◆ tpipe_get_large_size()

static void tpipe_get_large_size ( struct k_pipe ppipe,
k_timeout_t  timeout 
)
static

TESTPOINT: pipe get

◆ tpipe_get_small_size()

static void tpipe_get_small_size ( struct k_pipe ppipe,
k_timeout_t  timeout 
)
static

TESTPOINT: pipe get

◆ tpipe_kthread_to_kthread()

static void tpipe_kthread_to_kthread ( struct k_pipe ppipe)
static

TESTPOINT: thread-thread data passing via pipe

◆ tpipe_put()

static void tpipe_put ( struct k_pipe ppipe,
k_timeout_t  timeout 
)
static

TESTPOINT: pipe put

◆ tpipe_put_no_wait()

static void tpipe_put_no_wait ( struct k_pipe ppipe)
static

TESTPOINT: pipe put

◆ tpipe_put_small_size()

static void tpipe_put_small_size ( struct k_pipe ppipe,
k_timeout_t  timeout 
)
static

TESTPOINT: pipe put

◆ tpipe_thread_thread()

static void tpipe_thread_thread ( struct k_pipe ppipe)
static

TESTPOINT: thread-thread data passing via pipe

◆ tThread_entry()

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

◆ ZTEST() [1/2]

ZTEST ( pipe_api  ,
test_pipe_cleanup   
)

TESTPOINT: test if a dynamically allocated buffer can be freed

TESTPOINT: nothing to do with k_pipe_cleanup() for static buffer in pipe

◆ ZTEST() [2/2]

ZTEST ( pipe_api_1cpu  ,
test_pipe_alloc   
)

Test Initialization and buffer allocation of pipe, with various parameters.

See also
k_pipe_alloc_init(), k_pipe_cleanup()

Variable Documentation

◆ data

ZTEST_DMEM unsigned char data[]
static
Initial value:
=
"abcd1234$%^&PIPEefgh5678!/?*EPIPijkl9012[]<>PEPImnop3456{}()IPEP"

◆ pipe1

struct k_pipe pipe pipe1

◆ tdata

struct k_thread tdata

◆ tdata1

struct k_thread tdata1

◆ tdata2

struct k_thread tdata2