SDOCM00106584 Notify mailbox driver support on DRA7xx (IPU, HOST) - Part 1
authorRamsey Harris <ramsey@ti.com>
Sat, 24 May 2014 18:46:31 +0000 (11:46 -0700)
committerRobert Tivy <rtivy@ti.com>
Wed, 28 May 2014 00:19:48 +0000 (17:19 -0700)
Added notify mailbox driver support for IPU. The InterruptIpu module
uses the NotifySetup module to dispatch interrupt to the correct notify
driver. The InterruptIpu ISR no longer checks all mailboxes for new
messages because the NotifySetup dispatch ISR already did this. Added
IPU support to the NotifySetup module.

The NotifyDriverMbx module now supports IPU. The code is the same as for
DSP and EVE. Added the module to product library builds for M3 and M4.

Added two new sub-mailboxes to the mailbox table. These are needed for
IPU1-0 to IPU1-1 communication when using the mailbox driver. For shared
memory driver, they did not use a mailbox for interrupt. They used
internal IPU interrupt.

Removed module startup method from InterruptDsp and InterruptIpu modules.
Consolidated startup code in NotifySetup. The NotifyDriverMbx startup
method was also consolidated (but not yet removed).

Removed interruptTable from InterruptDsp, InterruptIpu and NotifyDriverMbx
modules. Consolidated in NotifySetup. Added access method to NotifySetup
to fetch interrupt number from table.

Added new mailboxes to TableInit.xs: generateTable() method.

15 files changed:
packages/ti/sdo/ipc/Build.xs
packages/ti/sdo/ipc/family/vayu/InterruptDsp.c
packages/ti/sdo/ipc/family/vayu/InterruptDsp.xdc
packages/ti/sdo/ipc/family/vayu/InterruptDsp.xs
packages/ti/sdo/ipc/family/vayu/InterruptIpu.c
packages/ti/sdo/ipc/family/vayu/InterruptIpu.xdc
packages/ti/sdo/ipc/family/vayu/InterruptIpu.xs
packages/ti/sdo/ipc/family/vayu/NotifyDriverMbx.c
packages/ti/sdo/ipc/family/vayu/NotifyDriverMbx.xdc
packages/ti/sdo/ipc/family/vayu/NotifyDriverMbx.xs
packages/ti/sdo/ipc/family/vayu/NotifySetup.c
packages/ti/sdo/ipc/family/vayu/NotifySetup.xdc
packages/ti/sdo/ipc/family/vayu/NotifySetup.xs
packages/ti/sdo/ipc/family/vayu/TableInit.xs
packages/ti/sdo/ipc/family/vayu/package.xdc

index 32874893006acff5853ec4347ebb2c4ffaef1e52..e0db7c89b25dc0fe62b79f2477bc2a98a01a986e 100644 (file)
@@ -379,8 +379,7 @@ var commonSources = ipcSources +
                     transportsSources;
 //                  utilsSources;
 
-var C64PSources  =
-                   "ipc/gates/GateAAMonitor.c " +
+var C64PSources  = "ipc/gates/GateAAMonitor.c " +
                    "ipc/gates/GateHWSpinlock.c " +
                    "ipc/gates/GateHWSem.c " +
                    "ipc/family/dm6446/NotifySetup.c " +
@@ -400,8 +399,7 @@ var C66Sources   = "ipc/gates/GateHWSem.c " +
                    "ipc/family/vayu/NotifyDriverMbx.c " +
                    "ipc/family/vayu/NotifySetup.c ";
 
-var C674Sources  =
-                   "ipc/gates/GateHWSpinlock.c " +
+var C674Sources  = "ipc/gates/GateHWSpinlock.c " +
                    "ipc/family/da830/NotifySetup.c " +
                    "ipc/family/da830/NotifyCircSetup.c " +
                    "ipc/family/da830/InterruptDsp.c " +
@@ -419,14 +417,12 @@ var C674Sources  =
                    "ipc/family/c6a8149/NotifyMbxSetup.c " +
                    "ipc/family/c6a8149/NotifyDriverMbx.c ";
 
-
 var C647xSources = "ipc/family/c647x/Interrupt.c " +
                    "ipc/family/c647x/NotifyCircSetup.c " +
                    "ipc/family/c647x/MultiProcSetup.c " +
                    "ipc/family/c647x/NotifySetup.c ";
 
-var C64TSources  =
-                   "ipc/gates/GateHWSpinlock.c " +
+var C64TSources  = "ipc/gates/GateHWSpinlock.c " +
                    "ipc/family/omap4430/NotifyCircSetup.c " +
                    "ipc/family/omap4430/NotifySetup.c " +
                    "ipc/family/omap4430/InterruptDsp.c ";
@@ -436,8 +432,7 @@ var C28Sources   = "ipc/family/f28m35x/NotifyDriverCirc.c " +
                    "ipc/family/f28m35x/TransportCirc.c " +
                    "ipc/family/f28m35x/NameServerBlock.c ";
 
-var M3Sources    =
-                   "ipc/gates/GateHWSpinlock.c " +
+var M3Sources    = "ipc/gates/GateHWSpinlock.c " +
                    "ipc/family/omap4430/NotifySetup.c " +
                    "ipc/family/omap4430/NotifyCircSetup.c " +
                    "ipc/family/omap4430/InterruptDucati.c " +
@@ -456,11 +451,12 @@ var M3Sources    =
                    "ipc/family/f28m35x/TransportCirc.c " +
                    "ipc/family/f28m35x/NameServerBlock.c " +
                    "ipc/family/vayu/InterruptIpu.c " +
+                   "ipc/family/vayu/NotifyDriverMbx.c " +
                    "ipc/family/vayu/NotifySetup.c ";
 
-var M4Sources    =
-                   "ipc/gates/GateHWSpinlock.c " +
+var M4Sources    = "ipc/gates/GateHWSpinlock.c " +
                    "ipc/family/vayu/InterruptIpu.c " +
+                   "ipc/family/vayu/NotifyDriverMbx.c " +
                    "ipc/family/vayu/NotifySetup.c ";
 
 var Arm9Sources  = "ipc/family/dm6446/NotifySetup.c " +
@@ -470,8 +466,7 @@ var Arm9Sources  = "ipc/family/dm6446/NotifySetup.c " +
                    "ipc/family/da830/NotifyCircSetup.c " +
                    "ipc/family/da830/InterruptArm.c ";
 
-var A8FSources   =
-                   "ipc/gates/GateHWSpinlock.c " +
+var A8FSources   = "ipc/gates/GateHWSpinlock.c " +
                    "ipc/family/ti81xx/NotifySetup.c " +
                    "ipc/family/ti81xx/NotifyCircSetup.c " +
                    "ipc/family/ti81xx/InterruptHost.c " +
@@ -486,8 +481,7 @@ var A8FSources   =
                    "ipc/family/omap3530/NotifyCircSetup.c " +
                    "ipc/family/omap3530/InterruptHost.c ";
 
-var A8gSources  =
-                   "ipc/gates/GateHWSpinlock.c " +
+var A8gSources  = "ipc/gates/GateHWSpinlock.c " +
                    "ipc/family/ti81xx/NotifySetup.c " +
                    "ipc/family/ti81xx/NotifyCircSetup.c " +
                    "ipc/family/ti81xx/InterruptHost.c " +
@@ -502,13 +496,11 @@ var A8gSources  =
                    "ipc/family/omap3530/NotifyCircSetup.c " +
                    "ipc/family/omap3530/InterruptHost.c ";
 
-
 var A15gSources  = "ipc/family/vayu/InterruptHost.c " +
                    "ipc/family/vayu/NotifySetup.c " +
                    "ipc/gates/GateHWSpinlock.c ";
 
-var ARP32Sources   =
-                   "ipc/gates/GateHWSpinlock.c " +
+var ARP32Sources = "ipc/gates/GateHWSpinlock.c " +
                    "ipc/family/arctic/NotifySetup.c " +
                    "ipc/family/arctic/NotifyCircSetup.c " +
                    "ipc/family/arctic/InterruptArp32.c " +
index 907f85c9d0f21376a23f9940579ef2bc30a86110..5bb489c569b7d8660c20e625482a15e7d2b807d5 100644 (file)
  *************************************************************************
  */
 
-/*
- *  ======== InterruptDsp_Module_startup ========
- */
-Int InterruptDsp_Module_startup(Int phase)
-{
-    extern cregister volatile UInt DNUM;
-
-    if (IntXbar_Module_startupDone()) {
-        /* connect mailbox interrupts at startup */
-        if (DNUM == 0) {               /* DSP1 */
-            IntXbar_connect(24, 284);  // eve1 mailbox 0 user 1
-            IntXbar_connect(25, 293);  // eve2 mailbox 0 user 1
-            IntXbar_connect(26, 249);  // system mailbox 5 user 0
-
-            InterruptDsp_module->interruptTable[6] = 57;    // IPU1-0
-            InterruptDsp_module->interruptTable[9] = 57;    // IPU1-1
-
-            /* plug eve3 and eve4 mbxs only if eve3 and eve4 exists */
-            if ((MultiProc_getId("EVE3") != MultiProc_INVALIDID) ||
-                (MultiProc_getId("EVE4") != MultiProc_INVALIDID)) {
-                IntXbar_connect(27, 302);  // eve3 mailbox 0 user 1
-                IntXbar_connect(28, 311);  // eve4 mailbox 0 user 1
-            }
-
-            /* plug mbx7 only if DSP2 or IPU2 exists */
-            if ((MultiProc_getId("DSP2") != MultiProc_INVALIDID) ||
-                (MultiProc_getId("IPU2") != MultiProc_INVALIDID) ||
-                (MultiProc_getId("IPU2-0") != MultiProc_INVALIDID)) {
-                IntXbar_connect(29, 257);  // system mailbox 7 user 0
-                InterruptDsp_module->interruptTable[7] = 60;    // IPU2-0
-            }
-
-            /* plug mbx8 only if IPU2-1 exists */
-            if (MultiProc_getId("IPU2-1") != MultiProc_INVALIDID) {
-                IntXbar_connect(30, 261);  // system mailbox 8 user 0
-                InterruptDsp_module->interruptTable[10] = 61;    // IPU2-1
-            }
-        }
-        else if (DNUM == 1) {          /* DSP2 */
-            IntXbar_connect(24, 287);  // eve1 mailbox 1 user 1
-            IntXbar_connect(25, 296);  // eve2 mailbox 1 user 1
-            IntXbar_connect(26, 253);  // system mailbox 6 user 0
-
-            InterruptDsp_module->interruptTable[7] = 57;    // IPU2-0
-            InterruptDsp_module->interruptTable[10] = 57;   // IPU2-1
-
-            /* plug eve3 and eve4 mbxs only if eve3 and eve4 exists */
-            if ((MultiProc_getId("EVE3") != MultiProc_INVALIDID) ||
-                (MultiProc_getId("EVE4") != MultiProc_INVALIDID)) {
-                IntXbar_connect(27, 305);  // eve3 mailbox 1 user 1
-                IntXbar_connect(28, 314);  // eve4 mailbox 1 user 1
-            }
-
-            /* plug mbx7 only if DSP1 or IPU1 exists */
-            if ((MultiProc_getId("DSP1") != MultiProc_INVALIDID) ||
-                (MultiProc_getId("IPU1") != MultiProc_INVALIDID) ||
-                (MultiProc_getId("IPU1-0") != MultiProc_INVALIDID)) {
-                IntXbar_connect(29, 258);  // system mailbox 7 user 1
-                InterruptDsp_module->interruptTable[6] = 60;    // IPU1-0
-            }
-
-            /* plug mbx8 only if IPU1-1 exists */
-            if (MultiProc_getId("IPU1-1") != MultiProc_INVALIDID) {
-                IntXbar_connect(30, 262);  // system mailbox 8 user 1
-                InterruptDsp_module->interruptTable[9] = 61;    // IPU1-1
-            }
-        }
-        return (Startup_DONE);
-    }
-
-    return (Startup_NOTDONE);
-}
-
 /*
  *  ======== InterruptDsp_intEnable ========
  *  Enable remote processor interrupt
index 69a24796436144442021030a88c95174aeba702c..acea63c5045f0cc8a78f9b8c8dde4ec3d53e71e6 100644 (file)
@@ -42,8 +42,6 @@ import xdc.rov.ViewInfo;
  *  ======== InterruptDsp ========
  *  Vayu/DSP interrupt manager
  */
-@ModuleStartup
-
 module InterruptDsp inherits ti.sdo.ipc.notifyDrivers.IInterrupt
 {
     /*! @_nodoc */
@@ -129,10 +127,5 @@ internal:
          * System) for each DSP core.
          */
         FxnTable   fxnTable[NUM_CORES];
-
-        /*
-         * Interrupt event IDs used to communicate with this processor.
-         * Table is indexed by virtual processor ID. */
-        UInt16 interruptTable[NUM_CORES];
     };
 }
index 787964c5a980530682edcddf02f0c6cf8cd5cecb..0a85a73298b6b6cd27119a2b35a13b4427e64805 100644 (file)
@@ -97,19 +97,4 @@ function module$static$init(mod, params)
         mod.fxnTable[remoteProcId].func  = null;
         mod.fxnTable[remoteProcId].arg   = 0;
     }
-
-    /* Initialize Interrupt Event Ids for communicating with this processor */
-    mod.interruptTable[0] = 55; /* EVE1 -> DSP1 or DSP2 */
-    mod.interruptTable[1] = 56; /* EVE2 -> DSP1 or DSP2 */
-    mod.interruptTable[2] = 58; /* EVE3 -> DSP1 or DSP2 */
-    mod.interruptTable[3] = 59; /* EVE4 -> DSP1 or DSP2 */
-    mod.interruptTable[4] = 60; /* DSP1 -> DSP2 */
-    mod.interruptTable[5] = 60; /* DSP2 -> DSP1 */
-    mod.interruptTable[8] = 57; /* HOST -> DSP1 or DSP2 */
-
-    /* These are not known at config time and is set a runtime */
-    mod.interruptTable[6] = 0; /* IPU1 -> DSP1 or DSP2 */
-    mod.interruptTable[7] = 0; /* IPU2 -> DSP1 or DSP2 */
-    mod.interruptTable[9] = 0; /* IPU1-1 -> DSP1 or DSP2 */
-    mod.interruptTable[10] = 0; /* IPU2-1 -> DSP1 or DSP2 */
 }
index 615fd73e25068df66f732930399e5cef86a1fb83..32f64b32b593b34fcdf2d39602dd47c6c72f3109 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013-2014, Texas Instruments Incorporated
+ * Copyright (c) 2013-2014 Texas Instruments Incorporated - http://www.ti.com
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
 
 #include <xdc/std.h>
 #include <xdc/runtime/Assert.h>
-#include <xdc/runtime/System.h>
 #include <xdc/runtime/Startup.h>
 
 #include <ti/sysbios/BIOS.h>
 #include <ti/sysbios/family/shared/vayu/IntXbar.h>
 #include <ti/sysbios/family/arm/m3/Hwi.h>
 #include <ti/sysbios/family/arm/ducati/Core.h>
+
+#include <ti/sdo/ipc/family/vayu/NotifySetup.h>
 #include <ti/sdo/ipc/notifyDrivers/IInterrupt.h>
 #include <ti/sdo/utils/_MultiProc.h>
 
  *************************************************************************
  */
 
-/*
- *  ======== InterruptIpu_Module_startup ========
- */
-Int InterruptIpu_Module_startup(Int phase)
-{
-    if (IntXbar_Module_startupDone()) {
-        /* connect mailbox interrupts at startup */
-        if (Core_ipuId == 1) {
-            if ((BIOS_smpEnabled) || (Core_getId() == 0)) {
-                /* IPU1-0 */
-                IntXbar_connect(42, 285);  // eve1 mailbox 0 user 2
-                IntXbar_connect(43, 294);  // eve2 mailbox 0 user 2
-                IntXbar_connect(44, 250);  // system mailbox 5 user 1
-                InterruptIpu_module->interruptTable[4] = 66;    // DSP1
-                InterruptIpu_module->interruptTable[8] = 66;    // HOST
-                InterruptIpu_module->interruptTable[9] = 19;    // IPU1-1
-
-                /* plug eve3 and eve4 mbxs only if eve3 and eve4 exists */
-                if ((MultiProc_getId("EVE3") != MultiProc_INVALIDID) ||
-                    (MultiProc_getId("EVE4") != MultiProc_INVALIDID)) {
-                    IntXbar_connect(45, 303);  // eve3 mailbox 0 user 2
-                    IntXbar_connect(46, 312);  // eve4 mailbox 0 user 2
-                }
-
-                /* plug mbx7 only if DSP2 or IPU2 exists */
-                if ((MultiProc_getId("DSP2") != MultiProc_INVALIDID) ||
-                    (MultiProc_getId("IPU2") != MultiProc_INVALIDID) ||
-                    (MultiProc_getId("IPU2-0") != MultiProc_INVALIDID)) {
-                    IntXbar_connect(47, 259);  // system mailbox 7 user 2
-                    InterruptIpu_module->interruptTable[5] = 69;    // DSP2
-                    InterruptIpu_module->interruptTable[7] = 69;    // IPU2-0
-                }
-
-                /* plug mbx8 only if IPU2-1 exists */
-                if (MultiProc_getId("IPU2-1") != MultiProc_INVALIDID) {
-                    IntXbar_connect(48, 263);  // system mailbox 8 user 2
-                    InterruptIpu_module->interruptTable[10] = 70;    // IPU2-1
-                }
-            }
-            else { /* IPU1-1 */
-                IntXbar_connect(49, 289);  // eve1 mailbox 1 user 3
-                IntXbar_connect(50, 298);  // eve2 mailbox 1 user 3
-                IntXbar_connect(51, 252);  // system mailbox 5 user 3
-                InterruptIpu_module->interruptTable[4] = 73;    // DSP1
-                InterruptIpu_module->interruptTable[8] = 73;    // HOST
-                InterruptIpu_module->interruptTable[6] = 19;    // IPU1-0
-
-                /* plug eve3 and eve4 mbxs only if eve3 and eve4 exists */
-                if ((MultiProc_getId("EVE3") != MultiProc_INVALIDID) ||
-                    (MultiProc_getId("EVE4") != MultiProc_INVALIDID)) {
-                    IntXbar_connect(52, 307);  // eve3 mailbox 1 user 3
-                    IntXbar_connect(53, 316);  // eve4 mailbox 1 user 3
-                }
-
-                /* plug mbx8 only if DSP2 or IPU2 exists */
-                if ((MultiProc_getId("DSP2") != MultiProc_INVALIDID) ||
-                    (MultiProc_getId("IPU2") != MultiProc_INVALIDID) ||
-                    (MultiProc_getId("IPU2-0") != MultiProc_INVALIDID)) {
-                    IntXbar_connect(54, 263);  // system mailbox 8 user 2
-                    InterruptIpu_module->interruptTable[5] = 76;    // DSP2
-                    InterruptIpu_module->interruptTable[7] = 76;    // IPU2-0
-                }
-            }
-        }
-        else {
-            if ((BIOS_smpEnabled) || (Core_getId() == 0)) {
-                /* IPU2-0 */
-                IntXbar_connect(42, 288);  // eve1 mailbox 1 user 2
-                IntXbar_connect(43, 297);  // eve2 mailbox 1 user 2
-                IntXbar_connect(44, 254);  // system mailbox 6 user 1
-                InterruptIpu_module->interruptTable[5] = 66;    // DSP2
-                InterruptIpu_module->interruptTable[8] = 66;    // HOST
-                InterruptIpu_module->interruptTable[10] = 19;    // IPU2-1
-
-                /* plug eve3 and eve4 mbxs only if eve3 and eve4 exists */
-                if ((MultiProc_getId("EVE3") != MultiProc_INVALIDID) ||
-                    (MultiProc_getId("EVE4") != MultiProc_INVALIDID)) {
-                    IntXbar_connect(45, 306);  // eve3 mailbox 1 user 2
-                    IntXbar_connect(46, 315);  // eve4 mailbox 1 user 2
-                }
-
-                /* plug mbx7 only if DSP1 or IPU1 exists */
-                if ((MultiProc_getId("DSP1") != MultiProc_INVALIDID) ||
-                    (MultiProc_getId("IPU1") != MultiProc_INVALIDID) ||
-                    (MultiProc_getId("IPU1-0") != MultiProc_INVALIDID)) {
-                    IntXbar_connect(47, 260);  // system mailbox 7 user 3
-                    InterruptIpu_module->interruptTable[4] = 69;    // DSP1
-                    InterruptIpu_module->interruptTable[6] = 69;    // IPU1-0
-                }
-
-                /* plug mbx8 only if IPU1-1 exists */
-                if (MultiProc_getId("IPU1-1") != MultiProc_INVALIDID) {
-                    IntXbar_connect(48, 264);  // system mailbox 8 user 3
-                    InterruptIpu_module->interruptTable[9] = 70;    // IPU1-1
-                }
-            }
-            else { /* IPU2-1 */
-                IntXbar_connect(49, 289);  // eve1 mailbox 1 user 3
-                IntXbar_connect(50, 298);  // eve2 mailbox 1 user 3
-                IntXbar_connect(51, 256);  // system mailbox 6 user 3
-                InterruptIpu_module->interruptTable[5] = 73;    // DSP2
-                InterruptIpu_module->interruptTable[8] = 73;    // HOST
-                InterruptIpu_module->interruptTable[7] = 19;    // IPU2-0
-
-                /* plug eve3 and eve4 mbxs only if eve3 and eve4 exists */
-                if ((MultiProc_getId("EVE3") != MultiProc_INVALIDID) ||
-                    (MultiProc_getId("EVE4") != MultiProc_INVALIDID)) {
-                    IntXbar_connect(52, 307);  // eve3 mailbox 1 user 3
-                    IntXbar_connect(53, 316);  // eve4 mailbox 1 user 3
-                }
-
-                /* plug mbx8 only if DSP2 or IPU2 exists */
-                if ((MultiProc_getId("DSP1") != MultiProc_INVALIDID) ||
-                    (MultiProc_getId("IPU1") != MultiProc_INVALIDID) ||
-                    (MultiProc_getId("IPU1-0") != MultiProc_INVALIDID)) {
-                    IntXbar_connect(54, 264);  // system mailbox 8 user 3
-                    InterruptIpu_module->interruptTable[4] = 76;    // DSP1
-                    InterruptIpu_module->interruptTable[6] = 76;    // IPU1-0
-                }
-            }
-        }
-
-        return (Startup_DONE);
-    }
-
-    return (Startup_NOTDONE);
-}
-
 /*
  *  ======== InterruptIpu_intEnable ========
  *  Enable remote processor interrupt
@@ -304,28 +177,26 @@ Void InterruptIpu_intDisable(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo)
 /*
  *  ======== InterruptIpu_intRegister ========
  */
-Void InterruptIpu_intRegister(UInt16 remoteProcId,
-                              IInterrupt_IntInfo *intInfo,
-                              Fxn func, UArg arg)
+Void InterruptIpu_intRegister(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo,
+        Fxn func, UArg arg)
 {
     Hwi_Params  hwiAttrs;
     UInt        key;
-    UInt        mbxIdx;
     Int         index;
     InterruptIpu_FxnTable *table;
 
     Assert_isTrue(remoteProcId < ti_sdo_utils_MultiProc_numProcessors,
             ti_sdo_utils_MultiProc_A_invalidMultiProcId);
 
-    mbxIdx = MBX_BASEADDR_IDX(MBX_TABLE_IDX(remoteProcId, MultiProc_self()));
-
+    /* index is the virtual id (invariant) */
     index = PROCID(remoteProcId);
 
-    intInfo->localIntId = InterruptIpu_module->interruptTable[index];
+    intInfo->localIntId = NotifySetup_interruptTable(index);
 
     /* Disable global interrupts */
     key = Hwi_disable();
 
+    /* store callback function by virtual id */
     table = &(InterruptIpu_module->fxnTable[index]);
     table->func = func;
     table->arg  = arg;
@@ -338,23 +209,16 @@ Void InterruptIpu_intRegister(UInt16 remoteProcId,
     if (Core_ipuId == 1) {
         if ((remoteProcId == InterruptIpu_ipu1_0ProcId) ||
             (remoteProcId == InterruptIpu_ipu1_1ProcId)) {
+
+            /* plug the cpu interrupt with local isr */
             Hwi_create(intInfo->localIntId,
                    (Hwi_FuncPtr)InterruptIpu_intShmDucatiStub,
-                   &hwiAttrs,
-                   NULL);
+                   &hwiAttrs, NULL);
         }
         else {
-            /* Make sure the interrupt only gets plugged once */
-            InterruptIpu_module->numPlugged[mbxIdx]++;
-            if (InterruptIpu_module->numPlugged[mbxIdx] == 1) {
-                Hwi_create(intInfo->localIntId,
-                           (Hwi_FuncPtr)InterruptIpu_intShmMbxStub,
-                            &hwiAttrs,
-                            NULL);
-
-                /* Interrupt_intEnable won't enable the Hwi */
-                Hwi_enableInterrupt(intInfo->localIntId);
-            }
+            /* plug the cpu interrupt with notify setup dispatch isr */
+            NotifySetup_plugHwi(remoteProcId, intInfo->localIntId,
+                    InterruptIpu_intShmMbxStub);
         }
     }
     else {
@@ -362,21 +226,11 @@ Void InterruptIpu_intRegister(UInt16 remoteProcId,
             (remoteProcId == InterruptIpu_ipu2_1ProcId)) {
             Hwi_create(intInfo->localIntId,
                    (Hwi_FuncPtr)InterruptIpu_intShmDucatiStub,
-                   &hwiAttrs,
-                   NULL);
+                   &hwiAttrs, NULL);
         }
         else {
-            /* Make sure the interrupt only gets plugged once */
-            InterruptIpu_module->numPlugged[mbxIdx]++;
-            if (InterruptIpu_module->numPlugged[mbxIdx] == 1) {
-                Hwi_create(intInfo->localIntId,
-                           (Hwi_FuncPtr)InterruptIpu_intShmMbxStub,
-                            &hwiAttrs,
-                            NULL);
-
-                /* Interrupt_intEnable won't enable the Hwi */
-                Hwi_enableInterrupt(intInfo->localIntId);
-            }
+            NotifySetup_plugHwi(remoteProcId, intInfo->localIntId,
+                    InterruptIpu_intShmMbxStub);
         }
     }
 
@@ -390,15 +244,13 @@ Void InterruptIpu_intRegister(UInt16 remoteProcId,
  *  ======== InterruptIpu_intUnregister ========
  */
 Void InterruptIpu_intUnregister(UInt16 remoteProcId,
-                                IInterrupt_IntInfo *intInfo)
+        IInterrupt_IntInfo *intInfo)
 {
-    UInt                       mbxIdx;
     Int                        index;
     InterruptIpu_FxnTable *table;
     Hwi_Handle                 hwiHandle;
 
-    mbxIdx = MBX_BASEADDR_IDX(MBX_TABLE_IDX(remoteProcId, MultiProc_self()));
-
+    /* index is the virtual id (invariant) */
     index = PROCID(remoteProcId);
 
     /* Disable the mailbox interrupt source */
@@ -411,12 +263,7 @@ Void InterruptIpu_intUnregister(UInt16 remoteProcId,
             Hwi_delete(&hwiHandle);
         }
         else {
-            /* Disable the interrupt itself */
-            InterruptIpu_module->numPlugged[mbxIdx]--;
-            if (InterruptIpu_module->numPlugged[mbxIdx] == 0) {
-                hwiHandle = Hwi_getHandle(intInfo->localIntId);
-                Hwi_delete(&hwiHandle);
-            }
+            NotifySetup_unplugHwi(remoteProcId, intInfo->localIntId);
         }
     }
     else {
@@ -426,12 +273,7 @@ Void InterruptIpu_intUnregister(UInt16 remoteProcId,
             Hwi_delete(&hwiHandle);
         }
         else {
-            /* Disable the interrupt itself */
-            InterruptIpu_module->numPlugged[mbxIdx]--;
-            if (InterruptIpu_module->numPlugged[mbxIdx] == 0) {
-                hwiHandle = Hwi_getHandle(intInfo->localIntId);
-                Hwi_delete(&hwiHandle);
-            }
+            NotifySetup_unplugHwi(remoteProcId, intInfo->localIntId);
         }
     }
 
@@ -659,33 +501,12 @@ Void InterruptIpu_intShmDucatiStub(UArg arg)
 /*
  *  ======== InterruptIpu_intShmMbxStub ========
  */
-Void InterruptIpu_intShmMbxStub(UArg arg)
+Void InterruptIpu_intShmMbxStub(UInt16 idx)
 {
-    UInt16 index;
-    UInt16 selfIdx;
-    UInt16 loopIdx;
+    UInt16 srcVirtId;
     InterruptIpu_FxnTable *table;
 
-    selfIdx = MultiProc_self();
-
-    for (loopIdx = 0; loopIdx < MultiProc_getNumProcsInCluster(); loopIdx++) {
-
-        if (loopIdx == selfIdx) {
-            continue;
-        }
-
-        index = MBX_TABLE_IDX(loopIdx, selfIdx);
-
-        /* skip mailbox if it's not being used */
-        if (InterruptIpu_mailboxTable[index] == (UInt32)(-1)) {
-            continue;
-        }
-
-        if (((REG32(MAILBOX_STATUS(index)) != 0) &&
-             (REG32(MAILBOX_IRQENABLE_SET(index)) &
-              MAILBOX_REG_VAL(SUBMBX_IDX(index))))) {
-            table = &(InterruptIpu_module->fxnTable[PROCID(loopIdx)]);
-            (table->func)(table->arg);
-        }
-    }
+    srcVirtId = idx / InterruptIpu_NUM_CORES;
+    table = &(InterruptIpu_module->fxnTable[srcVirtId]);
+    (table->func)(table->arg);
 }
index 6f029618a47c066e33a890cda47b02072c5c50d8..b1da830c1038e34af5bfeac728ddbaf4638d0fc6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * Copyright (c) 2012-2014 Texas Instruments Incorporated - http://www.ti.com
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -40,9 +40,6 @@ import ti.sdo.utils.MultiProc;
  *  ======== InterruptIpu ========
  *  IPU interrupt manager
  */
-
-@ModuleStartup
-
 module InterruptIpu inherits ti.sdo.ipc.notifyDrivers.IInterrupt
 {
     /*!
@@ -164,7 +161,7 @@ internal:
     Void intShmDucatiStub(UArg arg);
 
     /*! Stub to be plugged for intra-ducati interrupts */
-    Void intShmMbxStub(UArg arg);
+    Void intShmMbxStub(UInt16 idx);
 
     struct Module_State {
         /*
@@ -175,8 +172,5 @@ internal:
 
         /* # of times interrupt registered */
         UInt16     numPlugged[NUM_EVE_MBX + NUM_SYS_MBX];
-
-        /* table of interrupt event ids use to communicate with this proc */
-        UInt16 interruptTable[NUM_CORES];
     };
 }
index 682f62dfca18270762df45142c071b42b379cb15..37c9905474cf9fc51a5cdd3d7f11e17004db995a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Texas Instruments Incorporated
+ * Copyright (c) 2012-2014 Texas Instruments Incorporated - http://www.ti.com
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -51,6 +51,8 @@ function module$use()
     Xbar            = xdc.useModule("ti.sysbios.family.shared.vayu.IntXbar");
     TableInit       = xdc.useModule("ti.sdo.ipc.family.vayu.TableInit");
 
+    xdc.useModule("ti.sdo.ipc.family.vayu.NotifySetup");
+
     /* Initisalize procIdTable */
     TableInit.initProcId(Ipu);
 
@@ -150,40 +152,7 @@ function module$static$init(mod, params)
         mod.fxnTable[remoteProcId].arg   = 0;
     }
 
-    for (mbxId = 0; mbxId < Ipu.mailboxBaseAddr.length; mbxId++) {
+    for (mbxId = 0; mbxId < mod.numPlugged.length; mbxId++) {
         mod.numPlugged[mbxId] = 0;
     }
-
-    /* Initialize Interrupt Event Ids for communicating with this processor */
-    if (Core.id == 0) {
-        mod.interruptTable[0] = 64; /* EVE1 */
-        mod.interruptTable[1] = 65; /* EVE2 */
-        mod.interruptTable[2] = 67; /* EVE3 */
-        mod.interruptTable[3] = 68; /* EVE4 */
-
-        /* These are not known at config time and is set a runtime */
-        mod.interruptTable[4] = 0; /* DSP1 */
-        mod.interruptTable[5] = 0; /* DSP2 */
-        mod.interruptTable[6] = 0; /* Ipu1-0 */
-        mod.interruptTable[7] = 0; /* Ipu2-0 */
-        mod.interruptTable[8] = 0; /* HOST */
-        mod.interruptTable[9] = 0; /* Ipu1-1 */
-        mod.interruptTable[10] = 0; /* Ipu2-1 */
-    }
-    else {
-        mod.interruptTable[0] = 71; /* EVE1 */
-        mod.interruptTable[1] = 72; /* EVE2 */
-        mod.interruptTable[2] = 74; /* EVE3 */
-        mod.interruptTable[3] = 75; /* EVE4 */
-
-        /* These are not known at config time and is set a runtime */
-        mod.interruptTable[4] = 0; /* DSP1 */
-        mod.interruptTable[5] = 0; /* DSP2 */
-        mod.interruptTable[6] = 0; /* Ipu1-0 */
-        mod.interruptTable[7] = 0; /* Ipu2-0 */
-        mod.interruptTable[8] = 0; /* HOST */
-        mod.interruptTable[9] = 0; /* Ipu1-1 */
-        mod.interruptTable[10] = 0; /* Ipu2-1 */
-
-    }
 }
index aa63a36609903593e27a0742d778f7e7e08da611..bb840bd47b7dc04b36366121066fd84fe1c729a8 100644 (file)
@@ -116,72 +116,8 @@ Int NotifyDriverMbx_Module_startup(Int phase)
 {
 #if defined(xdc_target__isaCompatible_64P)
 
-    extern cregister volatile UInt DNUM;
-
-    if (IntXbar_Module_startupDone()) {
-        /* connect mailbox interrupts at startup */
-        if (DNUM == 0) {               /* DSP1 */
-            IntXbar_connect(24, 284);  // eve1 mailbox 0 user 1
-            IntXbar_connect(25, 293);  // eve2 mailbox 0 user 1
-            IntXbar_connect(26, 249);  // system mailbox 5 user 0
-
-            NotifyDriverMbx_module->interruptTable[6] = 57; // IPU1-0
-            NotifyDriverMbx_module->interruptTable[9] = 57; // IPU1-1
-
-            /* plug eve3 and eve4 mbxs only if eve3 and eve4 exists */
-            if ((MultiProc_getId("EVE3") != MultiProc_INVALIDID) ||
-                (MultiProc_getId("EVE4") != MultiProc_INVALIDID)) {
-                IntXbar_connect(27, 302);  // eve3 mailbox 0 user 1
-                IntXbar_connect(28, 311);  // eve4 mailbox 0 user 1
-            }
-
-            /* plug mbx7 only if DSP2 or IPU2 exists */
-            if ((MultiProc_getId("DSP2") != MultiProc_INVALIDID) ||
-                (MultiProc_getId("IPU2") != MultiProc_INVALIDID) ||
-                (MultiProc_getId("IPU2-0") != MultiProc_INVALIDID)) {
-                IntXbar_connect(29, 257);  // system mailbox 7 user 0
-                NotifyDriverMbx_module->interruptTable[7] = 60; // IPU2-0
-            }
-
-            /* plug mbx8 only if IPU2-1 exists */
-            if (MultiProc_getId("IPU2-1") != MultiProc_INVALIDID) {
-                IntXbar_connect(30, 261);  // system mailbox 8 user 0
-                NotifyDriverMbx_module->interruptTable[10] = 61; // IPU2-1
-            }
-        }
-        else if (DNUM == 1) {          /* DSP2 */
-            IntXbar_connect(24, 287);  // eve1 mailbox 1 user 1
-            IntXbar_connect(25, 296);  // eve2 mailbox 1 user 1
-            IntXbar_connect(26, 253);  // system mailbox 6 user 0
-
-            NotifyDriverMbx_module->interruptTable[7] = 57; // IPU2-0
-            NotifyDriverMbx_module->interruptTable[10] = 57; // IPU2-1
-
-            /* plug eve3 and eve4 mbxs only if eve3 and eve4 exists */
-            if ((MultiProc_getId("EVE3") != MultiProc_INVALIDID) ||
-                (MultiProc_getId("EVE4") != MultiProc_INVALIDID)) {
-                IntXbar_connect(27, 305);  // eve3 mailbox 1 user 1
-                IntXbar_connect(28, 314);  // eve4 mailbox 1 user 1
-            }
-
-            /* plug mbx7 only if DSP1 or IPU1 exists */
-            if ((MultiProc_getId("DSP1") != MultiProc_INVALIDID) ||
-                (MultiProc_getId("IPU1") != MultiProc_INVALIDID) ||
-                (MultiProc_getId("IPU1-0") != MultiProc_INVALIDID)) {
-                IntXbar_connect(29, 258);  // system mailbox 7 user 1
-                NotifyDriverMbx_module->interruptTable[6] = 60; // IPU1-0
-            }
-
-            /* plug mbx8 only if IPU1-1 exists */
-            if (MultiProc_getId("IPU1-1") != MultiProc_INVALIDID) {
-                IntXbar_connect(30, 262);  // system mailbox 8 user 1
-                NotifyDriverMbx_module->interruptTable[9] = 61; // IPU1-1
-            }
-        }
-        return (Startup_DONE);
-    }
-
-    return (Startup_NOTDONE);
+    /* nothing to do on this processor */
+    return (Startup_DONE);
 
 #elif defined(xdc_target__isaCompatible_arp32)
 
@@ -190,7 +126,7 @@ Int NotifyDriverMbx_Module_startup(Int phase)
 
 #elif defined(xdc_target__isaCompatible_v7M)
 
-    /* TODO */
+    /* nothing to do on this processor */
     return (Startup_DONE);
 
 #elif defined(xdc_target__isaCompatible_v7A)
@@ -356,9 +292,10 @@ Int NotifyDriverMbx_sendEvent(NotifyDriverMbx_Object *obj, UInt32 eventId,
         UInt32 payload, Bool waitClear)
 {
     UInt16 selfVirtId = PROCID(MultiProc_self());
-    UInt key, numMsgs;
-    UInt32 smallPayload;
     UInt16 index;
+    UInt key;
+    UInt numMsgs;
+    UInt32 smallPayload;
 
     /* Decide if the payload is small enough to fit in the first mbx msg */
     if (payload < 0x7FFFFFF) {
@@ -371,47 +308,17 @@ Int NotifyDriverMbx_sendEvent(NotifyDriverMbx_Object *obj, UInt32 eventId,
     }
 
 #if defined(xdc_target__isaCompatible_64P) || \
-    defined(xdc_target__isaCompatible_arp32)
+    defined(xdc_target__isaCompatible_arp32) || \
+    defined(xdc_target__isaCompatible_v7M)
 
     index = (selfVirtId * NotifyDriverMbx_NUM_CORES) + obj->remoteVirtId;
     PUT_NOTIFICATION(index);
 
-#elif defined(xdc_target__isaCompatible_v7M)
-
-//  if (!(BIOS_smpEnabled) && (Core_getId())) {
-//      if (remoteProcId == NotifyDriverMbx_dspProcId) {
-//          PUT_NOTIFICATION(VPSS_TO_DSP)
-//      }
-//      else if (remoteProcId == NotifyDriverMbx_hostProcId) {
-//          PUT_NOTIFICATION(VPSS_TO_HOST)
-//      }
-//      else {
-//          PUT_NOTIFICATION(VPSS_TO_VIDEO)
-//      }
-//  }
-//  else {
-//      if (remoteProcId == NotifyDriverMbx_dspProcId) {
-//          PUT_NOTIFICATION(VIDEO_TO_DSP)
-//      }
-//      else if (remoteProcId == NotifyDriverMbx_hostProcId) {
-//          PUT_NOTIFICATION(VIDEO_TO_HOST)
-//      }
-//      else {
-//          PUT_NOTIFICATION(VIDEO_TO_VPSS)
-//      }
-//  }
-
 #elif defined(xdc_target__isaCompatible_v7A)
 
-//  if (remoteProcId == NotifyDriverMbx_dspProcId) {
-//      PUT_NOTIFICATION(HOST_TO_DSP)
-//  }
-//  else if (remoteProcId == NotifyDriverMbx_videoProcId) {
-//      PUT_NOTIFICATION(HOST_TO_VIDEO)
-//  }
-//  else {
-//      PUT_NOTIFICATION(HOST_TO_VPSS)
-//  }
+    /* TODO */
+    index = (selfVirtId * NotifyDriverMbx_NUM_CORES) + obj->remoteVirtId;
+    PUT_NOTIFICATION(index);
 
 #else
 #error Invalid target
@@ -429,47 +336,17 @@ Void NotifyDriverMbx_disable(NotifyDriverMbx_Object *obj)
     UInt16 index;
 
 #if defined(xdc_target__isaCompatible_64P) || \
-    defined(xdc_target__isaCompatible_arp32)
+    defined(xdc_target__isaCompatible_arp32) || \
+    defined(xdc_target__isaCompatible_v7M)
 
     index = (obj->remoteVirtId * NotifyDriverMbx_NUM_CORES) + selfVirtId;
     REG32(MAILBOX_IRQENABLE_CLR(index)) = MAILBOX_REG_VAL(SUBMBX_IDX(index));
 
-#elif defined(xdc_target__isaCompatible_v7M)
-
-//  if (!(BIOS_smpEnabled) && (Core_getId())) {
-//      if (remoteProcId == NotifyDriverMbx_hostProcId) {
-//          REG32(MAILBOX_IRQENABLE_CLR_VPSS) = MAILBOX_REG_VAL(HOST_TO_VPSS);
-//      }
-//      else if (remoteProcId == NotifyDriverMbx_dspProcId) {
-//          REG32(MAILBOX_IRQENABLE_CLR_VPSS) = MAILBOX_REG_VAL(DSP_TO_VPSS);
-//      }
-//      else {
-//          REG32(MAILBOX_IRQENABLE_CLR_VPSS) = MAILBOX_REG_VAL(VIDEO_TO_VPSS);
-//      }
-//  }
-//  else {
-//      if (remoteProcId == NotifyDriverMbx_hostProcId) {
-//          REG32(MAILBOX_IRQENABLE_CLR_VIDEO) = MAILBOX_REG_VAL(HOST_TO_VIDEO);
-//      }
-//      else if (remoteProcId == NotifyDriverMbx_dspProcId) {
-//          REG32(MAILBOX_IRQENABLE_CLR_VIDEO) = MAILBOX_REG_VAL(DSP_TO_VIDEO);
-//      }
-//      else {
-//          REG32(MAILBOX_IRQENABLE_CLR_VIDEO) = MAILBOX_REG_VAL(VPSS_TO_VIDEO);
-//      }
-//  }
-
 #elif defined(xdc_target__isaCompatible_v7A)
 
-//  if (remoteProcId == NotifyDriverMbx_dspProcId) {
-//      REG32(MAILBOX_IRQENABLE_CLR_HOST) = MAILBOX_REG_VAL(DSP_TO_HOST);
-//  }
-//  else if (remoteProcId == NotifyDriverMbx_videoProcId) {
-//      REG32(MAILBOX_IRQENABLE_CLR_HOST) = MAILBOX_REG_VAL(VIDEO_TO_HOST);
-//  }
-//  else {
-//      REG32(MAILBOX_IRQENABLE_CLR_HOST) = MAILBOX_REG_VAL(VPSS_TO_HOST);
-//  }
+    /* TODO */
+    index = (obj->remoteVirtId * NotifyDriverMbx_NUM_CORES) + selfVirtId;
+    REG32(MAILBOX_IRQENABLE_CLR(index)) = MAILBOX_REG_VAL(SUBMBX_IDX(index));
 
 #else
 #error Invalid target
@@ -485,47 +362,17 @@ Void NotifyDriverMbx_enable(NotifyDriverMbx_Object *obj)
     UInt16 index;
 
 #if defined(xdc_target__isaCompatible_64P) || \
-    defined(xdc_target__isaCompatible_arp32)
+    defined(xdc_target__isaCompatible_arp32) || \
+    defined(xdc_target__isaCompatible_v7M)
 
     index = (obj->remoteVirtId * NotifyDriverMbx_NUM_CORES) + selfVirtId;
     REG32(MAILBOX_IRQENABLE_SET(index)) = MAILBOX_REG_VAL(SUBMBX_IDX(index));
 
-#elif defined(xdc_target__isaCompatible_v7M)
-
-//  if (!(BIOS_smpEnabled) && (Core_getId())) {
-//      if (remoteProcId == NotifyDriverMbx_hostProcId) {
-//          REG32(MAILBOX_IRQENABLE_SET_VPSS) = MAILBOX_REG_VAL(HOST_TO_VPSS);
-//      }
-//      else if (remoteProcId == NotifyDriverMbx_dspProcId) {
-//          REG32(MAILBOX_IRQENABLE_SET_VPSS) = MAILBOX_REG_VAL(DSP_TO_VPSS);
-//      }
-//      else {
-//          REG32(MAILBOX_IRQENABLE_SET_VPSS) = MAILBOX_REG_VAL(VIDEO_TO_VPSS);
-//      }
-//  }
-//  else {
-//      if (remoteProcId == NotifyDriverMbx_hostProcId) {
-//          REG32(MAILBOX_IRQENABLE_SET_VIDEO) = MAILBOX_REG_VAL(HOST_TO_VIDEO);
-//      }
-//      else if (remoteProcId == NotifyDriverMbx_dspProcId) {
-//          REG32(MAILBOX_IRQENABLE_SET_VIDEO) = MAILBOX_REG_VAL(DSP_TO_VIDEO);
-//      }
-//      else {
-//          REG32(MAILBOX_IRQENABLE_SET_VIDEO) = MAILBOX_REG_VAL(VPSS_TO_VIDEO);
-//      }
-//  }
-
 #elif defined(xdc_target__isaCompatible_v7A)
 
-//  if (remoteProcId == NotifyDriverMbx_dspProcId) {
-//      REG32(MAILBOX_IRQENABLE_SET_HOST) = MAILBOX_REG_VAL(DSP_TO_HOST);
-//  }
-//  else if (remoteProcId == NotifyDriverMbx_videoProcId) {
-//      REG32(MAILBOX_IRQENABLE_SET_HOST) = MAILBOX_REG_VAL(VIDEO_TO_HOST);
-//  }
-//  else {
-//      REG32(MAILBOX_IRQENABLE_SET_HOST) = MAILBOX_REG_VAL(VPSS_TO_HOST);
-//  }
+    /* TODO */
+    index = (obj->remoteVirtId * NotifyDriverMbx_NUM_CORES) + selfVirtId;
+    REG32(MAILBOX_IRQENABLE_SET(index)) = MAILBOX_REG_VAL(SUBMBX_IDX(index));
 
 #else
 #error Invalid target
@@ -593,39 +440,21 @@ Void NotifyDriverMbx_isr(UInt16 idx)
     UInt16 eventId;
 
 #if defined(xdc_target__isaCompatible_64P) || \
-    defined(xdc_target__isaCompatible_arp32)
+    defined(xdc_target__isaCompatible_arp32) || \
+    defined(xdc_target__isaCompatible_v7M)
 
     UInt16 srcVirtId;
 
     srcVirtId = idx / NotifyDriverMbx_NUM_CORES;
     MESSAGE_DELIVERY(idx)
 
-#elif defined(xdc_target__isaCompatible_v7M)
-
-//  do {
-//      numProcessed = 0;
-//      if (!(BIOS_smpEnabled) && (Core_getId())) {
-//          GET_NOTIFICATION(VPSS, HOST)
-//          GET_NOTIFICATION(VPSS, DSP)
-//          GET_NOTIFICATION(VPSS, VIDEO)
-//      }
-//      else {
-//          GET_NOTIFICATION(VIDEO, HOST)
-//          GET_NOTIFICATION(VIDEO, DSP)
-//          GET_NOTIFICATION(VIDEO, VPSS)
-//      }
-//  }
-//  while (numProcessed != 0);
-
 #elif defined(xdc_target__isaCompatible_v7A)
 
-//  do {
-//      numProcessed = 0;
-//      GET_NOTIFICATION(HOST, DSP)
-//      GET_NOTIFICATION(HOST, VPSS)
-//      GET_NOTIFICATION(HOST, VIDEO)
-//  }
-//  while (numProcessed != 0);
+    /* TODO */
+    UInt16 srcVirtId;
+
+    srcVirtId = idx / NotifyDriverMbx_NUM_CORES;
+    MESSAGE_DELIVERY(idx)
 
 #else
 #error Invalid target
index 3fe0be765c227cb05a3230416896b2a8bed296e7..1369dd9cbccc52c715a6020173badf1f067c4f80 100644 (file)
@@ -94,7 +94,6 @@ module NotifyDriverMbx inherits ti.sdo.ipc.interfaces.INotifyDriver
 
     /*!  @_nodoc */
     metaonly struct ModuleView {
-        UInt16                  interruptTable[NUM_CORES];
         NotifyDriverMbx.Handle  drvHandles[NUM_CORES];
     }
 
@@ -175,6 +174,7 @@ internal:
     config UInt32 mailboxTable[NUM_CORES * NUM_CORES];
 
     /* base address table for the mailbox subsystem */
+    /* TODO use the table in NotifySetup module */
     config UInt32 mailboxBaseAddr[NUM_EVE_MBX + NUM_SYS_MBX];
 
     /* map MultiProc ID to virtual ID, virtId = procIdTable[procId] */
@@ -206,12 +206,6 @@ internal:
     }
 
     struct Module_State {
-        /*  Interrupt event IDs used to communicate with this processor.
-         *  This table is indexed by virtual processor ID.
-         *  TODO: move this table to NotifySetup module
-         */
-        UInt16 interruptTable[NUM_CORES];
-
         /*  Used by the isr to retrieve the driver handle. This table is
          *  indexed by virtual processorID.
          */
index fd28c3514a52556c069096d6ded942da046a6cec..d6b0b6972ecf6ed1c510453db9288a72fb23e37f 100644 (file)
@@ -77,7 +77,7 @@ function module$use()
     /* Initialize mailboxTable */
     TableInit.generateTable(this);
 
-    if (isaChain.match(/#64P#|#v7M#|#v7A#/)) {
+    if (isaChain.match(/#64P#|#v7A#/)) {
         /* initialize mailbox base address table */
         this.mailboxBaseAddr[0]  = 0x4208B000;  /* EVE1 Internal Mailbox 0 */
         this.mailboxBaseAddr[1]  = 0x4208C000;  /* EVE1 Internal Mailbox 1 */
@@ -128,6 +128,76 @@ function module$use()
             this.mailboxBaseAddr[11] = 0x4008D000;
         }
     }
+    else if (isaChain.match(/#v7M#/)) {
+        /* initialize mailbox base address table */
+        if (this.mailboxBaseAddr[0] == undefined) {
+            this.mailboxBaseAddr[0]  = 0x6208B000;  /* EVE1 MBOX0 */
+        }
+        if (this.mailboxBaseAddr[1] == undefined) {
+            this.mailboxBaseAddr[1]  = 0x6208C000;  /* EVE1 MBOX1 */
+        }
+        if (this.mailboxBaseAddr[2] == undefined) {
+            this.mailboxBaseAddr[2]  = 0;           /* EVE1 MBOX2 */
+        } else {
+            this.$logWarning("NotifySetup.mailboxBaseAddr[2] is EVE1 MBOX2, "
+                    + "which is not used for IPU communication and should "
+                    + "not be configured.", this);
+        }
+        if (this.mailboxBaseAddr[3] == undefined) {
+            this.mailboxBaseAddr[3]  = 0x6218B000;  /* EVE2 MBOX0 */
+        }
+        if (this.mailboxBaseAddr[4] == undefined) {
+            this.mailboxBaseAddr[4]  = 0x6218C000;  /* EVE2 MBOX1 */
+        }
+        if (this.mailboxBaseAddr[5] == undefined) {
+            this.mailboxBaseAddr[5]  = 0;           /* EVE2 MBOX2 */
+        } else {
+            this.$logWarning("NotifySetup.mailboxBaseAddr[5] is EVE2 MBOX2, "
+                    + "which is not used for IPU communication and should "
+                    + "not be configured.", this);
+        }
+
+        if (this.mailboxBaseAddr[6] == undefined) {
+            this.mailboxBaseAddr[6]  = 0x6228B000;  /* EVE3 MBOX0 */
+        }
+        if (this.mailboxBaseAddr[7] == undefined) {
+            this.mailboxBaseAddr[7]  = 0x6228C000;  /* EVE3 MBOX1 */
+        }
+        if (this.mailboxBaseAddr[8] == undefined) {
+            this.mailboxBaseAddr[8]  = 0;           /* EVE3 MBOX2 */
+        } else {
+            this.$logWarning("NotifySetup.mailboxBaseAddr[8] is EVE3 MBOX2, "
+                    + "which is not used for IPU communication and should "
+                    + "not be configured.", this);
+        }
+
+        if (this.mailboxBaseAddr[9] == undefined) {
+            this.mailboxBaseAddr[9]  = 0x6238B000;  /* EVE4 MBOX0 */
+        }
+        if (this.mailboxBaseAddr[10] == undefined) {
+            this.mailboxBaseAddr[10]  = 0x6238C000; /* EVE4 MBOX1 */
+        }
+        if (this.mailboxBaseAddr[11] == undefined) {
+            this.mailboxBaseAddr[11]  = 0;          /* EVE4 MBOX2 */
+        } else {
+            this.$logWarning("NotifySetup.mailboxBaseAddr[11] is EVE4 MBOX2, "
+                    + "which is not used for IPU communication and should "
+                    + "not be configured.", this);
+        }
+
+        if (this.mailboxBaseAddr[12] == undefined) {
+            this.mailboxBaseAddr[12] = 0x68840000;  /* System Mailbox 5 */
+        }
+        if (this.mailboxBaseAddr[13] == undefined) {
+            this.mailboxBaseAddr[13] = 0x68842000;  /* System Mailbox 6 */
+        }
+        if (this.mailboxBaseAddr[14] == undefined) {
+            this.mailboxBaseAddr[14] = 0x68844000;  /* System Mailbox 7 */
+        }
+        if (this.mailboxBaseAddr[15] == undefined) {
+            this.mailboxBaseAddr[15] = 0x68846000;  /* System Mailbox 8 */
+        }
+    }
     else {
         throw("Invalid target: " + Program.build.target.$name);
     }
@@ -146,43 +216,10 @@ function module$static$init(state, mod)
     }
 
     if (isaChain.match(/#64P#/)) {
-        /* interrupt event IDs used by this processor */
-        state.interruptTable[0] = 55; /* EVE1 -> DSP1 or DSP2 */
-        state.interruptTable[1] = 56; /* EVE2 -> DSP1 or DSP2 */
-        state.interruptTable[2] = 58; /* EVE3 -> DSP1 or DSP2 */
-        state.interruptTable[3] = 59; /* EVE4 -> DSP1 or DSP2 */
-        state.interruptTable[4] = 60; /* DSP1 -> DSP2 */
-        state.interruptTable[5] = 60; /* DSP2 -> DSP1 */
-        state.interruptTable[8] = 57; /* HOST -> DSP1 or DSP2 */
-
-        /* these are not known at config time, set at runtime */
-        state.interruptTable[6] = 0; /* IPU1 -> DSP1 or DSP2 */
-        state.interruptTable[7] = 0; /* IPU2 -> DSP1 or DSP2 */
-        state.interruptTable[9] = 0; /* IPU1-1 -> DSP1 or DSP2 */
-        state.interruptTable[10] = 0; /* IPU2-1 -> DSP1 or DSP2 */
     }
     else if (isaChain.match(/#arp32#/)) {
-        /* interrupt event IDs used by this processor */
-        state.interruptTable[0] = 60; /* EVE1 - Group1/INTC1 */
-        state.interruptTable[1] = 60; /* EVE2 - Group1/INTC1 */
-        state.interruptTable[2] = 60; /* EVE3 - Group1/INTC1 */
-        state.interruptTable[3] = 60; /* EVE4 - Group1/INTC1 */
-        state.interruptTable[4] = 29; /* DSP1 - Group0/INTC0 */
-        state.interruptTable[5] = 30; /* DSP2 - Group0/INTC0 */
-        state.interruptTable[6] = 29; /* IPU1-0 */
-        state.interruptTable[7] = 30; /* IPU2-0 */
-        state.interruptTable[8] = 29; /* HOST */
-        state.interruptTable[9] = 30; /* IPU1-1 */
-        state.interruptTable[10] = 30; /* IPU2-1 */
     }
     else if (isaChain.match(/#v7M#/)) {
-        /* TODO */
-//      if (Core.id == 0) {
-//          Hwi.construct(state.hwi, 53, NotifyDriverMbx.isr);
-//      }
-//      else {
-//          Hwi.construct(state.hwi, 54, NotifyDriverMbx.isr);
-//      }
     }
     else if (isaChain.match(/#v7A#/)) {
         /* TODO */
index 408ebbdf1d434f4a8bdb74ab7c7bcc66a216fa96..b217f10cfdb703e7e7bec71c9350e79bef6fffbf 100644 (file)
 
 #elif defined(xdc_target__isaCompatible_v7M)
 
+#include <ti/sysbios/BIOS.h>
+#include <ti/sysbios/family/arm/ducati/Core.h>
 #include <ti/sysbios/family/arm/m3/Hwi.h>
+#include <ti/sysbios/family/shared/vayu/IntXbar.h>
 
 #elif defined(xdc_target__isaCompatible_v7A)
 
@@ -118,45 +121,60 @@ Int NotifySetup_Module_startup(Int phase)
     extern cregister volatile UInt DNUM;
 
     if (IntXbar_Module_startupDone()) {
+        /* connect mailbox interrupts at startup */
         if (DNUM == 0) {               /* DSP1 */
+            IntXbar_connect(24, 284);  // eve1 mailbox 0 user 1
+            IntXbar_connect(25, 293);  // eve2 mailbox 0 user 1
+            IntXbar_connect(26, 249);  // system mailbox 5 user 0
             NotifySetup_module->interruptTable[6] = 57; // IPU1-0
             NotifySetup_module->interruptTable[9] = 57; // IPU1-1
 
             /* plug eve3 and eve4 mbxs only if eve3 and eve4 exists */
             if ((MultiProc_getId("EVE3") != MultiProc_INVALIDID) ||
                 (MultiProc_getId("EVE4") != MultiProc_INVALIDID)) {
+                IntXbar_connect(27, 302);  // eve3 mailbox 0 user 1
+                IntXbar_connect(28, 311);  // eve4 mailbox 0 user 1
             }
 
             /* plug mbx7 only if DSP2 or IPU2 exists */
             if ((MultiProc_getId("DSP2") != MultiProc_INVALIDID) ||
                 (MultiProc_getId("IPU2") != MultiProc_INVALIDID) ||
                 (MultiProc_getId("IPU2-0") != MultiProc_INVALIDID)) {
+                IntXbar_connect(29, 257);  // system mailbox 7 user 0
                 NotifySetup_module->interruptTable[7] = 60; // IPU2-0
             }
 
             /* plug mbx8 only if IPU2-1 exists */
             if (MultiProc_getId("IPU2-1") != MultiProc_INVALIDID) {
+                IntXbar_connect(30, 261);  // system mailbox 8 user 0
                 NotifySetup_module->interruptTable[10] = 61; // IPU2-1
             }
         }
         else if (DNUM == 1) {          /* DSP2 */
+            IntXbar_connect(24, 287);  // eve1 mailbox 1 user 1
+            IntXbar_connect(25, 296);  // eve2 mailbox 1 user 1
+            IntXbar_connect(26, 253);  // system mailbox 6 user 0
             NotifySetup_module->interruptTable[7] = 57; // IPU2-0
             NotifySetup_module->interruptTable[10] = 57; // IPU2-1
 
             /* plug eve3 and eve4 mbxs only if eve3 and eve4 exists */
             if ((MultiProc_getId("EVE3") != MultiProc_INVALIDID) ||
                 (MultiProc_getId("EVE4") != MultiProc_INVALIDID)) {
+                IntXbar_connect(27, 305);  // eve3 mailbox 1 user 1
+                IntXbar_connect(28, 314);  // eve4 mailbox 1 user 1
             }
 
             /* plug mbx7 only if DSP1 or IPU1 exists */
             if ((MultiProc_getId("DSP1") != MultiProc_INVALIDID) ||
                 (MultiProc_getId("IPU1") != MultiProc_INVALIDID) ||
                 (MultiProc_getId("IPU1-0") != MultiProc_INVALIDID)) {
+                IntXbar_connect(29, 258);  // system mailbox 7 user 1
                 NotifySetup_module->interruptTable[6] = 60; // IPU1-0
             }
 
             /* plug mbx8 only if IPU1-1 exists */
             if (MultiProc_getId("IPU1-1") != MultiProc_INVALIDID) {
+                IntXbar_connect(30, 262);  // system mailbox 8 user 1
                 NotifySetup_module->interruptTable[9] = 61; // IPU1-1
             }
         }
@@ -172,7 +190,106 @@ Int NotifySetup_Module_startup(Int phase)
 
 #elif defined(xdc_target__isaCompatible_v7M)
 
-    /* TODO */
+    if (!IntXbar_Module_startupDone()) {
+        return (Startup_NOTDONE);
+    }
+
+    /* connect mailbox interrupts at startup */
+    if (Core_ipuId == 1) {
+        if ((BIOS_smpEnabled) || (Core_getId() == 0)) {
+            /* IPU1-0 */
+            IntXbar_connect(42, 285);  // eve1 mailbox 0 user 2
+            IntXbar_connect(43, 294);  // eve2 mailbox 0 user 2
+            IntXbar_connect(44, 250);  // system mailbox 5 user 1
+
+            /* plug eve3 and eve4 mbxs only if eve3 and eve4 exists */
+            if ((MultiProc_getId("EVE3") != MultiProc_INVALIDID) ||
+                (MultiProc_getId("EVE4") != MultiProc_INVALIDID)) {
+                IntXbar_connect(45, 303);  // eve3 mailbox 0 user 2
+                IntXbar_connect(46, 312);  // eve4 mailbox 0 user 2
+            }
+
+            /* plug mbx7 only if DSP2, IPU1-1, or IPU2 exists */
+            if ((MultiProc_getId("DSP2") != MultiProc_INVALIDID) ||
+                (MultiProc_getId("IPU1-1") != MultiProc_INVALIDID) ||
+                (MultiProc_getId("IPU2") != MultiProc_INVALIDID) ||
+                (MultiProc_getId("IPU2-0") != MultiProc_INVALIDID)) {
+                IntXbar_connect(47, 259);  // system mailbox 7 user 2
+            }
+
+            /* plug mbx8 only if IPU2-1 exists */
+            if (MultiProc_getId("IPU2-1") != MultiProc_INVALIDID) {
+                IntXbar_connect(48, 263);  // system mailbox 8 user 2
+            }
+        }
+        else { /* IPU1-1 */
+            IntXbar_connect(49, 289);  // eve1 mailbox 1 user 3
+            IntXbar_connect(50, 298);  // eve2 mailbox 1 user 3
+            IntXbar_connect(51, 252);  // system mailbox 5 user 3
+
+            /* plug eve3 and eve4 mbxs only if eve3 and eve4 exists */
+            if ((MultiProc_getId("EVE3") != MultiProc_INVALIDID) ||
+                (MultiProc_getId("EVE4") != MultiProc_INVALIDID)) {
+                IntXbar_connect(52, 307);  // eve3 mailbox 1 user 3
+                IntXbar_connect(53, 316);  // eve4 mailbox 1 user 3
+            }
+
+            /* plug mbx8 only if DSP2, IPU1-0, or IPU2 exists */
+            if ((MultiProc_getId("DSP2") != MultiProc_INVALIDID) ||
+                (MultiProc_getId("IPU1-0") != MultiProc_INVALIDID) ||
+                (MultiProc_getId("IPU2") != MultiProc_INVALIDID) ||
+                (MultiProc_getId("IPU2-0") != MultiProc_INVALIDID)) {
+                IntXbar_connect(54, 263);  // system mailbox 8 user 2
+            }
+        }
+    }
+    else {
+        if ((BIOS_smpEnabled) || (Core_getId() == 0)) {
+            /* IPU2-0 */
+            IntXbar_connect(42, 288);  // eve1 mailbox 1 user 2
+            IntXbar_connect(43, 297);  // eve2 mailbox 1 user 2
+            IntXbar_connect(44, 254);  // system mailbox 6 user 1
+
+            /* plug eve3 and eve4 mbxs only if eve3 and eve4 exists */
+            if ((MultiProc_getId("EVE3") != MultiProc_INVALIDID) ||
+                (MultiProc_getId("EVE4") != MultiProc_INVALIDID)) {
+                IntXbar_connect(45, 306);  // eve3 mailbox 1 user 2
+                IntXbar_connect(46, 315);  // eve4 mailbox 1 user 2
+            }
+
+            /* plug mbx7 only if DSP1 or IPU1 exists */
+            if ((MultiProc_getId("DSP1") != MultiProc_INVALIDID) ||
+                (MultiProc_getId("IPU1") != MultiProc_INVALIDID) ||
+                (MultiProc_getId("IPU1-0") != MultiProc_INVALIDID)) {
+                IntXbar_connect(47, 260);  // system mailbox 7 user 3
+            }
+
+            /* plug mbx8 only if IPU1-1 exists */
+            if (MultiProc_getId("IPU1-1") != MultiProc_INVALIDID) {
+                IntXbar_connect(48, 264);  // system mailbox 8 user 3
+            }
+        }
+        else { /* IPU2-1 */
+            IntXbar_connect(49, 289);  // eve1 mailbox 1 user 3
+            IntXbar_connect(50, 298);  // eve2 mailbox 1 user 3
+            IntXbar_connect(51, 256);  // system mailbox 6 user 3
+
+            /* plug eve3 and eve4 mbxs only if eve3 and eve4 exists */
+            if ((MultiProc_getId("EVE3") != MultiProc_INVALIDID) ||
+                (MultiProc_getId("EVE4") != MultiProc_INVALIDID)) {
+                IntXbar_connect(52, 307);  // eve3 mailbox 1 user 3
+                IntXbar_connect(53, 316);  // eve4 mailbox 1 user 3
+            }
+
+            /* plug mbx8 only if DSP2 or IPU2 exists */
+            if ((MultiProc_getId("DSP1") != MultiProc_INVALIDID) ||
+                (MultiProc_getId("IPU1") != MultiProc_INVALIDID) ||
+                (MultiProc_getId("IPU1-0") != MultiProc_INVALIDID)) {
+                IntXbar_connect(54, 264);  // system mailbox 8 user 3
+            }
+        }
+    }
+
     return (Startup_DONE);
 
 #elif defined(xdc_target__isaCompatible_v7A)
@@ -185,21 +302,29 @@ Int NotifySetup_Module_startup(Int phase)
 #endif
 }
 
-/*!
+/*
+ *  ======== NotifySetup_interruptTable ========
+ */
+UInt16 NotifySetup_interruptTable(Int srcVirtId)
+{
+    return (NotifySetup_module->interruptTable[srcVirtId]);
+}
+
+/*
  *  ======== NotifySetup_attach ========
  *  Create driver instance specified at config time.
  *
  *  This functions is generated by the NotifySetup.xdt template.
  */
 
-/*!
+/*
  *  ======== NotifySetup_sharedMemReq ========
  *  Compute how much shared memory is required by the driver.
  *
  *  This functions is generated by the NotifySetup.xdt template.
  */
 
-/*!
+/*
  * ======== NotifySetup_numIntLines ========
  * Return number of available interrupt lines to the current processor.
  */
@@ -228,7 +353,7 @@ NotifySetup_Driver NotifySetup_driverType(UInt16 remoteProcId)
         }
     }
 
-    return(driver);
+    return (driver);
 }
 
 /*
@@ -239,14 +364,20 @@ Void NotifySetup_plugHwi(UInt16 remoteProcId, Int cpuIntrNum,
 {
     Error_Block eb;
     UInt        key;
+#if !defined(xdc_target__isaCompatible_v7A)
     Hwi_Params  hwiParams;
-    UInt16      virtId;
-    Int         eventId;
+#endif
+    UInt16      srcVirtId;
 #if defined(xdc_target__isaCompatible_64P)
+    Int         eventId;
     UInt        combinedEventId;
 #elif defined(xdc_target__isaCompatible_arp32)
     UInt        mbxIdx;
+    Int         eventId;
     Bits16      mask;
+#elif defined(xdc_target__isaCompatible_v7M)
+    UInt16      idx;
+    UInt        mbxIdx;
 #endif
 
     Error_init(&eb);
@@ -255,15 +386,15 @@ Void NotifySetup_plugHwi(UInt16 remoteProcId, Int cpuIntrNum,
     key = Hwi_disable();
 
     /* map processor id to virtual id */
-    virtId = VIRTID(remoteProcId);
+    srcVirtId = VIRTID(remoteProcId);
 
     /* save driver isr in dispatch table */
-    NotifySetup_module->isrDispatchTable[virtId] = isr;
+    NotifySetup_module->isrDispatchTable[srcVirtId] = isr;
 
 #if defined(xdc_target__isaCompatible_64P)
 
     /* program the event dispatcher */
-    eventId = NotifySetup_module->interruptTable[virtId];
+    eventId = NotifySetup_module->interruptTable[srcVirtId];
     EventCombiner_dispatchPlug(eventId, NotifySetup_dispatchIsr, eventId, TRUE);
 
     /* make sure the interrupt is plugged only once */
@@ -277,8 +408,7 @@ Void NotifySetup_plugHwi(UInt16 remoteProcId, Int cpuIntrNum,
         hwiParams.arg = combinedEventId;
         hwiParams.enableInt = TRUE;
 
-        Hwi_create(cpuIntrNum,
-                &ti_sysbios_family_c64p_EventCombiner_dispatch,
+        Hwi_create(cpuIntrNum, &ti_sysbios_family_c64p_EventCombiner_dispatch,
                 &hwiParams, &eb);
         /* TODO: add error handling */
 
@@ -308,7 +438,7 @@ Void NotifySetup_plugHwi(UInt16 remoteProcId, Int cpuIntrNum,
     NotifySetup_module->numPlugged[mbxIdx]++;
 
     if (NotifySetup_module->numPlugged[mbxIdx] == 1) {
-        eventId = NotifySetup_module->interruptTable[virtId];
+        eventId = NotifySetup_module->interruptTable[srcVirtId];
 
         /* compute the hwi mask */
         mask = (1 << NotifySetup_eveIntVectId_INTC0)
@@ -324,12 +454,31 @@ Void NotifySetup_plugHwi(UInt16 remoteProcId, Int cpuIntrNum,
         Hwi_create(eventId, NotifySetup_dispatchIsr, &hwiParams, &eb);
         /* TODO: add error handling */
 
-        Hwi_enableInterrupt(NotifySetup_module->interruptTable[virtId]);
+        Hwi_enableInterrupt(NotifySetup_module->interruptTable[srcVirtId]);
     }
 
 #elif defined(xdc_target__isaCompatible_v7M)
 
-    /* TODO */
+    /* compute table index for given source and destination */
+    idx = (srcVirtId * NotifySetup_NUM_CORES) + MultiProc_self();
+
+    /* compute mailbox index */
+    mbxIdx = MBX_BASEADDR_IDX(idx);
+
+    /* make sure the interrupt is plugged only once */
+    NotifySetup_module->numPlugged[mbxIdx]++;
+
+    if (NotifySetup_module->numPlugged[mbxIdx] == 1) {
+
+        Hwi_Params_init(&hwiParams);
+        hwiParams.maskSetting = Hwi_MaskingOption_LOWER;
+        hwiParams.arg = cpuIntrNum;
+
+        Hwi_create(cpuIntrNum, NotifySetup_dispatchIsr, &hwiParams, &eb);
+        /* TODO: add error handling */
+
+        Hwi_enableInterrupt(cpuIntrNum);
+    }
 
 #elif defined(xdc_target__isaCompatible_v7A)
 
@@ -349,17 +498,28 @@ Void NotifySetup_plugHwi(UInt16 remoteProcId, Int cpuIntrNum,
 Void NotifySetup_unplugHwi(UInt16 remoteProcId, Int cpuIntrNum)
 {
     UInt        key;
+#if !defined(xdc_target__isaCompatible_v7A)
     Hwi_Handle  hwi;
+#endif
+    UInt16      srcVirtId;
 #if defined(xdc_target__isaCompatible_64P)
-    UInt16      virtId;
     Int         eventId;
 #elif defined(xdc_target__isaCompatible_arp32)
     UInt        mbxIdx;
+#elif defined(xdc_target__isaCompatible_v7M)
+    UInt16      idx;
+    UInt        mbxIdx;
 #endif
 
     /* disable global interrupts (TODO: should be a gated module) */
     key = Hwi_disable();
 
+    /* map processor id to virtual id */
+    srcVirtId = VIRTID(remoteProcId);
+
+    /* remove driver isr from dispatch table */
+    NotifySetup_module->isrDispatchTable[srcVirtId] = NULL;
+
 #if defined(xdc_target__isaCompatible_64P)
 
     /* unplug interrupt if last user */
@@ -371,8 +531,7 @@ Void NotifySetup_unplugHwi(UInt16 remoteProcId, Int cpuIntrNum)
     }
 
     /* unprogram the event dispatcher */
-    virtId = VIRTID(remoteProcId);
-    eventId = NotifySetup_module->interruptTable[virtId];
+    eventId = NotifySetup_module->interruptTable[srcVirtId];
     EventCombiner_disableEvent(eventId);
 
 #elif defined(xdc_target__isaCompatible_arp32)
@@ -404,7 +563,16 @@ Void NotifySetup_unplugHwi(UInt16 remoteProcId, Int cpuIntrNum)
 
 #elif defined(xdc_target__isaCompatible_v7M)
 
-    /* TODO */
+    /* decrement plug count */
+    idx = (srcVirtId * NotifySetup_NUM_CORES) + MultiProc_self();
+    mbxIdx = MBX_BASEADDR_IDX(idx);
+    NotifySetup_module->numPlugged[mbxIdx]--;
+
+    /* unplug interrupt if last user */
+    if (NotifySetup_module->numPlugged[0] == 0) {
+        hwi = Hwi_getHandle(cpuIntrNum);
+        Hwi_delete(&hwi);
+    }
 
 #elif defined(xdc_target__isaCompatible_v7A)
 
@@ -500,6 +668,7 @@ Int NotifySetup_Mbx_attach(UInt16 remoteProcId, Ptr sharedAddr)
     NotifyDriverMbx_Params params;
     NotifyDriverMbx_Handle driver;
     ti_sdo_ipc_Notify_Handle notify;
+    UInt16 virtId;
     Error_Block eb;
 
     Error_init(&eb);
@@ -527,11 +696,22 @@ Int NotifySetup_Mbx_attach(UInt16 remoteProcId, Ptr sharedAddr)
         }
     }
 
+    /* set the intVectorId if on the IPU */
+    if ((MultiProc_self() == NotifySetup_ipu1_0ProcId) ||
+        (MultiProc_self() == NotifySetup_ipu1_1ProcId) ||
+        (MultiProc_self() == NotifySetup_ipu2_0ProcId) ||
+        (MultiProc_self() == NotifySetup_ipu2_1ProcId)) {
+
+        /* map processor id to virtual id */
+        virtId = VIRTID(remoteProcId);
+        params.intVectorId = NotifySetup_module->interruptTable[virtId];
+    }
+
     /* create the notify driver instance */
     driver = NotifyDriverMbx_create(&params, &eb);
 
     if (driver == NULL) {
-        return(Notify_E_FAIL);
+        return (Notify_E_FAIL);
     }
 
     /* create the front-end notify instance */
@@ -543,7 +723,7 @@ Int NotifySetup_Mbx_attach(UInt16 remoteProcId, Ptr sharedAddr)
         status = Notify_E_FAIL;
     }
 
-    return(status);
+    return (status);
 }
 
 /*!
@@ -564,7 +744,15 @@ SizeT NotifySetup_Mbx_sharedMemReq(UInt16 remoteProcId, Ptr sharedAddr)
 
 /*
  *  ======== NotifySetup_dispatchIsr ========
- *  arg = eventId
+ *  Dispatch the current interrupt to the appropriate notify driver
+ *
+ *  The given interrupt may be shared by multiple notify drivers. This
+ *  ISR inspects the mailbox which raised the interrupt and looks for
+ *  all FIFOs which have data and raise the given interrupt. For each
+ *  one, the interrupt is dispatched to the registered driver for that
+ *  FIFO.
+ *
+ *  @param(arg) The eventId which raised the interrupt.
  */
 Void NotifySetup_dispatchIsr(UArg arg)
 {
index 6a51ee53a0fb6641ef5f20698494e526fc837368..f84be49f4534a0b6de0b418575fb4ba77fc9f76c 100644 (file)
@@ -101,8 +101,14 @@ module NotifySetup inherits ti.sdo.ipc.interfaces.INotifySetup
      *  ======== plugHwi ========
      *  Register an isr for the given interrupt and event.
      *
-     *  The given interrupt number must be the same for all calls
-     *  because all IPC events should be taken by the same interrupt.
+     *  @param(remoteProcId) The MutiProc Id of the remote processor
+     *  which will raise the given interrupt.
+     *
+     *  @param(cpuIntrNum) The interrupt number which will be raised
+     *  by the remote processor.
+     *
+     *  @param(isr) The ISR which should be invoked to service the
+     *  given interrupt.
      */
     Void plugHwi(UInt16 remoteProcId, Int cpuIntrNum, DriverIsr isr);
 
@@ -112,6 +118,12 @@ module NotifySetup inherits ti.sdo.ipc.interfaces.INotifySetup
      */
     Void unplugHwi(UInt16 remoteProcId, Int cpuIntrNum);
 
+    /*! @_nodoc
+     *  ======== interruptTable ========
+     *  Accessor method to return interrupt id for given virtual proc id
+     */
+    UInt16 interruptTable(Int srcVirtId);
+
 internal:
     /* total number of cores on Vayu SoC */
     const UInt8 NUM_CORES = 11;
@@ -140,9 +152,9 @@ internal:
     config UInt eve4ProcId = MultiProc.INVALIDID;
     config UInt dsp1ProcId = MultiProc.INVALIDID;
     config UInt dsp2ProcId = MultiProc.INVALIDID;
-    config UInt ipu1_0ProcId = MultiProc.INVALIDID;
+    config UInt ipu1_0ProcId = MultiProc.INVALIDID;  /* also used for ipu1 */
     config UInt ipu1_1ProcId = MultiProc.INVALIDID;
-    config UInt ipu2_0ProcId = MultiProc.INVALIDID;
+    config UInt ipu2_0ProcId = MultiProc.INVALIDID;  /* also used for ipu2 */
     config UInt ipu2_1ProcId = MultiProc.INVALIDID;
     config UInt hostProcId = MultiProc.INVALIDID;
 
index 51199528a3dc65d8cc9a89413d109aacd32c79f7..9f2426a5e176ca098c4b9cd0462cf4b77e2dbf83 100644 (file)
@@ -37,6 +37,29 @@ var MultiProc = null;
 var Core = null;
 var isaChain = "";
 
+/*
+ *  ======== isMbxDrv ========
+ */
+function isMbxDrv(mod, name)
+{
+    if (mod.connections == undefined) {
+        return (false);
+    }
+
+    for (var i = 0; i < mod.connections.length; i++) {
+        if (mod.connections[i].procName == name) {
+            if (mod.connections[i].driver == mod.Driver_MAILBOX) {
+                return (true);
+            }
+            else {
+                return (false);
+            }
+        }
+    }
+
+    return (false);
+}
+
 /*
  *  ======== module$use ========
  */
@@ -73,7 +96,7 @@ function module$use()
     /* initialize mailboxTable */
     TableInit.generateTable(this);
 
-    if (isaChain.match(/#64P#|#v7M#|#v7A#/)) {
+    if (isaChain.match(/#64P#|#v7A#/)) {
         /* initialize mailbox base address table */
         this.mailboxBaseAddr[0]  = 0x4208B000;  /* EVE1 Internal Mailbox 0 */
         this.mailboxBaseAddr[1]  = 0x4208C000;  /* EVE1 Internal Mailbox 1 */
@@ -124,6 +147,76 @@ function module$use()
             this.mailboxBaseAddr[11] = 0x4008D000;
         }
     }
+    else if (isaChain.match(/#v7M#/)) {
+        /* initialize mailbox base address table */
+        if (this.mailboxBaseAddr[0] == undefined) {
+            this.mailboxBaseAddr[0]  = 0x6208B000;  /* EVE1 MBOX0 */
+        }
+        if (this.mailboxBaseAddr[1] == undefined) {
+            this.mailboxBaseAddr[1]  = 0x6208C000;  /* EVE1 MBOX1 */
+        }
+        if (this.mailboxBaseAddr[2] == undefined) {
+            this.mailboxBaseAddr[2]  = 0;           /* EVE1 MBOX2 */
+        } else {
+            this.$logWarning("NotifySetup.mailboxBaseAddr[2] is EVE1 MBOX2, "
+                    + "which is not used for IPU communication and should "
+                    + "not be configured.", this);
+        }
+        if (this.mailboxBaseAddr[3] == undefined) {
+            this.mailboxBaseAddr[3]  = 0x6218B000;  /* EVE2 MBOX0 */
+        }
+        if (this.mailboxBaseAddr[4] == undefined) {
+            this.mailboxBaseAddr[4]  = 0x6218C000;  /* EVE2 MBOX1 */
+        }
+        if (this.mailboxBaseAddr[5] == undefined) {
+            this.mailboxBaseAddr[5]  = 0;           /* EVE2 MBOX2 */
+        } else {
+            this.$logWarning("NotifySetup.mailboxBaseAddr[5] is EVE2 MBOX2, "
+                    + "which is not used for IPU communication and should "
+                    + "not be configured.", this);
+        }
+
+        if (this.mailboxBaseAddr[6] == undefined) {
+            this.mailboxBaseAddr[6]  = 0x6228B000;  /* EVE3 MBOX0 */
+        }
+        if (this.mailboxBaseAddr[7] == undefined) {
+            this.mailboxBaseAddr[7]  = 0x6228C000;  /* EVE3 MBOX1 */
+        }
+        if (this.mailboxBaseAddr[8] == undefined) {
+            this.mailboxBaseAddr[8]  = 0;           /* EVE3 MBOX2 */
+        } else {
+            this.$logWarning("NotifySetup.mailboxBaseAddr[8] is EVE3 MBOX2, "
+                    + "which is not used for IPU communication and should "
+                    + "not be configured.", this);
+        }
+
+        if (this.mailboxBaseAddr[9] == undefined) {
+            this.mailboxBaseAddr[9]  = 0x6238B000;  /* EVE4 MBOX0 */
+        }
+        if (this.mailboxBaseAddr[10] == undefined) {
+            this.mailboxBaseAddr[10]  = 0x6238C000; /* EVE4 MBOX1 */
+        }
+        if (this.mailboxBaseAddr[11] == undefined) {
+            this.mailboxBaseAddr[11]  = 0;          /* EVE4 MBOX2 */
+        } else {
+            this.$logWarning("NotifySetup.mailboxBaseAddr[11] is EVE4 MBOX2, "
+                    + "which is not used for IPU communication and should "
+                    + "not be configured.", this);
+        }
+
+        if (this.mailboxBaseAddr[12] == undefined) {
+            this.mailboxBaseAddr[12] = 0x68840000;  /* System Mailbox 5 */
+        }
+        if (this.mailboxBaseAddr[13] == undefined) {
+            this.mailboxBaseAddr[13] = 0x68842000;  /* System Mailbox 6 */
+        }
+        if (this.mailboxBaseAddr[14] == undefined) {
+            this.mailboxBaseAddr[14] = 0x68844000;  /* System Mailbox 7 */
+        }
+        if (this.mailboxBaseAddr[15] == undefined) {
+            this.mailboxBaseAddr[15] = 0x68846000;  /* System Mailbox 8 */
+        }
+    }
     else {
         throw("Invalid target: " + Program.build.target.$name);
     }
@@ -163,8 +256,8 @@ function module$static$init(state, mod)
 {
     var procId;
 
-    /* Initialize the state connAry from the config params. Translate
-     * processor names into IDs for better runtime performance.
+    /*  Initialize the state connAry from the config params. Translate
+     *  processor names into IDs for better runtime performance.
      */
     state.connAry.length = mod.connections.length;
 
@@ -176,6 +269,9 @@ function module$static$init(state, mod)
 
     if (isaChain.match(/#64P#/)) {
         state.numPlugged.length = 1;
+        for (var i = 0; i < state.numPlugged.length; i++) {
+            state.numPlugged[i] = 0;
+        }
 
         /* interrupt event IDs used by this processor */
         state.interruptTable[0] = 55; /* EVE1 -> DSP1 or DSP2 */
@@ -194,6 +290,9 @@ function module$static$init(state, mod)
     }
     else if (isaChain.match(/#arp32#/)) {
         state.numPlugged.length = this.NUM_EVE_MBX / this.NUM_EVES;
+        for (var i = 0; i < state.numPlugged.length; i++) {
+            state.numPlugged[i] = 0;
+        }
 
         /* interrupt event IDs used by this processor */
         state.interruptTable[0] = 60; /* EVE1 - Group1/INTC1 */
@@ -209,19 +308,64 @@ function module$static$init(state, mod)
         state.interruptTable[10] = 30; /* IPU2-1 */
     }
     else if (isaChain.match(/#v7M#/)) {
-        state.numPlugged.length = 1;
+        state.numPlugged.length = mod.NUM_EVE_MBX + mod.NUM_SYS_MBX;
+        for (var i = 0; i < state.numPlugged.length; i++) {
+            state.numPlugged[i] = 0;
+        }
 
-        /* TODO */
-//      if (Core.id == 0) {
-//          Hwi.construct(state.hwi, 53, NotifyDriverMbx.isr);
-//      }
-//      else {
-//          Hwi.construct(state.hwi, 54, NotifyDriverMbx.isr);
-//      }
+        if (Core.id == 0) {
+            /* interrupt event IDs used by this processor */
+            state.interruptTable[0] = 64; /* EVE1 */
+            state.interruptTable[1] = 65; /* EVE2 */
+            state.interruptTable[2] = 67; /* EVE3 */
+            state.interruptTable[3] = 68; /* EVE4 */
 
-        /* interrupt event IDs used by this processor */
-        for (var i = 0; i < state.interruptTable.length; i++) {
-            state.interruptTable[i] = 0xFFFF; /* TODO */
+            if (Core.ipuId == 1) { /* IPU1-0 */
+                state.interruptTable[4] = 66;  /* DSP1 */
+                state.interruptTable[5] = 69;  /* DSP2 */
+                state.interruptTable[6] = 0;   /* IPU1-0 */
+                state.interruptTable[7] = 69;  /* Ipu2-0 */
+                state.interruptTable[8] = 66;  /* HOST */
+                var mbxDrv = isMbxDrv(mod, "IPU1-1");
+                state.interruptTable[9] = mbxDrv ? 69 : 19;  /* IPU1-1 */
+                state.interruptTable[10] = 70; /* Ipu2-1 */
+            }
+            else { /* IPU2-0 */
+                state.interruptTable[4] = 69;  /* DSP1 */
+                state.interruptTable[5] = 66;  /* DSP2 */
+                state.interruptTable[6] = 69;  /* IPU1-0 */
+                state.interruptTable[7] = 0;   /* Ipu2-0 */
+                state.interruptTable[8] = 66;  /* HOST */
+                state.interruptTable[9] = 70;  /* IPU1-1 */
+                state.interruptTable[10] = 19; /* Ipu2-1 */
+            }
+        }
+        else {
+            /* interrupt event IDs used by this processor */
+            state.interruptTable[0] = 71; /* EVE1 */
+            state.interruptTable[1] = 72; /* EVE2 */
+            state.interruptTable[2] = 74; /* EVE3 */
+            state.interruptTable[3] = 75; /* EVE4 */
+
+            if (Core.ipuId == 1) { /* IPU1-1 */
+                state.interruptTable[4] = 73;  /* DSP1 */
+                state.interruptTable[5] = 76;  /* DSP2 */
+                var mbxDrv = isMbxDrv(mod, "IPU1-0");
+                state.interruptTable[6] = mbxDrv ? 76 : 19;  /* IPU1-0 */
+                state.interruptTable[7] = 76;  /* Ipu2-0 */
+                state.interruptTable[8] = 73;  /* HOST */
+                state.interruptTable[9] = 0;   /* IPU1-1 */
+                state.interruptTable[10] = 0;  /* Ipu2-1 */
+            }
+            else { /* IPU2-1 */
+                state.interruptTable[4] = 76;  /* DSP1 */
+                state.interruptTable[5] = 73;  /* DSP2 */
+                state.interruptTable[6] = 76;  /* IPU1-0 */
+                state.interruptTable[7] = 19;  /* Ipu2-0 */
+                state.interruptTable[8] = 73;  /* HOST */
+                state.interruptTable[9] = 0;   /* IPU1-1 */
+                state.interruptTable[10] = 0;  /* Ipu2-1 */
+            }
         }
     }
     else if (isaChain.match(/#v7A#/)) {
index 2021fcf4aaac2882e8c30b8600c1582d04143475..57d0e6855f89e0c0ab63871d6106596f53ecc540 100644 (file)
@@ -155,6 +155,7 @@ function generateTable(InterruptCore)
     var SYS_MBX8_OFFSET = 3;
     var eveMbx2BaseIdx = 2;
 
+    var index;
     var subMbxIdx;
     var tableEntry;
     var mbxUserIdx;
@@ -185,8 +186,10 @@ function generateTable(InterruptCore)
      */
     for (var i = 0; i < InterruptCore.NUM_CORES; i++) {
         for (var j = 0; j < InterruptCore.NUM_CORES; j++) {
+
             /* init mailboxTable */
-            InterruptCore.mailboxTable[i*InterruptCore.NUM_CORES + j] = -1;
+            index = (i * InterruptCore.NUM_CORES) + j;
+            InterruptCore.mailboxTable[index] = -1;
 
             /* EVE Internal Mailbox 2 */
             if ((i < InterruptCore.NUM_EVES) && (j < InterruptCore.NUM_EVES)) {
@@ -194,15 +197,14 @@ function generateTable(InterruptCore)
                 /* Generate 3 masks forming a single table entry */
                 mbxBaseAddrIdx = ((j * 3) + eveMbx2BaseIdx) << 16;
 
-                /*
-                 * Determined based on the send remote receive local
+                /* Determined based on the send remote receive local
                  * methodology being followed for EVE-to-EVE communication.
                  */
                 mbxUserIdx = 0 << 8;
                 subMbxIdx = i;
 
                 tableEntry = mbxBaseAddrIdx | mbxUserIdx | subMbxIdx;
-                InterruptCore.mailboxTable[i*InterruptCore.NUM_CORES + j] = tableEntry;
+                InterruptCore.mailboxTable[index] = tableEntry;
                 continue;
             }
 
@@ -233,7 +235,7 @@ function generateTable(InterruptCore)
                     }
 
                     tableEntry = mbxBaseAddrIdx | mbxUserIdx | subMbxIdx;
-                    InterruptCore.mailboxTable[i*InterruptCore.NUM_CORES + j] = tableEntry;
+                    InterruptCore.mailboxTable[index] = tableEntry;
                     continue;
                 }
                 else if (j < InterruptCore.NUM_EVES) {
@@ -259,7 +261,7 @@ function generateTable(InterruptCore)
                     }
 
                     tableEntry = mbxBaseAddrIdx | mbxUserIdx | subMbxIdx;
-                    InterruptCore.mailboxTable[i*InterruptCore.NUM_CORES + j] = tableEntry;
+                    InterruptCore.mailboxTable[index] = tableEntry;
                     continue;
                 }
             }
@@ -270,10 +272,11 @@ function generateTable(InterruptCore)
                 (i == hostVirtId) || (i == ipu1_1VirtId)) &&
                 ((j == dsp1VirtId) || (j == ipu1_0VirtId) ||
                 (j == hostVirtId) || (j == ipu1_1VirtId))) {
+
                 mbxBaseAddrIdx = ((InterruptCore.NUM_EVES * 3) +
                                   SYS_MBX5_OFFSET) << 16;
 
-                /* These combinations does not need mailbox */
+                /* These combinations do not need mailbox */
                 if ((i == j) ||
                     (i == ipu1_0VirtId && j == ipu1_1VirtId) ||
                     (i == ipu1_1VirtId && j == ipu1_0VirtId)) {
@@ -324,7 +327,7 @@ function generateTable(InterruptCore)
                 }
 
                 tableEntry = mbxBaseAddrIdx | mbxUserIdx | subMbxIdx;
-                InterruptCore.mailboxTable[i*InterruptCore.NUM_CORES + j] = tableEntry;
+                InterruptCore.mailboxTable[index] = tableEntry;
                 continue;
             }
 
@@ -334,10 +337,11 @@ function generateTable(InterruptCore)
                 (i == hostVirtId) || (i == ipu2_1VirtId)) &&
                 ((j == dsp2VirtId) || (j == ipu2_0VirtId) ||
                 (j == hostVirtId) || (j ==ipu2_1VirtId))) {
+
                 mbxBaseAddrIdx = ((InterruptCore.NUM_EVES * 3) +
                                    SYS_MBX6_OFFSET) << 16;
 
-                /* These combinations does not need mailbox */
+                /* These combinations do not need mailbox */
                 if ((i == j) ||
                     (i == ipu2_0VirtId && j == ipu2_1VirtId) ||
                     (i == ipu2_1VirtId && j == ipu2_0VirtId)) {
@@ -388,12 +392,11 @@ function generateTable(InterruptCore)
                 }
 
                 tableEntry = mbxBaseAddrIdx | mbxUserIdx | subMbxIdx;
-                InterruptCore.mailboxTable[i*InterruptCore.NUM_CORES + j] = tableEntry;
+                InterruptCore.mailboxTable[index] = tableEntry;
                 continue;
             }
 
-            /*
-             *  System Mailbox 7
+            /*  System Mailbox 7
              *  This is for communication between DSP1/IPU1_0<->DSP2/IPU2-0
              *  but not DSP1<->IPU1-0 or DSP<->IPU2-0. Those communication
              *  lines have already been established above.
@@ -453,12 +456,11 @@ function generateTable(InterruptCore)
                 }
 
                 tableEntry = mbxBaseAddrIdx | mbxUserIdx | subMbxIdx;
-                InterruptCore.mailboxTable[i*InterruptCore.NUM_CORES + j] = tableEntry;
+                InterruptCore.mailboxTable[index] = tableEntry;
             }
 
-            /*
-             *  System Mailbox 8
-             *  This only required only if one of the IPU is running
+            /*  System Mailbox 8
+             *  This is required only if one of the IPU is running
              *  NON-SMP BIOS. This is for the second core of
              *  IPU1-1<->DSP2/IPU2 or second core of IPU2-1<->DSP1/IPU1.
              */
@@ -472,8 +474,6 @@ function generateTable(InterruptCore)
                 mbxBaseAddrIdx = ((InterruptCore.NUM_EVES * 3) +
                                   SYS_MBX8_OFFSET) << 16;
 
-                //print("i= " + i + " j= " + j);
-
                 /* Don't set any previously established lines */
                 if (i == j) {
                     continue;
@@ -556,8 +556,15 @@ function generateTable(InterruptCore)
                 }
 
                 tableEntry = mbxBaseAddrIdx | mbxUserIdx | subMbxIdx;
-                InterruptCore.mailboxTable[i*InterruptCore.NUM_CORES + j] = tableEntry;
+                InterruptCore.mailboxTable[index] = tableEntry;
             }
         }
     }
+
+    /* added mailbox for NotifyDriverMbx support */
+    index = (ipu1_0VirtId * InterruptCore.NUM_CORES) + ipu1_1VirtId;
+    InterruptCore.mailboxTable[index] = 15 << 16 | 2 << 8 | 4;
+
+    index = (ipu1_1VirtId * InterruptCore.NUM_CORES) + ipu1_0VirtId;
+    InterruptCore.mailboxTable[index] = 14 << 16 | 2 << 8 | 8;
 }
index 6e9ef788a6c969428b9cb1de96c2f5049b2dd030..e9102df3a4665429ef691bf620d2e339a099be59 100644 (file)
@@ -37,6 +37,11 @@ requires ti.sdo.ipc;
 
 /*!
  *  ======== ti.sdo.ipc.family.vayu ========
+ *  Device specific modules for Vayu
+ *
+ *  Low-level modules which interact directly with the device are
+ *  grouped into family packages. This package handles the Vayu
+ *  class of devices (DRA7xx, TDA2xx, OMAP57xx).
  */
 package ti.sdo.ipc.family.vayu [1,0,1] {
     module    TableInit;