/**
 *  \file   spi_test.cfg
 *
 *  \brief  Sysbios config file for SPI test project on OMAPL138 LCDK.
 *
 */

/*
 * Copyright (C) 2017-2018 Texas Instruments Incorporated - http://www.ti.com/
 *
 * 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.
 *
 */
/* Load all required BIOS/XDC runtime packages */
var Memory                      =   xdc.useModule('xdc.runtime.Memory');
var BIOS                        =   xdc.useModule('ti.sysbios.BIOS');
var HeapMem                     =   xdc.useModule('ti.sysbios.heaps.HeapMem');
var HeapBuf                     =   xdc.useModule('ti.sysbios.heaps.HeapBuf');
var Log                         =   xdc.useModule('xdc.runtime.Log');
var Task                        =   xdc.useModule('ti.sysbios.knl.Task');
var Semaphore                   =   xdc.useModule('ti.sysbios.knl.Semaphore');
var Hwi                         =   xdc.useModule('ti.sysbios.family.c64p.Hwi');
var ECM                         =   xdc.useModule('ti.sysbios.family.c64p.EventCombiner');
var core                        =   xdc.useModule('ti.sysbios.hal.Core');

var devType                     = "omapl138"

/* ================ Driver configuration ================*/ 
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");

/* Load the OSAL package */ 
var osType = "tirtos"
var Osal = xdc.useModule('ti.osal.Settings');
Osal.osType = osType;
Osal.socType = devType;

/*use CSL package*/
var Csl = xdc.loadPackage('ti.csl');
Csl.Settings.deviceType = devType;

/* Load the Board package and set the board name */
var Board = xdc.loadPackage('ti.board');
Board.Settings.boardName = "lcdkOMAPL138";

/* Load Profiling package */
/*var Utils = xdc.loadPackage('ti.utils.profiling');*/

/* Load the spi package */
var Spi = xdc.loadPackage('ti.drv.spi');
Spi.Settings.enableProfiling = false;     
Spi.Settings.socType = devType;

/* Load the uart package */
var Uart = xdc.useModule('ti.drv.uart.Settings');
Uart.socType = devType;

var System                      =   xdc.useModule('xdc.runtime.System');
SysStd                          =   xdc.useModule('xdc.runtime.SysStd');
System.SupportProxy             =   SysStd;

/* Load and use the CSL packages */
var Csl                         = xdc.useModule('ti.csl.Settings');
Csl.deviceType                  = devType;

/* Create a default system heap using ti.bios.HeapMem. */
var heapMemParams1              =   new HeapMem.Params;
heapMemParams1.size             =   8192 * 50;
heapMemParams1.sectionName      =   "systemHeap";
Program.global.heap0            =   HeapMem.create(heapMemParams1);


/* No runtime stack checking is performed */
Task.checkStackFlag             = false;


/* Reduce the number of task priorities */
Task.numPriorities              = 4;

/* ================ Task configuration ================ */
var task0Params                 = new Task.Params();
task0Params.instance.name       = "echo";
task0Params.stackSize           = 0x100000;
Program.global.echo             = Task.create("&spi_test", task0Params);

/* This is the default memory heap. */
Memory.defaultHeapInstance      =   Program.global.heap0;
/*
Program.sectMap["systemHeap"]   =   Program.platform.stackMemory;
Program.sectMap[".fardata:benchmarking"] = "APP_CACHED_DATA_MEM";
*/

/*Entry point Memory alignment*/
/*
Program.sectMap[".text:_c_int00"]                 = new Program.SectionSpec();
Program.sectMap[".text:_c_int00"].loadSegment     = "APP_CACHED_DATA_BLK1_MEM";
*/
/****** IPC - Shared Memory Settings ********/
/* IPC packages */

var memmap                      = Program.cpu.memoryMap;

/*Startup = xdc.useModule('xdc.runtime.Startup');
//Startup.firstFxns.$add('&myStartupFxn');*/


/* Enable BIOS Task Scheduler */
BIOS.taskEnabled                =   true;

/*
 * Enable Event Groups here and registering of ISR for specific GEM INTC is done
 * using EventCombiner_dispatchPlug() and Hwi_eventMap() APIs
 */
var exception =	xdc.useModule('ti.sysbios.family.c64p.Exception');
exception.enablePrint = true;

/*
 *  @(#) ti.sysbios.genx; 2, 0, 0, 0,275; 4-29-2009 15:45:06; /db/vtree/library/trees/avala/avala-k25x/src/
 */

/* Define and add one Task Hook Set */
/*Task.addHookSet({
	registerFxn: '&TaskRegisterId',
	switchFxn: '&mySwitch',
});*/
