/**
*   @file    Eth_SIU.c
*   @version 0.4.3
*
*    @brief            System Integration Unit 
*    @details          Implement the device system integration units
*
*   @addtogroup ETH_DRIVER
*   @{
*/
/*==================================================================================================
*   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_SIU_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_SIU_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_SIU_c_REF_4
* Violates MISRA 2012 Advisory Rule 11.4, A conversion should not be performed between a pointer to object
* and an integer type.
* The cast is used to access memory mapped registers.
*
* @section Eth_SIU_c_REF_5
* Violates MISRA 2012 Required Rule 11.6, A cast shall not be performed between pointer to void and an arithmetic type.
*
* @section Eth_SIU_c_REF_6
* Violates MISRA 2012 Required Rule 10.8, The value of a composite expression shall not be cast to a different essential 
* type category or a wider essential type.
*
* @section Eth_SIU_c_REF_7
* Violates MISRA 2012 Required Rule 7.2, A "U" or "u" sall be applied to all interger constants.
*/

/*==================================================================================================
*                                        INCLUDE FILES
* 1) system and project includes
* 2) needed interfaces from external units
* 3) internal and external interfaces from this unit
==================================================================================================*/
#include "Eth_SIU.h" 
#include "StdRegMacros.h"                 
/*==================================================================================================
*                              SOURCE FILE VERSION INFORMATION
==================================================================================================*/

#define ETH_SIU_VENDOR_ID_C                      43
#define ETH_SIU_MODULE_ID_C                      88
#define ETH_SIU_AR_RELEASE_MAJOR_VERSION_C       4
#define ETH_SIU_AR_RELEASE_MINOR_VERSION_C       3
#define ETH_SIU_AR_RELEASE_REVISION_VERSION_C    1
#define ETH_SIU_SW_MAJOR_VERSION_C               1
#define ETH_SIU_SW_MINOR_VERSION_C               0
#define ETH_SIU_SW_PATCH_VERSION_C               0

/*==================================================================================================
*                                     FILE VERSION CHECKS
==================================================================================================*/
/* Check if current file and ETH_SIU header file are of the same vendor */
#if(ETH_SIU_VENDOR_ID_C != ETH_SIU_VENDOR_ID_H)
    #error "Eth_SIU.c and ETH_SIU.h have different vendor ids"
#endif
/* Check if current file and ETH_SIU header file are of the same module */
#if(ETH_SIU_MODULE_ID_C != ETH_SIU_MODULE_ID_H)
    #error "Eth_SIU.c and ETH_SIU.h have different module ids"
#endif
/* Check if current file and ETH header file are of the same Autosar version */
#if ((ETH_SIU_AR_RELEASE_MAJOR_VERSION_C    != ETH_SIU_AR_RELEASE_MAJOR_VERSION_H) || \
     (ETH_SIU_AR_RELEASE_MINOR_VERSION_C    != ETH_SIU_AR_RELEASE_MINOR_VERSION_H) || \
     (ETH_SIU_AR_RELEASE_REVISION_VERSION_C != ETH_SIU_AR_RELEASE_REVISION_VERSION_H) \
    )
    #error "AutoSar Version Numbers of Eth_SIU.c and Eth_SIU.h are different"
#endif
/* Check if current file and ETH header file are of the same Software version */
#if ((ETH_SIU_SW_MAJOR_VERSION_C != ETH_SIU_SW_MAJOR_VERSION_H) || \
     (ETH_SIU_SW_MINOR_VERSION_C != ETH_SIU_SW_MINOR_VERSION_H) || \
     (ETH_SIU_SW_PATCH_VERSION_C != ETH_SIU_SW_PATCH_VERSION_H)    \
    )
    #error "Software Version Numbers of Eth_SIU.c and Eth_SIU.h are different"
#endif
#ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
    /* Check if current file and StdRegMacros header file are of the same version */
    #if ((ETH_SIU_AR_RELEASE_MAJOR_VERSION_C != STDREGMACROS_AR_RELEASE_MAJOR_VERSION) ||   \
         (ETH_SIU_AR_RELEASE_MINOR_VERSION_C != STDREGMACROS_AR_RELEASE_MINOR_VERSION)      \
        )
        #error "AutoSar Version Numbers of Eth_SIU.c and StdRegMacros.h are different"
    #endif
#endif /* DISABLE_MCAL_INTERMODULE_ASR_CHECK */
/*==================================================================================================
*                          LOCAL TYPEDEFS (STRUCTURES, UNIONS, ENUMS)
==================================================================================================*/
/*==============================================================================
*                                       LOCAL FUNCTIONS
==============================================================================*/

#define ETH_START_SEC_CODE
/* @violates @ref Eth_SIU_c_REF_1 This violation is not fixed since the inclusion of Eth_MemMap.h is as per AUTOSAR requirement*/
/* @violates @ref Eth_SIU_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"

/**
* @brief            This function will configure the FEC Mode
*
* @details          This function will configure FEC in MII or RMII mode
*
*/
#if defined (ETH_MII_MODE_SEL)
#if STD_ON == ETH_MII_MODE_SEL
FUNC(void, ETH_CODE) Eth_SIU_ModeSelect(void)
{ 
    /* @violates @ref Eth_SIU_c_REF_4 The cast is used to access memory mapped registers. */
    /* @violates @ref Eth_SIU_c_REF_5 */
    /* @violates @ref Eth_SIU_c_REF_6 */ 
    /* @violates @ref Eth_SIU_c_REF_7 */ 
    REG_WRITE32((uint32)(SIU_BASEADDR + SIU_FECCR_OFFSET_ADDR_U32), SIU_FECCR_FM_MASK_U32); 
}
#endif
#endif
#define ETH_STOP_SEC_CODE
/* @violates @ref Eth_SIU_c_REF_1 This violation is not fixed since the inclusion of Eth_MemMap.h is as per AUTOSAR requirement*/
/* @violates @ref Eth_SIU_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"

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