]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - ipc/ipcdev.git/blob - packages/ti/sdo/ipc/family/tci663x/Interrupt.xs
SDOCM00114392 Interrupt module on tci6638 does not support clusters
[ipc/ipcdev.git] / packages / ti / sdo / ipc / family / tci663x / Interrupt.xs
1 /*
2  * Copyright (c) 2012-2015 Texas Instruments Incorporated - http://www.ti.com
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(state, mod)
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     state.func = null;
100     state.numPlugged = 0;
103 /*
104  *************************************************************************
105  *                       ROV View functions
106  *************************************************************************
107  */
109 /*
110  *  ======== viewInterruptsData ========
111  *  Module data view
112  */
113 function viewInterruptsData(view)
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, 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     }