]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - ipc/ipcdev.git/commitdiff
SDOCM00114392 Interrupt module on tci6638 does not support clusters
authorRamsey Harris <ramsey@ti.com>
Tue, 3 Feb 2015 16:29:37 +0000 (08:29 -0800)
committerRobert Tivy <rtivy@ti.com>
Wed, 4 Feb 2015 19:04:35 +0000 (11:04 -0800)
Added segmentSize to MultiProcSetup to define the number of
processors on the device. Needed for sending interrupts to
processors in a different cluster but still on the local device.
Added cluster awareness. Added cluster support to the tci6638
package. Cleaned up Log_print statements. Replaced interface
IInterrupt references with Interrupt module references.

packages/ti/ipc/family/tci6638/Interrupt.c
packages/ti/ipc/family/tci6638/Interrupt.xdc
packages/ti/ipc/family/tci6638/Interrupt.xs
packages/ti/ipc/family/tci6638/VirtQueue.c
packages/ti/ipc/family/tci6638/VirtQueue.xdc
packages/ti/ipc/family/tci6638/VirtQueue.xs
packages/ti/sdo/ipc/family/tci663x/Interrupt.xdc
packages/ti/sdo/ipc/family/tci663x/Interrupt.xs
packages/ti/sdo/ipc/family/tci663x/MultiProcSetup.c
packages/ti/sdo/ipc/family/tci663x/MultiProcSetup.xdc
packages/ti/sdo/ipc/family/tci663x/MultiProcSetup.xs

index 600bddb19fd8b43a8de460d33e05f1b2c222676f..fe4f67e3c7cdb8fd50bd4f318c2e58dbe9ab62db 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013-2014, Texas Instruments Incorporated
+ * Copyright (c) 2013-2015 Texas Instruments Incorporated - http://www.ti.com
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -42,6 +42,7 @@
 
 #include <ti/sysbios/family/c64p/Hwi.h>
 
+#include <ti/sdo/utils/_MultiProc.h>
 #include <ti/ipc/MultiProc.h>
 #include <ti/sdo/ipc/notifyDrivers/IInterrupt.h>
 
@@ -58,15 +59,17 @@ Void Interrupt_isr(UArg arg);
 #define MAP_TO_BITPOS(intId) \
      (intId == Interrupt_SRCS_BITPOS_CORE0 ? (intId + DNUM) : intId)
 
-/*
- * Map remoteProcId to CORE ID [0-3]
- * NOTE: This assumes that HOST is at MultiProcId == 0, and CORE0 at 1i
+/*  Map procId to coreId (DNUM)
+ *
+ *  NOTE: This assumes HOST clusterId is 0, CORE0 clusterId is 1, etc.
  */
-#define MAP_RPROCID_TO_COREID(rProcId)     (rProcId-1)
+#define MAP_RPROCID_TO_COREID(procId) \
+        ((procId) - Interrupt_module->clusterId - 1)
 
 #define MAP_RPROCID_TO_SRCC(rProcId, intId) \
-         (intId == Interrupt_SRCS_BITPOS_CORE0 ?  \
-         (intId + (rProcId-1)) : intId)
+        (intId == Interrupt_SRCS_BITPOS_CORE0 ?  \
+        (intId + MAP_RPROCID_TO_COREID(rProcId)) : intId)
+
 /*
  *************************************************************************
  *                      Module functions
@@ -81,22 +84,29 @@ Int Interrupt_Module_startup(Int phase)
     volatile UInt32 *kick0 = (volatile UInt32 *)Interrupt_KICK0;
     volatile UInt32 *kick1 = (volatile UInt32 *)Interrupt_KICK1;
     UInt16 procId = MultiProc_self();
+    UInt16 hostClusterId;
 
-    /*
-     * If this assert fails, the MultiProc config has changed to break
-     * an assumption in Linux rpmsg driver, that HOST is listed first in
-     * MultiProc ID configuration.
-     */
-    Assert_isTrue(0 == MultiProc_getId("HOST"), NULL);
+    /* wait for Startup and procId to be set, because user fxn should set it */
+    if (!Startup_Module_startupDone()) {
+        return (Startup_NOTDONE);
+    }
+    else if (procId == MultiProc_INVALIDID) {
+        return (Startup_NOTDONE);
+    }
 
-    /*
-     *  Wait for Startup to be done (if MultiProc id not yet set) because a
-     *  user fxn should set it
-     */
-    if (!Startup_Module_startupDone() && procId == MultiProc_INVALIDID) {
+    /* wait for MultiProc to start before testing the assert below */
+    if (!ti_sdo_utils_MultiProc_Module_startupDone()) {
         return (Startup_NOTDONE);
     }
 
+    /*  If this assert fails, the MultiProc config has changed to break
+     *  an assumption in Linux rpmsg driver, that HOST is listed first in
+     *  MultiProc name list configuration.
+     */
+    Interrupt_module->clusterId = MultiProc_getBaseIdOfCluster();
+    hostClusterId = MultiProc_getId("HOST") - Interrupt_module->clusterId;
+    Assert_isTrue(0 == hostClusterId, NULL);
+
     if (!Interrupt_enableKick) {
         /* Do not unlock the kick registers */
         return (Startup_DONE);
@@ -146,7 +156,6 @@ Void Interrupt_intClearAll()
     ipcar[DNUM] = val;
 }
 
-
 /*
  *  ======== Interrupt_intRegister ========
  *  Register ISR for remote processor interrupt
@@ -162,7 +171,7 @@ Void Interrupt_intRegister(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo,
 
     pos = MAP_RPROCID_TO_SRCC(remoteProcId, intInfo->localIntId);
 
-    Log_print2(Diags_USER1, "Interrupt_intRegister: pos: %d, func: 0x%x\n",
+    Log_print2(Diags_USER1, "Interrupt_intRegister: pos: %d, func: 0x%x",
               (IArg)pos, (IArg)func);
 
     /* setup the function table with client function and arg to call: */
@@ -173,6 +182,7 @@ Void Interrupt_intRegister(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo,
     /* Make sure the interrupt only gets plugged once */
     Interrupt_module->numPlugged++;
     if (Interrupt_module->numPlugged == 1) {
+
         /* Clear all pending interrupts */
         Interrupt_intClearAll();
 
@@ -212,14 +222,13 @@ Void Interrupt_intUnregister(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
     table->arg  = 0;
 }
 
-/*!
+/*
  *  ======== Interrupt_intSend ========
  *  Send interrupt to the remote processor, identifying this core as source.
  *  If CORE0 BIT POS, we add DNUM to identify this core as the source;
  *  Otherwise, we just use the localIntId as the source bit position.
  */
-Void Interrupt_intSend(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo,
-                          UArg arg)
+Void Interrupt_intSend(UInt16 procId, IInterrupt_IntInfo *intInfo, UArg arg)
 {
     UInt32 val;
     volatile UInt32 *ipcgr = (volatile UInt32 *)Interrupt_IPCGR0;
@@ -229,18 +238,17 @@ Void Interrupt_intSend(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo,
     Assert_isTrue((intInfo != NULL), NULL);
     pos = MAP_TO_BITPOS(intInfo->localIntId);
 
-    /*
-     *  bit 0 is set to generate the interrupt.
+    /*  bit 0 is set to generate the interrupt.
      *  bits 4-7 are set to specify the interrupt generation source.
      *  The convention is that bit 4 (SRCS0) is used for core 0,
      *  bit 5 (SRCS1) for core 1, etc... .
      */
     val = (1 << pos) | 1;
-    Log_print3(Diags_USER1,
-        "Interrupt_intSend: setting bit %d in SRCS as 0x%x to for rprocId #%d",
-        (IArg)pos, (IArg)val, (IArg)remoteProcId);
 
-    if (remoteProcId == MultiProc_getId("HOST"))
+    Log_print3(Diags_USER1, "Interrupt_intSend: setting bit %d in SRC "
+            "(val=0x%x) for procId %d", (IArg)pos, (IArg)val, (IArg)procId);
+
+    if (procId == MultiProc_getId("HOST"))
     {
         /* Interrupt is to be generated on the Host processor.  Go through
          * IPCGRH register
@@ -250,7 +258,7 @@ Void Interrupt_intSend(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo,
     else
     {
         /* Interrupt is to be generated on another DSP. */
-        ipcgr[MAP_RPROCID_TO_COREID(remoteProcId)] =  val;
+        ipcgr[MAP_RPROCID_TO_COREID(procId)] =  val;
     }
 }
 
@@ -259,14 +267,14 @@ Void Interrupt_intSend(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo,
  *  Acknowledge interrupt by clearing the corresponding source bit.
  *
  *  intInfo->localIntId encodes the Source bit position to be cleared.
- *  If this corresponds to Core0, adjust using remoteProcId to get true
+ *  If this corresponds to Core0, adjust using procId to get true
  *  SRCS bit position for the DSP core.
  *
  *  Otherwise, the localIntId is used directly as the bit position.
  *
- *  Only callers setting remoteProcId == HOST id care about return value.
+ *  Only callers setting procId == HOST id care about return value.
  */
-UInt Interrupt_intClear(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+UInt Interrupt_intClear(UInt16 procId, IInterrupt_IntInfo *intInfo)
 {
     volatile UInt32 *ipcgr = (volatile UInt32 *)Interrupt_IPCGR0;
     volatile UInt32 *ipcar = (volatile UInt32 *)Interrupt_IPCAR0;
@@ -275,15 +283,16 @@ UInt Interrupt_intClear(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
     UInt pos;
 
     Assert_isTrue((intInfo != NULL), NULL);
-    pos = MAP_RPROCID_TO_SRCC(remoteProcId, intInfo->localIntId);
+
+    pos = MAP_RPROCID_TO_SRCC(procId, intInfo->localIntId);
     ipcar[DNUM] = (1 << pos);
 
-    Log_print2(Diags_USER1, "Interrupt_intClear: ipcgr: 0x%x, cleared: 0x%x\n",
-                            val, (1 << pos));
+    Log_print2(Diags_USER1, "Interrupt_intClear: ipcgr: 0x%x, cleared: 0x%x",
+            val, (1 << pos));
 
-    if (remoteProcId == MultiProc_getId("HOST")) {
-        payload = ((val & (UInt)(1 << Interrupt_SRCS_BITPOS_HOST)) ? val :
-                    Interrupt_INVALIDPAYLOAD);
+    if (procId == MultiProc_getId("HOST")) {
+        payload = ((val & (UInt)(1 << Interrupt_SRCS_BITPOS_HOST)) ?
+                val : Interrupt_INVALIDPAYLOAD);
     }
 
     return (payload);
@@ -294,7 +303,7 @@ UInt Interrupt_intClear(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
  *  Return 1 if the interrupt was set (if so, we clear it);
  *  Otherwise, returns 0.
  */
-UInt Interrupt_checkAndClear(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
+UInt Interrupt_checkAndClear(UInt16 procId, IInterrupt_IntInfo *intInfo)
 {
     volatile UInt32 *ipcgr = (volatile UInt32 *)Interrupt_IPCGR0;
     volatile UInt32 *ipcar = (volatile UInt32 *)Interrupt_IPCAR0;
index 98ba03ded03ca81e35dcaecf79ec3637d5457ac4..f19855518306926eb049d88a8e63fbc39b1582a7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Texas Instruments Incorporated
+ * Copyright (c) 2013-2015 Texas Instruments Incorporated - http://www.ti.com
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -116,7 +116,8 @@ internal:
     Void isr(UArg arg);
 
     struct Module_State {
-        FxnTable   fxnTable[];  /* indexed by Source ID bit pos */
-        UInt       numPlugged;  /* # of times the interrupt was registered */
+        UInt        numPlugged; /* # of times the interrupt was registered */
+        UInt16      clusterId;  /* cluster base procId */
+        FxnTable    fxnTable[]; /* indexed by Source ID bit pos */
     };
 }
index a6d85224d852475607c723fb839e6ceadcf7b6cc..c8da505cd1c7b16ea3ea92ce942b21b099177248 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013-2014, Texas Instruments Incorporated
+ * Copyright (c) 2013-2015 Texas Instruments Incorporated - http://www.ti.com
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -127,16 +127,17 @@ function module$use()
 /*
  *  ======== module$static$init ========
  */
-function module$static$init(mod, params)
+function module$static$init(state, mod)
 {
-    var fxnTable = Interrupt.$object.fxnTable;
+
+    state.numPlugged = 0;
+    state.clusterId = MultiProc.baseIdOfCluster;
 
     /* The function table length should be the number of IPCAR bits */
-    fxnTable.length = 32;
-    for (var i = 0; i < fxnTable.length; i++) {
-        fxnTable[i].func = null;
-        fxnTable[i].arg = 0;
-    }
+    state.fxnTable.length = 32;
 
-    mod.numPlugged = 0;
+    for (var i = 0; i < state.fxnTable.length; i++) {
+        state.fxnTable[i].func = null;
+        state.fxnTable[i].arg = 0;
+    }
 }
index 2f6936276976ae8f891658141c6671070277e106..b3caa632d32e065b138a14f4781fc465dd1950cb 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2014, Texas Instruments Incorporated
+ * Copyright (c) 2011-2015 Texas Instruments Incorporated - http://www.ti.com
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
+
 /** ============================================================================
  *  @file       VirtQueue.c
  *
  *  @brief      Virtio Queue implementation for BIOS
  *
  *  Differences between BIOS version and Linux kernel (include/linux/virtio.h):
- *  - Renamed module from virtio.h to VirtQueue_Object.h to match the API prefixes;
- *  - BIOS (XDC) types and CamelCasing used;
- *  - virtio_device concept removed (i.e, assumes no containing device);
- *  - simplified scatterlist from Linux version;
- *  - VirtQueue_Objects are created statically here, so just added a VirtQueue_Object_init()
- *    fxn to take the place of the Virtio vring_new_virtqueue() API;
+ *  - Renamed module from virtio.h to VirtQueue.h to match the API prefixes
+ *  - XDC Standard Types and CamelCasing used
+ *  - virtio_device concept removed (i.e, assumes no containing device)
+ *  - simplified scatterlist from Linux version
+ *  - VirtQueue objects are created statically, added VirtQueue_Instance_init()
+ *    fxn to take the place of the Virtio vring_new_virtqueue() API
  *  - The notify function is implicit in the implementation, and not provided
- *    by the client, as it is in Linux virtio.
+ *    by the client, as it is in Linux virtio
  *
  *  All VirtQueue operations can be called in any context.
- *
- *  The virtio header should be included in an application as follows:
- *  @code
- *  #include <ti/ipc/rpmsg/VirtQueue.h>
- *  @endcode
- *
  */
 
 #include <xdc/std.h>
@@ -67,7 +62,6 @@
 #include <ti/sysbios/family/c66/Cache.h>
 #include <ti/sysbios/knl/Swi.h>
 
-#include <ti/sdo/ipc/notifyDrivers/IInterrupt.h>
 #include <ti/ipc/family/tci6638/Interrupt.h>
 #include <ti/ipc/remoteproc/Resource.h>
 
 #include <ti/ipc/rpmsg/virtio_ring.h>
 
 /* Used for defining the size of the virtqueue registry */
-#define NUM_QUEUES                      2
+#define NUM_QUEUES 2
 
 #define DIV_ROUND_UP(n,d)   (((n) + (d) - 1) / (d))
 #define RP_MSG_BUFS_SPACE   (VirtQueue_RP_MSG_NUM_BUFS * RPMSG_BUF_SIZE * 2)
 
 /* With 256 buffers, our vring will occupy 3 pages */
-#define RP_MSG_RING_SIZE    ((DIV_ROUND_UP(vring_size(VirtQueue_RP_MSG_NUM_BUFS, \
-                            VirtQueue_RP_MSG_VRING_ALIGN), VirtQueue_PAGE_SIZE)) * VirtQueue_PAGE_SIZE)
+#define RP_MSG_RING_SIZE    \
+        ((DIV_ROUND_UP(vring_size(VirtQueue_RP_MSG_NUM_BUFS, \
+        VirtQueue_RP_MSG_VRING_ALIGN), \
+        VirtQueue_PAGE_SIZE)) * VirtQueue_PAGE_SIZE)
 
 /* The total IPC space needed to communicate with a remote processor */
 #define RPMSG_IPC_MEM   (RP_MSG_BUFS_SPACE + 2 * RP_MSG_RING_SIZE)
 
-#define ID_DSP_TO_A9      0
-#define ID_A9_TO_DSP      1
+#define ID_SELF_TO_HOST 0
+#define ID_HOST_TO_SELF 1
 
 extern volatile cregister UInt DNUM;
 
@@ -116,21 +112,26 @@ static inline UInt mapVAtoPA(Void * va)
 Void VirtQueue_init()
 {
     extern cregister volatile UInt DNUM;
+    UInt16 clusterId;
     UInt16 procId;
 
-    /*
-     * VirtQueue_init() must be called before MultiProcSetup_init().
-     * (Check the xdc_runtime_Startup_firstFxns__A in the XDC generated code)
-     * Abort if the procId has already been set.  We must set it!
+    /*  VirtQueue_init() must be called before MultiProcSetup_init().
+     *  Check the xdc_runtime_Startup_firstFxns__A array in the XDC
+     *  generated code. Abort if the procId has already been set; we
+     *  must set it!
      */
     if (MultiProc_self() != MultiProc_INVALIDID) {
         System_abort("VirtQueue_init(): MultiProc_self already set!");
         return;
     }
 
-    procId = DNUM + 1;
+    /* clusterId is needed to support single image loading */
+    clusterId = MultiProc_getBaseIdOfCluster();
+
+    /* compute local procId, add one to account for HOST processor */
+    procId = clusterId + DNUM + 1;
 
-    /* Set the local ID */
+    /* set the local procId */
     MultiProc_setLocalId(procId);
 }
 
@@ -144,7 +145,8 @@ Int VirtQueue_Instance_init(VirtQueue_Object *vq, UInt16 remoteProcId,
     UInt32 marValue;
 
     VirtQueue_module->traceBufPtr = Resource_getTraceBufPtr();
-    /* Create the thread protection gate */
+
+    /* create the thread protection gate */
     vq->gateH = GateAll_create(NULL, eb);
     if (Error_check(eb)) {
         Log_error0("VirtQueue_create: could not create gate object");
@@ -164,8 +166,8 @@ Int VirtQueue_Instance_init(VirtQueue_Object *vq, UInt16 remoteProcId,
     vq->swiHandle = params->swiHandle;
 
     switch (vq->id) {
-        case ID_DSP_TO_A9:
-        case ID_A9_TO_DSP:
+        case ID_SELF_TO_HOST:
+        case ID_HOST_TO_SELF:
             vringAddr = (struct vring *)Resource_getVringDA(vq->id);
             Assert_isTrue(vringAddr != NULL, NULL);
             /* Add per core offset: must match on host side: */
@@ -187,11 +189,11 @@ Int VirtQueue_Instance_init(VirtQueue_Object *vq, UInt16 remoteProcId,
             return(0);
     }
 
-    Log_print3(Diags_USER1,
-            "vring: %d 0x%x (0x%x)\n", vq->id, (IArg)vringAddr,
+    Log_print3(Diags_USER1, "vring: %d 0x%x (0x%x)", vq->id, (IArg)vringAddr,
             RP_MSG_RING_SIZE);
 
-    vring_init(vq->vringPtr, VirtQueue_RP_MSG_NUM_BUFS, vringAddr, VirtQueue_RP_MSG_VRING_ALIGN);
+    vring_init(vq->vringPtr, VirtQueue_RP_MSG_NUM_BUFS, vringAddr,
+            VirtQueue_RP_MSG_VRING_ALIGN);
 
     queueRegistry[vq->id] = vq;
     return(0);
@@ -203,18 +205,17 @@ Int VirtQueue_Instance_init(VirtQueue_Object *vq, UInt16 remoteProcId,
 Void VirtQueue_kick(VirtQueue_Handle vq)
 {
     struct vring *vring = vq->vringPtr;
-    IInterrupt_IntInfo intInfo;
+    Interrupt_IntInfo intInfo;
 
     /* For now, simply interrupt remote processor */
     if (vring->avail->flags & VRING_AVAIL_F_NO_INTERRUPT) {
-        Log_print0(Diags_USER1,
-                "VirtQueue_kick: no kick because of VRING_AVAIL_F_NO_INTERRUPT\n");
+        Log_print0(Diags_USER1, "VirtQueue_kick: no kick because of "
+                "VRING_AVAIL_F_NO_INTERRUPT");
         return;
     }
 
-    Log_print2(Diags_USER1,
-            "VirtQueue_kick: Sending interrupt to proc %d with payload 0x%x\n",
-            (IArg)vq->procId, (IArg)vq->id);
+    Log_print2(Diags_USER1, "VirtQueue_kick: Sending interrupt to proc %d "
+            "with payload 0x%x", (IArg)vq->procId, (IArg)vq->id);
 
     intInfo.localIntId  = Interrupt_SRCS_BITPOS_CORE0;
     Interrupt_intSend(vq->procId, &intInfo, vq->id);
@@ -313,10 +314,9 @@ Int16 VirtQueue_getAvailBuf(VirtQueue_Handle vq, Void **buf, Int *len)
     IArg key;
 
     key = GateAll_enter(vq->gateH);
-    Log_print6(Diags_USER1, "getAvailBuf vq: 0x%x %d %d %d 0x%x 0x%x\n",
-        (IArg)vq,
-        vq->last_avail_idx, vring->avail->idx, vring->num,
-        (IArg)&vring->avail, (IArg)vring->avail);
+    Log_print6(Diags_USER1, "getAvailBuf vq: 0x%x %d %d %d 0x%x 0x%x",
+        (IArg)vq, (IArg)vq->last_avail_idx, (IArg)vring->avail->idx,
+        (IArg)vring->num, (IArg)&vring->avail, (IArg)vring->avail);
 
     /*  Clear flag here to avoid race condition with remote processor.
      *  This is a negative flag, clearing it means that we want to
@@ -354,7 +354,7 @@ Void VirtQueue_isr(UArg msg)
 {
     VirtQueue_Object *vq;
 
-    Log_print1(Diags_USER1, "VirtQueue_isr received msg = 0x%x\n", msg);
+    Log_print1(Diags_USER1, "VirtQueue_isr received msg = 0x%x", msg);
 
     vq = queueRegistry[0];
     if (vq) {
@@ -371,7 +371,7 @@ Void VirtQueue_isr(UArg msg)
  */
 Void VirtQueue_startup(UInt16 remoteProcId, Bool isHost)
 {
-    IInterrupt_IntInfo intInfo;
+    Interrupt_IntInfo intInfo;
 
     intInfo.intVectorId = Interrupt_DSPINT;
     intInfo.localIntId  = Interrupt_SRCS_BITPOS_HOST;
@@ -383,12 +383,12 @@ Void VirtQueue_startup(UInt16 remoteProcId, Bool isHost)
      * Since interrupt is cleared, we throw away this first kick, which is
      * OK since we don't process this in the ISR anyway.
      */
-    Log_print0(Diags_USER1, "VirtQueue_startup: Polling for host int...\n");
+    Log_print0(Diags_USER1, "VirtQueue_startup: Polling for host int...");
     while (!Interrupt_checkAndClear(remoteProcId, &intInfo));
 
     Interrupt_intRegister(remoteProcId, &intInfo, (Fxn)VirtQueue_isr, 0);
 
-    Log_print0(Diags_USER1, "Passed VirtQueue_startup\n");
+    Log_print0(Diags_USER1, "Passed VirtQueue_startup");
 }
 
 /* By convention, Host VirtQueues host are the even number in the pair */
index 0bde155a3d8c6cc4308eab45df76103a878976a5..4ad35394289e69ccbcb84d277ef10eb14bbcddc1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Texas Instruments Incorporated
+ * Copyright (c) 2013-2015 Texas Instruments Incorporated - http://www.ti.com
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -323,9 +323,6 @@ instance:
 
 internal:   /* not for client use */
 
-    /*! Statically retrieve procIds to avoid doing this at runtime */
-    config UInt hostProcId  = MultiProc.INVALIDID;
-
     void init();
 
     /*!
index bc62655f46068d3b95dfda317513ea92d3c936dc..6c1399cb8d30ca8944c5d55956ce5ef3e10f2ed7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Texas Instruments Incorporated
+ * Copyright (c) 2013-2015 Texas Instruments Incorporated - http://www.ti.com
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -50,8 +50,6 @@ function module$use()
         var Startup = xdc.useModule('xdc.runtime.Startup');
         Startup.firstFxns.$add(VirtQueue.init);
     }
-
-    this.hostProcId = MultiProc.getIdMeta("HOST");
 }
 
 /*
index 78616031169020759b1268be897a84b395797d59..2af219004c508ec455f0229c4f3005b03f4341ec 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
@@ -64,7 +64,7 @@ module Interrupt inherits ti.sdo.ipc.notifyDrivers.IInterrupt
                         viewInitFxn: 'viewInterruptsData',
                         structName: 'InterruptDataStruct'
                     }
-                ],
+                ]
             ]
         });
 
@@ -90,7 +90,7 @@ internal:
 
     struct Module_State {
         Fxn     func;
-        UArg    args[];     /* One entry for each core */
-        UInt    numPlugged; /* # of times the interrupt was registered */
+        UInt    numPlugged;     /* # of times the interrupt was registered */
+        UArg    args[];         /* one entry for each core (in cluster) */
     };
 }
index d878b5d97a8fa8b9b549ac094847396aeee05c90..30ecdd56603ff939aab570af312f1d19956b5fca 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
@@ -85,7 +85,7 @@ function module$use()
 /*
  *  ======== module$static$init ========
  */
-function module$static$init(mod, params)
+function module$static$init(state, mod)
 {
     var args = Interrupt.$object.args;
     var MultiProc = xdc.module('ti.sdo.utils.MultiProc');
@@ -96,8 +96,8 @@ function module$static$init(mod, params)
         args[i] = 0;
     }
 
-    mod.func = null;
-    mod.numPlugged = 0;
+    state.func = null;
+    state.numPlugged = 0;
 }
 
 /*
@@ -123,9 +123,8 @@ function viewInterruptsData(view)
     var modCfg = Program.getModuleConfig('ti.sdo.ipc.family.tci663x.Interrupt');
     var MultiProcCfg = Program.getModuleConfig('ti.sdo.utils.MultiProc');
 
-    var args = Program.fetchArray(Interrupt.args$fetchDesc,
-                                      mod.args,
-                                      MultiProcCfg.numProcessors);
+    var args = Program.fetchArray(Interrupt.args$fetchDesc, mod.args,
+            MultiProcCfg.numProcessors);
 
     var localId = MultiProc.self$view();
 
index 45e06954c3ce9e95b133dadce28aa4edc71053e2..e5770e362459002912d5d437e41217ea57365766 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
@@ -66,16 +66,20 @@ Void MultiProcSetup_init()
     MultiProc_setLocalId(procId);
 }
 
-
 /*
  *  ======== MultiProcSetup_getProcId ========
  */
 UInt16 MultiProcSetup_getProcId(UInt coreId)
 {
     UInt i;
-    for (i = 0; i < ti_sdo_utils_MultiProc_numProcessors; i++) {
+    UInt baseId;
+
+    baseId = MultiProc_getBaseIdOfCluster();
+
+    /* search the procMap array for the given coreId */
+    for (i = 0; i < MultiProcSetup_segmentSize; i++) {
         if (MultiProcSetup_procMap[i] == coreId) {
-            return (i);
+            return (baseId + i);
         }
     }
 
index ff76df514b7b48c7c093aeac093b7ef27f983c14..9f729156f268e9959f7a024f82497173bc13246d 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
@@ -55,14 +55,24 @@ module MultiProcSetup
         msg: "A_invalidProcessor: This core is not present in the MultiProc name list"
     };
 
-    /*! ProcId -> CoreId mapping (indexed by procId) */
+internal:
+    /*  Map the clusterId to the coreId (only for DSP processos)
+     *
+     *  The procMap array is indexed by clusterId. The element value
+     *  is the coreId (equivalent to DNUM).
+     */
     config UInt16 procMap[];
 
-internal:
+    /*  Maximum number of processors on this device
+     *
+     *  We consider the CortexA15 quad-core processor to be one
+     *  logical processor. There are up to eight DSP processors.
+     */
+    config UInt16 segmentSize = 9;
 
-    /*!
+    /*
      *  ======== getProcId ========
-     *  Returns the MultiProc ID corresponding to a specific core
+     *  Returns the MultiProc ID corresponding to the given coreId
      */
     UInt16 getProcId(UInt coreId);
 
index 51e122f147e4873607750f51bd397682184d9b2b..e6490fc010dcc2bb4eccd7ae35005d80fd57b607 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
@@ -44,40 +44,42 @@ function module$use()
     MultiProcSetup = this;
     MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
 
-    /*
-     *  Only configure the local procId if the user hasn't disabled the config
-     *  and if the procId hasn't been statically set
+    /*  If not disabled by user and if procId has not been configured,
+     *  add run-time function to set it.
      */
-    if (MultiProcSetup.configureProcId == true &&
-            MultiProc.id == MultiProc.INVALIDID) {
+    if ((MultiProcSetup.configureProcId)
+            && (MultiProc.id == MultiProc.INVALIDID)) {
         var Startup = xdc.useModule('xdc.runtime.Startup');
         Startup.firstFxns.$add(MultiProcSetup.init);
     }
-}
 
-/*
- *  ======== module$static$init ========
- */
-function module$static$init(mod, params)
-{
+    /* the procMap is for all processors on the local device */
+    this.procMap.length = this.segmentSize;
 
-    /* The procMap is based upon the MuliProc id, init it here */
-    this.procMap.length = MultiProc.numProcessors;
     for (var i = 0; i < this.procMap.length; i++) {
         this.procMap[i] = -1;
     }
 
-    /* Set the procMap based on the configured names in MultiProc.setConfig */
-    for (var i = MultiProc.baseIdOfCluster; i < MultiProc.baseIdOfCluster +
-        MultiProc.numProcsInCluster; i++) {
+    /* make sure the MultiProc.nameList length fits into segmentSize */
+    if (MultiProc.nameList.length > this.segmentSize) {
+        this.$logError("The MultiProc.nameList length ("
+            + MultiProc.nameList.length + ") is larger than "
+            + "MultiProcSetup.segmentSize (" + this.segmentSize + ")", this);
+    }
+
+    /*  Use the MultiProc.nameList to initialize the procMap array
+     *  with the corresponding coreId.
+     */
+    for (var i = 0; i < MultiProc.nameList.length; i++) {
 
-        /* The nameList is based on an index */
-        if (MultiProc.nameList[i - MultiProc.baseIdOfCluster] == null) {
-            /* nameList is NULL, don't need to set the procMap */
-            break;
+        /* exclude host processor */
+        if (MultiProc.nameList[i] == "HOST") {
+            continue;
         }
 
-        this.procMap[i] = Number(MultiProc.nameList[i -
-            MultiProc.baseIdOfCluster].substring("CORE".length));
+        /* the numeric part of the name string determines the coreId */
+        var name = MultiProc.nameList[i];
+        var coreId = Number(name.substring("CORE".length));
+        this.procMap[i] = coreId;
     }
 }