]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - ipc/ipcdev.git/blobdiff - linux/src/api/MultiProc.c
Tests: ping_rpmsg: Update Test with Proper Socket Usage
[ipc/ipcdev.git] / linux / src / api / MultiProc.c
index 0a8435f1d1bacf67e4406ef911fe5746ac634137..015955abed9fac4f6f3d631ebdc2da0fbb40147c 100644 (file)
@@ -102,3 +102,51 @@ Void MultiProc_getConfig (MultiProc_Config * cfg)
 
     return;
 }
+
+/*
+ *  ======== MultiProc_rprocSetId ========
+ */
+Int MultiProc_rprocSetId(UInt16 procId, UInt rprocId)
+{
+    Int status;
+    LAD_ClientHandle handle;
+    struct LAD_CommandObj cmd;
+    union LAD_ResponseObj rsp;
+    UInt16 clusterId;
+
+
+    handle = LAD_findHandle();
+
+    if (handle == LAD_MAXNUMCLIENTS) {
+        PRINTVERBOSE1("MultiProc_rprocSetId: can't find connection to daemon "
+                "for pid %d\n", getpid())
+        return (-1);
+    }
+
+    cmd.cmd = LAD_RPROC_SETID;
+    cmd.clientId = handle;
+    cmd.args.rprocSetId.procId = procId;
+    cmd.args.rprocSetId.rprocId = rprocId;
+
+    if ((status = LAD_putCommand(&cmd)) != LAD_SUCCESS) {
+        PRINTVERBOSE1("MultiProc_rprocSetId: sending LAD command failed, "
+                "status=%d\n", status)
+        return (status);
+    }
+
+    if ((status = LAD_getResponse(handle, &rsp)) != LAD_SUCCESS) {
+        PRINTVERBOSE1("MultiProc_rprocSetId: no LAD response, status=%d\n",
+                status)
+        return (status);
+    }
+    status = rsp.status;
+
+    PRINTVERBOSE2("MultiProc_rprocSetId: got LAD response for client %d, "
+            "status=%d\n", handle, status)
+
+    /* update configuration in api state */
+    clusterId = procId - _MultiProc_cfg.baseIdOfCluster;
+    _MultiProc_cfg.rprocList[clusterId] = rprocId;
+
+    return (status);
+}