1 /*
2 * Copyright (c) 2021 Texas Instruments Incorporated
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the
15 * distribution.
16 *
17 * Neither the name of Texas Instruments Incorporated nor the names of
18 * its contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 */
34 /**
35 * \file lpm_ipc.c
36 *
37 * \brief IPC example code
38 *
39 */
41 /* ========================================================================== */
42 /* Include Files */
43 /* ========================================================================== */
45 #include <ti/drv/lpm/include/lpm_ipc.h>
46 #include <ti/drv/lpm/src/lpm_ipc_rsctable.h>
48 /* ========================================================================== */
49 /* Macros & Typedefs */
50 /* ========================================================================== */
52 #define MSGSIZE 256U
53 #define SERVICE_PING "ti.ipc4.ping-pong"
54 #define ENDPT_PING 13U
55 #define SERVICE_CHRDEV "rpmsg_chrdev"
56 #define ENDPT_CHRDEV 14U
57 #define NUMMSGS 10000 /* number of message sent per task */
59 /* this should be >= RPMessage_getObjMemRequired() */
60 #define IPC_RPMESSAGE_OBJ_SIZE 256U
62 #define RPMSG_DATA_SIZE (256U*512U + IPC_RPMESSAGE_OBJ_SIZE)
63 #define VQ_BUF_SIZE 2048U
65 /* Vring start address for each device */
66 #if defined (SOC_J7200)
67 #define VRING_BASE_ADDRESS 0xA4000000U
68 #else
69 #define VRING_BASE_ADDRESS 0xAA000000U
70 #endif
72 typedef struct Lpm_ipcTestParams_s
73 {
74 uint32_t endPt;
75 char name[32];
76 } Lpm_ipcTestParams;
78 Lpm_ipcTestParams service_ping = { ENDPT_PING, SERVICE_PING };
79 Lpm_ipcTestParams service_chrdev = { ENDPT_CHRDEV, SERVICE_CHRDEV };
81 #if defined (SOC_J721E)
82 #define CORE_IN_TEST 8
83 #elif defined (SOC_J7200)
84 #define CORE_IN_TEST 3
85 #endif
87 /* ========================================================================== */
88 /* Macros & Typedefs */
89 /* ========================================================================== */
91 #define IPC_SETUP_TASK_PRI (3)
92 /**< Priority for sender and receiver tasks */
94 /* ========================================================================== */
95 /* Structure Declarations */
96 /* ========================================================================== */
98 /* None */
100 /* ========================================================================== */
101 /* Function Declarations */
102 /* ========================================================================== */
104 /* None */
106 /* ========================================================================== */
107 /* Global Variables */
108 /* ========================================================================== */
111 uint8_t g_taskStackBuf[(CORE_IN_TEST+3)*IPC_TASK_STACKSIZE]
112 __attribute__ ((section(".bss:taskStackSection")))
113 __attribute__ ((aligned(8192)));
115 uint8_t gCntrlBuf[RPMSG_DATA_SIZE] __attribute__ ((section("ipc_data_buffer"), aligned (8)));
116 uint8_t sysVqBuf[VQ_BUF_SIZE] __attribute__ ((section ("ipc_data_buffer"), aligned (8)));
117 uint8_t g_sendBuf[RPMSG_DATA_SIZE * CORE_IN_TEST] __attribute__ ((section ("ipc_data_buffer"), aligned (8)));
118 uint8_t g_rspBuf[RPMSG_DATA_SIZE * 2] __attribute__ ((section ("ipc_data_buffer"), aligned (8)));
120 uint8_t *pCntrlBuf = gCntrlBuf;
121 uint8_t *pTaskBuf = g_taskStackBuf;
122 uint8_t *pSendTaskBuf = g_sendBuf;
123 uint8_t *pRecvTaskBuf = g_rspBuf;
124 uint8_t *pSysVqBuf = sysVqBuf;
126 uint32_t selfProcId = IPC_MCU1_0;
127 uint32_t remoteProc[] =
128 {
129 #if defined (SOC_J721E)
130 IPC_MPU1_0, IPC_MCU2_0, IPC_MCU2_1, IPC_MCU3_0, IPC_MCU3_1, IPC_C66X_1, IPC_C66X_2, IPC_C7X_1
131 #elif defined (SOC_J7200)
132 IPC_MPU1_0, IPC_MCU2_0, IPC_MCU2_1
133 #endif
134 };
136 uint32_t *pRemoteProcArray = remoteProc;
137 uint32_t gNumRemoteProc = sizeof(remoteProc)/sizeof(uint32_t);
139 uint32_t gRecvTaskBufIdx = 0;
140 uint32_t gSendTaskBufIdx[IPC_MAX_PROCS] = {0};
142 uint32_t rpmsgDataSize = RPMSG_DATA_SIZE;
144 __attribute((section(".tracebuf"))) char Ipc_traceBuffer[IPC_TRACE_BUFFER_MAX_SIZE];
146 uint8_t gOcmcShadowRscTable[0x8C];
147 uint8_t *pOcmcShadowRscTable = gOcmcShadowRscTable;
149 #if !defined(BUILD_MPU1_0) && defined(A72_LINUX_OS) && defined(A72_LINUX_OS_IPC_ATTACH)
150 static uint32_t RecvEndPt = 0;
151 RPMessage_Handle g_ResponderHandleLinux;
152 #endif
154 //#define DEBUG_PRINT
156 volatile uint32_t g_exitRespTsk = 0x0U;
157 RPMessage_Handle g_ResponderHandleRTOS;
159 /* ========================================================================== */
160 /* Function Definitions */
161 /* ========================================================================== */
163 void Lpm_ipcExitResponseTask()
164 {
165 g_exitRespTsk = 0x1U;
166 #ifdef DEBUG_PRINT
167 UART_printf("Calling Ipc de inits!\n");
168 #endif
169 RPMessage_delete(&g_ResponderHandleRTOS);
170 #if !defined(BUILD_MPU1_0) && defined(A72_LINUX_OS) && defined(A72_LINUX_OS_IPC_ATTACH)
171 RPMessage_delete(&g_ResponderHandleLinux);
172 #endif
173 RPMessage_deInit();
174 Ipc_deinit();
175 memcpy(pOcmcShadowRscTable, (const void*)0xa0100000, 0x8c);
176 #ifdef DEBUG_PRINT
177 UART_printf("Ipc de inits done!\n");
178 #endif
179 return;
180 }
182 /*
183 * This "Task" waits for a "ping" message from any processor
184 * then replies with a "pong" message.
185 */
186 void Lpm_ipcResponderFxn(uint32_t *arg0, uint32_t *arg1)
187 {
188 RPMessage_Params params;
189 RPMessage_Handle g_ResponderHandle;
190 uint32_t myEndPt = 0;
191 uint32_t remoteEndPt;
192 uint32_t remoteProcId;
193 uint16_t len;
194 int32_t n;
195 int32_t status = 0;
196 void *buf;
197 uint32_t requestedEpt = (uint32_t)*arg0;
198 char * name = (char *)arg1;
200 uint32_t bufSize = rpmsgDataSize;
201 char str[MSGSIZE];
203 #ifdef DEBUG_PRINT
204 UART_printf("RecvTask: Task Created!\n");
205 #endif
207 buf = &pRecvTaskBuf[gRecvTaskBufIdx++ * rpmsgDataSize];
208 if(buf == NULL)
209 {
210 UART_printf("RecvTask: buffer allocation failed\n");
211 return;
212 }
214 RPMessageParams_init(¶ms);
215 params.requestedEndpt = requestedEpt;
216 params.buf = buf;
217 params.bufSize = bufSize;
219 g_ResponderHandle = RPMessage_create(¶ms, &myEndPt);
220 if(!g_ResponderHandle)
221 {
222 UART_printf("RecvTask: Failed to create endpoint\n");
223 return;
224 }
225 else
226 {
227 #ifdef DEBUG_PRINT
228 UART_printf("RecvTask: Success to create endpoint\n");
229 #endif
230 }
232 if (requestedEpt == ENDPT_PING)
233 {
234 g_ResponderHandleRTOS = g_ResponderHandle;
235 }
236 else
237 {
238 #if !defined(BUILD_MPU1_0) && defined(A72_LINUX_OS) && defined(A72_LINUX_OS_IPC_ATTACH)
239 g_ResponderHandleLinux = g_ResponderHandle;
240 #endif
241 }
243 #if !defined(BUILD_MPU1_0) && defined(A72_LINUX_OS) && defined(A72_LINUX_OS_IPC_ATTACH)
244 if (requestedEpt == ENDPT_PING)
245 {
246 RecvEndPt = myEndPt;
247 }
248 #endif
250 status = RPMessage_announce(RPMESSAGE_ALL, myEndPt, name);
251 if(status != IPC_SOK)
252 {
253 UART_printf("RecvTask: RPMessage_announce() for %s failed\n", name);
254 return;
255 }
256 else
257 {
258 #ifdef DEBUG_PRINT
259 UART_printf("RecvTask: RPMessage_announce() for %s success\n", name);
260 #endif
261 }
263 while(g_exitRespTsk == 0x0U)
264 {
265 status = RPMessage_recv(g_ResponderHandle, (Ptr)str, &len, &remoteEndPt, &remoteProcId,
266 IPC_RPMESSAGE_TIMEOUT_FOREVER);
267 if(status != IPC_SOK)
268 {
269 UART_printf("RecvTask: failed with code %d\n", status);
270 }
271 else
272 {
273 /* NULL terminated string */
274 str[len] = '\0';
275 #ifdef DEBUG_PRINT
276 UART_printf("RecvTask: Revcvd msg \"%s\" len %d from %s\n",
277 str, len, Ipc_mpGetName(remoteProcId));
278 #endif
279 }
281 status = sscanf(str, "ping %d", &n);
282 if(status == 1)
283 {
284 memset(str, 0, MSGSIZE);
285 len = snprintf(str, 255, "pong %d", n);
286 if(len > 255)
287 {
288 UART_printf("RecvTask: snprintf failed, len %d\n", len);
289 len = 255;
290 }
291 str[len++] = '\0';
292 }
293 else
294 {
295 /* If this is not ping/pong message, just print the message */
296 UART_printf("%s <--> %s : %s recvd\n",
297 Ipc_mpGetSelfName(),
298 Ipc_mpGetName(remoteProcId),
299 str);
300 }
301 #ifdef DEBUG_PRINT
302 UART_printf("RecvTask: Sending msg \"%s\" len %d from %s to %s\n",
303 str, len, Ipc_mpGetSelfName(),
304 Ipc_mpGetName(remoteProcId));
305 #endif
306 status = RPMessage_send(g_ResponderHandle, remoteProcId, remoteEndPt, myEndPt, str, len);
307 if (status != IPC_SOK)
308 {
309 UART_printf("RecvTask: Sending msg \"%s\" len %d from %s to %s failed!!!\n",
310 str, len, Ipc_mpGetSelfName(),
311 Ipc_mpGetName(remoteProcId));
312 }
313 }
315 #ifdef DEBUG_PRINT
316 UART_printf("RecvTask: %s responder task exiting ...\n",
317 Ipc_mpGetSelfName());
318 #endif
319 return;
320 }
322 void Lpm_ipcSenderFxn(uint32_t *arg0, uint32_t *arg1)
323 {
324 RPMessage_Handle handle;
325 RPMessage_Params params;
326 uint32_t myEndPt = 0;
327 uint32_t remoteEndPt;
328 uint32_t remoteProcId;
329 uint32_t dstProc;
330 uint16_t len;
331 int32_t i;
332 int32_t status = 0;
333 char buf[256];
334 uint8_t *buf1;
336 uint32_t cntPing = 0;
337 uint32_t cntPong = 0;
339 buf1 = &pSendTaskBuf[rpmsgDataSize * (uint32_t)*arg1];
340 dstProc = (uint32_t)*arg0;
342 #ifdef DEBUG_PRINT
343 UART_printf("SendTask%d: Task Created!\n",
344 dstProc);
345 #endif
347 /* Create the endpoint for receiving. */
348 RPMessageParams_init(¶ms);
349 params.numBufs = 2;
350 params.buf = buf1;
351 params.bufSize = rpmsgDataSize;
352 handle = RPMessage_create(¶ms, &myEndPt);
353 if(!handle)
354 {
355 UART_printf("SendTask%d: Failed to create message endpoint\n",
356 dstProc);
357 return;
358 }
359 else
360 {
361 #ifdef DEBUG_PRINT
362 UART_printf("SendTask%d: Success to create message endpoint\n",
363 dstProc);
364 #endif
365 }
367 status = RPMessage_getRemoteEndPt(dstProc, SERVICE_PING, &remoteProcId,
368 &remoteEndPt, SemaphoreP_WAIT_FOREVER);
369 if(dstProc != remoteProcId)
370 {
371 UART_printf("SendTask%d: RPMessage_getRemoteEndPt() malfunctioned, status %d\n",
372 dstProc, status);
373 return;
374 }
375 else
376 {
377 #ifdef DEBUG_PRINT
378 UART_printf("SendTask%d: RPMessage_getRemoteEndPt() passed, status %d\n",
379 dstProc, status);
380 #endif
381 }
383 for (i = 0; i < NUMMSGS; i++)
384 {
385 /* Send data to remote endPt: */
386 memset(buf, 0, 256);
387 len = snprintf(buf, 255, "ping %d", i);
388 if(len > 255)
389 {
390 UART_printf("SendTask%d: snprintf failed, len %d\n", dstProc, len);
391 len = 255;
392 }
393 buf[len++] = '\0';
395 #ifdef DEBUG_PRINT
396 UART_printf("SendTask%d: Sending \"%s\" from %s to %s...\n", dstProc,
397 buf, Ipc_mpGetSelfName(),
398 Ipc_mpGetName(dstProc));
399 #endif
400 /* Increase the Ping Counter */
401 cntPing++;
403 status = RPMessage_send(handle, dstProc, ENDPT_PING, myEndPt, (Ptr)buf, len);
404 if (status != IPC_SOK)
405 {
406 UART_printf("SendTask%d: RPMessage_send Failed Msg-> \"%s\" from %s to %s...\n",
407 dstProc,
408 buf, Ipc_mpGetSelfName(),
409 Ipc_mpGetName(dstProc));
410 break;
411 }
414 /* wait a for a response message: */
415 status = RPMessage_recv(handle, (Ptr)buf, &len, &remoteEndPt,
416 &remoteProcId, IPC_RPMESSAGE_TIMEOUT_FOREVER);
418 if(status != IPC_SOK)
419 {
420 UART_printf("SendTask%d: RPMessage_recv failed with code %d\n",
421 dstProc, status);
422 break;
423 }
425 /* Make it NULL terminated string */
426 if(len >= MSGSIZE)
427 {
428 buf[MSGSIZE-1] = '\0';
429 }
430 else
431 {
432 buf[len] = '\0';
433 }
435 #ifdef DEBUG_PRINT
436 UART_printf("SendTask%d: Received \"%s\" len %d from %s endPt %d \n",
437 dstProc, buf, len, Ipc_mpGetName(remoteProcId),
438 remoteEndPt);
439 #endif
440 cntPong++;
441 if((i+1)%50 == 0)
442 {
443 //UART_printf("%s <--> %s, ping/pong iteration %d ...\n",
444 // Ipc_mpGetSelfName(), Ipc_mpGetName(dstProc), i);
445 }
446 }
448 UART_printf("%s <--> %s, Ping- %d, pong - %d completed\n",
449 Ipc_mpGetSelfName(),
450 Ipc_mpGetName(dstProc),
451 cntPing, cntPong);
453 /* Delete the RPMesg object now */
454 RPMessage_delete(&handle);
455 return;
456 }
458 /*
459 * This "Task" waits for Linux vdev ready, and late create the vrings
460 *
461 */
462 #if !defined(BUILD_MPU1_0) && defined(A72_LINUX_OS) && defined(A72_LINUX_OS_IPC_ATTACH)
463 void Lpm_ipcVdevMonitorFxn(void* arg0, void* arg1)
464 {
465 int32_t status;
467 UART_printf("Waiting for Linux VDev ready...\n");
468 while(!Ipc_isRemoteReady(IPC_MPU1_0))
469 {
470 if(!g_exitRespTsk)
471 {
472 TaskP_sleep(10);
473 }
474 else
475 {
476 UART_printf("Exiting rpmsg_vdevMonitorFxn!\n");
477 return;
478 }
479 }
480 UART_printf("Linux VDev is ready!\n");
482 /* Create the VRing now ... */
483 status = Ipc_lateVirtioCreate(IPC_MPU1_0);
484 if(status != IPC_SOK)
485 {
486 UART_printf("%s: Ipc_lateVirtioCreate failed\n", __func__);
487 return;
488 }
489 else
490 {
491 #ifdef DEBUG_PRINT
492 UART_printf("%s: Ipc_lateVirtioCreate passed\n", __func__);
493 #endif
494 }
496 status = RPMessage_lateInit(IPC_MPU1_0);
497 if(status != IPC_SOK)
498 {
499 UART_printf("%s: RPMessage_lateInit failed\n", __func__);
500 return;
501 }
502 else
503 {
504 #ifdef DEBUG_PRINT
505 UART_printf("%s: RPMessage_lateInit passed\n", __func__);
506 #endif
507 }
509 status = RPMessage_announce(IPC_MPU1_0, RecvEndPt, SERVICE_PING);
510 if(status != IPC_SOK)
511 {
512 UART_printf("rpmsg_vdevMonitorFxn: RPMessage_announce() failed\n");
513 }
514 else
515 {
516 #ifdef DEBUG_PRINT
517 UART_printf("rpmsg_vdevMonitorFxn: RPMessage_announce() passed\n");
518 #endif
519 }
521 return;
522 }
523 #endif /* !defined(BUILD_MPU1_0) && defined(A72_LINUX_OS) && defined(A72_LINUX_OS_IPC_ATTACH)*/
525 static void Lpm_ipcAppPrintf(const char *str)
526 {
527 UART_printf("%s", str);
529 return;
530 }
532 volatile uint32_t loop_ipcEcho = 0x0;
533 int32_t Lpm_ipcEchoApp(void)
534 {
535 uint32_t t;
536 TaskP_Params params;
537 uint32_t numProc = gNumRemoteProc;
538 Ipc_VirtIoParams vqParam;
539 Ipc_InitPrms initPrms;
540 uint32_t index = 0;
541 int32_t retVal = IPC_SOK;
543 while(loop_ipcEcho);
545 if(g_exitRespTsk == 0x1U)
546 {
547 memset(pCntrlBuf, 0, RPMSG_DATA_SIZE);
548 memset(pSendTaskBuf, 0, RPMSG_DATA_SIZE * CORE_IN_TEST);
549 memset(pRecvTaskBuf, 0, RPMSG_DATA_SIZE * 2);
550 memset(pSysVqBuf, 0, VQ_BUF_SIZE);
551 RecvEndPt = 0;
552 gRecvTaskBufIdx = 0;
553 memset(&gSendTaskBufIdx, 0, IPC_MAX_PROCS);
554 memcpy((void*)0xa0100000, pOcmcShadowRscTable, 0x8c);
555 g_exitRespTsk = 0;
556 }
558 /* Step1 : Initialize the multiproc */
559 retVal += Ipc_mpSetConfig(selfProcId, numProc, pRemoteProcArray);
560 if(retVal != IPC_SOK)
561 {
562 UART_printf("Ipc_mpSetConfig failed!\n");
563 }
564 else
565 {
566 UART_printf("IPC_echo_test (core : %s) .....\r\n", Ipc_mpGetSelfName());
569 /* Initialize params with defaults */
570 IpcInitPrms_init(0U, &initPrms);
572 initPrms.printFxn = &Lpm_ipcAppPrintf;
574 retVal += Ipc_init(&initPrms);
575 if(retVal != IPC_SOK)
576 {
577 UART_printf("Ipc_init failed!\n");
578 }
579 else
580 {
581 #ifdef DEBUG_PRINT
582 UART_printf("Required Local memory for Virtio_Object = %d\r\n",
583 numProc * Ipc_getVqObjMemoryRequiredPerCore());
584 #endif
586 #if !defined(BUILD_MPU1_0) && defined(A72_LINUX_OS)
587 /* If A72 remote core is running Linux OS, then
588 * load resource table
589 */
590 retVal += Ipc_loadResourceTable((void*)&ti_ipc_remoteproc_ResourceTable);
591 if(retVal != IPC_SOK)
592 {
593 UART_printf("Ipc_loadResourceTable failed!\n");
594 }
595 else
596 {
597 #if !defined(A72_LINUX_OS_IPC_ATTACH)
598 /* Wait for Linux VDev ready... */
599 for(t = 0; t < numProc; t++)
600 {
601 while(!Ipc_isRemoteReady(pRemoteProcArray[t]))
602 {
603 TaskP_sleep(10);
604 }
605 }
606 //UART_printf("Linux VDEV ready now .....\n");
607 #endif
608 #endif
609 /* Step2 : Initialize Virtio */
610 vqParam.vqObjBaseAddr = (void*)pSysVqBuf;
611 vqParam.vqBufSize = numProc * Ipc_getVqObjMemoryRequiredPerCore();
612 vqParam.vringBaseAddr = (void*)VRING_BASE_ADDRESS;
613 vqParam.vringBufSize = IPC_VRING_BUFFER_SIZE;
614 vqParam.timeoutCnt = 100; /* Wait for counts */
615 retVal += Ipc_initVirtIO(&vqParam);
616 if(retVal != IPC_SOK)
617 {
618 UART_printf("Ipc_initVirtIO failed!\n");
619 }
620 else
621 {
622 /* Step 3: Initialize RPMessage */
623 RPMessage_Params cntrlParam;
625 #ifdef DEBUG_PRINT
626 UART_printf("Required Local memory for RPMessage Object = %d\n",
627 RPMessage_getObjMemRequired());
628 #endif
630 /* Initialize the param */
631 RPMessageParams_init(&cntrlParam);
633 /* Set memory for HeapMemory for control task */
634 cntrlParam.buf = pCntrlBuf;
635 cntrlParam.bufSize = rpmsgDataSize;
636 cntrlParam.stackBuffer = &pTaskBuf[index++ * IPC_TASK_STACKSIZE];
637 cntrlParam.stackSize = IPC_TASK_STACKSIZE;
638 retVal += RPMessage_init(&cntrlParam);
639 if(retVal != IPC_SOK)
640 {
641 UART_printf("RPMessage_init failed!\n");
642 }
643 else
644 {
645 #ifdef DEBUG_PRINT
646 UART_printf("RPMessage_init successful!\n");
647 #endif
648 /* Respond to messages coming in to endPt ENDPT_PING */
649 TaskP_Params_init(¶ms);
650 params.priority = IPC_SETUP_TASK_PRI;
651 params.stack = &pTaskBuf[index++ * IPC_TASK_STACKSIZE];
652 params.stacksize = IPC_TASK_STACKSIZE;
653 params.arg0 = (uint32_t *)&service_ping.endPt;
654 params.arg1 = (uint32_t *)&service_ping.name[0];
655 TaskP_create((void*)Lpm_ipcResponderFxn, ¶ms);
657 #ifdef DEBUG_PRINT
658 UART_printf("Lpm_ipcResponderFxn for ENDPT_PING created!\n");
659 #endif
660 TaskP_sleep(1000);
662 #if !defined(BUILD_MPU1_0) && defined(A72_LINUX_OS)
663 /* Respond to messages coming in to endPt ENDPT_CHRDEV (for testing rpmsg_chrdev) */
664 TaskP_Params_init(¶ms);
665 params.priority = IPC_SETUP_TASK_PRI;
666 params.stack = &pTaskBuf[index++ * IPC_TASK_STACKSIZE];
667 params.stacksize = IPC_TASK_STACKSIZE;
668 params.arg0 = (uint32_t *)&service_chrdev.endPt;
669 params.arg1 = (uint32_t *)&service_chrdev.name[0];
670 TaskP_create((void*)Lpm_ipcResponderFxn, ¶ms);
671 #ifdef DEBUG_PRINT
672 UART_printf("Lpm_ipcResponderFxn for ENDPT_CHRDEV created!\n");
673 #endif
674 TaskP_sleep(1000);
675 #endif
677 for(t = 0; t < numProc; t++)
678 {
679 #if !defined(BUILD_MPU1_0) && defined(A72_LINUX_OS)
680 /* Linux does not have a responder func running */
681 if(pRemoteProcArray[t] == IPC_MPU1_0)
682 {
683 continue;
684 }
685 #endif
686 /* Store index in global array.
687 * the pointer of which is to be passed as argument to sender task */
688 gSendTaskBufIdx[t] = t;
689 /* send messages to peer(s) on ENDPT_PING */
690 TaskP_Params_init(¶ms);
691 params.priority = IPC_SETUP_TASK_PRI;
692 params.stack = &pTaskBuf[index++ * IPC_TASK_STACKSIZE];
693 params.stacksize = IPC_TASK_STACKSIZE;
694 params.arg0 = (uint32_t *)&pRemoteProcArray[t];
695 params.arg1 = (uint32_t *)&gSendTaskBufIdx[t];
696 TaskP_create((void*)Lpm_ipcSenderFxn, ¶ms);
698 }
700 #if !defined(BUILD_MPU1_0) && defined(A72_LINUX_OS) && defined(A72_LINUX_OS_IPC_ATTACH)
701 /* Respond to messages coming in to endPt ENDPT_PING */
702 TaskP_Params_init(¶ms);
703 params.priority = 7;
704 params.stack = &pTaskBuf[index++ * IPC_TASK_STACKSIZE];
705 params.stacksize = IPC_TASK_STACKSIZE;
706 params.arg0 = 0;
707 TaskP_create((void*)Lpm_ipcVdevMonitorFxn, ¶ms);
708 #endif /* !defined(BUILD_MPU1_0) && defined(A72_LINUX_OS) && defined(A72_LINUX_OS_IPC_ATTACH) */
709 }
710 }
711 }
712 #if !defined(BUILD_MPU1_0) && defined(A72_LINUX_OS)
713 }
714 #endif
715 }
717 //loop_ipcEcho = 0xDEADBEEF;
718 return 1;
719 }