9669492c19607e54e53160846b739ac64f0161ce
1 /*
2 * Copyright (c) 2011, 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 */
34 var hw_OMAP4 = 0;
35 var hw_OMAP5 = 1;
36 var hw_VAYU = 2;
37 var VIRTIO = 0;
38 var ZEBU = 0;
39 var ES10 = 1;
40 var ES20 = 2;
42 var Program = xdc.useModule('xdc.cfg.Program');
44 var cfgArgs = prog.build.cfgArgs;
46 Program.global.HwType = cfgArgs.HwType;
47 Program.global.enableSMP = cfgArgs.enableSMP;
48 Program.global.HwVer = cfgArgs.HwVer;
49 Program.global.coreName = "dsp";
51 print("HwType = " + Program.global.HwType);
53 //*************************************
54 var System = xdc.useModule('xdc.runtime.System');
55 var SysMin = xdc.useModule('ti.trace.SysMin');
56 System.SupportProxy = SysMin;
57 SysMin.bufSize = 0x8000;
59 var Memory = xdc.useModule('xdc.runtime.Memory');
60 Memory.defaultHeapSize = 0x20000;
62 var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore');
64 var Cache = xdc.useModule('ti.sysbios.family.c66.Cache');
65 Cache.setMarMeta(0xa0000000, 0x02000000, Cache.Mar_DISABLE);
66 var L1cache = new Cache.Size();
67 L1cache.l1dSize = Cache.L1Size_0K;
69 xdc.loadPackage('ti.sdo.ipc.family.vayu');
70 xdc.useModule('ti.sdo.ipc.family.vayu.InterruptDsp');
71 xdc.loadPackage('ti.ipc.rpmsg');
72 xdc.loadPackage('ti.ipc.family.vayu');
74 /* Enable Memory Translation module that operates on the BIOS Resource Table */
75 var Resource = xdc.useModule('ti.ipc.remoteproc.Resource');
76 Resource.loadSegment = "EXT_CODE"
78 /* Modules used in Power Management */
79 xdc.loadPackage('ti.pm');
81 /* Idle function that periodically flushes the unicache */
82 var Idle = xdc.useModule('ti.sysbios.knl.Idle');
83 Idle.addFunc('&VirtQueue_cacheWb');
85 var HeapBuf = xdc.useModule('ti.sysbios.heaps.HeapBuf');
86 var List = xdc.useModule('ti.sdo.utils.List');
88 xdc.useModule('ti.sysbios.xdcruntime.GateThreadSupport');
89 var GateSwi = xdc.useModule('ti.sysbios.gates.GateSwi');
91 var Task = xdc.useModule('ti.sysbios.knl.Task');
92 Task.common$.namedInstance = true;
94 var Assert = xdc.useModule('xdc.runtime.Assert');
95 var Defaults = xdc.useModule('xdc.runtime.Defaults');
96 var Diags = xdc.useModule('xdc.runtime.Diags');
97 var LoggerSys = xdc.useModule('xdc.runtime.LoggerSys');
98 var LoggerSysParams = new LoggerSys.Params();
100 /* Enable Logger: */
101 Defaults.common$.logger = LoggerSys.create(LoggerSysParams);
103 /* Enable runtime Diags_setMask() for non-XDC spec'd modules: */
104 var Text = xdc.useModule('xdc.runtime.Text');
105 Text.isLoaded = true;
107 var Main = xdc.useModule('xdc.runtime.Main');
108 Main.common$.diags_ASSERT = Diags.ALWAYS_ON;
109 Main.common$.diags_INTERNAL = Diags.ALWAYS_ON;
111 var Hwi = xdc.useModule('ti.sysbios.family.c64p.Hwi');
112 Hwi.enableException = true;
114 /* -------------------------------- DSP ----------------------------------*/
115 var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
116 MultiProc.setConfig("DSP1", ["HOST", "IPU2", "IPU1", "DSP2", "DSP1"]);
118 /* --------------------------- TICK --------------------------------------*/
119 var Clock = xdc.useModule('ti.sysbios.knl.Clock');
120 Clock.tickSource = Clock.TickSource_NULL;
122 //**************************************
123 xdc.loadPackage('ti.ipc.mm');
124 xdc.loadPackage('ti.ipc.ipcmgr');
125 xdc.loadPackage('ti.srvmgr');
126 xdc.loadPackage('ti.srvmgr.omaprpc');
128 // Disabling default IpcCommon trace
129 var Registry = xdc.useModule('xdc.runtime.Registry');
130 var Diags = xdc.useModule('xdc.runtime.Diags');
131 var Task = xdc.useModule('ti.sysbios.knl.Task');
132 Task.common$.namedInstance = true;
134 Registry.common$.diags_ENTRY = Diags.RUNTIME_OFF;
135 Registry.common$.diags_EXIT = Diags.RUNTIME_OFF;
136 Registry.common$.diags_USER1 = Diags.RUNTIME_OFF;
137 Registry.common$.diags_INFO = Diags.RUNTIME_OFF;
138 Registry.common$.diags_LIFECYCLE = Diags.ALWAYS_ON;
139 Registry.common$.diags_STATUS = Diags.ALWAYS_ON;
140 Diags.setMaskEnabled = true;
142 var Memory = xdc.useModule('xdc.runtime.Memory');
143 var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
144 var GateHwi = xdc.useModule('ti.sysbios.gates.GateHwi');
145 HeapMem.common$.gate = GateHwi.create();
148 var heapMemParams = new HeapMem.Params;
149 heapMemParams.size = 0x2400000; // 36MB
150 heapMemParams.sectionName = ".systemHeap";
151 var heap0 = HeapMem.create(heapMemParams);
152 Memory.defaultHeapInstance = heap0;
153 Program.global.heap0 = heap0;
155 /*
156 * Setup memory map.
157 */
159 /* Mark heaps as NOINIT for optimizing boot-time */
160 Program.sectMap[".systemHeap"] = new Program.SectionSpec();
161 Program.sectMap[".systemHeap"].loadSegment = "EXT_HEAP";
162 Program.sectMap[".systemHeap"].type = "NOINIT";
163 Program.sectMap[".tracebuf"] = "TRACE_BUF";
164 Program.sectMap[".errorbuf"] = "EXC_DATA";
166 /* ----------------------------- VERSION CONFIGURATION ---------------------*/
167 var commonBld = xdc.loadCapsule("build/common.bld");
168 commonBld.GetVersionTag();
170 /*
171 * ======== CODEC ENGINE configurations ========
172 */
174 var Global = xdc.useModule('ti.sdo.ce.osal.Global');
175 Global.runtimeEnv = Global.DSPBIOS;
177 xdc.useModule('ti.sdo.ce.global.Settings').profile = "debug";
178 xdc.loadPackage('ti.sdo.ce.video').profile = "debug";
179 xdc.loadPackage('ti.sdo.ce.video3').profile = "debug";
180 xdc.loadPackage('ti.sdo.ce.alg').profile = "debug";
182 var HeapBufMP = xdc.useModule('ti.sdo.ipc.heaps.HeapBufMP');
184 var ipcSettings = xdc.useModule('ti.sdo.ce.ipc.Settings');
185 ipcSettings.ipc = xdc.useModule('ti.sdo.ce.ipc.bios.Ipc');
186 // set to true to enable debugging of codec engine
187 xdc.useModule('ti.sdo.ce.Settings').checked = true;
189 /* Enable Memory Translation module that operates on the BIOS Resource Table */
190 var Resource = xdc.useModule('ti.ipc.remoteproc.Resource');
191 Resource.customTable = true;
193 // Load decoder/encoder APIs:
194 var VIDDEC2 = xdc.useModule('ti.sdo.ce.video2.IVIDDEC2');
195 var UNIVERSAL = xdc.useModule('ti.sdo.ce.universal.IUNIVERSAL');
197 // load whatever codecs are available in the build
198 var codecs = [];
200 function loadCodec(pkg, name)
201 {
202 try {
203 var codec = xdc.useModule(pkg);
204 print('loading: ' + name);
205 codecs.push({ name: name, mod: codec, local: true });
206 } catch(e) {
207 print('no package: ' + pkg);
208 }
209 }
211 loadCodec('ti.sdo.codecs.universal.ce.UNIVERSAL', 'dsp_universalCopy');
213 var engine = xdc.useModule('ti.sdo.ce.Engine');
214 var myEngine = engine.create("dsp_vidsvr", codecs);
216 xdc.useModule('ti.sysbios.knl.Task');
217 var Task = xdc.useModule('ti.sysbios.knl.Task');
218 Task.defaultStackSize = 12 * 0x400;
220 /* ----------------------------- Configure BIOS--------------------------------*/
222 BIOS = xdc.useModule('ti.sysbios.BIOS');
223 BIOS.addUserStartupFunction('&IpcMgr_rpmsgStartup');
225 BIOS.clockEnabled = true;
226 BIOS.libType = BIOS.LibType_Custom;
227 BIOS.smpEnabled = false;
230 var Timer = xdc.useModule('ti.sysbios.timers.dmtimer.Timer');
231 /*
232 BIOS assumes that default frequency is 38.4 MHz. On OMAP5, SYS_CLK is used to source
233 Hence it is clocked at 19.2 MHz.
235 Locally setting the BIOS configuration for GPT and CTM for OMAP5 till actual changes are
236 present in omap54xx/ipu/Platform.xdc
237 */
238 Timer.intFreq.hi = 0;
239 Timer.intFreq.lo = 19200000;
240 BIOS.cpuFreq.hi = 0;
241 BIOS.cpuFreq.lo = 600000000;
243 Program.sectMap[".plt"] = "EXT_DATA";
246 /* IPC 3.x is no longer providing version capability. If needed, then IPC needs to implement it. */
247 /* Version module; this will produce a .version section with trees infos. Read
248 * with "readelf -p .version <base_image>" */
249 // xdc.useModule('ti.utils.Version');