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 
72 /* #define APP_IPC_DEBUG */
73 
91 #if defined (SOC_J721E)
92 
93 #define APP_IPC_CPU_MPU1_0 ( 0u)
94 
95 #define APP_IPC_CPU_MCU1_0 ( 1u)
96 
97 #define APP_IPC_CPU_MCU1_1 ( 2u)
98 
99 #define APP_IPC_CPU_MCU2_0 ( 3u)
100 
101 #define APP_IPC_CPU_MCU2_1 ( 4u)
102 
103 #define APP_IPC_CPU_MCU3_0 ( 5u)
104 
105 #define APP_IPC_CPU_MCU3_1 ( 6u)
106 
107 #define APP_IPC_CPU_C6x_1 ( 7u)
108 
109 #define APP_IPC_CPU_C6x_2 ( 8u)
110 
111 #define APP_IPC_CPU_C7x_1 ( 9u)
112 
113 #define APP_IPC_CPU_MAX (10u)
114 
115 #define APP_IPC_CPU_INVALID (0xFFu)
116 #endif
117 
118 #if defined (SOC_J721S2)
119 
120 #define APP_IPC_CPU_MPU1_0 ( 0u)
121 
122 #define APP_IPC_CPU_MCU1_0 ( 1u)
123 
124 #define APP_IPC_CPU_MCU1_1 ( 2u)
125 
126 #define APP_IPC_CPU_MCU2_0 ( 3u)
127 
128 #define APP_IPC_CPU_MCU2_1 ( 4u)
129 
130 #define APP_IPC_CPU_MCU3_0 ( 5u)
131 
132 #define APP_IPC_CPU_MCU3_1 ( 6u)
133 
134 #define APP_IPC_CPU_C7x_1 ( 7u)
135 
136 #define APP_IPC_CPU_C7x_2 ( 8u)
137 
138 #define APP_IPC_CPU_MAX ( 9u)
139 
140 #define APP_IPC_CPU_INVALID (0xFFu)
141 #endif
142 
143 #if defined (SOC_J784S4)
144 
145 #define APP_IPC_CPU_MPU1_0 ( 0u)
146 
147 #define APP_IPC_CPU_MCU1_0 ( 1u)
148 
149 #define APP_IPC_CPU_MCU1_1 ( 2u)
150 
151 #define APP_IPC_CPU_MCU2_0 ( 3u)
152 
153 #define APP_IPC_CPU_MCU2_1 ( 4u)
154 
155 #define APP_IPC_CPU_MCU3_0 ( 5u)
156 
157 #define APP_IPC_CPU_MCU3_1 ( 6u)
158 
159 #define APP_IPC_CPU_MCU4_0 ( 7u)
160 
161 #define APP_IPC_CPU_MCU4_1 ( 8u)
162 
163 #define APP_IPC_CPU_C7x_1 ( 9u)
164 
165 #define APP_IPC_CPU_C7x_2 (10u)
166 
167 #define APP_IPC_CPU_C7x_3 (11u)
168 
169 #define APP_IPC_CPU_C7x_4 (12u)
170 
171 #define APP_IPC_CPU_MAX (13u)
172 
173 #define APP_IPC_CPU_INVALID (0xFFu)
174 #endif
175 
176 #if defined (SOC_AM62A)
177 
178 #define APP_IPC_CPU_MPU1_0 ( 0u)
179 
180 #define APP_IPC_CPU_MCU1_0 ( 1u)
181 
182 #define APP_IPC_CPU_C7x_1 ( 2u)
183 
184 #define APP_IPC_CPU_MAX ( 3u)
185 
186 #define APP_IPC_CPU_INVALID (0xFFu)
187 #if defined(MCU_PLUS_SDK)
188 #define IPC_MAX_PROCS (3U)
189 #endif
190 #endif
191 
192 #if defined (SOC_J722S)
193 
194 #define APP_IPC_CPU_MPU1_0 ( 0u)
195 
196 #define APP_IPC_CPU_MCU1_0 ( 1u)
197 
198 #define APP_IPC_CPU_MCU2_0 ( 2u)
199 
200 #define APP_IPC_CPU_C7x_1 ( 3u)
201 
202 #define APP_IPC_CPU_C7x_2 ( 4u)
203 
204 #define APP_IPC_CPU_MCU_R5F ( 5u)
205 
206 #define APP_IPC_CPU_MAX ( 6u)
207 
208 #define APP_IPC_CPU_INVALID (0xFFu)
209 #if defined(MCU_PLUS_SDK)
210 #define IPC_MAX_PROCS (6U)
211 #endif
212 #endif
213 
214 /* @} */
215 
217 #define APP_IPC_HW_LOCK_MAX (256u)
218 
220 #define APP_IPC_WAIT_FOREVER (0xFFFFFFFFu)
221 
230 #define APP_IPC_TIOVX_RPMSG_PORT_ID (13u)
231 
233 #define APP_IPC_REMOTE_SERVICE_RPMSG_PORT_ID (21u)
234 
236 #define APP_IPC_ECHO_TEST_RPMSG_PORT_ID (14u)
237 
239 #define APP_IPC_RPMSG_PROTO_ECHO_TEST_RPMSG_PORT_ID (12u)
240 
241 /* @} */
242 
250 typedef void (*app_ipc_notify_handler_f)(uint32_t src_cpu_id, uint32_t payload);
251 
252 
256 typedef struct {
257 
258  uint32_t num_cpus;
259  uint32_t enabled_cpu_id_list[APP_IPC_CPU_MAX];
267  uint32_t self_cpu_id;
271 
280 
288 int32_t appIpcInit(app_ipc_init_prm_t *prm);
289 
295 int32_t appIpcDeInit();
296 
305 
314 int32_t appIpcSendNotify(uint32_t dest_cpu_id, uint32_t payload);
315 
325 int32_t appIpcSendNotifyPort(uint32_t dest_cpu_id, uint32_t payload, uint32_t port_id);
326 
332 uint32_t appIpcGetSelfCpuId();
333 
339 uint32_t appIpcGetHostPortId(uint16_t cpu_id);
340 
348 uint32_t appIpcIsCpuEnabled(uint32_t cpu_id);
349 
363 int32_t appIpcHwLockAcquire(uint32_t lock_id, uint32_t timeout);
364 
370 int32_t appIpcHwLockRelease(uint32_t lock_id);
371 
381 int32_t appIpcGetTiovxObjDescSharedMemInfo(void **addr, uint32_t *size);
382 
392 void appIpcGetTiovxLogRtSharedMemInfo(void **shm_base, uint32_t *shm_size);
393 
398 uint32_t appIpcGetIpcCpuId(uint32_t app_cpu_id);
399 
400 
405 uint32_t appIpcGetAppCpuId(char *name);
406 
411 char *appIpcGetCpuName(uint32_t app_cpu_id);
412 
413 #if defined(FREERTOS) || defined(SAFERTOS)
414 
419 int32_t appIpcCreateTraceBufFlushTask(void);
420 
421 #endif
422 
423 #ifdef __cplusplus
424 }
425 #endif
426 
427 /* @} */
428 
429 #endif /* APP_IPC_H_ */
430 
uint32_t tiovx_rpmsg_port_id
Definition: app_ipc.h:260
int32_t appIpcDeInit()
De-Initialize IPC module.
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:268
void * tiovx_log_rt_mem
Definition: app_ipc.h:265
int32_t appIpcHwLockRelease(uint32_t lock_id)
Release a system wide HW lock.
uint32_t appIpcGetSelfCpuId()
Get current CPU ID.
IPC initialization parameters.
Definition: app_ipc.h:256
int32_t appIpcGetTiovxObjDescSharedMemInfo(void **addr, uint32_t *size)
Get base address and size of memory region assigned for TIOVX obj_desc&#39;s.
char * appIpcGetCpuName(uint32_t app_cpu_id)
Get CPU name from 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:262
uint32_t tiovx_log_rt_mem_size
Definition: app_ipc.h:266
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.
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:250
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:264
void appIpcInitPrmSetDefault(app_ipc_init_prm_t *prm)
Set IPC init parameters to default state.
uint32_t self_cpu_id
Definition: app_ipc.h:267
void * ipc_vring_mem
Definition: app_ipc.h:263
uint32_t num_cpus
Definition: app_ipc.h:258
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:269
void * tiovx_obj_desc_mem
Definition: app_ipc.h:261
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.