void ipc_rpmsg_echo_remote_core_start()
{
int32_t status;
RPMessage_CreateParams createParams;
// char recvMsg[MAX_MSG_SIZE];
uint16_t recvMsgSize, remoteCoreId;
uint32_t remoteCoreEndPt;
uint32_t msgCount = 0u;
RPMessage_CreateParams_init(&createParams);
createParams.localEndPt = gRemoteServiceEndPt;
status = RPMessage_construct(&gRecvMsgObject, &createParams);
DebugP_assert(status==SystemP_SUCCESS);
#if defined(PDK_DM_R5_TEST)
status = RPMessage_announce(CSL_CORE_ID_R5FSS0_0, gRemoteServiceEndPt, "ti.ipc4.ping-pong");
DebugP_assert(status==SystemP_SUCCESS);
#else
/* wait for all cores to be ready */
IpcNotify_syncAll(SystemP_WAIT_FOREVER);
#endif
DebugP_log("[IPC RPMSG ECHO] Remote Core waiting for messages from main core ... !!!\r\n");
/* wait for messages forever in a loop */
while(1)
{
/* set 'recvMsgSize' to size of recv buffer,
* after return `recvMsgSize` contains actual size of valid data in recv buffer
*/
recvMsgSize = sizeof(recvMsg);
status = RPMessage_recv(&gRecvMsgObject,
recvMsg, &recvMsgSize,
&remoteCoreId, &remoteCoreEndPt,
SystemP_WAIT_FOREVER);
DebugP_assert(status==SystemP_SUCCESS);
/* echo the same message string as reply */
/* send ack to sender CPU at the sender end point */
status = RPMessage_send(
trmitMsg, recvMsgSize,
remoteCoreId, remoteCoreEndPt,
RPMessage_getLocalEndPt(&gRecvMsgObject),
SystemP_WAIT_FOREVER);
DebugP_assert(status==SystemP_SUCCESS);
msgCount++;
if (msgCount >= gMsgEchoCount)
{
break;
}
}
DebugP_log("[IPC RPMSG ECHO] Received and echoed %d messages ... !!!\r\n", gMsgEchoCount);
DebugP_log("All tests have passed!!\r\n");
/* This loop will never exit */
}
M4 在等待接收数据和等待发送数据时可以执行用户程序吗? 怎么实现?