1 /*
2 Copyright (c) 2017, Texas Instruments Incorporated - http://www.ti.com/
3 All rights reserved.
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
15 * distribution.
16 *
17 * Neither the name of Texas Instruments Incorporated nor the names of
18 * its contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 *
33 */
36 /*
37 * ======== app.cfg ========
38 * Platform: 66AK2G_bios_elf
39 * Target: gnu.targets.arm.A15F
40 */
42 /* root of the configuration object model */
43 var Program = xdc.useModule('xdc.cfg.Program');
44 var cfgArgs = Program.build.cfgArgs;
45 var RB = (cfgArgs.profile == "release" ? true : false);
47 /* application uses the following modules and packages */
48 var Defaults = xdc.useModule('xdc.runtime.Defaults');
49 var Diags = xdc.useModule('xdc.runtime.Diags');
50 var Error = xdc.useModule('xdc.runtime.Error');
51 var Log = xdc.useModule('xdc.runtime.Log');
52 var Main = xdc.useModule('xdc.runtime.Main');
53 var Memory = xdc.useModule('xdc.runtime.Memory')
54 var SysMin = xdc.useModule('xdc.runtime.SysMin');
55 var System = xdc.useModule('xdc.runtime.System');
56 var Text = xdc.useModule('xdc.runtime.Text');
58 var BIOS = xdc.useModule('ti.sysbios.BIOS');
59 var GateAll = xdc.useModule('ti.sysbios.gates.GateAll'); // Added for PFP
60 var Hwi = xdc.useModule('ti.sysbios.hal.Hwi');
61 var Timer = xdc.useModule('ti.sysbios.hal.Timer');
62 var Clock = xdc.useModule('ti.sysbios.knl.Clock');
63 var Idle = xdc.useModule('ti.sysbios.knl.Idle');
64 var Swi = xdc.useModule('ti.sysbios.knl.Swi'); // Added for PFP, no SWIs on ARM
65 var Task = xdc.useModule('ti.sysbios.knl.Task');
66 var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore');
67 var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
68 var Load = xdc.useModule('ti.sysbios.utils.Load');
70 var LoggingSetup = xdc.useModule('ti.uia.sysbios.LoggingSetup');
71 var UIAEvt = xdc.useModule('ti.uia.events.UIAEvt');
73 xdc.useModule('ti.sdo.utils.MultiProc');
76 /*
77 * ======== IPC Configuration ========
78 */
79 xdc.global.SR0_cacheEnable = true;
80 xdc.global.SrMsmcMem_cacheEnable = true;
81 xdc.global.SrDDr3Mem_cacheEnable = true;
82 xdc.global.SrDDr3_2Mem_cacheEnable = false;
83 xdc.global.procName = "HOST";
84 /* var ipc_cfg = xdc.loadCapsule("C:/ti/processor_audio_sdk_1_00_00_05/pasdk/shared/ipc.cfg.xs"); */
85 var ipc_cfg = xdc.loadCapsule("../../shared/ipc.cfg.xs");
87 /* select ipc libraries */
88 var Build = xdc.useModule('ti.sdo.ipc.Build');
89 Build.libType = (RB ? Build.LibType_NonInstrumented : Build.LibType_Debug);
90 Build.assertsEnabled = (RB ? false : true);
91 Build.logsEnabled = (RB ? false : true);
94 /*
95 * Uncomment this line to globally disable Asserts.
96 * All modules inherit the default from the 'Defaults' module. You
97 * can override these defaults on a per-module basis using Module.common$.
98 * Disabling Asserts will save code space and improve runtime performance.
99 Defaults.common$.diags_ASSERT = Diags.ALWAYS_OFF;
100 */
102 /*
103 * Uncomment this line to keep module names from being loaded on the target.
104 * The module name strings are placed in the .const section. Setting this
105 * parameter to false will save space in the .const section. Error and
106 * Assert messages will contain an "unknown module" prefix instead
107 * of the actual module name.
108 Defaults.common$.namedModule = false;
109 */
111 /*
112 * Minimize exit handler array in System. The System module includes
113 * an array of functions that are registered with System_atexit() to be
114 * called by System_exit().
115 */
116 System.maxAtexitHandlers = 4;
118 /*
119 * Uncomment this line to disable the Error print function.
120 * We lose error information when this is disabled since the errors are
121 * not printed. Disabling the raiseHook will save some code space if
122 * your app is not using System_printf() since the Error_print() function
123 * calls System_printf().
124 Error.raiseHook = null;
125 */
127 /*
128 * Uncomment this line to keep Error, Assert, and Log strings from being
129 * loaded on the target. These strings are placed in the .const section.
130 * Setting this parameter to false will save space in the .const section.
131 * Error, Assert and Log message will print raw ids and args instead of
132 * a formatted message.
133 Text.isLoaded = false;
134 */
136 /*
137 * Uncomment this line to disable the output of characters by SysMin
138 * when the program exits. SysMin writes characters to a circular buffer.
139 * This buffer can be viewed using the SysMin Output view in ROV.
140 SysMin.flushAtExit = false;
141 */
143 /*
144 * The BIOS module will create the default heap for the system.
145 * Specify the size of this default heap.
146 */
147 //BIOS.heapSize = 0x1000; // initial setting
148 BIOS.heapSize = 0x2000; // from pa.cfg
149 BIOS.heapSection = ".systemHeap";
150 Program.sectMap[".systemHeap"] = "HOST_DDR3";
152 if (xdc.global.SrDDr3_2Mem_cacheEnable == false)
153 {
154 // Disable cache on ARM for the shared memory region
155 var Mmu = xdc.useModule('ti.sysbios.family.arm.a15.Mmu');
157 // descriptor attribute structure
158 var attrs = new Mmu.DescriptorAttrs();
160 // Note: If running in SMP mode, all page table entries for memory
161 // shared between the SMP cores should mark the memory as
162 // inner-shareable. This is to ensure that the cached copy of
163 // the memory region is kept coherent accross cores.
165 Mmu.initDescAttrsMeta(attrs);
166 attrs.type = Mmu.DescriptorType_BLOCK; // BLOCK descriptor
167 attrs.shareable = 2; //3; // 2 - outer-sharerable
168 attrs.attrIndx = 0;//2; // MAIR0 Byte2 describes
169 // memory attributes for
170 // this level2 entry
172 // write memory region attribute in mairRegAttr[2] i.e. MAIR0 Reg Byte2
173 Mmu.setMAIRMeta(0, 0x44); // Mark mem regions as non-cacheable
175 /* Get a handle to the C64P Target */
176 // TODO: remove hardcoded address and get correct values from .bld
177 var COMMON2_DDR3_base = 0x81000000;
178 var COMMON2_DDR3_end = 0x81000000 + 0x01000000;
179 // Set the descriptor for each entry in the address range
180 for (var i=COMMON2_DDR3_base; i < COMMON2_DDR3_end; i = i + 0x00200000) {
181 // Each 'BLOCK' descriptor entry spans a 2MB address range
182 Mmu.setSecondLevelDescMeta(i, i, attrs);
183 }
184 }
186 /*
187 * Build a custom SYS/BIOS library from sources.
188 */
189 BIOS.libType = (RB ? BIOS.LibType_NonInstrumented : BIOS.LibType_Instrumented);
190 // BIOS.libType = BIOS.LibType_Custom;
191 // BIOS.libType = BIOS.LibType_Debug;
193 /* System stack size (used by ISRs and Swis) */
194 Program.stack = 0x2000;
195 Program.sectMap[".stack"] = "HOST_MSMC";
197 /* Circular buffer size for System_printf() */
198 SysMin.bufSize = 0x200;
200 System.SupportProxy = SysMin;
202 /* ------ */
203 /* Set CPU frequency to 600 MHz */
204 BIOS.cpuFreq.lo = 600000000;
205 BIOS.cpuFreq.hi = 0;
207 /* Set Sysclock period (usec.) */
208 Clock.tickPeriod = 1000; // FL: measured period ~852 usec.??
210 /* Configure Logging */
211 LoggingSetup.loggerType = LoggingSetup.LoggerType_STOPMODE;
212 LoggingSetup.sysbiosTaskLogging = false; //true;
213 LoggingSetup.sysbiosSwiLogging = false; // no Swi's in system
214 LoggingSetup.sysbiosHwiLogging = false; //true;
215 //LoggingSetup.sysbiosLoggerSize = 16384;
216 LoggingSetup.loadLogging = false; //true;
217 LoggingSetup.mainLogging = true; // false;
218 LoggingSetup.mainLoggingRuntimeControl = false;
219 LoggingSetup.mainLoggerSize = 81960;
220 //LoggingSetup.memorySectionName = "HOST_DDR3"; //"HOST_MSMC";
223 /* Configure Load Logging */ // FL: doesn't work
224 //Load.taskEnabled = true;
225 //Load.hwiEnabled = true;
226 //Load.common$.diags_USER4 = Diags.ALWAYS_ON;
228 //Task.common$.diags_USER1 = Diags.ALWAYS_ON;
229 Task.common$.diags_INFO = Diags.ALWAYS_ON;
231 /* Disallow nested hardware interrupts */
232 Hwi.dispatcherAutoNestingSupport = false;
234 var ProjName = environment["ProjName"];
235 var topo = ProjName.replace( /pa_([a-z])[0-9]+_.*/, "$1");
236 var AudioClockSim = environment["AudioClockSim"];
237 var acSimBuild = (AudioClockSim == "1" ? true : false);
239 if (acSimBuild == true)
240 {
241 //
242 // IPC simulation
243 //
245 /* Add timer to simulate Rx audio IPC message */
246 var timer0Params = new Timer.Params();
247 timer0Params.instance.name = "timerRxAudio";
248 timer0Params.period = 5330;
249 timer0Params.startMode = xdc.module("ti.sysbios.interfaces.ITimer").StartMode_USER;
250 Program.global.timerRxAudio = Timer.create(1, null, timer0Params);
252 /* Add timer to simulate Tx audio IPC message */
253 var timer1Params = new Timer.Params();
254 timer1Params.instance.name = "timerTxAudio";
255 timer1Params.startMode = xdc.module("ti.sysbios.interfaces.ITimer").StartMode_USER;
256 timer1Params.period = 5330;
257 Program.global.timerTxAudio = Timer.create(2, null, timer1Params);
259 /* Add semaphore for Rx audio DMA */
260 var semaphore0Params = new Semaphore.Params();
261 semaphore0Params.instance.name = "semaphoreRxAudio";
262 Program.global.semaphoreRxAudio = Semaphore.create(null, semaphore0Params);
264 /* Add semaphore for Tx audio DMA */
265 var semaphore1Params = new Semaphore.Params();
266 semaphore1Params.instance.name = "semaphoreTxAudio";
267 Program.global.semaphoreTxAudio = Semaphore.create(null, semaphore1Params);
268 }
270 /* Set default stack size for tasks */
271 Task.defaultStackSize = 2048;
273 /* Set size of idle task stack */
274 Task.idleTaskStackSize = 2048;
276 /* Add Audio Stream Decode Processing (ASDP) task */
277 var task0Params = new Task.Params();
278 task0Params.instance.name = "TaskAsdp";
279 task0Params.stackSize = (0x8000+0x1000);
280 task0Params.stackSection = ".far:taskStackSectionAsdp";
281 //task0Params.arg0 = 0;
282 task0Params.arg0 = $externPtr("asdp_params_PA" + topo);
283 task0Params.arg1 = $externPtr("asdp_patchs_PA" + topo);
284 task0Params.priority = -1; //3;
285 Program.global.TaskAsdp = Task.create("&taskAsdpFxn", task0Params);
286 Program.sectMap[".far:taskStackSectionAsdp"] = "HOST_MSMC";
288 /* Add System Initialization task */
289 var task1Params = new Task.Params();
290 task1Params.instance.name = "TaskSysInit";
291 task1Params.stackSize = 0x1000;
292 task1Params.stackSection = ".far:taskStackSectionSysInit";
293 task1Params.priority = 4;
294 Program.global.TaskSysInit = Task.create("&taskSysInitFxn", task1Params);
295 Program.sectMap[".far:taskStackSectionSysInit"] = "HOST_DDR3";
297 Program.sectMap[".far:taskStackSection"] = "HOST_DDR3"; // SDRAM in pa.cfg
299 // Dec ip circular buffer will be in MSMC, size~=180 kB.
300 // Dec op circular buffer will be in MSMC, size~=192 kB.
301 // However, both buffers will be in Shared Region MSMC.
302 // So this is heap is for other use local to ARM (e.g. Dec chain). Set to 128 kB for now.
303 /* Add MSMC SRAM heap */ // formerly L3RAM
304 var heapMem1Params = new HeapMem.Params();
305 heapMem1Params.instance.name = "heapMemMsmcSram";
306 heapMem1Params.size = (224-4)*1024; //128*1024
307 heapMem1Params.sectionName = ".msmcSramHeap";
308 Program.global.heapMemMsmcSram = HeapMem.create(heapMem1Params);
309 Program.sectMap[".msmcSramHeap"] = "HOST_MSMC";
311 /* Add DDR3 heap */ // formerly SDRAM
312 var heapMem2Params = new HeapMem.Params();
313 heapMem2Params.instance.name = "heapMemDdr3";
314 heapMem2Params.size = 5350528+ (3*1024*1024); // Added 3 MB for DTS decoder;//4350528;
315 heapMem2Params.sectionName = ".ddr3Heap";
316 Program.global.heapMemDdr3 = HeapMem.create(heapMem2Params);
317 Program.sectMap[".ddr3Heap"] = "HOST_DDR3";
319 Program.global.heapMemL2Sram = Program.global.heapMemMsmcSram;
321 //Program.sectMap[".globalSectionPafAstConfig"] = "COMMON_DDR3";
322 //Program.sectMap[".globalSectionAcpStdBetaTable"] = "COMMON_DDR3";
324 /* Define HWI Hook Set for PFP */
325 Hwi.addHookSet({
326 registerFxn: '&pfpHwiRegister',
327 createFxn: '&pfpHwiCreate',
328 beginFxn: '&pfpHwiBegin',
329 endFxn: '&pfpHwiEnd',
330 deleteFxn: null,
331 });
333 /* Define SWI Hook Set for PFP */
334 Swi.addHookSet({
335 registerFxn: '&pfpSwiRegister', // need this for Id for Hook context
336 createFxn: '&pfpSwiCreate', // malloc context storage space
337 readyFxn: '&pfpSwiReady',
338 beginFxn: '&pfpSwiBegin',
339 endFxn: '&pfpSwiEnd',
340 deleteFxn: null,
341 });
343 /* Define Task Hook Set for PFP */
344 Task.addHookSet({
345 registerFxn: '&pfpTaskRegister',
346 createFxn: '&pfpTaskCreate',
347 readyFxn: '&pfpTaskReady',
348 switchFxn: '&pfpTaskSwitch',
349 exitFxn: null,
350 deleteFxn: null,
351 });
353 /* Added for PFP, not necessary */
354 Hwi.common$.namedInstance=true;
355 Swi.common$.namedInstance=true;
356 Task.common$.namedInstance=true;