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

Macros

#define MSGQ_LEN   (2)
 
#define STACK_SIZE   (512 + CONFIG_TEST_EXTRA_STACKSIZE)
 
#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_STACKSIZE))
 
 K_THREAD_STACK_DEFINE (service1_stack,(512+CONFIG_TEST_EXTRA_STACKSIZE))
 
 K_THREAD_STACK_DEFINE (service2_stack,(512+CONFIG_TEST_EXTRA_STACKSIZE))
 
 K_THREAD_STACK_DEFINE (client_stack,(512+CONFIG_TEST_EXTRA_STACKSIZE))
 
 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)
 
void test_msgq_usage (void)
 
void test_main (void)
 

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

◆ 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_STACKSIZE)   
)

◆ K_THREAD_STACK_DEFINE() [2/4]

K_THREAD_STACK_DEFINE ( service1_stack  ,
(512+CONFIG_TEST_EXTRA_STACKSIZE)   
)

◆ K_THREAD_STACK_DEFINE() [3/4]

K_THREAD_STACK_DEFINE ( service2_stack  ,
(512+CONFIG_TEST_EXTRA_STACKSIZE)   
)

◆ K_THREAD_STACK_DEFINE() [4/4]

K_THREAD_STACK_DEFINE ( service_manager_stack  ,
(512+CONFIG_TEST_EXTRA_STACKSIZE)   
)

◆ 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

◆ test_main()

void test_main ( void  )

test case main entry

◆ test_msgq_usage()

void test_msgq_usage ( void  )

Variable Documentation

◆ client

struct k_thread client

◆ client_buf

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

◆ client_msgq

struct k_msgq client_msgq

◆ 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