Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Copyright (c) 2013-2014, Texas Instruments Incorporated
- * 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.
- */
- /*
- * ======== Ipu1.cfg ========
- * Platform: DRA7XX_android_elf
- * Target: ti.targets.arm.elf.M4
- */
- /* root of the configuration object model */
- var Program = xdc.useModule('xdc.cfg.Program');
- var Event = xdc.useModule('ti.sysbios.knl.Event');
- var Cache = xdc.useModule('ti.sysbios.hal.Cache');
- var Swi = xdc.useModule('ti.sysbios.knl.Swi');
- /*
- * Disable edma usage from cfg, it seems precompiled libraries are broken.
- * var DRV = xdc.useModule('ti.sdo.edma3.drv.DRV');
- * var RM = xdc.useModule('ti.sdo.edma3.rm.RM');
- * var RmSample = xdc.useModule('ti.sdo.edma3.rm.sample.RmSample');
- */
- /* build arguments for this executable */
- var cfgArgs = Program.build.cfgArgs;
- //var configBld = xdc.loadCapsule(cfgArgs.configBld);
- /* application uses the following modules and packages */
- xdc.useModule('xdc.runtime.Assert');
- xdc.useModule('xdc.runtime.Diags');
- xdc.useModule('xdc.runtime.Error');
- xdc.useModule('xdc.runtime.Log');
- xdc.useModule('xdc.runtime.Registry');
- xdc.useModule('ti.sysbios.gates.GateHwi');
- var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore');
- xdc.useModule('ti.sysbios.knl.Task');
- /*
- * ======== IPC Configuration ========
- */
- xdc.loadPackage('ti.ipc.ipcmgr');
- Program.global.procName = "IPU1";
- var ipc_cfg = xdc.loadCapsule("../shared/ipc.cfg.xs");
- var BIOS = xdc.useModule('ti.sysbios.BIOS');
- // BIOS.addUserStartupFunction('&IpcMgr_ipcStartup');
- /*
- * ======== SYS/BIOS Configuration ========
- */
- if (Program.build.profile == "debug") {
- BIOS.libType = BIOS.LibType_Debug;
- } else {
- BIOS.libType = BIOS.LibType_Custom;
- }
- BIOS.smpEnabled = true; /* only support SMP mode on IPU */
- var Core = xdc.useModule('ti.sysbios.family.arm.ducati.Core');
- Core.ipuId = 1;
- /* no rts heap */
- Program.argSize = 100; /* minimum size */
- Program.stack = 0x1000;
- var Task = xdc.useModule('ti.sysbios.knl.Task');
- Task.common$.namedInstance = true;
- /* Remap the interrupt xbar mmr base address to match AMMU settings */
- var IntXbar = xdc.useModule('ti.sysbios.family.shared.vayu.IntXbar');
- IntXbar.mmrBaseAddr = 0x6A002000;
- /* default memory heap */
- var Memory = xdc.useModule('xdc.runtime.Memory');
- var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
- var heapMemParams = new HeapMem.Params();
- heapMemParams.size = 0x300000;
- Memory.defaultHeapInstance = HeapMem.create(heapMemParams);
- /* create heaps for IPC Message queues */
- var MessageQ = xdc.useModule('ti.sdo.ipc.MessageQ');
- var HeapBuf = xdc.useModule('ti.sysbios.heaps.HeapBuf');
- /* MessageQ heap 0 */
- var params = new HeapBuf.Params;
- params.align = 8;
- params.blockSize = 512;
- params.numBlocks = 256;
- var msgHeap = HeapBuf.create(params);
- MessageQ.registerHeapMeta(msgHeap, 0);
- /* MessageQ heap 1 */
- params = new HeapBuf.Params;
- params.align = 8;
- params.blockSize = 512;
- params.numBlocks = 32;
- msgHeap = HeapBuf.create(params);
- MessageQ.registerHeapMeta(msgHeap, 1);
- /* MessageQ heap 2 */
- params = new HeapBuf.Params;
- params.align = 8;
- params.blockSize = 512;
- params.numBlocks = 32;
- msgHeap = HeapBuf.create(params);
- MessageQ.registerHeapMeta(msgHeap, 2);
- /* MessageQ heap 3 */
- params = new HeapBuf.Params;
- params.align = 8;
- params.blockSize = 512;
- params.numBlocks = 32;
- msgHeap = HeapBuf.create(params);
- MessageQ.registerHeapMeta(msgHeap, 3);
- /* MessageQ heap 4 */
- params = new HeapBuf.Params;
- params.align = 8;
- params.blockSize = 512;
- params.numBlocks = 32;
- msgHeap = HeapBuf.create(params);
- MessageQ.registerHeapMeta(msgHeap, 4);
- /* MessageQ heap 5 */
- params = new HeapBuf.Params;
- params.align = 8;
- params.blockSize = 512;
- params.numBlocks = 32;
- msgHeap = HeapBuf.create(params);
- MessageQ.registerHeapMeta(msgHeap, 5);
- /* MessageQ heap 6 */
- params = new HeapBuf.Params;
- params.align = 8;
- params.blockSize = 512;
- params.numBlocks = 32;
- msgHeap = HeapBuf.create(params);
- MessageQ.registerHeapMeta(msgHeap, 6);
- /* MessageQ heap 7 */
- params = new HeapBuf.Params;
- params.align = 8;
- params.blockSize = 512;
- params.numBlocks = 32;
- msgHeap = HeapBuf.create(params);
- MessageQ.registerHeapMeta(msgHeap, 7);
- /* Setup MessageQ transport */
- var VirtioSetup = xdc.useModule('ti.ipc.transports.TransportRpmsgSetup');
- MessageQ.SetupTransportProxy = VirtioSetup;
- /* Setup NameServer remote proxy */
- var NameServer = xdc.useModule("ti.sdo.utils.NameServer");
- var NsRemote = xdc.useModule("ti.ipc.namesrv.NameServerRemoteRpmsg");
- NameServer.SetupProxy = NsRemote;
- /* Enable Memory Translation module that operates on the BIOS Resource Table */
- var Resource = xdc.useModule('ti.ipc.remoteproc.Resource');
- /* Use SysMin because trace buffer address is required for Linux/QNX
- * trace debug driver, plus provides better performance.
- */
- var System = xdc.useModule('xdc.runtime.System');
- var SysMin = xdc.useModule('ti.sysbios.smp.SysMin');
- SysMin.bufSize = 0x4000;
- System.SupportProxy = SysMin;
- Program.sectMap[".tracebuf"] = "TRACE_BUF";
- Program.sectMap[".errorbuf"] = "EXC_DATA";
- /* Configure external timer base address to match resource table mapping.
- */
- var dmTimer = xdc.useModule('ti.sysbios.timers.dmtimer.Timer');
- /* dmTimer 0 mapped to GPT1 */
- dmTimer.timerSettings[0].baseAddr = 0x6AE18000;
- /* dmTimer 1 mapped to GPT2 */
- dmTimer.timerSettings[1].baseAddr = 0x68032000;
- /* dmTimer 2 mapped to GPT3 */
- dmTimer.timerSettings[2].baseAddr = 0x68034000;
- /* dmTimer 3 mapped to GPT4 */
- dmTimer.timerSettings[3].baseAddr = 0x68036000;
- /* dmTimer 4 mapped to GPT5 */
- dmTimer.timerSettings[4].baseAddr = 0x68820000;
- /* dmTimer 5 mapped to GPT6 */
- dmTimer.timerSettings[5].baseAddr = 0x68822000;
- /* dmTimer 6 mapped to GPT7 */
- dmTimer.timerSettings[6].baseAddr = 0x68034000;
- /* dmTimer 7 mapped to GPT8 */
- dmTimer.timerSettings[7].baseAddr = 0x68036000;
- /* dmTimer 8 mapped to GPT9 */
- dmTimer.timerSettings[8].baseAddr = 0x6803E000;
- /* dmTimer 9 mapped to GPT10 */
- dmTimer.timerSettings[9].baseAddr = 0x68086000;
- /* dmTimer 10 mapped to GPT11 */
- dmTimer.timerSettings[10].baseAddr = 0x68088000;
- /* dmTimer 11 mapped to GPT12 */
- dmTimer.timerSettings[11].baseAddr = 0x6AE20000;
- /* dmTimer 12 mapped to GPT13 */
- dmTimer.timerSettings[12].baseAddr = 0x68828000;
- /* dmTimer 13 mapped to GPT14 */
- dmTimer.timerSettings[13].baseAddr = 0x6882A000;
- /* dmTimer 14 mapped to GPT15 */
- dmTimer.timerSettings[14].baseAddr = 0x6882C000;
- /* dmTimer 15 mapped to GPT16 */
- dmTimer.timerSettings[15].baseAddr = 0x6882E000;
- /* use external timers because they keep running when IPU is not */
- var halTimer = xdc.useModule('ti.sysbios.hal.Timer');
- halTimer.TimerProxy = dmTimer;
- /* ----------------------------- TICK ---------------------------------------*/
- var Clock = xdc.useModule('ti.sysbios.knl.Clock');
- Clock.tickSource = Clock.TickSource_USER;
- /* Configure GPTimer11 as BIOS clock source */
- Clock.timerId = 10;
- var Timer = xdc.useModule('ti.sysbios.timers.dmtimer.Timer');
- var timerParams = new Timer.Params();
- timerParams.period = Clock.tickPeriod;
- timerParams.periodType = Timer.PeriodType_MICROSECS;
- /* Smart-idle wake-up-capable mode */
- timerParams.tiocpCfg.idlemode = 0x3;
- /* Wake-up generation for Overflow */
- timerParams.twer.ovf_wup_ena = 0x1;
- //overwrite the timer frequency for dmtimer (suggested by ashish)
- //Fix for timer issue, which is ticking with 9.6 ms instead of 10ms
- Timer.intFreqs[10].lo = 20000000;
- Timer.intFreqs[10].hi = 0;
- Timer.create(Clock.timerId, Clock.doTick, timerParams);
- /* configure the IPU AMMU */
- xdc.loadCapsule("IpuAmmu.cfg");
- /*
- * ======== Power Management Configuration ========
- */
- xdc.loadPackage('ti.pm');
- var Power = xdc.useModule('ti.sysbios.family.arm.ducati.smp.Power');
- Power.loadSegment = "PM_DATA";
- /* idle functions, power management functions should be last */
- var Idle = xdc.useModule('ti.sysbios.knl.Idle');
- /* function to flush unicache on each core */
- Idle.addCoreFunc('&VirtQueue_cacheWb', 0);
- Idle.addCoreFunc('&VirtQueue_cacheWb', 1);
- /* power management idle functions for each core */
- Idle.addCoreFunc('&IpcPower_idle', 0);
- Idle.addCoreFunc('&IpcPower_idle', 1);
- /*
- * ======== Instrumentation Configuration ========
- */
- /* system logger */
- var LoggerSys = xdc.useModule('xdc.runtime.LoggerSys');
- var LoggerSysParams = new LoggerSys.Params();
- var Defaults = xdc.useModule('xdc.runtime.Defaults');
- Defaults.common$.logger = LoggerSys.create(LoggerSysParams);
- /* enable runtime Diags_setMask() for non-XDC spec'd modules */
- var Diags = xdc.useModule('xdc.runtime.Diags');
- Diags.setMaskEnabled = true;
- /* override diags mask for selected modules */
- xdc.useModule('xdc.runtime.Main');
- Diags.setMaskMeta("xdc.runtime.Main",
- Diags.ENTRY | Diags.EXIT | Diags.INFO, Diags.RUNTIME_ON);
- var Registry = xdc.useModule('xdc.runtime.Registry');
- Registry.common$.diags_ENTRY = Diags.RUNTIME_OFF;
- Registry.common$.diags_EXIT = Diags.RUNTIME_OFF;
- Registry.common$.diags_INFO = Diags.RUNTIME_OFF;
- Registry.common$.diags_USER1 = Diags.RUNTIME_OFF;
- Registry.common$.diags_LIFECYCLE = Diags.RUNTIME_OFF;
- Registry.common$.diags_STATUS = Diags.RUNTIME_OFF;
- var Main = xdc.useModule('xdc.runtime.Main');
- Main.common$.diags_ASSERT = Diags.ALWAYS_ON;
- Main.common$.diags_INTERNAL = Diags.ALWAYS_ON;
- var Hwi = xdc.useModule('ti.sysbios.family.arm.m3.Hwi');
- Hwi.nvicCCR.DIV_0_TRP = 1;
- var Resource = xdc.useModule('ti.ipc.remoteproc.Resource');
- Resource.customTable = true;
- /*
- * -------- I2C --------
- */
- /* Use Semaphore, and Task modules and set global properties */
- Program.global.hsi2c_sem0 = Semaphore.create(1);
- Program.global.hsi2c_sem1 = Semaphore.create(1);
- var iomFxns = "I2c_IOMFXNS";
- var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore');
- Program.global.hsi2c2_sem = Semaphore.create(1);
- var GIO = xdc.useModule('ti.sysbios.io.GIO');
- var initI2c2Fxn = "ipu_i2c2_init";
- var deviceIdI2c2 = 1;
- var deviceParamsI2c2 = "devInitParamsI2c2";
- GIO.addDeviceMeta("i2c", iomFxns, initI2c2Fxn, deviceIdI2c2, deviceParamsI2c2);
- /* ========================================================================== */
- /* CFG script for the McSPI sample */
- /* ========================================================================== */
- var IntXbar = xdc.useModule('ti.sysbios.family.shared.vayu.IntXbar');
- var iomFxns = "Mcspi_IOMFXNS";
- var initFxn = "ipu1_mcspi0_init";
- var deviceParams = "mcspiPrms";
- var deviceId = 0;
- GIO.addDeviceMeta("/mcspi0", iomFxns, initFxn, deviceId, deviceParams);
- /*
- * -------- System config (added by CTC) --------
- */
- Memory.defaultHeapSize = 0x200000;
- Program.sysStack = 4096;
- Task.deleteTerminatedTasks = true;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement