Ejemplo n.º 1
0
/* Send me a zero length data payload to tear down the MesssageQCopy object: */
static Void pingCallbackFxn(RPMessage_Handle h, UArg arg, Ptr data,
	UInt16 len, UInt32 src)
{
    const Char *reply = "Pong!";
    UInt  replyLen = strlen(reply) + 1;

    System_printf("%d: Received msg: %s from %d, len:%d\n",
                  counter++, data, src, len);

    /* Send data back to remote endpoint: */
    RPMessage_send(dstProc, src, myEndpoint, (Ptr)reply, replyLen);
}
Ejemplo n.º 2
0
Void copyTaskFxn(UArg arg0, UArg arg1)
{
    RPMessage_Handle    handle;
    Char                buffer[128];
    UInt32              myEndpoint = 0;
    UInt32              remoteEndpoint;
    UInt16              dstProc;
    UInt16              len;
    Int                 i;

    System_printf("copyTask %d: Entered...:\n", arg0);

    dstProc = MultiProc_getId("HOST");

    RPMessage_init(dstProc);

    /* Create the messageQ for receiving (and get our endpoint for sending). */
    handle = RPMessage_create(arg0, NULL, NULL, &myEndpoint);
    
    //NameMap_register("rpmsg-client-sample", "sample-desc", arg0);
    NameMap_register("rpmsg-client-sample", "sample-desc", arg0);
    
    for( i = 0; i < APP_NUM_ITERATIONS; i++ ) {
        /* Await a character message: */
        RPMessage_recv(handle, (Ptr)buffer, &len, &remoteEndpoint,
                       RPMessage_FOREVER);

        buffer[len] = '\0';
        System_printf("copyTask %d: Received data: %s, len:%d\n", i + 1,
                      buffer, len);

        /* Send data back to remote endpoint: */
        RPMessage_send(dstProc, remoteEndpoint, myEndpoint, (Ptr)buffer, len);
    }

    /* Teardown our side: */
    RPMessage_delete(&handle);

    /* Free MessageQCopy module wide resources: */
    RPMessage_finalize();
}