]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - ipc/ipcdev.git/blob - packages/ti/sdo/ipc/family/tci663x/Interrupt.xs
TCI6638: Add support for ti.platforms.evmTCI6638K2K
[ipc/ipcdev.git] / packages / ti / sdo / ipc / family / tci663x / Interrupt.xs
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     'TMS320TCI6638' : {
43         IPCGR0:         0x02620240,
44         IPCAR0:         0x02620280,
45         INTERDSPINT:    105,
46     },
47 }
48 var Settings = xdc.loadCapsule('ti/sdo/ipc/family/Settings.xs');
49 Settings.setDeviceAliases(deviceSettings, Settings.deviceAliases);
51 var Hwi;
52 var Interrupt;
53 var Ipc;
54 var MultiProc;
55 var SharedRegion;
56 var MultiProcSetup;
58 /*
59  *  ======== module$meta$init ========
60  */
61 function module$meta$init()
62 {
63     /* Only process during "cfg" phase */
64     if (xdc.om.$name != "cfg") {
65         return;
66     }
68     var settings = deviceSettings[Program.cpu.deviceName];
70     this.IPCGR0         = settings.IPCGR0;
71     this.IPCAR0         = settings.IPCAR0;
72     this.INTERDSPINT    = settings.INTERDSPINT;
73 }
76 /*
77  *  ======== module$use ========
78  */
79 function module$use()
80 {
81     Interrupt       = this;
82     Hwi             = xdc.useModule("ti.sysbios.family.c64p.Hwi");
83     Ipc             = xdc.useModule("ti.sdo.ipc.Ipc");
84     MultiProc       = xdc.useModule("ti.sdo.utils.MultiProc");
85     SharedRegion    = xdc.useModule("ti.sdo.ipc.SharedRegion");
86     MultiProcSetup  = xdc.useModule("ti.sdo.ipc.family.tci663x.MultiProcSetup");
87 }
89 /*
90  *  ======== module$static$init ========
91  */
92 function module$static$init(mod, params)
93 {
94     var args = Interrupt.$object.args;
95     var MultiProc = xdc.module('ti.sdo.utils.MultiProc');
97     /* The function table length should be the number of processors */
98     args.length = MultiProc.numProcessors;
99     for (var i = 0; i < args.length; i++) {
100         args[i] = 0;
101     }
103     mod.func = null;
104     mod.numPlugged = 0;
107 /*
108  *************************************************************************
109  *                       ROV View functions
110  *************************************************************************
111  */
113 /*
114  *  ======== viewInterruptsData ========
115  *  Module data view
116  */
117 function viewInterruptsData(view)
119     var Interrupt       = xdc.useModule('ti.sdo.ipc.family.tci663x.Interrupt');
120     var ScalarStructs   = xdc.useModule('xdc.rov.support.ScalarStructs');
121     var MultiProc       = xdc.useModule('ti.sdo.utils.MultiProc');
123     /* Retrieve the module state. */
124     var rawView = Program.scanRawView('ti.sdo.ipc.family.tci663x.Interrupt');
125     var mod = rawView.modState;
126     /* Retrieve the module configuration. */
127     var modCfg = Program.getModuleConfig('ti.sdo.ipc.family.tci663x.Interrupt');
128     var MultiProcCfg = Program.getModuleConfig('ti.sdo.utils.MultiProc');
130     var args = Program.fetchArray(Interrupt.args$fetchDesc,
131                                       mod.args,
132                                       MultiProcCfg.numProcessors);
134     var localId = MultiProc.self$view();
136     if (localId != MultiProc.INVALIDID) {
137         var ipcar0 = Program.fetchArray(ScalarStructs.S_Bits32$fetchDesc,
138             $addr(modCfg.IPCAR0), MultiProcCfg.numProcessors, false);
139     }
141     for (var i = 0; i < MultiProcCfg.numProcessors; i++) {
142         var entryView =
143                 Program.newViewStruct('ti.sdo.ipc.family.tci663x.Interrupt',
144                 'Registered Interrupts');
145         entryView.remoteCoreId = i;
146         if (Number(mod.func) != 0) {
147             entryView.isrFxn =
148                     Program.lookupFuncName(Number(mod.func))[0];
149             entryView.isrArg = "0x" + Number(args[i]).toString(16);
150         }
151         else {
152             entryView.isrFxn = "(unplugged)";
153             entryView.isrArg = "";
154         }
156         if (localId != MultiProc.INVALIDID) {
157             var enableFlag = ipcar0[localId].elem;
159             if (enableFlag & (1 << (i + Interrupt.SRCSx_SHIFT))) {
160                 entryView.isFlagged = true;
161             }
162             else {
163                 entryView.isFlagged = false;
164             }
165         }
168         view.elements.$add(entryView);
169     }