[!AUTOSPACING!]
[!CODE!][!//
/**
*   @file CDD_Mcl_Cfg.h
*   @version 1.0.0
*
*   @brief   AUTOSAR Mcl - contains the configuration data of the MCL driver
*   @details Contains the configuration data of the MCL driver
*
*   @addtogroup MCL_MODULE
*   @{
*/
/*==================================================================================================
*   Project              : AUTOSAR 4.3 MCAL
*   Platform             : PA
*   Peripheral           : eDMA
*   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.
==================================================================================================*/
/*==================================================================================================
==================================================================================================*/
[!INCLUDE "CDD_Mcl_PluginMacro.m"!][!//

[!NOCODE!]
[!VAR "totalNumberDmaChannels" = "ecu:get('Mcl.eDMA.ChannelNumberMain') + ecu:get('Mcl.eDMA.ChannelNumberAcd')"!]
[!VAR "MainNumberDmaChannels" = "ecu:get('Mcl.eDMA.ChannelNumberMain')"!]
[!VAR "numeDmaChannelsPerInstance" = "ecu:get('Mcl.eDMA.ChannelNumberPerDmaInstance')"!]
[!VAR "numeDmaChannelsPerInstanceAcd" = "ecu:get('Mcl.eDMA.ChannelNumberPerDmaInstanceAcd')"!]
[!VAR "numeDmaChannelsPerGroup" = "ecu:get('Mcl.eDMA.ChannelNumberPerGroup')"!]
[!VAR "numeDmaOffsetAEV2" = "ecu:get('Mcl.eDMA.OffsetAEAreaAcd')"!]
[!VAR "numeDmaInstancesV3" = "ecu:get('Mcl.MclConfigSet.DmaInstancesV3')"!]
[!VAR "numeDmaInstancesV2" = "ecu:get('Mcl.MclConfigSet.DmaInstancesV2')"!]
[!VAR "numeDmaTcdGapChannel" = "ecu:get('Mcl.eDMA.TCD.GapBetweenChannel')"!]
[!VAR "numeDmaTcdGapGroupChannel" = "ecu:get('Mcl.eDMA.TCD.GapBetweenGroupChannel')"!]
[!VAR "numeDmaInstances" = "num:i(count(ecu:list('Mcl.MclConfigSet.DmaInstances')))"!]
[!VAR "numeDmaMuxInstances" = "ecu:get('Mcl.DmaMux.DmaMuxInstances')"!]
[!VAR "numeDmaCrcInstances" = "ecu:get('Mcl.DmaCrc.DmaCrcInstances')"!]
[!VAR "ChCfgAddressesLittleEndianOrder" = "ecu:get('Mcl.DmaMux.ChCfgAddressesLittleEndianOrder')"!]
[!VAR "CombinedErrorIsr"                  = "num:i(ecu:get('Mcl.eDMA.CombinedErrorIsr'))"!][!//
[!VAR "CombinedTrCompletionIsr"           = "num:i(ecu:get('Mcl.eDMA.CombinedTrCompletionIsr'))"!][!//
[!VAR "TrCompletionMixedIsr"              = "num:i(ecu:get('Mcl.eDMA.CombinedTrComplMixedIsr'))"!][!//
[!VAR "GroupCompletionIsr"              = "num:i(ecu:get('Mcl.eDMA.CombinedGroupCompletionIsr'))"!][!//
[!VAR "GroupDmaV2Isr"                     = "num:i(ecu:get('Mcl.eDMA.GroupAcdIsr'))"!]
[!VAR "EccErrorReportingEnabled"          = "num:i(ecu:get('Mcl.eDMA.EccErrorReportingEnabled'))"!][!//
[!VAR "EnableInitDMAV2_DCHMID"              = "num:i(ecu:get('Mcl.eDMA.EnableInitDMA_DCHMID'))"!][!//
[!VAR "CombineErrorCompletion"                =  "num:i(ecu:get('Mcl.eDMA.CombinedErrCompletion'))"!][!//
[!ENDNOCODE!]


#ifndef CDD_MCL_CFG_H
#define CDD_MCL_CFG_H

#ifdef __cplusplus
extern "C"{
#endif

/**
* @page misra_violations MISRA-C:2012 violations
*
* @section [global]
* Violates MISRA 2012 Required Rule 5.1, External identifiers shall be distinct.
* Identifiers (internal and external) shall not rely on the significance of more than 31 characters.
* The used compilers use more than 31 chars for identifiers.
*
* @section [global]
* Violates MISRA 2012 Required Rule 5.2, Identifiers declared in the same scope and namespace shall be distinct.
* This violation is due to the requirement that requests to have a file version check.
*
* @section [global]
* Violates MISRA 2012 Required Rule 5.4, Macro identifiers shall be distinct.
* This violation is due to the requirement that requests to have a file version check.
*
* @section [global]
* Violates MISRA 2012 Required Rule 5.5, Identifiers shall be distinct from macro names.
* This violation is due to the requirement that requests to have a file version check.
*
* @section CDD_Mcl_Cfg_h_REF_1
* Violates MISRA 2012 Advisory Rule 2.5, A project should not contain unused macro declarations.
* Macros are used only in some configurations or for future releases.
**/

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

[!NOCODE!]
[!VAR "MclDisableDemReport" = "0"!]
[!IF "node:exists(MclDemEventParameterRefs)"!]
      [!IF "MclGeneral/MclDisableDemReportErrorStatus = 'true'"!]
        [!VAR "MclDisableDemReport" = "1"!]
      [!ENDIF!]
[!ELSE!]
  [!VAR "MclDisableDemReport" = "1"!]
[!ENDIF!]
[!ENDNOCODE!]
[!IF "$MclDisableDemReport=0"!]
#include "Dem.h"
[!ENDIF!]
[!INCLUDE "CDD_Mcl_Cfg_h_checks.m"!][!//
/*==================================================================================================
                               SOURCE FILE VERSION INFORMATION
==================================================================================================*/
#define MCL_VENDOR_ID_CFG                       43

#define MCL_AR_RELEASE_MAJOR_VERSION_CFG        4
#define MCL_AR_RELEASE_MINOR_VERSION_CFG        3
#define MCL_AR_RELEASE_REVISION_VERSION_CFG     1

#define MCL_SW_MAJOR_VERSION_CFG                1
#define MCL_SW_MINOR_VERSION_CFG                0
#define MCL_SW_PATCH_VERSION_CFG                0
/*==================================================================================================
                                      FILE VERSION CHECKS
==================================================================================================*/

#ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
    #if ((MCL_AR_RELEASE_MAJOR_VERSION_CFG != MCAL_AR_RELEASE_MAJOR_VERSION) || \
        (MCL_AR_RELEASE_MINOR_VERSION_CFG != MCAL_AR_RELEASE_MINOR_VERSION))
        #error "AutoSar Version Numbers of CDD_Mcl_Cfg.h and Mcal.h are different"
    #endif
#endif

/* Check if header file and Dem.h file are of the same Autosar version */
[!IF "$MclDisableDemReport=0"!]
 #ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
     /* Check if source file and Dem header file are of the same Autosar version */
     #if (( MCL_AR_RELEASE_MAJOR_VERSION_CFG != DEM_AR_RELEASE_MAJOR_VERSION) || \
          ( MCL_AR_RELEASE_MINOR_VERSION_CFG != DEM_AR_RELEASE_MINOR_VERSION))
         #error "AutoSar Version Numbers of CDD_Mcl_Cfg.h and Dem.h are different"
     #endif
 #endif
[!ENDIF!]

#if (MCL_VENDOR_ID_CFG != MCL_ENVCFG_VENDOR_ID)
    #error "CDD_Mcl_Cfg.h and Mcl_EnvCfg.h have different vendor ids"
#endif
/* Check if current file and Mcl_CfgEnv header file are of the same Autosar version */
#if (( MCL_AR_RELEASE_MAJOR_VERSION_CFG != MCL_ENVCFG_AR_RELEASE_MAJOR_VERSION) || \
     ( MCL_AR_RELEASE_MINOR_VERSION_CFG != MCL_ENVCFG_AR_RELEASE_MINOR_VERSION) || \
     ( MCL_AR_RELEASE_REVISION_VERSION_CFG !=  MCL_ENVCFG_AR_RELEASE_REVISION_VERSION))
     #error "AutoSar Version Numbers of CDD_Mcl_Cfg.h and Mcl_EnvCfg.h are different"
#endif
/* Check if current file and Mcl_CfgEnv header file are of the same software version */
#if ((MCL_SW_MAJOR_VERSION_CFG != MCL_ENVCFG_SW_MAJOR_VERSION) || \
     (MCL_SW_MINOR_VERSION_CFG != MCL_ENVCFG_SW_MINOR_VERSION) || \
     (MCL_SW_PATCH_VERSION_CFG != MCL_ENVCFG_SW_PATCH_VERSION))
     #error "Software Version Numbers of CDD_Mcl_Cfg.h and Mcl_EnvCfg.h are different"
#endif

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


/*==================================================================================================
                                       DEFINES AND MACROS
==================================================================================================*/
[!VAR "mclFeatureEnabled" = "0"!][!//

[!VAR "mclEnableInitDMA_EARS"   = "ecu:get('Mcl.eDMA.EnableInitDMA_EARS')"!][!//

/* Mcl Pre Compile Switch */
#define MCL_PRECOMPILE_SUPPORT                   ([!IF "(IMPLEMENTATION_CONFIG_VARIANT ='VariantPreCompile') and (variant:size()<=1)"!]STD_ON[!ELSE!]STD_OFF[!ENDIF!])

/**
*   @brief  Switches the Development Error Detection and Notification on or off.
*        STD_ON: Enabled. STD_OFF: Disabled.
*
*/
#define MCL_DEV_ERROR_DETECT                     ([!IF "MclGeneral/MclDevErrorDetect"!]STD_ON[!ELSE!]STD_OFF[!ENDIF!])

/**
* @{
*   @brief Configuration of Optional API's
*/
/**
*   @brief  Adds or removes the service Mcl_GetVersionInfo() from the code.
*        STD_ON: Mcl_GetVersionInfo() can be used. STD_OFF: Mcl_GetVersionInfo() can not be used.
*
*/
#define MCL_GET_VERSION_INFO_API                 ([!IF "MclGeneral/Mcl_VersionInfoApi"!]STD_ON[!ELSE!]STD_OFF[!ENDIF!])

/**
* @{
*   @brief Configuration of Optional API's
*/
/**
*   @brief  Adds or removes the service Mcl_DeInit() from the code.
*        STD_ON: Mcl_DeInit() can be used. STD_OFF: Mcl_DeInit() can not be used.
*
*/
#define MCL_DEINIT_API                           ([!IF "MclGeneral/Mcl_DeInitApi"!]STD_ON[!ELSE!]STD_OFF[!ENDIF!])

/**
*   @brief   Switches DMA features initialization on or off.
*        STD_ON: Enabled. STD_OFF: Disabled.
*
*/
#define MCL_ENABLE_DMA                           ([!IF "MclGeneral/EnableDMA"!]STD_ON[!ELSE!]STD_OFF[!ENDIF!])
[!IF "MclGeneral/EnableDMA"!][!VAR "mclFeatureEnabled"="1"!][!ENDIF!]



[!VAR "CrossbarNumInstances"              = "num:i(ecu:get('Mcl.Crossbar.CrossbarNumInstances'))"!][!//
[!VAR "EnableInitAXBS_MGPCR"               = "num:i(ecu:get('Mcl.Crossbar.EnableInitAXBS_MGPCR'))"!][!//
[!VAR "PRSIsReadOnly"                     = "num:i(ecu:get('Mcl.Crossbar.PRS.IsReadOnly'))"!][!//
[!VAR "PRSResetValueForInstance0"         = "ecu:get('Mcl.CrossbarInstance0.PRS.PRSResetValue')"!][!//
[!VAR "CRSResetValueForInstance0"         = "ecu:get('Mcl.CrossbarInstance0.CRS.CRSResetValue')"!][!//
[!IF "$CrossbarNumInstances=2"!]
[!VAR "PRSResetValueForInstance1"         = "ecu:get('Mcl.CrossbarInstance1.PRS.PRSResetValue')"!][!//
[!VAR "CRSResetValueForInstance1"         = "ecu:get('Mcl.CrossbarInstance1.CRS.CRSResetValue')"!][!//
[!ENDIF!]
/**
*   @brief   Switches the Crossbar support on or off.
*        STD_ON: Enabled. STD_OFF: Disabled.
*
*/
#define MCL_CROSSBAR_NUM_INSTANCES        ([!"num:inttohex($CrossbarNumInstances)"!]U)

#define MCL_ENABLE_CROSSBAR              ([!IF "MclGeneral/MclEnableCrossbarSwitch"!]STD_ON[!ELSE!]STD_OFF[!ENDIF!])

#define MCL_CROSSBAR_PRS_READONLY        ([!IF "$PRSIsReadOnly=1"!]STD_ON[!ELSE!]STD_OFF[!ENDIF!])

#define MCL_CROSSBAR0_PRS_RESET_VALUE_U32     ([!"$PRSResetValueForInstance0"!]U)

#define MCL_CROSSBAR0_CRS_RESET_VALUE_U32     ([!"$CRSResetValueForInstance0"!]U)

[!IF "$CrossbarNumInstances=2"!]
#define MCL_CROSSBAR1_PRS_RESET_VALUE_U32     ([!"$PRSResetValueForInstance1"!]U)

#define MCL_CROSSBAR1_CRS_RESET_VALUE_U32     ([!"$CRSResetValueForInstance1"!]U)
[!ENDIF!]

[!IF "$EnableInitAXBS_MGPCR=1"!]
#define MCL_AXBS_ENABLE_INIT_MGPCR        (STD_ON)
[!ENDIF!]

[!IF "MclGeneral/MclEnableCrossbarSwitch"!][!VAR "mclFeatureEnabled"="1"!][!ENDIF!]

[!IF "MclGeneral/EnableDMA"!][!//
/**
* @brief      This define specifies enable or disable initialization of DCHMID register in DMA
*
*/
#define MCL_DMA_ENABLE_INIT_DCHMID               ([!IF "$EnableInitDMAV2_DCHMID=1"!]STD_ON[!ELSE!]STD_OFF[!ENDIF!])
/**
* @brief      This define specifies the number of eDma Channels available for one eDma instance
*
*/
#define MCL_DMA_INSTANCE_CHANNELS_NO             ([!"num:inttohex($numeDmaChannelsPerInstance)"!]U)
/**
* @brief      This define specifies the number of eDma Channels available for one eDma V2 instance
*
*/
/* @violates @ref CDD_Mcl_Cfg_h_REF_1 MISRA 2012 Advisory 2.5*/
#define MCL_DMAV2_INSTANCE_CHANNELS_NO           ([!"num:inttohex($numeDmaChannelsPerInstanceAcd)"!]U)
/**
* @brief      This define specifies the number of eDma instances
*
*/
#define MCL_DMA_NB_CONTROLLERS                   ([!"num:inttohex($numeDmaInstances)"!]U)

/**
* @brief Number of groups within a DMA instance
*/
#define DMA_GROUPS                                    ([!"num:inttohex(ecu:get('Mcl.eDma.Group'))"!]U)
/**
* @{
* @brief Offset of Application Extension Subsystem.
*/
#define DMAV2_OFFSET_AE_AREA                     (uint32)([!"num:i($numeDmaOffsetAEV2)"!]U)

#define DMAV3_INSTANCES_NUMBER_U32               ([!"num:i($numeDmaInstancesV3)"!]U)

#define DMAV2_INSTANCES_NUMBER_U32               ([!"num:i($numeDmaInstancesV2)"!]U)


/**
* @{
*   @brief Configuration of Optional API's
*/
/**
*   @brief  Adds or removes the service Mcl_DmaGetChannelErrorStatus() from the code.
*        STD_ON: Mcl_DmaGetChannelErrorStatusApi() can be used. STD_OFF: Mcl_DmaGetChannelErrorStatusApi() can not be used.
*
*/
#define MCL_DMA_GET_CH_ERR_STATUS_API            ([!IF "MclGeneral/Mcl_DmaGetChannelErrorStatusApi"!]STD_ON[!ELSE!]STD_OFF[!ENDIF!])

/**
*   @brief  Adds or removes the service Mcl_DmaGetGlobalErrorStatusApi() from the code.
*        STD_ON: Mcl_DmaGetGlobalErrorStatusApi() can be used. STD_OFF: Mcl_DmaGetGlobalErrorStatusApi() can not be used.
*
*/
#define MCL_DMA_GET_GLOBAL_ERR_STATUS_API        ([!IF "MclGeneral/Mcl_DmaGetGlobalErrorStatusApi"!]STD_ON[!ELSE!]STD_OFF[!ENDIF!])

/**
* @brief      This define specifies the number of eDMA channels available
*             on the current platform
*
*/
#define MCL_EDMA_TOTAL_CHANNELS_NO               ([!"num:i($totalNumberDmaChannels)"!]U)

/**
* @brief      This define specifies the number of eDMAv3 channels available
*             on the current platform (eDMAv3 instances are used on the Main common chassis platform)
*
*/
#define MCL_EDMAV3_CHANNELS_NO                   ([!"num:i($MainNumberDmaChannels)"!]U)

/**
* @brief      This define specifies the number of eTimer channels in a group of channels available
*             on the current platform
*
*/
/* @violates @ref CDD_Mcl_Cfg_h_REF_1 MISRA 2012 Advisory 2.5*/
#define MCL_EDMA_CHANNELS_IN_GROUP               ([!"num:i($numeDmaChannelsPerGroup)"!]U)

/**
* @brief      This define specifies the number of eTimer channels in a group of channels available
*             on the current platform
*
*/
#define MCL_EDMA_TCD_GAP_CHANNELS                ([!"num:inttohex($numeDmaTcdGapChannel)"!]U)

/**
* @brief      This define specifies the number of eTimer channels in a group of channels available
*             on the current platform
*
*/
#define MCL_EDMA_TCD_GAP_GROUP_CHANNELS          ([!"num:inttohex($numeDmaTcdGapGroupChannel)"!]U)

/**
* @brief      This define specifies the number of eTimer channels in a group of channels available
*             on the current platform
*
*/
#define MCL_DMA_ERROR_INTERRUPTS_USED            ([!IF "MclGeneral/MclErrorChecking"!]STD_ON[!ELSE!]STD_OFF[!ENDIF!])

/**
* @brief  Define if current platform has EARS registers or not
*/
#define MCL_DMA_SETUP_EARS                       ([!IF "$mclEnableInitDMA_EARS=1"!]STD_ON[!ELSE!]STD_OFF[!ENDIF!])

/**
* @brief      This definition specify error notification for channel is supporrted
*             on the current platform
*/
#define MCL_DMA_COMBINED_ERROR_COMPLETION_PER_CHANNEL_ISR        ([!IF "$CombineErrorCompletion=1"!]STD_ON[!ELSE!]STD_OFF[!ENDIF!])

/**
* @brief      This define specifies if there is only one transfer completion ISR for all DMA channels within a DMA instance
*             or if there is a transfer completion ISR for each channel
*
*/
#define MCL_DMA_COMBINED_TR_COMPLETION_ISR       ([!IF "$CombinedTrCompletionIsr=1"!]STD_ON[!ELSE!]STD_OFF[!ENDIF!])

/**
* @brief      This define specifies if there is one transfer completion ISR for each group of DMA channels within a DMA instance
*
*/
#define MCL_DMA_COMBINED_GROUP_COMPLETION_ISR    ([!IF "$GroupCompletionIsr=1"!]STD_ON[!ELSE!]STD_OFF[!ENDIF!])

#if (MCL_DMA_COMBINED_GROUP_COMPLETION_ISR == STD_ON)
[!IF "ecu:get('Mcl.eDMA.PriorityGroup0Exists')='true'"!]
[!CODE!]#define MCL_DMA_GROUP0_ISR_USED[!ENDCODE!]
[!ENDIF!]

[!IF "ecu:get('Mcl.eDMA.PriorityGroup1Exists')='true'"!]
[!CODE!]#define MCL_DMA_GROUP1_ISR_USED[!ENDCODE!]
[!ENDIF!]

[!IF "ecu:get('Mcl.eDMA.PriorityGroup2Exists')='true'"!]
[!CODE!]#define MCL_DMA_GROUP2_ISR_USED[!ENDCODE!]
[!ENDIF!]

[!IF "ecu:get('Mcl.eDMA.PriorityGroup3Exists')='true'"!]
[!CODE!]#define MCL_DMA_GROUP3_ISR_USED[!ENDCODE!]
[!ENDIF!]

#endif

/**
* @brief      This define specifies if there are 2 types of DMA IP
*
*/
[!NOCODE!]
[!VAR "dmav3available" = "num:i(0)"!]
[!VAR "dmav2available" = "num:i(0)"!]
[!LOOP "ecu:list('Mcl.MclConfigSet.DmaInstances.Version')"!]
[!IF "num:i(substring-after(node:current(),'eDMA_v')) = 3"!]
[!VAR "dmav3available" = "num:i(1)"!]
[!ENDIF!]
[!IF "num:i(substring-after(node:current(),'eDMA_v')) = 2"!]
[!VAR "dmav2available" = "num:i(1)"!]
[!ENDIF!]
[!ENDLOOP!]
[!ENDNOCODE!]
#define MCL_DMA_V3_INSTANCE_AVAILABLE            ([!IF "$dmav3available=1"!]STD_ON[!ELSE!]STD_OFF[!ENDIF!])
#define MCL_DMA_V2_INSTANCE_AVAILABLE            ([!IF "$dmav2available=1"!]STD_ON[!ELSE!]STD_OFF[!ENDIF!])
/**
* @brief      This define specifies if there is only one error ISR for all DMA instances
*             or if there is an error ISR for each DMA instance
*
*/
#define MCL_DMA_COMBINED_ERROR_ISR               ([!IF "$CombinedErrorIsr=1"!]STD_ON[!ELSE!]STD_OFF[!ENDIF!])
/**
* @brief      This define specifies if there is Ecc error reporting available
*
*/
#define MCL_DMA_ECC_REPORTING_ENABLED            ([!IF "$EccErrorReportingEnabled=1"!]STD_ON[!ELSE!]STD_OFF[!ENDIF!])

/**
* @brief  Switch to globaly enable/disable the production error reporting.
*/
#define MCL_DISABLE_DEM_REPORT_ERROR_STATUS      ([!IF "$MclDisableDemReport=1"!]STD_ON[!ELSE!]STD_OFF[!ENDIF!])

[!VAR "NotificationUsed" = "num:i(0)"!]
[!VAR "isMixedIsrCase" = "num:i(0)"!]
[!VAR "isSeparatedIsrCase" = "num:i(0)"!]
[!NOCODE!]
    [!LOOP "MclGeneral/MclIsrAvailable/*"!]
        [!IF "MclIsrEnabled"!]
            [!VAR "hwCh" = "num:i(substring-after(node:value(MclIsrName),'eDMA_'))"!]
            [!IF "$GroupCompletionIsr=0"!]
                [!IF "($TrCompletionMixedIsr=0)"!]
                    [!CODE!]
#define MCL_DMA_CH_[!"$hwCh"!]_ISR_USED[!CR!]
                    [!ENDCODE!]
                    [!VAR "isSeparatedIsrCase" = "num:i(1)"!]
                [!ELSE!]
                    [!VAR "isMixedIsrCase" = "num:i(1)"!]
                [!ENDIF!]
            [!ELSE!]
                [!IF "$dmav2available=1"!]
                    [!IF "$hwCh > ($MainNumberDmaChannels -1)"!]
                        [!CODE!]
#define MCL_DMA_CH_[!"$hwCh"!]_ISR_USED[!CR!]
                        [!ENDCODE!]
                    [!VAR "isSeparatedIsrCase" = "num:i(1)"!]
                    [!ENDIF!]
                [!ENDIF!]
            [!ENDIF!] /* combined transfer ISR*/
            [!VAR "NotificationUsed" = "num:i(1)"!]
        [!ENDIF!]
    [!ENDLOOP!]
[!ENDNOCODE!]

/**
* @brief      This define specifies if there is only one transfer completion ISR for a DMA channel within a DMA instance
*             or if there is a transfer completion ISR for each channel
*
*/
#define MCL_DMA_TR_SEPARATED_ISR                 ([!IF "$isSeparatedIsrCase=1"!]STD_ON[!ELSE!]STD_OFF[!ENDIF!])

/**
* @brief      This define specifies if inside a DMA instance some channels have the same transfer completion ISR assigned,
*             and other channels have their own transfer completion ISR.
*
*/
#define MCL_DMA_TR_COMPLETION_MIXED_ISR          ([!IF "$isMixedIsrCase=1"!]STD_ON[!ELSE!]STD_OFF[!ENDIF!])

#define MCL_DMAV2_COMPLETION_GROUP_ISR                        ([!IF "$GroupDmaV2Isr=1"!]STD_ON[!ELSE!]STD_OFF[!ENDIF!]) 
/** Define to specify if least one transfer completion interrupt and notification is used,
*      needed for removing at precompile time the code for ISR handling for the transfer
*      completion notification processing. This define is needed in both combined transfer
*      completion interrupt and single channel mode. */
#define MCL_DMA_NOTIFICATION_SUPPORTED           ([!IF "$NotificationUsed = "1""!]STD_ON[!ELSE!]STD_OFF[!ENDIF!])

/* Transfer size options available */
[!NOCODE!]
    [!LOOP "ecu:list('Mcl.eDMA.TransferSizeInBytes')"!]
        [!CODE!]
#define MCL_TRANSFER_SIZE_[!"num:i(node:current())"!]_BYTE [!CR!]
        [!ENDCODE!]
    [!ENDLOOP!]
[!ENDNOCODE!]

[!ENDIF!][!//"MclGeneral/EnableDMA"



/**
* @brief            Support for User mode.
*                   STD_ON: the Mcl driver can be executed from both supervisor and user mode.
*                   STD_OFF: the Mcl driver can be executed only from supervisor mode.
*/
#define MCL_ENABLE_USER_MODE_SUPPORT             ([!IF "MclGeneral/MclEnableUserModeSupport"!]STD_ON[!ELSE!]STD_OFF[!ENDIF!])
#define MCL_LOGICAL_ADDRESS_USED                 ([!IF "MclGeneral/MclEnableLogicalAddress"!]STD_ON[!ELSE!]STD_OFF[!ENDIF!])

#define MCL_DMAMUX_USER_MODE_SUPPORT             ([!IF "node:containsValue(ecu:list('Mcl.Ipv.UserMode.Available'),'DMA_MUX')"!]STD_ON[!ELSE!]STD_OFF[!ENDIF!])

/* @violates @ref CDD_Mcl_Cfg_h_REF_1 MISRA 2012 Advisory 2.5*/
#define MCL_AXBS_USER_MODE_SUPPORT               ([!IF "node:containsValue(ecu:list('Mcl.Ipv.UserMode.Available'),'AXBS')"!]STD_ON[!ELSE!]STD_OFF[!ENDIF!])
/* @violates @ref CDD_Mcl_Cfg_h_REF_1 MISRA 2012 Advisory 2.5*/
#define MCL_LMEM_USER_MODE_SUPPORT               ([!IF "node:containsValue(ecu:list('Mcl.Ipv.UserMode.Available'),'LMEM')"!]STD_ON[!ELSE!]STD_OFF[!ENDIF!])

/* @violates @ref CDD_Mcl_Cfg_h_REF_1 MISRA 2012 Advisory 2.5*/
#define MCL_M7_USER_MODE_SUPPORT               ([!IF "node:containsValue(ecu:list('Mcl.Ipv.UserMode.Available'),'M7')"!]STD_ON[!ELSE!]STD_OFF[!ENDIF!])

/* @violates @ref CDD_Mcl_Cfg_h_REF_1 MISRA 2012 Advisory 2.5*/
#define MCL_TRGMUX_USER_MODE_SUPPORT             ([!IF "node:containsValue(ecu:list('Mcl.Ipv.UserMode.Available'),'TRGMUX')"!]STD_ON[!ELSE!]STD_OFF[!ENDIF!])

#if (MCL_ENABLE_USER_MODE_SUPPORT == STD_ON)
/**
* @brief            Protected Register in User mode
*                   Macro use to enable if IP hw need to configure Reg_Prot to access from user mode
*/

/* @violates @ref CDD_Mcl_Cfg_h_REF_1 MISRA 2012 Advisory 2.5*/
#define MCL_DMAMUX_REG_PROT_AVAILABLE            ([!IF "node:containsValue(ecu:list('Mcl.Ipv.RegProt.Available'),'DMA_MUX')"!]STD_ON[!ELSE!]STD_OFF[!ENDIF!])

#define MCL_DMA_REG_PROT_AVAILABLE               ([!IF "node:containsValue(ecu:list('Mcl.Ipv.RegProt.Available'),'DMA')"!]STD_ON[!ELSE!]STD_OFF[!ENDIF!])

#endif

#ifndef MCAL_ENABLE_USER_MODE_SUPPORT
    #if (STD_ON == MCL_ENABLE_USER_MODE_SUPPORT)
        #error MCAL_ENABLE_USER_MODE_SUPPORT is not enabled. For running Mcl in user mode the MCAL_ENABLE_USER_MODE_SUPPORT needs to be defined
    #endif /* (STD_ON == MCL_ENABLE_USER_MODE_SUPPORT) */
#endif /* ifndef MCAL_ENABLE_USER_MODE_SUPPORT */

#define M7_CACHE_ENABLE                        (0U)
#define LMEM_CACHE_ENABLE                      (1U)
/* Core used in this configuration
The define is used to lock the semaphores correctly with*/

#define  MCL_CORE_USED                           ((uint8)[!"num:i(MclGeneral/CoreUsed)"!])


/*********************************** SEMAPHORE SECTION ********************************/

/* Define that allows the use of the Semaphore API's */
#define  MCL_SEMA4_FEATURE_API                   ([!IF "MclGeneral/EnableSemaphoreSupport"!]STD_ON[!ELSE!]STD_OFF[!ENDIF!])

#if(STD_ON == MCL_SEMA4_FEATURE_API)
/* Number of semaphore channels present on the platform */
#define  MCL_SEMA4_NUMBER                        ((uint8)[!"num:i(ecu:get('Mcl.Sema4.NoOfSemaphores'))"!])
#define  MCL_SEMA42_SUPPORT                       ([!IF "num:i(ecu:get('Mcl.Sema42.Support')) = 1"!]STD_ON[!ELSE!]STD_OFF[!ENDIF!])

#endif


/*********************************** SEMAPHORE SECTION ********************************/

/** Variant aware structure [!IF "var:defined('postBuildVariant')"!]_[!"$postBuildVariant"!][!ENDIF!].c file. */
[!IF "((IMPLEMENTATION_CONFIG_VARIANT != 'VariantPostBuild') and (variant:size()>1)) or (IMPLEMENTATION_CONFIG_VARIANT = 'VariantPostBuild')"!]
    [!CALL "MclExportDriverConfiguration"!]
[!ELSE!]
/**Variant aware structure pre-compiled.c file */
#define MCL_INIT_CONFIG_PC_DEFINE extern CONST(Mcl_ConfigType, MCL_CONST) Mcl_Init_PBCfgVariantPredefined;
[!ENDIF!]

/********************************** Check MCL enable features *********************/
[!IF "$mclFeatureEnabled=0"!][!//
   [!ERROR!] [!//
         "At least one MCL feature must be enabled(DMA, Crossbar, TriggerMux, Gtm). "[!//
   [!ENDERROR!][!//
[!ENDIF!][!//
/*==================================================================================================
                                             ENUMS
==================================================================================================*/
[!IF "MclGeneral/EnableDMA"!][!//
#if (MCL_DISABLE_DEM_REPORT_ERROR_STATUS == STD_OFF)
/**
* @brief            DEM error reporting configuration.
* @details          This structure contains information DEM error reporting
*/
typedef struct
{
    VAR( Mcal_DemErrorType, MCL_VAR) Mcl_E_Dma_Bus;
    VAR( Mcal_DemErrorType, MCL_VAR) Mcl_E_Dma_Descriptor;
    VAR( Mcal_DemErrorType, MCL_VAR) Mcl_E_Dma_Ecc;
    VAR( Mcal_DemErrorType, MCL_VAR) Mcl_E_Dma_Priority;
    VAR( Mcal_DemErrorType, MCL_VAR) Mcl_E_Dma_Unrecognized;
    VAR( Mcal_DemErrorType, MCL_VAR) Mcl_E_Dma_Inconsistency;
} Mcl_DemConfigType;

extern CONST( Mcl_DemConfigType, MCL_CONST) Mcl_Dem_Config;

#endif

[!ENDIF!]

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


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

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

#ifdef __cplusplus
}
#endif

#endif    /* CDD_MCL_CFG_H */
/**@}*/

[!ENDCODE!]

