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 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.family.c28.Hwi');
var Boot = xdc.useModule('ti.catalog.c2800.init.Boot');

/*
 * 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 = 0x800;

/*
 * Build a custom SYS/BIOS library from sources.
 */
BIOS.libType = BIOS.LibType_Custom;

/* System stack size (used by ISRs and Swis) */
Program.stack = 3072;

/* Circular buffer size for System_printf() */
SysMin.bufSize = 0x200;

/* 
 * Create and install logger for the whole system
 */
var loggerBufParams = new LoggerBuf.Params();
loggerBufParams.numEntries = 32;
var logger0 = LoggerBuf.create(loggerBufParams);
Defaults.common$.logger = logger0;
Main.common$.diags_INFO = Diags.ALWAYS_ON;

System.SupportProxy = SysMin;

BIOS.assertsEnabled = false;
BIOS.logsEnabled = false;
BIOS.runtimeCreatesEnabled = false;
Boot.bootFromFlash = false;
Boot.pllOSCCLK = 30;
BIOS.cpuFreq.lo = 150000000;
var clock0Params = new Clock.Params();
clock0Params.instance.name = "clock_StartADC";
clock0Params.period = 1;
clock0Params.startFlag = true;
Program.global.clock_StartADC = Clock.create("&start_dataCollection", 1, clock0Params);
var swi0Params = new Swi.Params();
swi0Params.instance.name = "swi_control";
swi0Params.priority = 2;
Program.global.swi_control = Swi.create("&control", swi0Params);
var task0Params = new Task.Params();
task0Params.instance.name = "task_compass";
task0Params.stackSize = 1024;
Program.global.task_compass = Task.create("&compassTask", task0Params);
var hwi0Params = new Hwi.Params();
hwi0Params.instance.name = "hwi72_SPIRX";
hwi0Params.maskSetting = xdc.module("ti.sysbios.interfaces.IHwi").MaskingOption_ALL;
Program.global.hwi72_SPIRX = Hwi.create(72, "&SPI_RXint", hwi0Params);
var hwi1Params = new Hwi.Params();
hwi1Params.instance.name = "hwi80_McBSPTX";
hwi1Params.maskSetting = xdc.module("ti.sysbios.interfaces.IHwi").MaskingOption_ALL;
Program.global.hwi80_McBSPTX = Hwi.create(80, "&McBSP_TX_INTCH1_ISR", hwi1Params);
var hwi2Params = new Hwi.Params();
hwi2Params.instance.name = "hwi81_McBSPRX";
hwi2Params.maskSetting = xdc.module("ti.sysbios.interfaces.IHwi").MaskingOption_ALL;
Program.global.hwi81_McBSPRX = Hwi.create(81, "&McBSP_RX_INTCH2_ISR", hwi2Params);
var hwi3Params = new Hwi.Params();
hwi3Params.instance.name = "hwi92_RXC";
hwi3Params.maskSetting = xdc.module("ti.sysbios.interfaces.IHwi").MaskingOption_ALL;
Program.global.hwi92_RXC = Hwi.create(92, "&RXCINT_recv_ready", hwi3Params);
var hwi4Params = new Hwi.Params();
hwi4Params.instance.name = "hwi93_TXC";
hwi4Params.maskSetting = xdc.module("ti.sysbios.interfaces.IHwi").MaskingOption_ALL;
Program.global.hwi93_TXC = Hwi.create(93, "&TXCINT_data_sent", hwi4Params);
var hwi5Params = new Hwi.Params();
hwi5Params.instance.name = "hwi96_RXA";
hwi5Params.maskSetting = xdc.module("ti.sysbios.interfaces.IHwi").MaskingOption_ALL;
Program.global.hwi96_RXA = Hwi.create(96, "&RXAINT_recv_ready", hwi5Params);
var hwi6Params = new Hwi.Params();
hwi6Params.instance.name = "hwi97_TXA";
hwi6Params.maskSetting = xdc.module("ti.sysbios.interfaces.IHwi").MaskingOption_ALL;
Program.global.hwi97_TXA = Hwi.create(97, "&TXAINT_data_sent", hwi6Params);
var hwi7Params = new Hwi.Params();
hwi7Params.instance.name = "hwi98_RXB";
hwi7Params.maskSetting = xdc.module("ti.sysbios.interfaces.IHwi").MaskingOption_ALL;
Program.global.hwi98_RXB = Hwi.create(98, "&RXBINT_recv_ready", hwi7Params);
var hwi8Params = new Hwi.Params();
hwi8Params.instance.name = "hwi99_TXB";
hwi8Params.maskSetting = xdc.module("ti.sysbios.interfaces.IHwi").MaskingOption_ALL;
Program.global.hwi99_TXB = Hwi.create(99, "&TXBINT_data_sent", hwi8Params);
