Zephyr Project API 3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
main.c File Reference

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_STACK_SIZE)
 
#define FIFO_THREAD_PRIO   -5
 

Functions

 LOG_MODULE_REGISTER (test)
 
static K_THREAD_STACK_ARRAY_DEFINE (ttstack, ARRAY_SIZE(timeout_order_data_mult_fifo),(512+CONFIG_TEST_EXTRA_STACK_SIZE))
 
static void * get_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)
 
 ZTEST (fifo_timeout_1cpu, test_timeout_empty_fifo)
 Test empty fifo with timeout and K_NO_WAIT.
 
 ZTEST (fifo_timeout, test_timeout_non_empty_fifo)
 Test non empty fifo with timeout and K_NO_WAIT.
 
 ZTEST (fifo_timeout_1cpu, test_timeout_fifo_thread)
 Test fifo with timeout and K_NO_WAIT.
 
 ZTEST (fifo_timeout_1cpu, test_timeout_threads_pend_on_fifo)
 Test fifo with different timeouts.
 
 ZTEST (fifo_timeout_1cpu, test_timeout_threads_pend_on_dual_fifos)
 Test multiple fifos with different timeouts.
 
 ZTEST (fifo_timeout_1cpu, test_timeout_threads_pend_fail_on_fifo)
 Test same fifo with different timeouts.
 
static void * test_timeout_setup (void)
 Test fifo init.
 
 ZTEST_SUITE (fifo_timeout, NULL, test_timeout_setup, NULL, NULL, NULL)
 
 ZTEST_SUITE (fifo_timeout_1cpu, NULL, test_timeout_setup, ztest_simple_1cpu_before, ztest_simple_1cpu_after, NULL)
 

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

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_STACK_SIZE)   
)
static

◆ LOG_MODULE_REGISTER()

LOG_MODULE_REGISTER ( test  )

◆ put_scratch_packet()

static void put_scratch_packet ( void *  packet)
static

◆ 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

◆ ZTEST_SUITE() [1/2]

ZTEST_SUITE ( fifo_timeout  ,
NULL  ,
test_timeout_setup  ,
NULL  ,
NULL  ,
NULL   
)

◆ ZTEST_SUITE() [2/2]

ZTEST_SUITE ( fifo_timeout_1cpu  ,
NULL  ,
test_timeout_setup  ,
ztest_simple_1cpu_before  ,
ztest_simple_1cpu_after  ,
NULL   
)

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:56

◆ 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