% var moduleName = "spi"
% var module = system.modules['/driverlib/' + moduleName + '.js'];
%if (module != null)
%{
//*****************************************************************************
//
// SPI Configurations
//
//*****************************************************************************
    % for(var i = 0; i < module.$instances.length; i++) {
        % var instance = module.$instances[i];
        % let modInst  = instance[moduleName];
        % let solution    = modInst.$solution;
        %let peripheral  = system.deviceData.peripherals[solution.peripheralName];
#define `instance.$name`_BASE `peripheral.name`_BASE
#define `instance.$name`_BITRATE `parseInt(instance.bitRate)`
#define `instance.$name`_DATAWIDTH `parseInt(instance.dataWidth)`
        % if (instance.useDMARX) {
#define `instance.spiRXDMA.$name`_TRIGGER DMA_TRIGGER_`peripheral.name`RX           
#define `instance.spiRXDMA.$name`_ADDRESS ((uint16_t *)(`peripheral.name`_BASE + SPI_O_RXBUF))
        % }
        % if (instance.useDMATX) {
#define `instance.spiTXDMA.$name`_TRIGGER DMA_TRIGGER_`peripheral.name`TX  
#define `instance.spiTXDMA.$name`_ADDRESS ((uint16_t *)(`peripheral.name`_BASE + SPI_O_TXBUF))
        % }
void `instance.$name`_init();
    % }
%}