4bbeb6b5a56bee70d2082a7d6180a0f17d2c51f8
[processor-sdk/performance-audio-sr.git] / processor_audio_sdk_1_00_00_00 / pasdk / test_dsp / application / app.cfg
2 /*
3 Copyright (c) 2016, Texas Instruments Incorporated - http://www.ti.com/
4 All rights reserved.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 *
13 * Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the
16 * distribution.
17 *
18 * Neither the name of Texas Instruments Incorporated nor the names of
19 * its contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 *
34 */
36 /*
37 * ======== app.cfg ========
38 * Platform: 66AK2G_bios_elf
39 * Target: ti.targets.elf.C66
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 Hwi = xdc.useModule('ti.sysbios.hal.Hwi');
60 var Cache = xdc.useModule('ti.sysbios.hal.Cache');
61 var Timer = xdc.useModule('ti.sysbios.hal.Timer');
62 var HeapBuf = xdc.useModule('ti.sysbios.heaps.HeapBuf');
63 var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
64 var Clock = xdc.useModule('ti.sysbios.knl.Clock');
65 var Idle = xdc.useModule('ti.sysbios.knl.Idle');
66 var Queue = xdc.useModule('ti.sysbios.knl.Queue');
67 var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore');
68 var Task = xdc.useModule('ti.sysbios.knl.Task');
69 var Load = xdc.useModule('ti.sysbios.utils.Load');
71 var LoggingSetup = xdc.useModule('ti.uia.sysbios.LoggingSetup');
72 var UIAEvt = xdc.useModule('ti.uia.events.UIAEvt');
74 var ECM = xdc.useModule('ti.sysbios.family.c64p.EventCombiner');
76 xdc.useModule('ti.sdo.utils.MultiProc');
78 /*
79 * ======== IPC Configuration ========
80 */
81 xdc.global.SR0_cacheEnable = true;
82 xdc.global.SrMsmcMem_cacheEnable = true;
83 xdc.global.SrDDr3Mem_cacheEnable = true;
84 xdc.global.procName = "CORE0";
85 var ipc_cfg = xdc.loadCapsule("C:/ti/processor_audio_sdk_1_00_00_00/pasdk/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"] = "CORE0_DDR3";
152 /*
153 * Build a custom SYS/BIOS library from sources.
154 */
155 BIOS.libType = (RB ? BIOS.LibType_NonInstrumented : BIOS.LibType_Instrumented);
156 // BIOS.libType = BIOS.LibType_Custom;
157 // BIOS.libType = BIOS.LibType_Debug;
159 /* System stack size (used by ISRs and Swis) */
160 Program.stack = 0x2000;
161 Program.sectMap[".stack"] = "L2SRAM"
163 /* Circular buffer size for System_printf() */
164 SysMin.bufSize = 0x200;
166 System.SupportProxy = SysMin;
168 /* ------ */
169 /* Set CPU frequency to 600 MHz */
170 BIOS.cpuFreq.lo = 600000000;
171 BIOS.cpuFreq.hi = 0;
173 /* Set Sysclock period (usec.) */
174 Clock.tickPeriod = 1000;
176 /* Configure Logging */
177 LoggingSetup.loggerType = LoggingSetup.LoggerType_STOPMODE; // LoggerType_JTAGRUNMODE
178 LoggingSetup.sysbiosTaskLogging = false; // true;
179 LoggingSetup.sysbiosSwiLogging = false;
180 LoggingSetup.sysbiosHwiLogging = false; // true
181 //LoggingSetup.sysbiosLoggerSize = 16384;
182 LoggingSetup.loadLogging = false; //true;
183 LoggingSetup.mainLogging = true;
184 LoggingSetup.mainLoggingRuntimeControl = false;
185 LoggingSetup.mainLoggerSize = 81960;
186 //LoggingSetup.memorySectionName = "CORE0_DDR3"; //"CORE0_MSMC";
188 /* Configure Load Logging */ // FL: doesn't work
189 //Load.taskEnabled = true;
190 //Load.hwiEnabled = true;
191 //Load.common$.diags_USER4 = Diags.ALWAYS_ON;
193 //Task.common$.diags_USER1 = Diags.ALWAYS_ON;
194 Task.common$.diags_INFO = Diags.ALWAYS_ON;
196 /* Disallow nested hardware interrupts */
197 Hwi.dispatcherAutoNestingSupport = false;
199 var ProjName = environment["ProjName"];
200 var topo = ProjName.replace( /pa_([a-z])[0-9]+_.*/, "$1");
201 var AudioClockSim = environment["AudioClockSim"];
202 var acSimBuild = (AudioClockSim == "1" ? true : false);
203 var RxAlphaSim = environment["RxAlphaSim"];
204 var rxAlphaSimBuild = (RxAlphaSim == "1" ? true : false);
206 if (acSimBuild == false)
207 {
208 var Edma = xdc.loadPackage('ti.sdo.edma3.drv');
209 }
210 else
211 {
212 //
213 // SIO simulation
214 //
216 /* Add timer to simulate Rx audio DMA */
217 var timer0Params = new Timer.Params();
218 timer0Params.instance.name = "timerRxAudio";
219 timer0Params.period = 5330;
220 timer0Params.startMode = xdc.module("ti.sysbios.interfaces.ITimer").StartMode_USER;
221 Program.global.timerRxAudio = Timer.create(1, null, timer0Params);
223 /* Add timer to simulate Tx audio DMA */
224 var timer1Params = new Timer.Params();
225 timer1Params.instance.name = "timerTxAudio";
226 timer1Params.startMode = xdc.module("ti.sysbios.interfaces.ITimer").StartMode_USER;
227 timer1Params.period = 5330;
228 Program.global.timerTxAudio = Timer.create(2, null, timer1Params);
230 /* Add semaphore for Rx audio DMA */
231 var semaphore0Params = new Semaphore.Params();
232 semaphore0Params.instance.name = "semaphoreRxAudio";
233 Program.global.semaphoreRxAudio = Semaphore.create(null, semaphore0Params);
235 /* Add semaphore for Tx audio DMA */
236 var semaphore1Params = new Semaphore.Params();
237 semaphore1Params.instance.name = "semaphoreTxAudio";
238 Program.global.semaphoreTxAudio = Semaphore.create(null, semaphore1Params);
239 }
241 if (rxAlphaSimBuild == false)
242 {
243 var devType = "k2g"
245 var CpIntc = xdc.useModule('ti.sysbios.family.c66.tci66xx.CpIntc');
247 /* Load the OSAL package */
248 var osType = "tirtos";
249 var Osal = xdc.useModule('ti.osal.Settings');
250 Osal.osType = osType;
251 Osal.socType = devType;
253 /* Load the uart package */
254 var Uart = xdc.loadPackage('ti.drv.uart');
255 Uart.Settings.enableProfiling = false;
256 Uart.Settings.socType = devType;
257 Uart.Settings.useDma = "false";
258 }
259 else
260 {
261 //
262 // Rx alpha commands simulation
263 //
265 /* Add clock for Rx alpha commands DMA */
266 var clock0Params = new Clock.Params();
267 clock0Params.instance.name = "clockRxAlpha";
268 Program.global.clockRxAlpha = Clock.create("&clockRxAlphaFxn", 0, clock0Params);
270 /* Add semaphore for Rx alpha commands DMA */
271 var semaphore2Params = new Semaphore.Params();
272 semaphore2Params.instance.name = "semaphoreRxAlpha";
273 Program.global.semaphoreRxAlpha = Semaphore.create(null, semaphore2Params);
274 }
276 /* Set default stack size for tasks */
277 Task.defaultStackSize = 2048;
279 /* Set size of idle task stack */
280 Task.idleTaskStackSize = 2048;
282 /* Add Audio Function Processing (AFP) task */
283 var task0Params = new Task.Params();
284 task0Params.instance.name = "TaskAfp";
285 task0Params.stackSize = 0x1000; // initial value from pa.cfg
286 task0Params.stackSection = ".far:taskStackSectionAfp";
287 task0Params.arg0 = 0;
288 task0Params.priority = -1; //1;
289 Program.global.TaskAfp = Task.create("&taskAfpFxn", task0Params);
290 Program.sectMap[".far:taskStackSectionAfp"] = "CORE0_DDR3"; // SDRAM in pa.cfg
292 /* Add Alpha Interval Processing (AIP) task */
293 var task1Params = new Task.Params();
294 task1Params.instance.name = "TaskAip";
295 task1Params.stackSize = 0x1000;
296 task1Params.stackSection = ".far:taskStackSectionAip";
297 task1Params.arg0 = 0;
298 task1Params.priority = -1; //2;
299 Program.global.TaskAip = Task.create("&taskAipFxn", task1Params);
300 Program.sectMap[".far:taskStackSectionAip"] = "CORE0_MSMC"; // L3RAM in pa.cfg
302 /* Add Audio Stream Input Processing (ASIP) task */
303 var task2Params = new Task.Params();
304 task2Params.instance.name = "TaskAsip";
305 task2Params.stackSize = 0x4000;
306 task2Params.stackSection = ".far:taskStackSectionAsip";
307 //task2Params.arg0 = 0;
308 task2Params.arg0 = $externPtr("asip_params_PA" + topo);
309 task2Params.arg1 = $externPtr("asip_patchs_PA" + topo);
310 task2Params.priority = -1; //3;
311 Program.global.TaskAsip = Task.create("&taskAsipFxn", task2Params);
312 Program.sectMap[".far:taskStackSectionAsip"] = "CORE0_MSMC";
314 /* Add Audio Stream Output Processing (ASOP) task */
315 var task3Params = new Task.Params();
316 task3Params.instance.name = "TaskAsop";
317 task3Params.stackSize = 0x4000;
318 task3Params.stackSection = ".far:taskStackSectionAsop";
319 //task3Params.arg0 = 0;
320 task3Params.arg0 = $externPtr("asop_params_PA" + topo);
321 task3Params.arg1 = $externPtr("asop_patchs_PA" + topo);
322 task3Params.priority = -1; //3;
323 Program.global.TaskAsop = Task.create("&taskAsopFxn", task3Params);
324 Program.sectMap[".far:taskStackSectionAsop"] = "CORE0_MSMC";
326 /* Add System Initialization task */
327 var task4Params = new Task.Params();
328 task4Params.instance.name = "TaskSysInit";
329 task4Params.stackSize = 0x1000;
330 task4Params.stackSection = ".far:taskStackSectionSysInit";
331 task4Params.priority = 4;
332 Program.global.TaskSysInit = Task.create("&taskSysInitFxn", task4Params);
333 Program.sectMap[".far:taskStackSectionSysInit"] = "CORE0_DDR3";
335 Program.sectMap[".far:taskStackSection"] = "CORE0_DDR3"; // SDRAM in pa.cfg
337 /* Add idle functions */
338 if (acSimBuild == false)
339 {
340 Idle.idleFxns[0] = "&SAP_watchDog"; // Idle function for DSP watchdog; formerly DAP_watchDog()
341 }
342 else
343 {
344 //
345 // SIO simulation
346 //
347 Idle.idleFxns[0] = "&idleDapWatchDog"; // Idle function for DSP watchdog; formerly DAP_watchDog()
348 }
349 Idle.idleFxns[1] = "&idleAudioStream"; // Idle function for audio stream; formerly audioStream1Idle()
350 Idle.idleFxns[2] = "&idleNotifyInfoChange"; // Idle function for Notify Information Change (NIC); formerly customSystemStreamIdleNIC()
352 /* Add L2 SRAM heap */ // formerly IRAM
353 var heapMem0Params = new HeapMem.Params();
354 heapMem0Params.instance.name = "heapMemL2Sram";
355 heapMem0Params.size = 96000; // from pa.cfg
356 heapMem0Params.sectionName = ".l2SramHeap";
357 Program.global.heapMemL2Sram = HeapMem.create(heapMem0Params);
358 Program.sectMap[".l2SramHeap"] = "L2SRAM";
360 // Dec ip circular buffer will be in MSMC, size~=180 kB.
361 // Dec op circular buffer will be in MSMC, size~=192 kB.
362 // Both buffers will be in Shared Region MSMC.
363 /* Add MSMC SRAM heap */ // formerly L3RAM
364 var heapMem1Params = new HeapMem.Params();
365 heapMem1Params.instance.name = "heapMemMsmcSram";
366 // 43008=42 kB from pa.cfg
367 // 184320=180 kB, size of input circ buf, //185344=181 kB;
368 // 384*1024 for combined size of Dec ip/op buffers
369 heapMem1Params.size = 128*1024;
370 heapMem1Params.sectionName = ".msmcSramHeap";
371 Program.global.heapMemMsmcSram = HeapMem.create(heapMem1Params);
372 Program.sectMap[".msmcSramHeap"] = "CORE0_MSMC";
374 /* Add DDR3 heap */ // formerly SDRAM
375 var heapMem2Params = new HeapMem.Params();
376 heapMem2Params.instance.name = "heapMemDdr3";
377 heapMem2Params.size = 3350528;
378 heapMem2Params.sectionName = ".ddr3Heap";
379 Program.global.heapMemDdr3 = HeapMem.create(heapMem2Params);
380 Program.sectMap[".ddr3Heap"] = "CORE0_DDR3";
382 /* FL: hack for DCS7, dcs7_cfg.c */
383 Program.global.SDRAMHeap = Program.global.heapMemDdr3;
385 Program.sectMap["platform_lib"] = "L2SRAM";
386 //Program.sectMap[".stack"] = "L2SRAM";
388 if (acSimBuild == false)
389 {
390 ECM.eventGroupHwiNum[0] = 7;
391 //ECM.eventGroupHwiNum[1] = 8; // FL: conflict w/ UART LLD (intr-callback)
392 //ECM.eventGroupHwiNum[2] = 9;
393 //ECM.eventGroupHwiNum[3] = 10;
394 //Clock.tickPeriod = 100; // FL: UART LLD (intr-callback) unresponsive
395 }
396 else
397 {
398 ////
399 //// For simulation
400 //// This doesn't work-- events #34,36 aren't enabled in C66 EVTMASK1
401 //
402 //// Use EventCombiner module
403 //var EventCombiner = xdc.useModule('ti.sysbios.family.c64p.EventCombiner');
404 //
405 //// Plug function and argument for event 31 (timer1) then enable it.
406 //EventCombiner.events[34].fxn = '&timerRxFxn';
407 //EventCombiner.events[34].arg = 34;
408 //EventCombiner.events[34].unmask = true;
409 //
410 //// Plug function and argument for event 36 (timer2) then enable it.
411 //EventCombiner.events[36].fxn = '&timerTxFxn';
412 //EventCombiner.events[36].arg = 36;
413 //EventCombiner.events[36].unmask = true;
414 //
415 //// Map event 1 (combine events 32-63) to vector 7
416 //EventCombiner.eventGroupHwiNum[1] = 7;
417 }