Pull request #90: am64x/am243x: SDFM: add syscfg module
Merge in PINDSW/motor_control_sdk from a0502729_PINDSW-7102_sdfm_add_syscfg_module to next * commit 'c4246dd4b937c1a3e454e3e0a9c36f17ba0153e6': am243x/am64x: PWM: Add syscfg module am64x/am243x: SDFM: add syscfg module
This commit is contained in:
commit
e751569925
121
source/.meta/current_sense/sdfm.syscfg.js
Normal file
121
source/.meta/current_sense/sdfm.syscfg.js
Normal file
@ -0,0 +1,121 @@
|
||||
let common = system.getScript("/common");
|
||||
let sdfm_pins = system.getScript("/current_sense/sdfm_pins.js");
|
||||
let device = common.getDeviceName();
|
||||
|
||||
let sdfm_module_name = "/current_sense/sdfm";
|
||||
|
||||
|
||||
let sdfm_module = {
|
||||
displayName: "SDFM",
|
||||
templates: {
|
||||
"/drivers/system/system_config.h.xdt": {
|
||||
driver_config:"/.meta/current_sense/templates/sdfm_template.h.xdt",
|
||||
moduleName: sdfm_module_name,
|
||||
},
|
||||
"/drivers/pinmux/pinmux_config.c.xdt": {
|
||||
moduleName: sdfm_module_name,
|
||||
},
|
||||
},
|
||||
defaultInstanceName: "CONFIG_SDFM",
|
||||
config: [
|
||||
{
|
||||
name: "instance",
|
||||
displayName: "Instance",
|
||||
default: "ICSSG0",
|
||||
options: [
|
||||
{
|
||||
name: "ICSSG0",
|
||||
},
|
||||
{
|
||||
name: "ICSSG1",
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Channel_0",
|
||||
displayName: "Enable Channel 0",
|
||||
description: "Channel 0 Selection",
|
||||
default: true,
|
||||
},
|
||||
{
|
||||
name: "Channel_1",
|
||||
displayName: "Enable Channel 1",
|
||||
description: "Channel 1 Selection ",
|
||||
default: true,
|
||||
},
|
||||
{
|
||||
name: "Channel_2",
|
||||
displayName: "Enable Channel 2",
|
||||
description: "Channel 2 Selection ",
|
||||
default: true,
|
||||
},
|
||||
|
||||
{
|
||||
name: "Channel_3",
|
||||
displayName: "Enable Channel 3",
|
||||
description: "Channel 3 Selection",
|
||||
default: false,
|
||||
},
|
||||
{
|
||||
name: "Channel_4",
|
||||
displayName: "Enable Channel 4",
|
||||
description: "Channel 4 Selection ",
|
||||
default: false,
|
||||
},
|
||||
{
|
||||
name: "Channel_5",
|
||||
displayName: "Enable Channel 5",
|
||||
description: "Channel 5 Selection ",
|
||||
default: false,
|
||||
},
|
||||
{
|
||||
name: "Channel_6",
|
||||
displayName: "Enable Channel 6",
|
||||
description: "Channel 6 Selection",
|
||||
default: false,
|
||||
},
|
||||
{
|
||||
name: "Channel_7",
|
||||
displayName: "Enable Channel 7",
|
||||
description: "Channel 7 Selection ",
|
||||
default: false,
|
||||
},
|
||||
{
|
||||
name: "Channel_8",
|
||||
displayName: "Enable Channel 8",
|
||||
description: "Channel 8 Selection ",
|
||||
default: false,
|
||||
},
|
||||
|
||||
],
|
||||
moduleStatic: {
|
||||
modules: function(inst) {
|
||||
return [{
|
||||
name: "system_common",
|
||||
moduleName: "/system_common",
|
||||
}]
|
||||
},
|
||||
},
|
||||
pinmuxRequirements: sdfm_pins.pinmuxRequirements,
|
||||
getInterfaceName: sdfm_pins.getInterfaceName,
|
||||
getPeripheralPinNames: sdfm_pins.getPeripheralPinNames,
|
||||
sharedModuleInstances: sharedModuleInstances,
|
||||
|
||||
};
|
||||
|
||||
function sharedModuleInstances(instance) {
|
||||
let modInstances = new Array();
|
||||
|
||||
modInstances.push({
|
||||
name: "pru",
|
||||
displayName: "PRU ICSS Configuration",
|
||||
moduleName: '/drivers/pruicss/pruicss',
|
||||
requiredArgs: {
|
||||
instance: instance.instance,
|
||||
|
||||
},
|
||||
});
|
||||
return (modInstances);
|
||||
}
|
||||
|
||||
exports = sdfm_module;
|
||||
175
source/.meta/current_sense/sdfm_pins.js
Normal file
175
source/.meta/current_sense/sdfm_pins.js
Normal file
@ -0,0 +1,175 @@
|
||||
let common = system.getScript("/common");
|
||||
let pinmux = system.getScript("/drivers/pinmux/pinmux");
|
||||
|
||||
|
||||
function getInterfaceName(inst)
|
||||
{
|
||||
return `PRU_${inst.instance}_PRU`;
|
||||
}
|
||||
|
||||
function getInterfacePinList(inst)
|
||||
{
|
||||
let pinList = [];
|
||||
|
||||
/*SDFM SD8_CLK clock*/
|
||||
pinList.push({ pinName: "GPI16", displayName: "SD_CLK8", rx: true});
|
||||
|
||||
/*SD0_D*/
|
||||
pinList.push({ pinName: "GPI1", displayName: "SD_CHANNEL0_DATA", rx: true});
|
||||
|
||||
/*SD1_D*/
|
||||
pinList.push({ pinName: "GPI3", displayName: "SD_CHANNEL1_DATA", rx: true});
|
||||
|
||||
/*SD2_D*/
|
||||
pinList.push({ pinName: "GPI5", displayName: "SD_CHANNEL2_DATA", rx: true});
|
||||
|
||||
/*SD3_D*/
|
||||
pinList.push({ pinName: "GPI7", displayName: "SD_CHANNEL3_DATA", rx: true});
|
||||
|
||||
/*SD4_D*/
|
||||
pinList.push({ pinName: "GPI18", displayName: "SD_CHANNEL4_DATA", rx: true});
|
||||
|
||||
/*SD5_D*/
|
||||
pinList.push({ pinName: "GPI11", displayName: "SD_CHANNEL5_DATA", rx: true});
|
||||
|
||||
/*SD6_D*/
|
||||
pinList.push({ pinName: "GPI13", displayName: "SD_CHANNEL6_DATA", rx: true});
|
||||
|
||||
/*SD7_D*/
|
||||
pinList.push({ pinName: "GPI15", displayName: "SD_CHANNEL7_DATA", rx: true});
|
||||
|
||||
/*SD8_D*/
|
||||
pinList.push({ pinName: "GPI17", displayName: "SD_CHANNEL8_DATA", rx: true});
|
||||
|
||||
return pinList;
|
||||
}
|
||||
|
||||
function pinmuxRequirements(inst) {
|
||||
|
||||
let interfaceName = getInterfaceName(inst);
|
||||
let pinList = getInterfacePinList(inst);
|
||||
let resources = [];
|
||||
|
||||
for(let pin of pinList)
|
||||
{
|
||||
let pinResource = pinmux.getPinRequirements(interfaceName, pin.pinName, pin.displayName);
|
||||
|
||||
pinmux.setConfigurableDefault( pinResource, "rx", pin.rx );
|
||||
|
||||
if(inst["Channel_0"] == true){
|
||||
if((pin.pinName == "GPI1")){
|
||||
pinResource.used = true;
|
||||
}
|
||||
}else{
|
||||
if( (pin.pinName == "GPI1")){
|
||||
pinResource.used = false;
|
||||
}
|
||||
}
|
||||
if(inst["Channel_1"] == true){
|
||||
if((pin.pinName == "GPI3")){
|
||||
pinResource.used = true;
|
||||
}
|
||||
}else{
|
||||
if( (pin.pinName == "GPI3")){
|
||||
pinResource.used = false;
|
||||
}
|
||||
}
|
||||
if(inst["Channel_2"]==true){
|
||||
if((pin.pinName == "GPI5")){
|
||||
pinResource.used = true;
|
||||
}
|
||||
}else{
|
||||
if( (pin.pinName == "GPI5")){
|
||||
pinResource.used = false;
|
||||
}
|
||||
}
|
||||
if(inst["Channel_3"]==true){
|
||||
if((pin.pinName == "GPI7")){
|
||||
pinResource.used = true;
|
||||
}
|
||||
}else{
|
||||
if( (pin.pinName == "GPI7")){
|
||||
pinResource.used = false;
|
||||
}
|
||||
}
|
||||
if(inst["Channel_4"]==true){
|
||||
if((pin.pinName == "GPI18")){
|
||||
pinResource.used = true;
|
||||
}
|
||||
}else{
|
||||
if( (pin.pinName == "GPI18")){
|
||||
pinResource.used = false;
|
||||
}
|
||||
}
|
||||
if(inst["Channel_5"]==true){
|
||||
if((pin.pinName == "GPI11")){
|
||||
pinResource.used = true;
|
||||
}
|
||||
}else{
|
||||
if( (pin.pinName == "GPI11")){
|
||||
pinResource.used = false;
|
||||
}
|
||||
}
|
||||
if(inst["Channel_6"]==true){
|
||||
if((pin.pinName == "GPI13")){
|
||||
pinResource.used = true;
|
||||
}
|
||||
}else{
|
||||
if( (pin.pinName == "GPI13")){
|
||||
pinResource.used = false;
|
||||
}
|
||||
}
|
||||
if(inst["Channel_7"]==true){
|
||||
if((pin.pinName == "GPI15")){
|
||||
pinResource.used = true;
|
||||
}
|
||||
}else{
|
||||
if( (pin.pinName == "GPI15")){
|
||||
pinResource.used = false;
|
||||
}
|
||||
}
|
||||
if(inst["Channel_8"]==true){
|
||||
if((pin.pinName == "GPI17")){
|
||||
pinResource.used = true;
|
||||
}
|
||||
}else{
|
||||
if( (pin.pinName == "GPI17")){
|
||||
pinResource.used = false;
|
||||
}
|
||||
}
|
||||
|
||||
resources.push( pinResource );
|
||||
}
|
||||
|
||||
let peripheralRequirements = {
|
||||
name: interfaceName,
|
||||
displayName: interfaceName,
|
||||
interfaceName: interfaceName,
|
||||
resources: resources,
|
||||
};
|
||||
|
||||
return [peripheralRequirements];
|
||||
}
|
||||
|
||||
function getPeripheralPinNames(inst)
|
||||
{
|
||||
let pinList = [];
|
||||
let pinNameList = [];
|
||||
|
||||
pinList = getInterfacePinList(inst);
|
||||
|
||||
for(let pin of pinList)
|
||||
{
|
||||
pinNameList.push( pin.pinName );
|
||||
}
|
||||
|
||||
return pinNameList;
|
||||
}
|
||||
|
||||
|
||||
exports = {
|
||||
|
||||
pinmuxRequirements,
|
||||
getInterfaceName,
|
||||
getPeripheralPinNames,
|
||||
};
|
||||
41
source/.meta/current_sense/templates/sdfm_template.h.xdt
Normal file
41
source/.meta/current_sense/templates/sdfm_template.h.xdt
Normal file
@ -0,0 +1,41 @@
|
||||
%%{
|
||||
let module = system.modules[args[0]];
|
||||
%%}
|
||||
/*
|
||||
* SDFM
|
||||
*/
|
||||
|
||||
/* SDFM Instance Macros */
|
||||
#define CONFIG_SDFM_NUM_INSTANCES `module.$instances.length`
|
||||
%for(let i = 0; i < module.$instances.length; i++) {
|
||||
% let instance = module.$instances[i];
|
||||
% let Slice = 0 ;
|
||||
%if(instance.instance === "ICSSG1")
|
||||
%{
|
||||
% if(instance.PRU_ICSSG1_PRU.$assign === "PRU_ICSSG1_PRU1")
|
||||
%{
|
||||
% Slice = 1;
|
||||
%}
|
||||
|
||||
%}
|
||||
%else
|
||||
%{
|
||||
%if(instance.PRU_ICSSG0_PRU.$assign === "PRU_ICSSG0_PRU1")
|
||||
%{
|
||||
% Slice = 1;
|
||||
%}
|
||||
|
||||
%}
|
||||
|
||||
#define `instance.$name` `i`
|
||||
#define `instance.$name`_CHANNEL0 `instance.Channel_0 & 1`
|
||||
#define `instance.$name`_CHANNEL1 `instance.Channel_1 & 1`
|
||||
#define `instance.$name`_CHANNEL2 `instance.Channel_2 & 1`
|
||||
#define `instance.$name`_CHANNEL3 `instance.Channel_3 & 1`
|
||||
#define `instance.$name`_CHANNEL4 `instance.Channel_4 & 1`
|
||||
#define `instance.$name`_CHANNEL5 `instance.Channel_5 & 1`
|
||||
#define `instance.$name`_CHANNEL6 `instance.Channel_6 & 1`
|
||||
#define `instance.$name`_CHANNEL7 `instance.Channel_7 & 1`
|
||||
#define `instance.$name`_CHANNEL8 `instance.Channel_8 & 1`
|
||||
#define `instance.$name`_SLICE `Slice`
|
||||
% }
|
||||
105
source/.meta/pru_icssg/pwm.syscfg.js
Normal file
105
source/.meta/pru_icssg/pwm.syscfg.js
Normal file
@ -0,0 +1,105 @@
|
||||
let common = system.getScript("/common");
|
||||
let pinmux = system.getScript("/drivers/pinmux/pinmux");
|
||||
|
||||
function getInterfaceName(inst, peripheralName)
|
||||
{
|
||||
return `PRU_${inst.instance}_${peripheralName}`;
|
||||
}
|
||||
|
||||
function getInterfacePinList(inst, peripheralName)
|
||||
{
|
||||
let interfaceName = getInterfaceName(inst, peripheralName);
|
||||
let pinList = [];
|
||||
|
||||
pinList = pinmux.getInterfacePinList(interfaceName);
|
||||
|
||||
return pinList;
|
||||
}
|
||||
|
||||
function getPeripheralRequirements(inst, peripheralName)
|
||||
{
|
||||
let interfaceName = getInterfaceName(inst, peripheralName);
|
||||
let pinList = getInterfacePinList(inst, peripheralName);
|
||||
let resources = [];
|
||||
|
||||
for(let pin of pinList)
|
||||
{
|
||||
let pinResource = pinmux.getPinRequirements(interfaceName, pin);
|
||||
|
||||
/* make all pins as "rx" and then override to make "rx" as false as needed */
|
||||
pinmux.setConfigurableDefault( pinResource, "rx", false );
|
||||
|
||||
/* Disable all the pins. */
|
||||
pinResource.used=false;
|
||||
|
||||
resources.push( pinResource );
|
||||
}
|
||||
|
||||
let peripheralRequirements = {
|
||||
name: interfaceName,
|
||||
displayName: interfaceName,
|
||||
interfaceName: interfaceName,
|
||||
resources: resources,
|
||||
};
|
||||
|
||||
return peripheralRequirements;
|
||||
}
|
||||
|
||||
function pinmuxRequirements(inst) {
|
||||
|
||||
let pwm = getPeripheralRequirements(inst, "PWM");
|
||||
return [pwm];
|
||||
}
|
||||
|
||||
function getInterfaceNameList(inst) {
|
||||
|
||||
return [
|
||||
getInterfaceName(inst, "PWM"),
|
||||
];
|
||||
}
|
||||
|
||||
function getPeripheralPinNames(inst)
|
||||
{
|
||||
let pinList = [];
|
||||
|
||||
pinList = pinList.concat(getInterfacePinList(inst, "PWM"));
|
||||
return pinList;
|
||||
}
|
||||
|
||||
let pruicss_top_module_name = "/pru_icssg/pwm";
|
||||
|
||||
let pruicss_top_module = {
|
||||
displayName: "PRU (ICSS) PWM",
|
||||
|
||||
templates: {
|
||||
"/drivers/pinmux/pinmux_config.c.xdt": {
|
||||
moduleName: pruicss_top_module_name,
|
||||
},
|
||||
},
|
||||
|
||||
defaultInstanceName: "CONFIG_PRU_ICSS_PWM",
|
||||
config: [
|
||||
{
|
||||
name: "instance",
|
||||
displayName: "Instance",
|
||||
default: "ICSSG0",
|
||||
options: [
|
||||
{
|
||||
name: "ICSSG0",
|
||||
},
|
||||
{
|
||||
name: "ICSSG1",
|
||||
}
|
||||
],
|
||||
},
|
||||
],
|
||||
pinmuxRequirements,
|
||||
getInterfaceNameList,
|
||||
getPeripheralPinNames,
|
||||
};
|
||||
|
||||
function validate(inst, report) {
|
||||
common.validate.checkSameInstanceName(inst, report);
|
||||
}
|
||||
|
||||
exports = pruicss_top_module;
|
||||
@ -6,6 +6,8 @@ const topModules_main = [
|
||||
"/position_sense/hdsl",
|
||||
"/position_sense/tamagawa",
|
||||
"/position_sense/bissc",
|
||||
"/current_sense/sdfm",
|
||||
"/pru_icssg/pwm",
|
||||
|
||||
];
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user