1 /*
2 * Copyright (c) 2012-2013, Texas Instruments Incorporated
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * * Neither the name of Texas Instruments Incorporated nor the names of
17 * its contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32 /*
33 * ======== Interrupt.xs ========
34 */
36 var deviceSettings = {
37 /* all TCI663x devices inherit from TCI6634 according to Settings.xs */
38 'TMS320TCI6634' : {
39 IPCGR0: 0x02620240,
40 IPCAR0: 0x02620280,
41 INTERDSPINT: 105,
42 },
43 }
44 var Settings = xdc.loadCapsule('ti/sdo/ipc/family/Settings.xs');
45 Settings.setDeviceAliases(deviceSettings, Settings.deviceAliases);
47 var Hwi;
48 var Interrupt;
49 var Ipc;
50 var MultiProc;
51 var SharedRegion;
52 var MultiProcSetup;
54 /*
55 * ======== module$meta$init ========
56 */
57 function module$meta$init()
58 {
59 /* Only process during "cfg" phase */
60 if (xdc.om.$name != "cfg") {
61 return;
62 }
64 var settings = deviceSettings[Program.cpu.deviceName];
66 this.IPCGR0 = settings.IPCGR0;
67 this.IPCAR0 = settings.IPCAR0;
68 this.INTERDSPINT = settings.INTERDSPINT;
69 }
72 /*
73 * ======== module$use ========
74 */
75 function module$use()
76 {
77 Interrupt = this;
78 Hwi = xdc.useModule("ti.sysbios.family.c64p.Hwi");
79 Ipc = xdc.useModule("ti.sdo.ipc.Ipc");
80 MultiProc = xdc.useModule("ti.sdo.utils.MultiProc");
81 SharedRegion = xdc.useModule("ti.sdo.ipc.SharedRegion");
82 MultiProcSetup = xdc.useModule("ti.sdo.ipc.family.tci663x.MultiProcSetup");
83 }
85 /*
86 * ======== module$static$init ========
87 */
88 function module$static$init(mod, params)
89 {
90 var args = Interrupt.$object.args;
91 var MultiProc = xdc.module('ti.sdo.utils.MultiProc');
93 /* The function table length should be the number of processors */
94 args.length = MultiProc.numProcessors;
95 for (var i = 0; i < args.length; i++) {
96 args[i] = 0;
97 }
99 mod.func = null;
100 mod.numPlugged = 0;
101 }
103 /*
104 *************************************************************************
105 * ROV View functions
106 *************************************************************************
107 */
109 /*
110 * ======== viewInterruptsData ========
111 * Module data view
112 */
113 function viewInterruptsData(view)
114 {
115 var Interrupt = xdc.useModule('ti.sdo.ipc.family.tci663x.Interrupt');
116 var ScalarStructs = xdc.useModule('xdc.rov.support.ScalarStructs');
117 var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
119 /* Retrieve the module state. */
120 var rawView = Program.scanRawView('ti.sdo.ipc.family.tci663x.Interrupt');
121 var mod = rawView.modState;
122 /* Retrieve the module configuration. */
123 var modCfg = Program.getModuleConfig('ti.sdo.ipc.family.tci663x.Interrupt');
124 var MultiProcCfg = Program.getModuleConfig('ti.sdo.utils.MultiProc');
126 var args = Program.fetchArray(Interrupt.args$fetchDesc,
127 mod.args,
128 MultiProcCfg.numProcessors);
130 var localId = MultiProc.self$view();
132 if (localId != MultiProc.INVALIDID) {
133 var ipcar0 = Program.fetchArray(ScalarStructs.S_Bits32$fetchDesc,
134 $addr(modCfg.IPCAR0), MultiProcCfg.numProcessors, false);
135 }
137 for (var i = 0; i < MultiProcCfg.numProcessors; i++) {
138 var entryView =
139 Program.newViewStruct('ti.sdo.ipc.family.tci663x.Interrupt',
140 'Registered Interrupts');
141 entryView.remoteCoreId = i;
142 if (Number(mod.func) != 0) {
143 entryView.isrFxn =
144 Program.lookupFuncName(Number(mod.func))[0];
145 entryView.isrArg = "0x" + Number(args[i]).toString(16);
146 }
147 else {
148 entryView.isrFxn = "(unplugged)";
149 entryView.isrArg = "";
150 }
152 if (localId != MultiProc.INVALIDID) {
153 var enableFlag = ipcar0[localId].elem;
155 if (enableFlag & (1 << (i + Interrupt.SRCSx_SHIFT))) {
156 entryView.isFlagged = true;
157 }
158 else {
159 entryView.isFlagged = false;
160 }
161 }
164 view.elements.$add(entryView);
165 }
166 }