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

Data Structures

struct  scratch_lifo_packet
 
struct  reply_packet
 
struct  timeout_order_data
 

Macros

#define STACK_SIZE   (1024 + CONFIG_TEST_EXTRA_STACKSIZE)
 
#define LIST_LEN   2
 
#define NUM_SCRATCH_LIFO_PACKETS   20
 
#define TIMEOUT_ORDER_NUM_THREADS   ARRAY_SIZE(timeout_order_data_mult_lifo)
 
#define TSTACK_SIZE   (1024 + CONFIG_TEST_EXTRA_STACKSIZE)
 
#define LIFO_THREAD_PRIO   -5
 

Functions

static K_THREAD_STACK_DEFINE (tstack,(1024+CONFIG_TEST_EXTRA_STACKSIZE))
 
static K_THREAD_STACK_DEFINE (tstack1,(1024+CONFIG_TEST_EXTRA_STACKSIZE))
 
void test_thread_pend_and_timeout (void *p1, void *p2, void *p3)
 a thread pends on a lifo then times out More...
 
static K_THREAD_STACK_ARRAY_DEFINE (ttstack, ARRAY_SIZE(timeout_order_data_mult_lifo),(1024+CONFIG_TEST_EXTRA_STACKSIZE))
 
static voidget_scratch_packet (void)
 
static void put_scratch_packet (void *packet)
 
static void thread_entry_nowait (void *p1, void *p2, void *p3)
 
static bool is_timeout_in_range (uint32_t start_time, uint32_t timeout)
 
static int test_multiple_threads_pending (struct timeout_order_data *test_data, int test_data_size)
 
static void thread_entry_wait (void *p1, void *p2, void *p3)
 
static void test_thread_timeout_reply_values (void *p1, void *p2, void *p3)
 try getting data on lifo with special timeout value, return result in lifo More...
 
static void test_thread_timeout_reply_values_wfe (void *p1, void *p2, void *p3)
 
static void test_thread_put_timeout (void *p1, void *p2, void *p3)
 A thread sleeps then puts data on the lifo. More...
 
static void test_lifo_nowait (void)
 Test last in, first out queue using LIFO. More...
 
static void test_lifo_wait (void)
 Test pending reader in LIFO. More...
 
static void test_timeout_empty_lifo (void)
 Test reading empty LIFO. More...
 
static void test_timeout_non_empty_lifo (void)
 Test read and write operation in LIFO with timeout. More...
 
static void test_timeout_lifo_thread (void)
 Test LIFO with timeout. More...
 
static void test_timeout_threads_pend_on_lifo (void)
 Test multiple pending readers in LIFO. More...
 
static void test_para_init (void)
 Test LIFO initialization with various parameters. More...
 
void test_main (void)
 

Variables

struct k_lifo lifo plifo
 
static ldata_t data [2]
 
struct k_lifo timeout_order_lifo
 
static struct k_thread tdata tdata1
 
static struct k_sem start_sema wait_sema
 
static struct k_lifo lifo_timeout [2]
 
struct timeout_order_data timeout_order_data []
 
struct timeout_order_data timeout_order_data_mult_lifo []
 
struct scratch_lifo_packet scratch_lifo_packets [20]
 
struct k_lifo scratch_lifo_packets_lifo
 
static k_tid_t tid [ARRAY_SIZE(timeout_order_data_mult_lifo)]
 
static struct k_thread ttdata [ARRAY_SIZE(timeout_order_data_mult_lifo)]
 

Macro Definition Documentation

◆ LIFO_THREAD_PRIO

#define LIFO_THREAD_PRIO   -5

◆ LIST_LEN

#define LIST_LEN   2

◆ NUM_SCRATCH_LIFO_PACKETS

#define NUM_SCRATCH_LIFO_PACKETS   20

◆ STACK_SIZE

#define STACK_SIZE   (1024 + CONFIG_TEST_EXTRA_STACKSIZE)

◆ TIMEOUT_ORDER_NUM_THREADS

#define TIMEOUT_ORDER_NUM_THREADS   ARRAY_SIZE(timeout_order_data_mult_lifo)

◆ TSTACK_SIZE

#define TSTACK_SIZE   (1024 + CONFIG_TEST_EXTRA_STACKSIZE)

Function Documentation

◆ get_scratch_packet()

static void * get_scratch_packet ( void  )
static

◆ is_timeout_in_range()

static bool is_timeout_in_range ( uint32_t  start_time,
uint32_t  timeout 
)
static

◆ K_THREAD_STACK_ARRAY_DEFINE()

static K_THREAD_STACK_ARRAY_DEFINE ( ttstack  ,
ARRAY_SIZE(timeout_order_data_mult_lifo ,
(1024+CONFIG_TEST_EXTRA_STACKSIZE)   
)
static

◆ K_THREAD_STACK_DEFINE() [1/2]

static K_THREAD_STACK_DEFINE ( tstack  ,
(1024+CONFIG_TEST_EXTRA_STACKSIZE)   
)
static

◆ K_THREAD_STACK_DEFINE() [2/2]

static K_THREAD_STACK_DEFINE ( tstack1  ,
(1024+CONFIG_TEST_EXTRA_STACKSIZE)   
)
static

◆ put_scratch_packet()

static void put_scratch_packet ( void packet)
static

◆ test_main()

void test_main ( void  )

test case main entry

◆ test_multiple_threads_pending()

static int test_multiple_threads_pending ( struct timeout_order_data test_data,
int  test_data_size 
)
static

◆ thread_entry_nowait()

static void thread_entry_nowait ( void p1,
void p2,
void p3 
)
static

◆ thread_entry_wait()

static void thread_entry_wait ( void p1,
void p2,
void p3 
)
static

Variable Documentation

◆ data

ldata_t data[2]
static

◆ lifo_timeout

struct k_lifo lifo_timeout[2]
static

◆ plifo

struct k_lifo lifo plifo

◆ scratch_lifo_packets

struct scratch_lifo_packet scratch_lifo_packets[20]

◆ scratch_lifo_packets_lifo

struct k_lifo scratch_lifo_packets_lifo

◆ tdata1

struct k_thread tdata tdata1
static

◆ tid

◆ timeout_order_data

Initial value:
= {
{0, &lifo_timeout[0], 20, 2, 0},
{0, &lifo_timeout[0], 40, 4, 1},
{0, &lifo_timeout[0], 0, 0, 2},
{0, &lifo_timeout[0], 10, 1, 3},
{0, &lifo_timeout[0], 30, 3, 4},
}
static struct k_lifo lifo_timeout[2]
Definition: main.c:43

◆ timeout_order_data_mult_lifo

struct timeout_order_data timeout_order_data_mult_lifo[]
Initial value:
= {
{0, &lifo_timeout[1], 0, 0, 0},
{0, &lifo_timeout[0], 30, 3, 1},
{0, &lifo_timeout[0], 50, 5, 2},
{0, &lifo_timeout[1], 80, 8, 3},
{0, &lifo_timeout[1], 70, 7, 4},
{0, &lifo_timeout[0], 10, 1, 5},
{0, &lifo_timeout[0], 60, 6, 6},
{0, &lifo_timeout[0], 20, 2, 7},
{0, &lifo_timeout[1], 40, 4, 8},
}

◆ timeout_order_lifo

struct k_lifo timeout_order_lifo

◆ ttdata

◆ wait_sema

struct k_sem start_sema wait_sema
static