Zephyr Project API  3.4.0
A Scalable Open Source RTOS
sip_svc_controller.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2023, Intel Corporation.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#ifndef ZEPHYR_SIP_SVC_CONTROLLER_H_
8#define ZEPHYR_SIP_SVC_CONTROLLER_H_
9
14#ifdef CONFIG_ARM_SIP_SVC_SUBSYS
15
20#define SIP_SVC_SUBSYS_CONDUIT_NAME_LENGTH (4)
21
26struct sip_svc_client {
27
28 /* Client id internal to sip_svc*/
29 uint32_t id;
30 /* Client's token id provided back to client during sip_svc_register() */
31 uint32_t token;
32 /* Client's state */
34 /* Total Number of on-going transaction of the client */
35 uint32_t active_trans_cnt;
36 /* Private data of each client , Provided during sip_svc_register() */
37 void *priv_data;
38 /* Transaction id pool for each client */
39 struct sip_svc_id_pool *trans_idx_pool;
40};
41
46struct sip_svc_controller {
47
48 /* Initialization status*/
49 bool init;
50 /* Total number of clients*/
51 const uint32_t num_clients;
52 /* Maximum allowable transactions in the system per controller*/
53 const uint32_t max_transactions;
54 /* Response size of buffer used for ASYNC transaction*/
55 const uint32_t resp_size;
56 /* Total Number of active transactions */
57 uint32_t active_job_cnt;
58 /* Active ASYNC transactions */
59 uint32_t active_async_job_cnt;
60 /* Supervisory call name , got from dts entry */
61 char method[SIP_SVC_SUBSYS_CONDUIT_NAME_LENGTH];
62 /* Pointer to driver instance */
63 const struct device *dev;
64 /* Pointer to client id pool */
65 struct sip_svc_id_pool *client_id_pool;
66 /* Pointer to database for storing arguments from sip_svc_send() */
67 struct sip_svc_id_map *trans_id_map;
68 /* Pointer to client array */
69 struct sip_svc_client *clients;
70 /* Pointer to Buffer used for storing response from lower layers */
71 uint8_t *async_resp_data;
72 /* Thread id of sip_svc thread */
74
75#if CONFIG_ARM_SIP_SVC_SUBSYS_SINGLY_OPEN
76 /* Mutex to restrict one client access */
77 struct k_mutex open_mutex;
78#endif
79 /* Mutex for protecting database access */
80 struct k_mutex data_mutex;
81 /* msgq for sending sip_svc_request to sip_svc thread */
82 struct k_msgq req_msgq;
83 /* sip_svc thread object */
84 struct k_thread thread;
85 /* Stack object of sip_svc thread */
86 K_KERNEL_STACK_MEMBER(stack, CONFIG_ARM_SIP_SVC_SUBSYS_THREAD_STACK_SIZE);
87};
88
94#define SIP_SVC_CONTROLLER_DEFINE(inst, conduit_name, sip_dev, sip_num_clients, \
95 sip_max_transactions, sip_resp_size) \
96 static STRUCT_SECTION_ITERABLE(sip_svc_controller, sip_svc_##inst) = { \
97 .method = conduit_name, \
98 .dev = sip_dev, \
99 .num_clients = sip_num_clients, \
100 .max_transactions = sip_max_transactions, \
101 .resp_size = sip_resp_size, \
102 }
103
104#else
105#define SIP_SVC_CONTROLLER_DEFINE(inst, conduit_name, sip_dev, sip_num_clients, \
106 sip_max_transactions, sip_resp_size)
107#endif
108
109#endif /* ZEPHYR_SIP_SVC_CONTROLLER_H_ */
static struct k_thread thread[2]
Definition: atomic.c:26
static k_tid_t tid[ARRAY_SIZE(timeout_order_data_mult_fifo)]
Definition: main.c:86
#define K_KERNEL_STACK_MEMBER(sym, size)
Define an embedded stack memory region.
Definition: thread_stack.h:324
state
Definition: parser_state.h:29
char stack[2048]
Definition: main.c:22
__UINT32_TYPE__ uint32_t
Definition: stdint.h:90
__UINT8_TYPE__ uint8_t
Definition: stdint.h:88
Runtime device structure (in ROM) per driver instance.
Definition: device.h:380
Message Queue Structure.
Definition: kernel.h:4306
Definition: kernel.h:2822
Definition: thread.h:245