/**
*   @file    Can_43_FLEXCAN_IPW.h
*   @implements Can_IPW.h_Artifact
*   @version 1.0.0
*
*   @brief   AUTOSAR Can_43_FLEXCAN - module interface
*   @details Main header file - can include different IPV models.
*
*   @addtogroup CAN_DRIVER
*   @{
*/
/*==================================================================================================
*   Project              : AUTOSAR 4.3 MCAL
*   Platform             : PA
*   Peripheral           : FLEXCAN
*   Dependencies         : 
*
*   Autosar Version      : 4.3.1
*   Autosar Revision     : ASR_REL_4_3_REV_0001
*   Autosar Conf.Variant :
*   SW Version           : 1.0.0
*   Build Version        : MPC5777C_MCAL_1_0_0_RTM_ASR_REL_4_3_REV_0001_20190315
*
*   (c) Copyright 2006-2016 Freescale Semiconductor, Inc. 
*       Copyright 2017-2019 NXP
*   All Rights Reserved.
==================================================================================================*/
/*==================================================================================================
==================================================================================================*/

#ifndef CAN_IPW_H
#define CAN_IPW_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.
*          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 Can_43_FLEXCAN_IPW_h_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 Can_43_FLEXCAN_IPW_h_REF_2
* Violates MISRA 2012 Advisory Rule 4.9, A function should be used in preference to a function-like macro where they are interchangeable.
* Function like macro are used to reduce code complexity
*
* @section Can_43_FLEXCAN_IPW_h_REF_3
* Violates MISRA 2012 Advisory Rule 2.5, A project should not contain unused macro declarations.
* Declaration is reserved for future feature.
*/

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

/*==================================================================================================
*                              SOURCE FILE VERSION INFORMATION
==================================================================================================*/
/**
* @{
* @file           Can_IPW.h
*/
#define CAN_43_FLEXCAN_IPW_VENDOR_ID_H                    43
/* @violates @ref Can_43_FLEXCAN_IPW_h_REF_3 MISRA 2012 Advisory Rule 2.5 */
#define CAN_43_FLEXCAN_IPW_MODULE_ID_H                    80
#define CAN_43_FLEXCAN_IPW_AR_RELEASE_MAJOR_VERSION_H     4
#define CAN_43_FLEXCAN_IPW_AR_RELEASE_MINOR_VERSION_H     3
#define CAN_43_FLEXCAN_IPW_AR_RELEASE_REVISION_VERSION_H  1
#define CAN_43_FLEXCAN_IPW_SW_MAJOR_VERSION_H             1
#define CAN_43_FLEXCAN_IPW_SW_MINOR_VERSION_H             0
#define CAN_43_FLEXCAN_IPW_SW_PATCH_VERSION_H             0
/**@}*/

/*==================================================================================================
*                                     FILE VERSION CHECKS
==================================================================================================*/
/* Check if current file and CAN configuration header file are of the same vendor */
#if (CAN_43_FLEXCAN_IPW_VENDOR_ID_H != CAN_FLEXCAN_VENDOR_ID_H)
#error "Can_IPW.h and Can_FlexCan.h have different vendor ids"
#endif
/* Check if current file and CAN configuration header file are of the same Autosar version */
#if ((CAN_43_FLEXCAN_IPW_AR_RELEASE_MAJOR_VERSION_H    != CAN_FLEXCAN_AR_RELEASE_MAJOR_VERSION_H) || \
     (CAN_43_FLEXCAN_IPW_AR_RELEASE_MINOR_VERSION_H    != CAN_FLEXCAN_AR_RELEASE_MINOR_VERSION_H) || \
     (CAN_43_FLEXCAN_IPW_AR_RELEASE_REVISION_VERSION_H != CAN_FLEXCAN_AR_RELEASE_REVISION_VERSION_H))
#error "AutoSar Version Numbers of Can_IPW.h and Can_FlexCan.h are different"
#endif
/* Check if current file and CAN configuration header file are of the same software version */
#if ((CAN_43_FLEXCAN_IPW_SW_MAJOR_VERSION_H != CAN_FLEXCAN_SW_MAJOR_VERSION_H) || \
     (CAN_43_FLEXCAN_IPW_SW_MINOR_VERSION_H != CAN_FLEXCAN_SW_MINOR_VERSION_H) || \
     (CAN_43_FLEXCAN_IPW_SW_PATCH_VERSION_H != CAN_FLEXCAN_SW_PATCH_VERSION_H))
#error "Software Version Numbers of Can_IPW.h and Can_FlexCan.h are different"
#endif


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

/*==================================================================================================
*                                      DEFINES AND MACROS
==================================================================================================*/
    #define  CAN_43_FLEXCAN_NULL_OFFSET                                                        (FLEXCAN_NULL_OFFSET_U8)

    /* @violates @ref Can_43_FLEXCAN_IPW_h_REF_2 MISRA 2012 Advisory Rule 4.9 */
    /* @violates @ref Can_43_FLEXCAN_IPW_h_REF_3 MISRA 2012 Advisory Rule 2.5 */
    #define Can_43_FLEXCAN_IPW_ProcessRx( controller, mbindex_start, mbindex_end )             (Can_FlexCan_ProcessRx( (controller), (mbindex_start), (mbindex_end)) )

    /* @violates @ref Can_43_FLEXCAN_IPW_h_REF_2 MISRA 2012 Advisory Rule 4.9 */
    /* @violates @ref Can_43_FLEXCAN_IPW_h_REF_3 MISRA 2012 Advisory Rule 2.5 */
    #define Can_43_FLEXCAN_IPW_ProcessTx(controller, mbindex_start, mbindex_end)               (Can_FlexCan_ProcessTx( (controller), (mbindex_start), (mbindex_end)) )
 
#if (CAN_43_FLEXCAN_RXFIFO_ENABLE == STD_ON)

    /* @violates @ref Can_43_FLEXCAN_IPW_h_REF_2 MISRA 2012 Advisory Rule 4.9 */
    /* @violates @ref Can_43_FLEXCAN_IPW_h_REF_3 MISRA 2012 Advisory Rule 2.5 */
    #define Can_43_FLEXCAN_IPW_RxFifoFrameAvNotif(controller)                                  (Can_FlexCan_RxFifoFrameAvNotif( controller))
 
#endif
    /* @violates @ref Can_43_FLEXCAN_IPW_h_REF_2 MISRA 2012 Advisory Rule 4.9 */
    #define Can_43_FLEXCAN_IPW_ProcessBusOff(controller)                                                         (Can_FlexCan_ProcessBusOff( controller))
    
    /* @violates @ref Can_43_FLEXCAN_IPW_h_REF_2 MISRA 2012 Advisory Rule 4.9 */
    #define Can_43_FLEXCAN_IPW_InitVariables()                                                 (Can_FlexCan_InitVariables())

#if (STD_ON == CAN_43_FLEXCAN_ENABLE_USER_MODE_SUPPORT)
/* There is not the register of the Can controller under protection in this platform, thus this macro points to NULL_PTR*/
        /* @violates @ref Can_43_FLEXCAN_IPW_h_REF_2 MISRA 2012 Advisory Rule 4.9 */
        /* @violates @ref Can_43_FLEXCAN_IPW_h_REF_3 MISRA 2012 Advisory Rule 2.5 */
        #define         Can_43_FLEXCAN_IPW_SetUserAccessAllowed()                              Mcal_Trusted_Call(Can_FlexCan_SetUserAccessAllowed)
#endif

#if (STD_ON == CAN_43_FLEXCAN_ENABLE_USER_MODE_SUPPORT)
        /* @violates @ref Can_43_FLEXCAN_IPW_h_REF_2 MISRA 2012 Advisory Rule 4.9 */
        #define        Can_43_FLEXCAN_IPW_InitController(Controller)                           Mcal_Trusted_Call_Return1param(Can_FlexCan_InitController,(Controller))
#else
        /* @violates @ref Can_43_FLEXCAN_IPW_h_REF_2 MISRA 2012 Advisory Rule 4.9 */
        #define        Can_43_FLEXCAN_IPW_InitController(Controller)                          (Can_FlexCan_InitController(Controller))
#endif

#if (STD_ON == CAN_43_FLEXCAN_ENABLE_USER_MODE_SUPPORT)
        /* @violates @ref Can_43_FLEXCAN_IPW_h_REF_2 MISRA 2012 Advisory Rule 4.9 */
        #define        Can_43_FLEXCAN_IPW_DeInitController(Controller)                             Mcal_Trusted_Call1param(Can_FlexCan_DeInitController,(Controller))
#else                                          
        /* @violates @ref Can_43_FLEXCAN_IPW_h_REF_2 MISRA 2012 Advisory Rule 4.9 */
        #define        Can_43_FLEXCAN_IPW_DeInitController(Controller)                          (Can_FlexCan_DeInitController(Controller))
#endif

#if (STD_ON == CAN_43_FLEXCAN_ENABLE_USER_MODE_SUPPORT)
        /* @violates @ref Can_43_FLEXCAN_IPW_h_REF_2 MISRA 2012 Advisory Rule 4.9 */
        #define         Can_43_FLEXCAN_IPW_SetControllerMode(Controller, pCanControlerDescriptor, Transition, canif_notification_required) \
                         Mcal_Trusted_Call_Return4param(Can_FlexCan_SetControllerMode,(Controller), (pCanControlerDescriptor), (Transition), (canif_notification_required))
#else
        /* @violates @ref Can_43_FLEXCAN_IPW_h_REF_2 MISRA 2012 Advisory Rule 4.9 */
        #define         Can_43_FLEXCAN_IPW_SetControllerMode(Controller, pCanControlerDescriptor, Transition, canif_notification_required) \
                        (Can_FlexCan_SetControllerMode((Controller), (pCanControlerDescriptor), (Transition), (canif_notification_required)))
#endif
        /* @violates @ref Can_43_FLEXCAN_IPW_h_REF_2 MISRA 2012 Advisory Rule 4.9 */
        #define         Can_43_FLEXCAN_IPW_DisableControllerInterrupts(Controller) \
                        (Can_FlexCan_DisableControllerInterrupts((Controller)))
        /* @violates @ref Can_43_FLEXCAN_IPW_h_REF_2 MISRA 2012 Advisory Rule 4.9 */
        #define         Can_43_FLEXCAN_IPW_EnableControllerInterrupts(Controller, pCanControlerDescriptor) \
                        (Can_FlexCan_EnableControllerInterrupts((Controller), (pCanControlerDescriptor)))

    #if ((CAN_43_FLEXCAN_API_ENABLE_ABORT_MB == STD_ON))  
        /* @violates @ref Can_43_FLEXCAN_IPW_h_REF_2 MISRA 2012 Advisory Rule 4.9 */
        /* @violates @ref Can_43_FLEXCAN_IPW_h_REF_3 MISRA 2012 Advisory Rule 2.5 */
        #define         Can_43_FLEXCAN_IPW_Cancel(controller, mbindex)                                       (Can_FlexCan_Cancel((controller), (mbindex)))

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

    #if ((CAN_43_FLEXCAN_API_ENABLE_ABORT_MB == STD_ON))
        /* @violates @ref Can_43_FLEXCAN_IPW_h_REF_2 MISRA 2012 Advisory Rule 4.9 */
        #define         Can_43_FLEXCAN_IPW_AbortMb(Hth)                                                      (Can_FlexCan_AbortMb(Hth))

    #endif /* (CAN_43_FLEXCAN_API_ENABLE_ABORT_MB == STD_ON) */
    /* @violates @ref Can_43_FLEXCAN_IPW_h_REF_2 MISRA 2012 Advisory Rule 4.9 */
    #define         Can_43_FLEXCAN_IPW_Write(Hth, PduInfo)                                               (Can_FlexCan_Write((Hth), (PduInfo)))
    
    #if (CAN_43_FLEXCAN_TXPOLL_SUPPORTED == STD_ON)
        /* @violates @ref Can_43_FLEXCAN_IPW_h_REF_2 MISRA 2012 Advisory Rule 4.9 */
        #define         Can_43_FLEXCAN_IPW_MainFunctionWrite()                                               (Can_FlexCan_MainFunctionWrite())
        /* @violates @ref Can_43_FLEXCAN_IPW_h_REF_2 MISRA 2012 Advisory Rule 4.9 */
        /* @violates @ref Can_43_FLEXCAN_IPW_h_REF_3 MISRA 2012 Advisory Rule 2.5 */
        #define         Can_43_FLEXCAN_IPW_MainFunctionMultipleWritePoll(writepoll)                          (Can_FlexCan_MainFunctionMultipleWritePoll(writepoll))
    #endif
    
    #if (CAN_43_FLEXCAN_RXPOLL_SUPPORTED == STD_ON)
        /* @violates @ref Can_43_FLEXCAN_IPW_h_REF_2 MISRA 2012 Advisory Rule 4.9 */
        #define         Can_43_FLEXCAN_IPW_MainFunctionRead()                                                (Can_FlexCan_MainFunctionRead())
        /* @violates @ref Can_43_FLEXCAN_IPW_h_REF_2 MISRA 2012 Advisory Rule 4.9 */
        /* @violates @ref Can_43_FLEXCAN_IPW_h_REF_3 MISRA 2012 Advisory Rule 2.5 */
        #define         Can_43_FLEXCAN_IPW_MainFunctionMultipleReadPoll(readpoll)                            (Can_FlexCan_MainFunctionMultipleReadPoll(readpoll))
    #endif


#if (STD_ON == CAN_43_FLEXCAN_ENABLE_USER_MODE_SUPPORT)
        /* @violates @ref Can_43_FLEXCAN_IPW_h_REF_2 MISRA 2012 Advisory Rule 4.9 */
        #define         Can_43_FLEXCAN_IPW_MainFunctionMode()                              Mcal_Trusted_Call(Can_FlexCan_MainFunctionMode)
#else        
        /* @violates @ref Can_43_FLEXCAN_IPW_h_REF_2 MISRA 2012 Advisory Rule 4.9 */
        #define         Can_43_FLEXCAN_IPW_MainFunctionMode()                                                (Can_FlexCan_MainFunctionMode())
#endif
        /* @violates @ref Can_43_FLEXCAN_IPW_h_REF_2 MISRA 2012 Advisory Rule 4.9 */
        /* @violates @ref Can_43_FLEXCAN_IPW_h_REF_3 MISRA 2012 Advisory Rule 2.5 */
        #define         Can_43_FLEXCAN_IPW_CheckBusOff(controller)                                           (Can_FlexCan_CheckBusOff(controller))
    
    #if (CAN_43_FLEXCAN_DUAL_CLOCK_MODE == STD_ON)
        /* @violates @ref Can_43_FLEXCAN_IPW_h_REF_2 MISRA 2012 Advisory Rule 4.9 */
        #define         Can_43_FLEXCAN_IPW_SetClockMode(u8Controller, can_clk_mode)                        (Can_FlexCan_SetClockMode((u8Controller), (can_clk_mode)))
    #endif
     
     
#if(CAN_43_FLEXCAN_PUBLIC_ICOM_SUPPORT == STD_ON)
    #if (STD_ON == CAN_43_FLEXCAN_ENABLE_USER_MODE_SUPPORT)
        #define         Can_43_FLEXCAN_IPW_SetIcomConfiguration(u8Controller, u8ConfigIcomIndex)         Mcal_Trusted_Call_Return2param(Can_FlexCan_SetIcomConfig,  (u8Controller), (u8ConfigIcomIndex))
        #define         Can_43_FLEXCAN_IPW_DeactivateIcomConfiguration(u8Controller)                      Mcal_Trusted_Call_Return1param(Can_FlexCan_DeactivateIcom, (u8Controller))
    #else
        #define         Can_43_FLEXCAN_IPW_SetIcomConfiguration(u8Controller, u8ConfigIcomIndex)                                 (Can_FlexCan_SetIcomConfig( (u8Controller), (u8ConfigIcomIndex)))
        #define         Can_43_FLEXCAN_IPW_DeactivateIcomConfiguration(u8Controller)                                               (Can_FlexCan_DeactivateIcom(u8Controller))
    #endif

        #define         Can_43_FLEXCAN_IPW_ProcessWakeupPN(u8controller)                                   (Can_FlexCan_ProcessWakeupPN(u8controller))
#endif
/* @violates @ref Can_43_FLEXCAN_IPW_h_REF_2 MISRA 2012 Advisory Rule 4.9 */
#define Can_43_FLEXCAN_IPW_GetControllerErrorState(controller)                                                         (Can_FlexCan_GetControllerErrorState( controller))
/*==================================================================================================
*                                             ENUMS
==================================================================================================*/

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

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


#define CAN_43_FLEXCAN_START_SEC_CONFIG_DATA_UNSPECIFIED
/* @violates @ref Can_43_FLEXCAN_IPW_h_REF_1 MISRA 2012 Required Directive 4.10 */
#include "Can_43_FLEXCAN_MemMap.h"

#define CAN_43_FLEXCAN_STOP_SEC_CONFIG_DATA_UNSPECIFIED
/* @violates @ref Can_43_FLEXCAN_IPW_h_REF_1 MISRA 2012 Required Directive 4.10 */
#include "Can_43_FLEXCAN_MemMap.h"
/*==================================================================================================
*                                    FUNCTION PROTOTYPES
==================================================================================================*/
#define CAN_43_FLEXCAN_START_SEC_CODE
/* @violates @ref Can_43_FLEXCAN_IPW_h_REF_1 MISRA 2012 Required Directive 4.10 */
#include "Can_43_FLEXCAN_MemMap.h"
#define CAN_43_FLEXCAN_STOP_SEC_CODE
/* @violates @ref Can_43_FLEXCAN_IPW_h_REF_1 MISRA 2012 Required Directive 4.10 */
#include "Can_43_FLEXCAN_MemMap.h"

#ifdef __cplusplus
}
#endif

#endif /*TEMPLATE_H*/

/** @} */
