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 #include <stdint.h>
67 
68 /* #define APP_IPC_DEBUG */
69 
87 #if defined (SOC_J721E)
88 
89 #define APP_IPC_CPU_MPU1_0 ( 0u)
90 
91 #define APP_IPC_CPU_MCU1_0 ( 1u)
92 
93 #define APP_IPC_CPU_MCU1_1 ( 2u)
94 
95 #define APP_IPC_CPU_MCU2_0 ( 3u)
96 
97 #define APP_IPC_CPU_MCU2_1 ( 4u)
98 
99 #define APP_IPC_CPU_MCU3_0 ( 5u)
100 
101 #define APP_IPC_CPU_MCU3_1 ( 6u)
102 
103 #define APP_IPC_CPU_C6x_1 ( 7u)
104 
105 #define APP_IPC_CPU_C6x_2 ( 8u)
106 
107 #define APP_IPC_CPU_C7x_1 ( 9u)
108 
109 #define APP_IPC_CPU_MAX (10u)
110 
111 #define APP_IPC_CPU_INVALID (0xFFu)
112 #endif
113 
114 #if defined (SOC_J721S2)
115 
116 #define APP_IPC_CPU_MPU1_0 ( 0u)
117 
118 #define APP_IPC_CPU_MCU1_0 ( 1u)
119 
120 #define APP_IPC_CPU_MCU1_1 ( 2u)
121 
122 #define APP_IPC_CPU_MCU2_0 ( 3u)
123 
124 #define APP_IPC_CPU_MCU2_1 ( 4u)
125 
126 #define APP_IPC_CPU_MCU3_0 ( 5u)
127 
128 #define APP_IPC_CPU_MCU3_1 ( 6u)
129 
130 #define APP_IPC_CPU_C7x_1 ( 7u)
131 
132 #define APP_IPC_CPU_C7x_2 ( 8u)
133 
134 #define APP_IPC_CPU_MAX ( 9u)
135 
136 #define APP_IPC_CPU_INVALID (0xFFu)
137 #endif
138 
139 #if defined (SOC_J784S4)
140 
141 #define APP_IPC_CPU_MPU1_0 ( 0u)
142 
143 #define APP_IPC_CPU_MCU1_0 ( 1u)
144 
145 #define APP_IPC_CPU_MCU1_1 ( 2u)
146 
147 #define APP_IPC_CPU_MCU2_0 ( 3u)
148 
149 #define APP_IPC_CPU_MCU2_1 ( 4u)
150 
151 #define APP_IPC_CPU_MCU3_0 ( 5u)
152 
153 #define APP_IPC_CPU_MCU3_1 ( 6u)
154 
155 #define APP_IPC_CPU_MCU4_0 ( 7u)
156 
157 #define APP_IPC_CPU_MCU4_1 ( 8u)
158 
159 #define APP_IPC_CPU_C7x_1 ( 9u)
160 
161 #define APP_IPC_CPU_C7x_2 (10u)
162 
163 #define APP_IPC_CPU_C7x_3 (11u)
164 
165 #define APP_IPC_CPU_C7x_4 (12u)
166 
167 #define APP_IPC_CPU_MAX (13u)
168 
169 #define APP_IPC_CPU_INVALID (0xFFu)
170 #endif
171 
172 #if defined (SOC_AM62A)
173 
174 #define APP_IPC_CPU_MPU1_0 ( 0u)
175 
176 #define APP_IPC_CPU_MCU1_0 ( 1u)
177 
178 #define APP_IPC_CPU_C7x_1 ( 2u)
179 
180 #define APP_IPC_CPU_MAX ( 3u)
181 
182 #define APP_IPC_CPU_INVALID (0xFFu)
183 #if defined(MCU_PLUS_SDK)
184 #define IPC_MAX_PROCS (3U)
185 #endif
186 #endif
187 
188 /* @} */
189 
191 #define APP_IPC_HW_LOCK_MAX (256u)
192 
194 #define APP_IPC_WAIT_FOREVER (0xFFFFFFFFu)
195 
204 #define APP_IPC_TIOVX_RPMSG_PORT_ID (13u)
205 
207 #define APP_IPC_REMOTE_SERVICE_RPMSG_PORT_ID (21u)
208 
210 #define APP_IPC_ECHO_TEST_RPMSG_PORT_ID (14u)
211 
213 #define APP_IPC_RPMSG_PROTO_ECHO_TEST_RPMSG_PORT_ID (12u)
214 
215 /* @} */
216 
224 typedef void (*app_ipc_notify_handler_f)(uint32_t src_cpu_id, uint32_t payload);
225 
226 
230 typedef struct {
231 
232  uint32_t num_cpus;
233  uint32_t enabled_cpu_id_list[APP_IPC_CPU_MAX];
241  uint32_t self_cpu_id;
245 
254 
262 int32_t appIpcInit(app_ipc_init_prm_t *prm);
263 
269 int32_t appIpcDeInit();
270 
279 
288 int32_t appIpcSendNotify(uint32_t dest_cpu_id, uint32_t payload);
289 
299 int32_t appIpcSendNotifyPort(uint32_t dest_cpu_id, uint32_t payload, uint32_t port_id);
300 
306 uint32_t appIpcGetSelfCpuId();
307 
313 uint32_t appIpcGetHostPortId(uint16_t cpu_id);
314 
322 uint32_t appIpcIsCpuEnabled(uint32_t cpu_id);
323 
337 int32_t appIpcHwLockAcquire(uint32_t lock_id, uint32_t timeout);
338 
344 int32_t appIpcHwLockRelease(uint32_t lock_id);
345 
355 int32_t appIpcGetTiovxObjDescSharedMemInfo(void **addr, uint32_t *size);
356 
366 void appIpcGetTiovxLogRtSharedMemInfo(void **shm_base, uint32_t *shm_size);
367 
372 uint32_t appIpcGetIpcCpuId(uint32_t app_cpu_id);
373 
374 
379 uint32_t appIpcGetAppCpuId(char *name);
380 
385 char *appIpcGetCpuName(uint32_t app_cpu_id);
386 
387 #if defined(FREERTOS) || defined(SAFERTOS)
388 
393 int32_t appIpcCreateTraceBufFlushTask(void);
394 
395 #endif
396 
397 /* @} */
398 
399 #endif
400 
uint32_t tiovx_rpmsg_port_id
Definition: app_ipc.h:234
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:242
void * tiovx_log_rt_mem
Definition: app_ipc.h:239
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:230
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:236
uint32_t tiovx_log_rt_mem_size
Definition: app_ipc.h:240
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:224
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:238
void appIpcInitPrmSetDefault(app_ipc_init_prm_t *prm)
Set IPC init parameters to default state.
uint32_t self_cpu_id
Definition: app_ipc.h:241
void * ipc_vring_mem
Definition: app_ipc.h:237
uint32_t num_cpus
Definition: app_ipc.h:232
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:243
void * tiovx_obj_desc_mem
Definition: app_ipc.h:235
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.