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 'Kepler' : {
38 IPCGR0: 0x02620240,
39 IPCAR0: 0x02620280,
40 INTERDSPINT: 105,
41 },
42 }
43 var Settings = xdc.loadCapsule('ti/sdo/ipc/family/Settings.xs');
44 Settings.setDeviceAliases(deviceSettings, Settings.deviceAliases);
46 var Hwi;
47 var Interrupt;
48 var Ipc;
49 var MultiProc;
50 var SharedRegion;
51 var MultiProcSetup;
53 /*
54 * ======== module$meta$init ========
55 */
56 function module$meta$init()
57 {
58 /* Only process during "cfg" phase */
59 if (xdc.om.$name != "cfg") {
60 return;
61 }
63 var settings = deviceSettings[Program.cpu.deviceName];
65 this.IPCGR0 = settings.IPCGR0;
66 this.IPCAR0 = settings.IPCAR0;
67 this.INTERDSPINT = settings.INTERDSPINT;
68 }
71 /*
72 * ======== module$use ========
73 */
74 function module$use()
75 {
76 Interrupt = this;
77 Hwi = xdc.useModule("ti.sysbios.family.c64p.Hwi");
78 Ipc = xdc.useModule("ti.sdo.ipc.Ipc");
79 MultiProc = xdc.useModule("ti.sdo.utils.MultiProc");
80 SharedRegion = xdc.useModule("ti.sdo.ipc.SharedRegion");
81 MultiProcSetup = xdc.useModule("ti.sdo.ipc.family.tci663x.MultiProcSetup");
82 }
84 /*
85 * ======== module$static$init ========
86 */
87 function module$static$init(mod, params)
88 {
89 var args = Interrupt.$object.args;
90 var MultiProc = xdc.module('ti.sdo.utils.MultiProc');
92 /* The function table length should be the number of processors */
93 args.length = MultiProc.numProcessors;
94 for (var i = 0; i < args.length; i++) {
95 args[i] = 0;
96 }
98 mod.func = null;
99 mod.numPlugged = 0;
100 }
102 /*
103 *************************************************************************
104 * ROV View functions
105 *************************************************************************
106 */
108 /*
109 * ======== viewInterruptsData ========
110 * Module data view
111 */
112 function viewInterruptsData(view)
113 {
114 var Interrupt = xdc.useModule('ti.sdo.ipc.family.tci663x.Interrupt');
115 var ScalarStructs = xdc.useModule('xdc.rov.support.ScalarStructs');
116 var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
118 /* Retrieve the module state. */
119 var rawView = Program.scanRawView('ti.sdo.ipc.family.tci663x.Interrupt');
120 var mod = rawView.modState;
121 /* Retrieve the module configuration. */
122 var modCfg = Program.getModuleConfig('ti.sdo.ipc.family.tci663x.Interrupt');
123 var MultiProcCfg = Program.getModuleConfig('ti.sdo.utils.MultiProc');
125 var args = Program.fetchArray(Interrupt.args$fetchDesc,
126 mod.args,
127 MultiProcCfg.numProcessors);
129 var localId = MultiProc.self$view();
131 if (localId != MultiProc.INVALIDID) {
132 var ipcar0 = Program.fetchArray(ScalarStructs.S_Bits32$fetchDesc,
133 $addr(modCfg.IPCAR0), MultiProcCfg.numProcessors, false);
134 }
136 for (var i = 0; i < MultiProcCfg.numProcessors; i++) {
137 var entryView =
138 Program.newViewStruct('ti.sdo.ipc.family.tci663x.Interrupt',
139 'Registered Interrupts');
140 entryView.remoteCoreId = i;
141 if (Number(mod.func) != 0) {
142 entryView.isrFxn =
143 Program.lookupFuncName(Number(mod.func))[0];
144 entryView.isrArg = "0x" + Number(args[i]).toString(16);
145 }
146 else {
147 entryView.isrFxn = "(unplugged)";
148 entryView.isrArg = "";
149 }
151 if (localId != MultiProc.INVALIDID) {
152 var enableFlag = ipcar0[localId].elem;
154 if (enableFlag & (1 << (i + Interrupt.SRCSx_SHIFT))) {
155 entryView.isFlagged = true;
156 }
157 else {
158 entryView.isFlagged = false;
159 }
160 }
163 view.elements.$add(entryView);
164 }
165 }