/* Copyright (c) 2017, Texas Instruments Incorporated - http://www.ti.com/ All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the * distribution. * * Neither the name of Texas Instruments Incorporated nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ /* * ======== app.cfg ======== * Platform: 66AK2G_bios_elf * Target: gnu.targets.arm.A15F */ /* root of the configuration object model */ var Program = xdc.useModule('xdc.cfg.Program'); var cfgArgs = Program.build.cfgArgs; var RB = (cfgArgs.profile == "release" ? true : false); /* application uses the following modules and packages */ var Defaults = xdc.useModule('xdc.runtime.Defaults'); var Diags = xdc.useModule('xdc.runtime.Diags'); var Error = xdc.useModule('xdc.runtime.Error'); var Log = xdc.useModule('xdc.runtime.Log'); var Main = xdc.useModule('xdc.runtime.Main'); var Memory = xdc.useModule('xdc.runtime.Memory') var SysMin = xdc.useModule('xdc.runtime.SysMin'); var System = xdc.useModule('xdc.runtime.System'); var Text = xdc.useModule('xdc.runtime.Text'); var BIOS = xdc.useModule('ti.sysbios.BIOS'); var GateAll = xdc.useModule('ti.sysbios.gates.GateAll'); // Added for PFP var Hwi = xdc.useModule('ti.sysbios.hal.Hwi'); var Timer = xdc.useModule('ti.sysbios.hal.Timer'); var Clock = xdc.useModule('ti.sysbios.knl.Clock'); var Idle = xdc.useModule('ti.sysbios.knl.Idle'); var Swi = xdc.useModule('ti.sysbios.knl.Swi'); // Added for PFP, no SWIs on ARM var Task = xdc.useModule('ti.sysbios.knl.Task'); var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore'); var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem'); var Load = xdc.useModule('ti.sysbios.utils.Load'); var LoggingSetup = xdc.useModule('ti.uia.sysbios.LoggingSetup'); var UIAEvt = xdc.useModule('ti.uia.events.UIAEvt'); xdc.useModule('ti.sdo.utils.MultiProc'); /* * ======== IPC Configuration ======== */ xdc.global.SR0_cacheEnable = true; xdc.global.SrMsmcMem_cacheEnable = true; xdc.global.SrDDr3Mem_cacheEnable = true; xdc.global.SrDDr3_2Mem_cacheEnable = false; xdc.global.procName = "HOST"; /* var ipc_cfg = xdc.loadCapsule("C:/ti/processor_sdk_audio_1_00_00_06/pasdk/shared/ipc.cfg.xs"); */ var ipc_cfg = xdc.loadCapsule("../../shared/ipc.cfg.xs"); /* select ipc libraries */ var Build = xdc.useModule('ti.sdo.ipc.Build'); Build.libType = (RB ? Build.LibType_NonInstrumented : Build.LibType_Debug); Build.assertsEnabled = (RB ? false : true); Build.logsEnabled = (RB ? false : true); /* * Uncomment this line to globally disable Asserts. * All modules inherit the default from the 'Defaults' module. You * can override these defaults on a per-module basis using Module.common$. * Disabling Asserts will save code space and improve runtime performance. Defaults.common$.diags_ASSERT = Diags.ALWAYS_OFF; */ /* * Uncomment this line to keep module names from being loaded on the target. * The module name strings are placed in the .const section. Setting this * parameter to false will save space in the .const section. Error and * Assert messages will contain an "unknown module" prefix instead * of the actual module name. Defaults.common$.namedModule = false; */ /* * Minimize exit handler array in System. The System module includes * an array of functions that are registered with System_atexit() to be * called by System_exit(). */ System.maxAtexitHandlers = 4; /* * Uncomment this line to disable the Error print function. * We lose error information when this is disabled since the errors are * not printed. Disabling the raiseHook will save some code space if * your app is not using System_printf() since the Error_print() function * calls System_printf(). Error.raiseHook = null; */ /* * Uncomment this line to keep Error, Assert, and Log strings from being * loaded on the target. These strings are placed in the .const section. * Setting this parameter to false will save space in the .const section. * Error, Assert and Log message will print raw ids and args instead of * a formatted message. Text.isLoaded = false; */ /* * Uncomment this line to disable the output of characters by SysMin * when the program exits. SysMin writes characters to a circular buffer. * This buffer can be viewed using the SysMin Output view in ROV. SysMin.flushAtExit = false; */ /* * The BIOS module will create the default heap for the system. * Specify the size of this default heap. */ //BIOS.heapSize = 0x1000; // initial setting BIOS.heapSize = 0x2000; // from pa.cfg BIOS.heapSection = ".systemHeap"; Program.sectMap[".systemHeap"] = "HOST_DDR3"; if (xdc.global.SrDDr3_2Mem_cacheEnable == false) { // Disable cache on ARM for the shared memory region var Mmu = xdc.useModule('ti.sysbios.family.arm.a15.Mmu'); // descriptor attribute structure var attrs = new Mmu.DescriptorAttrs(); // Note: If running in SMP mode, all page table entries for memory // shared between the SMP cores should mark the memory as // inner-shareable. This is to ensure that the cached copy of // the memory region is kept coherent accross cores. Mmu.initDescAttrsMeta(attrs); attrs.type = Mmu.DescriptorType_BLOCK; // BLOCK descriptor attrs.shareable = 2; //3; // 2 - outer-sharerable attrs.attrIndx = 0;//2; // MAIR0 Byte2 describes // memory attributes for // this level2 entry // write memory region attribute in mairRegAttr[2] i.e. MAIR0 Reg Byte2 Mmu.setMAIRMeta(0, 0x44); // Mark mem regions as non-cacheable /* Get a handle to the C64P Target */ // TODO: remove hardcoded address and get correct values from .bld var COMMON2_DDR3_base = 0x81000000; var COMMON2_DDR3_end = 0x81000000 + 0x01000000; // Set the descriptor for each entry in the address range for (var i=COMMON2_DDR3_base; i < COMMON2_DDR3_end; i = i + 0x00200000) { // Each 'BLOCK' descriptor entry spans a 2MB address range Mmu.setSecondLevelDescMeta(i, i, attrs); } } /* * Build a custom SYS/BIOS library from sources. */ BIOS.libType = (RB ? BIOS.LibType_NonInstrumented : BIOS.LibType_Instrumented); // BIOS.libType = BIOS.LibType_Custom; // BIOS.libType = BIOS.LibType_Debug; /* System stack size (used by ISRs and Swis) */ Program.stack = 0x2000; Program.sectMap[".stack"] = "HOST_MSMC"; /* Circular buffer size for System_printf() */ SysMin.bufSize = 0x200; System.SupportProxy = SysMin; /* ------ */ /* Set CPU frequency to 600 MHz */ BIOS.cpuFreq.lo = 600000000; BIOS.cpuFreq.hi = 0; /* Set Sysclock period (usec.) */ Clock.tickPeriod = 1000; // FL: measured period ~852 usec.?? /* Configure Logging */ LoggingSetup.loggerType = LoggingSetup.LoggerType_STOPMODE; LoggingSetup.sysbiosTaskLogging = false; //true; LoggingSetup.sysbiosSwiLogging = false; // no Swi's in system LoggingSetup.sysbiosHwiLogging = false; //true; //LoggingSetup.sysbiosLoggerSize = 16384; LoggingSetup.loadLogging = false; //true; LoggingSetup.mainLogging = true; // false; LoggingSetup.mainLoggingRuntimeControl = false; LoggingSetup.mainLoggerSize = 81960; //LoggingSetup.memorySectionName = "HOST_DDR3"; //"HOST_MSMC"; /* Configure Load Logging */ // FL: doesn't work //Load.taskEnabled = true; //Load.hwiEnabled = true; //Load.common$.diags_USER4 = Diags.ALWAYS_ON; //Task.common$.diags_USER1 = Diags.ALWAYS_ON; Task.common$.diags_INFO = Diags.ALWAYS_ON; /* Disallow nested hardware interrupts */ Hwi.dispatcherAutoNestingSupport = false; var ProjName = environment["ProjName"]; var topo = ProjName.replace( /pa_([a-z])[0-9]+_.*/, "$1"); var AudioClockSim = environment["AudioClockSim"]; var acSimBuild = (AudioClockSim == "1" ? true : false); if (acSimBuild == true) { // // IPC simulation // /* Add timer to simulate Rx audio IPC message */ var timer0Params = new Timer.Params(); timer0Params.instance.name = "timerRxAudio"; timer0Params.period = 5330; timer0Params.startMode = xdc.module("ti.sysbios.interfaces.ITimer").StartMode_USER; Program.global.timerRxAudio = Timer.create(1, null, timer0Params); /* Add timer to simulate Tx audio IPC message */ var timer1Params = new Timer.Params(); timer1Params.instance.name = "timerTxAudio"; timer1Params.startMode = xdc.module("ti.sysbios.interfaces.ITimer").StartMode_USER; timer1Params.period = 5330; Program.global.timerTxAudio = Timer.create(2, null, timer1Params); /* Add semaphore for Rx audio DMA */ var semaphore0Params = new Semaphore.Params(); semaphore0Params.instance.name = "semaphoreRxAudio"; Program.global.semaphoreRxAudio = Semaphore.create(null, semaphore0Params); /* Add semaphore for Tx audio DMA */ var semaphore1Params = new Semaphore.Params(); semaphore1Params.instance.name = "semaphoreTxAudio"; Program.global.semaphoreTxAudio = Semaphore.create(null, semaphore1Params); } /* Set default stack size for tasks */ Task.defaultStackSize = 2048; /* Set size of idle task stack */ Task.idleTaskStackSize = 2048; /* Add Audio Stream Decode Processing (ASDP) task */ var task0Params = new Task.Params(); task0Params.instance.name = "TaskAsdp"; task0Params.stackSize = (0x8000+0x1000); task0Params.stackSection = ".far:taskStackSectionAsdp"; //task0Params.arg0 = 0; task0Params.arg0 = $externPtr("asdp_params_PA" + topo); task0Params.arg1 = $externPtr("asdp_patchs_PA" + topo); task0Params.priority = -1; //3; Program.global.TaskAsdp = Task.create("&taskAsdpFxn", task0Params); Program.sectMap[".far:taskStackSectionAsdp"] = "HOST_MSMC"; /* Add System Initialization task */ var task1Params = new Task.Params(); task1Params.instance.name = "TaskSysInit"; task1Params.stackSize = 0x1000; task1Params.stackSection = ".far:taskStackSectionSysInit"; task1Params.priority = 4; Program.global.TaskSysInit = Task.create("&taskSysInitFxn", task1Params); Program.sectMap[".far:taskStackSectionSysInit"] = "HOST_DDR3"; Program.sectMap[".far:taskStackSection"] = "HOST_DDR3"; // SDRAM in pa.cfg // Dec ip circular buffer will be in MSMC, size~=180 kB. // Dec op circular buffer will be in MSMC, size~=192 kB. // However, both buffers will be in Shared Region MSMC. // So this is heap is for other use local to ARM (e.g. Dec chain). Set to 128 kB for now. /* Add MSMC SRAM heap */ // formerly L3RAM var heapMem1Params = new HeapMem.Params(); heapMem1Params.instance.name = "heapMemMsmcSram"; heapMem1Params.size = (224-4)*1024; //128*1024 heapMem1Params.sectionName = ".msmcSramHeap"; Program.global.heapMemMsmcSram = HeapMem.create(heapMem1Params); Program.sectMap[".msmcSramHeap"] = "HOST_MSMC"; /* Add DDR3 heap */ // formerly SDRAM var heapMem2Params = new HeapMem.Params(); heapMem2Params.instance.name = "heapMemDdr3"; heapMem2Params.size = 5350528+ (3*1024*1024); // Added 3 MB for DTS decoder;//4350528; heapMem2Params.sectionName = ".ddr3Heap"; Program.global.heapMemDdr3 = HeapMem.create(heapMem2Params); Program.sectMap[".ddr3Heap"] = "HOST_DDR3"; Program.global.heapMemL2Sram = Program.global.heapMemMsmcSram; //Program.sectMap[".globalSectionPafAstConfig"] = "COMMON_DDR3"; //Program.sectMap[".globalSectionAcpStdBetaTable"] = "COMMON_DDR3"; /* Define HWI Hook Set for PFP */ Hwi.addHookSet({ registerFxn: '&pfpHwiRegister', createFxn: '&pfpHwiCreate', beginFxn: '&pfpHwiBegin', endFxn: '&pfpHwiEnd', deleteFxn: null, }); /* Define SWI Hook Set for PFP */ Swi.addHookSet({ registerFxn: '&pfpSwiRegister', // need this for Id for Hook context createFxn: '&pfpSwiCreate', // malloc context storage space readyFxn: '&pfpSwiReady', beginFxn: '&pfpSwiBegin', endFxn: '&pfpSwiEnd', deleteFxn: null, }); /* Define Task Hook Set for PFP */ Task.addHookSet({ registerFxn: '&pfpTaskRegister', createFxn: '&pfpTaskCreate', readyFxn: '&pfpTaskReady', switchFxn: '&pfpTaskSwitch', exitFxn: null, deleteFxn: null, }); /* Added for PFP, not necessary */ Hwi.common$.namedInstance=true; Swi.common$.namedInstance=true; Task.common$.namedInstance=true;