1 /*
2 * Copyright (c) 2013-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 /*
34 * ======== Interrupt.xs ========
35 */
37 var deviceSettings = {
38 'Kepler' : {
39 IPCGR0: 0x02620240,
40 IPCAR0: 0x02620280,
41 IPCGRH: 0x02620260,
42 IPCARH: 0x026202A0,
43 KICK0: 0x02620038,
44 KICK1: 0x0262003C,
45 INTERDSPINT: 105,
46 DSPINT: 5,
47 },
48 'TMS320TCI6638' : {
49 IPCGR0: 0x02620240,
50 IPCAR0: 0x02620280,
51 IPCGRH: 0x02620260,
52 IPCARH: 0x026202A0,
53 KICK0: 0x02620038,
54 KICK1: 0x0262003C,
55 INTERDSPINT: 105,
56 DSPINT: 5,
57 },
58 'TMS320TCI6636' : {
59 IPCGR0: 0x02620240,
60 IPCAR0: 0x02620280,
61 IPCGRH: 0x02620260,
62 IPCARH: 0x026202A0,
63 KICK0: 0x02620038,
64 KICK1: 0x0262003C,
65 INTERDSPINT: 105,
66 DSPINT: 5
67 },
68 'TMS320TCI6630K2L' : {
69 IPCGR0: 0x02620240,
70 IPCAR0: 0x02620280,
71 IPCGRH: 0x02620260,
72 IPCARH: 0x026202A0,
73 KICK0: 0x02620038,
74 KICK1: 0x0262003C,
75 INTERDSPINT: 105,
76 DSPINT: 5
77 },
78 'TMS320C66AK2H12' : {
79 IPCGR0: 0x02620240,
80 IPCAR0: 0x02620280,
81 IPCGRH: 0x02620260,
82 IPCARH: 0x026202A0,
83 KICK0: 0x02620038,
84 KICK1: 0x0262003C,
85 INTERDSPINT: 105,
86 DSPINT: 5,
87 },
88 'TMS320C66AK2E05' : {
89 IPCGR0: 0x02620240,
90 IPCAR0: 0x02620280,
91 IPCGRH: 0x02620260,
92 IPCARH: 0x026202A0,
93 KICK0: 0x02620038,
94 KICK1: 0x0262003C,
95 INTERDSPINT: 105,
96 DSPINT: 5
97 }
98 }
99 var Settings = xdc.loadCapsule('ti/sdo/ipc/family/Settings.xs');
100 Settings.setDeviceAliases(deviceSettings, Settings.deviceAliases);
101 var Hwi = null;
102 var Interrupt = null;
103 var MultiProc = null;
105 /*
106 * ======== module$meta$init ========
107 */
108 function module$meta$init()
109 {
110 /* Only process during "cfg" phase */
111 if (xdc.om.$name != "cfg") {
112 return;
113 }
115 var settings = deviceSettings[Program.cpu.deviceName];
117 this.IPCGR0 = settings.IPCGR0;
118 this.IPCAR0 = settings.IPCAR0;
119 this.IPCGRH = settings.IPCGRH;
120 this.IPCARH = settings.IPCARH;
121 this.KICK0 = settings.KICK0;
122 this.KICK1 = settings.KICK1;
123 this.INTERDSPINT = settings.INTERDSPINT;
124 this.DSPINT = settings.DSPINT;
125 }
126 /*
127 * ======== module$use ========
128 */
129 function module$use()
130 {
131 Interrupt = this;
133 Hwi = xdc.useModule("ti.sysbios.family.c64p.Hwi");
134 MultiProc = xdc.useModule("ti.sdo.utils.MultiProc");
135 }
137 /*
138 * ======== module$static$init ========
139 */
140 function module$static$init(state, mod)
141 {
143 state.numPlugged = 0;
144 state.clusterId = MultiProc.baseIdOfCluster;
146 /* The function table length should be the number of IPCAR bits */
147 state.fxnTable.length = 32;
149 for (var i = 0; i < state.fxnTable.length; i++) {
150 state.fxnTable[i].func = null;
151 state.fxnTable[i].arg = 0;
152 }
153 }