/**
*   @file    Mcu_CMU_Types.h
*   @version 1.0.0
*
*   @brief   AUTOSAR Mcu - Exported data outside of the Mcu from IPV_CMU.
*   @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_CMU_TYPES_H
#define MCU_CMU_TYPES_H


#ifdef __cplusplus
extern "C"{
#endif


/**
* @page misra_violations MISRA-C:2012 violations
*
* @section Mcu_CMU_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_CMU_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 "Soc_Ips.h"

#include "Reg_eSys_CMU.h"
/*==================================================================================================
                               SOURCE FILE VERSION INFORMATION
==================================================================================================*/
#define MCU_CMU_TYPES_VENDOR_ID                    43
#define MCU_CMU_TYPES_AR_RELEASE_MAJOR_VERSION     4
#define MCU_CMU_TYPES_AR_RELEASE_MINOR_VERSION     3
#define MCU_CMU_TYPES_AR_RELEASE_REVISION_VERSION  1
#define MCU_CMU_TYPES_SW_MAJOR_VERSION             1
#define MCU_CMU_TYPES_SW_MINOR_VERSION             0
#define MCU_CMU_TYPES_SW_PATCH_VERSION             0


/*==================================================================================================
                                      FILE VERSION CHECKS
==================================================================================================*/
/* Check if source file and PLLDIG header file are from the same vendor */
#if (MCU_CMU_TYPES_VENDOR_ID != MCU_CFG_VENDOR_ID)
    #error "Mcu_CMU_Types.h and Mcu_Cfg.h have different vendor ids"
#endif
/* Check if source file and PLLDIG header file are of the same Autosar version */
#if ((MCU_CMU_TYPES_AR_RELEASE_MAJOR_VERSION != MCU_CFG_AR_RELEASE_MAJOR_VERSION) || \
     (MCU_CMU_TYPES_AR_RELEASE_MINOR_VERSION != MCU_CFG_AR_RELEASE_MINOR_VERSION) || \
     (MCU_CMU_TYPES_AR_RELEASE_REVISION_VERSION != MCU_CFG_AR_RELEASE_REVISION_VERSION) \
    )
    #error "AutoSar Version Numbers of Mcu_CMU_Types.h and Mcu_Cfg.h are different"
#endif
/* Check if source file and PLLDIG header file are of the same Software version */
#if ((MCU_CMU_TYPES_SW_MAJOR_VERSION != MCU_CFG_SW_MAJOR_VERSION) || \
     (MCU_CMU_TYPES_SW_MINOR_VERSION != MCU_CFG_SW_MINOR_VERSION) || \
     (MCU_CMU_TYPES_SW_PATCH_VERSION != MCU_CFG_SW_PATCH_VERSION) \
    )
    #error "Software Version Numbers of Mcu_CMU_Types.h and Mcu_Cfg.h are different"
#endif

/* Check if current file and Soc_Ips header file are of the same version */
#ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
    #if ((MCU_CMU_TYPES_AR_RELEASE_MAJOR_VERSION != SOC_IPS_AR_RELEASE_MAJOR_VERSION) || \
         (MCU_CMU_TYPES_AR_RELEASE_MINOR_VERSION != SOC_IPS_AR_RELEASE_MINOR_VERSION) \
        )
        #error "AutoSar Version Numbers of Mcu_CMU_Types.h and Soc_Ips.h are different"
    #endif
#endif

/* Check if source file and PLLDIG header file are from the same vendor */
#if (MCU_CMU_TYPES_VENDOR_ID != REG_ESYS_CMU_VENDOR_ID)
    #error "Mcu_CMU_Types.h and Reg_eSys_CMU.h have different vendor ids"
#endif
/* Check if source file and PLLDIG header file are of the same Autosar version */
#if ((MCU_CMU_TYPES_AR_RELEASE_MAJOR_VERSION != REG_ESYS_CMU_AR_RELEASE_MAJOR_VERSION) || \
     (MCU_CMU_TYPES_AR_RELEASE_MINOR_VERSION != REG_ESYS_CMU_AR_RELEASE_MINOR_VERSION) || \
     (MCU_CMU_TYPES_AR_RELEASE_REVISION_VERSION != REG_ESYS_CMU_AR_RELEASE_REVISION_VERSION) \
    )
    #error "AutoSar Version Numbers of Mcu_CMU_Types.h and Reg_eSys_CMU.h are different"
#endif
/* Check if source file and PLLDIG header file are of the same Software version */
#if ((MCU_CMU_TYPES_SW_MAJOR_VERSION != REG_ESYS_CMU_SW_MAJOR_VERSION) || \
     (MCU_CMU_TYPES_SW_MINOR_VERSION != REG_ESYS_CMU_SW_MINOR_VERSION) || \
     (MCU_CMU_TYPES_SW_PATCH_VERSION != REG_ESYS_CMU_SW_PATCH_VERSION) \
    )
    #error "Software Version Numbers of Mcu_CMU_Types.h and Reg_eSys_CMU.h are different"
#endif

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


/*==================================================================================================
                                       DEFINES AND MACROS
==================================================================================================*/
#if (MCU_INIT_CLOCK == STD_ON)
/* various exported defines */
/* for CMU_CSR */
/**
* @violates @ref Mcu_CMU_Types_h_REF_1 A function should be used in preference to a function-like macro
* where they are interchangeable.
*/
#define CMU_CSR_U32(value)               ((uint32)( ((value) & CMU_CSR_RWBITS_MASK32) | CMU_CSR_RESBITS_MASK32))
/** @violates @ref Mcu_CMU_Types_h_REF_2 This violation is due to macros reserved for future use. */
#define CMU_CSR_RCDIV_1_U32              ((uint32)0x00000000U)
/** @violates @ref Mcu_CMU_Types_h_REF_2 This violation is due to macros reserved for future use. */
#define CMU_CSR_RCDIV_2_U32              ((uint32)0x00000002U)
/** @violates @ref Mcu_CMU_Types_h_REF_2 This violation is due to macros reserved for future use. */
#define CMU_CSR_RCDIV_4_U32              ((uint32)0x00000004U)
/** @violates @ref Mcu_CMU_Types_h_REF_2 This violation is due to macros reserved for future use. */
#define CMU_CSR_RCDIV_8_U32              ((uint32)0x00000006U)
/** @violates @ref Mcu_CMU_Types_h_REF_2 This violation is due to macros reserved for future use. */
#define CMU_CSR_CMU_ENA_U32              ((uint32)0x00000001U)
/** @violates @ref Mcu_CMU_Types_h_REF_2 This violation is due to macros reserved for future use. */
#define CMU_CSR_CMU_DIS_U32              ((uint32)0x00000000U)

/* for CMU_HFREFR */
/**
* @violates @ref Mcu_CMU_Types_h_REF_1 A function should be used in preference to a function-like macro
* where they are interchangeable.
*/
#define CMU_HFREFR_VALUE_U32(value)      ((uint32)( ((value) & CMU_HFREFR_RWBITS_MASK32 ) | CMU_HFREFR_RESBITS_MASK32))

/* for CMU_LFREFR */
/**
* @violates @ref Mcu_CMU_Types_h_REF_1 A function should be used in preference to a function-like macro
* where they are interchangeable.
*/
#define CMU_LFREFR_VALUE_U32(value)      ((uint32)( ((value) & CMU_LFREFR_RWBITS_MASK32 ) | CMU_LFREFR_RESBITS_MASK32))
#endif /* MCU_INIT_CLOCK == STD_ON */
/*==================================================================================================
*                                             ENUMS
==================================================================================================*/


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

#if (MCU_INIT_CLOCK == STD_ON)
/**
* @brief   MC_CGM IP configuration.
* @details This structure contains information for IRCOSC, XOSC, PLL, Output Clocks, CMUs
*          The definitions for each Clock setting within the structure Mcu_ConfigType shall contain:
*          - MCU specific properties as, e.g., clock safety features and special clock distribution
*            settings
*          - PLL settings /start lock options
*          - Internal oscillator setting
*/
typedef struct
{
#if (defined(MCU_CMU_RCDIV_INDEPEND) && (MCU_CMU_RCDIV_INDEPEND == STD_ON))
    /**< @brief CMU_x_CSR[RCDIV] exist. */
    VAR (boolean, MCU_VAR) abCmuRcdiv[MCU_CMU_UNITS];
#endif
    /**< @brief CMU configuration register. */
    VAR (uint32, MCU_VAR) au32CmuConfig[MCU_CMU_UNITS];
    /**< @brief CMU High frequency reference value. */
    VAR (uint32, MCU_VAR) au32CmuHfRef[MCU_CMU_UNITS];
    /**< @brief CMU Low  frequency reference value. */
    VAR (uint32, MCU_VAR) au32CmuLfRef[MCU_CMU_UNITS];

} Mcu_CMU_ConfigType;

#endif /* MCU_INIT_CLOCK == STD_ON */

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

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


#ifdef __cplusplus
}
#endif

#endif /* MCU_CMU_TYPES_H */

/** @} */

