Files
2026-08-30 23:04:35 -07:00

49 lines
1.8 KiB
Plaintext

% var moduleName = "uart"
% var module = system.modules['/driverlib/' + moduleName + '.js'];
% let Common = system.getScript("/driverlib/Common.js");
% let pinmuxOnlyDevices = ["F2838x"];
%if (module != null)
% {
//*****************************************************************************
//
// UART Configurations
//
//*****************************************************************************
% for(var inst of module.$instances) {
% let modInst = inst[moduleName];
% let solution = modInst.$solution;
% let peripheral = system.deviceData.peripherals[solution.peripheralName];
% if(!pinmuxOnlyDevices.includes(Common.getDeviceName())) {
//
// `inst.$name` Configuration
//
#define `inst.$name`_BASE `peripheral.name`_BASE
#define `inst.$name`_BAUDRATE `inst.baud`
#define `inst.$name`_CONFIG_WLEN `inst.wlen`
#define `inst.$name`_CONFIG_STP2 `inst.stp2`
#define `inst.$name`_CONFIG_EPS `inst.eps`
#define `inst.$name`_CONFIG_SPS `inst.sps == true ? "1" : "0"`
% if (inst.enInterrupt && inst.fen)
% {
% // if the user chose EOT, set txifsel to the default value of UART_FIFO_TX4_8
% // otherwise just use the value the user chose
% var actual_txiflsel = (inst.txiflsel == "EOT") ? "UART_FIFO_TX4_8" : inst.txiflsel;
#define `inst.$name`_FIFO_TXIFLSEL `actual_txiflsel`
#define `inst.$name`_FIFO_RXIFLSEL `inst.rxiflsel`
% }
% if (inst.dmarx)
% {
#define `inst.uartRXDMA.$name`_TRIGGER DMA_TRIGGER_`peripheral.name`RX
#define `inst.uartRXDMA.$name`_ADDRESS ((uint16_t *)(`peripheral.name`_BASE + UART_O_DR))
% }
% if (inst.dmatx)
% {
#define `inst.uartTXDMA.$name`_TRIGGER DMA_TRIGGER_`peripheral.name`TX
#define `inst.uartTXDMA.$name`_ADDRESS ((uint16_t *)(`peripheral.name`_BASE + UART_O_DR))
% }
% }
void `inst.$name`_init();
% }
% }