/**
 * These arguments were used when this file was generated. They will be automatically applied on subsequent loads
 * via the GUI or CLI. Run CLI with '--help' for additional information on how to override these arguments.
 * @cliArgs --device "F280015x" --part "F280015x_80PN" --package "80PN" --context "system" --product "C2000WARE@5.04.00.00"
 * @v2CliArgs --device "TMS320F2800154-Q1" --package "80PN" --context "system" --product "C2000WARE@5.04.00.00"
 * @versions {"tool":"1.24.0+4110"}
 */

/**
 * Import the modules used in this configuration.
 */
const device_support = scripting.addModule("/driverlib/device_support.js");
const epwm           = scripting.addModule("/driverlib/epwm.js", {}, false);
const epwm1          = epwm.addInstance();
const gpio           = scripting.addModule("/driverlib/gpio.js", {}, false);
const gpio1          = gpio.addInstance();
const sysctl         = scripting.addModule("/driverlib/sysctl.js");
const CMD            = scripting.addModule("/utilities/cmd_tool/cmd_syscfg/source/CMD");
const CMD1           = CMD.addInstance();
const CMD2           = CMD.addInstance();

/**
 * Write custom configuration values to the imported modules.
 */
epwm1.$name                                                    = "myEPWM0";
epwm1.epwmTimebase_hsClockDiv                                  = "EPWM_HSCLOCK_DIVIDER_1";
epwm1.epwmTimebase_period                                      = 25000;
epwm1.epwmTimebase_counterMode                                 = "EPWM_COUNTER_MODE_UP_DOWN";
epwm1.epwmEventTrigger_enableInterrupt                         = true;
epwm1.epwmEventTrigger_interruptSource                         = "EPWM_INT_TBCTR_U_CMPA";
epwm1.epwmEventTrigger_registerInterrupts                      = true;
epwm1.epwmEventTrigger_interruptEventCount                     = "1";
epwm1.epwmActionQualifier_EPWM_AQ_OUTPUT_A_ON_TIMEBASE_UP_CMPA = "EPWM_AQ_OUTPUT_TOGGLE";
epwm1.epwmActionQualifier_EPWM_AQ_OUTPUT_B_ON_TIMEBASE_UP_CMPA = "EPWM_AQ_OUTPUT_TOGGLE";
epwm1.epwm.epwm_aPin.$assign                                   = "GPIO0";
epwm1.epwm.epwm_bPin.$assign                                   = "GPIO1";
epwm1.epwmInt.enableInterrupt                                  = true;

gpio1.$name             = "myGPIO0";
gpio1.writeInitialValue = true;
gpio1.direction         = "GPIO_DIR_MODE_OUT";
gpio1.gpioPin.$assign   = "GPIO3";

CMD1.$name                    = "generic_ram_lnk";
CMD1.sectionMemory_text       = ["RAMLS0","RAMLS1"];
CMD1.sectionMemory_ramfunc    = ["RAMM0"];
CMD1.sectionMemory_cinit      = ["RAMM0"];
CMD1.sectionMemory_stack      = ["RAMM1"];
CMD1.sectionMemory_init_array = ["RAMM0"];
CMD1.sectionMemory_bss        = ["RAMLS0"];
CMD1.sectionMemory_const      = ["RAMLS0"];
CMD1.sectionMemory_data       = ["RAMLS0"];
CMD1.sectionMemory_switch     = ["RAMM0"];
CMD1.sectionMemory_sysmem     = ["RAMLS0"];

CMD2.$name                               = "generic_flash_lnk";
CMD2.sectionAlignEnable_ramfunc          = true;
CMD2.sectionAlignEnable_text             = true;
CMD2.sectionAlignEnable_binit            = true;
CMD2.sectionAlignEnable_cinit            = true;
CMD2.sectionAlignEnable_switch           = true;
CMD2.sectionAlignEnable_init_array       = true;
CMD2.sectionAlignEnable_const            = true;
CMD2.sectionAlignEnable_ovly             = true;
CMD2.sectionMemory_codestart             = "0x080000";
CMD2.sectionMemory_stack                 = ["RAMM1"];
CMD2.sectionMemory_ramfunc               = ["FLASH_BANK0_SEC_0_7"];
CMD2.sectionMemory_text                  = ["FLASH_BANK0_SEC_16_23","FLASH_BANK0_SEC_24_31","FLASH_BANK0_SEC_8_15"];
CMD2.sectionMemory_binit                 = ["FLASH_BANK0_SEC_0_7"];
CMD2.sectionMemory_cinit                 = ["FLASH_BANK0_SEC_0_7"];
CMD2.sectionMemory_switch                = ["FLASH_BANK0_SEC_0_7"];
CMD2.sectionMemory_bss                   = ["RAMLS0"];
CMD2.sectionMemory_init_array            = ["FLASH_BANK0_SEC_0_7"];
CMD2.sectionMemory_const                 = ["FLASH_BANK0_SEC_32_29"];
CMD2.sectionMemory_data                  = ["RAMLS0"];
CMD2.sectionMemory_sysmem                = ["RAMLS0"];
CMD2.sectionMemory_ovly                  = ["FLASH_BANK0_SEC_0_7"];
CMD2.sectionRunFromDifferentAddr_ramfunc = true;
CMD2.sectionRun_ramfunc                  = ["RAMLS0"];
CMD2.sectionBinit_ramfunc                = false;

/**
 * Pinmux solution for unlocked pins/peripherals. This ensures that minor changes to the automatic solver in a future
 * version of the tool will not impact the pinmux you originally saw.  These lines can be completely deleted in order to
 * re-solve from scratch.
 */
epwm1.epwm.$suggestSolution = "EPWM1";
