/**********************************************************************************************************************
 *  COPYRIGHT
 *  -------------------------------------------------------------------------------------------------------------------
 *  \verbatim
 *  Copyright (c) 2025 by Vector Informatik GmbH.                                                  All rights reserved.
 *
 *                This software is copyright protected and proprietary to Vector Informatik GmbH.
 *                Vector Informatik GmbH grants to you only those rights as set out in the license conditions.
 *                All other rights remain with Vector Informatik GmbH.
 *  \endverbatim
 *  -------------------------------------------------------------------------------------------------------------------
 *  FILE DESCRIPTION
 *  -----------------------------------------------------------------------------------------------------------------*/
/** \file  File:  BrsHw_Ports.h
 *      Project:  Vector Basic Runtime System
 *       Module:  BrsHw for platform TexasInstruments Sitara AM263x
 *
 *  \brief Description:  This header file contains the information for the evalboard specific port settings,
 *                       supported by this Brs implementation.
 *
 *  \attention Please note:
 *    The demo and example programs only show special aspects of the software. With regard to the fact
 *    that these programs are meant for demonstration purposes only, Vector Informatik liability shall be
 *    expressly excluded in cases of ordinary negligence, to the extent admissible by law or statute.
 *********************************************************************************************************************/

/**********************************************************************************************************************
 *  REVISION HISTORY
 *  -------------------------------------------------------------------------------------------------------------------
 *  Refer to BrsHw.h.
 *********************************************************************************************************************/

#ifndef _BRSHW_PORTS_H_
#define _BRSHW_PORTS_H_

/*******************************************************************************
 *  Generic PORT definition types
 *******************************************************************************/
/* GPIO module from TI libraries used for Pin toggling. See GPIO_soc.h for details on the pin declaration */
typedef struct
{
  uint32  portNumber;
} brsHw_Port_PortType;

#if defined (_BRSHW_C_)
  #define BRSHW_PORT_PIN(name, number) const brsHw_Port_PortType name = {number}
#else
  #define BRSHW_PORT_PIN(name, number) extern const brsHw_Port_PortType name
#endif

#define BRSHW_PORT_LOGIC_HIGH (uint8)1
#define BRSHW_PORT_LOGIC_LOW  (uint8)0

/*******************************************************************************
 *  PIN configuration for alive LED support
 *******************************************************************************/
#if defined (BRS_ENABLE_SUPPORT_LEDS)
# if defined (BRS_COMP_LLVMTEXASINSTRUMENTS)
#  if defined (BRS_EVA_BOARD_TI_AM2634_EVM)
BRSHW_PORT_PIN(BRSHW_PORT_LED, /*CSL_MSS_IOMUX_PADCQ_CFG_REG*/ 0); /* GPIOA -> GPIO2 -> T16 */
#  else
  #error "Your chosen EvaBoard is not yet supported for LED support. Feel free to add your EvaBoard on top, or disable BRS LED support."
#  endif /*BRS_EVA_BOARD_x*/
# endif /*BRS_COMP_LLVMTEXASINSTRUMENTS*/
#endif /*BRS_ENABLE_SUPPORT_LEDS*/

/*******************************************************************************
 *  PIN configuration for toggle WD pin support
 *******************************************************************************/
#if defined (BRS_ENABLE_SUPPORT_TOGGLE_WD_PIN)
# if defined (BRS_ENABLE_FBL_SUPPORT)
  #define BRS_START_SEC_RAM_CONST
  #include "Brs_MemMap.h"
# endif

  #error "Please configure here the needed WD-toggle pin and uncomment this error, or disable BRS_ENABLE_SUPPORT_TOGGLE_WD_PIN" */

BRSHW_PORT_PIN(BRSHW_PORT_TOGGLE_WD, SOC_TPR12_GPIO_x);

# if defined (BRS_ENABLE_FBL_SUPPORT)
  #define BRS_STOP_SEC_RAM_CONST
  #include "Brs_MemMap.h"
# endif
#endif /* BRS_ENABLE_SUPPORT_WD_PIN */

/*******************************************************************************
 *  PIN configuration for toggle CUSTOM pin support
 *******************************************************************************/
#if defined (BRS_ENABLE_SUPPORT_TOGGLE_CUSTOM_PIN)
# if defined (BRS_ENABLE_FBL_SUPPORT)
  #define BRS_START_SEC_RAM_CONST
  #include "Brs_MemMap.h"
# endif

  #error "Please configure here the needed custom toggle pin and uncomment this error, or disable BRS_ENABLE_SUPPORT_TOGGLE_CUSTOM_PIN" */

BRSHW_PORT_PIN(BRSHW_PORT_TOGGLE_CUSTOM, SOC_TPR12_GPIO_x);

# if defined (BRS_ENABLE_FBL_SUPPORT)
  #define BRS_STOP_SEC_RAM_CONST
  #include "Brs_MemMap.h"
# endif
#endif /* BRS_ENABLE_SUPPORT_CUSTOM_PIN */

/*******************************************************************************
 *  ------------------------------------------------------------
 *  COMMUNICATION DRIVER SPECIFIC PORT SETTINGS
 *  ------------------------------------------------------------
 *******************************************************************************/
/*******************************************************************************
 *  GENERAL COMMUNICATION DRIVER SPECIFIC SETTINGS
 *******************************************************************************/

/*******************************************************************************
 *  CAN driver
 *******************************************************************************/
/* Calls of BrsHwInitPortOutput() and BrsHwInitPortInput() replaced by proprietery SBL image, provided by TI */

/*******************************************************************************
 *  LIN driver
 *******************************************************************************/
#if defined (BRS_ENABLE_LIN_SUPPORT)
  //#error "PortPins for Lin are not yet supported!"
#endif /* BRS_ENABLE_LIN_SUPPORT */

/*******************************************************************************
 *  FLEXRAY driver
 *******************************************************************************/
#if defined (BRS_ENABLE_FLEXRAY_SUPPORT)
  #error "PortPins for FlexRay are not yet supported!"
#endif

/*******************************************************************************
 *  ETHERNET driver
 *******************************************************************************/
#if defined (BRS_ENABLE_ETHERNET_SUPPORT)

# if defined (BRS_COMP_LLVMTEXASINSTRUMENTS)
/* Calls of BrsHwInitPortOutput() and BrsHwInitPortInput() replaced by proprietery SBL image, provided by TI */
#  if defined (BRS_EVA_BOARD_TI_AM2634_EVM)
BRSHW_PORT_PIN(BRSHW_PORT_ETH0_PHY_EN, /*CSL_MSS_IOMUX_PADCQ_CFG_REG*/0); /* GPIOA -> GPIO2 -> T16 */
BRSHW_PORT_PIN(BRSHW_PORT_ETH0_PHY_N_RESET, /*CSL_MSS_IOMUX_PADBB_CFG_REG*/0); /* GPIOD -> GPIO28 -> R17 */
# else
  #error "Please choose the valid EvalBoard in vBRS setup or define pins for ETH_PHY_EN and ETH_PHY_N_RESET here manually."
# endif /* BRS_EVA_BOARD_x */
# endif /* BRS_COMP_LLVMTEXASINSTRUMENTS */
#endif /* BRS_ENABLE_ETHERNET_SUPPORT */

#endif /* _BRSHW_PORTS_H_ */
