/* ================ General configuration ================ */ var enableStaticIP = 1; 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 LoggerBuf = xdc.useModule('xdc.runtime.LoggerBuf'); var Main = xdc.useModule('xdc.runtime.Main'); var Memory = xdc.useModule('xdc.runtime.Memory') var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem'); var HeapBuf = xdc.useModule('ti.sysbios.heaps.HeapBuf'); 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 Clock = xdc.useModule('ti.sysbios.knl.Clock'); var Swi = xdc.useModule('ti.sysbios.knl.Swi'); var Task = xdc.useModule('ti.sysbios.knl.Task'); var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore'); var Hwi = xdc.useModule('ti.sysbios.hal.Hwi'); var Cache = xdc.useModule('ti.sysbios.hal.Cache'); var Event = xdc.useModule('ti.sysbios.knl.Event'); var Seconds = xdc.useModule('ti.sysbios.hal.Seconds'); var Edma = xdc.loadPackage ("ti.sdo.edma3.drv.sample"); var drv = xdc.loadPackage ("ti.sdo.edma3.drv"); var rm = xdc.loadPackage ("ti.sdo.edma3.rm"); var devType = "omapl138" var socType = "omapl138"; /*use CSL package*/ var Csl = xdc.loadPackage('ti.csl'); Csl.Settings.deviceType = socType; /* Load the OSAL package */ var osType = "tirtos" var Osal = xdc.useModule('ti.osal.Settings'); Osal.osType = osType; Osal.socType = devType; /* Load Profiling package */ //var Utils = xdc.loadPackage('ti.utils.profiling'); /* Load the MMCSD package */ var Mmcsd = xdc.loadPackage('ti.drv.mmcsd'); Mmcsd.Settings.useDma = "false"; Mmcsd.Settings.enableProfiling = false; Mmcsd.Settings.socType = socType; var Fatfs = xdc.loadPackage('ti.fs.fatfs'); /* Load the GPIO package */ var GPIO = xdc.loadPackage('ti.drv.gpio'); /* Load the uart package */ var Uart = xdc.loadPackage('ti.drv.uart'); Uart.Settings.enableProfiling = false; Uart.Settings.socType = devType; Uart.Settings.useDma = "true"; /* Load the I2C package */ var I2c = xdc.loadPackage('ti.drv.i2c'); I2c.Settings.socType = devType; /* Load the spi package */ var Spi = xdc.loadPackage('ti.drv.spi'); Spi.Settings.enableProfiling = false; Spi.Settings.socType = devType; Spi.Settings.useDma = "false"; /* Load the Board package and set the board name */ var Board = xdc.loadPackage('ti.board'); Board.Settings.boardName = "lcdkOMAPL138"; /* Load the EMAC package */ var Emac = xdc.loadPackage('ti.drv.emac'); Emac.Settings.socType = devType; Emac.Settings.enableProfiling = false; var Nimu = xdc.loadPackage('ti.transport.ndk.nimu'); Nimu.Settings.socType = socType; /** Use this load to configure NDK 2.2 and above using RTSC. In previous versions of ** the NDK RTSC configuration was not supported and you should comment this out. */ /* NDK modules */ var Global = xdc.useModule('ti.ndk.config.Global'); var Ip = xdc.useModule('ti.ndk.config.Ip'); var Tcp = xdc.useModule('ti.ndk.config.Tcp'); var Udp = xdc.useModule('ti.ndk.config.Udp'); var Telnet = xdc.useModule('ti.ndk.config.Telnet'); /*var Clock.TimerProxy = xdc.useModule('ti.sysbios.timers.dmtimer.Timer');*/ /* * Program.argSize sets the size of the .args section. * The examples don't use command line args so argSize is set to 0. */ Program.argSize = 0x0; /* * 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; */ /* No runtime stack checking is performed */ Task.checkStackFlag = true; /* Reduce the number of task priorities */ Task.numPriorities = 16; /* * The BIOS module will create the default heap for the system. * Specify the size of this default heap. */ BIOS.heapSize = 0x200000; /* * Build a custom SYS/BIOS library from sources. */ BIOS.libType = BIOS.LibType_Custom; BIOS.assertsEnabled = true; BIOS.logsEnabled = true; /* System stack size (used by ISRs and Swis) */ Program.stack = 0x10000; /* Circular buffer size for System_printf() */ SysMin.bufSize = 0x200; /* * Create and install logger for the whole system */ var loggerBufParams = new LoggerBuf.Params(); loggerBufParams.numEntries = 16; var logger0 = LoggerBuf.create(loggerBufParams); Defaults.common$.logger = logger0; Main.common$.diags_INFO = Diags.ALWAYS_ON; if (enableStaticIP) { // Settings for static IP configuration Ip.ResolveIP = false; Ip.CallByIP = false; Ip.autoIp = false; //Ip.address = "192.168.1.100"; Ip.address = "none"; //Ip.mask = "255.255.254.0"; //Ip.gatewayIpAddr = "192.168.1.254"; } else { Ip.dhcpClientMode = Ip.CIS_FLG_IFIDXVALID; } Global.pktSizeFrameBuf = 1536; Global.pktNumFrameBufs = 192; Global.ndkTickPeriod = 100; Global.kernTaskPriLevel = 11; Global.serviceReportHook = null; Global.IPv6 = false; Global.stackInitHook = "&stackInitHook"; Tcp.transmitBufSize = 16384; Tcp.receiveBufSize = 65536; Tcp.receiveBufLimit = 65536; Task.defaultStackSize = 4096; Task.idleTaskStackSize = 4096; System.SupportProxy = SysMin; var Cache1 = xdc.useModule('ti.sysbios.family.arm.arm9.Cache'); var Mmu = xdc.useModule('ti.sysbios.family.arm.arm9.Mmu'); /* Enable the cache */ Cache1.enableCache = true; /* Enable the MMU (Required for L1 data caching) */ Mmu.enableMMU = true; /* * default settings are: bufferable: true, cacheable: true * so we don't need to do anything for 'normal' DDR * * Map the peripheral space. Peripheral space is not cached. */ // descriptor attribute structure var attrs = { type: Mmu.FirstLevelDesc_SECTION, // SECTION descriptor bufferable: false, // bufferable cacheable: false, // cacheable imp: 1,// implementation defined domain: 3, // domain between 0-15 accPerm: 3,// read/write permission }; for (var i= 0x01C00000; i < 0x01F12000; i = i + 0x100000) { Mmu.setFirstLevelDescMeta(i, i, attrs); } // Shared L3 for IPC for (var i= 0x80000000; i < 0x81000000; i = i + 0x100000) { Mmu.setFirstLevelDescMeta(i, i, attrs); } for (var i=0x60000000; i < 0x68007FFF; i = i + 0x00100000) //EMIF { // Each 'SECTION' descriptor entry spans a 1MB address range Mmu.setFirstLevelDescMeta(i, i, attrs); } // Arm Loader header has to be readable from the Application /*for (var i= 0xC0000000; i < 0xC2000000; i = i + 0x100000) { Mmu.setFirstLevelDescMeta(i, i, attrs); }*/ var memmap = Program.cpu.memoryMap; var DDR = null; // Find DDR in memory map for (var i=0; i < memmap.length; i++) { if (memmap[i].name == "DDR") { DDR = memmap[i]; } } // Place the MMU table in the DDR memory segment if it exists if (DDR != null) { var sectionName = "ti.sysbios.family.arm.arm9.mmuTableSection"; Program.sectMap[sectionName] = new Program.SectionSpec(); Program.sectMap[sectionName].type = "NOINIT"; Program.sectMap[sectionName].loadSegment = "DDR"; } else { print("No DDR memory segment was found"); } /* This is the default memory heap. */ Program.sectMap["emacComm"] = "DDR"; // ----------------- TASKS ------------------- var task0Params = new Task.Params(); task0Params.instance.name = "task_fatfs"; task0Params.stackSize = 8192; task0Params.priority = 4; Program.global.task_fatfs = Task.create("&fatfs_taskFn", task0Params); var task1Params = new Task.Params(); task1Params.instance.name = "task_main"; task1Params.priority = 5; task1Params.stackSize = 2048; Program.global.task_main = Task.create("&main_task", task1Params); // ----------------- END TASKS ----------------- /* var hwi0Params = new Hwi.Params(); hwi0Params.instance.name = "hwi0"; hwi0Params.priority = 7; Program.global.hwi0 = Hwi.create(28, "&Ipc_Isr", hwi0Params); */ var task2Params = new Task.Params(); task2Params.instance.name = "task_uart_fpga"; task2Params.priority = 6; task2Params.stackSize = 4096; Program.global.task_uart_fpga = Task.create("&uart_fpga_taskFn", task2Params); var task3Params = new Task.Params(); task3Params.instance.name = "task_time"; task3Params.priority = 6; Program.global.task_time = Task.create("&time_taskFn", task3Params); var task4Params0 = new Task.Params(); task4Params0.instance.name = "task_uart1"; task4Params0.priority = 8; task4Params0.stackSize = 1024; Program.global.task_uart1 = Task.create("&uart1_taskFn", task4Params0);