]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - ipc/ipcdev.git/commitdiff
Fixed run-time configuration of cluster baseId 3.35.00.03_eng
authorRamsey Harris <ramsey@ti.com>
Wed, 4 Feb 2015 03:20:17 +0000 (19:20 -0800)
committerRobert Tivy <rtivy@ti.com>
Wed, 4 Feb 2015 19:10:25 +0000 (11:10 -0800)
New method to encapsulate the run-time configuration of IPC
cluster baseId: Ipc_clusterConfig. Call this method from a
startup first function after setting the cluster baseId. Set
Ipc.entry array with valid procId when cluster baseId is known,
otherwise set to INVALIDID. Set MultiProc.clusterProcList array
as above.

packages/ti/ipc/Ipc.h
packages/ti/sdo/ipc/Ipc.c
packages/ti/sdo/ipc/Ipc.xs
packages/ti/sdo/utils/MultiProc.xs

index d2a7dc192a334d5880170b15358bd9a14177eca2..9141ee5c14af8348b2a58fe6d766f602230a3d17 100644 (file)
@@ -203,6 +203,18 @@ typedef struct {
  */
 Int Ipc_attach(UInt16 remoteProcId);
 
+/*!
+ *  @brief      Internal IPC cluster configuration
+ *
+ *  Perform run-time configuration of internal data structures
+ *  related to cluster baseId. This function should be called
+ *  from a "startup first" hook but after having called
+ *  MultiProc_setBaseIdOfCluster().
+ *
+ *  @remarks    This function is only available on SYS/BIOS.
+ */
+Int Ipc_clusterConfig(Void);
+
 /*!
  *  @brief      Detach from the remote processor
  *
index 3f24580df495c3dbc2dca618e50cc9d034c0ac9f..e5e97dd35bc9155c8e671565c1f42e707351f918 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2014, Texas Instruments Incorporated
+ * Copyright (c) 2012-2015 Texas Instruments Incorporated - http://www.ti.com
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -59,6 +59,7 @@
 
 #ifdef __ti__
     #pragma FUNC_EXT_CALLED(Ipc_attach);
+    #pragma FUNC_EXT_CALLED(Ipc_clusterConfig);
     #pragma FUNC_EXT_CALLED(Ipc_detach);
     #pragma FUNC_EXT_CALLED(Ipc_isAttached);
     #pragma FUNC_EXT_CALLED(Ipc_readConfig);
@@ -351,6 +352,40 @@ Int Ipc_attach(UInt16 remoteProcId)
     return (status);
 }
 
+/*
+ *  ======== Ipc_clusterConfig ========
+ */
+Int Ipc_clusterConfig(Void)
+{
+    UInt16 *procIdPtr;
+    UInt16 numProcs;
+    UInt16 baseId;
+    UInt16 i;
+
+
+    /* sanity check the cluster baseId */
+    baseId = MultiProc_getBaseIdOfCluster();
+
+    if (baseId == MultiProc_INVALIDID) {
+        return (Ipc_E_INVALIDSTATE);
+    }
+
+    /* initialize the MultiProc.clusterProcList array */
+    numProcs = MultiProc_getNumProcsInCluster();
+    procIdPtr = MultiProc_getClusterProcList();
+
+    for (i = 0; i < numProcs; i++) {
+        *procIdPtr++ = baseId + i;
+    }
+
+    /* update the Ipc.procEntry[] array with valid procIds */
+    for (i = 0; i < numProcs; i++) {
+        Ipc_module->procEntry[i].entry.remoteProcId = baseId + i;
+    }
+
+    return (Ipc_S_SUCCESS);
+}
+
 /*
  *  ======== Ipc_isAttached ========
  */
index 900bf583af869f941e793c44033b8938dc3387c9..ccaaa005ab740e2e177d8cf8a5b938eebb84f8da 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * Copyright (c) 2012-2015 Texas Instruments Incorporated - http://www.ti.com
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -102,10 +102,8 @@ function module$use()
  *  ======== module$static$init ========
  *  Initialize module values.
  */
-function module$static$init(mod, params)
+function module$static$init(state, mod)
 {
-    /* this array will be setup below with internal array */
-    mod.procEntry.length = MultiProc.numProcsInCluster;
     var fxn = new Ipc.UserFxn;
     var userFxnSet = false;
 
@@ -138,16 +136,18 @@ function module$static$init(mod, params)
     /* init Ipc.entry */
     initEntryArray();
 
-    /* init the module state */
-    for (var i=0; i < MultiProc.numProcsInCluster; i++) {
-        mod.procEntry[i].entry = Ipc.entry[i];
-        mod.procEntry[i].localConfigList     = null;
-        mod.procEntry[i].remoteConfigList    = null;
-        mod.procEntry[i].attached            = 0;
+    /* initialize the procEntry[] array */
+    state.procEntry.length = MultiProc.numProcsInCluster;
+
+    for (var i = 0; i < state.procEntry.length; i++) {
+        state.procEntry[i].entry = Ipc.entry[i];
+        state.procEntry[i].localConfigList     = null;
+        state.procEntry[i].remoteConfigList    = null;
+        state.procEntry[i].attached            = 0;
     }
 
-    mod.ipcSharedAddr = null;
-    mod.gateMPSharedAddr = null;
+    state.ipcSharedAddr = null;
+    state.gateMPSharedAddr = null;
     Ipc.numUserFxns = Ipc.userFxns.length;
 }
 
@@ -181,12 +181,19 @@ function setEntryMeta(entry)
     /* init Ipc.entry */
     initEntryArray();
 
+    if (MultiProc.baseIdOfCluster == MultiProc.INVALIDID) {
+        Ipc.$logError("Cannot use Ipc.setEntryMeta when "
+                + "MultiProc.baseIdOfCluster is INVALIDID.", Ipc);
+    }
+
+    var clusterId = entry.remoteProcId - MultiProc.baseIdOfCluster;
+
     if (entry.setupNotify != undefined) {
-        Ipc.entry[entry.remoteProcId].setupNotify = entry.setupNotify;
+        Ipc.entry[clusterId].setupNotify = entry.setupNotify;
     }
 
     if (entry.setupMessageQ != undefined) {
-        Ipc.entry[entry.remoteProcId].setupMessageQ = entry.setupMessageQ;
+        Ipc.entry[clusterId].setupMessageQ = entry.setupMessageQ;
     }
 }
 
@@ -203,8 +210,10 @@ function initEntryArray()
     if (!(initEntryDone)) {
         Ipc.entry.length = MultiProc.numProcsInCluster;
 
-        for (var i=0; i < MultiProc.numProcsInCluster; i++) {
-            Ipc.entry[i].remoteProcId     = MultiProc.baseIdOfCluster + i;
+        for (var i = 0; i < MultiProc.numProcsInCluster; i++) {
+            Ipc.entry[i].remoteProcId =
+                    (MultiProc.baseIdOfCluster == MultiProc.INVALIDID) ?
+                    MultiProc.INVALIDID : MultiProc.baseIdOfCluster + i;
             Ipc.entry[i].setupNotify      = true;
             Ipc.entry[i].setupMessageQ    = true;
         }
index 9b7afeddc79e64121e0603238297e0f4697c536e..eb863cd9bd627a608a4b3ce37474391f47eb963c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2014 Texas Instruments Incorporated - http://www.ti.com
+ * Copyright (c) 2012-2015 Texas Instruments Incorporated - http://www.ti.com
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -231,10 +231,10 @@ function module$static$init(state, mod)
     state.clusterProcList.length = mod.numProcsInCluster;
 
     /* initialize the array if we know the actual procIds */
-    if (mod.baseIdOfCluster != MultiProc.INVALIDID) {
-        for (var i = 0; i < state.clusterProcList.length; i++) {
-            state.clusterProcList[i] = mod.baseIdOfCluster + i;
-        }
+    for (var i = 0; i < state.clusterProcList.length; i++) {
+        state.clusterProcList[i] =
+                (mod.baseIdOfCluster != MultiProc.INVALIDID) ?
+                mod.baseIdOfCluster + i : MultiProc.INVALIDID;
     }
 }