Zephyr API Documentation 4.1.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
test_mbox_api.c File Reference
#include <zephyr/ztest.h>

Macros

#define TIMEOUT   K_MSEC(100)
 
#define STACK_SIZE   (512 + CONFIG_TEST_EXTRA_STACK_SIZE)
 
#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
}
 

Functions

 K_MBOX_DEFINE (kmbox)
 TESTPOINT: init via K_MBOX_DEFINE.
 
static K_THREAD_STACK_DEFINE (tstack,(512+CONFIG_TEST_EXTRA_STACK_SIZE))
 
static K_THREAD_STACK_DEFINE (tstack_1,(512+CONFIG_TEST_EXTRA_STACK_SIZE))
 
static K_THREAD_STACK_ARRAY_DEFINE (waiting_get_stack, 5,(512+CONFIG_TEST_EXTRA_STACK_SIZE))
 
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)
 Test mailbox initialization.
 
void test_mbox_kdefine (void)
 Test mailbox definition.
 
void test_mbox_enhanced_capabilities (void)
 Test mailbox enhanced capabilities.
 
void test_define_multi_mbox (void)
 Test that multiple mailboxs can be defined.
 
void test_mbox_put_get_null (void)
 Test case for mailbox put and get operations with null data.
 
void test_mbox_put_get_buffer (void)
 Test case for mailbox put and get operations with buffer.
 
void test_mbox_async_put_get_buffer (void)
 Test case for mailbox asynchronous put and get operations with buffer.
 
void test_mbox_async_put_get_block (void)
 Test case for mailbox asynchronous put and get operations with block.
 
void test_mbox_target_source_thread_buffer (void)
 Test case for mailbox target/source thread buffer operations.
 
void test_mbox_incorrect_receiver_tid (void)
 Test case for mailbox incorrect receiver thread ID.
 
void test_mbox_incorrect_transmit_tid (void)
 Test case for mailbox incorrect transmit thread ID.
 
void test_mbox_timed_out_mbox_get (void)
 Test case for mailbox timed out get operation.
 
void test_mbox_msg_tid_mismatch (void)
 Test case for mailbox message thread ID mismatch.
 
void test_mbox_dispose_size_0_msg (void)
 Test case for mailbox dispose size 0 message.
 
void test_mbox_async_put_to_waiting_get (void)
 Test case for mailbox asynchronous put to waiting get operation.
 
void test_mbox_get_waiting_put_incorrect_tid (void)
 Test case for mailbox get waiting put with incorrect thread ID.
 
void test_mbox_async_multiple_put (void)
 Test case for mailbox asynchronous multiple put operation.
 
void test_mbox_multiple_waiting_get (void)
 Test case for mailbox multiple waiting get operation.
 
void * setup_mbox_api (void)
 
 ZTEST_SUITE (mbox_api, NULL, setup_mbox_api, NULL, NULL, NULL)
 

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 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]
 

Macro Definition Documentation

◆ MAIL_LEN

#define MAIL_LEN   64

◆ STACK_SIZE

#define STACK_SIZE   (512 + CONFIG_TEST_EXTRA_STACK_SIZE)

◆ 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 

Function Documentation

◆ async_put_sema_give()

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

◆ K_MBOX_DEFINE()

K_MBOX_DEFINE ( kmbox )

TESTPOINT: init via K_MBOX_DEFINE.

◆ K_THREAD_STACK_ARRAY_DEFINE()

static K_THREAD_STACK_ARRAY_DEFINE ( waiting_get_stack ,
5 ,
(512+CONFIG_TEST_EXTRA_STACK_SIZE)  )
static

◆ K_THREAD_STACK_DEFINE() [1/2]

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

◆ K_THREAD_STACK_DEFINE() [2/2]

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

◆ mbox_get_waiting_thread()

static void mbox_get_waiting_thread ( 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

◆ ZTEST_SUITE()

ZTEST_SUITE ( mbox_api ,
NULL ,
setup_mbox_api ,
NULL ,
NULL ,
NULL  )

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 async_tid waiting_get_tid[5]
static