Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
main.c File Reference
#include <ztest.h>
#include <irq_offload.h>
#include <sys/__assert.h>
#include <sys/util.h>

Data Structures

struct  scratch_fifo_packet
 
struct  reply_packet
 
struct  timeout_order_data
 

Macros

#define NUM_SCRATCH_FIFO_PACKETS   20
 
#define TIMEOUT_ORDER_NUM_THREADS   ARRAY_SIZE(timeout_order_data_mult_fifo)
 
#define TSTACK_SIZE   (512 + CONFIG_TEST_EXTRA_STACKSIZE)
 
#define FIFO_THREAD_PRIO   -5
 

Functions

static K_THREAD_STACK_ARRAY_DEFINE (ttstack, ARRAY_SIZE(timeout_order_data_mult_fifo),(512+CONFIG_TEST_EXTRA_STACKSIZE))
 
static voidget_scratch_packet (void)
 
static void put_scratch_packet (void *packet)
 
static bool is_timeout_in_range (uint32_t start_time, uint32_t timeout)
 
static void test_thread_put_timeout (void *p1, void *p2, void *p3)
 
static void test_thread_pend_and_timeout (void *p1, void *p2, void *p3)
 
static int test_multiple_threads_pending (struct timeout_order_data *test_data, int test_data_size)
 
static void test_thread_pend_and_get_data (void *p1, void *p2, void *p3)
 
static int test_multiple_threads_get_data (struct timeout_order_data *test_data, int test_data_size)
 
static void test_thread_timeout_reply_values (void *p1, void *p2, void *p3)
 
static void test_thread_timeout_reply_values_wfe (void *p1, void *p2, void *p3)
 
static void test_timeout_empty_fifo (void)
 Test empty fifo with timeout and K_NO_WAIT. More...
 
static void test_timeout_non_empty_fifo (void)
 Test non empty fifo with timeout and K_NO_WAIT. More...
 
static void test_timeout_fifo_thread (void)
 Test fifo with timeout and K_NO_WAIT. More...
 
static void test_timeout_threads_pend_on_fifo (void)
 Test fifo with different timeouts. More...
 
static void test_timeout_threads_pend_on_dual_fifos (void)
 Test multiple fifos with different timeouts. More...
 
static void test_timeout_threads_pend_fail_on_fifo (void)
 Test same fifo with different timeouts. More...
 
static void test_timeout_setup (void)
 Test fifo init. More...
 
void test_main (void)
 

Variables

struct scratch_fifo_packet scratch_fifo_packets [20]
 
struct k_fifo scratch_fifo_packets_fifo
 
static struct k_fifo fifo_timeout [2]
 
struct k_fifo timeout_order_fifo
 
struct timeout_order_data timeout_order_data []
 
struct timeout_order_data timeout_order_data_mult_fifo []
 
static struct k_thread ttdata [ARRAY_SIZE(timeout_order_data_mult_fifo)]
 
static k_tid_t tid [ARRAY_SIZE(timeout_order_data_mult_fifo)]
 

Macro Definition Documentation

◆ FIFO_THREAD_PRIO

#define FIFO_THREAD_PRIO   -5

◆ NUM_SCRATCH_FIFO_PACKETS

#define NUM_SCRATCH_FIFO_PACKETS   20

◆ TIMEOUT_ORDER_NUM_THREADS

#define TIMEOUT_ORDER_NUM_THREADS   ARRAY_SIZE(timeout_order_data_mult_fifo)

◆ TSTACK_SIZE

#define TSTACK_SIZE   (512 + 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_fifo ,
(512+CONFIG_TEST_EXTRA_STACKSIZE)   
)
static

◆ put_scratch_packet()

static void put_scratch_packet ( void packet)
static

◆ test_main()

void test_main ( void  )

◆ test_multiple_threads_get_data()

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

◆ test_multiple_threads_pending()

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

◆ test_thread_pend_and_get_data()

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

◆ test_thread_pend_and_timeout()

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

◆ test_thread_put_timeout()

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

◆ test_thread_timeout_reply_values()

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

◆ test_thread_timeout_reply_values_wfe()

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

Variable Documentation

◆ fifo_timeout

struct k_fifo fifo_timeout[2]
static

◆ scratch_fifo_packets

struct scratch_fifo_packet scratch_fifo_packets[20]

◆ scratch_fifo_packets_fifo

struct k_fifo scratch_fifo_packets_fifo

◆ tid

◆ timeout_order_data

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

◆ timeout_order_data_mult_fifo

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

◆ timeout_order_fifo

struct k_fifo timeout_order_fifo

◆ ttdata