/*
 * Copyright (c) 2020 Texas Instruments Incorporated - http://www.ti.com
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * *  Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * *  Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * *  Neither the name of Texas Instruments Incorporated nor the names of
 *    its contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 */

#ifndef BOARD_H
#define BOARD_H

//*****************************************************************************
//
// If building with a C++ compiler, make all of the definitions in this header
// have a C binding.
//
//*****************************************************************************
#ifdef __cplusplus
extern "C"
{
#endif

//
// Included Files
//

#include "driverlib.h"
#include "device.h"

//*****************************************************************************
//
// PinMux Configurations
//
//*****************************************************************************

//
// ANALOG -> PFC_MOTORS_EMI Pinmux
//

//
// EPWM1 -> MTR1_PWM_U Pinmux
//
//
// EPWM1_A - GPIO Settings
//
#define GPIO_PIN_EPWM1_A 0
#define MTR1_PWM_U_EPWMA_GPIO 0
#define MTR1_PWM_U_EPWMA_PIN_CONFIG GPIO_0_EPWM1_A
//
// EPWM1_B - GPIO Settings
//
#define GPIO_PIN_EPWM1_B 1
#define MTR1_PWM_U_EPWMB_GPIO 1
#define MTR1_PWM_U_EPWMB_PIN_CONFIG GPIO_1_EPWM1_B

//
// EPWM2 -> MTR2_PWM_W Pinmux
//
//
// EPWM2_A - GPIO Settings
//
#define GPIO_PIN_EPWM2_A 41
#define MTR2_PWM_W_EPWMA_GPIO 41
#define MTR2_PWM_W_EPWMA_PIN_CONFIG GPIO_41_EPWM2_A
//
// EPWM2_B - GPIO Settings
//
#define GPIO_PIN_EPWM2_B 40
#define MTR2_PWM_W_EPWMB_GPIO 40
#define MTR2_PWM_W_EPWMB_PIN_CONFIG GPIO_40_EPWM2_B

//
// EPWM3 -> MTR1_PWM_V Pinmux
//
//
// EPWM3_A - GPIO Settings
//
#define GPIO_PIN_EPWM3_A 4
#define MTR1_PWM_V_EPWMA_GPIO 4
#define MTR1_PWM_V_EPWMA_PIN_CONFIG GPIO_4_EPWM3_A
//
// EPWM3_B - GPIO Settings
//
#define GPIO_PIN_EPWM3_B 5
#define MTR1_PWM_V_EPWMB_GPIO 5
#define MTR1_PWM_V_EPWMB_PIN_CONFIG GPIO_5_EPWM3_B

//
// EPWM4 -> MTR2_PWM_U Pinmux
//
//
// EPWM4_A - GPIO Settings
//
#define GPIO_PIN_EPWM4_A 6
#define MTR2_PWM_U_EPWMA_GPIO 6
#define MTR2_PWM_U_EPWMA_PIN_CONFIG GPIO_6_EPWM4_A
//
// EPWM4_B - GPIO Settings
//
#define GPIO_PIN_EPWM4_B 7
#define MTR2_PWM_U_EPWMB_GPIO 7
#define MTR2_PWM_U_EPWMB_PIN_CONFIG GPIO_7_EPWM4_B

//
// EPWM5 -> MTR1_PWM_W Pinmux
//
//
// EPWM5_A - GPIO Settings
//
#define GPIO_PIN_EPWM5_A 8
#define MTR1_PWM_W_EPWMA_GPIO 8
#define MTR1_PWM_W_EPWMA_PIN_CONFIG GPIO_8_EPWM5_A
//
// EPWM5_B - GPIO Settings
//
#define GPIO_PIN_EPWM5_B 9
#define MTR1_PWM_W_EPWMB_GPIO 9
#define MTR1_PWM_W_EPWMB_PIN_CONFIG GPIO_9_EPWM5_B

//
// EPWM6 -> MTR2_PWM_V Pinmux
//
//
// EPWM6_A - GPIO Settings
//
#define GPIO_PIN_EPWM6_A 10
#define MTR2_PWM_V_EPWMA_GPIO 10
#define MTR2_PWM_V_EPWMA_PIN_CONFIG GPIO_10_EPWM6_A
//
// EPWM6_B - GPIO Settings
//
#define GPIO_PIN_EPWM6_B 19
#define MTR2_PWM_V_EPWMB_GPIO 19
#define MTR2_PWM_V_EPWMB_PIN_CONFIG GPIO_19_EPWM6_B

//
// EPWM7 -> PFC_PWM Pinmux
//
//
// EPWM7_A - GPIO Settings
//
#define GPIO_PIN_EPWM7_A 12
#define PFC_PWM_EPWMA_GPIO 12
#define PFC_PWM_EPWMA_PIN_CONFIG GPIO_12_EPWM7_A
//
// EPWM7_B - GPIO Settings
//
#define GPIO_PIN_EPWM7_B 13
#define PFC_PWM_EPWMB_GPIO 13
#define PFC_PWM_EPWMB_PIN_CONFIG GPIO_13_EPWM7_B
//
// GPIO22 - GPIO Settings
//
#define MTR1_PM_nFAULT_GPIO_GPIO_PIN_CONFIG GPIO_22_GPIO22
//
// GPIO23 - GPIO Settings
//
#define MTR2_PM_nFAULT_GPIO_GPIO_PIN_CONFIG GPIO_23_GPIO23
//
// GPIO18 - GPIO Settings
//
#define ACPOWER_RELAY_GPIO_GPIO_PIN_CONFIG GPIO_18_GPIO18
//
// GPIO20 - GPIO Settings
//
#define FOURWAY_RELAY_GPIO_GPIO_PIN_CONFIG GPIO_20_GPIO20
//
// GPIO32 - GPIO Settings
//
#define EEV_STEPPER_2H_GPIO_GPIO_PIN_CONFIG GPIO_32_GPIO32
//
// GPIO17 - GPIO Settings
//
#define EMI_INJ_PD_GPIO_GPIO_PIN_CONFIG GPIO_17_GPIO17
//
// GPIO16 - GPIO Settings
//
#define EMI_INJ_PU_GPIO_GPIO_PIN_CONFIG GPIO_16_GPIO16
//
// GPIO11 - GPIO Settings
//
#define EMI_INJ_MD_GPIO_GPIO_PIN_CONFIG GPIO_11_GPIO11
//
// GPIO2 - GPIO Settings
//
#define EEV_STEPPER_1H_GPIO_GPIO_PIN_CONFIG GPIO_2_GPIO2
//
// GPIO3 - GPIO Settings
//
#define EEV_STEPPER_1L_GPIO_GPIO_PIN_CONFIG GPIO_3_GPIO3
//
// GPIO33 - GPIO Settings
//
#define EMI_RESET_GPIO_GPIO_PIN_CONFIG GPIO_33_GPIO33

//
// OTHER -> cJTAG Pinmux
//

//
// SPIA -> DAC_SPI Pinmux
//
//
// SPIA_PICO - GPIO Settings
//
#define GPIO_PIN_SPIA_PICO 24
#define DAC_SPI_SPIPICO_GPIO 24
#define DAC_SPI_SPIPICO_PIN_CONFIG GPIO_24_SPIA_SIMO
//
// SPIA_CLK - GPIO Settings
//
#define GPIO_PIN_SPIA_CLK 28
#define DAC_SPI_SPICLK_GPIO 28
#define DAC_SPI_SPICLK_PIN_CONFIG GPIO_28_SPIA_CLK
//
// SPIA_PTE - GPIO Settings
//
#define GPIO_PIN_SPIA_PTE 29
#define DAC_SPI_SPIPTE_GPIO 29
#define DAC_SPI_SPIPTE_PIN_CONFIG GPIO_29_SPIA_STE

//*****************************************************************************
//
// ADC Configurations
//
//*****************************************************************************
#define MTR1_EMI_BASE ADCC_BASE
#define MTR1_EMI_RESULT_BASE ADCCRESULT_BASE
#define MTR1_EMI_IDC1 ADC_SOC_NUMBER0
#define MTR1_EMI_FORCE_IDC1 ADC_FORCE_SOC0
#define MTR1_EMI_SAMPLE_WINDOW_IDC1 125.00000000000001
#define MTR1_EMI_TRIGGER_SOURCE_IDC1 ADC_TRIGGER_EPWM3_SOCA
#define MTR1_EMI_CHANNEL_IDC1 ADC_CH_ADCIN1
#define MTR1_EMI_IDC2 ADC_SOC_NUMBER1
#define MTR1_EMI_FORCE_IDC2 ADC_FORCE_SOC1
#define MTR1_EMI_SAMPLE_WINDOW_IDC2 125.00000000000001
#define MTR1_EMI_TRIGGER_SOURCE_IDC2 ADC_TRIGGER_EPWM3_SOCB
#define MTR1_EMI_CHANNEL_IDC2 ADC_CH_ADCIN1
#define MTR1_EMI_IDC3 ADC_SOC_NUMBER2
#define MTR1_EMI_FORCE_IDC3 ADC_FORCE_SOC2
#define MTR1_EMI_SAMPLE_WINDOW_IDC3 125.00000000000001
#define MTR1_EMI_TRIGGER_SOURCE_IDC3 ADC_TRIGGER_EPWM5_SOCA
#define MTR1_EMI_CHANNEL_IDC3 ADC_CH_ADCIN1
#define MTR1_EMI_IDC4 ADC_SOC_NUMBER3
#define MTR1_EMI_FORCE_IDC4 ADC_FORCE_SOC3
#define MTR1_EMI_SAMPLE_WINDOW_IDC4 125.00000000000001
#define MTR1_EMI_TRIGGER_SOURCE_IDC4 ADC_TRIGGER_EPWM5_SOCB
#define MTR1_EMI_CHANNEL_IDC4 ADC_CH_ADCIN1
#define MTR1_EMI_PPB1 ADC_PPB_NUMBER1
#define MTR1_EMI_SOC_PPB1 ADC_SOC_NUMBER0
#define MTR1_EMI_PPB2 ADC_PPB_NUMBER2
#define MTR1_EMI_SOC_PPB2 ADC_SOC_NUMBER1
#define MTR1_EMI_PPB3 ADC_PPB_NUMBER3
#define MTR1_EMI_SOC_PPB3 ADC_SOC_NUMBER2
#define MTR1_EMI_PPB4 ADC_PPB_NUMBER4
#define MTR1_EMI_SOC_PPB4 ADC_SOC_NUMBER3
void MTR1_EMI_init();

#define PFC_MTRS_BASE ADCA_BASE
#define PFC_MTRS_RESULT_BASE ADCARESULT_BASE
#define PFC_MTRS_IAC1 ADC_SOC_NUMBER0
#define PFC_MTRS_FORCE_IAC1 ADC_FORCE_SOC0
#define PFC_MTRS_SAMPLE_WINDOW_IAC1 116.66666666666667
#define PFC_MTRS_TRIGGER_SOURCE_IAC1 ADC_TRIGGER_EPWM7_SOCA
#define PFC_MTRS_CHANNEL_IAC1 ADC_CH_ADCIN9
#define PFC_MTRS_VAC1 ADC_SOC_NUMBER1
#define PFC_MTRS_FORCE_VAC1 ADC_FORCE_SOC1
#define PFC_MTRS_SAMPLE_WINDOW_VAC1 166.66666666666669
#define PFC_MTRS_TRIGGER_SOURCE_VAC1 ADC_TRIGGER_EPWM7_SOCA
#define PFC_MTRS_CHANNEL_VAC1 ADC_CH_ADCIN10
#define PFC_MTRS_VDC1 ADC_SOC_NUMBER2
#define PFC_MTRS_FORCE_VDC1 ADC_FORCE_SOC2
#define PFC_MTRS_SAMPLE_WINDOW_VDC1 166.66666666666669
#define PFC_MTRS_TRIGGER_SOURCE_VDC1 ADC_TRIGGER_EPWM7_SOCA
#define PFC_MTRS_CHANNEL_VDC1 ADC_CH_ADCIN4
#define PFC_MTRS_IAC2 ADC_SOC_NUMBER3
#define PFC_MTRS_FORCE_IAC2 ADC_FORCE_SOC3
#define PFC_MTRS_SAMPLE_WINDOW_IAC2 116.66666666666667
#define PFC_MTRS_TRIGGER_SOURCE_IAC2 ADC_TRIGGER_EPWM7_SOCB
#define PFC_MTRS_CHANNEL_IAC2 ADC_CH_ADCIN9
#define PFC_MTRS_VAC2 ADC_SOC_NUMBER4
#define PFC_MTRS_FORCE_VAC2 ADC_FORCE_SOC4
#define PFC_MTRS_SAMPLE_WINDOW_VAC2 166.66666666666669
#define PFC_MTRS_TRIGGER_SOURCE_VAC2 ADC_TRIGGER_EPWM7_SOCB
#define PFC_MTRS_CHANNEL_VAC2 ADC_CH_ADCIN10
#define PFC_MTRS_VDC2 ADC_SOC_NUMBER5
#define PFC_MTRS_FORCE_VDC2 ADC_FORCE_SOC5
#define PFC_MTRS_SAMPLE_WINDOW_VDC2 166.66666666666669
#define PFC_MTRS_TRIGGER_SOURCE_VDC2 ADC_TRIGGER_EPWM7_SOCB
#define PFC_MTRS_CHANNEL_VDC2 ADC_CH_ADCIN4
#define PFC_MTRS_VU_M1 ADC_SOC_NUMBER6
#define PFC_MTRS_FORCE_VU_M1 ADC_FORCE_SOC6
#define PFC_MTRS_SAMPLE_WINDOW_VU_M1 166.66666666666669
#define PFC_MTRS_TRIGGER_SOURCE_VU_M1 ADC_TRIGGER_EPWM1_SOCA
#define PFC_MTRS_CHANNEL_VU_M1 ADC_CH_ADCIN8
#define PFC_MTRS_VV_M1 ADC_SOC_NUMBER7
#define PFC_MTRS_FORCE_VV_M1 ADC_FORCE_SOC7
#define PFC_MTRS_SAMPLE_WINDOW_VV_M1 166.66666666666669
#define PFC_MTRS_TRIGGER_SOURCE_VV_M1 ADC_TRIGGER_EPWM1_SOCA
#define PFC_MTRS_CHANNEL_VV_M1 ADC_CH_ADCIN1
#define PFC_MTRS_VW_M1 ADC_SOC_NUMBER8
#define PFC_MTRS_FORCE_VW_M1 ADC_FORCE_SOC8
#define PFC_MTRS_SAMPLE_WINDOW_VW_M1 166.66666666666669
#define PFC_MTRS_TRIGGER_SOURCE_VW_M1 ADC_TRIGGER_EPWM1_SOCA
#define PFC_MTRS_CHANNEL_VW_M1 ADC_CH_ADCIN5
#define PFC_MTRS_IU_M2 ADC_SOC_NUMBER9
#define PFC_MTRS_FORCE_IU_M2 ADC_FORCE_SOC9
#define PFC_MTRS_SAMPLE_WINDOW_IU_M2 116.66666666666667
#define PFC_MTRS_TRIGGER_SOURCE_IU_M2 ADC_TRIGGER_EPWM4_SOCA
#define PFC_MTRS_CHANNEL_IU_M2 ADC_CH_ADCIN2
#define PFC_MTRS_IV_M2 ADC_SOC_NUMBER10
#define PFC_MTRS_FORCE_IV_M2 ADC_FORCE_SOC10
#define PFC_MTRS_SAMPLE_WINDOW_IV_M2 116.66666666666667
#define PFC_MTRS_TRIGGER_SOURCE_IV_M2 ADC_TRIGGER_EPWM4_SOCA
#define PFC_MTRS_CHANNEL_IV_M2 ADC_CH_ADCIN6
#define PFC_MTRS_IW_M2 ADC_SOC_NUMBER11
#define PFC_MTRS_FORCE_IW_M2 ADC_FORCE_SOC11
#define PFC_MTRS_SAMPLE_WINDOW_IW_M2 116.66666666666667
#define PFC_MTRS_TRIGGER_SOURCE_IW_M2 ADC_TRIGGER_EPWM4_SOCA
#define PFC_MTRS_CHANNEL_IW_M2 ADC_CH_ADCIN3
#define PFC_MTRS_VU_M2 ADC_SOC_NUMBER12
#define PFC_MTRS_FORCE_VU_M2 ADC_FORCE_SOC12
#define PFC_MTRS_SAMPLE_WINDOW_VU_M2 166.66666666666669
#define PFC_MTRS_TRIGGER_SOURCE_VU_M2 ADC_TRIGGER_EPWM4_SOCA
#define PFC_MTRS_CHANNEL_VU_M2 ADC_CH_ADCIN11
#define PFC_MTRS_VV_M2 ADC_SOC_NUMBER13
#define PFC_MTRS_FORCE_VV_M2 ADC_FORCE_SOC13
#define PFC_MTRS_SAMPLE_WINDOW_VV_M2 166.66666666666669
#define PFC_MTRS_TRIGGER_SOURCE_VV_M2 ADC_TRIGGER_EPWM4_SOCA
#define PFC_MTRS_CHANNEL_VV_M2 ADC_CH_ADCIN14
#define PFC_MTRS_VW_M2 ADC_SOC_NUMBER14
#define PFC_MTRS_FORCE_VW_M2 ADC_FORCE_SOC14
#define PFC_MTRS_SAMPLE_WINDOW_VW_M2 166.66666666666669
#define PFC_MTRS_TRIGGER_SOURCE_VW_M2 ADC_TRIGGER_EPWM4_SOCA
#define PFC_MTRS_CHANNEL_VW_M2 ADC_CH_ADCIN15
#define PFC_MTRS_PPB1 ADC_PPB_NUMBER1
#define PFC_MTRS_SOC_PPB1 ADC_SOC_NUMBER0
#define PFC_MTRS_PPB2 ADC_PPB_NUMBER2
#define PFC_MTRS_SOC_PPB2 ADC_SOC_NUMBER1
#define PFC_MTRS_PPB3 ADC_PPB_NUMBER3
#define PFC_MTRS_SOC_PPB3 ADC_SOC_NUMBER3
#define PFC_MTRS_PPB4 ADC_PPB_NUMBER4
#define PFC_MTRS_SOC_PPB4 ADC_SOC_NUMBER4
void PFC_MTRS_init();


//*****************************************************************************
//
// ASYSCTL Configurations
//
//*****************************************************************************

//*****************************************************************************
//
// CMPSS Configurations
//
//*****************************************************************************
#define MTR2_CMPSS_UV_BASE CMPSS1_BASE
#define MTR2_CMPSS_UV_HIGH_COMP_BASE CMPSS1_BASE    
#define MTR2_CMPSS_UV_LOW_COMP_BASE CMPSS1_BASE    
void MTR2_CMPSS_UV_init();

//*****************************************************************************
//
// CMPSS-LITE Configurations
//
//*****************************************************************************
#define PFC_CMPSS_VIAC_BASE CMPSSLITE2_BASE
void PFC_CMPSS_VIAC_init();
#define MTRS_CMPSS_UW_BASE CMPSSLITE3_BASE
void MTRS_CMPSS_UW_init();
#define MTR1_CMPSS_IDC_BASE CMPSSLITE4_BASE
void MTR1_CMPSS_IDC_init();

//*****************************************************************************
//
// CPUTIMER Configurations
//
//*****************************************************************************
#define CPU_TIMER0_BASE CPUTIMER0_BASE
void CPU_TIMER0_init();
#define CPU_TIMER1_BASE CPUTIMER1_BASE
void CPU_TIMER1_init();
#define CPU_TIMER2_BASE CPUTIMER2_BASE
void CPU_TIMER2_init();

//*****************************************************************************
//
// EPWM Configurations
//
//*****************************************************************************
#define MTR1_PWM_U_BASE EPWM1_BASE
#define MTR1_PWM_U_TBPRD 5000
#define MTR1_PWM_U_COUNTER_MODE EPWM_COUNTER_MODE_UP_DOWN
#define MTR1_PWM_U_TBPHS 0
#define MTR1_PWM_U_CMPA 5000
#define MTR1_PWM_U_CMPB 5000
#define MTR1_PWM_U_CMPC 5
#define MTR1_PWM_U_CMPD 5
#define MTR1_PWM_U_DBRED 240
#define MTR1_PWM_U_DBFED 240
#define MTR1_PWM_U_TZA_ACTION EPWM_TZ_ACTION_LOW
#define MTR1_PWM_U_TZB_ACTION EPWM_TZ_ACTION_LOW
#define MTR1_PWM_U_OSHT_SOURCES (EPWM_TZ_SIGNAL_DCAEVT1 | EPWM_TZ_SIGNAL_DCBEVT1 | EPWM_TZ_SIGNAL_OSHT1)
#define MTR1_PWM_U_INTERRUPT_SOURCE EPWM_INT_TBCTR_ZERO
// MTR1_PWM_U Configuration Template
void MTR1_configureEPWM(uint32_t base);
#define MTR2_PWM_W_BASE EPWM2_BASE
#define MTR2_PWM_W_TBPRD 5000
#define MTR2_PWM_W_COUNTER_MODE EPWM_COUNTER_MODE_UP_DOWN
#define MTR2_PWM_W_TBPHS 0
#define MTR2_PWM_W_CMPA 5000
#define MTR2_PWM_W_CMPB 5000
#define MTR2_PWM_W_CMPC 5
#define MTR2_PWM_W_CMPD 5
#define MTR2_PWM_W_DBRED 240
#define MTR2_PWM_W_DBFED 240
#define MTR2_PWM_W_TZA_ACTION EPWM_TZ_ACTION_LOW
#define MTR2_PWM_W_TZB_ACTION EPWM_TZ_ACTION_LOW
#define MTR2_PWM_W_OSHT_SOURCES (EPWM_TZ_SIGNAL_DCAEVT1 | EPWM_TZ_SIGNAL_DCBEVT1 | EPWM_TZ_SIGNAL_OSHT2)
#define MTR2_PWM_W_INTERRUPT_SOURCE EPWM_INT_TBCTR_DISABLED
#define MTR1_PWM_V_BASE EPWM3_BASE
#define MTR1_PWM_V_TBPRD 5000
#define MTR1_PWM_V_COUNTER_MODE EPWM_COUNTER_MODE_UP_DOWN
#define MTR1_PWM_V_TBPHS 0
#define MTR1_PWM_V_CMPA 5000
#define MTR1_PWM_V_CMPB 5000
#define MTR1_PWM_V_CMPC 5
#define MTR1_PWM_V_CMPD 5
#define MTR1_PWM_V_DBRED 240
#define MTR1_PWM_V_DBFED 240
#define MTR1_PWM_V_TZA_ACTION EPWM_TZ_ACTION_LOW
#define MTR1_PWM_V_TZB_ACTION EPWM_TZ_ACTION_LOW
#define MTR1_PWM_V_OSHT_SOURCES (EPWM_TZ_SIGNAL_DCAEVT1 | EPWM_TZ_SIGNAL_DCBEVT1 | EPWM_TZ_SIGNAL_OSHT1)
#define MTR1_PWM_V_INTERRUPT_SOURCE EPWM_INT_TBCTR_DISABLED
#define MTR2_PWM_U_BASE EPWM4_BASE
#define MTR2_PWM_U_TBPRD 5000
#define MTR2_PWM_U_COUNTER_MODE EPWM_COUNTER_MODE_UP_DOWN
#define MTR2_PWM_U_TBPHS 0
#define MTR2_PWM_U_CMPA 5000
#define MTR2_PWM_U_CMPB 5000
#define MTR2_PWM_U_CMPC 5
#define MTR2_PWM_U_CMPD 5
#define MTR2_PWM_U_DBRED 245
#define MTR2_PWM_U_DBFED 225
#define MTR2_PWM_U_TZA_ACTION EPWM_TZ_ACTION_LOW
#define MTR2_PWM_U_TZB_ACTION EPWM_TZ_ACTION_LOW
#define MTR2_PWM_U_OSHT_SOURCES (EPWM_TZ_SIGNAL_DCAEVT1 | EPWM_TZ_SIGNAL_DCBEVT1 | EPWM_TZ_SIGNAL_OSHT2)
#define MTR2_PWM_U_INTERRUPT_SOURCE EPWM_INT_TBCTR_ZERO
// MTR2_PWM_U Configuration Template
void MTR2_configureEPWM(uint32_t base);
#define MTR1_PWM_W_BASE EPWM5_BASE
#define MTR1_PWM_W_TBPRD 5000
#define MTR1_PWM_W_COUNTER_MODE EPWM_COUNTER_MODE_UP_DOWN
#define MTR1_PWM_W_TBPHS 0
#define MTR1_PWM_W_CMPA 5000
#define MTR1_PWM_W_CMPB 5000
#define MTR1_PWM_W_CMPC 5
#define MTR1_PWM_W_CMPD 5
#define MTR1_PWM_W_DBRED 240
#define MTR1_PWM_W_DBFED 240
#define MTR1_PWM_W_TZA_ACTION EPWM_TZ_ACTION_LOW
#define MTR1_PWM_W_TZB_ACTION EPWM_TZ_ACTION_LOW
#define MTR1_PWM_W_OSHT_SOURCES (EPWM_TZ_SIGNAL_DCAEVT1 | EPWM_TZ_SIGNAL_DCBEVT1 | EPWM_TZ_SIGNAL_OSHT1)
#define MTR1_PWM_W_INTERRUPT_SOURCE EPWM_INT_TBCTR_DISABLED
#define MTR2_PWM_V_BASE EPWM6_BASE
#define MTR2_PWM_V_TBPRD 5000
#define MTR2_PWM_V_COUNTER_MODE EPWM_COUNTER_MODE_UP_DOWN
#define MTR2_PWM_V_TBPHS 0
#define MTR2_PWM_V_CMPA 5000
#define MTR2_PWM_V_CMPB 5000
#define MTR2_PWM_V_CMPC 5
#define MTR2_PWM_V_CMPD 5
#define MTR2_PWM_V_DBRED 240
#define MTR2_PWM_V_DBFED 240
#define MTR2_PWM_V_TZA_ACTION EPWM_TZ_ACTION_LOW
#define MTR2_PWM_V_TZB_ACTION EPWM_TZ_ACTION_LOW
#define MTR2_PWM_V_OSHT_SOURCES (EPWM_TZ_SIGNAL_DCAEVT1 | EPWM_TZ_SIGNAL_DCBEVT1 | EPWM_TZ_SIGNAL_OSHT2)
#define MTR2_PWM_V_INTERRUPT_SOURCE EPWM_INT_TBCTR_DISABLED
#define PFC_PWM_BASE EPWM7_BASE
#define PFC_PWM_TBPRD 5000
#define PFC_PWM_COUNTER_MODE EPWM_COUNTER_MODE_UP_DOWN
#define PFC_PWM_TBPHS 0
#define PFC_PWM_CMPA 5000
#define PFC_PWM_CMPB 5000
#define PFC_PWM_CMPC 5
#define PFC_PWM_CMPD 5
#define PFC_PWM_DBRED 10
#define PFC_PWM_DBFED 10
#define PFC_PWM_TZA_ACTION EPWM_TZ_ACTION_LOW
#define PFC_PWM_TZB_ACTION EPWM_TZ_ACTION_LOW
#define PFC_PWM_OSHT_SOURCES (EPWM_TZ_SIGNAL_DCAEVT1 | EPWM_TZ_SIGNAL_DCBEVT1)
#define PFC_PWM_INTERRUPT_SOURCE EPWM_INT_TBCTR_PERIOD
// PFC_PWM Configuration Template
void PFC_configureEPWM(uint32_t base);

//*****************************************************************************
//
// EPWMXBAR Configurations
//
//*****************************************************************************
void PFC_FAULT_IAC_CMPSS_init();
#define PFC_FAULT_IAC_CMPSS XBAR_TRIP4
#define PFC_FAULT_IAC_CMPSS_ENABLED_MUXES (XBAR_MUX02 | XBAR_MUX03)
void COMP_nFAULT_CMPSS_init();
#define COMP_nFAULT_CMPSS XBAR_TRIP7
#define COMP_nFAULT_CMPSS_ENABLED_MUXES (XBAR_MUX07)
void FAN_nFAULT_CMPSS_init();
#define FAN_nFAULT_CMPSS XBAR_TRIP8
#define FAN_nFAULT_CMPSS_ENABLED_MUXES (XBAR_MUX00 | XBAR_MUX01 | XBAR_MUX05)

//*****************************************************************************
//
// GPIO Configurations
//
//*****************************************************************************
#define MTR1_PM_nFAULT_GPIO 22
void MTR1_PM_nFAULT_GPIO_init();
#define MTR2_PM_nFAULT_GPIO 23
void MTR2_PM_nFAULT_GPIO_init();
#define ACPOWER_RELAY_GPIO 18
void ACPOWER_RELAY_GPIO_init();
#define FOURWAY_RELAY_GPIO 20
void FOURWAY_RELAY_GPIO_init();
#define EEV_STEPPER_2H_GPIO 32
void EEV_STEPPER_2H_GPIO_init();
#define EMI_INJ_PD_GPIO 17
void EMI_INJ_PD_GPIO_init();
#define EMI_INJ_PU_GPIO 16
void EMI_INJ_PU_GPIO_init();
#define EMI_INJ_MD_GPIO 11
void EMI_INJ_MD_GPIO_init();
#define EEV_STEPPER_1H_GPIO 2
void EEV_STEPPER_1H_GPIO_init();
#define EEV_STEPPER_1L_GPIO 3
void EEV_STEPPER_1L_GPIO_init();
#define EMI_RESET_GPIO 33
void EMI_RESET_GPIO_init();

//*****************************************************************************
//
// INPUTXBAR Configurations
//
//*****************************************************************************
#define COMP_nFAULT_IN_SOURCE 22
#define COMP_nFAULT_IN_INPUT XBAR_INPUT1
void COMP_nFAULT_IN_init();
#define FAN_nFAULT_IN_SOURCE 23
#define FAN_nFAULT_IN_INPUT XBAR_INPUT2
void FAN_nFAULT_IN_init();

//*****************************************************************************
//
// INTERRUPT Configurations
//
//*****************************************************************************

// Interrupt Settings for INT_PFC_MTRS_2
#define INT_PFC_MTRS_2 INT_ADCA2
#define INT_PFC_MTRS_2_INTERRUPT_ACK_GROUP INTERRUPT_ACK_GROUP10
extern __interrupt void pfcCtrlISR(void);

// Interrupt Settings for INT_PFC_MTRS_3
#define INT_PFC_MTRS_3 INT_ADCA3
#define INT_PFC_MTRS_3_INTERRUPT_ACK_GROUP INTERRUPT_ACK_GROUP10
extern __interrupt void motor1CtrlISR(void);

// Interrupt Settings for INT_PFC_MTRS_4
#define INT_PFC_MTRS_4 INT_ADCA4
#define INT_PFC_MTRS_4_INTERRUPT_ACK_GROUP INTERRUPT_ACK_GROUP10
extern __interrupt void motor2CtrlISR(void);

//*****************************************************************************
//
// OTHER Configurations
//
//*****************************************************************************

//*****************************************************************************
//
// SPI Configurations
//
//*****************************************************************************
#define DAC_SPI_BASE SPIA_BASE
#define DAC_SPI_BITRATE 4000000
void DAC_SPI_init();

//*****************************************************************************
//
// SYNC Scheme Configurations
//
//*****************************************************************************

//*****************************************************************************
//
// SYSCTL Configurations
//
//*****************************************************************************

//*****************************************************************************
//
// Board Configurations
//
//*****************************************************************************
void	Board_init();
void	ADC_init();
void	ASYSCTL_init();
void	CMPSS_init();
void	CMPSSLITE_init();
void	CPUTIMER_init();
void	EPWM_init();
void	EPWMXBAR_init();
void	GPIO_init();
void	INPUTXBAR_init();
void	INTERRUPT_init();
void	OTHER_init();
void	SPI_init();
void	SYNC_init();
void	SYSCTL_init();
void	PinMux_init();

//*****************************************************************************
//
// Mark the end of the C bindings section for C++ compilers.
//
//*****************************************************************************
#ifdef __cplusplus
}
#endif

#endif  // end of BOARD_H definition
