/**
*   @file    Mcu_PMC_Irq.c
*   @version 1.0.0
*
*   @brief   AUTOSAR Mcu - Power Management Controller module functions implementation.
*   @details Specific functions for PMC configuration and control.
*
*   @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.
==================================================================================================*/
/*==================================================================================================
==================================================================================================*/

#ifdef __cplusplus
extern "C"
{
#endif


/**
* @page misra_violations MISRA-C:2012 violations
*
* @section Mcu_PMC_IRQ_c_REF_1
* 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 Mcu_PMC_IRQ_c_REF_2
* 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 Mcu_MemMap.h is as
* per AUTOSAR requirement [SWS_MemMap_00003].
*
*/


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


/*==================================================================================================
                               SOURCE FILE VERSION INFORMATION
=================================================================================================*/
#define MCU_PMC_IRQ_VENDOR_ID_C                     43
#define MCU_PMC_IRQ_AR_RELEASE_MAJOR_VERSION_C      4
#define MCU_PMC_IRQ_AR_RELEASE_MINOR_VERSION_C      3
#define MCU_PMC_IRQ_AR_RELEASE_REVISION_VERSION_C   1
#define MCU_PMC_IRQ_SW_MAJOR_VERSION_C              1
#define MCU_PMC_IRQ_SW_MINOR_VERSION_C              0
#define MCU_PMC_IRQ_SW_PATCH_VERSION_C              0


/*==================================================================================================
                                      FILE VERSION CHECKS
==================================================================================================*/
/* Check if current file and Mcal header file are of the same version */
#ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
    #if ((MCU_PMC_IRQ_AR_RELEASE_MAJOR_VERSION_C != MCAL_AR_RELEASE_MAJOR_VERSION) || \
         (MCU_PMC_IRQ_AR_RELEASE_MINOR_VERSION_C != MCAL_AR_RELEASE_MINOR_VERSION) \
        )
        #error "AutoSar Version Numbers of Mcu_PMC_Irq.c and Mcal.h are different"
    #endif
#endif

/* Check if current file and Mcu_PMC_Irq header file are of the same Autosar version */
#if (MCU_PMC_IRQ_VENDOR_ID_C != MCU_PMC_VENDOR_ID)
    #error "Mcu_PMC_Irq.c and Mcu_PMC.h have different vendor ids"
#endif
/* Check if current file and Mcu_PMC_Irq header file are of the same Autosar version */
#if ((MCU_PMC_IRQ_AR_RELEASE_MAJOR_VERSION_C    != MCU_PMC_AR_RELEASE_MAJOR_VERSION) || \
     (MCU_PMC_IRQ_AR_RELEASE_MINOR_VERSION_C    != MCU_PMC_AR_RELEASE_MINOR_VERSION) || \
     (MCU_PMC_IRQ_AR_RELEASE_REVISION_VERSION_C != MCU_PMC_AR_RELEASE_REVISION_VERSION) \
    )
    #error "AutoSar Version Numbers of Mcu_PMC_Irq.c and Mcu_PMC.h are different"
#endif
/* Check if current file and Mcu_PMC_Irq header file are of the same Software version */
#if ((MCU_PMC_IRQ_SW_MAJOR_VERSION_C != MCU_PMC_SW_MAJOR_VERSION) || \
     (MCU_PMC_IRQ_SW_MINOR_VERSION_C != MCU_PMC_SW_MINOR_VERSION) || \
     (MCU_PMC_IRQ_SW_PATCH_VERSION_C != MCU_PMC_SW_PATCH_VERSION) \
    )
    #error "Software Version Numbers of Mcu_PMC_Irq.c and Mcu_PMC.h are different"
#endif

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


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


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


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


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


/*==================================================================================================
                                       GLOBAL VARIABLES
==================================================================================================*/


/*==================================================================================================
                                   LOCAL FUNCTION PROTOTYPES
==================================================================================================*/
#define MCU_START_SEC_CODE
/**
* @violates @ref Mcu_PMC_IRQ_c_REF_2 Precautions shall be taken in order to prevent the contents
* of a header file being included more than once.
*/
#include "Mcu_MemMap.h"

#if (MCU_VOLTAGE_ERROR_ISR_USED == STD_ON)
ISR(Mcu_PMC_LowVoltage_ISR);
#endif /* (MCU_VOLTAGE_ERROR_ISR_USED == STD_ON) */

#if (MCU_TEMPERATURE_ERROR_ISR_USED == STD_ON)
ISR(Mcu_PMC_TemperatureError_ISR);
#endif /* (MCU_TEMPERATURE_ERROR_ISR_USED == STD_ON) */

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


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

#if (MCU_VOLTAGE_ERROR_ISR_USED == STD_ON)
/**
* @brief       This function represents the ISR handler for PMC related events.
* @details     This interrupt is triggered if one of the enabled PMC's detect an out of range clock.
*
*
* @isr
*
*/
ISR(Mcu_PMC_LowVoltage_ISR)
{
    Mcu_PMC_VoltageErrorIsr();
    EXIT_INTERRUPT();
}
#endif /* (MCU_VOLTAGE_ERROR_ISR_USED == STD_ON) */

#if (MCU_TEMPERATURE_ERROR_ISR_USED == STD_ON)
/**
* @brief       This function represents the ISR handler for PMC related events.
* @details     This interrupt is triggered if one of the enabled PMC's detect an out of range clock.
*
*
* @isr
*
*/
ISR(Mcu_PMC_TemperatureError_ISR)
{
    Mcu_PMC_TemperatureErrorIsr();
    EXIT_INTERRUPT();
}
#endif /* (MCU_TEMPERATURE_ERROR_ISR_USED == STD_ON) */


#define MCU_STOP_SEC_CODE
/**
* @violates @ref Mcu_PMC_IRQ_c_REF_1 #include directives should only be preceded by preprocessor
* directives or comments.
*
* @violates @ref Mcu_PMC_IRQ_c_REF_2 Precautions shall be taken in order to prevent the contents
* of a header file being included more than once.
*/
#include "Mcu_MemMap.h"


#ifdef __cplusplus
}
#endif

/** @} */
