4cf211c5c857ea1a7994abd59e66eb78d27e6801
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_04/pasdk/shared/ipc.cfg.xs");
86 /* select ipc libraries */
87 var Build = xdc.useModule('ti.sdo.ipc.Build');
88 Build.libType = (RB ? Build.LibType_NonInstrumented : Build.LibType_Debug);
89 Build.assertsEnabled = (RB ? false : true);
90 Build.logsEnabled = (RB ? false : true);
93 /*
94 * Uncomment this line to globally disable Asserts.
95 * All modules inherit the default from the 'Defaults' module. You
96 * can override these defaults on a per-module basis using Module.common$.
97 * Disabling Asserts will save code space and improve runtime performance.
98 Defaults.common$.diags_ASSERT = Diags.ALWAYS_OFF;
99 */
101 /*
102 * Uncomment this line to keep module names from being loaded on the target.
103 * The module name strings are placed in the .const section. Setting this
104 * parameter to false will save space in the .const section. Error and
105 * Assert messages will contain an "unknown module" prefix instead
106 * of the actual module name.
107 Defaults.common$.namedModule = false;
108 */
110 /*
111 * Minimize exit handler array in System. The System module includes
112 * an array of functions that are registered with System_atexit() to be
113 * called by System_exit().
114 */
115 System.maxAtexitHandlers = 4;
117 /*
118 * Uncomment this line to disable the Error print function.
119 * We lose error information when this is disabled since the errors are
120 * not printed. Disabling the raiseHook will save some code space if
121 * your app is not using System_printf() since the Error_print() function
122 * calls System_printf().
123 Error.raiseHook = null;
124 */
126 /*
127 * Uncomment this line to keep Error, Assert, and Log strings from being
128 * loaded on the target. These strings are placed in the .const section.
129 * Setting this parameter to false will save space in the .const section.
130 * Error, Assert and Log message will print raw ids and args instead of
131 * a formatted message.
132 Text.isLoaded = false;
133 */
135 /*
136 * Uncomment this line to disable the output of characters by SysMin
137 * when the program exits. SysMin writes characters to a circular buffer.
138 * This buffer can be viewed using the SysMin Output view in ROV.
139 SysMin.flushAtExit = false;
140 */
142 /*
143 * The BIOS module will create the default heap for the system.
144 * Specify the size of this default heap.
145 */
146 //BIOS.heapSize = 0x1000; // initial setting
147 BIOS.heapSize = 0x2000; // from pa.cfg
148 BIOS.heapSection = ".systemHeap";
149 Program.sectMap[".systemHeap"] = "HOST_DDR3";
151 if (xdc.global.SrDDr3_2Mem_cacheEnable == false)
152 {
153 // Disable cache on ARM for the shared memory region
154 var Mmu = xdc.useModule('ti.sysbios.family.arm.a15.Mmu');
156 // descriptor attribute structure
157 var attrs = new Mmu.DescriptorAttrs();
159 // Note: If running in SMP mode, all page table entries for memory
160 // shared between the SMP cores should mark the memory as
161 // inner-shareable. This is to ensure that the cached copy of
162 // the memory region is kept coherent accross cores.
164 Mmu.initDescAttrsMeta(attrs);
165 attrs.type = Mmu.DescriptorType_BLOCK; // BLOCK descriptor
166 attrs.shareable = 2; //3; // 2 - outer-sharerable
167 attrs.attrIndx = 0;//2; // MAIR0 Byte2 describes
168 // memory attributes for
169 // this level2 entry
171 // write memory region attribute in mairRegAttr[2] i.e. MAIR0 Reg Byte2
172 Mmu.setMAIRMeta(0, 0x44); // Mark mem regions as non-cacheable
174 /* Get a handle to the C64P Target */
175 // TODO: remove hardcoded address and get correct values from .bld
176 var COMMON2_DDR3_base = 0x81000000;
177 var COMMON2_DDR3_end = 0x81000000 + 0x01000000;
178 // Set the descriptor for each entry in the address range
179 for (var i=COMMON2_DDR3_base; i < COMMON2_DDR3_end; i = i + 0x00200000) {
180 // Each 'BLOCK' descriptor entry spans a 2MB address range
181 Mmu.setSecondLevelDescMeta(i, i, attrs);
182 }
183 }
185 /*
186 * Build a custom SYS/BIOS library from sources.
187 */
188 BIOS.libType = (RB ? BIOS.LibType_NonInstrumented : BIOS.LibType_Instrumented);
189 // BIOS.libType = BIOS.LibType_Custom;
190 // BIOS.libType = BIOS.LibType_Debug;
192 /* System stack size (used by ISRs and Swis) */
193 Program.stack = 0x2000;
194 Program.sectMap[".stack"] = "HOST_MSMC";
196 /* Circular buffer size for System_printf() */
197 SysMin.bufSize = 0x200;
199 System.SupportProxy = SysMin;
201 /* ------ */
202 /* Set CPU frequency to 600 MHz */
203 BIOS.cpuFreq.lo = 600000000;
204 BIOS.cpuFreq.hi = 0;
206 /* Set Sysclock period (usec.) */
207 Clock.tickPeriod = 1000; // FL: measured period ~852 usec.??
209 /* Configure Logging */
210 LoggingSetup.loggerType = LoggingSetup.LoggerType_STOPMODE;
211 LoggingSetup.sysbiosTaskLogging = false; //true;
212 LoggingSetup.sysbiosSwiLogging = false; // no Swi's in system
213 LoggingSetup.sysbiosHwiLogging = false; //true;
214 //LoggingSetup.sysbiosLoggerSize = 16384;
215 LoggingSetup.loadLogging = false; //true;
216 LoggingSetup.mainLogging = true; // false;
217 LoggingSetup.mainLoggingRuntimeControl = false;
218 LoggingSetup.mainLoggerSize = 81960;
219 //LoggingSetup.memorySectionName = "HOST_DDR3"; //"HOST_MSMC";
222 /* Configure Load Logging */ // FL: doesn't work
223 //Load.taskEnabled = true;
224 //Load.hwiEnabled = true;
225 //Load.common$.diags_USER4 = Diags.ALWAYS_ON;
227 //Task.common$.diags_USER1 = Diags.ALWAYS_ON;
228 Task.common$.diags_INFO = Diags.ALWAYS_ON;
230 /* Disallow nested hardware interrupts */
231 Hwi.dispatcherAutoNestingSupport = false;
233 var ProjName = environment["ProjName"];
234 var topo = ProjName.replace( /pa_([a-z])[0-9]+_.*/, "$1");
235 var AudioClockSim = environment["AudioClockSim"];
236 var acSimBuild = (AudioClockSim == "1" ? true : false);
238 if (acSimBuild == true)
239 {
240 //
241 // IPC simulation
242 //
244 /* Add timer to simulate Rx audio IPC message */
245 var timer0Params = new Timer.Params();
246 timer0Params.instance.name = "timerRxAudio";
247 timer0Params.period = 5330;
248 timer0Params.startMode = xdc.module("ti.sysbios.interfaces.ITimer").StartMode_USER;
249 Program.global.timerRxAudio = Timer.create(1, null, timer0Params);
251 /* Add timer to simulate Tx audio IPC message */
252 var timer1Params = new Timer.Params();
253 timer1Params.instance.name = "timerTxAudio";
254 timer1Params.startMode = xdc.module("ti.sysbios.interfaces.ITimer").StartMode_USER;
255 timer1Params.period = 5330;
256 Program.global.timerTxAudio = Timer.create(2, null, timer1Params);
258 /* Add semaphore for Rx audio DMA */
259 var semaphore0Params = new Semaphore.Params();
260 semaphore0Params.instance.name = "semaphoreRxAudio";
261 Program.global.semaphoreRxAudio = Semaphore.create(null, semaphore0Params);
263 /* Add semaphore for Tx audio DMA */
264 var semaphore1Params = new Semaphore.Params();
265 semaphore1Params.instance.name = "semaphoreTxAudio";
266 Program.global.semaphoreTxAudio = Semaphore.create(null, semaphore1Params);
267 }
269 /* Set default stack size for tasks */
270 Task.defaultStackSize = 2048;
272 /* Set size of idle task stack */
273 Task.idleTaskStackSize = 2048;
275 /* Add Audio Stream Decode Processing (ASDP) task */
276 var task0Params = new Task.Params();
277 task0Params.instance.name = "TaskAsdp";
278 task0Params.stackSize = 0x8000;
279 task0Params.stackSection = ".far:taskStackSectionAsdp";
280 //task0Params.arg0 = 0;
281 task0Params.arg0 = $externPtr("asdp_params_PA" + topo);
282 task0Params.arg1 = $externPtr("asdp_patchs_PA" + topo);
283 task0Params.priority = -1; //3;
284 Program.global.TaskAsdp = Task.create("&taskAsdpFxn", task0Params);
285 Program.sectMap[".far:taskStackSectionAsdp"] = "HOST_MSMC";
287 /* Add System Initialization task */
288 var task1Params = new Task.Params();
289 task1Params.instance.name = "TaskSysInit";
290 task1Params.stackSize = 0x1000;
291 task1Params.stackSection = ".far:taskStackSectionSysInit";
292 task1Params.priority = 4;
293 Program.global.TaskSysInit = Task.create("&taskSysInitFxn", task1Params);
294 Program.sectMap[".far:taskStackSectionSysInit"] = "HOST_DDR3";
296 Program.sectMap[".far:taskStackSection"] = "HOST_DDR3"; // SDRAM in pa.cfg
298 // Dec ip circular buffer will be in MSMC, size~=180 kB.
299 // Dec op circular buffer will be in MSMC, size~=192 kB.
300 // However, both buffers will be in Shared Region MSMC.
301 // So this is heap is for other use local to ARM (e.g. Dec chain). Set to 128 kB for now.
302 /* Add MSMC SRAM heap */ // formerly L3RAM
303 var heapMem1Params = new HeapMem.Params();
304 heapMem1Params.instance.name = "heapMemMsmcSram";
305 heapMem1Params.size = 224*1024; //128*1024
306 heapMem1Params.sectionName = ".msmcSramHeap";
307 Program.global.heapMemMsmcSram = HeapMem.create(heapMem1Params);
308 Program.sectMap[".msmcSramHeap"] = "HOST_MSMC";
310 /* Add DDR3 heap */ // formerly SDRAM
311 var heapMem2Params = new HeapMem.Params();
312 heapMem2Params.instance.name = "heapMemDdr3";
313 heapMem2Params.size = 5350528+ (3*1024*1024); // Added 3 MB for DTS decoder;//4350528;
314 heapMem2Params.sectionName = ".ddr3Heap";
315 Program.global.heapMemDdr3 = HeapMem.create(heapMem2Params);
316 Program.sectMap[".ddr3Heap"] = "HOST_DDR3";
318 Program.global.heapMemL2Sram = Program.global.heapMemMsmcSram;
320 //Program.sectMap[".globalSectionPafAstConfig"] = "COMMON_DDR3";
321 //Program.sectMap[".globalSectionAcpStdBetaTable"] = "COMMON_DDR3";
323 /* Define HWI Hook Set for PFP */
324 Hwi.addHookSet({
325 registerFxn: '&pfpHwiRegister',
326 createFxn: '&pfpHwiCreate',
327 beginFxn: '&pfpHwiBegin',
328 endFxn: '&pfpHwiEnd',
329 deleteFxn: null,
330 });
332 /* Define SWI Hook Set for PFP */
333 Swi.addHookSet({
334 registerFxn: '&pfpSwiRegister', // need this for Id for Hook context
335 createFxn: '&pfpSwiCreate', // malloc context storage space
336 readyFxn: '&pfpSwiReady',
337 beginFxn: '&pfpSwiBegin',
338 endFxn: '&pfpSwiEnd',
339 deleteFxn: null,
340 });
342 /* Define Task Hook Set for PFP */
343 Task.addHookSet({
344 registerFxn: '&pfpTaskRegister',
345 createFxn: '&pfpTaskCreate',
346 readyFxn: '&pfpTaskReady',
347 switchFxn: '&pfpTaskSwitch',
348 exitFxn: null,
349 deleteFxn: null,
350 });
352 /* Added for PFP, not necessary */
353 Hwi.common$.namedInstance=true;
354 Swi.common$.namedInstance=true;
355 Task.common$.namedInstance=true;