/*==================================================================================================
*   Project              : RTD AUTOSAR 4.7
*   Platform             : CORTEXM
*   Peripheral           : FLEXCAN
*   Dependencies         : 
*
*   Autosar Version      : 4.7.0
*   Autosar Revision     : ASR_REL_4_7_REV_0000
*   Autosar Conf.Variant :
*   SW Version           : 4.0.0
*   Build Version        : S32K3_RTD_4_0_0_D2311_ASR_REL_4_7_REV_0000_20231128
*
*   (c) Copyright 2020 - 2023 NXP
*   All Rights Reserved.
*
*   NXP Confidential. This software is owned or controlled by NXP and may only be
*   used strictly in accordance with the applicable license terms. By expressly
*   accepting such terms or by downloading, installing, activating and/or otherwise
*   using the software, you are agreeing that you have read, and that you agree to
*   comply with and are bound by, such license terms. If you do not agree to be
*   bound by the applicable license terms, then you may not retain, install,
*   activate or otherwise use the software.
==================================================================================================*/
/***********************************************************************************************************************
 * This file was generated by the S32 Configuration Tools. Any manual edits made to this file
 * will be overwritten if the respective S32 Configuration Tools is used to update this file.
 **********************************************************************************************************************/

/**
*   @file FlexCAN_Ip_PBcfg.c
*
*   @addtogroup FlexCAN
*   @{
*/

#ifdef __cplusplus
extern "C"{
#endif

/*==================================================================================================
*                                        INCLUDE FILES
* 1) system and project includes
* 2) needed interfaces from external units
* 3) internal and external interfaces from this unit
==================================================================================================*/
#include "FlexCAN_Ip_Types.h"
#if (FLEXCAN_IP_FEATURE_HAS_DMA_ENABLE == STD_ON)
    #include "Dma_Ip.h"
#endif
/*==================================================================================================
*                              SOURCE FILE VERSION INFORMATION
==================================================================================================*/
#define FLEXCAN_IP_SA_VENDOR_ID_PBCFG_C                     43
#define FLEXCAN_IP_SA_AR_RELEASE_MAJOR_VERSION_PBCFG_C      4
#define FLEXCAN_IP_SA_AR_RELEASE_MINOR_VERSION_PBCFG_C      7
#define FLEXCAN_IP_SA_AR_RELEASE_REVISION_VERSION_PBCFG_C   0
#define FLEXCAN_IP_SA_SW_MAJOR_VERSION_PBCFG_C              4
#define FLEXCAN_IP_SA_SW_MINOR_VERSION_PBCFG_C              0
#define FLEXCAN_IP_SA_SW_PATCH_VERSION_PBCFG_C              0
/*==================================================================================================
*                                     FILE VERSION CHECKS
==================================================================================================*/
/* Checks against current file and FlexCAN_Ip_Types.h */
#if (FLEXCAN_IP_SA_VENDOR_ID_PBCFG_C != FLEXCAN_IP_TYPES_VENDOR_ID_H)
    #error "FlexCAN_Ip_Sa_PBcfg.c and FlexCAN_Ip_Types.h have different vendor ids"
#endif
#if ((FLEXCAN_IP_SA_AR_RELEASE_MAJOR_VERSION_PBCFG_C     != FLEXCAN_IP_TYPES_AR_RELEASE_MAJOR_VERSION_H) || \
     (FLEXCAN_IP_SA_AR_RELEASE_MINOR_VERSION_PBCFG_C     != FLEXCAN_IP_TYPES_AR_RELEASE_MINOR_VERSION_H) || \
     (FLEXCAN_IP_SA_AR_RELEASE_REVISION_VERSION_PBCFG_C  != FLEXCAN_IP_TYPES_AR_RELEASE_REVISION_VERSION_H) \
    )
    #error "AUTOSAR Version Numbers of FlexCAN_Ip_Sa_PBcfg.c and FlexCAN_Ip_Types.h are different"
#endif
#if ((FLEXCAN_IP_SA_SW_MAJOR_VERSION_PBCFG_C != FLEXCAN_IP_TYPES_SW_MAJOR_VERSION_H) || \
     (FLEXCAN_IP_SA_SW_MINOR_VERSION_PBCFG_C != FLEXCAN_IP_TYPES_SW_MINOR_VERSION_H) || \
     (FLEXCAN_IP_SA_SW_PATCH_VERSION_PBCFG_C != FLEXCAN_IP_TYPES_SW_PATCH_VERSION_H) \
    )
    #error "Software Version Numbers of FlexCAN_Ip_Sa_PBcfg.c and FlexCAN_Ip_Types.h are different"
#endif

#ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
    /* Checks against current file and Dma_Ip.h */
    #if (FLEXCAN_IP_FEATURE_HAS_DMA_ENABLE == STD_ON)
        #if ((FLEXCAN_IP_SA_AR_RELEASE_MAJOR_VERSION_PBCFG_C    != DMA_IP_AR_RELEASE_MAJOR_VERSION) || \
            (FLEXCAN_IP_SA_AR_RELEASE_MINOR_VERSION_PBCFG_C     != DMA_IP_AR_RELEASE_MINOR_VERSION) \
            )
            #error "AUTOSAR Version Numbers of FlexCAN_Ip_Sa_PBcfg.c and Dma_Ip.h are different"
        #endif
    #endif
#endif
/*==================================================================================================
*                                   GLOBAL FUNCTION PROTOTYPES
==================================================================================================*/
#define CAN_43_FLEXCAN_START_SEC_CODE
#include "Can_43_FLEXCAN_MemMap.h"

extern void CAN4TxRxIntCallBack(uint8 instance, Flexcan_Ip_EventType eventType,
                  uint32 buffIdx, const Flexcan_Ip_StateType * flexcanState);
extern void CAN4ERRIntCallBack(uint8 instance, Flexcan_Ip_EventType eventType,
                                              uint32 u32ErrStatus,
                                              const Flexcan_Ip_StateType * flexcanState);
#define CAN_43_FLEXCAN_STOP_SEC_CODE
#include "Can_43_FLEXCAN_MemMap.h"
/*==================================================================================================
*                                GLOBAL VARIABLE DECLARATIONS
==================================================================================================*/
#define CAN_43_FLEXCAN_START_SEC_VAR_CLEARED_UNSPECIFIED
#include "Can_43_FLEXCAN_MemMap.h"
/* FlexCAN State Structure used By driver
User should not modify this structure */
Flexcan_Ip_StateType FlexCAN_State0;
#define CAN_43_FLEXCAN_STOP_SEC_VAR_CLEARED_UNSPECIFIED
#include "Can_43_FLEXCAN_MemMap.h"
/*==================================================================================================
*                                      GLOBAL CONSTANTS
==================================================================================================*/
#define CAN_43_FLEXCAN_START_SEC_CONFIG_DATA_UNSPECIFIED
#include "Can_43_FLEXCAN_MemMap.h"

const Flexcan_Ip_ConfigType FlexCAN_Config0  = {
    /* Number Of Message Buffer used .max_num_mb  */
    (uint8)16,
    /*Can Hw filter count* .num_id_filters*- aici exista variatna sa generez toate filtrele si sa referentiezi tu in cod */
    FLEXCAN_RX_FIFO_ID_FILTERS_8,
    /* Legacy FIFO ENABLED .is_rx_fifo_needed*/
    (boolean)FALSE,
#if (FLEXCAN_IP_FEATURE_HAS_ENHANCED_RX_FIFO == STD_ON)
    /* The number of standard ID filter elements */
    0U,
    /* The number of extended ID filter elements */
    0U,
    /* The number of enhanced Rx FIFO watermark */
    0U,
    /* The Enhanced Rx FIFO feature is enabled or not. */
    (boolean)FALSE,
#endif
#if (FLEXCAN_IP_FEATURE_HAS_TS_ENABLE == STD_ON)
    /* TimeStamp Structure Configuration */
    {
        /* timeStampSurce Timer Source */
        FLEXCAN_CAN_CLK_TIMESTAMP_SRC
        #if (FLEXCAN_IP_FEATURE_HAS_HR_TIMER == STD_ON)
        /* msgBuffTimeStampType Timestamp MB Type  */
        ,FLEXCAN_MSGBUFFTIMESTAMP_TIMER
        /* hrConfigType Timestamp HR capture configuration */
        ,FLEXCAN_TIMESTAMPCAPTURE_DISABLE
        /* hrSrc HT Timer Source */
        ,FLEXCAN_HRTIMERSRC_STM0
        #endif
    },
#endif /* (FLEXCAN_IP_FEATURE_HAS_TS_ENABLE == STD_ON) */
    FLEXCAN_NORMAL_MODE,
#if (FLEXCAN_IP_FEATURE_HAS_MEM_ERR_DET == STD_ON)
#if (FLEXCAN_IP_FEATURE_MEM_ERR_DET_ENABLED == STD_ON)
    /* Memory error response .flexcanModeErrResponse */
    FLEXCAN_NORMAL_MODE,
#endif
#endif
     /*ctrlOptions*/
    (uint32)(\
    FLEXCAN_IP_BUSOFF_RECOVERY_U32 | \
    \
    0U),
     /* Can FD RamBlock specified *//*.payload*/
    {
      FLEXCAN_PAYLOAD_SIZE_8,
      FLEXCAN_PAYLOAD_SIZE_8
    },
        /*Can FD enabled .fd_enable*/
        (boolean)FALSE,
        /*Enhance CBT support . extCbtEnable*/
        (boolean)FALSE,
        /*BRS for FD .bitRateSwitch*/
        (boolean)FALSE,
        /*values for normal baudrate .bitrate*/
        {   /* Prop Seg */
            (7U),
            /* Phase Seg 1 */
            (6U),
            /* Phase Seg 2*/
            (3U),
            /* Pre Divider */
            (2U),
            /* Resync jump width */
            (1U)
        },
            /*values for FD baudrate .bitrate*/
        {   /* Prop Seg */
            (7U),
            /* Phase Seg 1 */
            (5U),
            /* Phase Seg 2*/
            (1U),
            /* Pre Divider */
            (4U),
            /* Resync jump width */
            (1U)
        },
        /*transfer_type*/
        FLEXCAN_RXFIFO_USING_INTERRUPTS,
#if (FLEXCAN_IP_FEATURE_HAS_DMA_ENABLE == STD_ON)
     /* DMA channel number used for transfers. */
         0,
  #endif
    /* Controller Callback */
    CAN4TxRxIntCallBack,
    /* Error Callback */
    CAN4ERRIntCallBack
    };
    
#define CAN_43_FLEXCAN_STOP_SEC_CONFIG_DATA_UNSPECIFIED
#include "Can_43_FLEXCAN_MemMap.h"

#ifdef __cplusplus
}
#endif
/** @} */

