/**
*   @file    Mcu_Dem_Wrapper.h
*   @version 1.0.0
*
*   @brief   AUTOSAR Mcu - Convenience macros for DEM.
*   @details Contains convenience macros for DEM calls to reduce code clutter in IPs.
*
*   @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_DEM_WRAPPER_H
#define MCU_DEM_WRAPPER_H

#ifdef __cplusplus
extern "C"{
#endif

/**
* @page misra_violations MISRA-C:2012 violations
*
* @section Mcu_Dem_Wrapper_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 not having to clutter
* every function which can throw a timeout error with DEM preprocessor directives.
*
* @section Mcu_Dem_Wrapper_h_REF_2
* Violates MISRA 2012 Required Rule 5.4, Macro identifiers shall be distinct.
* This violation is due to the AUTOSAR requirement [SWS_BSW_00036] (perform inter module checks).
*
* @section Mcu_Dem_Wrapper_h_REF_3
* Violates MISRA 2012 Required Rule 5.1, External identifiers shall be distinct.
* This rule does not apply if either identifier is a macro identifier, because this case is covered
* by Rule 5.4 and Rule 5.5.
*
* @section Mcu_Dem_Wrapper_h_REF_4
* Violates MISRA 2012 Required Rule 5.2, Identifiers declared in the same scope and name space shall be distinct.
* This rule does not apply if either identifier is a macro identifier, because this case is covered
* by Rule 5.4 and Rule 5.5.
*
* @section Mcu_Dem_Wrapper_h_REF_5
* Violates MISRA 2012 Required Rule 5.5, Identifiers shall be distinct from macro names.
* The identifier clash is between macro identifiers. Therefore, this rule is incorrectly reported by the tool.
*
*/


/*==================================================================================================
                                         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"

#if (MCU_DISABLE_DEM_REPORT_ERROR_STATUS == STD_OFF)
  #include "Dem.h"
#endif

/*==================================================================================================
                               SOURCE FILE VERSION INFORMATION
==================================================================================================*/
#define MCU_DEM_WRAPPER_VENDOR_ID                       43
/**
* @violates @ref Mcu_Dem_Wrapper_h_REF_2 Macro identifiers shall be distinct.
*
* @violates @ref Mcu_Dem_Wrapper_h_REF_3 External identifiers shall be distinct.
*
* @violates @ref Mcu_Dem_Wrapper_h_REF_4 Identifiers declared in the same scope and name space shall be distinct.
*
* @violates @ref Mcu_Dem_Wrapper_h_REF_5 Identifiers shall be distinct from macro names.
*/
#define MCU_DEM_WRAPPER_AR_RELEASE_MAJOR_VERSION        4
/**
* @violates @ref Mcu_Dem_Wrapper_h_REF_2 Macro identifiers shall be distinct.
*
* @violates @ref Mcu_Dem_Wrapper_h_REF_3 External identifiers shall be distinct.
*
* @violates @ref Mcu_Dem_Wrapper_h_REF_4 Identifiers declared in the same scope and name space shall be distinct.
*
* @violates @ref Mcu_Dem_Wrapper_h_REF_5 Identifiers shall be distinct from macro names.
*/
#define MCU_DEM_WRAPPER_AR_RELEASE_MINOR_VERSION        3
/**
* @violates @ref Mcu_Dem_Wrapper_h_REF_2 Macro identifiers shall be distinct.
*
* @violates @ref Mcu_Dem_Wrapper_h_REF_3 External identifiers shall be distinct.
*
* @violates @ref Mcu_Dem_Wrapper_h_REF_4 Identifiers declared in the same scope and name space shall be distinct.
*
* @violates @ref Mcu_Dem_Wrapper_h_REF_5 Identifiers shall be distinct from macro names.
*/
#define MCU_DEM_WRAPPER_AR_RELEASE_REVISION_VERSION     1
/**
* @violates @ref Mcu_Dem_Wrapper_h_REF_2 Macro identifiers shall be distinct.
*
* @violates @ref Mcu_Dem_Wrapper_h_REF_3 External identifiers shall be distinct.
*
* @violates @ref Mcu_Dem_Wrapper_h_REF_4 Identifiers declared in the same scope and name space shall be distinct.
*
* @violates @ref Mcu_Dem_Wrapper_h_REF_5 Identifiers shall be distinct from macro names.
*/
#define MCU_DEM_WRAPPER_SW_MAJOR_VERSION                1
/**
* @violates @ref Mcu_Dem_Wrapper_h_REF_2 Macro identifiers shall be distinct.
*
* @violates @ref Mcu_Dem_Wrapper_h_REF_3 External identifiers shall be distinct.
*
* @violates @ref Mcu_Dem_Wrapper_h_REF_4 Identifiers declared in the same scope and name space shall be distinct.
*
* @violates @ref Mcu_Dem_Wrapper_h_REF_5 Identifiers shall be distinct from macro names.
*/
#define MCU_DEM_WRAPPER_SW_MINOR_VERSION                0
/**
* @violates @ref Mcu_Dem_Wrapper_h_REF_2 Macro identifiers shall be distinct.
*
* @violates @ref Mcu_Dem_Wrapper_h_REF_3 External identifiers shall be distinct.
*
* @violates @ref Mcu_Dem_Wrapper_h_REF_4 Identifiers declared in the same scope and name space shall be distinct.
*
* @violates @ref Mcu_Dem_Wrapper_h_REF_5 Identifiers shall be distinct from macro names.
*/
#define MCU_DEM_WRAPPER_SW_PATCH_VERSION                0

/*==================================================================================================
                                      FILE VERSION CHECKS
==================================================================================================*/
/**
* @brief            The MCU module's implementer shall avoid the integration of incompatible files.
*
*/
/* Check if current file and MCU configuration header file are of the same vendor */
#if (MCU_DEM_WRAPPER_VENDOR_ID != MCU_CFG_VENDOR_ID)
    #error "Mcu_Dem_Wrapper.h and Mcu_Cfg.h have different vendor ids"
#endif

/* Check if current file and MCU configuration header file are of the same Autosar version */
#if ((MCU_DEM_WRAPPER_AR_RELEASE_MAJOR_VERSION    != MCU_CFG_AR_RELEASE_MAJOR_VERSION) || \
     (MCU_DEM_WRAPPER_AR_RELEASE_MINOR_VERSION    != MCU_CFG_AR_RELEASE_MINOR_VERSION) || \
     (MCU_DEM_WRAPPER_AR_RELEASE_REVISION_VERSION != MCU_CFG_AR_RELEASE_REVISION_VERSION) \
    )
    #error "AutoSar Version Numbers of Mcu_Dem_Wrapper.h and Mcu_Cfg.h are different"
#endif

/* Check if current file and MCU configuration header file are of the same software version */
#if ((MCU_DEM_WRAPPER_SW_MAJOR_VERSION != MCU_CFG_SW_MAJOR_VERSION) || \
     (MCU_DEM_WRAPPER_SW_MINOR_VERSION != MCU_CFG_SW_MINOR_VERSION) || \
     (MCU_DEM_WRAPPER_SW_PATCH_VERSION != MCU_CFG_SW_PATCH_VERSION) \
    )
    #error "Software Version Numbers of Mcu_Dem_Wrapper.h and Mcu_Cfg.h are different"
#endif


#if (MCU_DISABLE_DEM_REPORT_ERROR_STATUS == STD_OFF)
#ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
/* Check if current file and DEM header file are of the same version */
  #if ( (MCU_DEM_WRAPPER_AR_RELEASE_MAJOR_VERSION != DEM_AR_RELEASE_MAJOR_VERSION) || \
        (MCU_DEM_WRAPPER_AR_RELEASE_MINOR_VERSION != DEM_AR_RELEASE_MINOR_VERSION)    \
      )
      #error "AutoSar Version Numbers of Mcu_Dem_Wrapper.h and Dem.h are different"
  #endif
#endif
#endif

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

/*==================================================================================================
                                       DEFINES AND MACROS
==================================================================================================*/
#if (MCU_DISABLE_DEM_REPORT_ERROR_STATUS == STD_OFF)
    /* @violates @ref Mcu_Dem_Wrapper_h_REF_1 A function should be used in preference to a function-like macro. */
    #define Mcu_Macro_ReportDemTimeoutError(u32Timeout)  (Mcu_ReportDemTimeoutError((u32Timeout)))
#else
    /* @violates @ref Mcu_Dem_Wrapper_h_REF_1 A function should be used in preference to a function-like macro. */
    #define Mcu_Macro_ReportDemTimeoutError(u32Timeout)
#endif

/*==================================================================================================
                                             ENUMS
==================================================================================================*/

/*==================================================================================================
                                 STRUCTURES AND OTHER TYPEDEFS
==================================================================================================*/

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

/*==================================================================================================
                                     FUNCTION PROTOTYPES
==================================================================================================*/
#if (MCU_DISABLE_DEM_REPORT_ERROR_STATUS == STD_OFF)
FUNC(void, MCU_CODE) Mcu_ReportDemTimeoutError(CONST(uint32, AUTOMATIC) u32Timeout);
#endif

#ifdef __cplusplus
}
#endif

#endif /* MCU_DEM_WRAPPER_H */

/** @} */
