This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

SK-AM62B-P1: Where exactly is the "callback function" in this example?

Part Number: SK-AM62B-P1

I'm trying to enable graceful shutdown using this:
https://software-dl.ti.com/mcu-plus-sdk/esd/AM62X/09_02_00_38/exports/docs/api_guide_am62x/GRACEFUL_REMOTECORE_SHUTDOWN.html

Where exactly are these,in the mcu sdk directory:

  • On the callback unblock the RPMessage for all the RPMsg objects used in the code.
    volatile uint8_t gbShutdown = 0u;
    volatile uint8_t gbShutdownRemotecoreID = 0u;
    void ipc_rp_mbox_callback(uint16_t remoteCoreId, uint16_t clientId, uint32_t msgValue, void *args)
    {
    {
    if (msgValue == IPC_NOTIFY_RP_MBOX_SHUTDOWN) /* Shutdown request from the remotecore */
    {
    gbShutdown = 1u;
    gbShutdownRemotecoreID = remoteCoreId;
    RPMessage_unblock(&gIpcRecvMsgObject[0]);
    RPMessage_unblock(&gIpcRecvMsgObject[1]);
    }
    }
    }
  • On the main thread where the IPC is happening, break all the loops when gbShutdown == 1
/* 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 = IPC_RPMESSAGE_MAX_MSG_SIZE;
status = RPMessage_recv(pRpmsgObj,
recvMsg, &recvMsgSize,
&remoteCoreId, &remoteCoreEndPt,
if (gbShutdown == 1u)
{
break;
}
/* send ack to sender CPU at the sender end point */
status = RPMessage_send(
recvMsg, recvMsgSize,
remoteCoreId, remoteCoreEndPt,
}
  • Then follow the below sequence to go to WFI
    • Close all the dirvers used
    • Send acknowledgement to Linux core that the core is ready for shutdown
    • Deinit system (It will disable the interrupts and stops the tick timer)
    • Go to WFI / IDLE
/* Close the drivers */
Drivers_close();
/* ACK the suspend message */
/* Deinit System */
System_deinit();
/* For ARM R and M cores*/
__asm__ __volatile__ ("wfi" "\n\t": : : "memory");

This is implemented on IPC RP Message Linux Echo