HPM SDK
HPMicro Software Development Kit
hpm_mcan_drv.h File Reference
#include "hpm_common.h"
#include "hpm_mcan_regs.h"
#include "hpm_mcan_soc.h"

Go to the source code of this file.

Data Structures

struct  mcan_bit_timing_param_struct
 CAN Bit Timing Parameters. More...
 
struct  mcan_tx_message_struct
 CAN Transmit Message Frame. More...
 
struct  mcan_rx_message_struct
 CAN Receive Message Frame. More...
 
union  mcan_tx_event_fifo_elem_struct
 TX Event Fifo Element Structure. More...
 
union  mcan_filter_config_struct
 MCAN Filter Configuration. More...
 
union  mcan_rxfifo_config_struct
 MCAN RXFIFO Configuration. More...
 
struct  mcan_rxbuf_config_t
 MCAN RXBUF Configuration. More...
 
union  mcan_rx_fifo_or_buf_elem_config_struct
 MCAN RXBUF or RXFIFO Element Configuration. More...
 
union  mcan_txbuf_config_struct
 
struct  mcan_txbuf_elem_config_struct
 
union  mcan_tx_evt_fifo_config_t
 MCAN TX Event FIFO Structure. More...
 
struct  mcan_ram_flexible_config_struct
 MCAN RAM Flexible Configuration. More...
 
struct  mcan_ram_config_struct
 MCAN RAM configuration. More...
 
struct  mcan_global_filter_config_struct
 MCAN Global CAN configuration. More...
 
struct  mcan_std_id_filter_elem_struct
 MCAN Filter Element definitions. More...
 
struct  mcan_filter_elem_list_struct
 MCAN Filter Element List structure. More...
 
struct  mcan_all_filters_config_struct
 MCAN Configuration for all filters. More...
 
struct  mcan_timestamp_value_struct
 MCAN Timestamp Value. More...
 
struct  mcan_tsu_config_struct
 MCAN TSU Configuration. More...
 
struct  mcan_internal_timestamp_config_struct
 MCAN Internal timestamp configuration. More...
 
struct  mcan_timeout_config_struct
 MCAN Timeout configuration structure. More...
 
struct  mcan_tdc_config_t
 MCAN Transmitter Delay Compensation Configuration. More...
 
struct  mcan_config_struct
 MCAN Configuration Structure. More...
 
struct  mcan_timeout_counter_config_struct
 MCAN Timeout Counter Configuration. More...
 
struct  mcan_error_count_struct
 MCAN Error Count Information. More...
 
struct  mcan_protocol_status
 MCAN Protocol Status. More...
 
struct  mcan_high_priority_message_status_struct
 MCAN High Priority Message Status Information. More...
 

Macros

#define MCAN_INT_ACCESS_TO_RESERVED_ADDR   MCAN_IR_ARA_MASK
 CAN Interrupt Mask. More...
 
#define MCAN_INT_PROTOCOL_ERR_IN_DATA_PHASE   MCAN_IR_PED_MASK
 
#define MCAN_INT_PROTOCOL_ERR_IN_ARB_PHASE   MCAN_IR_PEA_MASK
 
#define MCAN_INT_WATCHDOG_INT   MCAN_IR_WDI_MASK
 
#define MCAN_INT_BUS_OFF_STATUS   MCAN_IR_BO_MASK
 
#define MCAN_INT_WARNING_STATUS   MCAN_IR_EW_MASK
 
#define MCAN_INT_ERROR_PASSIVE   MCAN_IR_EP_MASK
 
#define MCAN_INT_ERROR_LOGGING_OVERFLOW   MCAN_IR_ELO_MASK
 
#define MCAN_INT_BIT_ERROR_UNCORRECTED   MCAN_IR_BEU_MASK
 
#define MCAN_INT_BIT_ERROR_CORRECTED   MCAN_IR_BEC_MASK
 
#define MCAN_INT_MSG_STORE_TO_RXBUF   MCAN_IR_DRX_MASK
 
#define MCAN_INT_TIMEOUT_OCCURRED   MCAN_IR_TOO_MASK
 
#define MCAN_INT_MSG_RAM_ACCESS_FAILURE   MCAN_IR_MRAF_MASK
 
#define MCAN_INT_TIMESTAMP_WRAPAROUND   MCAN_IR_TSW_MASK
 
#define MCAN_INT_TX_EVT_FIFO_EVT_LOST   MCAN_IR_TEFL_MASK
 
#define MCAN_INT_TX_EVT_FIFO_FULL   MCAN_IR_TEFF_MASK
 
#define MCAN_INT_TX_EVT_FIFO_WMK_REACHED   MCAN_IR_TEFW_MASK
 
#define MCAN_INT_TX_EVT_FIFO_NEW_ENTRY   MCAN_IR_TEFN_MASK
 
#define MCAN_INT_TXFIFO_EMPTY   MCAN_IR_TFE_MASK
 
#define MCAN_INT_TX_CANCEL_FINISHED   MCAN_IR_TCF_MASK
 
#define MCAN_INT_TX_COMPLETED   MCAN_IR_TC_MASK
 
#define MCAN_INT_HIGH_PRIORITY_MSG   MCAN_IR_HPM_MASK
 
#define MCAN_INT_RXFIFO1_MSG_LOST   MCAN_IR_RF1L_MASK
 
#define MCAN_INT_RXFIFO1_FULL   MCAN_IR_RF1F_MASK
 
#define MCAN_INT_RXFIFO1_WMK_REACHED   MCAN_IR_RF1W_MASK
 
#define MCAN_INT_RXFIFO1_NEW_MSG   MCAN_IR_RF1N_MASK
 
#define MCAN_INT_RXFIFO0_MSG_LOST   MCAN_IR_RF0L_MASK
 
#define MCAN_INT_RXFIFO0_FULL   MCAN_IR_RF0F_MASK
 
#define MCAN_INT_RXFIFO0_WMK_REACHED   MCAN_IR_RF0W_MASK
 
#define MCAN_INT_RXFIFO0_NEW_MSG   MCAN_IR_RF0N_MASK
 
#define MCAN_EVENT_RECEIVE   (MCAN_INT_RXFIFO0_NEW_MSG | MCAN_INT_RXFIFO1_NEW_MSG | MCAN_INT_MSG_STORE_TO_RXBUF)
 MCAN Receive Event Flags. More...
 
#define MCAN_EVENT_TRANSMIT   (MCAN_INT_TX_COMPLETED)
 MCAN Transmit Event Flags. More...
 
#define MCAN_EVENT_ERROR
 MCAN Error Event Flags. More...
 
#define MCAN_TX_RETRY_COUNT_MAX   (10000000UL)
 Maximum Transmission Retry Count. More...
 
#define MCAN_RX_RETRY_COUNT_MAX   (80000000UL)
 Maximum Receive Wait Retry Count. More...
 
#define MCAN_RAM_WORD_SIZE   (640U)
 
#define MCAN_FILTER_ELEM_STD_ID_SIZE   (4U)
 
#define MCAN_FILTER_ELEM_EXT_ID_SIZE   (8U)
 
#define MCAN_STD_FILTER_ELEM_SIZE_MAX   (128U)
 
#define MCAN_EXT_FILTER_ELEM_SIZE_MAX   (64U)
 
#define MCAN_TXRX_ELEM_SIZE_CAN_MAX   (4U * sizeof(uint32_t))
 
#define MCAN_FILTER_SIZE_CAN_DEFAULT   (32U)
 
#define MCAN_TXBUF_SIZE_CAN_DEFAULT   (32U)
 
#define MCAN_RXFIFO_SIZE_CAN_DEFAULT   (32U)
 
#define MCAN_RXBUF_SIZE_CAN_DEFAULT   (16U)
 
#define MCAN_TXRX_ELEM_SIZE_CANFD_MAX   (18U * sizeof(uint32_t))
 
#define MCAN_FILTER_SIZE_CANFD_DEFAULT   (16U)
 
#define MCAN_TXBUF_SIZE_CANFD_DEFAULT   (8U)
 
#define MCAN_RXFIFO_SIZE_CANFD_DEFAULT   (8U)
 
#define MCAN_RXBUF_SIZE_CANFD_DEFAULT   (4U)
 
#define MCAN_TXEVT_ELEM_SIZE   (8U)
 
#define MCAN_MESSAGE_HEADER_SIZE_IN_BYTES   (8U)
 CAN Message Header Size. More...
 
#define MCAN_MESSAGE_HEADER_SIZE_IN_WORDS   (2U)
 
#define MCAN_CAN_ID_TYPE_STANDARD   (0U)
 CAN Identifier Types. More...
 
#define MCAN_CAN_ID_TYPE_EXTENDED   (1U)
 
#define MCAN_DATA_FIELD_SIZE_8BYTES   (0U)
 MCAN Data Field Size Definitions. More...
 
#define MCAN_DATA_FIELD_SIZE_12BYTES   (1U)
 
#define MCAN_DATA_FIELD_SIZE_16BYTES   (2U)
 
#define MCAN_DATA_FIELD_SIZE_20BYTES   (3U)
 
#define MCAN_DATA_FIELD_SIZE_24BYTES   (4U)
 
#define MCAN_DATA_FIELD_SIZE_32BYTES   (5U)
 
#define MCAN_DATA_FIELD_SIZE_48BYTES   (6U)
 
#define MCAN_DATA_FIELD_SIZE_64BYTES   (7U)
 
#define MCAN_FIFO_OPERATION_MODE_BLOCKING   (0U)
 MCAN FIFO Operation Mode types. More...
 
#define MCAN_FIFO_OPERATION_MODE_OVERWRITE   (1U)
 
#define MCAN_TXBUF_OPERATION_MODE_FIFO   (0U)
 MCAN TXBUF operation mode types. More...
 
#define MCAN_TXBUF_OPERATION_MODE_QUEUE   (1U)
 
#define MCAN_ACCEPT_NON_MATCHING_FRAME_OPTION_IN_RXFIFO0   (0U)
 MCAN Accept Non-Matching Frame options. More...
 
#define MCAN_ACCEPT_NON_MATCHING_FRAME_OPTION_IN_RXFIFO1   (1U)
 
#define MCAN_ACCEPT_NON_MATCHING_FRAME_OPTION_REJECT   (2U)
 
#define MCAN_FILTER_TYPE_RANGE_FILTER   (0U)
 MCAN Filter type definitions. More...
 
#define MCAN_FILTER_TYPE_SPECIFIED_ID_FILTER   (1U)
 
#define MCAN_FILTER_TYPE_CLASSIC_FILTER   (2U)
 
#define MCAN_FILTER_TYPE_FILTER_DISABLED   (3U)
 
#define MCAN_FILTER_TYPE_DUAL_ID_EXT_FILTER_IGNORE_MASK
 
#define MCAN_FILTER_ELEM_CFG_DISABLED   (0)
 MCAN Filter Configuration Options. More...
 
#define MCAN_FILTER_ELEM_CFG_STORE_IN_RX_FIFO0_IF_MATCH   (1U)
 
#define MCAN_FILTER_ELEM_CFG_STORE_IN_RX_FIFO1_IF_MATCH   (2U)
 
#define MCAN_FILTER_ELEM_CFG_REJECT_ID_IF_MATCH   (3U)
 
#define MCAN_FILTER_ELEM_CFG_SET_PRIORITY_IF_MATCH   (4U)
 
#define MCAN_FILTER_ELEM_CFG_SET_PRIORITY_AND_STORE_IN_FIFO0_IF_MATCH   (5U)
 
#define MCAN_FILTER_ELEM_CFG_SET_PRIORITY_AND_STORE_IN_FIFO1_IF_MATCH   (6U)
 
#define MCAN_FILTER_ELEM_CFG_STORE_INTO_RX_BUFFER_OR_AS_DBG_MSG   (7U)
 
#define MCAN_TIMESTAMP_SEL_MIN   (0U)
 MCAN Timestamp Select. More...
 
#define MCAN_TIMESTAMP_SEL_VALUE_ALWAYS_ZERO   (0U)
 
#define MCAN_TIMESTAMP_SEL_VALUE_INCREMENT   (1U)
 
#define MCAN_TIMESTAMP_SEL_EXT_TS_VAL_USED   (2U)
 
#define MCAN_TIMESTAMP_SEL_MAX   (MCAN_TIMESTAMP_SEL_EXT_TS_VAL_USED)
 
#define MCAN_TIMEOUT_SEL_TYPE_CONTINUOUS_OPERATION   (0U)
 MCAN Timeout Selection Options. More...
 
#define MCAN_TIMEOUT_SEL_TYPE_TIMEOUT_CTRL_BY_TX_EVT_FIFO   (1U)
 
#define MCAN_TIMEOUT_SEL_TYPE_TIMEOUT_CTRL_BY_RX_FIFO0   (2U)
 
#define MCAN_TIMEOUT_SEL_TYPE_TIMEOUT_CTRL_BY_RX_FIFO1   (3U)
 
#define MCAN_MESSAGE_STORAGE_INDICATOR_NO_FIFO_SELECTED   (0U)
 MCAN Message Storage Indicator Types. More...
 
#define MCAN_MESSAGE_STORAGE_INDICATOR_FIFO_MESSAGE_LOST   (1U)
 
#define MCAN_MESSAGE_STORAGE_INDICATOR_RXFIFO0   (2U)
 
#define MCAN_MESSAGE_STORAGE_INDICATOR_RXFIFO1   (3U)
 

Typedefs

typedef enum mcan_last_error_code mcan_last_err_code_t
 MCAN Last Error Code. More...
 
typedef enum mcan_activity_enum mcan_activity_state_t
 MCAN Communication State. More...
 
typedef struct mcan_bit_timing_param_struct mcan_bit_timing_param_t
 CAN Bit Timing Parameters. More...
 
typedef enum mcan_bit_timing_option mcan_bit_timing_option_t
 CAN Bit Timing Options. More...
 
typedef struct mcan_tx_message_struct mcan_tx_frame_t
 CAN Transmit Message Frame. More...
 
typedef struct mcan_rx_message_struct mcan_rx_message_t
 CAN Receive Message Frame. More...
 
typedef union mcan_tx_event_fifo_elem_struct mcan_tx_event_fifo_elem_t
 TX Event Fifo Element Structure. More...
 
typedef union mcan_filter_config_struct mcan_filter_config_t
 MCAN Filter Configuration. More...
 
typedef union mcan_rxfifo_config_struct mcan_rxfifo_config_t
 MCAN RXFIFO Configuration. More...
 
typedef union mcan_rx_fifo_or_buf_elem_config_struct mcan_rx_fifo_or_buf_elem_config_t
 MCAN RXBUF or RXFIFO Element Configuration. More...
 
typedef union mcan_txbuf_config_struct mcan_txbuf_config_t
 
typedef struct mcan_txbuf_elem_config_struct mcan_txbuf_elem_config_t
 
typedef struct mcan_ram_flexible_config_struct mcan_ram_flexible_config_t
 MCAN RAM Flexible Configuration. More...
 
typedef struct mcan_ram_config_struct mcan_ram_config_t
 MCAN RAM configuration. More...
 
typedef struct mcan_global_filter_config_struct mcan_global_filter_config_t
 MCAN Global CAN configuration. More...
 
typedef struct mcan_std_id_filter_elem_struct mcan_filter_elem_t
 MCAN Filter Element definitions. More...
 
typedef struct mcan_filter_elem_list_struct mcan_filter_elem_list_t
 MCAN Filter Element List structure. More...
 
typedef struct mcan_all_filters_config_struct mcan_all_filters_config_t
 MCAN Configuration for all filters. More...
 
typedef enum mcan_node_mode_enum mcan_node_mode_t
 CAN Node Mode types. More...
 
typedef struct mcan_timestamp_value_struct mcan_timestamp_value_t
 MCAN Timestamp Value. More...
 
typedef struct mcan_tsu_config_struct mcan_tsu_config_t
 MCAN TSU Configuration. More...
 
typedef struct mcan_internal_timestamp_config_struct mcan_internal_timestamp_config_t
 MCAN Internal timestamp configuration. More...
 
typedef enum mcan_timeout_sel_enum mcan_timeout_sel_t
 MCAN Timeout Selection Options. More...
 
typedef struct mcan_timeout_config_struct mcan_timeout_config_t
 MCAN Timeout configuration structure. More...
 
typedef struct mcan_tdc_config_t mcan_tdc_config_t
 MCAN Transmitter Delay Compensation Configuration. More...
 
typedef struct mcan_config_struct mcan_config_t
 MCAN Configuration Structure. More...
 
typedef struct mcan_timeout_counter_config_struct mcan_timeout_counter_config_t
 MCAN Timeout Counter Configuration. More...
 
typedef struct mcan_error_count_struct mcan_error_count_t
 MCAN Error Count Information. More...
 
typedef struct mcan_protocol_status mcan_protocol_status_t
 MCAN Protocol Status. More...
 
typedef struct mcan_high_priority_message_status_struct mcan_high_priority_message_status_t
 MCAN High Priority Message Status Information. More...
 

Enumerations

enum  {
  status_mcan_filter_index_out_of_range = ((uint32_t)( status_group_mcan )*1000U + (uint32_t)( 0 )) , status_mcan_rxfifo_empty = ((uint32_t)( status_group_mcan )*1000U + (uint32_t)( 1 )) , status_mcan_rxfifo_full = ((uint32_t)( status_group_mcan )*1000U + (uint32_t)( 2 )) , status_mcan_txbuf_full = ((uint32_t)( status_group_mcan )*1000U + (uint32_t)( 3 )) ,
  status_mcan_txfifo_full = ((uint32_t)( status_group_mcan )*1000U + (uint32_t)( 4 )) , status_mcan_rxfifo0_busy = ((uint32_t)( status_group_mcan )*1000U + (uint32_t)( 5 )) , status_mcan_rxfifo1_busy = ((uint32_t)( status_group_mcan )*1000U + (uint32_t)( 6 )) , status_mcan_txbuf_index_out_of_range = ((uint32_t)( status_group_mcan )*1000U + (uint32_t)( 7 )) ,
  status_mcan_rxbuf_index_out_of_range = ((uint32_t)( status_group_mcan )*1000U + (uint32_t)( 8 )) , status_mcan_rxbuf_empty = ((uint32_t)( status_group_mcan )*1000U + (uint32_t)( 9 )) , status_mcan_tx_evt_fifo_empty = ((uint32_t)( status_group_mcan )*1000U + (uint32_t)( 10 )) , status_mcan_timestamp_not_exist = ((uint32_t)( status_group_mcan )*1000U + (uint32_t)( 11 )) ,
  status_mcan_ram_out_of_range = ((uint32_t)( status_group_mcan )*1000U + (uint32_t)( 12 )) , status_mcan_timeout = ((uint32_t)( status_group_mcan )*1000U + (uint32_t)( 13 )) , status_mcan_invalid_bit_timing = ((uint32_t)( status_group_mcan )*1000U + (uint32_t)( 14 ))
}
 
enum  mcan_last_error_code {
  mcan_last_error_code_no_error = 0 , mcan_last_error_code_stuff_error , mcan_last_error_code_format_error , mcan_last_error_code_ack_error ,
  mcan_last_error_code_bit1_error , mcan_last_error_code_bit0_error , mcan_last_error_code_crc_error , mcan_last_error_code_no_change
}
 MCAN Last Error Code. More...
 
enum  mcan_activity_enum { mcan_activity_sync = 0 , mcan_activity_idle , mcan_activity_receiver , mcan_activity_transmitter }
 MCAN Communication State. More...
 
enum  mcan_bit_timing_option { mcan_bit_timing_can2_0 , mcan_bit_timing_canfd_nominal , mcan_bit_timing_canfd_data }
 CAN Bit Timing Options. More...
 
enum  mcan_node_mode_enum { mcan_mode_normal = 0 , mcan_mode_loopback_internal = 1 , mcan_mode_loopback_external = 2 , mcan_mode_listen_only = 3 }
 CAN Node Mode types. More...
 
enum  mcan_timeout_sel_enum { mcan_timeout_continuous_operation = 0 , mcan_timeout_triggered_by_tx_evt_fifo = 1 , mcan_timeout_triggered_by_rx_fifo0 = 2 , mcan_timeout_triggered_by_rx_fifo1 = 3 }
 MCAN Timeout Selection Options. More...
 

Functions

static void mcan_enable_transmit_pause (MCAN_Type *ptr)
 Enable Transmit Pause. More...
 
static void mcan_disable_transmit_pause (MCAN_Type *ptr)
 Disable Transmit Pause. More...
 
static void mcan_enable_edge_filtering (MCAN_Type *ptr)
 Enable Edge Filtering. More...
 
static void mcan_disable_edge_filtering (MCAN_Type *ptr)
 Disable Edge Filtering. More...
 
static void mcan_enable_protocol_exception_handling (MCAN_Type *ptr)
 Enable Protocol Exception Handling. More...
 
static void mcan_disable_protocol_exception_handling (MCAN_Type *ptr)
 Disable Protocol Exception Handling. More...
 
static void mcan_enable_wide_message_marker (MCAN_Type *ptr)
 Enable Wide Message Marker. More...
 
static void mcan_disable_wide_message_marker (MCAN_Type *ptr)
 Disable Wide Message Marker. More...
 
static void mcan_enable_tsu (MCAN_Type *ptr)
 Enable External Timestamp Unit. More...
 
static void mcan_disable_tsu (MCAN_Type *ptr)
 Disable External Timestamp Unit. More...
 
static bool mcan_is_tsu_used (MCAN_Type *ptr)
 Check whether TSU is used. More...
 
static bool mcan_is_64bit_tsu_timestamp_used (MCAN_Type *ptr)
 Check whether 64-bit TSU timestamp is used. More...
 
static void mcan_enable_bitrate_switch (MCAN_Type *ptr)
 Enable Bit Rate Switch. More...
 
static void mcan_disable_bitrate_switch (MCAN_Type *ptr)
 Disable Bit Rate Switch. More...
 
static void mcan_enable_auto_retransmission (MCAN_Type *ptr)
 Enable Auto Retransmission. More...
 
static void mcan_disable_auto_retransmission (MCAN_Type *ptr)
 Disable Auto Transmission. More...
 
static void mcan_enable_bus_monitoring_mode (MCAN_Type *ptr)
 Enable Bus monitoring Mode. More...
 
static void mcan_stop_clock (MCAN_Type *ptr)
 Stop MCAN clock. More...
 
static void mcan_enable_clock (MCAN_Type *ptr)
 Enable MCAN clock. More...
 
static bool mcan_is_clock_enabled (MCAN_Type *ptr)
 
static void mcan_disable_bus_monitoring_mode (MCAN_Type *ptr)
 Disable Bus monitoring Mode. More...
 
static bool mcan_is_clock_stopped (MCAN_Type *ptr)
 Check whether CAN clock is stopped or not. More...
 
static void mcan_enable_restricted_operation_mode (MCAN_Type *ptr)
 Enable Restricted Operation Mode. More...
 
static void mcan_disable_restricted_operation_mode (MCAN_Type *ptr)
 Disable Restricted Operation Mode. More...
 
static void mcan_enable_write_to_prot_config_registers (MCAN_Type *ptr)
 Enable Write Access to Protected Configuration Registers. More...
 
static void mcan_disable_write_to_prot_config_registers (MCAN_Type *ptr)
 Disable Write Access to Protected Configuration Registers. More...
 
static uint16_t mcan_get_timestamp_counter_value (MCAN_Type *ptr)
 Get Timestamp Counter Value. More...
 
static void mcan_enter_init_mode (MCAN_Type *ptr)
 Switch MCAN to Initialization mode. More...
 
static void mcan_enter_normal_mode (MCAN_Type *ptr)
 Switch MCAN to Normal mode. More...
 
static uint16_t mcan_get_timeout_counter_value (MCAN_Type *ptr)
 Get Timeout value. More...
 
static void mcan_reset_timeout_counter_value (MCAN_Type *ptr)
 Reset Timeout counter value. More...
 
static void mcan_get_error_counter (MCAN_Type *ptr, mcan_error_count_t *err_cnt)
 Get Error Counter Information. More...
 
static uint8_t mcan_get_last_error_code (MCAN_Type *ptr)
 Get Last Error Code. More...
 
static uint8_t mcan_get_last_data_error_code (MCAN_Type *ptr)
 Get Last Data Phase Error Code. More...
 
static uint8_t mcan_get_activity (MCAN_Type *ptr)
 Get CAN Activity. More...
 
static bool mcan_is_in_err_passive_state (MCAN_Type *ptr)
 Check whether the CAN node is under error passive state. More...
 
static bool mcan_is_in_error_warning_state (MCAN_Type *ptr)
 Check whether the CAN mode is under Warning State. More...
 
static bool mcan_is_in_busoff_state (MCAN_Type *ptr)
 Check whether the CAN node is under Bus-off state. More...
 
static uint8_t mcan_get_data_phase_last_error_code (MCAN_Type *ptr)
 Get the Last Data Phase Error. More...
 
static bool mcan_is_error_state_indicator_flag_set_in_last_received_canfd_msg (MCAN_Type *ptr)
 Check Whether the Error Status Indicator Flag is set in the last received CANFD message. More...
 
static bool mcan_is_bitrate_switch_flag_set_in_last_received_canfd_msg (MCAN_Type *ptr)
 Check whether the Bitrate Switch Flag is set in the last received CANFD message. More...
 
static bool mcan_is_canfd_message_received (MCAN_Type *ptr)
 Check whether CANFD messages were received. More...
 
static bool mcan_is_protocol_exception_event_occurred (MCAN_Type *ptr)
 Check whether Protocol Exception Events were occurred. More...
 
static uint8_t mcan_get_transmitter_delay_compensation_value (MCAN_Type *ptr)
 Get the Transmitter Delay Compensation Value. More...
 
static uint32_t mcan_get_interrupt_flags (MCAN_Type *ptr)
 Get Interrupt Flags. More...
 
static void mcan_clear_interrupt_flags (MCAN_Type *ptr, uint32_t mask)
 Clear Interrupt Flags. More...
 
static void mcan_enable_interrupts (MCAN_Type *ptr, uint32_t mask)
 Enable Interrupts. More...
 
static void mcan_enable_txbuf_interrupt (MCAN_Type *ptr, uint32_t mask)
 Enable TXBUF Interrupt. More...
 
static void mcan_disable_txbuf_interrupt (MCAN_Type *ptr, uint32_t mask)
 Disable TXBUF Interrupt. More...
 
static void mcan_disable_interrupts (MCAN_Type *ptr, uint32_t mask)
 Disable Interrupts. More...
 
static void mcan_enable_txbuf_transmission_interrupt (MCAN_Type *ptr, uint32_t mask)
 Enable TXBUF Transmission interrupt. More...
 
static void mcan_disable_txbuf_transmission_interrupt (MCAN_Type *ptr, uint32_t mask)
 Disable TXBUF Transmission interrupt. More...
 
static void mcan_enable_txbuf_cancel_finish_interrupt (MCAN_Type *ptr, uint32_t mask)
 Enable TXBUF Cancellation Finish interrupt. More...
 
static void mcan_disable_txbuf_cancel_finish_interrupt (MCAN_Type *ptr, uint32_t mask)
 Disable TXBUF Cancellation Finish interrupt. More...
 
static void mcan_interrupt_line_select (MCAN_Type *ptr, uint32_t mask, uint8_t line_index)
 Select Interrupt Line. More...
 
static bool mcan_is_transmit_request_pending (MCAN_Type *ptr, uint32_t index)
 Check whether a TXFIFO/TXBUF transmission request is pending. More...
 
static bool mcan_is_txfifo_full (MCAN_Type *ptr)
 Check whether TXFIFO is full. More...
 
static uint32_t mcan_get_txfifo_put_index (MCAN_Type *ptr)
 Get the TXFIFO Put Index. More...
 
static void mcan_send_add_request (MCAN_Type *ptr, uint32_t index)
 Request A Transmission via specified TXBUF Index. More...
 
static void mcan_send_add_multiple_requests (MCAN_Type *ptr, uint32_t index_bitmask)
 Request several transmission via specified TXBUF/FIFO Bit masks MCAN IP will transmit data in the buffer if corresponding bit in index_bitmask is asserted. More...
 
static void mcan_cancel_tx_buf_send_request (MCAN_Type *ptr, uint32_t index)
 Cancel the TXBUF Send request. More...
 
static bool mcan_is_transmit_occurred (MCAN_Type *ptr, uint32_t index)
 Check whether the Transmission completed via specified TXBUF/TXFIFO. More...
 
static bool mcan_is_rxbuf_data_available (MCAN_Type *ptr, uint32_t index)
 Check Whether there are data available in specified RXBUF. More...
 
static void mcan_clear_rxbuf_data_available_flag (MCAN_Type *ptr, uint32_t index)
 Clear RXBUF Data available Flag for specified RXBUF. More...
 
static bool mcan_is_interrupt_flag_set (MCAN_Type *ptr, uint32_t mask)
 Check whether specified Interrupt is set. More...
 
static bool mcan_is_tsu_timestamp_available (MCAN_Type *ptr, uint32_t index)
 Check whether the TSU timestamp is available. More...
 
uint32_t mcan_read_32bit_tsu_timestamp (MCAN_Type *ptr, uint32_t index)
 Read 32bit Timestamp value from TSU. More...
 
uint64_t mcan_read_64bit_tsu_timestamp (MCAN_Type *ptr, uint32_t index)
 Read 64bit Timestamp value from TSU. More...
 
void mcan_get_high_priority_message_status (MCAN_Type *ptr, mcan_high_priority_message_status_t *status)
 Get High Priority Message Status. More...
 
void mcan_get_default_config (MCAN_Type *ptr, mcan_config_t *config)
 Get Default CAN configuration. More...
 
uint8_t mcan_get_message_size_from_dlc (uint8_t dlc)
 Get message Size from Data Length Code. More...
 
uint8_t mcan_get_data_field_size (uint8_t data_field_size_option)
 Get the Data field size from data field size option. More...
 
void mcan_get_default_ram_flexible_config (MCAN_Type *ptr, mcan_ram_flexible_config_t *ram_config, bool enable_canfd)
 Get Default Full MCAN RAM configuration If the device is configured as classic CAN node, the default CAN RAM settings are as below: More...
 
void mcan_get_default_ram_config (MCAN_Type *ptr, mcan_ram_config_t *simple_config, bool enable_canfd)
 Get Default MCAN RAM configuration If the device is configured as classic CAN node, the default CAN RAM settings are as below: More...
 
hpm_stat_t mcan_init (MCAN_Type *ptr, mcan_config_t *config, uint32_t src_clk_freq)
 Initialize CAN controller. More...
 
void mcan_deinit (MCAN_Type *ptr)
 De-Initialize CAN controller. More...
 
hpm_stat_t mcan_config_ram_with_flexible_config (MCAN_Type *ptr, mcan_ram_flexible_config_t *config)
 Configure MCAN RAM will Full RAM configuration. More...
 
hpm_stat_t mcan_config_ram (MCAN_Type *ptr, mcan_ram_config_t *config)
 Configure MCAN RAM will Simplified RAM configuration. More...
 
hpm_stat_t mcan_config_all_filters (MCAN_Type *ptr, mcan_all_filters_config_t *config)
 Configure All CAN filters. More...
 
hpm_stat_t mcan_config_transmitter_delay_compensation (MCAN_Type *ptr, mcan_tdc_config_t *config)
 Configure Transmitter Delay Compensation. More...
 
hpm_stat_t mcan_set_global_filter_config (MCAN_Type *ptr, mcan_global_filter_config_t *filter_config)
 Configure Global Filter. More...
 
hpm_stat_t mcan_set_filter_element (MCAN_Type *ptr, const mcan_filter_elem_t *filter_elem, uint32_t index)
 Set CAN filter element. More...
 
hpm_stat_t mcan_write_txbuf (MCAN_Type *ptr, uint32_t index, mcan_tx_frame_t *tx_frame)
 Write Frame to CAN TX Buffer. More...
 
hpm_stat_t mcan_write_txfifo (MCAN_Type *ptr, mcan_tx_frame_t *tx_frame)
 Write Frame CAN to TXFIFO. More...
 
hpm_stat_t mcan_read_rxbuf (MCAN_Type *ptr, uint32_t index, mcan_rx_message_t *rx_frame)
 Read message from CAN RXBUF. More...
 
hpm_stat_t mcan_read_rxfifo (MCAN_Type *ptr, uint32_t fifo_index, mcan_rx_message_t *rx_frame)
 Read message from CAN RXBUF. More...
 
hpm_stat_t mcan_read_tx_evt_fifo (MCAN_Type *ptr, mcan_tx_event_fifo_elem_t *tx_evt)
 Read TX Event from CAN TX EVENT FIFO. More...
 
hpm_stat_t mcan_transmit_blocking (MCAN_Type *ptr, mcan_tx_frame_t *tx_frame)
 Transmit CAN message in blocking way. More...
 
hpm_stat_t mcan_request_and_fill_txfifo (MCAN_Type *ptr, mcan_tx_frame_t *tx_frame, uint32_t *fifo_index)
 Request TXFIFO and fill data into TXFIFO. More...
 
hpm_stat_t mcan_transmit_via_txfifo_nonblocking (MCAN_Type *ptr, mcan_tx_frame_t *tx_frame, uint32_t *fifo_index)
 Transmit CAN message via TX FIFO in non-blocking way. More...
 
hpm_stat_t mcan_transmit_via_txbuf_nonblocking (MCAN_Type *ptr, uint32_t index, mcan_tx_frame_t *tx_frame)
 Transmit CAN message via TX in non-blocking way. More...
 
hpm_stat_t mcan_receive_from_buf_blocking (MCAN_Type *ptr, uint32_t index, mcan_rx_message_t *rx_frame)
 Receive CAN Frame from RXBUF in blocking way. More...
 
hpm_stat_t mcan_receive_from_fifo_blocking (MCAN_Type *ptr, uint32_t fifo_index, mcan_rx_message_t *rx_frame)
 Receive CAN Frame from RXFIFO in blocking way. More...
 
hpm_stat_t mcan_get_timestamp_from_tx_event (MCAN_Type *ptr, const mcan_tx_event_fifo_elem_t *tx_evt, mcan_timestamp_value_t *timestamp)
 Get Timestamp from MCAN TX Event. More...
 
hpm_stat_t mcan_get_timestamp_from_received_message (MCAN_Type *ptr, const mcan_rx_message_t *rx_msg, mcan_timestamp_value_t *timestamp)
 Get Timestamp from MCAN RX frame. More...
 
hpm_stat_t mcan_parse_protocol_status (uint32_t psr, mcan_protocol_status_t *protocol_status)
 Parse the Protocol Status register value. More...
 
hpm_stat_t mcan_get_protocol_status (MCAN_Type *ptr, mcan_protocol_status_t *protocol_status)
 Get MCAN Protocol Status. More...