/**
*   @file    Mcu_eMios_Types.h
*   @version 1.0.0
*
*   @brief   AUTOSAR Mcu - Exported data outside of the Mcu from eMios.
*   @details Public data types exported outside of the Mcu driver.
*
*   @addtogroup MCU
*   @{
*/
/*==================================================================================================
*   Project              : AUTOSAR 4.3 MCAL
*   Platform             : PA
*   Peripheral           : MC
*   Dependencies         : none
*
*   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.
==================================================================================================*/
/*==================================================================================================
==================================================================================================*/

#ifndef MCU_EMIOS_TYPES_H
#define MCU_EMIOS_TYPES_H

#ifdef __cplusplus
extern "C"{
#endif

/**
* @page misra_violations MISRA-C:2012 violations
*
* @section Mcu_eMios_Types_h_REF_1
* Violates MISRA 2012 Advisory Directive 4.9, A function should be used in preference to a function-like macro
* where they are interchangeable. This violation is done to reduce code complexity by using function-like macros
* defined for register operations.
*
* @section Mcu_eMios_Types_h_REF_2
* Violates MISRA 2012 Advisory Rule 2.5, A project should not contain unused macro declarations.
*
*/

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

/*===============================================================================================
                               SOURCE FILE VERSION INFORMATION
===============================================================================================*/
#define MCU_EMIOS_TYPES_VENDOR_ID                       43
#define MCU_EMIOS_TYPES_AR_RELEASE_MAJOR_VERSION        4
#define MCU_EMIOS_TYPES_AR_RELEASE_MINOR_VERSION        3
#define MCU_EMIOS_TYPES_AR_RELEASE_REVISION_VERSION     1
#define MCU_EMIOS_TYPES_SW_MAJOR_VERSION                1
#define MCU_EMIOS_TYPES_SW_MINOR_VERSION                0
#define MCU_EMIOS_TYPES_SW_PATCH_VERSION                0

/*===============================================================================================
                                      FILE VERSION CHECKS
===============================================================================================*/
/* Check if source file and Mcu_Reg_eSys_eMios header file are from the same vendor */
#if (MCU_EMIOS_TYPES_VENDOR_ID != MCU_CFG_VENDOR_ID)
    #error "Mcu_eMios_Types.h and Mcu_Cfg.h have different vendor ids"
#endif
/* Check if source file and Mcu_Reg_eSys_eMios header file are of the same Autosar version */
#if ((MCU_EMIOS_TYPES_AR_RELEASE_MAJOR_VERSION != MCU_CFG_AR_RELEASE_MAJOR_VERSION) || \
     (MCU_EMIOS_TYPES_AR_RELEASE_MINOR_VERSION != MCU_CFG_AR_RELEASE_MINOR_VERSION) || \
     (MCU_EMIOS_TYPES_AR_RELEASE_REVISION_VERSION != MCU_CFG_AR_RELEASE_REVISION_VERSION) \
    )
    #error "AutoSar Version Numbers of Mcu_eMios_Types.h and Mcu_Cfg.h are different"
#endif
/* Check if source file and Mcu_Reg_eSys_eMios header file are of the same Software version */
#if ((MCU_EMIOS_TYPES_SW_MAJOR_VERSION != MCU_CFG_SW_MAJOR_VERSION) || \
     (MCU_EMIOS_TYPES_SW_MINOR_VERSION != MCU_CFG_SW_MINOR_VERSION) || \
     (MCU_EMIOS_TYPES_SW_PATCH_VERSION != MCU_CFG_SW_PATCH_VERSION) \
    )
    #error "Software Version Numbers of Mcu_eMios_Types.h and Mcu_Cfg.h are different"
#endif

/* Check if source file and eMios header file are from the same vendor */
#if (MCU_EMIOS_TYPES_VENDOR_ID != MCU_REG_ESYS_EMIOS_VENDOR_ID)
    #error "Mcu_eMios_Types.h and Mcu_Reg_eSys_eMios.h have different vendor ids"
#endif
/* Check if source file and eMios header file are of the same Autosar version */
#if ((MCU_EMIOS_TYPES_AR_RELEASE_MAJOR_VERSION != MCU_REG_ESYS_EMIOS_AR_RELEASE_MAJOR_VERSION) || \
     (MCU_EMIOS_TYPES_AR_RELEASE_MINOR_VERSION != MCU_REG_ESYS_EMIOS_AR_RELEASE_MINOR_VERSION) || \
     (MCU_EMIOS_TYPES_AR_RELEASE_REVISION_VERSION != MCU_REG_ESYS_EMIOS_AR_RELEASE_REVISION_VERSION) \
    )
    #error "AutoSar Version Numbers of Mcu_eMios_Types.h and Mcu_Reg_eSys_eMios.h are different"
#endif
/* Check if source file and eMios header file are of the same Software version */
#if ((MCU_EMIOS_TYPES_SW_MAJOR_VERSION != MCU_REG_ESYS_EMIOS_SW_MAJOR_VERSION) || \
     (MCU_EMIOS_TYPES_SW_MINOR_VERSION != MCU_REG_ESYS_EMIOS_SW_MINOR_VERSION) || \
     (MCU_EMIOS_TYPES_SW_PATCH_VERSION != MCU_REG_ESYS_EMIOS_SW_PATCH_VERSION) \
    )
    #error "Software Version Numbers of Mcu_eMios_Types.h and Mcu_Reg_eSys_eMios.h are different"
#endif

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


/*==================================================================================================
                                       DEFINES AND MACROS
==================================================================================================*/
#if (MCU_EMIOS_SUPPORT == STD_ON)
/**
* @violates @ref Mcu_eMios_Types_h_REF_1 A function should be used in preference to a function-like macro
* where they are interchangeable.
*/
#define EMIOS_MCR_U32(value)                ((uint32)( ((value) & EMIOS_MCR_RWBITS_MASK32 ) | EMIOS_MCR_RESBITS_MASK32 ))
/** @violates @ref Mcu_eMios_Types_h_REF_2 This violation is due to macros reserved for future use. */
#define EMIOS_MCR_MDIS_ENA_U32              (EMIOS_MCR_MDIS_MASK32)
/** @violates @ref Mcu_eMios_Types_h_REF_2 This violation is due to macros reserved for future use. */
#define EMIOS_MCR_MDIS_DIS_U32              ((uint32)0x00000000U)
/** @violates @ref Mcu_eMios_Types_h_REF_2 This violation is due to macros reserved for future use. */
#define EMIOS_MCR_FRZ_ENA_U32               (EMIOS_MCR_FRZ_MASK32)
/** @violates @ref Mcu_eMios_Types_h_REF_2 This violation is due to macros reserved for future use. */
#define EMIOS_MCR_FRZ_DIS_U32               ((uint32)0x00000000U)
/** @violates @ref Mcu_eMios_Types_h_REF_2 This violation is due to macros reserved for future use. */
#define EMIOS_MCR_GTBE_ENA_U32              (EMIOS_MCR_GTBE_MASK32)
/** @violates @ref Mcu_eMios_Types_h_REF_2 This violation is due to macros reserved for future use. */
#define EMIOS_MCR_GTBE_DIS_U32              ((uint32)0x00000000U)
/** @violates @ref Mcu_eMios_Types_h_REF_2 This violation is due to macros reserved for future use. */
#define EMIOS_MCR_ETB_ENA_U32               (EMIOS_MCR_ETB_MASK32)
/** @violates @ref Mcu_eMios_Types_h_REF_2 This violation is due to macros reserved for future use. */
#define EMIOS_MCR_ETB_DIS_U32               ((uint32)0x00000000U)
/** @violates @ref Mcu_eMios_Types_h_REF_2 This violation is due to macros reserved for future use. */
#define EMIOS_MCR_GPREN_ENA_U32             (EMIOS_MCR_GPREN_MASK32)
/** @violates @ref Mcu_eMios_Types_h_REF_2 This violation is due to macros reserved for future use. */
#define EMIOS_MCR_GPREN_DIS_U32             ((uint32)0x00000000U)

/**
* @violates @ref Mcu_eMios_Types_h_REF_1 A function should be used in preference to a function-like macro
* where they are interchangeable.
*/
#define EMIOS_MCR_SRV_U32(value)            ((uint32)( (uint32)( (value) << EMIOS_MCR_SRV_SHIFT32 ) & EMIOS_MCR_SRV_MASK32 ))
/**
* @violates @ref Mcu_eMios_Types_h_REF_1 A function should be used in preference to a function-like macro
* where they are interchangeable.
*/
#define EMIOS_MCR_GPRE_U32(value)           ((uint32)( (uint32)( (value) << EMIOS_MCR_GPRE_SHIFT32 ) & EMIOS_MCR_GPRE_MASK32 ))
#endif /* (MCU_EMIOS_SUPPORT == STD_ON) */

#if (MCU_EMIOS_CONFIGURE_GPREN_API == STD_ON)
#ifdef EMIOS_0_BASEADDR
/** @violates @ref Mcu_eMios_Types_h_REF_2 This violation is due to macros reserved for future use. */
#define MCU_EMIOS_MODULE_0                  ((uint8)0x00U)
#endif /* EMIOS_0_BASEADDR */

#ifdef EMIOS_1_BASEADDR
/** @violates @ref Mcu_eMios_Types_h_REF_2 This violation is due to macros reserved for future use. */
#define MCU_EMIOS_MODULE_1                  ((uint8)0x01U)
#endif /* EMIOS_1_BASEADDR */

#ifdef EMIOS_2_BASEADDR
/** @violates @ref Mcu_eMios_Types_h_REF_2 This violation is due to macros reserved for future use. */
#define MCU_EMIOS_MODULE_2                  ((uint8)0x02U)
#endif /* EMIOS_2_BASEADDR */

#ifdef EMIOS_3_BASEADDR
/** @violates @ref Mcu_eMios_Types_h_REF_2 This violation is due to macros reserved for future use. */
#define MCU_EMIOS_MODULE_3                  ((uint8)0x03U)
#endif /* EMIOS_3_BASEADDR */

#define MCU_EMIOS_GPREN_BIT_ENABLE          (0x01U)
/** @violates @ref Mcu_eMios_Types_h_REF_2 This violation is due to macros reserved for future use. */
#define MCU_EMIOS_GPREN_BIT_DISABLE         (0x00U)
#endif /* (MCU_EMIOS_CONFIGURE_GPREN_API == STD_ON) */
/*==================================================================================================
*                                             ENUMS
==================================================================================================*/


/*==================================================================================================
*                                STRUCTURES AND OTHER TYPEDEFS
==================================================================================================*/
#if (MCU_EMIOS_SUPPORT == STD_ON)
/**
* @brief            EMIOS configuration.
*
*/
typedef struct
{
    VAR(uint32,  MCU_VAR) au32EmiosData[MCU_EMIOS_NB_MODULES];

} Mcu_eMios_ConfigType;
#endif

/*==================================================================================================
*                                GLOBAL VARIABLE DECLARATIONS
==================================================================================================*/


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

#ifdef __cplusplus
}
#endif

#endif /* MCU_EMIOS_TYPES_H */
/** @} */
