Update repo
No files matched your search
@@ -0,0 +1,862 @@
|
||||
let CONTEXT_CPU1= "CPU1";
|
||||
let CONTEXT_CPU2= "CPU2";
|
||||
let CONTEXT_SYSTEM = "system"
|
||||
let Collateral = system.getScript("/driverlib/sysconfig_collateral_links.js");
|
||||
|
||||
exports = {
|
||||
getBoard : getBoard,
|
||||
getBoardName : getBoardName,
|
||||
getDeviceTRM: getDeviceTRM,
|
||||
getDeviceDatasheet: getDeviceDatasheet,
|
||||
findDuplicates : findDuplicates,
|
||||
peripheralCount: peripheralCount,
|
||||
typeMatches: typeMatches,
|
||||
peripheralNames: peripheralNames,
|
||||
stringOrEmpty: stringOrEmpty,
|
||||
removeNonNumber : removeNonNumber,
|
||||
gpioNameToNumber : gpioNameToNumber,
|
||||
printDebugObject : printDebugObject,
|
||||
printDebugObjectKeys : printDebugObjectKeys,
|
||||
getGPIOs : getGPIOs,
|
||||
getAIOs : getAIOs,
|
||||
peripheralListFromSysCtl : peripheralListFromSysCtl,
|
||||
getDeviceName: getDeviceName,
|
||||
getDevicePart: getDevicePart,
|
||||
getDevicePackage: getDevicePackage,
|
||||
getSDK: getSDK,
|
||||
getC2000WareRelativePath : getC2000WareRelativePath,
|
||||
onlyPinmux: onlyPinmux,
|
||||
CLB_isType1 : CLB_isType1,
|
||||
CLB_isType1_Type2 : CLB_isType1_Type2,
|
||||
CLB_isType2 : CLB_isType2,
|
||||
autoForce : autoForce,
|
||||
autoForceMultiple : autoForceMultiple,
|
||||
SYSCLK_getMaxMHz : SYSCLK_getMaxMHz,
|
||||
getConfigNameRecursive: getConfigNameRecursive,
|
||||
getConfigsRecursive: getConfigsRecursive,
|
||||
printConfigsInfo : printConfigsInfo,
|
||||
getCollateralFindabilityList : getCollateralFindabilityList,
|
||||
zero_to_15 : [
|
||||
{ name: 0 },
|
||||
{ name: 1 },
|
||||
{ name: 2 },
|
||||
{ name: 3 },
|
||||
{ name: 4 },
|
||||
{ name: 5 },
|
||||
{ name: 6 },
|
||||
{ name: 7 },
|
||||
{ name: 8 },
|
||||
{ name: 9 },
|
||||
{ name: 10 },
|
||||
{ name: 11 },
|
||||
{ name: 12 },
|
||||
{ name: 13 },
|
||||
{ name: 14 },
|
||||
{ name: 15 },
|
||||
],
|
||||
zero_to_16 : [
|
||||
{ name: 0 },
|
||||
{ name: 1 },
|
||||
{ name: 2 },
|
||||
{ name: 3 },
|
||||
{ name: 4 },
|
||||
{ name: 5 },
|
||||
{ name: 6 },
|
||||
{ name: 7 },
|
||||
{ name: 8 },
|
||||
{ name: 9 },
|
||||
{ name: 10 },
|
||||
{ name: 11 },
|
||||
{ name: 12 },
|
||||
{ name: 13 },
|
||||
{ name: 14 },
|
||||
{ name: 15 },
|
||||
{ name: 16 },
|
||||
],
|
||||
|
||||
CONTEXT_CPU1: CONTEXT_CPU1,
|
||||
CONTEXT_CPU2: CONTEXT_CPU2,
|
||||
isContextCPU1: isContextCPU1,
|
||||
isContextCPU2: isContextCPU2,
|
||||
isMultiCoreSysConfig : isMultiCoreSysConfig,
|
||||
isMultiCoreDevice : isMultiCoreDevice,
|
||||
getModuleForCore : getModuleForCore,
|
||||
getContextNames: getContextNames,
|
||||
getAllModulesForCore: getAllModulesForCore,
|
||||
getModulePaths, getModulePaths,
|
||||
getContextDisplayName: getContextDisplayName,
|
||||
getOtherContextNames: getOtherContextNames,
|
||||
isModuleOnThisContext: isModuleOnThisContext,
|
||||
isModuleOnAnyContext: isModuleOnAnyContext,
|
||||
isModuleOnOtherContext: isModuleOnOtherContext,
|
||||
getModuleForTheFirstAvailableCore : getModuleForTheFirstAvailableCore,
|
||||
removeArrayFromArray : removeArrayFromArray,
|
||||
getSYSCLK: getSYSCLK,
|
||||
getClockTree : getClockTree,
|
||||
getC2000WarePath: getC2000WarePath
|
||||
};
|
||||
|
||||
function getSYSCLK(cpu)
|
||||
{
|
||||
var clockTree = getClockTree();
|
||||
if (clockTree){
|
||||
|
||||
if (isMultiCoreDevice())
|
||||
{
|
||||
if (!cpu)
|
||||
{
|
||||
if (isContextCPU1())
|
||||
{
|
||||
cpu = "1"
|
||||
return clockTree["CPU" + cpu + "_SYSCLK"].in
|
||||
}
|
||||
else
|
||||
{
|
||||
cpu = "2"
|
||||
|
||||
return clockTree["CPU" + cpu + "_SYSCLK"].in
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return clockTree["SYSCLK"].in
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return SYSCLK_getMaxMHz()
|
||||
}
|
||||
}
|
||||
|
||||
function getC2000WarePath()
|
||||
{
|
||||
var currnetSDKProductPath = system.getProducts()[0].path
|
||||
var sdkPath = system.utils.path.join(currnetSDKProductPath + "../../../")
|
||||
sdkPath = sdkPath.replace(new RegExp('\\' + system.utils.path.sep, 'g'), '/')
|
||||
if (system.getProducts()[0].name != "C2000WARE")
|
||||
{
|
||||
sdkPath = sdkPath + "c2000ware/"
|
||||
}
|
||||
|
||||
return sdkPath
|
||||
}
|
||||
|
||||
function getC2000WareRelativePath()
|
||||
{
|
||||
if (system.getProducts()[0].name != "C2000WARE")
|
||||
{
|
||||
return "../../c2000ware"
|
||||
}
|
||||
|
||||
return ".."
|
||||
}
|
||||
|
||||
function removeArrayFromArray(arrSource, arrRem)
|
||||
{
|
||||
return arrSource.filter( function( el ) {
|
||||
return !arrRem.includes( el );
|
||||
} );
|
||||
}
|
||||
|
||||
|
||||
function getContextDisplayName(cntxName)
|
||||
{
|
||||
return (cntxName == CONTEXT_SYSTEM? CONTEXT_CPU1: cntxName)
|
||||
}
|
||||
|
||||
function isContextCPU1()
|
||||
{
|
||||
if (system.context == CONTEXT_CPU1 || system.context == CONTEXT_SYSTEM)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
function isContextCPU2()
|
||||
{
|
||||
if (system.context == CONTEXT_CPU2)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
function getOtherContextNames()
|
||||
{
|
||||
var contextNames = Object.keys(system.contexts)
|
||||
return contextNames.filter(e => e !== system.context);
|
||||
}
|
||||
|
||||
function isModuleOnThisContext(moduleName)
|
||||
{
|
||||
return system.modules[moduleName]?true:false;
|
||||
}
|
||||
|
||||
function isModuleOnAnyContext(moduleName)
|
||||
{
|
||||
var cntxs = getContextNames();
|
||||
for (var cntx of cntxs){
|
||||
if (getModuleForCore(moduleName, cntx)){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function isModuleOnOtherContext(moduleName)
|
||||
{
|
||||
var cntxs = getOtherContextNames();
|
||||
for (var cntx of cntxs){
|
||||
if (getModuleForCore(moduleName, cntx)){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function getContextNames()
|
||||
{
|
||||
var contextNames = Object.keys(system.contexts)
|
||||
return contextNames;
|
||||
}
|
||||
|
||||
//
|
||||
// Returns true only when the multi-core is laucnhed in sysconfig
|
||||
// If a multi-core device is launched in signle view it wont return true.
|
||||
//
|
||||
function isMultiCoreSysConfig()
|
||||
{
|
||||
return (getContextNames().length > 1);
|
||||
}
|
||||
|
||||
function isMultiCoreDevice()
|
||||
{
|
||||
return (system.context.includes("CPU"));
|
||||
}
|
||||
|
||||
function getAllModulesForCore(coreName)
|
||||
{
|
||||
let context = system.contexts[coreName];
|
||||
let modules = context ? context.system.modules : {};
|
||||
|
||||
return modules;
|
||||
}
|
||||
|
||||
//
|
||||
// Handles getting clocktree for multi-core this for multi-core
|
||||
//
|
||||
function getClockTree()
|
||||
{
|
||||
var contextNames = getContextNames();
|
||||
var mainContext = "system"
|
||||
if (contextNames.includes("CPU1"))
|
||||
{
|
||||
mainContext = "CPU1"
|
||||
}
|
||||
let context = system.contexts[mainContext];
|
||||
let clocktree = context ? context.system.clockTree : null;
|
||||
|
||||
if (system.deviceData.clockTree)
|
||||
{
|
||||
return clocktree
|
||||
}
|
||||
else
|
||||
{
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
function getModuleForCore(moduleName, coreName)
|
||||
{
|
||||
let context = system.contexts[coreName];
|
||||
let modules = context ? context.system.modules : {};
|
||||
let module = modules[moduleName];
|
||||
|
||||
return module;
|
||||
}
|
||||
|
||||
function getModuleForTheFirstAvailableCore(moduleName)
|
||||
{
|
||||
var cntxs = getContextNames();
|
||||
for (var cntx of cntxs){
|
||||
var mod = getModuleForCore(moduleName, cntx)
|
||||
if (mod){
|
||||
return mod;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function getModulePaths(modules)
|
||||
{
|
||||
return Object.keys(modules).sort();;
|
||||
}
|
||||
|
||||
function getBoard()
|
||||
{
|
||||
return system.deviceData.board;
|
||||
}
|
||||
|
||||
|
||||
function getBoardName()
|
||||
{
|
||||
if (system.deviceData.board)
|
||||
{
|
||||
return system.deviceData.board.name;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
function getConfigNameRecursive(arrayConfigs)
|
||||
{
|
||||
var configNames = [];
|
||||
for (var modConfig of arrayConfigs)
|
||||
{
|
||||
if (modConfig.config)
|
||||
{
|
||||
configNames = configNames.concat(getConfigNameRecursive(modConfig.config))
|
||||
}
|
||||
else
|
||||
{
|
||||
var modConfigName = modConfig.name;
|
||||
configNames.push(modConfigName);
|
||||
}
|
||||
}
|
||||
return configNames;
|
||||
}
|
||||
|
||||
function getConfigsRecursive(arrayConfigs)
|
||||
{
|
||||
var configNames = [];
|
||||
for (var modConfig of arrayConfigs)
|
||||
{
|
||||
if (modConfig.config)
|
||||
{
|
||||
configNames = configNames.concat(getConfigsRecursive(modConfig.config))
|
||||
}
|
||||
else
|
||||
{
|
||||
var modConfigName = modConfig;
|
||||
configNames.push(modConfigName);
|
||||
}
|
||||
}
|
||||
return configNames;
|
||||
}
|
||||
|
||||
function printConfigsInfo(configByName)
|
||||
{
|
||||
// for (const key in configByName) {
|
||||
// console.log(key);
|
||||
// console.log(configByName[key].name)
|
||||
// console.log(configByName[key].displayName)
|
||||
// console.log(configByName[key].default)
|
||||
// console.log(configByName[key].options)
|
||||
// }
|
||||
console.log(JSON.stringify(configByName, null, 4));
|
||||
}
|
||||
|
||||
|
||||
function autoForceMultiple(module_names_paths)
|
||||
{
|
||||
return (function (){
|
||||
return module_names_paths
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
function autoForce(module_name, module_path)
|
||||
{
|
||||
return (function (){
|
||||
return [{
|
||||
name : module_name,
|
||||
moduleName: module_path,
|
||||
hidden : false
|
||||
}]
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
function findDuplicates(arrayToCheck)
|
||||
{
|
||||
const count = arrayToCheck =>
|
||||
arrayToCheck.reduce((a, b) => ({ ...a,
|
||||
[b]: (a[b] || 0) + 1
|
||||
}), {})
|
||||
|
||||
const duplicates = dict =>
|
||||
Object.keys(dict).filter((a) => dict[a] > 1)
|
||||
|
||||
return {count: count(arrayToCheck), duplicates: duplicates(count(arrayToCheck))};
|
||||
}
|
||||
|
||||
function onlyPinmux()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
function getSDK()
|
||||
{
|
||||
var sdk = system.getScript("/.metadata/sdk.json");
|
||||
|
||||
return sdk;
|
||||
}
|
||||
|
||||
function getDeviceName()
|
||||
{
|
||||
var deviceName = system.deviceData.device;
|
||||
return deviceName
|
||||
}
|
||||
|
||||
function getDevicePart()
|
||||
{
|
||||
var devicePart = system.deviceData.part;
|
||||
return devicePart
|
||||
}
|
||||
|
||||
function getDevicePackage()
|
||||
{
|
||||
var devicePackage = system.deviceData.package;
|
||||
return devicePackage
|
||||
}
|
||||
|
||||
function stringOrEmpty(stringToCheck, stringToAdd)
|
||||
{
|
||||
if (stringToCheck != "")
|
||||
{
|
||||
return stringToAdd;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
function printDebugObject(obj)
|
||||
{
|
||||
if (obj == null)
|
||||
{
|
||||
console.log("Object is null");
|
||||
return;
|
||||
}
|
||||
var keys = Object.keys(obj);
|
||||
for (var key in keys)
|
||||
{
|
||||
console.log(keys[key] + " : " + obj[keys[key]]);
|
||||
}
|
||||
}
|
||||
|
||||
function printDebugObjectKeys(obj)
|
||||
{
|
||||
if (obj == null)
|
||||
{
|
||||
console.log("Object is null");
|
||||
return;
|
||||
}
|
||||
var keys = Object.keys(obj);
|
||||
console.log("Keys:")
|
||||
for (var key in keys)
|
||||
{
|
||||
console.log(keys[key]);
|
||||
}
|
||||
}
|
||||
|
||||
function removeNonNumber(stringToCheck)
|
||||
{
|
||||
var numberOnly = "";
|
||||
if (stringToCheck != "")
|
||||
{
|
||||
for (var i = 0; i < stringToCheck.length; i++)
|
||||
{
|
||||
if ("0123456789".includes(stringToCheck[i]))
|
||||
{
|
||||
numberOnly += stringToCheck[i];
|
||||
}
|
||||
}
|
||||
return numberOnly;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
//As soon a number is detected and then more characters are detected, exit.
|
||||
//Good for usecases like GPIO180_X2, the 2 is not added to the numbers
|
||||
function gpioNameToNumber(stringToCheck)
|
||||
{
|
||||
var numberOnly = "";
|
||||
var numbersDetected = false;
|
||||
if (stringToCheck != "")
|
||||
{
|
||||
for (var i = 0; i < stringToCheck.length; i++)
|
||||
{
|
||||
if ("0123456789".includes(stringToCheck[i]))
|
||||
{
|
||||
numberOnly += stringToCheck[i];
|
||||
numbersDetected = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (numbersDetected)
|
||||
{
|
||||
return numberOnly;
|
||||
}
|
||||
}
|
||||
}
|
||||
return numberOnly;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
function getGPIOs()
|
||||
{
|
||||
var allGpioNames = [];
|
||||
let gpio = system.deviceData.interfaces.GPIO;
|
||||
if (gpio != null)
|
||||
{
|
||||
for (var i = 0; i < gpio.peripherals.length; i++)
|
||||
{
|
||||
var gpioperiph = gpio.peripherals[i];
|
||||
allGpioNames.push(gpioperiph.name);
|
||||
}
|
||||
}
|
||||
return allGpioNames
|
||||
}
|
||||
|
||||
function getAIOs()
|
||||
{
|
||||
var allAioNames = [];
|
||||
let aio = system.deviceData.interfaces.AIO;
|
||||
if (aio != null)
|
||||
{
|
||||
for (var i = 0; i < aio.peripherals.length; i++)
|
||||
{
|
||||
var aioperiph = aio.peripherals[i];
|
||||
allAioNames.push(aioperiph.name);
|
||||
}
|
||||
}
|
||||
return allAioNames;
|
||||
}
|
||||
|
||||
function peripheralListFromSysCtl(peripheralName, sysctl)
|
||||
{
|
||||
var peripherals = []
|
||||
sysctl.SysCtl_PeripheralPCLOCKCR.forEach((element, index) => {
|
||||
var split_by_underscore = element.name.split("_")
|
||||
var peripheralInst = split_by_underscore[split_by_underscore.length - 1];
|
||||
if (peripheralInst.startsWith(peripheralName))
|
||||
{
|
||||
peripherals.push(peripheralInst)
|
||||
}
|
||||
});
|
||||
return peripherals
|
||||
}
|
||||
|
||||
function peripheralCount(peripheralType)
|
||||
{
|
||||
let peripherals = system.deviceData.peripherals
|
||||
let numberOfPeripherals = Object.keys(peripherals).length;
|
||||
var count = 0;
|
||||
|
||||
//console.log(numberOfPeripherals);
|
||||
|
||||
for (var peripheral in peripherals) {
|
||||
|
||||
try
|
||||
{
|
||||
var interfaces = peripherals[peripheral]["interfaces"];
|
||||
for (var interfaceType in interfaces)
|
||||
{
|
||||
if (peripheralType == interfaceType)
|
||||
{
|
||||
peripheralNames = interfaces[interfaceType].peripherals;
|
||||
//console.log(peripheralNames);
|
||||
count = peripheralNames.length;
|
||||
//console.log(count);
|
||||
return count;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(err) {
|
||||
|
||||
}
|
||||
}
|
||||
if (count == 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return (count);
|
||||
}
|
||||
|
||||
|
||||
function peripheralNames(peripheralType)
|
||||
{
|
||||
let peripherals = system.deviceData.peripherals
|
||||
//console.log(peripherals);
|
||||
let numberOfPeripherals = Object.keys(peripherals).length;
|
||||
var names = [];
|
||||
|
||||
//console.log(numberOfPeripherals);
|
||||
|
||||
for (var peripheral in peripherals) {
|
||||
|
||||
try
|
||||
{
|
||||
var interfaces = peripherals[peripheral]["interfaces"];
|
||||
//console.log(interfaces);
|
||||
for (var interfaceType in interfaces)
|
||||
{
|
||||
if (peripheralType == interfaceType)
|
||||
{
|
||||
names = interfaces[interfaceType].peripherals;
|
||||
//console.log(names);
|
||||
return names;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(err) {
|
||||
|
||||
}
|
||||
}
|
||||
//console.log(names);
|
||||
return (names);
|
||||
}
|
||||
|
||||
|
||||
function CLB_isType1() {
|
||||
return ["F28004x"].includes(getDeviceName());
|
||||
}
|
||||
|
||||
function CLB_isType2() {
|
||||
return ["F28002x", "F2838x", "F28003x", "F28P55x", "F28P65x"].includes(getDeviceName());
|
||||
}
|
||||
|
||||
function CLB_isType1_Type2(){
|
||||
return (CLB_isType1() | CLB_isType2());
|
||||
}
|
||||
|
||||
function SYSCLK_getMaxMHz()
|
||||
{
|
||||
var sysclk_max = {
|
||||
F2807x : 120,
|
||||
F2837xS : 200,
|
||||
F2837xD : 200,
|
||||
F2838x : 200,
|
||||
F28004x : 100,
|
||||
F28002x : 100,
|
||||
F28003x : 120,
|
||||
F280013x : 120,
|
||||
F280015x : 120,
|
||||
F28P65x : 200,
|
||||
F28P55x : 150
|
||||
}
|
||||
return sysclk_max[getDeviceName()];
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* ======== typeMatches ========
|
||||
* Check that HW signal type matches a specified array of types
|
||||
*
|
||||
* Example: within a module's filterHardware(component) method:
|
||||
* for (sig in component.signals) {
|
||||
* let type = component.signals[sig].type;
|
||||
* if (Common.typeMatches(type, ["PWM", "DOUT"])) {
|
||||
* :
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* type - a string or array of strings that are valid signal types
|
||||
* nameArray - array of signal name types that must match one of the signal
|
||||
* types named by type
|
||||
*
|
||||
* Returns true iff nameArray contains at least one type name that's
|
||||
* specified the type parameter.
|
||||
*/
|
||||
function typeMatches(type, nameArray)
|
||||
{
|
||||
let options = {};
|
||||
|
||||
if (type instanceof Array || typeof type == "object") {
|
||||
for (var i = 0; i < type.length; i++) {
|
||||
options[type[i]] = 1;
|
||||
}
|
||||
}
|
||||
else if (typeof type == "string" || type instanceof String) {
|
||||
options[type] = 1;
|
||||
}
|
||||
|
||||
for (var i = 0; i < nameArray.length; i++) {
|
||||
let name = nameArray[i];
|
||||
if (name in options) {
|
||||
return (true);
|
||||
}
|
||||
}
|
||||
|
||||
return (false);
|
||||
}
|
||||
|
||||
function getDeviceTRM()
|
||||
{
|
||||
var deviceTRMLinks = {
|
||||
"F2807x": "https://www.ti.com/lit/spruhm9",
|
||||
"F2837xS": "https://www.ti.com/lit/spruhx5",
|
||||
"F2837xD": "https://www.ti.com/lit/spruhm8",
|
||||
"F28004x": "https://www.ti.com/lit/sprui33",
|
||||
"F2838x": "https://www.ti.com/lit/spruii0",
|
||||
"F28002x": "https://www.ti.com/lit/spruin7",
|
||||
"F28003x": "https://www.ti.com/lit/spruiw9",
|
||||
"F280013x": "https://www.ti.com/lit/spruix1",
|
||||
"F280015x": "https://www.ti.com/lit/spruiy4",
|
||||
"F28P65x": "https://www.ti.com/lit/spruiz1"
|
||||
}
|
||||
|
||||
var deviceTRMLink = deviceTRMLinks[getDeviceName()];
|
||||
if (deviceTRMLink)
|
||||
{
|
||||
return deviceTRMLink
|
||||
}
|
||||
else
|
||||
{
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
function getDeviceDatasheet()
|
||||
{
|
||||
var deviceDSLinks = {
|
||||
"F2807x": "https://www.ti.com/lit/gpn/tms320f28075",
|
||||
"F2837xS": "https://www.ti.com/lit/gpn/tms320f28377s",
|
||||
"F2837xD": "https://www.ti.com/lit/gpn/tms320f28379d",
|
||||
"F28004x": "https://www.ti.com/lit/gpn/tms320f280049",
|
||||
"F2838x": "https://www.ti.com/lit/gpn/tms320f28388d",
|
||||
"F28002x": "https://www.ti.com/lit/gpn/tms320f280025c",
|
||||
"F28003x": "https://www.ti.com/lit/gpn/tms320f280039c",
|
||||
"F280013x": "https://www.ti.com/lit/gpn/tms320f2800137",
|
||||
"F280015x": "https://www.ti.com/lit/gpn/tms320f2800157",
|
||||
"F28P65x": "https://www.ti.com/lit/gpn/tms320f28p650dk"
|
||||
}
|
||||
|
||||
var deviceDSLink = deviceDSLinks[getDeviceName()];
|
||||
if (deviceDSLink)
|
||||
{
|
||||
return deviceDSLink
|
||||
}
|
||||
else
|
||||
{
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
function getCollateralFindabilityList(peripheral)
|
||||
{
|
||||
var res = "";
|
||||
//*********************************************************************
|
||||
// GETTING STARTED WITH SYSCONFIG
|
||||
//*********************************************************************
|
||||
res += "**"
|
||||
res += "Sysconfig Resources"
|
||||
res += "**\n"
|
||||
res += "* [C2000 SysConfig - Step by Step Guide on How to use C2000 SysConfig](https://www.ti.com/lit/spracx3)\n"
|
||||
res += "* [C2000 SysConfig - Speed Up Development With C2000 Real-Time MCUs Using SysConfig](https://www.ti.com/lit/spry341)\n"
|
||||
res += "\n"
|
||||
|
||||
var deviceGPN = getDeviceName();
|
||||
var cdata = Collateral.getCollateralData();
|
||||
// console.log(cdata[peripheral]);
|
||||
for (var i=0; i < cdata[peripheral].length; i++)
|
||||
{
|
||||
//*********************************************************************
|
||||
// CATEGORY TITLE
|
||||
//*********************************************************************
|
||||
var category_dict = cdata[peripheral][i];
|
||||
// console.log(category_dict['category_displayName'])
|
||||
|
||||
// first check if the category is used by this device at all (not filtered out from this device)
|
||||
var category_used = false;
|
||||
for (var j=0; j < category_dict['content'].length; j++)
|
||||
{
|
||||
var content_dict = category_dict['content'][j]
|
||||
if ( ('devices' in content_dict && content_dict['devices'].includes(deviceGPN)) ||
|
||||
!('devices' in content_dict)
|
||||
)
|
||||
{
|
||||
category_used = true;
|
||||
|
||||
// break out of loop on the first occurrence of a collateral that is used for this device
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// now if it was used, go ahead and add the category title
|
||||
if (category_used)
|
||||
{
|
||||
res += "\n# **" +
|
||||
category_dict['category_displayName'] +
|
||||
"**\n"
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
// COLLATERAL LINKS WITHIN CATEGORY
|
||||
//*********************************************************************
|
||||
// add each content item that applies
|
||||
for (var j=0; j < category_dict['content'].length; j++)
|
||||
{
|
||||
var content_dict = category_dict['content'][j]
|
||||
if ( ('devices' in content_dict && content_dict['devices'].includes(deviceGPN)) ||
|
||||
!('devices' in content_dict)
|
||||
)
|
||||
{
|
||||
// italicize if this is an App Note
|
||||
if ( 'appNote' in content_dict )
|
||||
{
|
||||
res += "* *[" +
|
||||
content_dict['name'] +
|
||||
"](" +
|
||||
content_dict['url'] +
|
||||
")*"
|
||||
}
|
||||
// don't italicize if not an app note
|
||||
else
|
||||
{
|
||||
res += "* [" +
|
||||
content_dict['name'] +
|
||||
"](" +
|
||||
content_dict['url'] +
|
||||
")"
|
||||
}
|
||||
|
||||
// add a (Video) tag if this is a video
|
||||
if ('video' in content_dict)
|
||||
{
|
||||
res += " (Video)"
|
||||
}
|
||||
|
||||
// now add a newline to finish up the normal bullet
|
||||
res += "\n"
|
||||
|
||||
//*********************************************************************
|
||||
// EXTRA TEXT FOR THIS COLLATERAL LINK
|
||||
//*********************************************************************
|
||||
// add the "Extra Text" as a sub-bullet if it exits
|
||||
if ('description' in content_dict)
|
||||
{
|
||||
res += " * " +
|
||||
content_dict['description'] +
|
||||
"\n"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
// DEVICE TRM
|
||||
//*********************************************************************
|
||||
// finally, add the device TRM to the bottom of the list
|
||||
// res += "---\n"
|
||||
res += "\n# ***"
|
||||
res += "["+deviceGPN+" Technical Reference Manual](" + getDeviceTRM() + ")"
|
||||
res += "***\n"
|
||||
|
||||
|
||||
return res
|
||||
}
|
||||
@@ -0,0 +1,349 @@
|
||||
let Common = system.getScript("/driverlib/Common.js");
|
||||
let references = system.getScript("/driverlib/PeripheralComponentsReferences.js");
|
||||
|
||||
let CATEGORY_ANALOG = "Analog";
|
||||
let CATEGORY_COMS = "Communication";
|
||||
let CATEGORY_CONTROL = "Control";
|
||||
let CATEGORY_SYSTEM = "System";
|
||||
let CATEGORY_BOARD = "Board Components"
|
||||
let CATEGORY_SW = "Software";
|
||||
|
||||
let CATEGORY_LIST = [
|
||||
CATEGORY_ANALOG,
|
||||
CATEGORY_COMS,
|
||||
CATEGORY_CONTROL,
|
||||
CATEGORY_SYSTEM,
|
||||
CATEGORY_BOARD,
|
||||
CATEGORY_SW,
|
||||
]
|
||||
|
||||
var supported_modules_analog = [];
|
||||
var supported_modules_coms = [];
|
||||
var supported_modules_system = [];
|
||||
var supported_modules_contorl = [];
|
||||
var supported_modules_board = [];
|
||||
var supported_modules_sw = [];
|
||||
|
||||
var supported_modules = {};
|
||||
supported_modules[CATEGORY_ANALOG] = supported_modules_analog
|
||||
supported_modules[CATEGORY_COMS] = supported_modules_coms
|
||||
supported_modules[CATEGORY_SYSTEM] = supported_modules_system
|
||||
supported_modules[CATEGORY_CONTROL] = supported_modules_contorl
|
||||
supported_modules[CATEGORY_BOARD] = supported_modules_board
|
||||
supported_modules[CATEGORY_SW] = supported_modules_sw
|
||||
|
||||
var supported_peripheralName_moduleFile = [
|
||||
{ moduleCategory: CATEGORY_SYSTEM , peripheralName : "AIO", moduleFile : "/driverlib/aio.js"},
|
||||
{ moduleCategory: CATEGORY_COMS , peripheralName : "CAN", moduleFile : "/driverlib/can.js"},
|
||||
{ moduleCategory: CATEGORY_COMS , peripheralName : "CM-I2C", moduleFile : "/driverlib/cmi2c.js"},
|
||||
{ moduleCategory: CATEGORY_SYSTEM , peripheralName : "CLB_OUTPUTXBAR", moduleFile : "/driverlib/clb_outputxbar.js"},
|
||||
{ moduleCategory: CATEGORY_ANALOG , peripheralName : "DC-DC", moduleFile : "/driverlib/dcdc.js"},
|
||||
{ moduleCategory: CATEGORY_COMS , peripheralName : "ECAT", moduleFile : "/driverlib/ecat.js"},
|
||||
{ moduleCategory: CATEGORY_COMS , peripheralName : "ETHERNET", moduleFile : "/driverlib/ethernet.js"},
|
||||
{ moduleCategory: CATEGORY_SYSTEM , peripheralName : "EMIF1", moduleFile : "/driverlib/emif1.js"},
|
||||
{ moduleCategory: CATEGORY_SYSTEM , peripheralName : "EMIF2", moduleFile : "/driverlib/emif2.js"},
|
||||
{ moduleCategory: CATEGORY_CONTROL, peripheralName : "EPWM", moduleFile : "/driverlib/epwm.js"},
|
||||
{ moduleCategory: CATEGORY_CONTROL, peripheralName : "EQEP", moduleFile : "/driverlib/eqep.js"},
|
||||
{ moduleCategory: CATEGORY_COMS , peripheralName : "FSITX", moduleFile : "/driverlib/fsitx.js"},
|
||||
{ moduleCategory: CATEGORY_COMS , peripheralName : "FSIRX", moduleFile : "/driverlib/fsirx.js"},
|
||||
{ moduleCategory: CATEGORY_BOARD , peripheralName : "FSIRX", moduleFile : "/driverlib/board_components/fsi"},
|
||||
{ moduleCategory: CATEGORY_SYSTEM , peripheralName : "GPIO", moduleFile : "/driverlib/gpio.js"},
|
||||
{ moduleCategory: CATEGORY_SYSTEM , peripheralName : "HIC", moduleFile : "/driverlib/hic.js"},
|
||||
{ moduleCategory: CATEGORY_COMS , peripheralName : "I2C", moduleFile : "/driverlib/i2c.js"},
|
||||
//{ moduleCategory: CATEGORY_SYSTEM , peripheralName : "INPUTXBAR", moduleFile : "/driverlib/inputxbar.js"},
|
||||
{ moduleCategory: CATEGORY_COMS , peripheralName : "LIN", moduleFile : "/driverlib/lin.js"},
|
||||
{ moduleCategory: CATEGORY_COMS , peripheralName : "MCAN", moduleFile : "/driverlib/mcan.js"},
|
||||
{ moduleCategory: CATEGORY_COMS , peripheralName : "MCBSP", moduleFile : "/driverlib/mcbsp.js"},
|
||||
{ moduleCategory: CATEGORY_SYSTEM , peripheralName : "OUTPUTXBAR", moduleFile : "/driverlib/outputxbar.js"},
|
||||
{ moduleCategory: CATEGORY_SYSTEM , peripheralName : "OTHER", moduleFile : "/driverlib/other.js"},
|
||||
{ moduleCategory: CATEGORY_COMS , peripheralName : "PMBUS", moduleFile : "/driverlib/pmbus.js"},
|
||||
{ moduleCategory: CATEGORY_CONTROL , peripheralName : "SD", moduleFile : "/driverlib/sd.js"},
|
||||
{ moduleCategory: CATEGORY_COMS , peripheralName : "SPI", moduleFile : "/driverlib/spi.js"},
|
||||
{ moduleCategory: CATEGORY_COMS , peripheralName : "SCI", moduleFile : "/driverlib/sci.js"},
|
||||
{ moduleCategory: CATEGORY_COMS , peripheralName : "SSI", moduleFile : "/driverlib/ssi.js"},
|
||||
{ moduleCategory: CATEGORY_COMS , peripheralName : "UART", moduleFile : "/driverlib/uart.js"},
|
||||
{ moduleCategory: CATEGORY_SYSTEM , peripheralName : "UPP", moduleFile : "/driverlib/upp.js"},
|
||||
{ moduleCategory: CATEGORY_COMS , peripheralName : "USB", moduleFile : "/driverlib/usb.js"},
|
||||
{ moduleCategory: CATEGORY_ANALOG , peripheralName : "ANALOG", moduleFile : "/driverlib/analog.js"},
|
||||
];
|
||||
|
||||
var static_peripheralName_moduleFile = [
|
||||
{ moduleCategory: CATEGORY_SYSTEM , peripheralName : "INTERRUPT", moduleFile : "/driverlib/interrupt.js"},
|
||||
{ moduleCategory: CATEGORY_SYSTEM , peripheralName : "INPUTXBAR", moduleFile : "/driverlib/inputxbar_input.js"},
|
||||
{ moduleCategory: CATEGORY_SYSTEM , peripheralName : "SYSCTL", moduleFile : "/driverlib/sysctl.js"},
|
||||
{ moduleCategory: CATEGORY_ANALOG , peripheralName : "ASYSCTL", moduleFile : "/driverlib/asysctl.js"},
|
||||
{ moduleCategory: CATEGORY_ANALOG , peripheralName : "ADC", moduleFile : "/driverlib/adc.js"},
|
||||
{ moduleCategory: CATEGORY_SYSTEM , peripheralName : "CPUTIMER", moduleFile : "/driverlib/cputimer.js"},
|
||||
{ moduleCategory: CATEGORY_SYSTEM , peripheralName : "EPWMXBAR", moduleFile : "/driverlib/epwmxbar.js"},
|
||||
{ moduleCategory: CATEGORY_SYSTEM , peripheralName : "WATCHDOG", moduleFile : "/driverlib/watchdog.js"},
|
||||
{ moduleCategory: CATEGORY_CONTROL, peripheralName : "ECAP", moduleFile : "/driverlib/ecap.js"},
|
||||
{ moduleCategory: CATEGORY_CONTROL, peripheralName : "SYNC", moduleFile : "/driverlib/sync.js"},
|
||||
{ moduleCategory: CATEGORY_SYSTEM , peripheralName : "MEMCFG", moduleFile : "/driverlib/memcfg.js"},
|
||||
{ moduleCategory: CATEGORY_BOARD , peripheralName : "", moduleFile : "/driverlib/board_components/led"},
|
||||
{ moduleCategory: CATEGORY_BOARD , peripheralName : "", moduleFile : "/driverlib/board_components/swtch"},
|
||||
{ moduleCategory: CATEGORY_SW, moduleFile : "/driverlib/interrupt_nesting.js"},
|
||||
{ moduleCategory: CATEGORY_SW, moduleFile : "/driverlib/device_support.js"},
|
||||
]
|
||||
|
||||
var device_specific_modules = [
|
||||
{ moduleCategory: CATEGORY_ANALOG , devices : ["F28004x", "F2838x", "F2837xS", "F2837xD", "F2807x", "F28003x","F28P55x", "F280013x", "F280015x", "F28002x", "F28P65x"], peripheralName : "CMPSS", moduleFile : "/driverlib/cmpss.js"},
|
||||
{ moduleCategory: CATEGORY_ANALOG , devices : ["F280013x", "F280015x"], peripheralName : "CMPSSLITE", moduleFile : "/driverlib/cmpss_lite.js"},
|
||||
{ moduleCategory: CATEGORY_ANALOG , devices : ["F28004x", "F2838x", "F2837xS", "F2837xD", "F2807x", "F28003x","F28P55x", "F28P65x"], peripheralName : "DAC", moduleFile : "/driverlib/dac.js"},
|
||||
{ moduleCategory: CATEGORY_SYSTEM , devices : ["F28004x", "F2838x", "F28002x", "F28003x","F28P55x", "F28P65x"], peripheralName : "ERAD", moduleFile : "/driverlib/erad.js"},
|
||||
{ moduleCategory: CATEGORY_CONTROL, devices : ["F28004x", "F2838x", "F2837xS", "F2837xD", "F2807x", "F28003x","F28P55x", "F28002x", "F28P65x"], peripheralName : "CLB", moduleFile : "/driverlib/clb.js"},
|
||||
{ moduleCategory: CATEGORY_SYSTEM , devices : ["F28004x", "F2838x", "F2837xS", "F2837xD", "F2807x", "F28003x","F28P55x", "F28002x", "F28P65x"], peripheralName : "CLBXBAR", moduleFile : "/driverlib/clbxbar.js"},
|
||||
{ moduleCategory: CATEGORY_SYSTEM , devices : ["F28002x", "F2838x", "F28003x","F28P55x", "F28P65x"], peripheralName : "CLB_INPUTXBAR", moduleFile : "/driverlib/clb_inputxbar_input.js"},
|
||||
{ moduleCategory: CATEGORY_ANALOG , devices : ["F28004x", "F28P55x"], peripheralName : "PGA", moduleFile : "/driverlib/pga.js"},
|
||||
{ moduleCategory: CATEGORY_SYSTEM , devices : ["F28004x", "F28002x", "F2838x", "F28003x","F28P55x", "F280013x", "F280015x", "F28P65x"], peripheralName : "DCC", moduleFile : "/driverlib/dcc.js"},
|
||||
{ moduleCategory: CATEGORY_SYSTEM , devices : ["F2837xD", "F2837xS", "F2807x", "F28004x", "F2838x", "F28003x","F28P55x", "F28P65x"], peripheralName : "CLA", moduleFile : "/driverlib/cla.js"},
|
||||
{ moduleCategory: CATEGORY_COMS , devices : ["F28002x", "F28003x","F28P55x", "F28004x","F2807x", "F2837xS", "F2837xD", "F2838x", "F28P65x"], peripheralName : "DMA", moduleFile : "/driverlib/dma.js"},
|
||||
{ moduleCategory: CATEGORY_SYSTEM , devices : ["F28002x", "F2838x", "F28003x", "F28P65x"], peripheralName : "BGCRC", moduleFile : "/driverlib/bgcrc.js"},
|
||||
{ moduleCategory: CATEGORY_SYSTEM , devices : ["F28003x","F28P65x","F28P55x", "F2838x", "F28002x", "F28004x", "F2837xD", "F2837xS","F280013x","F280015x","F2807x"], peripheralName : "FLASH", moduleFile : "/driverlib/flash.js"},
|
||||
{ moduleCategory: CATEGORY_SYSTEM , devices : ["F2838x", "F2837xD", "F28P65x"], peripheralName : "IPC", moduleFile : "/driverlib/ipc.js"},
|
||||
{ moduleCategory: CATEGORY_SYSTEM , devices : ["F28P65x"], peripheralName : "MINDB_XBAR", moduleFile : "/driverlib/mindbxbar.js"},
|
||||
{ moduleCategory: CATEGORY_SYSTEM , devices : ["F28P65x"], peripheralName : "ICL_XBAR", moduleFile : "/driverlib/iclxbar.js"},
|
||||
{ moduleCategory: CATEGORY_ANALOG , devices : ["F28P65x"], peripheralName : "ADCSafetyChecker", moduleFile : "/driverlib/adcsafetychecker.js"},
|
||||
]
|
||||
|
||||
if (Common.onlyPinmux())
|
||||
{
|
||||
static_peripheralName_moduleFile = []
|
||||
device_specific_modules = []
|
||||
}
|
||||
|
||||
var cpu2_unavailable_peripherals = {
|
||||
"F2837xD" : [
|
||||
{ peripheralName: "GPIO", moduleFile : "/driverlib/gpio.js"},
|
||||
{ peripheralName: "AIO", moduleFile : "/driverlib/aio.js"},
|
||||
{ peripheralName: "ANALOG", moduleFile : "/driverlib/analog.js"},
|
||||
{ peripheralName: "INPUTXBAR", moduleFile : "/driverlib/inputxbar.js"},
|
||||
{ peripheralName: "INPUTXBAR", moduleFile : "/driverlib/inputxbar_input.js"},
|
||||
{ peripheralName: "OUTPUTXBAR", moduleFile : "/driverlib/outputxbar.js" },
|
||||
{ peripheralName: "EPWMXBAR", moduleFile : "/driverlib/epwmxbar.js"},
|
||||
{ peripheralName: "CLBXBAR", moduleFile : "/driverlib/clbxbar.js"},
|
||||
{ peripheralName: "USB", moduleFile : "/driverlib/usb.js" },
|
||||
{ peripheralName: "UPP", moduleFile : "/driverlib/upp.js" },
|
||||
{ peripheralName: "EMIF1", moduleFile : "/driverlib/emif1.js" },
|
||||
{ peripheralName: "EMIF2", moduleFile : "/driverlib/emif2.js" },
|
||||
{ peripheralName: "SYNC", moduleFile : "/driverlib/sync.js" },
|
||||
{ peripheralName: "ASYSCTL", moduleFile : "/driverlib/asysctl.js" },
|
||||
{ peripheralName: "OTHER", moduleFile : "/driverlib/other.js"},
|
||||
],
|
||||
"F2838x" : [
|
||||
{ peripheralName: "GPIO", moduleFile : "/driverlib/gpio.js"},
|
||||
{ peripheralName: "AIO", moduleFile : "/driverlib/aio.js"},
|
||||
{ peripheralName: "ANALOG", moduleFile : "/driverlib/analog.js"},
|
||||
{ peripheralName: "INPUTXBAR", moduleFile : "/driverlib/inputxbar.js"},
|
||||
{ peripheralName: "OUTPUTXBAR", moduleFile : "/driverlib/outputxbar.js" },
|
||||
{ peripheralName: "EPWMXBAR", moduleFile : "/driverlib/epwmxbar.js"},
|
||||
{ peripheralName: "CLBXBAR", moduleFile : "/driverlib/clbxbar.js"},
|
||||
{ peripheralName: "CLB_INPUTXBAR", moduleFile : "/driverlib/clb_inputxbar.js"},
|
||||
{ peripheralName: "CLB_INPUTXBAR", moduleFile : "/driverlib/clb_inputxbar_input.js"},
|
||||
{ peripheralName: "CLB_OUTPUTXBAR", moduleFile : "/driverlib/clb_outputxbar.js"},
|
||||
{ peripheralName: "USB", moduleFile : "/driverlib/usb.js" },
|
||||
{ peripheralName: "UPP", moduleFile : "/driverlib/upp.js" },
|
||||
{ peripheralName: "EMIF1", moduleFile : "/driverlib/emif1.js" },
|
||||
{ peripheralName: "EMIF2", moduleFile : "/driverlib/emif2.js" },
|
||||
{ peripheralName: "SYNC", moduleFile : "/driverlib/sync.js" },
|
||||
{ peripheralName: "ASYSCTL", moduleFile : "/driverlib/asysctl.js" },
|
||||
{ peripheralName: "ECAT", moduleFile : "/driverlib/ecat.js" },
|
||||
{ peripheralName: "ETHERNET", moduleFile : "/driverlib/ethernet.js" },
|
||||
{ peripheralName: "UART", moduleFile : "/driverlib/uart.js" },
|
||||
{ peripheralName: "CM-I2C", moduleFile : "/driverlib/cmi2c.js" },
|
||||
{ peripheralName: "OTHER", moduleFile : "/driverlib/other.js"},
|
||||
],
|
||||
"F28P65x" : [
|
||||
{ peripheralName: "GPIO", moduleFile : "/driverlib/gpio.js"},
|
||||
{ peripheralName: "AIO", moduleFile : "/driverlib/aio.js"},
|
||||
{ peripheralName: "ANALOG", moduleFile : "/driverlib/analog.js"},
|
||||
{ peripheralName: "INPUTXBAR", moduleFile : "/driverlib/inputxbar.js"},
|
||||
{ peripheralName: "OUTPUTXBAR", moduleFile : "/driverlib/outputxbar.js" },
|
||||
{ peripheralName: "EMIF1", moduleFile : "/driverlib/emif1.js" },
|
||||
{ peripheralName: "EPWMXBAR", moduleFile : "/driverlib/epwmxbar.js"},
|
||||
{ peripheralName: "CLBXBAR", moduleFile : "/driverlib/clbxbar.js"},
|
||||
{ peripheralName: "ICLXBAR", moduleFile : "/driverlib/iclxbar.js"},
|
||||
{ peripheralName: "MINDBXBAR", moduleFile : "/driverlib/mindbxbar.js"},
|
||||
{ peripheralName: "CLB_INPUTXBAR", moduleFile : "/driverlib/clb_inputxbar.js"},
|
||||
{ peripheralName: "CLB_INPUTXBAR", moduleFile : "/driverlib/clb_inputxbar_input.js"},
|
||||
{ peripheralName: "CLB_OUTPUTXBAR", moduleFile : "/driverlib/clb_outputxbar.js"},
|
||||
{ peripheralName: "SYNC", moduleFile : "/driverlib/sync.js" },
|
||||
{ peripheralName: "ASYSCTL", moduleFile : "/driverlib/asysctl.js" },
|
||||
]
|
||||
}
|
||||
|
||||
for (var periphName_moduleFile_index in supported_peripheralName_moduleFile)
|
||||
{
|
||||
if (Common.peripheralCount(
|
||||
supported_peripheralName_moduleFile[periphName_moduleFile_index].peripheralName) > 0)
|
||||
{
|
||||
supported_modules[supported_peripheralName_moduleFile[periphName_moduleFile_index].moduleCategory].
|
||||
push(supported_peripheralName_moduleFile[periphName_moduleFile_index].moduleFile)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for (var periphName_moduleFile_index in static_peripheralName_moduleFile)
|
||||
{
|
||||
supported_modules[static_peripheralName_moduleFile[periphName_moduleFile_index].moduleCategory].
|
||||
push(static_peripheralName_moduleFile[periphName_moduleFile_index].moduleFile)
|
||||
}
|
||||
|
||||
|
||||
for (var device_specific_modules_index in device_specific_modules)
|
||||
{
|
||||
if (device_specific_modules[device_specific_modules_index].
|
||||
devices.includes(Common.getDeviceName()))
|
||||
{
|
||||
supported_modules[device_specific_modules[device_specific_modules_index].moduleCategory].
|
||||
push(device_specific_modules[device_specific_modules_index].moduleFile)
|
||||
}
|
||||
}
|
||||
|
||||
//console.log(system.deviceData.board)
|
||||
var views = []
|
||||
if(Common.getBoard())
|
||||
{
|
||||
views.push(
|
||||
{
|
||||
"name": "/boards/templates/board_info.xdt",
|
||||
"displayName": "Board Info",
|
||||
"viewType": "markdown"
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
if (["F2837xD", "F2838x", "F28P65x"].includes(Common.getDeviceName()))
|
||||
{
|
||||
// Multi-core Check
|
||||
var device_cpu2_unavailable_peripherals = cpu2_unavailable_peripherals[Common.getDeviceName()];
|
||||
if (device_cpu2_unavailable_peripherals)
|
||||
{
|
||||
if (Common.isContextCPU2())
|
||||
{
|
||||
for (var category of CATEGORY_LIST)
|
||||
{
|
||||
for (var unavailable_peripheral of device_cpu2_unavailable_peripherals)
|
||||
{
|
||||
var indexToRemove = supported_modules[category].indexOf(unavailable_peripheral.moduleFile)
|
||||
if (indexToRemove > -1)
|
||||
{
|
||||
supported_modules[category].splice(indexToRemove, 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// console.log(supported_modules[CATEGORY_SYSTEM])
|
||||
// console.log(supported_modules[CATEGORY_COMS])
|
||||
// console.log(supported_modules[CATEGORY_ANALOG])
|
||||
// console.log(supported_modules[CATEGORY_CONTROL])
|
||||
|
||||
exports = {
|
||||
|
||||
displayName: "C2000Ware SysConfig",
|
||||
topModules: [
|
||||
|
||||
{
|
||||
displayName: CATEGORY_SYSTEM,
|
||||
description: "System configured here",
|
||||
modules: supported_modules[CATEGORY_SYSTEM]
|
||||
},
|
||||
{
|
||||
displayName: CATEGORY_ANALOG,
|
||||
description: "Analog peripherals get configured here",
|
||||
modules: supported_modules[CATEGORY_ANALOG]
|
||||
// categories: [{
|
||||
// displayName: "Sub Cat",
|
||||
// modules: ["/driverlib/sysctl.js"]
|
||||
// }]
|
||||
},
|
||||
{
|
||||
displayName: CATEGORY_CONTROL,
|
||||
description: "Control peripherals get configured here",
|
||||
modules: supported_modules[CATEGORY_CONTROL]
|
||||
// categories: [{
|
||||
// }]
|
||||
},
|
||||
{
|
||||
displayName: CATEGORY_COMS,
|
||||
description: "Communication peripherals get configured here",
|
||||
modules: supported_modules[CATEGORY_COMS]
|
||||
},
|
||||
{
|
||||
displayName: CATEGORY_SW,
|
||||
description: "Software modules configuration",
|
||||
modules: supported_modules[CATEGORY_SW]
|
||||
},
|
||||
|
||||
{
|
||||
displayName : CATEGORY_BOARD,
|
||||
description : "Board component configurations",
|
||||
modules : supported_modules[CATEGORY_BOARD]
|
||||
}
|
||||
],
|
||||
references: references.componentReferences,
|
||||
templates: [{
|
||||
name: "/driverlib/board.c.xdt",
|
||||
outputPath: "board.c",
|
||||
alwaysRun: true
|
||||
},
|
||||
{
|
||||
name: "/driverlib/board.h.xdt",
|
||||
outputPath: "board.h",
|
||||
alwaysRun: true
|
||||
},
|
||||
{
|
||||
name: "/driverlib/board.cmd.genlibs.xdt",
|
||||
outputPath: "board.cmd.genlibs",
|
||||
alwaysRun: true
|
||||
},
|
||||
{
|
||||
name: "/driverlib/board.opt.xdt",
|
||||
outputPath: "board.opt",
|
||||
alwaysRun: true
|
||||
},
|
||||
{
|
||||
name: "/driverlib/board.json.xdt",
|
||||
outputPath: "board.json",
|
||||
alwaysRun: true
|
||||
},
|
||||
{
|
||||
name: "/driverlib/pinmux.csv.xdt",
|
||||
outputPath: "pinmux.csv",
|
||||
alwaysRun: true
|
||||
},
|
||||
{
|
||||
name: "/driverlib/epwm/templates/epwm.dot.xdt",
|
||||
outputPath: "epwm.dot",
|
||||
},
|
||||
{
|
||||
name: "/driverlib/device/device.c.xdt",
|
||||
outputPath: "device.c",
|
||||
},
|
||||
{
|
||||
name: "/driverlib/device/device.h.xdt",
|
||||
outputPath: "device.h",
|
||||
},
|
||||
{
|
||||
name: "/driverlib/adc/templates/adc.dot.xdt",
|
||||
outputPath: "adc.dot",
|
||||
},
|
||||
{
|
||||
name: "/driverlib/sysctl/sysctl_config.c.xdt",
|
||||
outputPath: "sysctl_config.c",
|
||||
},
|
||||
{
|
||||
name: "/driverlib/interrupt_nesting/sw_prioritized_defaultisr.c.xdt",
|
||||
outputPath: "sw_prioritized_defaultisr.c",
|
||||
},
|
||||
{
|
||||
name: "/driverlib/interrupt_nesting/sw_prioritized_isr_levels.h.xdt",
|
||||
outputPath: "sw_prioritized_isr_levels.h",
|
||||
}
|
||||
],
|
||||
views : views
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
let Common = system.getScript("/driverlib/Common.js");
|
||||
|
||||
var references = [
|
||||
{
|
||||
name: "codestartbranch_asm",
|
||||
path: "../device_support/${DEVICE_NAME}/common/source/${DEVICE_NAME}_codestartbranch.asm",
|
||||
alwaysInclude: false,
|
||||
},
|
||||
{
|
||||
name: "driverlib_h",
|
||||
path: "../device_support/${DEVICE_NAME}/common/include/driverlib.h",
|
||||
alwaysInclude: false,
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
function getReferencePath(name)
|
||||
{
|
||||
for (var ref of references)
|
||||
{
|
||||
if (ref.name == name)
|
||||
{
|
||||
return ref.path
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var componentReferences = []
|
||||
for (var ref of references)
|
||||
{
|
||||
ref.path = ref.path.replace(/\$\{DEVICE_NAME\}/g, Common.getDeviceName().toLowerCase())
|
||||
componentReferences.push({
|
||||
path: ref.path,
|
||||
alwaysInclude: ref.alwaysInclude
|
||||
})
|
||||
}
|
||||
|
||||
function appendReferences(refObjs)
|
||||
{
|
||||
componentReferences = componentReferences.concat(refObjs);
|
||||
}
|
||||
|
||||
exports = {
|
||||
references: references,
|
||||
getReferencePath : getReferencePath,
|
||||
appendReferences : appendReferences,
|
||||
componentReferences : componentReferences
|
||||
}
|
||||
@@ -0,0 +1,457 @@
|
||||
% var module = system.modules['/driverlib/adc.js'];
|
||||
% let Common = system.getScript("/driverlib/Common.js");
|
||||
% var nameOfModule = "adc";
|
||||
% var nameOfPeripheral = module.peripheralName;
|
||||
% var device_driverlib_peripheral = system.getScript("/driverlib/device_driverlib_peripherals/" + Common.getDeviceName().toLowerCase() + "_adc.js");
|
||||
%%{
|
||||
if((["F28002x", "F28003x", "F280013x", "F280015x", "F28004x", "F28P65x", "F28P55x"].includes(Common.getDeviceName()))&&(Common.isContextCPU1())){
|
||||
var staticModule = system.modules['/driverlib/asysctl.js']
|
||||
var stat = staticModule.$static
|
||||
}
|
||||
var varDelay = 500
|
||||
var refMode = ""
|
||||
var refVoltage = ""
|
||||
%%}
|
||||
//*****************************************************************************
|
||||
//
|
||||
// ADC Configurations
|
||||
//
|
||||
//*****************************************************************************
|
||||
void `nameOfPeripheral`_init(){
|
||||
%if (module != null)
|
||||
%{
|
||||
% for(var i = 0; i < module.$instances.length; i++) {
|
||||
% var instance = module.$instances[i];
|
||||
% var baseName = instance.$name + "_BASE";
|
||||
`instance.$name`_init();
|
||||
% }
|
||||
%}
|
||||
}
|
||||
|
||||
% for(var i = 0; i < module.$instances.length; i++)
|
||||
% {
|
||||
% var instance = module.$instances[i];
|
||||
% var baseName = instance.$name + "_BASE";
|
||||
% let instancePinmux = instance[nameOfModule];
|
||||
void `instance.$name`_init(){
|
||||
% // delay depends on analog reference
|
||||
% if((["F28002x", "F28003x", "F280013x", "F280015x", "F28004x", "F28P65x", "F28P55x"].includes(Common.getDeviceName()))&&(Common.isContextCPU1())){
|
||||
% if(stat.analogReference == "EXTERNAL"){
|
||||
% refMode = "ADC_REFERENCE_EXTERNAL"
|
||||
% }
|
||||
% else{
|
||||
% refMode = "ADC_REFERENCE_INTERNAL"
|
||||
% }
|
||||
% if(stat.analogReferenceVoltage == "2P5"){
|
||||
% refVoltage = "ADC_REFERENCE_2_5V"
|
||||
% }
|
||||
% else{
|
||||
% refVoltage = "ADC_REFERENCE_3_3V"
|
||||
% }
|
||||
//
|
||||
// ADC Initialization: Write ADC configurations and power up the ADC
|
||||
//
|
||||
// Set the analog voltage reference selection and ADC module's offset trims.
|
||||
// This function sets the analog voltage reference to internal (with the reference voltage of 1.65V or 2.5V) or external for ADC
|
||||
// which is same as ASysCtl APIs.
|
||||
//
|
||||
ADC_setVREF(`baseName`, `refMode`, `refVoltage`);
|
||||
% }
|
||||
//
|
||||
// Configures the analog-to-digital converter module prescaler.
|
||||
//
|
||||
ADC_setPrescaler(`baseName`, `instance.adcClockPrescaler`);
|
||||
% if( ["F2837xD", "F2837xS","F2838x","F28P65x"].includes(system.deviceData.deviceId)){
|
||||
//
|
||||
// Configures the analog-to-digital converter resolution and signal mode.
|
||||
//
|
||||
ADC_setMode(`baseName`, `instance.adcResolutionMode`, `instance.adcSignalMode`);
|
||||
% }
|
||||
//
|
||||
// Sets the timing of the end-of-conversion pulse
|
||||
//
|
||||
ADC_setInterruptPulseMode(`baseName`, `instance.interruptPulseMode`);
|
||||
% if(!["F2807x","F2837xS", "F2837xD"].includes(system.deviceData.deviceId)){
|
||||
% if (instance.interruptPulseMode == "ADC_PULSE_END_OF_ACQ_WIN"){
|
||||
//
|
||||
// Sets the timing of early interrupt generation.
|
||||
//
|
||||
ADC_setInterruptCycleOffset(`baseName`, `instance.interruptCycleOffset`U);
|
||||
% }
|
||||
% }
|
||||
% if(instance.enableConverter){
|
||||
//
|
||||
// Powers up the analog-to-digital converter core.
|
||||
//
|
||||
ADC_enableConverter(`baseName`);
|
||||
% }
|
||||
% else{
|
||||
//
|
||||
// Powers down the analog-to-digital converter module.
|
||||
//
|
||||
ADC_disableConverter(`baseName`);
|
||||
% }
|
||||
%%{
|
||||
//
|
||||
// delay depends on analog reference
|
||||
//
|
||||
if((["F28002x", "F28003x", "F280013x", "F280015x", "F28004x", "F28P65x", "F28P55x"].includes(Common.getDeviceName()))&&(Common.isContextCPU1())){
|
||||
if(stat.analogReference == "EXTERNAL"){
|
||||
varDelay = 500
|
||||
}
|
||||
else{
|
||||
varDelay = 5000
|
||||
}
|
||||
}
|
||||
%%}
|
||||
//
|
||||
// Delay for 1ms to allow ADC time to power up
|
||||
//
|
||||
DEVICE_DELAY_US(`varDelay`);
|
||||
%if(["F28P65x", "F28P55x"].includes(Common.getDeviceName())){
|
||||
% if(instance.enableTDMA){
|
||||
//
|
||||
// Enable alternate timings for DMA trigger
|
||||
//
|
||||
ADC_enableAltDMATiming(`baseName`);
|
||||
% }
|
||||
% else{
|
||||
//
|
||||
// Disables alternate timings for DMA trigger
|
||||
//
|
||||
ADC_disableAltDMATiming(`baseName`);
|
||||
% }
|
||||
% if(instance.enableEXTMUX){
|
||||
% if (instance.extTiming == "Preselection"){
|
||||
//
|
||||
//! Enables external channel mux preselection
|
||||
//
|
||||
ADC_enableExtMuxPreselect(`baseName`);
|
||||
% }
|
||||
% else{
|
||||
//
|
||||
//! Disables external mux preselection
|
||||
//
|
||||
ADC_disableExtMuxPreselect(`baseName`);
|
||||
% }
|
||||
% }
|
||||
% }
|
||||
//
|
||||
// SOC Configuration: Setup ADC EPWM channel and trigger settings
|
||||
% if(instance.enableBurstMode){
|
||||
//
|
||||
// Enables SOC burst mode.
|
||||
//
|
||||
ADC_enableBurstMode(`baseName`);
|
||||
//
|
||||
// Set SOC burst mode.
|
||||
//
|
||||
ADC_setBurstModeConfig(`baseName`, `instance.burstTrigger`, `(instance.burstSize+1)`);
|
||||
% }
|
||||
% else{
|
||||
//
|
||||
// Disables SOC burst mode.
|
||||
//
|
||||
ADC_disableBurstMode(`baseName`);
|
||||
% }
|
||||
//
|
||||
// Sets the priority mode of the SOCs.
|
||||
//
|
||||
ADC_setSOCPriority(`baseName`, `instance.socHighPriorityMode`);
|
||||
% for(var socIndex in device_driverlib_peripheral.ADC_SOCNumber){
|
||||
% var currentSOC = device_driverlib_peripheral.ADC_SOCNumber[socIndex].name
|
||||
% var socNumber = (currentSOC).replace(/[^0-9]/g,'')
|
||||
% if((instance.enabledSOCs).includes(currentSOC)){
|
||||
//
|
||||
// Start of Conversion `socNumber` Configuration
|
||||
//
|
||||
% if(["F28P65x", "F28P55x"].includes(Common.getDeviceName())){
|
||||
% if((instance.enableEXTMUX) && ((instance.adcNumExtPins)!="0")){
|
||||
//
|
||||
// Configures the external channel mux for an ADC SOC.
|
||||
// base: `baseName`
|
||||
// SOC number : `socNumber`
|
||||
// extChannel : `instance["soc"+socNumber+"ExtChannel"]`
|
||||
//
|
||||
ADC_selectSOCExtChannel(`baseName`, ADC_SOC_NUMBER`socNumber`,`instance["soc"+socNumber+"ExtChannel"]`);
|
||||
% }
|
||||
% if(instance["soc" + socNumber.toString() + "Triggermode"]=="repeatermode"){
|
||||
//
|
||||
// Configures Repeater Modules
|
||||
//
|
||||
% for(var rptrIndex in device_driverlib_peripheral.ADC_RepInstance){
|
||||
% var currentRPTR = device_driverlib_peripheral.ADC_RepInstance[rptrIndex].name
|
||||
% var rptriNumber = (currentRPTR).replace(/[^0-9]/g,'')
|
||||
% if((instance["soc" + socNumber.toString() + "Trigger"].replace(/[^0-9]/g,'')==rptriNumber )){
|
||||
//
|
||||
// Repeater module `rptriNumber` parameters
|
||||
// base: `baseName`
|
||||
// RepInstance: `instance["soc" + socNumber.toString() + "Trigger"]`
|
||||
// ADC_RepeaterConfig :
|
||||
// mode : `instance["repeater"+rptriNumber+" Mode"]`
|
||||
// Trigger : `instance["repeater"+rptriNumber+" Trigger"]`
|
||||
// SyncInput : `instance["repeater"+rptriNumber+" SyncInput"]`
|
||||
// Count : `instance["repeater"+rptriNumber+" Count"]`
|
||||
// phase : `instance["repeater"+rptriNumber+" Phase"]`
|
||||
// spread : `instance["repeater"+rptriNumber+" Spread"]`
|
||||
//
|
||||
ADC_triggerRepeaterSelect(`baseName`, ADC_REPINST`rptriNumber`, `instance["repeater"+rptriNumber+" Trigger"]`);
|
||||
ADC_triggerRepeaterMode(`baseName`, ADC_REPINST`rptriNumber`, `instance["repeater"+rptriNumber+" Mode"]`);
|
||||
ADC_triggerRepeaterSyncIn(`baseName`, ADC_REPINST`rptriNumber`, `instance["repeater"+rptriNumber+" SyncInput"]`);
|
||||
ADC_triggerRepeaterCount(`baseName`, ADC_REPINST`rptriNumber`, `instance["repeater"+rptriNumber+" Count"]`);
|
||||
ADC_triggerRepeaterPhase(`baseName`, ADC_REPINST`rptriNumber`, `instance["repeater"+rptriNumber+" Phase"]`);
|
||||
ADC_triggerRepeaterSpread(`baseName`, ADC_REPINST`rptriNumber`, `instance["repeater"+rptriNumber+" Spread"]`);
|
||||
% }
|
||||
% }
|
||||
% }
|
||||
% }
|
||||
//
|
||||
// Configures a start-of-conversion (SOC) in the ADC and its interrupt SOC trigger.
|
||||
// SOC number : `socNumber`
|
||||
// Trigger : `instance["soc"+socNumber+"Trigger"]`
|
||||
// Channel : `instance["soc"+socNumber+"Channel"]`
|
||||
% if (instance["soc" + socNumber.toString() + "UseCalculatedSampleTime"] &&
|
||||
% instance["soc" + socNumber.toString() + "UseSampleTimeCalculator"]){
|
||||
// Sample Window : `instance["soc"+socNumber+"SampleWindowCalculated"]` SYSCLK cycles
|
||||
% }
|
||||
% else{
|
||||
// Sample Window : `instance["soc"+socNumber+"SampleWindow"]` SYSCLK cycles
|
||||
% }
|
||||
// Interrupt Trigger: `instance["soc"+socNumber+"InterruptTrigger"]`
|
||||
//
|
||||
% if (instance["soc" + socNumber.toString() + "UseCalculatedSampleTime"] &&
|
||||
% instance["soc" + socNumber.toString() + "UseSampleTimeCalculator"]){
|
||||
ADC_setupSOC(`baseName`, ADC_SOC_NUMBER`socNumber`, `instance["soc"+socNumber+"Trigger"]`, `instance["soc"+socNumber+"Channel"]`, `instance["soc"+socNumber+"SampleWindowCalculated"]`U);
|
||||
% }
|
||||
% else{
|
||||
ADC_setupSOC(`baseName`, ADC_SOC_NUMBER`socNumber`, `instance["soc"+socNumber+"Trigger"]`, `instance["soc"+socNumber+"Channel"]`, `instance["soc"+socNumber+"SampleWindow"]`U);
|
||||
% }
|
||||
ADC_setInterruptSOCTrigger(`baseName`, ADC_SOC_NUMBER`socNumber`, `instance["soc"+socNumber+"InterruptTrigger"]`);
|
||||
% }
|
||||
% }
|
||||
% for(var intIndex in device_driverlib_peripheral.ADC_IntNumber){
|
||||
% var currentINT = device_driverlib_peripheral.ADC_IntNumber[intIndex].name
|
||||
% var intNumber = (currentINT).replace(/[^0-9]/g,'')
|
||||
% if((instance.enabledInts).includes(currentINT)){
|
||||
//
|
||||
// ADC Interrupt `intNumber` Configuration
|
||||
// Source : `(instance["interrupt"+intNumber+"SOCSource"])`
|
||||
% if(instance["enableInterrupt"+intNumber]){
|
||||
// Interrupt Source: enabled
|
||||
% }
|
||||
% else{
|
||||
// Interrupt Source: disabled
|
||||
% }
|
||||
% if(instance["enableInterrupt"+intNumber+"ContinuousMode"]){
|
||||
// Continuous Mode : enabled
|
||||
% }
|
||||
% else{
|
||||
// Continuous Mode : disabled
|
||||
% }
|
||||
//
|
||||
% for(var ppbIndex in device_driverlib_peripheral.ADC_PPBNumber){
|
||||
% var currentPPB = device_driverlib_peripheral.ADC_PPBNumber[ppbIndex].name
|
||||
% var ppbNumber = (currentPPB).replace(/[^0-9]/g,'')
|
||||
% if((instance.enabledPPBs).includes(currentPPB) && (instance.enabledInts).includes(currentINT)&&((instance["interrupt"+intNumber+"SOCSource"]) == "ADC_INT_TRIGGER_OSINT"+ppbNumber)) {
|
||||
// Configures PPB interrupt source
|
||||
// osIntSrc : `(instance["ppb"+ppbNumber+"SelectOSINTSource"])`
|
||||
% }
|
||||
% }
|
||||
//
|
||||
% for(var ppbIndex in device_driverlib_peripheral.ADC_PPBNumber){
|
||||
% var currentPPB = device_driverlib_peripheral.ADC_PPBNumber[ppbIndex].name
|
||||
% var ppbNumber = (currentPPB).replace(/[^0-9]/g,'')
|
||||
% if((instance.enabledPPBs).includes(currentPPB) && (instance.enabledInts).includes(currentINT)&&((instance["interrupt"+intNumber+"SOCSource"]) == "ADC_INT_TRIGGER_OSINT"+ppbNumber)) {
|
||||
ADC_selectPPBOSINTSource (`baseName`,ADC_PPB_NUMBER`ppbNumber`,`instance["ppb"+ppbNumber+"SelectOSINTSource"]`);
|
||||
% }
|
||||
% }
|
||||
ADC_setInterruptSource(`baseName`, ADC_INT_NUMBER`intNumber`, `instance["interrupt"+intNumber+"SOCSource"]`);
|
||||
% if(instance["enableInterrupt"+intNumber]){
|
||||
ADC_clearInterruptStatus(`baseName`, ADC_INT_NUMBER`intNumber`);
|
||||
% }
|
||||
% if(instance["enableInterrupt"+intNumber+"ContinuousMode"]){
|
||||
ADC_enableContinuousMode(`baseName`, ADC_INT_NUMBER`intNumber`);
|
||||
% }
|
||||
% else{
|
||||
ADC_disableContinuousMode(`baseName`, ADC_INT_NUMBER`intNumber`);
|
||||
% }
|
||||
% if(instance["enableInterrupt"+intNumber]){
|
||||
ADC_enableInterrupt(`baseName`, ADC_INT_NUMBER`intNumber`);
|
||||
% }
|
||||
% else{
|
||||
ADC_disableInterrupt(`baseName`, ADC_INT_NUMBER`intNumber`);
|
||||
% }
|
||||
% }
|
||||
% }
|
||||
% if ((instance.enabledPPBs).length>0){
|
||||
|
||||
//
|
||||
// PPB Configuration: Configure high and low limits detection for ADCPPB
|
||||
% }
|
||||
% var ppbiTotal = 4
|
||||
% for(var ppbIndex in device_driverlib_peripheral.ADC_PPBNumber){
|
||||
% var currentPPB = device_driverlib_peripheral.ADC_PPBNumber[ppbIndex].name
|
||||
% var ppbNumber = (currentPPB).replace(/[^0-9]/g,'')
|
||||
% if((instance.enabledPPBs).includes(currentPPB)){
|
||||
//
|
||||
// Post Processing Block `ppbNumber` Configuration
|
||||
// Configures a post-processing block (PPB) in the ADC.
|
||||
// PPB Number : `ppbNumber`
|
||||
// SOC/EOC number : `((instance["ppb"+ppbNumber+"SOCNumber"]).toString()).replace("ADC_SOC_NUMBER", "")`
|
||||
% if(instance["ppb"+ppbNumber+"EventEnable"].length>0){
|
||||
// Events Sources Enabled : `(instance["ppb"+ppbNumber+"EventEnable"])`
|
||||
% }
|
||||
% if(instance["ppb"+ppbNumber+"EventInterruptEnable"].length>0){
|
||||
// Interrupt Sources Enabled: `instance["ppb"+ppbNumber+"EventInterruptEnable"]`
|
||||
% }
|
||||
// Calibration Offset : `instance["ppb"+ppbNumber+"CalibrationOffset"]`
|
||||
// Reference Offset : `instance["ppb"+ppbNumber+"ReferenceOffset"]`
|
||||
% if(instance["ppb"+ppbNumber+"EnableTwosComplement"]){
|
||||
// Two's Complement : Enabled
|
||||
% }
|
||||
% else{
|
||||
// Two's Complement : Disabled
|
||||
% }
|
||||
// Trip High Limit : `instance["ppb"+ppbNumber+"HighTripLimit"]`
|
||||
// Trip Low Limit : `instance["ppb"+ppbNumber+"LowTripLimit"]`
|
||||
% if(!["F2807x","F2837xS", "F2837xD"].includes(system.deviceData.deviceId)){
|
||||
% if(instance["ppb"+ppbNumber+"EnablePPBEventCBCClear"]){
|
||||
// Clear PPB Event Flags : Enabled
|
||||
% }
|
||||
% else{
|
||||
// Clear PPB Event Flags : Disabled
|
||||
% }
|
||||
% }
|
||||
% if(["F28P65x", "F28P55x"].includes(system.deviceData.deviceId)){
|
||||
// Accumulation Limit : `instance["ppb"+ppbNumber+"AccumulationLimit"]`
|
||||
// SyncInput Source : `instance["ppb"+ppbNumber+"SyncInput"]`
|
||||
// Comparator Source : `instance["ppb"+ppbNumber+"CompSource"]`
|
||||
// Right Shift : `instance["ppb"+ppbNumber+"Rightshift"]`
|
||||
// Absolute value : `instance["ppb"+ppbNumber+"AbsValue"]`
|
||||
% }
|
||||
//
|
||||
ADC_setupPPB(`baseName`, ADC_PPB_NUMBER`ppbNumber`, `instance["ppb"+ppbNumber+"SOCNumber"]`);
|
||||
%%{
|
||||
var eventOptions = ["ADC_EVT_TRIPHI","ADC_EVT_TRIPLO","ADC_EVT_ZERO"]
|
||||
var currentEvent = ""
|
||||
var enableEventCount = 0
|
||||
var eventsToEnableOR = "("
|
||||
for (var eventToEnable in instance["ppb"+ppbNumber+"EventEnable"])
|
||||
{
|
||||
currentEvent = instance["ppb"+ppbNumber+"EventEnable"][enableEventCount]
|
||||
if (enableEventCount == 0)
|
||||
{
|
||||
eventsToEnableOR += currentEvent
|
||||
}
|
||||
else
|
||||
{
|
||||
eventsToEnableOR += " | " + currentEvent
|
||||
}
|
||||
var disableIndex = eventOptions.indexOf(currentEvent)
|
||||
if(disableIndex>-1){
|
||||
eventOptions.splice(disableIndex,1)
|
||||
}
|
||||
enableEventCount++
|
||||
}
|
||||
eventsToEnableOR += ")"
|
||||
var eventsToDisableOR = "("
|
||||
var disableEventCount = 0
|
||||
for(var eventToDisable in eventOptions){
|
||||
currentEvent = eventOptions[disableEventCount]
|
||||
if (disableEventCount == 0)
|
||||
{
|
||||
eventsToDisableOR += currentEvent
|
||||
}
|
||||
else
|
||||
{
|
||||
eventsToDisableOR += " | " + currentEvent
|
||||
}
|
||||
disableEventCount++
|
||||
}
|
||||
eventsToDisableOR += ")"
|
||||
%%}
|
||||
% if(enableEventCount > 0){
|
||||
ADC_enablePPBEvent(`baseName`, ADC_PPB_NUMBER`ppbNumber`, `eventsToEnableOR`);
|
||||
% }
|
||||
% if(disableEventCount > 0){
|
||||
ADC_disablePPBEvent(`baseName`, ADC_PPB_NUMBER`ppbNumber`, `eventsToDisableOR`);
|
||||
% }
|
||||
%%{
|
||||
var eventInterruptOptions = ["ADC_EVT_TRIPHI","ADC_EVT_TRIPLO","ADC_EVT_ZERO"]
|
||||
var currentEventInterrupt = ""
|
||||
var enableEventInterruptCount = 0
|
||||
var eventInterruptsToEnableOR = "("
|
||||
for (var eventInterruptToEnable in instance["ppb"+ppbNumber+"EventInterruptEnable"])
|
||||
{
|
||||
currentEventInterrupt = instance["ppb"+ppbNumber+"EventInterruptEnable"][enableEventInterruptCount]
|
||||
if (enableEventInterruptCount == 0)
|
||||
{
|
||||
eventInterruptsToEnableOR += currentEventInterrupt
|
||||
}
|
||||
else
|
||||
{
|
||||
eventInterruptsToEnableOR += " | " + currentEventInterrupt
|
||||
}
|
||||
var disableIndex = eventInterruptOptions.indexOf(currentEventInterrupt)
|
||||
if(disableIndex>-1){
|
||||
eventInterruptOptions.splice(disableIndex,1)
|
||||
}
|
||||
enableEventInterruptCount++
|
||||
}
|
||||
eventInterruptsToEnableOR += ")"
|
||||
var eventInterruptsToDisableOR = "("
|
||||
var disableEventInterruptCount = 0
|
||||
for(var eventInterruptToDisable in eventInterruptOptions){
|
||||
currentEventInterrupt = eventInterruptOptions[disableEventInterruptCount]
|
||||
if (disableEventInterruptCount == 0)
|
||||
{
|
||||
eventInterruptsToDisableOR += currentEventInterrupt
|
||||
}
|
||||
else
|
||||
{
|
||||
eventInterruptsToDisableOR += " | " + currentEventInterrupt
|
||||
}
|
||||
disableEventInterruptCount++
|
||||
}
|
||||
eventInterruptsToDisableOR += ")"
|
||||
%%}
|
||||
% if(enableEventInterruptCount > 0){
|
||||
ADC_enablePPBEventInterrupt(`baseName`, ADC_PPB_NUMBER`ppbNumber`, `eventInterruptsToEnableOR`);
|
||||
% }
|
||||
% if(disableEventInterruptCount > 0){
|
||||
ADC_disablePPBEventInterrupt(`baseName`, ADC_PPB_NUMBER`ppbNumber`, `eventInterruptsToDisableOR`);
|
||||
% }
|
||||
ADC_setPPBCalibrationOffset(`baseName`, ADC_PPB_NUMBER`ppbNumber`, `instance["ppb"+ppbNumber+"CalibrationOffset"]`);
|
||||
ADC_setPPBReferenceOffset(`baseName`, ADC_PPB_NUMBER`ppbNumber`, `instance["ppb"+ppbNumber+"ReferenceOffset"]`);
|
||||
% if(instance["ppb"+ppbNumber+"EnableTwosComplement"]){
|
||||
ADC_enablePPBTwosComplement(`baseName`, ADC_PPB_NUMBER`ppbNumber`);
|
||||
% }
|
||||
% else {
|
||||
ADC_disablePPBTwosComplement(`baseName`, ADC_PPB_NUMBER`ppbNumber`);
|
||||
% }
|
||||
ADC_setPPBTripLimits(`baseName`, ADC_PPB_NUMBER`ppbNumber`, `instance["ppb"+ppbNumber+"HighTripLimit"]`, `instance["ppb"+ppbNumber+"LowTripLimit"]`);
|
||||
% if(!["F2807x","F2837xS", "F2837xD"].includes(system.deviceData.deviceId)){
|
||||
% if (instance["ppb"+ppbNumber+"EnablePPBEventCBCClear"]){
|
||||
ADC_enablePPBEventCBCClear(`baseName`, ADC_PPB_NUMBER`ppbNumber`);
|
||||
% }
|
||||
% else{
|
||||
ADC_disablePPBEventCBCClear(`baseName`, ADC_PPB_NUMBER`ppbNumber`);
|
||||
% }
|
||||
% }
|
||||
% if(["F28P65x", "F28P55x"].includes(Common.getDeviceName())){
|
||||
ADC_setPPBCountLimit(`baseName`, ADC_PPB_NUMBER`ppbNumber`,`instance["ppb"+ppbNumber+"AccumulationLimit"]`);
|
||||
ADC_selectPPBSyncInput(`baseName`, ADC_PPB_NUMBER`ppbNumber`,`instance["ppb"+ppbNumber+"SyncInput"]`);
|
||||
ADC_selectPPBCompareSource(`baseName`, ADC_PPB_NUMBER`ppbNumber`,`instance["ppb"+ppbNumber+"CompSource"]`);
|
||||
ADC_setPPBShiftValue(`baseName`, ADC_PPB_NUMBER`ppbNumber`,`instance["ppb"+ppbNumber+"Rightshift"]`);
|
||||
% if(instance["ppb"+ppbNumber+"AbsValue"]){
|
||||
ADC_enablePPBAbsoluteValue(`baseName`, ADC_PPB_NUMBER`ppbNumber`);
|
||||
% }
|
||||
% else {
|
||||
ADC_disablePPBAbsoluteValue(`baseName`, ADC_PPB_NUMBER`ppbNumber`);
|
||||
% }
|
||||
% }
|
||||
% }
|
||||
% }
|
||||
}
|
||||
|
||||
% }
|
||||
@@ -0,0 +1,75 @@
|
||||
% var moduleName = "adc"
|
||||
% var module = system.modules['/driverlib/' + moduleName + '.js'];
|
||||
% let Common = system.getScript("/driverlib/Common.js");
|
||||
% var device_driverlib_peripheral = system.getScript("/driverlib/device_driverlib_peripherals/" + Common.getDeviceName().toLowerCase() + "_adc.js");
|
||||
%if (module != null)
|
||||
%{
|
||||
//*****************************************************************************
|
||||
//
|
||||
// ADC Configurations
|
||||
//
|
||||
//*****************************************************************************
|
||||
% for(var i = 0; i < module.$instances.length; i++) {
|
||||
% var instance = module.$instances[i];
|
||||
#define `instance.$name`_BASE `instance.adcBase`
|
||||
#define `instance.$name`_RESULT_BASE `instance.adcBase.replace("_BASE", "RESULT_BASE")`
|
||||
% for(var socIndex in device_driverlib_peripheral.ADC_SOCNumber){
|
||||
% var currentSOC = device_driverlib_peripheral.ADC_SOCNumber[socIndex].name
|
||||
% var socNumber = (currentSOC).replace(/[^0-9]/g,'')
|
||||
% if((instance.enabledSOCs).includes(currentSOC)){
|
||||
% var soc_name = instance["soc" + socIndex.toString() + "Name"].replace(/\s/g, '')
|
||||
% if (soc_name != "")
|
||||
% {
|
||||
% if (!instance["soc" + socIndex.toString() + "IndependentNameMode"])
|
||||
% {
|
||||
#define `instance.$name`_`soc_name` ADC_SOC_NUMBER`socNumber`
|
||||
#define `instance.$name`_FORCE_`soc_name` ADC_FORCE_SOC`socNumber`
|
||||
#define `instance.$name`_SAMPLE_WINDOW_`soc_name` `instance["soc" + socIndex.toString() + "SampleTime"]`
|
||||
#define `instance.$name`_TRIGGER_SOURCE_`soc_name` `instance["soc" + socIndex.toString() + "Trigger"]`
|
||||
#define `instance.$name`_CHANNEL_`soc_name` `instance["soc" + socIndex.toString() + "Channel"]`
|
||||
% if(instance["soc" + socNumber.toString() + "Triggermode"]=="repeatermode"){
|
||||
% for(var rptrIndex in device_driverlib_peripheral.ADC_RepInstance){
|
||||
% var currentRPTR = device_driverlib_peripheral.ADC_RepInstance[rptrIndex].name
|
||||
% var rptriNumber = (currentRPTR).replace(/[^0-9]/g,'')
|
||||
%}
|
||||
%}
|
||||
% } else {
|
||||
#define `soc_name` ADC_SOC_NUMBER`socNumber`
|
||||
#define `soc_name`_FORCE ADC_FORCE_SOC`socNumber`
|
||||
#define `soc_name`_ADC_BASE `instance.adcBase`
|
||||
#define `soc_name`_RESULT_BASE `instance.adcBase.replace("_BASE", "RESULT_BASE")`
|
||||
#define `soc_name`_SAMPLE_WINDOW `instance["soc" + socIndex.toString() + "SampleTime"]`
|
||||
#define `soc_name`_TRIGGER_SOURCE `instance["soc" + socIndex.toString() + "Trigger"]`
|
||||
#define `soc_name`_CHANNEL `instance["soc" + socIndex.toString() + "Channel"]`
|
||||
% if(instance["soc" + socNumber.toString() + "Triggermode"]=="repeatermode"){
|
||||
% for(var rptrIndex in device_driverlib_peripheral.ADC_RepInstance){
|
||||
% var currentRPTR = device_driverlib_peripheral.ADC_RepInstance[rptrIndex].name
|
||||
% var rptriNumber = (currentRPTR).replace(/[^0-9]/g,'')
|
||||
%}
|
||||
%}
|
||||
% }
|
||||
% }
|
||||
% }
|
||||
% }
|
||||
% for(var ppbIndex in device_driverlib_peripheral.ADC_PPBNumber){
|
||||
% var currentPPB = device_driverlib_peripheral.ADC_PPBNumber[ppbIndex].name
|
||||
% var ppbNumber = (currentPPB).replace(/[^0-9]/g,'')
|
||||
% if((instance.enabledPPBs).includes(currentPPB)){
|
||||
% var ppb_name = instance["ppb" + ppbNumber.toString() + "Name"].replace(/\s/g, '')
|
||||
% if (ppb_name != "")
|
||||
% {
|
||||
% if (!instance["ppb" + ppbNumber.toString() + "IndependentNameMode"])
|
||||
% {
|
||||
#define `instance.$name`_`ppb_name` ADC_PPB_NUMBER`ppbNumber`
|
||||
#define `instance.$name`_SOC_`ppb_name` `instance["ppb" + ppbNumber.toString() + "SOCNumber"]`
|
||||
% } else {
|
||||
#define `ppb_name` ADC_PPB_NUMBER`ppbNumber`
|
||||
#define `ppb_name`_SOC `instance["ppb" + ppbNumber.toString() + "SOCNumber"]`
|
||||
% }
|
||||
% }
|
||||
% }
|
||||
% }
|
||||
void `instance.$name`_init();
|
||||
|
||||
% }
|
||||
%}
|
||||
@@ -0,0 +1,514 @@
|
||||
var tEOC_12bit_SYSCLK = {
|
||||
ADC_CLK_DIV_1_0 : 11,
|
||||
ADC_CLK_DIV_2_0 : 21,
|
||||
ADC_CLK_DIV_2_5 : 26,
|
||||
ADC_CLK_DIV_3_0 : 31,
|
||||
ADC_CLK_DIV_3_5 : 36,
|
||||
ADC_CLK_DIV_4_0 : 41,
|
||||
ADC_CLK_DIV_4_5 : 46,
|
||||
ADC_CLK_DIV_5_0 : 51,
|
||||
ADC_CLK_DIV_5_5 : 56,
|
||||
ADC_CLK_DIV_6_0 : 61,
|
||||
ADC_CLK_DIV_6_5 : 66,
|
||||
ADC_CLK_DIV_7_0 : 71,
|
||||
ADC_CLK_DIV_7_5 : 76,
|
||||
ADC_CLK_DIV_8_0 : 81,
|
||||
ADC_CLK_DIV_8_5 : 86,
|
||||
}
|
||||
|
||||
var tEOC_16bit_SYSCLK = {
|
||||
ADC_CLK_DIV_1_0 : 31,
|
||||
ADC_CLK_DIV_2_0 : 60,
|
||||
ADC_CLK_DIV_2_5 : 75,
|
||||
ADC_CLK_DIV_3_0 : 90,
|
||||
ADC_CLK_DIV_3_5 : 104,
|
||||
ADC_CLK_DIV_4_0 : 119,
|
||||
ADC_CLK_DIV_4_5 : 134,
|
||||
ADC_CLK_DIV_5_0 : 149,
|
||||
ADC_CLK_DIV_5_5 : 163,
|
||||
ADC_CLK_DIV_6_0 : 178,
|
||||
ADC_CLK_DIV_6_5 : 193,
|
||||
ADC_CLK_DIV_7_0 : 208,
|
||||
ADC_CLK_DIV_7_5 : 222,
|
||||
ADC_CLK_DIV_8_0 : 237,
|
||||
ADC_CLK_DIV_8_5 : 252,
|
||||
}
|
||||
|
||||
var Cp_F28004x = {
|
||||
ADCINA0 : { CMP_DIS: 12.7 , CMP_EN: 15.2 },
|
||||
ADCINA1 : { CMP_DIS: 13.7 , CMP_EN: 16.2 },
|
||||
ADCINA2 : { CMP_DIS: 9.2 , CMP_EN: 11.7 },
|
||||
ADCINA3 : { CMP_DIS: 6.9 , CMP_EN: 9.4 },
|
||||
ADCINA4 : { CMP_DIS: 9.2 , CMP_EN: 11.7 },
|
||||
ADCINA5 : { CMP_DIS: 7.5 , CMP_EN: 10 },
|
||||
ADCINA6 : { CMP_DIS: 8.0 , CMP_EN: 10.5 },
|
||||
ADCINA7 : { CMP_DIS: 7.0 , CMP_EN: 9.5 },
|
||||
ADCINA8 : { CMP_DIS: 10.0 , CMP_EN: 12.5 },
|
||||
ADCINA9 : { CMP_DIS: 8.1 , CMP_EN: 10.6 },
|
||||
ADCINA10 : { CMP_DIS: 9.3 , CMP_EN: 11.8 },
|
||||
ADCINB0 : { CMP_DIS: 7.1 , CMP_EN: 9.6 },
|
||||
ADCINB1 : { CMP_DIS: 9.3 , CMP_EN: 11.8 },
|
||||
ADCINB2 : { CMP_DIS: 9.6 , CMP_EN: 12.1 },
|
||||
ADCINB3 : { CMP_DIS: 125.6 , CMP_EN: 128.1 },
|
||||
ADCINB4 : { CMP_DIS: 8.8 , CMP_EN: 11.3 },
|
||||
ADCINB5 : { CMP_DIS: 7.1 , CMP_EN: 9.6 },
|
||||
ADCINB6 : { CMP_DIS: 9.2 , CMP_EN: 11.7 },
|
||||
ADCINB8 : { CMP_DIS: 9.2 , CMP_EN: 11.7 },
|
||||
ADCINB15 : { CMP_DIS: 12.7 , CMP_EN: 15.2 },
|
||||
ADCINC0 : { CMP_DIS: 6.4 , CMP_EN: 8.9 },
|
||||
ADCINC1 : { CMP_DIS: 6.1 , CMP_EN: 8.6 },
|
||||
ADCINC2 : { CMP_DIS: 5.24 , CMP_EN: 7.74 },
|
||||
ADCINC3 : { CMP_DIS: 5.5 , CMP_EN: 8 },
|
||||
ADCINC4 : { CMP_DIS: 6.2 , CMP_EN: 8.7 },
|
||||
ADCINC5 : { CMP_DIS: 5.6 , CMP_EN: 8.1 },
|
||||
ADCINC6 : { CMP_DIS: 9.6 , CMP_EN: 12.1 },
|
||||
ADCINC8 : { CMP_DIS: 8.8 , CMP_EN: 11.3 },
|
||||
ADCINC10 : { CMP_DIS: 9.3 , CMP_EN: 11.8 },
|
||||
ADCINC12 : { CMP_DIS: 4.1 , CMP_EN: 6.6 },
|
||||
ADCINC14 : { CMP_DIS: 4.5 , CMP_EN: 7 },
|
||||
ADCINC15 : { CMP_DIS: 12.7 , CMP_EN: 15.2 },
|
||||
}
|
||||
|
||||
var Cp_F2837xD = {
|
||||
ADCINA0 : { CMP_DIS: 12.9 , CMP_EN: 12.9 },
|
||||
ADCINA1 : { CMP_DIS: 10.3 , CMP_EN: 10.3 },
|
||||
ADCINA2 : { CMP_DIS: 5.9 , CMP_EN: 7.3 },
|
||||
ADCINA3 : { CMP_DIS: 6.3 , CMP_EN: 8.8 },
|
||||
ADCINA4 : { CMP_DIS: 5.9 , CMP_EN: 7.3 },
|
||||
ADCINA5 : { CMP_DIS: 6.3 , CMP_EN: 8.8 },
|
||||
ADCINB0 : { CMP_DIS: 117.0 , CMP_EN: 117.0 },
|
||||
ADCINB1 : { CMP_DIS: 10.6 , CMP_EN: 10.6 },
|
||||
ADCINB2 : { CMP_DIS: 5.9 , CMP_EN: 7.3 },
|
||||
ADCINB3 : { CMP_DIS: 6.2 , CMP_EN: 8.7 },
|
||||
ADCINB4 : { CMP_DIS: 5.2 , CMP_EN: 5.2 },
|
||||
ADCINB5 : { CMP_DIS: 5.1 , CMP_EN: 5.1 },
|
||||
ADCINC2 : { CMP_DIS: 5.5 , CMP_EN: 6.9 },
|
||||
ADCINC3 : { CMP_DIS: 5.8 , CMP_EN: 8.3 },
|
||||
ADCINC4 : { CMP_DIS: 5.0 , CMP_EN: 6.4 },
|
||||
ADCINC5 : { CMP_DIS: 5.3 , CMP_EN: 7.8 },
|
||||
ADCIND0 : { CMP_DIS: 5.3 , CMP_EN: 6.7 },
|
||||
ADCIND1 : { CMP_DIS: 5.7 , CMP_EN: 8.2 },
|
||||
ADCIND2 : { CMP_DIS: 5.3 , CMP_EN: 6.7 },
|
||||
ADCIND3 : { CMP_DIS: 5.6 , CMP_EN: 8.1 },
|
||||
ADCIND4 : { CMP_DIS: 4.3 , CMP_EN: 4.3 },
|
||||
ADCIND5 : { CMP_DIS: 4.3 , CMP_EN: 4.3 },
|
||||
ADCINA14 : { CMP_DIS: 8.6 , CMP_EN: 10.0 },
|
||||
ADCINA15 : { CMP_DIS: 9.0 , CMP_EN: 11.5 },
|
||||
ADCINB14 : { CMP_DIS: 8.6 , CMP_EN: 10.0 },
|
||||
ADCINB15 : { CMP_DIS: 9.0 , CMP_EN: 11.5 },
|
||||
ADCINC14 : { CMP_DIS: 8.6 , CMP_EN: 10.0 },
|
||||
ADCINC15 : { CMP_DIS: 9.0 , CMP_EN: 11.5 },
|
||||
ADCIND14 : { CMP_DIS: 8.6 , CMP_EN: 10.0 },
|
||||
ADCIND15 : { CMP_DIS: 9.0 , CMP_EN: 11.5 },
|
||||
}
|
||||
|
||||
var Cp_F2837xS = {
|
||||
ADCINA0 : { CMP_DIS: 12.9 , CMP_EN: 12.9 },
|
||||
ADCINA1 : { CMP_DIS: 10.3 , CMP_EN: 10.3 },
|
||||
ADCINA2 : { CMP_DIS: 5.9 , CMP_EN: 7.3 },
|
||||
ADCINA3 : { CMP_DIS: 6.3 , CMP_EN: 8.8 },
|
||||
ADCINA4 : { CMP_DIS: 5.9 , CMP_EN: 7.3 },
|
||||
ADCINA5 : { CMP_DIS: 6.3 , CMP_EN: 8.8 },
|
||||
ADCINB0 : { CMP_DIS: 117.0 , CMP_EN: 117.0 },
|
||||
ADCINB1 : { CMP_DIS: 10.6 , CMP_EN: 10.6 },
|
||||
ADCINB2 : { CMP_DIS: 5.9 , CMP_EN: 7.3 },
|
||||
ADCINB3 : { CMP_DIS: 6.2 , CMP_EN: 8.7 },
|
||||
ADCINB4 : { CMP_DIS: 5.2 , CMP_EN: 5.2 },
|
||||
ADCINB5 : { CMP_DIS: 5.1 , CMP_EN: 5.1 },
|
||||
ADCINC2 : { CMP_DIS: 5.5 , CMP_EN: 6.9 },
|
||||
ADCINC3 : { CMP_DIS: 5.8 , CMP_EN: 8.3 },
|
||||
ADCINC4 : { CMP_DIS: 5.0 , CMP_EN: 6.4 },
|
||||
ADCINC5 : { CMP_DIS: 5.3 , CMP_EN: 7.8 },
|
||||
ADCIND0 : { CMP_DIS: 5.3 , CMP_EN: 6.7 },
|
||||
ADCIND1 : { CMP_DIS: 5.7 , CMP_EN: 8.2 },
|
||||
ADCIND2 : { CMP_DIS: 5.3 , CMP_EN: 6.7 },
|
||||
ADCIND3 : { CMP_DIS: 5.6 , CMP_EN: 8.1 },
|
||||
ADCIND4 : { CMP_DIS: 4.3 , CMP_EN: 4.3 },
|
||||
ADCIND5 : { CMP_DIS: 4.3 , CMP_EN: 4.3 },
|
||||
ADCINA14 : { CMP_DIS: 8.6 , CMP_EN: 10.0 },
|
||||
ADCINA15 : { CMP_DIS: 9.0 , CMP_EN: 11.5 },
|
||||
ADCINB14 : { CMP_DIS: 8.6 , CMP_EN: 10.0 },
|
||||
ADCINB15 : { CMP_DIS: 9.0 , CMP_EN: 11.5 },
|
||||
ADCINC14 : { CMP_DIS: 8.6 , CMP_EN: 10.0 },
|
||||
ADCINC15 : { CMP_DIS: 9.0 , CMP_EN: 11.5 },
|
||||
ADCIND14 : { CMP_DIS: 8.6 , CMP_EN: 10.0 },
|
||||
ADCIND15 : { CMP_DIS: 9.0 , CMP_EN: 11.5 },
|
||||
}
|
||||
|
||||
var Cp_F2838x = {
|
||||
ADCINA0 : { CMP_DIS: 12.9 , CMP_EN: 12.9 },
|
||||
ADCINA1 : { CMP_DIS: 10.3 , CMP_EN: 10.3 },
|
||||
ADCINA2 : { CMP_DIS: 5.9 , CMP_EN: 7.3 },
|
||||
ADCINA3 : { CMP_DIS: 6.3 , CMP_EN: 8.8 },
|
||||
ADCINA4 : { CMP_DIS: 5.9 , CMP_EN: 7.3 },
|
||||
ADCINA5 : { CMP_DIS: 6.3 , CMP_EN: 8.8 },
|
||||
ADCINB0 : { CMP_DIS: 117.0 , CMP_EN: 117.0 },
|
||||
ADCINB1 : { CMP_DIS: 10.6 , CMP_EN: 10.6 },
|
||||
ADCINB2 : { CMP_DIS: 5.9 , CMP_EN: 7.3 },
|
||||
ADCINB3 : { CMP_DIS: 6.2 , CMP_EN: 8.7 },
|
||||
ADCINB4 : { CMP_DIS: 5.2 , CMP_EN: 5.2 },
|
||||
ADCINB5 : { CMP_DIS: 5.1 , CMP_EN: 5.1 },
|
||||
ADCINC2 : { CMP_DIS: 5.5 , CMP_EN: 6.9 },
|
||||
ADCINC3 : { CMP_DIS: 5.8 , CMP_EN: 8.3 },
|
||||
ADCINC4 : { CMP_DIS: 5.0 , CMP_EN: 6.4 },
|
||||
ADCINC5 : { CMP_DIS: 5.3 , CMP_EN: 7.8 },
|
||||
ADCIND0 : { CMP_DIS: 5.3 , CMP_EN: 6.7 },
|
||||
ADCIND1 : { CMP_DIS: 5.7 , CMP_EN: 8.2 },
|
||||
ADCIND2 : { CMP_DIS: 5.3 , CMP_EN: 6.7 },
|
||||
ADCIND3 : { CMP_DIS: 5.6 , CMP_EN: 8.1 },
|
||||
ADCIND4 : { CMP_DIS: 4.3 , CMP_EN: 4.3 },
|
||||
ADCIND5 : { CMP_DIS: 4.3 , CMP_EN: 4.3 },
|
||||
ADCINA14 : { CMP_DIS: 8.6 , CMP_EN: 10.0 },
|
||||
ADCINA15 : { CMP_DIS: 9.0 , CMP_EN: 11.5 },
|
||||
ADCINB14 : { CMP_DIS: 8.6 , CMP_EN: 10.0 },
|
||||
ADCINB15 : { CMP_DIS: 9.0 , CMP_EN: 11.5 },
|
||||
ADCINC14 : { CMP_DIS: 8.6 , CMP_EN: 10.0 },
|
||||
ADCINC15 : { CMP_DIS: 9.0 , CMP_EN: 11.5 },
|
||||
ADCIND14 : { CMP_DIS: 8.6 , CMP_EN: 10.0 },
|
||||
ADCIND15 : { CMP_DIS: 9.0 , CMP_EN: 11.5 },
|
||||
}
|
||||
|
||||
var Cp_F2807x = {
|
||||
ADCINA0 : { CMP_DIS: 12.9 , CMP_EN: 12.9 },
|
||||
ADCINA1 : { CMP_DIS: 10.3 , CMP_EN: 10.3 },
|
||||
ADCINA2 : { CMP_DIS: 5.9 , CMP_EN: 7.3 },
|
||||
ADCINA3 : { CMP_DIS: 6.3 , CMP_EN: 8.8 },
|
||||
ADCINA4 : { CMP_DIS: 5.9 , CMP_EN: 7.3 },
|
||||
ADCINA5 : { CMP_DIS: 6.3 , CMP_EN: 8.8 },
|
||||
ADCINB0 : { CMP_DIS: 117.0 , CMP_EN: 117.0 },
|
||||
ADCINB1 : { CMP_DIS: 10.6 , CMP_EN: 10.6 },
|
||||
ADCINB2 : { CMP_DIS: 5.9 , CMP_EN: 7.3 },
|
||||
ADCINB3 : { CMP_DIS: 6.2 , CMP_EN: 8.7 },
|
||||
ADCINB4 : { CMP_DIS: 5.2 , CMP_EN: 5.2 },
|
||||
ADCINB5 : { CMP_DIS: 5.1 , CMP_EN: 5.1 },
|
||||
ADCIND0 : { CMP_DIS: 5.3 , CMP_EN: 6.7 },
|
||||
ADCIND1 : { CMP_DIS: 5.7 , CMP_EN: 8.2 },
|
||||
ADCIND2 : { CMP_DIS: 5.3 , CMP_EN: 6.7 },
|
||||
ADCIND3 : { CMP_DIS: 5.6 , CMP_EN: 8.1 },
|
||||
ADCIND4 : { CMP_DIS: 4.3 , CMP_EN: 4.3 },
|
||||
ADCINA14 : { CMP_DIS: 8.6 , CMP_EN: 10.0 },
|
||||
ADCINA15 : { CMP_DIS: 9.0 , CMP_EN: 11.5 },
|
||||
ADCINB14 : { CMP_DIS: 8.6 , CMP_EN: 10.0 },
|
||||
ADCINB15 : { CMP_DIS: 9.0 , CMP_EN: 11.5 },
|
||||
ADCIND14 : { CMP_DIS: 8.6 , CMP_EN: 10.0 },
|
||||
ADCIND15 : { CMP_DIS: 9.0 , CMP_EN: 11.5 },
|
||||
}
|
||||
|
||||
var Cp_F28002x = {
|
||||
ADCINA0 : { CMP_DIS: 3.3 , CMP_EN: 15.8 },
|
||||
ADCINC15 : { CMP_DIS: 3.3 , CMP_EN: 15.8 },
|
||||
ADCINA1 : { CMP_DIS: 2.4 , CMP_EN: 4.9 },
|
||||
ADCINA2 : { CMP_DIS: 2.9 , CMP_EN: 5.4 },
|
||||
ADCINC9 : { CMP_DIS: 2.9 , CMP_EN: 5.4 },
|
||||
ADCINA3 : { CMP_DIS: 71.4 , CMP_EN: 73.9 },
|
||||
ADCINC5 : { CMP_DIS: 71.4 , CMP_EN: 73.9 },
|
||||
ADCINA4 : { CMP_DIS: 4.5 , CMP_EN: 7 },
|
||||
ADCINC14 : { CMP_DIS: 4.5 , CMP_EN: 7 },
|
||||
ADCINA5 : { CMP_DIS: 2.7 , CMP_EN: 5.2 },
|
||||
ADCINC2 : { CMP_DIS: 2.7 , CMP_EN: 5.2 },
|
||||
ADCINA6 : { CMP_DIS: 2.6 , CMP_EN: 5.1 },
|
||||
ADCINA7 : { CMP_DIS: 4.2 , CMP_EN: 6.7 },
|
||||
ADCINC3 : { CMP_DIS: 4.2 , CMP_EN: 6.7 },
|
||||
ADCINA8 : { CMP_DIS: 4.5 , CMP_EN: 7 },
|
||||
ADCINC11 : { CMP_DIS: 4.5 , CMP_EN: 7 },
|
||||
ADCINA9 : { CMP_DIS: 3.4 , CMP_EN: 5.9 },
|
||||
ADCINC8 : { CMP_DIS: 3.4 , CMP_EN: 5.9 },
|
||||
ADCINA10 : { CMP_DIS: 2.9 , CMP_EN: 5.4 },
|
||||
ADCINC10 : { CMP_DIS: 2.9 , CMP_EN: 5.4 },
|
||||
ADCINA11 : { CMP_DIS: 2.9 , CMP_EN: 5.4 },
|
||||
ADCINC0 : { CMP_DIS: 2.9 , CMP_EN: 5.4 },
|
||||
ADCINA12 : { CMP_DIS: 4.7 , CMP_EN: 7.2 },
|
||||
ADCINC1 : { CMP_DIS: 4.7 , CMP_EN: 7.2 },
|
||||
ADCINA14 : { CMP_DIS: 2.5 , CMP_EN: 5 },
|
||||
ADCINC4 : { CMP_DIS: 2.5 , CMP_EN: 5 },
|
||||
ADCINA15 : { CMP_DIS: 3.3 , CMP_EN: 5.8 },
|
||||
ADCINC7 : { CMP_DIS: 3.3 , CMP_EN: 5.8 },
|
||||
ADCINC6 : { CMP_DIS: 2.9 , CMP_EN: 5.4 },
|
||||
}
|
||||
|
||||
var Cp_F28003x = {
|
||||
ADCINA0 : { CMP_DIS: 9.1 , CMP_EN: 11.6 },
|
||||
ADCINA1 : { CMP_DIS: 7.4 , CMP_EN: 9.9 },
|
||||
ADCINA2 : { CMP_DIS: 4.1 , CMP_EN: 6.6 },
|
||||
ADCINA3 : { CMP_DIS: 3.3 , CMP_EN: 5.8 },
|
||||
ADCINA4 : { CMP_DIS: 3.8 , CMP_EN: 6.3 },
|
||||
ADCINA5 : { CMP_DIS: 3.5 , CMP_EN: 6 },
|
||||
ADCINA6 : { CMP_DIS: 3.2 , CMP_EN: 5.7 },
|
||||
ADCINA7 : { CMP_DIS: 3.8 , CMP_EN: 6.3 },
|
||||
ADCINA8 : { CMP_DIS: 4.1 , CMP_EN: 6.6 },
|
||||
ADCINA9 : { CMP_DIS: 3.1 , CMP_EN: 5.6 },
|
||||
ADCINA10 : { CMP_DIS: 4.7 , CMP_EN: 7.2 },
|
||||
ADCINA11 : { CMP_DIS: 4 , CMP_EN: 6.5 },
|
||||
ADCINA12 : { CMP_DIS: 3.4 , CMP_EN: 5.9 },
|
||||
ADCINA14 : { CMP_DIS: 3.8 , CMP_EN: 6.3 },
|
||||
ADCINA15 : { CMP_DIS: 3.8 , CMP_EN: 6.3 },
|
||||
ADCINC0 : { CMP_DIS: 4 , CMP_EN: 6.5 },
|
||||
ADCINC1 : { CMP_DIS: 3 , CMP_EN: 5.5 },
|
||||
ADCINC2 : { CMP_DIS: 3.6 , CMP_EN: 6.1 },
|
||||
ADCINC3 : { CMP_DIS: 3.8 , CMP_EN: 6.3 },
|
||||
ADCINC4 : { CMP_DIS: 3.8 , CMP_EN: 6.3 },
|
||||
ADCINC5 : { CMP_DIS: 3.6 , CMP_EN: 6.1 },
|
||||
ADCINC6 : { CMP_DIS: 3.9 , CMP_EN: 6.4 },
|
||||
ADCINC7 : { CMP_DIS: 3.3 , CMP_EN: 5.8 },
|
||||
ADCINC8 : { CMP_DIS: 3.8 , CMP_EN: 6.3 },
|
||||
ADCINC9 : { CMP_DIS: 4.1 , CMP_EN: 6.6 },
|
||||
ADCINC10 : { CMP_DIS: 4.7 , CMP_EN: 7.2 },
|
||||
ADCINC11 : { CMP_DIS: 4.1 , CMP_EN: 6.6 },
|
||||
ADCINC14 : { CMP_DIS: 4.2 , CMP_EN: 6.7 },
|
||||
ADCINC15 : { CMP_DIS: 9.1 , CMP_EN: 11.6 },
|
||||
ADCINB0 : { CMP_DIS: 4.1 , CMP_EN: 6.6 },
|
||||
ADCINB1 : { CMP_DIS: 4.7 , CMP_EN: 7.2 },
|
||||
ADCINB2 : { CMP_DIS: 3.9 , CMP_EN: 6.4 },
|
||||
ADCINB3 : { CMP_DIS: 75 , CMP_EN: 77.5 },
|
||||
ADCINB4 : { CMP_DIS: 3.8 , CMP_EN: 6.3 },
|
||||
ADCINB5 : { CMP_DIS: 3.5 , CMP_EN: 6 },
|
||||
ADCINB6 : { CMP_DIS: 4.1 , CMP_EN: 6.6 },
|
||||
ADCINB7 : { CMP_DIS: 7.4 , CMP_EN: 9.9 },
|
||||
ADCINB8 : { CMP_DIS: 3.8 , CMP_EN: 6.3 },
|
||||
ADCINB9 : { CMP_DIS: 3.3 , CMP_EN: 5.8 },
|
||||
ADCINB11 : { CMP_DIS: 4 , CMP_EN: 6.5 },
|
||||
ADCINB12 : { CMP_DIS: 3.6 , CMP_EN: 6.1 },
|
||||
ADCINB14 : { CMP_DIS: 3.8 , CMP_EN: 6.3 },
|
||||
ADCINB15 : { CMP_DIS: 9.1 , CMP_EN: 11.6 },
|
||||
AGPIO_B5 : { CMP_DIS: 3.2 , CMP_EN: 5.7 },
|
||||
AGPIO_B11 : { CMP_DIS: 3.1 , CMP_EN: 5.6 },
|
||||
}
|
||||
|
||||
var Cp_F280013x = {
|
||||
ADCINA0 : { CMP_DIS: 9.3, CMP_EN: 14.3 },
|
||||
ADCINA1 : { CMP_DIS: 9.3, CMP_EN: 14.3 },
|
||||
ADCINA2 : { CMP_DIS: 1.5, CMP_EN: 4.0 },
|
||||
ADCINA3 : { CMP_DIS: 1.8, CMP_EN: 4.3 },
|
||||
ADCINA4 : { CMP_DIS: 2.4, CMP_EN: 4.9 },
|
||||
ADCINA5 : { CMP_DIS: 4.4, CMP_EN: 9.4 },
|
||||
ADCINA6 : { CMP_DIS: 3.1, CMP_EN: 8.1 },
|
||||
ADCINA7 : { CMP_DIS: 5.1, CMP_EN: 10.1 },
|
||||
ADCINA8 : { CMP_DIS: 2.2, CMP_EN: 4.7 },
|
||||
ADCINA9 : { CMP_DIS: 4.3, CMP_EN: 9.3 },
|
||||
ADCINA10 : { CMP_DIS: 4.3, CMP_EN: 9.3 },
|
||||
ADCINA11 : { CMP_DIS: 4.4 , CMP_EN: 9.4 },
|
||||
ADCINA12 : { CMP_DIS: 5.1, CMP_EN: 10.1 },
|
||||
ADCINA14 : { CMP_DIS: 5.4 , CMP_EN: 10.4 },
|
||||
ADCINA15 : { CMP_DIS: 5.4 , CMP_EN: 10.4 },
|
||||
ADCINA16 : { CMP_DIS: 2.4 , CMP_EN: 4.9},
|
||||
ADCINA17 : { CMP_DIS: 2.7 , CMP_EN: 5.2},
|
||||
ADCINA18 : { CMP_DIS: 2.7 , CMP_EN: 5.2},
|
||||
ADCINA19 : { CMP_DIS: 2.7 , CMP_EN: 5.2},
|
||||
ADCINA20 : { CMP_DIS: 2.7 , CMP_EN: 5.2},
|
||||
ADCINC0 : { CMP_DIS: 4.4 , CMP_EN: 9.4 },
|
||||
ADCINC1 : { CMP_DIS: 5.1, CMP_EN: 10.1 },
|
||||
ADCINC2 : { CMP_DIS: 4.4 , CMP_EN: 9.4 },
|
||||
ADCINC3 : { CMP_DIS: 5.1, CMP_EN: 10.1 },
|
||||
ADCINC4 : { CMP_DIS: 5.4 , CMP_EN: 10.4 },
|
||||
ADCINC5 : { CMP_DIS: 1.8 , CMP_EN: 4.3 },
|
||||
ADCINC6 : { CMP_DIS: 3.1 , CMP_EN: 8.1 },
|
||||
ADCINC7 : { CMP_DIS: 5.4 , CMP_EN: 10.4 },
|
||||
ADCINC8 : { CMP_DIS: 4.3, CMP_EN: 9.3 },
|
||||
ADCINC9 : { CMP_DIS: 1.5 , CMP_EN: 4.0 },
|
||||
ADCINC10 : { CMP_DIS: 4.3, CMP_EN: 9.3 },
|
||||
ADCINC11 : { CMP_DIS: 2.2, CMP_EN: 4.7 },
|
||||
ADCINC14 : { CMP_DIS: 2.4 , CMP_EN: 4.9 },
|
||||
ADCINC15 : { CMP_DIS: 9.3 , CMP_EN: 14.3},
|
||||
ADCINC16 : { CMP_DIS: 2.4 , CMP_EN: 4.9},
|
||||
ADCINC17 : { CMP_DIS: 2.7 , CMP_EN: 5.2},
|
||||
ADCINC18 : { CMP_DIS: 2.7 , CMP_EN: 5.2},
|
||||
ADCINC19 : { CMP_DIS: 2.7 , CMP_EN: 5.2},
|
||||
ADCINC20 : { CMP_DIS: 2.7 , CMP_EN: 5.2},
|
||||
ADCINB3 : { CMP_DIS: 63 , CMP_EN: 65.5 },
|
||||
ADCINB5 : { CMP_DIS: 2.1 , CMP_EN: 4.6 },
|
||||
ADCINB11 : { CMP_DIS: 1.6 , CMP_EN: 4.1 },
|
||||
AGPIO_B5 : { CMP_DIS: 1 , CMP_EN: 3.5 },
|
||||
AGPIO_B11 : { CMP_DIS: 1 , CMP_EN: 3.5 },
|
||||
}
|
||||
|
||||
var Cp_F280015x = {
|
||||
ADCINA0 : { CMP_DIS: 9.3, CMP_EN: 14.3 },
|
||||
ADCINA1 : { CMP_DIS: 9.3, CMP_EN: 14.3 },
|
||||
ADCINA2 : { CMP_DIS: 1.5, CMP_EN: 4.0 },
|
||||
ADCINA3 : { CMP_DIS: 1.8, CMP_EN: 4.3 },
|
||||
ADCINA4 : { CMP_DIS: 2.4, CMP_EN: 4.9 },
|
||||
ADCINA5 : { CMP_DIS: 4.4, CMP_EN: 9.4 },
|
||||
ADCINA6 : { CMP_DIS: 3.1, CMP_EN: 8.1 },
|
||||
ADCINA7 : { CMP_DIS: 5.1, CMP_EN: 10.1 },
|
||||
ADCINA8 : { CMP_DIS: 2.2, CMP_EN: 4.7 },
|
||||
ADCINA9 : { CMP_DIS: 4.3, CMP_EN: 9.3 },
|
||||
ADCINA10 : { CMP_DIS: 4.3, CMP_EN: 9.3 },
|
||||
ADCINA11 : { CMP_DIS: 4.4 , CMP_EN: 9.4 },
|
||||
ADCINA12 : { CMP_DIS: 5.1, CMP_EN: 10.1 },
|
||||
ADCINA14 : { CMP_DIS: 5.4 , CMP_EN: 10.4 },
|
||||
ADCINA15 : { CMP_DIS: 5.4 , CMP_EN: 10.4 },
|
||||
ADCINA16 : { CMP_DIS: 2.4 , CMP_EN: 4.9},
|
||||
ADCINA17 : { CMP_DIS: 2.7 , CMP_EN: 5.2},
|
||||
ADCINA18 : { CMP_DIS: 2.7 , CMP_EN: 5.2},
|
||||
ADCINA19 : { CMP_DIS: 2.7 , CMP_EN: 5.2},
|
||||
ADCINA20 : { CMP_DIS: 2.7 , CMP_EN: 5.2},
|
||||
ADCINC0 : { CMP_DIS: 4.4 , CMP_EN: 9.4 },
|
||||
ADCINC1 : { CMP_DIS: 5.1, CMP_EN: 10.1 },
|
||||
ADCINC2 : { CMP_DIS: 4.4 , CMP_EN: 9.4 },
|
||||
ADCINC3 : { CMP_DIS: 5.1, CMP_EN: 10.1 },
|
||||
ADCINC4 : { CMP_DIS: 5.4 , CMP_EN: 10.4 },
|
||||
ADCINC5 : { CMP_DIS: 1.8 , CMP_EN: 4.3 },
|
||||
ADCINC6 : { CMP_DIS: 3.1 , CMP_EN: 8.1 },
|
||||
ADCINC7 : { CMP_DIS: 5.4 , CMP_EN: 10.4 },
|
||||
ADCINC8 : { CMP_DIS: 4.3, CMP_EN: 9.3 },
|
||||
ADCINC9 : { CMP_DIS: 1.5 , CMP_EN: 4.0 },
|
||||
ADCINC10 : { CMP_DIS: 4.3, CMP_EN: 9.3 },
|
||||
ADCINC11 : { CMP_DIS: 2.2, CMP_EN: 4.7 },
|
||||
ADCINC14 : { CMP_DIS: 2.4 , CMP_EN: 4.9 },
|
||||
ADCINC15 : { CMP_DIS: 9.3 , CMP_EN: 14.3},
|
||||
ADCINC16 : { CMP_DIS: 2.4 , CMP_EN: 4.9},
|
||||
ADCINC17 : { CMP_DIS: 2.7 , CMP_EN: 5.2},
|
||||
ADCINC18 : { CMP_DIS: 2.7 , CMP_EN: 5.2},
|
||||
ADCINC19 : { CMP_DIS: 2.7 , CMP_EN: 5.2},
|
||||
ADCINC20 : { CMP_DIS: 2.7 , CMP_EN: 5.2},
|
||||
ADCINB3 : { CMP_DIS: 63 , CMP_EN: 65.5 },
|
||||
ADCINB5 : { CMP_DIS: 2.1 , CMP_EN: 4.6 },
|
||||
ADCINB11 : { CMP_DIS: 1.6 , CMP_EN: 4.1 },
|
||||
AGPIO_B5 : { CMP_DIS: 1 , CMP_EN: 3.5 },
|
||||
AGPIO_B11 : { CMP_DIS: 1 , CMP_EN: 3.5 },
|
||||
}
|
||||
|
||||
var Cp_F28P55x = {
|
||||
ADCINA0 : { CMP_DIS: 9.1 , CMP_EN: 11.6 },
|
||||
ADCINA1 : { CMP_DIS: 7.4 , CMP_EN: 9.9 },
|
||||
ADCINA2 : { CMP_DIS: 4.1 , CMP_EN: 6.6 },
|
||||
ADCINA3 : { CMP_DIS: 3.3 , CMP_EN: 5.8 },
|
||||
ADCINA4 : { CMP_DIS: 3.8 , CMP_EN: 6.3 },
|
||||
ADCINA5 : { CMP_DIS: 3.5 , CMP_EN: 6 },
|
||||
ADCINA6 : { CMP_DIS: 3.2 , CMP_EN: 5.7 },
|
||||
ADCINA7 : { CMP_DIS: 3.8 , CMP_EN: 6.3 },
|
||||
ADCINA8 : { CMP_DIS: 4.1 , CMP_EN: 6.6 },
|
||||
ADCINA9 : { CMP_DIS: 3.1 , CMP_EN: 5.6 },
|
||||
ADCINA10 : { CMP_DIS: 4.7 , CMP_EN: 7.2 },
|
||||
ADCINA11 : { CMP_DIS: 4 , CMP_EN: 6.5 },
|
||||
ADCINA12 : { CMP_DIS: 3.4 , CMP_EN: 5.9 },
|
||||
ADCINA14 : { CMP_DIS: 3.8 , CMP_EN: 6.3 },
|
||||
ADCINA15 : { CMP_DIS: 3.8 , CMP_EN: 6.3 },
|
||||
ADCINC0 : { CMP_DIS: 4 , CMP_EN: 6.5 },
|
||||
ADCINC1 : { CMP_DIS: 3 , CMP_EN: 5.5 },
|
||||
ADCINC2 : { CMP_DIS: 3.6 , CMP_EN: 6.1 },
|
||||
ADCINC3 : { CMP_DIS: 3.8 , CMP_EN: 6.3 },
|
||||
ADCINC4 : { CMP_DIS: 3.8 , CMP_EN: 6.3 },
|
||||
ADCINC5 : { CMP_DIS: 3.6 , CMP_EN: 6.1 },
|
||||
ADCINC6 : { CMP_DIS: 3.9 , CMP_EN: 6.4 },
|
||||
ADCINC7 : { CMP_DIS: 3.3 , CMP_EN: 5.8 },
|
||||
ADCINC8 : { CMP_DIS: 3.8 , CMP_EN: 6.3 },
|
||||
ADCINC9 : { CMP_DIS: 4.1 , CMP_EN: 6.6 },
|
||||
ADCINC10 : { CMP_DIS: 4.7 , CMP_EN: 7.2 },
|
||||
ADCINC11 : { CMP_DIS: 4.1 , CMP_EN: 6.6 },
|
||||
ADCINC14 : { CMP_DIS: 4.2 , CMP_EN: 6.7 },
|
||||
ADCINC15 : { CMP_DIS: 9.1 , CMP_EN: 11.6 },
|
||||
ADCINB0 : { CMP_DIS: 4.1 , CMP_EN: 6.6 },
|
||||
ADCINB1 : { CMP_DIS: 4.7 , CMP_EN: 7.2 },
|
||||
ADCINB2 : { CMP_DIS: 3.9 , CMP_EN: 6.4 },
|
||||
ADCINB3 : { CMP_DIS: 75 , CMP_EN: 77.5 },
|
||||
ADCINB4 : { CMP_DIS: 3.8 , CMP_EN: 6.3 },
|
||||
ADCINB5 : { CMP_DIS: 3.5 , CMP_EN: 6 },
|
||||
ADCINB6 : { CMP_DIS: 4.1 , CMP_EN: 6.6 },
|
||||
ADCINB7 : { CMP_DIS: 7.4 , CMP_EN: 9.9 },
|
||||
ADCINB8 : { CMP_DIS: 3.8 , CMP_EN: 6.3 },
|
||||
ADCINB9 : { CMP_DIS: 3.3 , CMP_EN: 5.8 },
|
||||
ADCINB11 : { CMP_DIS: 4 , CMP_EN: 6.5 },
|
||||
ADCINB12 : { CMP_DIS: 3.6 , CMP_EN: 6.1 },
|
||||
ADCINB14 : { CMP_DIS: 3.8 , CMP_EN: 6.3 },
|
||||
ADCINB15 : { CMP_DIS: 9.1 , CMP_EN: 11.6 },
|
||||
AGPIO_B5 : { CMP_DIS: 3.2 , CMP_EN: 5.7 },
|
||||
AGPIO_B11 : { CMP_DIS: 3.1 , CMP_EN: 5.6 },
|
||||
}
|
||||
|
||||
var Cp_F28P65x = {
|
||||
ADCINA0 : { CMP_DIS: 9.3, CMP_EN: 14.3 },
|
||||
ADCINA1 : { CMP_DIS: 9.3, CMP_EN: 14.3 },
|
||||
ADCINA2 : { CMP_DIS: 1.5, CMP_EN: 4.0 },
|
||||
ADCINA3 : { CMP_DIS: 1.8, CMP_EN: 4.3 },
|
||||
ADCINA4 : { CMP_DIS: 2.4, CMP_EN: 4.9 },
|
||||
ADCINA5 : { CMP_DIS: 4.4, CMP_EN: 9.4 },
|
||||
ADCINA6 : { CMP_DIS: 3.1, CMP_EN: 8.1 },
|
||||
ADCINA7 : { CMP_DIS: 5.1, CMP_EN: 10.1 },
|
||||
ADCINA8 : { CMP_DIS: 2.2, CMP_EN: 4.7 },
|
||||
ADCINA9 : { CMP_DIS: 4.3, CMP_EN: 9.3 },
|
||||
ADCINA10 : { CMP_DIS: 4.3, CMP_EN: 9.3 },
|
||||
ADCINA11 : { CMP_DIS: 4.4 , CMP_EN: 9.4 },
|
||||
ADCINA12 : { CMP_DIS: 5.1, CMP_EN: 10.1 },
|
||||
ADCINA14 : { CMP_DIS: 5.4 , CMP_EN: 10.4 },
|
||||
ADCINA15 : { CMP_DIS: 5.4 , CMP_EN: 10.4 },
|
||||
ADCINA16 : { CMP_DIS: 2.4 , CMP_EN: 4.9},
|
||||
ADCINA17 : { CMP_DIS: 2.7 , CMP_EN: 5.2},
|
||||
ADCINA18 : { CMP_DIS: 2.7 , CMP_EN: 5.2},
|
||||
ADCINA19 : { CMP_DIS: 2.7 , CMP_EN: 5.2},
|
||||
ADCINA20 : { CMP_DIS: 2.7 , CMP_EN: 5.2},
|
||||
ADCINC0 : { CMP_DIS: 4.4 , CMP_EN: 9.4 },
|
||||
ADCINC1 : { CMP_DIS: 5.1, CMP_EN: 10.1 },
|
||||
ADCINC2 : { CMP_DIS: 4.4 , CMP_EN: 9.4 },
|
||||
ADCINC3 : { CMP_DIS: 5.1, CMP_EN: 10.1 },
|
||||
ADCINC4 : { CMP_DIS: 5.4 , CMP_EN: 10.4 },
|
||||
ADCINC5 : { CMP_DIS: 1.8 , CMP_EN: 4.3 },
|
||||
ADCINC6 : { CMP_DIS: 3.1 , CMP_EN: 8.1 },
|
||||
ADCINC7 : { CMP_DIS: 5.4 , CMP_EN: 10.4 },
|
||||
ADCINC8 : { CMP_DIS: 4.3, CMP_EN: 9.3 },
|
||||
ADCINC9 : { CMP_DIS: 1.5 , CMP_EN: 4.0 },
|
||||
ADCINC10 : { CMP_DIS: 4.3, CMP_EN: 9.3 },
|
||||
ADCINC11 : { CMP_DIS: 2.2, CMP_EN: 4.7 },
|
||||
ADCINC14 : { CMP_DIS: 2.4 , CMP_EN: 4.9 },
|
||||
ADCINC15 : { CMP_DIS: 9.3 , CMP_EN: 14.3},
|
||||
ADCINC16 : { CMP_DIS: 2.4 , CMP_EN: 4.9},
|
||||
ADCINC17 : { CMP_DIS: 2.7 , CMP_EN: 5.2},
|
||||
ADCINC18 : { CMP_DIS: 2.7 , CMP_EN: 5.2},
|
||||
ADCINC19 : { CMP_DIS: 2.7 , CMP_EN: 5.2},
|
||||
ADCINC20 : { CMP_DIS: 2.7 , CMP_EN: 5.2},
|
||||
ADCINB3 : { CMP_DIS: 63 , CMP_EN: 65.5 },
|
||||
ADCINB5 : { CMP_DIS: 2.1 , CMP_EN: 4.6 },
|
||||
ADCINB11 : { CMP_DIS: 1.6 , CMP_EN: 4.1 },
|
||||
AGPIO_B5 : { CMP_DIS: 1 , CMP_EN: 3.5 },
|
||||
AGPIO_B11 : { CMP_DIS: 1 , CMP_EN: 3.5 },
|
||||
}
|
||||
|
||||
var Cp = {
|
||||
F28P65x: Cp_F28P65x,
|
||||
F28P55x: Cp_F28P55x,
|
||||
F280015x: Cp_F280015x,
|
||||
F280013x: Cp_F280013x,
|
||||
F28003x: Cp_F28003x,
|
||||
F28002x: Cp_F28002x,
|
||||
F2838x : Cp_F2838x,
|
||||
F28004x: Cp_F28004x,
|
||||
F2837xD: Cp_F2837xD,
|
||||
F2837xS: Cp_F2837xS,
|
||||
F2807x: Cp_F2807x
|
||||
}
|
||||
|
||||
var Ron = {
|
||||
F28P65x:{ REF_3V3: 860, REF: 500},
|
||||
F28P55x:{ REF_3V3: 860, REF: 500},
|
||||
F280015x:{ REF_3V3: 860, REF: 500},
|
||||
F280013x:{ REF_3V3: 860, REF: 500},
|
||||
F28003x: { REF_3V3: 860, REF: 500},
|
||||
F28002x: { REF_3V3: 860, REF: 500},
|
||||
F2838x : { REF_3V3: 700, REF: 700},
|
||||
F28004x: { REF_3V3: 860, REF: 500},
|
||||
F2837xD: { REF_3V3: 425, REF: 425},
|
||||
F2837xS: { REF_3V3: 425, REF: 425},
|
||||
F2807x: { REF_3V3: 600, REF: 600},
|
||||
}
|
||||
|
||||
var Ch = {
|
||||
F28P65x:{ REF_3V3: 7.5, REF: 12.5},
|
||||
F28P55x:{ REF_3V3: 7.5, REF: 12.5},
|
||||
F280015x:{ REF_3V3: 7.5, REF: 12.5},
|
||||
F280013x:{ REF_3V3: 7.5, REF: 12.5},
|
||||
F28003x: { REF_3V3: 7.5, REF: 12.5},
|
||||
F28002x: { REF_3V3: 7.5, REF: 12.5},
|
||||
F2838x : { REF_3V3: 16.5, REF: 16.5},
|
||||
F28004x: { REF_3V3: 7.5, REF: 12.5},
|
||||
F2837xD: { REF_3V3: 14.5, REF: 14.5},
|
||||
F2837xS: { REF_3V3: 14.5, REF: 14.5},
|
||||
F2807x: { REF_3V3: 16.5, REF: 16.5},
|
||||
}
|
||||
|
||||
exports = {
|
||||
Ch: Ch,
|
||||
Ron: Ron,
|
||||
Cp: Cp,
|
||||
tEOC_12bit_SYSCLK,
|
||||
tEOC_16bit_SYSCLK
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
/* Stucture for ADC Internal Connections with VREFLO*/
|
||||
// TODO: Verify if need to add individual package support
|
||||
let ADC_internalSignals = {
|
||||
F28002x: {
|
||||
A13: "VREFLO",
|
||||
C12: "TempSensor",
|
||||
C13: "VREFLO",
|
||||
},
|
||||
F28003x: {
|
||||
A13: "VREFLO",
|
||||
B13: "VREFLO",
|
||||
C12: "TempSensor",
|
||||
C13: "VREFLO",
|
||||
},
|
||||
F280013x: {
|
||||
A13: "VREFLO",
|
||||
C12: "TempSensor",
|
||||
C13: "VREFLO",
|
||||
},
|
||||
F280015x: {
|
||||
A13: "VREFLO",
|
||||
C12: "TempSensor",
|
||||
C13: "VREFLO",
|
||||
},
|
||||
F28004x: {
|
||||
A13: "VREFLOA",
|
||||
B13: "VREFLOB",
|
||||
B14: "TempSensor",
|
||||
C13: "VREFLOC",
|
||||
},
|
||||
F2838x: {
|
||||
A8: "VREFLOA",
|
||||
A9: "VREFLOA",
|
||||
A13: "TempSensor",
|
||||
B8: "VREFLOB",
|
||||
B9: "VREFLOB",
|
||||
C8: "VREFLOC",
|
||||
C9: "VREFLOC",
|
||||
D8: "VREFLOD",
|
||||
D9: "VREFLOD",
|
||||
},
|
||||
F2837xD: {
|
||||
A8: "VREFLOA",
|
||||
A9: "VREFLOA",
|
||||
A13: "TempSensor",
|
||||
B8: "VREFLOB",
|
||||
B9: "VREFLOB",
|
||||
C8: "VREFLOC",
|
||||
C9: "VREFLOC",
|
||||
D8: "VREFLOD",
|
||||
D9: "VREFLOD",
|
||||
},
|
||||
F2837xS: {
|
||||
A8: "VREFLOA",
|
||||
A9: "VREFLOA",
|
||||
A13: "TempSensor",
|
||||
B8: "VREFLOB",
|
||||
B9: "VREFLOB",
|
||||
C8: "VREFLOC",
|
||||
C9: "VREFLOC",
|
||||
D8: "VREFLOD",
|
||||
D9: "VREFLOD",
|
||||
},
|
||||
F2807x: {
|
||||
A8: "VREFLOA",
|
||||
A9: "VREFLOA",
|
||||
A13: "TempSensor",
|
||||
B8: "VREFLOB",
|
||||
B9: "VREFLOB",
|
||||
D8: "VREFLOD",
|
||||
D9: "VREFLOD",
|
||||
},
|
||||
F28P65x: {
|
||||
A18: "VREFLOA",
|
||||
C18: "VREFLOA",
|
||||
A13: "TempSensor",
|
||||
A19: "VREFLOB",
|
||||
C19: "VREFLOB",
|
||||
A20: "VREFLOC",
|
||||
C20: "VREFLOC",
|
||||
},
|
||||
F28P55x: {
|
||||
A13: "VREFLO",
|
||||
B13: "VREFLO",
|
||||
C12: "TempSensor",
|
||||
C13: "VREFLO",
|
||||
D13: "VREFLO",
|
||||
E13: "VREFLO",
|
||||
}
|
||||
}
|
||||
|
||||
exports = {
|
||||
ADC_internalSignals: ADC_internalSignals,
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
% var nameOfModule = "adcsafetychecker";
|
||||
% var module = system.modules['/driverlib/' + nameOfModule + '.js'];
|
||||
% let Common = system.getScript("/driverlib/Common.js");
|
||||
% var nameOfPeripheral = module.peripheralName;
|
||||
%
|
||||
% let tileModule = system.modules['/driverlib/adc/modules/adcsafetycheckertile.js'];
|
||||
% let aggrModule = system.modules['/driverlib/adc/modules/adcsafetycheckeraggr.js'];
|
||||
%
|
||||
% let device_driverlib_peripheral = system.getScript("/driverlib/device_driverlib_peripherals/" + Common.getDeviceName().toLowerCase() + "_adc.js");
|
||||
% let device_driverlib_memmap =system.getScript("/driverlib/device_driverlib_peripherals/" + Common.getDeviceName().toLowerCase() + "_memmap.js");
|
||||
void `nameOfPeripheral`_init(){
|
||||
%if (tileModule != null)
|
||||
%{
|
||||
% for(var i = 0; i < tileModule.$instances.length; i++) {
|
||||
% var instance = tileModule.$instances[i];
|
||||
% var baseName = instance.$name + "_BASE";
|
||||
`instance.$name`_init();
|
||||
% }
|
||||
%}
|
||||
|
||||
%if (aggrModule != null)
|
||||
%{
|
||||
% for(var i = 0; i < aggrModule.$instances.length; i++) {
|
||||
% var instance = aggrModule.$instances[i];
|
||||
% var baseName = instance.$name + "_BASE";
|
||||
`instance.$name`_init();
|
||||
% }
|
||||
% }
|
||||
}
|
||||
|
||||
%if (tileModule != null)
|
||||
%{
|
||||
% for(var i = 0; i < tileModule.$instances.length; i++) {
|
||||
% var instance = tileModule.$instances[i];
|
||||
% var baseName = instance.$name + "_BASE";
|
||||
|
||||
void `instance.$name`_init(){
|
||||
% for(var rptrIndex in device_driverlib_peripheral.ADC_SafetyCheckInst){
|
||||
% var currentRPTR = device_driverlib_peripheral.ADC_SafetyCheckInst[rptrIndex].name
|
||||
% var rptrNumber = (currentRPTR).replace(/[^0-9]/g,'');
|
||||
% var socName = "ADC_SOC_NUMBER"+(instance["safetycheck"+rptrNumber+"usedSOC"]).replace(/[^0-9]/g,'') ;
|
||||
//
|
||||
// Configures the safety checker result for a selected SOC.
|
||||
// adcBase : `instance["safetycheck"+rptrNumber+"ADC"].replace("_","")`_BASE
|
||||
// socNumber : `instance["safetycheck"+rptrNumber+"usedSOC"]`
|
||||
// scInput : `instance["safetycheck"+rptrNumber+"inputSource"]`
|
||||
ADC_configSOCSafetyCheckerInput(`instance["safetycheck"+rptrNumber+"ADC"].replace("_","")`_BASE,`instance["safetycheck"+rptrNumber+"ResultSelect"].replace("ADC_RESULT","ADC_SOC_NUMBER")`,`instance["safetycheck"+rptrNumber+"inputSource"]`);
|
||||
//
|
||||
// Configures the safety checker module.
|
||||
// scBase : `baseName`
|
||||
// SafetyCheckerInstant : `rptrNumber`
|
||||
// ADCInstant : `instance["safetycheck"+rptrNumber+"ADC"]`
|
||||
// adcResultInst : `instance["safetycheck"+rptrNumber+"ResultSelect"]`
|
||||
ADC_configureSafetyChecker(`baseName`, ADC_SAFETY_CHECK`rptrNumber`,`instance["safetycheck"+rptrNumber+"ADC"]`,`instance["safetycheck"+rptrNumber+"ResultSelect"]`);
|
||||
% }
|
||||
//
|
||||
// Configures the tolerance allowed between safety check results.
|
||||
// scBase : `baseName`
|
||||
// tolerance : `instance["safetyCheckTolerance"]`
|
||||
ADC_setSafetyCheckerTolerance(`baseName`,`instance["safetyCheckTolerance"]`);
|
||||
% if(instance.enableSafetychecker){
|
||||
//
|
||||
// Enables the ADC result safety checker module.
|
||||
//
|
||||
ADC_enableSafetyChecker(`baseName`);
|
||||
% }
|
||||
% else{
|
||||
//
|
||||
// Disables the ADC result safety checker module.
|
||||
//
|
||||
ADC_disableSafetyChecker(`baseName`);
|
||||
% }
|
||||
}
|
||||
% }
|
||||
% }
|
||||
|
||||
%if (aggrModule != null)
|
||||
%{
|
||||
% for(var i = 0; i < aggrModule.$instances.length; i++) {
|
||||
% var instance = aggrModule.$instances[i];
|
||||
% var baseName = instance.$name + "_BASE";
|
||||
void `instance.$name`_init(){
|
||||
% for (var sftychkr in device_driverlib_memmap.ADCSAFETYCHKMemoryMap) {
|
||||
% for (var chkrslt in device_driverlib_peripheral.ADC_SafetyCheckResult){
|
||||
% var currentchkrslt= device_driverlib_memmap.ADCSAFETYCHKMemoryMap[sftychkr].name.replace("_BASE","").replace("ADC","");
|
||||
% var currentsftychkr = device_driverlib_peripheral.ADC_SafetyCheckResult[chkrslt].name.replace("ADC_SAFETY_CHECK_","");
|
||||
% var chkrNumber = currentchkrslt.replace(/[^0-9]/g,'');
|
||||
% var chkrResult = device_driverlib_peripheral.ADC_SafetyCheckResult[chkrslt].name;
|
||||
% if (instance.enableInterrupt) {
|
||||
% if((instance.eventInterruptSource).includes(currentchkrslt + currentsftychkr)){
|
||||
//
|
||||
// Enable Safety Checker `chkrNumber` `currentsftychkr` interrupt
|
||||
//
|
||||
ADC_enableSafetyCheckInt(`baseName`, ADC_SAFETY_CHECKER`chkrNumber`, `chkrResult`);
|
||||
% }
|
||||
% }
|
||||
% }
|
||||
% }
|
||||
|
||||
|
||||
% for(var evntIndex in device_driverlib_peripheral.ADC_SafetyCheckEvent){
|
||||
% var currentEvnt = device_driverlib_peripheral.ADC_SafetyCheckEvent[evntIndex].name
|
||||
% var evntNumber = (currentEvnt).replace(/[^0-9]/g,'')
|
||||
% if((instance.enableEvent).includes(currentEvnt)){
|
||||
% for (var sftychkr in device_driverlib_memmap.ADCSAFETYCHKMemoryMap) {
|
||||
% for (var chkrslt in device_driverlib_peripheral.ADC_SafetyCheckResult){
|
||||
% var currentchkrslt= device_driverlib_memmap.ADCSAFETYCHKMemoryMap[sftychkr].name.replace("_BASE","").replace("ADC","");
|
||||
% var currentsftychkr = device_driverlib_peripheral.ADC_SafetyCheckResult[chkrslt].name.replace("ADC_SAFETY_CHECK_","");
|
||||
% var chkrNumber = currentchkrslt.replace(/[^0-9]/g,'');
|
||||
% var chkrResult = device_driverlib_peripheral.ADC_SafetyCheckResult[chkrslt].name;
|
||||
% if((instance["chkEvent" + evntNumber + "Source"]).includes(currentchkrslt + currentsftychkr)){
|
||||
//
|
||||
// Enable Safety Checker `chkrNumber` `currentsftychkr` event `evntNumber`
|
||||
//
|
||||
ADC_enableSafetyCheckEvt(`baseName`, ADC_SAFETY_CHECKER`chkrNumber`, ADC_SAFETY_CHECK_EVENT`evntNumber`, `chkrResult`);
|
||||
% }
|
||||
% }
|
||||
% }
|
||||
% }
|
||||
% }
|
||||
|
||||
}
|
||||
% }
|
||||
% }
|
||||
@@ -0,0 +1,26 @@
|
||||
% var nameOfModule = "adcsafetychecker";
|
||||
% var module = system.modules['/driverlib/' + nameOfModule + '.js'];
|
||||
% let Common = system.getScript("/driverlib/Common.js");
|
||||
% let tileModule = system.modules['/driverlib/adc/modules/adcsafetycheckertile.js'];
|
||||
% let aggrModule = system.modules['/driverlib/adc/modules/adcsafetycheckeraggr.js'];
|
||||
%if (tileModule != null)
|
||||
%{
|
||||
//*****************************************************************************
|
||||
//
|
||||
// ADC Safety Checker Configurations
|
||||
//
|
||||
//*****************************************************************************
|
||||
% for(var i = 0; i < tileModule.$instances.length; i++) {
|
||||
% var instance = tileModule.$instances[i];
|
||||
#define `instance.$name`_BASE `instance.adcscBase`
|
||||
void `instance.$name`_init();
|
||||
% }
|
||||
%}
|
||||
%if (aggrModule != null)
|
||||
%{
|
||||
% for(var i = 0; i < aggrModule.$instances.length; i++) {
|
||||
% var instance = aggrModule.$instances[i];
|
||||
#define `instance.$name`_BASE `instance.adcIntEvtBase`
|
||||
void `instance.$name`_init();
|
||||
% }
|
||||
%}
|
||||
|
After Width: | Height: | Size: 33 KiB |
|
After Width: | Height: | Size: 33 KiB |
|
After Width: | Height: | Size: 4.4 KiB |
|
After Width: | Height: | Size: 35 KiB |
|
After Width: | Height: | Size: 50 KiB |
|
After Width: | Height: | Size: 49 KiB |
|
After Width: | Height: | Size: 8.6 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
@@ -0,0 +1,219 @@
|
||||
let Common = system.getScript("/driverlib/Common.js");
|
||||
let device_driverlib_peripheral =
|
||||
system.getScript("/driverlib/device_driverlib_peripherals/" +
|
||||
Common.getDeviceName().toLowerCase() + "_adc.js");
|
||||
|
||||
let device_driverlib_memmap =
|
||||
system.getScript("/driverlib/device_driverlib_peripherals/" +
|
||||
Common.getDeviceName().toLowerCase() + "_memmap.js");
|
||||
|
||||
var ADC_SFTYCH_SOURCE =[];
|
||||
|
||||
var ADCINTEVT_INSTANCE =[];
|
||||
|
||||
if (["F28P65x"].includes(Common.getDeviceName()))
|
||||
{
|
||||
for (var sftychkr in device_driverlib_memmap.ADCSAFETYINTEVTAGGMemoryMap)
|
||||
{
|
||||
ADCINTEVT_INSTANCE.push(
|
||||
{ name: device_driverlib_memmap.ADCSAFETYINTEVTAGGMemoryMap[sftychkr].name,
|
||||
displayName: device_driverlib_memmap.ADCSAFETYINTEVTAGGMemoryMap[sftychkr].name.replace("_BASE","")
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
var maxInstances = ADCINTEVT_INSTANCE.length
|
||||
|
||||
if (["F28P65x"].includes(Common.getDeviceName()))
|
||||
{
|
||||
for (var sftychkr in device_driverlib_memmap.ADCSAFETYCHKMemoryMap)
|
||||
{
|
||||
for (var chkrslt in device_driverlib_peripheral.ADC_SafetyCheckResult)
|
||||
{
|
||||
var currentchkrslt= device_driverlib_memmap.ADCSAFETYCHKMemoryMap[sftychkr].name.replace("_BASE","").replace("ADC","")
|
||||
var currentsftychkr = device_driverlib_peripheral.ADC_SafetyCheckResult[chkrslt].name.replace("ADC_SAFETY_CHECK_","")
|
||||
|
||||
ADC_SFTYCH_SOURCE.push(
|
||||
{ name: device_driverlib_memmap.ADCSAFETYCHKMemoryMap[sftychkr].name.replace("_BASE","").replace("ADC","") + device_driverlib_peripheral.ADC_SafetyCheckResult[chkrslt].name.replace("ADC_SAFETY_CHECK_",""),
|
||||
displayName: device_driverlib_memmap.ADCSAFETYCHKMemoryMap[sftychkr].name.replace("_BASE","").replace("ADCSAFETYCHK","SAFETY_CHECK") + " "+ device_driverlib_peripheral.ADC_SafetyCheckResult[chkrslt].name.replace("ADC_SAFETY_CHECK_","")
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function onChangeSafetyCheckerEVNTs(inst, ui){
|
||||
for(var evntIndex in device_driverlib_peripheral.ADC_SafetyCheckEvent)
|
||||
{
|
||||
var currentEvnt = device_driverlib_peripheral.ADC_SafetyCheckEvent[evntIndex].name
|
||||
var evnti = (currentEvnt).replace(/[^0-9]/g,'')
|
||||
var sftyEVNTConfigs =
|
||||
[
|
||||
"chkEvent" + evnti.toString() + "Source",
|
||||
]
|
||||
|
||||
if (ui)
|
||||
{
|
||||
for (var sftyConfig of sftyEVNTConfigs)
|
||||
{
|
||||
if(inst["enableEvent"].includes(currentEvnt))
|
||||
{
|
||||
ui[sftyConfig].hidden = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
ui[sftyConfig].hidden = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function onChangeSafetyCheckerINTs(inst, ui) {
|
||||
if (ui) {
|
||||
if((inst.enableInterrupt)) {
|
||||
ui["eventInterruptSource"].hidden = false;
|
||||
}
|
||||
else {
|
||||
ui["eventInterruptSource"].hidden = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var config = [
|
||||
{
|
||||
name : "adcIntEvtBase",
|
||||
displayName : "ADC INTEVT Instance",
|
||||
description : 'Instance of the ADC used.',
|
||||
hidden : false,
|
||||
default : ADCINTEVT_INSTANCE[0].name,
|
||||
options : ADCINTEVT_INSTANCE,
|
||||
},
|
||||
{
|
||||
name : "enableInterrupt",
|
||||
displayName : "Enable Interrupt",
|
||||
description : 'Each ADC result safety checker tile can generate an interrupt signal from out-of-tolerance (OOT) flag and result overflow flags OVF1 and OVF2',
|
||||
longDescription : 'Each ADC result safety checker tile generates an interrupt pulse when an enabled out-of-tolerance (OOT) or overflow OVF1 or OVF2 event occurs. No further interrupt pulses will be generated until the interrupt flag is cleared.',
|
||||
hidden : false,
|
||||
default : false,
|
||||
onChange : onChangeSafetyCheckerINTs,
|
||||
},
|
||||
{
|
||||
name : "eventInterruptSource",
|
||||
displayName : "Select source for interrupt",
|
||||
description : 'Each ADC result safety checker tile can generate an interrupt signal from out-of-tolerance (OOT) flag and result overflow flags OVF1 and OVF2',
|
||||
hidden : true,
|
||||
minSelections : 0,
|
||||
default : [],
|
||||
options : ADC_SFTYCH_SOURCE,
|
||||
onChange : onChangeSafetyCheckerINTs,
|
||||
},
|
||||
{
|
||||
name : "enableEvent",
|
||||
displayName : "Enable Event",
|
||||
description : 'safety checker tiles can generate events that can be sent to the X-BAR, so that automatic hardware actions such as an ePWM trip can be generated',
|
||||
longDescription : '',
|
||||
hidden : false,
|
||||
minSelections : 0,
|
||||
default : [],
|
||||
options :device_driverlib_peripheral.ADC_SafetyCheckEvent,
|
||||
onChange : onChangeSafetyCheckerEVNTs,
|
||||
},
|
||||
|
||||
];
|
||||
|
||||
for(var evntIndex in device_driverlib_peripheral.ADC_SafetyCheckEvent)
|
||||
{
|
||||
var currentEvnt = device_driverlib_peripheral.ADC_SafetyCheckEvent[evntIndex].name
|
||||
var evnti = (currentEvnt).replace(/[^0-9]/g,'')
|
||||
var sfty_Configs = [
|
||||
{
|
||||
name: "chkEvent" + evnti.toString() + "Source",
|
||||
displayName : "Select Source",
|
||||
description : 'Select Source for this event',
|
||||
hidden : true,
|
||||
minSelections : 0,
|
||||
default : [],
|
||||
options : ADC_SFTYCH_SOURCE,
|
||||
},
|
||||
|
||||
]
|
||||
config = config.concat ([{
|
||||
name: "GROUP_EVENT" +evnti.toString(),
|
||||
displayName: "Safety Check Event " + evnti.toString(),
|
||||
description: "",
|
||||
longDescription: "",
|
||||
config: sfty_Configs
|
||||
}])
|
||||
}
|
||||
|
||||
function onValidate(inst, validation) {
|
||||
//
|
||||
// Check duplicate sources
|
||||
//
|
||||
var usedADCSCInsts = [];
|
||||
for (var instance_index in inst.$module.$instances)
|
||||
{
|
||||
var instance_obj = inst.$module.$instances[instance_index];
|
||||
usedADCSCInsts.push(instance_obj.adcIntEvtBase);
|
||||
}
|
||||
|
||||
var otherContexts = Common.getOtherContextNames()
|
||||
for (var cntx of otherContexts)
|
||||
{
|
||||
var onOtherCntx = Common.getModuleForCore(inst.$module.$name, cntx);
|
||||
if (onOtherCntx)
|
||||
{
|
||||
for (var instance_index in onOtherCntx.$instances)
|
||||
{
|
||||
var instance_obj = onOtherCntx.$instances[instance_index];
|
||||
usedADCSCInsts.push(instance_obj.adcIntEvtBase);
|
||||
}
|
||||
}
|
||||
}
|
||||
var duplicatesResult = Common.findDuplicates(usedADCSCInsts)
|
||||
|
||||
if (duplicatesResult.duplicates.length != 0)
|
||||
{
|
||||
var allDuplicates = "";
|
||||
for (var duplicateNamesIndex in duplicatesResult.duplicates)
|
||||
{
|
||||
allDuplicates = allDuplicates + Common.stringOrEmpty(allDuplicates, ", ")
|
||||
+ duplicatesResult.duplicates[duplicateNamesIndex];
|
||||
}
|
||||
validation.logError(
|
||||
"The ADC Safety Checker Aggregator Instance used. Duplicates: " + allDuplicates,
|
||||
inst, "adcIntEvtBase");
|
||||
}
|
||||
|
||||
if (Common.isContextCPU1()) {
|
||||
if (inst["adcIntEvtBase"] == "ADCSAFETYINTEVTAGG2_BASE"){
|
||||
validation.logError(
|
||||
"ADC Safety INTEVT Aggregator 2 instance can not be used for CPU1", inst, "adcIntEvtBase");
|
||||
}
|
||||
}
|
||||
if (Common.isContextCPU2()) {
|
||||
if (inst["adcIntEvtBase"] == "ADCSAFETYINTEVTAGG1_BASE"){
|
||||
validation.logError(
|
||||
"ADC Safety INTEVT Aggregator 1 instance can not be used for CPU2", inst, "adcIntEvtBase");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var adcSCSubmodule = {
|
||||
//peripheralName: "ADCSafetyCheckerINTEVT",
|
||||
displayName: "ADC SAFETY CHECKER INTEVT",
|
||||
defaultInstanceName: "myADCSAFETYCHECKERAGGR",
|
||||
description: "ADC Safety Checker Interrupt Event Aggregator",
|
||||
maxInstances: maxInstances,
|
||||
config: config,
|
||||
validate: onValidate,
|
||||
templates: {
|
||||
// boardc : "",
|
||||
// boardh : ""
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
exports = adcSCSubmodule;
|
||||
@@ -0,0 +1,758 @@
|
||||
let Common = system.getScript("/driverlib/Common.js");
|
||||
let device_driverlib_peripheral =
|
||||
system.getScript("/driverlib/device_driverlib_peripherals/" +
|
||||
Common.getDeviceName().toLowerCase() + "_adc.js");
|
||||
let device_driverlib_memmap =
|
||||
system.getScript("/driverlib/device_driverlib_peripherals/" +
|
||||
Common.getDeviceName().toLowerCase() + "_memmap.js");
|
||||
|
||||
|
||||
var ADCSC_INSTANCE =[];
|
||||
|
||||
if (["F28P65x"].includes(Common.getDeviceName()))
|
||||
{
|
||||
for (var sftychkr in device_driverlib_memmap.ADCSAFETYCHKMemoryMap)
|
||||
{
|
||||
ADCSC_INSTANCE.push(
|
||||
{ name: device_driverlib_memmap.ADCSAFETYCHKMemoryMap[sftychkr].name,
|
||||
displayName: device_driverlib_memmap.ADCSAFETYCHKMemoryMap[sftychkr].name.replace("_BASE","")
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
var maxInstances = ADCSC_INSTANCE.length
|
||||
|
||||
|
||||
|
||||
var longDescriptionsafetychecker = `
|
||||
For safety-critical applications, this device provides the ability to automatically compare ADC conversion results from multiple ADC modules against each other for consistency.
|
||||
Each ADC checker tile captures conversion results from the associated ADCs
|
||||
as soon as the conversions are complete, and compares the absolute value of the difference to the configured
|
||||
tolerance. If the computed delta is out of range, the checker can generate a trip event signal that is sent to
|
||||
an ePWM or output crossbar, and can also trigger an CPU interrupt. The structure and
|
||||
operation of an ADC result safety checker tile are demonstrated in the figure:
|
||||

|
||||
|
||||
To configure an ADC result safety checker tile:
|
||||
1) Select the first ADC instance to test. Then, in the Input field, select the source of the result, which can be any one of the SOCs, PPB modules or PPB sums. The result value should be given in the Selected Result field.
|
||||
2) Select the second ADC instance to test. Then, in the Input field, select the source of the result, which can be any one of the SOCs, PPB modules or PPB sums. The result value should be given in the Selected Result field.
|
||||
3) Configure the checker tolerance by assigning the value to Tolerance field.
|
||||
4) Enable the checker tile by selecting Enable Safety Checker
|
||||
`
|
||||
var longDescriptionsafetycheckertolerance = `
|
||||
Each ADC result safety checker tile can be configured to automatically compare two ADC conversion results
|
||||
against a set tolerance value, and generate an interrupt if an out-of-tolerance (OOT) event occurs. The selected
|
||||
results can be from the same ADC instance, or from different ADCs.
|
||||
`
|
||||
/* Array of ADC configurables that are common across device families */
|
||||
let config = [
|
||||
{
|
||||
name : "adcscBase",
|
||||
displayName : "ADC Safety Checker Instance",
|
||||
longDescription : longDescriptionsafetychecker,
|
||||
hidden : false,
|
||||
default : ADCSC_INSTANCE[0].name,
|
||||
options : ADCSC_INSTANCE,
|
||||
|
||||
},
|
||||
{
|
||||
name : "safetyCheckTolerance",
|
||||
displayName : "Tolerance [LSB]",
|
||||
description : 'Select tolerance in LSB for the difference between check result instancese',
|
||||
longDescription : longDescriptionsafetycheckertolerance,
|
||||
hidden : false,
|
||||
default : 0,
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
function onChangesafetychecker(inst, ui)
|
||||
{
|
||||
for(var rptrIndex in device_driverlib_peripheral.ADC_SafetyCheckInst)
|
||||
{
|
||||
var currentRPTR = device_driverlib_peripheral.ADC_SafetyCheckInst[rptrIndex].name
|
||||
var rptri = (currentRPTR).replace(/[^0-9]/g,'')
|
||||
var selectedsources=
|
||||
[
|
||||
"safetycheck"+ rptri.toString()+"usedSOC",
|
||||
// "safetycheck"+ rptri.toString()+"usedPPB",
|
||||
// "safetycheck"+ rptri.toString()+"usedPPBSUM",
|
||||
];
|
||||
if (ui)
|
||||
{
|
||||
for (var selectedsource of selectedsources)
|
||||
{
|
||||
if ((inst["safetycheck"+ rptri.toString()+"inputSource"] != "ADC_SAFETY_CHECKER_INPUT_DISABLE"))
|
||||
{
|
||||
ui["safetycheck"+ rptri.toString()+"usedSOC"].hidden = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
ui["safetycheck"+ rptri.toString()+"usedSOC"].hidden = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (["F28P65x"].includes(Common.getDeviceName())) {
|
||||
for (var rptrIndex in device_driverlib_peripheral.ADC_SafetyCheckInst) {
|
||||
var currentRPTR = device_driverlib_peripheral.ADC_SafetyCheckInst[rptrIndex].name
|
||||
let rptri = (currentRPTR).replace(/[^0-9]/g,'')
|
||||
config= config.concat ([
|
||||
{
|
||||
name:"safetychecker"+ rptri.toString(),
|
||||
displayName: "Selector "+ rptri.toString() + " Configurations",
|
||||
longDescription: "",
|
||||
collapsed: true,
|
||||
config:
|
||||
[
|
||||
|
||||
{
|
||||
name: "safetycheck"+ rptri.toString()+"ADC",
|
||||
displayName : "ADC Instance",
|
||||
description : 'Select the ADC for this safety checker module',
|
||||
default : device_driverlib_peripheral.ADC_Select[0].name,
|
||||
options : device_driverlib_peripheral.ADC_Select,
|
||||
},
|
||||
{
|
||||
name: "safetycheck"+ rptri.toString()+"inputSource",
|
||||
displayName: "Input Source",
|
||||
hidden : false,
|
||||
default : device_driverlib_peripheral.ADC_SafetyCheckerInput[0].name,
|
||||
options : device_driverlib_peripheral.ADC_SafetyCheckerInput,
|
||||
onChange : onChangesafetychecker,
|
||||
},
|
||||
{
|
||||
name: "safetycheck"+ rptri.toString()+"ResultSelect",
|
||||
displayName : "Result to Compare",
|
||||
description : 'Select the result for the safety checker module',
|
||||
default : device_driverlib_peripheral.ADC_ResultSelect[0].name,
|
||||
options : device_driverlib_peripheral.ADC_ResultSelect
|
||||
},
|
||||
{
|
||||
name: "safetycheck"+ rptri.toString()+"usedSOC",
|
||||
displayName : "Selected Source",
|
||||
description : 'Selected SOCs for Selector '+ rptri.toString(),
|
||||
hidden : true,
|
||||
default :"",
|
||||
getValue : (inst) =>{
|
||||
let adc = system.modules["/driverlib/adc.js"];
|
||||
var selectedsource= "";
|
||||
if (adc!=null)
|
||||
{
|
||||
for ( var adc_inst of adc.$instances)
|
||||
{
|
||||
if (adc_inst.adcBase.replace("_BASE","").replace("ADC","") ==
|
||||
inst["safetycheck"+ rptri.toString()+"ADC"].replace("ADC_","") )
|
||||
for(var socIndex in device_driverlib_peripheral.ADC_SOCNumber)
|
||||
{
|
||||
var currentSOC = device_driverlib_peripheral.ADC_SOCNumber[socIndex].name
|
||||
var soci = (currentSOC).replace(/[^0-9]/g,'')
|
||||
var resi= inst["safetycheck"+ rptri.toString()+"ResultSelect"].replace(/[^0-9]/g,'')
|
||||
//return adc_inst.enabledSOCs.toString().replace("ADC_","").replace("_NUMBER"," number ").replace("SOC","SOC/EOC")
|
||||
// if((adc_inst.enabledPPBs).includes(currentPPB)){
|
||||
if((adc_inst.enabledSOCs).includes(currentSOC) && (inst["safetycheck"+ rptri.toString()+"inputSource"]=="ADC_SAFETY_CHECKER_INPUT_SOCx"))
|
||||
{
|
||||
if (resi==soci)
|
||||
{
|
||||
selectedsource= "SOC"+soci.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(var ppbIndex in device_driverlib_peripheral.ADC_PPBNumber)
|
||||
{
|
||||
var currentPPB = device_driverlib_peripheral.ADC_PPBNumber[ppbIndex].name
|
||||
var ppbi = (currentPPB).replace(/[^0-9]/g,'')
|
||||
var resi= inst["safetycheck"+ rptri.toString()+"ResultSelect"].replace(/[^0-9]/g,'')
|
||||
var highPPB = "";
|
||||
if((adc_inst.enabledPPBs).includes(currentPPB) && ((inst["safetycheck"+ rptri.toString()+"inputSource"]=="ADC_SAFETY_CHECKER_INPUT_PPBx")||(inst["safetycheck"+ rptri.toString()+"inputSource"]=="ADC_SAFETY_CHECKER_INPUT_PPBSUMx")))
|
||||
{
|
||||
if (resi == adc_inst["ppb" + ppbi.toString() + "SOCNumber"].replace(/[^0-9]/g,''))
|
||||
{
|
||||
// highPPB+=adc_inst["ppb" + ppbi.toString() + "Name"];
|
||||
highPPB+=adc_inst["ppb" + ppbi.toString() + "SOCNumber"]
|
||||
selectedsource = adc_inst["ppb" + ppbi.toString() + "SOCNumber"].replace("ADC_","").replace("_NUMBER","")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return selectedsource;
|
||||
}
|
||||
},
|
||||
]
|
||||
},
|
||||
])
|
||||
}
|
||||
}
|
||||
config = config.concat([
|
||||
{
|
||||
name: "enableSafetychecker",
|
||||
displayName : "Enable Safety Checker During Initilization",
|
||||
description : 'Enable Safety Checker during initilization',
|
||||
hidden : false,
|
||||
default : false,
|
||||
// onChange :onChangesafetychecker,
|
||||
},
|
||||
])
|
||||
|
||||
|
||||
function onValidateStatic(mod, stat)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
function filterHardware(component)
|
||||
{
|
||||
return (Common.typeMatches(component.type, ["ADC"]));
|
||||
}
|
||||
|
||||
function modules(inst)
|
||||
{
|
||||
if (inst) {
|
||||
return [
|
||||
{
|
||||
name: "adcPullInTemplateDot",
|
||||
moduleName: "/driverlib/adc/templates/adc.dot.dynamic.js",
|
||||
}
|
||||
];
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
|
||||
|
||||
function onValidate(inst, validation) {
|
||||
|
||||
//
|
||||
// Check copy safety Checker Instances
|
||||
//
|
||||
var usedADCSCInsts = [];
|
||||
for (var instance_index in inst.$module.$instances)
|
||||
{
|
||||
var instance_obj = inst.$module.$instances[instance_index];
|
||||
usedADCSCInsts.push(instance_obj.adcscBase);
|
||||
}
|
||||
|
||||
var otherContexts = Common.getOtherContextNames()
|
||||
for (var cntx of otherContexts)
|
||||
{
|
||||
var onOtherCntx = Common.getModuleForCore(inst.$module.$name, cntx);
|
||||
if (onOtherCntx)
|
||||
{
|
||||
for (var instance_index in onOtherCntx.$instances)
|
||||
{
|
||||
var instance_obj = onOtherCntx.$instances[instance_index];
|
||||
usedADCSCInsts.push(instance_obj.adcscBase);
|
||||
}
|
||||
}
|
||||
}
|
||||
var duplicatesResult = Common.findDuplicates(usedADCSCInsts)
|
||||
|
||||
if (duplicatesResult.duplicates.length != 0)
|
||||
{
|
||||
var allDuplicates = "";
|
||||
for (var duplicateNamesIndex in duplicatesResult.duplicates)
|
||||
{
|
||||
allDuplicates = allDuplicates + Common.stringOrEmpty(allDuplicates, ", ")
|
||||
+ duplicatesResult.duplicates[duplicateNamesIndex];
|
||||
}
|
||||
validation.logError(
|
||||
"The ADC Safety Checker Tile Instance used. Duplicates: " + allDuplicates,
|
||||
inst, "adcscBase");
|
||||
}
|
||||
//
|
||||
// Check duplicate ADC sources
|
||||
//
|
||||
let adc = system.modules["/driverlib/adc.js"];
|
||||
|
||||
if (adc!=null)
|
||||
{
|
||||
var usedADCInsts = [];
|
||||
for (var instance_index in adc.$instances)
|
||||
{
|
||||
var instance_obj = adc.$instances[instance_index];
|
||||
usedADCInsts.push(instance_obj.adcBase);
|
||||
}
|
||||
for(var rptrIndex in device_driverlib_peripheral.ADC_SafetyCheckInst) {
|
||||
var currentRPTR = device_driverlib_peripheral.ADC_SafetyCheckInst[rptrIndex].name
|
||||
let rptri = (currentRPTR).replace(/[^0-9]/g,'')
|
||||
if(!(usedADCInsts.includes(inst["safetycheck"+ rptri.toString()+"ADC"].replace("ADC_","ADC")+"_BASE"))){
|
||||
validation.logError(
|
||||
"This ADC Instance has not been configured. If you want to use this ADC, you can set it up via ADC module.",
|
||||
inst, "safetycheck"+ rptri.toString()+"ADC");
|
||||
}
|
||||
}
|
||||
for ( var adc_inst of adc.$instances)
|
||||
{
|
||||
if ((inst["safetycheck1usedSOC"]!=null)&&(inst["safetycheck2usedSOC"]!=null)) {
|
||||
var usedSOC1 =inst["safetycheck1ResultSelect"].replace(/[^0-9]/g,'')
|
||||
var usedSOC2 =inst["safetycheck2ResultSelect"].replace(/[^0-9]/g,'')
|
||||
var selectedSOC1 = inst["safetycheck1ResultSelect"].replace("RESULT","SOC_NUMBER")
|
||||
var selectedSOC2 = inst["safetycheck2ResultSelect"].replace("RESULT","SOC_NUMBER")
|
||||
//
|
||||
// Check the source for SOC
|
||||
//
|
||||
if ((adc_inst.enabledSOCs).includes(selectedSOC1)&&(adc_inst.enabledSOCs).includes(selectedSOC2)&&(inst["safetycheck1inputSource"]=="ADC_SAFETY_CHECKER_INPUT_SOCx")&&
|
||||
(inst["safetycheck2inputSource"]=="ADC_SAFETY_CHECKER_INPUT_SOCx")) {
|
||||
//channel
|
||||
if (adc_inst["soc"+ usedSOC1.toString()+"Channel"]==adc_inst["soc"+ usedSOC2.toString()+"Channel"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Same channel has been selected for SOC of Selector 1 and Selector 2. For safety checking, you need to have different channels.",
|
||||
inst, "safetycheck2usedSOC");
|
||||
}
|
||||
//trigger
|
||||
if (!(adc_inst.enableBurstMode)) {
|
||||
if ((adc_inst["soc"+ usedSOC1.toString()+"Triggermode"]=="singlemode")&&(adc_inst["soc"+ usedSOC2.toString()+"Triggermode"]=="singlemode"))
|
||||
{
|
||||
if (adc_inst["soc"+ usedSOC1.toString()+"Trigger"]!=adc_inst["soc"+ usedSOC2.toString()+"Trigger"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"To get the accurate performance of Safety Checker, same SOC Trigger should be selected for Selector 1 and Selector 2.",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
}
|
||||
if (!((adc_inst["soc"+ usedSOC1.toString()+"Triggermode"]=="singlemode")^(adc_inst["soc"+ usedSOC2.toString()+"Triggermode"]=="repeatermode")) )
|
||||
{
|
||||
validation.logWarning(
|
||||
"To get the accurate performance of Safety Checker, same Trigger Mode should be selected for SOC of Selector 1 and Selector 2.",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
if ((adc_inst["soc"+ usedSOC1.toString()+"Triggermode"]=="repeatermode")&&(adc_inst["soc"+ usedSOC2.toString()+"Triggermode"]=="repeatermode")) {
|
||||
if (((adc_inst["soc"+ usedSOC1.toString()+"Trigger"]=="ADC_TRIGGER_REPEATER1" )&&(adc_inst["soc"+ usedSOC2.toString()+"Trigger"]=="ADC_TRIGGER_REPEATER2"))||
|
||||
((adc_inst["soc"+ usedSOC1.toString()+"Trigger"]=="ADC_TRIGGER_REPEATER2" )&&(adc_inst["soc"+ usedSOC2.toString()+"Trigger"]=="ADC_TRIGGER_REPEATER1"))) {
|
||||
if (adc_inst["repeater1 Trigger"]!=adc_inst["repeater2 Trigger"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"To get the accurate performance of Safety Checker, you need to make sure same Triger is selected for repeater modules 1 and 2 associated with SOCs of Selector 1 and Selector 2.",
|
||||
inst, "safetycheck2usedSOC");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//sampling time
|
||||
if (adc_inst["soc"+ usedSOC1.toString()+"CalculatedSampleTime"]!=adc_inst["soc"+ usedSOC2.toString()+"CalculatedSampleTime"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"To get the accurate performance of Safety Checker, the sample time should be identical for Selected SOC in Selector 1 and Selector 2.",
|
||||
inst, "safetycheck2usedSOC");
|
||||
}
|
||||
if (adc_inst["soc"+ usedSOC1.toString()+"SampleTime"]!=adc_inst["soc"+ usedSOC2.toString()+"SampleTime"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"To get the accurate performance of Safety Checker, the sample time should be identical for Selected SOC in Selector 1 and Selector 2.",
|
||||
inst, "safetycheck2usedSOC");
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
// Check the source for PPB
|
||||
//
|
||||
if ((inst["safetycheck1inputSource"]=="ADC_SAFETY_CHECKER_INPUT_PPBx")&&(inst["safetycheck2inputSource"]=="ADC_SAFETY_CHECKER_INPUT_PPBx")) {
|
||||
var res1= inst["safetycheck1ResultSelect"].replace(/[^0-9]/g,'')
|
||||
var res2= inst["safetycheck2ResultSelect"].replace(/[^0-9]/g,'')
|
||||
var ppbsoc4= adc_inst["ppb4SOCNumber"].replace(/[^0-9]/g,'')
|
||||
var ppbsoc3= adc_inst["ppb3SOCNumber"].replace(/[^0-9]/g,'')
|
||||
var ppbsoc2= adc_inst["ppb2SOCNumber"].replace(/[^0-9]/g,'')
|
||||
var ppbsoc1= adc_inst["ppb1SOCNumber"].replace(/[^0-9]/g,'')
|
||||
if ((inst.safetycheck1usedSOC)&&(inst.safetycheck2usedSOC)) {
|
||||
if (res1!=res2) {
|
||||
//
|
||||
// To do: make a function to handle this section
|
||||
//
|
||||
// for (let xbari=1; xbari< 5; xbari++){
|
||||
// if ((adc_inst.enabledPPBs).includes("ADC_PPB_NUMBER"+xbari)){
|
||||
|
||||
// }
|
||||
if (((adc_inst.enabledPPBs).includes("ADC_PPB_NUMBER1")&&(adc_inst.enabledPPBs).includes("ADC_PPB_NUMBER2"))&&(((res1==ppbsoc1)&&(res2==ppbsoc2))||(res1==ppbsoc2)&&(res2==ppbsoc1))) {
|
||||
if (adc_inst["ppb1ReferenceOffset"]!=adc_inst["ppb2ReferenceOffset"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Different Reference Offset values have been selected for PPB1 and PPB2. For safety checking, you need to make sure this setting is identical for PPB1 and PPB2",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
if (adc_inst["ppb1EnableTwosComplement"]!=adc_inst["ppb2EnableTwosComplement"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Different settings related to Invert Output have been selected for PPB1 and PPB2. For safety checking, you need to make sure this setting is identical for PPB1 and PPB2.",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
}
|
||||
if (((adc_inst.enabledPPBs).includes("ADC_PPB_NUMBER1")&&(adc_inst.enabledPPBs).includes("ADC_PPB_NUMBER3"))&&(ppbsoc3!=ppbsoc2)&&(((res1==ppbsoc1)&&(res2==ppbsoc3))||(res1==ppbsoc3)&&(res2==ppbsoc1))) {
|
||||
if (adc_inst["ppb3ReferenceOffset"]!=adc_inst["ppb1ReferenceOffset"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Different Reference Offset values have been selected for PPB1 and PPB3. For safety checking, you need to make sure this setting is identical for PPB1 and PPB3",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
if (adc_inst["ppb3EnableTwosComplement"]!=adc_inst["ppb1EnableTwosComplement"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Different settings related to Invert Output have been selected for PPB1 and PPB3. For safety checking, you need to make sure this setting is identical for PPB1 and PPB3.",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
}
|
||||
if (((adc_inst.enabledPPBs).includes("ADC_PPB_NUMBER1")&&(adc_inst.enabledPPBs).includes("ADC_PPB_NUMBER4"))&&(ppbsoc2!=ppbsoc4)&&(ppbsoc3!=ppbsoc4)&&(((res1==ppbsoc1)&&(res2==ppbsoc4))||(res1==ppbsoc4)&&(res2==ppbsoc1))) {
|
||||
if (adc_inst["ppb1ReferenceOffset"]!=adc_inst["ppb4ReferenceOffset"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Different Reference Offset values have been selected for PPB1 and PPB4. For safety checking, you need to make sure this setting is identical for PPB1 and PPB4",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
if (adc_inst["ppb1EnableTwosComplement"]!=adc_inst["ppb4EnableTwosComplement"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Different settings related to Invert Output have been selected for PPB1 and PPB4. For safety checking, you need to make sure this setting is identical for PPB1 and PPB4.",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
}
|
||||
if (((adc_inst.enabledPPBs).includes("ADC_PPB_NUMBER3")&&(adc_inst.enabledPPBs).includes("ADC_PPB_NUMBER2"))&&(res1!=ppbsoc1)&&(res2!=ppbsoc1)&&(((res1==ppbsoc2)&&(res2==ppbsoc3))||(res1==ppbsoc3)&&(res2==ppbsoc2))) {
|
||||
if (adc_inst["ppb3ReferenceOffset"]!=adc_inst["ppb2ReferenceOffset"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Different Reference Offset values have been selected for PPB3 and PPB2. For safety checking, you need to make sure this setting is identical for PPB3 and PPB2",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
if (adc_inst["ppb3EnableTwosComplement"]!=adc_inst["ppb2EnableTwosComplement"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Different settings related to Invert Output have been selected for PPB3 and PPB2. For safety checking, you need to make sure this setting is identical for PPB3 and PPB2.",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
}
|
||||
|
||||
if (((adc_inst.enabledPPBs).includes("ADC_PPB_NUMBER2")&&(adc_inst.enabledPPBs).includes("ADC_PPB_NUMBER4"))&&(res1!=ppbsoc1)&&(res2!=ppbsoc1)&&(res1!=ppbsoc3)
|
||||
&&(res2!=ppbsoc3)&&(((res1==ppbsoc4)&&(res2==ppbsoc2))||(res1==ppbsoc2)&&(res2==ppbsoc4))) {
|
||||
if (adc_inst["ppb2ReferenceOffset"]!=adc_inst["ppb4ReferenceOffset"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Different Reference Offset values have been selected for PPB2 and PPB4. For safety checking, you need to make sure this setting is identical for PPB2 and PPB4",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
if (adc_inst["ppb2EnableTwosComplement"]!=adc_inst["ppb4EnableTwosComplement"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Different settings related to Invert Output have been selected for PPB2 and PPB4. For safety checking, you need to make sure this setting is identical for PPB2 and PPB4.",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
}
|
||||
if (((adc_inst.enabledPPBs).includes("ADC_PPB_NUMBER3")&&(adc_inst.enabledPPBs).includes("ADC_PPB_NUMBER4"))&&(res1!=ppbsoc1)&&(res2!=ppbsoc1)&&(res1!=ppbsoc2)&&
|
||||
(res2!=ppbsoc2)&&(((res1==ppbsoc4)&&(res2==ppbsoc3))||(res1==ppbsoc3)&&(res2==ppbsoc4)))
|
||||
{
|
||||
if (adc_inst["ppb3ReferenceOffset"]!=adc_inst["ppb4ReferenceOffset"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Different Reference Offset values have been selected for PPB3 and PPB4. For safety checking, you need to make sure this setting is identical for PPB3 and PPB4.",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
if (adc_inst["ppb3EnableTwosComplement"]!=adc_inst["ppb4EnableTwosComplement"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Different settings related to Invert Output have been selected for PPB3 and PPB4. For safety checking, you need to make sure this setting is identical for PPB3 and PPB4.",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
// Check the source for PPBSum
|
||||
//
|
||||
if ((inst["safetycheck1inputSource"]=="ADC_SAFETY_CHECKER_INPUT_PPBSUMx")&&(inst["safetycheck2inputSource"]=="ADC_SAFETY_CHECKER_INPUT_PPBSUMx")) {
|
||||
var res1= inst["safetycheck1ResultSelect"].replace(/[^0-9]/g,'')
|
||||
var res2= inst["safetycheck2ResultSelect"].replace(/[^0-9]/g,'')
|
||||
var ppbsoc4= adc_inst["ppb4SOCNumber"].replace(/[^0-9]/g,'')
|
||||
var ppbsoc3= adc_inst["ppb3SOCNumber"].replace(/[^0-9]/g,'')
|
||||
var ppbsoc2= adc_inst["ppb2SOCNumber"].replace(/[^0-9]/g,'')
|
||||
var ppbsoc1= adc_inst["ppb1SOCNumber"].replace(/[^0-9]/g,'')
|
||||
if ((inst.safetycheck1usedSOC)&&(inst.safetycheck2usedSOC)) {
|
||||
if (res1!=res2) {
|
||||
if (((adc_inst.enabledPPBs).includes("ADC_PPB_NUMBER1")&&(adc_inst.enabledPPBs).includes("ADC_PPB_NUMBER2"))&&(((res1==ppbsoc1)&&(res2==ppbsoc2))||(res1==ppbsoc2)&&(res2==ppbsoc1))) {
|
||||
if (adc_inst["ppb1ReferenceOffset"]!=adc_inst["ppb2ReferenceOffset"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Different Reference Offset values have been selected for PPB1 and PPB2. For safety checking, you need to make sure this setting is identical for PPB1 and PPB2",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
if (adc_inst["ppb1EnableTwosComplement"]!=adc_inst["ppb2EnableTwosComplement"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Different settings related to Invert Output have been selected for PPB1 and PPB2. For safety checking, you need to make sure this setting is identical for PPB1 and PPB2.",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
if (adc_inst["ppb1Rightshift"]!=adc_inst["ppb2Rightshift"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Different Number of Bits to Right Shift PSUM have been selected for PPB1 and PPB2.For safety checking, you need to make sure this setting is identical for PPB1 and PPB2.",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
}
|
||||
if (((adc_inst.enabledPPBs).includes("ADC_PPB_NUMBER1")&&(adc_inst.enabledPPBs).includes("ADC_PPB_NUMBER3"))&&(ppbsoc3!=ppbsoc2)&&(((res1==ppbsoc1)&&(res2==ppbsoc3))||(res1==ppbsoc3)&&(res2==ppbsoc1))) {
|
||||
if (adc_inst["ppb3ReferenceOffset"]!=adc_inst["ppb1ReferenceOffset"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Different Reference Offset values have been selected for PPB1 and PPB3. For safety checking, you need to make sure this setting is identical for PPB1 and PPB3",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
if (adc_inst["ppb3EnableTwosComplement"]!=adc_inst["ppb1EnableTwosComplement"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Different settings related to Invert Output have been selected for PPB1 and PPB3. For safety checking, you need to make sure this setting is identical for PPB1 and PPB3.",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
if (adc_inst["ppb3Rightshift"]!=adc_inst["ppb1Rightshift"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Different Number of Bits to Right Shift PSUM have been selected for PPB1 and PPB3.For safety checking, you need to make sure this setting is identical for PPB1 and PPB3.",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
|
||||
}
|
||||
if (((adc_inst.enabledPPBs).includes("ADC_PPB_NUMBER1")&&(adc_inst.enabledPPBs).includes("ADC_PPB_NUMBER4"))&&(ppbsoc2!=ppbsoc4)&&(ppbsoc3!=ppbsoc4)&&(((res1==ppbsoc1)&&(res2==ppbsoc4))||(res1==ppbsoc4)&&(res2==ppbsoc1))) {
|
||||
if (adc_inst["ppb1ReferenceOffset"]!=adc_inst["ppb4ReferenceOffset"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Different Reference Offset values have been selected for PPB1 and PPB4. For safety checking, you need to make sure this setting is identical for PPB1 and PPB4",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
if (adc_inst["ppb1EnableTwosComplement"]!=adc_inst["ppb4EnableTwosComplement"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Different settings related to Invert Output have been selected for PPB1 and PPB4. For safety checking, you need to make sure this setting is identical for PPB1 and PPB4.",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
if (adc_inst["ppb1Rightshift"]!=adc_inst["ppb4Rightshift"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Different Number of Bits to Right Shift PSUM have been selected for PPB1 and PPB4.For safety checking, you need to make sure this setting is identical for PPB1 and PPB4.",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
}
|
||||
if (((adc_inst.enabledPPBs).includes("ADC_PPB_NUMBER3")&&(adc_inst.enabledPPBs).includes("ADC_PPB_NUMBER2"))&&(res1!=ppbsoc1)&&(res2!=ppbsoc1)&&(((res1==ppbsoc2)&&(res2==ppbsoc3))||(res1==ppbsoc3)&&(res2==ppbsoc2))) {
|
||||
if (adc_inst["ppb3ReferenceOffset"]!=adc_inst["ppb2ReferenceOffset"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Different Reference Offset values have been selected for PPB3 and PPB2. For safety checking, you need to make sure this setting is identical for PPB3 and PPB2",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
if (adc_inst["ppb3EnableTwosComplement"]!=adc_inst["ppb2EnableTwosComplement"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Different settings related to Invert Output have been selected for PPB3 and PPB2. For safety checking, you need to make sure this setting is identical for PPB3 and PPB2.",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
if (adc_inst["ppb3Rightshift"]!=adc_inst["ppb2Rightshift"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Different Number of Bits to Right Shift PSUM have been selected for PPB3 and PPB2.For safety checking, you need to make sure this setting is identical for PPB3 and PPB2.",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
}
|
||||
|
||||
if (((adc_inst.enabledPPBs).includes("ADC_PPB_NUMBER2")&&(adc_inst.enabledPPBs).includes("ADC_PPB_NUMBER4"))&&(res1!=ppbsoc1)&&(res2!=ppbsoc1)&&(res1!=ppbsoc3)&&(res2!=ppbsoc3)&&(((res1==ppbsoc4)&&(res2==ppbsoc2))||(res1==ppbsoc2)&&(res2==ppbsoc4))) {
|
||||
if (adc_inst["ppb2ReferenceOffset"]!=adc_inst["ppb4ReferenceOffset"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Different Reference Offset values have been selected for PPB2 and PPB4. For safety checking, you need to make sure this setting is identical for PPB2 and PPB4",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
if (adc_inst["ppb2EnableTwosComplement"]!=adc_inst["ppb4EnableTwosComplement"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Different settings related to Invert Output have been selected for PPB2 and PPB4. For safety checking, you need to make sure this setting is identical for PPB2 and PPB4.",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
if (adc_inst["ppb2Rightshift"]!=adc_inst["ppb4Rightshift"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Different Number of Bits to Right Shift PSUM have been selected for PPB2 and PPB4.For safety checking, you need to make sure this setting is identical for PPB2 and PPB4.",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
}
|
||||
if (((adc_inst.enabledPPBs).includes("ADC_PPB_NUMBER3")&&(adc_inst.enabledPPBs).includes("ADC_PPB_NUMBER4"))&&(res1!=ppbsoc1)&&(res2!=ppbsoc1)&&(res1!=ppbsoc2)&&(res2!=ppbsoc2)&&(((res1==ppbsoc4)&&(res2==ppbsoc3))||(res1==ppbsoc3)&&(res2==ppbsoc4)))
|
||||
{
|
||||
if (adc_inst["ppb3ReferenceOffset"]!=adc_inst["ppb4ReferenceOffset"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Different Reference Offset values have been selected for PPB3 and PPB4. For safety checking, you need to make sure this setting is identical for PPB3 and PPB4.",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
if (adc_inst["ppb3EnableTwosComplement"]!=adc_inst["ppb4EnableTwosComplement"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Different settings related to Invert Output have been selected for PPB3 and PPB4. For safety checking, you need to make sure this setting is identical for PPB3 and PPB4.",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
if (adc_inst["ppb3Rightshift"]!=adc_inst["ppb4Rightshift"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Different Number of Bits to Right Shift PSUM have been selected for PPB3 and PPB4.For safety checking, you need to make sure this setting is identical for PPB3 and PPB4.",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(var rptrIndex in device_driverlib_peripheral.ADC_SafetyCheckInst) {
|
||||
var currentRPTR = device_driverlib_peripheral.ADC_SafetyCheckInst[rptrIndex].name
|
||||
let rptri = (currentRPTR).replace(/[^0-9]/g,'')
|
||||
if ((inst["safetycheck"+ rptri.toString()+"usedSOC"]!="")&&(adc_inst.adcBase.replace("_BASE", "")==inst["safetycheck"+ rptri.toString()+"ADC"].replace("ADC_","ADC"))) {
|
||||
if (inst["safetycheck"+ rptri.toString()+"inputSource"]=="ADC_SAFETY_CHECKER_INPUT_SOCx")
|
||||
{
|
||||
var selectedSOC = inst ["safetycheck"+rptri.toString()+"usedSOC"].replace(/[^0-9]/g,'')
|
||||
validation.logInfo(
|
||||
"You can change settings of Input Source for Selector "+ rptri.toString()+ " via"+ ": " + system.getReference(adc_inst,"soc"+selectedSOC.toString()+"Name"),
|
||||
inst, "safetycheck"+ rptri.toString()+"usedSOC");
|
||||
}
|
||||
if ((inst["safetycheck"+ rptri.toString()+"inputSource"]=="ADC_SAFETY_CHECKER_INPUT_PPBx")||(inst["safetycheck"+ rptri.toString()+"inputSource"]=="ADC_SAFETY_CHECKER_INPUT_PPBSUMx")) {
|
||||
for(var ppbIndex in device_driverlib_peripheral.ADC_PPBNumber) {
|
||||
var currentPPB = device_driverlib_peripheral.ADC_PPBNumber[ppbIndex].name
|
||||
var ppbi = (currentPPB).replace(/[^0-9]/g,'')
|
||||
var resi= inst["safetycheck"+ rptri.toString()+"ResultSelect"].replace(/[^0-9]/g,'')
|
||||
let higherPPB="";
|
||||
if (resi==adc_inst["ppb" + ppbi.toString() + "SOCNumber"].replace(/[^0-9]/g,'')){
|
||||
if (adc_inst.enabledPPBs.includes("ADC_PPB_NUMBER1")) {
|
||||
if ((currentPPB=="ADC_PPB_NUMBER4")&&(adc_inst["ppb4SOCNumber"]!=adc_inst["ppb3SOCNumber"])&&(adc_inst["ppb4SOCNumber"]!=adc_inst["ppb2SOCNumber"])&&(adc_inst["ppb4SOCNumber"]!=adc_inst["ppb1SOCNumber"])) {
|
||||
higherPPB= "ppb4Name";
|
||||
validation.logInfo(
|
||||
"SOC"+resi.toString()+" is used in PPB4. You can change settings of Input Source for Selector "+ rptri.toString()+ " via"+ ": " + system.getReference(adc_inst,higherPPB),
|
||||
inst, "safetycheck"+ rptri.toString()+"usedSOC" );
|
||||
}
|
||||
if ((currentPPB=="ADC_PPB_NUMBER3")&&(adc_inst["ppb3SOCNumber"]!=adc_inst["ppb2SOCNumber"])&&(adc_inst["ppb3SOCNumber"]!=adc_inst["ppb1SOCNumber"])) {
|
||||
higherPPB= "ppb3Name";
|
||||
validation.logInfo(
|
||||
"SOC"+resi.toString()+" is used in PPB3. You can change settings of Input Source for Selector "+ rptri.toString()+ " via"+ ": " + system.getReference(adc_inst,higherPPB),
|
||||
inst, "safetycheck"+ rptri.toString()+"usedSOC" );
|
||||
}
|
||||
if ((currentPPB=="ADC_PPB_NUMBER2")&&(adc_inst["ppb1SOCNumber"]!=adc_inst["ppb2SOCNumber"])) {
|
||||
higherPPB= "ppb2Name";
|
||||
validation.logInfo(
|
||||
"SOC"+resi.toString()+" is used in PPB2. You can change settings of Input Source for Selector "+ rptri.toString()+ " via"+ ": " + system.getReference(adc_inst,higherPPB),
|
||||
inst, "safetycheck"+ rptri.toString()+"usedSOC" );
|
||||
}
|
||||
if ((currentPPB=="ADC_PPB_NUMBER1")) {
|
||||
higherPPB= "ppb1Name";
|
||||
validation.logInfo(
|
||||
"SOC"+resi.toString()+" is used in PPB1. You can change settings of Input Source for Selector "+ rptri.toString()+ " via"+ ": " + system.getReference(adc_inst,higherPPB),
|
||||
inst, "safetycheck"+ rptri.toString()+"usedSOC" );
|
||||
}
|
||||
}
|
||||
if (!(adc_inst.enabledPPBs.includes("ADC_PPB_NUMBER1"))) {
|
||||
if (adc_inst.enabledPPBs.includes("ADC_PPB_NUMBER2")) {
|
||||
if (currentPPB=="ADC_PPB_NUMBER2") {
|
||||
higherPPB= "ppb2Name";
|
||||
validation.logInfo(
|
||||
"SOC"+resi.toString()+" is used in PPB2. You can change settings of Input Source for Selector "+ rptri.toString()+ " via"+ ": " + system.getReference(adc_inst,higherPPB),
|
||||
inst, "safetycheck"+ rptri.toString()+"usedSOC" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!(adc_inst.enabledPPBs.includes("ADC_PPB_NUMBER1"))) {
|
||||
if (!(adc_inst.enabledPPBs.includes("ADC_PPB_NUMBER2"))||(resi!=adc_inst["ppb2" + "SOCNumber"].replace(/[^0-9]/g,''))) {
|
||||
if (adc_inst.enabledPPBs.includes("ADC_PPB_NUMBER3")){
|
||||
if (currentPPB=="ADC_PPB_NUMBER3")
|
||||
{
|
||||
higherPPB= "ppb3Name";
|
||||
validation.logInfo(
|
||||
"SOC "+resi.toString()+" is used in PPB3. You can change settings of Input Source for Selector "+ rptri.toString()+ " via"+ ": " + system.getReference(adc_inst,higherPPB),
|
||||
inst, "safetycheck"+ rptri.toString()+"usedSOC" );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!(adc_inst.enabledPPBs.includes("ADC_PPB_NUMBER1"))) {
|
||||
if (!(adc_inst.enabledPPBs.includes("ADC_PPB_NUMBER3"))) {
|
||||
if (adc_inst.enabledPPBs.includes("ADC_PPB_NUMBER4")) {
|
||||
if (currentPPB=="ADC_PPB_NUMBER4") {
|
||||
higherPPB= "ppb4Name";
|
||||
validation.logInfo(
|
||||
"SOC"+resi.toString()+" is used in PPB4. You can change settings of Input Source for Selector "+ rptri.toString()+ " via"+ ": " + system.getReference(adc_inst,higherPPB),
|
||||
inst, "safetycheck"+ rptri.toString()+"usedSOC" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for(var rptrIndex in device_driverlib_peripheral.ADC_SafetyCheckInst) {
|
||||
var currentRPTR = device_driverlib_peripheral.ADC_SafetyCheckInst[rptrIndex].name
|
||||
let rptri = (currentRPTR).replace(/[^0-9]/g,'')
|
||||
if ((inst["safetycheck"+ rptri.toString()+"usedSOC"]=="") && (inst["safetycheck"+ rptri.toString()+"inputSource"] != "ADC_SAFETY_CHECKER_INPUT_DISABLE")) {
|
||||
validation.logWarning(
|
||||
"There is no Input Source configured for this Result",
|
||||
inst, "safetycheck"+ rptri.toString()+"usedSOC");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if ((inst["safetycheck1inputSource"] != "ADC_SAFETY_CHECKER_INPUT_DISABLE")||(inst["safetycheck2inputSource"] != "ADC_SAFETY_CHECKER_INPUT_DISABLE")){
|
||||
if (inst["safetycheck1inputSource"] != inst["safetycheck2inputSource"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Same Input Source should be selected for Selector 1 and Selector 2",
|
||||
inst, "safetycheck2inputSource");
|
||||
}
|
||||
if ((inst["safetycheck1ResultSelect"] == inst["safetycheck2ResultSelect"]) &&
|
||||
(inst["safetycheck1ADC"] == inst["safetycheck2ADC"]))
|
||||
{
|
||||
validation.logWarning(
|
||||
"Different Result should be selected for Selector 1 and Selector 2 when the same ADC instance is used for both",
|
||||
inst, "safetycheck1ResultSelect");
|
||||
}
|
||||
}
|
||||
if (inst["safetyCheckTolerance"] > 16777215)
|
||||
{
|
||||
validation.logError(
|
||||
"The max limit for Tolerance is 16777215",
|
||||
inst, "safetyCheckTolerance");
|
||||
}
|
||||
if (inst["safetyCheckTolerance"] < 0)
|
||||
{
|
||||
validation.logError(
|
||||
"Tolerance must be larger than 0",
|
||||
inst, "safetyCheckTolerance");
|
||||
}
|
||||
if (!Number.isInteger(inst["safetyCheckTolerance"]))
|
||||
{
|
||||
validation.logError(
|
||||
"Tolerance must be an integer value",
|
||||
inst, "safetyCheckTolerance");
|
||||
}
|
||||
}
|
||||
|
||||
var adcscModule = {
|
||||
//peripheralName: "ADCSafetyCheckerTile",
|
||||
displayName: "ADC SAFETY CHECKER",
|
||||
maxInstances: maxInstances,
|
||||
defaultInstanceName: "myADCSAFETYCHECKER",
|
||||
description: "ADC Safety Checker Module",
|
||||
longDescription: (Common.getCollateralFindabilityList("ADC")),
|
||||
filterHardware : filterHardware,
|
||||
config: config,
|
||||
templates: {
|
||||
//boardc : "/driverlib/adc/adcsc.board.c.xdt",
|
||||
//boardh : "/driverlib/adc/adcsc.board.h.xdt"
|
||||
},
|
||||
|
||||
modules : modules,
|
||||
validate : onValidate,
|
||||
};
|
||||
|
||||
exports = adcscModule;
|
||||
@@ -0,0 +1,6 @@
|
||||
exports = {
|
||||
moduleStatic: {},
|
||||
templates: {
|
||||
"/driverlib/adc/templates/adc.dot.xdt" : ""
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,197 @@
|
||||
%%{
|
||||
var module = system.modules['/driverlib/adc.js'];
|
||||
let device_adc_char =
|
||||
system.getScript("/driverlib/adc/adc_char.js");
|
||||
let Common = system.getScript("/driverlib/Common.js");
|
||||
let device_driverlib_peripheral =
|
||||
system.getScript("/driverlib/device_driverlib_peripherals/" +
|
||||
Common.getDeviceName().toLowerCase() + "_adc.js");
|
||||
var nameOfModule = "adc";
|
||||
var nameOfPeripheral = module.peripheralName;
|
||||
var width = 3;
|
||||
var total_number_socs = 16;
|
||||
var high_priority_x_offset = 6;
|
||||
var timing_x_offset = 8;
|
||||
var sysclk_width = 0.5;
|
||||
var instance_x_offset = 0;
|
||||
var instance_y_offset = 0;
|
||||
var colors = [
|
||||
'#FFA0A0',
|
||||
'#A0FFA0',
|
||||
'#A0A0FF',
|
||||
'#FFFFA0',
|
||||
'#A0FFFF',
|
||||
'#FFA0FF',
|
||||
'#5EE0BE'
|
||||
]
|
||||
|
||||
if (module != null)
|
||||
{
|
||||
%%}
|
||||
digraph {
|
||||
graph [fontname = "helvetica"];
|
||||
node [fontname = "helvetica"];
|
||||
edge [fontname = "helvetica"];
|
||||
graph [mclimit=50 nodesep=0.5 rankdir=LR ranksep=1.25]
|
||||
|
||||
node [shape = circle style=filled];
|
||||
|
||||
%%{
|
||||
for(var instanceIndex = 0; instanceIndex < module.$instances.length; instanceIndex++) {
|
||||
var instance = module.$instances[instanceIndex];
|
||||
var instanceName = instance.adcBase.replace("_BASE", "");
|
||||
var instanceNamePrepend = instanceName.toLowerCase() + "_"
|
||||
var highPri = instance.socHighPriorityMode;
|
||||
var number_highpri_socs = device_driverlib_peripheral.ADC_PriorityMode.findIndex(x => x.name == highPri);
|
||||
var number_roundrobin_socs = total_number_socs - number_highpri_socs
|
||||
var alpha = Math.PI*2/number_roundrobin_socs
|
||||
var r = width/2/Math.sin(alpha/2)
|
||||
if (number_roundrobin_socs < 2)
|
||||
{
|
||||
r = width;
|
||||
angle = 0;
|
||||
}
|
||||
var angle = 0;
|
||||
var x = 0;
|
||||
var y = 0;
|
||||
%%}
|
||||
%%{
|
||||
for (var i = number_highpri_socs; i < total_number_socs; i++) {
|
||||
x = r*Math.sin(angle) + instance_x_offset;
|
||||
y = r*Math.cos(angle) + instance_y_offset;
|
||||
angle = angle + alpha
|
||||
%%}
|
||||
`instanceNamePrepend`SOC`i.toString()` [label="`instanceName + " SOC" + i.toString()`" fillcolor="`colors[instanceIndex]`" pos="`x.toFixed(3)`,`y.toFixed(3)`!"]
|
||||
%%{
|
||||
}
|
||||
|
||||
y = r
|
||||
for (var i = 0; i < number_highpri_socs; i++)
|
||||
{
|
||||
|
||||
%%}
|
||||
`instanceNamePrepend`SOC`i.toString()` [fillcolor="`colors[instanceIndex]`" pos="`(high_priority_x_offset*width + instance_x_offset).toFixed(3)`, `(y + instance_y_offset).toFixed(3)`!"]
|
||||
%%{
|
||||
y = y - width
|
||||
}
|
||||
|
||||
for (var i = number_highpri_socs; i < total_number_socs; i++) {
|
||||
if (i < total_number_socs - 1){
|
||||
%%}
|
||||
`instanceNamePrepend`SOC`(i).toString()` -> `instanceNamePrepend`SOC`(i+1).toString()`
|
||||
%%{
|
||||
}
|
||||
else {
|
||||
%%}
|
||||
`instanceNamePrepend`SOC`(i).toString()` -> `instanceNamePrepend`SOC`number_highpri_socs.toString()`
|
||||
%%{
|
||||
}
|
||||
}
|
||||
%%}
|
||||
%%{
|
||||
instance_x_offset = 0;
|
||||
instance_y_offset = instance_y_offset - ((total_number_socs + 1)*width);
|
||||
}
|
||||
%%}
|
||||
node [shape=rect style=filled];
|
||||
%%{
|
||||
instance_y_offset = 0;
|
||||
instance_x_offset = 0;
|
||||
for (var adcTrigger of device_driverlib_peripheral.ADC_Trigger)
|
||||
{
|
||||
var adcTriggerDisplayName = adcTrigger.displayName;
|
||||
var adcTriggerName = adcTrigger.name;
|
||||
var triggerNameInserted = false;
|
||||
|
||||
instance_x_offset = 0;
|
||||
|
||||
for (var instanceIndex = 0; instanceIndex < module.$instances.length; instanceIndex++) {
|
||||
var instance = module.$instances[instanceIndex];
|
||||
var instanceName = instance.adcBase.replace("_BASE", "");
|
||||
var instanceNamePrepend = instanceName.toLowerCase() + "_"
|
||||
var instanceClockDiv = parseFloat(instance.adcClockPrescaler.replace("ADC_CLK_DIV_", "").replace("_", "."))
|
||||
var instanceAdcClockPrescaler = instance.adcClockPrescaler
|
||||
var highPri = instance.socHighPriorityMode;
|
||||
var number_highpri_socs = device_driverlib_peripheral.ADC_PriorityMode.findIndex(x => x.name == highPri);
|
||||
|
||||
var conversion_time = device_adc_char.tEOC_12bit_SYSCLK[instanceAdcClockPrescaler];
|
||||
if (["F2837xD", "F2837xS", "F2838x"].includes(Common.getDeviceName()))
|
||||
{
|
||||
if (instance.adcResolutionMode == "ADC_RESOLUTION_16BIT")
|
||||
{
|
||||
conversion_time = device_adc_char.tEOC_16bit_SYSCLK[instanceAdcClockPrescaler];
|
||||
}
|
||||
}
|
||||
var adc_socs_with_trigger_rr = [];
|
||||
var adc_socs_with_trigger_hp = [];
|
||||
for (var socIndex = 0; socIndex < 16; socIndex++) {
|
||||
if (instance["enableBurstMode"])
|
||||
{
|
||||
if (socIndex >= number_highpri_socs)
|
||||
{
|
||||
if (instance["burstTrigger"] == adcTriggerName)
|
||||
{
|
||||
adc_socs_with_trigger_rr.push(
|
||||
{
|
||||
soc: "soc" + socIndex,
|
||||
window: instance["soc" + socIndex.toString() + "SampleWindow"]
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (instance["soc" + socIndex.toString() + "Trigger"] == adcTriggerName)
|
||||
{
|
||||
if (socIndex < number_highpri_socs)
|
||||
{
|
||||
adc_socs_with_trigger_hp.push(
|
||||
{
|
||||
soc: "soc" + socIndex,
|
||||
window: instance["soc" + socIndex.toString() + "SampleWindow"]
|
||||
}
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!instance["enableBurstMode"])
|
||||
{
|
||||
adc_socs_with_trigger_rr.push(
|
||||
{
|
||||
soc: "soc" + socIndex,
|
||||
window: instance["soc" + socIndex.toString() + "SampleWindow"]
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
if (adc_socs_with_trigger_rr.length > 0) {
|
||||
instance_x_offset = 0;
|
||||
if (!triggerNameInserted) {
|
||||
instance_y_offset = instance_y_offset - width
|
||||
%%}
|
||||
`adcTriggerName`[label="`adcTriggerDisplayName`" fillcolor="yellow" fontsize="40" color="white" pos="`(timing_x_offset*width + instance_x_offset).toFixed(3)`,`instance_y_offset.toFixed(3)`!"]
|
||||
%%{
|
||||
instance_y_offset = instance_y_offset - width
|
||||
triggerNameInserted = true;
|
||||
}
|
||||
instance_y_offset = instance_y_offset - width
|
||||
%%}
|
||||
`instanceNamePrepend + adcTriggerName`[label="`instanceName`" fontsize="40" fillcolor="white" color="white" pos="`(timing_x_offset*width + instance_x_offset).toFixed(3)`,`instance_y_offset.toFixed(3)`!"]
|
||||
%%{
|
||||
instance_x_offset = instance_x_offset + width
|
||||
for (var adc_soc_info of adc_socs_with_trigger_rr){
|
||||
var adc_soc = adc_soc_info.soc;
|
||||
var soc_width = conversion_time*sysclk_width + adc_soc_info.window*sysclk_width
|
||||
var soc_pos = timing_x_offset*width + soc_width/2 + instance_x_offset
|
||||
%%}
|
||||
`instanceNamePrepend + adcTriggerName + "_" + adc_soc`[label="`adc_soc` (S+H[SYSCLK]: `adc_soc_info.window.toString()`, Conv[SYSCLK]: `conversion_time.toString()`)" fillcolor="`colors[instanceIndex]`" width="`(soc_width).toFixed(3)`" pos="`(soc_pos).toFixed(3)`,`instance_y_offset.toFixed(3)`!"]
|
||||
%%{
|
||||
instance_x_offset = instance_x_offset + soc_width
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
%%}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
let Common = system.getScript("/driverlib/Common.js");
|
||||
let Pinmux = system.getScript("/driverlib/pinmux.js");
|
||||
let device_driverlib_peripheral =
|
||||
system.getScript("/driverlib/device_driverlib_peripherals/" +
|
||||
Common.getDeviceName().toLowerCase() + "_adc.js");
|
||||
let device_driverlib_memmap =
|
||||
system.getScript("/driverlib/device_driverlib_peripherals/" +
|
||||
Common.getDeviceName().toLowerCase() + "_memmap.js");
|
||||
|
||||
//var numberOfBusCompInstance = {
|
||||
// "F29H85x" : 8
|
||||
//}
|
||||
|
||||
let config = [
|
||||
{
|
||||
name: "GROUP_SAFECHECKCFG",
|
||||
displayName: "ADC Safety Checker Configuration",
|
||||
collapsed: false,
|
||||
config: []
|
||||
},
|
||||
];
|
||||
|
||||
function filterHardware(component)
|
||||
{
|
||||
return (Common.typeMatches(component.type, ["ADC"]));
|
||||
}
|
||||
|
||||
function moduleInstances(inst)
|
||||
{
|
||||
let components = new Array();
|
||||
|
||||
components.push(
|
||||
{
|
||||
name: "adc_safetycheckertile",
|
||||
group: "GROUP_SAFECHECKCFG",
|
||||
displayName: "Safety Checker Tile",
|
||||
moduleName: "/driverlib/adc/modules/adcsafetycheckertile.js",
|
||||
useArray: true,
|
||||
collapsed: true,
|
||||
//maxInstances: maxInstances,
|
||||
}
|
||||
)
|
||||
|
||||
components.push(
|
||||
{
|
||||
name: "adc_safetycheckeraggr",
|
||||
group: "GROUP_SAFECHECKCFG",
|
||||
displayName: "Safety Checker Interrupt/Event Configuration",
|
||||
moduleName: "/driverlib/adc/modules/adcsafetycheckeraggr.js",
|
||||
useArray: true,
|
||||
collapsed: true,
|
||||
//maxInstances: maxInstances,
|
||||
}
|
||||
)
|
||||
|
||||
return components;
|
||||
}
|
||||
|
||||
var adcSCModule = {
|
||||
peripheralName: "ADCSafetyChecker",
|
||||
displayName: "ADC SAFETY CHECKER",
|
||||
defaultInstanceName: "myADCSAFETYCHECK",
|
||||
description: "ADC Safety Checker Module",
|
||||
// longDescription: (Common.getCollateralFindabilityList("ERAD")),
|
||||
filterHardware : filterHardware,
|
||||
moduleStatic : {
|
||||
config : config,
|
||||
moduleInstances : moduleInstances,
|
||||
},
|
||||
templates: {
|
||||
boardc : "/driverlib/adc/adcsc.board.c.xdt",
|
||||
boardh : "/driverlib/adc/adcsc.board.h.xdt"
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
exports = adcSCModule;
|
||||
@@ -0,0 +1,752 @@
|
||||
let Common = system.getScript("/driverlib/Common.js");
|
||||
let device_driverlib_peripheral =
|
||||
system.getScript("/driverlib/device_driverlib_peripherals/" +
|
||||
Common.getDeviceName().toLowerCase() + "_adc.js");
|
||||
let device_driverlib_memmap =
|
||||
system.getScript("/driverlib/device_driverlib_peripherals/" +
|
||||
Common.getDeviceName().toLowerCase() + "_memmap.js");
|
||||
|
||||
|
||||
var ADCSC_INSTANCE =[];
|
||||
|
||||
if (["F28P65x"].includes(Common.getDeviceName()))
|
||||
{
|
||||
for (var sftychkr in device_driverlib_memmap.ADCSAFETYCHKMemoryMap)
|
||||
{
|
||||
ADCSC_INSTANCE.push(
|
||||
{ name: device_driverlib_memmap.ADCSAFETYCHKMemoryMap[sftychkr].name,
|
||||
displayName: device_driverlib_memmap.ADCSAFETYCHKMemoryMap[sftychkr].name.replace("_BASE","")
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
var maxInstances = ADCSC_INSTANCE.length
|
||||
|
||||
|
||||
|
||||
var longDescriptionsafetychecker = `
|
||||
For safety-critical applications, this device provides the ability to automatically compare ADC conversion results from multiple ADC modules against each other for consistency.
|
||||
Each ADC checker tile captures conversion results from the associated ADCs
|
||||
as soon as the conversions are complete, and compares the absolute value of the difference to the configured
|
||||
tolerance. If the computed delta is out of range, the checker can generate a trip event signal that is sent to
|
||||
an ePWM or output crossbar, and can also trigger an CPU interrupt. The structure and
|
||||
operation of an ADC result safety checker tile are demonstrated in the figure:
|
||||

|
||||
|
||||
To configure an ADC result safety checker tile:
|
||||
1) Select the first ADC instance to test. Then, in the Input field, select the source of the result, which can be any one of the SOCs, PPB modules or PPB sums. The result value should be given in the Selected Result field.
|
||||
2) Select the second ADC instance to test. Then, in the Input field, select the source of the result, which can be any one of the SOCs, PPB modules or PPB sums. The result value should be given in the Selected Result field.
|
||||
3) Configure the checker tolerance by assigning the value to Tolerance field.
|
||||
4) Enable the checker tile by selecting Enable Safety Checker
|
||||
`
|
||||
var longDescriptionsafetycheckertolerance = `
|
||||
Each ADC result safety checker tile can be configured to automatically compare two ADC conversion results
|
||||
against a set tolerance value, and generate an interrupt if an out-of-tolerance (OOT) event occurs. The selected
|
||||
results can be from the same ADC instance, or from different ADCs.
|
||||
`
|
||||
/* Array of ADC configurables that are common across device families */
|
||||
let config = [
|
||||
{
|
||||
name : "adcscBase",
|
||||
displayName : "ADC Safety Checker Instance",
|
||||
longDescription : longDescriptionsafetychecker,
|
||||
hidden : false,
|
||||
default : ADCSC_INSTANCE[0].name,
|
||||
options : ADCSC_INSTANCE,
|
||||
|
||||
},
|
||||
{
|
||||
name : "safetyCheckTolerance",
|
||||
displayName : "Tolerance [LSB]",
|
||||
description : 'Select tolerance in LSB for the difference between check result instancese',
|
||||
longDescription : longDescriptionsafetycheckertolerance,
|
||||
hidden : false,
|
||||
default : 0,
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
function onChangesafetychecker(inst, ui)
|
||||
{
|
||||
for(var rptrIndex in device_driverlib_peripheral.ADC_SafetyCheckInst)
|
||||
{
|
||||
var currentRPTR = device_driverlib_peripheral.ADC_SafetyCheckInst[rptrIndex].name
|
||||
var rptri = (currentRPTR).replace(/[^0-9]/g,'')
|
||||
var selectedsources=
|
||||
[
|
||||
"safetycheck"+ rptri.toString()+"usedSOC",
|
||||
// "safetycheck"+ rptri.toString()+"usedPPB",
|
||||
// "safetycheck"+ rptri.toString()+"usedPPBSUM",
|
||||
];
|
||||
if (ui)
|
||||
{
|
||||
for (var selectedsource of selectedsources)
|
||||
{
|
||||
if ((inst["safetycheck"+ rptri.toString()+"inputSource"] != "ADC_SAFETY_CHECKER_INPUT_DISABLE"))
|
||||
{
|
||||
ui["safetycheck"+ rptri.toString()+"usedSOC"].hidden = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
ui["safetycheck"+ rptri.toString()+"usedSOC"].hidden = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (["F28P65x"].includes(Common.getDeviceName())) {
|
||||
for (var rptrIndex in device_driverlib_peripheral.ADC_SafetyCheckInst) {
|
||||
var currentRPTR = device_driverlib_peripheral.ADC_SafetyCheckInst[rptrIndex].name
|
||||
let rptri = (currentRPTR).replace(/[^0-9]/g,'')
|
||||
config= config.concat ([
|
||||
{
|
||||
name:"safetychecker"+ rptri.toString(),
|
||||
displayName: "Selector "+ rptri.toString() + " Configurations",
|
||||
longDescription: "",
|
||||
collapsed: true,
|
||||
config:
|
||||
[
|
||||
|
||||
{
|
||||
name: "safetycheck"+ rptri.toString()+"ADC",
|
||||
displayName : "ADC Instance",
|
||||
description : 'Select the ADC for this safety checker module',
|
||||
default : device_driverlib_peripheral.ADC_Select[0].name,
|
||||
options : device_driverlib_peripheral.ADC_Select,
|
||||
},
|
||||
{
|
||||
name: "safetycheck"+ rptri.toString()+"inputSource",
|
||||
displayName: "Input Source"+ rptri.toString(),
|
||||
hidden : false,
|
||||
default : device_driverlib_peripheral.ADC_SafetyCheckerInput[0].name,
|
||||
options : device_driverlib_peripheral.ADC_SafetyCheckerInput,
|
||||
onChange : onChangesafetychecker,
|
||||
},
|
||||
{
|
||||
name: "safetycheck"+ rptri.toString()+"ResultSelect",
|
||||
displayName : "Result "+ rptri.toString(),
|
||||
description : 'Select the result for the safety checker module',
|
||||
default : device_driverlib_peripheral.ADC_ResultSelect[0].name,
|
||||
options : device_driverlib_peripheral.ADC_ResultSelect
|
||||
},
|
||||
{
|
||||
name: "safetycheck"+ rptri.toString()+"usedSOC",
|
||||
displayName : "Selected Source",
|
||||
description : 'Selected SOCs for Selector '+ rptri.toString(),
|
||||
hidden : true,
|
||||
default :"",
|
||||
getValue : (inst) =>{
|
||||
let adc = system.modules["/driverlib/adc.js"];
|
||||
var selectedsource= "";
|
||||
if (adc!=null)
|
||||
{
|
||||
for ( var adc_inst of adc.$instances)
|
||||
{
|
||||
if (adc_inst.adcBase.replace("_BASE","").replace("ADC","") ==
|
||||
inst["safetycheck"+ rptri.toString()+"ADC"].replace("ADC_","") )
|
||||
for(var socIndex in device_driverlib_peripheral.ADC_SOCNumber)
|
||||
{
|
||||
var currentSOC = device_driverlib_peripheral.ADC_SOCNumber[socIndex].name
|
||||
var soci = (currentSOC).replace(/[^0-9]/g,'')
|
||||
var resi= inst["safetycheck"+ rptri.toString()+"ResultSelect"].replace(/[^0-9]/g,'')
|
||||
//return adc_inst.enabledSOCs.toString().replace("ADC_","").replace("_NUMBER"," number ").replace("SOC","SOC/EOC")
|
||||
// if((adc_inst.enabledPPBs).includes(currentPPB)){
|
||||
if((adc_inst.enabledSOCs).includes(currentSOC) && (inst["safetycheck"+ rptri.toString()+"inputSource"]=="ADC_SAFETY_CHECKER_INPUT_SOCx"))
|
||||
{
|
||||
if (resi==soci)
|
||||
{
|
||||
selectedsource= "SOC"+soci.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(var ppbIndex in device_driverlib_peripheral.ADC_PPBNumber)
|
||||
{
|
||||
var currentPPB = device_driverlib_peripheral.ADC_PPBNumber[ppbIndex].name
|
||||
var ppbi = (currentPPB).replace(/[^0-9]/g,'')
|
||||
var resi= inst["safetycheck"+ rptri.toString()+"ResultSelect"].replace(/[^0-9]/g,'')
|
||||
var highPPB = "";
|
||||
if((adc_inst.enabledPPBs).includes(currentPPB) && ((inst["safetycheck"+ rptri.toString()+"inputSource"]=="ADC_SAFETY_CHECKER_INPUT_PPBx")||(inst["safetycheck"+ rptri.toString()+"inputSource"]=="ADC_SAFETY_CHECKER_INPUT_PPBSUMx")))
|
||||
{
|
||||
if (resi == adc_inst["ppb" + ppbi.toString() + "SOCNumber"].replace(/[^0-9]/g,''))
|
||||
{
|
||||
// highPPB+=adc_inst["ppb" + ppbi.toString() + "Name"];
|
||||
highPPB+=adc_inst["ppb" + ppbi.toString() + "SOCNumber"]
|
||||
selectedsource = adc_inst["ppb" + ppbi.toString() + "SOCNumber"].replace("ADC_","").replace("_NUMBER","")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return selectedsource;
|
||||
}
|
||||
},
|
||||
]
|
||||
},
|
||||
])
|
||||
}
|
||||
}
|
||||
config = config.concat([
|
||||
{
|
||||
name: "enableSafetychecker",
|
||||
displayName : "Enable Safety Checker During Initilization",
|
||||
description : 'Enable Safety Checker during initilization',
|
||||
hidden : false,
|
||||
default : false,
|
||||
// onChange :onChangesafetychecker,
|
||||
},
|
||||
])
|
||||
|
||||
|
||||
function onValidateStatic(mod, stat)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
function filterHardware(component)
|
||||
{
|
||||
return (Common.typeMatches(component.type, ["ADC"]));
|
||||
}
|
||||
|
||||
function modules(inst)
|
||||
{
|
||||
if (inst) {
|
||||
return [
|
||||
{
|
||||
name: "adcPullInTemplateDot",
|
||||
moduleName: "/driverlib/adc/templates/adc.dot.dynamic.js",
|
||||
}
|
||||
];
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
|
||||
|
||||
function onValidate(inst, validation) {
|
||||
|
||||
//
|
||||
// Check copy safety Checker Instances
|
||||
//
|
||||
var usedADCSCInsts = [];
|
||||
for (var instance_index in inst.$module.$instances)
|
||||
{
|
||||
var instance_obj = inst.$module.$instances[instance_index];
|
||||
usedADCSCInsts.push(instance_obj.adcscBase);
|
||||
}
|
||||
|
||||
var otherContexts = Common.getOtherContextNames()
|
||||
for (var cntx of otherContexts)
|
||||
{
|
||||
var onOtherCntx = Common.getModuleForCore(inst.$module.$name, cntx);
|
||||
if (onOtherCntx)
|
||||
{
|
||||
for (var instance_index in onOtherCntx.$instances)
|
||||
{
|
||||
var instance_obj = onOtherCntx.$instances[instance_index];
|
||||
usedADCSCInsts.push(instance_obj.adcscBase);
|
||||
}
|
||||
}
|
||||
}
|
||||
var duplicatesResult = Common.findDuplicates(usedADCSCInsts)
|
||||
|
||||
if (duplicatesResult.duplicates.length != 0)
|
||||
{
|
||||
var allDuplicates = "";
|
||||
for (var duplicateNamesIndex in duplicatesResult.duplicates)
|
||||
{
|
||||
allDuplicates = allDuplicates + Common.stringOrEmpty(allDuplicates, ", ")
|
||||
+ duplicatesResult.duplicates[duplicateNamesIndex];
|
||||
}
|
||||
validation.logError(
|
||||
"The ADC Safety Checker Instance used. Duplicates: " + allDuplicates,
|
||||
inst, "adcscBase");
|
||||
}
|
||||
//
|
||||
// Check duplicate ADC sources
|
||||
//
|
||||
let adc = system.modules["/driverlib/adc.js"];
|
||||
|
||||
if (adc!=null)
|
||||
{
|
||||
var usedADCInsts = [];
|
||||
for (var instance_index in adc.$instances)
|
||||
{
|
||||
var instance_obj = adc.$instances[instance_index];
|
||||
usedADCInsts.push(instance_obj.adcBase);
|
||||
}
|
||||
for(var rptrIndex in device_driverlib_peripheral.ADC_SafetyCheckInst) {
|
||||
var currentRPTR = device_driverlib_peripheral.ADC_SafetyCheckInst[rptrIndex].name
|
||||
let rptri = (currentRPTR).replace(/[^0-9]/g,'')
|
||||
if(!(usedADCInsts.includes(inst["safetycheck"+ rptri.toString()+"ADC"].replace("ADC_","ADC")+"_BASE"))){
|
||||
validation.logError(
|
||||
"This ADC Instance has not been configured. If you want to use this ADC, you can set it up via ADC module.",
|
||||
inst, "safetycheck"+ rptri.toString()+"ADC");
|
||||
}
|
||||
}
|
||||
for ( var adc_inst of adc.$instances)
|
||||
{
|
||||
if ((inst["safetycheck1usedSOC"]!=null)&&(inst["safetycheck2usedSOC"]!=null)) {
|
||||
var usedSOC1 =inst["safetycheck1ResultSelect"].replace(/[^0-9]/g,'')
|
||||
var usedSOC2 =inst["safetycheck2ResultSelect"].replace(/[^0-9]/g,'')
|
||||
var selectedSOC1 = inst["safetycheck1ResultSelect"].replace("RESULT","SOC_NUMBER")
|
||||
var selectedSOC2 = inst["safetycheck2ResultSelect"].replace("RESULT","SOC_NUMBER")
|
||||
//
|
||||
// Check the source for SOC
|
||||
//
|
||||
if ((adc_inst.enabledSOCs).includes(selectedSOC1)&&(adc_inst.enabledSOCs).includes(selectedSOC2)&&(inst["safetycheck1inputSource"]=="ADC_SAFETY_CHECKER_INPUT_SOCx")&&
|
||||
(inst["safetycheck2inputSource"]=="ADC_SAFETY_CHECKER_INPUT_SOCx")) {
|
||||
//channel
|
||||
if (adc_inst["soc"+ usedSOC1.toString()+"Channel"]==adc_inst["soc"+ usedSOC2.toString()+"Channel"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Same channel has been selected for SOC of Selector 1 and Selector 2. For safety checking, you need to have different channels.",
|
||||
inst, "safetycheck2usedSOC");
|
||||
}
|
||||
//trigger
|
||||
if (!(adc_inst.enableBurstMode)) {
|
||||
if ((adc_inst["soc"+ usedSOC1.toString()+"Triggermode"]=="singlemode")&&(adc_inst["soc"+ usedSOC2.toString()+"Triggermode"]=="singlemode"))
|
||||
{
|
||||
if (adc_inst["soc"+ usedSOC1.toString()+"Trigger"]!=adc_inst["soc"+ usedSOC2.toString()+"Trigger"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"To get the accurate performance of Safety Checker, same SOC Trigger should be selected for Selector 1 and Selector 2.",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
}
|
||||
if (!((adc_inst["soc"+ usedSOC1.toString()+"Triggermode"]=="singlemode")^(adc_inst["soc"+ usedSOC2.toString()+"Triggermode"]=="repeatermode")) )
|
||||
{
|
||||
validation.logWarning(
|
||||
"To get the accurate performance of Safety Checker, same Trigger Mode should be selected for SOC of Selector 1 and Selector 2.",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
if ((adc_inst["soc"+ usedSOC1.toString()+"Triggermode"]=="repeatermode")&&(adc_inst["soc"+ usedSOC2.toString()+"Triggermode"]=="repeatermode")) {
|
||||
if (((adc_inst["soc"+ usedSOC1.toString()+"Trigger"]=="ADC_TRIGGER_REPEATER1" )&&(adc_inst["soc"+ usedSOC2.toString()+"Trigger"]=="ADC_TRIGGER_REPEATER2"))||
|
||||
((adc_inst["soc"+ usedSOC1.toString()+"Trigger"]=="ADC_TRIGGER_REPEATER2" )&&(adc_inst["soc"+ usedSOC2.toString()+"Trigger"]=="ADC_TRIGGER_REPEATER1"))) {
|
||||
if (adc_inst["repeater1 Trigger"]!=adc_inst["repeater2 Trigger"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"To get the accurate performance of Safety Checker, you need to make sure same Triger is selected for repeater modules 1 and 2 associated with SOCs of Selector 1 and Selector 2.",
|
||||
inst, "safetycheck2usedSOC");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//sampling time
|
||||
if (adc_inst["soc"+ usedSOC1.toString()+"CalculatedSampleTime"]!=adc_inst["soc"+ usedSOC2.toString()+"CalculatedSampleTime"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"To get the accurate performance of Safety Checker, the sample time should be identical for Selected SOC in Selector 1 and Selector 2.",
|
||||
inst, "safetycheck2usedSOC");
|
||||
}
|
||||
if (adc_inst["soc"+ usedSOC1.toString()+"SampleTime"]!=adc_inst["soc"+ usedSOC2.toString()+"SampleTime"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"To get the accurate performance of Safety Checker, the sample time should be identical for Selected SOC in Selector 1 and Selector 2.",
|
||||
inst, "safetycheck2usedSOC");
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
// Check the source for PPB
|
||||
//
|
||||
if ((inst["safetycheck1inputSource"]=="ADC_SAFETY_CHECKER_INPUT_PPBx")&&(inst["safetycheck2inputSource"]=="ADC_SAFETY_CHECKER_INPUT_PPBx")) {
|
||||
var res1= inst["safetycheck1ResultSelect"].replace(/[^0-9]/g,'')
|
||||
var res2= inst["safetycheck2ResultSelect"].replace(/[^0-9]/g,'')
|
||||
var ppbsoc4= adc_inst["ppb4SOCNumber"].replace(/[^0-9]/g,'')
|
||||
var ppbsoc3= adc_inst["ppb3SOCNumber"].replace(/[^0-9]/g,'')
|
||||
var ppbsoc2= adc_inst["ppb2SOCNumber"].replace(/[^0-9]/g,'')
|
||||
var ppbsoc1= adc_inst["ppb1SOCNumber"].replace(/[^0-9]/g,'')
|
||||
if ((inst.safetycheck1usedSOC)&&(inst.safetycheck2usedSOC)) {
|
||||
if (res1!=res2) {
|
||||
//
|
||||
// To do: make a function to handle this section
|
||||
//
|
||||
// for (let xbari=1; xbari< 5; xbari++){
|
||||
// if ((adc_inst.enabledPPBs).includes("ADC_PPB_NUMBER"+xbari)){
|
||||
|
||||
// }
|
||||
if (((adc_inst.enabledPPBs).includes("ADC_PPB_NUMBER1")&&(adc_inst.enabledPPBs).includes("ADC_PPB_NUMBER2"))&&(((res1==ppbsoc1)&&(res2==ppbsoc2))||(res1==ppbsoc2)&&(res2==ppbsoc1))) {
|
||||
if (adc_inst["ppb1ReferenceOffset"]!=adc_inst["ppb2ReferenceOffset"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Different Reference Offset values have been selected for PPB1 and PPB2. For safety checking, you need to make sure this setting is identical for PPB1 and PPB2",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
if (adc_inst["ppb1EnableTwosComplement"]!=adc_inst["ppb2EnableTwosComplement"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Different settings related to Invert Output have been selected for PPB1 and PPB2. For safety checking, you need to make sure this setting is identical for PPB1 and PPB2.",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
}
|
||||
if (((adc_inst.enabledPPBs).includes("ADC_PPB_NUMBER1")&&(adc_inst.enabledPPBs).includes("ADC_PPB_NUMBER3"))&&(ppbsoc3!=ppbsoc2)&&(((res1==ppbsoc1)&&(res2==ppbsoc3))||(res1==ppbsoc3)&&(res2==ppbsoc1))) {
|
||||
if (adc_inst["ppb3ReferenceOffset"]!=adc_inst["ppb1ReferenceOffset"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Different Reference Offset values have been selected for PPB1 and PPB3. For safety checking, you need to make sure this setting is identical for PPB1 and PPB3",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
if (adc_inst["ppb3EnableTwosComplement"]!=adc_inst["ppb1EnableTwosComplement"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Different settings related to Invert Output have been selected for PPB1 and PPB3. For safety checking, you need to make sure this setting is identical for PPB1 and PPB3.",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
}
|
||||
if (((adc_inst.enabledPPBs).includes("ADC_PPB_NUMBER1")&&(adc_inst.enabledPPBs).includes("ADC_PPB_NUMBER4"))&&(ppbsoc2!=ppbsoc4)&&(ppbsoc3!=ppbsoc4)&&(((res1==ppbsoc1)&&(res2==ppbsoc4))||(res1==ppbsoc4)&&(res2==ppbsoc1))) {
|
||||
if (adc_inst["ppb1ReferenceOffset"]!=adc_inst["ppb4ReferenceOffset"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Different Reference Offset values have been selected for PPB1 and PPB4. For safety checking, you need to make sure this setting is identical for PPB1 and PPB4",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
if (adc_inst["ppb1EnableTwosComplement"]!=adc_inst["ppb4EnableTwosComplement"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Different settings related to Invert Output have been selected for PPB1 and PPB4. For safety checking, you need to make sure this setting is identical for PPB1 and PPB4.",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
}
|
||||
if (((adc_inst.enabledPPBs).includes("ADC_PPB_NUMBER3")&&(adc_inst.enabledPPBs).includes("ADC_PPB_NUMBER2"))&&(res1!=ppbsoc1)&&(res2!=ppbsoc1)&&(((res1==ppbsoc2)&&(res2==ppbsoc3))||(res1==ppbsoc3)&&(res2==ppbsoc2))) {
|
||||
if (adc_inst["ppb3ReferenceOffset"]!=adc_inst["ppb2ReferenceOffset"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Different Reference Offset values have been selected for PPB3 and PPB2. For safety checking, you need to make sure this setting is identical for PPB3 and PPB2",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
if (adc_inst["ppb3EnableTwosComplement"]!=adc_inst["ppb2EnableTwosComplement"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Different settings related to Invert Output have been selected for PPB3 and PPB2. For safety checking, you need to make sure this setting is identical for PPB3 and PPB2.",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
}
|
||||
|
||||
if (((adc_inst.enabledPPBs).includes("ADC_PPB_NUMBER2")&&(adc_inst.enabledPPBs).includes("ADC_PPB_NUMBER4"))&&(res1!=ppbsoc1)&&(res2!=ppbsoc1)&&(res1!=ppbsoc3)
|
||||
&&(res2!=ppbsoc3)&&(((res1==ppbsoc4)&&(res2==ppbsoc2))||(res1==ppbsoc2)&&(res2==ppbsoc4))) {
|
||||
if (adc_inst["ppb2ReferenceOffset"]!=adc_inst["ppb4ReferenceOffset"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Different Reference Offset values have been selected for PPB2 and PPB4. For safety checking, you need to make sure this setting is identical for PPB2 and PPB4",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
if (adc_inst["ppb2EnableTwosComplement"]!=adc_inst["ppb4EnableTwosComplement"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Different settings related to Invert Output have been selected for PPB2 and PPB4. For safety checking, you need to make sure this setting is identical for PPB2 and PPB4.",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
}
|
||||
if (((adc_inst.enabledPPBs).includes("ADC_PPB_NUMBER3")&&(adc_inst.enabledPPBs).includes("ADC_PPB_NUMBER4"))&&(res1!=ppbsoc1)&&(res2!=ppbsoc1)&&(res1!=ppbsoc2)&&
|
||||
(res2!=ppbsoc2)&&(((res1==ppbsoc4)&&(res2==ppbsoc3))||(res1==ppbsoc3)&&(res2==ppbsoc4)))
|
||||
{
|
||||
if (adc_inst["ppb3ReferenceOffset"]!=adc_inst["ppb4ReferenceOffset"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Different Reference Offset values have been selected for PPB3 and PPB4. For safety checking, you need to make sure this setting is identical for PPB3 and PPB4.",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
if (adc_inst["ppb3EnableTwosComplement"]!=adc_inst["ppb4EnableTwosComplement"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Different settings related to Invert Output have been selected for PPB3 and PPB4. For safety checking, you need to make sure this setting is identical for PPB3 and PPB4.",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
// Check the source for PPBSum
|
||||
//
|
||||
if ((inst["safetycheck1inputSource"]=="ADC_SAFETY_CHECKER_INPUT_PPBSUMx")&&(inst["safetycheck2inputSource"]=="ADC_SAFETY_CHECKER_INPUT_PPBSUMx")) {
|
||||
var res1= inst["safetycheck1ResultSelect"].replace(/[^0-9]/g,'')
|
||||
var res2= inst["safetycheck2ResultSelect"].replace(/[^0-9]/g,'')
|
||||
var ppbsoc4= adc_inst["ppb4SOCNumber"].replace(/[^0-9]/g,'')
|
||||
var ppbsoc3= adc_inst["ppb3SOCNumber"].replace(/[^0-9]/g,'')
|
||||
var ppbsoc2= adc_inst["ppb2SOCNumber"].replace(/[^0-9]/g,'')
|
||||
var ppbsoc1= adc_inst["ppb1SOCNumber"].replace(/[^0-9]/g,'')
|
||||
if ((inst.safetycheck1usedSOC)&&(inst.safetycheck2usedSOC)) {
|
||||
if (res1!=res2) {
|
||||
if (((adc_inst.enabledPPBs).includes("ADC_PPB_NUMBER1")&&(adc_inst.enabledPPBs).includes("ADC_PPB_NUMBER2"))&&(((res1==ppbsoc1)&&(res2==ppbsoc2))||(res1==ppbsoc2)&&(res2==ppbsoc1))) {
|
||||
if (adc_inst["ppb1ReferenceOffset"]!=adc_inst["ppb2ReferenceOffset"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Different Reference Offset values have been selected for PPB1 and PPB2. For safety checking, you need to make sure this setting is identical for PPB1 and PPB2",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
if (adc_inst["ppb1EnableTwosComplement"]!=adc_inst["ppb2EnableTwosComplement"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Different settings related to Invert Output have been selected for PPB1 and PPB2. For safety checking, you need to make sure this setting is identical for PPB1 and PPB2.",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
if (adc_inst["ppb1Rightshift"]!=adc_inst["ppb2Rightshift"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Different Number of Bits to Right Shift PSUM have been selected for PPB1 and PPB2.For safety checking, you need to make sure this setting is identical for PPB1 and PPB2.",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
}
|
||||
if (((adc_inst.enabledPPBs).includes("ADC_PPB_NUMBER1")&&(adc_inst.enabledPPBs).includes("ADC_PPB_NUMBER3"))&&(ppbsoc3!=ppbsoc2)&&(((res1==ppbsoc1)&&(res2==ppbsoc3))||(res1==ppbsoc3)&&(res2==ppbsoc1))) {
|
||||
if (adc_inst["ppb3ReferenceOffset"]!=adc_inst["ppb1ReferenceOffset"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Different Reference Offset values have been selected for PPB1 and PPB3. For safety checking, you need to make sure this setting is identical for PPB1 and PPB3",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
if (adc_inst["ppb3EnableTwosComplement"]!=adc_inst["ppb1EnableTwosComplement"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Different settings related to Invert Output have been selected for PPB1 and PPB3. For safety checking, you need to make sure this setting is identical for PPB1 and PPB3.",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
if (adc_inst["ppb3Rightshift"]!=adc_inst["ppb1Rightshift"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Different Number of Bits to Right Shift PSUM have been selected for PPB1 and PPB3.For safety checking, you need to make sure this setting is identical for PPB1 and PPB3.",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
|
||||
}
|
||||
if (((adc_inst.enabledPPBs).includes("ADC_PPB_NUMBER1")&&(adc_inst.enabledPPBs).includes("ADC_PPB_NUMBER4"))&&(ppbsoc2!=ppbsoc4)&&(ppbsoc3!=ppbsoc4)&&(((res1==ppbsoc1)&&(res2==ppbsoc4))||(res1==ppbsoc4)&&(res2==ppbsoc1))) {
|
||||
if (adc_inst["ppb1ReferenceOffset"]!=adc_inst["ppb4ReferenceOffset"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Different Reference Offset values have been selected for PPB1 and PPB4. For safety checking, you need to make sure this setting is identical for PPB1 and PPB4",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
if (adc_inst["ppb1EnableTwosComplement"]!=adc_inst["ppb4EnableTwosComplement"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Different settings related to Invert Output have been selected for PPB1 and PPB4. For safety checking, you need to make sure this setting is identical for PPB1 and PPB4.",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
if (adc_inst["ppb1Rightshift"]!=adc_inst["ppb4Rightshift"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Different Number of Bits to Right Shift PSUM have been selected for PPB1 and PPB4.For safety checking, you need to make sure this setting is identical for PPB1 and PPB4.",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
}
|
||||
if (((adc_inst.enabledPPBs).includes("ADC_PPB_NUMBER3")&&(adc_inst.enabledPPBs).includes("ADC_PPB_NUMBER2"))&&(res1!=ppbsoc1)&&(res2!=ppbsoc1)&&(((res1==ppbsoc2)&&(res2==ppbsoc3))||(res1==ppbsoc3)&&(res2==ppbsoc2))) {
|
||||
if (adc_inst["ppb3ReferenceOffset"]!=adc_inst["ppb2ReferenceOffset"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Different Reference Offset values have been selected for PPB3 and PPB2. For safety checking, you need to make sure this setting is identical for PPB3 and PPB2",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
if (adc_inst["ppb3EnableTwosComplement"]!=adc_inst["ppb2EnableTwosComplement"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Different settings related to Invert Output have been selected for PPB3 and PPB2. For safety checking, you need to make sure this setting is identical for PPB3 and PPB2.",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
if (adc_inst["ppb3Rightshift"]!=adc_inst["ppb2Rightshift"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Different Number of Bits to Right Shift PSUM have been selected for PPB3 and PPB2.For safety checking, you need to make sure this setting is identical for PPB3 and PPB2.",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
}
|
||||
|
||||
if (((adc_inst.enabledPPBs).includes("ADC_PPB_NUMBER2")&&(adc_inst.enabledPPBs).includes("ADC_PPB_NUMBER4"))&&(res1!=ppbsoc1)&&(res2!=ppbsoc1)&&(res1!=ppbsoc3)&&(res2!=ppbsoc3)&&(((res1==ppbsoc4)&&(res2==ppbsoc2))||(res1==ppbsoc2)&&(res2==ppbsoc4))) {
|
||||
if (adc_inst["ppb2ReferenceOffset"]!=adc_inst["ppb4ReferenceOffset"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Different Reference Offset values have been selected for PPB2 and PPB4. For safety checking, you need to make sure this setting is identical for PPB2 and PPB4",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
if (adc_inst["ppb2EnableTwosComplement"]!=adc_inst["ppb4EnableTwosComplement"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Different settings related to Invert Output have been selected for PPB2 and PPB4. For safety checking, you need to make sure this setting is identical for PPB2 and PPB4.",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
if (adc_inst["ppb2Rightshift"]!=adc_inst["ppb4Rightshift"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Different Number of Bits to Right Shift PSUM have been selected for PPB2 and PPB4.For safety checking, you need to make sure this setting is identical for PPB2 and PPB4.",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
}
|
||||
if (((adc_inst.enabledPPBs).includes("ADC_PPB_NUMBER3")&&(adc_inst.enabledPPBs).includes("ADC_PPB_NUMBER4"))&&(res1!=ppbsoc1)&&(res2!=ppbsoc1)&&(res1!=ppbsoc2)&&(res2!=ppbsoc2)&&(((res1==ppbsoc4)&&(res2==ppbsoc3))||(res1==ppbsoc3)&&(res2==ppbsoc4)))
|
||||
{
|
||||
if (adc_inst["ppb3ReferenceOffset"]!=adc_inst["ppb4ReferenceOffset"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Different Reference Offset values have been selected for PPB3 and PPB4. For safety checking, you need to make sure this setting is identical for PPB3 and PPB4.",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
if (adc_inst["ppb3EnableTwosComplement"]!=adc_inst["ppb4EnableTwosComplement"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Different settings related to Invert Output have been selected for PPB3 and PPB4. For safety checking, you need to make sure this setting is identical for PPB3 and PPB4.",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
if (adc_inst["ppb3Rightshift"]!=adc_inst["ppb4Rightshift"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Different Number of Bits to Right Shift PSUM have been selected for PPB3 and PPB4.For safety checking, you need to make sure this setting is identical for PPB3 and PPB4.",
|
||||
inst, "safetycheck1usedSOC");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(var rptrIndex in device_driverlib_peripheral.ADC_SafetyCheckInst) {
|
||||
var currentRPTR = device_driverlib_peripheral.ADC_SafetyCheckInst[rptrIndex].name
|
||||
let rptri = (currentRPTR).replace(/[^0-9]/g,'')
|
||||
if ((inst["safetycheck"+ rptri.toString()+"usedSOC"]!="")&&(adc_inst.adcBase.replace("_BASE", "")==inst["safetycheck"+ rptri.toString()+"ADC"].replace("ADC_","ADC"))) {
|
||||
if (inst["safetycheck"+ rptri.toString()+"inputSource"]=="ADC_SAFETY_CHECKER_INPUT_SOCx")
|
||||
{
|
||||
var selectedSOC = inst ["safetycheck"+rptri.toString()+"usedSOC"].replace(/[^0-9]/g,'')
|
||||
validation.logInfo(
|
||||
"You can change settings of Input Source for Selector "+ rptri.toString()+ " via"+ ": " + system.getReference(adc_inst,"soc"+selectedSOC.toString()+"Name"),
|
||||
inst, "safetycheck"+ rptri.toString()+"usedSOC");
|
||||
}
|
||||
if ((inst["safetycheck"+ rptri.toString()+"inputSource"]=="ADC_SAFETY_CHECKER_INPUT_PPBx")||(inst["safetycheck"+ rptri.toString()+"inputSource"]=="ADC_SAFETY_CHECKER_INPUT_PPBSUMx")) {
|
||||
for(var ppbIndex in device_driverlib_peripheral.ADC_PPBNumber) {
|
||||
var currentPPB = device_driverlib_peripheral.ADC_PPBNumber[ppbIndex].name
|
||||
var ppbi = (currentPPB).replace(/[^0-9]/g,'')
|
||||
var resi= inst["safetycheck"+ rptri.toString()+"ResultSelect"].replace(/[^0-9]/g,'')
|
||||
let higherPPB="";
|
||||
if (resi==adc_inst["ppb" + ppbi.toString() + "SOCNumber"].replace(/[^0-9]/g,'')){
|
||||
if (adc_inst.enabledPPBs.includes("ADC_PPB_NUMBER1")) {
|
||||
if ((currentPPB=="ADC_PPB_NUMBER4")&&(adc_inst["ppb4SOCNumber"]!=adc_inst["ppb3SOCNumber"])&&(adc_inst["ppb4SOCNumber"]!=adc_inst["ppb2SOCNumber"])&&(adc_inst["ppb4SOCNumber"]!=adc_inst["ppb1SOCNumber"])) {
|
||||
higherPPB= "ppb4Name";
|
||||
validation.logInfo(
|
||||
"SOC"+resi.toString()+" is used in PPB4. You can change settings of Input Source for Selector "+ rptri.toString()+ " via"+ ": " + system.getReference(adc_inst,higherPPB),
|
||||
inst, "safetycheck"+ rptri.toString()+"usedSOC" );
|
||||
}
|
||||
if ((currentPPB=="ADC_PPB_NUMBER3")&&(adc_inst["ppb3SOCNumber"]!=adc_inst["ppb2SOCNumber"])&&(adc_inst["ppb3SOCNumber"]!=adc_inst["ppb1SOCNumber"])) {
|
||||
higherPPB= "ppb3Name";
|
||||
validation.logInfo(
|
||||
"SOC"+resi.toString()+" is used in PPB3. You can change settings of Input Source for Selector "+ rptri.toString()+ " via"+ ": " + system.getReference(adc_inst,higherPPB),
|
||||
inst, "safetycheck"+ rptri.toString()+"usedSOC" );
|
||||
}
|
||||
if ((currentPPB=="ADC_PPB_NUMBER2")&&(adc_inst["ppb1SOCNumber"]!=adc_inst["ppb2SOCNumber"])) {
|
||||
higherPPB= "ppb2Name";
|
||||
validation.logInfo(
|
||||
"SOC"+resi.toString()+" is used in PPB2. You can change settings of Input Source for Selector "+ rptri.toString()+ " via"+ ": " + system.getReference(adc_inst,higherPPB),
|
||||
inst, "safetycheck"+ rptri.toString()+"usedSOC" );
|
||||
}
|
||||
if ((currentPPB=="ADC_PPB_NUMBER1")) {
|
||||
higherPPB= "ppb1Name";
|
||||
validation.logInfo(
|
||||
"SOC"+resi.toString()+" is used in PPB1. You can change settings of Input Source for Selector "+ rptri.toString()+ " via"+ ": " + system.getReference(adc_inst,higherPPB),
|
||||
inst, "safetycheck"+ rptri.toString()+"usedSOC" );
|
||||
}
|
||||
}
|
||||
if (!(adc_inst.enabledPPBs.includes("ADC_PPB_NUMBER1"))) {
|
||||
if (adc_inst.enabledPPBs.includes("ADC_PPB_NUMBER2")) {
|
||||
if (currentPPB=="ADC_PPB_NUMBER2") {
|
||||
higherPPB= "ppb2Name";
|
||||
validation.logInfo(
|
||||
"SOC"+resi.toString()+" is used in PPB2. You can change settings of Input Source for Selector "+ rptri.toString()+ " via"+ ": " + system.getReference(adc_inst,higherPPB),
|
||||
inst, "safetycheck"+ rptri.toString()+"usedSOC" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!(adc_inst.enabledPPBs.includes("ADC_PPB_NUMBER1"))) {
|
||||
if (!(adc_inst.enabledPPBs.includes("ADC_PPB_NUMBER2"))||(resi!=adc_inst["ppb2" + "SOCNumber"].replace(/[^0-9]/g,''))) {
|
||||
if (adc_inst.enabledPPBs.includes("ADC_PPB_NUMBER3")){
|
||||
if (currentPPB=="ADC_PPB_NUMBER3")
|
||||
{
|
||||
higherPPB= "ppb3Name";
|
||||
validation.logInfo(
|
||||
"SOC "+resi.toString()+" is used in PPB3. You can change settings of Input Source for Selector "+ rptri.toString()+ " via"+ ": " + system.getReference(adc_inst,higherPPB),
|
||||
inst, "safetycheck"+ rptri.toString()+"usedSOC" );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!(adc_inst.enabledPPBs.includes("ADC_PPB_NUMBER1"))) {
|
||||
if (!(adc_inst.enabledPPBs.includes("ADC_PPB_NUMBER3"))) {
|
||||
if (adc_inst.enabledPPBs.includes("ADC_PPB_NUMBER4")) {
|
||||
if (currentPPB=="ADC_PPB_NUMBER4") {
|
||||
higherPPB= "ppb4Name";
|
||||
validation.logInfo(
|
||||
"SOC"+resi.toString()+" is used in PPB4. You can change settings of Input Source for Selector "+ rptri.toString()+ " via"+ ": " + system.getReference(adc_inst,higherPPB),
|
||||
inst, "safetycheck"+ rptri.toString()+"usedSOC" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for(var rptrIndex in device_driverlib_peripheral.ADC_SafetyCheckInst) {
|
||||
var currentRPTR = device_driverlib_peripheral.ADC_SafetyCheckInst[rptrIndex].name
|
||||
let rptri = (currentRPTR).replace(/[^0-9]/g,'')
|
||||
if ((inst["safetycheck"+ rptri.toString()+"usedSOC"]=="") && (inst["safetycheck"+ rptri.toString()+"inputSource"] != "ADC_SAFETY_CHECKER_INPUT_DISABLE")) {
|
||||
validation.logWarning(
|
||||
"There is no Input Source configured for this Result",
|
||||
inst, "safetycheck"+ rptri.toString()+"usedSOC");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if ((inst["safetycheck1inputSource"] != "ADC_SAFETY_CHECKER_INPUT_DISABLE")||(inst["safetycheck2inputSource"] != "ADC_SAFETY_CHECKER_INPUT_DISABLE")){
|
||||
if (inst["safetycheck1inputSource"] != inst["safetycheck2inputSource"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Same Input Source should be selected for Selector 1 and Selector 2",
|
||||
inst, "safetycheck2inputSource");
|
||||
}
|
||||
if ((inst["safetycheck1ResultSelect"] == inst["safetycheck2ResultSelect"]) &&
|
||||
(inst["safetycheck1ADC"] == inst["safetycheck2ADC"]))
|
||||
{
|
||||
validation.logWarning(
|
||||
"Different Result should be selected for Selector 1 and Selector 2 when the same ADC instance is used for both",
|
||||
inst, "safetycheck1ResultSelect");
|
||||
}
|
||||
if (inst["safetyCheckTolerance"] < 0)
|
||||
{
|
||||
validation.logError(
|
||||
"Tolerance must be larger than 0",
|
||||
inst, "safetyCheckTolerance");
|
||||
}
|
||||
if (!Number.isInteger(inst["safetyCheckTolerance"]))
|
||||
{
|
||||
validation.logError(
|
||||
"Tolerance must be an integer value",
|
||||
inst, "safetyCheckTolerance");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var adcscModule = {
|
||||
peripheralName: "ADCSafetyChecker",
|
||||
displayName: "ADC SAFETY CHECKER",
|
||||
maxInstances: maxInstances,
|
||||
defaultInstanceName: "myADCSafetyChecker",
|
||||
description: "ADC Safety Checker Module",
|
||||
longDescription: (Common.getCollateralFindabilityList("ADC")),
|
||||
filterHardware : filterHardware,
|
||||
config: config,
|
||||
templates: {
|
||||
boardc : "/driverlib/adc/adcsc.board.c.xdt",
|
||||
boardh : "/driverlib/adc/adcsc.board.h.xdt"
|
||||
},
|
||||
|
||||
modules : modules,
|
||||
validate : onValidate,
|
||||
};
|
||||
|
||||
exports = adcscModule;
|
||||
@@ -0,0 +1,179 @@
|
||||
let Common = system.getScript("/driverlib/Common.js");
|
||||
let Pinmux = system.getScript("/driverlib/pinmux.js");
|
||||
|
||||
let device_driverlib_peripheral =
|
||||
system.getScript("/driverlib/device_driverlib_peripherals/" +
|
||||
Common.getDeviceName().toLowerCase() + "_gpio.js");
|
||||
|
||||
/* Intro splash on GUI */
|
||||
let longDescription = "A AIO peripheral is used to translate data between " +
|
||||
"the chip and a serial port. The SCI driver simplifies reading " +
|
||||
"and writing to any of the UART peripherals on the board, with " +
|
||||
"multiple modes of operation and performance. These include " +
|
||||
"blocking, non-blocking, and polling, as well as text/binary " +
|
||||
"mode, echo and return characters.";
|
||||
|
||||
/* Array of SCI configurables that are common across device families */
|
||||
let config = [
|
||||
|
||||
{
|
||||
name : "direction",
|
||||
displayName : "AIO Direction",
|
||||
description : 'Only supports input.',
|
||||
hidden : false,
|
||||
default : 'IN',
|
||||
options : [
|
||||
{ name: "IN" }
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
name : "padConfig",
|
||||
displayName : "Pin Type",
|
||||
description : 'Type of pin is driving the gpio.',
|
||||
hidden : false,
|
||||
default : 'STD',
|
||||
options : [
|
||||
{ name: "STD", displayName : "Push-pull output/floating input" },
|
||||
{ name: "PULLUP", displayName : "Push-pull output/pull-up enabled on input" },
|
||||
{ name: "INVERT", displayName : "Push-pull output/floating INVERTED polarity on an input" },
|
||||
{ name: "PULLUP_INVERT", displayName : "Push-pull output/pull-up enabled on INVERTED input" },
|
||||
{ name: "OD", displayName : "Open-drain output/floating input" },
|
||||
{ name: "OD_PULLUP", displayName : "Open-drain output with pull-up enabled output and input" },
|
||||
{ name: "OD_INVERT", displayName : "Open-drain output/floating inverted input" },
|
||||
{ name: "OD_PULLUP_INVERT", displayName : "Open-drain output with pull-up enabled output and INVERTED input" }
|
||||
]
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
name : "qualMode",
|
||||
displayName : "Qualification Mode",
|
||||
description : 'The type of qualification done on the pin.',
|
||||
hidden : false,
|
||||
default : device_driverlib_peripheral.GPIO_QualificationMode[0].name,
|
||||
options : device_driverlib_peripheral.GPIO_QualificationMode
|
||||
},
|
||||
|
||||
{
|
||||
name : "GROUP_XINT",
|
||||
displayName : "External Interrupts",
|
||||
description : 'Connect to an XINT for interrupts',
|
||||
config : [
|
||||
{
|
||||
name : "useInterrupt",
|
||||
displayName : "Use Interrupts",
|
||||
description : 'Connect to an XINT for interrupts',
|
||||
hidden : false,
|
||||
default : false
|
||||
},
|
||||
]
|
||||
},
|
||||
];
|
||||
|
||||
if (!["F28002x", "F280013x", "F280015x"].includes(Common.getDeviceName()))
|
||||
{
|
||||
var coreSelectConfig = {
|
||||
name : "controllerCore",
|
||||
legacyNames : ["masterCore"],
|
||||
displayName : "Core Select",
|
||||
description : 'Who owns the GPIO.',
|
||||
hidden : false,
|
||||
default : device_driverlib_peripheral.GPIO_CoreSelect[0].name,
|
||||
options : device_driverlib_peripheral.GPIO_CoreSelect
|
||||
};
|
||||
config.push(coreSelectConfig)
|
||||
}
|
||||
|
||||
/*
|
||||
* ======== filterHardware ========
|
||||
* Control RX, TX Pin usage by the user specified dataDirection.
|
||||
*
|
||||
* param component - hardware object describing signals and
|
||||
* resources they're attached to
|
||||
*
|
||||
* returns Boolean indicating whether or not to allow the component to
|
||||
* be assigned to an instance's $hardware config
|
||||
*/
|
||||
function filterHardware(component)
|
||||
{
|
||||
return (Common.typeMatches(component.type, ["AIO"]));
|
||||
}
|
||||
|
||||
function moduleInstances(inst)
|
||||
{
|
||||
var ownedMods = []
|
||||
|
||||
if (inst.useInterrupt)
|
||||
{
|
||||
//GROUP_XINT
|
||||
ownedMods.push({
|
||||
name: "xint",
|
||||
displayName: "XINT",
|
||||
moduleName: "/driverlib/xint.js",
|
||||
collapsed: true,
|
||||
group: "GROUP_XINT",
|
||||
requiredArgs: {
|
||||
$name : inst.$name + "_XINT",
|
||||
}
|
||||
})
|
||||
}
|
||||
return ownedMods
|
||||
}
|
||||
|
||||
function onValidatePinmux(inst, validation) {
|
||||
if (inst.useInterrupt){
|
||||
var xint = inst.xint;
|
||||
var xintNum = xint.xintNum;
|
||||
var inputxbar = xint.inputxbar;
|
||||
|
||||
if (inst.aioPin.$solution)
|
||||
{
|
||||
var selectedAIOPeripheral = inst.aioPin.$solution.peripheralPinName;
|
||||
if (!selectedAIOPeripheral)
|
||||
{
|
||||
selectedAIOPeripheral = inst.aioPin.$solution.peripheralName
|
||||
}
|
||||
if (selectedAIOPeripheral != inputxbar["inputxbarGpio"])
|
||||
{
|
||||
validation.logWarning(
|
||||
"Select " + selectedAIOPeripheral + " which is the selection in your AIO PinMux entry.",
|
||||
inputxbar, "inputxbarGpio");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
validation.logInfo(
|
||||
"Select " + "the same AIO" + " as the one in your AIO PinMux entry.",
|
||||
inputxbar, "inputxbarGpio");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Common.onlyPinmux())
|
||||
{
|
||||
config = [];
|
||||
}
|
||||
var aioModule = {
|
||||
peripheralName: "AIO",
|
||||
displayName: "AIO",
|
||||
maxInstances: Common.peripheralCount("AIO"),
|
||||
defaultInstanceName: "myAIO",
|
||||
description: "Analog IO Interface Peripheral",
|
||||
filterHardware : filterHardware,
|
||||
moduleInstances: moduleInstances,
|
||||
config: config,
|
||||
templates: {
|
||||
boardc : "/driverlib/aio/aio.board.c.xdt",
|
||||
boardh : "/driverlib/aio/aio.board.h.xdt"
|
||||
},
|
||||
pinmuxRequirements : Pinmux.aioPinmuxRequirements,
|
||||
validatePinmux: onValidatePinmux
|
||||
};
|
||||
|
||||
if (aioModule.maxInstances <= 0)
|
||||
{
|
||||
delete aioModule.pinmuxRequirements;
|
||||
}
|
||||
|
||||
exports = aioModule;
|
||||
@@ -0,0 +1,61 @@
|
||||
% var module = system.modules['/driverlib/aio.js'];
|
||||
% let Common = system.getScript("/driverlib/Common.js");
|
||||
//*****************************************************************************
|
||||
//
|
||||
// AIO Configurations
|
||||
//
|
||||
//*****************************************************************************
|
||||
void `module.peripheralName`_init(){
|
||||
% for(var i = 0; i < module.$instances.length; i++)
|
||||
% {
|
||||
% var instance = module.$instances[i];
|
||||
`instance.$name`_init();
|
||||
% }
|
||||
}
|
||||
|
||||
%if (module != null)
|
||||
%{
|
||||
% for(var i = 0; i < module.$instances.length; i++) {
|
||||
% var instance = module.$instances[i];
|
||||
void `instance.$name`_init(){
|
||||
GPIO_setAnalogMode(`instance.$name`, GPIO_ANALOG_DISABLED);
|
||||
GPIO_setDirectionMode(`instance.$name`, GPIO_DIR_MODE_IN);
|
||||
%if(instance.padConfig == "STD")
|
||||
%{
|
||||
GPIO_setPadConfig(`instance.$name`, GPIO_PIN_TYPE_`instance.padConfig`);
|
||||
%}
|
||||
%else if(instance.padConfig == "PULLUP")
|
||||
%{
|
||||
GPIO_setPadConfig(`instance.$name`, GPIO_PIN_TYPE_STD | GPIO_PIN_TYPE_PULLUP);
|
||||
%}
|
||||
%else if(instance.padConfig == "INVERT")
|
||||
%{
|
||||
GPIO_setPadConfig(`instance.$name`, GPIO_PIN_TYPE_STD | GPIO_PIN_TYPE_INVERT);
|
||||
%}
|
||||
%else if(instance.padConfig == "PULLUP_INVERT")
|
||||
%{
|
||||
GPIO_setPadConfig(`instance.$name`, GPIO_PIN_TYPE_STD | GPIO_PIN_TYPE_PULLUP | GPIO_PIN_TYPE_INVERT);
|
||||
%}
|
||||
%else if(instance.padConfig == "OD")
|
||||
%{
|
||||
GPIO_setPadConfig(`instance.$name`, GPIO_PIN_TYPE_`instance.padConfig`);
|
||||
%}
|
||||
%else if(instance.padConfig == "OD_PULLUP")
|
||||
%{
|
||||
GPIO_setPadConfig(`instance.$name`, GPIO_PIN_TYPE_OD | GPIO_PIN_TYPE_PULLUP);
|
||||
%}
|
||||
%else if(instance.padConfig == "OD_INVERT")
|
||||
%{
|
||||
GPIO_setPadConfig(`instance.$name`, GPIO_PIN_TYPE_OD | GPIO_PIN_TYPE_INVERT);
|
||||
%}
|
||||
%else if(instance.padConfig == "OD_PULLUP_INVERT")
|
||||
%{
|
||||
GPIO_setPadConfig(`instance.$name`, GPIO_PIN_TYPE_OD | GPIO_PIN_TYPE_PULLUP | GPIO_PIN_TYPE_INVERT);
|
||||
%}
|
||||
% if (!["F28002x", "F280013x", "F280015x"].includes(Common.getDeviceName())) {
|
||||
GPIO_setControllerCore(`instance.$name`, `instance.controllerCore`);
|
||||
% }
|
||||
GPIO_setQualificationMode(`instance.$name`, `instance.qualMode`);
|
||||
}
|
||||
%}
|
||||
%}
|
||||
@@ -0,0 +1,27 @@
|
||||
% var module = system.modules['/driverlib/aio.js'];
|
||||
% let Common = system.getScript("/driverlib/Common.js");
|
||||
% var contextNames = Common.getContextNames();
|
||||
% for (var cntx of contextNames) {
|
||||
% var module = Common.getModuleForCore('/driverlib/aio.js', cntx);
|
||||
%if (module != null)
|
||||
%{
|
||||
//*****************************************************************************
|
||||
//
|
||||
// AIO Configurations
|
||||
//
|
||||
//*****************************************************************************
|
||||
% for(var i = 0; i < module.$instances.length; i++) {
|
||||
% var instance = module.$instances[i];
|
||||
% let aioPin = instance.aioPin;
|
||||
% let solution = aioPin.$solution;
|
||||
% let peripheral = system.deviceData.peripherals[instance.aioPin.$solution.peripheralName];
|
||||
% var aioName = peripheral.name;
|
||||
% var gpioNumber = aioName.substring(2);
|
||||
% gpioNumber = Common.gpioNameToNumber(gpioNumber);
|
||||
#define `instance.$name` `gpioNumber`
|
||||
% if(Common.isContextCPU1()){
|
||||
void `instance.$name`_init();
|
||||
%}
|
||||
% }
|
||||
%}
|
||||
%}
|
||||
@@ -0,0 +1,67 @@
|
||||
let Common = system.getScript("/driverlib/Common.js");
|
||||
let Pinmux = system.getScript("/driverlib/pinmux.js");
|
||||
|
||||
/* Intro splash on GUI */
|
||||
let longDescription = "Analog PinMux configuration";
|
||||
|
||||
/* Array of CAN configurables that are common across device families */
|
||||
let config = [
|
||||
{
|
||||
name: "useCase",
|
||||
displayName : "Use Case",
|
||||
description : 'Peripheral use case',
|
||||
hidden : false,
|
||||
default : 'ALL',
|
||||
options : Pinmux.getPeripheralUseCaseNames("ANALOG"),
|
||||
onChange : Pinmux.useCaseChanged,
|
||||
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
/*
|
||||
* ======== filterHardware ========
|
||||
* Control RX, TX Pin usage by the user specified dataDirection.
|
||||
*
|
||||
* param component - hardware object describing signals and
|
||||
* resources they're attached to
|
||||
*
|
||||
* returns Boolean indicating whether or not to allow the component to
|
||||
* be assigned to an instance's $hardware config
|
||||
*/
|
||||
function filterHardware(component)
|
||||
{
|
||||
return (Common.typeMatches(component.type, ["ANALOG"]));
|
||||
}
|
||||
|
||||
if (Common.onlyPinmux())
|
||||
{
|
||||
config = [config[config.length - 1]];
|
||||
}
|
||||
|
||||
var analogModule = {
|
||||
peripheralName: "ANALOG",
|
||||
displayName: "ANALOG PinMux",
|
||||
maxInstances: Common.peripheralCount("ANALOG"),
|
||||
defaultInstanceName: "myANALOGPinMux",
|
||||
description: "Analog Configuration",
|
||||
filterHardware : filterHardware,
|
||||
config: config,
|
||||
templates: {
|
||||
boardc : "/driverlib/analog/analog.board.c.xdt",
|
||||
boardh : "/driverlib/analog/analog.board.h.xdt"
|
||||
},
|
||||
pinmuxRequirements : Pinmux.analogPinmuxRequirements
|
||||
};
|
||||
|
||||
|
||||
if (analogModule.maxInstances <= 0)
|
||||
{
|
||||
delete analogModule.pinmuxRequirements;
|
||||
}
|
||||
else
|
||||
{
|
||||
Pinmux.addCustomPinmuxEnumToConfig(analogModule)
|
||||
}
|
||||
|
||||
exports = analogModule;
|
||||
@@ -0,0 +1,22 @@
|
||||
% var module = system.modules['/driverlib/analog.js'];
|
||||
% let Common = system.getScript("/driverlib/Common.js");
|
||||
% var nameOfModule = "analog";
|
||||
% var nameOfPeripheral = module.peripheralName;
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Analog PinMux Configurations
|
||||
//
|
||||
//*****************************************************************************
|
||||
void `nameOfPeripheral`_init(){
|
||||
%if (module != null)
|
||||
%{
|
||||
% for(var i = 0; i < module.$instances.length; i++) {
|
||||
% var instance = module.$instances[i];
|
||||
//`instance.$name` initialization
|
||||
|
||||
% let instancePinmux = instance[nameOfModule];
|
||||
% let solution = instancePinmux.$solution;
|
||||
% let peripheral = system.deviceData.peripherals[solution.peripheralName];
|
||||
%}
|
||||
%}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
% var module = system.modules['/driverlib/analog.js'];
|
||||
%if (module != null)
|
||||
%{
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Analog PinMux Configurations
|
||||
//
|
||||
//*****************************************************************************
|
||||
% for(var i = 0; i < module.$instances.length; i++) {
|
||||
% var instance = module.$instances[i];
|
||||
% let analog = instance.analog;
|
||||
% let solution = analog.$solution;
|
||||
%let peripheral = system.deviceData.peripherals[solution.peripheralName];
|
||||
% }
|
||||
%}
|
||||
%
|
||||
@@ -0,0 +1,171 @@
|
||||
let Common = system.getScript("/driverlib/Common.js");
|
||||
let Pinmux = system.getScript("/driverlib/pinmux.js");
|
||||
|
||||
let device_driverlib_peripheral =
|
||||
system.getScript("/driverlib/device_driverlib_peripherals/" +
|
||||
Common.getDeviceName().toLowerCase() + "_asysctl.js");
|
||||
|
||||
function onChangeAnalogRef(inst, ui)
|
||||
{
|
||||
if (["F28004x","F28002x", "F28003x","F280013x", "F280015x", "F28P65x", "F28P55x"].includes(Common.getDeviceName())){
|
||||
if (inst.analogReference == "INTERNAL"){
|
||||
ui.analogReferenceVoltage.hidden = false
|
||||
}
|
||||
else {
|
||||
ui.analogReferenceVoltage.hidden = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Array of CAN configurables that are common across device families */
|
||||
let staticConfig = [
|
||||
{
|
||||
name: "GROUP_TEMP_CONTROL",
|
||||
displayName: "Temperature Control",
|
||||
description: "",
|
||||
longDescription: "",
|
||||
collapsed: false,
|
||||
config: [
|
||||
// enableTemperatureSensor / disableTemperatureSensor
|
||||
{
|
||||
name: "enableTemperatureSensor",
|
||||
displayName : "Enable Temperature Sensor",
|
||||
default: false,
|
||||
},
|
||||
// lockTemperatureSensor
|
||||
{
|
||||
name: "lockTemperatureSensor",
|
||||
displayName : "Lock Temperature Sensor Control Register",
|
||||
default: false,
|
||||
},
|
||||
]
|
||||
},
|
||||
];
|
||||
|
||||
//**************************************************************************
|
||||
// analogReference OPTIONS - choose which device+package combinations have
|
||||
// only one reference mode option
|
||||
|
||||
var analogReference_opts = [];
|
||||
|
||||
// Devices WITHOUT internal reference mode (no VREFHI/VREFLO pins):
|
||||
// 32pin package for F280013x+F280015x
|
||||
if ((Common.getDevicePackage() == "32RHB") && // 32pin package
|
||||
(["F280013x","F280015x"].includes(Common.getDeviceName()))) // for F280013x/15x
|
||||
{
|
||||
analogReference_opts = [
|
||||
{name: "EXTERNAL", displayName: "External"}
|
||||
];
|
||||
}
|
||||
// use below else-if statement for future devices that don't have
|
||||
// VREFHI/VREFLO, so we don't complicate the logic above
|
||||
// else if()
|
||||
// {
|
||||
// }
|
||||
// All other device+package combos that have "analogReference" option have
|
||||
// both external and internal options
|
||||
else if (["F28P55x"].includes(Common.getDeviceName()))
|
||||
{
|
||||
analogReference_opts = [
|
||||
{name: "INTERNAL", displayName: "Internal"},
|
||||
{name: "EXTERNAL", displayName: "External"},
|
||||
{name: "VDDA", displayName: "VDDA"},
|
||||
];
|
||||
}
|
||||
else
|
||||
{
|
||||
analogReference_opts = [
|
||||
{name: "INTERNAL", displayName: "Internal"},
|
||||
{name: "EXTERNAL", displayName: "External"},
|
||||
];
|
||||
}
|
||||
|
||||
if (["F28004x","F28002x", "F28003x","F280013x","F280015x", "F28P65x", "F28P55x"].includes(Common.getDeviceName()))
|
||||
{
|
||||
staticConfig.push(
|
||||
{
|
||||
name: "GROUP_ANAREF",
|
||||
displayName: "Analog Reference",
|
||||
description: "",
|
||||
longDescription: "",
|
||||
collapsed: false,
|
||||
config: [
|
||||
// setAnalogReferenceInternal / setAnalogReferenceExternal
|
||||
{
|
||||
name : "analogReference",
|
||||
displayName : "Analog Reference",
|
||||
onChange : onChangeAnalogRef,
|
||||
default : "EXTERNAL",
|
||||
options : analogReference_opts
|
||||
},
|
||||
// setAnalogReference2P5 / setAnalogReference1P65
|
||||
{
|
||||
name : "analogReferenceVoltage",
|
||||
displayName : "Analog Reference Voltage",
|
||||
hidden : true,
|
||||
default : "2P5",
|
||||
options :
|
||||
[
|
||||
{name: "2P5", displayName: "2.5V"},
|
||||
{name: "1P65", displayName: "1.65V"},
|
||||
]
|
||||
},
|
||||
]
|
||||
},
|
||||
);
|
||||
}
|
||||
if (["F28P55x","F280013x","F280015x"].includes(Common.getDeviceName()))
|
||||
{
|
||||
staticConfig.push(
|
||||
{
|
||||
name: "GROUP_COMPLDAC",
|
||||
displayName: "External DACL Enable",
|
||||
description: "",
|
||||
longDescription: "This function disables CMPSSx.COMPL and the associated DAC will act as a general purpose DAC with 11 bit resolution; enables CMPSS external DAC",
|
||||
collapsed: false,
|
||||
config: [
|
||||
{
|
||||
name : "externalDACLEnable",
|
||||
displayName : "CMPSS DACL Output Enable",
|
||||
default : false,
|
||||
},
|
||||
]
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
var sharedModuleInstances = undefined;
|
||||
|
||||
/*
|
||||
* ======== filterHardware ========
|
||||
* Control RX, TX Pin usage by the user specified dataDirection.
|
||||
*
|
||||
* param component - hardware object describing signals and
|
||||
* resources they're attached to
|
||||
*
|
||||
* returns Boolean indicating whether or not to allow the component to
|
||||
* be assigned to an instance's $hardware config
|
||||
*/
|
||||
function filterHardware(component)
|
||||
{
|
||||
return (Common.typeMatches(component.type, ["ASYSCTL"]));
|
||||
}
|
||||
|
||||
var asysctlModule = {
|
||||
peripheralName: "ASYSCTL",
|
||||
displayName: "ASYSCTL",
|
||||
maxInstances: 1,
|
||||
defaultInstanceName: "myASYSCTL",
|
||||
description: "Analog SysCtl",
|
||||
filterHardware : filterHardware,
|
||||
moduleStatic : {
|
||||
config : staticConfig,
|
||||
},
|
||||
//config: config,
|
||||
templates: {
|
||||
boardc : "/driverlib/asysctl/asysctl.board.c.xdt",
|
||||
boardh : "/driverlib/asysctl/asysctl.board.h.xdt"
|
||||
},
|
||||
};
|
||||
exports = asysctlModule;
|
||||
@@ -0,0 +1,155 @@
|
||||
% var module = system.modules['/driverlib/asysctl.js'];
|
||||
% let Common = system.getScript("/driverlib/Common.js");
|
||||
% var nameOfModule = "asysctl";
|
||||
% var nameOfPeripheral = module.peripheralName;
|
||||
//*****************************************************************************
|
||||
//
|
||||
// ASYSCTL Configurations
|
||||
//
|
||||
//*****************************************************************************
|
||||
void `nameOfPeripheral`_init(){
|
||||
%if (module != null)
|
||||
%{
|
||||
% var stat = module.$static
|
||||
//
|
||||
// `nameOfModule` initialization
|
||||
% if(stat.enableTemperatureSensor){
|
||||
//
|
||||
// Enables the temperature sensor output to the ADC.
|
||||
//
|
||||
ASysCtl_enableTemperatureSensor();
|
||||
DEVICE_DELAY_US(500);
|
||||
% }
|
||||
% else{
|
||||
//
|
||||
// Disables the temperature sensor output to the ADC.
|
||||
//
|
||||
ASysCtl_disableTemperatureSensor();
|
||||
% }
|
||||
% if(stat.lockTemperatureSensor){
|
||||
//
|
||||
// Locks the temperature sensor control register.
|
||||
//
|
||||
ASysCtl_lockTemperatureSensor();
|
||||
% }
|
||||
% if(["F28004x", "F28P65x"].includes(system.deviceData.deviceId)){
|
||||
% if(stat.analogReference == "INTERNAL"){
|
||||
//
|
||||
// Set the analog voltage reference selection to internal.
|
||||
//
|
||||
ASysCtl_setAnalogReferenceInternal( ASYSCTL_VREFHIA | ASYSCTL_VREFHIB | ASYSCTL_VREFHIC );
|
||||
% }
|
||||
% else{
|
||||
//
|
||||
// Set the analog voltage reference selection to external.
|
||||
//
|
||||
ASysCtl_setAnalogReferenceExternal( ASYSCTL_VREFHIA | ASYSCTL_VREFHIB | ASYSCTL_VREFHIC );
|
||||
% }
|
||||
% if((stat.analogReference == "INTERNAL") && (stat.analogReferenceVoltage == "2P5")){
|
||||
//
|
||||
// Set the internal analog voltage reference selection to 2.5V.
|
||||
//
|
||||
ASysCtl_setAnalogReference2P5( ASYSCTL_VREFHIA | ASYSCTL_VREFHIB | ASYSCTL_VREFHIC );
|
||||
% }
|
||||
% else if((stat.analogReference == "INTERNAL") && (stat.analogReferenceVoltage == "1P65")){
|
||||
//
|
||||
// Set the internal analog voltage reference selection to 1.65V.
|
||||
//
|
||||
ASysCtl_setAnalogReference1P65( ASYSCTL_VREFHIA | ASYSCTL_VREFHIB | ASYSCTL_VREFHIC );
|
||||
% }
|
||||
% }
|
||||
% else if(system.deviceData.deviceId.includes("F28002x")){
|
||||
% if(stat.analogReference == "INTERNAL"){
|
||||
//
|
||||
// Set the analog voltage reference selection to internal.
|
||||
//
|
||||
ASysCtl_setAnalogReferenceInternal( ASYSCTL_VREFHIA | ASYSCTL_VREFHIC );
|
||||
% }
|
||||
% else{
|
||||
//
|
||||
// Set the analog voltage reference selection to external.
|
||||
//
|
||||
ASysCtl_setAnalogReferenceExternal( ASYSCTL_VREFHIA | ASYSCTL_VREFHIC );
|
||||
% }
|
||||
% if((stat.analogReference == "INTERNAL") && (stat.analogReferenceVoltage == "2P5")){
|
||||
//
|
||||
// Set the internal analog voltage reference selection to 2.5V.
|
||||
//
|
||||
ASysCtl_setAnalogReference2P5( ASYSCTL_VREFHIA | ASYSCTL_VREFHIC );
|
||||
% }
|
||||
% else if((stat.analogReference == "INTERNAL") && (stat.analogReferenceVoltage == "1P65")){
|
||||
//
|
||||
// Set the internal analog voltage reference selection to 1.65V.
|
||||
//
|
||||
ASysCtl_setAnalogReference1P65( ASYSCTL_VREFHIA | ASYSCTL_VREFHIC );
|
||||
% }
|
||||
% }
|
||||
% else if( ["F28003x", "F280013x", "F280015x"].includes(system.deviceData.deviceId)){
|
||||
% if(stat.analogReference == "INTERNAL"){
|
||||
//
|
||||
// Set the analog voltage reference selection to internal.
|
||||
//
|
||||
ASysCtl_setAnalogReferenceInternal( ASYSCTL_VREFHI );
|
||||
% }
|
||||
% else{
|
||||
//
|
||||
// Set the analog voltage reference selection to external.
|
||||
//
|
||||
ASysCtl_setAnalogReferenceExternal( ASYSCTL_VREFHI );
|
||||
% }
|
||||
% if((stat.analogReference == "INTERNAL") && (stat.analogReferenceVoltage == "2P5")){
|
||||
//
|
||||
// Set the internal analog voltage reference selection to 2.5V.
|
||||
//
|
||||
ASysCtl_setAnalogReference2P5( ASYSCTL_VREFHI);
|
||||
% }
|
||||
% else if((stat.analogReference == "INTERNAL") && (stat.analogReferenceVoltage == "1P65")){
|
||||
//
|
||||
// Set the internal analog voltage reference selection to 1.65V.
|
||||
//
|
||||
ASysCtl_setAnalogReference1P65( ASYSCTL_VREFHI );
|
||||
% }
|
||||
% }
|
||||
% else if( ["F28P55x"].includes(system.deviceData.deviceId)){
|
||||
% if(stat.analogReference == "INTERNAL"){
|
||||
//
|
||||
// Set the analog voltage reference selection to internal.
|
||||
//
|
||||
ASysCtl_setAnalogReferenceInternal( ASYSCTL_ANAREF_INTREF_ADCA | ASYSCTL_ANAREF_INTREF_ADCB | ASYSCTL_ANAREF_INTREF_ADCC | ASYSCTL_ANAREF_INTREF_ADCD | ASYSCTL_ANAREF_INTREF_ADCE );
|
||||
% }
|
||||
% else if(stat.analogReference == "EXTERNAL"){
|
||||
//
|
||||
// Set the analog voltage reference selection to external.
|
||||
//
|
||||
ASysCtl_setAnalogReferenceExternal( ASYSCTL_ANAREF_VREFHI_ADCA | ASYSCTL_ANAREF_VREFHI_ADCB | ASYSCTL_ANAREF_VREFHI_ADCC | ASYSCTL_ANAREF_VREFHI_ADCD | ASYSCTL_ANAREF_VREFHI_ADCE );
|
||||
% }
|
||||
% else if(stat.analogReference == "VDDA"){
|
||||
//
|
||||
// Set the analog voltage reference selection to VDDA.
|
||||
//
|
||||
ASysCtl_setAnalogReferenceVDDA( ASYSCTL_ANAREF_VDDA_ADCA | ASYSCTL_ANAREF_VDDA_ADCB | ASYSCTL_ANAREF_VDDA_ADCC | ASYSCTL_ANAREF_VDDA_ADCD | ASYSCTL_ANAREF_VDDA_ADCE );
|
||||
% }
|
||||
|
||||
% if((stat.analogReference == "INTERNAL") && (stat.analogReferenceVoltage == "2P5")){
|
||||
//
|
||||
// Set the internal analog voltage reference selection to 2.5V.
|
||||
//
|
||||
ASysCtl_setAnalogReference2P5( ASYSCTL_ANAREF_ADCA | ASYSCTL_ANAREF_ADCB | ASYSCTL_ANAREF_ADCC | ASYSCTL_ANAREF_ADCD | ASYSCTL_ANAREF_ADCE );
|
||||
% }
|
||||
% else if((stat.analogReference == "INTERNAL") && (stat.analogReferenceVoltage == "1P65")){
|
||||
//
|
||||
// Set the internal analog voltage reference selection to 1.65V.
|
||||
//
|
||||
ASysCtl_setAnalogReference1P65( ASYSCTL_ANAREF_ADCA | ASYSCTL_ANAREF_ADCB | ASYSCTL_ANAREF_ADCC | ASYSCTL_ANAREF_ADCD | ASYSCTL_ANAREF_ADCE );
|
||||
% }
|
||||
% }
|
||||
%}
|
||||
%if((system.deviceData.deviceId.includes("F28P55x") || system.deviceData.deviceId.includes("F280013x") || system.deviceData.deviceId.includes("F280015x")) && (stat.externalDACLEnable == true))
|
||||
%{
|
||||
//
|
||||
// This function disables CMPSSx.COMPL and the associated DAC will act as a
|
||||
// general purpose DAC with 11 bit resolution
|
||||
//
|
||||
ASysCtl_enableCMPSSExternalDAC(ASYSCTL_CMPSS1_DACL);
|
||||
%}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
% var moduleName = "asysctl"
|
||||
% var module = system.modules['/driverlib/' + moduleName + '.js'];
|
||||
%if (module != null)
|
||||
%{
|
||||
//*****************************************************************************
|
||||
//
|
||||
// ASYSCTL Configurations
|
||||
//
|
||||
//*****************************************************************************
|
||||
% for(var i = 0; i < module.$instances.length; i++) {
|
||||
% var instance = module.$instances[i];
|
||||
% }
|
||||
%}
|
||||
@@ -0,0 +1,441 @@
|
||||
let Common = system.getScript("/driverlib/Common.js");
|
||||
let Pinmux = system.getScript("/driverlib/pinmux.js");
|
||||
|
||||
let device_driverlib_peripheral =
|
||||
system.getScript("/driverlib/device_driverlib_peripherals/" +
|
||||
Common.getDeviceName().toLowerCase() + "_bgcrc.js");
|
||||
|
||||
let BGCRC_MODE = [
|
||||
{name: "BGCRC_CRC_MODE", displayName: "CRC Mode"},
|
||||
{name: "BGCRC_SCRUB_MODE", displayName: "Scrub Mode"},
|
||||
]
|
||||
/* Intro splash on GUI */
|
||||
let longDescription = `Background Cyclic Redundancy Check (BGCRC)
|
||||
|
||||
> CRC Algorithms verify data integrity over large blocks
|
||||
> The BGCRC module computes a CRC-32 on a configurable block of memory
|
||||
- Computed is compared against golden CRC-32 value to determine pass/fail
|
||||
- Memory block size to be checked can be configured
|
||||
- Identifies memory faults and corruption
|
||||
|
||||
The technical description of the BGCRC module and its registers are available in the device TRM:
|
||||
`;
|
||||
|
||||
longDescription += "* [Device TRM](" + Common.getDeviceTRM() + ")";
|
||||
|
||||
var BGCRC_INSTANCE = [];
|
||||
|
||||
let INPUT_MODE_MANUAL = "MANUAL"
|
||||
let INPUT_MODE_VARIABLE = "VARIABLE"
|
||||
|
||||
let ADDRESS_INPUT_MODE = [
|
||||
{name: INPUT_MODE_MANUAL, displayName: "Manual Address"},
|
||||
{name: INPUT_MODE_VARIABLE, displayName: "Variable/Function Name"},
|
||||
]
|
||||
|
||||
if (["F28002x"].includes(Common.getDeviceName()))
|
||||
{
|
||||
BGCRC_INSTANCE.push(
|
||||
{ name: "BGCRC_CPU_BASE", displayName: "BGCRC CPU"},
|
||||
)
|
||||
|
||||
}
|
||||
else if (["F2838x", "F28003x", "F28P65x", "F28P55x"].includes(Common.getDeviceName()))
|
||||
{
|
||||
BGCRC_INSTANCE.push(
|
||||
{ name: "BGCRC_CPU_BASE", displayName: "BGCRC CPU"},
|
||||
{ name: "BGCRC_CLA1_BASE", displayName: "BGCRC CLA1"}
|
||||
)
|
||||
}
|
||||
|
||||
device_driverlib_peripheral.BGCRC_NMI[0].displayName = "Generate NMI";
|
||||
device_driverlib_peripheral.BGCRC_NMI[1].displayName = "Generate non-NMI Interrupt";
|
||||
device_driverlib_peripheral.BGCRC_EMUCTRL[0].displayName = "Soft - stops upon halt";
|
||||
device_driverlib_peripheral.BGCRC_EMUCTRL[1].displayName = "Free - continues running";
|
||||
|
||||
function onChangeStartAddressInputMode(inst,ui)
|
||||
{
|
||||
if (inst.startAddrInputMode == INPUT_MODE_MANUAL) {
|
||||
ui.startAddr.hidden = false
|
||||
ui.startAddrVariable.hidden = true
|
||||
}
|
||||
if (inst.startAddrInputMode == INPUT_MODE_VARIABLE) {
|
||||
ui.startAddr.hidden = true
|
||||
ui.startAddrVariable.hidden = false
|
||||
}
|
||||
}
|
||||
|
||||
/*Array of BGCRC configurables that are common across device families */
|
||||
let config = [
|
||||
{
|
||||
name : "bgcrcBase",
|
||||
displayName : "BGCRC Instance",
|
||||
description : 'Instance of the BGCRC used.',
|
||||
hidden : false,
|
||||
default : BGCRC_INSTANCE[0].name,
|
||||
options : BGCRC_INSTANCE
|
||||
},
|
||||
//Config NMI
|
||||
{
|
||||
name : "nmiMode",
|
||||
displayName : "Error Response Severity",
|
||||
description : 'Non-Maskable Interrupts are enabled by default for memory check failures',
|
||||
hidden : false,
|
||||
default : device_driverlib_peripheral.BGCRC_NMI[0].name,
|
||||
options : device_driverlib_peripheral.BGCRC_NMI
|
||||
},
|
||||
//Emulation control
|
||||
{
|
||||
name : "emuCtl",
|
||||
displayName : "Emulation Control",
|
||||
description : 'Emulation control for the BGCRC module can be set to free or soft. CRC calculation and watchdog not affected by DEBUG HALT when set to free. Soft is set by default.',
|
||||
hidden : false,
|
||||
default : device_driverlib_peripheral.BGCRC_EMUCTRL[0].name,
|
||||
options : device_driverlib_peripheral.BGCRC_EMUCTRL
|
||||
}
|
||||
|
||||
];
|
||||
|
||||
let wdConfig = [
|
||||
//Enable/disable Watchdog
|
||||
{
|
||||
name : "enableWatchdog",
|
||||
displayName : "Enable Watchdog during CRC",
|
||||
description : 'Watchdog is enabled by default to ensure test completes in expected time, but can be explicitly disabled',
|
||||
hidden : false,
|
||||
default : true
|
||||
},
|
||||
//min
|
||||
{
|
||||
name : "wdMin",
|
||||
displayName : "Watchdog Window Minimum",
|
||||
description : 'Lower limit for watchdog window.',
|
||||
hidden : false,
|
||||
default : '0x0'
|
||||
},
|
||||
//max
|
||||
{
|
||||
name : "wdMax",
|
||||
displayName : "Watchdog Window Maximum",
|
||||
description : 'Upper limit for watchdog window.',
|
||||
hidden : false,
|
||||
default : '0xFFFFFFFF'
|
||||
}
|
||||
|
||||
];
|
||||
|
||||
let testConfig = [
|
||||
//startAddr
|
||||
{
|
||||
name: "startAddrInputMode",
|
||||
displayName : "Start Address Input Type",
|
||||
description : 'Type of start address input.',
|
||||
hidden : false,
|
||||
default : ADDRESS_INPUT_MODE[0].name,
|
||||
options : ADDRESS_INPUT_MODE,
|
||||
onChange : onChangeStartAddressInputMode
|
||||
},
|
||||
//Manual input
|
||||
{
|
||||
name : "startAddr",
|
||||
displayName : "Start Address",
|
||||
description : 'Starting address of the block to be checked. Value must be 0x80 word aligned, otherwise address will be changed to match closest 0x80 aligned address.',
|
||||
hidden : false,
|
||||
default : "0x00"
|
||||
},
|
||||
//Variable input
|
||||
{
|
||||
name: "startAddrVariable",
|
||||
displayName : "Start Address Variable",
|
||||
description : "Void pointer to function/variable of source address.",
|
||||
hidden : true,
|
||||
default : "",
|
||||
},
|
||||
//Block Size
|
||||
{
|
||||
name : "blockSize",
|
||||
displayName : "Block Size (Enter Num Bytes)",
|
||||
description : 'Block Size of Memory to be Checked. IMPORTANT: Must be a multiple of 256.',
|
||||
hidden : false,
|
||||
default : "256",
|
||||
/*
|
||||
options : [{name:"256B"}
|
||||
,{name:"512B"}
|
||||
,{name:"768B"}
|
||||
,{name:"1KB"}]
|
||||
*/
|
||||
},
|
||||
//CRC mode
|
||||
{
|
||||
name : "crcMode",
|
||||
displayName : "Mode Select",
|
||||
description : 'CRC mode of operation can be set to either CRC mode or Scrub mode.' +
|
||||
'In Scrub mode, CRC of data is not compared with the golden CRC.' +
|
||||
'Error check is done using the ECC/Parity logic. In CRC mode,' +
|
||||
'value is compared with golden CRC at the end in addition to' +
|
||||
'the data correctness check by ECC/Parity logic.',
|
||||
hidden : false,
|
||||
default : BGCRC_MODE[0].name,
|
||||
options : BGCRC_MODE
|
||||
},
|
||||
//Set Seed Value
|
||||
{
|
||||
name : "seedVal",
|
||||
displayName : "CRC Seed Value",
|
||||
description : 'Sets the seed value for the CRC calculations.',
|
||||
hidden : false,
|
||||
default : '0x0'
|
||||
},
|
||||
//Set Golden CRC value
|
||||
{
|
||||
name : "goldVal",
|
||||
displayName : "Golden CRC Value",
|
||||
description : 'Sets the golden CRC Value of the memory block being tested.',
|
||||
hidden : false,
|
||||
default : '0x0'
|
||||
}
|
||||
];
|
||||
|
||||
config.push({
|
||||
name: "wdWindow",
|
||||
displayName: "Watchdog Settings",
|
||||
collapsed: false,
|
||||
config: wdConfig
|
||||
});
|
||||
|
||||
config.push({
|
||||
name: "regionSetting",
|
||||
displayName: "CRC Configuration",
|
||||
collapsed: false,
|
||||
config: testConfig
|
||||
});
|
||||
|
||||
config.push({
|
||||
name: "interruptSetting",
|
||||
displayName: "Interrupt Settings",
|
||||
description: "",
|
||||
collapsed: false,
|
||||
config: [
|
||||
{
|
||||
name : "intFlags",
|
||||
displayName : "Enable Interrupt Flags",
|
||||
description : 'Select which int flags you would like to enable, if any.',
|
||||
hidden : false,
|
||||
default : [],
|
||||
minSelections: 0,
|
||||
options : [
|
||||
{name:"BGCRC_TEST_DONE"},
|
||||
{name:"BGCRC_CRC_FAIL"},
|
||||
{name:"BGCRC_UNCORR_ERR"},
|
||||
{name:"BGCRC_CORR_ERR"},
|
||||
{name:"BGCRC_WD_UNDERFLOW"},
|
||||
{name:"BGCRC_WD_OVERFLOW"}
|
||||
]
|
||||
},
|
||||
//register interrupt
|
||||
{
|
||||
name : "registerInterrupts",
|
||||
displayName : "Register Interrupt Handler",
|
||||
description : 'Whether or not to register interrupt handlers in the interrupt module.',
|
||||
hidden : false,
|
||||
default : false
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
config.push({
|
||||
name: "regProtection",
|
||||
displayName: "Register Guards and Protection",
|
||||
description: "",
|
||||
collapsed: false,
|
||||
config: [
|
||||
{
|
||||
name : "lockRegs",
|
||||
displayName : "Lock Registers",
|
||||
description : 'Select which register(s) you would like to lock, if any.',
|
||||
hidden : false,
|
||||
default : [],
|
||||
minSelections: 0,
|
||||
options : device_driverlib_peripheral.BGCRC_REG
|
||||
},
|
||||
//commit regs
|
||||
{
|
||||
name: "commitRegs",
|
||||
displayName: "Commit locked Registers",
|
||||
description : 'Commits the current register configuration. IMPORTANT: Only a reset can change the configuration',
|
||||
hidden : false,
|
||||
default : false
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
config.push({
|
||||
name : "startBGCRC",
|
||||
displayName : "Initiate BGCRC",
|
||||
description : 'Whether or not to star the BGCRC computation.',
|
||||
hidden : false,
|
||||
default : false
|
||||
})
|
||||
|
||||
function filterHardware(component)
|
||||
{
|
||||
return (Common.typeMatches(component.type, ["BGCRC"]));
|
||||
}
|
||||
|
||||
function onValidate(inst, validation) {
|
||||
|
||||
var usedBGCRCInsts = [];
|
||||
for (var instance_index in inst.$module.$instances)
|
||||
{
|
||||
var instance_obj = inst.$module.$instances[instance_index];
|
||||
usedBGCRCInsts.push(instance_obj.bgcrcBase);
|
||||
}
|
||||
|
||||
var duplicatesResult = Common.findDuplicates(usedBGCRCInsts)
|
||||
|
||||
if (duplicatesResult.duplicates.length != 0)
|
||||
{
|
||||
var allDuplicates = "";
|
||||
for (var duplicateNamesIndex in duplicatesResult.duplicates)
|
||||
{
|
||||
allDuplicates = allDuplicates + Common.stringOrEmpty(allDuplicates, ", ")
|
||||
+ duplicatesResult.duplicates[duplicateNamesIndex];
|
||||
}
|
||||
validation.logError(
|
||||
"The BGCRC Instance used. Duplicates: " + allDuplicates,
|
||||
inst, "bgcrcBase");
|
||||
}
|
||||
|
||||
|
||||
if ((inst.blockSize % 256) != 0){
|
||||
validation.logError(
|
||||
"Block Size byte input must be a mutliple of 256!",
|
||||
inst, "blockSize");
|
||||
}
|
||||
|
||||
if (inst.blockSize > 256000){
|
||||
validation.logError(
|
||||
"Block Size cannot exceed 256 KB!",
|
||||
inst, "blockSize");
|
||||
}
|
||||
|
||||
if (inst.blockSize < 0){
|
||||
validation.logError(
|
||||
"Please enter a positive multiple of 256.",
|
||||
inst, "blockSize");
|
||||
}
|
||||
|
||||
if (inst.wdMin < 0x0 || inst.wdMin > 0xFFFFFFFF ){
|
||||
validation.logError(
|
||||
"Enter a value from 0x0 to 0xFFFFFFFF",
|
||||
inst, "wdMin");
|
||||
}
|
||||
|
||||
if (inst.wdMax < 0x0 || inst.wdMax > 0xFFFFFFFF ){
|
||||
validation.logError(
|
||||
"Enter a value from 0x0 to 0xFFFFFFFF",
|
||||
inst, "wdMax");
|
||||
}
|
||||
|
||||
if (inst.wdMin > inst.wdMax){
|
||||
validation.logError(
|
||||
"Min is larger than Max value",
|
||||
inst, "wdMax")
|
||||
}
|
||||
|
||||
if (inst.startAddrInputMode == INPUT_MODE_MANUAL) {
|
||||
|
||||
if (inst.startAddr < 0x0 || inst.startAddr > 0xFFFFFFFF ){
|
||||
validation.logError(
|
||||
"Enter a value from 0x0 to 0xFFFFFFFF",
|
||||
inst, "startAddr");
|
||||
}
|
||||
|
||||
if ((inst.startAddr & 0xFFFFFF80) != inst.startAddr){
|
||||
validation.logWarning(
|
||||
"The entered address is not 0x80 word aligned. The start address will be set to 0x" + (inst.startAddr & 0xFFFFFF80).toString(16).toUpperCase(),
|
||||
inst, "startAddr");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (inst.crcMode == BGCRC_MODE[1].name ){
|
||||
validation.logInfo(
|
||||
"Mode is set to Scrub Mode, the Golden CRC Value will not be used.",
|
||||
inst, "goldVal");
|
||||
|
||||
validation.logInfo(
|
||||
"Mode is set to Scrub Mode, the Seed Value will not be used.",
|
||||
inst, "seedVal");
|
||||
}
|
||||
|
||||
if (inst.goldVal < 0x0 || inst.goldVal > 0xFFFFFFFF ){
|
||||
validation.logError(
|
||||
"Enter a value from 0x0 to 0xFFFFFFFF",
|
||||
inst, "goldVal");
|
||||
}
|
||||
|
||||
if (inst.seedVal < 0x0 || inst.seedVal > 0xFFFFFFFF ){
|
||||
validation.logError(
|
||||
"Enter a value from 0x0 to 0xFFFFFFFF",
|
||||
inst, "seedVal");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
var bgcrcModule = {
|
||||
|
||||
peripheralName: "BGCRC",
|
||||
displayName: "BGCRC",
|
||||
maxInstances: BGCRC_INSTANCE.length,
|
||||
defaultInstanceName: "myBGCRC",
|
||||
description: "BGCRC memory check peripheral",
|
||||
longDescription : longDescription,
|
||||
filterHardware: filterHardware,
|
||||
config: config,
|
||||
moduleInstances: (inst) => {
|
||||
var dlibInt = "INT_BGCRC";
|
||||
|
||||
if (inst.bgcrcBase.includes("CLA"))
|
||||
{
|
||||
dlibInt = "INT_BGCRC_CLA1";
|
||||
if (["F2838x", "F28P65x"].includes(Common.getDeviceName())){
|
||||
dlibInt = "INT_CLA1CRC";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (["F2838x", "F28P65x"].includes(Common.getDeviceName())){
|
||||
dlibInt = "INT_CPUCRC";
|
||||
}
|
||||
}
|
||||
|
||||
if (inst.registerInterrupts){
|
||||
return[{
|
||||
name: "bgcrcInt",
|
||||
displayName: "BGCRC Interrupt",
|
||||
moduleName: "/driverlib/interrupt.js",
|
||||
collapsed: true,
|
||||
args: {
|
||||
$name : inst.$name + "_INT",
|
||||
int : "INT_" + inst.$name,
|
||||
pinmuxPeripheralModule: "",
|
||||
driverlibInt : dlibInt
|
||||
}
|
||||
}]
|
||||
}
|
||||
return []
|
||||
},
|
||||
templates: {
|
||||
boardc : "/driverlib/bgcrc/bgcrc.board.c.xdt",
|
||||
boardh : "/driverlib/bgcrc/bgcrc.board.h.xdt"
|
||||
},
|
||||
validate : onValidate
|
||||
};
|
||||
|
||||
if (bgcrcModule.maxInstances <= 0){
|
||||
delete bgcrcModule.pinmuxRequirements;
|
||||
}
|
||||
|
||||
exports = bgcrcModule;
|
||||
@@ -0,0 +1,121 @@
|
||||
% var nameOfModule = "bgcrc";
|
||||
% var module = system.modules['/driverlib/' + nameOfModule + '.js'];
|
||||
% let Common = system.getScript("/driverlib/Common.js");
|
||||
% var nameOfPeripheral = module.peripheralName;
|
||||
//*****************************************************************************
|
||||
//
|
||||
// BGCRC Configurations
|
||||
//
|
||||
//*****************************************************************************
|
||||
void `nameOfPeripheral`_init(){
|
||||
% for(var i = 0; i < module.$instances.length; i++)
|
||||
% {
|
||||
% var instance = module.$instances[i];
|
||||
`instance.$name`_init();
|
||||
% }
|
||||
}
|
||||
|
||||
%if (module != null)
|
||||
%{
|
||||
% for(var i = 0; i < module.$instances.length; i++) {
|
||||
void `instance.$name`_init(){
|
||||
% var instance = module.$instances[i];
|
||||
% var baseName = instance.$name + "_BASE";
|
||||
% var blockSizeString = "";
|
||||
% var numBlks = instance.blockSize / 256;
|
||||
% var numKB = (numBlks / 4) >> 0;
|
||||
% var remBytes = numBlks % 4;
|
||||
%
|
||||
% if ( numBlks >= 1 ){
|
||||
% if ( numKB >= 1 ){
|
||||
% if (remBytes == 1){
|
||||
% blockSizeString = "BGCRC_SIZE_KBYTES(" + numKB + ") + BGCRC_SIZE_BYTES_256";
|
||||
% } else if (remBytes == 2){
|
||||
% blockSizeString = "BGCRC_SIZE_KBYTES(" + numKB + ") + BGCRC_SIZE_BYTES_512";
|
||||
% } else if (remBytes == 3){
|
||||
% blockSizeString = "BGCRC_SIZE_KBYTES(" + numKB + ") + BGCRC_SIZE_BYTES_768";
|
||||
% } else{
|
||||
% blockSizeString = "BGCRC_SIZE_KBYTES(" + numKB + ")";
|
||||
% }
|
||||
%} else{
|
||||
% if (remBytes == 1){
|
||||
% blockSizeString = "BGCRC_SIZE_BYTES_256";
|
||||
% } else if (remBytes == 2){
|
||||
% blockSizeString = "BGCRC_SIZE_BYTES_512";
|
||||
% } else {
|
||||
% blockSizeString = "BGCRC_SIZE_BYTES_768";
|
||||
% }
|
||||
% }
|
||||
%
|
||||
% } else{
|
||||
% blockSizeString = "BGCRC_SIZE_BYTES_0";
|
||||
% }
|
||||
%
|
||||
% //`instance.$name` initialization
|
||||
% let instancePinmux = instance[nameOfModule];
|
||||
%//handle interrupt flags
|
||||
% if (instance.enableWatchdog) {
|
||||
BGCRC_enableWatchdog(`baseName`);
|
||||
//
|
||||
//config watchdog settings
|
||||
//
|
||||
BGCRC_setWatchdogWindow(`baseName`, `instance.$name`_WDMIN, `instance.$name`_WDMAX);
|
||||
% } else {
|
||||
BGCRC_disableWatchdog(`baseName`);
|
||||
//
|
||||
//config watchdog settings
|
||||
//
|
||||
BGCRC_setWatchdogWindow(`baseName`, `instance.$name`_WDMIN, `instance.$name`_WDMAX);
|
||||
% }
|
||||
%
|
||||
//
|
||||
//run BGCRC_setConfig
|
||||
//
|
||||
BGCRC_setConfig(`baseName`, `instance.$name`_NMIMODE, `instance.$name`_EMUCTRL);
|
||||
%
|
||||
//
|
||||
//run BGCRC_setRegion
|
||||
//
|
||||
%
|
||||
BGCRC_setRegion(`baseName`, `instance.$name`_STARTADDR, `blockSizeString`, `instance.$name`_MODE);
|
||||
%
|
||||
//
|
||||
//call BGCRC_setGoldenCRCValue
|
||||
//
|
||||
BGCRC_setGoldenCRCValue(`baseName`, `instance.$name`_GOLDENVALUE);
|
||||
//
|
||||
//call BGCRC_setSeedValue
|
||||
//
|
||||
BGCRC_setSeedValue(`baseName`, `instance.$name`_SEEDVALUE);
|
||||
%
|
||||
%
|
||||
% if ((instance.intFlags).length > 0){
|
||||
//
|
||||
//handle interrupt flags
|
||||
//
|
||||
BGCRC_enableInterrupt(`baseName`, `instance.$name`_INTFLAGS);
|
||||
% }
|
||||
%
|
||||
% if ((instance.lockRegs).length > 0){
|
||||
//
|
||||
//lock selected BGCRC regs
|
||||
//
|
||||
BGCRC_lockRegister(`baseName`, `instance.$name`_LOCKREGS);
|
||||
% }
|
||||
%
|
||||
% if (instance.commitRegs){
|
||||
//
|
||||
//commit the current register config
|
||||
//
|
||||
BGCRC_commitRegisterLock(`baseName`, `instance.$name`_LOCKREGS);
|
||||
% }
|
||||
%
|
||||
% if (instance.startBGCRC){
|
||||
//
|
||||
//start BGCRC calculation
|
||||
//
|
||||
BGCRC_start(`baseName`);
|
||||
% }
|
||||
}
|
||||
%}
|
||||
%}
|
||||
@@ -0,0 +1,36 @@
|
||||
% var moduleName = "bgcrc"
|
||||
% var module = system.modules['/driverlib/' + moduleName + '.js'];
|
||||
%if (module != null)
|
||||
%{
|
||||
//*****************************************************************************
|
||||
//
|
||||
// BGCRC Configurations
|
||||
//
|
||||
//*****************************************************************************
|
||||
% for(var i = 0; i < module.$instances.length; i++) {
|
||||
% var instance = module.$instances[i];
|
||||
% let modInst = instance[moduleName];
|
||||
#define `instance.$name`_BASE `instance.bgcrcBase`
|
||||
#define `instance.$name`_EMUCTRL `instance.emuCtl`
|
||||
#define `instance.$name`_NMIMODE `instance.nmiMode`
|
||||
#define `instance.$name`_MODE `instance.crcMode`
|
||||
#define `instance.$name`_WDMIN `instance.wdMin`
|
||||
#define `instance.$name`_WDMAX `instance.wdMax`
|
||||
#define `instance.$name`_BLOCKSIZE `instance.blockSize`
|
||||
#define `instance.$name`_GOLDENVALUE `instance.goldVal`
|
||||
#define `instance.$name`_SEEDVALUE `instance.seedVal`
|
||||
% var intFlg = ["0"].concat(instance.intFlags)
|
||||
#define `instance.$name`_INTFLAGS (`intFlg.join("|")`)
|
||||
% var lckReg = ["0"].concat(instance.lockRegs)
|
||||
#define `instance.$name`_LOCKREGS (`lckReg.join("|")`)
|
||||
%if (instance.startAddrInputMode == "MANUAL"){
|
||||
#define `instance.$name`_STARTADDR `instance.startAddr`
|
||||
% } else{
|
||||
extern const void *`instance.startAddrVariable`;
|
||||
#define `instance.$name`_STARTADDR (uint32_t)`instance.startAddrVariable`
|
||||
% }
|
||||
void `instance.$name`_init();
|
||||
|
||||
% }
|
||||
%}
|
||||
%
|
||||
@@ -0,0 +1,171 @@
|
||||
/*
|
||||
* Copyright (c) 2020 Texas Instruments Incorporated - http://www.ti.com
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
% let Common = system.getScript("/driverlib/Common.js");
|
||||
#include "board.h"
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Board Configurations
|
||||
// Initializes the rest of the modules.
|
||||
// Call this function in your application if you wish to do all module
|
||||
// initialization.
|
||||
// If you wish to not use some of the initializations, instead of the
|
||||
// Board_init use the individual Module_inits
|
||||
//
|
||||
//*****************************************************************************
|
||||
void Board_init()
|
||||
{
|
||||
EALLOW;
|
||||
|
||||
% if (Common.isContextCPU1()) {
|
||||
PinMux_init();
|
||||
% }
|
||||
% if (!Common.onlyPinmux())
|
||||
% {
|
||||
% let keys = Object.keys(system.modules).sort();
|
||||
%
|
||||
%%{
|
||||
// Ordered list of peripherals to initialize first, any peripherals outside will be added after in alphabetical order
|
||||
var prioritizedPeripherals = [
|
||||
{ name: "sysctl", peripheralName: "SYSCTL" },
|
||||
{ name: "inputxbar_input", peripheralName: "INPUTXBAR" },
|
||||
{ name: "sync", peripheralName: "SYNC" },
|
||||
{ name: "asysctl", peripheralName: "ASYSCTL" },
|
||||
{ name: "cla", peripheralName: "CLA" },
|
||||
{ name: "memcfg", peripheralName: "MEMCFG" },
|
||||
]
|
||||
var prioritizedPeripheralsNames = prioritizedPeripherals.map(element => element.name)
|
||||
var prioritizedPeripheralsPeripheralNames = prioritizedPeripherals.map(element => element.peripheralName)
|
||||
// Ordered list for prioritize last
|
||||
var lastPrioritized = ["INTERRUPT"]
|
||||
// Skip in list
|
||||
var skipPeripherals = ["ANALOG"]
|
||||
%%}
|
||||
% for(var currentPer in prioritizedPeripherals){
|
||||
% let mod = system.modules["/driverlib/"+prioritizedPeripherals[currentPer].name.toLowerCase()+".js"]
|
||||
% if (mod != null) {
|
||||
`mod.peripheralName.replace("-","_")`_init();
|
||||
% }
|
||||
% }
|
||||
%
|
||||
% var peripheralsCodeGenerated = []
|
||||
% for (let i = 0; i < keys.length; i++) {
|
||||
% let mod = system.modules[keys[i]];
|
||||
% if (skipPeripherals.includes(mod.peripheralName))
|
||||
% continue;
|
||||
% if (peripheralsCodeGenerated.includes(mod.peripheralName))
|
||||
% {
|
||||
% peripheralsCodeGenerated.push(mod.peripheralName);
|
||||
% continue;
|
||||
% }
|
||||
% if (mod.peripheralName != null) {
|
||||
% if (mod.peripheralName == "FLASH"){
|
||||
// FLASH Initialization:
|
||||
// The "FLASH_init()" should be called after or during initialization functions like
|
||||
// Device_init() or Device_enableAllPeripherals().
|
||||
% }
|
||||
% else if (mod.peripheralName == "DC-DC"){
|
||||
// DC-DC Initialization:
|
||||
// The procedure to enable the internal DC-DC regulator should be completed
|
||||
// prior to other initialization functions. This is in order for the
|
||||
// DC-DC initialization to happen during low current operation.
|
||||
// "DC_DC_init()" should be called before initialization functions like
|
||||
// Device_init() or Device_enableAllPeripherals().
|
||||
% }
|
||||
% else if (mod.peripheralName == "IPC"){
|
||||
`mod.peripheralName.replace("-","_")`_SYSCFG_init();
|
||||
% }
|
||||
% else if (mod.peripheralName == "MCAN"){
|
||||
`mod.peripheralName.replace("-","_")`_SYSCFG_init();
|
||||
% }
|
||||
% else if(!(prioritizedPeripheralsPeripheralNames.includes(mod.peripheralName) || lastPrioritized.includes(mod.peripheralName))){
|
||||
`mod.peripheralName.replace("-","_")`_init();
|
||||
% }
|
||||
% }
|
||||
% }
|
||||
% var lastPrioritizedPeripheralsCodeGenerated = []
|
||||
% for (let i = 0; i < keys.length; i++) {
|
||||
% let mod = system.modules[keys[i]];
|
||||
% if (lastPrioritized.includes(mod.peripheralName)) {
|
||||
% if (!lastPrioritizedPeripheralsCodeGenerated.includes(mod.peripheralName)) {
|
||||
% lastPrioritizedPeripheralsCodeGenerated.push(mod.peripheralName);
|
||||
`mod.peripheralName.replace("-","_")`_init();
|
||||
% }
|
||||
% }
|
||||
% }
|
||||
% }
|
||||
% else if (system.modules["/driverlib/inputxbar.js"] != null) {
|
||||
INPUTXBAR_init();
|
||||
% }
|
||||
|
||||
EDIS;
|
||||
}
|
||||
|
||||
% if (Common.isContextCPU1()) {
|
||||
//*****************************************************************************
|
||||
//
|
||||
// PINMUX Configurations
|
||||
//
|
||||
//*****************************************************************************
|
||||
void PinMux_init()
|
||||
{
|
||||
% let pinmuxContent = system.getTemplate("/driverlib/pinmux/pinmux.board.c.xdt");
|
||||
`pinmuxContent("")`
|
||||
}
|
||||
% }
|
||||
|
||||
% if (!Common.onlyPinmux())
|
||||
% {
|
||||
% let keys = Object.keys(system.modules).sort();
|
||||
%
|
||||
% var interruptCodeGenerated = false;
|
||||
% for (let i = 0; i < keys.length; i++) {
|
||||
% let mod = system.modules[keys[i]];
|
||||
% if (skipPeripherals.includes(mod.peripheralName))
|
||||
% continue;
|
||||
% if (mod.peripheralName == "INTERRUPT")
|
||||
% {
|
||||
% if (interruptCodeGenerated) {continue;}
|
||||
% interruptCodeGenerated = true;
|
||||
% }
|
||||
% if (mod.templates && mod.templates.boardc) {
|
||||
% let gen = system.getTemplate(mod.templates.boardc);
|
||||
`gen(mod)`
|
||||
% }
|
||||
% }
|
||||
% }
|
||||
% else if (system.modules["/driverlib/inputxbar.js"] != null){
|
||||
% let inputxbargen = system.getTemplate(system.modules["/driverlib/inputxbar.js"].templates.boardc);
|
||||
`inputxbargen()`
|
||||
% }
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* ======== board.cmd.genlibs ========
|
||||
* Libraries needed to link this application's configuration
|
||||
*
|
||||
* NOTE, this feature requires software components configured in your
|
||||
* system to correctly indicate their dependencies and report the
|
||||
* libraries needed for your specific configuration. If you find
|
||||
* errors, please report them on TI's E2E forums
|
||||
* (https://e2e.ti.com/) so they can be addressed in a future
|
||||
* release.
|
||||
*
|
||||
* This file allows one to portably link applications that use SysConfig
|
||||
* _without_ having to make changes to build rules when moving to a new
|
||||
* device OR when upgrading to a new version of a SysConfig enabled
|
||||
* product.
|
||||
*
|
||||
* DO NOT EDIT - This file is generated by the SysConfig tool for the
|
||||
* TI C/C++ toolchain
|
||||
*/
|
||||
|
||||
% let Common = system.getScript("/driverlib/Common.js");
|
||||
% let device_support = system.modules["/driverlib/device_support.js"]
|
||||
% if (device_support) {
|
||||
/* libraries required for driverlib */
|
||||
-l"driverlib/`Common.getDeviceName().toLowerCase()`/driverlib/ccs/`device_support.$static.build`/driverlib.lib"
|
||||
% }
|
||||
@@ -0,0 +1,149 @@
|
||||
/*
|
||||
* Copyright (c) 2020 Texas Instruments Incorporated - http://www.ti.com
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef BOARD_H
|
||||
#define BOARD_H
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// If building with a C++ compiler, make all of the definitions in this header
|
||||
// have a C binding.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
|
||||
#include "driverlib.h"
|
||||
#include "device.h"
|
||||
|
||||
% let Common = system.getScript("/driverlib/Common.js");
|
||||
% let pinmuxContent = system.getTemplate("/driverlib/pinmux/pinmux.board.c.xdt");
|
||||
% let modsAlwaysRunOnAllContexts = ['/driverlib/gpio.js', '/driverlib/aio.js']
|
||||
//*****************************************************************************
|
||||
//
|
||||
// PinMux Configurations
|
||||
//
|
||||
//*****************************************************************************
|
||||
`pinmuxContent("header")`
|
||||
% if (!Common.onlyPinmux()) {
|
||||
% let keys = Object.keys(system.modules).sort();
|
||||
% var interruptCodeGenerated = false;
|
||||
% for (let i = 0; i < keys.length; i++) {
|
||||
% let mod = system.modules[keys[i]];
|
||||
% if (mod.peripheralName == "ANALOG")
|
||||
% continue;
|
||||
% if (mod.peripheralName == "INTERRUPT")
|
||||
% {
|
||||
% if (interruptCodeGenerated) {continue;}
|
||||
% interruptCodeGenerated = true;
|
||||
% }
|
||||
% if (mod.templates && mod.templates.boardh) {
|
||||
% let gen = system.getTemplate(mod.templates.boardh);
|
||||
% if (gen(mod).replace("\n", "").replace("\r", "") != ""){
|
||||
`gen(mod)`
|
||||
% }
|
||||
% }
|
||||
% }
|
||||
% for (var modAlwaysRun of modsAlwaysRunOnAllContexts){
|
||||
% if (!Common.isModuleOnThisContext(modAlwaysRun) && Common.isModuleOnOtherContext(modAlwaysRun))
|
||||
% {
|
||||
% var availMod = Common.getModuleForTheFirstAvailableCore(modAlwaysRun)
|
||||
% if (availMod.templates && availMod.templates.boardh) {
|
||||
% let gen = system.getTemplate(availMod.templates.boardh);
|
||||
% if (gen(availMod).replace("\n", "").replace("\r", "") != ""){
|
||||
`gen(availMod)`
|
||||
% }
|
||||
% }
|
||||
% }
|
||||
% }
|
||||
% }
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Board Configurations
|
||||
//
|
||||
//*****************************************************************************
|
||||
void Board_init();
|
||||
% if (!Common.onlyPinmux()) {
|
||||
% let keys = Object.keys(system.modules).sort();
|
||||
%
|
||||
% var interruptCodeGenerated = false;
|
||||
% for (let i = 0; i < keys.length; i++) {
|
||||
% let mod = system.modules[keys[i]];
|
||||
% if (mod.peripheralName == "ANALOG")
|
||||
% continue;
|
||||
% if (mod.peripheralName == "INTERRUPT")
|
||||
% {
|
||||
% if (interruptCodeGenerated) {continue;}
|
||||
% interruptCodeGenerated = true;
|
||||
% }
|
||||
% if (mod.peripheralName != null) {
|
||||
% if (mod.peripheralName == "MCAN") {
|
||||
void `mod.peripheralName.replace("-","_")`_SYSCFG_init();
|
||||
% } else if (mod.peripheralName == "IPC") {
|
||||
void `mod.peripheralName.replace("-","_")`_SYSCFG_init();
|
||||
% } else {
|
||||
void `mod.peripheralName.replace("-","_")`_init();
|
||||
% }
|
||||
% }
|
||||
% }
|
||||
% }
|
||||
% else {
|
||||
% let keys = Object.keys(system.modules).sort();
|
||||
%
|
||||
% for (let i = 0; i < keys.length; i++) {
|
||||
% let mod = system.modules[keys[i]];
|
||||
% if (mod.peripheralName == "INPUTXBAR") {
|
||||
void `mod.peripheralName.replace("-","_")`_init();
|
||||
% }
|
||||
% }
|
||||
% }
|
||||
% if(Common.isContextCPU1()){
|
||||
void PinMux_init();
|
||||
% }
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Mark the end of the C bindings section for C++ compilers.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // end of BOARD_H definition
|
||||
@@ -0,0 +1,15 @@
|
||||
% let Common = system.getScript("/driverlib/Common.js");
|
||||
{
|
||||
"interruptInfo" : [
|
||||
% let interruptMod = system.modules["/driverlib/interrupt.js"]
|
||||
% if (interruptMod != null) {
|
||||
% var interruptCount = interruptMod.$instances.length;
|
||||
% for (var interruptInst of interruptMod.$instances){
|
||||
{
|
||||
"interruptName": "`interruptInst.interruptName`",
|
||||
"interruptHandler": "`interruptInst.interruptHandler`"
|
||||
}`(interruptCount-- > 1)?",":""`
|
||||
% }
|
||||
% }
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* ======== board.opt ========
|
||||
* Project options needed for this application's configuration
|
||||
*
|
||||
* NOTE, this feature requires software components configured in your
|
||||
* system to correctly indicate their project properties
|
||||
* needed for your specific configuration. If you find
|
||||
* errors, please report them on TI's E2E forums
|
||||
* (https://e2e.ti.com/) so they can be addressed in a future
|
||||
* release.
|
||||
*
|
||||
* This file allows one to portably link applications that use SysConfig
|
||||
* _without_ having to make changes to build rules when moving to a new
|
||||
* device OR when upgrading to a new version of a SysConfig enabled
|
||||
* product.
|
||||
*
|
||||
* DO NOT EDIT - This file is generated by the SysConfig tool for the
|
||||
* TI C/C++ toolchain
|
||||
*/
|
||||
|
||||
% let Common = system.getScript("/driverlib/Common.js");
|
||||
% let device_support = system.modules["/driverlib/device_support.js"]
|
||||
% var currnetSDKProductPath = system.getProducts()[0].path
|
||||
% var sdkPath = system.utils.path.join(currnetSDKProductPath + "../../../")
|
||||
% sdkPath = sdkPath.replace(new RegExp('\\' + system.utils.path.sep, 'g'), '/')
|
||||
%
|
||||
--define=`Common.getDeviceName()`=1
|
||||
% if (device_support) {
|
||||
-I"`sdkPath`device_support/`Common.getDeviceName().toLowerCase()`/common/include/"
|
||||
-I"`sdkPath`driverlib/`Common.getDeviceName().toLowerCase()`/driverlib/"
|
||||
% if (Common.isContextCPU1()){
|
||||
-DCPU1
|
||||
%}else{
|
||||
-DCPU2
|
||||
%}
|
||||
% }
|
||||
@@ -0,0 +1,165 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2020, Texas Instruments Incorporated - http://www.ti.com
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* ======== LED.syscfg.js ========
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
let Common = system.getScript("/driverlib/Common.js");
|
||||
|
||||
/* generic configuration parameters for LED instances */
|
||||
let config = [
|
||||
|
||||
];
|
||||
|
||||
function _getPinResources(inst)
|
||||
{
|
||||
let modRX;
|
||||
let pin;
|
||||
|
||||
// modRX = system.getScript("/driverlib/fsirx.js");
|
||||
// modTX = system.getScript("/driverlib/fsirx.js");
|
||||
// pin = modRX._getPinResources(inst.fsirx.fsirx_d0Pin);
|
||||
// console.log(pin)
|
||||
|
||||
return (pin);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ========= filterHardware ========
|
||||
* param component - hardware object describing signals and
|
||||
* resources
|
||||
*
|
||||
* returns Boolean indicating whether or not to allow the component to
|
||||
* be assigned to an instance's $hardware config
|
||||
*/
|
||||
function filterHardware(component)
|
||||
{
|
||||
if (component.type) {
|
||||
if (Common.typeMatches(component.type, ["FSI"])) {
|
||||
return (true);
|
||||
}
|
||||
}
|
||||
return (false);
|
||||
}
|
||||
|
||||
/*
|
||||
* ======== validate ========
|
||||
* Validate this inst's configuration
|
||||
*
|
||||
* param inst - LED instance to be validated
|
||||
* param validation - object to hold detected validation issues
|
||||
*/
|
||||
function validate(inst, validation)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* ======== moduleInstances ========
|
||||
* Add a pwm or gpio instance to the module depending on if the LED is
|
||||
* dimmable or not.
|
||||
*/
|
||||
function moduleInstances(inst)
|
||||
{
|
||||
|
||||
let devInstanceRX;
|
||||
devInstanceRX = {
|
||||
displayName: "FSIRX",
|
||||
name: "fsiRx",
|
||||
description: "",
|
||||
moduleName: "/driverlib/fsirx.js",
|
||||
args: {
|
||||
$name: inst.$name + "_FSIRX"
|
||||
},
|
||||
};
|
||||
devInstanceRX.hardware = inst.$hardware;
|
||||
|
||||
let devInstanceTX;
|
||||
devInstanceTX = {
|
||||
displayName: "FSITX",
|
||||
name: "fsiTx",
|
||||
description: "",
|
||||
moduleName: "/driverlib/fsitx.js",
|
||||
args: {
|
||||
$name: inst.$name + "_FSITX"
|
||||
},
|
||||
};
|
||||
devInstanceTX.hardware = inst.$hardware;
|
||||
return ([devInstanceRX, devInstanceTX]);
|
||||
}
|
||||
|
||||
/*
|
||||
* ======== onHardwareChanged ========
|
||||
* Handle new hardware selection
|
||||
*
|
||||
* @param inst - LED instance to be validated
|
||||
* @param ui - object with properties for each configurable whose value
|
||||
* is an object that allows us to control the GUI display of
|
||||
* the configurable (hidden, readonly, ...)
|
||||
*/
|
||||
function onHardwareChanged(inst, ui)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* ======== base ========
|
||||
* Define the base properties and methods
|
||||
*/
|
||||
let base = {
|
||||
displayName: "FSI",
|
||||
description: "FSI",
|
||||
longDescription: "",
|
||||
defaultInstanceName: "myBoardFSI",
|
||||
|
||||
config: config,
|
||||
|
||||
validate: validate,
|
||||
moduleInstances: moduleInstances,
|
||||
filterHardware: filterHardware,
|
||||
|
||||
/* make GUI changes in response to HW model changes */
|
||||
onHardwareChanged: onHardwareChanged,
|
||||
|
||||
templates: {
|
||||
boardc: "/driverlib/board_components/fsi/fsi.board.c.xdt",
|
||||
boardh: "/driverlib/board_components/fsi/fsi.board.h.xdt"
|
||||
},
|
||||
|
||||
_getPinResources: _getPinResources
|
||||
};
|
||||
|
||||
exports = base;
|
||||
@@ -0,0 +1,154 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2020, Texas Instruments Incorporated - http://www.ti.com
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* ======== LED.syscfg.js ========
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
let Common = system.getScript("/driverlib/Common.js");
|
||||
|
||||
/* generic configuration parameters for LED instances */
|
||||
let config = [
|
||||
|
||||
];
|
||||
|
||||
function _getPinResources(inst)
|
||||
{
|
||||
let mod;
|
||||
let pin;
|
||||
|
||||
mod = system.getScript("/driverlib/gpio.js");
|
||||
pin = mod._getPinResources(inst.gpioPin);
|
||||
|
||||
return (pin);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ========= filterHardware ========
|
||||
* param component - hardware object describing signals and
|
||||
* resources
|
||||
*
|
||||
* returns Boolean indicating whether or not to allow the component to
|
||||
* be assigned to an instance's $hardware config
|
||||
*/
|
||||
function filterHardware(component)
|
||||
{
|
||||
if (component.type) {
|
||||
if (Common.typeMatches(component.type, ["LED"])) {
|
||||
return (true);
|
||||
}
|
||||
}
|
||||
return (false);
|
||||
}
|
||||
|
||||
/*
|
||||
* ======== validate ========
|
||||
* Validate this inst's configuration
|
||||
*
|
||||
* param inst - LED instance to be validated
|
||||
* param validation - object to hold detected validation issues
|
||||
*/
|
||||
function validate(inst, validation)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* ======== moduleInstances ========
|
||||
* Add a pwm or gpio instance to the module depending on if the LED is
|
||||
* dimmable or not.
|
||||
*/
|
||||
function moduleInstances(inst)
|
||||
{
|
||||
|
||||
let devInstance;
|
||||
devInstance = {
|
||||
displayName: "GPIO",
|
||||
name: "gpio",
|
||||
description: "This LED is driven by a GPIO",
|
||||
moduleName: "/driverlib/gpio.js",
|
||||
args: {
|
||||
$name: inst.$name + "_GPIO"
|
||||
},
|
||||
requiredArgs: {
|
||||
direction : "GPIO_DIR_MODE_OUT"
|
||||
}
|
||||
};
|
||||
devInstance.hardware = inst.$hardware;
|
||||
return ([devInstance]);
|
||||
}
|
||||
|
||||
/*
|
||||
* ======== onHardwareChanged ========
|
||||
* Handle new hardware selection
|
||||
*
|
||||
* @param inst - LED instance to be validated
|
||||
* @param ui - object with properties for each configurable whose value
|
||||
* is an object that allows us to control the GUI display of
|
||||
* the configurable (hidden, readonly, ...)
|
||||
*/
|
||||
function onHardwareChanged(inst, ui)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* ======== base ========
|
||||
* Define the base properties and methods
|
||||
*/
|
||||
let base = {
|
||||
displayName: "LED",
|
||||
description: "LED Driver",
|
||||
longDescription: "",
|
||||
defaultInstanceName: "myBoardLED",
|
||||
|
||||
config: config,
|
||||
|
||||
validate: validate,
|
||||
moduleInstances: moduleInstances,
|
||||
filterHardware: filterHardware,
|
||||
|
||||
/* make GUI changes in response to HW model changes */
|
||||
onHardwareChanged: onHardwareChanged,
|
||||
|
||||
templates: {
|
||||
boardc: "/driverlib/board_components/led/led.board.c.xdt",
|
||||
boardh: "/driverlib/board_components/led/led.board.h.xdt"
|
||||
},
|
||||
|
||||
_getPinResources: _getPinResources
|
||||
};
|
||||
|
||||
exports = base;
|
||||
@@ -0,0 +1,151 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2020, Texas Instruments Incorporated - http://www.ti.com
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* ======== LED.syscfg.js ========
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
let Common = system.getScript("/driverlib/Common.js");
|
||||
|
||||
/* generic configuration parameters for LED instances */
|
||||
let config = [
|
||||
|
||||
];
|
||||
|
||||
function _getPinResources(inst)
|
||||
{
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ========= filterHardware ========
|
||||
* param component - hardware object describing signals and
|
||||
* resources
|
||||
*
|
||||
* returns Boolean indicating whether or not to allow the component to
|
||||
* be assigned to an instance's $hardware config
|
||||
*/
|
||||
function filterHardware(component)
|
||||
{
|
||||
if (component.type) {
|
||||
if (Common.typeMatches(component.type, ["SWITCH"])) {
|
||||
return (true);
|
||||
}
|
||||
}
|
||||
return (false);
|
||||
}
|
||||
|
||||
/*
|
||||
* ======== validate ========
|
||||
* Validate this inst's configuration
|
||||
*
|
||||
* param inst - LED instance to be validated
|
||||
* param validation - object to hold detected validation issues
|
||||
*/
|
||||
function validate(inst, validation)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* ======== moduleInstances ========
|
||||
* Add a pwm or gpio instance to the module depending on if the LED is
|
||||
* dimmable or not.
|
||||
*/
|
||||
function moduleInstances(inst)
|
||||
{
|
||||
|
||||
let devInstance;
|
||||
devInstance = {
|
||||
displayName: "GPIO",
|
||||
name: "gpio",
|
||||
description: "This SWITCH is connected to a GPIO",
|
||||
moduleName: "/driverlib/gpio.js",
|
||||
args: {
|
||||
$name: inst.$name + "_GPIO"
|
||||
},
|
||||
requiredArgs: {
|
||||
direction : "GPIO_DIR_MODE_IN"
|
||||
}
|
||||
};
|
||||
|
||||
devInstance.hardware = inst.$hardware;
|
||||
|
||||
return ([devInstance]);
|
||||
}
|
||||
|
||||
/*
|
||||
* ======== onHardwareChanged ========
|
||||
* Handle new hardware selection
|
||||
*
|
||||
* @param inst - LED instance to be validated
|
||||
* @param ui - object with properties for each configurable whose value
|
||||
* is an object that allows us to control the GUI display of
|
||||
* the configurable (hidden, readonly, ...)
|
||||
*/
|
||||
function onHardwareChanged(inst, ui)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* ======== base ========
|
||||
* Define the base properties and methods
|
||||
*/
|
||||
let base = {
|
||||
displayName: "SWITCH",
|
||||
description: "SWITCH Driver",
|
||||
longDescription: "",
|
||||
defaultInstanceName: "myBoardSWITCH",
|
||||
|
||||
config: config,
|
||||
|
||||
validate: validate,
|
||||
moduleInstances: moduleInstances,
|
||||
filterHardware: filterHardware,
|
||||
|
||||
/* make GUI changes in response to HW model changes */
|
||||
onHardwareChanged: onHardwareChanged,
|
||||
|
||||
templates: {
|
||||
boardc: "/driverlib/board_components/switch/switch.board.c.xdt",
|
||||
boardh: "/driverlib/board_components/switch/switch.board.h.xdt"
|
||||
},
|
||||
|
||||
_getPinResources: _getPinResources
|
||||
};
|
||||
|
||||
exports = base;
|
||||
@@ -0,0 +1,540 @@
|
||||
let Common = system.getScript("/driverlib/Common.js");
|
||||
let Pinmux = system.getScript("/driverlib/pinmux.js");
|
||||
|
||||
/* Intro splash on GUI */
|
||||
let longDescription = "CAN is a communication peripheral which is used " +
|
||||
"when there is high noise in the signal bus. It uses a differential " +
|
||||
"wire topology to reduce the common noise. This applicatoin provides " +
|
||||
"a simplified interface to configure the different parameters of the " +
|
||||
"peripheral such as bit rate, time quanta and test mode etc. ";
|
||||
|
||||
function onChangeUseLoopback(inst, ui)
|
||||
{
|
||||
if (inst.enableLoopback) {
|
||||
ui.loopbackMode.hidden = false;
|
||||
}
|
||||
else {
|
||||
ui.loopbackMode.hidden = true;
|
||||
}
|
||||
}
|
||||
function onChangeUseAutoBusOn(inst, ui)
|
||||
{
|
||||
if (inst.enableAutoBusOn) {
|
||||
ui.AutoBusOnTimer.hidden = false;
|
||||
}
|
||||
else {
|
||||
ui.AutoBusOnTimer.hidden = true;
|
||||
}
|
||||
}
|
||||
function onChangeEnableInterrupt(inst, ui)
|
||||
{
|
||||
if (inst.enableInterrupt) {
|
||||
ui.registerInterrupts.hidden = false;
|
||||
ui.interruptFlags.hidden = false;
|
||||
ui.interruptLine.hidden = false;
|
||||
}
|
||||
else {
|
||||
ui.registerInterrupts.hidden = true;
|
||||
ui.interruptFlags.hidden = true;
|
||||
ui.interruptLine.hidden = true;
|
||||
}
|
||||
}
|
||||
|
||||
var msgCountConfig = []
|
||||
for (var msgCount = 1; msgCount <= 32; msgCount++)
|
||||
{
|
||||
msgCountConfig.push(
|
||||
{
|
||||
name: msgCount ,
|
||||
displayName: msgCount.toString()
|
||||
}
|
||||
);
|
||||
}
|
||||
var SysClk_MHz = Common.SYSCLK_getMaxMHz();
|
||||
var SysClk_Hz = SysClk_MHz * 1000000;
|
||||
var bitTimeOptions = [];
|
||||
for (var bitTime = 8; bitTime <= 25; bitTime++)
|
||||
{
|
||||
bitTimeOptions.push(
|
||||
{
|
||||
name: bitTime ,
|
||||
displayName: bitTime.toString()
|
||||
}
|
||||
);
|
||||
}
|
||||
var tSeg1 = 0;
|
||||
var tSeg2 = 0;
|
||||
var sjw = 0;
|
||||
var prescalerExtension = 0, prescaler = 0;
|
||||
var bitTime = 8;
|
||||
|
||||
function calcBitTimeParam(bitRate)
|
||||
{
|
||||
for (var i = 17; i >= 0; i--)
|
||||
{
|
||||
bitTime = i + 8;
|
||||
var brp = (SysClk_Hz/(bitRate*bitTime)), tProp = 2, tSync = 1, tPhase = bitTime - (tSync + tProp), phaseSeg1 = 0, phaseSeg2 = 0;
|
||||
if((tPhase / 2) <= 8)
|
||||
{
|
||||
phaseSeg2 = tPhase / 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
phaseSeg2 = 8;
|
||||
}
|
||||
tSeg1 = ((tPhase - phaseSeg2) + tProp) - 1;
|
||||
tSeg2 = phaseSeg2 - 1;
|
||||
sjw = 0;
|
||||
prescalerExtension = 0; prescaler = 0;
|
||||
if(phaseSeg2 > 4)
|
||||
{
|
||||
sjw = 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
sjw = tSeg2;
|
||||
}
|
||||
prescalerExtension = parseInt((brp - 1) / 64);
|
||||
prescaler = ((brp - 1) % 64);
|
||||
if(Number.isInteger(brp))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
function onChangeBitRate(inst, ui)
|
||||
{
|
||||
SysClk_Hz = inst.sysClock*1000000;
|
||||
calcBitTimeParam(inst.bitRate);
|
||||
inst.bitTime = bitTime;
|
||||
inst.bitRatePrescalerExtension = prescalerExtension;
|
||||
inst.bitRatePrescaler = prescaler;
|
||||
inst.bitTimeSeg1 = tSeg1;
|
||||
inst.bitTimeSeg2 = tSeg2;
|
||||
return;
|
||||
}
|
||||
|
||||
calcBitTimeParam(500000);
|
||||
|
||||
function onChangeAutoCalc(inst, ui)
|
||||
{
|
||||
if(inst.bitTimeAutoCalc)
|
||||
{
|
||||
ui.bitTime.readOnly = true;
|
||||
ui.bitTimeSeg1.readOnly = true;
|
||||
ui.bitTimeSeg2.readOnly = true;
|
||||
ui.bitRatePrescaler.readOnly = true;
|
||||
ui.bitRatePrescalerExtension.readOnly = true;
|
||||
ui.sjw.readOnly = true;
|
||||
onChangeBitRate(inst, ui);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.bitTime.readOnly = false;
|
||||
ui.bitTimeSeg1.readOnly = false;
|
||||
ui.bitTimeSeg2.readOnly = false;
|
||||
ui.bitRatePrescaler.readOnly = false;
|
||||
ui.bitRatePrescalerExtension.readOnly = false;
|
||||
ui.sjw.readOnly = false;
|
||||
}
|
||||
}
|
||||
|
||||
let config = [
|
||||
{
|
||||
name: "GROUP_BR",
|
||||
displayName: "Bit Rate Parameters",
|
||||
config: [
|
||||
{
|
||||
name : "sysClock",
|
||||
displayName : "Device SYSCLK MHz",
|
||||
description : 'Device System Clock Frequency',
|
||||
hidden : false,
|
||||
default : SysClk_MHz,
|
||||
onChange : onChangeBitRate,
|
||||
},
|
||||
{
|
||||
name : "bitRate",
|
||||
displayName : "Bit Rate Bps",
|
||||
description : 'CAN bus bit rate',
|
||||
hidden : false,
|
||||
default : "500000",
|
||||
onChange : onChangeBitRate,
|
||||
options :[
|
||||
{name: "1000000", displayName : "1000000"},
|
||||
{name: "800000", displayName : "800000"},
|
||||
{name: "500000", displayName : "500000"},
|
||||
{name: "250000", displayName : "250000"},
|
||||
{name: "125000", displayName : "125000"},
|
||||
{name: "100000", displayName : "100000"},
|
||||
{name: "50000", displayName : "50000"},
|
||||
],
|
||||
},
|
||||
{
|
||||
name : "bitTimeAutoCalc",
|
||||
displayName : "Use Calculated Values for Bit Timing Parameters",
|
||||
description : 'Use Calculated Values for Bit Timing Parameters',
|
||||
hidden : false,
|
||||
onChange : onChangeAutoCalc,
|
||||
default : true,
|
||||
|
||||
},
|
||||
{
|
||||
name : "bitTime",
|
||||
displayName : "Bit Time Quanta (Tq)",
|
||||
description : 'Number of time quanta per bit',
|
||||
hidden : false,
|
||||
default : bitTimeOptions[bitTime-8].name,
|
||||
options : bitTimeOptions,
|
||||
readOnly : true,
|
||||
|
||||
},
|
||||
{
|
||||
name : "bitRatePrescalerExtension",
|
||||
displayName : "Bit Rate Prescelar Extension",
|
||||
description : 'Bit Rate Prescelar Extension',
|
||||
hidden : false,
|
||||
default : prescalerExtension,
|
||||
readOnly : true,
|
||||
|
||||
},
|
||||
{
|
||||
name : "bitRatePrescaler",
|
||||
displayName : "Bit Rate Prescaler",
|
||||
description : 'Bit Rate Prescaler',
|
||||
hidden : false,
|
||||
default : prescaler,
|
||||
readOnly : true,
|
||||
|
||||
},
|
||||
{
|
||||
name : "bitTimeSeg1",
|
||||
displayName : "Bit Time segment before sample point (Tq)",
|
||||
description : 'Bit Time segment before sample point (Tq)',
|
||||
hidden : false,
|
||||
default : tSeg1,
|
||||
readOnly : true,
|
||||
|
||||
},
|
||||
{
|
||||
name : "bitTimeSeg2",
|
||||
displayName : "Bit Time segment after sample point (Tq)",
|
||||
description : 'Bit Time segment after sample point (Tq)',
|
||||
hidden : false,
|
||||
default : tSeg2,
|
||||
readOnly : true,
|
||||
|
||||
},
|
||||
{
|
||||
name : "sjw",
|
||||
displayName : "(Re)Synchronization Jump Width (Tq)",
|
||||
description : '(Re)Synchronization Jump Width (Tq)',
|
||||
hidden : false,
|
||||
default : sjw,
|
||||
readOnly : true,
|
||||
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
name : "enableLoopback",
|
||||
displayName : "Enable Loopback",
|
||||
description : 'Whether loopback mode to be enabled.',
|
||||
hidden : false,
|
||||
onChange : onChangeUseLoopback,
|
||||
default : false,
|
||||
},
|
||||
{
|
||||
name : "loopbackMode",
|
||||
displayName : "Loopback Mode",
|
||||
description : 'Which loopback mode to use if enabled.',
|
||||
hidden : true,
|
||||
default : "CAN_TEST_SILENT",
|
||||
options : [
|
||||
{name: "CAN_TEST_SILENT", displayName : "Silent Mode"},
|
||||
{name: "CAN_TEST_LBACK", displayName : "Internal Loopback Mode"},
|
||||
{name: "CAN_TEST_EXL", displayName : "External Loopback Mode"},
|
||||
],
|
||||
|
||||
},
|
||||
{
|
||||
name : "enableAutoBusOn",
|
||||
displayName : "Enable Auto-Bus-On",
|
||||
description : 'Whether auto bus on feature is to be enabled.',
|
||||
hidden : false,
|
||||
onChange : onChangeUseAutoBusOn,
|
||||
default : false,
|
||||
},
|
||||
{
|
||||
name : "AutoBusOnTimer",
|
||||
displayName : "Auto-Bus-On Timer",
|
||||
description : 'Auto-Bus-On Timer value if enabled.',
|
||||
hidden : true,
|
||||
default : 0,
|
||||
|
||||
},
|
||||
{
|
||||
name: "GROUP_INT",
|
||||
displayName: "Interrupts",
|
||||
config: [
|
||||
{
|
||||
name : "enableInterrupt",
|
||||
displayName : "Enable Interrupt",
|
||||
description : 'To Enable CAN Interrupts.',
|
||||
hidden : false,
|
||||
onChange : onChangeEnableInterrupt,
|
||||
default : false,
|
||||
},
|
||||
{
|
||||
name : "registerInterrupts",
|
||||
displayName : "Register Interrupt Handler",
|
||||
description : 'Whether or not to register interrupt handlers in the interrupt module.',
|
||||
hidden : true,
|
||||
default : false
|
||||
|
||||
},
|
||||
{
|
||||
name : "interruptFlags",
|
||||
displayName : "Enable Interrupts",
|
||||
description : 'Which Interrupts to enable.',
|
||||
hidden : true,
|
||||
minSelections : 0,
|
||||
default : [],
|
||||
options : [
|
||||
{name: "CAN_INT_ERROR", displayName : "Controller error condition "},
|
||||
{name: "CAN_INT_STATUS", displayName : "Message transfer complete or bus error"},
|
||||
{name: "CAN_INT_IE0", displayName : "Enable CAN line 0 Interrupts"},
|
||||
{name: "CAN_INT_IE1", displayName : "Enable CAN line 1 Interrupts"},
|
||||
],
|
||||
|
||||
},
|
||||
{
|
||||
name : "interruptLine",
|
||||
displayName : "Enable Global Interrupt Lines",
|
||||
description : 'Which Interrupt lines to enable.',
|
||||
hidden : true,
|
||||
minSelections : 0,
|
||||
default : [],
|
||||
options : [
|
||||
{name: "CAN_GLOBAL_INT_CANINT0", displayName : "Enable CAN Global Interrupt line 0"},
|
||||
{name: "CAN_GLOBAL_INT_CANINT1", displayName : "Enable CAN Global Interrupt line 1"},
|
||||
],
|
||||
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
deprecated : true,
|
||||
name : "msgObjs",
|
||||
displayName : "Message Objects",
|
||||
description : 'Message objects need to be configured',
|
||||
hidden : false,
|
||||
default : 0,
|
||||
onChange : (inst, ui) => {
|
||||
var convertedArray = []
|
||||
for (var mO = 1; mO <= inst["msgObjs"]; mO++)
|
||||
{
|
||||
convertedArray.push(mO);
|
||||
}
|
||||
inst["msgObjsUsed"] = convertedArray;
|
||||
}
|
||||
},
|
||||
{
|
||||
name : "msgObjsUsed",
|
||||
displayName : "Message Objects used (1-32)",
|
||||
description : 'Message objects need to be configured',
|
||||
hidden : false,
|
||||
minSelections : 0,
|
||||
default : [],
|
||||
options : msgCountConfig
|
||||
},
|
||||
{
|
||||
name: "useCase",
|
||||
displayName : "PinMux Use Case",
|
||||
description : 'Peripheral use case',
|
||||
hidden : false,
|
||||
default : 'ALL',
|
||||
options : Pinmux.getPeripheralUseCaseNames("CAN"),
|
||||
onChange : Pinmux.useCaseChanged,
|
||||
},
|
||||
{
|
||||
name : "startModule",
|
||||
displayName : "Start CAN module in CAN_init() function",
|
||||
description : "Starts the CAN Module",
|
||||
hidden : false,
|
||||
default : true,
|
||||
},
|
||||
];
|
||||
|
||||
function moduleInstances(inst,ui)
|
||||
{
|
||||
let components = [];
|
||||
|
||||
var pinmuxQualMods = Pinmux.getGpioQualificationModInstDefinitions("CAN", inst)
|
||||
for (var pinmuxQualMod of pinmuxQualMods)
|
||||
{
|
||||
pinmuxQualMod.args.padConfig = "PULLUP";
|
||||
|
||||
if(pinmuxQualMod.name.includes("rx"))
|
||||
{
|
||||
pinmuxQualMod.requiredArgs = {
|
||||
qualMode : "GPIO_QUAL_ASYNC",
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pinmuxQualMod.args.qualMode = "GPIO_QUAL_ASYNC";
|
||||
}
|
||||
}
|
||||
components = components.concat(pinmuxQualMods)
|
||||
|
||||
for(var i in inst.msgObjsUsed)
|
||||
{
|
||||
components = components.concat([
|
||||
{
|
||||
moduleName : "/driverlib/canMsgObj.js",
|
||||
name : "msgObj"+inst.msgObjsUsed[i],
|
||||
displayName: "Message Object "+inst.msgObjsUsed[i],
|
||||
collapsed : true,
|
||||
},
|
||||
]);
|
||||
}
|
||||
if (inst.enableInterrupt && inst.registerInterrupts)
|
||||
{
|
||||
components = components.concat([{
|
||||
name: "can0Int",
|
||||
displayName: "CAN Interrupt 0",
|
||||
moduleName: "/driverlib/interrupt.js",
|
||||
collapsed: true,
|
||||
args: {
|
||||
$name : inst.$name + "_0_INT",
|
||||
int : "INT_" + inst.$name + "_0",
|
||||
pinmuxPeripheralModule : "can",
|
||||
driverlibInt: "INT_#0"
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "can1Int",
|
||||
displayName: "CAN Interrupt 1",
|
||||
moduleName: "/driverlib/interrupt.js",
|
||||
collapsed: true,
|
||||
args: {
|
||||
$name : inst.$name + "_1_INT",
|
||||
int : "INT_" + inst.$name + "_1",
|
||||
pinmuxPeripheralModule : "can",
|
||||
driverlibInt: "INT_#1"
|
||||
}
|
||||
}]);
|
||||
}
|
||||
return components;
|
||||
}
|
||||
|
||||
/*
|
||||
* ======== filterHardware ========
|
||||
* Control RX, TX Pin usage by the user specified dataDirection.
|
||||
*
|
||||
* param component - hardware object describing signals and
|
||||
* resources they're attached to
|
||||
*
|
||||
* returns Boolean indicating whether or not to allow the component to
|
||||
* be assigned to an instance's $hardware config
|
||||
*/
|
||||
function filterHardware(component)
|
||||
{
|
||||
return (Common.typeMatches(component.type, ["CAN"]));
|
||||
}
|
||||
|
||||
if (Common.onlyPinmux())
|
||||
{
|
||||
config = [config[config.length - 1]];
|
||||
}
|
||||
|
||||
|
||||
function onValidate(inst, validation) {
|
||||
|
||||
if ( inst.bitRatePrescaler >= 64 || inst.bitRatePrescaler < 0)
|
||||
{
|
||||
validation.logError(
|
||||
"The Bit Rate Prescaler must be a number between 0 and 64",
|
||||
inst, "bitRatePrescaler");
|
||||
}
|
||||
if ((inst.bitRatePrescalerExtension < 0) || (inst.bitRatePrescalerExtension >= 16))
|
||||
{
|
||||
validation.logError(
|
||||
"The Bit Rate Prescaler Extension value must be a number between 0 and 16",
|
||||
inst, "bitRatePrescalerExtension");
|
||||
}
|
||||
if ( inst.bitTimeSeg1 >= 16 || inst.bitTimeSeg1 <= 0)
|
||||
{
|
||||
validation.logError(
|
||||
"The Bit Time segment before sampling must be a number between 1 and 16",
|
||||
inst, "bitTimeSeg1");
|
||||
}
|
||||
if ( inst.bitTimeSeg2 >= 8 || inst.bitTimeSeg1 < 0)
|
||||
{
|
||||
validation.logError(
|
||||
"The Bit Time segment after sampling must be a number between 0 and 8",
|
||||
inst, "bitTimeSeg2");
|
||||
}
|
||||
if ( inst.sjw >= 4 || inst.sjw < 0)
|
||||
{
|
||||
validation.logError(
|
||||
"(Re)Synchronization Jump Width must be a number between 0 and 4",
|
||||
inst, "sjw");
|
||||
}
|
||||
if ( inst.sysClock != SysClk_MHz)
|
||||
{
|
||||
validation.logWarning(
|
||||
"Sysclk Frequency is not the default value of " + String(SysClk_MHz),
|
||||
inst, "sysClock");
|
||||
}
|
||||
if((String(inst.interruptFlags).includes("CAN_INT_IE0") || String(inst.interruptFlags).includes("CAN_INT_STATUS") || String(inst.interruptFlags).includes("CAN_INT_ERROR")) && !String(inst.interruptLine).includes("CAN_GLOBAL_INT_CANINT0"))
|
||||
{
|
||||
validation.logWarning("Line 0 Interrupts Enabled but Global Line 0 Not Enabled",
|
||||
inst, "interruptLine");
|
||||
}
|
||||
if(String(inst.interruptFlags).includes("CAN_INT_IE1") && !String(inst.interruptLine).includes("CAN_GLOBAL_INT_CANINT1"))
|
||||
{
|
||||
validation.logWarning("Line 1 Interrupt Enabled but Global Line 1 Not Enabled",
|
||||
inst, "interruptLine");
|
||||
}
|
||||
|
||||
var pinmuxQualMods = Pinmux.getGpioQualificationModInstDefinitions("CAN", inst)
|
||||
for (var pinmuxQualMod of pinmuxQualMods)
|
||||
{
|
||||
if ((inst[pinmuxQualMod.name].padConfig.includes("OD")) || (inst[pinmuxQualMod.name].padConfig.includes("INVERT")))
|
||||
{
|
||||
validation.logError("The open-drain and inverted pad configurations should not be used for the CAN module.", inst);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var canModule = {
|
||||
peripheralName: "CAN",
|
||||
displayName: "CAN",
|
||||
maxInstances: Common.peripheralCount("CAN"),
|
||||
defaultInstanceName: "myCAN",
|
||||
description: "Controller Area Network Peripheral",
|
||||
longDescription: (Common.getCollateralFindabilityList("DCAN")),
|
||||
filterHardware : filterHardware,
|
||||
moduleInstances : moduleInstances,
|
||||
config: config,
|
||||
templates: {
|
||||
boardc : "/driverlib/can/can.board.c.xdt",
|
||||
boardh : "/driverlib/can/can.board.h.xdt"
|
||||
},
|
||||
validate: onValidate,
|
||||
pinmuxRequirements : Pinmux.canPinmuxRequirements
|
||||
};
|
||||
|
||||
|
||||
if (canModule.maxInstances <= 0)
|
||||
{
|
||||
delete canModule.pinmuxRequirements;
|
||||
}
|
||||
else
|
||||
{
|
||||
Pinmux.addCustomPinmuxEnumToConfig(canModule)
|
||||
Pinmux.addPinMuxQualGroupToConfig(canModule)
|
||||
}
|
||||
|
||||
exports = canModule;
|
||||
@@ -0,0 +1,97 @@
|
||||
% var module = system.modules['/driverlib/can.js'];
|
||||
% let Common = system.getScript("/driverlib/Common.js");
|
||||
% var nameOfModule = "can";
|
||||
% var nameOfPeripheral = module.peripheralName;
|
||||
//*****************************************************************************
|
||||
//
|
||||
// CAN Configurations
|
||||
//
|
||||
//*****************************************************************************
|
||||
void `nameOfPeripheral`_init(){
|
||||
% for(var i = 0; i < module.$instances.length; i++)
|
||||
% {
|
||||
% var instance = module.$instances[i];
|
||||
`instance.$name`_init();
|
||||
% }
|
||||
}
|
||||
|
||||
%if (module != null)
|
||||
%{
|
||||
% for(var i = 0; i < module.$instances.length; i++) {
|
||||
% var instance = module.$instances[i];
|
||||
void `instance.$name`_init(){
|
||||
CAN_initModule(`instance.$name`_BASE);
|
||||
//
|
||||
// Refer to the Driver Library User Guide for information on how to set
|
||||
// tighter timing control. Additionally, consult the device data sheet
|
||||
// for more information about the CAN module clocking.
|
||||
//
|
||||
CAN_setBitTiming(`instance.$name`_BASE, `instance.bitRatePrescaler`, `instance.bitRatePrescalerExtension`, `instance.bitTimeSeg1`, `instance.bitTimeSeg2`, `instance.sjw`);
|
||||
% if (instance.enableLoopback){
|
||||
//
|
||||
// Enable CAN test mode
|
||||
//
|
||||
CAN_enableTestMode(`instance.$name`_BASE, `instance.loopbackMode`);
|
||||
%}
|
||||
% if (instance.enableAutoBusOn){
|
||||
//
|
||||
// Enable CAN Auto-Bus-On
|
||||
//
|
||||
CAN_enableAutoBusOn(`instance.$name`_BASE);
|
||||
//
|
||||
// Set Auto-Bus-On Timer
|
||||
//
|
||||
CAN_setAutoBusOnTime(`instance.$name`_BASE, `instance.AutoBusOnTimer`);
|
||||
%}
|
||||
% if (instance.enableInterrupt){
|
||||
//
|
||||
// Enable CAN Interrupts
|
||||
//
|
||||
% let x = String(instance.interruptFlags).split(",").join("|");
|
||||
% if (!x) { x = "0";}
|
||||
CAN_enableInterrupt(`instance.$name`_BASE, `x`);
|
||||
% for (var int_index in instance.interruptLine)
|
||||
%{
|
||||
CAN_enableGlobalInterrupt(`instance.$name`_BASE, `instance.interruptLine[int_index]`);
|
||||
%}
|
||||
%}
|
||||
% var MailBoxInterruptLineAssert = 0;
|
||||
% for(var i2 in instance.msgObjsUsed) {
|
||||
% var msgObjInstance = instance["msgObj" + instance.msgObjsUsed[i2]];
|
||||
//
|
||||
// Initialize the transmit message object used for sending CAN messages.
|
||||
// Message Object Parameters:
|
||||
// Message Object ID Number: `instance.msgObjsUsed[i2]`
|
||||
// Message Identifier: `msgObjInstance.msgID`
|
||||
// Message Frame: `msgObjInstance.frameType`
|
||||
// Message Type: `msgObjInstance.msgType`
|
||||
// Message ID Mask: `msgObjInstance.msgIDMask`
|
||||
// Message Object Flags: `msgObjInstance.flags`
|
||||
// Message Data Length: `msgObjInstance.msgLen` Bytes
|
||||
//
|
||||
% let x = String(msgObjInstance.flags).split(",").join("|");
|
||||
% if (!x) { x = "0";}
|
||||
CAN_setupMessageObject(`instance.$name`_BASE, `instance.msgObjsUsed[i2]`, `instance.$name`_MessageObj`instance.msgObjsUsed[i2]`_ID, `msgObjInstance.frameType`,`msgObjInstance.msgType`, `msgObjInstance.msgIDMask`, `x`,`msgObjInstance.msgLen`);
|
||||
% MailBoxInterruptLineAssert |= msgObjInstance.intLine << instance.msgObjsUsed[i2];
|
||||
%}
|
||||
% if (instance.enableInterrupt){
|
||||
CAN_setInterruptMux(`instance.$name`_BASE, `MailBoxInterruptLineAssert`);
|
||||
% }
|
||||
% if(instance.startModule){
|
||||
//
|
||||
// Start CAN module operations
|
||||
//
|
||||
CAN_startModule(`instance.$name`_BASE);
|
||||
% let instancePinmux = instance[nameOfModule];
|
||||
% let solution = instancePinmux.$solution;
|
||||
% let peripheral = system.deviceData.peripherals[solution.peripheralName];
|
||||
%} else{
|
||||
//
|
||||
// The CAN module is not started in this function.
|
||||
// The application SW must call the CAN_startModule when needed.
|
||||
// CAN_startModule(`instance.$name`_BASE);
|
||||
//
|
||||
%}
|
||||
}
|
||||
%}
|
||||
%}
|
||||
@@ -0,0 +1,24 @@
|
||||
% var moduleName = "can"
|
||||
% var module = system.modules['/driverlib/' + moduleName + '.js'];
|
||||
%if (module != null)
|
||||
%{
|
||||
//*****************************************************************************
|
||||
//
|
||||
// CAN Configurations
|
||||
//
|
||||
//*****************************************************************************
|
||||
% for(var i = 0; i < module.$instances.length; i++) {
|
||||
% var instance = module.$instances[i];
|
||||
% let modInst = instance[moduleName];
|
||||
% let solution = modInst.$solution;
|
||||
%let peripheral = system.deviceData.peripherals[solution.peripheralName];
|
||||
#define `instance.$name`_BASE `peripheral.name`_BASE
|
||||
|
||||
% for(var i2 in instance.msgObjsUsed) {
|
||||
% var msgObjInstance = instance["msgObj" + instance.msgObjsUsed[i2]];
|
||||
#define `instance.$name`_MessageObj`instance.msgObjsUsed[i2]`_ID `msgObjInstance.msgID`
|
||||
%}
|
||||
void `instance.$name`_init();
|
||||
|
||||
% }
|
||||
%}
|
||||
@@ -0,0 +1,192 @@
|
||||
let Common = system.getScript("/driverlib/Common.js");
|
||||
let Pinmux = system.getScript("/driverlib/pinmux.js");
|
||||
|
||||
let device_driverlib_peripheral =
|
||||
system.getScript("/driverlib/device_driverlib_peripherals/" +
|
||||
Common.getDeviceName().toLowerCase() + "_can.js");
|
||||
|
||||
var MaskWrongSettingVal = false;
|
||||
function onChangeMsgType(inst, ui)
|
||||
{
|
||||
if ((inst.msgType == device_driverlib_peripheral.CAN_MsgObjType[0].name) || inst.msgType == device_driverlib_peripheral.CAN_MsgObjType[1].name) {
|
||||
ui.msgIDMask.hidden = true;
|
||||
}
|
||||
else {
|
||||
ui.msgIDMask.hidden = false;
|
||||
if ((String(inst.msgType).includes("CAN_MSG_OBJ_TYPE_RXTX_REMOTE"))){
|
||||
ui.msgIDMask.readOnly = false;
|
||||
}
|
||||
}
|
||||
if ((inst.msgType == device_driverlib_peripheral.CAN_MsgObjType[2].name)) {
|
||||
ui.msgLen.hidden = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.msgLen.hidden = false;
|
||||
}
|
||||
if ((ui.msgIDMask.readOnly == true) && (inst.msgIDMask != 0))
|
||||
{
|
||||
MaskWrongSettingVal = true;
|
||||
}
|
||||
else {
|
||||
MaskWrongSettingVal = false;
|
||||
}
|
||||
}
|
||||
|
||||
function onChangeFlags(inst, ui)
|
||||
{
|
||||
if ((String(inst.flags).includes("CAN_MSG_OBJ_USE_ID_FILTER")) ||(String(inst.flags).includes("CAN_MSG_OBJ_USE_EXT_FILTER")) || (String(inst.msgType).includes("CAN_MSG_OBJ_TYPE_RXTX_REMOTE"))) {
|
||||
ui.msgIDMask.readOnly = false;
|
||||
}
|
||||
else {
|
||||
ui.msgIDMask.readOnly = true;
|
||||
}
|
||||
if ((ui.msgIDMask.readOnly == true) && (inst.msgIDMask != 0))
|
||||
{
|
||||
MaskWrongSettingVal = true;
|
||||
}
|
||||
else {
|
||||
MaskWrongSettingVal = false;
|
||||
}
|
||||
}
|
||||
|
||||
function displayMsgObjConf(inst, ui)
|
||||
{
|
||||
if (inst.msgObjs > 0) {
|
||||
ui.msgID.hidden = false;
|
||||
ui.flags.hidden = false;
|
||||
ui.msgLen.hidden = false;
|
||||
ui.msgIDMask.hidden = false;
|
||||
ui.msgType.hidden = false;
|
||||
ui.frameType.hidden = false;
|
||||
}
|
||||
else {
|
||||
ui.msgID.hidden = true;
|
||||
ui.flags.hidden = true;
|
||||
ui.msgLen.hidden = true;
|
||||
ui.msgIDMask.hidden = true;
|
||||
ui.msgType.hidden = true;
|
||||
ui.frameType.hidden = true;
|
||||
}
|
||||
}
|
||||
let config = [
|
||||
{
|
||||
name : "frameType",
|
||||
displayName : "Type of Frame",
|
||||
description : 'Type of Frame',
|
||||
hidden : false,
|
||||
default : device_driverlib_peripheral.CAN_MsgFrameType[0].name,
|
||||
options : device_driverlib_peripheral.CAN_MsgFrameType
|
||||
},
|
||||
{
|
||||
name : "msgID",
|
||||
displayName : "Message Identifier",
|
||||
description : 'Message ID of object',
|
||||
hidden : false,
|
||||
default : 0,
|
||||
},
|
||||
{
|
||||
name : "msgType",
|
||||
displayName : "Type of Message",
|
||||
description : 'Type of Message',
|
||||
hidden : false,
|
||||
onChange : onChangeMsgType,
|
||||
default : device_driverlib_peripheral.CAN_MsgObjType[2].name,
|
||||
options : device_driverlib_peripheral.CAN_MsgObjType
|
||||
},
|
||||
{
|
||||
name : "flags",
|
||||
displayName : "Flags for Message Object",
|
||||
description : 'Flags for Message Object',
|
||||
hidden : false,
|
||||
onChange : onChangeFlags,
|
||||
default : [],
|
||||
minSelections: 0,
|
||||
options : [
|
||||
{name: "CAN_MSG_OBJ_TX_INT_ENABLE", displayName : "Enable Transmit Interrupts"},
|
||||
{name: "CAN_MSG_OBJ_RX_INT_ENABLE", displayName : "Enable Receive Interrupts"},
|
||||
{name: "CAN_MSG_OBJ_USE_ID_FILTER", displayName : "Use filtering based on the Message ID"},
|
||||
{name: "CAN_MSG_OBJ_USE_EXT_FILTER", displayName : "Use filtering based on the Extended Identifier"},
|
||||
{name: "CAN_MSG_OBJ_USE_DIR_FILTER", displayName : "Use filtering based on the direction of the transfer"},
|
||||
{name: "CAN_MSG_OBJ_FIFO", displayName : "Message object part of a FIFO and not final message"},
|
||||
],
|
||||
},
|
||||
{
|
||||
name : "msgIDMask",
|
||||
displayName : "Message Identifier Mask",
|
||||
description : 'CAN message identifier mask when filtering is enabled',
|
||||
hidden : false,
|
||||
readOnly : true,
|
||||
default : 0,
|
||||
},
|
||||
{
|
||||
name : "msgLen",
|
||||
displayName : "Message data length (0-8)",
|
||||
description : 'Number of data bytes in the Message',
|
||||
hidden : true,
|
||||
default : 0,
|
||||
},
|
||||
{
|
||||
name : "intLine",
|
||||
displayName : "Trigger Interrupt on Line",
|
||||
description : 'Which Interrupt Line to be asserted when Interrupt occurs',
|
||||
hidden : false,
|
||||
default : "0",
|
||||
options : [
|
||||
{name: "0", displayName : "Assert CAN line 0 interrupt for this Mailbox"},
|
||||
{name: "1", displayName : "Assert CAN line 1 interrupt for this Mailbox"},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
function onValidate(inst, validation) {
|
||||
if (inst.frameType == device_driverlib_peripheral.CAN_MsgFrameType[0].name)
|
||||
{
|
||||
if (inst.msgID < 0 || inst.msgID > 0x7FF)
|
||||
{
|
||||
validation.logError(
|
||||
"The Message ID must be a 11 bit value",
|
||||
inst, "msgID");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (inst.msgID < 0 || inst.msgID > 0x1FFFFFFF)
|
||||
{
|
||||
validation.logError(
|
||||
"The Message ID must be a 29 bit value",
|
||||
inst, "msgID");
|
||||
}
|
||||
}
|
||||
if (inst.msgIDMask < 0 || inst.msgIDMask > 0x1FFFFFFF)
|
||||
{
|
||||
validation.logError(
|
||||
"The Message ID Mask must be a 29 bit value",
|
||||
inst, "msgIDMask");
|
||||
}
|
||||
if (inst.msgLen < 0 || inst.msgLen > 8)
|
||||
{
|
||||
validation.logError(
|
||||
"The Message data length must be between 0 and 8",
|
||||
inst, "msgLen");
|
||||
}
|
||||
if (MaskWrongSettingVal)
|
||||
{
|
||||
validation.logWarning(
|
||||
"The Message ID Mask has a nonzero value but is not used in the current configuration",
|
||||
inst, "msgIDMask");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var canMsgObj = {
|
||||
displayName: "canMsgObj",
|
||||
maxInstances: 64,
|
||||
defaultInstanceName: "msgObj",
|
||||
description: "Message Object",
|
||||
config: config,
|
||||
validate: onValidate,
|
||||
};
|
||||
|
||||
exports = canMsgObj;
|
||||
@@ -0,0 +1,311 @@
|
||||
let Common = system.getScript("/driverlib/Common.js");
|
||||
let Pinmux = system.getScript("/driverlib/pinmux.js");
|
||||
|
||||
let device_driverlib_peripheral =
|
||||
system.getScript("/driverlib/device_driverlib_peripherals/" +
|
||||
Common.getDeviceName().toLowerCase() + "_cla.js");
|
||||
let device_driverlib_memmap =
|
||||
system.getScript("/driverlib/device_driverlib_peripherals/" +
|
||||
Common.getDeviceName().toLowerCase() + "_memmap.js");
|
||||
let device_driverlib_int =
|
||||
system.getScript("/driverlib/device_driverlib_peripherals/" +
|
||||
Common.getDeviceName().toLowerCase() + "_interrupt.js");
|
||||
let device_driverlib_memcfg =
|
||||
system.getScript("/driverlib/device_driverlib_peripherals/" +
|
||||
Common.getDeviceName().toLowerCase() + "_memcfg.js");
|
||||
|
||||
/* Intro splash on GUI */
|
||||
let longDescription = `The Control Law Accelerator (CLA) extends the capabilities of the C28x CPU by adding parallel processing. Time-critical
|
||||
control loops serviced by the CLA can achieve low ADC sample to output delay. Thus, the CLA enables
|
||||
faster system response and higher frequency control loops. Utilizing the CLA for time-critical tasks frees up the
|
||||
main CPU to perform other system and communication functions concurrently.
|
||||
`;
|
||||
var CLA_INSTANCE = [];
|
||||
CLA_INSTANCE.push({
|
||||
name : "CLA1_BASE",
|
||||
displayName : "CLA1"
|
||||
})
|
||||
|
||||
/*
|
||||
*
|
||||
* CLA instance selection UI
|
||||
*
|
||||
*/
|
||||
|
||||
let config = [
|
||||
{
|
||||
name : "claBase",
|
||||
displayName : "CLA Instance",
|
||||
description : 'Instance of the CLA used.',
|
||||
hidden : false,
|
||||
default : CLA_INSTANCE[0].name,
|
||||
options : CLA_INSTANCE
|
||||
},
|
||||
];
|
||||
|
||||
/*
|
||||
*
|
||||
* CLA Task configuration UI
|
||||
*
|
||||
*/
|
||||
|
||||
// Generate task configuration UI
|
||||
var clatask_group_config = [];
|
||||
|
||||
// Task Enable checkbox for each task
|
||||
device_driverlib_peripheral.CLA_TaskNumber.
|
||||
forEach((element, index) =>
|
||||
{
|
||||
clatask_group_config = clatask_group_config.concat([
|
||||
{
|
||||
name : "enable_"+element.name,
|
||||
displayName : "Enable " + element.displayName,
|
||||
default : true,
|
||||
onChange : onChangeEnableClaTask
|
||||
}
|
||||
]);
|
||||
});
|
||||
|
||||
// Configuration UI for each task
|
||||
device_driverlib_peripheral.CLA_TaskNumber.
|
||||
forEach((element, index) =>
|
||||
{
|
||||
var clataskindex = element.name[element.name.length-1];
|
||||
var clataskname = element.name;
|
||||
|
||||
var clatask_config = [];
|
||||
clatask_config = clatask_config.concat([
|
||||
{
|
||||
name : "mvect_"+clataskname,
|
||||
displayName : "Interrupt Vector",
|
||||
default : device_driverlib_peripheral.CLA_MVECTNumber[index].name,
|
||||
readOnly : true,
|
||||
},
|
||||
{
|
||||
name : "name_"+clataskname,
|
||||
displayName : "Interrupt Name",
|
||||
default : "Cla1Task"+clataskindex,
|
||||
},
|
||||
{
|
||||
name : "trigger_"+clataskname,
|
||||
displayName : "Trigger Source",
|
||||
default : device_driverlib_peripheral.CLA_Trigger[0].name,
|
||||
options : device_driverlib_peripheral.CLA_Trigger
|
||||
},
|
||||
]);
|
||||
|
||||
clatask_group_config = clatask_group_config.concat([
|
||||
{
|
||||
name : "group_"+clataskname,
|
||||
displayName : element.displayName,
|
||||
description : "",
|
||||
longDescription : "",
|
||||
config : clatask_config
|
||||
}
|
||||
]);
|
||||
});
|
||||
|
||||
|
||||
|
||||
// If device has CLA version 2, add task 8 background task configuration option
|
||||
var CLA2_device_list = ["f28004x", "f2838x", "f28003x", "f28p65x", "f28p55x"];
|
||||
|
||||
if (CLA2_device_list.includes(Common.getDeviceName().toLowerCase()))
|
||||
{
|
||||
clatask_group_config[15].config = clatask_group_config[15].config.concat([
|
||||
{
|
||||
name : "background_"+device_driverlib_peripheral.CLA_TaskNumber[7].name,
|
||||
displayName : "Enable Background Task (CLA Task 8)",
|
||||
default : false,
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
||||
// Add the CLA task configuration block to UI
|
||||
config = config.concat([
|
||||
{
|
||||
name : "claTaskGroup",
|
||||
displayName : "CLA Task Configuration",
|
||||
config : clatask_group_config,
|
||||
},
|
||||
]);
|
||||
|
||||
/*
|
||||
*
|
||||
* CLA memory allocation UI
|
||||
*
|
||||
*/
|
||||
var LSRAM_list = [];
|
||||
device_driverlib_memcfg.MEMCFG_SECT.
|
||||
forEach((element, index) =>
|
||||
{
|
||||
if ((element.name.includes("MEMCFG_SECT_LS")) && (element.name != "MEMCFG_SECT_LSX_ALL"))
|
||||
{
|
||||
LSRAM_list.push(element);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* CLA task CPU interrupt configuration UI
|
||||
*
|
||||
*/
|
||||
|
||||
// Generate CPU interrupt configuration UI
|
||||
var cpuint_group_config = [];
|
||||
|
||||
device_driverlib_peripheral.CLA_TaskNumber.
|
||||
forEach((element, index) =>
|
||||
{
|
||||
cpuint_group_config = cpuint_group_config.concat([
|
||||
{
|
||||
name : "cpuint_"+element.name,
|
||||
displayName : "Register Interrupt for " + element.displayName,
|
||||
default : true,
|
||||
}
|
||||
]);
|
||||
});
|
||||
|
||||
// Add the CPU interrupt configuration block to UI
|
||||
config = config.concat([
|
||||
{
|
||||
name : "cpuIntGroup",
|
||||
displayName : "C28 Interrupt Register for CLA Task",
|
||||
config : cpuint_group_config,
|
||||
},
|
||||
]);
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* Callback function for enable task
|
||||
*
|
||||
*/
|
||||
function onChangeEnableClaTask(inst, ui) {
|
||||
//console.log("Changed enable checkbox");
|
||||
//console.log(inst);
|
||||
//console.log(ui);
|
||||
|
||||
device_driverlib_peripheral.CLA_TaskNumber.
|
||||
forEach((element, index) =>
|
||||
{
|
||||
// Task enabled, show configuration UI
|
||||
if (inst["enable_"+element.name])
|
||||
{
|
||||
ui["mvect_"+element.name].hidden = false;
|
||||
ui["name_"+element.name].hidden = false;
|
||||
ui["trigger_"+element.name].hidden = false;
|
||||
if (element.name[element.name.length-1] == 8 && typeof ui["background_"+element.name] !== 'undefined')
|
||||
{
|
||||
ui["background_"+element.name].hidden = false;
|
||||
}
|
||||
}
|
||||
else // Hide configuration UI
|
||||
{
|
||||
ui["mvect_"+element.name].hidden = true;
|
||||
ui["name_"+element.name].hidden = true;
|
||||
ui["trigger_"+element.name].hidden = true;
|
||||
if (element.name[element.name.length-1] == 8 && typeof ui["background_"+element.name] !== 'undefined')
|
||||
{
|
||||
ui["background_"+element.name].hidden = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* Validate configuration
|
||||
*
|
||||
*/
|
||||
function onValidate(inst, validation) {
|
||||
|
||||
//
|
||||
// Make sure the BASE address is not duplicated
|
||||
//
|
||||
var usedCLAInsts = [];
|
||||
for (var instance_index in inst.$module.$instances)
|
||||
{
|
||||
var instance_obj = inst.$module.$instances[instance_index];
|
||||
usedCLAInsts.push(instance_obj.claBase);
|
||||
}
|
||||
|
||||
var duplicatesResult = Common.findDuplicates(usedCLAInsts)
|
||||
|
||||
if (duplicatesResult.duplicates.length != 0)
|
||||
{
|
||||
var allDuplicates = "";
|
||||
for (var duplicateNamesIndex in duplicatesResult.duplicates)
|
||||
{
|
||||
allDuplicates = allDuplicates + Common.stringOrEmpty(allDuplicates, ", ")
|
||||
+ duplicatesResult.duplicates[duplicateNamesIndex];
|
||||
}
|
||||
validation.logError(
|
||||
"The CLA Instance used. Duplicates: " + allDuplicates,
|
||||
inst, "claBase");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* Add MemCfg dependency
|
||||
*
|
||||
*/
|
||||
var claStatic = {
|
||||
name: "claGlobal",
|
||||
displayName: "CLA Global",
|
||||
modules: Common.autoForce("memcfg", "/driverlib/memcfg.js")
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* CLA module
|
||||
*
|
||||
*/
|
||||
var claModule = {
|
||||
peripheralName: "CLA",
|
||||
displayName: "CLA",
|
||||
// longDescription : longDescription,
|
||||
longDescription : longDescription + "\n" + (Common.getCollateralFindabilityList("CLA")),
|
||||
maxInstances: CLA_INSTANCE.length,
|
||||
defaultInstanceName: "myCLA",
|
||||
description: "Control Law Accelerator",
|
||||
config: config,
|
||||
moduleStatic: claStatic,
|
||||
moduleInstances: (inst) => {
|
||||
var intReturn = [];
|
||||
// Loop through all instances of task interrupt
|
||||
device_driverlib_peripheral.CLA_TaskNumber.forEach((element, index) =>
|
||||
{
|
||||
// If CLA task interrupt is enabled then generate interrupt configuration UI
|
||||
if (inst["cpuint_"+element.name])
|
||||
{
|
||||
intReturn.push ({
|
||||
name : "intconfig_"+element.name,
|
||||
displayName : "C28 Interrupt Configuration for " + element.displayName,
|
||||
moduleName : "/driverlib/interrupt.js",
|
||||
collapsed : true,
|
||||
args : {
|
||||
$name : "interrupt_" + element.name,
|
||||
int : "INT_" + inst.$name + element.name[element.name.length-1],
|
||||
pinmuxPeripheralModule : "",
|
||||
driverlibInt : "INT_CLA1_" + element.name[element.name.length-1],
|
||||
interruptHandler : "cla1Isr" + element.name[element.name.length-1],
|
||||
enableInterrupt : true,
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
return intReturn;
|
||||
},
|
||||
sharedModuleInstances : undefined,
|
||||
templates: {
|
||||
boardc : "/driverlib/cla/cla.board.c.xdt",
|
||||
boardh : "/driverlib/cla/cla.board.h.xdt"
|
||||
},
|
||||
validate : onValidate,
|
||||
};
|
||||
|
||||
exports = claModule;
|
||||
@@ -0,0 +1,174 @@
|
||||
%%{
|
||||
var module = system.modules['/driverlib/cla.js'];
|
||||
let Common = system.getScript("/driverlib/Common.js");
|
||||
var nameOfModule = "cla";
|
||||
var nameOfPeripheral = module.peripheralName;
|
||||
//var device_driverlib_peripheral = system.getScript("/driverlib/device_driverlib_peripherals/" + Common.getDeviceName().toLowerCase() + "_cla.js");
|
||||
//var device_driverlib_interrupt = system.getScript("/driverlib/device_driverlib_peripherals/" + Common.getDeviceName().toLowerCase() + "_interrupt.js");
|
||||
%%}
|
||||
%
|
||||
%
|
||||
//*****************************************************************************
|
||||
//
|
||||
// CLA Configurations
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
%if (module != null)
|
||||
%{
|
||||
% var configs=[]
|
||||
% module.config.forEach((element, index) =>
|
||||
% {
|
||||
% configs[element.name] = element.config
|
||||
% });
|
||||
%
|
||||
%
|
||||
% for(var i = 0; i < module.$instances.length; i++)
|
||||
% {
|
||||
% var instance = module.$instances[i];
|
||||
% var baseName = instance.$name + "_BASE";
|
||||
void `instance.$name`_init(){
|
||||
//
|
||||
// Configure all CLA task vectors
|
||||
// On Type-1 and Type-2 CLAs the MVECT registers accept full 16-bit task addresses as
|
||||
// opposed to offsets used on older Type-0 CLAs
|
||||
//
|
||||
#pragma diag_suppress=770
|
||||
%
|
||||
% var taskflaglist = "";
|
||||
%
|
||||
% configs["claTaskGroup"].forEach((element, index) =>
|
||||
% {
|
||||
% if (element.name.includes("group"))
|
||||
% {
|
||||
% var clataskconfig = [];
|
||||
% element.config.forEach((taskconfig,configindex) => {
|
||||
% clataskconfig[taskconfig.name] = taskconfig;
|
||||
% });
|
||||
%
|
||||
% var enabletask = element.name.replace("group_", "enable_");
|
||||
% if (instance[enabletask])
|
||||
% {
|
||||
%
|
||||
% // Add task to taskflasg list
|
||||
% taskflaglist += "CLA_TASKFLAG_" + element.name[element.name.length-1] + " | ";
|
||||
%
|
||||
% var taskname = element.name.replace("group_", "");
|
||||
% var mvectname = element.name.replace("group_", "mvect_");
|
||||
% var isrname = element.name.replace("group_", "name_");
|
||||
% var trigname = element.name.replace("group_", "trigger_");
|
||||
% var bgname = element.name.replace("group_", "background_");
|
||||
%
|
||||
% if (element.name.includes("8") && typeof instance[bgname] !== 'undefined')
|
||||
% {
|
||||
% if (instance[bgname]) // Background task enabled
|
||||
% {
|
||||
//
|
||||
// CLA Task `element.name[element.name.length-1]`
|
||||
//
|
||||
CLA_mapBackgroundTaskVector(`baseName`, (uint16_t)&`instance[isrname]`);
|
||||
% if (instance[trigname] != "CLA_TRIGGER_SOFTWARE")
|
||||
% {
|
||||
CLA_enableHardwareTrigger(`baseName`);
|
||||
% }
|
||||
%
|
||||
CLA_setTriggerSource(`taskname`, `instance[trigname]`);
|
||||
//
|
||||
// Enable background task
|
||||
//
|
||||
CLA_enableBackgroundTask(`baseName`);
|
||||
% }
|
||||
% else // Background task disabled
|
||||
% {
|
||||
//
|
||||
// CLA Task `element.name[element.name.length-1]`
|
||||
//
|
||||
CLA_mapTaskVector(`baseName`, `instance[mvectname]`, (uint16_t)&`instance[isrname]`);
|
||||
CLA_setTriggerSource(`taskname`, `instance[trigname]`);
|
||||
//
|
||||
// Disable background task
|
||||
//
|
||||
CLA_disableBackgroundTask(`baseName`);
|
||||
% }
|
||||
% }
|
||||
% else
|
||||
% {
|
||||
//
|
||||
// CLA Task `element.name[element.name.length-1]`
|
||||
//
|
||||
CLA_mapTaskVector(`baseName`, `instance[mvectname]`, (uint16_t)&`instance[isrname]`);
|
||||
CLA_setTriggerSource(`taskname`, `instance[trigname]`);
|
||||
% }
|
||||
% }
|
||||
% }
|
||||
% });
|
||||
#pragma diag_warning=770
|
||||
//
|
||||
// Enable the IACK instruction to start a task on CLA in software
|
||||
// for all 8 CLA tasks. Also, globally enable all 8 tasks (or a
|
||||
// subset of tasks) by writing to their respective bits in the
|
||||
// MIER register
|
||||
//
|
||||
CLA_enableIACK(`baseName`);
|
||||
%
|
||||
% taskflaglist = taskflaglist.substring(0, taskflaglist.length-2);
|
||||
%
|
||||
% if (taskflaglist == "CLA_TASKFLAG_1 | CLA_TASKFLAG_2 | CLA_TASKFLAG_3 | CLA_TASKFLAG_4 | CLA_TASKFLAG_5 | CLA_TASKFLAG_6 | CLA_TASKFLAG_7 | CLA_TASKFLAG_8 ")
|
||||
% {
|
||||
CLA_enableTasks(`baseName`, CLA_TASKFLAG_ALL);
|
||||
% }
|
||||
% else
|
||||
% {
|
||||
CLA_enableTasks(`baseName`, `taskflaglist`);
|
||||
% }
|
||||
}
|
||||
% }
|
||||
%}
|
||||
|
||||
|
||||
void `nameOfPeripheral`_init()
|
||||
{
|
||||
#ifdef _FLASH
|
||||
#ifndef CMDTOOL // Linker command tool is not used
|
||||
|
||||
%var CLA_funcs_list = ["f2838x","f2837xd","f2837xs","f2807x"];
|
||||
%if (CLA_funcs_list.includes(Common.getDeviceName().toLowerCase()))
|
||||
%{
|
||||
extern uint32_t Cla1funcsRunStart, Cla1funcsLoadStart, Cla1funcsLoadSize;
|
||||
extern uint32_t Cla1ConstRunStart, Cla1ConstLoadStart, Cla1ConstLoadSize;
|
||||
|
||||
//
|
||||
// Copy the program and constants from FLASH to RAM before configuring
|
||||
// the CLA
|
||||
//
|
||||
memcpy((uint32_t *)&Cla1funcsRunStart, (uint32_t *)&Cla1funcsLoadStart,
|
||||
(uint32_t)&Cla1funcsLoadSize);
|
||||
memcpy((uint32_t *)&Cla1ConstRunStart, (uint32_t *)&Cla1ConstLoadStart,
|
||||
(uint32_t)&Cla1ConstLoadSize );
|
||||
|
||||
%}
|
||||
%else
|
||||
%{
|
||||
extern uint32_t Cla1ProgRunStart, Cla1ProgLoadStart, Cla1ProgLoadSize;
|
||||
extern uint32_t Cla1ConstRunStart, Cla1ConstLoadStart, Cla1ConstLoadSize;
|
||||
|
||||
//
|
||||
// Copy the program and constants from FLASH to RAM before configuring
|
||||
// the CLA
|
||||
//
|
||||
memcpy((uint32_t *)&Cla1ProgRunStart, (uint32_t *)&Cla1ProgLoadStart,
|
||||
(uint32_t)&Cla1ProgLoadSize);
|
||||
memcpy((uint32_t *)&Cla1ConstRunStart, (uint32_t *)&Cla1ConstLoadStart,
|
||||
(uint32_t)&Cla1ConstLoadSize );
|
||||
|
||||
%}
|
||||
|
||||
#endif //CMDTOOL
|
||||
#endif //_FLASH
|
||||
|
||||
% for(var i = 0; i < module.$instances.length; i++)
|
||||
% {
|
||||
% var instance = module.$instances[i];
|
||||
`instance.$name`_init();
|
||||
% }
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
% var moduleName = "cla"
|
||||
% var module = system.modules['/driverlib/' + moduleName + '.js'];
|
||||
%if (module != null)
|
||||
%{
|
||||
//*****************************************************************************
|
||||
//
|
||||
// CLA Configurations
|
||||
//
|
||||
//*****************************************************************************
|
||||
% for(var i = 0; i < module.$instances.length; i++) {
|
||||
% var instance = module.$instances[i];
|
||||
% let modInst = instance[moduleName];
|
||||
#define `instance.$name`_BASE `instance.claBase`
|
||||
|
||||
//
|
||||
// The following are symbols defined in the CLA assembly code
|
||||
// Including them in the shared header file makes them global
|
||||
// and the main CPU can make use of them.
|
||||
//
|
||||
% var configs=[]
|
||||
% module.config.forEach((element, index) =>
|
||||
% {
|
||||
% configs[element.name] = element.config
|
||||
% });
|
||||
% configs["claTaskGroup"].forEach((element, index) =>
|
||||
% {
|
||||
% if (element.name.includes("group"))
|
||||
% {
|
||||
% var enabletask = element.name.replace("group_", "enable_");
|
||||
% if (instance[enabletask])
|
||||
% {
|
||||
% var isrname = element.name.replace("group_", "name_");
|
||||
% if (isrname.includes("8") && instance[element.name.replace("group_", "background_")])
|
||||
% {
|
||||
#if defined(__TMS320C28XX__)
|
||||
__attribute__((interrupt)) void `instance[isrname]`();
|
||||
#else
|
||||
__attribute__((interrupt("background"))) void `instance[isrname]`();
|
||||
#endif
|
||||
% }
|
||||
% else
|
||||
% {
|
||||
__attribute__((interrupt)) void `instance[isrname]`();
|
||||
% }
|
||||
% }
|
||||
% }
|
||||
% });
|
||||
void `instance.$name`_init();
|
||||
|
||||
% }
|
||||
%}
|
||||
@@ -0,0 +1,740 @@
|
||||
let Common = system.getScript("/driverlib/Common.js");
|
||||
let Pinmux = system.getScript("/driverlib/pinmux.js");
|
||||
let CLBSignals = system.getScript("/driverlib/clb/clbSignals.js");
|
||||
|
||||
let device_driverlib_peripheral =
|
||||
system.getScript("/driverlib/device_driverlib_peripherals/" +
|
||||
Common.getDeviceName().toLowerCase() + "_clb.js");
|
||||
|
||||
/* Intro splash on GUI */
|
||||
let longDescription = `The Configurable Logic Block (CLB) is a collection of configurable blocks that may be inter-connected using software to implement custom digital logic functions.`
|
||||
|
||||
let longDescriptionCLBInput = `
|
||||
The input type for the CLB can be from the local mux, the global mux, or the GPREG. For CLB type 1 and
|
||||
type 2 (on devices F2807x, F2837xS, F2837xD, and F28004x), the pipelining option which adds an additional
|
||||
flop for synchronized inputs is not included.
|
||||
|
||||
Note: The synchronizer will add a delay of 2-3 cycles to the input path (the exact value of the
|
||||
delay is 2 to 3 cycles, it is not predictable which delay value it will be).
|
||||
|
||||

|
||||
`
|
||||
|
||||
let longDescriptionSPI = `
|
||||
Export CLB data through SPI buffer. Data is HLC R0 regiter
|
||||
|
||||

|
||||
`
|
||||
|
||||
var MAX_OUTPUTS = 16;
|
||||
if (Common.CLB_isType1())
|
||||
{
|
||||
MAX_OUTPUTS = 24;
|
||||
}
|
||||
else if (Common.CLB_isType2())
|
||||
{
|
||||
MAX_OUTPUTS = 32;
|
||||
}
|
||||
|
||||
var staticSwitchOptions = [
|
||||
{ name: 0 , displayName: 'Zero' },
|
||||
{ name: 8 , displayName: 'One' },
|
||||
{ name: 24 , displayName: 'Boundary input 0' },
|
||||
{ name: 25 , displayName: 'Boundary input 1' },
|
||||
{ name: 26 , displayName: 'Boundary input 2' },
|
||||
{ name: 27 , displayName: 'Boundary input 3' },
|
||||
{ name: 28 , displayName: 'Boundary input 4' },
|
||||
{ name: 29 , displayName: 'Boundary input 5' },
|
||||
{ name: 30 , displayName: 'Boundary input 6' },
|
||||
{ name: 31 , displayName: 'Boundary input 7' },
|
||||
{ name: 7 , displayName: 'LUT 0 Output' },
|
||||
{ name: 15 , displayName: 'LUT 1 Output' },
|
||||
{ name: 23 , displayName: 'LUT 2 Output' },
|
||||
{ name: 6 , displayName: 'FSM 0 Output' },
|
||||
{ name: 4 , displayName: 'FSM 0 State 0 Value' },
|
||||
{ name: 5 , displayName: 'FSM 0 State 1 Value' },
|
||||
{ name: 14 , displayName: 'FSM 1 Output' },
|
||||
{ name: 12 , displayName: 'FSM 1 State 0 Value' },
|
||||
{ name: 13 , displayName: 'FSM 1 State 1 Value' },
|
||||
{ name: 22 , displayName: 'FSM 2 Output' },
|
||||
{ name: 20 , displayName: 'FSM 2 State 0 Value' },
|
||||
{ name: 21 , displayName: 'FSM 2 State 1 Value' },
|
||||
{ name: 2 , displayName: 'Counter 0 Equals Zero' },
|
||||
{ name: 3 , displayName: 'Counter 0 Equals Match 1' },
|
||||
{ name: 1 , displayName: 'Counter 0 Equals Match 2' },
|
||||
{ name: 10 , displayName: 'Counter 1 Equals Zero' },
|
||||
{ name: 11 , displayName: 'Counter 1 Equals Match 1' },
|
||||
{ name: 9 , displayName: 'Counter 1 Equals Match 2' },
|
||||
{ name: 18 , displayName: 'COUNTER 2 Equals Zero' },
|
||||
{ name: 19 , displayName: 'Counter 2 Equals Match 1' },
|
||||
{ name: 1 , displayName: 'Counter 2 Equals Match 2' },
|
||||
];
|
||||
|
||||
var totatCLBOutputs = [];
|
||||
for (var i = 0; i < MAX_OUTPUTS; i++)
|
||||
{
|
||||
totatCLBOutputs.push({
|
||||
name: "CLB_OUT" + i.toString(), displayName: "Output " + i.toString(),
|
||||
})
|
||||
}
|
||||
|
||||
var CLB_INSTANCE = [
|
||||
{ name: "CLB1_BASE", displayName: "CLB1"},
|
||||
{ name: "CLB2_BASE", displayName: "CLB2"},
|
||||
{ name: "CLB3_BASE", displayName: "CLB3"},
|
||||
{ name: "CLB4_BASE", displayName: "CLB4"}
|
||||
]
|
||||
|
||||
var numberOfCLBs = 4;
|
||||
|
||||
if (Common.getDeviceName().includes("F28002x"))
|
||||
{
|
||||
CLB_INSTANCE = [
|
||||
{ name: "CLB1_BASE", displayName: "CLB1"},
|
||||
{ name: "CLB2_BASE", displayName: "CLB2"}
|
||||
];
|
||||
numberOfCLBs = 2;
|
||||
}
|
||||
else if (Common.getDeviceName().includes("F2838x"))
|
||||
{
|
||||
CLB_INSTANCE = [
|
||||
{ name: "CLB1_BASE", displayName: "CLB1"},
|
||||
{ name: "CLB2_BASE", displayName: "CLB2"},
|
||||
{ name: "CLB3_BASE", displayName: "CLB3"},
|
||||
{ name: "CLB4_BASE", displayName: "CLB4"},
|
||||
{ name: "CLB5_BASE", displayName: "CLB5"},
|
||||
{ name: "CLB6_BASE", displayName: "CLB6"},
|
||||
{ name: "CLB7_BASE", displayName: "CLB7"},
|
||||
{ name: "CLB8_BASE", displayName: "CLB8"}
|
||||
]
|
||||
numberOfCLBs = 8;
|
||||
}
|
||||
else if (Common.getDeviceName().includes("F28P65x"))
|
||||
{
|
||||
CLB_INSTANCE = [
|
||||
{ name: "CLB1_BASE", displayName: "CLB1"},
|
||||
{ name: "CLB2_BASE", displayName: "CLB2"},
|
||||
{ name: "CLB3_BASE", displayName: "CLB3"},
|
||||
{ name: "CLB4_BASE", displayName: "CLB4"},
|
||||
{ name: "CLB5_BASE", displayName: "CLB5"},
|
||||
{ name: "CLB6_BASE", displayName: "CLB6"}
|
||||
]
|
||||
numberOfCLBs = 6;
|
||||
}
|
||||
|
||||
else if (Common.getDeviceName().includes("F28P55x"))
|
||||
{
|
||||
CLB_INSTANCE = [
|
||||
{ name: "CLB1_BASE", displayName: "CLB1"},
|
||||
{ name: "CLB2_BASE", displayName: "CLB2"}
|
||||
];
|
||||
numberOfCLBs = 2;
|
||||
}
|
||||
|
||||
let INPUT_TYPES = [
|
||||
{name: "GP", displayName: "Use Memory Mapped GPREG BIT"},
|
||||
{name: "GLOBAL", displayName: "Use Global Mux"},
|
||||
{name: "LOCAL", displayName: "Use Local Mux"}
|
||||
]
|
||||
|
||||
function onChangeCLBBase(inst, ui){
|
||||
if (Common.CLB_isType2())
|
||||
{
|
||||
var clb_with_spi_supprt = ["CLB1_BASE", "CLB2_BASE", "CLB3_BASE", "CLB4_BASE"];
|
||||
if (["F28003x", "F28P55x"].includes(Common.getDeviceName()))
|
||||
{
|
||||
clb_with_spi_supprt = ["CLB1_BASE", "CLB2_BASE"];
|
||||
}
|
||||
if (clb_with_spi_supprt.includes(inst.clbBase)){
|
||||
ui["spiBufferAccess"].hidden = false;
|
||||
ui["spiBufferLoadTriggerSignal"].hidden = false;
|
||||
ui["spiBufferR0Shift"].hidden = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
ui["spiBufferAccess"].hidden = true;
|
||||
ui["spiBufferLoadTriggerSignal"].hidden = true;
|
||||
ui["spiBufferR0Shift"].hidden = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function onChangeInputType(inst, ui)
|
||||
{
|
||||
for (var clb_input_i in device_driverlib_peripheral.CLB_Inputs)
|
||||
{
|
||||
var clbInputName = device_driverlib_peripheral.CLB_Inputs[clb_input_i].name
|
||||
|
||||
if (inst.inputsUsed.includes(clbInputName))
|
||||
{
|
||||
if (inst["inputType" + clbInputName] == "GP")
|
||||
{
|
||||
ui["synchronize" + clbInputName].hidden = true;
|
||||
ui["localConfig" + clbInputName].hidden = true;
|
||||
ui["globalConfig" + clbInputName].hidden = true;
|
||||
ui["gpStartValueConfig" + clbInputName].hidden = false;
|
||||
}
|
||||
else if (inst["inputType" + clbInputName] == "GLOBAL")
|
||||
{
|
||||
ui["synchronize" + clbInputName].hidden = false;
|
||||
ui["localConfig" + clbInputName].hidden = true;
|
||||
ui["globalConfig" + clbInputName].hidden = false;
|
||||
ui["gpStartValueConfig" + clbInputName].hidden = true;
|
||||
}
|
||||
else if (inst["inputType" + clbInputName] == "LOCAL")
|
||||
{
|
||||
ui["synchronize" + clbInputName].hidden = false;
|
||||
ui["localConfig" + clbInputName].hidden = false;
|
||||
ui["globalConfig" + clbInputName].hidden = true;
|
||||
ui["gpStartValueConfig" + clbInputName].hidden = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ui["synchronize" + clbInputName].hidden = true;
|
||||
ui["localConfig" + clbInputName].hidden = true;
|
||||
ui["globalConfig" + clbInputName].hidden = true;
|
||||
ui["gpStartValueConfig" + clbInputName].hidden = true;
|
||||
}
|
||||
|
||||
ui["inputType" + clbInputName].hidden = !inst.inputsUsed.includes(clbInputName);
|
||||
ui["filterConfig" + clbInputName].hidden = !inst.inputsUsed.includes(clbInputName);
|
||||
if (Common.CLB_isType2()){
|
||||
ui["inputPipelineConfig" + clbInputName].hidden = !inst.inputsUsed.includes(clbInputName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Array of CAN configurables that are common across device families */
|
||||
let config = [
|
||||
{
|
||||
name : "clbBase",
|
||||
displayName : "CLB Instance",
|
||||
description : 'Instance of the CLB used.',
|
||||
onChange : onChangeCLBBase,
|
||||
hidden : false,
|
||||
default : CLB_INSTANCE[0].name,
|
||||
options : CLB_INSTANCE
|
||||
},
|
||||
{
|
||||
name: "enableCLB",
|
||||
displayName : "Enable CLB",
|
||||
description : 'Enable the CLB',
|
||||
hidden : false,
|
||||
default : false
|
||||
},
|
||||
{
|
||||
name: "outputsToOverridePeripheral",
|
||||
displayName : "Overriding Outputs",
|
||||
description : 'Outputs from the CLB which will intersect the peripheral signals',
|
||||
hidden : false,
|
||||
default : [],
|
||||
minSelections : 0,
|
||||
options : totatCLBOutputs
|
||||
},
|
||||
];
|
||||
|
||||
if (Common.CLB_isType2())
|
||||
{
|
||||
config = config.concat([
|
||||
{
|
||||
name: "lockOutputsToOverridePeripheral",
|
||||
displayName : "Lock Overriding Outputs Setting",
|
||||
description : 'Lock the setting for outputs from the CLB which will intersect the peripheral signals',
|
||||
hidden : false,
|
||||
default : false
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
||||
if (Common.CLB_isType1_Type2())
|
||||
{
|
||||
config = config.concat([
|
||||
{
|
||||
name: "hlcNMI",
|
||||
displayName : "HLC Generates NMI",
|
||||
description : 'The HLC interrupts are not maskable',
|
||||
hidden : false,
|
||||
default : false
|
||||
}
|
||||
]);
|
||||
|
||||
config = config.concat([{
|
||||
name: "GROUP_PRESCALAR",
|
||||
displayName: "Clock Prescalar",
|
||||
description: "CLB input prescalar configuration",
|
||||
longDescription: "The prescaled version of the CLB clock which can be used a CLB input",
|
||||
config: [
|
||||
{
|
||||
name: "clken",
|
||||
displayName : "Enable Prescalar",
|
||||
description : 'Enable the clock prescalar',
|
||||
hidden : false,
|
||||
default : false
|
||||
},
|
||||
{
|
||||
name: "strb",
|
||||
displayName : "Enable Strobe Mode",
|
||||
description : 'Enable the strobe mode. When disabled, a strobe output will be sent out whenever' +
|
||||
' the prescale counter value matches the Prescale Value.' +
|
||||
' When enabled, the output is the prescale counter register bit position as selected by ' +
|
||||
'TAP Select Bit.',
|
||||
hidden : false,
|
||||
default : false
|
||||
},
|
||||
{
|
||||
name: "tap",
|
||||
displayName : "Tap Select Bit",
|
||||
description : 'The prescaler Tap Select Bit in Strobe Mode.',
|
||||
hidden : false,
|
||||
default : 0,
|
||||
options : Common.zero_to_15
|
||||
},
|
||||
{
|
||||
name: "prescale",
|
||||
displayName : "Prescale Value",
|
||||
description : 'The prescale value for the clock.',
|
||||
hidden : false,
|
||||
default : 1
|
||||
}
|
||||
]
|
||||
}]);
|
||||
}
|
||||
|
||||
if (Common.CLB_isType2())
|
||||
{
|
||||
config = config.concat([{
|
||||
name: "GROUP_SPIDATAEXPORT",
|
||||
displayName: "Data Exporting Through SPI Buffer",
|
||||
description: "",
|
||||
longDescription: longDescriptionSPI,
|
||||
config: [
|
||||
{
|
||||
name: "spiBufferAccess",
|
||||
displayName : "Enable SPI Buffer Access",
|
||||
description : 'Enable CLB data exporting through SPI buffer.',
|
||||
hidden : false,
|
||||
default : false
|
||||
},
|
||||
{
|
||||
name: "spiBufferLoadTriggerSignal",
|
||||
displayName : "SPI Buffer Load Trigger Signal",
|
||||
description : 'SPI buffer load trigger signal.',
|
||||
hidden : false,
|
||||
default : staticSwitchOptions[0].name,
|
||||
options : staticSwitchOptions
|
||||
},
|
||||
{
|
||||
name: "spiBufferR0Shift",
|
||||
displayName : "HLC R0 Register Shift Value",
|
||||
description : 'HLC R0 register shift value.',
|
||||
hidden : false,
|
||||
default : Common.zero_to_16[0].name,
|
||||
options : Common.zero_to_16
|
||||
}
|
||||
]
|
||||
}]);
|
||||
}
|
||||
|
||||
config = config.concat([
|
||||
{
|
||||
name: "inputsUsed",
|
||||
displayName : "Inputs Used",
|
||||
description : 'Used inputs for the CLB',
|
||||
longDescription : longDescriptionCLBInput,
|
||||
hidden : false,
|
||||
default : [],
|
||||
minSelections : 0,
|
||||
options : device_driverlib_peripheral.CLB_Inputs,
|
||||
onChange : onChangeInputType
|
||||
}
|
||||
]);
|
||||
|
||||
for (var clb_input_i in device_driverlib_peripheral.CLB_Inputs)
|
||||
{
|
||||
var clbInputName = device_driverlib_peripheral.CLB_Inputs[clb_input_i].name
|
||||
var clbInputDisplayName = device_driverlib_peripheral.CLB_Inputs[clb_input_i].displayName
|
||||
|
||||
var inputTypeConfig = {
|
||||
name: "inputType" + clbInputName,
|
||||
displayName : "Input Type " + clbInputDisplayName,
|
||||
description : 'Input type for the CLB input',
|
||||
hidden : true,
|
||||
default : INPUT_TYPES[0].name,
|
||||
options : INPUT_TYPES,
|
||||
onChange : onChangeInputType
|
||||
}
|
||||
|
||||
var synchronizeConfig = {
|
||||
name: "synchronize" + clbInputName,
|
||||
displayName : "Enable Sync " + clbInputDisplayName,
|
||||
description : 'Enable the CLB input synchronization',
|
||||
hidden : true,
|
||||
default : false
|
||||
}
|
||||
|
||||
var localConfig = {
|
||||
name: "localConfig" + clbInputName,
|
||||
displayName : "Local Mux " + clbInputDisplayName,
|
||||
description : 'Local Mux input for CLB',
|
||||
hidden : true,
|
||||
default : device_driverlib_peripheral.CLB_LocalInputMux[0].name,
|
||||
options : device_driverlib_peripheral.CLB_LocalInputMux
|
||||
}
|
||||
|
||||
var globalConfig = {
|
||||
name: "globalConfig" + clbInputName,
|
||||
displayName : "Global Mux " + clbInputDisplayName,
|
||||
description : 'Global Mux input for CLB',
|
||||
hidden : true,
|
||||
default : device_driverlib_peripheral.CLB_GlobalInputMux[0].name,
|
||||
options : device_driverlib_peripheral.CLB_GlobalInputMux
|
||||
}
|
||||
|
||||
var gpStartValueConfig = {
|
||||
name: "gpStartValueConfig" + clbInputName,
|
||||
displayName : "GPREG Initial Value " + clbInputDisplayName,
|
||||
description : 'GPREG Initial Value for ' + clbInputDisplayName,
|
||||
hidden : true,
|
||||
default : 0,
|
||||
options : [
|
||||
{ name : 0 },
|
||||
{ name : 1 }
|
||||
]
|
||||
}
|
||||
|
||||
var filterConfig = {
|
||||
name: "filterConfig" + clbInputName,
|
||||
displayName : "Input Filter " + clbInputDisplayName,
|
||||
description : 'Input filter for ' + clbInputDisplayName,
|
||||
hidden : true,
|
||||
default : device_driverlib_peripheral.CLB_FilterType[0].name,
|
||||
options : device_driverlib_peripheral.CLB_FilterType
|
||||
}
|
||||
|
||||
var inputConfigs = [
|
||||
inputTypeConfig,
|
||||
localConfig,
|
||||
globalConfig,
|
||||
synchronizeConfig,
|
||||
filterConfig,
|
||||
gpStartValueConfig,
|
||||
]
|
||||
|
||||
if (Common.CLB_isType2())
|
||||
{
|
||||
var inputPipelineModeConfig = {
|
||||
name: "inputPipelineConfig" + clbInputName,
|
||||
displayName : "Input Pipeline " + clbInputDisplayName,
|
||||
description : 'Enable Input Pipeline for ' + clbInputDisplayName,
|
||||
hidden : true,
|
||||
default : false
|
||||
}
|
||||
|
||||
inputConfigs.push(inputPipelineModeConfig);
|
||||
}
|
||||
|
||||
|
||||
var clbInputGroupConfig = [{
|
||||
name: "GROUP_" + clbInputName,
|
||||
displayName: "CLB " + clbInputDisplayName,
|
||||
description: "CLB Input Configuration " + clbInputDisplayName,
|
||||
longDescription: "",
|
||||
config: inputConfigs
|
||||
}];
|
||||
|
||||
config = config.concat(clbInputGroupConfig);
|
||||
|
||||
}
|
||||
|
||||
config = config.concat([
|
||||
{
|
||||
name : "registerInterrupts",
|
||||
displayName : "Register Interrupt Handler",
|
||||
description : 'Whether or not to register interrupt handlers in the interrupt module.',
|
||||
hidden : false,
|
||||
default : false
|
||||
|
||||
},
|
||||
{
|
||||
name : "attachTile",
|
||||
displayName : "Attach a TILE Config to this CLB",
|
||||
description : 'Whether or not to connect one of the TILE modules to this CLB module.',
|
||||
hidden : false,
|
||||
default : false,
|
||||
onChange : (inst, ui)=> {
|
||||
ui["initTile"].hidden = !inst.attachTile;
|
||||
}
|
||||
},
|
||||
{
|
||||
name : "initTile",
|
||||
displayName : "Initialize TILE",
|
||||
description : 'Whether or not to initialize the TILE within CLB_init function.',
|
||||
hidden : true,
|
||||
default : false,
|
||||
},
|
||||
]);
|
||||
|
||||
function findDuplicates(arrayToCheck)
|
||||
{
|
||||
const count = arrayToCheck =>
|
||||
arrayToCheck.reduce((a, b) => ({ ...a,
|
||||
[b]: (a[b] || 0) + 1
|
||||
}), {})
|
||||
|
||||
const duplicates = dict =>
|
||||
Object.keys(dict).filter((a) => dict[a] > 1)
|
||||
|
||||
return {count: count(arrayToCheck), duplicates: duplicates(count(arrayToCheck))};
|
||||
}
|
||||
|
||||
function onValidate(inst, validation) {
|
||||
var usedCLBInsts = [];
|
||||
for (var instance_index in inst.$module.$instances)
|
||||
{
|
||||
var instance_obj = inst.$module.$instances[instance_index];
|
||||
usedCLBInsts.push(instance_obj.clbBase);
|
||||
}
|
||||
var otherContexts = Common.getOtherContextNames()
|
||||
for (var cntx of otherContexts)
|
||||
{
|
||||
var onOtherCntx = Common.getModuleForCore(inst.$module.$name, cntx);
|
||||
if (onOtherCntx)
|
||||
{
|
||||
for (var instance_index in onOtherCntx.$instances)
|
||||
{
|
||||
var instance_obj = onOtherCntx.$instances[instance_index];
|
||||
usedCLBInsts.push(instance_obj.clbBase);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var duplicatesResult = findDuplicates(usedCLBInsts)
|
||||
|
||||
if (duplicatesResult.duplicates.length != 0)
|
||||
{
|
||||
var allDuplicates = "";
|
||||
for (var duplicateNamesIndex in duplicatesResult.duplicates)
|
||||
{
|
||||
allDuplicates = allDuplicates + Common.stringOrEmpty(allDuplicates, ", ")
|
||||
+ duplicatesResult.duplicates[duplicateNamesIndex];
|
||||
}
|
||||
validation.logError(
|
||||
"The CLB Instance used. Duplicates: " + allDuplicates,
|
||||
inst, "clbBase");
|
||||
}
|
||||
|
||||
if (inst.prescale < 0 || inst.prescale > 0xFFFF)
|
||||
{
|
||||
validation.logError(
|
||||
"The CLB prescale value must be a valid 16-bit number",
|
||||
inst, "prescale");
|
||||
}
|
||||
|
||||
var base = inst["clbBase"];
|
||||
var clb_1to4 = false;
|
||||
var clb_1 = false;
|
||||
if (["CLB1_BASE",
|
||||
"CLB2_BASE",
|
||||
"CLB3_BASE",
|
||||
"CLB4_BASE", ].includes(base))
|
||||
{
|
||||
clb_1to4 = true;
|
||||
}
|
||||
if ("CLB1_BASE" == base)
|
||||
{
|
||||
clb_1 = true;
|
||||
}
|
||||
|
||||
var F2838x = Common.getDeviceName().includes("F2838x");
|
||||
var F28002x = Common.getDeviceName().includes("F28002x");
|
||||
|
||||
// Check global and local sources
|
||||
var i = 0;
|
||||
for (var clb_input_i in device_driverlib_peripheral.CLB_Inputs)
|
||||
{
|
||||
var clbInputName = device_driverlib_peripheral.CLB_Inputs[clb_input_i].name
|
||||
var clbSyncCheck = CLBSignals.CLBInputSignals[Common.getDeviceName()]
|
||||
|
||||
if (inst.inputsUsed.includes(clbInputName))
|
||||
{
|
||||
var global_or_local = false;
|
||||
var config_pre = "";
|
||||
var enum_name = "";
|
||||
if (inst["inputType" + clbInputName] == "GLOBAL")
|
||||
{
|
||||
global_or_local = true;
|
||||
config_pre = "globalConfig";
|
||||
enum_name = "CLB_GlobalInputMux"
|
||||
clbSyncCheck = clbSyncCheck["GLOBAL_MUX"][inst["globalConfigCLB_IN" + i]];
|
||||
}
|
||||
else if (inst["inputType" + clbInputName] == "LOCAL")
|
||||
{
|
||||
global_or_local = true;
|
||||
config_pre = "localConfig";
|
||||
enum_name = "CLB_LocalInputMux"
|
||||
clbSyncCheck = clbSyncCheck["LOCAL_MUX"][inst["localConfigCLB_IN" + i]];
|
||||
}
|
||||
|
||||
//clbSyncCheck (from clbSignals.js) states whether synchronization is required
|
||||
if((clbSyncCheck == true) && (inst["synchronizeCLB_IN" + i] == false)) //When synchronization is required but not enabled, throw a warning
|
||||
{
|
||||
validation.logWarning(
|
||||
"Synchronization is required for this signal to prevent metastability; this metastability can cause errors dependent on voltage, temperature, and wafer fab process (adds 2-3 cycle delay to input)",
|
||||
inst, "synchronize" + clbInputName);
|
||||
}
|
||||
else if((clbSyncCheck == false) && (inst["inputPipelineConfigCLB_IN" + i] == false)) //When input pipeline is required but not enabled, throw a warning
|
||||
{
|
||||
validation.logWarning(
|
||||
"Pipelining is required for synchronous signals (adds 1 cycle delay to input)",
|
||||
inst, "inputPipelineConfig" + clbInputName);
|
||||
}
|
||||
else if((config_pre != "") && (inst["synchronizeCLB_IN" + i] == false) && (inst["inputPipelineConfigCLB_IN" + i] == false))
|
||||
{
|
||||
validation.logWarning(
|
||||
"Having both synchronization and pipeline disabled results in a purely asynchronous signal",
|
||||
inst, config_pre + clbInputName);
|
||||
}
|
||||
else if((config_pre != "") && (inst["synchronizeCLB_IN" + i] == true) && (inst["inputPipelineConfigCLB_IN" + i] == true))
|
||||
{
|
||||
validation.logWarning(
|
||||
"Having both synchronization and pipeline enabled results in a 3-4 cycle delay on the input",
|
||||
inst, config_pre + clbInputName);
|
||||
}
|
||||
|
||||
if (global_or_local)
|
||||
{
|
||||
var result = device_driverlib_peripheral[enum_name].find(input => {
|
||||
return input.name === inst[config_pre + clbInputName]
|
||||
})
|
||||
var diplayName = result.displayName.replace(/ /g, "")
|
||||
|
||||
if (F2838x &&
|
||||
diplayName.includes("(CLB5") &&
|
||||
clb_1to4)
|
||||
{
|
||||
validation.logError(
|
||||
"This CLB input is only applicable for CLB 5-8",
|
||||
inst, config_pre + clbInputName);
|
||||
}
|
||||
if (F2838x &&
|
||||
diplayName.includes("(CLB1") &&
|
||||
!clb_1to4)
|
||||
{
|
||||
validation.logError(
|
||||
"This CLB input is only applicable for CLB 1-4",
|
||||
inst, config_pre + clbInputName);
|
||||
}
|
||||
|
||||
if (F28002x &&
|
||||
diplayName.includes("(CLB2") &&
|
||||
clb_1)
|
||||
{
|
||||
validation.logError(
|
||||
"This CLB input is only applicable for CLB 2",
|
||||
inst, config_pre + clbInputName);
|
||||
}
|
||||
if (F28002x &&
|
||||
diplayName.includes("(CLB1") &&
|
||||
!clb_1)
|
||||
{
|
||||
validation.logError(
|
||||
"This CLB input is only applicable for CLB 1",
|
||||
inst, config_pre + clbInputName);
|
||||
}
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
var temp_arr = [];
|
||||
|
||||
for(var n = 0; n < MAX_OUTPUTS; n++)
|
||||
{
|
||||
if(inst.outputsToOverridePeripheral[n])
|
||||
{
|
||||
if(CLBSignals.CLBInputSignals[Common.getDeviceName()]["OUT_OVERRIDE"][inst.clbBase.replace("_BASE", "")][inst.outputsToOverridePeripheral[n]])
|
||||
{
|
||||
var clbOutputNum = parseInt(inst.outputsToOverridePeripheral[n].replace("CLB_OUT", ""), 10);
|
||||
var textOutput = "CLB Output " + clbOutputNum + " is overriding the " + CLBSignals.CLBInputSignals[Common.getDeviceName()]["OUT_OVERRIDE"][inst.clbBase.replace("_BASE", "")][inst.outputsToOverridePeripheral[n]] + " signal.";
|
||||
temp_arr.push(
|
||||
{clbOutputNum, textOutput}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
temp_arr.sort((s1, s2) => {
|
||||
return s1.clbOutputNum - s2.clbOutputNum;
|
||||
});
|
||||
|
||||
for(var n = 0; n < temp_arr.length; n++)
|
||||
{
|
||||
if(temp_arr[n].textOutput.includes("does not override"))
|
||||
{
|
||||
validation.logInfo("CLB output does not override a signal", inst, "outputsToOverridePeripheral");
|
||||
}
|
||||
else
|
||||
{
|
||||
validation.logInfo(temp_arr[n].textOutput, inst, "outputsToOverridePeripheral");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var sharedModuleInstances = undefined;
|
||||
|
||||
sharedModuleInstances = function (inst) {
|
||||
if (inst.attachTile)
|
||||
{
|
||||
return (
|
||||
[
|
||||
{
|
||||
name: "tile",
|
||||
displayName: "TILE Configuration",
|
||||
moduleName: "/utilities/clb_tool/clb_syscfg/source/TILE.syscfg.js",
|
||||
collapsed: true,
|
||||
},
|
||||
]
|
||||
);
|
||||
}
|
||||
return []
|
||||
}
|
||||
|
||||
|
||||
var clbModule = {
|
||||
peripheralName: "CLB",
|
||||
displayName: "CLB",
|
||||
// longDescription : longDescription,
|
||||
longDescription: longDescription + "\n" + (Common.getCollateralFindabilityList("CLB")),
|
||||
maxInstances: numberOfCLBs,
|
||||
defaultInstanceName: "myCLB",
|
||||
description: "Configurable Logic Block",
|
||||
config: config,
|
||||
moduleInstances: (inst) => {
|
||||
if (inst.registerInterrupts)
|
||||
{
|
||||
return [{
|
||||
name: "clbInt",
|
||||
displayName: "CLB Interrupt",
|
||||
moduleName: "/driverlib/interrupt.js",
|
||||
collapsed: true,
|
||||
args: {
|
||||
$name : inst.$name + "_INT",
|
||||
int : "INT_" + inst.$name,
|
||||
pinmuxPeripheralModule : "",
|
||||
driverlibInt: "INT_" + inst.clbBase.replace("_BASE", "")
|
||||
}
|
||||
}]
|
||||
}
|
||||
return []
|
||||
},
|
||||
sharedModuleInstances : sharedModuleInstances,
|
||||
templates: {
|
||||
boardc : "/driverlib/clb/clb.board.c.xdt",
|
||||
boardh : "/driverlib/clb/clb.board.h.xdt"
|
||||
},
|
||||
validate : onValidate,
|
||||
};
|
||||
|
||||
exports = clbModule;
|
||||
@@ -0,0 +1,199 @@
|
||||
%%{
|
||||
var module = system.modules['/driverlib/clb.js'];
|
||||
let Common = system.getScript("/driverlib/Common.js");
|
||||
var nameOfModule = "clb";
|
||||
var nameOfPeripheral = module.peripheralName;
|
||||
%%}
|
||||
//*****************************************************************************
|
||||
//
|
||||
// CLB Configurations
|
||||
//
|
||||
//*****************************************************************************
|
||||
void `nameOfPeripheral`_init(){
|
||||
% for(var i = 0; i < module.$instances.length; i++)
|
||||
% {
|
||||
% var instance = module.$instances[i];
|
||||
`instance.$name`_init();
|
||||
% }
|
||||
}
|
||||
|
||||
%%{
|
||||
if (module != null)
|
||||
{
|
||||
for(var i = 0; i < module.$instances.length; i++) {
|
||||
var instance = module.$instances[i];
|
||||
var baseName = instance.$name + "_BASE";
|
||||
var enableCLBLine = "CLB_disableCLB(" + baseName + ");"
|
||||
var tileInitLine = ""
|
||||
var gpRegValue = 0;
|
||||
var nmi = "";
|
||||
var clken = "";
|
||||
var strb = "";
|
||||
var spiBufferEnable = "";
|
||||
var spiBufferTrigger = "";
|
||||
var spiBufferShift = "";
|
||||
%%}
|
||||
void `instance.$name`_init(){
|
||||
%%{
|
||||
if (instance.attachTile)
|
||||
{
|
||||
if (instance.initTile)
|
||||
{
|
||||
var tileName = instance.tile.$name;
|
||||
tileInitLine = "init" + tileName + "(" + baseName + ");"
|
||||
}
|
||||
}
|
||||
if(instance.enableCLB)
|
||||
{
|
||||
enableCLBLine = "CLB_enableCLB(" + baseName + ");"
|
||||
}
|
||||
if (Common.CLB_isType1_Type2())
|
||||
{
|
||||
if (instance.hlcNMI){
|
||||
nmi = "CLB_enableNMI(" + baseName + ");";
|
||||
}
|
||||
if (instance.clken){
|
||||
clken = "CLB_configureClockPrescalar(" + baseName + ", " + instance.prescale + ");";
|
||||
}
|
||||
if (instance.strb){
|
||||
strb = "CLB_configureStrobeMode(" + baseName + ", " + instance.tap + ");";
|
||||
}
|
||||
}
|
||||
if (Common.CLB_isType2()){
|
||||
if (instance.spiBufferAccess){
|
||||
spiBufferEnable = "CLB_enableSPIBufferAccess(" + baseName + ");";
|
||||
}
|
||||
else{
|
||||
spiBufferEnable = "CLB_disableSPIBufferAccess(" + baseName + ");";
|
||||
}
|
||||
spiBufferTrigger = "CLB_configSPIBufferLoadSignal(" + baseName + ", " + instance.spiBufferLoadTriggerSignal + ");";
|
||||
spiBufferShift = "CLB_configSPIBufferShift(" + baseName + ", " + instance.spiBufferR0Shift + ");";
|
||||
}
|
||||
%%}
|
||||
% if(Common.CLB_isType1_Type2()){
|
||||
% if(nmi != ""){
|
||||
`nmi`
|
||||
% }
|
||||
% if(clken != ""){
|
||||
`clken`
|
||||
% }
|
||||
% if(strb != ""){
|
||||
`strb`
|
||||
% }
|
||||
% }
|
||||
%%{
|
||||
var outputs = "(0UL << 0UL)"
|
||||
for (var outputUsed_i in instance.outputsToOverridePeripheral)
|
||||
{
|
||||
var clbOutputName = instance.outputsToOverridePeripheral[outputUsed_i]
|
||||
outputs = outputs + " | \n\t\t\t\t" + "(1UL << " + clbOutputName.replace("CLB_OUT", "") + "UL)"
|
||||
}
|
||||
var outputLine = "CLB_setOutputMask(" + baseName + ",\n\t\t\t\t" + outputs + ", true);"
|
||||
%%}
|
||||
`outputLine`
|
||||
% if (Common.CLB_isType2()) {
|
||||
% var lockOutputLine = "";
|
||||
% if (instance.lockOutputsToOverridePeripheral){
|
||||
% lockOutputLine = "CLB_disableOutputMaskUpdates(" + baseName + ");"
|
||||
% } else {
|
||||
% lockOutputLine = "CLB_enableOutputMaskUpdates(" + baseName + ");"
|
||||
% }
|
||||
`lockOutputLine`
|
||||
% }
|
||||
% if (Common.CLB_isType2() && ["CLB1_BASE", "CLB2_BASE", "CLB3_BASE", "CLB4_BASE"].includes(instance.clbBase)) {
|
||||
//
|
||||
// `instance.$name` SPI Buffer Configuration
|
||||
//
|
||||
`spiBufferEnable`
|
||||
`spiBufferTrigger`
|
||||
`spiBufferShift`
|
||||
% }
|
||||
%%{
|
||||
for (var inputUsed_i in instance.inputsUsed)
|
||||
{
|
||||
var clbInputName = instance.inputsUsed[inputUsed_i]
|
||||
var clbInputNumber = parseInt(Common.removeNonNumber(clbInputName));
|
||||
var inputType = instance["inputType" + clbInputName]
|
||||
var localInput = "";
|
||||
var globalInput = "";
|
||||
var gpInput = "";
|
||||
var syncInput = "";
|
||||
var inputPipeline = "";
|
||||
if (Common.CLB_isType2())
|
||||
{
|
||||
if (instance["inputPipelineConfig" + clbInputName]){
|
||||
inputPipeline = "CLB_enableInputPipelineMode(" + baseName + ", " + clbInputName + ");"
|
||||
}
|
||||
else{
|
||||
inputPipeline = "CLB_disableInputPipelineMode(" + baseName + ", " + clbInputName + ");"
|
||||
}
|
||||
}
|
||||
if (instance["synchronize" + clbInputName])
|
||||
{
|
||||
syncInput = "CLB_enableSynchronization(" + baseName + ", " + clbInputName + ");"
|
||||
}
|
||||
if (inputType == "GP")
|
||||
{
|
||||
localInput = "CLB_configLocalInputMux(" + baseName +
|
||||
", " + clbInputName + ", CLB_LOCAL_IN_MUX_GLOBAL_IN);"
|
||||
globalInput = "CLB_configGlobalInputMux(" + baseName +
|
||||
", " + clbInputName + ", CLB_GLOBAL_IN_MUX_EPWM1A);"
|
||||
gpInput = "CLB_configGPInputMux(" + baseName +
|
||||
", " + clbInputName + ", CLB_GP_IN_MUX_GP_REG);"
|
||||
}
|
||||
else if (inputType == "GLOBAL")
|
||||
{
|
||||
localInput = "CLB_configLocalInputMux(" + baseName +
|
||||
", " + clbInputName + ", CLB_LOCAL_IN_MUX_GLOBAL_IN);"
|
||||
globalInput = "CLB_configGlobalInputMux(" + baseName +
|
||||
", " + clbInputName + ", " + instance["globalConfig" + clbInputName] + ");"
|
||||
gpInput = "CLB_configGPInputMux(" + baseName +
|
||||
", " + clbInputName + ", CLB_GP_IN_MUX_EXTERNAL);"
|
||||
}
|
||||
else if (inputType == "LOCAL")
|
||||
{
|
||||
localInput = "CLB_configLocalInputMux(" + baseName +
|
||||
", " + clbInputName + ", " + instance["localConfig" + clbInputName] + ");"
|
||||
globalInput = "CLB_configGlobalInputMux(" + baseName +
|
||||
", " + clbInputName + ", CLB_GLOBAL_IN_MUX_EPWM1A);"
|
||||
gpInput = "CLB_configGPInputMux(" + baseName +
|
||||
", " + clbInputName + ", CLB_GP_IN_MUX_EXTERNAL);"
|
||||
}
|
||||
var inputFilterLine = "CLB_selectInputFilter(" + baseName +
|
||||
", " + clbInputName + ", " + instance["filterConfig" + clbInputName] + ");"
|
||||
gpRegValue += instance["gpStartValueConfig" + clbInputName] << clbInputNumber
|
||||
%%}
|
||||
//
|
||||
// `instance.$name` `clbInputName` initialization
|
||||
//
|
||||
// The following functions configure the CLB input mux and whether the inputs
|
||||
// have synchronization or pipeline enabled; check the device manual for more
|
||||
// information on when a signal needs to be synchronized or go through a
|
||||
// pipeline filter
|
||||
//
|
||||
`localInput`
|
||||
`globalInput`
|
||||
`gpInput`
|
||||
%if (instance["synchronize" + clbInputName])
|
||||
%{
|
||||
`syncInput`
|
||||
%}
|
||||
`inputFilterLine`
|
||||
% if (Common.CLB_isType2()) {
|
||||
`inputPipeline`
|
||||
% }
|
||||
%%{
|
||||
}
|
||||
var gpRegLine = "CLB_setGPREG(" + baseName + "," + gpRegValue.toString() + ");"
|
||||
%%}
|
||||
`gpRegLine`
|
||||
|
||||
% if (tileInitLine) {
|
||||
`tileInitLine`
|
||||
% }
|
||||
`enableCLBLine`
|
||||
}
|
||||
%%{
|
||||
}
|
||||
}
|
||||
%%}
|
||||
@@ -0,0 +1,26 @@
|
||||
% var moduleName = "clb"
|
||||
% var module = system.modules['/driverlib/' + moduleName + '.js'];
|
||||
%if (module != null)
|
||||
%{
|
||||
//*****************************************************************************
|
||||
//
|
||||
// CLB Configurations
|
||||
//
|
||||
//*****************************************************************************
|
||||
% var clb_config_h = false;
|
||||
% for(var i = 0; i < module.$instances.length; i++) {
|
||||
% var instance = module.$instances[i];
|
||||
% let modInst = instance[moduleName];
|
||||
% if (instance.attachTile) {
|
||||
% clb_config_h = true;
|
||||
% }
|
||||
#define `instance.$name`_BASE `instance.clbBase`
|
||||
void `instance.$name`_init();
|
||||
% }
|
||||
% if (clb_config_h) {
|
||||
//
|
||||
// Tile Configurations for all CLBs are in this file
|
||||
//
|
||||
#include "clb_config.h"
|
||||
% }
|
||||
%}
|
||||
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 32 KiB |
@@ -0,0 +1,161 @@
|
||||
let Common = system.getScript("/driverlib/Common.js");
|
||||
let Pinmux = system.getScript("/driverlib/pinmux.js");
|
||||
|
||||
let device_driverlib_peripheral =
|
||||
system.getScript("/driverlib/device_driverlib_peripherals/" +
|
||||
Common.getDeviceName().toLowerCase() + "_xbar.js");
|
||||
|
||||
/* Intro splash on GUI */
|
||||
let longDescription = "The CLB Input X-BAR is used to route signals from a GPIO to many different" +
|
||||
" IP blocks such as the ADC(s), eCAP(s), ePWM(s), and external interrupts";
|
||||
|
||||
|
||||
function onChangeInputsUsed(inst, ui)
|
||||
{
|
||||
var usedInputs = inst.inputsUsed;
|
||||
for (var uiInputXbarNameIndex in uiInputXbarNames)
|
||||
{
|
||||
var uiName = uiInputXbarNames[uiInputXbarNameIndex];
|
||||
//console.log(uiName);
|
||||
ui[uiName].hidden = true;
|
||||
|
||||
uiName = uiInputXbarLockNames[uiInputXbarNameIndex];
|
||||
//console.log(uiName);
|
||||
ui[uiName].hidden = true;
|
||||
}
|
||||
for (var usedInputIndex in usedInputs)
|
||||
{
|
||||
var usedInput = usedInputs[usedInputIndex];
|
||||
for (uiInputXbarNameIndex in uiInputXbarNames)
|
||||
{
|
||||
var uiName = uiInputXbarNames[uiInputXbarNameIndex];
|
||||
//console.log("ui Name:" + uiName)
|
||||
//console.log("used input name:" + usedInput)
|
||||
if (usedInput == uiName)
|
||||
{
|
||||
//console.log("Name match")
|
||||
//console.log(uiName);
|
||||
ui[uiName].hidden = false;
|
||||
|
||||
uiName = uiInputXbarLockNames[uiInputXbarNameIndex];
|
||||
//console.log(uiName);
|
||||
ui[uiName].hidden = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Array of Input X-bar configurables that are common across device families */
|
||||
var config = [
|
||||
/*
|
||||
{
|
||||
name : "bitRate",
|
||||
displayName : "Bit Rate",
|
||||
description : 'Bit rate for device',
|
||||
hidden : false,
|
||||
default : '400'
|
||||
}
|
||||
*/
|
||||
];
|
||||
|
||||
var gpios = Common.getGPIOs();
|
||||
var aios = Common.getAIOs();
|
||||
var inputxbarGPIOOptions = [];
|
||||
for (var gpioIndex = 0; gpioIndex < gpios.length; gpioIndex++)
|
||||
{
|
||||
inputxbarGPIOOptions.push({name: gpios[gpioIndex]});
|
||||
}
|
||||
for (var aioIndex = 0; aioIndex < aios.length; aioIndex++)
|
||||
{
|
||||
inputxbarGPIOOptions.push({name: aios[aioIndex]});
|
||||
}
|
||||
|
||||
|
||||
var interfaceNames = []
|
||||
var uiInputXbarNames = []
|
||||
var uiInputXbarLockNames = []
|
||||
for (var clb_inputxbar_index = 1; clb_inputxbar_index <= 16; clb_inputxbar_index++)
|
||||
{
|
||||
|
||||
|
||||
var uiInputXbarName = "CLB_INPUTXBAR" + clb_inputxbar_index.toString() + "Gpio"
|
||||
var uiInputXbarLockName = "CLB_INPUTXBAR" + clb_inputxbar_index.toString() + "Lock"
|
||||
|
||||
uiInputXbarNames.push(uiInputXbarName)
|
||||
uiInputXbarLockNames.push(uiInputXbarLockName)
|
||||
|
||||
|
||||
interfaceNames.push({name: uiInputXbarName, displayName: "CLB_INPUTXBAR" + clb_inputxbar_index.toString()})
|
||||
|
||||
var inputxbarGPIOConfig = {
|
||||
name : uiInputXbarName,
|
||||
displayName : "CLB_INPUTXBAR" + clb_inputxbar_index.toString(),
|
||||
description : 'GPIO for this Input X-Bar',
|
||||
hidden : true,
|
||||
default : inputxbarGPIOOptions[0].name,
|
||||
options : inputxbarGPIOOptions,
|
||||
deprecated : true,
|
||||
}
|
||||
|
||||
var inputxbarLOCKConfig = {
|
||||
name : uiInputXbarLockName,
|
||||
displayName : "CLB_INPUTXBAR" + clb_inputxbar_index.toString() + " Lock",
|
||||
description : 'Lock this Input X-Bar',
|
||||
hidden : true,
|
||||
default : false,
|
||||
deprecated : true,
|
||||
}
|
||||
|
||||
config.push(inputxbarGPIOConfig);
|
||||
config.push(inputxbarLOCKConfig);
|
||||
}
|
||||
|
||||
config.unshift(
|
||||
{
|
||||
name : "inputsUsed",
|
||||
displayName : "INPUTs to be used",
|
||||
description : 'Which inputs to use from the CLB INPUT X-BAR.',
|
||||
hidden : false,
|
||||
default : [],
|
||||
minSelections: 0,
|
||||
//onChange : onChangeInputsUsed,
|
||||
options : interfaceNames,
|
||||
deprecated : true,
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
var clb_inputxbarModule = {
|
||||
displayName: "CLB INPUTXBAR",
|
||||
maxInstances: 1,
|
||||
defaultInstanceName: "myCLBINPUTXBAR",
|
||||
description: "CLB Input X-bar",
|
||||
config: config,
|
||||
templates: {
|
||||
boardc : "",
|
||||
boardh : ""
|
||||
},
|
||||
migrateLegacyConfiguration : (inst) => {
|
||||
for (var input of inst.inputsUsed)
|
||||
{
|
||||
var inputxbar_input_inst = scripting.addModule("/driverlib/clb_inputxbar_input.js").addInstance();
|
||||
var inputNum = input.replace("Gpio", "").replace("CLB_INPUTXBAR", "")
|
||||
var inputLock = inst["CLB_INPUTXBAR" + inputNum + "Lock"]
|
||||
var inputSource = inst[input]
|
||||
inputxbar_input_inst.inputxbarInput = "XBAR_INPUT" + inputNum;
|
||||
inputxbar_input_inst.inputxbarGpio = inputSource;
|
||||
inputxbar_input_inst.inputxbarLock = inputLock;
|
||||
}
|
||||
},
|
||||
//pinmuxRequirements : Pinmux.inputxbarPinmuxRequirements
|
||||
};
|
||||
|
||||
|
||||
if (clb_inputxbarModule.maxInstances <= 0)
|
||||
{
|
||||
delete clb_inputxbarModule.pinmuxRequirements;
|
||||
}
|
||||
|
||||
|
||||
exports = clb_inputxbarModule;
|
||||
@@ -0,0 +1,50 @@
|
||||
% var module = system.modules['/driverlib/clb_inputxbar.js'];
|
||||
% let Common = system.getScript("/driverlib/Common.js");
|
||||
% var nameOfModule = "clb_inputxbar";
|
||||
% var nameOfPeripheral = module.peripheralName;
|
||||
%%{
|
||||
function addBaseAddress(){
|
||||
if (["F28003x", "F28002x", "F2838x", "F28P55x"].includes(Common.getDeviceName()))
|
||||
{
|
||||
return "CLBINPUTXBAR_BASE"
|
||||
}
|
||||
return ""
|
||||
}
|
||||
%%}
|
||||
//*****************************************************************************
|
||||
//
|
||||
// CLBINPUTXBAR Configurations
|
||||
//
|
||||
//*****************************************************************************
|
||||
void `nameOfPeripheral`_init(){
|
||||
%if (module != null)
|
||||
%{
|
||||
% for(var i = 0; i < module.$instances.length; i++) {
|
||||
% var instance = module.$instances[i];
|
||||
|
||||
//`instance.$name` initialization
|
||||
% for (var clb_inputxbar_index = 1; clb_inputxbar_index <= 16; clb_inputxbar_index++)
|
||||
% {
|
||||
% var interfaceName = "CLB_INPUTXBAR" + clb_inputxbar_index.toString();
|
||||
% let pinName = "CLB_INPUTXBAR" + clb_inputxbar_index.toString() + "Gpio";
|
||||
% let lockName = "CLB_INPUTXBAR" + clb_inputxbar_index.toString() + "Lock";
|
||||
% var gpioName = instance[pinName];
|
||||
% var gpioNumber = "";
|
||||
% if (gpioName.includes("IO")){
|
||||
% var aioOrGpio = (gpioName.includes("AIO"))?3:4;
|
||||
% gpioNumber = gpioName.substring(aioOrGpio);
|
||||
% gpioNumber = Common.gpioNameToNumber(gpioNumber);
|
||||
% } else {
|
||||
% gpioNumber = gpioName;
|
||||
%}
|
||||
% if (instance.inputsUsed.indexOf(pinName) != -1)
|
||||
% {
|
||||
XBAR_setInputPin(`addBaseAddress()`, XBAR_INPUT`interfaceName.replace("CLB_INPUTXBAR", "")`, `gpioNumber`);
|
||||
% if (instance[lockName]){
|
||||
XBAR_lockInput(`addBaseAddress()`, XBAR_INPUT`interfaceName.replace("CLB_INPUTXBAR", "")`);
|
||||
% }
|
||||
%}
|
||||
%}
|
||||
%}
|
||||
%}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
% var moduleName = "clb_inputxbar"
|
||||
% var module = system.modules['/driverlib/' + moduleName + '.js'];
|
||||
% let Common = system.getScript("/driverlib/Common.js");
|
||||
|
||||
%if (module != null)
|
||||
%{
|
||||
//*****************************************************************************
|
||||
//
|
||||
// CLBINPUTXBAR Configurations
|
||||
//
|
||||
//*****************************************************************************
|
||||
% for(var i = 0; i < module.$instances.length; i++) {
|
||||
% var instance = module.$instances[i];
|
||||
% let modInst = instance[moduleName];
|
||||
% var inputs = "";
|
||||
% for (var clb_inputxbar_index = 1; clb_inputxbar_index <= 16; clb_inputxbar_index++)
|
||||
% {
|
||||
% var interfaceName = "CLB_INPUTXBAR" + clb_inputxbar_index.toString();
|
||||
% let pinName = "CLB_INPUTXBAR" + clb_inputxbar_index.toString() + "Gpio";
|
||||
% let lockName = "CLB_INPUTXBAR" + clb_inputxbar_index.toString() + "Lock";
|
||||
% var gpioName = instance[pinName];
|
||||
% var gpioNumber = "";
|
||||
% if (gpioName.includes("IO")){
|
||||
% var aioOrGpio = (gpioName.includes("AIO"))?3:4;
|
||||
% gpioNumber = gpioName.substring(aioOrGpio);
|
||||
% gpioNumber = Common.gpioNameToNumber(gpioNumber);
|
||||
% } else {
|
||||
% gpioNumber = gpioName;
|
||||
%}
|
||||
% if (instance.inputsUsed.indexOf(pinName) != -1)
|
||||
% {
|
||||
% inputs += Common.stringOrEmpty(inputs, " | ");
|
||||
% inputs += "XBAR_INPUT" + interfaceName.replace("CLB_INPUTXBAR", "");
|
||||
% }
|
||||
%}
|
||||
% if (inputs !="")
|
||||
%{
|
||||
#define `instance.$name`_INPUTS_USED (`inputs`)
|
||||
%}
|
||||
% }
|
||||
%}
|
||||
%
|
||||
@@ -0,0 +1,38 @@
|
||||
% var module = system.modules['/driverlib/clb_inputxbar_input.js'];
|
||||
% let Common = system.getScript("/driverlib/Common.js");
|
||||
% var nameOfModule = "clb_inputxbar_input";
|
||||
% var nameOfPeripheral = module.peripheralName;
|
||||
%%{
|
||||
function addBaseAddress(){
|
||||
if (["F280013x", "F280015x", "F28003x", "F28002x", "F2838x", "F28P65x", "F28P55x"].includes(Common.getDeviceName()))
|
||||
{
|
||||
return "CLBINPUTXBAR_BASE, "
|
||||
}
|
||||
return ""
|
||||
}
|
||||
%%}
|
||||
//*****************************************************************************
|
||||
//
|
||||
// CLBINPUTXBAR Configurations
|
||||
//
|
||||
//*****************************************************************************
|
||||
void `nameOfPeripheral`_init(){
|
||||
% for(var i = 0; i < module.$instances.length; i++)
|
||||
% {
|
||||
% var instance = module.$instances[i];
|
||||
`instance.$name`_init();
|
||||
% }
|
||||
}
|
||||
|
||||
%if (module != null)
|
||||
%{
|
||||
% for(var i = 0; i < module.$instances.length; i++) {
|
||||
% var instance = module.$instances[i];
|
||||
void `instance.$name`_init(){
|
||||
XBAR_setInputPin(`addBaseAddress()``instance.$name`_INPUT, `instance.$name`_SOURCE);
|
||||
% if (instance.inputxbarLock){
|
||||
XBAR_lockInput(`addBaseAddress()``instance.$name`_INPUT);
|
||||
% }
|
||||
}
|
||||
%}
|
||||
%}
|
||||
@@ -0,0 +1,30 @@
|
||||
% var moduleName = "clb_inputxbar_input"
|
||||
% var module = system.modules['/driverlib/' + moduleName + '.js'];
|
||||
% let Common = system.getScript("/driverlib/Common.js");
|
||||
% var nameOfPeripheral = module.peripheralName;
|
||||
%if (module != null)
|
||||
%{
|
||||
//*****************************************************************************
|
||||
//
|
||||
// CLBINPUTXBAR Configurations
|
||||
//
|
||||
//*****************************************************************************
|
||||
% for(var i = 0; i < module.$instances.length; i++) {
|
||||
% var instance = module.$instances[i];
|
||||
% let modInst = instance[moduleName];
|
||||
% var inputs = "";
|
||||
% var gpioName = instance.inputxbarGpio;
|
||||
% var gpioNumber = "";
|
||||
% if (gpioName.includes("IO")){
|
||||
% var aioOrGpio = (gpioName.includes("AIO"))?3:4;
|
||||
% gpioNumber = gpioName.substring(aioOrGpio);
|
||||
% gpioNumber = Common.gpioNameToNumber(gpioNumber);
|
||||
% } else {
|
||||
% gpioNumber = gpioName;
|
||||
% }
|
||||
#define `instance.$name`_SOURCE `gpioNumber`
|
||||
#define `instance.$name`_INPUT `instance.inputxbarInput`
|
||||
void `instance.$name`_init();
|
||||
% }
|
||||
%}
|
||||
%
|
||||
@@ -0,0 +1,120 @@
|
||||
let Common = system.getScript("/driverlib/Common.js");
|
||||
let Pinmux = system.getScript("/driverlib/pinmux.js");
|
||||
let InputXbar_DevSpecific = system.getScript("/driverlib/inputxbar/inputxbar_deviceSpecific.js");
|
||||
|
||||
let device_driverlib_peripheral =
|
||||
system.getScript("/driverlib/device_driverlib_peripherals/" +
|
||||
Common.getDeviceName().toLowerCase() + "_xbar.js");
|
||||
|
||||
|
||||
/* Intro splash on GUI */
|
||||
let longDescription = "The CLB Input X-BAR is used to route signals from a GPIO to many different" +
|
||||
" IP blocks such as the ADC(s), eCAP(s), ePWM(s), and external interrupts";
|
||||
|
||||
var inputXbarCount = 16
|
||||
|
||||
|
||||
/* Array of Input X-bar configurables that are common across device families */
|
||||
var config = [
|
||||
|
||||
];
|
||||
|
||||
var gpios = Common.getGPIOs();
|
||||
var aios = Common.getAIOs();
|
||||
var inputxbarGPIOOptions = [];
|
||||
for (var gpioIndex = 0; gpioIndex < gpios.length; gpioIndex++)
|
||||
{
|
||||
inputxbarGPIOOptions.push({name: gpios[gpioIndex]});
|
||||
}
|
||||
for (var aioIndex = 0; aioIndex < aios.length; aioIndex++)
|
||||
{
|
||||
inputxbarGPIOOptions.push({name: aios[aioIndex]});
|
||||
}
|
||||
|
||||
var inputNumOptions = []
|
||||
for (var inputNum of device_driverlib_peripheral.XBAR_InputNum)
|
||||
{
|
||||
inputNumOptions.push({
|
||||
name: inputNum.name
|
||||
})
|
||||
}
|
||||
|
||||
var inputxbarINPUTConfig = {
|
||||
name : "inputxbarInput",
|
||||
displayName : "INPUT",
|
||||
description : 'The INPUT number for Input X-Bar',
|
||||
hidden : false,
|
||||
default : inputNumOptions[0].name,
|
||||
options : inputNumOptions
|
||||
}
|
||||
|
||||
var inputxbarGPIOConfig = {
|
||||
name : "inputxbarGpio",
|
||||
displayName : "INPUT Source",
|
||||
description : 'GPIO for this Input X-Bar',
|
||||
hidden : false,
|
||||
default : inputxbarGPIOOptions[0].name,
|
||||
options : inputxbarGPIOOptions
|
||||
}
|
||||
|
||||
var inputxbarLOCKConfig = {
|
||||
name : "inputxbarLock",
|
||||
displayName : "INPUT Lock",
|
||||
description : 'Lock this Input X-Bar',
|
||||
hidden : false,
|
||||
default : false
|
||||
}
|
||||
|
||||
config.push(inputxbarINPUTConfig);
|
||||
config.push(inputxbarGPIOConfig);
|
||||
config.push(inputxbarLOCKConfig);
|
||||
|
||||
|
||||
function onValidate(inst, validation)
|
||||
{
|
||||
var usedInsts = [];
|
||||
for (var instance_index in inst.$module.$instances)
|
||||
{
|
||||
var instance_obj = inst.$module.$instances[instance_index];
|
||||
usedInsts.push(instance_obj.inputxbarInput);
|
||||
}
|
||||
|
||||
var duplicatesResult = Common.findDuplicates(usedInsts)
|
||||
|
||||
if (duplicatesResult.duplicates.length != 0)
|
||||
{
|
||||
var allDuplicates = "";
|
||||
for (var duplicateNamesIndex in duplicatesResult.duplicates)
|
||||
{
|
||||
allDuplicates = allDuplicates + Common.stringOrEmpty(allDuplicates, ", ")
|
||||
+ duplicatesResult.duplicates[duplicateNamesIndex];
|
||||
}
|
||||
validation.logError(
|
||||
"This instance is already in use! Duplicates: " + allDuplicates,
|
||||
inst, "inputxbarInput");
|
||||
}
|
||||
}
|
||||
|
||||
var clb_inputxbarModule = {
|
||||
peripheralName: "CLB_INPUTXBAR",
|
||||
displayName: "CLB INPUTXBAR INPUT",
|
||||
maxInstances: inputXbarCount,
|
||||
defaultInstanceName: "myCLBINPUTXBARINPUT",
|
||||
description: "CLB Input X-bar",
|
||||
config: config,
|
||||
templates: {
|
||||
boardc : "/driverlib/clb_inputxbar/clb_inputxbar_input.board.c.xdt",
|
||||
boardh : "/driverlib/clb_inputxbar/clb_inputxbar_input.board.h.xdt"
|
||||
},
|
||||
validate : onValidate,
|
||||
|
||||
};
|
||||
|
||||
|
||||
if (clb_inputxbarModule.maxInstances <= 0)
|
||||
{
|
||||
delete clb_inputxbarModule.pinmuxRequirements;
|
||||
}
|
||||
|
||||
|
||||
exports = clb_inputxbarModule;
|
||||
@@ -0,0 +1,258 @@
|
||||
let Common = system.getScript("/driverlib/Common.js");
|
||||
let Pinmux = system.getScript("/driverlib/pinmux.js");
|
||||
|
||||
let device_driverlib_peripheral =
|
||||
system.getScript("/driverlib/device_driverlib_peripherals/" +
|
||||
Common.getDeviceName().toLowerCase() + "_xbar.js");
|
||||
|
||||
/* Intro splash on GUI */
|
||||
let longDescription = "The CLB Output X-BAR takes signals from " +
|
||||
"the CLB TILE OUTs and brings them out to a GPIO.";
|
||||
|
||||
let outputxbar_enum = device_driverlib_peripheral.XBAR_OutputMuxConfig;
|
||||
|
||||
var index_of_clbxbar = outputxbar_enum.length;
|
||||
var clboutputxbar_only = [];
|
||||
var start_of_clboutputxbar_only = false;
|
||||
for (var i = 0; i < outputxbar_enum.length; i++){
|
||||
if (outputxbar_enum[i].name == "XBAR_OUT_MUX00_CLB1_OUT0")
|
||||
{
|
||||
start_of_clboutputxbar_only = true;
|
||||
}
|
||||
if (start_of_clboutputxbar_only)
|
||||
{
|
||||
clboutputxbar_only.push(outputxbar_enum[i].name)
|
||||
}
|
||||
}
|
||||
|
||||
function onChangeMuxesUsed(inst, ui)
|
||||
{
|
||||
var optionNamePrepend = "XBAR_MUX"
|
||||
var muxSource = {}
|
||||
ui["sourceSignals"].hidden = !inst["useSourceSelect"]
|
||||
if (inst["useSourceSelect"])
|
||||
{
|
||||
var muxes = []
|
||||
for (var sourceSignal of inst.sourceSignals)
|
||||
{
|
||||
var mux = muxOptionToMuxNumber[sourceSignal]
|
||||
muxSource[mux] = sourceSignal
|
||||
if (!muxes.includes(optionNamePrepend + mux)){
|
||||
muxes.push(optionNamePrepend + mux)
|
||||
}
|
||||
}
|
||||
inst.muxesUsed = muxes;
|
||||
ui.muxesUsed.readOnly = true;
|
||||
}
|
||||
else {
|
||||
ui.muxesUsed.readOnly = false;
|
||||
}
|
||||
var muxesUsed = inst.muxesUsed;
|
||||
for (var muxConfigIndex in muxConfigs)
|
||||
{
|
||||
var muxConfigName = muxConfigs[muxConfigIndex];
|
||||
var muxNumber = parseInt(muxConfigName.replace("mux", "").replace("Config", ""))
|
||||
var turnOnMux = false
|
||||
for (var muxesUsedIndex in muxesUsed)
|
||||
{
|
||||
var usedMuxName = muxesUsed[muxesUsedIndex]
|
||||
var usedMuxNumberString = usedMuxName.replace("XBAR_MUX", "")
|
||||
var usedMuxNumber = parseInt(usedMuxName.replace("XBAR_MUX", ""))
|
||||
//console.log("used: " + usedMuxNumber)
|
||||
//console.log("checking: " + muxNumber)
|
||||
var turnOnMux = true;
|
||||
|
||||
if (usedMuxNumber == muxNumber)
|
||||
{
|
||||
turnOnMux = true;
|
||||
if (inst["useSourceSelect"])
|
||||
{
|
||||
inst[muxConfigName] = "XBAR_OUT_MUX" + usedMuxNumberString + "_" + muxSource[usedMuxNumberString]
|
||||
}
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
turnOnMux = false;
|
||||
}
|
||||
|
||||
}
|
||||
if (turnOnMux)
|
||||
{
|
||||
ui[muxConfigName].hidden = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
ui[muxConfigName].hidden = true;
|
||||
}
|
||||
|
||||
ui[muxConfigName].readOnly = inst["useSourceSelect"];
|
||||
}
|
||||
}
|
||||
|
||||
var config = [];
|
||||
var latchModeConfig = {
|
||||
name : "latchMode",
|
||||
displayName : "Latch Mode",
|
||||
description : 'Whether the output is latched or not',
|
||||
hidden : false,
|
||||
default : false
|
||||
};
|
||||
|
||||
var invertConfig = {
|
||||
name : "invertMode",
|
||||
displayName : "Invert Mode",
|
||||
description : 'Whether the output is inverted or not',
|
||||
hidden : false,
|
||||
default : false
|
||||
};
|
||||
|
||||
var muxesUsed = {
|
||||
name : "muxesUsed",
|
||||
displayName : "MUXes to be used",
|
||||
description : 'Which MUXes are be to use from the OUTPUT X-BAR.',
|
||||
hidden : false,
|
||||
default : [],
|
||||
minSelections: 0,
|
||||
onChange : onChangeMuxesUsed,
|
||||
options : device_driverlib_peripheral.XBAR_MUXES
|
||||
}
|
||||
|
||||
|
||||
config.push(latchModeConfig);
|
||||
config.push(invertConfig);
|
||||
config.push({
|
||||
name: "useSourceSelect",
|
||||
displayName: "Auto Enable Mux Setting From Source",
|
||||
description: "Select your source and have the muxes used get autocalculated",
|
||||
longDescription: "Instead of selecting the muxes to be used and then selecting your source signals, select your source signals and \
|
||||
and have the muxes to be used auto calculated",
|
||||
default : false,
|
||||
onChange: onChangeMuxesUsed,
|
||||
})
|
||||
|
||||
var muxSelectConfig = []
|
||||
var muxConfigs = []
|
||||
var allMuxOptions = []
|
||||
var muxOptionToMuxNumber = {}
|
||||
|
||||
for (var mux_number_index in device_driverlib_peripheral.XBAR_OutputMuxConfig_All_MUXES)
|
||||
{
|
||||
var muxSpecificOptions = device_driverlib_peripheral.XBAR_OutputMuxConfig_All_MUXES[mux_number_index]
|
||||
if (muxSpecificOptions[0] != undefined)
|
||||
{
|
||||
var onlyclbxbar = muxSpecificOptions.filter(muxoption => {
|
||||
//console.log(muxoption.name)
|
||||
//console.log(!clboutputxbar_only.includes(muxoption.name))
|
||||
return clboutputxbar_only.includes(muxoption.name);
|
||||
});
|
||||
|
||||
|
||||
var noMuxNumOptions = onlyclbxbar.map(element => {
|
||||
var elementName = element.name.replace(/XBAR_OUT_MUX[0-9][0-9]_/g, "")
|
||||
var elementMux = element.name.substring("XBAR_OUT_MUX".length, "XBAR_OUT_MUX".length + 2)
|
||||
muxOptionToMuxNumber[elementName] = elementMux
|
||||
return { name: elementName, displayName: element.displayName+" (MUX "+ elementMux + ")" }
|
||||
});
|
||||
|
||||
if (onlyclbxbar.length > 0)
|
||||
{
|
||||
var muxOptions = {
|
||||
name : "mux" + mux_number_index + "Config",
|
||||
displayName : "MUX " + mux_number_index + " Config",
|
||||
description : 'Mux Configuration for CLB OUTPUT XBAR\'s MUX number ' + mux_number_index,
|
||||
hidden : true,
|
||||
default : onlyclbxbar[0].name,
|
||||
options : onlyclbxbar
|
||||
};
|
||||
muxConfigs.push(muxOptions.name)
|
||||
|
||||
muxSelectConfig.push(muxOptions)
|
||||
|
||||
allMuxOptions = allMuxOptions.concat(noMuxNumOptions)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var sourceSignals = {
|
||||
name : "sourceSignals",
|
||||
displayName : "Source Signals",
|
||||
description : 'Which signals to use for this output.',
|
||||
hidden : true,
|
||||
default : [],
|
||||
minSelections: 0,
|
||||
options : allMuxOptions,
|
||||
onChange: onChangeMuxesUsed,
|
||||
}
|
||||
|
||||
config.push(sourceSignals)
|
||||
config.push(
|
||||
{
|
||||
name: "GROUP_MUXSELECT",
|
||||
displayName: "Mux Selection Method",
|
||||
config : muxSelectConfig
|
||||
}
|
||||
)
|
||||
muxSelectConfig.unshift(muxesUsed);
|
||||
|
||||
function onValidate(inst, validation) {
|
||||
var optionNamePrepend = "XBAR_MUX"
|
||||
if (inst["useSourceSelect"])
|
||||
{
|
||||
var muxes = []
|
||||
for (var sourceSignal of inst.sourceSignals)
|
||||
{
|
||||
var mux = muxOptionToMuxNumber[sourceSignal]
|
||||
if (muxes.includes(optionNamePrepend + mux)){
|
||||
validation.logError(
|
||||
"There are multiple signals selected for MUX" + mux + ". Only one is allowed at a time per MUX. Signal: " + sourceSignal,
|
||||
inst, "sourceSignals");
|
||||
}
|
||||
else {
|
||||
muxes.push(optionNamePrepend + mux)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* ======== filterHardware ========
|
||||
* Control RX, TX Pin usage by the user specified dataDirection.
|
||||
*
|
||||
* param component - hardware object describing signals and
|
||||
* resources they're attached to
|
||||
*
|
||||
* returns Boolean indicating whether or not to allow the component to
|
||||
* be assigned to an instance's $hardware config
|
||||
*/
|
||||
function filterHardware(component)
|
||||
{
|
||||
return (Common.typeMatches(component.type, ["CLB_OUTPUTXBAR"]));
|
||||
}
|
||||
|
||||
if (Common.onlyPinmux())
|
||||
{
|
||||
config = [config[config.length - 1]];
|
||||
}
|
||||
var clb_outputxbarModule = {
|
||||
peripheralName: "CLB_OUTPUTXBAR",
|
||||
displayName: "CLB OUTPUTXBAR",
|
||||
maxInstances: Common.peripheralCount("CLB_OUTPUTXBAR"),
|
||||
defaultInstanceName: "myCLB_OUTPUTXBAR",
|
||||
description: "CLB Output X-bar",
|
||||
filterHardware : filterHardware,
|
||||
config: config,
|
||||
templates: {
|
||||
boardc : "/driverlib/clb_outputxbar/clb_outputxbar.board.c.xdt",
|
||||
boardh : "/driverlib/clb_outputxbar/clb_outputxbar.board.h.xdt"
|
||||
},
|
||||
pinmuxRequirements : Pinmux.clb_outputxbarPinmuxRequirements,
|
||||
validate : onValidate,
|
||||
};
|
||||
|
||||
|
||||
if (clb_outputxbarModule.maxInstances <= 0)
|
||||
{
|
||||
delete clb_outputxbarModule.pinmuxRequirements;
|
||||
}
|
||||
|
||||
exports = clb_outputxbarModule;
|
||||
@@ -0,0 +1,78 @@
|
||||
% var module = system.modules['/driverlib/clb_outputxbar.js'];
|
||||
% let Common = system.getScript("/driverlib/Common.js");
|
||||
% var nameOfModule = "clb_outputxbar";
|
||||
% var nameOfPeripheral = module.peripheralName;
|
||||
%%{
|
||||
function addBaseAddress(){
|
||||
if (["F28003x", "F28002x", "F2838x", "F28P65x", "F28P55x"].includes(Common.getDeviceName()))
|
||||
{
|
||||
return "CLBOUTPUTXBAR_BASE, "
|
||||
}
|
||||
return ""
|
||||
}
|
||||
%%}
|
||||
//*****************************************************************************
|
||||
//
|
||||
// CLBOUTPUTXBAR Configurations
|
||||
//
|
||||
//*****************************************************************************
|
||||
void `nameOfPeripheral`_init(){
|
||||
% for(var i = 0; i < module.$instances.length; i++)
|
||||
% {
|
||||
% var instance = module.$instances[i];
|
||||
`instance.$name`_init();
|
||||
% }
|
||||
}
|
||||
|
||||
%if (module != null)
|
||||
%{
|
||||
% for(var i = 0; i < module.$instances.length; i++) {
|
||||
% var instance = module.$instances[i];
|
||||
% let instancePinmux = instance[nameOfModule];
|
||||
% let solution = instancePinmux.$solution;
|
||||
% let peripheral = system.deviceData.peripherals[solution.peripheralName];
|
||||
% let driverlibName = addBaseAddress() + instance.$name
|
||||
|
||||
void `instance.$name`_init(){
|
||||
% if(instance.latchMode){
|
||||
XBAR_setOutputLatchMode(`driverlibName`, true);
|
||||
%}
|
||||
% else{
|
||||
XBAR_setOutputLatchMode(`driverlibName`, false);
|
||||
%}
|
||||
% if(instance.invertMode){
|
||||
XBAR_invertOutputSignal(`driverlibName`, true);
|
||||
%} else{
|
||||
XBAR_invertOutputSignal(`driverlibName`, false);
|
||||
%}
|
||||
%%{
|
||||
var muxConfigurationOutput = "";
|
||||
if(instance.muxesUsed.length > 0)
|
||||
{
|
||||
muxConfigurationOutput = "\n\t//\n\t//Mux configuration\n\t//\n";
|
||||
var muxesUsed = instance.muxesUsed;
|
||||
var enabledMuxesUsed = "";
|
||||
for (var muxesUsedIndex in muxesUsed)
|
||||
{
|
||||
var usedMuxName = muxesUsed[muxesUsedIndex];
|
||||
var usedMuxNumber = parseInt(usedMuxName.replace("XBAR_MUX", ""))
|
||||
var muxConfigName = "mux" + usedMuxNumber + "Config"
|
||||
|
||||
if (instance[muxConfigName])
|
||||
{
|
||||
enabledMuxesUsed += Common.stringOrEmpty(enabledMuxesUsed, " | ");
|
||||
enabledMuxesUsed += usedMuxName;
|
||||
var muxSource = instance[muxConfigName]
|
||||
muxConfigurationOutput += "\tXBAR_setOutputMuxConfig(" + driverlibName + ", " + muxSource + ");\n"
|
||||
}
|
||||
}
|
||||
if (enabledMuxesUsed != "")
|
||||
{
|
||||
muxConfigurationOutput += "\tXBAR_enableOutputMux(" + driverlibName + ", " + enabledMuxesUsed + ");"
|
||||
}
|
||||
}
|
||||
%%}
|
||||
`muxConfigurationOutput`
|
||||
}
|
||||
%}
|
||||
%}
|
||||
@@ -0,0 +1,38 @@
|
||||
% var moduleName = "clb_outputxbar"
|
||||
% let Common = system.getScript("/driverlib/Common.js");
|
||||
% var module = system.modules['/driverlib/' + moduleName + '.js'];
|
||||
%if (module != null)
|
||||
%{
|
||||
//*****************************************************************************
|
||||
//
|
||||
// CLBOUTPUTXBAR Configurations
|
||||
//
|
||||
//*****************************************************************************
|
||||
% for(var i = 0; i < module.$instances.length; i++) {
|
||||
% var instance = module.$instances[i];
|
||||
% let modInst = instance[moduleName];
|
||||
% let solution = modInst.$solution;
|
||||
%let peripheral = system.deviceData.peripherals[solution.peripheralName];
|
||||
void `instance.$name`_init();
|
||||
% let driverlibName = "XBAR_OUTPUT" + peripheral.name.replace("CLB_OUTPUTXBAR", "")
|
||||
#define `instance.$name` `driverlibName`
|
||||
% var muxesUsed = instance.muxesUsed;
|
||||
% var enabledMuxesUsed = "";
|
||||
% for (var muxesUsedIndex in muxesUsed)
|
||||
% {
|
||||
% var usedMuxName = muxesUsed[muxesUsedIndex];
|
||||
% var usedMuxNumber = parseInt(usedMuxName.replace("XBAR_MUX", ""))
|
||||
% var muxConfigName = "mux" + usedMuxNumber + "Config"
|
||||
% if (instance[muxConfigName])
|
||||
% {
|
||||
% enabledMuxesUsed += Common.stringOrEmpty(enabledMuxesUsed, " | ");
|
||||
% enabledMuxesUsed += usedMuxName;
|
||||
% }
|
||||
% }
|
||||
% if (enabledMuxesUsed !="")
|
||||
% {
|
||||
#define `instance.$name`_ENABLED_MUXES (`enabledMuxesUsed`)
|
||||
% }
|
||||
% }
|
||||
%}
|
||||
%
|
||||
@@ -0,0 +1,269 @@
|
||||
let Common = system.getScript("/driverlib/Common.js");
|
||||
let Pinmux = system.getScript("/driverlib/pinmux.js");
|
||||
|
||||
let device_driverlib_peripheral =
|
||||
system.getScript("/driverlib/device_driverlib_peripherals/" +
|
||||
Common.getDeviceName().toLowerCase() + "_xbar.js");
|
||||
|
||||
/* Intro splash on GUI */
|
||||
let longDescription = "The CLB X-BAR takes signals from inside " +
|
||||
"the device and brings them to the CLB AUXSIGx inputs.";
|
||||
|
||||
function findDuplicates(arrayToCheck)
|
||||
{
|
||||
const count = arrayToCheck =>
|
||||
arrayToCheck.reduce((a, b) => ({ ...a,
|
||||
[b]: (a[b] || 0) + 1
|
||||
}), {}) // don't forget to initialize the accumulator
|
||||
|
||||
const duplicates = dict =>
|
||||
Object.keys(dict).filter((a) => dict[a] > 1)
|
||||
|
||||
//console.log(count(arrayToCheck)) // { Mike: 1, Matt: 1, Nancy: 2, Adam: 1, Jenny: 1, Carl: 1 }
|
||||
//console.log(duplicates(count(arrayToCheck)))
|
||||
|
||||
return {count: count(arrayToCheck), duplicates: duplicates(count(arrayToCheck))};
|
||||
}
|
||||
|
||||
function onChangeauxInput(inst, ui)
|
||||
{
|
||||
//console.log(inst.$module.$instances);
|
||||
|
||||
}
|
||||
|
||||
function onValidate(inst, validation) {
|
||||
|
||||
var usedAuxs = [];
|
||||
for (var instance_index in inst.$module.$instances)
|
||||
{
|
||||
var instance_obj = inst.$module.$instances[instance_index];
|
||||
usedAuxs.push(instance_obj.auxInput);
|
||||
}
|
||||
|
||||
var duplicatesResult = findDuplicates(usedAuxs)
|
||||
|
||||
if (duplicatesResult.duplicates.length != 0)
|
||||
{
|
||||
var allDuplicates = "";
|
||||
for (var duplicateNamesIndex in duplicatesResult.duplicates)
|
||||
{
|
||||
allDuplicates = allDuplicates + Common.stringOrEmpty(allDuplicates, ", ")
|
||||
+ duplicatesResult.duplicates[duplicateNamesIndex];
|
||||
}
|
||||
validation.logError(
|
||||
"The AUXSIG Inputs cannot be same for multiple modules. Duplicates: " + allDuplicates,
|
||||
inst, "auxInput");
|
||||
}
|
||||
|
||||
var optionNamePrepend = "XBAR_MUX"
|
||||
if (inst["useSourceSelect"])
|
||||
{
|
||||
var muxes = []
|
||||
for (var sourceSignal of inst.sourceSignals)
|
||||
{
|
||||
var mux = muxOptionToMuxNumber[sourceSignal]
|
||||
if (muxes.includes(optionNamePrepend + mux)){
|
||||
validation.logError(
|
||||
"There are multiple signals selected for MUX" + mux + ". Only one is allowed at a time per MUX. Signal: " + sourceSignal,
|
||||
inst, "sourceSignals");
|
||||
}
|
||||
else {
|
||||
muxes.push(optionNamePrepend + mux)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function onChangeMuxesUsed(inst, ui)
|
||||
{
|
||||
var optionNamePrepend = "XBAR_MUX"
|
||||
var muxSource = {}
|
||||
ui["sourceSignals"].hidden = !inst["useSourceSelect"]
|
||||
if (inst["useSourceSelect"])
|
||||
{
|
||||
var muxes = []
|
||||
for (var sourceSignal of inst.sourceSignals)
|
||||
{
|
||||
var mux = muxOptionToMuxNumber[sourceSignal]
|
||||
muxSource[mux] = sourceSignal
|
||||
if (!muxes.includes(optionNamePrepend + mux)){
|
||||
muxes.push(optionNamePrepend + mux)
|
||||
}
|
||||
}
|
||||
inst.muxesUsed = muxes;
|
||||
ui.muxesUsed.readOnly = true;
|
||||
}
|
||||
else {
|
||||
ui.muxesUsed.readOnly = false;
|
||||
}
|
||||
var muxesUsed = inst.muxesUsed;
|
||||
for (var muxConfigIndex in muxConfigs)
|
||||
{
|
||||
var muxConfigName = muxConfigs[muxConfigIndex];
|
||||
var muxNumber = parseInt(muxConfigName.replace("mux", "").replace("Config", ""))
|
||||
var turnOnMux = false
|
||||
for (var muxesUsedIndex in muxesUsed)
|
||||
{
|
||||
var usedMuxName = muxesUsed[muxesUsedIndex]
|
||||
var usedMuxNumberString = usedMuxName.replace("XBAR_MUX", "")
|
||||
var usedMuxNumber = parseInt(usedMuxName.replace("XBAR_MUX", ""))
|
||||
//console.log("used: " + usedMuxNumber)
|
||||
//console.log("checking: " + muxNumber)
|
||||
var turnOnMux = true;
|
||||
|
||||
if (usedMuxNumber == muxNumber)
|
||||
{
|
||||
turnOnMux = true;
|
||||
if (inst["useSourceSelect"])
|
||||
{
|
||||
inst[muxConfigName] = "XBAR_CLB_MUX" + usedMuxNumberString + "_" + muxSource[usedMuxNumberString]
|
||||
}
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
turnOnMux = false;
|
||||
}
|
||||
|
||||
}
|
||||
if (turnOnMux)
|
||||
{
|
||||
ui[muxConfigName].hidden = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
ui[muxConfigName].hidden = true;
|
||||
}
|
||||
ui[muxConfigName].readOnly = inst["useSourceSelect"];
|
||||
}
|
||||
}
|
||||
|
||||
var config = [];
|
||||
var latchModeConfig = {
|
||||
name : "latchMode",
|
||||
displayName : "Latch Mode",
|
||||
description : 'Whether the output is latched or not',
|
||||
hidden : false,
|
||||
default : false
|
||||
};
|
||||
|
||||
var invertConfig = {
|
||||
name : "invertMode",
|
||||
displayName : "Invert Mode",
|
||||
description : 'Whether the output is inverted or not',
|
||||
hidden : false,
|
||||
default : false
|
||||
};
|
||||
|
||||
var muxesUsed = {
|
||||
name : "muxesUsed",
|
||||
displayName : "MUXes to be used",
|
||||
description : 'Which MUXes are be to use from the CLB X-BAR.',
|
||||
hidden : false,
|
||||
default : [],
|
||||
minSelections: 0,
|
||||
onChange : onChangeMuxesUsed,
|
||||
options : device_driverlib_peripheral.XBAR_MUXES
|
||||
|
||||
}
|
||||
|
||||
var auxInput = {
|
||||
name : "auxInput",
|
||||
displayName : "Aux Signal Input",
|
||||
description : 'Which Aux Signal is configured to be sourced from the muxes.',
|
||||
hidden : false,
|
||||
default : device_driverlib_peripheral.XBAR_AuxSigNum[0].name,
|
||||
onChange : onChangeauxInput,
|
||||
options : device_driverlib_peripheral.XBAR_AuxSigNum,
|
||||
|
||||
}
|
||||
|
||||
|
||||
config.push(auxInput);
|
||||
//config.push(latchModeConfig);
|
||||
config.push(invertConfig);
|
||||
|
||||
config.push({
|
||||
name: "useSourceSelect",
|
||||
displayName: "Auto Enable Mux Setting From Source",
|
||||
description: "Select your source and have the muxes used get autocalculated",
|
||||
longDescription: "Instead of selecting the muxes to be used and then selecting your source signals, select your source signals and \
|
||||
and have the muxes to be used auto calculated",
|
||||
default : false,
|
||||
onChange: onChangeMuxesUsed,
|
||||
})
|
||||
|
||||
|
||||
|
||||
var muxSelectConfig = []
|
||||
var muxConfigs = []
|
||||
var allMuxOptions = []
|
||||
var muxOptionToMuxNumber = {}
|
||||
|
||||
for (var mux_number_index in device_driverlib_peripheral.XBAR_CLBMuxConfig_All_MUXES)
|
||||
{
|
||||
|
||||
var muxSpecificOptions = device_driverlib_peripheral.XBAR_CLBMuxConfig_All_MUXES[mux_number_index]
|
||||
if (muxSpecificOptions[0] != undefined)
|
||||
{
|
||||
var noMuxNumOptions = muxSpecificOptions.map(element => {
|
||||
var elementName = element.name.replace(/XBAR_CLB_MUX[0-9][0-9]_/g, "")
|
||||
var elementMux = element.name.substring("XBAR_CLB_MUX".length, "XBAR_CLB_MUX".length + 2)
|
||||
muxOptionToMuxNumber[elementName] = elementMux
|
||||
return { name: elementName, displayName: element.displayName+" (MUX "+ elementMux + ")" }
|
||||
});
|
||||
|
||||
|
||||
var muxOptions = {
|
||||
name : "mux" + mux_number_index + "Config",
|
||||
displayName : "MUX " + mux_number_index + " Config",
|
||||
description : 'Mux Configuration for CLB XBAR\'s MUX number ' + mux_number_index,
|
||||
hidden : true,
|
||||
default : muxSpecificOptions[0].name,
|
||||
options : muxSpecificOptions
|
||||
};
|
||||
|
||||
muxConfigs.push(muxOptions.name)
|
||||
|
||||
muxSelectConfig.push(muxOptions)
|
||||
|
||||
allMuxOptions = allMuxOptions.concat(noMuxNumOptions)
|
||||
}
|
||||
}
|
||||
|
||||
var sourceSignals = {
|
||||
name : "sourceSignals",
|
||||
displayName : "Source Signals",
|
||||
description : 'Which signals to use for this output.',
|
||||
hidden : true,
|
||||
default : [],
|
||||
minSelections: 0,
|
||||
options : allMuxOptions,
|
||||
onChange: onChangeMuxesUsed,
|
||||
}
|
||||
|
||||
config.push(sourceSignals)
|
||||
config.push(
|
||||
{
|
||||
name: "GROUP_MUXSELECT",
|
||||
displayName: "Mux Selection Method",
|
||||
config : muxSelectConfig
|
||||
}
|
||||
)
|
||||
muxSelectConfig.unshift(muxesUsed);
|
||||
|
||||
var clbxbarModule = {
|
||||
peripheralName: "CLBXBAR",
|
||||
displayName: "CLBXBAR",
|
||||
maxInstances: 8,
|
||||
defaultInstanceName: "myCLBXBAR",
|
||||
description: "CLB X-bar",
|
||||
config: config,
|
||||
templates: {
|
||||
boardc : "/driverlib/clbxbar/clbxbar.board.c.xdt",
|
||||
boardh : "/driverlib/clbxbar/clbxbar.board.h.xdt"
|
||||
},
|
||||
validate : onValidate,
|
||||
};
|
||||
|
||||
exports = clbxbarModule;
|
||||
@@ -0,0 +1,53 @@
|
||||
% var module = system.modules['/driverlib/clbxbar.js'];
|
||||
% let Common = system.getScript("/driverlib/Common.js");
|
||||
% var nameOfModule = "clbxbar";
|
||||
% var nameOfPeripheral = module.peripheralName;
|
||||
//*****************************************************************************
|
||||
//
|
||||
// CLBXBAR Configurations
|
||||
//
|
||||
//*****************************************************************************
|
||||
void `nameOfPeripheral`_init(){
|
||||
% for(var i = 0; i < module.$instances.length; i++)
|
||||
% {
|
||||
% var instance = module.$instances[i];
|
||||
`instance.$name`_init();
|
||||
% }
|
||||
}
|
||||
|
||||
%if (module != null)
|
||||
%{
|
||||
% for(var i = 0; i < module.$instances.length; i++) {
|
||||
% var instance = module.$instances[i];
|
||||
% let instancePinmux = instance[nameOfModule];
|
||||
void `instance.$name`_init(){
|
||||
% if(instance.invertMode){
|
||||
XBAR_invertCLBSignal(`instance.$name`, true);
|
||||
%}
|
||||
%%{
|
||||
var muxConfigurationOutput = "\n";
|
||||
var muxesUsed = instance.muxesUsed;
|
||||
var enabledMuxesUsed = "";
|
||||
for (var muxesUsedIndex in muxesUsed)
|
||||
{
|
||||
var usedMuxName = muxesUsed[muxesUsedIndex];
|
||||
var usedMuxNumber = parseInt(usedMuxName.replace("XBAR_MUX", ""))
|
||||
var muxConfigName = "mux" + usedMuxNumber + "Config"
|
||||
|
||||
if (instance[muxConfigName])
|
||||
{
|
||||
enabledMuxesUsed += Common.stringOrEmpty(enabledMuxesUsed, " | ");
|
||||
enabledMuxesUsed += usedMuxName;
|
||||
var muxSource = instance[muxConfigName]
|
||||
muxConfigurationOutput += "\tXBAR_setCLBMuxConfig(" + instance.$name + ", " + muxSource + ");\n"
|
||||
}
|
||||
}
|
||||
if (enabledMuxesUsed != "")
|
||||
{
|
||||
muxConfigurationOutput += "\tXBAR_enableCLBMux(" + instance.$name + ", " + instance.$name + "_ENABLED_MUXES);"
|
||||
}
|
||||
%%}
|
||||
`muxConfigurationOutput`
|
||||
}
|
||||
%}
|
||||
%}
|
||||
@@ -0,0 +1,37 @@
|
||||
% var moduleName = "clbxbar"
|
||||
% var module = system.modules['/driverlib/' + moduleName + '.js'];
|
||||
% let Common = system.getScript("/driverlib/Common.js");
|
||||
%if (module != null)
|
||||
%{
|
||||
//*****************************************************************************
|
||||
//
|
||||
// CLBXBAR Configurations
|
||||
//
|
||||
//*****************************************************************************
|
||||
% for(var i = 0; i < module.$instances.length; i++) {
|
||||
% var instance = module.$instances[i];
|
||||
% let modInst = instance[moduleName];
|
||||
% let driverlibName = instance.auxInput
|
||||
void `instance.$name`_init();
|
||||
#define `instance.$name` `driverlibName`
|
||||
%var muxesUsed = instance.muxesUsed;
|
||||
%var enabledMuxesUsed = "";
|
||||
%for (var muxesUsedIndex in muxesUsed)
|
||||
%{
|
||||
%var usedMuxName = muxesUsed[muxesUsedIndex];
|
||||
%var usedMuxNumber = parseInt(usedMuxName.replace("XBAR_MUX", ""))
|
||||
%var muxConfigName = "mux" + usedMuxNumber + "Config"
|
||||
|
||||
%if (instance[muxConfigName])
|
||||
%{
|
||||
%enabledMuxesUsed += Common.stringOrEmpty(enabledMuxesUsed, " | ");
|
||||
%enabledMuxesUsed += usedMuxName;
|
||||
%var muxSource = instance[muxConfigName];
|
||||
%}
|
||||
%}
|
||||
%if (enabledMuxesUsed != "")
|
||||
%{
|
||||
#define `instance.$name`_ENABLED_MUXES (`enabledMuxesUsed`)
|
||||
%}
|
||||
% }
|
||||
%}
|
||||
@@ -0,0 +1,44 @@
|
||||
exports = {
|
||||
displayName: "Adder",
|
||||
config: [{
|
||||
name: "type",
|
||||
displayName: "Type",
|
||||
default: "Adder",
|
||||
readOnly: true,
|
||||
}],
|
||||
extendConfig: ({ $ipInstance }) => [
|
||||
{
|
||||
name: "Description",
|
||||
displayName: "Description",
|
||||
default: $ipInstance.description,
|
||||
readOnly: true,
|
||||
},
|
||||
{
|
||||
name: "InputValue1",
|
||||
displayName: "Input Clock 1 (MHz)",
|
||||
default: '',
|
||||
getValue: (inst) => {
|
||||
const value = inst[$ipInstance.inPins[0].name] + ' MHz';
|
||||
return value;
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "InputValue2",
|
||||
displayName: "Input Clock 2 (MHz)",
|
||||
default: '',
|
||||
getValue: (inst) => {
|
||||
const value = inst[$ipInstance.inPins[1].name] + ' MHz';
|
||||
return value;
|
||||
}
|
||||
},
|
||||
{
|
||||
name: $ipInstance.outPins[0].name,
|
||||
default: 0,
|
||||
getValue: (inst) => {
|
||||
const value1 = inst[$ipInstance.inPins[0].name];
|
||||
const value2 = inst[$ipInstance.inPins[1].name];
|
||||
return value1 + value2;
|
||||
},
|
||||
}
|
||||
]
|
||||
};
|
||||
@@ -0,0 +1,223 @@
|
||||
let Common = system.getScript("/driverlib/Common.js");
|
||||
let clocktree_common = system.getScript("/driverlib/clocktree/clocktree_common.js");
|
||||
const multi_core = clocktree_common.multi_core;
|
||||
if (("system" === system.context || "CPU1" === system.context) && system.deviceData.clockTree)
|
||||
{
|
||||
|
||||
let Support = system.getScript("./support.js");
|
||||
|
||||
const typeMap = {
|
||||
Oscillator: "/driverlib/clocktree/oscillators.js",
|
||||
PinFunction: "/driverlib/clocktree/pinFunction.js",
|
||||
Mux: "/driverlib/clocktree/mux.js",
|
||||
Divider: "/driverlib/clocktree/divider.js",
|
||||
Multiplier: "/driverlib/clocktree/multiplier.js",
|
||||
Adder: "/driverlib/clocktree/adder.js",
|
||||
Gate: "/driverlib/clocktree/unknown.js",
|
||||
NamedConnection: "/driverlib/clocktree/namedConnection.js",
|
||||
unknown: "/driverlib/clocktree/unknown.js",
|
||||
};
|
||||
|
||||
let FreqLabels = _.chain(system.deviceData.clockTree.connectivity).filter((c)=>!_.isEmpty(c.displayName)).map((c)=>c.name).value()
|
||||
|
||||
let namedConnection = _.chain(system.deviceData.clockTree.ipInstances).filter((c) => (c.shape === "NamedConnection")).map((c)=>c.name).value()
|
||||
|
||||
let InputClock = _.chain(system.deviceData.clockTree.ipInstances).filter((c) => (c.displayName === "OSCCLK")).map((c)=>c.name).value()
|
||||
|
||||
FreqLabels = FreqLabels.concat(namedConnection)
|
||||
|
||||
function defaultView(ipInstance) {
|
||||
return {
|
||||
displayName: (ipInstance.description ?? ipInstance.name).replace(/domain/ig,''),
|
||||
ipInstances: [ipInstance.name],
|
||||
algorithm: "fanIn",//"fanInAndOut",
|
||||
frequencyLabels: FreqLabels,
|
||||
}
|
||||
}
|
||||
|
||||
let All_Instances = _.map(system.deviceData.clockTree.ipInstances, (i) => i.name)
|
||||
|
||||
|
||||
let SYSCLK_Entries = [
|
||||
"SYSCLK"
|
||||
]
|
||||
|
||||
let CPUCLK_Entries = ["PLLSYSCLK", "CPU", "CPUCLK", "SYSCLK", "CPUCLK_domain"]
|
||||
|
||||
var device = system.deviceData.device
|
||||
|
||||
var brokenConnection1
|
||||
|
||||
switch(device)
|
||||
{
|
||||
case 'F2837xD':
|
||||
brokenConnection1 = Support.F2837xD_bc
|
||||
break
|
||||
|
||||
case 'F2837xS':
|
||||
case 'F2807x':
|
||||
brokenConnection1 = Support.F2837xS_F2807x_bc
|
||||
break
|
||||
|
||||
case 'F2838x':
|
||||
brokenConnection1 = Support.F2838x_bc
|
||||
break
|
||||
|
||||
case 'F28004x':
|
||||
case 'F28002x':
|
||||
case 'F280013x':
|
||||
brokenConnection1 = Support.F28004x_F280013x_bc
|
||||
break
|
||||
|
||||
case 'F28003x':
|
||||
brokenConnection1 = Support.F28003x_bc
|
||||
break
|
||||
|
||||
case 'F280015x':
|
||||
brokenConnection1 = Support.F280015x_bc
|
||||
break
|
||||
}
|
||||
|
||||
if(multi_core.includes(device))
|
||||
{
|
||||
var myipInstance1 = ["CPU1CLK_domain", "CPU2CLK_domain", "CPU1_SYSCLK_domain", "CPU2_SYSCLK_domain"]
|
||||
var myipInstance2 = ["CPU1_SYSCLK", "CPU2_SYSCLK"]
|
||||
}
|
||||
else
|
||||
{
|
||||
var myipInstance1 = ["CPUCLK", "SYSCLK"]
|
||||
var myipInstance2 = ["SYSCLK"]
|
||||
}
|
||||
|
||||
|
||||
All_Instances = All_Instances.concat(FreqLabels)
|
||||
|
||||
//Beta version: reasonableLayout is not used in beta version of clocktree tool
|
||||
//Purpose: Used for customized Layout.
|
||||
const reasonableLayout = {
|
||||
"INTOSC1" : { layer: 0, position: 1 },
|
||||
"INTOSC2" : { layer: 0, position: 2 },
|
||||
"XTAL" : { layer: 0, position: 3 },
|
||||
"OSCCLKSRCSEL" : { layer: 1, position: 0 },
|
||||
"PLL_IMULT" : { layer: 4, position: 1 },
|
||||
"PLL_FMULT" : { layer: 4, position: 2 },
|
||||
"PLL_ADD" : { layer: 5, position: 2 },
|
||||
"PLL_ODIV" : { layer: 6, position: 2 },
|
||||
"PLL_Group" : { layer: 3, position: 3 },
|
||||
};
|
||||
|
||||
|
||||
|
||||
var tree = [
|
||||
{
|
||||
displayName: "Complete ClockTree",
|
||||
entries: [
|
||||
{
|
||||
displayName: "ClockTree",
|
||||
ipInstances: All_Instances,
|
||||
frequencyLabels: FreqLabels,
|
||||
brokenConnections: brokenConnection1,
|
||||
},
|
||||
],
|
||||
},
|
||||
]
|
||||
// checking the deviceData to see if the device has AUXPLL
|
||||
var AUXPLLDevice = (system.deviceData.clockTree.ipInstances).filter(function(ipInst) {
|
||||
return ipInst.name === "AUXCLKDIVSEL";
|
||||
});
|
||||
if(( AUXPLLDevice.length > 0)& (multi_core.includes(device))){
|
||||
tree = tree.concat ([
|
||||
{
|
||||
displayName: "PLLs",
|
||||
entries: [
|
||||
{
|
||||
displayName: "System PLL",
|
||||
ipInstances: ["CPU1_SYSCLK", "CPU2_SYSCLK"],
|
||||
frequencyLabels: FreqLabels,
|
||||
algorithm: "fanIn"
|
||||
},
|
||||
{
|
||||
displayName: "Auxillary PLL",
|
||||
ipInstances: ["AUXPLLCLK"],
|
||||
frequencyLabels: FreqLabels,
|
||||
algorithm: "fanIn"
|
||||
},
|
||||
],
|
||||
}
|
||||
])
|
||||
}
|
||||
else if (( AUXPLLDevice.length > 0)& (!(multi_core.includes(device)))) {
|
||||
tree = tree.concat ([
|
||||
{
|
||||
displayName: "PLLs",
|
||||
entries: [
|
||||
{
|
||||
displayName: "System PLL",
|
||||
ipInstances: ["SYSCLK"],
|
||||
frequencyLabels: FreqLabels,
|
||||
algorithm: "fanIn"
|
||||
},
|
||||
{
|
||||
displayName: "Auxillary PLL",
|
||||
ipInstances: ["AUXPLLCLK"],
|
||||
frequencyLabels: FreqLabels,
|
||||
algorithm: "fanIn"
|
||||
},
|
||||
],
|
||||
}
|
||||
])
|
||||
}
|
||||
|
||||
tree = tree.concat ([
|
||||
{
|
||||
displayName: "Clock domain view",
|
||||
entries: _.chain(system.deviceData.clockTree.ipInstances)
|
||||
.filter((ipInstance) => _.endsWith(ipInstance.name, "domain"))
|
||||
.map(defaultView)
|
||||
.value(),
|
||||
}
|
||||
]);
|
||||
|
||||
const views = [
|
||||
{
|
||||
name: "/driverlib/clocktree/summaryView.xdt",
|
||||
displayName: "Clock Tree Summary",
|
||||
viewType: "markdown"
|
||||
}
|
||||
];
|
||||
|
||||
exports = {
|
||||
// topModules: [{
|
||||
// displayName: "Modules",
|
||||
// modules: ["/modules/basic.js"],
|
||||
// }],
|
||||
displayName: "ClockTree Tool",
|
||||
clockTree: {
|
||||
typeMap,
|
||||
tree,
|
||||
},
|
||||
views,
|
||||
templates: [
|
||||
{
|
||||
name: "/driverlib/clocktree/clocktree.h.xdt",
|
||||
outputPath: "clocktree.h",
|
||||
alwaysRun: true,
|
||||
ignoreErrors: false
|
||||
},
|
||||
]
|
||||
};
|
||||
}
|
||||
else if ("CPU2" === system.context) //"CPU2" === system.context
|
||||
{
|
||||
exports = {
|
||||
displayName: "ClockTree Tool",
|
||||
templates: [
|
||||
{
|
||||
name: "/driverlib/clocktree/clocktree_cpu2.h.xdt",
|
||||
outputPath: "clocktree.h",
|
||||
alwaysRun: true,
|
||||
ignoreErrors: false
|
||||
},
|
||||
]
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
%%{
|
||||
let clocktree_common = system.getScript("/driverlib/.meta/clocktree/clocktree_common.js");
|
||||
|
||||
var DualCore = clocktree_common.DualCore;
|
||||
var SingleCore = clocktree_common.SingleCore;
|
||||
|
||||
const multi_core = clocktree_common.multi_core;
|
||||
const PLL_type1 = clocktree_common.PLL_type1;
|
||||
const PLL_type2 = clocktree_common.PLL_type2;
|
||||
|
||||
const device = clocktree_common.device;
|
||||
|
||||
%%}
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: clockTree.h
|
||||
//
|
||||
// TITLE: Setups device clocking for examples.
|
||||
//
|
||||
//#############################################################################
|
||||
// $Copyright:
|
||||
// Copyright (C) `new Date().getFullYear()` 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.
|
||||
// $
|
||||
//###########################################################################
|
||||
|
||||
#ifndef CLOCKTREE_H
|
||||
#define CLOCKTREE_H
|
||||
%
|
||||
% if(multi_core.includes(device))
|
||||
%{
|
||||
`DualCore()`
|
||||
%}
|
||||
%
|
||||
%
|
||||
% if(!multi_core.includes(device) && (PLL_type1.includes(device) || PLL_type2.includes(device)))
|
||||
%{
|
||||
`SingleCore()`
|
||||
%}
|
||||
#endif // CLOCKTREE_H
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
var DualCore = system.getTemplate('dualCore/dualCore.xdt');
|
||||
var DualCore_CPU2 = system.getTemplate('dualCore/dualCore_CPU2.xdt');
|
||||
var SingleCore = system.getTemplate('singleCore/singleCore.xdt');
|
||||
|
||||
const multi_core = ["F2837xD", "F2838x", "F28P65x"]
|
||||
const xtal_x1_macro = ["F2837xS", "F2837xD", "F2807x"] //In Soprano, we do not differentiate between XTAL and X1 macro
|
||||
|
||||
const PLL_type1 = ["F2837xS", "F2837xD", "F2807x", "F28004x"] //FMULT available | REFDIV unavailable
|
||||
const PLL_type2 = ["F2838x", "F28002x", "F28003x", "F280013x", "F280015x", "F28P65x", "F28P55x"] //FMULT unavailable | REFDIV available
|
||||
|
||||
const AUXPLL_Support = ["F2837xS", "F2807x", "F2837xD", "F2838x", "F28P65x"]
|
||||
const EPWM_div_support = ["F2837xS", "F2837xD", "F2807x", "F28P65x"] //ePWM clock divider support
|
||||
|
||||
const device = system.deviceData.device
|
||||
var XTAL_OR_X1 = system.clockTree.XTAL_OR_X1
|
||||
|
||||
exports = {
|
||||
DualCore : DualCore,
|
||||
DualCore_CPU2 : DualCore_CPU2,
|
||||
SingleCore : SingleCore,
|
||||
multi_core : multi_core,
|
||||
xtal_x1_macro : xtal_x1_macro,
|
||||
PLL_type1 : PLL_type1,
|
||||
PLL_type2 : PLL_type2,
|
||||
device : device,
|
||||
AUXPLL_Support : AUXPLL_Support,
|
||||
EPWM_div_support : EPWM_div_support,
|
||||
XTAL_OR_X1 : XTAL_OR_X1
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
%%{
|
||||
let clocktree_common = system.getScript("/driverlib/.meta/clocktree/clocktree_common.js");
|
||||
let Common = system.getScript("/driverlib/Common.js");
|
||||
var clockTree_CPU2 = Common.getClockTree();
|
||||
var DualCore_CPU2 = clocktree_common.DualCore_CPU2;
|
||||
|
||||
const multi_core = clocktree_common.multi_core;
|
||||
const PLL_type1 = clocktree_common.PLL_type1;
|
||||
const PLL_type2 = clocktree_common.PLL_type2;
|
||||
const device = clocktree_common.device;
|
||||
if (clockTree_CPU2!=null){ // If we can't get clock tree, CPU1 context is probably not open
|
||||
|
||||
%%}
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: clockTree.h
|
||||
//
|
||||
// TITLE: Setups device clocking for examples.
|
||||
//
|
||||
//#############################################################################
|
||||
// $Copyright:
|
||||
// Copyright (C) `new Date().getFullYear()` 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.
|
||||
// $
|
||||
//###########################################################################
|
||||
|
||||
#ifndef CLOCKTREE_H
|
||||
#define CLOCKTREE_H
|
||||
%
|
||||
% if(multi_core.includes(device))
|
||||
%{
|
||||
`DualCore_CPU2()`
|
||||
%}
|
||||
%
|
||||
%
|
||||
#endif // CLOCKTREE_H
|
||||
%} else {
|
||||
#ifndef CLOCKTREE_H
|
||||
#define CLOCKTREE_H
|
||||
|
||||
//
|
||||
// CANNOT ACCESS CLOCKTREE. PLEASE MAKE SURE TO OPEN BOTH CPU1 AND CPU2 in SYSCONFIG.
|
||||
//
|
||||
|
||||
#endif // CLOCKTREE_H
|
||||
%}
|
||||
@@ -0,0 +1,25 @@
|
||||
exports = {
|
||||
displayName: "Default Clock Value",
|
||||
moduleStatic: {
|
||||
config: [{
|
||||
name: "valueType",
|
||||
default: "arrayRange",
|
||||
options: [{ name: "singleValue" }, { name: "arraySame" }, { name: "arrayRange" }]
|
||||
}]
|
||||
},
|
||||
getDefaultValue: (inst) => {
|
||||
const valueType = system.modules["/clockTree/defaultValue.js"]?.$static.valueType ?? "arrayRange";
|
||||
if (inst.disable) {
|
||||
return valueType === "singleValue" ? 0 : [0, 0];
|
||||
}
|
||||
const name = inst.$name;
|
||||
switch (valueType) {
|
||||
case "singleValue":
|
||||
return _.size(name);
|
||||
case "arraySame":
|
||||
return [_.size(name), _.size(name)];
|
||||
case "arrayRange":
|
||||
return [_.size(name), _.size(name) + 1];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
|
||||
|
||||
var device_info =
|
||||
[
|
||||
{device: "F280049", addInstance: ["PLL_FMULT","PLL_ADD"]},
|
||||
{device: "F2837xD", addInstance: ["PLL_FMULT","PLL_ADD"]},
|
||||
|
||||
|
||||
|
||||
|
||||
let FreqLabels = ["OSCCLK","VCOCLK", "PLLRAWCLK", "PLLSYSCLK", "CPUCLK", "SYSCLK", "LSPCLK", "CANBITCLK"]
|
||||
|
||||
let All_Instance_Entries = [
|
||||
"INTOSC1","INTOSC2","XTAL","X1","XTAL_OR_X1","OSCCLKSRCSEL","Watchdog_domain",
|
||||
"PLL_IMULT","PLL_FMULT","PLL_ADD","PLL_ODIV","SYSPLLCTL1","SYSCLKDIVSEL",
|
||||
"CPU","NMIWD_domain","LOSPCP","CLKSRCCTL2", "CAN_CLOCK_domain", "PERx_SYSCLK_GATE",
|
||||
"PERx_SYSCLK_domain","CPUCLK_domain","PERx_LSPCLK_GATE","LSPCLK_domain",
|
||||
"SYSCLK_domain"
|
||||
]
|
||||
|
||||
let OSCCLK_Entries = [
|
||||
"INTOSC1","INTOSC2","XTAL","X1","XTAL_OR_X1","OSCCLKSRCSEL", "OSCCLK"
|
||||
]
|
||||
|
||||
let PLL_Entries = [
|
||||
"OSCCLK", "PLL_IMULT","PLL_FMULT","PLL_ADD","PLL_ODIV", "VCOCLK", "PLLRAWCLK"
|
||||
]
|
||||
|
||||
let PLLSYSCLK_Entries = ["OSCCLK", "PLLRAWCLK", "SYSPLLCTL1","SYSCLKDIVSEL", "NMIWD_domain", "PLLSYSCLK"]
|
||||
|
||||
let CPUCLK_Entries = ["PLLSYSCLK", "CPU", "CPUCLK", "CPUCLK_domain"]
|
||||
|
||||
let SYSCLK_Entries = ["XTAL","X1","XTAL_OR_X1", "PLLSYSCLK", "CPU", "SYSCLK", "CLKSRCCTL2", "CAN_CLOCK_domain", "PERx_SYSCLK_GATE",
|
||||
"PERx_SYSCLK_domain","PERx_LSPCLK_GATE","LSPCLK_domain","SYSCLK_domain", "CANBITCLK", "LOSPCP", "LSPCLK"]
|
||||
|
||||
|
||||
All_Instance_Entries = All_Instance_Entries.concat(FreqLabels)
|
||||
@@ -0,0 +1,37 @@
|
||||
exports = {
|
||||
displayName: "Divider",
|
||||
config: [],
|
||||
extendConfig: ({ $ipInstance }) => [
|
||||
{
|
||||
name: "Description",
|
||||
displayName: "Description",
|
||||
default: $ipInstance.description,
|
||||
readOnly: true
|
||||
},
|
||||
{
|
||||
name: "InputValue",
|
||||
displayName: "Input Clock",
|
||||
default: '',
|
||||
getValue: (inst) => {
|
||||
const value = inst[$ipInstance.inPins[0].name] + ' MHz';
|
||||
return value;
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "divideValue",
|
||||
displayName: "Divide Value",
|
||||
default: $ipInstance.resetValue,
|
||||
options: _.map($ipInstance.divideValues, (v) => ({ name: v, displayName: `/ ${v}` })),
|
||||
},
|
||||
{
|
||||
name: $ipInstance.outPins[0].name,
|
||||
default: [0, 0],
|
||||
getValue: (inst) => {
|
||||
const value = inst[$ipInstance.inPins[0].name];
|
||||
if (_.isArray(value)) {
|
||||
return _.map(value, (v) => v / inst.divideValue);
|
||||
}
|
||||
return value / inst.divideValue;
|
||||
},
|
||||
}]
|
||||
};
|
||||
@@ -0,0 +1,23 @@
|
||||
%%{
|
||||
let clocktree_common = system.getScript("../clocktree_common.js");
|
||||
var DualCore_SYSPLL = system.getTemplate('./dualCore_SYSPLL.xdt');
|
||||
var DualCore_AUXPLL = system.getTemplate('./dualCore_AUXPLL.xdt');
|
||||
var DualCore_domain = system.getTemplate('./dualCore_domain.xdt');
|
||||
|
||||
const PLL_type1 = clocktree_common.PLL_type1;
|
||||
const PLL_type2 = clocktree_common.PLL_type2;
|
||||
|
||||
const AUXPLL_Support = clocktree_common.AUXPLL_Support;
|
||||
const EPWM_div_support = clocktree_common.EPWM_div_support;
|
||||
|
||||
const device = clocktree_common.device
|
||||
|
||||
%%}
|
||||
`DualCore_SYSPLL()`
|
||||
|
||||
% if(AUXPLL_Support.includes(device))
|
||||
% {
|
||||
`DualCore_AUXPLL()`
|
||||
% }
|
||||
|
||||
`DualCore_domain()`
|
||||
@@ -0,0 +1,186 @@
|
||||
%%{
|
||||
let clocktree_common = system.getScript("../clocktree_common.js");
|
||||
|
||||
const PLL_type1 = clocktree_common.PLL_type1;
|
||||
const PLL_type2 = clocktree_common.PLL_type2;
|
||||
const xtal_x1_macro = clocktree_common.xtal_x1_macro;
|
||||
|
||||
const device = clocktree_common.device
|
||||
var XTAL_OR_X1 = clocktree_common.XTAL_OR_X1;
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
// Frequency lables
|
||||
//////////////////////////////////////////////////
|
||||
const AUXOSCCLK_d = system.clockTree.AUXOSCCLK.in
|
||||
const AUXPLLRAWCLK_d = system.clockTree.AUXPLLRAWCLK.in
|
||||
const AUXPLLCLK_d = system.clockTree.AUXPLLCLK.in
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
// AUXOSCCLK source
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
var AUXOSCCLKSRCSEL = system.clockTree.AUXOSCCLKSRCSEL
|
||||
|
||||
var auxoscclkSrc = "SYSCTL_OSCSRC_OSC2"
|
||||
var auxoscclksource
|
||||
var auxoscclk = 10
|
||||
|
||||
//
|
||||
// XTAL Single-Ended replaces X1 for F2838x, F28002x, F28003x, F28004x, F280013x, F280015x, F28P65x
|
||||
//
|
||||
switch(AUXOSCCLKSRCSEL.inputSelect){
|
||||
case "AUXCLK":
|
||||
auxoscclkSrc = "SYSCTL_AUXPLL_OSCSRC_AUXCLKIN"
|
||||
auxoscclksource = AUXOSCCLKSRCSEL.inputSelect
|
||||
auxoscclk = 10
|
||||
break
|
||||
case "INTOSC2":
|
||||
auxoscclkSrc = "SYSCTL_AUXPLL_OSCSRC_OSC2"
|
||||
auxoscclksource = AUXOSCCLKSRCSEL.inputSelect
|
||||
auxoscclk = 10
|
||||
break
|
||||
case "X1_XTAL":
|
||||
if((XTAL_OR_X1.inputSelect == "XTAL") || xtal_x1_macro.includes(device))
|
||||
{
|
||||
auxoscclkSrc = "SYSCTL_AUXPLL_OSCSRC_XTAL"
|
||||
}
|
||||
else
|
||||
{
|
||||
auxoscclkSrc = "SYSCTL_AUXPLL_OSCSRC_XTAL_SE"
|
||||
}
|
||||
auxoscclksource = system.clockTree.XTAL_OR_X1.inputSelect
|
||||
auxoscclk = system.clockTree.XTAL_OR_X1.External_Clock
|
||||
break
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
// IMULT, FMULT (AUXRAWCLK) source
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
|
||||
var AUX_PLLEN = system.clockTree.AUX_PLLEN
|
||||
var AUX_IMULT_mv = system.clockTree.AUX_IMULT.multiplyValue
|
||||
var AUX_IMULT = "SYSCTL_AUXPLL_IMULT(" + AUX_IMULT_mv + ")"
|
||||
|
||||
var AUXCLKDIVSEL_dv = system.clockTree.AUXCLKDIVSEL.divideValue
|
||||
|
||||
var AUX_DIVSEL = "SYSCTL_AUXPLL_DIV_" + AUXCLKDIVSEL_dv
|
||||
|
||||
|
||||
var AUX_FMULT
|
||||
if(PLL_type1.includes(device))
|
||||
{
|
||||
var AUX_FMULT_mv = system.clockTree.AUX_FMULT.multiplyValue
|
||||
switch(system.clockTree.AUX_FMULT.multiplyValue){
|
||||
case 0:
|
||||
AUX_FMULT = "SYSCTL_AUXPLL_FMULT_NONE"
|
||||
break
|
||||
case 0.25:
|
||||
AUX_FMULT = "SYSCTL_AUXPLL_FMULT_1_4"
|
||||
break
|
||||
case 0.5:
|
||||
AUX_FMULT = "SYSCTL_AUXPLL_FMULT_1_2"
|
||||
break
|
||||
case 0.75:
|
||||
AUX_FMULT = "SYSCTL_AUXPLL_FMULT_3_4"
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if(PLL_type2.includes(device))
|
||||
{
|
||||
var AUX_REFDIV_dv = system.clockTree.AUX_REFDIV.divideValue
|
||||
var AUX_REFDIV = "SYSCTL_REFDIV(" + AUX_REFDIV_dv + ")"
|
||||
|
||||
var AUX_ODIV_dv = system.clockTree.AUX_ODIV.divideValue
|
||||
var AUX_ODIV = "SYSCTL_ODIV(" + AUX_ODIV_dv + ")"
|
||||
|
||||
var AUXCLKDIVSEL_dv = system.clockTree.AUXCLKDIVSEL.divideValue
|
||||
}
|
||||
|
||||
var AUXPLL_STS = 'SYSCTL_AUXPLL_ENABLE'
|
||||
var AUXPLL_Status = 'DISABLED'
|
||||
|
||||
if(AUX_PLLEN.inputSelect == 'AUXOSCCLK')
|
||||
{
|
||||
AUXPLL_STS = 'SYSCTL_AUXPLL_DISABLE'
|
||||
AUXPLL_Status = 'DISABLED'
|
||||
}
|
||||
else
|
||||
{
|
||||
AUXPLL_STS = 'SYSCTL_AUXPLL_ENABLE'
|
||||
AUXPLL_Status = 'ENABLED'
|
||||
}
|
||||
|
||||
%%}
|
||||
%
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Summary of AUXPLL related clock configuration
|
||||
//
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Input Clock to AUXOSCCLK = `AUXOSCCLK_d` MHz (`auxoscclksource` provides AUXOSCCLK)
|
||||
//
|
||||
//##### AUXPLL `AUXPLL_Status` #####
|
||||
//
|
||||
// AUXPLLRAWCLK = `AUXPLLRAWCLK_d` MHz (Output of AUXPLL if enabled)
|
||||
// AUXPLLCLK = `AUXPLLCLK_d` MHz
|
||||
//
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Macro definitions used in device.c (AUXPLL)
|
||||
//
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Input Clock to AUXPLL (AUXOSCCLK) = `auxoscclksource` = `AUXOSCCLK_d` MHz
|
||||
//
|
||||
#define DEVICE_AUXOSCSRC_FREQ `AUXOSCCLK_d`000000U
|
||||
%
|
||||
% if(PLL_type1.includes(device))
|
||||
% {
|
||||
//
|
||||
// Define to pass to SysCtl_setAuxClock(). Will configure the clock as follows:
|
||||
%if(AUXPLL_STS == 'SYSCTL_AUXPLL_ENABLE')
|
||||
% {
|
||||
// AUXPLL ENABLED
|
||||
// AUXPLLCLK = `AUXPLLCLK_d` MHz = `AUXOSCCLK_d` MHz (AUXOSCCLK) * (`AUX_IMULT_mv` (AUX_IMULT) + `AUX_FMULT_mv` (AUX_FMULT)) / `AUXCLKDIVSEL_dv` (AUXCLKDIVSEL)
|
||||
#define DEVICE_AUXCLK_FREQ ((DEVICE_AUXOSCSRC_FREQ * (`AUX_IMULT_mv` + `AUX_FMULT_mv`)) / `AUXCLKDIVSEL_dv`)
|
||||
% }
|
||||
%else
|
||||
% {
|
||||
// AUXPLL DISABLED
|
||||
// AUXPLLCLK = `AUXPLLCLK_d` MHz = `AUXOSCCLK_d` MHz (`auxoscclksource`) / `AUXCLKDIVSEL_dv` (AUXCLKDIVSEL)
|
||||
#define DEVICE_AUXCLK_FREQ (DEVICE_AUXOSCSRC_FREQ / `AUXCLKDIVSEL_dv`)
|
||||
% }
|
||||
//
|
||||
#define DEVICE_SETAUXCLOCK_CFG (`auxoscclkSrc` | `AUX_IMULT` | \
|
||||
`AUX_FMULT` | SYSCTL_AUXPLL_DIV_`AUXCLKDIVSEL_dv` | \
|
||||
`AUXPLL_STS`)
|
||||
% }
|
||||
%
|
||||
% if(PLL_type2.includes(device))
|
||||
% {
|
||||
//
|
||||
// Define to pass to SysCtl_setAuxClock(). Will configure the clock as follows:
|
||||
%if(AUXPLL_STS == 'SYSCTL_AUXPLL_ENABLE')
|
||||
% {
|
||||
// AUXPLL ENABLED
|
||||
// AUXPLLCLK = `AUXPLLCLK_d` MHz = `AUXOSCCLK_d` MHz (AUXOSCCLK) * `AUX_IMULT_mv` (IMULT) / (`AUX_REFDIV_dv` (REFDIV) * `AUX_ODIV_dv` (ODIV) * `AUXCLKDIVSEL_dv` (AUXCLKDIVSEL))
|
||||
#define DEVICE_AUXCLK_FREQ (DEVICE_AUXOSCSRC_FREQ * `AUX_IMULT_mv`) / (`AUX_REFDIV_dv` * `AUX_ODIV_dv` * `AUXCLKDIVSEL_dv`)
|
||||
% }
|
||||
%else
|
||||
% {
|
||||
// AUXPLL DISABLED
|
||||
// AUXPLLCLK = `AUXPLLCLK_d` MHz = (`AUXOSCCLK_d`) / `AUXCLKDIVSEL_dv` (AUXCLKDIVSEL)
|
||||
#define DEVICE_AUXCLK_FREQ (DEVICE_AUXOSCSRC_FREQ / `AUXCLKDIVSEL_dv`)
|
||||
% }
|
||||
//
|
||||
#define DEVICE_AUXSETCLOCK_CFG (`auxoscclkSrc` | `AUX_IMULT` | \
|
||||
`AUX_REFDIV` | `AUX_ODIV`| \
|
||||
`AUX_DIVSEL` | `AUXPLL_STS` | \
|
||||
SYSCTL_DCC_BASE_0)
|
||||
|
||||
|
||||
% }
|
||||
% /////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -0,0 +1,24 @@
|
||||
%%{
|
||||
let clocktree_common = system.getScript("../clocktree_common.js");
|
||||
|
||||
var DualCore_CPU2_SYSPLL = system.getTemplate('./dualCore_CPU2_SYSPLL.xdt');
|
||||
var DualCore_CPU2_AUXPLL = system.getTemplate('./dualCore_CPU2_AUXPLL.xdt');
|
||||
var DualCore_CPU2_domain = system.getTemplate('./dualCore_CPU2_domain.xdt');
|
||||
|
||||
const PLL_type1 = clocktree_common.PLL_type1;
|
||||
const PLL_type2 = clocktree_common.PLL_type2;
|
||||
|
||||
const AUXPLL_Support = clocktree_common.AUXPLL_Support;
|
||||
const EPWM_div_support = clocktree_common.EPWM_div_support;
|
||||
|
||||
const device = clocktree_common.device
|
||||
|
||||
%%}
|
||||
`DualCore_CPU2_SYSPLL()`
|
||||
|
||||
% if(AUXPLL_Support.includes(device))
|
||||
% {
|
||||
`DualCore_CPU2_AUXPLL()`
|
||||
% }
|
||||
|
||||
`DualCore_CPU2_domain()`
|
||||
@@ -0,0 +1,188 @@
|
||||
%%{
|
||||
let clocktree_common = system.getScript("../clocktree_common.js");
|
||||
let Common = system.getScript("/driverlib/Common.js");
|
||||
var clockTree_CPU2 = Common.getClockTree();
|
||||
|
||||
const PLL_type1 = clocktree_common.PLL_type1;
|
||||
const PLL_type2 = clocktree_common.PLL_type2;
|
||||
const xtal_x1_macro = clocktree_common.xtal_x1_macro;
|
||||
|
||||
const device = clocktree_common.device
|
||||
var XTAL_OR_X1 = clockTree_CPU2.XTAL_OR_X1;
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
// Frequency lables
|
||||
//////////////////////////////////////////////////
|
||||
const AUXOSCCLK_d = clockTree_CPU2.AUXOSCCLK.in
|
||||
const AUXPLLRAWCLK_d = clockTree_CPU2.AUXPLLRAWCLK.in
|
||||
const AUXPLLCLK_d = clockTree_CPU2.AUXPLLCLK.in
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
// AUXOSCCLK source
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
var AUXOSCCLKSRCSEL = clockTree_CPU2.AUXOSCCLKSRCSEL
|
||||
|
||||
var auxoscclkSrc = "SYSCTL_OSCSRC_OSC2"
|
||||
var auxoscclksource
|
||||
var auxoscclk = 10
|
||||
|
||||
//
|
||||
// XTAL Single-Ended replaces X1 for F2838x, F28002x, F28003x, F28004x, F280013x, F280015x, F28P65x
|
||||
//
|
||||
switch(AUXOSCCLKSRCSEL.inputSelect){
|
||||
case "AUXCLK":
|
||||
auxoscclkSrc = "SYSCTL_AUXPLL_OSCSRC_AUXCLKIN"
|
||||
auxoscclksource = AUXOSCCLKSRCSEL.inputSelect
|
||||
auxoscclk = 10
|
||||
break
|
||||
case "INTOSC2":
|
||||
auxoscclkSrc = "SYSCTL_AUXPLL_OSCSRC_OSC2"
|
||||
auxoscclksource = AUXOSCCLKSRCSEL.inputSelect
|
||||
auxoscclk = 10
|
||||
break
|
||||
case "X1_XTAL":
|
||||
if((XTAL_OR_X1.inputSelect == "XTAL") || xtal_x1_macro.includes(device))
|
||||
{
|
||||
auxoscclkSrc = "SYSCTL_AUXPLL_OSCSRC_XTAL"
|
||||
}
|
||||
else
|
||||
{
|
||||
auxoscclkSrc = "SYSCTL_AUXPLL_OSCSRC_XTAL_SE"
|
||||
}
|
||||
auxoscclksource = clockTree_CPU2.XTAL_OR_X1.inputSelect
|
||||
auxoscclk = clockTree_CPU2.XTAL_OR_X1.External_Clock
|
||||
break
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
// IMULT, FMULT (AUXRAWCLK) source
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
|
||||
var AUX_PLLEN = clockTree_CPU2.AUX_PLLEN
|
||||
var AUX_IMULT_mv = clockTree_CPU2.AUX_IMULT.multiplyValue
|
||||
var AUX_IMULT = "SYSCTL_AUXPLL_IMULT(" + AUX_IMULT_mv + ")"
|
||||
|
||||
var AUXCLKDIVSEL_dv = clockTree_CPU2.AUXCLKDIVSEL.divideValue
|
||||
|
||||
var AUX_DIVSEL = "SYSCTL_AUXPLL_DIV_" + AUXCLKDIVSEL_dv
|
||||
|
||||
|
||||
var AUX_FMULT
|
||||
if(PLL_type1.includes(device))
|
||||
{
|
||||
var AUX_FMULT_mv = clockTree_CPU2.AUX_FMULT.multiplyValue
|
||||
switch(clockTree_CPU2.AUX_FMULT.multiplyValue){
|
||||
case 0:
|
||||
AUX_FMULT = "SYSCTL_AUXPLL_FMULT_NONE"
|
||||
break
|
||||
case 0.25:
|
||||
AUX_FMULT = "SYSCTL_AUXPLL_FMULT_1_4"
|
||||
break
|
||||
case 0.5:
|
||||
AUX_FMULT = "SYSCTL_AUXPLL_FMULT_1_2"
|
||||
break
|
||||
case 0.75:
|
||||
AUX_FMULT = "SYSCTL_AUXPLL_FMULT_3_4"
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if(PLL_type2.includes(device))
|
||||
{
|
||||
var AUX_REFDIV_dv = clockTree_CPU2.AUX_REFDIV.divideValue
|
||||
var AUX_REFDIV = "SYSCTL_REFDIV(" + AUX_REFDIV_dv + ")"
|
||||
|
||||
var AUX_ODIV_dv = clockTree_CPU2.AUX_ODIV.divideValue
|
||||
var AUX_ODIV = "SYSCTL_ODIV(" + AUX_ODIV_dv + ")"
|
||||
|
||||
var AUXCLKDIVSEL_dv = clockTree_CPU2.AUXCLKDIVSEL.divideValue
|
||||
}
|
||||
|
||||
var AUXPLL_STS = 'SYSCTL_AUXPLL_ENABLE'
|
||||
var AUXPLL_Status = 'DISABLED'
|
||||
|
||||
if(AUX_PLLEN.inputSelect == 'AUXOSCCLK')
|
||||
{
|
||||
AUXPLL_STS = 'SYSCTL_AUXPLL_DISABLE'
|
||||
AUXPLL_Status = 'DISABLED'
|
||||
}
|
||||
else
|
||||
{
|
||||
AUXPLL_STS = 'SYSCTL_AUXPLL_ENABLE'
|
||||
AUXPLL_Status = 'ENABLED'
|
||||
}
|
||||
|
||||
%%}
|
||||
%
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Summary of AUXPLL related clock configuration
|
||||
//
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Input Clock to AUXOSCCLK = `AUXOSCCLK_d` MHz (`auxoscclksource` provides AUXOSCCLK)
|
||||
//
|
||||
//##### AUXPLL `AUXPLL_Status` #####
|
||||
//
|
||||
// AUXPLLRAWCLK = `AUXPLLRAWCLK_d` MHz (Output of AUXPLL if enabled)
|
||||
// AUXPLLCLK = `AUXPLLCLK_d` MHz
|
||||
//
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Macro definitions used in device.c (AUXPLL)
|
||||
//
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Input Clock to AUXPLL (AUXOSCCLK) = `auxoscclksource` = `AUXOSCCLK_d` MHz
|
||||
//
|
||||
#define DEVICE_AUXOSCSRC_FREQ `AUXOSCCLK_d`000000U
|
||||
%
|
||||
% if(PLL_type1.includes(device))
|
||||
% {
|
||||
//
|
||||
// Define to pass to SysCtl_setAuxClock(). Will configure the clock as follows:
|
||||
%if(AUXPLL_STS == 'SYSCTL_AUXPLL_ENABLE')
|
||||
% {
|
||||
// AUXPLL ENABLED
|
||||
// AUXPLLCLK = `AUXPLLCLK_d` MHz = `AUXOSCCLK_d` MHz (AUXOSCCLK) * (`AUX_IMULT_mv` (AUX_IMULT) + `AUX_FMULT_mv` (AUX_FMULT)) / `AUXCLKDIVSEL_dv` (AUXCLKDIVSEL)
|
||||
#define DEVICE_AUXCLK_FREQ ((DEVICE_AUXOSCSRC_FREQ * (`AUX_IMULT_mv` + `AUX_FMULT_mv`)) / `AUXCLKDIVSEL_dv`)
|
||||
% }
|
||||
%else
|
||||
% {
|
||||
// AUXPLL DISABLED
|
||||
// AUXPLLCLK = `AUXPLLCLK_d` MHz = `AUXOSCCLK_d` MHz (`auxoscclksource`) / `AUXCLKDIVSEL_dv` (AUXCLKDIVSEL)
|
||||
#define DEVICE_AUXCLK_FREQ (DEVICE_AUXOSCSRC_FREQ / `AUXCLKDIVSEL_dv`)
|
||||
% }
|
||||
//
|
||||
#define DEVICE_SETAUXCLOCK_CFG (`auxoscclkSrc` | `AUX_IMULT` | \
|
||||
`AUX_FMULT` | SYSCTL_AUXPLL_DIV_`AUXCLKDIVSEL_dv` | \
|
||||
`AUXPLL_STS`)
|
||||
% }
|
||||
%
|
||||
% if(PLL_type2.includes(device))
|
||||
% {
|
||||
//
|
||||
// Define to pass to SysCtl_setAuxClock(). Will configure the clock as follows:
|
||||
%if(AUXPLL_STS == 'SYSCTL_AUXPLL_ENABLE')
|
||||
% {
|
||||
// AUXPLL ENABLED
|
||||
// AUXPLLCLK = `AUXPLLCLK_d` MHz = `AUXOSCCLK_d` MHz (AUXOSCCLK) * `AUX_IMULT_mv` (IMULT) / (`AUX_REFDIV_dv` (REFDIV) * `AUX_ODIV_dv` (ODIV) * `AUXCLKDIVSEL_dv` (AUXCLKDIVSEL))
|
||||
#define DEVICE_AUXCLK_FREQ (DEVICE_AUXOSCSRC_FREQ * `AUX_IMULT_mv`) / (`AUX_REFDIV_dv` * `AUX_ODIV_dv` * `AUXCLKDIVSEL_dv`)
|
||||
% }
|
||||
%else
|
||||
% {
|
||||
// AUXPLL DISABLED
|
||||
// AUXPLLCLK = `AUXPLLCLK_d` MHz = (`AUXOSCCLK_d`) / `AUXCLKDIVSEL_dv` (AUXCLKDIVSEL)
|
||||
#define DEVICE_AUXCLK_FREQ (DEVICE_AUXOSCSRC_FREQ / `AUXCLKDIVSEL_dv`)
|
||||
% }
|
||||
//
|
||||
#define DEVICE_AUXSETCLOCK_CFG (`auxoscclkSrc` | `AUX_IMULT` | \
|
||||
`AUX_REFDIV` | `AUX_ODIV`| \
|
||||
`AUX_DIVSEL` | `AUXPLL_STS` | \
|
||||
SYSCTL_DCC_BASE_0)
|
||||
|
||||
|
||||
% }
|
||||
% /////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -0,0 +1,217 @@
|
||||
%%{
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
let clocktree_common = system.getScript("../clocktree_common.js");
|
||||
let Common = system.getScript("/driverlib/Common.js");
|
||||
|
||||
const PLL_type1 = clocktree_common.PLL_type1;
|
||||
const PLL_type2 = clocktree_common.PLL_type2;
|
||||
|
||||
const device = clocktree_common.device
|
||||
var clockTree_CPU2 = Common.getClockTree();
|
||||
|
||||
const AUXPLL_Support = clocktree_common.AUXPLL_Support;
|
||||
const EPWM_div_support = clocktree_common.EPWM_div_support;
|
||||
const xtal_x1_macro = clocktree_common.xtal_x1_macro;
|
||||
var XTAL_OR_X1 = clockTree_CPU2.XTAL_OR_X1;
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
// Frequency lables
|
||||
//////////////////////////////////////////////////
|
||||
const OSCCLK_d = clockTree_CPU2.OSCCLK.in
|
||||
const PLLRAWCLK_d = clockTree_CPU2.PLLRAWCLK.in
|
||||
const PLLSYSCLK_d = clockTree_CPU2.PLLSYSCLK.in
|
||||
const CPU1_CPUCLK_d = clockTree_CPU2.CPU1_CPUCLK.in
|
||||
const CPU2_CPUCLK_d = clockTree_CPU2.CPU2_CPUCLK.in
|
||||
const CPU1_SYSCLK_d = clockTree_CPU2.CPU1_SYSCLK.in
|
||||
const CPU2_SYSCLK_d = clockTree_CPU2.CPU2_SYSCLK.in
|
||||
const LSPCLK_d = clockTree_CPU2.LSPCLK.in
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
// OSCCLK source
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
var OSCCLKSRCSEL = clockTree_CPU2.OSCCLKSRCSEL
|
||||
|
||||
var oscclkSrc = "SYSCTL_OSCSRC_OSC2"
|
||||
var oscclksource
|
||||
var oscclk = 10
|
||||
|
||||
//
|
||||
// XTAL Single-Ended replaces X1 for F2838x, F28002x, F28003x, F28004x, F280013x, F280015x, F28P65x
|
||||
//
|
||||
switch(OSCCLKSRCSEL.inputSelect){
|
||||
case "INTOSC1":
|
||||
oscclkSrc = "SYSCTL_OSCSRC_OSC1"
|
||||
oscclksource = OSCCLKSRCSEL.inputSelect
|
||||
oscclk = 10
|
||||
break
|
||||
case "INTOSC2":
|
||||
oscclkSrc = "SYSCTL_OSCSRC_OSC2"
|
||||
oscclksource = OSCCLKSRCSEL.inputSelect
|
||||
oscclk = 10
|
||||
break
|
||||
case "X1_XTAL":
|
||||
if((XTAL_OR_X1.inputSelect == "XTAL") || xtal_x1_macro.includes(device))
|
||||
{
|
||||
oscclkSrc = "SYSCTL_OSCSRC_XTAL"
|
||||
}
|
||||
else
|
||||
{
|
||||
oscclkSrc = "SYSCTL_OSCSRC_XTAL_SE"
|
||||
}
|
||||
oscclksource = XTAL_OR_X1.inputSelect
|
||||
oscclk = XTAL_OR_X1.External_Clock
|
||||
break
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
// IMULT, FMULT (PLLRAWCLK) source
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
var SYSPLLCTL1 = clockTree_CPU2.SYSPLLCTL1
|
||||
|
||||
var PLL_IMULT_mv = clockTree_CPU2.PLL_IMULT.multiplyValue
|
||||
var PLL_IMULT = "SYSCTL_IMULT(" + PLL_IMULT_mv + ")"
|
||||
|
||||
var SYSCLKDIVSEL_dv = clockTree_CPU2.SYSCLKDIVSEL.divideValue
|
||||
|
||||
var PLL_DIVSEL = "SYSCTL_SYSDIV(" + SYSCLKDIVSEL_dv + ")"
|
||||
|
||||
var PLL_FMULT
|
||||
if(PLL_type1.includes(device))
|
||||
{
|
||||
var PLL_FMULT_mv = clockTree_CPU2.PLL_FMULT.multiplyValue
|
||||
switch(PLL_FMULT_mv){
|
||||
case 0:
|
||||
PLL_FMULT = "SYSCTL_FMULT_NONE"
|
||||
break
|
||||
case 0.25:
|
||||
PLL_FMULT = "SYSCTL_FMULT_1_4"
|
||||
break
|
||||
case 0.5:
|
||||
PLL_FMULT = "SYSCTL_FMULT_1_2"
|
||||
break
|
||||
case 0.75:
|
||||
PLL_FMULT = "SYSCTL_FMULT_3_4"
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
var PLL_STS = 'SYSCTL_PLL_ENABLE'
|
||||
var SYSPLL_STS = 'DISABLED'
|
||||
|
||||
if(SYSPLLCTL1.inputSelect == 'OSCCLK')
|
||||
{
|
||||
PLL_STS = 'SYSCTL_PLL_DISABLE'
|
||||
SYSPLL_STS = 'DISABLED'
|
||||
}
|
||||
else
|
||||
{
|
||||
PLL_STS = 'SYSCTL_PLL_ENABLE'
|
||||
SYSPLL_STS = 'ENABLED'
|
||||
}
|
||||
|
||||
|
||||
if(PLL_type2.includes(device))
|
||||
{
|
||||
var PLL_REFDIV_dv = clockTree_CPU2.PLL_REFDIV.divideValue
|
||||
var PLL_REFDIV = "SYSCTL_REFDIV(" + PLL_REFDIV_dv + ")"
|
||||
|
||||
var PLL_ODIV_dv = clockTree_CPU2.PLL_ODIV.divideValue
|
||||
var PLL_ODIV = "SYSCTL_ODIV(" + PLL_ODIV_dv + ")"
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
%%}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Summary of SYSPLL related clock configuration
|
||||
//
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Input Clock to SYSPLL (OSCCLK) = `OSCCLK_d` MHz (`oscclksource` provides OSCCLK)
|
||||
//
|
||||
//##### SYSPLL `SYSPLL_STS` #####
|
||||
//
|
||||
// PLLRAWCLK = `PLLRAWCLK_d` MHz (Output of SYSPLL if enabled)
|
||||
// PLLSYSCLK = `PLLSYSCLK_d` MHz
|
||||
// CPU1CLK = `CPU1_CPUCLK_d` MHz
|
||||
// CPU2CLK = `CPU2_CPUCLK_d` MHz
|
||||
// CPU1_SYSCLK = `CPU1_SYSCLK_d` MHz
|
||||
// CPU2_SYSCLK = `CPU2_SYSCLK_d` MHz
|
||||
// LSPCLK = `LSPCLK_d` MHz
|
||||
%
|
||||
%if(EPWM_div_support.includes(device))
|
||||
%{
|
||||
% var EPWMCLK_d = clockTree_CPU2.PLLSYSCLK.in / clockTree_CPU2.EPWMCLKDIV.divideValue
|
||||
// EPWMCLK = `EPWMCLK_d` MHz
|
||||
%}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Macro definitions used in device.c (SYSPLL / LSPCLK)
|
||||
//
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Input Clock to SYSPLL (OSCCLK) = `oscclksource` = `OSCCLK_d` MHz
|
||||
//
|
||||
#define DEVICE_OSCSRC_FREQ `OSCCLK_d`000000U
|
||||
%
|
||||
% /////////////////////////////////////////////////////////////////////////////////////////
|
||||
%
|
||||
% if(PLL_type1.includes(device))
|
||||
% {
|
||||
//
|
||||
// Define to pass to SysCtl_setClock(). Will configure the clock as follows:
|
||||
%if(PLL_STS == 'SYSCTL_PLL_ENABLE')
|
||||
% {
|
||||
// SYSPLL ENABLED
|
||||
// SYSCLK = `PLLSYSCLK_d` MHz = `OSCCLK_d` MHz (OSCCLK) * (`PLL_IMULT_mv` (IMULT) + `PLL_FMULT_mv` (FMULT)) / `SYSCLKDIVSEL_dv` (SYSCLKDIVSEL)
|
||||
#define DEVICE_SYSCLK_FREQ ((DEVICE_OSCSRC_FREQ * (`PLL_IMULT_mv` + `PLL_FMULT_mv`)) / `SYSCLKDIVSEL_dv`)
|
||||
% }
|
||||
%else
|
||||
% {
|
||||
// SYSPLL DISABLED
|
||||
// SYSCLK = `OSCCLK_d` MHz(`oscclksource`) / `SYSCLKDIVSEL_dv` (SYSCLKDIVSEL) = `PLLSYSCLK_d` MHz
|
||||
#define DEVICE_SYSCLK_FREQ (DEVICE_OSCSRC_FREQ / `SYSCLKDIVSEL_dv`)
|
||||
% }
|
||||
//
|
||||
#define DEVICE_SETCLOCK_CFG (`oscclkSrc` | `PLL_IMULT` | \
|
||||
`PLL_FMULT` | `PLL_DIVSEL`| \
|
||||
`PLL_STS`)
|
||||
%}
|
||||
% /////////////////////////////////////////////////////////////////////////////////////////
|
||||
%
|
||||
% if(PLL_type2.includes(device))
|
||||
% {
|
||||
//
|
||||
// Define to pass to SysCtl_setClock(). Will configure the clock as follows:
|
||||
%if(PLL_STS == 'SYSCTL_PLL_ENABLE')
|
||||
% {
|
||||
// SYSPLL ENABLED
|
||||
// SYSCLK = `PLLSYSCLK_d` MHz = `OSCCLK_d` MHz (OSCCLK) * `PLL_IMULT_mv` (IMULT) / (`PLL_REFDIV_dv` (REFDIV) * `PLL_ODIV_dv` (ODIV) * `SYSCLKDIVSEL_dv` (SYSCLKDIVSEL))
|
||||
% }
|
||||
%else
|
||||
% {
|
||||
// SYSPLL DISABLED
|
||||
// SYSCLK = `OSCCLK_d` MHz(`oscclksource`) / `SYSCLKDIVSEL_dv` (SYSCLKDIVSEL) = `PLLSYSCLK_d` MHz
|
||||
% }
|
||||
//
|
||||
#define DEVICE_SETCLOCK_CFG (`oscclkSrc` | `PLL_IMULT` | \
|
||||
`PLL_REFDIV` | `PLL_ODIV` | \
|
||||
`PLL_DIVSEL` | `PLL_STS` | \
|
||||
SYSCTL_DCC_BASE_0)
|
||||
|
||||
|
||||
#define DEVICE_SYSCLK_FREQ ((DEVICE_OSCSRC_FREQ * `PLL_IMULT_mv`) / (`PLL_REFDIV_dv` * `PLL_ODIV_dv` * `SYSCLKDIVSEL_dv`))
|
||||
% }
|
||||
% /////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//
|
||||
// Define to pass to SysCtl_setLowSpeedClock().
|
||||
// Low Speed Clock (LSPCLK) = `PLLSYSCLK_d` MHz / `clockTree_CPU2.LOSPCP.divideValue` = `LSPCLK_d` MHz
|
||||
//
|
||||
#define DEVICE_LSPCLK_CFG SYSCTL_LSPCLK_PRESCALE_`clockTree_CPU2.LOSPCP.divideValue`
|
||||
|
||||
#define DEVICE_LSPCLK_FREQ (DEVICE_SYSCLK_FREQ / `clockTree_CPU2.LOSPCP.divideValue`)
|
||||
@@ -0,0 +1,110 @@
|
||||
%%{
|
||||
let clocktree_common = system.getScript("../clocktree_common.js");
|
||||
let Common = system.getScript("/driverlib/Common.js");
|
||||
var clockTree_CPU2 = Common.getClockTree();
|
||||
|
||||
const PLL_type1 = clocktree_common.PLL_type1;
|
||||
const PLL_type2 = clocktree_common.PLL_type2;
|
||||
const EPWM_div_support = clocktree_common.EPWM_div_support;
|
||||
const device = clocktree_common.device;
|
||||
|
||||
const PLLSYSCLK_d = clockTree_CPU2.PLLSYSCLK.in
|
||||
const LSPCLK_d = clockTree_CPU2.LSPCLK.in
|
||||
const CPU1_CPUCLK_d = clockTree_CPU2.CPU1_CPUCLK.in
|
||||
const CPU2_CPUCLK_d = clockTree_CPU2.CPU2_CPUCLK.in
|
||||
const CPU1_SYSCLK_d = clockTree_CPU2.CPU1_SYSCLK.in
|
||||
const CPU2_SYSCLK_d = clockTree_CPU2.CPU2_SYSCLK.in
|
||||
%%}
|
||||
%
|
||||
%if(EPWM_div_support.includes(device))
|
||||
%{
|
||||
% var EPWMCLK_d = clockTree_CPU2.PLLSYSCLK.in / clockTree_CPU2.EPWMCLKDIV.divideValue
|
||||
%}
|
||||
//*****************************************************************************
|
||||
//
|
||||
// CPU1CLK / CPU2CLK Domain (`CPU1_CPUCLK_d` MHz)
|
||||
//
|
||||
//*****************************************************************************
|
||||
% var max, i
|
||||
% max = clockTree_CPU2.CPU1CLK_domain.$ipInstance.modulePins.length
|
||||
% for(i=0; i<max; i++)
|
||||
% {
|
||||
// `clockTree_CPU2.CPU1CLK_domain.$ipInstance.modulePins[i].name`
|
||||
% }
|
||||
//
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// CPU1 SYSCLK Domain (`CPU1_SYSCLK_d` MHz)
|
||||
//
|
||||
//*****************************************************************************
|
||||
% max = clockTree_CPU2.CPU1_SYSCLK_domain.$ipInstance.modulePins.length
|
||||
% for(i=0; i<max; i++)
|
||||
% {
|
||||
// `clockTree_CPU2.CPU1_SYSCLK_domain.$ipInstance.modulePins[i].name`
|
||||
% }
|
||||
//
|
||||
|
||||
/////////////////////
|
||||
// Gated CPU1 SYSCLK
|
||||
/////////////////////
|
||||
% max = clockTree_CPU2.CPU1_PERx_SYSCLK_domain.$ipInstance.modulePins.length
|
||||
% for(i=0; i<max; i++)
|
||||
% {
|
||||
// `clockTree_CPU2.CPU1_PERx_SYSCLK_domain.$ipInstance.modulePins[i].name`
|
||||
% }
|
||||
//
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// CPU2 SYSCLK Domain (`CPU1_SYSCLK_d` MHz)
|
||||
//
|
||||
//*****************************************************************************
|
||||
% max = clockTree_CPU2.CPU2_SYSCLK_domain.$ipInstance.modulePins.length
|
||||
% for(i=0; i<max; i++)
|
||||
% {
|
||||
// `clockTree_CPU2.CPU2_SYSCLK_domain.$ipInstance.modulePins[i].name`
|
||||
% }
|
||||
//
|
||||
|
||||
/////////////////////
|
||||
// Gated CPU2 SYSCLK
|
||||
/////////////////////
|
||||
% max = clockTree_CPU2.CPU2_PERx_SYSCLK_domain.$ipInstance.modulePins.length
|
||||
% for(i=0; i<max; i++)
|
||||
% {
|
||||
// `clockTree_CPU2.CPU2_PERx_SYSCLK_domain.$ipInstance.modulePins[i].name`
|
||||
% }
|
||||
//
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Gated Peripheral EPWM Domain (`EPWMCLK_d` MHz)
|
||||
//
|
||||
//*****************************************************************************
|
||||
% max = clockTree_CPU2.EPWM_Clock_domain.$ipInstance.modulePins.length
|
||||
% for(i=0; i<max; i++)
|
||||
% {
|
||||
// `clockTree_CPU2.EPWM_Clock_domain.$ipInstance.modulePins[i].name`
|
||||
% }
|
||||
//
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Gated Peripheral SYSCLK Domain (`PLLSYSCLK_d` MHz)
|
||||
//
|
||||
//*****************************************************************************
|
||||
% max = clockTree_CPU2.PERx_SYSCLK_domain.$ipInstance.modulePins.length
|
||||
% for(i=0; i<max; i++)
|
||||
% {
|
||||
// `clockTree_CPU2.PERx_SYSCLK_domain.$ipInstance.modulePins[i].name`
|
||||
% }
|
||||
//
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Gated LSPCLK Domain (`LSPCLK_d` MHz)
|
||||
//
|
||||
//*****************************************************************************
|
||||
% max = clockTree_CPU2.LSPCLK_domain.$ipInstance.modulePins.length
|
||||
% for(i=0; i<max; i++)
|
||||
% {
|
||||
// `clockTree_CPU2.LSPCLK_domain.$ipInstance.modulePins[i].name`
|
||||
% }
|
||||
@@ -0,0 +1,215 @@
|
||||
%%{
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
let clocktree_common = system.getScript("../clocktree_common.js");
|
||||
|
||||
const PLL_type1 = clocktree_common.PLL_type1;
|
||||
const PLL_type2 = clocktree_common.PLL_type2;
|
||||
|
||||
const AUXPLL_Support = clocktree_common.AUXPLL_Support;
|
||||
const EPWM_div_support = clocktree_common.EPWM_div_support;
|
||||
const xtal_x1_macro = clocktree_common.xtal_x1_macro;
|
||||
var XTAL_OR_X1 = clocktree_common.XTAL_OR_X1;
|
||||
|
||||
const device = clocktree_common.device
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
// Frequency lables
|
||||
//////////////////////////////////////////////////
|
||||
const OSCCLK_d = system.clockTree.OSCCLK.in
|
||||
const PLLRAWCLK_d = system.clockTree.PLLRAWCLK.in
|
||||
const PLLSYSCLK_d = system.clockTree.PLLSYSCLK.in
|
||||
const CPU1_CPUCLK_d = system.clockTree.CPU1_CPUCLK.in
|
||||
const CPU2_CPUCLK_d = system.clockTree.CPU2_CPUCLK.in
|
||||
const CPU1_SYSCLK_d = system.clockTree.CPU1_SYSCLK.in
|
||||
const CPU2_SYSCLK_d = system.clockTree.CPU2_SYSCLK.in
|
||||
const LSPCLK_d = system.clockTree.LSPCLK.in
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
// OSCCLK source
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
var OSCCLKSRCSEL = system.clockTree.OSCCLKSRCSEL
|
||||
|
||||
var oscclkSrc = "SYSCTL_OSCSRC_OSC2"
|
||||
var oscclksource
|
||||
var oscclk = 10
|
||||
|
||||
//
|
||||
// XTAL Single-Ended replaces X1 for F2838x, F28002x, F28003x, F28004x, F280013x, F280015x, F28P65x
|
||||
//
|
||||
switch(OSCCLKSRCSEL.inputSelect){
|
||||
case "INTOSC1":
|
||||
oscclkSrc = "SYSCTL_OSCSRC_OSC1"
|
||||
oscclksource = OSCCLKSRCSEL.inputSelect
|
||||
oscclk = 10
|
||||
break
|
||||
case "INTOSC2":
|
||||
oscclkSrc = "SYSCTL_OSCSRC_OSC2"
|
||||
oscclksource = OSCCLKSRCSEL.inputSelect
|
||||
oscclk = 10
|
||||
break
|
||||
case "X1_XTAL":
|
||||
if((XTAL_OR_X1.inputSelect == "XTAL") || xtal_x1_macro.includes(device))
|
||||
{
|
||||
oscclkSrc = "SYSCTL_OSCSRC_XTAL"
|
||||
}
|
||||
else
|
||||
{
|
||||
oscclkSrc = "SYSCTL_OSCSRC_XTAL_SE"
|
||||
}
|
||||
oscclksource = XTAL_OR_X1.inputSelect
|
||||
oscclk = XTAL_OR_X1.External_Clock
|
||||
break
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
// IMULT, FMULT (PLLRAWCLK) source
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
var SYSPLLCTL1 = system.clockTree.SYSPLLCTL1
|
||||
|
||||
var PLL_IMULT_mv = system.clockTree.PLL_IMULT.multiplyValue
|
||||
var PLL_IMULT = "SYSCTL_IMULT(" + PLL_IMULT_mv + ")"
|
||||
|
||||
var SYSCLKDIVSEL_dv = system.clockTree.SYSCLKDIVSEL.divideValue
|
||||
|
||||
var PLL_DIVSEL = "SYSCTL_SYSDIV(" + SYSCLKDIVSEL_dv + ")"
|
||||
|
||||
var PLL_FMULT
|
||||
if(PLL_type1.includes(device))
|
||||
{
|
||||
var PLL_FMULT_mv = system.clockTree.PLL_FMULT.multiplyValue
|
||||
switch(PLL_FMULT_mv){
|
||||
case 0:
|
||||
PLL_FMULT = "SYSCTL_FMULT_NONE"
|
||||
break
|
||||
case 0.25:
|
||||
PLL_FMULT = "SYSCTL_FMULT_1_4"
|
||||
break
|
||||
case 0.5:
|
||||
PLL_FMULT = "SYSCTL_FMULT_1_2"
|
||||
break
|
||||
case 0.75:
|
||||
PLL_FMULT = "SYSCTL_FMULT_3_4"
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
var PLL_STS = 'SYSCTL_PLL_ENABLE'
|
||||
var SYSPLL_STS = 'DISABLED'
|
||||
|
||||
if(SYSPLLCTL1.inputSelect == 'OSCCLK')
|
||||
{
|
||||
PLL_STS = 'SYSCTL_PLL_DISABLE'
|
||||
SYSPLL_STS = 'DISABLED'
|
||||
}
|
||||
else
|
||||
{
|
||||
PLL_STS = 'SYSCTL_PLL_ENABLE'
|
||||
SYSPLL_STS = 'ENABLED'
|
||||
}
|
||||
|
||||
|
||||
if(PLL_type2.includes(device))
|
||||
{
|
||||
var PLL_REFDIV_dv = system.clockTree.PLL_REFDIV.divideValue
|
||||
var PLL_REFDIV = "SYSCTL_REFDIV(" + PLL_REFDIV_dv + ")"
|
||||
|
||||
var PLL_ODIV_dv = system.clockTree.PLL_ODIV.divideValue
|
||||
var PLL_ODIV = "SYSCTL_ODIV(" + PLL_ODIV_dv + ")"
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
%%}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Summary of SYSPLL related clock configuration
|
||||
//
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Input Clock to SYSPLL (OSCCLK) = `OSCCLK_d` MHz (`oscclksource` provides OSCCLK)
|
||||
//
|
||||
//##### SYSPLL `SYSPLL_STS` #####
|
||||
//
|
||||
// PLLRAWCLK = `PLLRAWCLK_d` MHz (Output of SYSPLL if enabled)
|
||||
// PLLSYSCLK = `PLLSYSCLK_d` MHz
|
||||
// CPU1CLK = `CPU1_CPUCLK_d` MHz
|
||||
// CPU2CLK = `CPU2_CPUCLK_d` MHz
|
||||
// CPU1_SYSCLK = `CPU1_SYSCLK_d` MHz
|
||||
// CPU2_SYSCLK = `CPU2_SYSCLK_d` MHz
|
||||
// LSPCLK = `LSPCLK_d` MHz
|
||||
%
|
||||
%if(EPWM_div_support.includes(device))
|
||||
%{
|
||||
% var EPWMCLK_d = system.clockTree.PLLSYSCLK.in / system.clockTree.EPWMCLKDIV.divideValue
|
||||
// EPWMCLK = `EPWMCLK_d` MHz
|
||||
%}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Macro definitions used in device.c (SYSPLL / LSPCLK)
|
||||
//
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Input Clock to SYSPLL (OSCCLK) = `oscclksource` = `OSCCLK_d` MHz
|
||||
//
|
||||
#define DEVICE_OSCSRC_FREQ `OSCCLK_d`000000U
|
||||
%
|
||||
% /////////////////////////////////////////////////////////////////////////////////////////
|
||||
%
|
||||
% if(PLL_type1.includes(device))
|
||||
% {
|
||||
//
|
||||
// Define to pass to SysCtl_setClock(). Will configure the clock as follows:
|
||||
%if(PLL_STS == 'SYSCTL_PLL_ENABLE')
|
||||
% {
|
||||
// SYSPLL ENABLED
|
||||
// SYSCLK = `PLLSYSCLK_d` MHz = `OSCCLK_d` MHz (OSCCLK) * (`PLL_IMULT_mv` (IMULT) + `PLL_FMULT_mv` (FMULT)) / `SYSCLKDIVSEL_dv` (SYSCLKDIVSEL)
|
||||
#define DEVICE_SYSCLK_FREQ ((DEVICE_OSCSRC_FREQ * (`PLL_IMULT_mv` + `PLL_FMULT_mv`)) / `SYSCLKDIVSEL_dv`)
|
||||
% }
|
||||
%else
|
||||
% {
|
||||
// SYSPLL DISABLED
|
||||
// SYSCLK = `OSCCLK_d` MHz(`oscclksource`) / `SYSCLKDIVSEL_dv` (SYSCLKDIVSEL) = `PLLSYSCLK_d` MHz
|
||||
#define DEVICE_SYSCLK_FREQ (DEVICE_OSCSRC_FREQ / `SYSCLKDIVSEL_dv`)
|
||||
% }
|
||||
//
|
||||
#define DEVICE_SETCLOCK_CFG (`oscclkSrc` | `PLL_IMULT` | \
|
||||
`PLL_FMULT` | `PLL_DIVSEL`| \
|
||||
`PLL_STS`)
|
||||
%}
|
||||
% /////////////////////////////////////////////////////////////////////////////////////////
|
||||
%
|
||||
% if(PLL_type2.includes(device))
|
||||
% {
|
||||
//
|
||||
// Define to pass to SysCtl_setClock(). Will configure the clock as follows:
|
||||
%if(PLL_STS == 'SYSCTL_PLL_ENABLE')
|
||||
% {
|
||||
// SYSPLL ENABLED
|
||||
// SYSCLK = `PLLSYSCLK_d` MHz = `OSCCLK_d` MHz (OSCCLK) * `PLL_IMULT_mv` (IMULT) / (`PLL_REFDIV_dv` (REFDIV) * `PLL_ODIV_dv` (ODIV) * `SYSCLKDIVSEL_dv` (SYSCLKDIVSEL))
|
||||
% }
|
||||
%else
|
||||
% {
|
||||
// SYSPLL DISABLED
|
||||
// SYSCLK = `OSCCLK_d` MHz(`oscclksource`) / `SYSCLKDIVSEL_dv` (SYSCLKDIVSEL) = `PLLSYSCLK_d` MHz
|
||||
% }
|
||||
//
|
||||
#define DEVICE_SETCLOCK_CFG (`oscclkSrc` | `PLL_IMULT` | \
|
||||
`PLL_REFDIV` | `PLL_ODIV` | \
|
||||
`PLL_DIVSEL` | `PLL_STS` | \
|
||||
SYSCTL_DCC_BASE_0)
|
||||
|
||||
|
||||
#define DEVICE_SYSCLK_FREQ ((DEVICE_OSCSRC_FREQ * `PLL_IMULT_mv`) / (`PLL_REFDIV_dv` * `PLL_ODIV_dv` * `SYSCLKDIVSEL_dv`))
|
||||
% }
|
||||
% /////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//
|
||||
// Define to pass to SysCtl_setLowSpeedClock().
|
||||
// Low Speed Clock (LSPCLK) = `PLLSYSCLK_d` MHz / `system.clockTree.LOSPCP.divideValue` = `LSPCLK_d` MHz
|
||||
//
|
||||
#define DEVICE_LSPCLK_CFG SYSCTL_LSPCLK_PRESCALE_`system.clockTree.LOSPCP.divideValue`
|
||||
|
||||
#define DEVICE_LSPCLK_FREQ (DEVICE_SYSCLK_FREQ / `system.clockTree.LOSPCP.divideValue`)
|
||||
@@ -0,0 +1,110 @@
|
||||
%%{
|
||||
let clocktree_common = system.getScript("../clocktree_common.js");
|
||||
|
||||
const PLL_type1 = clocktree_common.PLL_type1;
|
||||
const PLL_type2 = clocktree_common.PLL_type2;
|
||||
|
||||
const EPWM_div_support = clocktree_common.EPWM_div_support;
|
||||
|
||||
const device = clocktree_common.device;
|
||||
|
||||
const PLLSYSCLK_d = system.clockTree.PLLSYSCLK.in
|
||||
const LSPCLK_d = system.clockTree.LSPCLK.in
|
||||
const CPU1_CPUCLK_d = system.clockTree.CPU1_CPUCLK.in
|
||||
const CPU2_CPUCLK_d = system.clockTree.CPU2_CPUCLK.in
|
||||
const CPU1_SYSCLK_d = system.clockTree.CPU1_SYSCLK.in
|
||||
const CPU2_SYSCLK_d = system.clockTree.CPU2_SYSCLK.in
|
||||
%%}
|
||||
%
|
||||
%if(EPWM_div_support.includes(device))
|
||||
%{
|
||||
% var EPWMCLK_d = system.clockTree.PLLSYSCLK.in / system.clockTree.EPWMCLKDIV.divideValue
|
||||
%}
|
||||
//*****************************************************************************
|
||||
//
|
||||
// CPU1CLK / CPU2CLK Domain (`CPU1_CPUCLK_d` MHz)
|
||||
//
|
||||
//*****************************************************************************
|
||||
% var max, i
|
||||
% max = system.clockTree.CPU1CLK_domain.$ipInstance.modulePins.length
|
||||
% for(i=0; i<max; i++)
|
||||
% {
|
||||
// `system.clockTree.CPU1CLK_domain.$ipInstance.modulePins[i].name`
|
||||
% }
|
||||
//
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// CPU1 SYSCLK Domain (`CPU1_SYSCLK_d` MHz)
|
||||
//
|
||||
//*****************************************************************************
|
||||
% max = system.clockTree.CPU1_SYSCLK_domain.$ipInstance.modulePins.length
|
||||
% for(i=0; i<max; i++)
|
||||
% {
|
||||
// `system.clockTree.CPU1_SYSCLK_domain.$ipInstance.modulePins[i].name`
|
||||
% }
|
||||
//
|
||||
|
||||
/////////////////////
|
||||
// Gated CPU1 SYSCLK
|
||||
/////////////////////
|
||||
% max = system.clockTree.CPU1_PERx_SYSCLK_domain.$ipInstance.modulePins.length
|
||||
% for(i=0; i<max; i++)
|
||||
% {
|
||||
// `system.clockTree.CPU1_PERx_SYSCLK_domain.$ipInstance.modulePins[i].name`
|
||||
% }
|
||||
//
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// CPU2 SYSCLK Domain (`CPU1_SYSCLK_d` MHz)
|
||||
//
|
||||
//*****************************************************************************
|
||||
% max = system.clockTree.CPU2_SYSCLK_domain.$ipInstance.modulePins.length
|
||||
% for(i=0; i<max; i++)
|
||||
% {
|
||||
// `system.clockTree.CPU2_SYSCLK_domain.$ipInstance.modulePins[i].name`
|
||||
% }
|
||||
//
|
||||
|
||||
/////////////////////
|
||||
// Gated CPU2 SYSCLK
|
||||
/////////////////////
|
||||
% max = system.clockTree.CPU2_PERx_SYSCLK_domain.$ipInstance.modulePins.length
|
||||
% for(i=0; i<max; i++)
|
||||
% {
|
||||
// `system.clockTree.CPU2_PERx_SYSCLK_domain.$ipInstance.modulePins[i].name`
|
||||
% }
|
||||
//
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Gated Peripheral EPWM Domain (`EPWMCLK_d` MHz)
|
||||
//
|
||||
//*****************************************************************************
|
||||
% max = system.clockTree.EPWM_Clock_domain.$ipInstance.modulePins.length
|
||||
% for(i=0; i<max; i++)
|
||||
% {
|
||||
// `system.clockTree.EPWM_Clock_domain.$ipInstance.modulePins[i].name`
|
||||
% }
|
||||
//
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Gated Peripheral SYSCLK Domain (`PLLSYSCLK_d` MHz)
|
||||
//
|
||||
//*****************************************************************************
|
||||
% max = system.clockTree.PERx_SYSCLK_domain.$ipInstance.modulePins.length
|
||||
% for(i=0; i<max; i++)
|
||||
% {
|
||||
// `system.clockTree.PERx_SYSCLK_domain.$ipInstance.modulePins[i].name`
|
||||
% }
|
||||
//
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Gated LSPCLK Domain (`LSPCLK_d` MHz)
|
||||
//
|
||||
//*****************************************************************************
|
||||
% max = system.clockTree.LSPCLK_domain.$ipInstance.modulePins.length
|
||||
% for(i=0; i<max; i++)
|
||||
% {
|
||||
// `system.clockTree.LSPCLK_domain.$ipInstance.modulePins[i].name`
|
||||
% }
|
||||
@@ -0,0 +1,35 @@
|
||||
exports = {
|
||||
displayName: "Multiplier",
|
||||
config: [],
|
||||
extendConfig: ({ $ipInstance }) => [
|
||||
{
|
||||
name: "Description",
|
||||
displayName: "Description",
|
||||
default: $ipInstance.description,
|
||||
readOnly: true,
|
||||
},
|
||||
{
|
||||
name: "InputValue",
|
||||
displayName: "Input Clock (MHz)",
|
||||
default: '',
|
||||
getValue: (inst) => {
|
||||
const value = inst[$ipInstance.inPins[0].name] + ' MHz';
|
||||
return value;
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "multiplyValue",
|
||||
displayName: "Multiply Value",
|
||||
default: $ipInstance.resetValue,
|
||||
options: _.map($ipInstance.multiplyValues, (v) => ({ name: v, displayName: `X ${v}` })),
|
||||
},
|
||||
{
|
||||
name: $ipInstance.outPins[0].name,
|
||||
displayName: "Output Clock",
|
||||
default: 0,
|
||||
getValue: (inst) => {
|
||||
const value = inst[$ipInstance.inPins[0].name];
|
||||
return value * inst.multiplyValue;
|
||||
},
|
||||
}],
|
||||
};
|
||||
@@ -0,0 +1,45 @@
|
||||
exports = {
|
||||
displayName: "Mux",
|
||||
config: [],
|
||||
extendConfig: ({ $ipInstance }) => {
|
||||
var pinConfig = [];
|
||||
pinConfig.push({
|
||||
name: "Description",
|
||||
displayName: "Description",
|
||||
default: $ipInstance.description,
|
||||
readOnly: true,
|
||||
})
|
||||
pinConfig.push({
|
||||
name: "inputSelect",
|
||||
displayName: "Input Select",
|
||||
default: $ipInstance.resetValue,
|
||||
options: _.map($ipInstance.inPins, ({ name }) => ({ name })),
|
||||
})
|
||||
pinConfig.push({
|
||||
name: $ipInstance.outPins[0].name,
|
||||
default: 0,
|
||||
getValue: (inst) => inst[inst.inputSelect],
|
||||
})
|
||||
if ($ipInstance.name == "CPUSELx")
|
||||
{
|
||||
pinConfig.push({
|
||||
name: "cpu_sel_mux",
|
||||
displayName: "CPU Select Mux",
|
||||
default: "Click the hyper link for SYSCLK GATES",
|
||||
getValue: (inst) => { return "Click the hyper link for SYSCLK GATES" },
|
||||
})
|
||||
}
|
||||
return pinConfig;
|
||||
},
|
||||
|
||||
validate: (inst, { $ipInstance, logInfo }) => {
|
||||
var sysctl = system.modules['/driverlib/sysctl.js']
|
||||
if (sysctl)
|
||||
{
|
||||
if (inst.cpu_sel_mux)
|
||||
{
|
||||
logInfo("For enabling peripherals, use the " + system.getReference(sysctl.$static, "enable_SYSCTL_PERIPH_CLK_TIMER0"), inst, "cpu_sel_mux")
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,60 @@
|
||||
exports = {
|
||||
displayName: "NamedConnection",
|
||||
config: [],
|
||||
extendConfig: ({ $ipInstance }) => [
|
||||
{
|
||||
name: "in",
|
||||
displayName: "Frequency",
|
||||
default: 0,
|
||||
getValue: () => 0,
|
||||
},
|
||||
{
|
||||
name: "Min",
|
||||
displayName: "Min",
|
||||
default: ($ipInstance.Min??"-1") + " MHz",
|
||||
readOnly: true,
|
||||
},
|
||||
{
|
||||
name: "Max",
|
||||
displayName: "Max",
|
||||
default: ($ipInstance.Max??"-1") + " MHz",
|
||||
readOnly: true,
|
||||
},
|
||||
{
|
||||
name: "out",
|
||||
default: 0,
|
||||
getValue: (inst) => inst.in,
|
||||
hidden: true,
|
||||
}],
|
||||
validate: (inst, { $ipInstance,logError, logWarning }) => {
|
||||
let min = inst.$ipInstance.Min;
|
||||
let max = inst.$ipInstance.Max;
|
||||
const derivedClock = inst[inst.$ipInstance.inPins[0].name];
|
||||
|
||||
let minMsg = "Configured " + inst.$ipInstance.name + " = " + derivedClock + " MHz. Minimum frequency supported = " + inst.$ipInstance.Min + " MHz";
|
||||
let maxMsg = "Configured " + inst.$ipInstance.name + " = " + derivedClock + " MHz. Maximum frequency supported = " + inst.$ipInstance.Max + " MHz";
|
||||
|
||||
if (derivedClock < min)
|
||||
{
|
||||
if (inst.warning)
|
||||
{
|
||||
logWarning(minMsg, inst, inst.$ipInstance.inPins[0].name)
|
||||
}
|
||||
else
|
||||
{
|
||||
logError(minMsg, inst, inst.$ipInstance.inPins[0].name)
|
||||
}
|
||||
}
|
||||
if (derivedClock > max)
|
||||
{
|
||||
if (inst.warning)
|
||||
{
|
||||
logWarning(maxMsg + inst.$ipInstance.Max + " MHz", inst, inst.$ipInstance.outPins[0].name)
|
||||
}
|
||||
else
|
||||
{
|
||||
logError(maxMsg , inst, inst.$ipInstance.inPins[0].name)
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,33 @@
|
||||
const { getDefaultValue } = system.getScript("./defaultValue.js");
|
||||
|
||||
exports = {
|
||||
displayName: "Internal Oscillators",
|
||||
config: [{
|
||||
name: "type",
|
||||
displayName: "Type",
|
||||
default: "Internal Oscillators",
|
||||
readOnly: true,
|
||||
}, ],
|
||||
extendConfig: ({ $ipInstance }) => {
|
||||
if (!_.isEmpty($ipInstance.outPins)) {
|
||||
return [{
|
||||
name: $ipInstance.outPins[0].name,
|
||||
default: 10,
|
||||
getValue: (inst) => $ipInstance.outputValue,
|
||||
readOnly: false
|
||||
}];
|
||||
} else {
|
||||
// Override the input pin so it's visible with a tool tip
|
||||
return [{
|
||||
name: $ipInstance.description,
|
||||
default: 0,
|
||||
description: "Custom tool tip",
|
||||
hidden: false,
|
||||
getValue: () => { } // Tool will update
|
||||
}]
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
|
||||
};
|
||||
@@ -0,0 +1,83 @@
|
||||
const { getDefaultValue } = system.getScript("./defaultValue.js");
|
||||
|
||||
exports = {
|
||||
displayName: "Pin Function",
|
||||
config: [],
|
||||
validate: (inst, { $ipInstance,logError, logWarning }) => {
|
||||
let min = inst.$ipInstance.Min;
|
||||
let max = inst.$ipInstance.Max;
|
||||
const derivedClock = inst.XTAL_Freq;
|
||||
|
||||
let minMsg = "Configured " + inst.$ipInstance.name + " = " + derivedClock + " MHz. Minimum " + inst.$ipInstance.name + " frequency supported = " + inst.$ipInstance.Min + " MHz";
|
||||
let maxMsg = "Configured " + inst.$ipInstance.name + " = " + derivedClock + " MHz. Maximum " + inst.$ipInstance.name + " frequency supported = " + inst.$ipInstance.Max + " MHz";
|
||||
|
||||
if (derivedClock < min)
|
||||
{
|
||||
if (inst.warning)
|
||||
{
|
||||
logWarning(minMsg, inst, inst.$ipInstance.outPins[0].name)
|
||||
}
|
||||
else
|
||||
{
|
||||
logError(minMsg, inst, inst.$ipInstance.outPins[0].name)
|
||||
}
|
||||
}
|
||||
if (derivedClock > max)
|
||||
{
|
||||
if (inst.warning)
|
||||
{
|
||||
logWarning(maxMsg + inst.$ipInstance.Max + " MHz", inst, inst.$ipInstance.outPins[0].name)
|
||||
}
|
||||
else
|
||||
{
|
||||
logError(maxMsg , inst, inst.$ipInstance.outPins[0].name)
|
||||
}
|
||||
}
|
||||
},
|
||||
extendConfig: ({ $ipInstance }) => {
|
||||
if (!_.isEmpty($ipInstance.outPins)) {
|
||||
return [
|
||||
{
|
||||
name: "Description",
|
||||
displayName: "Description",
|
||||
default: $ipInstance.description,
|
||||
readOnly: true
|
||||
},
|
||||
{
|
||||
name: "XTAL_Freq",
|
||||
displayName: "XTAL Frequency (in MHz)",
|
||||
default: $ipInstance.outputValue,
|
||||
readOnly: false
|
||||
},
|
||||
{
|
||||
name: $ipInstance.outPins[0].name,
|
||||
default: 0,
|
||||
getValue: (inst) => inst.XTAL_Freq,
|
||||
readOnly: false,
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
name: "minXTAL",
|
||||
displayName: "Min XTAL Frequency supported (in MHz)",
|
||||
default: $ipInstance.Min,
|
||||
readOnly: true
|
||||
},
|
||||
{
|
||||
name: "maxXTAL",
|
||||
displayName: "Max XTAL Frequency supported (in MHz)",
|
||||
default: $ipInstance.Max,
|
||||
readOnly: true
|
||||
}
|
||||
];
|
||||
} else {
|
||||
// Override the input pin so it's visible with a tool tip
|
||||
return [{
|
||||
name: $ipInstance.description,
|
||||
default: 0,
|
||||
description: "Custom tool tip",
|
||||
hidden: false,
|
||||
getValue: () => { } // Tool will update
|
||||
}]
|
||||
}
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,26 @@
|
||||
%%{
|
||||
|
||||
var SingleCore_SYSPLL = system.getTemplate('./singleCore_SYSPLL.xdt');
|
||||
var SingleCore_AUXPLL = system.getTemplate('./singleCore_AUXPLL.xdt');
|
||||
var SingleCore_domain = system.getTemplate('./singleCore_domain.xdt');
|
||||
|
||||
let clocktree_common = system.getScript("../clocktree_common.js");
|
||||
|
||||
const PLL_type1 = clocktree_common.PLL_type1;
|
||||
const PLL_type2 = clocktree_common.PLL_type2;
|
||||
|
||||
const AUXPLL_Support = clocktree_common.AUXPLL_Support;
|
||||
const EPWM_div_support = clocktree_common.EPWM_div_support;
|
||||
|
||||
const device = clocktree_common.device;
|
||||
|
||||
%%}
|
||||
%
|
||||
`SingleCore_SYSPLL()`
|
||||
%
|
||||
% if(AUXPLL_Support.includes(device))
|
||||
% {
|
||||
`SingleCore_AUXPLL()`
|
||||
% }
|
||||
%
|
||||
`SingleCore_domain()`
|
||||
@@ -0,0 +1,160 @@
|
||||
%%{
|
||||
let clocktree_common = system.getScript("../clocktree_common.js");
|
||||
|
||||
const PLL_type1 = clocktree_common.PLL_type1;
|
||||
const PLL_type2 = clocktree_common.PLL_type2;
|
||||
const xtal_x1_macro = clocktree_common.xtal_x1_macro;
|
||||
|
||||
const device = clocktree_common.device;
|
||||
var XTAL_OR_X1 = clocktree_common.XTAL_OR_X1;
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
// Frequency lables
|
||||
//////////////////////////////////////////////////
|
||||
const AUXOSCCLK_d = system.clockTree.AUXOSCCLK.in
|
||||
const AUXPLLRAWCLK_d = system.clockTree.AUXPLLRAWCLK.in
|
||||
const AUXPLLCLK_d = system.clockTree.AUXPLLCLK.in
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
// AUXOSCCLK source
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
var AUXOSCCLKSRCSEL = system.clockTree.AUXOSCCLKSRCSEL
|
||||
|
||||
var auxoscclkSrc = "SYSCTL_OSCSRC_OSC2"
|
||||
var auxoscclksource
|
||||
var auxoscclk = 10
|
||||
|
||||
//
|
||||
// XTAL Single-Ended replaces X1 for F2838x, F28002x, F28003x, F28004x, F280013x, F280015x, F28P65x
|
||||
//
|
||||
switch(AUXOSCCLKSRCSEL.inputSelect){
|
||||
case "AUXCLK":
|
||||
auxoscclkSrc = "SYSCTL_AUXPLL_OSCSRC_AUXCLKIN"
|
||||
auxoscclksource = AUXOSCCLKSRCSEL.inputSelect
|
||||
auxoscclk = 10
|
||||
break
|
||||
case "INTOSC2":
|
||||
auxoscclkSrc = "SYSCTL_AUXPLL_OSCSRC_OSC2"
|
||||
auxoscclksource = AUXOSCCLKSRCSEL.inputSelect
|
||||
auxoscclk = 10
|
||||
break
|
||||
case "X1_XTAL":
|
||||
if((XTAL_OR_X1.inputSelect == "XTAL") || xtal_x1_macro.includes(device))
|
||||
{
|
||||
auxoscclkSrc = "SYSCTL_AUXPLL_OSCSRC_XTAL"
|
||||
}
|
||||
else
|
||||
{
|
||||
auxoscclkSrc = "SYSCTL_AUXPLL_OSCSRC_XTAL_SE"
|
||||
}
|
||||
auxoscclksource = system.clockTree.XTAL_OR_X1.inputSelect
|
||||
auxoscclk = system.clockTree.XTAL_OR_X1.External_Clock
|
||||
break
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
// IMULT, FMULT (AUXRAWCLK) source
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
|
||||
var AUX_PLLEN = system.clockTree.AUX_PLLEN
|
||||
var AUX_IMULT_mv = system.clockTree.AUX_IMULT.multiplyValue
|
||||
var AUX_IMULT = "SYSCTL_AUXPLL_IMULT(" + AUX_IMULT_mv + ")"
|
||||
|
||||
var AUXCLKDIVSEL_dv = system.clockTree.AUXCLKDIVSEL.divideValue
|
||||
|
||||
var AUX_DIVSEL = "SYSCTL_SYSDIV(" + AUXCLKDIVSEL_dv + ")"
|
||||
|
||||
|
||||
var AUX_FMULT
|
||||
if(PLL_type1.includes(device))
|
||||
{
|
||||
var AUX_FMULT_mv = system.clockTree.AUX_FMULT.multiplyValue
|
||||
switch(system.clockTree.AUX_FMULT.multiplyValue){
|
||||
case 0:
|
||||
AUX_FMULT = "SYSCTL_AUXPLL_FMULT_NONE"
|
||||
break
|
||||
case 0.25:
|
||||
AUX_FMULT = "SYSCTL_AUXPLL_FMULT_1_4"
|
||||
break
|
||||
case 0.5:
|
||||
AUX_FMULT = "SYSCTL_AUXPLL_FMULT_1_2"
|
||||
break
|
||||
case 0.75:
|
||||
AUX_FMULT = "SYSCTL_AUXPLL_FMULT_3_4"
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if(PLL_type2.includes(device))
|
||||
{
|
||||
var AUX_REFDIV_dv = system.clockTree.AUX_REFDIV.divideValue
|
||||
var AUX_REFDIV = "SYSCTL_REFDIV(" + AUX_REFDIV_dv + ")"
|
||||
|
||||
var AUX_ODIV_dv = system.clockTree.AUX_ODIV.divideValue
|
||||
var AUX_ODIV = "SYSCTL_ODIV(" + AUX_ODIV_dv + ")"
|
||||
|
||||
var AUXCLKDIVSEL_dv = system.clockTree.AUXCLKDIVSEL.divideValue
|
||||
}
|
||||
|
||||
var AUXPLL_STS = 'SYSCTL_AUXPLL_ENABLE'
|
||||
var AUXPLL_Status = 'DISABLED'
|
||||
|
||||
if(AUX_PLLEN.inputSelect == 'AUXOSCCLK')
|
||||
{
|
||||
AUXPLL_STS = 'SYSCTL_AUXPLL_DISABLE'
|
||||
AUXPLL_Status = 'DISABLED'
|
||||
}
|
||||
else
|
||||
{
|
||||
AUXPLL_STS = 'SYSCTL_AUXPLL_ENABLE'
|
||||
AUXPLL_Status = 'ENABLED'
|
||||
}
|
||||
|
||||
%%}
|
||||
%
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Summary of AUXPLL related clock configuration
|
||||
//
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Input Clock to AUXOSCCLK = `AUXOSCCLK_d` MHz (`auxoscclksource` provides AUXOSCCLK)
|
||||
//
|
||||
//##### AUXPLL `AUXPLL_Status` #####
|
||||
//
|
||||
// AUXPLLRAWCLK = `AUXPLLRAWCLK_d` MHz (Output of AUXPLL if enabled)
|
||||
// AUXPLLCLK = `AUXPLLCLK_d` MHz
|
||||
//
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Macro definitions used in device.c (AUXPLL)
|
||||
//
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Input Clock to AUXPLL (AUXOSCCLK) = `auxoscclksource` = `AUXOSCCLK_d` MHz
|
||||
//
|
||||
#define DEVICE_AUXOSCSRC_FREQ `AUXOSCCLK_d`000000U
|
||||
%
|
||||
% if(PLL_type1.includes(device))
|
||||
% {
|
||||
//
|
||||
// Define to pass to SysCtl_setAuxClock(). Will configure the clock as follows:
|
||||
%if(AUXPLL_STS == 'SYSCTL_AUXPLL_ENABLE')
|
||||
% {
|
||||
// AUXPLL ENABLED
|
||||
// AUXPLLCLK = `AUXPLLCLK_d` MHz = `AUXOSCCLK_d` MHz (AUXOSCCLK) * (`AUX_IMULT_mv` (AUX_IMULT) + `AUX_FMULT_mv` (AUX_FMULT)) / `AUXCLKDIVSEL_dv` (AUXCLKDIVSEL)
|
||||
#define DEVICE_AUXCLK_FREQ ((DEVICE_AUXOSCSRC_FREQ * (`AUX_IMULT_mv` + `AUX_FMULT_mv`)) / `AUXCLKDIVSEL_dv`)
|
||||
% }
|
||||
%else
|
||||
% {
|
||||
// AUXPLL DISABLED
|
||||
// AUXPLLCLK = `AUXPLLCLK_d` MHz = `AUXOSCCLK_d` MHz `auxoscclksource` / `AUXCLKDIVSEL_dv` (AUXCLKDIVSEL)
|
||||
#define DEVICE_AUXCLK_FREQ (DEVICE_AUXOSCSRC_FREQ / `AUXCLKDIVSEL_dv`)
|
||||
% }
|
||||
//
|
||||
#define DEVICE_SETAUXCLOCK_CFG (`auxoscclkSrc` | `AUX_IMULT` | \
|
||||
`AUX_FMULT` | SYSCTL_AUXPLL_DIV_`AUXCLKDIVSEL_dv` | \
|
||||
`AUXPLL_STS`)
|
||||
% }
|
||||
@@ -0,0 +1,212 @@
|
||||
%%{
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
let clocktree_common = system.getScript("../clocktree_common.js");
|
||||
|
||||
const PLL_type1 = clocktree_common.PLL_type1;
|
||||
const PLL_type2 = clocktree_common.PLL_type2;
|
||||
|
||||
const AUXPLL_Support = clocktree_common.AUXPLL_Support;
|
||||
const EPWM_div_support = clocktree_common.EPWM_div_support;
|
||||
const xtal_x1_macro = clocktree_common.xtal_x1_macro;
|
||||
|
||||
const device = system.deviceData.device
|
||||
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
// Frequency lables
|
||||
//////////////////////////////////////////////////
|
||||
const OSCCLK_d = system.clockTree.OSCCLK.in
|
||||
const PLLRAWCLK_d = system.clockTree.PLLRAWCLK.in
|
||||
const PLLSYSCLK_d = system.clockTree.PLLSYSCLK.in
|
||||
const CPUCLK_d = system.clockTree.CPUCLK.in
|
||||
const SYSCLK_d = system.clockTree.SYSCLK.in
|
||||
const LSPCLK_d = system.clockTree.LSPCLK.in
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
// OSCCLK source
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
var XTAL_OR_X1 = clocktree_common.XTAL_OR_X1;
|
||||
var OSCCLKSRCSEL = system.clockTree.OSCCLKSRCSEL
|
||||
|
||||
var oscclkSrc = "SYSCTL_OSCSRC_OSC2"
|
||||
var oscclksource
|
||||
var oscclk = 10
|
||||
|
||||
//
|
||||
// XTAL Single-Ended replaces X1 for F2838x, F28002x, F28003x, F28004x, F280013x, F280015x, F28P65x, F28P55x
|
||||
//
|
||||
switch(OSCCLKSRCSEL.inputSelect){
|
||||
case "INTOSC1":
|
||||
oscclkSrc = "SYSCTL_OSCSRC_OSC1"
|
||||
oscclksource = OSCCLKSRCSEL.inputSelect
|
||||
oscclk = 10
|
||||
break
|
||||
case "INTOSC2":
|
||||
oscclkSrc = "SYSCTL_OSCSRC_OSC2"
|
||||
oscclksource = OSCCLKSRCSEL.inputSelect
|
||||
oscclk = 10
|
||||
break
|
||||
case "X1_XTAL":
|
||||
if((XTAL_OR_X1.inputSelect == "XTAL") || xtal_x1_macro.includes(device))
|
||||
{
|
||||
oscclkSrc = "SYSCTL_OSCSRC_XTAL"
|
||||
}
|
||||
else
|
||||
{
|
||||
oscclkSrc = "SYSCTL_OSCSRC_XTAL_SE"
|
||||
}
|
||||
oscclksource = XTAL_OR_X1.inputSelect
|
||||
oscclk = XTAL_OR_X1.External_Clock
|
||||
break
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
// IMULT, FMULT (PLLRAWCLK) source
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
var SYSPLLCTL1 = system.clockTree.SYSPLLCTL1
|
||||
|
||||
var PLL_IMULT_mv = system.clockTree.PLL_IMULT.multiplyValue
|
||||
var PLL_IMULT = "SYSCTL_IMULT(" + PLL_IMULT_mv + ")"
|
||||
|
||||
var SYSCLKDIVSEL_dv = system.clockTree.SYSCLKDIVSEL.divideValue
|
||||
|
||||
var PLL_DIVSEL = "SYSCTL_SYSDIV(" + SYSCLKDIVSEL_dv + ")"
|
||||
|
||||
var PLL_FMULT
|
||||
if(PLL_type1.includes(device))
|
||||
{
|
||||
var PLL_FMULT_mv = system.clockTree.PLL_FMULT.multiplyValue
|
||||
switch(system.clockTree.PLL_FMULT.multiplyValue){
|
||||
case 0:
|
||||
PLL_FMULT = "SYSCTL_FMULT_NONE"
|
||||
break
|
||||
case 0.25:
|
||||
PLL_FMULT = "SYSCTL_FMULT_1_4"
|
||||
break
|
||||
case 0.5:
|
||||
PLL_FMULT = "SYSCTL_FMULT_1_2"
|
||||
break
|
||||
case 0.75:
|
||||
PLL_FMULT = "SYSCTL_FMULT_3_4"
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
var PLL_STS = 'SYSCTL_PLL_ENABLE'
|
||||
var SYSPLL_STS = 'DISABLED'
|
||||
|
||||
if(SYSPLLCTL1.inputSelect == 'OSCCLK')
|
||||
{
|
||||
PLL_STS = 'SYSCTL_PLL_DISABLE'
|
||||
SYSPLL_STS = 'DISABLED'
|
||||
}
|
||||
else
|
||||
{
|
||||
PLL_STS = 'SYSCTL_PLL_ENABLE'
|
||||
SYSPLL_STS = 'ENABLED'
|
||||
}
|
||||
|
||||
|
||||
if(PLL_type2.includes(device))
|
||||
{
|
||||
var PLL_REFDIV_dv = system.clockTree.PLL_REFDIV.divideValue
|
||||
var PLL_REFDIV = "SYSCTL_REFDIV(" + PLL_REFDIV_dv + ")"
|
||||
|
||||
var PLL_ODIV_dv = system.clockTree.PLL_ODIV.divideValue
|
||||
var PLL_ODIV = "SYSCTL_ODIV(" + PLL_ODIV_dv + ")"
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
%%}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Summary of SYSPLL related clock configuration
|
||||
//
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Input Clock to SYSPLL (OSCCLK) = `OSCCLK_d` MHz (`oscclksource` provides OSCCLK)
|
||||
//
|
||||
//##### SYSPLL `SYSPLL_STS` #####
|
||||
//
|
||||
// PLLRAWCLK = `PLLRAWCLK_d` MHz (Output of SYSPLL if enabled)
|
||||
// PLLSYSCLK = `PLLSYSCLK_d` MHz
|
||||
// CPUCLK = `CPUCLK_d` MHz
|
||||
// SYSCLK = `SYSCLK_d` MHz
|
||||
// LSPCLK = `LSPCLK_d` MHz
|
||||
%
|
||||
%if(EPWM_div_support.includes(device))
|
||||
%{
|
||||
% var EPWMCLK_d = system.clockTree.PLLSYSCLK.in / system.clockTree.EPWMCLKDIV.divideValue
|
||||
// EPWMCLK = `EPWMCLK_d` MHz
|
||||
%}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Macro definitions used in device.c (SYSPLL / LSPCLK)
|
||||
//
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Input Clock to SYSPLL (OSCCLK) = `oscclksource` = `OSCCLK_d` MHz
|
||||
//
|
||||
#define DEVICE_OSCSRC_FREQ `OSCCLK_d`000000U
|
||||
%
|
||||
% /////////////////////////////////////////////////////////////////////////////////////////
|
||||
%
|
||||
% if(PLL_type1.includes(device))
|
||||
% {
|
||||
//
|
||||
// Define to pass to SysCtl_setClock(). Will configure the clock as follows:
|
||||
%if(PLL_STS == 'SYSCTL_PLL_ENABLE')
|
||||
% {
|
||||
// SYSPLL ENABLED
|
||||
// SYSCLK = `PLLSYSCLK_d` MHz = `OSCCLK_d` MHz (OSCCLK) * (`PLL_IMULT_mv` (IMULT) + `PLL_FMULT_mv` (FMULT)) / `SYSCLKDIVSEL_dv` (SYSCLKDIVSEL)
|
||||
#define DEVICE_SYSCLK_FREQ ((DEVICE_OSCSRC_FREQ * (`PLL_IMULT_mv` + `PLL_FMULT_mv`)) / `SYSCLKDIVSEL_dv`)
|
||||
% }
|
||||
%else
|
||||
% {
|
||||
// SYSPLL DISABLED
|
||||
// SYSCLK = `OSCCLK_d` MHz(`oscclksource`) / `SYSCLKDIVSEL_dv` (SYSCLKDIVSEL) = `PLLSYSCLK_d` MHz
|
||||
#define DEVICE_SYSCLK_FREQ (DEVICE_OSCSRC_FREQ / `SYSCLKDIVSEL_dv`)
|
||||
% }
|
||||
//
|
||||
#define DEVICE_SETCLOCK_CFG (`oscclkSrc` | `PLL_IMULT` | \
|
||||
`PLL_FMULT` | `PLL_DIVSEL`| \
|
||||
`PLL_STS`)
|
||||
%}
|
||||
% /////////////////////////////////////////////////////////////////////////////////////////
|
||||
%
|
||||
% if(PLL_type2.includes(device))
|
||||
% {
|
||||
//
|
||||
// Define to pass to SysCtl_setClock(). Will configure the clock as follows:
|
||||
%if(PLL_STS == 'SYSCTL_PLL_ENABLE')
|
||||
% {
|
||||
// SYSPLL ENABLED
|
||||
// SYSCLK = `PLLSYSCLK_d` MHz = `OSCCLK_d` MHz (OSCCLK) * `PLL_IMULT_mv` (IMULT) / (`PLL_REFDIV_dv` (REFDIV) * `PLL_ODIV_dv` (ODIV) * `SYSCLKDIVSEL_dv` (SYSCLKDIVSEL))
|
||||
#define DEVICE_SYSCLK_FREQ ((DEVICE_OSCSRC_FREQ * `PLL_IMULT_mv`) / (`PLL_REFDIV_dv` * `PLL_ODIV_dv` * `SYSCLKDIVSEL_dv`))
|
||||
% }
|
||||
%else
|
||||
% {
|
||||
// SYSPLL DISABLED
|
||||
// SYSCLK = `OSCCLK_d` MHz(`oscclksource`) / `SYSCLKDIVSEL_dv` (SYSCLKDIVSEL) = `PLLSYSCLK_d` MHz
|
||||
#define DEVICE_SYSCLK_FREQ (DEVICE_OSCSRC_FREQ / `SYSCLKDIVSEL_dv`)
|
||||
% }
|
||||
//
|
||||
#define DEVICE_SETCLOCK_CFG (`oscclkSrc` | `PLL_IMULT` | \
|
||||
`PLL_REFDIV` | `PLL_ODIV`| \
|
||||
`PLL_DIVSEL` | `PLL_STS` | \
|
||||
SYSCTL_DCC_BASE_0)
|
||||
|
||||
% }
|
||||
% /////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//
|
||||
// Define to pass to SysCtl_setLowSpeedClock().
|
||||
// Low Speed Clock (LSPCLK) = `PLLSYSCLK_d` MHz / `system.clockTree.LOSPCP.divideValue` = `LSPCLK_d` MHz
|
||||
//
|
||||
#define DEVICE_LSPCLK_CFG SYSCTL_LSPCLK_PRESCALE_`system.clockTree.LOSPCP.divideValue`
|
||||
|
||||
#define DEVICE_LSPCLK_FREQ (DEVICE_SYSCLK_FREQ / `system.clockTree.LOSPCP.divideValue`)
|
||||