/*!
* @file     Can_Hw.h
*
* @version  1.0.0
*
* @brief    AUTOSAR CAN Driver header file
 *           
* @attention
*
* Project Name      : AUTOSAR MCAL
*
* Platform          : Arm
*
* Autosar Standard  : Classic Platform 4.4.0
*
* Compiled Version  : G32A10xx_MCAL_1_0_0_15-Nov-25
*
* Copyright (C) 2026 Geehy Semiconductor
*
* You may not use this file except in compliance with the
* GEEHY COPYRIGHT NOTICE (Geehy Semiconductor Software License Agreement).
*
* The program is only for reference, which is distributed in the hope
* that it will be usefull and instructional for customers to develop
* their software. Unless required by applicable law or agreed to in
* writing, the program is distributed on an "AS IS" BASIS, WITHOUT
* ANY WARRANTY OR CONDITIONS OF ANY KIND, either express or implied.
* See the Geehy Semiconductor Software License Agreement for the governing permissions
* and limitations under the License.
*/

/*
* MISRA-C:2012 compliance checks
*
*      Can_Hw_h_MISRA_REF1
*          Breaks the required Rule-6.1 & Dir-1.1 & Rule-1.2 of MISRA 2012 guidelines,
*          Bit-fields shall only be declared with an appropriate type
*
*/


#ifndef CAN_HW_H
#define CAN_HW_H

#ifdef __cplusplus
extern "C"{
#endif

#include "StdRegMacros.h"
#include "Can_Reg.h"
#include "Can_GeneralTypes.h"
#include "ComStack_Types.h"
#include "CanIf_Cbk.h"
#include "Mcal.h"
/** @addtogroup G32A10xx_StdPeriphDriver
  @{
*/

/** @defgroup CAN_Driver
  * @brief CAN driver modules
  @{
*/

/** @defgroup CAN_Macros
  @{
*/
/*******************************************************************************
                    VENDOR ID & AUTOSAR VERSION INFO
*******************************************************************************/
/** Vendor ID (vendorId) of the dedicated implementation of this module according to the AUTOSAR vendor list. */
#define CAN_HW_H_VENDOR_ID                      0x00C1U
/** Module ID of this module, as defined in the BSW Module List. */
#define CAN_HW_H_MODULE_ID                      0x0050U
/** Major version number of AUTOSAR release on which the appropriate implementation is based on. */
#define CAN_HW_H_AR_RELEASE_MAJOR_VERSION       0x04U
/** Minor version number of AUTOSAR release on which the appropriate implementation is based on. */
#define CAN_HW_H_AR_RELEASE_MINOR_VERSION       0x04U
/** Revision version number of AUTOSAR release on which the appropriate implementation is based on. */
#define CAN_HW_H_AR_RELEASE_REVISION_VERSION    0x00U
/** Major version number of the vendor specific implementation of the module. The numbering is vendor specific. */
#define CAN_HW_H_SW_MAJOR_VERSION               0x01U
/** Minor version number of the vendor specific implementation of the module. The numbering is vendor specific. */
#define CAN_HW_H_SW_MINOR_VERSION               0x00U
/** Patch level version number of the vendor specific implementation of the module. The numbering is vendor specific. */
#define CAN_HW_H_SW_PATCH_VERSION               0x00U

/*******************************************************************************
                                VERSION CHECK
*******************************************************************************/
/* Make sure the vendor id is the same between Can_Hw.h and Can_Reg.h */
#if (CAN_HW_H_VENDOR_ID != CAN_REG_H_VENDOR_ID)
    #error "Vendor id mismatch between Can_Hw.h and Can_Reg.h"
#endif

/* Make sure the AUTOSAR major version number is the same between Can_Hw.h and Can_Reg.h */
#if (CAN_HW_H_AR_RELEASE_MAJOR_VERSION != CAN_REG_H_AR_RELEASE_MAJOR_VERSION)
    #error "AUTOSAR major version number mismatch between Can_Hw.h and Can_Reg.h"
#endif
/* Make sure the AUTOSAR minor version number is the same between Can_Hw.h and Can_Reg.h */
#if (CAN_HW_H_AR_RELEASE_MINOR_VERSION != CAN_REG_H_AR_RELEASE_MINOR_VERSION)
    #error "AUTOSAR minor version number mismatch between Can_Hw.h and Can_Reg.h"
#endif
/* Make sure the AUTOSAR revision version number is the same between Can_Hw.h and Can_Reg.h */
#if (CAN_HW_H_AR_RELEASE_REVISION_VERSION != CAN_REG_H_AR_RELEASE_REVISION_VERSION)
    #error "AUTOSAR revision version number mismatch between Can_Hw.h and Can_Reg.h"
#endif
/* Make sure the software major version number is the same between Can_Hw.h and Can_Reg.h */
#if (CAN_HW_H_SW_MAJOR_VERSION != CAN_REG_H_SW_MAJOR_VERSION)
    #error "Software major version number mismatch between Can_Hw.h and Can_Reg.h"
#endif
/* Make sure the software minor version number is the same between Can_Hw.h and Can_Reg.h */
#if (CAN_HW_H_SW_MINOR_VERSION != CAN_REG_H_SW_MINOR_VERSION)
    #error "Software minor version number mismatch between Can_Hw.h and Can_Reg.h"
#endif
/* Make sure the software patch version number is the same between Can_Hw.h and Can_Reg.h */
#if (CAN_HW_H_SW_PATCH_VERSION != CAN_REG_H_SW_PATCH_VERSION)
    #error "Software patch version number mismatch between Can_Hw.h and Can_Reg.h"
#endif

#ifdef ENABLE_INTERMODULE_MCAL_CHECK
    /* Make sure the AUTOSAR major version number is the same between Can_Hw.h and StdRegMacros.h */
    #if (CAN_HW_H_AR_RELEASE_MAJOR_VERSION != STD_REG_MACROS_H_AR_RELEASE_MAJOR_VERSION)
        #error "AUTOSAR major version number mismatch between Can_Hw.h and StdRegMacros.h"
    #endif
    /* Make sure the AUTOSAR minor version number is the same between Can_Hw.h and StdRegMacros.h */
    #if (CAN_HW_H_AR_RELEASE_MINOR_VERSION != STD_REG_MACROS_H_AR_RELEASE_MINOR_VERSION)
        #error "AUTOSAR minor version number mismatch between Can_Hw.h and StdRegMacros.h"
    #endif
    /* Make sure the AUTOSAR major version number is the same between Can_Hw.h and Can_GeneralTypes.h */
    #if (CAN_HW_H_AR_RELEASE_MAJOR_VERSION != CAN_GENERAL_TYPES_H_AR_RELEASE_MAJOR_VERSION)
        #error "AUTOSAR major version number mismatch between Can_Hw.h and Can_GeneralTypes.h"
    #endif
    /* Make sure the AUTOSAR minor version number is the same between Can_Hw.h and Can_GeneralTypes.h */
    #if (CAN_HW_H_AR_RELEASE_MINOR_VERSION != CAN_GENERAL_TYPES_H_AR_RELEASE_MINOR_VERSION)
        #error "AUTOSAR minor version number mismatch between Can_Hw.h and Can_GeneralTypes.h"
    #endif
    /* Make sure the AUTOSAR major version number is the same between Can_Hw.h and ComStack_Types.h */
    #if (CAN_HW_H_AR_RELEASE_MAJOR_VERSION != COM_STACK_TYPES_H_AR_RELEASE_MAJOR_VERSION)
        #error "AUTOSAR major version number mismatch between Can_Hw.h and ComStack_Types.h"
    #endif
    /* Make sure the AUTOSAR minor version number is the same between Can_Hw.h and ComStack_Types.h */
    #if (CAN_HW_H_AR_RELEASE_MINOR_VERSION != COM_STACK_TYPES_H_AR_RELEASE_MINOR_VERSION)
        #error "AUTOSAR minor version number mismatch between Can_Hw.h and ComStack_Types.h"
    #endif
    /* Make sure the AUTOSAR major version number is the same between Can_Hw.h and CanIf_Cbk.h */
    #if (CAN_HW_H_AR_RELEASE_MAJOR_VERSION != CANIF_CBK_H_AR_RELEASE_MAJOR_VERSION)
        #error "AUTOSAR major version number mismatch between Can_Hw.h and CanIf_Cbk.h"
    #endif
    /* Make sure the AUTOSAR minor version number is the same between Can_Hw.h and CanIf_Cbk.h */
    #if (CAN_HW_H_AR_RELEASE_MINOR_VERSION != CANIF_CBK_H_AR_RELEASE_MINOR_VERSION)
        #error "AUTOSAR minor version number mismatch between Can_Hw.h and CanIf_Cbk.h"
    #endif
    /* Make sure the AUTOSAR major version number is the same between Can_Hw.h and Mcal.h */
    #if (CAN_HW_H_AR_RELEASE_MAJOR_VERSION != MCAL_H_AR_RELEASE_MAJOR_VERSION)
        #error "AUTOSAR major version number mismatch between Can_Hw.h and Mcal.h"
    #endif
    /* Make sure the AUTOSAR minor version number is the same between Can_Hw.h and Mcal.h */
    #if (CAN_HW_H_AR_RELEASE_MINOR_VERSION != MCAL_H_AR_RELEASE_MINOR_VERSION)
        #error "AUTOSAR minor version number mismatch between Can_Hw.h and Mcal.h"
    #endif
#endif /* ENABLE_INTERMODULE_MCAL_CHECK */

/*******************************************************************************
                                MACROS
*******************************************************************************/
#define CAN_CCCR_CONFIG_MASK_U32                     (0x000078E4U)

/** Size of one standard filter element in number of bytes */
#define CAN_STANDARD_FILTER_ELE_SIZE_U32              (4U)
/** Size of one extended filter element in number of bytes */
#define CAN_EXTENDED_FILTER_ELE_SIZE_U32              (8U)
/** Register bits check */
#define CAN_REGISTER_BITS_NOT_ZERO                    (0x00000002U)
/** Size in bytes of the ICOM Signal */
#define CAN_ICOM_DATA_SIGNAL_MATCH_SIZE               (8U)

/** Maximum number of transmit message buffers available */
#define CAN_MAX_TX_BUFFER_INDEX                       (32U)
/** Number of transmit hardware object buffers present */
#define CAN_NOOF_TX_HW_BUFF_AVAILABLE                 (32U)

/** FD flag in CAN ID */
#ifdef CAN_INCLUDE_EXTENDEDID
#if (STD_ON == CAN_INCLUDE_EXTENDEDID)
    #define CAN_ID_FD_DESCRIPTOR                          ((uint32)0x40000000)
#else
    #define CAN_ID_FD_DESCRIPTOR                          ((uint16)0x4000)
#endif
#endif /* CAN_INCLUDE_EXTENDEDID */

/** Message head length(in bytes) */
#define CAN_MSG_RAM_ELEMENT_HEAD_SIZE                 (8U)
/** IDE flag used to identify whether the ID is extended or standard */
#define CAN_ID_IDE_U32                                ((uint32)0x80000000U)
/** Values used for FD mask and Extended Id Mask */
#define CAN_PDU_EXTENDED_ID_MASK                      (uint32)(0x1FFFFFFFU)
#define CAN_PDU_STANDARD_ID_MASK                      (uint32)(0x000007FFU)

/** Shift operation values used by the CAN driver */
#define CAN_MSG_STANDARD_ID_SHIFT_EIGHTEEN            (18U)

#if (STD_ON == CAN_ENABLE_FD_MODE)
#define CAN_MSG_DATA_LEN_CAL_TWO                      (2U)
#define CAN_MSG_DATA_LEN_CAL_THREE                    (3U)
#define CAN_MSG_DATA_LEN_CAL_FOUR                     (4U)
#define CAN_MSG_DATA_LEN_CAL_SIX                      (6U)
#define CAN_MSG_DATA_LEN_CAL_EIGHT                    (8U)
#define CAN_MSG_DATA_LEN_CAL_ELEVEN                   (11U)
#define CAN_MSG_DATA_LEN_CAL_FIFTEEN                  (15U)
#define CAN_MSG_DATA_LEN_CAL_SIXTEEN                  (16U)
/** Shift operation values used by the CAN driver */
#define CAN_MSG_DATA_LEN_CAL_SHIFT_TWENTYFOUR         (24U)
/** Message RAM element size with FD support */
#define CAN_MSG_RAM_ELEMENT_SIZE_FD                   (72U)
#endif

/** Initerrupt Bit mask for the interruptStatus/interruptTempStatus Can_ControllerStatusType */
#define CAN_BUSOFF_INT_BIT_MASK                       (0x01U)
#define CAN_TX_EVT_INT_BIT_MASK                       (0x02U)
#define CAN_DEDICATED_RX_BUF_INT_BIT_MASK             (0x04U)
#define CAN_RX_FIFO0_INT_BIT_MASK                     (0x08U)
#define CAN_RX_FIFO1_INT_BIT_MASK                     (0x10U)

/** Event handler index(Tx/Rx/Bus Off/Wakeup) */
#define CAN_EVENT_HANDLER_INDEX_TX                    (0U)
#define CAN_EVENT_HANDLER_INDEX_RX                    (1U)
#define CAN_EVENT_HANDLER_INDEX_BUSOFF                (2U)
#define CAN_EVENT_HANDLER_INDEX_WAKEUP                (3U)

/** Rx Buffer index of the Rx Fifo 0 and Rx Fifo 1 */
#define CAN_RX_FIFO0_BUF_INDEX                        (0xFDU)
#define CAN_RX_FIFO1_BUF_INDEX                        (0xFEU)

/** Buffer data region size type count */
#define CAN_BUF_DATA_REGION_SIZE_TYPE_COUNT           (8U)

/** Maximum data length supported in CAN FD/CAN mode */
#define CAN_MAX_FD_DATA_LENGTH                        (64U)
#define CAN_MAX_DATA_LENGTH                           (8U)

/** Size of one Tx Event FIFO element in number of bytes */
#define CAN_TX_EVT_FIFO_ELEMENT_SIZE_U32              (8U)

/** Invalid software object handle value */
#define CAN_SWOBJECT_INVALID_VAL                      (0xFFFFU)

/** Number of times to check flags for IRQ status */
#define CAN_FLAG_IRQ_CHECK_COUNT                      (3U)

/** CAN Controller logical index */
#define CAN_CONTROLLER_LOG_INDEX0                     (0U)

/** CAN Controller hardware index */
#define CAN_CAONTROLLER_HW_INDEX0                     (0U)

/** Used in the configuration when controller is disabled */
#define CAN_CONTROLLER_INVALID                        ((uint8)0xFFU)

/** Shift value for CAN RAM address calculation */
#define CAN_RAM_ADDRESS_SHIFT_VAL                     (2U)

/**@} end of group CAN_Macros */
/*******************************************************************************
                                ENUMS
*******************************************************************************/
/** @defgroup CAN_Enumerations
  @{
*/
/**
 * @brief    CAN BIT State
 */
typedef enum
{
    CAN_BIT_RESET = 0U,
    CAN_BIT_SET
} Can_BitStatusType;

/**
 * @brief    CAN Controller ICOM activation state
 */
typedef enum
{
    CAN_ICOM_DEACTIVATED = 0U,
    CAN_ICOM_ACTIVATED
} Can_IcomStateType;

/**
 * @brief    Interrupt mode of a CAN controller
 */
typedef enum
{
    CAN_INTERRUPT_DISABLED = 0U,
    CAN_INTERRUPT_ENABLED
} Can_InterruptModeType;

/**
 * @brief    Tx FIFO/Queue Mode
 */
typedef enum
{
    CAN_TX_MODE_FIFO,         //!< Tx FIFO operation
    CAN_TX_MODE_QUEUE,        //!< Tx Queue operation
    CAN_TX_MODE_DEDICATE_BUF, //!< Tx dedicated buffers operation
    CAN_TX_MODE_SHARE_FIFO,   //!< Tx shared dedicated buffers and Tx FIFO operation
    CAN_TX_MODE_SHARE_QUEUE   //!< Tx shared dedicated buffers and Tx Queue operation
} Can_TxBufModeType;

/**
 * @brief    Data Field Size
 */
typedef enum
{
    CAN_DATA_FIELD_SIZE_8,  //!< 8  bytes data field
    CAN_DATA_FIELD_SIZE_12, //!< 12 bytes data field
    CAN_DATA_FIELD_SIZE_16, //!< 16 bytes data field
    CAN_DATA_FIELD_SIZE_20, //!< 20 bytes data field
    CAN_DATA_FIELD_SIZE_24, //!< 24 bytes data field
    CAN_DATA_FIELD_SIZE_32, //!< 32 bytes data field
    CAN_DATA_FIELD_SIZE_48, //!< 48 bytes data field
    CAN_DATA_FIELD_SIZE_64  //!< 64 bytes data field
} Can_DataFieldSizeType;

/**
 * @brief    Message Id length (Standard or Extended)
 */
typedef enum
{
    CAN_MSG_ID_LEN_STANDARD, //!< Standard Message ID
    CAN_MSG_ID_LEN_EXTENDED, //!< Extended Message ID
    CAN_MSG_ID_LEN_BOTH      //!< Both Standard and Extended message IDs
} Can_MsgIdLenType;

/**
 * @brief    Indicate the action to be taken with the messages which do not match with any element of the filter.
 */
typedef enum
{
    CAN_NON_MATCH_FRAME_ACC_RX_FIFO0 = 0, //!< Accept the non matching messages into Rx FIFO 0
    CAN_NON_MATCH_FRAME_ACC_RX_FIFO1 = 1, //!< Accept the non matching messages into Rx FIFO 1
    CAN_NON_MATCH_FRAME_REJECT = 2        //!< Reject the non-matching messages
} Can_NonMatFrameAccType;

/**
 * @brief    Rx Buffers or FIFO 0 or combination Mode of reception
 */
typedef enum
{
    CAN_RX_MODE_DEDICATE_BUF, //!< Rx dedicated buffers operation
    CAN_RX_MODE_FIFO0,        //!< Rx FIFO 0 operation
    CAN_RX_MODE_FIFO1,        //!< Rx FIFO 1 operation
    CAN_RX_MODE_SHARE_FIFO0,  //!< Rx shared dedicated buffers and Rx FIFO 0 operation
    CAN_RX_MODE_SHARE_FIFO1,  //!< Rx shared dedicated buffers and Rx FIFO 1 operation
    CAN_RX_MODE_SHARE_ALL     //!< Rx shared dedicated buffers and Rx FIFO 0 and Rx FIFO 1 operation
} Can_RxModeType;

/**
 * @brief    Rx FIFO 0/1 operating mode
 */
typedef enum
{
    CAN_RX_FIFO_MODE_BLOCKING, //!< Blocking mode
    CAN_RX_FIFO_MODE_OVERWRITE //!< Overwrite mode
} Can_RxFifoModeType;

/**
 * @brief    Filter Element Configuration
 */
typedef enum
{
    CAN_FILTER_ELE_COFIG_DISABLE,              //!< Disable filter element
    CAN_FILTER_ELE_COFIG_STORE_RX_FIFO0,       //!< Store in Rx FIFO 0 if filter matches
    CAN_FILTER_ELE_COFIG_STORE_RX_FIFO1,       //!< Store in Rx FIFO 1 if filter matches
    CAN_FILTER_ELE_COFIG_REJECT_ID,            //!< Reject ID if filter matches
    CAN_FILTER_ELE_COFIG_SET_PRIO,             //!< Set priority if filter matches
    CAN_FILTER_ELE_COFIG_SET_PRIO_STORE_FIFO0, //!< Set priority and store in FIFO 0 if filter matches
    CAN_FILTER_ELE_COFIG_SET_PRIO_STORE_FIFO1, //!< Set priority and store in FIFO 1 if filter matches
    CAN_FILTER_ELE_COFIG_STORE_RX_BUF          //!< Store into Rx Buffer */
} Can_FilterElementConfigType;

/**
 * @brief    Filter Type
 */
typedef enum
{
    CAN_FILTER_ACTION_RANGE,   //!< Range filter from SFID1 to SFID2 (SFID2 is greater than SFID1)
    CAN_FILTER_ACTION_DUAL_ID, //!< Dual ID filter for SFID1 or SFID2
    CAN_FILTER_ACTION_CLASSIC, //!< Classic filter: SFID1 = filter, SFID2 = mask
    CAN_FILTER_ACTION_NONE     //!< Reserved */
} Can_FilterActionType;

/**
 * @brief    Interrupt line number
 */
typedef enum
{
    CAN_INTERRUPT_LINE0 = 0U, //!< Interrupt Line 0
    CAN_INTERRUPT_LINE1  //!< Interrupt Line 1
} Can_InterruptLineType;

/**
 * @brief    Rx Buffer number
 */
typedef enum
{
    CAN_RX_BUF_ID_0,  //!< Rx buffer 0
    CAN_RX_BUF_ID_1,  //!< Rx buffer 1
    CAN_RX_BUF_ID_2,  //!< Rx buffer 2
    CAN_RX_BUF_ID_3,  //!< Rx buffer 3
    CAN_RX_BUF_ID_4,  //!< Rx buffer 4
    CAN_RX_BUF_ID_5,  //!< Rx buffer 5
    CAN_RX_BUF_ID_6,  //!< Rx buffer 6
    CAN_RX_BUF_ID_7,  //!< Rx buffer 7
    CAN_RX_BUF_ID_8,  //!< Rx buffer 8
    CAN_RX_BUF_ID_9,  //!< Rx buffer 9
    CAN_RX_BUF_ID_10, //!< Rx buffer 10
    CAN_RX_BUF_ID_11, //!< Rx buffer 11
    CAN_RX_BUF_ID_12, //!< Rx buffer 12
    CAN_RX_BUF_ID_13, //!< Rx buffer 13
    CAN_RX_BUF_ID_14, //!< Rx buffer 14
    CAN_RX_BUF_ID_15, //!< Rx buffer 15
    CAN_RX_BUF_ID_16, //!< Rx buffer 16
    CAN_RX_BUF_ID_17, //!< Rx buffer 17
    CAN_RX_BUF_ID_18, //!< Rx buffer 18
    CAN_RX_BUF_ID_19, //!< Rx buffer 19
    CAN_RX_BUF_ID_20, //!< Rx buffer 20
    CAN_RX_BUF_ID_21, //!< Rx buffer 21
    CAN_RX_BUF_ID_22, //!< Rx buffer 22
    CAN_RX_BUF_ID_23, //!< Rx buffer 23
    CAN_RX_BUF_ID_24, //!< Rx buffer 24
    CAN_RX_BUF_ID_25, //!< Rx buffer 25
    CAN_RX_BUF_ID_26, //!< Rx buffer 26
    CAN_RX_BUF_ID_27, //!< Rx buffer 27
    CAN_RX_BUF_ID_28, //!< Rx buffer 28
    CAN_RX_BUF_ID_29, //!< Rx buffer 29
    CAN_RX_BUF_ID_30, //!< Rx buffer 30
    CAN_RX_BUF_ID_31, //!< Rx buffer 31
    CAN_RX_BUF_ID_32, //!< Rx buffer 32
    CAN_RX_BUF_ID_33, //!< Rx buffer 33
    CAN_RX_BUF_ID_34, //!< Rx buffer 34
    CAN_RX_BUF_ID_35, //!< Rx buffer 35
    CAN_RX_BUF_ID_36, //!< Rx buffer 36
    CAN_RX_BUF_ID_37, //!< Rx buffer 37
    CAN_RX_BUF_ID_38, //!< Rx buffer 38
    CAN_RX_BUF_ID_39, //!< Rx buffer 39
    CAN_RX_BUF_ID_40, //!< Rx buffer 40
    CAN_RX_BUF_ID_41, //!< Rx buffer 41
    CAN_RX_BUF_ID_42, //!< Rx buffer 42
    CAN_RX_BUF_ID_43, //!< Rx buffer 43
    CAN_RX_BUF_ID_44, //!< Rx buffer 44
    CAN_RX_BUF_ID_45, //!< Rx buffer 45
    CAN_RX_BUF_ID_46, //!< Rx buffer 46
    CAN_RX_BUF_ID_47, //!< Rx buffer 47
    CAN_RX_BUF_ID_48, //!< Rx buffer 48
    CAN_RX_BUF_ID_49, //!< Rx buffer 49
    CAN_RX_BUF_ID_50, //!< Rx buffer 50
    CAN_RX_BUF_ID_51, //!< Rx buffer 51
    CAN_RX_BUF_ID_52, //!< Rx buffer 52
    CAN_RX_BUF_ID_53, //!< Rx buffer 53
    CAN_RX_BUF_ID_54, //!< Rx buffer 54
    CAN_RX_BUF_ID_55, //!< Rx buffer 55
    CAN_RX_BUF_ID_56, //!< Rx buffer 56
    CAN_RX_BUF_ID_57, //!< Rx buffer 57
    CAN_RX_BUF_ID_58, //!< Rx buffer 58
    CAN_RX_BUF_ID_59, //!< Rx buffer 59
    CAN_RX_BUF_ID_60, //!< Rx buffer 60
    CAN_RX_BUF_ID_61, //!< Rx buffer 61
    CAN_RX_BUF_ID_62, //!< Rx buffer 62
    CAN_RX_BUF_ID_63, //!< Rx buffer 63
    CAN_RX_BUF_ID_NONE = 0xFF //!< Invalid Rx buffer
} Can_RxBufIdType;

/**
 * @brief    Tx Buffer number
 */
typedef enum
{
    Can_TX_BUF_ID_0,  //!< Tx buffer 0
    Can_TX_BUF_ID_1,  //!< Tx buffer 1
    Can_TX_BUF_ID_2,  //!< Tx buffer 2
    Can_TX_BUF_ID_3,  //!< Tx buffer 3
    Can_TX_BUF_ID_4,  //!< Tx buffer 4
    Can_TX_BUF_ID_5,  //!< Tx buffer 5
    Can_TX_BUF_ID_6,  //!< Tx buffer 6
    Can_TX_BUF_ID_7,  //!< Tx buffer 7
    Can_TX_BUF_ID_8,  //!< Tx buffer 8
    Can_TX_BUF_ID_9,  //!< Tx buffer 9
    Can_TX_BUF_ID_10, //!< Tx buffer 10
    Can_TX_BUF_ID_11, //!< Tx buffer 11
    Can_TX_BUF_ID_12, //!< Tx buffer 12
    Can_TX_BUF_ID_13, //!< Tx buffer 13
    Can_TX_BUF_ID_14, //!< Tx buffer 14
    Can_TX_BUF_ID_15, //!< Tx buffer 15
    Can_TX_BUF_ID_16, //!< Tx buffer 16
    Can_TX_BUF_ID_17, //!< Tx buffer 17
    Can_TX_BUF_ID_18, //!< Tx buffer 18
    Can_TX_BUF_ID_19, //!< Tx buffer 19
    Can_TX_BUF_ID_20, //!< Tx buffer 20
    Can_TX_BUF_ID_21, //!< Tx buffer 21
    Can_TX_BUF_ID_22, //!< Tx buffer 22
    Can_TX_BUF_ID_23, //!< Tx buffer 23
    Can_TX_BUF_ID_24, //!< Tx buffer 24
    Can_TX_BUF_ID_25, //!< Tx buffer 25
    Can_TX_BUF_ID_26, //!< Tx buffer 26
    Can_TX_BUF_ID_27, //!< Tx buffer 27
    Can_TX_BUF_ID_28, //!< Tx buffer 28
    Can_TX_BUF_ID_29, //!< Tx buffer 29
    Can_TX_BUF_ID_30, //!< Tx buffer 30
    Can_TX_BUF_ID_31, //!< Tx buffer 31
    Can_TX_FIFO_QUEUE_ID_32  //!< Tx FIFO/Queue 32
} Can_TxBufferIdType;

/**
 * @brief    Rx FIFO Watermark level
 */
typedef enum
{
    CAN_FIFO_WATERMARK_DISABLED = 0U,
    CAN_FIFO_WATERMARK_1,
    CAN_FIFO_WATERMARK_2,
    CAN_FIFO_WATERMARK_3,
    CAN_FIFO_WATERMARK_4,
    CAN_FIFO_WATERMARK_5,
    CAN_FIFO_WATERMARK_6,
    CAN_FIFO_WATERMARK_7,
    CAN_FIFO_WATERMARK_8,
    CAN_FIFO_WATERMARK_9,
    CAN_FIFO_WATERMARK_10,
    CAN_FIFO_WATERMARK_11,
    CAN_FIFO_WATERMARK_12,
    CAN_FIFO_WATERMARK_13,
    CAN_FIFO_WATERMARK_14,
    CAN_FIFO_WATERMARK_15,
    CAN_FIFO_WATERMARK_16,
    CAN_FIFO_WATERMARK_17,
    CAN_FIFO_WATERMARK_18,
    CAN_FIFO_WATERMARK_19,
    CAN_FIFO_WATERMARK_20,
    CAN_FIFO_WATERMARK_21,
    CAN_FIFO_WATERMARK_22,
    CAN_FIFO_WATERMARK_23,
    CAN_FIFO_WATERMARK_24,
    CAN_FIFO_WATERMARK_25,
    CAN_FIFO_WATERMARK_26,
    CAN_FIFO_WATERMARK_27,
    CAN_FIFO_WATERMARK_28,
    CAN_FIFO_WATERMARK_29,
    CAN_FIFO_WATERMARK_30,
    CAN_FIFO_WATERMARK_31,
    CAN_FIFO_WATERMARK_32,
    CAN_FIFO_WATERMARK_33,
    CAN_FIFO_WATERMARK_34,
    CAN_FIFO_WATERMARK_35,
    CAN_FIFO_WATERMARK_36,
    CAN_FIFO_WATERMARK_37,
    CAN_FIFO_WATERMARK_38,
    CAN_FIFO_WATERMARK_39,
    CAN_FIFO_WATERMARK_40,
    CAN_FIFO_WATERMARK_41,
    CAN_FIFO_WATERMARK_42,
    CAN_FIFO_WATERMARK_43,
    CAN_FIFO_WATERMARK_44,
    CAN_FIFO_WATERMARK_45,
    CAN_FIFO_WATERMARK_46,
    CAN_FIFO_WATERMARK_47,
    CAN_FIFO_WATERMARK_48,
    CAN_FIFO_WATERMARK_49,
    CAN_FIFO_WATERMARK_50,
    CAN_FIFO_WATERMARK_51,
    CAN_FIFO_WATERMARK_52,
    CAN_FIFO_WATERMARK_53,
    CAN_FIFO_WATERMARK_54,
    CAN_FIFO_WATERMARK_55,
    CAN_FIFO_WATERMARK_56,
    CAN_FIFO_WATERMARK_57,
    CAN_FIFO_WATERMARK_58,
    CAN_FIFO_WATERMARK_59,
    CAN_FIFO_WATERMARK_60,
    CAN_FIFO_WATERMARK_61,
    CAN_FIFO_WATERMARK_62,
    CAN_FIFO_WATERMARK_63,
    CAN_FIFO_WATERMARK_64
} Can_FifoWaterMarkType;

/**
 * @brief    Message RAM section indexes
 */
typedef enum
{
    CAN_MSG_RAM_SECTION_INDEX_STD_FILTERS   = 0U,
    CAN_MSG_RAM_SECTION_INDEX_EXT_FILTERS   = 1U,
    CAN_MSG_RAM_SECTION_INDEX_RX_FIFO0      = 2U,
    CAN_MSG_RAM_SECTION_INDEX_RX_FIFO1      = 3U,
    CAN_MSG_RAM_SECTION_INDEX_RX_BUFFERS    = 4U,
    CAN_MSG_RAM_SECTION_INDEX_TX_BUFFERS    = 5U,
    CAN_MSG_RAM_SECTION_INDEX_TX_EVENT_FIFO = 6U
} Can_MsgRamSectionIndexType;

/**
 * @brief    Tx Mode for Testing
 */
typedef enum
{
    CAN_TEST_TX_MODE_CORE_CTRL = 0U,
    CAN_TEST_TX_MODE_SAMPLE_MONITOR = 1U,
    CAN_TEST_TX_MODE_PIN_LOW = 2U,
    CAN_TEST_TX_MODE_PIN_HIGH = 3U
} Can_TestTxModeType;

/**
 * @brief    Timestamp counter operation mode 
 */
typedef enum
{
    CAN_TIMESTAMP_OPER_DISABLED = 0U,
    CAN_TIMESTAMP_OPER_TCP = 1U,
    CAN_TIMESTAMP_OPER_EXTERNAL = 2U
} Can_TimestampOperModeType;

/**
 * @brief    Timestamp counter prescaler
 */
typedef enum
{
    CAN_TIMESTAMP_PSC_DIV1 = 0U,
    CAN_TIMESTAMP_PSC_DIV2 = 1U,
    CAN_TIMESTAMP_PSC_DIV3 = 2U,
    CAN_TIMESTAMP_PSC_DIV4 = 3U,
    CAN_TIMESTAMP_PSC_DIV5 = 4U,
    CAN_TIMESTAMP_PSC_DIV6 = 5U,
    CAN_TIMESTAMP_PSC_DIV7 = 6U,
    CAN_TIMESTAMP_PSC_DIV8 = 7U,
    CAN_TIMESTAMP_PSC_DIV9 = 8U,
    CAN_TIMESTAMP_PSC_DIV10 = 9U,
    CAN_TIMESTAMP_PSC_DIV11 = 10U,
    CAN_TIMESTAMP_PSC_DIV12 = 11U,
    CAN_TIMESTAMP_PSC_DIV13 = 12U,
    CAN_TIMESTAMP_PSC_DIV14 = 13U,
    CAN_TIMESTAMP_PSC_DIV15 = 14U,
    CAN_TIMESTAMP_PSC_DIV16 = 15U
} Can_TimestampPrescalerType;

/**
 * @brief    Timeout counter operation mode
 */
typedef enum
{
    CAN_TIMEOUT_CNTER_OPER_CONTINUOUS = 0U,
    CAN_TIMEOUT_CNTER_OPER_TX_FIFO = 1U,
    CAN_TIMESTAMP_OPER_RX_FIFO0 = 2U,
    CAN_TIMESTAMP_OPER_RX_FIFO1 = 3U
} Can_TimeoutCnterOperModeType;

#if (STD_ON == CAN_PUBLIC_ICOM_ENABLE)
/**
 * @brief    Data type used for Icom signal operator
 */
typedef enum
{
    CAN_ICOM_OPER_AND,
    CAN_ICOM_OPER_EQUAL,
    CAN_ICOM_OPER_GREATER,
    CAN_ICOM_OPER_SMALLER,
    CAN_ICOM_OPER_XOR
} Can_IcomSignalOperType;
#endif /* STD_ON == CAN_PUBLIC_ICOM_ENABLE */

/**
 * @brief    Rx data check type
 */
typedef enum
{
    CAN_RX_DATA_CHECK_DEDICATED_BUFFER,
    CAN_RX_DATA_CHECK_FIFO0,
    CAN_RX_DATA_CHECK_FIFO1,
    CAN_RX_DATA_CHECK_ALL
} Can_RxDataCheckType;

/**
 * @brief    Tx Event FIFO Interrupt type
 */
typedef enum
{
    CAN_TX_EVT_FIFO_NEW_ELE_INT,
    CAN_TX_EVT_FIFO_WM_INT,
    CAN_TX_EVT_FIFO_FULL_INT
} Can_TxEvtFifoIntType;

/**
 * @brief    Rx FIFO Interrupt type
 */
typedef enum
{
    CAN_RX_FIFO_NEW_MESSAGE_INT,
    CAN_RX_FIFO_WATERMARK_INT,
    CAN_RX_FIFO_FULL_INT
} Can_RxFifoIntType;

/**
 * @brief    Rx FIFO index
 */
typedef enum
{
    CAN_RX_FIFO0,
    CAN_RX_FIFO1
} Can_RxFifoIndexType;

/**
 * @brief    CAN driver state
 */
typedef enum
{
    CAN_UNINIT = 0U,
    CAN_READY
} Can_DriverStatusType;
/**@} end of group CAN_Enumerations */
/*******************************************************************************
                                TYPE DEFINES
*******************************************************************************/
/** @defgroup CAN_Typedef
  @{
*/
/** Pointer to a callback function */
typedef void (*Can_CallBackFunctionPtrType)(void);

/** The ECC Error notification functions definition. */
typedef void (*Can_EccErrorNotifyFunctionType)(uint32 FaultAddr);

/** Pointer to CAN ID */
typedef CONSTP2CONST(Can_IdType, CAN_CONST, CAN_APPL_CONST) Can_IdPtrType;

/**@} end of group CAN_Typedef */
/** @defgroup CAN_Structure
  @{
*/
/**
 * @brief    Address of IFLAG and IMASK registers
 */
typedef struct
{
    CONST(uint32, CAN_CONST) addrIflag;
    CONST(uint32, CAN_CONST) addrImask;
} Can_MaskFlagAddrType;

/**
 * @brief    Runtime status of a CAN controller
 */
typedef struct
{
    /** Pointer to the CAN transmit buffer Mask */
    volatile VAR(uint32, CAN_VAR) txMask;
    /** Pointer to Backup variable used to restore during BO */
    volatile VAR(uint32, CAN_VAR) backupTxMask;
    /** Current controller state */
    VAR(volatile Can_ControllerStateType, CAN_VAR) controllerState;
    /** This variable stores the interrupt status of the controller */
    volatile VAR(Can_InterruptModeType, CAN_VAR) interruptMode;
    /** This variable stores count value of disable Interrupt called for the
    controller in the core */
    volatile VAR(uint8, CAN_VAR) disableIntrpCount;
    /** Used to store swPduHandle passed by CanIf(current only support one controller) */
    P2VAR(PduIdType, AUTOMATIC, CAN_APPL_DATA) swObjectHandle;
    /** Current baudrate in use */
    VAR(volatile uint8, CAN_VAR) currentBaudrateIndex;
    /** Cancel Rx Buffer hw index */
    VAR(volatile Can_HwHandleType, CAN_VAR) mbCancelIndex;

#if (STD_OFF == CAN_TX_INTERRUPT_HANDLE_ENABLE)
    /** Variable used to hold the order of transmit that have occured */
    P2VAR(uint16, AUTOMATIC, CAN_APPL_DATA) txSwObjPriorityPtr;
#endif

#if (STD_ON == CAN_PUBLIC_ICOM_ENABLE)
    /** This variable stores the wake on bus off status on ICOM configuration */
    volatile VAR(boolean, CAN_VAR) icomConfgBOStatus;
    /** This variable stores the Pretended network support status */
    volatile VAR(boolean, CAN_VAR) icomEnableStatus;
    /** If this variable is SET, Can_Write API will be blocked indicating that ICOM
    enable is in progress and filters are getting updated */
    VAR(boolean, CAN_VAR) icomBlockWriteCalls;
    /** This variable used to stores the current ICOM Configuration ID */
    VAR(uint8, CAN_VAR) activeIcomCfgId;
    /** ICOM Message counter counter value:per counter for each message */
    P2VAR(uint16, AUTOMATIC, CAN_APPL_DATA) icomMsgCntrValPtr;
#endif /* STD_ON == CAN_PUBLIC_ICOM_ENABLE */
} Can_ControllerStatusType;

/**
 * @brief    Tx Event FIFO Element 0
 */
typedef struct
{
    /** [28:0] Identifier (rwh) */
    unsigned int id : 29;
    /** [29:29] Remote Transmission Request (rwh) */
    unsigned int rtr : 1;
    /** [30:30] Extended Identifier (rwh) */
    unsigned int xtd : 1;
    /** [31:31] Error State Indicator (rwh) */
    unsigned int esi : 1;
}Can_TxEvtE0Type;

/**
 * @brief    Tx Event FIFO Element 1
 */
typedef struct
{
    /** [15:0] Tx Timestamp (rwh) */
    unsigned int txts : 16;
    /** [19:16] Data Length Code (rwh) */
    unsigned int dlc : 4;
    /** [20:20] Bit Rate Switch (rwh) */
    unsigned int brs : 1;
    /** [21:21] FD Format (rwh) */
    unsigned int fdf : 1;
    /** [23:22] Event Type (rwh) */
    unsigned int et : 2;
    /** [31:24] Message Marker (rwh) */
    unsigned int mm : 8;
}Can_TxEvtE1Type;

/**
 * @brief    Tx Event FIFO Element Structure
 */
typedef struct
{
    Can_TxEvtE0Type txEvtE0;
    Can_TxEvtE1Type txEvtE1;
}Can_TxEvtFifoEleType;

/**
 * @brief    Transmit Buffer 0
 */
typedef struct
{
    /** [28:0] Identifier (rw) */
    unsigned int id : 29;
    /** [29:29] Remote Transmission Request (rw) */
    unsigned int rtr : 1;
    /** [30:30] Extended Identifier (rw) */
    unsigned int xtd : 1;
    /** [31:31] Error State Indicator (rw) */
    unsigned int esi : 1;
} Can_TxMsgT0Type;

/**
 * @brief    Transmit Buffer 1
 */
typedef struct
{
    /** internal Reserved */
    unsigned int reserved_0 : 16;
    /** [19:16] Data Length Code (rw) */
    unsigned int dlc : 4;
    /** [20:20] Bit Rate Switching (rw) */
    unsigned int brs : 1;
    /** [21:21] FD Format (rw) */
    unsigned int fdf : 1;
    /** [22:22] internal Reserved */
    unsigned int reserved_22 : 1;
    /** [23:23] Event FIFO Control (rw) */
    unsigned int efc : 1;
    /** [31:24] Message Marker (rw) */
    unsigned int mm : 8;
} Can_TxMsgT1Type;

/**
 * @brief    Data Byte m
 */
typedef struct
{
    /** [7:0] Data Byte m (rwH) */
    /*** @warning Can_Hw_h_MISRA_REF1 [C99] Bit-field db in unnamed struct has been declared with a type not explicitly supported. */
    VAR(uint8, AUTOMATIC) db : 8;
} Can_MsgDbType;

/**
 * @brief    Tx Message Structure
 */
typedef struct
{
    Can_TxMsgT0Type txMsgT0;
    Can_TxMsgT1Type txMsgT1;
    Can_MsgDbType   txMsgDb[64];
} Can_TxMsgType;

/**
 * @brief    Rx Buffer 0
 */
typedef struct
{
    /** [28:0] Identifier (rwh) */
    unsigned int id : 29;
    /** [29:29] Remote Transmission Request (rwh) */
    unsigned int rtr : 1;
    /** [30:30] Extended Identifier (rwh) */
    unsigned int xtd : 1;
    /** [31:31] Error State Indicator (rwh) */
    unsigned int esi : 1;
} Can_RxMsgR0Type;

/**
 * @brief    Rx Buffer 1
 */
typedef struct
{
    /** [15:0] Rx Timestamp (rwh) */
    unsigned int rxts : 16;
    /** [19:16] Data Length Code (rwh) */
    unsigned int dlc : 4;
    /** [20:20] Bit Rate Switching (rwh) */
    unsigned int brs : 1;
    /** [21:21] Frame Data Format (rwh) */
    unsigned int fdf : 1;
    /** [23:22] internal Reserved */
    unsigned int reserved_22 : 2;
    /** [30:24] Filter Index (rwh) */
    unsigned int fidx : 7;
    /** [31:31] Accepted Non-matching Frame (rwh) */
    unsigned int anmf : 1;
} Can_RxMsgR1Type;

/**
 * @brief    Rx Message Structure
 */
typedef struct
{
    Can_RxMsgR0Type rxMsgR0;
    Can_RxMsgR1Type rxMsgR1;
    Can_MsgDbType rxMsgDb[64];
} Can_RxMsgType;

/**
 * @brief    Configurations of one Tx message buffer
 */
typedef struct
{
    /** Hardware object Id */
    CONST(Can_HwHandleType, CAN_CONST) txHwObjId;
    /** Tx Buffer index number */
    CONST(uint8, CAN_CONST) txBuffIndx;
    /** configuration id of Controller to which this hardware object is assigned */
    CONST(uint8, CAN_CONST) hwControllerId;
    
#if(STD_ON == CAN_ENABLE_FD_MODE)
    /** The CAN FD padding Value */
    CONST(uint8, CAN_CONST) canFdPaddValue;
#endif
    
    /** The buffer types used by the Hardware handler */
    CONST(Can_TxBufModeType, CAN_CONST) txBufferModeType;
    
#if (STD_ON == CAN_TRIGGER_TRANSMIT_ENABLE)
    /** CAN Trigger transmit status */
    CONST(boolean, CAN_CONST) trigTxStatus;
#endif
    
    /** Main function read write period reference */
    CONST(uint8, CAN_CONST) mainFunctionRwPeriodRef;
} Can_TxMbConfigType;

/**
 * @brief    List of  Tx message buffer configurations
 */
typedef struct
{
    /** Number of elements in the Tx Message Buffers array */
    CONST(Can_HwHandleType, CAN_CONST) txMbCount;
    /** Pointer to the message buffer configuration array */
    P2CONST(Can_TxMbConfigType, CAN_CONST, CAN_APPL_CONST) txMbConfigPtr;
} Can_TxMbConfigsContainerType;

/**
 * @brief    Configurations of one Rx message buffer
 */
typedef struct
{
    /** Hardware object Id */
    CONST(Can_HwHandleType, CAN_CONST) rxHwObjId;
    /** Rx Buffer index number 
    * Dedicated buffer Index:0-63
    * Rx Fifo 0:0xFD
    * Rx Fifo 1:0xFE
    */
    CONST(uint8, CAN_CONST) rxBuffIndx;
    /** configuration id of Controller to which this hardware object is assigned */
    CONST(uint8, CAN_CONST) hwControllerId;
    
    /** Main function read write period reference */
    CONST(uint8, CAN_CONST) mainFunctionRwPeriodRef;
    
} Can_RxMbConfigType;

/**
 * @brief    List of  Rx message buffer configurations
 */
typedef struct
{
    /** Number of elements in the Rx Message Buffers array */
    CONST(Can_HwHandleType, CAN_CONST) rxMbCount;
    /** Pointer to the message buffer configuration array */
    P2CONST(Can_RxMbConfigType, CAN_CONST, CAN_APPL_CONST) rxMbConfigPtr;
} Can_RxMbConfigsContainerType;

/**
 * @brief    Structure for nominal baudrate
 */
typedef struct
{
    /** Baudrate value configured in Kbps */
    CONST(uint16, CAN_CONST) baudrateVal;
    /** Synchronization Jump Width */
    CONST(uint16, CAN_CONST) syncJumpWidth;
    /** Baud Rate Prescaler */
    CONST(uint16, CAN_CONST) prescaler;
    /** Time segment before sample point */
    CONST(uint8, CAN_CONST) timeSegment1;
    /** Time segment after sample point */
    CONST(uint8, CAN_CONST) timeSegment2;
} Can_BaudRateType;

/**
 * @brief    Structure for fast baudrate
 */
typedef struct
{
    /** Baudrate value configured in Kbps */
    CONST(uint16, CAN_CONST) baudrateVal;
    /** Synchronization Jump Width */
    CONST(uint16, CAN_CONST) syncJumpWidth;
    /** Baud Rate Prescaler */
    CONST(uint16, CAN_CONST) prescaler;
    /** Time segment before sample point */
    CONST(uint8, CAN_CONST) timeSegment1;
    /** Time segment after sample point */
    CONST(uint8, CAN_CONST) timeSegment2;
    /** Transceiver delay compensation enable */
    CONST(boolean, CAN_CONST) tranceiverDelayComEnable;
    /** Transceiver delay compensation offset */
    CONST(uint8, CAN_CONST) tranceiverDelayOffset;
    /** Transceiver delay compensation filter window */
    CONST(uint8, CAN_CONST) tranceiverDelayFilterWindow;
    /** BRS enable/disable */
    CONST(boolean, CAN_CONST) brsEnable;
} Can_FastBaudRateType;

/**
 * @brief    Structure for baudrate configuration
 */
typedef struct
{
    /** Structure for nominal baudrate */
    CONST(Can_BaudRateType, CAN_CONST) baudRate;
#if (CAN_ENABLE_FD_MODE == STD_ON)
    /** Structure for fast baudrate */
    CONST(Can_FastBaudRateType, CAN_CONST) fastBaudRate;
#endif

#if (STD_ON == CAN_SET_BAUDRATE_API)
    CONST(uint16, CAN_CONST) baudrateConfigId;
#endif /* STD_ON == CAN_SET_BAUDRATE_API */

#if ((STD_ON == CAN_CONTROLLER_ENABLE_ISO_CANFD) || (STD_ON == CAN_ENABLE_FD_MODE))
    /**  CCCR register value: Bit[15]: ISO CAN FD enable, Bit[8]: FDOE */
    CONST(uint32, CAN_CONST) isoAndFdConfig;
#endif
} Can_BaudrateConfigType;

/**
 * @brief    Structure for Tx buffer Configuration
 */
typedef struct
{
    /** Tx Dedicated buffer/FIFO/Queue Mode */
    CONST(Can_TxBufModeType, CAN_CONST) txMode;
    /** Tx Buffer Data Field Size */
    CONST(Can_DataFieldSizeType, CAN_CONST) txBufferDataFieldSize;
    /** TxEvent FIFO Water Mark Level */
    CONST(Can_FifoWaterMarkType, CAN_CONST) txEventFifoThreshold;
    /** Tx Buffer interrupts Enable:each bit for one tx buffer */
    CONST(uint32, CAN_CONST) txBufIntEnableBits;
    /** Tx Buffer Cancel interrupts Enable:each bit for one tx buffer */
    CONST(uint32, CAN_CONST) txBufCancelIntEnableBits;
} Can_TxConfigType;

/**
 * @brief    Structure for standard Filter element
 */
typedef struct
{
    /** Standard Filter ID 2:[10:0] */
    unsigned int sfid2:11;
    /** Reserved:[15:11] */
    unsigned int reserved_11:5;
    /** Standard Filter ID 1:[26:16] */
    unsigned int sfid1:11;
    /** Standard Filter Element Configuration:[29:27] */
    unsigned int sfec:3;
    /** Standard Filter Type:[31:30] */
    unsigned int sft:2;
} Can_FilterStandardEleType;

/**
 * @brief    Structure for extended Filter element 0
 */
typedef struct
{
    /** Extended Filter ID 1:[28:0] */
    unsigned int efid1:29;
    /** Extended Filter Element Configuration:[31:29] */
    unsigned int efec:3;
} Can_FilterExtendedEle0Type;

/**
 * @brief    Structure for extended Filter element 1
 */
typedef struct
{
    /** Extended Filter ID 2:[28:0] */
    unsigned int efid2:29;
    /** Reserved:[29] */
    unsigned int reserved_29:1;
    /** Extended Filter Type:[31:30] */
    unsigned int eft:2;
} Can_FilterExtendedEle1Type;

/**
 * @brief    Structure for extended Filter element
 */
typedef struct 
{
    VAR(Can_FilterExtendedEle0Type, AUTOMATIC) filterExtEle0;
    VAR(Can_FilterExtendedEle1Type, AUTOMATIC) filterExtEle1;
} Can_FilterExtendedEleType;

/**
 * @brief    Structure for for Filter configuration
 */
typedef struct
{
    /** Filter index */
    CONST(uint8, CAN_CONST) filterIndex;
    /** Filter Element Configuration */
    CONST(Can_FilterElementConfigType, CAN_CONST) elementConfig;
    /** Filter Type */
    CONST(Can_FilterActionType, CAN_CONST) filterAction;
    /** FID1 First ID of (standard / extended ID) filter element */
    CONST(uint32, CAN_CONST) id1;
    /** FID2 Second ID of (standard / extended ID) filter element */
    CONST(uint32, CAN_CONST) id2;
    /** Rx Buffers or FIFO 0 or combination Mode of reception */
    CONST(Can_RxBufIdType, CAN_CONST) rxBufferOffset;

#if (STD_ON == CAN_PUBLIC_ICOM_ENABLE)
    /** The message ID(standard / extended ID) is supported for ICOM support or not */
    boolean canIdPNSupport;
#endif
} Can_FilterEleType;

/**
 * @brief    Structure for Acceptance filter configuration
 */
typedef struct
{
    /** Message Id length (Standard / Extended) */
    CONST(Can_MsgIdLenType, CAN_CONST) msgIdLen;
    /** List Size Standard */
    CONST(uint8, CAN_CONST) standardListSize;
    /** List Size Extended */
    CONST(uint8, CAN_CONST) extendedListSize;
    /** Reject Remote Frames with Standard Id */
    CONST(boolean, CAN_CONST) rejectRemoteFramesWithStandardId;
    /** Reject Remote Frames with Extended Id */
    CONST(boolean, CAN_CONST) rejectRemoteFramesWithExtendedId;
    /** Action to be taken on the frames with ids, which are not matching with the filter */
    CONST(Can_NonMatFrameAccType, CAN_CONST) standardFilterForNonMatchingFrames;
    /** Action to be taken on the frames with ids, which are not matching with the filter */
    CONST(Can_NonMatFrameAccType, CAN_CONST) extendedFilterForNonMatchingFrames;
    /** Collection of standard id filters */
    P2CONST(Can_FilterEleType, CAN_CONST, CAN_APPL_CONST) standardFiltersPtr;
    /** Collection of extended id filters */
    P2CONST(Can_FilterEleType, CAN_CONST, CAN_APPL_CONST) extendedFiltersPtr;
} Can_FilterConfigType;

/**
 * @brief    Structure for Message RAM configuration
 */
typedef struct
{
    /** Start Address of Each Section with in the Message RAM:
    * 0: Standard ID Filter
    * 1: Extended ID Filter
    * 2: Rx FIFO 0
    * 3: Rx FIFO 1
    * 4: Rx Buffers
    * 5: Tx Buffers
    * 6: Tx Event FIFO
    */
    P2CONST(uint32, CAN_CONST, CAN_APPL_CONST) canControllerMsgRAMMapPtr;
    /** No of used Tx dedicated buffer */
    CONST(uint8, CAN_CONST) txDedBuffCount;
    /** Tx FIFO/Queue Size */
    CONST(uint8, CAN_CONST) txFifoQueueSize;
    /** TxEvent FIFO Size */
    CONST(uint8, CAN_CONST) txEvntFIFOSize;
#if (STD_ON == CAN_RXFIFO_ENABLE)
    /** RXFIFO0 Size */
    CONST(uint8, CAN_CONST) rxFIFO0Size;
    /** RXFIFO1 Size */
    CONST(uint8, CAN_CONST) rxFIFO1Size;
#endif
} Can_MessageRamConfigType;

/**
 * @brief    Structure for Interrupt configuration
 */
typedef struct
{
    /** Interrupt enable/Disable(one bit for each interrupt) */
    CONST(uint32, CAN_CONST) intEnBits;
    /** Interrupt line for each interrupts(one bit for each interrupt:0:line0, 1:line1) */
    CONST(uint32, CAN_CONST)  intLineBits;
    /** Interrupt line enable/Disable(only bit0 and bit1 are used) */
    CONST(uint32, CAN_CONST)  intLineEnBits;
} Can_InterruptConfigType;

/** 
 * @brief Structure for Rx handle Configuration
 */
typedef struct
{
    /** Rx Buffers or FIFO 0 or combination Mode of reception */
    CONST(Can_RxModeType, CAN_CONST) rxMode;
    /** Rx Buffer Data Field Size */
    CONST(Can_DataFieldSizeType, CAN_CONST) rxBufferDataFieldSize;
#if (STD_ON == CAN_RXFIFO_ENABLE)
    /** Rx FIFO 0 Data Field Size */
    CONST(Can_DataFieldSizeType, CAN_CONST) rxFifo0DataFieldSize;
    /** Rx FIFO 1 Data Field Size */
    CONST(Can_DataFieldSizeType, CAN_CONST) rxFifo1DataFieldSize;
    /** Rx FIFO 0 operating mode */
    CONST(Can_RxFifoModeType, CAN_CONST) rxFifo0OperatingMode;
    /** Rx FIFO 1 operating mode */
    CONST(Can_RxFifoModeType, CAN_CONST) rxFifo1OperatingMode;
    /** Rx FIFO 0 watermark level */
    CONST(uint8, CAN_CONST) rxFifo0WatermarkLevel;
    /** Rx FIFO 1 watermark level */
    CONST(uint8, CAN_CONST) rxFifo1WatermarkLevel;
#endif
} Can_RxConfigType;

/**
 * @brief    Notification configuration type
 */
typedef struct
{
#if (STD_ON == CAN_RXFIFO_MSG_LOST_NOTIFICATION_ENABLE)
    /** Rx Fifo 0 losts message notification function */
    CONST(Can_CallBackFunctionPtrType, CAN_CONST) rxFifo0LostMsgNotification;
    /** Rx Fifo 1 losts  message notification function */
    CONST(Can_CallBackFunctionPtrType, CAN_CONST) rxFifo1LostMsgNotification;
#endif

#if (STD_ON == CAN_TX_EVT_FIFO_LOST_ELE_NOTIFICATION_ENABLE)
    /** Tx Event Fifo losts member notification function */
    CONST(Can_CallBackFunctionPtrType, CAN_CONST) txEvtFifoLostMsgNotification;
#endif

#if (STD_ON == CAN_HIGH_PRIORITY_MSG_NOTIFICATION_ENABLE)
    /** High priority message notification function */
    CONST(Can_CallBackFunctionPtrType, CAN_CONST) highPriorityMsgNotification;
#endif

#if (STD_ON == CAN_TRANS_COMPLETE_NOTIFICATION_ENABLE)
    /** Transmission complete notification function */
    CONST(Can_CallBackFunctionPtrType, CAN_CONST) txCompleteNotification;
#endif

#if (STD_ON == CAN_CANCEL_FINISHED_NOTIFICATION_ENABLE)
    /** Transmission cancel finished notification function */
    CONST(Can_CallBackFunctionPtrType, CAN_CONST) txCancelFinishedNotification;
#endif

#if (STD_ON == CNA_TX_FIFO_EMPTY_NOTIFICATION_ENABLE)
    /** Tx Fifo empty notification function */
    CONST(Can_CallBackFunctionPtrType, CAN_CONST) txFifoEmptyNotification;
#endif

#if (STD_ON == CAN_TIMESTAMP_OVERFLOW_NOTIFICATION_ENABLE)
    /** Timestamp overflow notification function */
    CONST(Can_CallBackFunctionPtrType, CAN_CONST) timeStampOverFlowNotification;
#endif

#if (STD_ON == CAN_RAM_ACC_FAILED_NOTIFICATION_ENABLE)
    /** RAM access failure notification function */
    CONST(Can_CallBackFunctionPtrType, CAN_CONST) msgRamAccessFailureNotification;
#endif

#if (STD_ON == CAN_TIME_OVERFLOW_NOTIFICATION_ENABLE)
    /** Time overflow notification function */
    CONST(Can_CallBackFunctionPtrType, CAN_CONST) timeOverFlowNotification;
#endif

#if (STD_ON == CAN_ERROR_LOG_OVERFLOW_NOTIFICATION_ENABLE)
    /** Error log overflow notification function */
    CONST(Can_CallBackFunctionPtrType, CAN_CONST) errorLogOverFlowNotification;
#endif

#if (STD_ON == CAN_ERROR_PASSIVE_NOTIFICATION_ENABLE)
    /** Error passive notification function */
    CONST(Can_CallBackFunctionPtrType, CAN_CONST) errorPassiveNotification;
#endif

#if (STD_ON == CAN_ERROR_WARNING_NOTIFICATION_ENABLE)
    /** Error warning notification function */
    CONST(Can_CallBackFunctionPtrType, CAN_CONST) errorWarningNotification;
#endif

#if (STD_ON == CAN_WDG_NOTIFICATION_ENABLE)
    /** Watchdog notification function */
    CONST(Can_CallBackFunctionPtrType, CAN_CONST) watchdogNotification;
#endif

#if (STD_ON == CAN_PLROTOCOL_ERROR_ARB_NOTIFICATION_ENABLE)
    /** Protocol error arbitration notification function */
    CONST(Can_CallBackFunctionPtrType, CAN_CONST) protocolErrorArbNotification;
#endif

#if (STD_ON == CAN_PLROTOCOL_ERROR_DATA_NOTIFICATION_ENABLE)
    /** Protocol error data notification function */
    CONST(Can_CallBackFunctionPtrType, CAN_CONST) protocolErrorDataNotification;
#endif

#if (STD_ON == CAN_ACC_RESERVED_ADDR_NOTIFICATION_ENABLE)
    /** Access to reserved address notification function */
    CONST(Can_CallBackFunctionPtrType, CAN_CONST) accessReservedAddrNotification;
#endif

#if (STD_ON == CAN_WAKEUP_NOTIFICATION_ENABLE)
    /** Wakeup notification function */
    CONST(Can_CallBackFunctionPtrType, CAN_CONST) wakeupNotification;
#endif

#if (STD_ON == CAN_ECC_ERROR_NOTIFICATION_ENABLE)

#if (STD_ON == CAN_ECC_ERROR_CORRECT_NOTIFICATION_ENABLE)
    /** ECC Error notification function */
    CONST(Can_EccErrorNotifyFunctionType, CAN_CONST) eccErrorCorrectNotification;
#endif

#if (STD_ON == CAN_ECC_ERROR_UNCORRECT_NOTIFICATION_ENABLE)
    /** ECC Error notification function */
    CONST(Can_EccErrorNotifyFunctionType, CAN_CONST) eccErrorUnCorrectNotification;
#endif

#endif /* STD_ON == CAN_ECC_ERROR_NOTIFICATION_ENABLE */

}Can_NotificationConfigType;

/**
 * @brief    Information about a CAN controller
 */
typedef struct
{
    /** Max baudrate number */
    CONST(uint8, CAN_CONST) maxBaudrateCount;
    /** Default baudrate index */
    CONST(uint8, CAN_CONST) defaultBaudrateIndex;
    /** Pointer to the baudrate configurations */
    CONSTP2CONST(Can_BaudrateConfigType, CAN_CONST, CAN_APPL_CONST) baudrateConfigs;
    /** Pointer to the Tx message buffer configurations */
    P2CONST(Can_NotificationConfigType, CAN_CONST, CAN_APPL_CONST) notificationConfigPtr;
} Can_ControllerInfoType;

/**
 * @brief    Configuration of testing mode
 */
typedef struct
{
    /** Loopback mode enable status */
    CONST(boolean, CAN_CONST) loopbackModeEnable;
    /** Tx pin control status */
    CONST(Can_TestTxModeType, CAN_CONST) txPinControl;
} Can_TestConfigType;

/**
 * @brief    Configuration of timestamp counter
 */
typedef struct
{
    /** Timestamp counter operation mode */
    CONST(Can_TimestampOperModeType, CAN_CONST) timestampCnterOperMode;
    /** Timestamp counter prescaler */
    CONST(Can_TimestampPrescalerType, CAN_CONST) timestampCnterPscaler;
} Can_TimestampConfigType;

/**
 * @brief    Configuration of timeout counter
 */
typedef struct
{
    /** Timeout counter enable status */
    CONST(boolean, CAN_CONST) timeoutCnterEnable;
    /** Timeout counter operation mode */
    CONST(Can_TimeoutCnterOperModeType, CAN_CONST) timeoutCnterOperMode;
    /** Timeout Period */
    CONST(uint16, CAN_CONST) timeoutPeriod;
} Can_TimeoutCnterConfigType;

/**
 * @brief    Configuration of a CAN controller
 */
typedef struct
{
    /** Controller offset: CAN_A = 0 */
    CONST(uint8, CAN_CONST) controllerOffset;
    /** Test mode configuration */
    P2CONST(Can_TestConfigType, CAN_CONST, CAN_APPL_CONST) testConfigPtr;
    /** Timestamp counter configuration */
    P2CONST(Can_TimestampConfigType, CAN_CONST, CAN_APPL_CONST) timestampConfigPtr;
    /** Timeout counter configuration */
    P2CONST(Can_TimeoutCnterConfigType, CAN_CONST, CAN_APPL_CONST) timeoutCnterConfigPtr;
    /** CCCR:TXP/EFBI/PXHD/WMM/TEST/DAR/MON/ASM */
    CONST(uint32, CAN_CONST) controllerOptions;
    /** RWD Register:WDC */
    CONST(uint32, CAN_CONST) rwdOptions;

#if (STD_ON == CAN_PUBLIC_ICOM_ENABLE)
    /** If pretended networking is supported */
    CONST(boolean, CAN_CONST) pnSupported;
#endif
} Can_ControllerStaticConfigType;

#if (STD_ON == CAN_PUBLIC_ICOM_ENABLE)
/**
 * @brief    ICOM configuration data type
 */
typedef struct
{
    /** ICOM Message configuration ID */
    CONST(uint8, CAN_CONST) icomConfigId;
    /** ICOM Message configuration start index */
    CONST(uint16, CAN_CONST) icomFirstMsgIndx;
    /** No of ICOM Message configuration */
    CONST(uint16, CAN_CONST) icomNoOfMsgIndx;
    /** Bus off is configured as wakeup source */
    CONST(boolean, CAN_VAR) icomWakeOnBusOff;
} Can_IcomEleConfigType;

/**
 * @brief    ICOM message configuration data type
 */
typedef struct
{
    /** Icom Message ID */
    CONST(Can_IdType, CAN_VAR) icomMsgId;
    /** Icom Message ID Mask value */
    CONST(Can_IdType, CAN_VAR) icomMaskRef;
    /** Icom Message Counter value */
    CONST(uint16, CAN_CONST) icomCntrVal;
    /** Icom Message DLC value */
    CONST(uint8, CAN_CONST) icomDLC;
    /** Icom Message Signal/Data configuration Index value */
    CONST(uint8, CAN_CONST)  icomFirstSignalIndx;
    /** Number of Message Signal/Data configuration */
    CONST(uint8, CAN_CONST)  icomNoOfSignalIndx;
    /** DLC error configured as wakeup source or not */
    CONST(boolean, CAN_CONST) icomLengthErr;
} Can_IcomRxMsgConfigType;

/**
 * @brief    ICOM message signal configuration data type
 */
typedef struct
{
    /** Combination of Signal Mask value */
    CONST(uint8, CAN_CONST) icomSignalMask[CAN_ICOM_DATA_SIGNAL_MATCH_SIZE];
    /** Combination of Signal value */
    CONST(uint8, CAN_CONST) icomSignalValue[CAN_ICOM_DATA_SIGNAL_MATCH_SIZE];
    /** Operation selected for the Signal validation */
    CONST(Can_IcomSignalOperType, CAN_CONST)  icomSignalOper;
} Can_IcomRxMsgSignalConfigType;


/** 
 * @brief CAN Icom configurations
 */
typedef struct
{
    /** Number of Icom configurations */
    CONST(uint8, CAN_CONST) icomConfigsCount;
    /** Pointer to the ICOM configurations set */
    P2CONST(Can_IcomEleConfigType, CAN_CONST, CAN_APPL_CONST) icomSetConfigPtr;
    /** Pointer to the ICOM Rx message configurations */
    P2CONST(Can_IcomRxMsgConfigType, CAN_CONST, CAN_APPL_CONST) icomMsgConfigPtr;
    /** Pointer to the ICOM Rx message signal configurations */
    P2CONST(Can_IcomRxMsgSignalConfigType, CAN_CONST, CAN_APPL_CONST) icomRxSignalConfigPtr;
} Can_IcomConfigType;
#endif /* STD_ON == CAN_PUBLIC_ICOM_ENABLE */

/** 
 * @brief CAN Erm configurations
 */
typedef struct
{
    /** Erm control register value */
    CONST(uint32, CAN_CONST) ermControlReg;
}Can_ErmConfigType;

/** 
 * @brief CAN driver overall static configurations
 */
typedef struct
{
    /** How many CAN controllers configured */
    CONST(uint8, CAN_CONST) controllersConfigured;

    /** Pointer to the CAN controller configurations */
    P2CONST(Can_ControllerStaticConfigType, CAN_CONST, CAN_APPL_CONST) controllerStaticConfigPtr;

#if (STD_ON == CAN_PUBLIC_ICOM_ENABLE)
    /** The Icom configurations */
    P2CONST(Can_IcomConfigType, CAN_CONST, CAN_APPL_CONST) icomConfigPtr;
#endif /* STD_ON == CAN_PUBLIC_ICOM_ENABLE */
} Can_StaticConfigType;

/** 
 * @brief CAN driver overall configurations used by Can_Init()
 */
typedef struct
{
    /** Message RAM configuration(current only support one controller) */
    P2CONST(Can_MessageRamConfigType, CAN_CONST, CAN_APPL_CONST) msgRamConfigPtr;
    /** Filter configuration */
    P2CONST(Can_FilterConfigType, CAN_CONST, CAN_APPL_CONST) filterConfigPtr;
    /** Tx handle configuration */
    P2CONST(Can_TxConfigType, CAN_CONST, CAN_APPL_CONST) txConfigPtr;
    /** Rx handle configuration */
    P2CONST(Can_RxConfigType, CAN_CONST, CAN_APPL_CONST) rxConfigPtr;
    /** Tx message buffer configuration container */
    P2CONST(Can_TxMbConfigsContainerType, CAN_CONST, CAN_APPL_CONST) txMbConfigContainerPtr;
    /** Rx message buffer configuration container */
    P2CONST(Can_RxMbConfigsContainerType, CAN_CONST, CAN_APPL_CONST) rxMbConfigContainerPtr;
    /** Pointer to CAN controllers information */
    P2CONST(Can_ControllerInfoType, CAN_CONST, CAN_APPL_CONST) controllersInfoPtr;
    /** Interrupt configuration */
    P2CONST(Can_InterruptConfigType, CAN_CONST, CAN_APPL_CONST) interruptConfigPtr;
#if (STD_ON == CAN_ENABLE_ERM)
    /** Erm configuration */
    P2CONST(Can_ErmConfigType, CAN_CONST, CAN_APPL_CONST) ermConfigPtr;
#endif /* STD_ON == CAN_ENABLE_ERM */
} Can_ConfigType;

/**@} end of group CAN_Structure */
/** @defgroup CAN_Typedef
  @{
*/
typedef P2CONST(Can_ControllerInfoType, CAN_CONST, CAN_APPL_CONST) Can_ControllerInfoPtrType;
/**@} end of group CAN_Typedef */
/*******************************************************************************
                                GLOBAL VARIABLES
*******************************************************************************/
/** @defgroup CAN_Variable
  @{
*/
#define CAN_START_SEC_VAR_INIT_UNSPECIFIED
#include "Can_MemMap.h"

/** Pointer to CAN controllers information */
extern P2CONST(Can_ControllerInfoType, CAN_VAR, CAN_APPL_CONST) g_canControllersInfoPtr;

/** Pointer to CAN driver configuration */
extern P2CONST(Can_ConfigType, CAN_VAR, CAN_APPL_CONST) g_canConfigPtr;

/** Pointer to CAN driver static configuration */
extern P2CONST(Can_StaticConfigType, CAN_VAR, CAN_APPL_CONST) g_canStaticConfigPtr;

/** Pointer to CAN controller configurations */
extern P2CONST(Can_ControllerStaticConfigType, CAN_VAR, CAN_APPL_CONST) g_canControllerStaticConfigPtr;

/** CAN driver status: CAN_UNINIT or CAN_READY */
extern VAR(Can_DriverStatusType, CAN_VAR) g_canDriverStatus;

#define CAN_STOP_SEC_VAR_INIT_UNSPECIFIED
#include "Can_MemMap.h"

#define CAN_START_SEC_VAR_NO_INIT_UNSPECIFIED
#include "Can_MemMap.h"

/** Runtime status of the CAN controllers */
extern VAR(Can_ControllerStatusType, CAN_VAR) g_canControllerStatus[CAN_MAXCTRL_NUMBER_CFG];

#define CAN_STOP_SEC_VAR_NO_INIT_UNSPECIFIED
#include "Can_MemMap.h"
/**@} end of group CAN_Variable */
/*******************************************************************************
                            FUNCTION DECLARATIONS
*******************************************************************************/
/** @defgroup CAN_Fuctions
  @{
*/
#define CAN_START_SEC_CODE
#include "Can_MemMap.h"

#if (STD_ON == CAN_PUBLIC_ICOM_ENABLE)
FUNC(Std_ReturnType, CAN_CODE) Can_Hw_SetIcomConfig(
    CONST(uint8, AUTOMATIC) Controller,
    VAR(uint8, AUTOMATIC) IcomConfigIndex);
FUNC(Std_ReturnType, CAN_CODE) Can_Hw_DeactivateIcom(CONST(uint8, AUTOMATIC) Controller);
#endif /* STD_ON == CAN_PUBLIC_ICOM_ENABLE */

FUNC(void, CAN_CODE) Can_Hw_CancelPendingTx(CONST(uint8, AUTOMATIC) Controller);

#if (STD_OFF == CAN_RX_INTERRUPT_HANDLE_ENABLE)
FUNC(void, CAN_CODE) Can_Hw_MainFunctionRead(void);
FUNC(void, CAN_CODE) Can_Hw_MainFunctionMultipleRead(VAR(uint8, AUTOMATIC) PeriodRef);
#endif /* STD_OFF == CAN_RX_INTERRUPT_HANDLE_ENABLE */

#if (STD_OFF == CAN_TX_INTERRUPT_HANDLE_ENABLE)
FUNC(void, CAN_CODE) Can_Hw_MainFunctionWrite(void);
FUNC(void, CAN_CODE) Can_Hw_MainFunctionMultipleWrite(VAR(uint8, AUTOMATIC) PeriodRef);
#endif /* STD_OFF == CAN_TX_INTERRUPT_HANDLE_ENABLE */

#if (STD_ON == CAN_ABORT_MB_API_ENABLE)
FUNC(void, CAN_CODE) Can_Hw_AbortMb(VAR(Can_HwHandleType, AUTOMATIC) Hth);
#endif /* STD_ON == CAN_ABORT_MB_API_ENABLE */

#ifdef CAN_SET_BAUDRATE_API
#if (STD_ON == CAN_SET_BAUDRATE_API)
FUNC(void, CAN_CODE) Can_Hw_SetBaudrate(VAR(uint8, AUTOMATIC) Controller);
#endif /* STD_ON == CAN_SET_BAUDRATE_API */
#endif /* CAN_SET_BAUDRATE_API */

FUNC(void, CAN_CODE) Can_Hw_MainFunctionMode(void);

FUNC(void, CAN_CODE) Can_Hw_EnableControllerInterrupts(
    VAR(uint8, AUTOMATIC) Controller);

FUNC(void, CAN_CODE) Can_Hw_DisableControllerInterrupts(VAR(uint8, AUTOMATIC) Controller);

FUNC(Std_ReturnType, CAN_CODE) Can_Hw_InitController(VAR(uint8, AUTOMATIC) Controller);
FUNC(void, CAN_CODE) Can_Hw_DeInitController(VAR(uint8, AUTOMATIC) Controller);

FUNC(void, CAN_CODE) Can_Hw_InitVariables(void);

FUNC(Std_ReturnType, CAN_CODE) Can_Hw_Write(
    Can_HwHandleType Hth,
    P2CONST(Can_PduType, AUTOMATIC, CAN_APPL_CONST) PduInfoPtr);

FUNC(Std_ReturnType, CAN_CODE) Can_Hw_IsBusOff(VAR(uint8, AUTOMATIC) Controller);
FUNC(void, CAN_CODE) Can_Hw_BusOffHandler(CONST(uint8, AUTOMATIC) Controller);

FUNC(Can_ErrorStateType, CAN_CODE) Can_Hw_GetControllerErrorState(
    VAR(uint8, AUTOMATIC) Controller);

FUNC(Std_ReturnType, CAN_CODE) Can_Hw_SetControllerMode(
    VAR(uint8, AUTOMATIC) Controller,
    Can_ControllerStateType Transition, 
    VAR(boolean, AUTOMATIC) NotifyCanIf);

FUNC(void, CAN_CODE) Can_Hw_ReceiveHandler(CONST(uint8, AUTOMATIC) Controller,
    CONST(Can_RxDataCheckType, AUTOMATIC) CheckBuffType, CONST(boolean, AUTOMATIC) PriodicCheck,
    VAR(uint8, AUTOMATIC) PeriodRef);
FUNC(void, CAN_CODE) Can_Hw_TxEventHandler(CONST(uint8, AUTOMATIC) Controller);

#define CAN_STOP_SEC_CODE
#include "Can_MemMap.h"

/**@} end of group CAN_Fuctions */
#ifdef __cplusplus
}
#endif

#endif /* CAN_HW_H */
/**@} end of group CAN_Driver */
/**@} end of group G32A10xx_StdPeriphDriver */
