am243x/am64x: PWM: Add syscfg module
- Add PWM syscfg module in motor control section Fixes: PINDSW-7102 Signed-off-by: Achala Ram <a-ram@ti.com>
This commit is contained in:
parent
0a4b4cf5ef
commit
c4246dd4b9
@ -1,19 +1,9 @@
|
|||||||
let common = system.getScript("/common");
|
let common = system.getScript("/common");
|
||||||
let sdfm_pins = system.getScript("/current_sense/sdfm_pins.js");
|
let sdfm_pins = system.getScript("/current_sense/sdfm_pins.js");
|
||||||
let device = common.getDeviceName();
|
let device = common.getDeviceName();
|
||||||
let is_am243x_lp_device = (device === "am243x-lp") ? true : false;
|
|
||||||
|
|
||||||
let sdfm_module_name = "/current_sense/sdfm";
|
let sdfm_module_name = "/current_sense/sdfm";
|
||||||
|
|
||||||
/*function onValidate(inst, validation) {
|
|
||||||
for (let instance_index in inst.$module.$instances)
|
|
||||||
{
|
|
||||||
let instance = inst.$module.$instances[instance_index];
|
|
||||||
//if ((!instance.channel_0)&&(!instance.channel_1)&&(!instance.channel_2)&&(!instance.channel_3)&&(!instance.channel_4)&&(!instance.channel_5)&&(!instance.channel_6)&&(!instance.channel_7)&&(!instance.channel_8))
|
|
||||||
// validation.logError("Select atleast one channel",inst,"channel_0"
|
|
||||||
//)
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
let sdfm_module = {
|
let sdfm_module = {
|
||||||
displayName: "SDFM",
|
displayName: "SDFM",
|
||||||
@ -110,7 +100,6 @@ let sdfm_module = {
|
|||||||
getInterfaceName: sdfm_pins.getInterfaceName,
|
getInterfaceName: sdfm_pins.getInterfaceName,
|
||||||
getPeripheralPinNames: sdfm_pins.getPeripheralPinNames,
|
getPeripheralPinNames: sdfm_pins.getPeripheralPinNames,
|
||||||
sharedModuleInstances: sharedModuleInstances,
|
sharedModuleInstances: sharedModuleInstances,
|
||||||
/*validate: onValidate,*/
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -37,5 +37,5 @@
|
|||||||
#define `instance.$name`_CHANNEL6 `instance.Channel_6 & 1`
|
#define `instance.$name`_CHANNEL6 `instance.Channel_6 & 1`
|
||||||
#define `instance.$name`_CHANNEL7 `instance.Channel_7 & 1`
|
#define `instance.$name`_CHANNEL7 `instance.Channel_7 & 1`
|
||||||
#define `instance.$name`_CHANNEL8 `instance.Channel_8 & 1`
|
#define `instance.$name`_CHANNEL8 `instance.Channel_8 & 1`
|
||||||
#define PRU_ICSSGx_PRU_SLICE `Slice`
|
#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;
|
||||||
@ -7,6 +7,7 @@ const topModules_main = [
|
|||||||
"/position_sense/tamagawa",
|
"/position_sense/tamagawa",
|
||||||
"/position_sense/bissc",
|
"/position_sense/bissc",
|
||||||
"/current_sense/sdfm",
|
"/current_sense/sdfm",
|
||||||
|
"/pru_icssg/pwm",
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user