3e9db619f9fff22e14588e09b0b23e32c0d41f6b
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 = "ipu";
51 print("HwType = " + Program.global.HwType);
52 print("HwVer = " + Program.global.HwVer);
54 if(Program.global.HwType == hw_VAYU)
55 {
56 xdc.loadCapsule("platform/ti/configs/vayu/IpcCommon.cfg.xs");
57 xdc.loadCapsule("platform/ti/configs/vayu/Ipu2Smp.cfg");
58 xdc.loadCapsule("platform/ti/configs/vayu/IpuAmmu.cfg");
59 }
60 else
61 {
62 xdc.loadCapsule("platform/ti/configs/omap54xx/IpcCommon.cfg.xs");
63 xdc.loadCapsule("platform/ti/configs/omap54xx/IpuSmp.cfg");
64 xdc.loadCapsule("platform/ti/configs/omap54xx/IpuAmmu.cfg");
66 }
68 xdc.loadPackage('ti.ipc.mm');
69 xdc.loadPackage('ti.ipc.ipcmgr');
70 xdc.loadPackage('ti.srvmgr');
71 xdc.loadPackage('ti.srvmgr.omaprpc');
73 var Memory = xdc.useModule('xdc.runtime.Memory');
74 var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
75 var GateHwi = xdc.useModule('ti.sysbios.gates.GateHwi');
76 HeapMem.common$.gate = GateHwi.create();
78 /* Heap Memory is set to 40 MB of the total 150 MB of EXT_HEAP.
79 * This is considering 2 1080p instances of Mpeg4 Decoders, each
80 * requiring 14 MBs and a single instance of H264 Encode requiring
81 * 8 MBs running parallely.
82 */
84 var heapMemParams = new HeapMem.Params;
85 heapMemParams.size = 0x2800000; // 40MB
86 heapMemParams.sectionName = ".systemHeap";
87 var heap0 = HeapMem.create(heapMemParams);
88 Memory.defaultHeapInstance = heap0;
89 Program.global.heap0 = heap0;
91 /*
92 * Setup memory map.
93 */
95 /* Mark heaps as NOINIT for optimizing boot-time */
96 Program.sectMap[".systemHeap"] = new Program.SectionSpec();
97 Program.sectMap[".systemHeap"].loadSegment = "EXT_HEAP";
98 Program.sectMap[".systemHeap"].type = "NOINIT";
100 /* Work-around for .const loading issues with MPEG4/VC1 codecs.. move AMMU
101 * tables out of .const into .txt so that they have valid data when AMMU
102 * is programmed (which happens before cinit initializes rw sections..
103 * which is what .const becomes due to rw var mistakenly placed on .const
104 */
105 Program.sectMap[".const:ti_sysbios_hal_ammu_AMMU_mmuInitConfig__C"] = "EXT_CODE";
106 Program.sectMap[".const:ti_sysbios_hal_ammu_AMMU_numLargePages__C"] = "EXT_CODE";
107 Program.sectMap[".const:ti_sysbios_hal_ammu_AMMU_numLinePages__C"] = "EXT_CODE";
108 Program.sectMap[".const:ti_sysbios_hal_ammu_AMMU_numMediumPages__C"] = "EXT_CODE";
109 Program.sectMap[".const:ti_sysbios_hal_ammu_AMMU_numSmallPages__C"] = "EXT_CODE";
111 /* ----------------------------- VERSION CONFIGURATION ---------------------*/
112 var commonBld = xdc.loadCapsule("build/common.bld");
113 commonBld.GetVersionTag();
115 /*
116 * ======== CODEC ENGINE configurations ========
117 */
119 var Global = xdc.useModule('ti.sdo.ce.osal.Global');
120 Global.runtimeEnv = Global.DSPBIOS;
122 xdc.useModule('ti.sdo.ce.global.Settings').profile = "debug";
123 xdc.loadPackage('ti.sdo.ce.video').profile = "debug";
124 xdc.loadPackage('ti.sdo.ce.video3').profile = "debug";
125 xdc.loadPackage('ti.sdo.ce.alg').profile = "debug";
126 xdc.useModule('ti.sdo.fc.global.Settings').profile = "debug";
127 xdc.loadPackage('ti.sdo.fc.rman').profile = "debug";
128 xdc.loadPackage('ti.sdo.fc.ires.hdvicp').profile = "debug";
129 xdc.loadPackage('ti.sdo.fc.ires.tiledmemory').profile = "debug";
130 xdc.loadPackage('ti.sdo.fc.utils').profile = "debug";
132 var ipcSettings = xdc.useModule('ti.sdo.ce.ipc.Settings');
133 ipcSettings.ipc = xdc.useModule('ti.sdo.ce.ipc.bios.Ipc');
134 // set to true to enable debugging of codec engine
135 xdc.useModule('ti.sdo.ce.Settings').checked = true;
137 /* Enable Memory Translation module that operates on the BIOS Resource Table */
138 var Resource = xdc.useModule('ti.ipc.remoteproc.Resource');
139 Resource.customTable = true;
141 //set All heaps of dskts as the default heap0
142 var DSKT2 = xdc.useModule('ti.sdo.fc.dskt2.DSKT2');
143 DSKT2.DARAM0 = "heap0";
144 DSKT2.DARAM1 = "heap0";
145 DSKT2.DARAM2 = "heap0";
146 DSKT2.SARAM0 = "heap0";
147 DSKT2.SARAM1 = "heap0";
148 DSKT2.SARAM2 = "heap0";
149 DSKT2.ESDATA = "heap0";
150 DSKT2.IPROG = "heap0";
151 DSKT2.EPROG = "heap0";
152 DSKT2.DSKT2_HEAP = "heap0";
154 var HDVICP20= xdc.useModule('ti.sdo.codecs.hdvicp20api.HDVICP20API');
156 //Remove these as it is done in ivahd.c
157 var HDVICP2 = xdc.useModule('ti.sdo.fc.ires.hdvicp.HDVICP2');
158 HDVICP2.memoryBaseAddress[0] = 0xBB000000;
159 HDVICP2.registerBaseAddress[0] = 0xBA000000;
160 if(Program.global.HwType == hw_OMAP5) {
161 if(Program.global.HwVer == ES20) {
162 print("Benelli Omap5: Setting PRCM Addresses ES2.0");
163 HDVICP2.resetControlAddress[0] = 0xAAE07210;
164 }
165 else {
166 print("Benelli Omap5: Setting PRCM Addresses ES1.0");
167 HDVICP2.resetControlAddress[0] = 0xAAE06F10;
168 }
169 }
170 else if(Program.global.HwType == hw_VAYU) {
171 if(Program.global.HwVer == ES10) {
172 print("Benelli Vayu: Setting PRCM Addresses ES1.0");
173 HDVICP2.memoryBaseAddress[0] = 0x7B000000;
174 HDVICP2.registerBaseAddress[0] = 0x7A000000;
175 HDVICP2.resetControlAddress[0] = 0x6AE07210;
176 }
177 else {
178 print("Benelli Vayu: E2.0 not there yet!!!!!!!!");
179 }
180 }
181 else {
182 HDVICP2.resetControlAddress[0] = 0xAA306F10;
183 print("Ducati omap4: Setting PRCM Addresses ES2.x");
184 }
185 HDVICP2.resetFxn = "ivahd_reset";
187 xdc.useModule('ti.sdo.fc.rman.RMAN');
189 // Load decoder/encoder APIs:
190 var VIDDEC3 = xdc.useModule('ti.sdo.ce.video3.IVIDDEC3');
191 var VIDENC2 = xdc.useModule('ti.sdo.ce.video2.IVIDENC2');
193 // load whatever codecs are available in the build
194 var codecs = [];
196 function loadCodec(pkg, name)
197 {
198 try {
199 var codec = xdc.useModule(pkg);
200 print('loading: ' + name);
201 codecs.push({ name: name, mod: codec, local: true });
202 } catch(e) {
203 print('no package: ' + pkg);
204 }
205 }
207 loadCodec('ti.sdo.codecs.mpeg4vdec.ce.MPEG4VDEC', 'ivahd_mpeg4dec');
208 loadCodec('ti.sdo.codecs.h264vdec.ce.H264VDEC', 'ivahd_h264dec');
209 loadCodec('ti.sdo.codecs.jpegvdec.ce.JPEGVDEC', 'ivahd_jpegvdec');
210 loadCodec('ti.sdo.codecs.vc1vdec.ce.VC1VDEC', 'ivahd_vc1vdec');
211 loadCodec('ti.sdo.codecs.mpeg2vdec.ce.MPEG2VDEC','ivahd_mpeg2vdec');
212 loadCodec('ti.sdo.codecs.h264enc.ce.H264ENC', 'ivahd_h264enc');
213 loadCodec('ti.sdo.codecs.mpeg4enc.ce.MPEG4ENC', 'ivahd_mpeg4enc');
215 var engine = xdc.useModule('ti.sdo.ce.Engine');
216 var myEngine = engine.create("ivahd_vidsvr", codecs);
218 xdc.useModule('ti.sysbios.knl.Task');
219 var Task = xdc.useModule('ti.sysbios.knl.Task');
220 Task.defaultStackSize = 12 * 0x400;
222 // Enable load computation.
223 var Load = xdc.useModule('ti.sysbios.smp.Load');
224 Load.updateInIdle = true;
225 Load.windowInMs = 11;
227 /* ----------------------------- Configure BIOS--------------------------------*/
229 BIOS = xdc.useModule('ti.sysbios.BIOS');
230 BIOS.addUserStartupFunction('&IpcMgr_rpmsgStartup');
232 BIOS.clockEnabled = true;
233 BIOS.libType = BIOS.LibType_Custom;
234 if(Program.global.enableSMP)
235 {
236 print("SMP Enabled BIOS");
237 /* --- SMP is enabled using a common BIOS version ----------*/
238 BIOS.smpEnabled = true;
239 /* ---- disabling BIOS logs and asserts for performance ----*/
240 BIOS.logsEnabled = false;
241 BIOS.assertsEnabled = false;
242 }
243 else
244 {
245 /* --- SMP is enabled using a common BIOS version ----------*/
246 BIOS.smpEnabled = false;
247 }
249 var Settings = xdc.useModule('ti.sysbios.posix.Settings');
250 Settings.supportsMutexPriority = true;
252 var Timer = xdc.useModule('ti.sysbios.timers.dmtimer.Timer');
253 if(Program.global.HwType == hw_OMAP5)
254 {
255 /*
256 The value in Timer.intFreq.lo need to match the configured value of
257 register CM_CLKSEL_SYS.SYS_CLKSEL.
258 For OMAP5, the SYSCLK is set to 19.2MHz.
259 */
260 Timer.intFreq.hi = 0;
261 Timer.intFreq.lo = 19200000;
262 }
263 else if(Program.global.HwType == hw_VAYU)
264 {
265 /*
266 The value in Timer.intFreq.lo need to match the configured value of
267 register CM_CLKSEL_SYS.SYS_CLKSEL.
268 For Vayu (DRA7xx), the SYSCLK is set to 20MHz.
269 */
270 Timer.intFreq.hi = 0;
271 Timer.intFreq.lo = 20000000;
272 }
274 /* IPC 3.x is no longer providing version capability. If needed, then IPC needs to implement it. */
275 /* Version module; this will produce a .version section with trees infos. Read
276 * with "readelf -p .version <base_image>" */
277 // xdc.useModule('ti.utils.Version');
279 /*************************/
280 /* PSI KPI hooks - begin */
281 /*************************/
282 if (cfgArgs.psi_kpi_hooks) {
283 var Swi = xdc.useModule('ti.sysbios.knl.Swi');
284 var Hwi = xdc.useModule('ti.sysbios.family.arm.m3.Hwi');
285 /* Enable instance names */
286 Task.common$.namedInstance = true;
287 Swi.common$.namedInstance = true;
288 Hwi.common$.namedInstance = true;
289 /* Define and add one Task Hook Set */
290 Task.addHookSet({
291 switchFxn: '&psi_kpi_task_switch',
292 });
293 Swi.addHookSet({
294 beginFxn: '&psi_kpi_swi_begin',
295 endFxn: '&psi_kpi_swi_end',
296 });
297 Hwi.addHookSet({
298 beginFxn: '&psi_kpi_hwi_begin',
299 endFxn: '&psi_kpi_hwi_end',
300 });
301 }/*cfgArgs.psi_kpi_inst*/
302 /*************************/
303 /* PSI KPI hooks - end */
304 /*************************/