[!NOCODE!]
/**
    @file    Mcu_RegOperations.m
    @version 1.0.0

    @brief   AUTOSAR Mcu - Register operations.
    @details Register operations.

    Project AUTOSAR 4.3 MCAL
    Platform PA
    Peripheral MC
    Dependencies none

    ARVersion 4.3.1
    ARRevision ASR_REL_4_3_REV_0001
    ARConfVariant
    SWVersion 1.0.0
    BuildVersion 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.
 */
/*==================================================================================================
==================================================================================================*/

[!MACRO "Mcu_Dem_Config"!][!//
[!NOCODE!]
    [!VAR "McuDemEventParameter"!]MCU_E_TIMEOUT_FAILURE,MCU_E_SSCM_CER_FAILURE[!ENDVAR!]
    [!VAR "DemErrorCount" = "num:i(count(text:split($McuDemEventParameter, ',')))"!]
[!CODE!]
#if (MCU_DISABLE_DEM_REPORT_ERROR_STATUS == STD_OFF)
/**
* @brief        DEM error reporting configuration
* @details      Set the state and id for Mcal_DemErrorType.
*/
CONST(Mcu_DemConfigType, MCU_CONST) Mcu_Dem_Config =
{
[!ENDCODE!]
    [!FOR "Index" = "1" TO "num:i($DemErrorCount)"!]
        [!VAR "ErrorName" = "normalize-space(text:split($McuDemEventParameter, ',')[num:i($Index)])"!]
        [!IF "node:exists(McuModuleConfiguration/McuDemEventParameterRefs)"!]
            [!VAR "DemRefNode" = "concat('McuModuleConfiguration/McuDemEventParameterRefs/',$ErrorName)"!]
            [!IF "node:exists($DemRefNode)"!]
                [!IF "node:refvalid($DemRefNode)"!]
[!CODE!]
    /* DEM error reporting [!"$ErrorName"!] */
    {(uint32)STD_ON, (uint32)DemConf_DemEventParameter_[!"node:ref(node:value($DemRefNode))/@name"!]}[!IF "$Index < $DemErrorCount"!],[!ENDIF!]
[!ENDCODE!]
                [!ELSE!]
                     [!ERROR "Invalid reference for $ErrorName"!]
                [!ENDIF!]
            [!ELSE!]
[!CODE!]
    /* DEM error reporting [!"$ErrorName"!] */
    {(uint32)STD_OFF, (uint32)0U}[!IF "$Index < $DemErrorCount"!],[!ENDIF!]
[!ENDCODE!]
            [!ENDIF!]
        [!ELSE!]
[!CODE!]
    /* DEM error reporting [!"$ErrorName"!] */
    {(uint32)STD_OFF, (uint32)0U}[!IF "$Index < $DemErrorCount"!],[!ENDIF!]
[!ENDCODE!]
        [!ENDIF!]
    [!ENDFOR!]
[!CODE!]
};
#endif /* (MCU_DISABLE_DEM_REPORT_ERROR_STATUS == STD_OFF) */
[!ENDCODE!]
[!ENDNOCODE!]
[!ENDMACRO!]


[!MACRO "McuLinkerSymbols","Type"!][!//
[!NOCODE!][!//
    [!LOOP "McuModuleConfiguration/McuRamSectorSettingConf/*"!]
        [!IF "McuRamSectionSizeLinkerSym != ''"!]
            [!VAR "Externs_SL" = "concat('extern  VAR(uint32, MCU_VAR) ',McuRamSectionSizeLinkerSym,'[];')"!]
[!CODE!][!//
[!"$Externs_SL"!]
[!ENDCODE!][!//
        [!ENDIF!]
        [!IF "McuRamSectionBaseAddrLinkerSym != ''"!]
            [!VAR "Externs_BAL" = "concat('extern  VAR(uint8, MCU_VAR) ',McuRamSectionBaseAddrLinkerSym,'[];')"!]
[!CODE!][!//
[!"$Externs_BAL"!]
[!ENDCODE!][!//
        [!ENDIF!]
    [!ENDLOOP!][!//McuRamSectorSettingConf/*
[!ENDNOCODE!][!//
[!ENDMACRO!][!//



[!MACRO "Mcu_Ram_Config","Type"!][!//
[!NOCODE!]
    [!IF "num:i(count(McuModuleConfiguration/McuRamSectorSettingConf/*))>0"!]
        [!VAR "RamSector"= "num:i(count(McuModuleConfiguration/McuRamSectorSettingConf/*))-1"!]
[!CODE!]
#ifndef MCU_MAX_NORAMCONFIGS
/**
* @brief        Definition of RAM sections within the configuration structure.
* @details      Blocks of memory are initialized with a default data.
*               Configuration set by calling Mcu_InitRamSection() API.
*
*/
static CONST(Mcu_RamConfigType, MCU_CONST) Mcu_aRamConfig[!"$Type"!][!IF "var:defined('postBuildVariant')"!]_[!"$postBuildVariant"!][!ENDIF!][[!"num:i(count(McuModuleConfiguration/McuRamSectorSettingConf/*))"!]] =
{
[!ENDCODE!]
    [!LOOP "McuModuleConfiguration/McuRamSectorSettingConf/*"!]
        [!VAR "PCindex" = "@index"!]
[!CODE!]
    {
        /* The ID for Ram Sector configuration. */
        (Mcu_RamSectionType)[!"num:i(McuRamSectorId)"!]U,

        /* RAM section base address: Start of Mcu_aRamConfig[[!"@index"!]]. */
        /** @violates @ref Mcu_PBcfg[!IF "var:defined('postBuildVariant')"!]_[!"$postBuildVariant"!][!ENDIF!]_c_REF_5 False positive error */
        /** @violates @ref Mcu_PBcfg[!IF "var:defined('postBuildVariant')"!]_[!"$postBuildVariant"!][!ENDIF!]_c_REF_6 The cast is used to access RAM in order to perform RAM initialization. */
        [!IF "McuRamSectionBaseAddrLinkerSym = ''"!](uint8 (*)[1U])[!"num:inttohex(McuRamSectionBaseAddress,8)"!]U[!ELSE!](uint8 (*)[1U])[!"McuRamSectionBaseAddrLinkerSym"!][!ENDIF!],

        /* RAM section size: Section base address (must be aligned to 4 bytes). */
        [!IF "McuRamSectionSizeLinkerSym = ''"!](Mcu_RamSizeType)[!"num:inttohex(McuRamSectionSize,8)"!]U,[!ELSE!](Mcu_RamSizeType)[!"McuRamSectionSizeLinkerSym"!],[!ENDIF!]

        /* RAM default value. */
[!ENDCODE!]
        [!VAR "FirstByte" = "1"!]
        [!CODE!][!WS "8"!](uint64) ( [!ENDCODE!]
        [!FOR "i" = "0" TO "node:fallback(McuRamSectionWriteSize, 8) - 1"!][!//
            [!CODE!][!IF "num:i($FirstByte)=0"!] | [!ENDIF!][!VAR "FirstByte"="0"!]((uint64)[!"num:inttohex(McuRamDefaultValue, 2)"!]U << [!"num:i($i * 8)"!]U)[!ENDCODE!]
        [!ENDFOR!]
        [!CODE!] ),[!ENDCODE!]
[!CODE!]

        /* RAM section write size (maximum allowed: 8). */
        (Mcu_RamWriteSizeType)[!"num:i(McuRamSectionWriteSize)"!]U

    }[!IF "$PCindex < $RamSector"!],[!ENDIF!] /* End of Mcu_aRamConfig[!"$Type"!][[!"@index"!]]. */
[!ENDCODE!]
    [!ENDLOOP!][!//McuRamSectorSettingConf/*
[!CODE!]
};
#endif /* ifndef MCU_MAX_NORAMCONFIGS */
[!ENDCODE!]
    [!ENDIF!][!//num:i(count(McuModuleConfiguration/McuRamSectorSettingConf/*))>0
[!ENDNOCODE!]
[!ENDMACRO!][!//


[!MACRO "Mcu_Mode_Config","Type"!][!//
[!NOCODE!]
        [!IF "num:i(count(McuModuleConfiguration/McuModeSettingConf/*))>0"!]
            [!VAR "Mode"= "num:i(count(McuModuleConfiguration/McuModeSettingConf/*))-1"!]
[!CODE!]
/**
* @brief        Definition of MCU mode sections in the configuration structure.
* @details      Specifies the system behaviour during the selected target mode.
*               Configuration set by calling Mcu_SetMode() API.
*/
static CONST(Mcu_ModeConfigType, MCU_CONST) Mcu_aModeConfig[!"$Type"!][!IF "var:defined('postBuildVariant')"!]_[!"$postBuildVariant"!][!ENDIF!][[!"num:i(count(McuModuleConfiguration/McuModeSettingConf/*))"!]U] =
{
[!ENDCODE!]
        [!LOOP "McuModuleConfiguration/McuModeSettingConf/*"!]
            [!VAR "PCindex" = "@index"!]
[!CODE!]
    /* Start of Mcu_aModeConfig[[!"@index"!]]*/
    {
        /* The ID for Power Mode configuration. */
        (Mcu_ModeType)[!"num:i(McuMode)"!]U,
        
        /* The Power Mode name (code). */
        (MCU_[!"McuPowerMode"!]_MODE),
        
        /* Core 0 Reset Vector Register Configuration */
        (
            SIU_RSTVEC_RSTVEC_U32([!"num:inttohex(McuCore0ResetVectorRegister/McuCore0ResetVector,8)"!]U) |
            [!IF "McuCore0ResetVectorRegister/McuCore0ResetEnable"!]SIU_RSTVEC_RST_ENABLE_U32[!ELSE!]SIU_RSTVEC_RST_DISABLE_U32[!ENDIF!] |
            [!IF "McuCore0ResetVectorRegister/McuCore0VLESelect"!]SIU_RSTVEC_VLE_VLE_U32[!ELSE!]SIU_RSTVEC_VLE_BOOK_E_U32[!ENDIF!]
        ),
        
        /* Core 1 Reset Vector Register Configuration */
        (
            SIU_RSTVEC_RSTVEC_U32([!"num:inttohex(McuCore1ResetVectorRegister/McuCore1ResetVector,8)"!]U) |
            [!IF "McuCore1ResetVectorRegister/McuCore1ResetEnable"!]SIU_RSTVEC_RST_ENABLE_U32[!ELSE!]SIU_RSTVEC_RST_DISABLE_U32[!ENDIF!] |
            [!IF "McuCore1ResetVectorRegister/McuCore1VLESelect"!]SIU_RSTVEC_VLE_VLE_U32[!ELSE!]SIU_RSTVEC_VLE_BOOK_E_U32[!ENDIF!]
        ),    
        
        [!VAR "TheFirstHaltValue"= "num:i(0)"!]
        /* SIU_HLT1 register value */
        (
            [!LOOP "Halt1Register/*"!][!//
                [!IF "node:fallback(.,'false')"!][!//
            [!IF "$TheFirstHaltValue = 0"!][!VAR "TheFirstHaltValue"= "1"!][!ELSE!] | [!ENDIF!]
            SIU_HLT1_[!"substring-after(@name,'Halt')"!]_HALT_EN_U32[!//
            [!ELSE!][!IF "$TheFirstHaltValue = num:i(0)"!][!VAR "TheFirstHaltValue"= "num:i(1)"!][!ELSE!] | [!ENDIF!]
            SIU_HLT1_[!"substring-after(@name,'Halt')"!]_HALT_DIS_U32[!//
                [!ENDIF!][!//
            [!ENDLOOP!][!//
        ),
        
        [!VAR "TheFirstHaltValue"= "num:i(0)"!]
        /* SIU_HLT2 register value */
        (
            [!LOOP "Halt2Register/*"!][!//
                [!IF "node:fallback(.,'false')"!][!//
            [!IF "$TheFirstHaltValue = 0"!][!VAR "TheFirstHaltValue"= "1"!][!ELSE!] | [!ENDIF!]
            SIU_HLT2_[!"substring-after(@name,'Halt')"!]_HALT_EN_U32
                [!ELSE!][!IF "$TheFirstHaltValue = num:i(0)"!][!VAR "TheFirstHaltValue"= "num:i(1)"!][!ELSE!] | [!ENDIF!]
            SIU_HLT2_[!"substring-after(@name,'Halt')"!]_HALT_DIS_U32
                [!ENDIF!][!//
            [!ENDLOOP!][!//
        )
    }[!IF "$PCindex < $Mode"!],[!ENDIF!]/* end of Mcu_aModeConfig[!"$Type"!][[!"@index"!]]. */
[!ENDCODE!]
        [!ENDLOOP!]
[!CODE!]
};
[!ENDCODE!]
        [!ENDIF!]
[!ENDNOCODE!]
[!ENDMACRO!][!//


[!MACRO "FLASH_Clock_Config","Type"!][!//
[!NOCODE!]
        [!LOOP "McuModuleConfiguration/McuClockSettingConfig/*"!]
            [!CODE!]
#if (MCU_INIT_CLOCK == STD_ON)
#if (MCU_DISABLE_FLASH_CONFIG == STD_OFF)
/**
* @brief        Timing configuration for FLASH hw IP.
* @details      Set the Pipeline/Write/Read wait states for FLASH controller.
*               Configuration set by calling Mcu_InitClock API.
*/
static CONST( Mcu_FLASH_ClockConfigType, MCU_CONST) FLASH_Clock_Config[!"$Type"!]_[!"num:i(@index)"!][!IF "var:defined('postBuildVariant')"!]_[!"$postBuildVariant"!][!ENDIF!] =
{
    /* Flash Controller timing settings.
       PFCR1 configuration register: Address Pipelining Control & Read Wait State Control. */
    (
        MCU_FLASH_ADDR_PIPELINE_WS_U32([!"num:i(McuFlash/McuFlashAddrPipelineControl)"!]U) |
        MCU_FLASH_READ_WS_U32([!"num:i(McuFlash/McuFlashReadWaitStateControl)"!]U)
    )
};
#endif /* (MCU_DISABLE_FLASH_CONFIG == STD_OFF) */
#endif /* (MCU_INIT_CLOCK == STD_ON) */
            [!ENDCODE!]
        [!ENDLOOP!][!//McuModuleConfiguration/McuClockSettingConfig/*
[!ENDNOCODE!]
[!ENDMACRO!][!//


[!MACRO "PcsClock_Config", "Type"!][!//
[!NOCODE!]
        [!LOOP "McuModuleConfiguration/McuClockSettingConfig/*"!]
[!CODE!]
#if (MCU_INIT_CLOCK == STD_ON)
static CONST( Mcu_SIU_RegisterConfigType, MCU_CONST) aPcsClock_Config[!"$Type"!]_[!"num:i(@index)"!][!IF "var:defined('postBuildVariant')"!]_[!"$postBuildVariant"!][!ENDIF!][MCU_NUMBER_OF_PCS_REGS] =
{
[!ENDCODE!]
    [!VAR "Idx"="0"!]
    [!VAR "Count"="num:i(count(McuProgClkSwitch/McuPcsConfig/*))"!]
    [!LOOP "McuProgClkSwitch/McuPcsConfig/*"!]
[!CODE!]
    /* PCS Divider Change Register [!"substring-after(McuPCS_Name,'PCS_')"!]. */
    {
        PCS_DIVC[!"num:i(substring-after(McuPCS_Name,'PCS_'))"!]_ADDR32,
        PCS_DIVC_U32
        (
            PCS_DIVC_INIT_U32((uint32)[!"num:inttohex(num:i(McuPCS_DivInit),8)"!]U) |
            PCS_DIVC_RATE_U32((uint32)[!"num:inttohex(num:i(McuPCS_DivRate),8)"!]U)
        )
    },
    /* PCS Divider Start Register [!"substring-after(McuPCS_Name,'PCS_')"!]. */
    {
        PCS_DIVS[!"num:i(substring-after(McuPCS_Name,'PCS_'))"!]_ADDR32,
        PCS_DIVS_U32((uint32)[!"num:inttohex(num:i(McuPCS_DivStart),8)"!]U)
    },
    /* PCS Divider End Register [!"substring-after(McuPCS_Name,'PCS_')"!]. */
    {
        PCS_DIVE[!"num:i(substring-after(McuPCS_Name,'PCS_'))"!]_ADDR32,
        PCS_DIVE_U32((uint32)[!"num:inttohex(num:i(McuPCS_DivEnd),8)"!]U)
    }[!IF "num:i($Idx) < num:i($Count - 1)"!],[!ENDIF!][!VAR "Idx"="$Idx + 1"!]
[!ENDCODE!]
    [!ENDLOOP!]
[!CODE!]
};
#endif /* (MCU_INIT_CLOCK == STD_ON) */
[!ENDCODE!]
        [!ENDLOOP!][!//McuModuleConfiguration/McuClockSettingConfig/*
[!ENDNOCODE!]
[!ENDMACRO!][!//


[!MACRO "NumberOfAuxElements"!][!//
    [!VAR "Count"="0"!]
        [!IF "McuExternalClock/McuExternalClockUnderMcuControl='true'"!]
            [!VAR "Count" = "$Count + 1"!]
        [!ENDIF!]
        [!IF "McuSigmaDeltaClockConfig/McuSDClockUnderMcuControl='true'"!]
            [!VAR "Count" = "$Count + 1"!]
        [!ENDIF!]
        [!IF "McuLFASTClockConfig/McuLFASTClockUnderMcuControl='true'"!]
            [!VAR "Count" = "$Count + 1"!]
        [!ENDIF!]
        [!IF "McuPSI5ClockConfig/McuPSI5ClockUnderMcuControl='true'"!]
            [!VAR "Count" = "$Count + 1"!]
        [!ENDIF!]
    [!"$Count"!]
[!ENDMACRO!][!//


[!MACRO "AuxClock_Config", "Type"!][!//
[!NOCODE!]
        [!LOOP "McuModuleConfiguration/McuClockSettingConfig/*"!]
            [!VAR "TheNumberOfAuxElements"!][!CALL "NumberOfAuxElements"!][!ENDVAR!]
            [!IF "num:i($TheNumberOfAuxElements)>0"!]
                [!VAR "TheFirstAuxClock" = "1"!]
[!CODE!]
#if (MCU_INIT_CLOCK == STD_ON)
static CONST( Mcu_SIU_RegisterConfigType, MCU_CONST) SIU_aAuxClock_Config[!"$Type"!]_[!"num:i(@index)"!][!IF "var:defined('postBuildVariant')"!]_[!"$postBuildVariant"!][!ENDIF!][[!"num:i($TheNumberOfAuxElements)"!]] =
{
[!ENDCODE!]
        [!IF "McuExternalClock/McuExternalClockUnderMcuControl='true'"!]
[!CODE!]
    [!IF "num:i($TheFirstAuxClock)=0"!],[!ENDIF!][!VAR "TheFirstAuxClock"="0"!][!//
    /* External Clock Register Configuration. */
    {
        SIU_ECCR_ADDR32,
        (
            SIU_ECCR_ENGDIV_U32((uint32)([!"num:i(McuExternalClock/McuEngineeringClockDivisonFactor)"!]U)) |
            [!IF "node:value(McuExternalClock/McuEngineeringClockSource) = 'PLAT_CLK'"!]SIU_ECCR_ECCS_SOURCE_PLAT_CLK_U32[!ELSE!]SIU_ECCR_ECCS_SOURCE_XOSC_U32[!ENDIF!] |
            [!IF "node:value(McuExternalClock/McuExternalBusTapSelect)"!]SIU_ECCR_EBTS_NON_ZERO_HOLD_TIMES_U32[!ELSE!]SIU_ECCR_EBTS_ZERO_HOLD_TIMES_U32[!ENDIF!] |
            SIU_ECCR_EBDF_U32((uint32)([!"num:i(McuExternalClock/McuExternalBusDivisonFactor - 1)"!]U))
        )
    }
[!ENDCODE!]
        [!ENDIF!]
        [!IF "McuSigmaDeltaClockConfig/McuSDClockUnderMcuControl='true'"!]
[!CODE!]
    [!IF "num:i($TheFirstAuxClock)=0"!],[!ENDIF!][!VAR "TheFirstAuxClock"="0"!][!//
    /* Sigma Delta Clock Config Register. */
    {
        SIU_SDCLKCFG_ADDR32,
        SIU_SDCLKCFG_SDDIV_U32((uint32)([!"num:i(McuSigmaDeltaClockConfig/McuSigmaDeltaClockDivider - 1)"!]U))
    }
[!ENDCODE!]
        [!ENDIF!]
        [!IF "McuLFASTClockConfig/McuLFASTClockUnderMcuControl='true'"!]
[!CODE!]
    [!IF "num:i($TheFirstAuxClock)=0"!],[!ENDIF!][!VAR "TheFirstAuxClock"="0"!][!//
    /* LFAST Clock Config Register. */
    {
        SIU_LFCLKCFG_ADDR32,
        (
            [!IF "node:value(McuLFASTClockConfig/McuLFASTClockSource) = 'XOSC'"!]SIU_LFCLKSEL_SOURCE_XOSC_U32[!ELSE!][!//
                [!IF "node:value(McuLFASTClockConfig/McuLFASTClockSource) = 'SIPI_REFCLK'"!]SIU_LFCLKSEL_SOURCE_SIPI_REFCLK_U32[!ELSE!][!//
                    SIU_LFCLKSEL_SOURCE_PER_CLK_UNDIV_U32[!ENDIF!][!ENDIF!] |
        SIU_LFCLKCFG_LFDDIV_U32((uint32)([!"num:i(McuLFASTClockConfig/McuLFASTClockDivider - 1)"!]U))
        )
    }
[!ENDCODE!]
        [!ENDIF!]
        [!IF "McuPSI5ClockConfig/McuPSI5ClockUnderMcuControl='true'"!]
[!CODE!]
    [!IF "num:i($TheFirstAuxClock)=0"!],[!ENDIF!][!VAR "TheFirstAuxClock"="0"!][!//
    /* PSI5 Clock Config Register. */
    {
        SIU_PSCLKCFG_ADDR32,
        (
            SIU_PSCLKCFG_PSDIV_U32((uint32)([!"num:i(McuPSI5ClockConfig/McuPSI5ClockDivider - 1)"!]U)) |
            SIU_PSCLKCFG_PSDIV1M_U32((uint32)([!"num:i(McuPSI5ClockConfig/McuPSI5ClockDivider1Mhz - 1)"!]U))
        )
    }
[!ENDCODE!]
        [!ENDIF!]
[!CODE!]
};
#endif /* (MCU_INIT_CLOCK == STD_ON) */
[!ENDCODE!]
            [!ENDIF!][!//"num:i($TheNumberOfAuxElements)>0"
        [!ENDLOOP!][!//McuModuleConfiguration/McuClockSettingConfig/*
[!ENDNOCODE!]
[!ENDMACRO!][!//


[!MACRO "SIU_Clock_Config","Type"!][!//
[!NOCODE!]
        [!LOOP "McuModuleConfiguration/McuClockSettingConfig/*"!]
            [!VAR "TheNumberOfAuxElements"!][!CALL "NumberOfAuxElements"!][!ENDVAR!]
            [!CODE!]
#if (MCU_INIT_CLOCK == STD_ON)
/**
* @brief            SIU clock configuration.
* @details          This structure contains information for XOSC, PLL, Output Clocks, CMUs
*
*/
static CONST( Mcu_SIU_ClockConfigType, MCU_CONST) SIU_Clock_Config[!"$Type"!]_[!"num:i(@index)"!][!IF "var:defined('postBuildVariant')"!]_[!"$postBuildVariant"!][!ENDIF!] =
{
    /* system clock configuration */
    [!IF "McuSysClockUnderMcuControl='true'"!][!//
    (
        [!IF "node:value(McuSystemClockSwitch) = 'IRC'"!]SIU_SYSDIV_SYSCLKSEL_SOURCE_IRC_U32[!ELSE!][!//
            [!IF "node:value(McuSystemClockSwitch) = 'XOSC'"!]SIU_SYSDIV_SYSCLKSEL_SOURCE_XOSC_U32[!ELSE!][!//
                [!IF "node:value(McuSystemClockSwitch) = 'PLL0_PHI'"!]SIU_SYSDIV_SYSCLKSEL_SOURCE_PLL0_PHI_U32[!ELSE!][!//
                SIU_SYSDIV_SYSCLKSEL_SOURCE_PLL1_PHI_U32[!ENDIF!][!ENDIF!][!ENDIF!] |
        SIU_SYSDIV_SYSCLKDIV_U32((uint32)([!IF "node:value(McuSystemClockDivider) = num:i(1)"!]4U[!ELSE!][!IF "node:value(McuSystemClockDivider) = num:i(2)"!]0U[!ELSE!][!IF "node:value(McuSystemClockDivider) = num:i(4)"!]1U[!ELSE!][!IF "node:value(McuSystemClockDivider) = num:i(8)"!]2U[!ELSE!][!IF "node:value(McuSystemClockDivider) = num:i(16)"!]3U[!ENDIF!][!ENDIF!][!ENDIF!][!ENDIF!][!ENDIF!])) |
        [!IF "node:value(McuPll0ClockReference) = 'XOSC'"!]SIU_SYSDIV_PLL0SEL_SOURCE_XOSC_U32[!ELSE!]SIU_SYSDIV_PLL0SEL_SOURCE_IRC_U32[!ENDIF!] |
        [!IF "node:value(McuPll1ClockReference) = 'XOSC'"!]SIU_SYSDIV_PLL1SEL_SOURCE_XOSC_U32[!ELSE!]SIU_SYSDIV_PLL1SEL_SOURCE_PLL0_PHI1_U32[!ENDIF!] |
        SIU_SYSDIV_FMPERDIV_U32((uint32)([!IF "node:value(McuFMClockPeripheralDivider) = num:i(2)"!]0U[!ELSE!][!IF "node:value(McuFMClockPeripheralDivider) = num:i(4)"!]1U[!ELSE!][!IF "node:value(McuFMClockPeripheralDivider) = num:i(8)"!]2U[!ENDIF!][!ENDIF!][!ENDIF!])) |
        [!IF "node:value(McuPerClockReference) = 'SYSTEM_CLK'"!]SIU_SYSDIV_PERCLKSEL_SOURCE_SYS_CLK_U32[!ELSE!]SIU_SYSDIV_PERCLKSEL_SOURCE_PLL0_PHI_U32[!ENDIF!] |
        SIU_SYSDIV_PERDIV_U32((uint32)([!IF "node:value(McuNonFMClockPeripheralDivider) = num:i(2)"!]0U[!ELSE!][!IF "node:value(McuNonFMClockPeripheralDivider) = num:i(4)"!]1U[!ELSE!][!IF "node:value(McuNonFMClockPeripheralDivider) = num:i(8)"!]2U[!ENDIF!][!ENDIF!][!ENDIF!])) |
        [!IF "node:value(McuETPUClockDivider) = 1"!]SIU_SYSDIV_ETPUDIV_DIVIDE_BY_1_U32[!ELSE!]SIU_SYSDIV_ETPUDIV_DIVIDE_BY_2_U32[!ENDIF!] |
        [!IF "node:value(McuMCANClockReference) = 'XOSC'"!]SIU_SYSDIV_MCANSEL_SOURCE_XOSC_U32[!ELSE!]SIU_SYSDIV_MCANSEL_SOURCE_PER_CLK_U32[!ENDIF!] |
        [!IF "node:value(McuPcsEnable)"!]SIU_PCSEN_PCS_ENABLED_U32[!ELSE!]SIU_PCSEN_PCS_DISABLED_U32[!ENDIF!]
    )
    [!ELSE!](0xFFFFFFFFU)[!ENDIF!],
    
    /* Progressive Clock Switching (CGM_PCS_SDUR[SDUR]) */
    PCS_SDUR_U32((uint32)[!"num:inttohex(num:i(McuProgClkSwitch/McuProgresSwitchDuration),2)"!]U),

    /* number of pcs registers unde mcu control */
    MCU_NUMBER_OF_PCS_REGS,

    /* pcs registers */
    &aPcsClock_Config[!"$Type"!]_[!"num:i(@index)"!][!IF "var:defined('postBuildVariant')"!]_[!"$postBuildVariant"!][!ENDIF!],

    /* number of configurable aux clock regs */
    ((uint8)[!"num:i($TheNumberOfAuxElements)"!]U),

    /* auxiliary clock dividers */
    [!IF "$TheNumberOfAuxElements != 0"!] &SIU_aAuxClock_Config[!"$Type"!]_[!"num:i(@index)"!][!IF "var:defined('postBuildVariant')"!]_[!"$postBuildVariant"!][!ENDIF!]
    [!ELSE!]
    (NULL_PTR)
    [!ENDIF!]

};
#endif /* (MCU_INIT_CLOCK == STD_ON) */
            [!ENDCODE!]
        [!ENDLOOP!][!//McuModuleConfiguration/McuClockSettingConfig/*
[!ENDNOCODE!]
[!ENDMACRO!][!//

[!MACRO "NumberOfPllRegisters"!][!//
    [!VAR "Count"="0"!]
    [!LOOP "./*"!]
        [!IF "contains(@name,'McuPll_0')='true'"!]
            [!VAR "usedByMcu" = "concat('../',@name,'/','McuPllUnderMcuControl')"!]
            [!IF "node:value($usedByMcu)='true'"!]
                [!VAR "Count" = "$Count + 3"!]
            [!ENDIF!]
        [!ELSEIF "contains(@name,'McuPll_1')='true'"!]
            [!VAR "usedByMcu" = "concat('../',@name,'/','McuPllUnderMcuControl')"!]
            [!IF "node:value($usedByMcu)='true'"!]
                [!VAR "Count" = "$Count + 5"!]
            [!ENDIF!]
        [!ENDIF!]
    [!ENDLOOP!]
    [!"$Count"!]
[!ENDMACRO!][!//

[!MACRO "Mcu_PLL_REG_Config","Type"!][!//
[!NOCODE!]
        [!LOOP "McuModuleConfiguration/McuClockSettingConfig/*"!]
            [!VAR "NumberOfPllRegs"!][!CALL "NumberOfPllRegisters"!][!ENDVAR!]
            [!VAR "TheFirstPLL" = "1"!]
[!IF "$NumberOfPllRegs > 0"!]
            [!CODE!]
#if (MCU_INIT_CLOCK == STD_ON)
/**
* @brief            PLLDIG Registers configuration.
* @details          This structure contains configuration for PLLDIG Registers.
*
*/
static CONST( Mcu_PLLDIG_RegisterConfigType, MCU_CONST) Mcu_aPLLDIG_Registers_Config_[!"$Type"!]_[!"num:i(@index)"!][!IF "var:defined('postBuildVariant')"!]_[!"$postBuildVariant"!][!ENDIF!][[!"num:i($NumberOfPllRegs)"!]] =
{
    [!IF "McuPll_0/McuPllUnderMcuControl = 'true'"!][!VAR "TheFirstPLL"="0"!]
    /* turn off PLL0 */
    {
        PLLDIG_PLL0CR_ADDR32,
        MCU_PLLDIG_PLL0CR_U32
        (
            PLLDIG_PLL0CR_CLKCFG_BO_U32
        )
    },
    /* PLL0 dividers */
    {
        PLLDIG_PLL0DV_ADDR32,
        MCU_PLLDIG_PLL0DV_U32
        (
            MCU_PLLDIG_PLL0DV_RFDPHI1_U32( (uint32)[!"num:i(McuPll_0/McuPll0_Parameter/McuPHI1_ReducedFreqDivider)"!]U ) |
            MCU_PLLDIG_PLL0DV_RFDPHI_U32( (uint32)[!"num:i(McuPll_0/McuPll0_Parameter/McuPHI_ReducedFreqDivider)"!]U ) |
            MCU_PLLDIG_PLL0DV_PREDIV_U32( (uint32)[!"num:i(McuPll_0/McuPll0_Parameter/McuInputClkPreDivider)"!]U ) |
            MCU_PLLDIG_PLL0DV_MFD_U32( (uint32)[!"num:i(McuPll_0/McuPll0_Parameter/McuLoopMultiplicationClkDivider)"!]U )
        )
    },
    /* PLL0 configuration */
    {
        PLLDIG_PLL0CR_ADDR32,
        MCU_PLLDIG_PLL0CR_U32
        (
            [!IF "McuPll_0/McuPllClockConfiguration = 'PLL_OFF'"!]PLLDIG_PLL0CR_CLKCFG_BO_U32[!ELSE!]PLLDIG_PLL0CR_CLKCFG_NR_U32[!ENDIF!] |
            [!IF "McuPll_0/McuPll0_Parameter/McuLossOfLockInt"!]MCU_PLLDIG_PLL0CR_LOLIE_ENA_U32[!ELSE!]MCU_PLLDIG_PLL0CR_LOLIE_DIS_U32[!ENDIF!]
        )
    }[!ENDIF!][!IF "McuPll_1/McuPllUnderMcuControl = 'true'"!][!IF "num:i($TheFirstPLL)=0"!],[!ENDIF!][!VAR "TheFirstPLL" = "0"!]
    /* turn off PLL1 */
    {
        PLLDIG_PLL1CR_ADDR32,
        MCU_PLLDIG_PLL1CR_U32
        (
            PLLDIG_PLL1CR_CLKCFG_BO_U32
        )
    },
    /* PLL1 dividers */
    {
        PLLDIG_PLL1DV_ADDR32,
        MCU_PLLDIG_PLL1DV_U32
        (
            MCU_PLLDIG_PLL1DV_RFDPHI_U32( (uint32)[!"num:i(McuPll_1/McuPll1_Parameter/McuPHI_ReducedFreqDivider)"!]U ) |
            MCU_PLLDIG_PLL1DV_MFD_U32( (uint32)[!"num:i(McuPll_1/McuPll1_Parameter/McuLoopMultiplicationClkDivider)"!]U )
        )
    },
    /* PLL1 frequency modulation */
    {
        PLLDIG_PLL1FM_ADDR32,
        MCU_PLLDIG_PLL1FM_U32[!IF "McuPll_1/McuPll1_Parameter/McuModulationEnable"!][!/*
        */!]
        (
            MCU_PLLDIG_PLL1FM_MODEN_ENA_U32 |
            [!IF "McuPll_1/McuFmPll1_Parameter/McuSpreadSelection='Down_Spread'"!]MCU_PLLDIG_PLL1FM_MODSEL_ENA_U32[!ELSE!]MCU_PLLDIG_PLL1FM_MODSEL_DIS_U32[!ENDIF!] |
            MCU_PLLDIG_PLL1FM_MODPRD_U32( (uint32)[!"num:i(McuPll_1/McuFmPll1_Parameter/McuModulationPeriod)"!]U ) |
            MCU_PLLDIG_PLL1FM_INCSTP_U32( (uint32)[!"num:i(McuPll_1/McuFmPll1_Parameter/McuModulationIncrementStep)"!]U )
        )
        [!ELSE!]( MCU_PLLDIG_PLL1FM_MODEN_DIS_U32 )[!/*
        */!][!ENDIF!]
    },
    /* PLL1 fractional divider */
    {
        PLLDIG_PLL1FD_ADDR32,
        MCU_PLLDIG_PLL1FD_U32[!IF "McuPll_1/McuPll1_Parameter/McuFracDivEnable"!][!/*
        */!]
        (
            MCU_PLLDIG_PLL1FD_FDEN_ENA_U32 |
            MCU_PLLDIG_PLL1FD_DTHDIS1_U32( (uint32)[!IF "McuPll_1/McuFdPll1_Parameter/McuDthDisable1"!]1[!ELSE!]0[!ENDIF!]U ) |
            MCU_PLLDIG_PLL1FD_DTHDIS0_U32( (uint32)[!IF "McuPll_1/McuFdPll1_Parameter/McuDthDisable0"!]1[!ELSE!]0[!ENDIF!]U ) |
            MCU_PLLDIG_PLL1FD_FRCDIV_U32( (uint32)[!"num:i(McuPll_1/McuFdPll1_Parameter/McuFractionalDivider)"!]U )
        )
        [!ELSE!]( MCU_PLLDIG_PLL1FD_FDEN_DIS_U32 )[!/*
        */!][!ENDIF!]
    },
    /* PLL1 configuration */
    {
        PLLDIG_PLL1CR_ADDR32,
        MCU_PLLDIG_PLL1CR_U32
        (
            [!IF "McuPll_1/McuPllClockConfiguration = 'PLL_OFF'"!]PLLDIG_PLL1CR_CLKCFG_BO_U32[!ELSE!]PLLDIG_PLL1CR_CLKCFG_NR_U32[!ENDIF!] |
            [!IF "McuPll_1/McuPll1_Parameter/McuLossOfLockInt"!]MCU_PLLDIG_PLL1CR_LOLIE_ENA_U32[!ELSE!]MCU_PLLDIG_PLL1CR_LOLIE_DIS_U32[!ENDIF!]
        )
    }[!ENDIF!]
};
#endif /* (MCU_INIT_CLOCK == STD_ON) */
            [!ENDCODE!]
[!ENDIF!]
        [!ENDLOOP!][!//McuModuleConfiguration/McuClockSettingConfig/*
[!ENDNOCODE!]
[!ENDMACRO!][!//


[!MACRO "Mcu_PLLDIG_Config","Type"!][!//
[!NOCODE!]
    [!LOOP "McuModuleConfiguration/McuClockSettingConfig/*"!]
            [!VAR "NumberOfPllRegs"!][!CALL "NumberOfPllRegisters"!][!ENDVAR!]
[!CODE!]
#if (MCU_INIT_CLOCK == STD_ON)
/**
* @brief            PLLDIG clock configuration.
* @details          This structure contains information for PLLDIG PLL0 and FMPLL1.
*
*/
static CONST( Mcu_PLLDIG_ConfigType, MCU_CONST) MC_PLLDIG_ClockConfig[!"$Type"!]_[!"num:i(@index)"!][!IF "var:defined('postBuildVariant')"!]_[!"$postBuildVariant"!][!ENDIF!] =
{
    /* number of pll regs under mcu control */
    [!"num:inttohex(num:i($NumberOfPllRegs),2)"!]U,
    /* configuration for PLLDIG registers */
    [!IF "$NumberOfPllRegs > 0"!]&Mcu_aPLLDIG_Registers_Config_[!"$Type"!]_[!"num:i(@index)"!][!IF "var:defined('postBuildVariant')"!]_[!"$postBuildVariant"!][!ENDIF!][!ELSE!](NULL_PTR)[!ENDIF!]
};
#endif /* (MCU_INIT_CLOCK == STD_ON) */
            [!ENDCODE!]
    [!ENDLOOP!][!//McuModuleConfiguration/McuClockSettingConfig/*
[!ENDNOCODE!]
[!ENDMACRO!][!//

[!MACRO "EMIOS_Module_Config","Type"!][!// 
[!NOCODE!]
        [!LOOP "McuModuleConfiguration/McuClockSettingConfig/*"!]
[!CODE!]
#if (MCU_INIT_CLOCK == STD_ON)
#if (MCU_EMIOS_SUPPORT == STD_ON)
/**
* @brief            eMios Module Configuration.
* @details          This structure contains information for eMios0 and eMios1.
*
*/
static CONST(Mcu_eMios_ConfigType, MCU_CONST) EMIOS_Module_Config[!"$Type"!]_[!"num:i(@index)"!][!IF "var:defined('postBuildVariant')"!]_[!"$postBuildVariant"!][!ENDIF!] = 
{
    {
        /* eMios0 configuration */
        EMIOS_MCR_U32
        (
            [!IF "McuEMIOS/McuEMIOS_0/McuMdisBit"!]EMIOS_MCR_MDIS_ENA_U32[!ELSE!]EMIOS_MCR_MDIS_DIS_U32[!ENDIF!] |
            [!IF "McuEMIOS/McuEMIOS_0/McuFreezeBit"!]EMIOS_MCR_FRZ_ENA_U32[!ELSE!]EMIOS_MCR_FRZ_DIS_U32[!ENDIF!] |
            [!IF "McuEMIOS/McuEMIOS_0/McuGlobalTimeBaseEnable"!]EMIOS_MCR_GTBE_ENA_U32[!ELSE!]EMIOS_MCR_GTBE_DIS_U32[!ENDIF!] |
            [!IF "McuEMIOS/McuEMIOS_0/McuExternalTimeBase"!]EMIOS_MCR_ETB_ENA_U32[!ELSE!]EMIOS_MCR_ETB_DIS_U32[!ENDIF!] |
            [!IF "McuEMIOS/McuEMIOS_0/McuGlobalPrescalerEnable"!]EMIOS_MCR_GPREN_ENA_U32[!ELSE!]EMIOS_MCR_GPREN_DIS_U32[!ENDIF!] |
            EMIOS_MCR_SRV_U32((uint32)[!"num:i(McuEMIOS/McuEMIOS_0/McuServerTimeSlot)"!]U)|
            EMIOS_MCR_GPRE_U32((uint32)[!"num:i(num:i(McuEMIOS/McuEMIOS_0/McuGlobalPrescaler) - num:i(1))"!]U)
        ),
        /* eMios1 configuration */
        EMIOS_MCR_U32
        (
            [!IF "McuEMIOS/McuEMIOS_1/McuMdisBit"!]EMIOS_MCR_MDIS_ENA_U32[!ELSE!]EMIOS_MCR_MDIS_DIS_U32[!ENDIF!] |
            [!IF "McuEMIOS/McuEMIOS_1/McuFreezeBit"!]EMIOS_MCR_FRZ_ENA_U32[!ELSE!]EMIOS_MCR_FRZ_DIS_U32[!ENDIF!] |
            [!IF "McuEMIOS/McuEMIOS_1/McuGlobalTimeBaseEnable"!]EMIOS_MCR_GTBE_ENA_U32[!ELSE!]EMIOS_MCR_GTBE_DIS_U32[!ENDIF!] |
            [!IF "McuEMIOS/McuEMIOS_1/McuExternalTimeBase"!]EMIOS_MCR_ETB_ENA_U32[!ELSE!]EMIOS_MCR_ETB_DIS_U32[!ENDIF!] |
            [!IF "McuEMIOS/McuEMIOS_1/McuGlobalPrescalerEnable"!]EMIOS_MCR_GPREN_ENA_U32[!ELSE!]EMIOS_MCR_GPREN_DIS_U32[!ENDIF!] |
            EMIOS_MCR_SRV_U32((uint32)[!"num:i(McuEMIOS/McuEMIOS_1/McuServerTimeSlot)"!]U)|
            EMIOS_MCR_GPRE_U32((uint32)[!"num:i(num:i(McuEMIOS/McuEMIOS_1/McuGlobalPrescaler) - num:i(1))"!]U)
        )
    }
};
#endif /* (MCU_EMIOS_SUPPORT == STD_ON) */
#endif /* (MCU_INIT_CLOCK == STD_ON) */
[!ENDCODE!]
        [!ENDLOOP!][!//McuModuleConfiguration/McuClockSettingConfig/*
[!ENDNOCODE!]
[!ENDMACRO!][!//


[!MACRO "CMU_Config","Type"!][!//
[!NOCODE!]
        [!LOOP "McuModuleConfiguration/McuClockSettingConfig/*"!]
[!CODE!]
#if (MCU_INIT_CLOCK == STD_ON)
/**
* @brief            CMU configuration.
* @details          This structure contains information for CMU[n].
*                   The number of CMU's is defined in the resource files,
*
*/
static CONST( Mcu_CMU_ConfigType, MCU_CONST) CMU_Config[!"$Type"!]_[!"num:i(@index)"!][!IF "var:defined('postBuildVariant')"!]_[!"$postBuildVariant"!][!ENDIF!] =
{
#if (defined(MCU_CMU_RCDIV_INDEPEND) && (MCU_CMU_RCDIV_INDEPEND == STD_ON))
    {
[!ENDCODE!]
        [!VAR "TheFirstCmu" = "1"!]
        [!LOOP "McuClkMonitor/*"!]
[!CODE!]
        [!IF "$TheFirstCmu=0.0"!],[!ENDIF!][!VAR "TheFirstCmu" = "0"!]
        /* CMU_x_CSR[RCDIV] exist on [!"McuCmuName"!] */
        (boolean)[!"text:toupper(text:contains(ecu:list('MCU.CMU.RCDIV.AVAILABLE.LIST'),substring-before(substring-after(McuCmuName,'CMU_'),'_')))"!]
[!ENDCODE!]
        [!ENDLOOP!]
[!CODE!]
    },
#endif
    {
[!ENDCODE!]
        [!VAR "TheFirstCmu" = "1"!]
        [!LOOP "McuClkMonitor/*"!]
[!CODE!]
        [!IF "$TheFirstCmu=0.0"!],[!ENDIF!][!VAR "TheFirstCmu" = "0"!]
        /* CSR for [!"McuCmuName"!] */
        CMU_CSR_U32
        (
            [!IF "McuClkMonitorEn = 'true'"!]CMU_CSR_CMU_ENA_U32[!ELSE!]CMU_CSR_CMU_DIS_U32[!ENDIF!]
            [!IF "text:tolower(text:contains(ecu:list('MCU.CMU.RCDIV.AVAILABLE.LIST'),substring-before(substring-after(McuCmuName,'CMU_'),'_'))) = 'true'"!][!IF "node:value(McuRCDivisorFactor) = 'DIV_1'"!]| CMU_CSR_RCDIV_1_U32[!ELSEIF "node:value(McuRCDivisorFactor) = 'DIV_2'"!]| CMU_CSR_RCDIV_2_U32[!ELSEIF "node:value(McuRCDivisorFactor) = 'DIV_4'"!]| CMU_CSR_RCDIV_4_U32[!ELSEIF "node:value(McuRCDivisorFactor) = 'DIV_8'"!]| CMU_CSR_RCDIV_8_U32[!ENDIF!][!ENDIF!]
        )
[!ENDCODE!]
        [!ENDLOOP!]
[!CODE!]
    },
    {
[!ENDCODE!]
        [!VAR "TheFirstCmu" = "1"!]
        [!LOOP "McuClkMonitor/*"!]
[!CODE!]
        [!IF "$TheFirstCmu=0.0"!],[!ENDIF!][!VAR "TheFirstCmu" = "0"!]
        /* HFREFR for [!"McuCmuName"!] */
        CMU_HFREFR_VALUE_U32
        (
            (uint32)[!IF "McuClkMonitorEn = 'true'"!][!"num:i(node:value(McuHighFrequencyRef))"!]U[!ELSE!]MCU_CMU_HFREFR_RESET_VALUE_U32[!ENDIF!]
        )
[!ENDCODE!]
        [!ENDLOOP!]
[!CODE!]
    },
    {
[!ENDCODE!]
        [!VAR "TheFirstCmu" = "1"!]
        [!LOOP "McuClkMonitor/*"!]
[!CODE!]
        [!IF "$TheFirstCmu=0.0"!],[!ENDIF!][!VAR "TheFirstCmu" = "0"!]
        /* LFREFR for [!"McuCmuName"!] */
        CMU_LFREFR_VALUE_U32
        (
            (uint32)[!IF "McuClkMonitorEn = 'true'"!][!"num:i(node:value(McuLowFrequencyRef))"!]U[!ELSE!]MCU_CMU_LREF_RESET_VALUE_U32[!ENDIF!]
        )
[!ENDCODE!]
        [!ENDLOOP!]
[!CODE!]
    }
};
#endif /* (MCU_INIT_CLOCK == STD_ON) */
[!ENDCODE!]
        [!ENDLOOP!][!//McuModuleConfiguration/McuClockSettingConfig/*
[!ENDNOCODE!]
[!ENDMACRO!][!//

[!MACRO "PRAM_Clock_Config","Type"!][!//
[!NOCODE!]
        [!LOOP "McuModuleConfiguration/McuClockSettingConfig/*"!]
            [!CODE!]
#if (MCU_INIT_CLOCK == STD_ON)
#if (MCU_DISABLE_RAM_WS_CONFIG == STD_OFF)
/**
* @brief        Timing configuration for SRAMC hw IP.
* @details      Set the Read wait states for RAM.
*               Configuration set by calling Mcu_InitClock API.
*/
static CONST( Mcu_PRAM_ClockConfigType, MCU_CONST) SRAMC_ClockConfig[!"$Type"!]_[!"num:i(@index)"!][!IF "var:defined('postBuildVariant')"!]_[!"$postBuildVariant"!][!ENDIF!] =
{
    /* PRAMC_0 Controller timing settings. PRCR1 configuration register. */
    PRAMC_PRCR1_VALUE_U32
    (
        [!IF "McuRam/McuRam_PRAMC_0_P0_BO_DIS = 'true'"!]PRAMC_PRCR1_P0_BO_DIS_U32[!ELSE!]PRAMC_PRCR1_P0_BO_ENA_U32[!ENDIF!] |
        [!IF "McuRam/McuRam_PRAMC_0_FT_DIS = 'true'"!]PRAMC_PRCR1_FT_DIS_U32[!ELSE!]PRAMC_PRCR1_FT_ENA_U32[!ENDIF!]
    ),
    /* PRAMC_1 Controller timing settings. PRCR1 configuration register. */
    PRAMC_PRCR1_VALUE_U32
    (
        [!IF "McuRam/McuRam_PRAMC_1_P0_BO_DIS = 'true'"!]PRAMC_PRCR1_P0_BO_DIS_U32[!ELSE!]PRAMC_PRCR1_P0_BO_ENA_U32[!ENDIF!] |
        [!IF "McuRam/McuRam_PRAMC_1_FT_DIS = 'true'"!]PRAMC_PRCR1_FT_DIS_U32[!ELSE!]PRAMC_PRCR1_FT_ENA_U32[!ENDIF!]
    )
};
#endif /* (MCU_DISABLE_RAM_WS_CONFIG == STD_OFF) */
#endif /* (MCU_INIT_CLOCK == STD_ON) */
            [!ENDCODE!]
        [!ENDLOOP!][!//McuModuleConfiguration/McuClockSettingConfig/*
[!ENDNOCODE!]
[!ENDMACRO!][!//


[!MACRO "Mcu_Clock_Config","Type"!][!//
[!NOCODE!]
            [!CODE!]
#if (MCU_INIT_CLOCK == STD_ON)
/**
* @brief          Initialization clock data.
* @details        Static configuration realized by calling Mcu_InitClock() API.
*
*/
static CONST( Mcu_ClockConfigType, MCU_CONST) Mcu_aClockConfig[!"$Type"!][!IF "var:defined('postBuildVariant')"!]_[!"$postBuildVariant"!][!ENDIF!][[!"num:i(count(McuModuleConfiguration/McuClockSettingConfig/*))"!]] =
{
    [!ENDCODE!]
    [!IF "num:i(count(McuModuleConfiguration/McuClockSettingConfig/*))>0"!]
        [!VAR "ClockConfigs"= "num:i(count(McuModuleConfiguration/McuClockSettingConfig/*))-1"!]
        [!LOOP "McuModuleConfiguration/McuClockSettingConfig/*"!]
            [!CODE!]
    /* Start of Mcu_ClockConfig[[!"@index"!]]. */
    {
            [!ENDCODE!]
            [!VAR "PCindex" = "@index"!]
            [!CALL "MCheckClockSettings"!]

            [!CODE!]
        /* ID Clock Configuration. */
        (uint8)[!"num:i(McuClockSettingId)"!]U,

        /* Globally enable/disable SCM, loss of clock and loss of lock notification. */
        ([!IF "num:i(count(McuClkMonitor/*/McuClkMonitorEn[.='true'])) >= 1"!]MCU_CLK_NOTIF_EN[!ELSE!]MCU_CLK_NOTIF_DIS[!ENDIF!]),
        
        /* SIU IP Clock settings. */
        &SIU_Clock_Config[!"$Type"!]_[!"num:i(@index)"!][!IF "var:defined('postBuildVariant')"!]_[!"$postBuildVariant"!][!ENDIF!],

        /* PLLDIG IP Clock settings. */
        &MC_PLLDIG_ClockConfig[!"$Type"!]_[!"num:i(@index)"!][!IF "var:defined('postBuildVariant')"!]_[!"$postBuildVariant"!][!ENDIF!],
        
#if (MCU_EMIOS_SUPPORT == STD_ON)
        /* eMios Module settings. */
        &EMIOS_Module_Config[!"$Type"!]_[!"num:i(@index)"!][!IF "var:defined('postBuildVariant')"!]_[!"$postBuildVariant"!][!ENDIF!],
#endif
        /* CMU IP Clock settings. */
        &CMU_Config[!"$Type"!]_[!"num:i(@index)"!][!IF "var:defined('postBuildVariant')"!]_[!"$postBuildVariant"!][!ENDIF!],

#if (MCU_DISABLE_RAM_WS_CONFIG == STD_OFF)
        /* SRAMC IP Clock settings. */
        &SRAMC_ClockConfig[!"$Type"!]_[!"num:i(@index)"!][!IF "var:defined('postBuildVariant')"!]_[!"$postBuildVariant"!][!ENDIF!],
#endif /* (MCU_DISABLE_RAM_WS_CONFIG == STD_OFF) */

#if (MCU_DISABLE_FLASH_CONFIG == STD_OFF)
        /* FLASH IP Clock settings. */
        &FLASH_Clock_Config[!"$Type"!]_[!"num:i(@index)"!][!IF "var:defined('postBuildVariant')"!]_[!"$postBuildVariant"!][!ENDIF!],
#endif /* (MCU_DISABLE_FLASH_CONFIG == STD_OFF) */

    }[!IF "$PCindex < $ClockConfigs"!],[!ENDIF!] /* end of Mcu_ClockConfig[[!"@index"!]] */
            [!ENDCODE!]
        [!ENDLOOP!][!//McuModuleConfiguration/McuClockSettingConfig/*
        [!CODE!]
};
#endif /* (MCU_INIT_CLOCK == STD_ON) */
        [!ENDCODE!]
        [!ENDIF!][!//"num:i(count(McuModuleConfiguration/McuClockSettingConfig/*))>0"
[!ENDNOCODE!]
[!ENDMACRO!][!//


[!MACRO "Reset_Config","Type"!][!//
[!NOCODE!]
[!CODE!]
/**
* @brief          Initialization data for MC_RGM hw IP.
* @details        Static configuration realized at statup by calling Mcu_Init() API.
*
*/
static CONST(Mcu_SIU_ResetConfigType, MCU_CONST) SIU_ResetConfig[!"$Type"!][!IF "var:defined('postBuildVariant')"!]_[!"$postBuildVariant"!][!ENDIF!] =
{
#if (MCU_PERFORM_RESET_API == STD_ON)
    /* Reset type: software system vs software external. */
    ([!IF "McuModuleConfiguration/McuResetConfig/McuResetSource = 'SoftwareSystemReset'"!]MCU_SOFT_SYSTEM_RESET[!ELSE!]MCU_SOFT_EXTERNAL_RESET[!ENDIF!]),
#endif /* (MCU_PERFORM_RESET_API == STD_ON) */

    /* Reset escalation threshold */
    SIU_RCR_RET_U32((uint32)([!"num:i(McuModuleConfiguration/McuResetConfig/McuResetEscalationThreshold)"!]U))
};
[!ENDCODE!]
[!ENDNOCODE!]
[!ENDMACRO!][!//



[!MACRO "FLASH_Config","Type"!][!//
[!NOCODE!]
        [!SELECT "McuModuleConfiguration"!][!//
        [!CODE!]
#if (MCU_DISABLE_FLASH_CONFIG == STD_OFF)
/**
* @brief            Platform FLASH hw IP configuration.
* @details          Configure prefetch mechanism, buffers, access protection.
*                   Configuration set by calling Mcu_Init API.
*/
static CONST( Mcu_FLASH_ConfigType, MCU_CONST) FLASH_Config[!"$Type"!][!IF "var:defined('postBuildVariant')"!]_[!"$postBuildVariant"!][!ENDIF!] =
{
    /* Platform Flash Configuration Register 1 (PFCR1). */
    MCU_FLASH_PFCR1_U32
    (
        [!IF "McuPlatformFlashConfig/McuPFCR1/McuPort0Master15Prefetch='true'"!]MCU_FLASH_P0_MASTER15_PREFETCH_EN_U32[!ELSE!]MCU_FLASH_P0_MASTER15_PREFETCH_DIS_U32[!ENDIF!] |
        [!IF "McuPlatformFlashConfig/McuPFCR1/McuPort0Master14Prefetch='true'"!]MCU_FLASH_P0_MASTER14_PREFETCH_EN_U32[!ELSE!]MCU_FLASH_P0_MASTER14_PREFETCH_DIS_U32[!ENDIF!] |
        [!IF "McuPlatformFlashConfig/McuPFCR1/McuPort0Master13Prefetch='true'"!]MCU_FLASH_P0_MASTER13_PREFETCH_EN_U32[!ELSE!]MCU_FLASH_P0_MASTER13_PREFETCH_DIS_U32[!ENDIF!] |
        [!IF "McuPlatformFlashConfig/McuPFCR1/McuPort0Master12Prefetch='true'"!]MCU_FLASH_P0_MASTER12_PREFETCH_EN_U32[!ELSE!]MCU_FLASH_P0_MASTER12_PREFETCH_DIS_U32[!ENDIF!] |
        [!IF "McuPlatformFlashConfig/McuPFCR1/McuPort0Master11Prefetch='true'"!]MCU_FLASH_P0_MASTER11_PREFETCH_EN_U32[!ELSE!]MCU_FLASH_P0_MASTER11_PREFETCH_DIS_U32[!ENDIF!] |
        [!IF "McuPlatformFlashConfig/McuPFCR1/McuPort0Master10Prefetch='true'"!]MCU_FLASH_P0_MASTER10_PREFETCH_EN_U32[!ELSE!]MCU_FLASH_P0_MASTER10_PREFETCH_DIS_U32[!ENDIF!] |
        [!IF "McuPlatformFlashConfig/McuPFCR1/McuPort0Master9Prefetch='true'"!]MCU_FLASH_P0_MASTER9_PREFETCH_EN_U32[!ELSE!]MCU_FLASH_P0_MASTER9_PREFETCH_DIS_U32[!ENDIF!] |
        [!IF "McuPlatformFlashConfig/McuPFCR1/McuPort0Master8Prefetch='true'"!]MCU_FLASH_P0_MASTER8_PREFETCH_EN_U32[!ELSE!]MCU_FLASH_P0_MASTER8_PREFETCH_DIS_U32[!ENDIF!] |
        [!IF "McuPlatformFlashConfig/McuPFCR1/McuPort0Master7Prefetch='true'"!]MCU_FLASH_P0_MASTER7_PREFETCH_EN_U32[!ELSE!]MCU_FLASH_P0_MASTER7_PREFETCH_DIS_U32[!ENDIF!] |
        [!IF "McuPlatformFlashConfig/McuPFCR1/McuPort0Master6Prefetch='true'"!]MCU_FLASH_P0_MASTER6_PREFETCH_EN_U32[!ELSE!]MCU_FLASH_P0_MASTER6_PREFETCH_DIS_U32[!ENDIF!] |
        [!IF "McuPlatformFlashConfig/McuPFCR1/McuPort0Master5Prefetch='true'"!]MCU_FLASH_P0_MASTER5_PREFETCH_EN_U32[!ELSE!]MCU_FLASH_P0_MASTER5_PREFETCH_DIS_U32[!ENDIF!] |
        [!IF "McuPlatformFlashConfig/McuPFCR1/McuPort0Master4Prefetch='true'"!]MCU_FLASH_P0_MASTER4_PREFETCH_EN_U32[!ELSE!]MCU_FLASH_P0_MASTER4_PREFETCH_DIS_U32[!ENDIF!] |
        [!IF "McuPlatformFlashConfig/McuPFCR1/McuPort0Master3Prefetch='true'"!]MCU_FLASH_P0_MASTER3_PREFETCH_EN_U32[!ELSE!]MCU_FLASH_P0_MASTER3_PREFETCH_DIS_U32[!ENDIF!] |
        [!IF "McuPlatformFlashConfig/McuPFCR1/McuPort0Master2Prefetch='true'"!]MCU_FLASH_P0_MASTER2_PREFETCH_EN_U32[!ELSE!]MCU_FLASH_P0_MASTER2_PREFETCH_DIS_U32[!ENDIF!] |
        [!IF "McuPlatformFlashConfig/McuPFCR1/McuPort0Master1Prefetch='true'"!]MCU_FLASH_P0_MASTER1_PREFETCH_EN_U32[!ELSE!]MCU_FLASH_P0_MASTER1_PREFETCH_DIS_U32[!ENDIF!] |
        [!IF "McuPlatformFlashConfig/McuPFCR1/McuPort0Master0Prefetch='true'"!]MCU_FLASH_P0_MASTER0_PREFETCH_EN_U32[!ELSE!]MCU_FLASH_P0_MASTER0_PREFETCH_DIS_U32[!ENDIF!] |
        [!IF "McuPlatformFlashConfig/McuPFCR1/McuPort0DataPrefetch='true'"!]MCU_FLASH_P0_DATA_PREFETCH_EN_U32[!ELSE!]MCU_FLASH_P0_DATA_PREFETCH_DIS_U32[!ENDIF!] |
        [!IF "McuPlatformFlashConfig/McuPFCR1/McuPort0InstructionPrefetch='true'"!]MCU_FLASH_P0_INSTR_PREFETCH_EN_U32[!ELSE!]MCU_FLASH_P0_INSTR_PREFETCH_DIS_U32[!ENDIF!] |
        MCU_FLASH_P0_PFLIM_U32( (uint32)[!"num:i(McuPlatformFlashConfig/McuPFCR1/McuPort0PrefetchLimit)"!]U ) |
        [!IF "McuPlatformFlashConfig/McuPFCR1/McuPort0ReadBufferEnable='true'"!]MCU_FLASH_P0_BUFFER_EN_U32[!ELSE!]MCU_FLASH_P0_BUFFER_DIS_U32[!ENDIF!]
    ),

    /* Platform Flash Configuration Register 2 (PFCR2). */
    MCU_FLASH_PFCR2_U32
    (
        [!IF "McuPlatformFlashConfig/McuPFCR2/McuPort1Master15Prefetch='true'"!]MCU_FLASH_P1_MASTER15_PREFETCH_EN_U32[!ELSE!]MCU_FLASH_P1_MASTER15_PREFETCH_DIS_U32[!ENDIF!] |
        [!IF "McuPlatformFlashConfig/McuPFCR2/McuPort1Master14Prefetch='true'"!]MCU_FLASH_P1_MASTER14_PREFETCH_EN_U32[!ELSE!]MCU_FLASH_P1_MASTER14_PREFETCH_DIS_U32[!ENDIF!] |
        [!IF "McuPlatformFlashConfig/McuPFCR2/McuPort1Master13Prefetch='true'"!]MCU_FLASH_P1_MASTER13_PREFETCH_EN_U32[!ELSE!]MCU_FLASH_P1_MASTER13_PREFETCH_DIS_U32[!ENDIF!] |
        [!IF "McuPlatformFlashConfig/McuPFCR2/McuPort1Master12Prefetch='true'"!]MCU_FLASH_P1_MASTER12_PREFETCH_EN_U32[!ELSE!]MCU_FLASH_P1_MASTER12_PREFETCH_DIS_U32[!ENDIF!] |
        [!IF "McuPlatformFlashConfig/McuPFCR2/McuPort1Master11Prefetch='true'"!]MCU_FLASH_P1_MASTER11_PREFETCH_EN_U32[!ELSE!]MCU_FLASH_P1_MASTER11_PREFETCH_DIS_U32[!ENDIF!] |
        [!IF "McuPlatformFlashConfig/McuPFCR2/McuPort1Master10Prefetch='true'"!]MCU_FLASH_P1_MASTER10_PREFETCH_EN_U32[!ELSE!]MCU_FLASH_P1_MASTER10_PREFETCH_DIS_U32[!ENDIF!] |
        [!IF "McuPlatformFlashConfig/McuPFCR2/McuPort1Master9Prefetch='true'"!]MCU_FLASH_P1_MASTER9_PREFETCH_EN_U32[!ELSE!]MCU_FLASH_P1_MASTER9_PREFETCH_DIS_U32[!ENDIF!] |
        [!IF "McuPlatformFlashConfig/McuPFCR2/McuPort1Master8Prefetch='true'"!]MCU_FLASH_P1_MASTER8_PREFETCH_EN_U32[!ELSE!]MCU_FLASH_P1_MASTER8_PREFETCH_DIS_U32[!ENDIF!] |
        [!IF "McuPlatformFlashConfig/McuPFCR2/McuPort1Master7Prefetch='true'"!]MCU_FLASH_P1_MASTER7_PREFETCH_EN_U32[!ELSE!]MCU_FLASH_P1_MASTER7_PREFETCH_DIS_U32[!ENDIF!] |
        [!IF "McuPlatformFlashConfig/McuPFCR2/McuPort1Master6Prefetch='true'"!]MCU_FLASH_P1_MASTER6_PREFETCH_EN_U32[!ELSE!]MCU_FLASH_P1_MASTER6_PREFETCH_DIS_U32[!ENDIF!] |
        [!IF "McuPlatformFlashConfig/McuPFCR2/McuPort1Master5Prefetch='true'"!]MCU_FLASH_P1_MASTER5_PREFETCH_EN_U32[!ELSE!]MCU_FLASH_P1_MASTER5_PREFETCH_DIS_U32[!ENDIF!] |
        [!IF "McuPlatformFlashConfig/McuPFCR2/McuPort1Master4Prefetch='true'"!]MCU_FLASH_P1_MASTER4_PREFETCH_EN_U32[!ELSE!]MCU_FLASH_P1_MASTER4_PREFETCH_DIS_U32[!ENDIF!] |
        [!IF "McuPlatformFlashConfig/McuPFCR2/McuPort1Master3Prefetch='true'"!]MCU_FLASH_P1_MASTER3_PREFETCH_EN_U32[!ELSE!]MCU_FLASH_P1_MASTER3_PREFETCH_DIS_U32[!ENDIF!] |
        [!IF "McuPlatformFlashConfig/McuPFCR2/McuPort1Master2Prefetch='true'"!]MCU_FLASH_P1_MASTER2_PREFETCH_EN_U32[!ELSE!]MCU_FLASH_P1_MASTER2_PREFETCH_DIS_U32[!ENDIF!] |
        [!IF "McuPlatformFlashConfig/McuPFCR2/McuPort1Master1Prefetch='true'"!]MCU_FLASH_P1_MASTER1_PREFETCH_EN_U32[!ELSE!]MCU_FLASH_P1_MASTER1_PREFETCH_DIS_U32[!ENDIF!] |
        [!IF "McuPlatformFlashConfig/McuPFCR2/McuPort1Master0Prefetch='true'"!]MCU_FLASH_P1_MASTER0_PREFETCH_EN_U32[!ELSE!]MCU_FLASH_P1_MASTER0_PREFETCH_DIS_U32[!ENDIF!] |
        [!IF "McuPlatformFlashConfig/McuPFCR2/McuPort1DataPrefetch='true'"!]MCU_FLASH_P1_DATA_PREFETCH_EN_U32[!ELSE!]MCU_FLASH_P1_DATA_PREFETCH_DIS_U32[!ENDIF!] |
        [!IF "McuPlatformFlashConfig/McuPFCR2/McuPort1InstructionPrefetch='true'"!]MCU_FLASH_P1_INSTR_PREFETCH_EN_U32[!ELSE!]MCU_FLASH_P1_INSTR_PREFETCH_DIS_U32[!ENDIF!] |
        MCU_FLASH_P1_PFLIM_U32( (uint32)[!"num:i(McuPlatformFlashConfig/McuPFCR2/McuPort1PrefetchLimit)"!]U ) |
        [!IF "McuPlatformFlashConfig/McuPFCR2/McuPort1ReadBufferEnable='true'"!]MCU_FLASH_P1_BUFFER_EN_U32[!ELSE!]MCU_FLASH_P1_BUFFER_DIS_U32[!ENDIF!]
    ),

    /* Platform Flash Configuration Register 3 (PFCR3). */
    MCU_FLASH_PFCR3_U32
    (
        [!IF "McuPlatformFlashConfig/McuPFCR3/McuBFENLock='true'"!]MCU_FLASH_BFEN_LOCK_U32[!ELSE!]MCU_FLASH_BFEN_UNLOCK_U32[!ENDIF!] |
        MCU_FLASH_P0_WCFG_U32( (uint32)[!"num:i(McuPlatformFlashConfig/McuPFCR3/McuPort0PageBufferConfiguration)"!]U ) |
        MCU_FLASH_P1_WCFG_U32( (uint32)[!"num:i(McuPlatformFlashConfig/McuPFCR3/McuPort1LineBufferConfiguration)"!]U ) |
        MCU_FLASH_ARBM_WCFG_U32( (uint32)[!"num:i(McuPlatformFlashConfig/McuPFCR3/McuArbitrationMode)"!]U ) |
        [!IF "McuPlatformFlashConfig/McuPFCR3/McuDataErrorSuppression='true'"!]MCU_FLASH_DERR_SUP_EN_U32[!ELSE!]MCU_FLASH_DERR_SUP_DIS_U32[!ENDIF!]
    ),

    /* Platform Flash Access Protection Register (PFAPR). */
    MCU_FLASH_PFAPR_U32
    (
        MCU_FLASH_M0AP_U32( (uint32)[!"num:i(McuPlatformFlashConfig/McuPFAPR/McuMaster0AccessProt)"!]U ) |
        MCU_FLASH_M1AP_U32( (uint32)[!"num:i(McuPlatformFlashConfig/McuPFAPR/McuMaster1AccessProt)"!]U ) |
        MCU_FLASH_M2AP_U32( (uint32)[!"num:i(McuPlatformFlashConfig/McuPFAPR/McuMaster2AccessProt)"!]U ) |
        MCU_FLASH_M3AP_U32( (uint32)[!"num:i(McuPlatformFlashConfig/McuPFAPR/McuMaster3AccessProt)"!]U ) |
        MCU_FLASH_M4AP_U32( (uint32)[!"num:i(McuPlatformFlashConfig/McuPFAPR/McuMaster4AccessProt)"!]U ) |
        MCU_FLASH_M5AP_U32( (uint32)[!"num:i(McuPlatformFlashConfig/McuPFAPR/McuMaster5AccessProt)"!]U ) |
        MCU_FLASH_M6AP_U32( (uint32)[!"num:i(McuPlatformFlashConfig/McuPFAPR/McuMaster6AccessProt)"!]U ) |
        MCU_FLASH_M7AP_U32( (uint32)[!"num:i(McuPlatformFlashConfig/McuPFAPR/McuMaster7AccessProt)"!]U ) |
        MCU_FLASH_M8AP_U32( (uint32)[!"num:i(McuPlatformFlashConfig/McuPFAPR/McuMaster8AccessProt)"!]U ) |
        MCU_FLASH_M9AP_U32( (uint32)[!"num:i(McuPlatformFlashConfig/McuPFAPR/McuMaster9AccessProt)"!]U ) |
        MCU_FLASH_M10AP_U32( (uint32)[!"num:i(McuPlatformFlashConfig/McuPFAPR/McuMaster10AccessProt)"!]U ) |
        MCU_FLASH_M11AP_U32( (uint32)[!"num:i(McuPlatformFlashConfig/McuPFAPR/McuMaster11AccessProt)"!]U ) |
        MCU_FLASH_M12AP_U32( (uint32)[!"num:i(McuPlatformFlashConfig/McuPFAPR/McuMaster12AccessProt)"!]U ) |
        MCU_FLASH_M13AP_U32( (uint32)[!"num:i(McuPlatformFlashConfig/McuPFAPR/McuMaster13AccessProt)"!]U ) |
        MCU_FLASH_M14AP_U32( (uint32)[!"num:i(McuPlatformFlashConfig/McuPFAPR/McuMaster14AccessProt)"!]U ) |
        MCU_FLASH_M15AP_U32( (uint32)[!"num:i(McuPlatformFlashConfig/McuPFAPR/McuMaster15AccessProt)"!]U )
    )
};
#endif /* (MCU_DISABLE_FLASH_CONFIG == STD_OFF) */
        [!ENDCODE!]
        [!ENDSELECT!][!//McuModuleConfiguration
[!ENDNOCODE!]
[!ENDMACRO!][!//


[!MACRO "PMC_Config","Type"!][!//
[!NOCODE!]
        [!SELECT "McuModuleConfiguration"!][!//
        [!CODE!]
/**
* @brief          Initialization data for PMC hw IP.
* @details        Static configuration realized at statup by calling Mcu_Init() API.
*
*/
static CONST( Mcu_PMC_ConfigType, MCU_CONST) PMC_Config[!IF "var:defined('postBuildVariant')"!]_[!"$postBuildVariant"!][!ENDIF!] =
{
    /* Reset event interrupt enable register. PMC_TS_IER register. */
    PMC_TS_IER_CONFIG_U32
    (
        [!IF "McuPowerControl/McuPMC_IntConfig/McuTS1_2IE='true'"!]PMC_TS_IER_TS1_2IE_ENA_U32[!ELSE!]PMC_TS_IER_TS1_2IE_DIS_U32[!ENDIF!] |
        [!IF "McuPowerControl/McuPMC_IntConfig/McuTS1_0IE='true'"!]PMC_TS_IER_TS1_0IE_ENA_U32[!ELSE!]PMC_TS_IER_TS1_0IE_DIS_U32[!ENDIF!] |
        [!IF "McuPowerControl/McuPMC_IntConfig/McuTS0_2IE='true'"!]PMC_TS_IER_TS0_2IE_ENA_U32[!ELSE!]PMC_TS_IER_TS0_2IE_DIS_U32[!ENDIF!] |
        [!IF "McuPowerControl/McuPMC_IntConfig/McuTS0_0IE='true'"!]PMC_TS_IER_TS0_0IE_ENA_U32[!ELSE!]PMC_TS_IER_TS0_0IE_DIS_U32[!ENDIF!]
    ),

    /* Temperature reset event enable register. PMC_REE_TD register. */
    PMC_REE_TD_CONFIG_U32
    (
        [!IF "McuPowerControl/McuPMC_TempResetEventEnConfig/McuTEMP1_2E='true'"!]PMC_REE_TD_TEMP1_2_ENA_U32[!ELSE!]PMC_REE_TD_TEMP1_2_DIS_U32[!ENDIF!] |
        [!IF "McuPowerControl/McuPMC_TempResetEventEnConfig/McuTEMP1_0E='true'"!]PMC_REE_TD_TEMP1_0_ENA_U32[!ELSE!]PMC_REE_TD_TEMP1_0_DIS_U32[!ENDIF!] |
        [!IF "McuPowerControl/McuPMC_TempResetEventEnConfig/McuTEMP0_2E='true'"!]PMC_REE_TD_TEMP0_2_ENA_U32[!ELSE!]PMC_REE_TD_TEMP0_2_DIS_U32[!ENDIF!] |
        [!IF "McuPowerControl/McuPMC_TempResetEventEnConfig/McuTEMP0_0E='true'"!]PMC_REE_TD_TEMP0_0_ENA_U32[!ELSE!]PMC_REE_TD_TEMP0_0_DIS_U32[!ENDIF!]
    ),

    /* Temperature reset event selection register. PMC_RES_TD register. */
    PMC_RES_TD_CONFIG_U32
    (
        [!IF "McuPowerControl/McuPMC_TempResetEventSelConfig/McuTEMP1_2S='POR_GENERATED'"!]PMC_RES_TD_TEMP1_2_POR_GENERATED_U32[!ELSE!]PMC_RES_TD_TEMP1_2_NO_RESET_GENERATED_U32[!ENDIF!] |
        [!IF "McuPowerControl/McuPMC_TempResetEventSelConfig/McuTEMP1_0S='POR_GENERATED'"!]PMC_RES_TD_TEMP1_0_POR_GENERATED_U32[!ELSE!]PMC_RES_TD_TEMP1_0_NO_RESET_GENERATED_U32[!ENDIF!] |
        [!IF "McuPowerControl/McuPMC_TempResetEventSelConfig/McuTEMP0_2S='POR_GENERATED'"!]PMC_RES_TD_TEMP0_2_POR_GENERATED_U32[!ELSE!]PMC_RES_TD_TEMP0_2_NO_RESET_GENERATED_U32[!ENDIF!] |
        [!IF "McuPowerControl/McuPMC_TempResetEventSelConfig/McuTEMP0_0S='POR_GENERATED'"!]PMC_RES_TD_TEMP0_0_POR_GENERATED_U32[!ELSE!]PMC_RES_TD_TEMP0_0_NO_RESET_GENERATED_U32[!ENDIF!]
    ),

    /* Temperature detector configuration register. PMC_CTL_TD register. */
    PMC_CTL_TD_CONFIG_U32
    (
        [!IF "McuPowerControl/McuPMC_TempDetectorConfig/McuTS1_EN='true'"!]PMC_CTL_TD_TS1_ENA_U32[!ELSE!]PMC_CTL_TD_TS1_DIS_U32[!ENDIF!] |
        [!IF "McuPowerControl/McuPMC_TempDetectorConfig/McuTS0_EN='true'"!]PMC_CTL_TD_TS0_ENA_U32[!ELSE!]PMC_CTL_TD_TS0_DIS_U32[!ENDIF!]
    ),

     /* LVD/HVD Interrupt Enable Control Register. PMC_LVD_HVD_INTR_ENB register. */
     PMC_LVD_HVD_INTR_ENB_U32
     (
        [!IF "McuPowerControl/McuPMC_LVD_HVD_InterruptEnableConfig/McuPMC_HVD_FLASH_InterruptEnable='true'"!]PMC_HVD_FLASH_INT_ENABLED_U32[!ELSE!]PMC_HVD_FLASH_INT_DISABLED_U32[!ENDIF!] |
        [!IF "McuPowerControl/McuPMC_LVD_HVD_InterruptEnableConfig/McuPMC_HVD_HV_InterruptEnable='true'"!]PMC_HVD_HV_INT_ENABLED_U32[!ELSE!]PMC_HVD_HV_INT_DISABLED_U32[!ENDIF!] |
        [!IF "McuPowerControl/McuPMC_LVD_HVD_InterruptEnableConfig/McuPMC_HVD_CORE_InterruptEnable='true'"!]PMC_HVD_CORE_INT_ENABLED_U32[!ELSE!]PMC_HVD_CORE_INT_DISABLED_U32[!ENDIF!] |
        [!IF "McuPowerControl/McuPMC_LVD_HVD_InterruptEnableConfig/McuPMC_LVD_CORE_COLD_InterruptEnable='true'"!]PMC_LVD_CORE_COLD_INT_ENABLED_U32[!ELSE!]PMC_LVD_CORE_COLD_INT_DISABLED_U32[!ENDIF!]
    ),
    
     /* ADC Channel Select Register. PMC_ADC_CS register. */
     PMC_ADC_CS_[!"McuPowerControl/McuPMC_ADCChannelSelectConfig/McuPMC_ADCChannelSelect"!]_U32,
     
     /* Reset Event Enable Register. PMC_REE register. */
     PMC_REE_U32
     (
        [!IF "McuPowerControl/McuPMC_ResetEventEnableConfig/McuPMC_HVD_FLASH_ResetEnable='true'"!]PMC_HVD_FLASH_RESET_ENABLED_U32[!ELSE!]PMC_HVD_FLASH_RESET_DISABLED_U32[!ENDIF!] |
        [!IF "McuPowerControl/McuPMC_ResetEventEnableConfig/McuPMC_HVD_HV_ResetEnable='true'"!]PMC_HVD_HV_RESET_ENABLED_U32[!ELSE!]PMC_HVD_HV_RESET_DISABLED_U32[!ENDIF!] |
        [!IF "McuPowerControl/McuPMC_ResetEventEnableConfig/McuPMC_HVD_CORE_ResetEnable='true'"!]PMC_HVD_CORE_RESET_ENABLED_U32[!ELSE!]PMC_HVD_CORE_RESET_DISABLED_U32[!ENDIF!] |
        [!IF "McuPowerControl/McuPMC_ResetEventEnableConfig/McuPMC_LVD_CORE_COLD_ResetEnable='true'"!]PMC_LVD_CORE_COLD_RESET_ENABLED_U32[!ELSE!]PMC_LVD_CORE_COLD_RESET_DISABLED_U32[!ENDIF!]
     )
};
        [!ENDCODE!]
        [!ENDSELECT!][!//McuModuleConfiguration
[!ENDNOCODE!]
[!ENDMACRO!][!//


[!MACRO "SSCM_Config","Type"!][!//
[!NOCODE!]
[!CODE!]
/**
* @brief          Initialization data for SSCM hw IP.
* @details        Static configuration realized at statup by calling Mcu_Init() API.
*
*/
static CONST( Mcu_SSCM_ConfigType, MCU_CONST) SSCM_Config[!"$Type"!][!IF "var:defined('postBuildVariant')"!]_[!"$postBuildVariant"!][!ENDIF!] =
{
    /* SSCM configuration */
    SSCM_ERROR_U16(
        [!IF "McuModuleConfiguration/McuSSCMConfiguration/McuSscmPae='true'"!]SSCM_ERROR_PAE_ENABLE_U16[!ELSE!]SSCM_ERROR_PAE_DISABLE_U16[!ENDIF!]
    )

};
[!ENDCODE!]
[!ENDNOCODE!]
[!ENDMACRO!][!//


[!MACRO "Mcu_HwIPs_Config","Type"!][!//
[!NOCODE!]
[!CODE!]
/**
* @brief          Initialization data for different hw IPs.
* @details        Static configuration realized at statup by calling Mcu_Init() API.
*
*/
static CONST( Mcu_HwIPsConfigType, MCU_CONST) Mcu_HwIPs_Config[!"$Type"!] =
{
    /* Configuration for SIU Reset. */
    &SIU_ResetConfig[!"$Type"!][!IF "var:defined('postBuildVariant')"!]_[!"$postBuildVariant"!][!ENDIF!],

    /* Configuration for PMC (Power Management Control) hardware IP. */
    &PMC_Config[!IF "var:defined('postBuildVariant')"!]_[!"$postBuildVariant"!][!ENDIF!],

#if (MCU_DISABLE_FLASH_CONFIG == STD_OFF)
    /* Configuration for FLASH (Flash Memory) hardware IP. */
    &FLASH_Config[!"$Type"!][!IF "var:defined('postBuildVariant')"!]_[!"$postBuildVariant"!][!ENDIF!],
#endif

    /* Configuration for SSCM hardware IP. */
    &SSCM_Config[!"$Type"!][!IF "var:defined('postBuildVariant')"!]_[!"$postBuildVariant"!][!ENDIF!]
};
[!ENDCODE!]
[!ENDNOCODE!]
[!ENDMACRO!][!//


[!MACRO "Mcu_Config","Type"!][!//
[!NOCODE!]
[!CODE!]
/**
* @brief          Initialization data for the MCU driver.
* @details        A pointer to such a structure is provided to the MCU initialization routines for configuration.
*
*/
[!IF "(IMPLEMENTATION_CONFIG_VARIANT = 'VariantPreCompile') and (variant:size() <= 1)"!][!//
/**
* @violates @ref Mcu_[!IF "$Type = 'PC'"!]Cfg[!ELSE!]PBcfg[!IF "var:defined('postBuildVariant')"!]_[!"$postBuildVariant"!][!ENDIF!][!ENDIF!]_c_REF_4 An object should be defined at block scope if its
* identifier only appears in a single function.
*/
[!ELSE!]
/**
* @violates @ref Mcu_[!IF "$Type = 'PC'"!]Cfg[!ELSE!]PBcfg[!IF "var:defined('postBuildVariant')"!]_[!"$postBuildVariant"!][!ENDIF!][!ENDIF!]_c_REF_3 Functions and objects should not be defined with external
* linkage if they are referenced in only one translation unit.
*/
[!ENDIF!][!//
CONST(Mcu_ConfigType, MCU_CONST) [!IF "(IMPLEMENTATION_CONFIG_VARIANT = 'VariantPreCompile') and (variant:size() <= 1)"!]Mcu_PBCfgVariantPredefined[!ELSE!][!"as:name(McuModuleConfiguration)"!][!IF "var:defined('postBuildVariant')"!]_[!"$postBuildVariant"!][!ENDIF!][!ENDIF!] =
{
#if (MCU_DISABLE_DEM_REPORT_ERROR_STATUS == STD_OFF)
    /* Pointer to DEM error reporting configurations. */
    &Mcu_Dem_Config,
#endif

    /* Number of RAM Sections configurations. */
    (Mcu_RamSectionType)[!"num:i(count(McuModuleConfiguration/McuRamSectorSettingConf/*))"!]U,

    /* Number of Power Modes configurations. */
    (Mcu_ModeType)[!"num:i(count(McuModuleConfiguration/McuModeSettingConf/*))"!]U,

#if (MCU_INIT_CLOCK == STD_ON)
    /* Number of Clock Setting configurations. */
    (Mcu_ClockType)[!"num:i(count(McuModuleConfiguration/McuClockSettingConfig/*))"!]U,
#endif /* (MCU_INIT_CLOCK == STD_ON) */

    /* Pointer to RAM Section configurations. */
    [!IF "num:i(count(McuModuleConfiguration/McuRamSectorSettingConf/*))>0"!]&Mcu_aRamConfig[!"$Type"!][!IF "var:defined('postBuildVariant')"!]_[!"$postBuildVariant"!][!ENDIF!],[!ELSE!](NULL_PTR),[!ENDIF!]

    /* Pointer to Power Mode configurations. */
    [!IF "num:i(count(McuModuleConfiguration/McuModeSettingConf/*))>0"!]&Mcu_aModeConfig[!"$Type"!][!IF "var:defined('postBuildVariant')"!]_[!"$postBuildVariant"!][!ENDIF!],[!ELSE!](NULL_PTR),[!ENDIF!]

#if (MCU_INIT_CLOCK == STD_ON)
    /* Pointer to Clock configurations. */
    [!IF "num:i(count(McuModuleConfiguration/McuClockSettingConfig/*))>0"!]&Mcu_aClockConfig[!"$Type"!][!IF "var:defined('postBuildVariant')"!]_[!"$postBuildVariant"!][!ENDIF!],[!ELSE!](NULL_PTR),[!ENDIF!]

#endif /* (MCU_INIT_CLOCK == STD_ON) */

    /* Pointer to Low Level Mcu driver configuration. */
    &Mcu_HwIPs_Config[!"$Type"!]
};
[!ENDCODE!]
[!ENDNOCODE!]
[!ENDMACRO!][!//
[!ENDNOCODE!]