/**
 * 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 "AM243x_ALX_beta" --package "ALX" --part "ALX" --context "r5fss0-0" --product "MCU_PLUS_SDK@07.03.01"
 * @versions {"tool":"1.14.0+2667"}
 */

/**
 * Import the modules used in this configuration.
 */
const gpio       = scripting.addModule("/drivers/gpio/gpio", {}, false);
const gpio1      = gpio.addInstance();
const debug_log  = scripting.addModule("/kernel/dpl/debug_log");
const mpu_armv7  = scripting.addModule("/kernel/dpl/mpu_armv7", {}, false);
const mpu_armv71 = mpu_armv7.addInstance();
const mpu_armv72 = mpu_armv7.addInstance();
const mpu_armv73 = mpu_armv7.addInstance();
const mpu_armv74 = mpu_armv7.addInstance();
const mpu_armv75 = mpu_armv7.addInstance();
const timer      = scripting.addModule("/kernel/dpl/timer", {}, false);
const timer1     = timer.addInstance();
const endat      = scripting.addModule("/motor_control/position_sense/endat", {}, false);
const endat1     = endat.addInstance();

/**
 * Write custom configuration values to the imported modules.
 */
debug_log.enableUartLog        = true;
debug_log.enableCssLog         = false;
debug_log.uartLog.$name        = "CONFIG_UART_CONSOLE";
debug_log.uartLog.UART.$assign = "USART0";

mpu_armv71.$name             = "CONFIG_MPU_REGION0";
mpu_armv71.size              = 31;
mpu_armv71.attributes        = "Device";
mpu_armv71.accessPermissions = "Supervisor RD+WR, User RD";
mpu_armv71.allowExecute      = false;

mpu_armv72.$name             = "CONFIG_MPU_REGION1";
mpu_armv72.size              = 15;
mpu_armv72.accessPermissions = "Supervisor RD+WR, User RD";

mpu_armv73.$name             = "CONFIG_MPU_REGION2";
mpu_armv73.baseAddr          = 0x41010000;
mpu_armv73.size              = 15;
mpu_armv73.accessPermissions = "Supervisor RD+WR, User RD";

mpu_armv74.$name             = "CONFIG_MPU_REGION3";
mpu_armv74.accessPermissions = "Supervisor RD+WR, User RD";
mpu_armv74.baseAddr          = 0x70000000;
mpu_armv74.size              = 21;

mpu_armv75.$name             = "CONFIG_MPU_REGION4";
mpu_armv75.baseAddr          = 0x60000000;
mpu_armv75.size              = 28;
mpu_armv75.accessPermissions = "Supervisor RD, User RD";

timer1.$name         = "CONFIG_TIMER0";
timer1.intrPriority  = 0;
timer1.timerCallback = "endat_position_loop";
timer1.TIMER.$assign = "DMTIMER0";

endat1.$name                        = "CONFIG_ENDAT0";
endat1.Booster_Pack                 = true;
endat1.PRU_ICSSG0_PRU.$assign       = "PRU_ICSSG0_PRU1";
endat1.PRU_ICSSG0_PRU.GPO2.$assign  = "ball.M2";
endat1.PRU_ICSSG0_PRU.GPO1.$assign  = "ball.J2";
endat1.PRU_ICSSG0_PRU.GPO0.$assign  = "ball.L5";
endat1.PRU_ICSSG0_PRU.GPI13.$assign = "ball.T4";
endat1.PRU_ICSSG0_PRU.GPO5.$used    = false;
endat1.PRU_ICSSG0_PRU.GPO4.$used    = false;
endat1.PRU_ICSSG0_PRU.GPO3.$used    = false;
endat1.PRU_ICSSG0_PRU.GPI14.$used   = false;
endat1.PRU_ICSSG0_PRU.GPO8.$used    = false;
endat1.PRU_ICSSG0_PRU.GPO12.$used   = false;
endat1.PRU_ICSSG0_PRU.GPO6.$used    = false;
endat1.PRU_ICSSG0_PRU.GPI11.$used   = false;

endat1.ENC1_EN             = gpio1;
gpio1.$name                = "ENC1_EN";
gpio1.GPIO.$assign         = "GPIO1";
gpio1.GPIO.gpioPin.pu_pd   = "pu";
gpio1.GPIO.gpioPin.rx      = false;
gpio1.GPIO.gpioPin.$assign = "ball.C16";

const pruicss                            = scripting.addModule("/drivers/pruicss/pruicss", {}, false);
const pruicss1                           = pruicss.addInstance({}, false);
pruicss1.$name                           = "CONFIG_PRU_ICSS0";
endat1.pru                               = pruicss1;
pruicss1.AdditionalICSSSettings[0].$name = "CONFIG_PRU_ICSS_IO0";

/**
 * 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.
 */
debug_log.uartLog.UART.RXD.$suggestSolution = "ball.B10";
debug_log.uartLog.UART.TXD.$suggestSolution = "ball.B11";
