1efc084bbeeb002041b009a1a2a62fa2911f085e
2 /*
3 Copyright (c) 2017, 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');
59 var BIOS = xdc.useModule('ti.sysbios.BIOS');
60 var GateAll = xdc.useModule('ti.sysbios.gates.GateAll'); // Added for PFP
61 var Hwi = xdc.useModule('ti.sysbios.hal.Hwi');
62 var Cache = xdc.useModule('ti.sysbios.hal.Cache');
63 var Cachec66 = xdc.useModule('ti.sysbios.family.c66.Cache');
64 var Timer = xdc.useModule('ti.sysbios.hal.Timer');
65 var HeapBuf = xdc.useModule('ti.sysbios.heaps.HeapBuf');
66 var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
67 var Clock = xdc.useModule('ti.sysbios.knl.Clock');
68 var Idle = xdc.useModule('ti.sysbios.knl.Idle');
69 var Queue = xdc.useModule('ti.sysbios.knl.Queue');
70 var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore');
71 var Swi = xdc.useModule('ti.sysbios.knl.Swi'); // Added for PFP
72 var Task = xdc.useModule('ti.sysbios.knl.Task');
73 var Load = xdc.useModule('ti.sysbios.utils.Load');
75 var LoggingSetup = xdc.useModule('ti.uia.sysbios.LoggingSetup');
76 var UIAEvt = xdc.useModule('ti.uia.events.UIAEvt');
78 var ECM = xdc.useModule('ti.sysbios.family.c64p.EventCombiner');
80 xdc.useModule('ti.sdo.utils.MultiProc');
82 /*
83 * ======== IPC Configuration ========
84 */
85 xdc.global.SR0_cacheEnable = true;
86 xdc.global.SrMsmcMem_cacheEnable = true;
87 xdc.global.SrDDr3Mem_cacheEnable = true;
88 xdc.global.SrDDr3_2Mem_cacheEnable = false;
89 xdc.global.procName = "CORE0";
90 /* var ipc_cfg = xdc.loadCapsule("C:/ti/processor_sdk_audio_1_01_00_01/pasdk/shared/ipc.cfg.xs"); */
91 var ipc_cfg = xdc.loadCapsule("../../shared/ipc.cfg.xs");
94 /* select ipc libraries */
95 var Build = xdc.useModule('ti.sdo.ipc.Build');
96 Build.libType = (RB ? Build.LibType_NonInstrumented : Build.LibType_Debug);
97 Build.assertsEnabled = (RB ? false : true);
98 Build.logsEnabled = (RB ? false : true);
101 /*
102 * Uncomment this line to globally disable Asserts.
103 * All modules inherit the default from the 'Defaults' module. You
104 * can override these defaults on a per-module basis using Module.common$.
105 * Disabling Asserts will save code space and improve runtime performance.
106 Defaults.common$.diags_ASSERT = Diags.ALWAYS_OFF;
107 */
109 /*
110 * Uncomment this line to keep module names from being loaded on the target.
111 * The module name strings are placed in the .const section. Setting this
112 * parameter to false will save space in the .const section. Error and
113 * Assert messages will contain an "unknown module" prefix instead
114 * of the actual module name.
115 Defaults.common$.namedModule = false;
116 */
118 /*
119 * Minimize exit handler array in System. The System module includes
120 * an array of functions that are registered with System_atexit() to be
121 * called by System_exit().
122 */
123 System.maxAtexitHandlers = 4;
125 /*
126 * Uncomment this line to disable the Error print function.
127 * We lose error information when this is disabled since the errors are
128 * not printed. Disabling the raiseHook will save some code space if
129 * your app is not using System_printf() since the Error_print() function
130 * calls System_printf().
131 Error.raiseHook = null;
132 */
134 /*
135 * Uncomment this line to keep Error, Assert, and Log strings from being
136 * loaded on the target. These strings are placed in the .const section.
137 * Setting this parameter to false will save space in the .const section.
138 * Error, Assert and Log message will print raw ids and args instead of
139 * a formatted message.
140 Text.isLoaded = false;
141 */
143 /*
144 * Uncomment this line to disable the output of characters by SysMin
145 * when the program exits. SysMin writes characters to a circular buffer.
146 * This buffer can be viewed using the SysMin Output view in ROV.
147 SysMin.flushAtExit = false;
148 */
150 /*
151 * The BIOS module will create the default heap for the system.
152 * Specify the size of this default heap.
153 */
154 //BIOS.heapSize = 0x1000; // initial setting
155 BIOS.heapSize = 0x2000; // from pa.cfg
156 BIOS.heapSection = ".systemHeap";
157 Program.sectMap[".systemHeap"] = "CORE0_DDR3";
159 /*
160 * Build a custom SYS/BIOS library from sources.
161 */
163 var HsDevBuild = environment["HsDevBuild"];
164 var hsDevBuild = (HsDevBuild == "1" ? true : false);
165 if (HsDevBuild == true)
166 {
167 /* HS device build */
168 /* Added per recommendation from CATAPPS-171 */
169 BIOS.useSK = true;
170 BIOS.setupSecureContext = true;
171 BIOS.libType = BIOS.LibType_Custom;
172 }
173 else
174 {
175 /* GP device build */
176 BIOS.libType = (RB ? BIOS.LibType_NonInstrumented : BIOS.LibType_Instrumented);
177 //BIOS.libType = BIOS.LibType_Custom;
178 //BIOS.libType = BIOS.LibType_Debug;
179 }
181 /* System stack size (used by ISRs and Swis) */
182 Program.stack = 0x2000;
183 Program.sectMap[".stack"] = "L2SRAM"
185 /* Circular buffer size for System_printf() */
186 SysMin.bufSize = 0x200;
188 System.SupportProxy = SysMin;
190 /* ------ */
191 /* Set CPU frequency to 600 MHz */
192 BIOS.cpuFreq.lo = 600000000;
193 BIOS.cpuFreq.hi = 0;
195 /* Set Sysclock period (usec.) */
196 Clock.tickPeriod = 1000;
198 /* Configure Logging */
199 LoggingSetup.loggerType = LoggingSetup.LoggerType_STOPMODE; // LoggerType_JTAGRUNMODE
200 LoggingSetup.sysbiosTaskLogging = false; // true;
201 LoggingSetup.sysbiosSwiLogging = false;
202 LoggingSetup.sysbiosHwiLogging = false; // true
203 //LoggingSetup.sysbiosLoggerSize = 16384;
204 LoggingSetup.loadLogging = false; //true;
205 LoggingSetup.mainLogging = true;
206 LoggingSetup.mainLoggingRuntimeControl = false;
207 LoggingSetup.mainLoggerSize = 327680; //81960;
208 //LoggingSetup.memorySectionName = "CORE0_DDR3"; //"CORE0_MSMC";
210 // FL: CPU load logging via UIA doesn't work.
211 // Below settings work for target-side load computation (no UIA) when LoggingSetup.loadLogging set to false, but not true.
212 // Load.common$.diags_USER4 set to default or Diags.ALWAYS_ON makes no difference.
213 /* Configure Load Logging */
214 Load.updateInIdle = true; // default=true
215 Load.windowInMs = 5.33; // 48KHz 256 @ 5.33ms // in msec., default=500
216 Load.taskEnabled = true; // default=true
217 Load.swiEnabled = false; // default=true
218 Load.hwiEnabled = false; // default=true
219 //Load.common$.diags_USER4 = Diags.ALWAYS_ON; // default=Diags.RUNTIME_ON
221 //Task.common$.diags_USER1 = Diags.ALWAYS_ON;
222 Task.common$.diags_INFO = Diags.ALWAYS_ON;
224 /* Disallow nested hardware interrupts */
225 Hwi.dispatcherAutoNestingSupport = false;
227 var ProjName = environment["ProjName"];
228 var topo = ProjName.replace( /pa_([a-z])[0-9]+_.*/, "$1");
230 var drv = xdc.loadPackage('ti.sdo.edma3.drv');
231 var rm = xdc.loadPackage ("ti.sdo.edma3.rm");
232 var Edma = xdc.loadPackage ("ti.sdo.edma3.drv.sample");
233 var Hwi = xdc.useModule('ti.sysbios.family.c64p.Hwi');
235 var devType = "k2g"
237 var CpIntc = xdc.useModule('ti.sysbios.family.c66.tci66xx.CpIntc');
239 /* Load the OSAL package */
240 var osType = "tirtos";
241 var Osal = xdc.useModule('ti.osal.Settings');
242 Osal.osType = osType;
243 Osal.socType = devType;
245 /* Load the uart package */
246 var Uart = xdc.loadPackage('ti.drv.uart');
247 Uart.Settings.enableProfiling = false;
248 Uart.Settings.socType = devType;
249 Uart.Settings.useDma = "true";
251 /* Load the spi package */
252 var Spi = xdc.loadPackage('ti.drv.spi');
253 Spi.Settings.enableProfiling = false;
254 Spi.Settings.socType = devType;
256 /* Load the i2c package */
257 var I2c = xdc.loadPackage('ti.drv.i2c');
258 I2c.Settings.enableProfiling = false;
259 I2c.Settings.socType = devType;
261 /* Load and use the CSL packages */
262 var Csl = xdc.useModule('ti.csl.Settings');
263 Csl.deviceType = devType;
265 /* Set default stack size for tasks */
266 Task.defaultStackSize = 2048;
268 /* Set size of idle task stack */
269 Task.idleTaskStackSize = 2048;
271 /* Add Audio Function Processing (AFP) task */
272 var task0Params = new Task.Params();
273 task0Params.instance.name = "TaskAfp";
274 task0Params.stackSize = 0x1000; // initial value from pa.cfg
275 task0Params.stackSection = ".far:taskStackSectionAfp";
276 task0Params.arg0 = 0;
277 task0Params.priority = -1; //1;
278 Program.global.TaskAfp = Task.create("&taskAfpFxn", task0Params);
279 Program.sectMap[".far:taskStackSectionAfp"] = "CORE0_DDR3"; // SDRAM in pa.cfg
281 /* Add Alpha Interval Processing (AIP) task */
282 var task1Params = new Task.Params();
283 task1Params.instance.name = "TaskAip";
284 task1Params.stackSize = 0x1000;
285 task1Params.stackSection = ".far:taskStackSectionAip";
286 task1Params.arg0 = 0;
287 task1Params.priority = -1; //2;
288 Program.global.TaskAip = Task.create("&taskAipFxn", task1Params);
289 Program.sectMap[".far:taskStackSectionAip"] = "CORE0_DDR3"; // L3RAM in pa.cfg
291 /* Add Audio Stream Input Processing (ASIP) task */
292 var task2Params = new Task.Params();
293 task2Params.instance.name = "TaskAsip";
294 task2Params.stackSize = 0x4000;
295 task2Params.stackSection = ".far:taskStackSectionAsip";
296 //task2Params.arg0 = 0;
297 task2Params.arg0 = $externPtr("asip_params_PA" + topo);
298 task2Params.arg1 = $externPtr("asip_patchs_PA" + topo);
299 task2Params.priority = -1; //3;
300 Program.global.TaskAsip = Task.create("&taskAsipFxn", task2Params);
301 Program.sectMap[".far:taskStackSectionAsip"] = "CORE0_DDR3";
303 /* Add Audio Stream Output Processing (ASOP) task */
304 var task3Params = new Task.Params();
305 task3Params.instance.name = "TaskAsop";
306 task3Params.stackSize = 0x4000;
307 task3Params.stackSection = ".far:taskStackSectionAsop";
308 //task3Params.arg0 = 0;
309 task3Params.arg0 = $externPtr("asop_params_PA" + topo);
310 task3Params.arg1 = $externPtr("asop_patchs_PA" + topo);
311 task3Params.priority = -1; //3;
312 Program.global.TaskAsop = Task.create("&taskAsopFxn", task3Params);
313 Program.sectMap[".far:taskStackSectionAsop"] = "CORE0_DDR3";
315 /* Add System Initialization task */
316 var task4Params = new Task.Params();
317 task4Params.instance.name = "TaskSysInit";
318 task4Params.stackSize = 0x1000;
319 task4Params.stackSection = ".far:taskStackSectionSysInit";
320 task4Params.priority = 6; //5;
321 Program.global.TaskSysInit = Task.create("&taskSysInitFxn", task4Params);
322 Program.sectMap[".far:taskStackSectionSysInit"] = "CORE0_DDR3";
324 Program.sectMap[".far:taskStackSection"] = "CORE0_DDR3"; // SDRAM in pa.cfg
326 /* Add task for audio System stream processing; formerly audioStream1Idle() */
327 var task5Params = new Task.Params();
328 task5Params.instance.name = "TaskSystemStream";
329 task5Params.stackSize = 0x1000;
330 task5Params.stackSection = ".far:taskStackSectionAudioStream";
331 task5Params.priority = -1;
332 Program.global.TaskSystemStream = Task.create("&taskSystemStreamFxn", task5Params);
333 Program.sectMap[".far:taskStackSectionAudioStream"] = "CORE0_DDR3";
335 /* Add idle functions */
336 // Remark: original idle functions
337 //Idle.idleFxns[0] = "&SAP_watchDog"; // Idle function for DSP watchdog; formerly DAP_watchDog()
338 //Idle.idleFxns[1] = "&idleAudioStream"; // Idle function for audio stream; formerly audioStream1Idle()
339 //Idle.idleFxns[2] = "&idleNotifyInfoChange"; // Idle function for Notify Information Change (NIC); formerly customSystemStreamIdleNIC()
340 // Remark: Moved idleAudioStream (idle function) to taskSystemStreamFxn (task)
341 //Idle.idleFxns[0] = "&SAP_watchDog"; // Idle function for DSP watchdog; formerly DAP_watchDog()
342 //Idle.idleFxns[1] = "&idleNotifyInfoChange"; // Idle function for Notify Information Change (NIC); formerly customSystemStreamIdleNIC()
343 //Idle.idleFxns[2] = "&idleDebug" // Idle function for debug code
344 // Remark: Removed SAP watch dog
345 Idle.idleFxns[0] = "&idleNotifyInfoChange"; // Idle function for Notify Information Change (NIC)
346 Idle.idleFxns[1] = "&idleDebug" // Idle function for debug code
348 /* Add L2 SRAM heap */ // formerly IRAM
349 var heapMem0Params = new HeapMem.Params();
350 heapMem0Params.instance.name = "heapMemL2Sram";
351 heapMem0Params.size = 550*1024; // 550 kB temporary setting for OB in L2
352 heapMem0Params.sectionName = ".l2SramHeap";
353 Program.global.heapMemL2Sram = HeapMem.create(heapMem0Params);
354 Program.sectMap[".l2SramHeap"] = "L2SRAM";
356 // Dec ip circular buffer will be in MSMC, size~=180 kB.
357 // Dec op circular buffer will be in MSMC, size~=192 kB.
358 // Both buffers will be in Shared Region MSMC.
359 /* Add MSMC SRAM heap */ // formerly L3RAM
360 var heapMem1Params = new HeapMem.Params();
361 heapMem1Params.instance.name = "heapMemMsmcSram";
362 // 43008=42 kB from pa.cfg
363 // 184320=180 kB, size of input circ buf, //185344=181 kB;
364 // 384*1024 for combined size of Dec ip/op buffers
365 heapMem1Params.size = 128*1024;
366 heapMem1Params.sectionName = ".msmcSramHeap";
367 Program.global.heapMemMsmcSram = HeapMem.create(heapMem1Params);
368 Program.sectMap[".msmcSramHeap"] = "CORE0_DDR3";
370 /* Add DDR3 heap */ // formerly SDRAM
371 var heapMem2Params = new HeapMem.Params();
372 heapMem2Params.instance.name = "heapMemDdr3";
373 heapMem2Params.size = 4350528 + (3*1024*1024); // Added 3 MB for DTS PARMA
374 heapMem2Params.sectionName = ".ddr3Heap";
375 Program.global.heapMemDdr3 = HeapMem.create(heapMem2Params);
376 Program.sectMap[".ddr3Heap"] = "CORE0_DDR3";
378 /* For DCS7, dcs7_cfg.c */
379 Program.global.Heap = Program.global.heapMemDdr3;
381 //Program.sectMap[".stack"] = "L2SRAM";
383 /* Map C66x INTC Event Combiner EVT 0-3 to HWI numbers */
384 ECM.eventGroupHwiNum[0] = 7;
385 ECM.eventGroupHwiNum[1] = 8; // FL: conflict w/ UART LLD, intr-callback mode
386 ECM.eventGroupHwiNum[2] = 9;
387 ECM.eventGroupHwiNum[3] = 10;
390 /* Define HWI Hook Set for PFP */
391 Hwi.addHookSet({
392 registerFxn: '&pfpHwiRegister',
393 createFxn: '&pfpHwiCreate',
394 beginFxn: '&pfpHwiBegin',
395 endFxn: '&pfpHwiEnd',
396 deleteFxn: null,
397 });
399 /* Define SWI Hook Set for PFP */
400 Swi.addHookSet({
401 registerFxn: '&pfpSwiRegister', // need this for Id for Hook context
402 createFxn: '&pfpSwiCreate', // malloc context storage space
403 readyFxn: '&pfpSwiReady',
404 beginFxn: '&pfpSwiBegin',
405 endFxn: '&pfpSwiEnd',
406 deleteFxn: null,
407 });
409 /* Define Task Hook Set for PFP */
410 Task.addHookSet({
411 registerFxn: '&pfpTaskRegister',
412 createFxn: '&pfpTaskCreate',
413 readyFxn: '&pfpTaskReady',
414 switchFxn: '&pfpTaskSwitch',
415 exitFxn: null,
416 deleteFxn: null,
417 });
419 /* Added for PFP, not necessary */
420 Hwi.common$.namedInstance=true;
421 Swi.common$.namedInstance=true;
422 Task.common$.namedInstance=true;