a7dd9f8dba0fc99ea7b0399f5441d4f1f47d57ff
1 /*
2 * Copyright (c) 2012-2014 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 */
33 /*
34 * ======== NotifySetup.xs ========
35 *
36 */
37 var MultiProc = null;
39 /*
40 * ======== module$use ========
41 */
42 function module$use()
43 {
44 var TableInit = xdc.useModule("ti.sdo.ipc.family.vayu.TableInit");
46 /* load modules needed in meta domain and in target domain */
47 MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
49 xdc.useModule('xdc.runtime.Assert');
51 /* initialize procIdTable */
52 TableInit.initProcId(this);
54 /* initialize mailboxTable */
55 TableInit.generateTable(this);
57 /* Initialize mailbox base address table */
58 this.mailboxBaseAddr[0] = 0x4208B000; /* EVE1 Internal Mailbox 0 */
59 this.mailboxBaseAddr[1] = 0x4208C000; /* EVE1 Internal Mailbox 1 */
60 this.mailboxBaseAddr[2] = 0x4208D000; /* EVE1 Internal Mailbox 2 */
61 this.mailboxBaseAddr[3] = 0x4218B000; /* EVE2 Internal Mailbox 0 */
62 this.mailboxBaseAddr[4] = 0x4218C000; /* EVE2 Internal Mailbox 1 */
63 this.mailboxBaseAddr[5] = 0x4218D000; /* EVE2 Internal Mailbox 2 */
64 this.mailboxBaseAddr[6] = 0x4228B000; /* EVE3 Internal Mailbox 0 */
65 this.mailboxBaseAddr[7] = 0x4228C000; /* EVE3 Internal Mailbox 1 */
66 this.mailboxBaseAddr[8] = 0x4228D000; /* EVE3 Internal Mailbox 2 */
67 this.mailboxBaseAddr[9] = 0x4238B000; /* EVE4 Internal Mailbox 0 */
68 this.mailboxBaseAddr[10] = 0x4238C000; /* EVE4 Internal Mailbox 1 */
69 this.mailboxBaseAddr[11] = 0x4238D000; /* EVE4 Internal Mailbox 2 */
70 this.mailboxBaseAddr[12] = 0x48840000; /* System Mailbox 5 */
71 this.mailboxBaseAddr[13] = 0x48842000; /* System Mailbox 6 */
72 this.mailboxBaseAddr[14] = 0x48844000; /* System Mailbox 7 */
73 this.mailboxBaseAddr[15] = 0x48846000; /* System Mailbox 8 */
75 /* determine which notify drivers to include */
76 this.$private.driverMask = 0;
78 /* for unspecfied connections, the default is shared memory */
79 if (this.connections.length < (MultiProc.numProcessors - 1)) {
80 this.$private.driverMask |= this.Driver_SHAREDMEMORY;
81 }
83 /* remember which notify drivers have been specified */
84 for (var i = 0; i < this.connections.length; i++) {
85 if (this.connections[i].driver == this.Driver_SHAREDMEMORY) {
86 this.$private.driverMask |= this.Driver_SHAREDMEMORY;
87 }
88 if (this.connections[i].driver == this.Driver_MAILBOX) {
89 this.$private.driverMask |= this.Driver_MAILBOX;
90 }
91 }
93 /* load notify drivers into configuration model */
94 if (this.$private.driverMask & this.Driver_SHAREDMEMORY) {
95 xdc.useModule('ti.sdo.ipc.notifyDrivers.NotifyDriverShm');
96 }
97 if (this.$private.driverMask & this.Driver_MAILBOX) {
98 xdc.useModule('ti.sdo.ipc.family.vayu.NotifyDriverMbx');
99 }
100 }
102 /*
103 * ======== module$static$init ========
104 * Initialize the target state object.
105 */
106 function module$static$init(state, mod)
107 {
108 var procId;
110 state.numPlugged = 0;
112 /* Initialize the state connAry from the config params. Translate
113 * processor names into IDs for better runtime performance.
114 */
115 state.connAry.length = mod.connections.length;
117 for (var i = 0; i < mod.connections.length; i++) {
118 procId = MultiProc.getIdMeta(mod.connections[i].procName);
119 state.connAry[i].procId = procId;
120 state.connAry[i].driver = mod.connections[i].driver;
121 }
123 /* finish initializing the interrupt table */
124 if (Program.build.target.isa == "v7M4") {
125 // TODO
126 // if (Core.id == 0) {
127 // Hwi.construct(state.hwi, 53, NotifyDriverMbx.isr);
128 // }
129 // else {
130 // Hwi.construct(state.hwi, 54, NotifyDriverMbx.isr);
131 // }
132 /* interrupt event IDs used by this processor */
133 for (var i = 0; i < state.interruptTable.length; i++) {
134 state.interruptTable[i] = 0xFFFF; /* TODO */
135 }
136 }
137 else if (Program.build.target.isa == "arp32") {
138 /* interrupt event IDs used by this processor */
139 for (var i = 0; i < state.interruptTable.length; i++) {
140 state.interruptTable[i] = 0xFFFF; /* TODO */
141 }
142 }
143 else if (Program.build.target.isa == "66") {
144 /* interrupt event IDs used by this processor */
145 state.interruptTable[0] = 55; /* EVE1 -> DSP1 or DSP2 */
146 state.interruptTable[1] = 56; /* EVE2 -> DSP1 or DSP2 */
147 state.interruptTable[2] = 58; /* EVE3 -> DSP1 or DSP2 */
148 state.interruptTable[3] = 59; /* EVE4 -> DSP1 or DSP2 */
149 state.interruptTable[4] = 60; /* DSP1 -> DSP2 */
150 state.interruptTable[5] = 60; /* DSP2 -> DSP1 */
151 state.interruptTable[8] = 57; /* HOST -> DSP1 or DSP2 */
153 /* these are not known at config time, set at runtime */
154 state.interruptTable[6] = 0; /* IPU1 -> DSP1 or DSP2 */
155 state.interruptTable[7] = 0; /* IPU2 -> DSP1 or DSP2 */
156 state.interruptTable[9] = 0; /* IPU1-1 -> DSP1 or DSP2 */
157 state.interruptTable[10] = 0; /* IPU2-1 -> DSP1 or DSP2 */
158 }
159 else if (Program.build.target.isa == "v7A15") {
160 /* interrupt event IDs used by this processor */
161 for (var i = 0; i < state.interruptTable.length; i++) {
162 state.interruptTable[i] = 0xFFFF; /* TODO */
163 }
165 /* TODO */
166 // Hwi.construct(state.hwi, 77, NotifyDriverMbx.isr);
167 }
168 else {
169 throw("Invalid target: " + Program.build.target.$name);
170 }
172 /* initialize the driver table */
173 for (var i = 0; i < state.isrDispatchTable.length; i++) {
174 state.isrDispatchTable[i] = null;
175 }
176 }