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 * ======== InterruptHost.xs ========
34 *
35 */
37 var Hwi = null;
38 var Host = null;
39 var Ipc = null;
40 var Xbar = null;
41 var Mmu = null;
43 /*
44 * ======== module$use ========
45 */
46 function module$use()
47 {
48 Hwi = xdc.useModule("ti.sysbios.family.arm.gic.Hwi");
49 Ipc = xdc.useModule("ti.sdo.ipc.Ipc");
50 Host = xdc.useModule("ti.sdo.ipc.family.vayu.InterruptHost");
51 Xbar = xdc.useModule("ti.sysbios.hal.vayu.IntXbar");
52 Mmu = xdc.useModule("ti.sysbios.family.arm.a15.Mmu");
53 TableInit = xdc.useModule("ti.sdo.ipc.family.vayu.TableInit");
55 /* Initisalize procIdTable */
56 TableInit.initProcId(Host);
58 /* Initialize mailboxTable */
59 TableInit.generateTable(Host);
61 /* Initialize mailbox base address table */
62 this.mailboxBaseAddr[0] = 0x4208B000; /* EVE1 Internal Mailbox 0 */
63 this.mailboxBaseAddr[1] = 0x4208C000; /* EVE1 Internal Mailbox 1 */
64 this.mailboxBaseAddr[2] = 0x4208D000; /* EVE1 Internal Mailbox 2 */
65 this.mailboxBaseAddr[3] = 0x4218B000; /* EVE2 Internal Mailbox 0 */
66 this.mailboxBaseAddr[4] = 0x4218C000; /* EVE2 Internal Mailbox 1 */
67 this.mailboxBaseAddr[5] = 0x4218D000; /* EVE2 Internal Mailbox 2 */
68 this.mailboxBaseAddr[6] = 0x4228B000; /* EVE3 Internal Mailbox 0 */
69 this.mailboxBaseAddr[7] = 0x4228C000; /* EVE3 Internal Mailbox 1 */
70 this.mailboxBaseAddr[8] = 0x4228D000; /* EVE3 Internal Mailbox 2 */
71 this.mailboxBaseAddr[9] = 0x4238B000; /* EVE4 Internal Mailbox 0 */
72 this.mailboxBaseAddr[10] = 0x4238C000; /* EVE4 Internal Mailbox 1 */
73 this.mailboxBaseAddr[11] = 0x4238D000; /* EVE4 Internal Mailbox 2 */
74 this.mailboxBaseAddr[12] = 0x48840000; /* System Mailbox 5 */
75 this.mailboxBaseAddr[13] = 0x48842000; /* System Mailbox 6 */
76 this.mailboxBaseAddr[14] = 0x48844000; /* System Mailbox 7 */
77 this.mailboxBaseAddr[15] = 0x48846000; /* System Mailbox 8 */
79 /* These are obtained by looking at MPU IRQ + 32 */
80 this.hostInterruptTable[0] = 134 + 32; /* EVE1 */
81 this.hostInterruptTable[1] = 135 + 32; /* EVE2 */
82 this.hostInterruptTable[2] = 137 + 32; /* EVE3 */
83 this.hostInterruptTable[3] = 138 + 32; /* EVE4 */
84 this.hostInterruptTable[4] = 136 + 32; /* DSP1 */
85 this.hostInterruptTable[5] = 141 + 32; /* DSP2 */
86 this.hostInterruptTable[6] = 136 + 32; /* IPU1-0 */
87 this.hostInterruptTable[7] = 141 + 32; /* IPU2-0 */
88 this.hostInterruptTable[8] = 0; /* HOST */
89 this.hostInterruptTable[9] = 136 + 32; /* IPU1-1 */
90 this.hostInterruptTable[10] = 141 + 32; /* IPU2-1 */
92 /*
93 * In case of a spec change, follow the process shown below:
94 * 1. Update the mailboxBaseAddr Table.
95 * 2. Update the dspInterruptTable.
96 * 3. Update Virtual Index assignment.
97 * 4. Update numCores, numEves and eveMbx2BaseIdx variables
98 * in order to correctly intialize the mailboxTable.
99 */
101 /* Add mailbox addresses to the Mmu table */
102 /* Force mailbox addresses to be NON cacheable */
103 var peripheralAttrs = {
104 type : Mmu.DescriptorType_BLOCK, // BLOCK descriptor
105 accPerm : 0, // read/write at PL1
106 noExecute : true, // not executable
107 attrIndx : 1 // MAIR0 Byte1 describes mem attr
108 };
110 /* Configure the corresponding MMU page descriptor accordingly */
111 Mmu.setSecondLevelDescMeta(0x42000000,
112 0x42000000,
113 peripheralAttrs);
115 Mmu.setSecondLevelDescMeta(0x42200000,
116 0x42200000,
117 peripheralAttrs);
119 Mmu.setSecondLevelDescMeta(0x48800000,
120 0x48800000,
121 peripheralAttrs);
122 }
124 /*
125 * ======== module$static$init ========
126 * Initialize module values.
127 */
128 function module$static$init(mod, params)
129 {
130 var remoteProcId;
131 var mbxId;
133 for (remoteProcId = 0; remoteProcId < Host.procIdTable.length; remoteProcId++) {
134 mod.fxnTable[remoteProcId].func = null;
135 mod.fxnTable[remoteProcId].arg = 0;
136 }
138 for (mbxId = 0; mbxId < Host.mailboxBaseAddr.length; mbxId++) {
139 mod.numPlugged[mbxId] = 0;
140 }
141 }