1 /*
2 * Copyright (c) 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 * ======== InterruptIpu.xs ========
34 *
35 */
37 var BIOS = null;
38 var Hwi = null;
39 var Core = null;
40 var Ipu = null;
42 /*
43 * ======== module$use ========
44 */
45 function module$use()
46 {
47 BIOS = xdc.useModule("ti.sysbios.BIOS");
48 Hwi = xdc.useModule("ti.sysbios.family.arm.m3.Hwi");
49 Core = xdc.useModule("ti.sysbios.family.arm.ducati.Core");
50 Ipc = xdc.useModule("ti.sdo.ipc.Ipc");
51 Ipu = xdc.useModule("ti.sdo.ipc.family.vayu.InterruptIpu");
52 Xbar = xdc.useModule("ti.sysbios.hal.vayu.IntXbar");
53 TableInit = xdc.useModule("ti.sdo.ipc.family.vayu.TableInit");
55 /* Initisalize procIdTable */
56 TableInit.initProcId(Ipu);
58 /* Initialize mailboxTable */
59 TableInit.generateTable(Ipu);
61 /* Initialize mailbox base addrs */
62 if (this.mailboxBaseAddr[0] == undefined) {
63 this.mailboxBaseAddr[0] = 0x6208B000; /* EVE1 MBOX0 - PA: 0x4208B000 */
64 }
65 if (this.mailboxBaseAddr[1] == undefined) {
66 this.mailboxBaseAddr[1] = 0x6208C000; /* EVE1 MBOX1 - PA: 0x4208C000 */
67 }
68 if (this.mailboxBaseAddr[2] == undefined) {
69 this.mailboxBaseAddr[2] = 0; /* EVE1 MBOX2 - PA: N/A */
70 } else {
71 this.$logWarning("InterruptIpu.mailboxBaseAddr[2] is the EVE1 MBOX2, " +
72 "which is not used for IPU communication and should not be " +
73 "configured.", this);
74 }
75 if (this.mailboxBaseAddr[3] == undefined) {
76 this.mailboxBaseAddr[3] = 0x6218B000; /* EVE2 MBOX0 - PA: 0x4218B000 */
77 }
78 if (this.mailboxBaseAddr[4] == undefined) {
79 this.mailboxBaseAddr[4] = 0x6218C000; /* EVE2 MBOX1 - PA: 0x4218C000 */
80 }
81 if (this.mailboxBaseAddr[5] == undefined) {
82 this.mailboxBaseAddr[5] = 0; /* EVE2 MBOX2 - PA: N/A */
83 } else {
84 this.$logWarning("InterruptIpu.mailboxBaseAddr[5] is the EVE2 MBOX2, " +
85 "which is not used for IPU communication and should not be " +
86 "configured.", this);
87 }
89 if (this.mailboxBaseAddr[6] == undefined) {
90 this.mailboxBaseAddr[6] = 0x6228B000; /* EVE3 MBOX0 - PA: 0x4228B000 */
91 }
92 if (this.mailboxBaseAddr[7] == undefined) {
93 this.mailboxBaseAddr[7] = 0x6228C000; /* EVE3 MBOX1 - PA: 0x4228C000 */
94 }
95 if (this.mailboxBaseAddr[8] == undefined) {
96 this.mailboxBaseAddr[8] = 0; /* EVE3 MBOX2 - PA: N/A */
97 } else {
98 this.$logWarning("InterruptIpu.mailboxBaseAddr[8] is the EVE3 MBOX2, " +
99 "which is not used for IPU communication and should not be " +
100 "configured.", this);
101 }
103 if (this.mailboxBaseAddr[9] == undefined) {
104 this.mailboxBaseAddr[9] = 0x6238B000; /* EVE4 MBOX0 - PA: 0x4238B000 */
105 }
106 if (this.mailboxBaseAddr[10] == undefined) {
107 this.mailboxBaseAddr[10] = 0x6238C000; /* EVE4 MBOX1 - PA: 0x4238C000 */
108 }
109 if (this.mailboxBaseAddr[11] == undefined) {
110 this.mailboxBaseAddr[11] = 0; /* EVE4 MBOX2 - PA: N/A */
111 } else {
112 this.$logWarning("InterruptIpu.mailboxBaseAddr[11] is the EVE4 MBOX2, " +
113 "which is not used for IPU communication and should not be " +
114 "configured.", this);
115 }
117 if (this.mailboxBaseAddr[12] == undefined) {
118 this.mailboxBaseAddr[12] = 0x68840000; /* System Mailbox 5 */
119 }
120 if (this.mailboxBaseAddr[13] == undefined) {
121 this.mailboxBaseAddr[13] = 0x68842000; /* System Mailbox 6 */
122 }
123 if (this.mailboxBaseAddr[14] == undefined) {
124 this.mailboxBaseAddr[14] = 0x68844000; /* System Mailbox 7 */
125 }
126 if (this.mailboxBaseAddr[15] == undefined) {
127 this.mailboxBaseAddr[15] = 0x68846000; /* System Mailbox 8 */
128 }
130 /*
131 * In case of a spec change, follow the process shown below:
132 * 1. Update the mailboxBaseAddr Table.
133 * 2. Update the dspInterruptTable.
134 * 3. Update Virtual Index assignment.
135 * 4. Update numCores, numEves and eveMbx2BaseIdx variables
136 * in order to correctly intialize the mailboxTable.
137 */
138 }
140 /*
141 * ======== module$static$init ========
142 * Initialize module values.
143 */
144 function module$static$init(mod, params)
145 {
146 var remoteProcId;
147 var mbxId;
149 for (remoteProcId = 0; remoteProcId < Ipu.procIdTable.length; remoteProcId++) {
150 mod.fxnTable[remoteProcId].func = null;
151 mod.fxnTable[remoteProcId].arg = 0;
152 }
154 for (mbxId = 0; mbxId < Ipu.mailboxBaseAddr.length; mbxId++) {
155 mod.numPlugged[mbxId] = 0;
156 }
158 /* Initialize Interrupt Event Ids for communicating with this processor */
159 if (Core.id == 0) {
160 mod.interruptTable[0] = 64; /* EVE1 */
161 mod.interruptTable[1] = 65; /* EVE2 */
162 mod.interruptTable[2] = 67; /* EVE3 */
163 mod.interruptTable[3] = 68; /* EVE4 */
165 /* These are not known at config time and is set a runtime */
166 mod.interruptTable[4] = 0; /* DSP1 */
167 mod.interruptTable[5] = 0; /* DSP2 */
168 mod.interruptTable[6] = 0; /* Ipu1-0 */
169 mod.interruptTable[7] = 0; /* Ipu2-0 */
170 mod.interruptTable[8] = 0; /* HOST */
171 mod.interruptTable[9] = 0; /* Ipu1-1 */
172 mod.interruptTable[10] = 0; /* Ipu2-1 */
173 }
174 else {
175 mod.interruptTable[0] = 71; /* EVE1 */
176 mod.interruptTable[1] = 72; /* EVE2 */
177 mod.interruptTable[2] = 74; /* EVE3 */
178 mod.interruptTable[3] = 75; /* EVE4 */
180 /* These are not known at config time and is set a runtime */
181 mod.interruptTable[4] = 0; /* DSP1 */
182 mod.interruptTable[5] = 0; /* DSP2 */
183 mod.interruptTable[6] = 0; /* Ipu1-0 */
184 mod.interruptTable[7] = 0; /* Ipu2-0 */
185 mod.interruptTable[8] = 0; /* HOST */
186 mod.interruptTable[9] = 0; /* Ipu1-1 */
187 mod.interruptTable[10] = 0; /* Ipu2-1 */
189 }
190 }