1 /*
2 * Copyright (c) 2012-2014, 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 */
33 var Memory = xdc.useModule('xdc.runtime.Memory');
34 var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore');
35 var BIOS = xdc.useModule('ti.sysbios.BIOS');
36 BIOS.heapSize = 0x10000;
37 //BIOS.libType = BIOS.LibType_Custom;
39 var Idle = xdc.useModule('ti.sysbios.knl.Idle');
40 Idle.addFunc('&VirtQueue_cacheWb');
42 var System = xdc.useModule('xdc.runtime.System');
43 var SysMin = xdc.useModule('xdc.runtime.SysMin');
44 System.SupportProxy = SysMin;
46 var Diags = xdc.useModule('xdc.runtime.Diags');
48 if (Program.cpu.deviceName == "OMAPL138") {
49 xdc.useModule('ti.ipc.family.omapl138.VirtQueue');
50 xdc.useModule('ti.sdo.ipc.family.da830.InterruptDsp');
52 var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
53 MultiProc.setConfig("DSP", ["HOST", "DSP"]);
55 /* Enable Memory Translation module that operates on the Resource Table */
56 var Resource = xdc.useModule('ti.ipc.remoteproc.Resource');
57 Resource.loadSegment = Program.platform.dataMemory;
59 Program.sectMap[".text:_c_int00"] = new Program.SectionSpec();
60 Program.sectMap[".text:_c_int00"].loadSegment = "DDR";
61 Program.sectMap[".text:_c_int00"].loadAlign = 0x400;
63 var Hwi = xdc.useModule('ti.sysbios.family.c64p.Hwi');
65 var Cache = xdc.useModule('ti.sysbios.family.c64p.Cache');
66 /* Set 0xc4000000 -> 0xc4ffffff to be non-cached for shared memory IPC */
67 Cache.MAR192_223 = 0x00000010;
69 Program.global.sysMinBufSize = 0x8000;
70 SysMin.bufSize = Program.global.sysMinBufSize;
72 var Timer = xdc.useModule('ti.sysbios.timers.timer64.Timer');
73 var Clock = xdc.useModule('ti.sysbios.knl.Clock');
74 Timer.timerSettings[1].master = true;
75 Timer.defaultHalf = Timer.Half_LOWER;
76 Clock.timerId = 1;
78 /* COMMENT OUT TO SHUT OFF LOG FOR BENCHMARKS: */
79 /*
80 Diags.setMaskMeta("ti.ipc.family.omapl138.Interrupt", Diags.USER1,
81 Diags.ALWAYS_ON);
82 Diags.setMaskMeta("ti.ipc.family.omapl138.VirtQueue", Diags.USER1,
83 Diags.ALWAYS_ON);
84 */
85 }
86 else if (Program.platformName.match(/6614/)) {
87 var VirtQueue = xdc.useModule('ti.ipc.family.tci6614.VirtQueue');
88 var Interrupt = xdc.useModule('ti.ipc.family.tci6614.Interrupt');
90 /* Note: MultiProc_self is set during VirtQueue_init based on DNUM. */
91 var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
92 MultiProc.setConfig(null, ["HOST", "CORE0", "CORE1", "CORE2", "CORE3"]);
94 Program.sectMap[".text:_c_int00"] = new Program.SectionSpec();
95 Program.sectMap[".text:_c_int00"].loadSegment = "L2SRAM";
96 Program.sectMap[".text:_c_int00"].loadAlign = 0x400;
98 var Hwi = xdc.useModule('ti.sysbios.family.c64p.Hwi');
100 /* This makes the vrings address range 0xa0000000 to 0xa1ffffff uncachable.
101 We assume the rest is to be left cacheable.
102 Per sprugw0b.pdf
103 0184 8280h MAR160 Memory Attribute Register 160 A000 0000h - A0FF FFFFh
104 0184 8284h MAR161 Memory Attribute Register 161 A100 0000h - A1FF FFFFh
105 */
106 var Cache = xdc.useModule('ti.sysbios.family.c66.Cache');
107 /* This doesn't work:
108 Cache.MAR160_191 = 0xFFFFFFFC;
109 So, need to do this:
110 */
111 Cache.setMarMeta(0xA0000000, 0x1FFFFFF, 0);
113 Program.global.sysMinBufSize = 0x8000;
114 SysMin.bufSize = Program.global.sysMinBufSize;
116 /* Enable Memory Translation module that operates on the Resource Table */
117 var Resource = xdc.useModule('ti.ipc.remoteproc.Resource');
118 Resource.loadSegment = Program.platform.dataMemory;
120 /* COMMENT OUT TO SHUT OFF LOG FOR BENCHMARKS: */
121 /*
122 Diags.setMaskMeta("ti.ipc.family.tci6614.Interrupt", Diags.USER1,
123 Diags.ALWAYS_ON);
124 Diags.setMaskMeta("ti.ipc.family.tci6614.VirtQueue", Diags.USER1,
125 Diags.ALWAYS_ON);
126 Diags.setMaskMeta("ti.ipc.transports.TransportRpmsg",
127 Diags.INFO|Diags.USER1|Diags.STATUS,
128 Diags.ALWAYS_ON);
129 Diags.setMaskMeta("ti.ipc.namesrv.NameServerRemoteRpmsg", Diags.INFO,
130 Diags.ALWAYS_ON);
131 */
132 }
133 else if (Program.platformName.match(/simKepler/) ||
134 Program.cpu.deviceName.match(/^TMS320C66AK2E05$/) ||
135 Program.cpu.deviceName.match(/^TMS320TCI663(0K2L|6|8)$/)) {
136 var VirtQueue = xdc.useModule('ti.ipc.family.tci6638.VirtQueue');
137 var Interrupt = xdc.useModule('ti.ipc.family.tci6638.Interrupt');
139 /* Note: MultiProc_self is set during VirtQueue_init based on DNUM. */
140 var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
142 switch (Program.cpu.deviceName) {
143 case "TMS320C66AK2E05":
144 MultiProc.setConfig(null, ["HOST", "CORE0"]);
145 break;
147 case "TMS320TCI6630":
148 MultiProc.setConfig(null,
149 ["HOST", "CORE0", "CORE1", "CORE2", "CORE3"]);
150 break;
152 case "TMS320TCI6636":
153 case "TMS320TCI6638":
154 MultiProc.setConfig(null,
155 ["HOST", "CORE0", "CORE1", "CORE2", "CORE3",
156 "CORE4", "CORE5", "CORE6", "CORE7"]);
157 break;
158 }
160 Program.sectMap[".text:_c_int00"] = new Program.SectionSpec();
161 Program.sectMap[".text:_c_int00"].loadSegment = "L2SRAM";
162 Program.sectMap[".text:_c_int00"].loadAlign = 0x400;
164 var Hwi = xdc.useModule('ti.sysbios.family.c64p.Hwi');
166 /* This makes the vrings address range 0xa0000000 to 0xa1ffffff uncachable.
167 We assume the rest is to be left cacheable.
168 Per sprugw0b.pdf
169 0184 8280h MAR160 Memory Attribute Register 160 A000 0000h - A0FF FFFFh
170 0184 8284h MAR161 Memory Attribute Register 161 A100 0000h - A1FF FFFFh
171 */
172 var Cache = xdc.useModule('ti.sysbios.family.c66.Cache');
173 /* This doesn't work:
174 Cache.MAR160_191 = 0xFFFFFFFC;
175 So, need to do this:
176 */
177 /* TBD: Update for Kepler: */
178 Cache.setMarMeta(0xA0000000, 0x1FFFFFF, 0);
180 Program.global.sysMinBufSize = 0x8000;
181 SysMin.bufSize = Program.global.sysMinBufSize;
183 /* Enable Memory Translation module that operates on the Resource Table */
184 var Resource = xdc.useModule('ti.ipc.remoteproc.Resource');
185 Resource.loadSegment = Program.platform.dataMemory;
187 /* COMMENT OUT TO SHUT OFF LOG FOR BENCHMARKS: */
188 /*
189 Diags.setMaskMeta("ti.ipc.family.tci6638.Interrupt", Diags.USER1,
190 Diags.ALWAYS_ON);
191 Diags.setMaskMeta("ti.ipc.family.tci6638.VirtQueue", Diags.USER1,
192 Diags.ALWAYS_ON);
193 Diags.setMaskMeta("ti.ipc.transports.TransportRpmsg",
194 Diags.INFO|Diags.USER1|Diags.STATUS,
195 Diags.ALWAYS_ON);
196 Diags.setMaskMeta("ti.ipc.namesrv.NameServerRemoteRpmsg", Diags.INFO,
197 Diags.ALWAYS_ON);
198 */
199 }
200 else {
201 throw("ping_rpmsg_common.cfg: Did not match any platform!");
202 }
204 Hwi.enableException = true;
206 xdc.loadPackage('ti.ipc.ipcmgr');
207 BIOS.addUserStartupFunction('&IpcMgr_rpmsgStartup');
209 xdc.loadPackage('ti.ipc.rpmsg');
211 var HeapBuf = xdc.useModule('ti.sysbios.heaps.HeapBuf');
212 var List = xdc.useModule('ti.sdo.utils.List');
214 xdc.useModule('ti.sysbios.xdcruntime.GateThreadSupport');
215 var GateSwi = xdc.useModule('ti.sysbios.gates.GateSwi');
217 var Assert = xdc.useModule('xdc.runtime.Assert');
218 var Defaults = xdc.useModule('xdc.runtime.Defaults');
219 var Diags = xdc.useModule('xdc.runtime.Diags');
220 var LoggerSys = xdc.useModule('xdc.runtime.LoggerSys');
221 var LoggerSysParams = new LoggerSys.Params();
223 /* Enable Logger: */
224 Defaults.common$.logger = LoggerSys.create(LoggerSysParams);
225 // FOR BENCHMARKING: Defaults.common$.logger = null;
227 /* Enable runtime Diags_setMask() for non-XDC spec'd modules: */
228 var Text = xdc.useModule('xdc.runtime.Text');
229 Text.isLoaded = true;
230 var Registry = xdc.useModule('xdc.runtime.Registry');
231 /*
232 Registry.common$.diags_INFO = Diags.ALWAYS_ON;
233 Registry.common$.diags_STATUS = Diags.ALWAYS_ON;
234 Registry.common$.diags_LIFECYCLE = Diags.ALWAYS_ON;
235 */
236 Diags.setMaskEnabled = true;
238 var Main = xdc.useModule('xdc.runtime.Main');
239 Main.common$.diags_ASSERT = Diags.ALWAYS_ON;
240 Main.common$.diags_INTERNAL = Diags.ALWAYS_ON;