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_00_00_06/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 */
162 BIOS.libType = (RB ? BIOS.LibType_NonInstrumented : BIOS.LibType_Instrumented);
163 // BIOS.libType = BIOS.LibType_Custom;
164 // BIOS.libType = BIOS.LibType_Debug;
166 /* System stack size (used by ISRs and Swis) */
167 Program.stack = 0x2000;
168 Program.sectMap[".stack"] = "L2SRAM"
170 /* Circular buffer size for System_printf() */
171 SysMin.bufSize = 0x200;
173 System.SupportProxy = SysMin;
175 /* ------ */
176 /* Set CPU frequency to 600 MHz */
177 BIOS.cpuFreq.lo = 600000000;
178 BIOS.cpuFreq.hi = 0;
180 /* Set Sysclock period (usec.) */
181 Clock.tickPeriod = 1000;
183 /* Configure Logging */
184 LoggingSetup.loggerType = LoggingSetup.LoggerType_STOPMODE; // LoggerType_JTAGRUNMODE
185 LoggingSetup.sysbiosTaskLogging = false; // true;
186 LoggingSetup.sysbiosSwiLogging = false;
187 LoggingSetup.sysbiosHwiLogging = false; // true
188 //LoggingSetup.sysbiosLoggerSize = 16384;
189 LoggingSetup.loadLogging = false; //true;
190 LoggingSetup.mainLogging = true;
191 LoggingSetup.mainLoggingRuntimeControl = false;
192 LoggingSetup.mainLoggerSize = 327680; //81960;
193 //LoggingSetup.memorySectionName = "CORE0_DDR3"; //"CORE0_MSMC";
195 // FL: CPU load logging via UIA doesn't work.
196 // Below settings work for target-side load computation (no UIA) when LoggingSetup.loadLogging set to false, but not true.
197 // Load.common$.diags_USER4 set to default or Diags.ALWAYS_ON makes no difference.
198 /* Configure Load Logging */
199 Load.updateInIdle = true; // default=true
200 Load.windowInMs = 5.33; // 48KHz 256 @ 5.33ms // in msec., default=500
201 Load.taskEnabled = true; // default=true
202 Load.swiEnabled = false; // default=true
203 Load.hwiEnabled = false; // default=true
204 //Load.common$.diags_USER4 = Diags.ALWAYS_ON; // default=Diags.RUNTIME_ON
206 //Task.common$.diags_USER1 = Diags.ALWAYS_ON;
207 Task.common$.diags_INFO = Diags.ALWAYS_ON;
209 /* Disallow nested hardware interrupts */
210 Hwi.dispatcherAutoNestingSupport = false;
212 var ProjName = environment["ProjName"];
213 var topo = ProjName.replace( /pa_([a-z])[0-9]+_.*/, "$1");
215 var drv = xdc.loadPackage('ti.sdo.edma3.drv');
216 var rm = xdc.loadPackage ("ti.sdo.edma3.rm");
217 var Edma = xdc.loadPackage ("ti.sdo.edma3.drv.sample");
218 var Hwi = xdc.useModule('ti.sysbios.family.c64p.Hwi');
220 var devType = "k2g"
222 var CpIntc = xdc.useModule('ti.sysbios.family.c66.tci66xx.CpIntc');
224 /* Load the OSAL package */
225 var osType = "tirtos";
226 var Osal = xdc.useModule('ti.osal.Settings');
227 Osal.osType = osType;
228 Osal.socType = devType;
230 /* Load the uart package */
231 var Uart = xdc.loadPackage('ti.drv.uart');
232 Uart.Settings.enableProfiling = false;
233 Uart.Settings.socType = devType;
234 Uart.Settings.useDma = "true";
236 /* Load the spi package */
237 var Spi = xdc.loadPackage('ti.drv.spi');
238 Spi.Settings.enableProfiling = false;
239 Spi.Settings.socType = devType;
241 /* Load the i2c package */
242 var I2c = xdc.loadPackage('ti.drv.i2c');
243 I2c.Settings.enableProfiling = false;
244 I2c.Settings.socType = devType;
246 /* Load and use the CSL packages */
247 var Csl = xdc.useModule('ti.csl.Settings');
248 Csl.deviceType = devType;
250 /* Set default stack size for tasks */
251 Task.defaultStackSize = 2048;
253 /* Set size of idle task stack */
254 Task.idleTaskStackSize = 2048;
256 /* Add Audio Function Processing (AFP) task */
257 var task0Params = new Task.Params();
258 task0Params.instance.name = "TaskAfp";
259 task0Params.stackSize = 0x1000; // initial value from pa.cfg
260 task0Params.stackSection = ".far:taskStackSectionAfp";
261 task0Params.arg0 = 0;
262 task0Params.priority = -1; //1;
263 Program.global.TaskAfp = Task.create("&taskAfpFxn", task0Params);
264 Program.sectMap[".far:taskStackSectionAfp"] = "CORE0_DDR3"; // SDRAM in pa.cfg
266 /* Add Alpha Interval Processing (AIP) task */
267 var task1Params = new Task.Params();
268 task1Params.instance.name = "TaskAip";
269 task1Params.stackSize = 0x1000;
270 task1Params.stackSection = ".far:taskStackSectionAip";
271 task1Params.arg0 = 0;
272 task1Params.priority = -1; //2;
273 Program.global.TaskAip = Task.create("&taskAipFxn", task1Params);
274 Program.sectMap[".far:taskStackSectionAip"] = "CORE0_DDR3"; // L3RAM in pa.cfg
276 /* Add Audio Stream Input Processing (ASIP) task */
277 var task2Params = new Task.Params();
278 task2Params.instance.name = "TaskAsip";
279 task2Params.stackSize = 0x4000;
280 task2Params.stackSection = ".far:taskStackSectionAsip";
281 //task2Params.arg0 = 0;
282 task2Params.arg0 = $externPtr("asip_params_PA" + topo);
283 task2Params.arg1 = $externPtr("asip_patchs_PA" + topo);
284 task2Params.priority = -1; //3;
285 Program.global.TaskAsip = Task.create("&taskAsipFxn", task2Params);
286 Program.sectMap[".far:taskStackSectionAsip"] = "CORE0_DDR3";
288 /* Add Audio Stream Output Processing (ASOP) task */
289 var task3Params = new Task.Params();
290 task3Params.instance.name = "TaskAsop";
291 task3Params.stackSize = 0x4000;
292 task3Params.stackSection = ".far:taskStackSectionAsop";
293 //task3Params.arg0 = 0;
294 task3Params.arg0 = $externPtr("asop_params_PA" + topo);
295 task3Params.arg1 = $externPtr("asop_patchs_PA" + topo);
296 task3Params.priority = -1; //3;
297 Program.global.TaskAsop = Task.create("&taskAsopFxn", task3Params);
298 Program.sectMap[".far:taskStackSectionAsop"] = "CORE0_DDR3";
300 /* Add System Initialization task */
301 var task4Params = new Task.Params();
302 task4Params.instance.name = "TaskSysInit";
303 task4Params.stackSize = 0x1000;
304 task4Params.stackSection = ".far:taskStackSectionSysInit";
305 task4Params.priority = 6; //5;
306 Program.global.TaskSysInit = Task.create("&taskSysInitFxn", task4Params);
307 Program.sectMap[".far:taskStackSectionSysInit"] = "CORE0_DDR3";
309 Program.sectMap[".far:taskStackSection"] = "CORE0_DDR3"; // SDRAM in pa.cfg
311 /* Add task for audio System stream processing; formerly audioStream1Idle() */
312 var task5Params = new Task.Params();
313 task5Params.instance.name = "TaskSystemStream";
314 task5Params.stackSize = 0x1000;
315 task5Params.stackSection = ".far:taskStackSectionAudioStream";
316 task5Params.priority = -1;
317 Program.global.TaskSystemStream = Task.create("&taskSystemStreamFxn", task5Params);
318 Program.sectMap[".far:taskStackSectionAudioStream"] = "CORE0_DDR3";
320 /* Add idle functions */
321 Idle.idleFxns[0] = "&SAP_watchDog"; // Idle function for DSP watchdog; formerly DAP_watchDog()
322 // Remark: Moved idleAudioStream (idle function) to taskSystemStreamFxn (task)
323 //Idle.idleFxns[1] = "&idleAudioStream"; // Idle function for audio stream; formerly audioStream1Idle()
324 //Idle.idleFxns[2] = "&idleNotifyInfoChange"; // Idle function for Notify Information Change (NIC); formerly customSystemStreamIdleNIC()
325 Idle.idleFxns[1] = "&idleNotifyInfoChange"; // Idle function for Notify Information Change (NIC); formerly customSystemStreamIdleNIC()
326 Idle.idleFxns[2] = "&idleDebug" // Idle function for debug code
328 /* Add L2 SRAM heap */ // formerly IRAM
329 var heapMem0Params = new HeapMem.Params();
330 heapMem0Params.instance.name = "heapMemL2Sram";
331 heapMem0Params.size = 550*1024; // 550 kB temporary setting for OB in L2
332 heapMem0Params.sectionName = ".l2SramHeap";
333 Program.global.heapMemL2Sram = HeapMem.create(heapMem0Params);
334 Program.sectMap[".l2SramHeap"] = "L2SRAM";
336 // Dec ip circular buffer will be in MSMC, size~=180 kB.
337 // Dec op circular buffer will be in MSMC, size~=192 kB.
338 // Both buffers will be in Shared Region MSMC.
339 /* Add MSMC SRAM heap */ // formerly L3RAM
340 var heapMem1Params = new HeapMem.Params();
341 heapMem1Params.instance.name = "heapMemMsmcSram";
342 // 43008=42 kB from pa.cfg
343 // 184320=180 kB, size of input circ buf, //185344=181 kB;
344 // 384*1024 for combined size of Dec ip/op buffers
345 heapMem1Params.size = 128*1024;
346 heapMem1Params.sectionName = ".msmcSramHeap";
347 Program.global.heapMemMsmcSram = HeapMem.create(heapMem1Params);
348 Program.sectMap[".msmcSramHeap"] = "CORE0_DDR3";
350 /* Add DDR3 heap */ // formerly SDRAM
351 var heapMem2Params = new HeapMem.Params();
352 heapMem2Params.instance.name = "heapMemDdr3";
353 heapMem2Params.size = 4350528 + (3*1024*1024); // Added 3 MB for DTS PARMA
354 heapMem2Params.sectionName = ".ddr3Heap";
355 Program.global.heapMemDdr3 = HeapMem.create(heapMem2Params);
356 Program.sectMap[".ddr3Heap"] = "CORE0_DDR3";
358 /* For DCS7, dcs7_cfg.c */
359 Program.global.Heap = Program.global.heapMemDdr3;
361 Program.sectMap["platform_lib"] = "L2SRAM";
362 //Program.sectMap[".stack"] = "L2SRAM";
364 ECM.eventGroupHwiNum[0] = 7;
365 ECM.eventGroupHwiNum[1] = 8; // FL: conflict w/ UART LLD (intr-callback)
366 ECM.eventGroupHwiNum[2] = 9;
367 ECM.eventGroupHwiNum[3] = 10;
368 //Clock.tickPeriod = 100; // FL: UART LLD (intr-callback) unresponsive
370 /* Define HWI Hook Set for PFP */
371 Hwi.addHookSet({
372 registerFxn: '&pfpHwiRegister',
373 createFxn: '&pfpHwiCreate',
374 beginFxn: '&pfpHwiBegin',
375 endFxn: '&pfpHwiEnd',
376 deleteFxn: null,
377 });
379 /* Define SWI Hook Set for PFP */
380 Swi.addHookSet({
381 registerFxn: '&pfpSwiRegister', // need this for Id for Hook context
382 createFxn: '&pfpSwiCreate', // malloc context storage space
383 readyFxn: '&pfpSwiReady',
384 beginFxn: '&pfpSwiBegin',
385 endFxn: '&pfpSwiEnd',
386 deleteFxn: null,
387 });
389 /* Define Task Hook Set for PFP */
390 Task.addHookSet({
391 registerFxn: '&pfpTaskRegister',
392 createFxn: '&pfpTaskCreate',
393 readyFxn: '&pfpTaskReady',
394 switchFxn: '&pfpTaskSwitch',
395 exitFxn: null,
396 deleteFxn: null,
397 });
399 /* Added for PFP, not necessary */
400 Hwi.common$.namedInstance=true;
401 Swi.common$.namedInstance=true;
402 Task.common$.namedInstance=true;