Update repo

This commit is contained in:
2026-08-30 23:04:35 -07:00
parent 749dab5721
commit ce65a0f59a
14950 changed files with 4408250 additions and 1 deletions
@@ -0,0 +1,303 @@
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() + "_sdfm.js");
let sd_device_info = system.getScript("/driverlib/sdfm/sd_device_info.js");
let sd_definition = system.getScript("/driverlib/sdfm/sdfm_board_definition_c.js");
var FIFO_LVL =
[
{name: "0", displayName: "FIFO_EMPTY"},
{name: "1", displayName: "FIFO_LVL_1"},
{name: "2", displayName: "FIFO_LVL_2"},
{name: "3", displayName: "FIFO_LVL_3"},
{name: "4", displayName: "FIFO_LVL_4"},
{name: "5", displayName: "FIFO_LVL_5"},
{name: "6", displayName: "FIFO_LVL_6"},
{name: "7", displayName: "FIFO_LVL_7"},
{name: "8", displayName: "FIFO_LVL_8"},
{name: "9", displayName: "FIFO_LVL_9"},
{name: "10", displayName: "FIFO_LVL_10"},
{name: "11", displayName: "FIFO_LVL_11"},
{name: "12", displayName: "FIFO_LVL_12"},
{name: "13", displayName: "FIFO_LVL_13"},
{name: "14", displayName: "FIFO_LVL_14"},
{name: "15", displayName: "FIFO_LVL_15"},
{name: "16", displayName: "FIFO_LVL_16"},
];
function onChangeDataFilterEnable(inst, ui)
{
for (var channel = 1; channel <= 4; channel++)
{
var status = inst["Ch" + channel.toString() + "_DataFilterEnable"];
ui["Ch" + channel.toString() + "_FilterType_D"].hidden = !status;
ui["Ch" + channel.toString() + "_DOSR"].hidden = !status;
ui["Ch" + channel.toString() + "_Min_FilterOutput"].hidden = !status;
ui["Ch" + channel.toString() + "_Max_FilterOutput"].hidden = !status;
ui["Ch" + channel.toString() + "_Datarate_DF"].hidden = !status;
ui["Ch" + channel.toString() + "_Latency_DF"].hidden = !status;
ui["Ch" + channel.toString() + "_DataFilter_Representation"].hidden = !status;
ui["Ch" + channel.toString() + "_ShiftControl"].hidden = !status;
ui["Ch" + channel.toString() + "_SDSYNC_Enable"].hidden = !status;
//ui["Ch" + channel.toString() + "_SDSYNC_source"].hidden = !status;
//ui["Ch" + channel.toString() + "_WTSYNCEN"].hidden = !status;
//ui["Ch" + channel.toString() + "_WTSCLREN"].hidden = !status;
if (sd_device_info.peripheralType == "Type1" || sd_device_info.peripheralType == "Type2")
{
ui["Ch" + channel.toString() + "_FIFO_Enable"].hidden = !status;
}
}
//var value = 2;
//inst["Ch1_FilterType_D"] = sd_device_info.SDFM_FilterType.filter(arg => arg.regValue === value)[0].name
}
function onChangeUseFIFOSettings(inst, ui)
{
for (var channel = 1; channel <= 4; channel++)
{
if (sd_device_info.peripheralType == "Type1" || sd_device_info.peripheralType == "Type2")
{
var status_FIFO = inst["Ch" + channel.toString() + "_FIFO_Enable"];
ui["Ch" + channel.toString() + "_SDFFIL"].hidden = !status_FIFO;
ui["Ch" + channel.toString() + "_FFSYNCCLREN"].hidden = !status_FIFO;
var status_SyncEn = inst["Ch" + channel.toString() + "_SDSYNC_Enable"];
ui["Ch" + channel.toString() + "_SDSYNC_source"].hidden = !status_SyncEn;
ui["Ch" + channel.toString() + "_WTSYNCEN"].hidden = true;
ui["Ch" + channel.toString() + "_WTSCLREN"].hidden = !status_SyncEn;
}
}
var status_use_int = inst.useInterrupts
if(inst.useInterrupts)
{
var status_FIFOEn = (inst.Ch1_FIFO_Enable || inst.Ch2_FIFO_Enable || inst.Ch3_FIFO_Enable || inst.Ch4_FIFO_Enable);
if (sd_device_info.peripheralType == "Type1" || sd_device_info.peripheralType == "Type2")
{
ui.SDFFINT.hidden = ((!status_FIFOEn) || (!status_use_int));
ui.SDFFOVF.hidden = ((!status_FIFOEn) || (!status_use_int));
ui.AE.hidden = !status_use_int;
}
}
}
function iterate(item)
{
var settings = [];
for(var i = 0; i< item.length; i++)
{
settings = settings.concat((({ name, displayName }) => ({ name, displayName }))(item[i]));
//console.log((({ name, displayName }) => ({ name, displayName }))(item[i]));
}
return settings;
}
var rr_temp = iterate(sd_device_info.SDFM_FilterType);
var hide = true;
// Data Filter settings //
function datafilterSettings(channel)
{
var Settings = [];
var order = 0;
Settings =
[
{
name: "Ch" + channel.toString() + "_FilterType_D",
displayName : "FilterType",
description : 'Select FilterType for Data Filter',
hidden : hide,
default : iterate(sd_device_info.SDFM_FilterType)[3].name,
options : iterate(sd_device_info.SDFM_FilterType),
},
{
name: "Ch" + channel.toString() + "_DOSR",
displayName : "DOSR",
description : 'Select OSR for Data Filter (1 to 256)',
hidden : hide,
default : 256,
},
{
name : "Ch" + channel.toString() + "_Datarate_DF",
displayName : "Data rate (us)",
description : 'Data rate (Data filter) for given DOSR setting and SDmodulator rate',
hidden : hide,
getValue : (inst) => {
var datarate = inst["Ch" + channel.toString() + "_DOSR"] / inst["Ch" + channel.toString() + "_SD_modulatorFrequency"];
return datarate;
},
default : 0,
},
{
name : "Ch" + channel.toString() + "_Latency_DF",
displayName : "Latency (us)",
description : 'Latency (or) settling time (Data filter) for given DOSR setting and SDmodulator rate',
hidden : hide,
getValue : (inst) => {
if(inst["Ch" + channel.toString() + "_FilterType_D"] == "SDFM_FILTER_SINC_FAST" || inst["Ch" + channel.toString() + "_FilterType_D"] == "SDFM_FILTER_SINC_3")
{
order = 3;
}
if(inst["Ch" + channel.toString() + "_FilterType_D"] == "SDFM_FILTER_SINC_2")
{
order = 2;
}
if(inst["Ch" + channel.toString() + "_FilterType_D"] == "SDFM_FILTER_SINC_1")
{
order = 1;
}
var latency = order * inst["Ch" + channel.toString() + "_DOSR"] / inst["Ch" + channel.toString() + "_SD_modulatorFrequency"];
return latency;
},
default : 0,
},
{
name : "Ch" + channel.toString() + "_Min_FilterOutput",
displayName : "Min (Data filter output)",
description : 'Minimum Data Filter output for given DOSR setting',
hidden : hide,
getValue : (inst) => {
var min_value = -1*sd_definition.getShiftvalue(inst["Ch" + channel.toString() + "_FilterType_D"], inst["Ch" + channel.toString() + "_DOSR"], 0 , inst["Ch" + channel.toString() + "_DataFilter_Representation"]);
return min_value;
},
default : 0,
},
{
name : "Ch" + channel.toString() + "_Max_FilterOutput",
displayName : "Max (Data filter output)",
description : 'Maximum Data Filter output for given DOSR setting',
hidden : hide,
getValue : (inst) => {
var max_value = sd_definition.getShiftvalue(inst["Ch" + channel.toString() + "_FilterType_D"], inst["Ch" + channel.toString() + "_DOSR"], 0 , inst["Ch" + channel.toString() + "_DataFilter_Representation"]);
return max_value;
},
default : 0,
},
{
name: "Ch" + channel.toString() + "_DataFilter_Representation",
displayName : "Data Filter Output Representation",
description : '16-bit (or) 32-bit representation',
hidden : hide,
default : sd_device_info.SDFM_OutputDataFormat[1].name,
options : sd_device_info.SDFM_OutputDataFormat,
},
{
name: "Ch" + channel.toString() + "_ShiftControl",
displayName : "Shift 32-bit filter output by x bits",
description : 'Shift 32-bit filter output by x bits',
hidden : hide,
getValue : (inst) => {
var shiftvalue = sd_definition.getShiftvalue(inst["Ch" + channel.toString() + "_FilterType_D"], inst["Ch" + channel.toString() + "_DOSR"], 1 , inst["Ch" + channel.toString() + "_DataFilter_Representation"]);
return shiftvalue;
},
default : 0,
},
{
name: "Ch" + channel.toString() + "_SDSYNC_Enable",
displayName : "Use PWM synchronization",
description : 'Use PWM synchronization',
hidden : hide,
default : false,
onChange : onChangeUseFIFOSettings,
},
]
if (sd_device_info.peripheralType == "Type1" || sd_device_info.peripheralType == "Type2")
{
Settings = Settings.concat
(
[
{
name : "GROUP_SDSYNC_settings" + channel.toString() +"",
displayName : "SDSYNC feature Settings",
collapsed : false,
config :
[
{
name: "Ch" + channel.toString() + "_SDSYNC_source",
displayName : "Source of SDSYNC event",
description : 'Choose PWM source for SDSYNC event',
hidden : hide,
default : sd_device_info.SDFM_PWMSyncSource[0].name,
options : sd_device_info.SDFM_PWMSyncSource
},
{
name: "Ch" + channel.toString() + "_WTSYNCEN",
displayName : "Enable Wait For Sync feature?",
description : 'FIFO gets written on every data ready event (or) SDSYNC event',
hidden : hide,
default : false,
},
{
name: "Ch" + channel.toString() + "_WTSCLREN",
displayName : "Clear Wait for Sync flag manually?",
description : 'When enabled, wait for sync flag is manually cleared',
hidden : hide,
default : false,
},
]
},
{
name: "Ch" + channel.toString() + "_FIFO_Enable",
displayName : "Use FIFO",
description : 'Use FIFO',
hidden : hide,
default : false,
onChange : onChangeUseFIFOSettings,
},
{
name : "GROUP_FIFO_settings" + channel.toString() +"",
displayName : "FIFO Settings",
collapsed : false,
config :
[
{
name: "Ch" + channel.toString() + "_SDFFIL",
displayName : "SDFIFO interrupt level (SDFFIL)",
description : 'FIFO will generate interrupt when FIFO has more (or) equal contents than SDFFIL',
hidden : hide,
default : FIFO_LVL[0].name,
options : FIFO_LVL,
},
{
name: "Ch" + channel.toString() + "_FFSYNCCLREN",
displayName : "Clear FIFO on SDSYNC event?",
description : 'When enabled, SDSYNC event (from PWM) can be clear the FIFO',
hidden : hide,
default : false,
},
]
},
]
)
}
return(Settings);
}
// Data Filter settings //
exports =
{
datafilterSettings : datafilterSettings,
onChangeDataFilterEnable : onChangeDataFilterEnable,
}
@@ -0,0 +1,188 @@
let Common = system.getScript("/driverlib/Common.js");
let Pinmux = system.getScript("/driverlib/pinmux.js");
let useComparator = system.getScript("/driverlib/sdfm/modules/sd_comparatorFilter.js");
let useDatafilter = system.getScript("/driverlib/sdfm/modules/sd_DataFilter.js");
let sd_device_info = system.getScript("/driverlib/sdfm/sd_device_info.js");
let sd_definition = system.getScript("/driverlib/sdfm/sdfm_board_definition_c.js");
let device_driverlib_peripheral =
system.getScript("/driverlib/device_driverlib_peripherals/" +
Common.getDeviceName().toLowerCase() + "_sdfm.js");
var filterConfigs = [];
let density_1s = 0;
let Theoretical_Data_Filter = 0;
let Theoretical_Comparator_Filter = 0;
var hide = true;
// SDModulator settings //
function SDmodulatorSettings(channel)
{
var Settings = [];
density_1s = (inst) => {
var temp= (inst["Ch" + channel.toString() + "_DC_Input"] + inst["Ch" + channel.toString() + "_Vclipping"]) / (2 * inst["Ch" + channel.toString() + "_Vclipping"]);
return temp;}
Theoretical_Data_Filter = (inst) => {
var temp = Math.floor((Math.abs(inst["Ch" + channel.toString() + "_DC_Input"]) / inst["Ch" + channel.toString() + "_Vclipping"])*sd_definition.getShiftvalue(inst["Ch" + channel.toString() + "_FilterType_D"], inst["Ch" + channel.toString() + "_DOSR"], 0 , inst["Ch" + channel.toString() + "_DataFilter_Representation"]));
if(inst["Ch" + channel.toString() + "_DC_Input"] < 0)
{
temp = -1 * temp;
}
return temp;}
Theoretical_Comparator_Filter = (inst) => {
var temp = (inst["Ch" + channel.toString() + "_DC_Input"] + inst["Ch" + channel.toString() + "_Vclipping"]) / (2 * inst["Ch" + channel.toString() + "_Vclipping"]) * sd_definition.getShiftvalue(inst["Ch" + channel.toString() + "_FilterType"], inst["Ch" + channel.toString() + "_COSR"], 0 , "SDFM_DATA_FORMAT_32_BIT");
return temp;}
Settings =
[
{
name: "Ch" + channel.toString() + "_SD_modulatorFrequency",
displayName : "SD Modulator Frequency (MHz)",
description : 'Select SD Modulator Frequency in MHz',
hidden : hide,
default : 20,
},
{
name : "Ch" + channel.toString() + "_Vclipping",
displayName : "Differential clipping voltage (V)",
description : 'What is the full scale range of SD modulator',
hidden : hide,
default : 0.32,
},
{
name : "Ch" + channel.toString() + "_DC_Input",
displayName : "DC input to SD-modulator (V)",
description : 'What is the DC input to SD-modulator',
hidden : hide,
default : 0,
},
{
name : "Ch" + channel.toString() + "_bitstream_1s_density",
displayName : "Bitstream 1's density",
description : 'Density of 1s in SD modulated bitstream',
hidden : hide,
getValue : density_1s,
default : 0,
},
{
name : "Ch" + channel.toString() + "_Theoritical_DataFilterOutput",
displayName : "Theoritical Data filter Output",
description : 'Theoritical Data filter Output',
hidden : hide,
getValue : Theoretical_Data_Filter,
default : 0,
},
{
name : "Ch" + channel.toString() + "_Theoritical_ComparatorFilterOutput",
displayName : "Theoritical Comparator filter Output",
description : 'Theoritical Comparator filter Output',
hidden : hide,
getValue : Theoretical_Comparator_Filter,
default : 0,
},
]
return(Settings);
}
function fill_filter_array()
{
var cconfig =
[
{
name: "Ch" + channel.toString() + "_Mode",
displayName : "SD Modulator mode",
description : 'SD Modulator mode',
hidden : hide,
default : sd_device_info.SDFM_ModulatorClockMode[0].name,
options : sd_device_info.SDFM_ModulatorClockMode,
},
{
name: "Ch" + channel.toString() + "_DataFilterEnable",
displayName : "Enable Data Filter",
description : 'Enable / Disable Data Filter',
hidden : hide,
default : false,
onChange : useDatafilter.onChangeDataFilterEnable
},
]
if(sd_device_info.peripheralType == "Type1" || sd_device_info.peripheralType == "Type2")
{
cconfig = cconfig.concat([
{
name: "Ch" + channel.toString() + "_ComparatorEnable",
displayName : "Enable Comparator",
description : 'Enable Comparator',
hidden : hide,
default : false,
onChange : useComparator.onChangeComparatorEnable
},
])
}
cconfig = cconfig.concat([
{
name : "GROUP_ComparatorFilter",
displayName : "ComparatorFilter Settings",
config : useComparator.comparatorSettings(channel)
},
{
name : "GROUP_DataFilter",
displayName : "DataFilter Settings",
config : useDatafilter.datafilterSettings(channel)
},
{
name : "GROUP_SDMod",
displayName : "SD_modulator_Settings",
collapsed : false,
config : SDmodulatorSettings(channel)
},
])
return(cconfig);
}
for (var channel = 1; channel <= 4; channel++)
{
filterConfigs = filterConfigs.concat
(
[
{
name: "GROUP_FILTER" + channel.toString(),
displayName: "Filter" + channel.toString(),
description: "Configure Filter" + channel.toString(),
collapsed : true,
longDescription: "",
config: fill_filter_array(),
}
]
);
}
useComparator.onChangeComparatorEnable
useDatafilter.onChangeDataFilterEnable
var sdFilterConfigSubmodule =
{
displayName: "FILTER Configurations",
maxInstances: Common.peripheralCount("SD"),
defaultInstanceName: "SD_FILTER_CONFIG",
description: "Configure Comparator and Data filter",
config: filterConfigs,
templates:
{
boardc : "",
boardh : "",
},
};
exports = sdFilterConfigSubmodule;
@@ -0,0 +1,261 @@
let Common = system.getScript("/driverlib/Common.js");
let Pinmux = system.getScript("/driverlib/pinmux.js");
let useComparator = system.getScript("/driverlib/sdfm/modules/sd_comparatorFilter.js");
let useDatafilter = system.getScript("/driverlib/sdfm/modules/sd_DataFilter.js");
let sd_device_info = system.getScript("/driverlib/sdfm/sd_device_info.js");
let device_driverlib_peripheral =
system.getScript("/driverlib/device_driverlib_peripherals/" +
Common.getDeviceName().toLowerCase() + "_sdfm.js");
let CompEvent =
[
{ name: "CEVT1" , displayName: "Comparator event 1 interrupt" },
{ name: "CEVT2" , displayName: "Comparator event 2 interrupt" },
]
let IEL_IEHEvent =
[
{ name: "IEL" , displayName: "Low Threshold interrupt" },
{ name: "IEH" , displayName: "High Threshold interrupt" },
]
var temp1 = [];
var temp2 = [];
if (sd_device_info.peripheralType == "Type0" || sd_device_info.peripheralType == "Type1")
{
var temp1 = IEL_IEHEvent[0];
var temp2 = IEL_IEHEvent[1];
}
if (sd_device_info.peripheralType == "Type2")
{
var temp1 = CompEvent[0];
var temp2 = CompEvent[1];
}
var FilterNumber = [];
//var length = sd_device_info.SDFM_FilterNumber.length;
function onChangeUseInterrupts(inst, ui)
{
var status_use_int = inst.useInterrupts
var status_FIFO_EN = (inst.Ch1_FIFO_Enable || inst.Ch2_FIFO_Enable || inst.Ch3_FIFO_Enable || inst.Ch4_FIFO_Enable);
var status_compEN;
if(sd_device_info.peripheralType == "Type1" || sd_device_info.peripheralType == "Type2")
{
status_compEN = (inst.Ch1_ComparatorEnable || inst.Ch2_ComparatorEnable || inst.Ch3_ComparatorEnable || inst.Ch4_ComparatorEnable);
}
else
{
status_compEN = true;
}
ui.MFIE.hidden = !status_use_int;
ui.AE.hidden = !status_use_int;
if(sd_device_info.peripheralType == "Type0" || sd_device_info.peripheralType == "Type1")
{
ui.IEH.hidden = ((!status_use_int) || (!status_compEN));
ui.IEL.hidden = ((!status_use_int) || (!status_compEN));
}
if(sd_device_info.peripheralType == "Type2")
{
ui.CEVT1.hidden = ((!status_use_int) || (!status_compEN));
ui.CEVT2.hidden = ((!status_use_int) || (!status_compEN));
}
if(sd_device_info.peripheralType == "Type0")
{
// ui.SDFM_INT_RegisterInterrupts.hidden = (!status_use_int);
}
if(sd_device_info.peripheralType == "Type1" || sd_device_info.peripheralType == "Type2")
{
ui.SDFFINT.hidden = ((!status_FIFO_EN) || (!status_use_int));
ui.SDFFOVF.hidden = ((!status_FIFO_EN) || (!status_use_int));
// ui.SDFM_ERR_RegisterInterrupts.hidden = (!status_use_int);
// ui.SDFM_DR_RegisterInterrupts.hidden = (!status_use_int);
}
}
var interruptSettings_Type0 = [];
var intSettings = [];
if(sd_device_info.peripheralType == "Type0")
{
interruptSettings_Type0 = interruptSettings_Type0.concat
([
{
name : "MFIE",
displayName : "Modulator Clock failure",
description : 'Which interrupts to enabled.',
hidden : true,
default : [],
minSelections: 0,
options : sd_device_info.SDFM_FilterNumber,
},
{
name : temp1.name,
displayName : temp1.displayName,
description : 'Which interrupts to enabled.',
hidden : true,
default : [],
minSelections: 0,
options : sd_device_info.SDFM_FilterNumber,
},
{
name : temp2.name,
displayName : temp2.displayName,
description : 'Which interrupts to enabled.',
hidden : true,
default : [],
minSelections: 0,
options : sd_device_info.SDFM_FilterNumber,
},
{
name : "AE",
displayName : "Data Acknowledge",
description : 'Which interrupts to enabled.',
hidden : true,
default : [],
minSelections: 0,
options : sd_device_info.SDFM_FilterNumber,
},
])
intSettings = interruptSettings_Type0;
}
var interruptSettings_SDFM_INT = [];
var interruptSettings_SDFM_DR_INT = [];
if(sd_device_info.peripheralType == "Type1" || sd_device_info.peripheralType == "Type2")
{
interruptSettings_SDFM_INT = interruptSettings_SDFM_INT.concat([
{
name : "MFIE",
displayName : "Modulator Clock failure",
description : 'Which interrupts to enabled.',
hidden : true,
default : [],
minSelections: 0,
options : sd_device_info.SDFM_FilterNumber,
},
{
name : temp1.name,
displayName : temp1.displayName,
description : 'Which interrupts to enabled.',
hidden : true,
default : [],
minSelections: 0,
options : sd_device_info.SDFM_FilterNumber,
},
{
name : temp2.name,
displayName : temp2.displayName,
description : 'Which interrupts to enabled.',
hidden : true,
default : [],
minSelections: 0,
options : sd_device_info.SDFM_FilterNumber,
},
{
name : "SDFFOVF",
displayName : "FIFO Overflow error",
description : 'Which interrupts to enabled.',
hidden : true,
default : [],
minSelections: 0,
options : sd_device_info.SDFM_FilterNumber,
},
])
intSettings = interruptSettings_SDFM_INT;
interruptSettings_SDFM_DR_INT = interruptSettings_SDFM_DR_INT.concat([
{
name : "AE",
displayName : "Data Acknowledge",
description : 'Which interrupts to enabled.',
hidden : true,
default : [],
minSelections: 0,
options : sd_device_info.SDFM_FilterNumber,
},
{
name : "SDFFINT",
displayName : "SDFM FIFO Interrupt",
description : 'Which interrupts to enabled.',
hidden : true,
default : [],
minSelections: 0,
options : sd_device_info.SDFM_FilterNumber,
},
])
}
var interruptSettings = [];
interruptSettings =
[
{
name : "useInterrupts",
displayName : "Use SDFM interrupts",
description : 'Whether or not to use Interrupt mode.',
hidden : false,
default : false,
onChange : onChangeUseInterrupts,
},
{
name: "GROUP_SDFM_INT",
displayName: "SDFM interrupt",
description: "Configure SDFM interrupt",
collapsed : false,
longDescription: "",
config: intSettings,
},
{
name: "GROUP_SDFM_DR_INT",
displayName: "SDFM data ready interrupt",
description: "Configure SDFM data ready interrupt",
collapsed : false,
longDescription: "",
config: interruptSettings_SDFM_DR_INT,
},
]
var sdInterruptConfigSubmodule =
{
displayName: "Interrupt Configurations",
maxInstances: Common.peripheralCount("SD"),
defaultInstanceName: "_INTERRUPT_CONFIG",
description: "Select Interrupt source",
config: interruptSettings,
templates:
{
boardc : "",
boardh : "",
},
};
exports = sdInterruptConfigSubmodule
@@ -0,0 +1,94 @@
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() + "_sdfm.js");
let sd_device_info = system.getScript("/driverlib/sdfm/sd_device_info.js");
var ClockConfigs = [];
let Ch1_ClockSource =
[
{ name: "SDFM_CLK_SOURCE_SD1_CLK", displayName: "SD1 channel clock" },
]
let Ch2_ClockSource =
[
{ name: "SDFM_CLK_SOURCE_CHANNEL_CLK", displayName: "SD2 channel clock" },
{ name: "SDFM_CLK_SOURCE_SD1_CLK", displayName: "SD1 channel clock" },
]
let Ch3_ClockSource =
[
{ name: "SDFM_CLK_SOURCE_CHANNEL_CLK", displayName: "SD3 channel clock" },
{ name: "SDFM_CLK_SOURCE_SD1_CLK", displayName: "SD1 channel clock" },
]
let Ch4_ClockSource =
[
{ name: "SDFM_CLK_SOURCE_CHANNEL_CLK", displayName: "SD3 channel clock" },
{ name: "SDFM_CLK_SOURCE_SD1_CLK", displayName: "SD1 channel clock" },
]
var hide = true;
if (sd_device_info.peripheralType == "Type2")
{
ClockConfigs = ClockConfigs.concat
(
[
{
name: "Ch1_SDCLKSEL",
displayName : "Channel 1 SDCLK source",
description : "Channel 1 SDCLK source",
hidden : hide,
default : Ch1_ClockSource[0].name,
options : Ch1_ClockSource,
},
{
name: "Ch2_SDCLKSEL",
displayName : "Channel 2 SDCLK source",
description : "Channel 2 SDCLK source",
hidden : hide,
default : Ch2_ClockSource[0].name,
options : Ch2_ClockSource,
},
{
name: "Ch3_SDCLKSEL",
displayName : "Channel 3 SDCLK source",
description : "Channel 3 SDCLK source",
hidden : hide,
default : Ch3_ClockSource[0].name,
options : Ch3_ClockSource,
},
{
name: "Ch4_SDCLKSEL",
displayName : "Channel 4 SDCLK source",
description : "Channel 4 SDCLK source",
hidden : hide,
default : Ch4_ClockSource[0].name,
options : Ch4_ClockSource,
},
]
);
}
var sdClockConfigSubmodule =
{
displayName: "SDCLK Source Configuration",
maxInstances: Common.peripheralCount("SD"),
defaultInstanceName: "SDCLK_CLOCK_CONFIG",
description: "Select SDCLK for respective filter channels",
config: ClockConfigs,
templates:
{
boardc : "",
boardh : "",
},
};
exports =
{
ClockConfigs : ClockConfigs,
}
@@ -0,0 +1,365 @@
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() + "_sdfm.js");
let sd_device_info = system.getScript("/driverlib/sdfm/sd_device_info.js");
var HTLZ_Enable =
[
{name: "Enable" , value : "32768"},
{name: "Disable", value : "0"},
]
function onChangeComparatorEnable(inst, ui)
{
for (var channel = 1; channel <= 4; channel++)
{
var status;
if(sd_device_info.peripheralType == "Type1" || sd_device_info.peripheralType == "Type2")
{
status = inst["Ch" + channel.toString() + "_ComparatorEnable"];
}
else
{
status = inst["Use_FilterChannel_" + channel.toString()];
}
ui["Ch" + channel.toString() + "_FilterType"].hidden = !status;
ui["Ch" + channel.toString() + "_COSR"].hidden = !status;
ui["Ch" + channel.toString() + "_Datarate_CF"].hidden = !status;
ui["Ch" + channel.toString() + "_Latency_CF"].hidden = !status;
if (sd_device_info.peripheralType == "Type0" || sd_device_info.peripheralType == "Type1")
{
ui["Ch" + channel.toString() + "_HLT"].hidden = !status;
ui["Ch" + channel.toString() + "_LLT"].hidden = !status;
if(sd_device_info.peripheralType == "Type1")
{
ui["Ch" + channel.toString() + "_HLTZ_Enable"].hidden = !status;
ui["Ch" + channel.toString() + "_HLTZ"].hidden = !status;
}
}
if(sd_device_info.peripheralType == "Type2")
{
ui["Ch" + channel.toString() + "_HLT1"].hidden = !status;
ui["Ch" + channel.toString() + "_HLT2"].hidden = !status;
ui["Ch" + channel.toString() + "_HLTZ_Enable"].hidden = !status;
ui["Ch" + channel.toString() + "_HLTZ"].hidden = !status;
ui["Ch" + channel.toString() + "_LLT1"].hidden = !status;
ui["Ch" + channel.toString() + "_LLT2"].hidden = !status;
for(var event = 1; event<=2 ;event++)
{
ui["Ch" + channel.toString() + "_CEVT" + event.toString() + "_SourceSelect"].hidden = !status;
ui["Ch" + channel.toString() + "_Use_CEVT" + event.toString() + "_Digital_Filter"].hidden = !status;
}
}
}
var status_compEN;
var status_use_int = inst.useInterrupts;
if(sd_device_info.peripheralType == "Type1" || sd_device_info.peripheralType == "Type2")
{
status_compEN = (inst.Ch1_ComparatorEnable || inst.Ch2_ComparatorEnable || inst.Ch3_ComparatorEnable || inst.Ch4_ComparatorEnable);
}
else
{
status_compEN = true;
}
if(sd_device_info.peripheralType == "Type0" || sd_device_info.peripheralType == "Type1")
{
ui.IEH.hidden = ((!status_use_int) || (!status_compEN));
ui.IEL.hidden = ((!status_use_int) || (!status_compEN));
}
if(sd_device_info.peripheralType == "Type2")
{
ui.CEVT1.hidden = ((!status_use_int) || (!status_compEN));
ui.CEVT2.hidden = ((!status_use_int) || (!status_compEN));
}
}
function onChangeCEVT_Digital_filterSettings(inst, ui)
{
for (var channel = 1; channel <= 4; channel++)
{
for(var event = 1; event <= 2; event++)
{
var status = inst["Ch" + channel.toString() + "_Use_CEVT" + event.toString() + "_Digital_Filter"];
ui["Ch" + channel.toString() + "_InitFilterCEVT" + event.toString() +""].hidden = !status;
ui["Ch" + channel.toString() + "_SamplePrescale_CEVT" + event.toString() +""].hidden = !status;
ui["Ch" + channel.toString() + "_Threshold_CEVT" + event.toString() +""].hidden = !status;
ui["Ch" + channel.toString() + "_SampleWindow_CEVT" + event.toString() +""].hidden = !status;
}
}
}
var hide;
if (sd_device_info.peripheralType == "Type0")
{
hide = false; //Comparator settings not hidden when SDFM is Type 0
}
else
{
hide = true; //Comparator settings hidden when SDFM is Type 1 / 2 and get enabled only when Comparator is enabled
}
function iterate(item)
{
var settings = [];
for(var i = 0; i< item.length; i++)
{
settings = settings.concat((({ name, displayName }) => ({ name, displayName }))(item[i]));
//console.log((({ name, displayName }) => ({ name, displayName }))(item[i]));
}
return settings;
}
var Settings = [];
// Comparator Filter settings //
function comparatorSettings(channel)
{
var order = 0;
Settings =
[
{
name: "Ch" + channel.toString() + "_FilterType",
displayName : "FilterType",
description : 'Select FilterType for Comparator Filter',
hidden : hide,
default : iterate(sd_device_info.SDFM_FilterType)[3].name,
options : iterate(sd_device_info.SDFM_FilterType),
},
{
name: "Ch" + channel.toString() + "_COSR",
displayName : "COSR",
description : 'Select OSR for Comparator Filter (1 to 32)',
hidden : hide,
default : 32,
},
{
name : "Ch" + channel.toString() + "_Datarate_CF",
displayName : "Data rate (us)",
description : 'Data rate (Data filter) for given DOSR setting and SDmodulator rate',
hidden : hide,
getValue : (inst) => {
var datarate = inst["Ch" + channel.toString() + "_COSR"] / inst["Ch" + channel.toString() + "_SD_modulatorFrequency"];
return datarate;
},
default : 0,
},
{
name : "Ch" + channel.toString() + "_Latency_CF",
displayName : "Latency (us)",
description : 'Latency (or) settling time (Data filter) for given COSR setting and SDmodulator rate',
hidden : hide,
getValue : (inst) => {
if(inst["Ch" + channel.toString() + "_FilterType"] == "SDFM_FILTER_SINC_FAST" || inst["Ch" + channel.toString() + "_FilterType"] == "SDFM_FILTER_SINC_3")
{
order = 3;
}
if(inst["Ch" + channel.toString() + "_FilterType"] == "SDFM_FILTER_SINC_2")
{
order = 2;
}
if(inst["Ch" + channel.toString() + "_FilterType"] == "SDFM_FILTER_SINC_1")
{
order = 1;
}
var latency = order * inst["Ch" + channel.toString() + "_COSR"] / inst["Ch" + channel.toString() + "_SD_modulatorFrequency"];
return latency;
},
default : 0,
},
]
if (sd_device_info.peripheralType == "Type0" || sd_device_info.peripheralType == "Type1")
{
Settings = Settings.concat([
{
name: "Ch" + channel.toString() + "_HLT",
displayName : "High Level Threshold",
description : 'High Threshold Level (0 to 32767)',
hidden : hide,
default : 32767,
},
{
name: "Ch" + channel.toString() + "_LLT",
displayName : "Low Level Threshold",
description : 'Low Threshold Level (0 to 32767)',
hidden : hide,
default : "0",
},
])
}
if (sd_device_info.peripheralType == "Type1")
{
Settings = Settings.concat([
{
name: "Ch" + channel.toString() + "_HLTZ",
displayName : "High Level Threshold (Z)",
description : 'High Threshold Level (Z) (0 to 32767)',
hidden : hide,
default : "32767",
},
{
name: "Ch" + channel.toString() + "_HLTZ_Enable",
displayName : "Use High Threshold (Z)",
description : 'High Threshold Level Z (0 to 32767)',
hidden : hide,
default : false,
},
])
}
if (sd_device_info.peripheralType == "Type2")
{
Settings = Settings.concat
(
[
{
name: "Ch" + channel.toString() + "_HLT1",
displayName : "High Level Threshold 1",
description : 'High Threshold Level 1 (0 to 32767)',
hidden : hide,
default : "32767",
},
{
name: "Ch" + channel.toString() + "_HLT2",
displayName : "High Level Threshold 2",
description : 'High Threshold Level 2 (0 to 32767)',
hidden : hide,
default : "32767",
},
{
name: "Ch" + channel.toString() + "_HLTZ_Enable",
displayName : "Use High Threshold (Z)",
description : 'High Threshold Level Z (0 to 32767)',
hidden : hide,
default : false,
},
{
name: "Ch" + channel.toString() + "_HLTZ",
displayName : "High Level Threshold (Z)",
description : 'High Threshold Level (Z) (0 to 32767)',
hidden : hide,
default : "32767",
},
{
name: "Ch" + channel.toString() + "_LLT1",
displayName : "Low Level Threshold 1",
description : 'Low Threshold Level 1 (0 to 32767)',
hidden : hide,
default : "0",
},
{
name: "Ch" + channel.toString() + "_LLT2",
displayName : "Low Level Threshold 2",
description : 'Low Threshold Level 2 (0 to 32767)',
hidden : hide,
default : "0",
},
]
)
for(var event = 1; event <= 2; event++)
{
var eventSource;
if(event == 1)
{
eventSource = sd_device_info.SDFM_CompEvent1Source;
}
if(event == 2)
{
eventSource = sd_device_info.SDFM_CompEvent2Source;
}
Settings = Settings.concat
(
[
{
name: "Ch" + channel.toString() + "_CEVT" + event.toString() + "_SourceSelect",
displayName : "Comparator Event" + event.toString() + " SourceSelect",
description : "Select Comparator Event" + event.toString(),
hidden : hide,
default : eventSource[0].name,
options : eventSource,
},
{
name: "Ch" + channel.toString() + "_Use_CEVT" + event.toString() + "_Digital_Filter",
displayName : "Use CEVT" + event.toString() + " Digital Filter",
description : "Use CEVT" + event.toString() + " Digital Filter",
hidden : hide,
default : false,
onChange : onChangeCEVT_Digital_filterSettings,
},
{
name : "GROUP" + event.toString() + "_CEVT_Digital Filter" + channel.toString() +"",
displayName : "CEVT" + event.toString() + " Digital Filter settings",
collapsed : false,
config :
[
{
name : "Ch" + channel.toString() + "_InitFilterCEVT" + event.toString() + "",
displayName : "Initialize Digital Filter (CEVT" + event.toString() + ")",
description : "Initialize Digital Filter (CEVT" + event.toString() + ")",
hidden : hide,
default : true
},
{
name : "Ch" + channel.toString() + "_SamplePrescale_CEVT" + event.toString() + "",
displayName : "CEVT" + event.toString() + " Prescale",
description : 'The number of system clock cycles between samples.',
hidden : hide,
default : 0
},
{
name : "Ch" + channel.toString() + "_Threshold_CEVT" + event.toString() + "",
displayName : "CEVT" + event.toString() + " Threshold",
description : 'The number of FIFO samples to monitor.',
hidden : hide,
default : 0
},
{
name : "Ch" + channel.toString() + "_SampleWindow_CEVT" + event.toString() + "",
displayName : "CEVT" + event.toString() + " Sample Window",
description : 'The number of FIFO samples to monitor.',
hidden : hide,
default : 0
},
]
},
]
)
}
}
return(Settings);
}
// Comparator Filter settings //
exports =
{
comparatorSettings : comparatorSettings,
onChangeComparatorEnable : onChangeComparatorEnable,
}
@@ -0,0 +1,133 @@
function onValidate(inst, validation)
{
for (var channel = 1; channel <= 4; channel++)
{
var dc_input = inst["Ch" + channel.toString() + "_DC_Input"];
var FSR = inst["Ch" + channel.toString() + "_FSR"];
if(dc_input > FSR)
{
validation.logError(
"DC input is outside full scale range of modulator_" + inst[$name] + channel + " DC input = " + dc_input,
inst);
}
var cosr = inst["Ch" + channel.toString() + "_COSR"];
if(cosr < 0 || cosr > 32)
{
validation.logError(
"COSR should be between 1 to 32! - Check Filter_" + inst[$name] + channel + " COSR = " + cosr,
inst);
}
var dosr = inst["Ch" + channel.toString() + "_DOSR"];
if(dosr < 0 || dosr > 256)
{
validation.logError(
"dosr should be between 1 to 256! - Check Filter_" + channel + " DOSR = " + dosr,
inst);
}
var HLT1 = inst["Ch" + channel.toString() + "_HLT1"];
if(HLT1 < 0 || HLT1 > 32767)
{
validation.logError(
"HLT1 should be between 0 to 32767! - Check Filter_" + channel + " HLT1 = " + HLT1,
inst);
}
var HLT2 = inst["Ch" + channel.toString() + "_HLT2"];
if(HLT2 < 0 || HLT2 > 32767)
{
validation.logError(
"HLT2 should be between 0 to 32767! - Check Filter_" + channel + " HLT2 = " + HLT2,
inst);
}
var HLT = inst["Ch" + channel.toString() + "_HLT"];
if(HLT < 0 || HLT > 32767)
{
validation.logError(
"HLT should be between 0 to 32767! - Check Filter_" + channel + " HLT = " + HLT,
inst);
}
var HLTZ = inst["Ch" + channel.toString() + "_HLTZ"];
if(HLTZ < 0 || HLTZ > 32767)
{
validation.logError(
"HLTZ should be between 0 to 32767! - Check Filter_" + channel + " HLTZ = " + HLTZ,
inst);
}
var LLT1 = inst["Ch" + channel.toString() + "_LLT1"];
if(LLT1 < 0 || LLT1 > 32767)
{
validation.logError(
"LLT1 should be between 0 to 32767! - Check Filter_" + channel + " LLT1 = " + LLT1,
inst);
}
var LLT2 = inst["Ch" + channel.toString() + "_LLT2"];
if(LLT2 < 0 || LLT2 > 32767)
{
validation.logError(
"LLT2 should be between 0 to 32767! - Check Filter_" + channel + " LLT2 = " + LLT2,
inst);
}
var LLT = inst["Ch" + channel.toString() + "_LLT"];
if(LLT < 0 || LLT > 32767)
{
validation.logError(
"LLT should be between 0 to 32767! - Check Filter_" + channel + " LLT = " + LLT,
inst);
}
for(var event = 1; event <= 2; event++)
{
var Prescale_CEVT = inst["Ch" + channel.toString() + "_samplePrescale_CEVT" + event.toString()];
if(Prescale_CEVT < 0 || Prescale_CEVT > 1023)
{
validation.logError(
"Comparator event Prescale should be between 0 to 1023! - Check Filter_" + channel + " CEVT" + event.toString() + "Prescale = " + Prescale_CEVT,
inst);
}
var threshold_CEVT = inst["Ch" + channel.toString() + "_Threshold_CEVT" + event.toString()];
if(threshold_CEVT < 0 || threshold_CEVT > 31)
{
validation.logError(
"Comparator event Threshold should be between 0 to 31! - Check Filter_" + channel + " CEVT" + event.toString() + "Threshold = " + threshold_CEVT,
inst);
}
var sampleWindow_CEVT = inst["Ch" + channel.toString() + "_sampleWindow_CEVT" + event.toString()];
if(sampleWindow_CEVT < 0 || sampleWindow_CEVT > 31)
{
validation.logError(
"Comparator event samplewindow should be between 0 to 31! - Check Filter_" + channel + " CEVT" + event.toString() + "sample window = " + sampleWindow_CEVT,
inst);
}
}
}
}
exports =
{
onValidate : onValidate,
}