Project

General

Profile

RE: SysLink Configuration » Dsp.cfg

Okan Çalış, 11/07/2017 01:28 PM

 
/*
* Copyright (c) 2012, 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.
*/

/*
* ======== Dsp.cfg ========
*
*/

/* root of the configuration object model */
var Program = xdc.useModule('xdc.cfg.Program');

/* 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');
xdc.useModule('ti.sysbios.knl.Semaphore');
xdc.useModule('ti.sysbios.knl.Task');

var BIOS = xdc.useModule('ti.sysbios.BIOS');
BIOS.libType = BIOS.LibType_NonInstrumented;


/*
* ======== IPC Configuration ========
*/

/* required because SysLink is running on the host processor */
xdc.useModule('ti.syslink.ipc.rtos.Syslink');

/* configure processor names */
var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
var procNameAry = MultiProc.getDeviceProcNames();
MultiProc.setConfig("DSP", procNameAry);

/* ipc configuration */
var Ipc = xdc.useModule('ti.sdo.ipc.Ipc');

/* ipc setup for SR0 Memory (host processor not running Sys/Bios) */
Ipc.sr0MemorySetup = false;

/* set ipc sync to pair, requiring Ipc_attach() call on all processors */
Ipc.procSync = Ipc.ProcSync_PAIR;

/* define host processor */
Ipc.hostProcId = MultiProc.getIdMeta("HOST");

/* shared region configuration */
var SharedRegion = xdc.useModule('ti.sdo.ipc.SharedRegion');

/* configure SharedRegion #0 (IPC) */
var SR0Mem = Program.cpu.memoryMap["SR_0"];

SharedRegion.setEntryMeta(0,
new SharedRegion.Entry({
name: "SR0",
base: SR0Mem.base,
len: SR0Mem.len,
ownerProcId: MultiProc.getIdMeta("HOST"),
cacheEnable: false,
isValid: true
})
);

/* configure SharedRegion #1 (MessageQ Buffers) */
var SR1Mem = Program.cpu.memoryMap["SR_1"];

SharedRegion.setEntryMeta(1,
new SharedRegion.Entry({
name: "MessageQ Buffers",
base: SR1Mem.base,
len: SR1Mem.len,
ownerProcId: MultiProc.getIdMeta("HOST"),
cacheEnable: false,
isValid: true
})
);

/* configure external memory cache property
*
* C000_0000 - C7FF_FFFF 800_0000 ( 128 MB) Cache.MAR192_223
* ----------------------------------------------------------------------------
* C000_0000 - C1FF_FFFF 200_0000 ( 32 MB) -------- don't care
* C200_0000 - C202_FFFF 3_0000 ( 192 KB) SR_0, SR-1 no-cache MAR194
* C203_0000 - C2FF_FFFF FD_0000 ( ~15 MB) -------- no-cache MAR194
* C300_0000 - C37F_FFFF 80_0000 ( 8 MB) DSP_PROG cache enable MAR195
* C380_0000 - C3FF_FFFF 80_0000 ( 8 MB) -------- cache enable MAR195
* C400_0000 - C7FF_FFFF 400_0000 ( 64 MB) -------- don't care
*/

Cache = xdc.useModule('ti.sysbios.family.c64p.Cache');
Cache.MAR192_223 = 0x00000008; /* xxxx xxxx xxxx xxxx xxxx xxxx xxxx 10xx */


/*
* ======== Operating System Configuration ========
*/

/* no rts heap */
Program.heap = 0;
Program.argSize = 100; /* minimum size */
Program.stack = 0x1000;

/* create a default heap */
var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
var heapMemParams = new HeapMem.Params();
heapMemParams.size = 0x4000;

var Memory = xdc.useModule('xdc.runtime.Memory');
Memory.defaultHeapInstance = HeapMem.create(heapMemParams);

/* configure System module */
var SysMin = xdc.useModule('xdc.runtime.SysMin');
SysMin.bufSize = 0x1000;
SysMin.flushAtExit = false;

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

/* configure SysBios to use the lower half of Timer 1 */
var Timer = xdc.useModule('ti.sysbios.timers.timer64.Timer');
var Clock = xdc.useModule('ti.sysbios.knl.Clock');
Timer.timerSettings[1].master = true;
Timer.defaultHalf = Timer.Half_LOWER;
Clock.timerId = 1;

/*
* ======== Miscellaneous Configuration ========
*/

/* set default diags mask */
var Diags = xdc.useModule('xdc.runtime.Diags');
var Defaults = xdc.useModule('xdc.runtime.Defaults');

Defaults.common$.diags_ENTRY = Diags.ALWAYS_OFF;
Defaults.common$.diags_EXIT = Diags.ALWAYS_OFF;
Defaults.common$.diags_LIFECYCLE = Diags.ALWAYS_OFF;
Defaults.common$.diags_INTERNAL = Diags.ALWAYS_OFF; /* needed for asserts */
Defaults.common$.diags_ASSERT = Diags.ALWAYS_OFF; /* development only */
Defaults.common$.diags_STATUS = Diags.RUNTIME_ON;
Defaults.common$.diags_USER1 = Diags.ALWAYS_OFF;
Defaults.common$.diags_USER2 = Diags.ALWAYS_OFF;
Defaults.common$.diags_USER3 = Diags.ALWAYS_OFF;
Defaults.common$.diags_USER4 = Diags.ALWAYS_OFF;
Defaults.common$.diags_USER5 = Diags.ALWAYS_OFF;
Defaults.common$.diags_USER6 = Diags.ALWAYS_OFF;
Defaults.common$.diags_INFO = Diags.ALWAYS_OFF;
Defaults.common$.diags_ANALYSIS = Diags.ALWAYS_OFF;

/* 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;

/* create a logger instance */
var LoggerBuf = xdc.useModule('xdc.runtime.LoggerBuf');
var loggerBufP = new LoggerBuf.Params();
loggerBufP.numEntries = 128; /* 128 entries = 4 KB of memory */
loggerBufP.bufType = LoggerBuf.BufType_FIXED;

var appLogger = LoggerBuf.create(loggerBufP);
appLogger.instance.name = "AppLog_Core1";
Defaults.common$.logger = appLogger;
(1-1/3)