e28954cd03ec3db80c97f7f3d25cf1534df933ab
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 'TMS320C6472' : {
38 IPCGR0: 0x02A80540,
39 IPCAR0: 0x02A80580,
40 KICK0: 0,
41 KICK1: 0,
42 INTERDSPINT: 84,
43 },
44 'TMS320C6474' : {
45 IPCGR0: 0x02880900,
46 IPCAR0: 0x02880940,
47 KICK0: 0,
48 KICK1: 0,
49 INTERDSPINT: 76,
50 },
51 'TMS320C6670' : {
52 IPCGR0: 0x02620240,
53 IPCAR0: 0x02620280,
54 KICK0: 0x02620038,
55 KICK1: 0x0262003C,
56 INTERDSPINT: 90,
57 },
58 'TMS320C6678' : {
59 IPCGR0: 0x02620240,
60 IPCAR0: 0x02620280,
61 KICK0: 0x02620038,
62 KICK1: 0x0262003C,
63 INTERDSPINT: 91,
64 },
65 'Kepler' : {
66 IPCGR0: 0x02620240,
67 IPCAR0: 0x02620280,
68 KICK0: 0x02620038,
69 KICK1: 0x0262003C,
70 INTERDSPINT: 90,
71 },
72 }
73 var Settings = xdc.loadCapsule('ti/sdo/ipc/family/Settings.xs');
74 Settings.setDeviceAliases(deviceSettings, Settings.deviceAliases);
76 var Hwi;
77 var Interrupt;
78 var Ipc;
79 var MultiProc;
80 var SharedRegion;
81 var MultiProcSetup;
83 /*
84 * ======== module$meta$init ========
85 */
86 function module$meta$init()
87 {
88 /* Only process during "cfg" phase */
89 if (xdc.om.$name != "cfg") {
90 return;
91 }
93 var settings = deviceSettings[Program.cpu.deviceName];
95 this.IPCGR0 = settings.IPCGR0;
96 this.IPCAR0 = settings.IPCAR0;
97 this.KICK0 = settings.KICK0;
98 this.KICK1 = settings.KICK1;
99 this.INTERDSPINT = settings.INTERDSPINT;
100 }
103 /*
104 * ======== module$use ========
105 */
106 function module$use()
107 {
108 Interrupt = this;
109 Hwi = xdc.useModule("ti.sysbios.family.c64p.Hwi");
110 Ipc = xdc.useModule("ti.sdo.ipc.Ipc");
111 MultiProc = xdc.useModule("ti.sdo.utils.MultiProc");
112 SharedRegion = xdc.useModule("ti.sdo.ipc.SharedRegion");
113 MultiProcSetup = xdc.useModule("ti.sdo.ipc.family.c647x.MultiProcSetup");
114 }
116 /*
117 * ======== module$static$init ========
118 */
119 function module$static$init(mod, params)
120 {
121 var args = Interrupt.$object.args;
122 var MultiProc = xdc.module('ti.sdo.utils.MultiProc');
124 /* The function table length should be the number of processors */
125 args.length = MultiProc.numProcessors;
126 for (var i = 0; i < args.length; i++) {
127 args[i] = 0;
128 }
130 mod.func = null;
131 mod.numPlugged = 0;
132 }
134 /*
135 *************************************************************************
136 * ROV View functions
137 *************************************************************************
138 */
140 /*
141 * ======== viewInterruptsData ========
142 * Module data view
143 */
144 function viewInterruptsData(view)
145 {
146 var Interrupt = xdc.useModule('ti.sdo.ipc.family.c647x.Interrupt');
147 var ScalarStructs = xdc.useModule('xdc.rov.support.ScalarStructs');
148 var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
150 /* Retrieve the module state. */
151 var rawView = Program.scanRawView('ti.sdo.ipc.family.c647x.Interrupt');
152 var mod = rawView.modState;
153 /* Retrieve the module configuration. */
154 var modCfg = Program.getModuleConfig('ti.sdo.ipc.family.c647x.Interrupt');
155 var MultiProcCfg = Program.getModuleConfig('ti.sdo.utils.MultiProc');
157 var args = Program.fetchArray(Interrupt.args$fetchDesc,
158 mod.args,
159 MultiProcCfg.numProcessors);
161 var localId = MultiProc.self$view();
163 if (localId != MultiProc.INVALIDID) {
164 var ipcar0 = Program.fetchArray(ScalarStructs.S_Bits32$fetchDesc,
165 $addr(modCfg.IPCAR0), MultiProcCfg.numProcessors, false);
166 }
168 for (var i = 0; i < MultiProcCfg.numProcessors; i++) {
169 var entryView =
170 Program.newViewStruct('ti.sdo.ipc.family.c647x.Interrupt',
171 'Registered Interrupts');
172 entryView.remoteCoreId = i;
173 if (Number(mod.func) != 0) {
174 entryView.isrFxn =
175 Program.lookupFuncName(Number(mod.func))[0];
176 entryView.isrArg = "0x" + Number(args[i]).toString(16);
177 }
178 else {
179 entryView.isrFxn = "(unplugged)";
180 entryView.isrArg = "";
181 }
183 if (localId != MultiProc.INVALIDID) {
184 var enableFlag = ipcar0[localId].elem;
186 if (enableFlag & (1 << (i + Interrupt.SRCSx_SHIFT))) {
187 entryView.isFlagged = true;
188 }
189 else {
190 entryView.isFlagged = false;
191 }
192 }
195 view.elements.$add(entryView);
196 }
197 }