Advertisement
Guest User

Ipu1.cfg

a guest
Sep 13th, 2016
318
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.18 KB | None | 0 0
  1. /*
  2. * Copyright (c) 2013-2014, Texas Instruments Incorporated
  3. * All rights reserved.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions
  7. * are met:
  8. *
  9. * * Redistributions of source code must retain the above copyright
  10. * notice, this list of conditions and the following disclaimer.
  11. *
  12. * * Redistributions in binary form must reproduce the above copyright
  13. * notice, this list of conditions and the following disclaimer in the
  14. * documentation and/or other materials provided with the distribution.
  15. *
  16. * * Neither the name of Texas Instruments Incorporated nor the names of
  17. * its contributors may be used to endorse or promote products derived
  18. * from this software without specific prior written permission.
  19. *
  20. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  21. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
  22. * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  23. * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  24. * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  25. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  26. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  27. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  28. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  29. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
  30. * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  31. */
  32.  
  33. /*
  34. * ======== Ipu1.cfg ========
  35. * Platform: DRA7XX_android_elf
  36. * Target: ti.targets.arm.elf.M4
  37. */
  38.  
  39. /* root of the configuration object model */
  40. var Program = xdc.useModule('xdc.cfg.Program');
  41. var Event = xdc.useModule('ti.sysbios.knl.Event');
  42. var Cache = xdc.useModule('ti.sysbios.hal.Cache');
  43. var Swi = xdc.useModule('ti.sysbios.knl.Swi');
  44.  
  45. /*
  46. * Disable edma usage from cfg, it seems precompiled libraries are broken.
  47. * var DRV = xdc.useModule('ti.sdo.edma3.drv.DRV');
  48. * var RM = xdc.useModule('ti.sdo.edma3.rm.RM');
  49. * var RmSample = xdc.useModule('ti.sdo.edma3.rm.sample.RmSample');
  50. */
  51.  
  52. /* build arguments for this executable */
  53. var cfgArgs = Program.build.cfgArgs;
  54. //var configBld = xdc.loadCapsule(cfgArgs.configBld);
  55.  
  56. /* application uses the following modules and packages */
  57. xdc.useModule('xdc.runtime.Assert');
  58. xdc.useModule('xdc.runtime.Diags');
  59. xdc.useModule('xdc.runtime.Error');
  60. xdc.useModule('xdc.runtime.Log');
  61. xdc.useModule('xdc.runtime.Registry');
  62.  
  63. xdc.useModule('ti.sysbios.gates.GateHwi');
  64. var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore');
  65. xdc.useModule('ti.sysbios.knl.Task');
  66.  
  67. /*
  68. * ======== IPC Configuration ========
  69. */
  70. xdc.loadPackage('ti.ipc.ipcmgr');
  71.  
  72. Program.global.procName = "IPU1";
  73. var ipc_cfg = xdc.loadCapsule("../shared/ipc.cfg.xs");
  74.  
  75. var BIOS = xdc.useModule('ti.sysbios.BIOS');
  76. // BIOS.addUserStartupFunction('&IpcMgr_ipcStartup');
  77.  
  78. /*
  79. * ======== SYS/BIOS Configuration ========
  80. */
  81. if (Program.build.profile == "debug") {
  82. BIOS.libType = BIOS.LibType_Debug;
  83. } else {
  84. BIOS.libType = BIOS.LibType_Custom;
  85. }
  86. BIOS.smpEnabled = true; /* only support SMP mode on IPU */
  87.  
  88. var Core = xdc.useModule('ti.sysbios.family.arm.ducati.Core');
  89. Core.ipuId = 1;
  90.  
  91. /* no rts heap */
  92. Program.argSize = 100; /* minimum size */
  93. Program.stack = 0x1000;
  94.  
  95. var Task = xdc.useModule('ti.sysbios.knl.Task');
  96. Task.common$.namedInstance = true;
  97.  
  98. /* Remap the interrupt xbar mmr base address to match AMMU settings */
  99. var IntXbar = xdc.useModule('ti.sysbios.family.shared.vayu.IntXbar');
  100. IntXbar.mmrBaseAddr = 0x6A002000;
  101.  
  102. /* default memory heap */
  103. var Memory = xdc.useModule('xdc.runtime.Memory');
  104. var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
  105. var heapMemParams = new HeapMem.Params();
  106. heapMemParams.size = 0x300000;
  107. Memory.defaultHeapInstance = HeapMem.create(heapMemParams);
  108.  
  109. /* create heaps for IPC Message queues */
  110. var MessageQ = xdc.useModule('ti.sdo.ipc.MessageQ');
  111. var HeapBuf = xdc.useModule('ti.sysbios.heaps.HeapBuf');
  112.  
  113. /* MessageQ heap 0 */
  114. var params = new HeapBuf.Params;
  115. params.align = 8;
  116. params.blockSize = 512;
  117. params.numBlocks = 256;
  118. var msgHeap = HeapBuf.create(params);
  119.  
  120. MessageQ.registerHeapMeta(msgHeap, 0);
  121.  
  122. /* MessageQ heap 1 */
  123. params = new HeapBuf.Params;
  124. params.align = 8;
  125. params.blockSize = 512;
  126. params.numBlocks = 32;
  127. msgHeap = HeapBuf.create(params);
  128.  
  129. MessageQ.registerHeapMeta(msgHeap, 1);
  130.  
  131. /* MessageQ heap 2 */
  132. params = new HeapBuf.Params;
  133. params.align = 8;
  134. params.blockSize = 512;
  135. params.numBlocks = 32;
  136. msgHeap = HeapBuf.create(params);
  137.  
  138. MessageQ.registerHeapMeta(msgHeap, 2);
  139.  
  140. /* MessageQ heap 3 */
  141. params = new HeapBuf.Params;
  142. params.align = 8;
  143. params.blockSize = 512;
  144. params.numBlocks = 32;
  145. msgHeap = HeapBuf.create(params);
  146.  
  147. MessageQ.registerHeapMeta(msgHeap, 3);
  148.  
  149. /* MessageQ heap 4 */
  150. params = new HeapBuf.Params;
  151. params.align = 8;
  152. params.blockSize = 512;
  153. params.numBlocks = 32;
  154. msgHeap = HeapBuf.create(params);
  155.  
  156. MessageQ.registerHeapMeta(msgHeap, 4);
  157.  
  158. /* MessageQ heap 5 */
  159. params = new HeapBuf.Params;
  160. params.align = 8;
  161. params.blockSize = 512;
  162. params.numBlocks = 32;
  163. msgHeap = HeapBuf.create(params);
  164.  
  165. MessageQ.registerHeapMeta(msgHeap, 5);
  166.  
  167. /* MessageQ heap 6 */
  168. params = new HeapBuf.Params;
  169. params.align = 8;
  170. params.blockSize = 512;
  171. params.numBlocks = 32;
  172. msgHeap = HeapBuf.create(params);
  173.  
  174. MessageQ.registerHeapMeta(msgHeap, 6);
  175.  
  176. /* MessageQ heap 7 */
  177. params = new HeapBuf.Params;
  178. params.align = 8;
  179. params.blockSize = 512;
  180. params.numBlocks = 32;
  181. msgHeap = HeapBuf.create(params);
  182.  
  183. MessageQ.registerHeapMeta(msgHeap, 7);
  184.  
  185. /* Setup MessageQ transport */
  186. var VirtioSetup = xdc.useModule('ti.ipc.transports.TransportRpmsgSetup');
  187. MessageQ.SetupTransportProxy = VirtioSetup;
  188.  
  189. /* Setup NameServer remote proxy */
  190. var NameServer = xdc.useModule("ti.sdo.utils.NameServer");
  191. var NsRemote = xdc.useModule("ti.ipc.namesrv.NameServerRemoteRpmsg");
  192. NameServer.SetupProxy = NsRemote;
  193.  
  194. /* Enable Memory Translation module that operates on the BIOS Resource Table */
  195. var Resource = xdc.useModule('ti.ipc.remoteproc.Resource');
  196.  
  197. /* Use SysMin because trace buffer address is required for Linux/QNX
  198. * trace debug driver, plus provides better performance.
  199. */
  200. var System = xdc.useModule('xdc.runtime.System');
  201. var SysMin = xdc.useModule('ti.sysbios.smp.SysMin');
  202. SysMin.bufSize = 0x4000;
  203. System.SupportProxy = SysMin;
  204.  
  205. Program.sectMap[".tracebuf"] = "TRACE_BUF";
  206. Program.sectMap[".errorbuf"] = "EXC_DATA";
  207.  
  208. /* Configure external timer base address to match resource table mapping.
  209. */
  210. var dmTimer = xdc.useModule('ti.sysbios.timers.dmtimer.Timer');
  211. /* dmTimer 0 mapped to GPT1 */
  212. dmTimer.timerSettings[0].baseAddr = 0x6AE18000;
  213. /* dmTimer 1 mapped to GPT2 */
  214. dmTimer.timerSettings[1].baseAddr = 0x68032000;
  215. /* dmTimer 2 mapped to GPT3 */
  216. dmTimer.timerSettings[2].baseAddr = 0x68034000;
  217. /* dmTimer 3 mapped to GPT4 */
  218. dmTimer.timerSettings[3].baseAddr = 0x68036000;
  219. /* dmTimer 4 mapped to GPT5 */
  220. dmTimer.timerSettings[4].baseAddr = 0x68820000;
  221. /* dmTimer 5 mapped to GPT6 */
  222. dmTimer.timerSettings[5].baseAddr = 0x68822000;
  223. /* dmTimer 6 mapped to GPT7 */
  224. dmTimer.timerSettings[6].baseAddr = 0x68034000;
  225. /* dmTimer 7 mapped to GPT8 */
  226. dmTimer.timerSettings[7].baseAddr = 0x68036000;
  227. /* dmTimer 8 mapped to GPT9 */
  228. dmTimer.timerSettings[8].baseAddr = 0x6803E000;
  229. /* dmTimer 9 mapped to GPT10 */
  230. dmTimer.timerSettings[9].baseAddr = 0x68086000;
  231. /* dmTimer 10 mapped to GPT11 */
  232. dmTimer.timerSettings[10].baseAddr = 0x68088000;
  233. /* dmTimer 11 mapped to GPT12 */
  234. dmTimer.timerSettings[11].baseAddr = 0x6AE20000;
  235. /* dmTimer 12 mapped to GPT13 */
  236. dmTimer.timerSettings[12].baseAddr = 0x68828000;
  237. /* dmTimer 13 mapped to GPT14 */
  238. dmTimer.timerSettings[13].baseAddr = 0x6882A000;
  239. /* dmTimer 14 mapped to GPT15 */
  240. dmTimer.timerSettings[14].baseAddr = 0x6882C000;
  241. /* dmTimer 15 mapped to GPT16 */
  242. dmTimer.timerSettings[15].baseAddr = 0x6882E000;
  243.  
  244. /* use external timers because they keep running when IPU is not */
  245. var halTimer = xdc.useModule('ti.sysbios.hal.Timer');
  246. halTimer.TimerProxy = dmTimer;
  247.  
  248. /* ----------------------------- TICK ---------------------------------------*/
  249. var Clock = xdc.useModule('ti.sysbios.knl.Clock');
  250. Clock.tickSource = Clock.TickSource_USER;
  251. /* Configure GPTimer11 as BIOS clock source */
  252. Clock.timerId = 10;
  253.  
  254. var Timer = xdc.useModule('ti.sysbios.timers.dmtimer.Timer');
  255. var timerParams = new Timer.Params();
  256. timerParams.period = Clock.tickPeriod;
  257. timerParams.periodType = Timer.PeriodType_MICROSECS;
  258. /* Smart-idle wake-up-capable mode */
  259. timerParams.tiocpCfg.idlemode = 0x3;
  260. /* Wake-up generation for Overflow */
  261. timerParams.twer.ovf_wup_ena = 0x1;
  262. //overwrite the timer frequency for dmtimer (suggested by ashish)
  263. //Fix for timer issue, which is ticking with 9.6 ms instead of 10ms
  264. Timer.intFreqs[10].lo = 20000000;
  265. Timer.intFreqs[10].hi = 0;
  266.  
  267. Timer.create(Clock.timerId, Clock.doTick, timerParams);
  268.  
  269. /* configure the IPU AMMU */
  270. xdc.loadCapsule("IpuAmmu.cfg");
  271.  
  272.  
  273. /*
  274. * ======== Power Management Configuration ========
  275. */
  276. xdc.loadPackage('ti.pm');
  277. var Power = xdc.useModule('ti.sysbios.family.arm.ducati.smp.Power');
  278. Power.loadSegment = "PM_DATA";
  279.  
  280. /* idle functions, power management functions should be last */
  281. var Idle = xdc.useModule('ti.sysbios.knl.Idle');
  282.  
  283. /* function to flush unicache on each core */
  284. Idle.addCoreFunc('&VirtQueue_cacheWb', 0);
  285. Idle.addCoreFunc('&VirtQueue_cacheWb', 1);
  286.  
  287. /* power management idle functions for each core */
  288. Idle.addCoreFunc('&IpcPower_idle', 0);
  289. Idle.addCoreFunc('&IpcPower_idle', 1);
  290.  
  291. /*
  292. * ======== Instrumentation Configuration ========
  293. */
  294.  
  295. /* system logger */
  296. var LoggerSys = xdc.useModule('xdc.runtime.LoggerSys');
  297. var LoggerSysParams = new LoggerSys.Params();
  298. var Defaults = xdc.useModule('xdc.runtime.Defaults');
  299. Defaults.common$.logger = LoggerSys.create(LoggerSysParams);
  300.  
  301. /* enable runtime Diags_setMask() for non-XDC spec'd modules */
  302. var Diags = xdc.useModule('xdc.runtime.Diags');
  303. Diags.setMaskEnabled = true;
  304.  
  305. /* override diags mask for selected modules */
  306. xdc.useModule('xdc.runtime.Main');
  307. Diags.setMaskMeta("xdc.runtime.Main",
  308. Diags.ENTRY | Diags.EXIT | Diags.INFO, Diags.RUNTIME_ON);
  309.  
  310. var Registry = xdc.useModule('xdc.runtime.Registry');
  311. Registry.common$.diags_ENTRY = Diags.RUNTIME_OFF;
  312. Registry.common$.diags_EXIT = Diags.RUNTIME_OFF;
  313. Registry.common$.diags_INFO = Diags.RUNTIME_OFF;
  314. Registry.common$.diags_USER1 = Diags.RUNTIME_OFF;
  315. Registry.common$.diags_LIFECYCLE = Diags.RUNTIME_OFF;
  316. Registry.common$.diags_STATUS = Diags.RUNTIME_OFF;
  317.  
  318. var Main = xdc.useModule('xdc.runtime.Main');
  319. Main.common$.diags_ASSERT = Diags.ALWAYS_ON;
  320. Main.common$.diags_INTERNAL = Diags.ALWAYS_ON;
  321.  
  322. var Hwi = xdc.useModule('ti.sysbios.family.arm.m3.Hwi');
  323. Hwi.nvicCCR.DIV_0_TRP = 1;
  324. var Resource = xdc.useModule('ti.ipc.remoteproc.Resource');
  325. Resource.customTable = true;
  326.  
  327. /*
  328. * -------- I2C --------
  329. */
  330. /* Use Semaphore, and Task modules and set global properties */
  331. Program.global.hsi2c_sem0 = Semaphore.create(1);
  332. Program.global.hsi2c_sem1 = Semaphore.create(1);
  333.  
  334. var iomFxns = "I2c_IOMFXNS";
  335. var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore');
  336.  
  337. Program.global.hsi2c2_sem = Semaphore.create(1);
  338.  
  339. var GIO = xdc.useModule('ti.sysbios.io.GIO');
  340.  
  341. var initI2c2Fxn = "ipu_i2c2_init";
  342. var deviceIdI2c2 = 1;
  343. var deviceParamsI2c2 = "devInitParamsI2c2";
  344. GIO.addDeviceMeta("i2c", iomFxns, initI2c2Fxn, deviceIdI2c2, deviceParamsI2c2);
  345.  
  346.  
  347. /* ========================================================================== */
  348. /* CFG script for the McSPI sample */
  349. /* ========================================================================== */
  350.  
  351. var IntXbar = xdc.useModule('ti.sysbios.family.shared.vayu.IntXbar');
  352.  
  353. var iomFxns = "Mcspi_IOMFXNS";
  354. var initFxn = "ipu1_mcspi0_init";
  355. var deviceParams = "mcspiPrms";
  356. var deviceId = 0;
  357.  
  358. GIO.addDeviceMeta("/mcspi0", iomFxns, initFxn, deviceId, deviceParams);
  359.  
  360.  
  361. /*
  362. * -------- System config (added by CTC) --------
  363. */
  364. Memory.defaultHeapSize = 0x200000;
  365. Program.sysStack = 4096;
  366. Task.deleteTerminatedTasks = true;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement