/*
 * Copyright (c) 2021, NXP
 * All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

#ifndef _PIN_MUX_H_
#define _PIN_MUX_H_

/*!
 * @addtogroup pin_mux
 * @{
 */

/***********************************************************************************************************************
 * API
 **********************************************************************************************************************/

#if defined(__cplusplus)
extern "C" {
#endif

/*!
 * @brief Calls initialization functions.
 *
 */
void BOARD_InitBootPins(void);

/*!
 * @brief Configures pin routing and optionally pin electrical features.
 *
 */
void BOARD_InitPins(void);

/*! @name PORTA4 (number 5), SW1
  @{ */

/* Symbols to be used with GPIO driver */
#define BOARD_SW1_FGPIO FGPIOA             /*!<@brief FGPIO peripheral base pointer */
#define BOARD_SW1_GPIO GPIOA               /*!<@brief GPIO peripheral base pointer */
#define BOARD_SW1_GPIO_PIN_MASK (1U << 4U) /*!<@brief GPIO pin mask */

/* Symbols to be used with PORT driver */
#define BOARD_SW1_PORT PORTA               /*!<@brief PORT peripheral base pointer */
#define BOARD_SW1_PIN 4U                   /*!<@brief PORT pin number */
#define BOARD_SW1_PIN_MASK (1U << 4U)      /*!<@brief PORT pin mask */
                                           /* @} */

/*!
 * @brief Configures pin routing and optionally pin electrical features.
 *
 */
void BOARD_InitButtonsPins(void);

/*!
 * @brief Configures pin routing and optionally pin electrical features.
 *
 */
void BOARD_InitLEDsPins(void);

#define PORT_DFER_DFE_0_MASK 0x01u /*!<@brief Digital Filter Enable Mask for item 0. */

/*!
 * @brief Configures pin routing and optionally pin electrical features.
 *
 */
void BOARD_InitACCELPins(void);

/*!
 * @brief Configures pin routing and optionally pin electrical features.
 *
 */
void BOARD_InitDEBUG_UARTPins(void);

/*! @name PORTE3 (number 58), J7[2]/Y2[1]/XTAL_8MHz
  @{ */

/* Symbols to be used with PORT driver */
#define BOARD_XTAL0_PORT PORTE               /*!<@brief PORT peripheral base pointer */
#define BOARD_XTAL0_PIN 3U                   /*!<@brief PORT pin number */
#define BOARD_XTAL0_PIN_MASK (1U << 3U)      /*!<@brief PORT pin mask */
                                             /* @} */

/*! @name XTAL32 (number 25), Y1[1]/XTAL_32K
  @{ */
/* @} */

/*! @name EXTAL32 (number 26), Y1[2]/EXTAL_32K
  @{ */
/* @} */

/*!
 * @brief Configures pin routing and optionally pin electrical features.
 *
 */
void BOARD_InitOSCPins(void);

/*! @name PORTG4 (number 79), J32[B10]/J15[1]/U4[5]/SPI0_MOSI
  @{ */

/* Symbols to be used with PORT driver */
#define BOARD_FLASH_SI_PORT PORTG               /*!<@brief PORT peripheral base pointer */
#define BOARD_FLASH_SI_PIN 4U                   /*!<@brief PORT pin number */
#define BOARD_FLASH_SI_PIN_MASK (1U << 4U)      /*!<@brief PORT pin mask */
                                                /* @} */

/*! @name PORTG5 (number 80), J32[B11]/J13[2]/U4[2]/SPI0_MISO
  @{ */

/* Symbols to be used with PORT driver */
#define BOARD_FLASH_SO_PORT PORTG               /*!<@brief PORT peripheral base pointer */
#define BOARD_FLASH_SO_PIN 5U                   /*!<@brief PORT pin number */
#define BOARD_FLASH_SO_PIN_MASK (1U << 5U)      /*!<@brief PORT pin mask */
                                                /* @} */

/*! @name PORTG3 (number 78), J32[B7]/J12[1]/U4[6]/SPI0_SCK
  @{ */

/* Symbols to be used with PORT driver */
#define BOARD_FLASH_CLK_PORT PORTG               /*!<@brief PORT peripheral base pointer */
#define BOARD_FLASH_CLK_PIN 3U                   /*!<@brief PORT pin number */
#define BOARD_FLASH_CLK_PIN_MASK (1U << 3U)      /*!<@brief PORT pin mask */
                                                 /* @} */

/*! @name PORTG2 (number 77), J32[B9]/J9[2]/U4[1]/SPI0_PCS0
  @{ */

/* Symbols to be used with PORT driver */
#define BOARD_FLASH_CS_PORT PORTG               /*!<@brief PORT peripheral base pointer */
#define BOARD_FLASH_CS_PIN 2U                   /*!<@brief PORT pin number */
#define BOARD_FLASH_CS_PIN_MASK (1U << 2U)      /*!<@brief PORT pin mask */
                                                /* @} */

/*!
 * @brief Configures pin routing and optionally pin electrical features.
 *
 */
void BOARD_InitSPI_FLASHPins(void);

/*!
 * @brief
 * UART0 IrDA Select: UART0 selected for IrDA modulation.
 * UART0 TX modulated by XBAR_OUT[14] and UART0 RX input connected to XBAR_OUT[13].
 * UARTxIRSEL cannot configure XBAR_OUT[14] and XBAR_OUT[13] automatically, and they need extra configuration in
 * XBAR.
 * User should configure XBAR[14:13] accordingly.
 */
#define MISC_CTL_UART0IRSEL_0b1 0x01u

/*!
 * @brief Configures pin routing and optionally pin electrical features.
 *
 */
void BOARD_InitInfra_RedPins(void);

/*! @name PORTF1 (number 68), J21[1]/POT_5K
  @{ */

/* Symbols to be used with PORT driver */
#define BOARD_ADC_POT_PORT PORTF               /*!<@brief PORT peripheral base pointer */
#define BOARD_ADC_POT_PIN 1U                   /*!<@brief PORT pin number */
#define BOARD_ADC_POT_PIN_MASK (1U << 1U)      /*!<@brief PORT pin mask */
                                               /* @} */

/*!
 * @brief Configures pin routing and optionally pin electrical features.
 *
 */
void BOARD_InitPotentiometerPins(void);

/*! @name PORTF2 (number 69), J20[1]/TEMP_SENSE
  @{ */

/* Symbols to be used with PORT driver */
#define BOARD_ADC_TEMP_PORT PORTF               /*!<@brief PORT peripheral base pointer */
#define BOARD_ADC_TEMP_PIN 2U                   /*!<@brief PORT pin number */
#define BOARD_ADC_TEMP_PIN_MASK (1U << 2U)      /*!<@brief PORT pin mask */
                                                /* @} */

/*!
 * @brief Configures pin routing and optionally pin electrical features.
 *
 */
void BOARD_InitTemp_sensorPins(void);

/*! @name PORTB5 (number 16), DS1[2]/LCD_P36
  @{ */

/* Symbols to be used with PORT driver */
#define BOARD_LCD_P36_PORT PORTB               /*!<@brief PORT peripheral base pointer */
#define BOARD_LCD_P36_PIN 5U                   /*!<@brief PORT pin number */
#define BOARD_LCD_P36_PIN_MASK (1U << 5U)      /*!<@brief PORT pin mask */
                                               /* @} */

/*! @name PORTB1 (number 12), DS1[4]/LCD_P32
  @{ */

/* Symbols to be used with PORT driver */
#define BOARD_LCD_P32_PORT PORTB               /*!<@brief PORT peripheral base pointer */
#define BOARD_LCD_P32_PIN 1U                   /*!<@brief PORT pin number */
#define BOARD_LCD_P32_PIN_MASK (1U << 1U)      /*!<@brief PORT pin mask */
                                               /* @} */

/*! @name PORTB0 (number 9), DS1[5]/LCD_P31
  @{ */

/* Symbols to be used with PORT driver */
#define BOARD_LCD_P31_PORT PORTB               /*!<@brief PORT peripheral base pointer */
#define BOARD_LCD_P31_PIN 0U                   /*!<@brief PORT pin number */
#define BOARD_LCD_P31_PIN_MASK (1U << 0U)      /*!<@brief PORT pin mask */
                                               /* @} */

/*! @name PORTA6 (number 7), DS1[6]/LCD_P29
  @{ */

/* Symbols to be used with PORT driver */
#define BOARD_LCD_P29_PORT PORTA               /*!<@brief PORT peripheral base pointer */
#define BOARD_LCD_P29_PIN 6U                   /*!<@brief PORT pin number */
#define BOARD_LCD_P29_PIN_MASK (1U << 6U)      /*!<@brief PORT pin mask */
                                               /* @} */

/*! @name PORTA2 (number 3), DS1[15]/LCD_P45
  @{ */

/* Symbols to be used with PORT driver */
#define BOARD_LCD_P45_PORT PORTA               /*!<@brief PORT peripheral base pointer */
#define BOARD_LCD_P45_PIN 2U                   /*!<@brief PORT pin number */
#define BOARD_LCD_P45_PIN_MASK (1U << 2U)      /*!<@brief PORT pin mask */
                                               /* @} */

/*! @name PORTC4 (number 23), DS1[9]/LCD_P43
  @{ */

/* Symbols to be used with PORT driver */
#define BOARD_LCD_P43_PORT PORTC               /*!<@brief PORT peripheral base pointer */
#define BOARD_LCD_P43_PIN 4U                   /*!<@brief PORT pin number */
#define BOARD_LCD_P43_PIN_MASK (1U << 4U)      /*!<@brief PORT pin mask */
                                               /* @} */

/*! @name PORTB6 (number 17), DS1[13]/LCD_P50
  @{ */

/* Symbols to be used with PORT driver */
#define BOARD_LCD_P50_PORT PORTB               /*!<@brief PORT peripheral base pointer */
#define BOARD_LCD_P50_PIN 6U                   /*!<@brief PORT pin number */
#define BOARD_LCD_P50_PIN_MASK (1U << 6U)      /*!<@brief PORT pin mask */
                                               /* @} */

/*! @name PORTB2 (number 13), DS1[12]/LCD_P33
  @{ */

/* Symbols to be used with PORT driver */
#define BOARD_LCD_P33_PORT PORTB               /*!<@brief PORT peripheral base pointer */
#define BOARD_LCD_P33_PIN 2U                   /*!<@brief PORT pin number */
#define BOARD_LCD_P33_PIN_MASK (1U << 2U)      /*!<@brief PORT pin mask */
                                               /* @} */

/*! @name PORTA7 (number 8), DS1[14]/LCD_P30
  @{ */

/* Symbols to be used with PORT driver */
#define BOARD_LCD_P30_PORT PORTA               /*!<@brief PORT peripheral base pointer */
#define BOARD_LCD_P30_PIN 7U                   /*!<@brief PORT pin number */
#define BOARD_LCD_P30_PIN_MASK (1U << 7U)      /*!<@brief PORT pin mask */
                                               /* @} */

/*! @name PORTA3 (number 4), DS1[17]/LCD_P26
  @{ */

/* Symbols to be used with PORT driver */
#define BOARD_LCD_P26_PORT PORTA               /*!<@brief PORT peripheral base pointer */
#define BOARD_LCD_P26_PIN 3U                   /*!<@brief PORT pin number */
#define BOARD_LCD_P26_PIN_MASK (1U << 3U)      /*!<@brief PORT pin mask */
                                               /* @} */

/*! @name PORTA5 (number 6), DS1[18]/LCD_P28
  @{ */

/* Symbols to be used with PORT driver */
#define BOARD_LCD_P28_PORT PORTA               /*!<@brief PORT peripheral base pointer */
#define BOARD_LCD_P28_PIN 5U                   /*!<@brief PORT pin number */
#define BOARD_LCD_P28_PIN_MASK (1U << 5U)      /*!<@brief PORT pin mask */
                                               /* @} */

/*! @name PORTH4 (number 87), DS1[22]/LCD_P19
  @{ */

/* Symbols to be used with PORT driver */
#define BOARD_LCD_P19_PORT PORTH               /*!<@brief PORT peripheral base pointer */
#define BOARD_LCD_P19_PIN 4U                   /*!<@brief PORT pin number */
#define BOARD_LCD_P19_PIN_MASK (1U << 4U)      /*!<@brief PORT pin mask */
                                               /* @} */

/*! @name PORTG6 (number 81), DS1[23]/LCD_P13
  @{ */

/* Symbols to be used with PORT driver */
#define BOARD_LCD_P13_PORT PORTG               /*!<@brief PORT peripheral base pointer */
#define BOARD_LCD_P13_PIN 6U                   /*!<@brief PORT pin number */
#define BOARD_LCD_P13_PIN_MASK (1U << 6U)      /*!<@brief PORT pin mask */
                                               /* @} */

/*! @name PORTI3 (number 94), DS1[26]/LCD_P22
  @{ */

/* Symbols to be used with PORT driver */
#define BOARD_LCD_P22_PORT PORTI               /*!<@brief PORT peripheral base pointer */
#define BOARD_LCD_P22_PIN 3U                   /*!<@brief PORT pin number */
#define BOARD_LCD_P22_PIN_MASK (1U << 3U)      /*!<@brief PORT pin mask */
                                               /* @} */

/*! @name PORTH5 (number 88), DS1[27]/LCD_P20
  @{ */

/* Symbols to be used with PORT driver */
#define BOARD_LCD_P20_PORT PORTH               /*!<@brief PORT peripheral base pointer */
#define BOARD_LCD_P20_PIN 5U                   /*!<@brief PORT pin number */
#define BOARD_LCD_P20_PIN_MASK (1U << 5U)      /*!<@brief PORT pin mask */
                                               /* @} */

/*! @name PORTG7 (number 82), DS1[28]/LCD_P14
  @{ */

/* Symbols to be used with PORT driver */
#define BOARD_LCD_P14_PORT PORTG               /*!<@brief PORT peripheral base pointer */
#define BOARD_LCD_P14_PIN 7U                   /*!<@brief PORT pin number */
#define BOARD_LCD_P14_PIN_MASK (1U << 7U)      /*!<@brief PORT pin mask */
                                               /* @} */

/*!
 * @brief Configures pin routing and optionally pin electrical features.
 *
 */
void BOARD_InitLCDPins(void);

#if defined(__cplusplus)
}
#endif

/*!
 * @}
 */
#endif /* _PIN_MUX_H_ */

/***********************************************************************************************************************
 * EOF
 **********************************************************************************************************************/
