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

Macros

#define TIMEOUT   K_MSEC(100)
 
#define STACK_SIZE   (512 + CONFIG_TEST_EXTRA_STACKSIZE)
 
#define MAIL_LEN   64
 

Enumerations

enum  mmsg_type {
  PUT_GET_NULL = 0 , PUT_GET_BUFFER , ASYNC_PUT_GET_BUFFER , ASYNC_PUT_GET_BLOCK ,
  TARGET_SOURCE_THREAD_BUFFER , MAX_INFO_TYPE , INCORRECT_RECEIVER_TID , INCORRECT_TRANSMIT_TID ,
  TIMED_OUT_MBOX_GET , MSG_TID_MISMATCH , DISPOSE_SIZE_0_MSG , ASYNC_PUT_TO_WAITING_GET ,
  GET_WAITING_PUT_INCORRECT_TID , ASYNC_MULTIPLE_PUT , MULTIPLE_WAITING_GET , PUT_GET_NULL = 0 ,
  TARGET_SOURCE
}
 

Functions

 K_MBOX_DEFINE (kmbox)
 
static K_THREAD_STACK_DEFINE (tstack,(512+CONFIG_TEST_EXTRA_STACKSIZE))
 
static K_THREAD_STACK_DEFINE (rtstack,(512+CONFIG_TEST_EXTRA_STACKSIZE))
 
static K_THREAD_STACK_DEFINE (tstack_1,(512+CONFIG_TEST_EXTRA_STACKSIZE))
 
static K_THREAD_STACK_ARRAY_DEFINE (waiting_get_stack, 5,(512+CONFIG_TEST_EXTRA_STACKSIZE))
 
static void async_put_sema_give (void *p1, void *p2, void *p3)
 
static void mbox_get_waiting_thread (void *p1, void *p2, void *p3)
 
static void tmbox_put (struct k_mbox *pmbox)
 
static void tmbox_get (struct k_mbox *pmbox)
 
static void tmbox_entry (void *p1, void *p2, void *p3)
 
static void tmbox (struct k_mbox *pmbox)
 
void test_mbox_kinit (void)
 
void test_mbox_kdefine (void)
 
 K_MBOX_DEFINE (send_mbox)
 
static void thread_mbox_data_get_null (void *p1, void *p2, void *p3)
 
void test_mbox_data_get_null (void)
 Test k_mbox_data_get() API. More...
 
static void thread_mbox_get_block_data (void *p1, void *p2, void *p3)
 
static void thread_mbox_put_block_data (void *p1, void *p2, void *p3)
 
void test_mbox_get_put_block_data (void)
 Test put and get mailbox with block data. More...
 
void test_enhance_capability (void)
 
void test_define_multi_mbox (void)
 
void test_mbox_put_get_null (void)
 
void test_mbox_put_get_buffer (void)
 
void test_mbox_async_put_get_buffer (void)
 
void test_mbox_async_put_get_block (void)
 
void test_mbox_target_source_thread_buffer (void)
 
void test_mbox_incorrect_receiver_tid (void)
 
void test_mbox_incorrect_transmit_tid (void)
 
void test_mbox_timed_out_mbox_get (void)
 
void test_mbox_msg_tid_mismatch (void)
 
void test_mbox_dispose_size_0_msg (void)
 
void test_mbox_async_put_to_waiting_get (void)
 
void test_mbox_get_waiting_put_incorrect_tid (void)
 
void test_mbox_async_multiple_put (void)
 
void test_mbox_multiple_waiting_get (void)
 

Variables

static struct k_mbox mbox
 
static k_tid_t sender_tid
 
static k_tid_t receiver_tid
 
static k_tid_t random_tid
 
static struct k_thread tdata rtdata async_tid waiting_get_tid [5]
 
static struct k_sem end_sema sync_sema
 
static enum mmsg_type info_type
 
static char data [MAX_INFO_TYPE][64]
 
static ZTEST_BMEM char buffer [8]
 Test mailbox enhance capabilities. More...
 

Macro Definition Documentation

◆ MAIL_LEN

#define MAIL_LEN   64

◆ STACK_SIZE

#define STACK_SIZE   (512 + CONFIG_TEST_EXTRA_STACKSIZE)

◆ TIMEOUT

#define TIMEOUT   K_MSEC(100)

Enumeration Type Documentation

◆ mmsg_type

enum mmsg_type
Enumerator
PUT_GET_NULL 
PUT_GET_BUFFER 
ASYNC_PUT_GET_BUFFER 
ASYNC_PUT_GET_BLOCK 
TARGET_SOURCE_THREAD_BUFFER 
MAX_INFO_TYPE 
INCORRECT_RECEIVER_TID 
INCORRECT_TRANSMIT_TID 
TIMED_OUT_MBOX_GET 
MSG_TID_MISMATCH 
DISPOSE_SIZE_0_MSG 
ASYNC_PUT_TO_WAITING_GET 
GET_WAITING_PUT_INCORRECT_TID 
ASYNC_MULTIPLE_PUT 
MULTIPLE_WAITING_GET 
PUT_GET_NULL 
TARGET_SOURCE 

Function Documentation

◆ async_put_sema_give()

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

◆ K_MBOX_DEFINE() [1/2]

K_MBOX_DEFINE ( kmbox  )

TESTPOINT: init via K_MBOX_DEFINE

◆ K_MBOX_DEFINE() [2/2]

K_MBOX_DEFINE ( send_mbox  )

◆ K_THREAD_STACK_ARRAY_DEFINE()

static K_THREAD_STACK_ARRAY_DEFINE ( waiting_get_stack  ,
,
(512+CONFIG_TEST_EXTRA_STACKSIZE)   
)
static

◆ K_THREAD_STACK_DEFINE() [1/3]

static K_THREAD_STACK_DEFINE ( rtstack  ,
(512+CONFIG_TEST_EXTRA_STACKSIZE)   
)
static

◆ K_THREAD_STACK_DEFINE() [2/3]

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

◆ K_THREAD_STACK_DEFINE() [3/3]

static K_THREAD_STACK_DEFINE ( tstack_1  ,
(512+CONFIG_TEST_EXTRA_STACKSIZE)   
)
static

◆ mbox_get_waiting_thread()

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

◆ test_define_multi_mbox()

void test_define_multi_mbox ( void  )

TESTPOINT: init via k_mbox_init

◆ test_enhance_capability()

void test_enhance_capability ( void  )

◆ test_mbox_async_multiple_put()

void test_mbox_async_multiple_put ( void  )

◆ test_mbox_async_put_get_block()

void test_mbox_async_put_get_block ( void  )

◆ test_mbox_async_put_get_buffer()

void test_mbox_async_put_get_buffer ( void  )

◆ test_mbox_async_put_to_waiting_get()

void test_mbox_async_put_to_waiting_get ( void  )

◆ test_mbox_dispose_size_0_msg()

void test_mbox_dispose_size_0_msg ( void  )

◆ test_mbox_get_waiting_put_incorrect_tid()

void test_mbox_get_waiting_put_incorrect_tid ( void  )

◆ test_mbox_incorrect_receiver_tid()

void test_mbox_incorrect_receiver_tid ( void  )

◆ test_mbox_incorrect_transmit_tid()

void test_mbox_incorrect_transmit_tid ( void  )

◆ test_mbox_kdefine()

void test_mbox_kdefine ( void  )

◆ test_mbox_kinit()

void test_mbox_kinit ( void  )

TESTPOINT: init via k_mbox_init

◆ test_mbox_msg_tid_mismatch()

void test_mbox_msg_tid_mismatch ( void  )

◆ test_mbox_multiple_waiting_get()

void test_mbox_multiple_waiting_get ( void  )

◆ test_mbox_put_get_buffer()

void test_mbox_put_get_buffer ( void  )

◆ test_mbox_put_get_null()

void test_mbox_put_get_null ( void  )

◆ test_mbox_target_source_thread_buffer()

void test_mbox_target_source_thread_buffer ( void  )

◆ test_mbox_timed_out_mbox_get()

void test_mbox_timed_out_mbox_get ( void  )

◆ thread_mbox_data_get_null()

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

◆ thread_mbox_get_block_data()

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

◆ thread_mbox_put_block_data()

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

◆ tmbox()

static void tmbox ( struct k_mbox pmbox)
static

TESTPOINT: thread-thread data passing via mbox

◆ tmbox_entry()

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

◆ tmbox_get()

static void tmbox_get ( struct k_mbox pmbox)
static

TESTPOINT: mbox sync get buffer

TESTPOINT: mbox sync get buffer

TESTPOINT: mbox async get buffer

◆ tmbox_put()

static void tmbox_put ( struct k_mbox pmbox)
static

TESTPOINT: mbox sync put empty message

TESTPOINT: mbox sync put buffer

TESTPOINT: mbox async put buffer

Variable Documentation

◆ data

char data[MAX_INFO_TYPE][64]
static
Initial value:
= {
"send/recv an empty message",
"send/recv msg using a buffer",
"async send/recv msg using a memory block",
"specify target/source thread, using a memory block"
}

◆ info_type

enum mmsg_type info_type
static

◆ mbox

struct k_mbox mbox
static

◆ random_tid

k_tid_t random_tid
static

◆ receiver_tid

k_tid_t receiver_tid
static

◆ sender_tid

k_tid_t sender_tid
static

◆ sync_sema

struct k_sem end_sema sync_sema
static

◆ waiting_get_tid

struct k_thread tdata rtdata async_tid waiting_get_tid[5]
static