Zephyr Project API 3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
main.c File Reference
#include <zephyr/kernel.h>
#include <zephyr/irq_offload.h>
#include <zephyr/ztest.h>
#include <limits.h>

Macros

#define MSGQ_LEN   (2)
 
#define STACK_SIZE   (512 + CONFIG_TEST_EXTRA_STACK_SIZE)
 
#define NUM_SERVICES   2
 
#define TIMEOUT   K_MSEC(100)
 

Enumerations

enum  message_info {
  QUERRY_SERVICE = 1 , REGISTER_SERVICE1 , REGISTER_SERVICE2 , GET_SERVICE ,
  SERVICE1_RUNNING , SERVICE2_RUNNING , SERVICE_QUIT
}
 

Functions

 K_MSGQ_DEFINE (manager_q, sizeof(unsigned long) *2, 4, 4)
 
 K_THREAD_STACK_DEFINE (service_manager_stack,(512+CONFIG_TEST_EXTRA_STACK_SIZE))
 
 K_THREAD_STACK_DEFINE (service1_stack,(512+CONFIG_TEST_EXTRA_STACK_SIZE))
 
 K_THREAD_STACK_DEFINE (service2_stack,(512+CONFIG_TEST_EXTRA_STACK_SIZE))
 
 K_THREAD_STACK_DEFINE (client_stack,(512+CONFIG_TEST_EXTRA_STACK_SIZE))
 
 K_SEM_DEFINE (service_sema, 2, 2)
 
 K_SEM_DEFINE (service_started, 0, 2)
 
 K_SEM_DEFINE (test_continue, 0, 1)
 
static void service_manager_entry (void *p1, void *p2, void *p3)
 
static void start_service_manager (void)
 
static void service1_entry (void *p1, void *p2, void *p3)
 
static void service2_entry (void *p1, void *p2, void *p3)
 
static void register_service (void)
 
static void client_entry (void *p1, void *p2, void *p3)
 
static void start_client (void)
 
 ZTEST (msgq_usage, test_msgq_usage)
 
 ZTEST_SUITE (msgq_usage, NULL, NULL, NULL, NULL, NULL)
 

Variables

struct k_msgq service1_msgq
 
struct k_msgq service2_msgq
 
struct k_msgq client_msgq
 
struct k_thread service_manager
 
struct k_thread service1
 
struct k_thread service2
 
struct k_thread client_thread
 
static ZTEST_DMEM unsigned long service1_buf [(2)]
 
static ZTEST_DMEM unsigned long service2_buf [(2)]
 
static ZTEST_DMEM unsigned long client_buf [(2) *2]
 
static ZTEST_DMEM struct k_msgqservices [2]
 
static ZTEST_DMEM struct k_msgqpclient
 
static ZTEST_DMEM bool service1_run
 
static ZTEST_DMEM bool service2_run
 
static ZTEST_DMEM k_tid_t tservice_manager
 
static ZTEST_DMEM k_tid_t tservice1
 
static ZTEST_DMEM k_tid_t tservice2
 
static ZTEST_DMEM k_tid_t tclient
 

Macro Definition Documentation

◆ MSGQ_LEN

#define MSGQ_LEN   (2)

◆ NUM_SERVICES

#define NUM_SERVICES   2

◆ STACK_SIZE

#define STACK_SIZE   (512 + CONFIG_TEST_EXTRA_STACK_SIZE)

◆ TIMEOUT

#define TIMEOUT   K_MSEC(100)

Enumeration Type Documentation

◆ message_info

Enumerator
QUERRY_SERVICE 
REGISTER_SERVICE1 
REGISTER_SERVICE2 
GET_SERVICE 
SERVICE1_RUNNING 
SERVICE2_RUNNING 
SERVICE_QUIT 

Function Documentation

◆ client_entry()

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

◆ K_MSGQ_DEFINE()

K_MSGQ_DEFINE ( manager_q  ,
sizeof(unsigned long) *  2,
,
 
)

◆ K_SEM_DEFINE() [1/3]

K_SEM_DEFINE ( service_sema  ,
,
 
)

◆ K_SEM_DEFINE() [2/3]

K_SEM_DEFINE ( service_started  ,
,
 
)

◆ K_SEM_DEFINE() [3/3]

K_SEM_DEFINE ( test_continue  ,
,
 
)

◆ K_THREAD_STACK_DEFINE() [1/4]

K_THREAD_STACK_DEFINE ( client_stack  ,
(512+CONFIG_TEST_EXTRA_STACK_SIZE)   
)

◆ K_THREAD_STACK_DEFINE() [2/4]

K_THREAD_STACK_DEFINE ( service1_stack  ,
(512+CONFIG_TEST_EXTRA_STACK_SIZE)   
)

◆ K_THREAD_STACK_DEFINE() [3/4]

K_THREAD_STACK_DEFINE ( service2_stack  ,
(512+CONFIG_TEST_EXTRA_STACK_SIZE)   
)

◆ K_THREAD_STACK_DEFINE() [4/4]

K_THREAD_STACK_DEFINE ( service_manager_stack  ,
(512+CONFIG_TEST_EXTRA_STACK_SIZE)   
)

◆ register_service()

static void register_service ( void  )
static

◆ service1_entry()

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

◆ service2_entry()

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

◆ service_manager_entry()

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

◆ start_client()

static void start_client ( void  )
static

◆ start_service_manager()

static void start_service_manager ( void  )
static

◆ ZTEST()

ZTEST ( msgq_usage  ,
test_msgq_usage   
)

◆ ZTEST_SUITE()

ZTEST_SUITE ( msgq_usage  ,
NULL  ,
NULL  ,
NULL  ,
NULL  ,
NULL   
)

Variable Documentation

◆ client_buf

ZTEST_DMEM unsigned long client_buf[(2) *2]
static

◆ client_msgq

struct k_msgq client_msgq

◆ client_thread

struct k_thread client_thread

◆ pclient

ZTEST_DMEM struct k_msgq* pclient
static

◆ service1

struct k_thread service1

◆ service1_buf

ZTEST_DMEM unsigned long service1_buf[(2)]
static

◆ service1_msgq

struct k_msgq service1_msgq

◆ service1_run

ZTEST_DMEM bool service1_run
static

◆ service2

struct k_thread service2

◆ service2_buf

ZTEST_DMEM unsigned long service2_buf[(2)]
static

◆ service2_msgq

struct k_msgq service2_msgq

◆ service2_run

ZTEST_DMEM bool service2_run
static

◆ service_manager

struct k_thread service_manager

◆ services

ZTEST_DMEM struct k_msgq* services[2]
static

◆ tclient

ZTEST_DMEM k_tid_t tclient
static

◆ tservice1

ZTEST_DMEM k_tid_t tservice1
static

◆ tservice2

ZTEST_DMEM k_tid_t tservice2
static

◆ tservice_manager

ZTEST_DMEM k_tid_t tservice_manager
static