Vision Apps User Guide
app_ipc.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright (c) 2017 Texas Instruments Incorporated
4  *
5  * All rights reserved not granted herein.
6  *
7  * Limited License.
8  *
9  * Texas Instruments Incorporated grants a world-wide, royalty-free, non-exclusive
10  * license under copyrights and patents it now or hereafter owns or controls to make,
11  * have made, use, import, offer to sell and sell ("Utilize") this software subject to the
12  * terms herein. With respect to the foregoing patent license, such license is granted
13  * solely to the extent that any such patent is necessary to Utilize the software alone.
14  * The patent license shall not apply to any combinations which include this software,
15  * other than combinations with devices manufactured by or for TI ("TI Devices").
16  * No hardware patent is licensed hereunder.
17  *
18  * Redistributions must preserve existing copyright notices and reproduce this license
19  * (including the above copyright notice and the disclaimer and (if applicable) source
20  * code license limitations below) in the documentation and/or other materials provided
21  * with the distribution
22  *
23  * Redistribution and use in binary form, without modification, are permitted provided
24  * that the following conditions are met:
25  *
26  * * No reverse engineering, decompilation, or disassembly of this software is
27  * permitted with respect to any software provided in binary form.
28  *
29  * * any redistribution and use are licensed by TI for use only with TI Devices.
30  *
31  * * Nothing shall obligate TI to provide you with source code for the software
32  * licensed and provided to you in object code.
33  *
34  * If software source code is provided to you, modification and redistribution of the
35  * source code are permitted provided that the following conditions are met:
36  *
37  * * any redistribution and use of the source code, including any resulting derivative
38  * works, are licensed by TI for use only with TI Devices.
39  *
40  * * any redistribution and use of any object code compiled from the source code
41  * and any resulting derivative works, are licensed by TI for use only with TI Devices.
42  *
43  * Neither the name of Texas Instruments Incorporated nor the names of its suppliers
44  *
45  * may be used to endorse or promote products derived from this software without
46  * specific prior written permission.
47  *
48  * DISCLAIMER.
49  *
50  * THIS SOFTWARE IS PROVIDED BY TI AND TI'S LICENSORS "AS IS" AND ANY EXPRESS
51  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
52  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
53  * IN NO EVENT SHALL TI AND TI'S LICENSORS BE LIABLE FOR ANY DIRECT, INDIRECT,
54  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
55  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
56  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
57  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
58  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
59  * OF THE POSSIBILITY OF SUCH DAMAGE.
60  *
61  */
62 
63 #ifndef APP_IPC_H_
64 #define APP_IPC_H_
65 
66 #ifdef __cplusplus
67 extern "C" {
68 #endif
69 
70 #include <stdint.h>
71 #include <stdbool.h>
72 
73 /* #define APP_IPC_DEBUG */
74 
92 #if defined (SOC_J721E)
93 
94 #define APP_IPC_CPU_MPU1_0 ( 0u)
95 
96 #define APP_IPC_CPU_MCU1_0 ( 1u)
97 
98 #define APP_IPC_CPU_MCU1_1 ( 2u)
99 
100 #define APP_IPC_CPU_MCU2_0 ( 3u)
101 
102 #define APP_IPC_CPU_MCU2_1 ( 4u)
103 
104 #define APP_IPC_CPU_MCU3_0 ( 5u)
105 
106 #define APP_IPC_CPU_MCU3_1 ( 6u)
107 
108 #define APP_IPC_CPU_C6x_1 ( 7u)
109 
110 #define APP_IPC_CPU_C6x_2 ( 8u)
111 
112 #define APP_IPC_CPU_C7x_1 ( 9u)
113 
114 #define APP_IPC_CPU_MAX (10u)
115 
116 #define APP_IPC_CPU_INVALID (0xFFu)
117 #endif
118 
119 #if defined (SOC_J721S2)
120 
121 #define APP_IPC_CPU_MPU1_0 ( 0u)
122 
123 #define APP_IPC_CPU_MCU1_0 ( 1u)
124 
125 #define APP_IPC_CPU_MCU1_1 ( 2u)
126 
127 #define APP_IPC_CPU_MCU2_0 ( 3u)
128 
129 #define APP_IPC_CPU_MCU2_1 ( 4u)
130 
131 #define APP_IPC_CPU_MCU3_0 ( 5u)
132 
133 #define APP_IPC_CPU_MCU3_1 ( 6u)
134 
135 #define APP_IPC_CPU_C7x_1 ( 7u)
136 
137 #define APP_IPC_CPU_C7x_2 ( 8u)
138 
139 #define APP_IPC_CPU_MAX ( 9u)
140 
141 #define APP_IPC_CPU_INVALID (0xFFu)
142 #endif
143 
144 #if defined (SOC_J784S4)
145 
146 #define APP_IPC_CPU_MPU1_0 ( 0u)
147 
148 #define APP_IPC_CPU_MCU1_0 ( 1u)
149 
150 #define APP_IPC_CPU_MCU1_1 ( 2u)
151 
152 #define APP_IPC_CPU_MCU2_0 ( 3u)
153 
154 #define APP_IPC_CPU_MCU2_1 ( 4u)
155 
156 #define APP_IPC_CPU_MCU3_0 ( 5u)
157 
158 #define APP_IPC_CPU_MCU3_1 ( 6u)
159 
160 #define APP_IPC_CPU_MCU4_0 ( 7u)
161 
162 #define APP_IPC_CPU_MCU4_1 ( 8u)
163 
164 #define APP_IPC_CPU_C7x_1 ( 9u)
165 
166 #define APP_IPC_CPU_C7x_2 (10u)
167 
168 #define APP_IPC_CPU_C7x_3 (11u)
169 
170 #define APP_IPC_CPU_C7x_4 (12u)
171 
172 #define APP_IPC_CPU_MAX (13u)
173 
174 #define APP_IPC_CPU_INVALID (0xFFu)
175 #endif
176 
177 #if defined (SOC_J742S2)
178 
179 #define APP_IPC_CPU_MPU1_0 ( 0u)
180 
181 #define APP_IPC_CPU_MCU1_0 ( 1u)
182 
183 #define APP_IPC_CPU_MCU1_1 ( 2u)
184 
185 #define APP_IPC_CPU_MCU2_0 ( 3u)
186 
187 #define APP_IPC_CPU_MCU2_1 ( 4u)
188 
189 #define APP_IPC_CPU_MCU3_0 ( 5u)
190 
191 #define APP_IPC_CPU_MCU3_1 ( 6u)
192 
193 #define APP_IPC_CPU_MCU4_0 ( 7u)
194 
195 #define APP_IPC_CPU_MCU4_1 ( 8u)
196 
197 #define APP_IPC_CPU_C7x_1 ( 9u)
198 
199 #define APP_IPC_CPU_C7x_2 (10u)
200 
201 #define APP_IPC_CPU_C7x_3 (11u)
202 
203 #define APP_IPC_CPU_MAX (12u)
204 
205 #define APP_IPC_CPU_INVALID (0xFFu)
206 #endif
207 
208 #if defined (SOC_AM62A)
209 
210 #define APP_IPC_CPU_MPU1_0 ( 0u)
211 
212 #define APP_IPC_CPU_MCU1_0 ( 1u)
213 
214 #define APP_IPC_CPU_C7x_1 ( 2u)
215 
216 #define APP_IPC_CPU_MAX ( 3u)
217 
218 #define APP_IPC_CPU_INVALID (0xFFu)
219 #if defined(MCU_PLUS_SDK)
220 #define IPC_MAX_PROCS (3U)
221 #endif
222 #endif
223 
224 #if defined (SOC_J722S)
225 
226 #define APP_IPC_CPU_MPU1_0 ( 0u)
227 
228 #define APP_IPC_CPU_MCU1_0 ( 1u)
229 
230 #define APP_IPC_CPU_MCU2_0 ( 2u)
231 
232 #define APP_IPC_CPU_C7x_1 ( 3u)
233 
234 #define APP_IPC_CPU_C7x_2 ( 4u)
235 
236 #define APP_IPC_CPU_MCU_R5F ( 5u)
237 
238 #define APP_IPC_CPU_MAX ( 6u)
239 
240 #define APP_IPC_CPU_INVALID (0xFFu)
241 #if defined(MCU_PLUS_SDK)
242 #define IPC_MAX_PROCS (6U)
243 #endif
244 #endif
245 
246 /* @} */
247 
249 #define APP_IPC_HW_LOCK_MAX (256u)
250 
252 #define APP_IPC_WAIT_FOREVER (0xFFFFFFFFu)
253 
262 #define APP_IPC_TIOVX_RPMSG_PORT_ID (13u)
263 
265 #define APP_IPC_REMOTE_SERVICE_RPMSG_PORT_ID (21u)
266 
268 #define APP_IPC_ECHO_TEST_RPMSG_PORT_ID (14u)
269 
271 #define APP_IPC_RPMSG_PROTO_ECHO_TEST_RPMSG_PORT_ID (12u)
272 
273 /* @} */
274 
282 typedef void (*app_ipc_notify_handler_f)(uint32_t src_cpu_id, uint32_t payload);
283 
284 
288 typedef struct {
289 
290  uint32_t num_cpus;
291  uint32_t enabled_cpu_id_list[APP_IPC_CPU_MAX];
299  uint32_t self_cpu_id;
303 
312 
323 int32_t appIpcInit(app_ipc_init_prm_t *prm);
324 
333 int32_t appIpcDeInit(void);
334 
343 
352 int32_t appIpcSendNotify(uint32_t dest_cpu_id, uint32_t payload);
353 
363 int32_t appIpcSendNotifyPort(uint32_t dest_cpu_id, uint32_t payload, uint32_t port_id);
364 
370 uint32_t appIpcGetSelfCpuId(void);
371 
377 uint32_t appIpcGetHostPortId(uint16_t cpu_id);
378 
386 uint32_t appIpcIsCpuEnabled(uint32_t cpu_id);
387 
401 int32_t appIpcHwLockAcquire(uint32_t lock_id, uint32_t timeout);
402 
408 int32_t appIpcHwLockRelease(uint32_t lock_id);
409 
419 int32_t appIpcGetTiovxObjDescSharedMemInfo(void **addr, uint32_t *size);
420 
430 void appIpcGetTiovxLogRtSharedMemInfo(void **shm_base, uint32_t *shm_size);
431 
436 uint32_t appIpcGetIpcCpuId(uint32_t app_cpu_id);
437 
438 
443 uint32_t appIpcGetAppCpuId(char *name);
444 
449 const char *appIpcGetCpuName(uint32_t app_cpu_id);
450 
455 int32_t appIpcEchoTestStart(void);
456 
457 #ifdef __cplusplus
458 }
459 #endif
460 
461 /* @} */
462 
463 #endif /* APP_IPC_H_ */
464 
uint32_t tiovx_rpmsg_port_id
Definition: app_ipc.h:292
uint32_t appIpcGetIpcCpuId(uint32_t app_cpu_id)
Convert from APP_CPU_xxx to IPC LLD CPU ID.
void * ipc_resource_tbl
Definition: app_ipc.h:300
void * tiovx_log_rt_mem
Definition: app_ipc.h:297
const char * appIpcGetCpuName(uint32_t app_cpu_id)
Get CPU name from CPU ID.
int32_t appIpcHwLockRelease(uint32_t lock_id)
Release a system wide HW lock.
IPC initialization parameters.
Definition: app_ipc.h:288
int32_t appIpcGetTiovxObjDescSharedMemInfo(void **addr, uint32_t *size)
Get base address and size of memory region assigned for TIOVX obj_desc&#39;s.
uint32_t appIpcGetSelfCpuId(void)
Get current CPU ID.
int32_t appIpcRegisterNotifyHandler(app_ipc_notify_handler_f handler)
Register callback to invoke on receiving a notify message.
uint32_t appIpcIsCpuEnabled(uint32_t cpu_id)
Check if a CPU is enabled in current system for IPC.
uint32_t tiovx_obj_desc_mem_size
Definition: app_ipc.h:294
uint32_t tiovx_log_rt_mem_size
Definition: app_ipc.h:298
uint32_t appIpcGetHostPortId(uint16_t cpu_id)
Get current CPU Port ID.
uint32_t appIpcGetAppCpuId(char *name)
Get APP_CPU_xxx from CPU name.
void appIpcGetTiovxLogRtSharedMemInfo(void **shm_base, uint32_t *shm_size)
Get base address and size of memory region assigned for TIOVX run-time logging.
int32_t appIpcEchoTestStart(void)
Start echo test.
void(* app_ipc_notify_handler_f)(uint32_t src_cpu_id, uint32_t payload)
Callback that is invoke when current CPU receives a IPC notify.
Definition: app_ipc.h:282
int32_t appIpcSendNotifyPort(uint32_t dest_cpu_id, uint32_t payload, uint32_t port_id)
Send a notify message to a given CPU.
uint32_t ipc_vring_mem_size
Definition: app_ipc.h:296
void appIpcInitPrmSetDefault(app_ipc_init_prm_t *prm)
Set IPC init parameters to default state.
uint32_t self_cpu_id
Definition: app_ipc.h:299
int32_t appIpcDeInit(void)
De-Initialize IPC module.
void * ipc_vring_mem
Definition: app_ipc.h:295
uint32_t num_cpus
Definition: app_ipc.h:290
int32_t appIpcHwLockAcquire(uint32_t lock_id, uint32_t timeout)
Acquire a system wide HW lock.
uint32_t enable_tiovx_ipc_announce
Definition: app_ipc.h:301
void * tiovx_obj_desc_mem
Definition: app_ipc.h:293
int32_t appIpcInit(app_ipc_init_prm_t *prm)
Initialize IPC module.
int32_t appIpcSendNotify(uint32_t dest_cpu_id, uint32_t payload)
Send a notify message to a given CPU.