]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - ipc/ipcdev.git/blob - packages/ti/sdo/ipc/family/tci663x/Interrupt.xs
Interrupt: tci663x: Update Interrupt numbers for 66AK2G
[ipc/ipcdev.git] / packages / ti / sdo / ipc / family / tci663x / Interrupt.xs
1 /*
2  * Copyright (c) 2014-2015 Texas Instruments Incorporated - http://www.ti.com
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  *   Redistributions of source code must retain the above copyright
9  *   notice, this list of conditions and the following disclaimer.
10  *
11  *   Redistributions in binary form must reproduce the above copyright
12  *   notice, this list of conditions and the following disclaimer in the
13  *   documentation and/or other materials provided with the
14  *   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
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
33 /*
34  *  ======== Interrupt.xs ========
35  */
37 var isaChain = "";
38 var deviceSettings = {
39     /* all Keystone II devices inherit from TCI6634 */
40     'TMS320TCI6634' : {
41         IPCGR0:         0x02620240,
42         IPCAR0:         0x02620280,
43         IPCGRH:         0x02620260,
44         IPCARH:         0x026202A0,
45         KICK0:          0x02620038,
46         KICK1:          0x0262003C,
47         INTERDSPINT:    105,
48         IPCHOSTINT:     4
49     },
50     'TMS320C66AK2H12' : {
51         IPCGR0:         0x02620240,
52         IPCAR0:         0x02620280,
53         IPCGRH:         0x02620260,
54         IPCARH:         0x026202A0,
55         KICK0:          0x02620038,
56         KICK1:          0x0262003C,
57         INTERDSPINT:    8,
58         IPCHOSTINT:     1
59     }
61 };
63 var Settings = xdc.loadCapsule('ti/sdo/ipc/family/Settings.xs');
64 Settings.setDeviceAliases(deviceSettings, Settings.deviceAliases);
66 var MultiProc;
68 /*
69  *  ======== module$meta$init ========
70  */
71 function module$meta$init()
72 {
73     /* only process during "cfg" phase */
74     if (xdc.om.$name != "cfg") {
75         return;
76     }
78     /* concatinate isa chain into single string for easier matching */
79     isaChain = "#" + Program.build.target.getISAChain().join("#") + "#";
81     var settings = deviceSettings[Program.cpu.deviceName];
83     this.IPCGR0         = settings.IPCGR0;
84     this.IPCAR0         = settings.IPCAR0;
85     this.IPCGRH         = settings.IPCGRH;
86     this.IPCARH         = settings.IPCARH;
87     this.KICK0          = settings.KICK0;
88     this.KICK1          = settings.KICK1;
89     if (isaChain.match(/#64P#/)) {
90         this.INTERDSPINT    = settings.INTERDSPINT;
91     }
92     else if (isaChain.match(/#v7A#/)) {
93         this.INTERDSPINT    = settings.IPCHOSTINT;
94     }
95 }
97 /*
98  *  ======== module$use ========
99  */
100 function module$use()
102     xdc.useModule("ti.sysbios.hal.Hwi");
103     xdc.useModule("ti.sdo.ipc.family.tci663x.MultiProcSetup");
105     MultiProc = xdc.useModule("ti.sdo.utils.MultiProc");
107     /*  Hack: fix conflict between NotifyDriverCirc and VirtQueue.
108      *
109      *  If both of these modules are in the configuration, then instruct
110      *  the NotifyCircSetup module to exclude the host during the IPC
111      *  attach phase.
112      */
113     var ncsName = this.$package.$name + ".NotifyCircSetup";
114     var vqName = "ti.ipc.family.tci6638.VirtQueue";
116     var notifySetup = ((ncsName in xdc.om) && xdc.module(ncsName).$used);
117     var virtQue = ((vqName in xdc.om) && xdc.module(vqName).$used);
119     if (notifySetup && virtQue) {
120         xdc.module(ncsName).includeHost = false;
121     }
124 /*
125  *  ======== module$static$init ========
126  */
127 function module$static$init(state, mod)
129     state.numPlugged = 0;
130     state.baseId = MultiProc.baseIdOfCluster;
131     state.hwi = null;
133     /* initialize client function table */
134     state.clientTab.length = MultiProc.numProcsInCluster;
136     for (var i = 0; i < state.clientTab.length; i++) {
137         state.clientTab[i].func = null;
138         state.clientTab[i].arg = -1;
139     }
141     /* initialize ipcar source bit mapping */
142     state.hwTab.length = MultiProc.numProcsInCluster;
144     for (var i = 0; i < state.hwTab.length; i++) {
145         var name = MultiProc.nameList[i];
147         if (name == "HOST") {
148             state.hwTab[i].dnum = MultiProc.INVALIDID;
149             /* by convention, host is bit 31 in ipcgr and ipcar registers */
150             state.hwTab[i].srcsx = 31;
151         }
152         else {
153             /* the numeric part of the name string determines the coreId */
154             var coreId = Number(name.substring("CORE".length));
155             state.hwTab[i].dnum = coreId;
156             state.hwTab[i].srcsx = coreId + mod.SRCSx_SHIFT;
157         }
158     }
161 /*
162  *************************************************************************
163  *                       ROV View functions
164  *************************************************************************
165  */
167 /*
168  *  ======== viewInterruptsData ========
169  *  Module data view
170  */
171 function viewInterruptsData(view)
173     var Interrupt       = xdc.useModule('ti.sdo.ipc.family.tci663x.Interrupt');
174     var ScalarStructs   = xdc.useModule('xdc.rov.support.ScalarStructs');
175     var MultiProc       = xdc.useModule('ti.sdo.utils.MultiProc');
177     /* Retrieve the module state. */
178     var rawView = Program.scanRawView('ti.sdo.ipc.family.tci663x.Interrupt');
179     var mod = rawView.modState;
180     /* Retrieve the module configuration. */
181     var modCfg = Program.getModuleConfig('ti.sdo.ipc.family.tci663x.Interrupt');
182     var MultiProcCfg = Program.getModuleConfig('ti.sdo.utils.MultiProc');
184     var clientTab = Program.fetchArray(Interrupt.clientTab$fetchDesc,
185             mod.clientTab, MultiProcCfg.numProcessors);
187     var localId = MultiProc.self$view();
189     if (localId != MultiProc.INVALIDID) {
190         var ipcar0 = Program.fetchArray(ScalarStructs.S_Bits32$fetchDesc,
191             $addr(modCfg.IPCAR0), MultiProcCfg.numProcessors, false);
192     }
194     for (var i = 0; i < MultiProcCfg.numProcsInCluster; i++) {
195         var entryView =
196                 Program.newViewStruct('ti.sdo.ipc.family.tci663x.Interrupt',
197                 'Registered Interrupts');
199         entryView.remoteCoreId = MultiProc.baseIdOfCluster + i;
201         var fxn = Number(clientTab[i].func);
202         if (fxn != 0) {
203             entryView.isrFxn = Program.lookupFuncName(fxn)[0];
204             entryView.isrArg = "0x" + Number(clientTab[i].arg).toString(16);
205         }
206         else {
207             entryView.isrFxn = "(unplugged)";
208             entryView.isrArg = "";
209         }
211         if (localId != MultiProc.INVALIDID) {
212             var enableFlag = ipcar0[localId].elem;
214             if (enableFlag & (1 << (i + Interrupt.SRCSx_SHIFT))) {
215                 entryView.isFlagged = true;
216             }
217             else {
218                 entryView.isFlagged = false;
219             }
220         }
222         view.elements.$add(entryView);
223     }