示例#1
0
Void pingTaskFxn(UArg arg0, UArg arg1)
{
    System_printf("ping_task at port %d: Entered...\n", arg0);

    /* Create the messageQ for receiving, and register callback: */
    handle = RPMessage_create(arg0, pingCallbackFxn, NULL, &myEndpoint);
    if (!handle) {
        System_abort("RPMessage_createEx failed\n");
    }

    /* Announce we are here: */
#ifdef RPMSG_NS_2_0
    NameMap_register("rpmsg-proto", "rpmsg-proto", arg0);
#else
    NameMap_register("rpmsg-proto", arg0);
#endif

    /* Note: we don't get a chance to teardown with RPMessage_destroy() */
}
示例#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();
}