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_audio_sdk_1_00_00_03/pasdk/shared/ipc.cfg.xs");
92 /* select ipc libraries */
93 var Build = xdc.useModule('ti.sdo.ipc.Build');
94 Build.libType = (RB ? Build.LibType_NonInstrumented : Build.LibType_Debug);
95 Build.assertsEnabled = (RB ? false : true);
96 Build.logsEnabled = (RB ? false : true);
99 /*
100 * Uncomment this line to globally disable Asserts.
101 * All modules inherit the default from the 'Defaults' module. You
102 * can override these defaults on a per-module basis using Module.common$.
103 * Disabling Asserts will save code space and improve runtime performance.
104 Defaults.common$.diags_ASSERT = Diags.ALWAYS_OFF;
105 */
107 /*
108 * Uncomment this line to keep module names from being loaded on the target.
109 * The module name strings are placed in the .const section. Setting this
110 * parameter to false will save space in the .const section. Error and
111 * Assert messages will contain an "unknown module" prefix instead
112 * of the actual module name.
113 Defaults.common$.namedModule = false;
114 */
116 /*
117 * Minimize exit handler array in System. The System module includes
118 * an array of functions that are registered with System_atexit() to be
119 * called by System_exit().
120 */
121 System.maxAtexitHandlers = 4;
123 /*
124 * Uncomment this line to disable the Error print function.
125 * We lose error information when this is disabled since the errors are
126 * not printed. Disabling the raiseHook will save some code space if
127 * your app is not using System_printf() since the Error_print() function
128 * calls System_printf().
129 Error.raiseHook = null;
130 */
132 /*
133 * Uncomment this line to keep Error, Assert, and Log strings from being
134 * loaded on the target. These strings are placed in the .const section.
135 * Setting this parameter to false will save space in the .const section.
136 * Error, Assert and Log message will print raw ids and args instead of
137 * a formatted message.
138 Text.isLoaded = false;
139 */
141 /*
142 * Uncomment this line to disable the output of characters by SysMin
143 * when the program exits. SysMin writes characters to a circular buffer.
144 * This buffer can be viewed using the SysMin Output view in ROV.
145 SysMin.flushAtExit = false;
146 */
148 /*
149 * The BIOS module will create the default heap for the system.
150 * Specify the size of this default heap.
151 */
152 //BIOS.heapSize = 0x1000; // initial setting
153 BIOS.heapSize = 0x2000; // from pa.cfg
154 BIOS.heapSection = ".systemHeap";
155 Program.sectMap[".systemHeap"] = "CORE0_DDR3";
157 /*
158 * Build a custom SYS/BIOS library from sources.
159 */
160 BIOS.libType = (RB ? BIOS.LibType_NonInstrumented : BIOS.LibType_Instrumented);
161 // BIOS.libType = BIOS.LibType_Custom;
162 // BIOS.libType = BIOS.LibType_Debug;
164 /* System stack size (used by ISRs and Swis) */
165 Program.stack = 0x2000;
166 Program.sectMap[".stack"] = "L2SRAM"
168 /* Circular buffer size for System_printf() */
169 SysMin.bufSize = 0x200;
171 System.SupportProxy = SysMin;
173 /* ------ */
174 /* Set CPU frequency to 600 MHz */
175 BIOS.cpuFreq.lo = 600000000;
176 BIOS.cpuFreq.hi = 0;
178 /* Set Sysclock period (usec.) */
179 Clock.tickPeriod = 1000;
181 /* Configure Logging */
182 LoggingSetup.loggerType = LoggingSetup.LoggerType_STOPMODE; // LoggerType_JTAGRUNMODE
183 LoggingSetup.sysbiosTaskLogging = false; // true;
184 LoggingSetup.sysbiosSwiLogging = false;
185 LoggingSetup.sysbiosHwiLogging = false; // true
186 //LoggingSetup.sysbiosLoggerSize = 16384;
187 LoggingSetup.loadLogging = false; //true;
188 LoggingSetup.mainLogging = true;
189 LoggingSetup.mainLoggingRuntimeControl = false;
190 LoggingSetup.mainLoggerSize = 327680; //81960;
191 //LoggingSetup.memorySectionName = "CORE0_DDR3"; //"CORE0_MSMC";
193 // FL: CPU load logging via UIA doesn't work.
194 // Below settings work for target-side load computation (no UIA) when LoggingSetup.loadLogging set to false, but not true.
195 // Load.common$.diags_USER4 set to default or Diags.ALWAYS_ON makes no difference.
196 /* Configure Load Logging */
197 Load.updateInIdle = true; // default=true
198 Load.windowInMs = 5.33; // 48KHz 256 @ 5.33ms // in msec., default=500
199 Load.taskEnabled = true; // default=true
200 Load.swiEnabled = false; // default=true
201 Load.hwiEnabled = false; // default=true
202 //Load.common$.diags_USER4 = Diags.ALWAYS_ON; // default=Diags.RUNTIME_ON
204 //Task.common$.diags_USER1 = Diags.ALWAYS_ON;
205 Task.common$.diags_INFO = Diags.ALWAYS_ON;
207 /* Disallow nested hardware interrupts */
208 Hwi.dispatcherAutoNestingSupport = false;
210 var ProjName = environment["ProjName"];
211 var topo = ProjName.replace( /pa_([a-z])[0-9]+_.*/, "$1");
212 var RxAlphaSim = environment["RxAlphaSim"];
213 var rxAlphaSimBuild = (RxAlphaSim == "1" ? true : false);
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 if (rxAlphaSimBuild == false)
221 {
222 var devType = "k2g"
224 var CpIntc = xdc.useModule('ti.sysbios.family.c66.tci66xx.CpIntc');
226 /* Load the OSAL package */
227 var osType = "tirtos";
228 var Osal = xdc.useModule('ti.osal.Settings');
229 Osal.osType = osType;
230 Osal.socType = devType;
232 /* Load the uart package */
233 var Uart = xdc.loadPackage('ti.drv.uart');
234 Uart.Settings.enableProfiling = false;
235 Uart.Settings.socType = devType;
236 Uart.Settings.useDma = "true";
238 /* Load the spi package */
239 var Spi = xdc.loadPackage('ti.drv.spi');
240 Spi.Settings.enableProfiling = false;
241 Spi.Settings.socType = devType;
243 /* Load the i2c package */
244 var I2c = xdc.loadPackage('ti.drv.i2c');
245 I2c.Settings.enableProfiling = false;
246 I2c.Settings.socType = devType;
248 /* Load and use the CSL packages */
249 var Csl = xdc.useModule('ti.csl.Settings');
250 Csl.deviceType = devType;
251 }
252 else
253 {
254 //
255 // Rx alpha commands simulation
256 //
258 /* Add clock for Rx alpha commands DMA */
259 var clock0Params = new Clock.Params();
260 clock0Params.instance.name = "clockRxAlpha";
261 Program.global.clockRxAlpha = Clock.create("&clockRxAlphaFxn", 0, clock0Params);
263 /* Add semaphore for Rx alpha commands DMA */
264 var semaphore2Params = new Semaphore.Params();
265 semaphore2Params.instance.name = "semaphoreRxAlpha";
266 Program.global.semaphoreRxAlpha = Semaphore.create(null, semaphore2Params);
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 Function Processing (AFP) task */
276 var task0Params = new Task.Params();
277 task0Params.instance.name = "TaskAfp";
278 task0Params.stackSize = 0x1000; // initial value from pa.cfg
279 task0Params.stackSection = ".far:taskStackSectionAfp";
280 task0Params.arg0 = 0;
281 task0Params.priority = -1; //1;
282 Program.global.TaskAfp = Task.create("&taskAfpFxn", task0Params);
283 Program.sectMap[".far:taskStackSectionAfp"] = "CORE0_DDR3"; // SDRAM in pa.cfg
285 /* Add Alpha Interval Processing (AIP) task */
286 var task1Params = new Task.Params();
287 task1Params.instance.name = "TaskAip";
288 task1Params.stackSize = 0x1000;
289 task1Params.stackSection = ".far:taskStackSectionAip";
290 task1Params.arg0 = 0;
291 task1Params.priority = -1; //2;
292 Program.global.TaskAip = Task.create("&taskAipFxn", task1Params);
293 Program.sectMap[".far:taskStackSectionAip"] = "CORE0_MSMC"; // L3RAM in pa.cfg
295 /* Add Audio Stream Input Processing (ASIP) task */
296 var task2Params = new Task.Params();
297 task2Params.instance.name = "TaskAsip";
298 task2Params.stackSize = 0x4000;
299 task2Params.stackSection = ".far:taskStackSectionAsip";
300 //task2Params.arg0 = 0;
301 task2Params.arg0 = $externPtr("asip_params_PA" + topo);
302 task2Params.arg1 = $externPtr("asip_patchs_PA" + topo);
303 task2Params.priority = -1; //3;
304 Program.global.TaskAsip = Task.create("&taskAsipFxn", task2Params);
305 Program.sectMap[".far:taskStackSectionAsip"] = "CORE0_MSMC";
307 /* Add Audio Stream Output Processing (ASOP) task */
308 var task3Params = new Task.Params();
309 task3Params.instance.name = "TaskAsop";
310 task3Params.stackSize = 0x4000;
311 task3Params.stackSection = ".far:taskStackSectionAsop";
312 //task3Params.arg0 = 0;
313 task3Params.arg0 = $externPtr("asop_params_PA" + topo);
314 task3Params.arg1 = $externPtr("asop_patchs_PA" + topo);
315 task3Params.priority = -1; //3;
316 Program.global.TaskAsop = Task.create("&taskAsopFxn", task3Params);
317 Program.sectMap[".far:taskStackSectionAsop"] = "CORE0_MSMC";
319 /* Add System Initialization task */
320 var task4Params = new Task.Params();
321 task4Params.instance.name = "TaskSysInit";
322 task4Params.stackSize = 0x1000;
323 task4Params.stackSection = ".far:taskStackSectionSysInit";
324 task4Params.priority = 6; //5;
325 Program.global.TaskSysInit = Task.create("&taskSysInitFxn", task4Params);
326 Program.sectMap[".far:taskStackSectionSysInit"] = "CORE0_DDR3";
328 Program.sectMap[".far:taskStackSection"] = "CORE0_DDR3"; // SDRAM in pa.cfg
330 /* Add task for audio System stream processing; formerly audioStream1Idle() */
331 var task5Params = new Task.Params();
332 task5Params.instance.name = "TaskSystemStream";
333 task5Params.stackSize = 0x1000;
334 task5Params.stackSection = ".far:taskStackSectionAudioStream";
335 task5Params.priority = -1;
336 Program.global.TaskSystemStream = Task.create("&taskSystemStreamFxn", task5Params);
337 Program.sectMap[".far:taskStackSectionAudioStream"] = "CORE0_DDR3";
339 /* Add idle functions */
340 Idle.idleFxns[0] = "&SAP_watchDog"; // Idle function for DSP watchdog; formerly DAP_watchDog()
341 // Remark: Moved idleAudioStream (idle function) to taskSystemStreamFxn (task)
342 //Idle.idleFxns[1] = "&idleAudioStream"; // Idle function for audio stream; formerly audioStream1Idle()
343 //Idle.idleFxns[2] = "&idleNotifyInfoChange"; // Idle function for Notify Information Change (NIC); formerly customSystemStreamIdleNIC()
344 Idle.idleFxns[1] = "&idleNotifyInfoChange"; // Idle function for Notify Information Change (NIC); formerly customSystemStreamIdleNIC()
345 Idle.idleFxns[2] = "&idleDebug" // Idle function for debug code
347 /* Add L2 SRAM heap */ // formerly IRAM
348 var heapMem0Params = new HeapMem.Params();
349 heapMem0Params.instance.name = "heapMemL2Sram";
350 heapMem0Params.size = 550*1024; // 96000; // from pa.cfg
351 heapMem0Params.sectionName = ".l2SramHeap";
352 Program.global.heapMemL2Sram = HeapMem.create(heapMem0Params);
353 Program.sectMap[".l2SramHeap"] = "L2SRAM";
355 // Dec ip circular buffer will be in MSMC, size~=180 kB.
356 // Dec op circular buffer will be in MSMC, size~=192 kB.
357 // Both buffers will be in Shared Region MSMC.
358 /* Add MSMC SRAM heap */ // formerly L3RAM
359 var heapMem1Params = new HeapMem.Params();
360 heapMem1Params.instance.name = "heapMemMsmcSram";
361 // 43008=42 kB from pa.cfg
362 // 184320=180 kB, size of input circ buf, //185344=181 kB;
363 // 384*1024 for combined size of Dec ip/op buffers
364 heapMem1Params.size = 128*1024;
365 heapMem1Params.sectionName = ".msmcSramHeap";
366 Program.global.heapMemMsmcSram = HeapMem.create(heapMem1Params);
367 Program.sectMap[".msmcSramHeap"] = "CORE0_MSMC";
369 /* Add DDR3 heap */ // formerly SDRAM
370 var heapMem2Params = new HeapMem.Params();
371 heapMem2Params.instance.name = "heapMemDdr3";
372 heapMem2Params.size = 4350528;
373 heapMem2Params.sectionName = ".ddr3Heap";
374 Program.global.heapMemDdr3 = HeapMem.create(heapMem2Params);
375 Program.sectMap[".ddr3Heap"] = "CORE0_DDR3";
377 /* For DCS7, dcs7_cfg.c */
378 Program.global.Heap = Program.global.heapMemDdr3;
380 Program.sectMap["platform_lib"] = "L2SRAM";
381 //Program.sectMap[".stack"] = "L2SRAM";
383 ECM.eventGroupHwiNum[0] = 7;
384 ECM.eventGroupHwiNum[1] = 8; // FL: conflict w/ UART LLD (intr-callback)
385 ECM.eventGroupHwiNum[2] = 9;
386 ECM.eventGroupHwiNum[3] = 10;
387 //Clock.tickPeriod = 100; // FL: UART LLD (intr-callback) unresponsive
389 /* Define HWI Hook Set for PFP */
390 Hwi.addHookSet({
391 registerFxn: '&pfpHwiRegister',
392 createFxn: '&pfpHwiCreate',
393 beginFxn: '&pfpHwiBegin',
394 endFxn: '&pfpHwiEnd',
395 deleteFxn: null,
396 });
398 /* Define SWI Hook Set for PFP */
399 Swi.addHookSet({
400 registerFxn: '&pfpSwiRegister', // need this for Id for Hook context
401 createFxn: '&pfpSwiCreate', // malloc context storage space
402 readyFxn: '&pfpSwiReady',
403 beginFxn: '&pfpSwiBegin',
404 endFxn: '&pfpSwiEnd',
405 deleteFxn: null,
406 });
408 /* Define Task Hook Set for PFP */
409 Task.addHookSet({
410 registerFxn: '&pfpTaskRegister',
411 createFxn: '&pfpTaskCreate',
412 readyFxn: '&pfpTaskReady',
413 switchFxn: '&pfpTaskSwitch',
414 exitFxn: null,
415 deleteFxn: null,
416 });
418 /* Added for PFP, not necessary */
419 Hwi.common$.namedInstance=true;
420 Swi.common$.namedInstance=true;
421 Task.common$.namedInstance=true;