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

Data Structures

struct  mem_block
 

Macros

#define STACK_SIZE   (1024 + CONFIG_TEST_EXTRA_STACKSIZE)
 
#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)
 
 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_STACKSIZE))
 
 K_THREAD_STACK_DEFINE (tstack1,(1024+CONFIG_TEST_EXTRA_STACKSIZE))
 
 K_THREAD_STACK_DEFINE (tstack2,(1024+CONFIG_TEST_EXTRA_STACKSIZE))
 
 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)
 
void test_pipe_alloc (void)
 Test Initialization and buffer allocation of pipe, with various parameters. More...
 
static void thread_for_get_forever (void *p1, void *p2, void *p3)
 
void test_pipe_cleanup (void)
 
static void thread_handler (void *p1, void *p2, void *p3)
 
void test_pipe_thread2thread (void)
 Test pipe data passing between threads. More...
 
void test_pipe_user_thread2thread (void)
 Test data passing using pipes between user threads. More...
 
void test_resource_pool_auto_free (void)
 Test resource pool free. More...
 
static void tThread_half_pipe_put (void *p1, void *p2, void *p3)
 
static void tThread_half_pipe_get (void *p1, void *p2, void *p3)
 
void test_half_pipe_put_get (void)
 Test put/get with smaller pipe buffer. More...
 
void test_pipe_get_put (void)
 
void test_pipe_get_large (void)
 
void test_pipe_reader_wait (void)
 Test pending reader in pipe. More...
 

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_STACKSIZE)

◆ 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_STACKSIZE)   
)

◆ K_THREAD_STACK_DEFINE() [2/3]

K_THREAD_STACK_DEFINE ( tstack1  ,
(1024+CONFIG_TEST_EXTRA_STACKSIZE)   
)

◆ K_THREAD_STACK_DEFINE() [3/3]

K_THREAD_STACK_DEFINE ( tstack2  ,
(1024+CONFIG_TEST_EXTRA_STACKSIZE)   
)

◆ test_pipe_alloc()

void test_pipe_alloc ( void  )

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

See also
k_pipe_alloc_init(), k_pipe_cleanup()

◆ test_pipe_cleanup()

void test_pipe_cleanup ( void  )

TESTPOINT: test if a dynamically allocated buffer can be freed

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

◆ 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

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