/**
*   @file       Eth_Cfg.c
*   @implements Eth_Cfg.c_Artifact
*   @version 1.0.0
*
*   @brief   AUTOSAR Eth driver Link-Time configuration file
*   @details File containing the configuration for the Ethernet driver
*   @note    This file was generated on [!"$date"!].
*
*   @addtogroup ETH_DRIVER_CONFIGURATION
*   @{
*/
/*==================================================================================================
*   Project              : AUTOSAR 4.3 MCAL
*   Platform             : PA
*   Peripheral           : FEC
*   Dependencies         : 
*
*   Autosar Version      : 4.3.1
*   Autosar Revision     : ASR_REL_4_3_REV_0001
*   Autosar Conf.Variant :
*   SW Version           : 1.0.0
*   Build Version        : MPC5777C_MCAL_1_0_0_RTM_ASR_REL_4_3_REV_0001_20190315
*
*   (c) Copyright 2006-2016 Freescale Semiconductor, Inc. 
*       Copyright 2017-2019 NXP
*   All Rights Reserved.
==================================================================================================*/
/*==================================================================================================
==================================================================================================*/

#ifdef __cplusplus
extern "C"{
#endif

/**
* @page misra_violations MISRA-C:2012 violations
* 
* @section Eth_Cfg_c_REF_1
* Violates MISRA 2012 Required Directive 4.10, Precautions shall be taken in order to prevent the contents
* of a header file being included more than once. This comes from the order of includes in the .c file
* and from include dependencies. As a safe approach, any file must include all its dependencies.
* Header files are already protected against double inclusions. The inclusion of Eth_Memmap.h is as
* per AUTOSAR requirement (SWS_MemMap_00003)
*
* @section [global]
*          Violates MISRA 2012 Required Rule 5.1, External identifiers shall be distinct.
*          The used compilers use more than 31 chars for identifiers.
*
* @section [global]
*          Violates MISRA 2012 Required Rule 5.2, Identifiers declared in the same scope and name space shall be distinct.
*          The used compilers use more than 31 chars for identifiers.
*
* @section [global]
*          Violates MISRA 2012 Required Rule 5.4, Macro identifiers shall be distinct.
*          The used compilers use more than 31 chars for identifiers.
*
* @section [global]
*          Violates MISRA 2012 Required Rule 5.5, Identifiers shall be distinct from macro names.
*          The used compilers use more than 31 chars for identifiers.
*
* @section Eth_Cfg_c_REF_2
* Violates MISRA 2012 Advisory Rule 20.1, #include directives should only be preceded by preprocessor 
* directives or comments. AUTOSAR imposes the specification of the sections in which certain parts
* of the driver must be placed.
*
* @section Eth_Cfg_c_REF_3
* Violates MISRA 2012 Required Rule 1.3, There shall be no occurrence of undefined or critical unspecified behaviour
*
* @section Eth_Cfg_c_REF_4
* Violates MISRA 2012 Advisory Rule 8.7,  Functions and objects should not be defined with external 
* linkage if they are referenced in only one translation unit.
*
*/

/*==================================================================================================
*                                        INCLUDE FILES
* 1) system and project includes
* 2) needed interfaces from external units
* 3) internal and external interfaces from this unit
==================================================================================================*/
/* ETH001 */
#include "Eth.h"
#include "Eth_Fec_Reg_Sys.h"

/*==================================================================================================
*                              SOURCE FILE VERSION INFORMATION
==================================================================================================*/
#define ETH_VENDOR_ID_C                      43
#define ETH_MODULE_ID_C                      88
#define ETH_AR_RELEASE_MAJOR_VERSION_C       4
#define ETH_AR_RELEASE_MINOR_VERSION_C       3
#define ETH_AR_RELEASE_REVISION_VERSION_C    1
#define ETH_SW_MAJOR_VERSION_C               1
#define ETH_SW_MINOR_VERSION_C               0
#define ETH_SW_PATCH_VERSION_C               0

/*==================================================================================================
*                                     FILE VERSION CHECKS
==================================================================================================*/
/* Check if current file and ETH header file are of the same vendor */
#if (ETH_VENDOR_ID_C != ETH_VENDOR_ID)
    #error "Eth_Cfg.c and Eth.h have different vendor ids"
#endif
/* Check if current file and ETH header file are of the same module */
#if (ETH_MODULE_ID_C != ETH_MODULE_ID)
    #error "Eth_Cfg.c and Eth.h have different vendor ids"
#endif
/* Check if current file and ETH header file are of the same Autosar version */
#if ((ETH_AR_RELEASE_MAJOR_VERSION_C    != ETH_AR_RELEASE_MAJOR_VERSION) || \
     (ETH_AR_RELEASE_MINOR_VERSION_C    != ETH_AR_RELEASE_MINOR_VERSION) || \
     (ETH_AR_RELEASE_REVISION_VERSION_C != ETH_AR_RELEASE_REVISION_VERSION))
    #error "AutoSar Version Numbers of Eth_Cfg.c and Eth.h are different"
#endif
/* Check if current file and ETH header file are of the same Software version */
#if ((ETH_SW_MAJOR_VERSION_C != ETH_SW_MAJOR_VERSION) || \
     (ETH_SW_MINOR_VERSION_C != ETH_SW_MINOR_VERSION) || \
     (ETH_SW_PATCH_VERSION_C != ETH_SW_PATCH_VERSION))
    #error "Software Version Numbers of Eth_Cfg.c and Eth.h are different"
#endif
/* Check if current file and Eth_Fec_Reg_Sys header file are of the same vendor */
#if (ETH_VENDOR_ID_C != ETH_VENDOR_ID_REG_SYS_H)
    #error "Eth_Cfg.c and Eth_Fec_Reg_Sys.h have different vendor ids"
#endif
/* Check if current file and Eth_Fec_Reg_Sys header file are of the same module */
#if (ETH_MODULE_ID_C != ETH_MODULE_ID_REG_SYS_H)
    #error "Eth_Cfg.c and Eth_Fec_Reg_Sys.h have different vendor ids"
#endif
/* Check if current file and Eth_Fec_Reg_Sys header file are of the same Autosar version */
#if ((ETH_AR_RELEASE_MAJOR_VERSION_C    != ETH_AR_RELEASE_MAJOR_VERSION_REG_SYS_H) || \
     (ETH_AR_RELEASE_MINOR_VERSION_C    != ETH_AR_RELEASE_MINOR_VERSION_REG_SYS_H) || \
     (ETH_AR_RELEASE_REVISION_VERSION_C != ETH_AR_RELEASE_REVISION_VERSION_REG_SYS_H))
    #error "AutoSar Version Numbers of Eth_Cfg.c and Eth_Fec_Reg_Sys.h are different"
#endif
/* Check if current file and Eth_Fec_Reg_Sys header file are of the same Software version */
#if ((ETH_SW_MAJOR_VERSION_C != ETH_SW_MAJOR_VERSION_REG_SYS_H) || \
     (ETH_SW_MINOR_VERSION_C != ETH_SW_MINOR_VERSION_REG_SYS_H) || \
     (ETH_SW_PATCH_VERSION_C != ETH_SW_PATCH_VERSION_REG_SYS_H))
    #error "Software Version Numbers of Eth_Cfg.c and Eth_Fec_Reg_Sys.h are different"
#endif

/*==================================================================================================
                                     FUNCTION PROTOTYPES
==================================================================================================*/
/*==================================================================================================
*                          LOCAL TYPEDEFS (STRUCTURES, UNIONS, ENUMS)
==================================================================================================*/


/*==================================================================================================
*                                       LOCAL MACROS
==================================================================================================*/


/*==================================================================================================
*                                      LOCAL CONSTANTS
==================================================================================================*/


/*==================================================================================================
*                                      LOCAL VARIABLES
==================================================================================================*/

#define ETH_START_SEC_CONST_UNSPECIFIED
/* @violates @ref Eth_Cfg_c_REF_1 This violation is not fixed since the inclusion of Eth_MemMap.h is as per AUTOSAR requirement*/
#include "Eth_MemMap.h"

[!INCLUDE "Eth_GetRegisterValues.m"!]
[!AUTOSPACING!][!//
/*******************************************************************************
* Configuration parameters
*******************************************************************************/
[!SELECT "EthConfigSet"!][!// Select configuration
[!VAR "BufCountIndex" = "0"!]
[!LOOP "EthCtrlConfig/*"!] [!// Loop over the controller config
[!VAR "CtrlConfigName" = "as:name(.)"!]
/**
* @var Specified for EthCtrlConfig: [!"@name"!]
* @par Memory usage:
[!IF "EthVendorSpecific/EthEnableLoopbackMode/EthInternalLoopbackMode = 'true'"!][!//
*
* @warning Internal loopback is enabled, no external signals will be used
[!ENDIF!][!//
*/
static CONST(Eth_StaticCtrlCfgType, ETH_APPL_CONST) Eth_Static[!"$CtrlConfigName"!] =
{
  [!IF "EthCtrlEnableRxInterrupt = 'true'"!][!//
    ((VAR(boolean, AUTOMATIC))TRUE),        /**< RX interrupt enabled */
  [!ELSE!][!//
    ((VAR(boolean, AUTOMATIC))FALSE),       /**< RX interrupt disabled */
  [!ENDIF!][!//
  [!IF "EthCtrlEnableTxInterrupt = 'true'"!][!//
    ((VAR(boolean, AUTOMATIC))TRUE),        /**< TX interrupt enabled */
  [!ELSE!][!//
    ((VAR(boolean, AUTOMATIC))FALSE),       /**< TX interrupt disabled */
  [!ENDIF!][!//
    [!"EthCtrlIdx"!]U,  /**< Instance ID of the controller within the EthIf module context */
    /* @violates @ref Eth_Cfg_c_REF_3 */
    (&Eth_TxBuffers[[!"num:i($BufCountIndex)"!]][0]),    /**< Address of TX Buffer */
    /* @violates @ref Eth_Cfg_c_REF_3 */
    (&Eth_RxBuffers[[!"num:i($BufCountIndex)"!]][0])    /**< Address of RX Buffer */
};
  [!VAR "BufCountIndex"="$BufCountIndex+1"!]
[!CR!]
[!ENDLOOP!][!//End loop of controller
[!ENDSELECT!][!//
/*==================================================================================================
*                                      GLOBAL CONSTANTS
==================================================================================================*/


/*==================================================================================================
*                                      GLOBAL VARIABLES
==================================================================================================*/
/**
* @brief         Driver configuration to be passed to Eth_Init function
* @details       This array contains reference to the Link-Time configuration
*                to be used for the Eth driver configuration.
*/
[!SELECT "EthConfigSet"!][!// Select configuration
[!LOOP "EthCtrlConfig/*"!]
[!VAR "CtrlConfigName" = "as:name(.)"!]
CONST(Eth_StaticConfigType, ETH_APPL_CONST) Eth_StaticConfigPtr = 
{
 {
      &Eth_Static[!"$CtrlConfigName"!],
 }
};
[!ENDLOOP!]
[!ENDSELECT!]

#define ETH_STOP_SEC_CONST_UNSPECIFIED
/* @violates @ref Eth_Cfg_c_REF_1 This violation is not fixed since the inclusion of Eth_MemMap.h is as per AUTOSAR requirement*/
/* @violates @ref Eth_Cfg_c_REF_2 Eth_MemMap.h is included after each section define in order to set the current memory section as defined by AUTOSAR */
#include "Eth_MemMap.h"

/*==================================================================================================
*                                   LOCAL FUNCTION PROTOTYPES
==================================================================================================*/


/*==================================================================================================
*                                       LOCAL FUNCTIONS
==================================================================================================*/


/*==================================================================================================
*                                       GLOBAL FUNCTIONS
==================================================================================================*/

#ifdef __cplusplus
}
#endif
/** @} */
