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

  @brief   AUTOSAR Can - macros.
  @details Macros
  
  Project AUTOSAR 4.3 MCAL
  Platform PA
  Peripheral MCAN
  Dependencies 
  
  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.
*/
/*==================================================================================================
==================================================================================================*/
[!ENDNOCODE!]


[!/* avoid multiple inclusion */!]
[!IF "not(var:defined('CAN_NOTIFY_CHECK_SRC_M'))"!]
[!VAR "CAN_NOTIFY_CHECK_SRC_M"="'true'"!]

[!NOCODE!]
[!MACRO "CanRxFifoWarningNotification_PC"!]
    [!VAR "MacOuterLoopCounter" = "0"!]
    [!VAR "MacInnerLoopCounter" = "0"!]
    [!LOOP "CanConfigSet/CanController/*/CanRxFifo/*"!]
        [!VAR "MacOuterLoopCounter" = "$MacOuterLoopCounter + 1"!]
        [!VAR "MacInnerLoopCounter" = "0"!]
        [!VAR "MacMatchcounter" = "0"!]
        [!IF "node:exists(CanFifoWatermask/CanFifoWatermarkNotification)"!] 
            [!VAR "MacNotification" = "CanFifoWatermask/CanFifoWatermarkNotification"!]
            [!LOOP "../../../../CanController/*/CanRxFifo/*"!]
                [!IF "node:exists(CanFifoWatermask/CanFifoWatermarkNotification)"!]
                    [!IF "(normalize-space(CanFifoWatermask/CanFifoWatermarkNotification) != 'NULL_PTR')"!]
                        [!VAR "MacInnerLoopCounter" = "$MacInnerLoopCounter + 1"!]
                        [!IF "$MacOuterLoopCounter >= $MacInnerLoopCounter"!]
                            [!IF "($MacNotification = CanFifoWatermask/CanFifoWatermarkNotification)"!]
                                [!VAR "MacMatchcounter" = "$MacMatchcounter + 1"!]
                            [!ENDIF!]
                        [!ENDIF!]
                    [!ENDIF!]
                [!ENDIF!]
            [!ENDLOOP!]
            [!IF "$MacMatchcounter = 1"!]
                [!CODE!]
/* @violates @ref Can_Cfg_c_REF_4 MISRA 2012 Required Rule 8.5 */
extern FUNC(void,CAN_43_MCAN_CODE) [!"normalize-space(CanFifoWatermask/CanFifoWatermarkNotification)"!]( void);
                [!ENDCODE!]
            [!ENDIF!]
        [!ENDIF!]   
    [!ENDLOOP!]
[!ENDMACRO!]

[!MACRO "CanRxFifoOverflowNotification_PC"!]
    [!VAR "MacOuterLoopCounter" = "0"!]
    [!VAR "MacInnerLoopCounter" = "0"!]
    [!LOOP "CanConfigSet/CanController/*/CanRxFifo/*"!]
        [!VAR "MacOuterLoopCounter" = "$MacOuterLoopCounter + 1"!]
        [!VAR "MacInnerLoopCounter" = "0"!]
        [!VAR "MacMatchcounter" = "0"!]
        [!VAR "MacNotification" = "CanFifoOverflow/CanFifoOverflowNotification"!]
        [!LOOP "../../../../CanController/*/CanRxFifo/*"!]
            [!IF "(normalize-space(CanFifoOverflow/CanFifoOverflowNotification) != 'NULL_PTR')"!]
                [!VAR "MacInnerLoopCounter" = "$MacInnerLoopCounter + 1"!]
                [!IF "$MacOuterLoopCounter >= $MacInnerLoopCounter"!]
                    [!IF "($MacNotification = CanFifoOverflow/CanFifoOverflowNotification)"!]
                        [!VAR "MacMatchcounter" = "$MacMatchcounter + 1"!]
                    [!ENDIF!]
                [!ENDIF!]
            [!ENDIF!]
        [!ENDLOOP!]
        [!IF "$MacMatchcounter = 1"!]
            [!CODE!]
/* @violates @ref Can_Cfg_c_REF_4 MISRA 2012 Required Rule 8.5 */           
extern FUNC(void,CAN_43_MCAN_CODE) [!"normalize-space(CanFifoOverflow/CanFifoOverflowNotification)"!]( void);
            [!ENDCODE!]
        [!ENDIF!]
    [!ENDLOOP!]
[!ENDMACRO!]

[!MACRO "CanErrorControllerNotification_PC"!]
    [!VAR "MacOuterLoopCounter" = "0"!]
    [!VAR "MacInnerLoopCounter" = "0"!]
    [!LOOP "CanConfigSet/CanController/*"!]
         [!VAR "MacOuterLoopCounter" = "$MacOuterLoopCounter + 1"!]
        [!VAR "MacInnerLoopCounter" = "0"!]
        [!VAR "MacMatchcounter" = "0"!]
        [!IF "CanErrorControllerNotifEn = 'true'"!]
            [!VAR "MacNotification" = "CanErrorControllerNotification"!]
        [!ENDIF!] 
        [!LOOP "../../CanController/*"!]
             [!IF "CanErrorControllerNotifEn = 'true'"!]
                [!IF "(normalize-space(CanErrorControllerNotification) != 'NULL_PTR')"!]
                    [!VAR "MacInnerLoopCounter" = "$MacInnerLoopCounter + 1"!]
                    [!IF "$MacOuterLoopCounter >= $MacInnerLoopCounter"!]
                        [!IF "($MacNotification = CanErrorControllerNotification)"!]
                            [!VAR "MacMatchcounter" = "$MacMatchcounter + 1"!]
                        [!ENDIF!]
                    [!ENDIF!]
                [!ENDIF!]
            [!ENDIF!]
        [!ENDLOOP!]
        [!IF "$MacMatchcounter = 1"!]
            [!IF "CanErrorControllerNotifEn = 'true'"!][!CODE!]
/* @violates @ref Can_Cfg_c_REF_4 MISRA 2012 Required Rule 8.5 */  
extern FUNC(void,CAN_CODE) [!"normalize-space(CanErrorControllerNotification)"!]( void);
            [!ENDCODE!]
            [!ENDIF!]
        [!ENDIF!]
    [!ENDLOOP!]
[!ENDMACRO!]

[!MACRO "CanMRAFNotification_PC"!]
    [!VAR "MacOuterLoopCounter" = "0"!]
    [!VAR "MacInnerLoopCounter" = "0"!]
    [!LOOP "CanConfigSet/CanController/*"!]
        [!VAR "MacOuterLoopCounter" = "$MacOuterLoopCounter + 1"!]
        [!VAR "MacInnerLoopCounter" = "0"!]
        [!VAR "MacMatchcounter" = "0"!]
        [!VAR "MacNotification" = "CanMRAFNotification"!]
        [!LOOP "../../CanController/*"!]
            [!IF "(normalize-space(CanMRAFNotification) != 'NULL_PTR')"!]
                [!VAR "MacInnerLoopCounter" = "$MacInnerLoopCounter + 1"!]
                [!IF "$MacOuterLoopCounter >= $MacInnerLoopCounter"!]
                    [!IF "($MacNotification = CanMRAFNotification)"!]
                        [!VAR "MacMatchcounter" = "$MacMatchcounter + 1"!]
                    [!ENDIF!]
                [!ENDIF!]
            [!ENDIF!]
        [!ENDLOOP!]
        [!IF "$MacMatchcounter = 1"!]
            [!CODE!]
/* MRAF Notification for controller: [!"@name"!] */
/* @violates @ref Can_Cfg_c_REF_4 MISRA 2012 Required Rule 8.5 */
extern FUNC(void,CAN_CODE) [!"normalize-space(CanMRAFNotification)"!]( void);
            [!ENDCODE!]
        [!ENDIF!]
    [!ENDLOOP!]
[!ENDMACRO!]

[!ENDNOCODE!]
[!ENDIF!][!// avoid multiple inclusion ENDIF