]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - ipc/ipcdev.git/blobdiff - linux/src/api/Ipc.c
Fix Linux GateMP bug by introducing new GateMP_attach(procId) API
[ipc/ipcdev.git] / linux / src / api / Ipc.c
index 42ac0cbe415ad0a8d75f71e7fd5dc3a81d60cbbd..e81700c6762a388ab40b77b614dad93b6dab87fa 100644 (file)
@@ -400,6 +400,9 @@ Int Ipc_attach(UInt16 procId)
 {
     Int status = Ipc_S_SUCCESS;
     UInt16 clusterId;
+#if defined(GATEMP_SUPPORT)
+    Int ret;
+#endif
 
     /* cannot attach to yourself */
     if (MultiProc_self() == procId) {
@@ -443,6 +446,18 @@ Int Ipc_attach(UInt16 procId)
     /* hack: bind all existing message queues to remote processor */
     MessageQ_bind(procId);
 
+#if defined(GATEMP_SUPPORT)
+    if (GateMP_isSetup()) {
+        /* establish GateMP connection to remote processor */
+        ret = GateMP_attach(procId);
+
+        if (ret < 0) {
+            PRINTVERBOSE1("Ipc_attach: failed to GateMP_attach to procId %d\n",
+                          procId);
+        }
+    }
+#endif
+
     /* getting here means we have successfully attached */
     Ipc_module.attached[clusterId]++;
 
@@ -459,6 +474,9 @@ Int Ipc_detach(UInt16 procId)
 {
     Int status = Ipc_S_SUCCESS;
     UInt16 clusterId;
+#if defined(GATEMP_SUPPORT)
+    Int ret;
+#endif
 
     /* cannot detach from yourself */
     if (MultiProc_self() == procId) {
@@ -486,6 +504,18 @@ Int Ipc_detach(UInt16 procId)
         goto done;
     }
 
+#if defined(GATEMP_SUPPORT)
+    if (GateMP_isSetup()) {
+        /* establish GateMP connection to remote processor */
+        ret = GateMP_detach(procId);
+
+        if (ret < 0) {
+            PRINTVERBOSE1("Ipc_detach: failed to GateMP_detach from procId %d\n",
+                          procId);
+        }
+    }
+#endif
+
     /* hack: unbind all existing message queues from remote processor */
     MessageQ_unbind(procId);