[!CODE!][!//
[!AUTOSPACING!]
/**
 *   @file    Icu_DmaNotification.c
 *   @version 1.0.0
 *
 *   @brief   AUTOSAR Icu - contains the data exported by the Icu module
 *   @details Contains the information that will be exported by the module, as requested by Autosar.
 *
 *   @addtogroup ICU_MODULE
 *   @{
 */
/*==================================================================================================
 *   Project              : AUTOSAR 4.3 MCAL
 *   Platform             : PA
 *   Peripheral           : eMIOS SIU
 *   Dependencies         : none
 *
 *   Autosar Version      : 4.3.1
 *   Autosar Revision     : ASR_REL_4_3_REV_0001
 *   Autosar Conf.Variant :
 *   SW Version           : 1.0.0
 *   Build Version        : MPC5777C_MCAL_1_0_0_RTM_ASR_REL_4_3_REV_0001_20190315
 *
 *   (c) Copyright 2006-2016 Freescale Semiconductor, Inc. 
*       Copyright 2017-2019 NXP
 *   All Rights Reserved.
 ==================================================================================================*/
/*==================================================================================================
==================================================================================================*/

#ifdef __cplusplus
extern "C"{
#endif

/**
* @page misra_violations MISRA-C:2012 violations
*
* @section [global]
* Violates MISRA 2012 Required Rule 5.1, External identifiers shall be distinct.
* 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 name space shall be distinct.
* The used compilers use more than 31 chars for identifiers.
*
* @section [global]
* Violates MISRA 2012 Required Rule 5.4, Macro identifiers shall be distinct.
* The used compilers use more than 31 chars for identifiers.
*
* @section [global]
* Violates MISRA 2012 Required Rule 5.5, Identifiers shall be distinct from macro names.
* The used compilers use more than 31 chars for identifiers.
*
* @section ICU_DMANOTIFICATION_C_REF_1
* Violates MISRA 2012 Required Directive 4.10, Precautions shall be taken in order to prevent the contents
* of a header file being included more than once.
* This violation is not fixed since the inclusion of <MA>_MemMap.h is as per AUTOSAR requirement [SWS_MemMap_00003].
*
* @section ICU_DMANOTIFICATION_C_REF_2
* Violates MISRA 2012 Advisory Rule 8.7, Functions and objects should not be defined with external linkage if
* they are referenced in only one translation unit.
* These functions represent the API of the driver. External linkage is needed to "export" the API.
*
* @section ICU_DMANOTIFICATION_C_REF_3
* Violates MISRA 2012 Required Rule 8.4, A compatible declaration shall be visible when an object or function with external linkage is defined.
* This violation is due to exporting the externally configured initialization structure.
*
* @section ICU_DMANOTIFICATION_C_REF_4
* Violates MISRA 2012 Advisory Rule 20.1, #include directives should only be preceded by preprocessor
* directives or comments.
* <MA>_MemMap.h is included after each section define in order to set the current memory section as defined by AUTOSAR.
*
*/

/*==================================================================================================
*                                         INCLUDE FILES
* 1) system and project includes
* 2) needed interfaces from external units
* 3) internal and external interfaces from this unit
*==================================================================================================*/
#include "Icu.h"
#include "Icu_Irq.h"
/*==================================================================================================
 *                              SOURCE FILE VERSION INFORMATION
 *==================================================================================================*/

#define ICU_VENDOR_ID_DMANOTIF_C                  43

#define ICU_AR_RELEASE_MAJOR_VERSION_DMANOTIF_C   4
#define ICU_AR_RELEASE_MINOR_VERSION_DMANOTIF_C   3
#define ICU_AR_RELEASE_REVISION_VERSION_DMANOTIF_C      1

#define ICU_SW_MAJOR_VERSION_DMANOTIF_C           1
#define ICU_SW_MINOR_VERSION_DMANOTIF_C           0
#define ICU_SW_PATCH_VERSION_DMANOTIF_C           0

/*==================================================================================================
 *                                      FILE VERSION CHECKS
 *==================================================================================================*/

/* Check Icu_DmaNotification.c against Icu.h file versions */
#if (ICU_VENDOR_ID_DMANOTIF_C!= ICU_VENDOR_ID)
    #error "Icu_DmaNotification.c and Icu.h have different vendor IDs"
#endif

#if ((ICU_AR_RELEASE_MAJOR_VERSION_DMANOTIF_C!= ICU_AR_RELEASE_MAJOR_VERSION) || \
     (ICU_AR_RELEASE_MINOR_VERSION_DMANOTIF_C!= ICU_AR_RELEASE_MINOR_VERSION) || \
     (ICU_AR_RELEASE_REVISION_VERSION_DMANOTIF_C!= ICU_AR_RELEASE_REVISION_VERSION))
  #error "AutoSar Version Numbers of Icu_DmaNotification.c and Icu.h are different"
#endif

#if ((ICU_SW_MAJOR_VERSION_DMANOTIF_C!= ICU_SW_MAJOR_VERSION) || \
     (ICU_SW_MINOR_VERSION_DMANOTIF_C!= ICU_SW_MINOR_VERSION) || \
     (ICU_SW_PATCH_VERSION_DMANOTIF_C!= ICU_SW_PATCH_VERSION))
       #error "Software Version Numbers of Icu_DmaNotification.c  and Icu.h are different"
#endif

/* Check Icu_DmaNotification.c against Icu_Irq.h file versions */
#if (ICU_VENDOR_ID_DMANOTIF_C!= ICU_IRQ_VENDOR_ID)
    #error "Icu_DmaNotification.c and Icu_Irq.h have different vendor IDs"
#endif

#if ((ICU_AR_RELEASE_MAJOR_VERSION_DMANOTIF_C!= ICU_IRQ_AR_RELEASE_MAJOR_VERSION) || \
     (ICU_AR_RELEASE_MINOR_VERSION_DMANOTIF_C!= ICU_IRQ_AR_RELEASE_MINOR_VERSION) || \
     (ICU_AR_RELEASE_REVISION_VERSION_DMANOTIF_C!= ICU_IRQ_AR_RELEASE_REVISION_VERSION))
  #error "AutoSar Version Numbers of Icu_DmaNotification.c and Icu_Irq.h are different"
#endif

#if ((ICU_SW_MAJOR_VERSION_DMANOTIF_C!= ICU_IRQ_SW_MAJOR_VERSION) || \
     (ICU_SW_MINOR_VERSION_DMANOTIF_C!= ICU_IRQ_SW_MINOR_VERSION) || \
     (ICU_SW_PATCH_VERSION_DMANOTIF_C!= ICU_IRQ_SW_PATCH_VERSION))
       #error "Software Version Numbers of Icu_DmaNotification.c  and Icu_Irq.h are different"
#endif

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


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


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


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


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

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


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


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

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

#define ICU_START_SEC_CODE
/**
* @violates @ref ICU_DMANOTIFICATION_C_REF_1 Directive 4.10, Precautions shall be taken in order to prevent the contents
* of a header file being included more than once.
*/
#include "Icu_MemMap.h"
#if ((ICU_SIGNALMEASUREMENT_USES_DMA == STD_ON) || (ICU_TIMESTAMP_USES_DMA == STD_ON))
[!NOCODE!]
    [!VAR "OuterLoopCounter" = "0"!]
    [!VAR "InnerLoopCounter" = "0"!]
    [!VAR "found" = "'false'"!]
    [!SELECT "IcuConfigSet"!]
     [!LOOP "./IcuChannel/*"!]
     [!IF "IcuDMAChannelEnable='true'"!]
        [!IF "node:exists(IcuDMAChannelRef)"!]
            [!VAR "OuterLoopCounter" = "$OuterLoopCounter + 1"!]
            [!VAR "InnerLoopCounter" = "0"!]
            [!VAR "Matchcounter" = "0"!]
            [!VAR "ChRef" = "IcuDMAChannelRef"!]
            [!LOOP "../../IcuChannel/*"!] [!//All channels
          [!IF "node:exists(IcuDMAChannelRef)"!]
                    [!VAR "InnerLoopCounter" = "$InnerLoopCounter + 1"!]
                    [!IF "$OuterLoopCounter >= $InnerLoopCounter"!]
                        [!IF "($ChRef = IcuDMAChannelRef)"!]
                             [!VAR "Matchcounter" = "$Matchcounter + 1"!]
                        [!ENDIF!]
                    [!ENDIF!]
                [!ENDIF!]
            [!ENDLOOP!]
     [!ENDIF!]
            [!IF "$Matchcounter = 1"!]
                [!CODE!]
FUNC (void, ICU_CODE) [!"node:ref(IcuDMAChannelRef)/MclDmaTransferCompletionNotif"!](void);[!CR!]
                [!ENDCODE!][!//
            [!ENDIF!]
      [!ENDIF!]
     [!ENDLOOP!]
    [!ENDSELECT!]
[!ENDNOCODE!]

[!NOCODE!]
    [!VAR "OuterLoopCounter" = "0"!]
    [!VAR "InnerLoopCounter" = "0"!]
    [!VAR "found" = "'false'"!]
    [!SELECT "IcuConfigSet"!]
     [!LOOP "./IcuChannel/*"!]
     [!IF "IcuDMAChannelEnable='true'"!]
        [!IF "node:exists(IcuDMAChannelRef)"!]
            [!VAR "OuterLoopCounter" = "$OuterLoopCounter + 1"!]
            [!VAR "InnerLoopCounter" = "0"!]
            [!VAR "Matchcounter" = "0"!]
            [!VAR "ChRef" = "IcuDMAChannelRef"!]
            [!LOOP "../../IcuChannel/*"!] [!//All channels
          [!IF "node:exists(IcuDMAChannelRef)"!]
                    [!VAR "InnerLoopCounter" = "$InnerLoopCounter + 1"!]
                    [!IF "$OuterLoopCounter >= $InnerLoopCounter"!]
                        [!IF "($ChRef = IcuDMAChannelRef)"!]
                             [!VAR "Matchcounter" = "$Matchcounter + 1"!]
                        [!ENDIF!]
                    [!ENDIF!]
                [!ENDIF!]
            [!ENDLOOP!]
     [!ENDIF!]
            [!IF "$Matchcounter = 1"!]
                  [!IF "$found = 'false'"!]
                      [!VAR "found" = "'true'"!]
                      [!CODE!]
/**
*   @brief Dma notification handlers for [!"node:name(.)"!]
*/[!/*
                       */!][!CR!][!ENDCODE!]
                 [!ENDIF!]
[!IF "IcuMeasurementMode = 'ICU_MODE_TIMESTAMP'"!]
                 [!CODE!]
/* @violates @ref ICU_DMANOTIFICATION_C_REF_2 Advisory Rule 8.7, Functions and objects should not be defined with external linkage if they are referenced in only one translation unit. */
FUNC (void, ICU_CODE) [!"node:ref(IcuDMAChannelRef)/MclDmaTransferCompletionNotif"!](void)[!CR!]
/* @violates @ref ICU_DMANOTIFICATION_C_REF_3 Required Rule 8.4, A compatible declaration shall be visible when an object or function with external linkage is defined. */
{
    Icu_TimestampDmaProcessing([!"node:name(.)"!]);
}
                [!ENDCODE!][!//
[!ENDIF!]

[!IF "IcuMeasurementMode = 'ICU_MODE_SIGNAL_MEASUREMENT'"!]
[!CODE!]
FUNC (void, ICU_CODE) [!"node:ref(IcuDMAChannelRef)/MclDmaTransferCompletionNotif"!](void)[!CR!]
{
    Icu_SignalMeasurementDmaProcessing([!"node:name(.)"!]);
}
[!ENDCODE!][!//
[!ENDIF!]
            [!ENDIF!]
      [!ENDIF!]
     [!ENDLOOP!]
    [!ENDSELECT!]
[!ENDNOCODE!]
#endif
#define ICU_STOP_SEC_CODE
/**
* @violates @ref ICU_DMANOTIFICATION_C_REF_1 Directive 4.10, Precautions shall be taken in order to prevent the contents
* of a header file being included more than once.
* @violates @ref ICU_DMANOTIFICATION_C_REF_4 Advisory Rule 20.1, #include directives should only be preceded by preprocessor directives or comments.
*/
#include "Icu_MemMap.h"

#ifdef __cplusplus
}
#endif

/** @} */
[!ENDCODE!]
