Microchip® Advanced Software Framework

can.h File Reference

SAM Control Area Network (CAN) Low Level Driver.

Copyright (c) 2015-2018 Microchip Technology Inc. and its subsidiaries.

#include <compiler.h>
#include <system.h>
#include <conf_can.h>

Data Structures

struct  can_config
 CAN configuration structure. More...
 
struct  can_extended_message_filter_element
 CAN extended message ID filter element structure. More...
 
union  CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_Type
 
union  CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_Type
 
struct  can_module
 CAN software device instance structure. More...
 
struct  can_rx_element_buffer
 CAN receive element structure for buffer. More...
 
struct  can_rx_element_fifo_0
 CAN receive element structure for FIFO 0. More...
 
struct  can_rx_element_fifo_1
 CAN receive element structure for FIFO 1. More...
 
union  CAN_RX_ELEMENT_R0_Type
 
union  CAN_RX_ELEMENT_R1_Type
 
struct  can_standard_message_filter_element
 CAN standard message ID filter element structure. More...
 
union  CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_Type
 
struct  can_tx_element
 CAN transfer element structure. More...
 
union  CAN_TX_ELEMENT_T0_Type
 
union  CAN_TX_ELEMENT_T1_Type
 
struct  can_tx_event_element
 CAN transfer event FIFO element structure. More...
 
union  CAN_TX_EVENT_ELEMENT_E0_Type
 
union  CAN_TX_EVENT_ELEMENT_E1_Type
 

Macros

Message RAM
#define CAN_RX_ELEMENT_R0_ID_Pos   0
 
#define CAN_RX_ELEMENT_R0_ID_Msk   (0x1FFFFFFFul << CAN_RX_ELEMENT_R0_ID_Pos)
 
#define CAN_RX_ELEMENT_R0_ID(value)   ((CAN_RX_ELEMENT_R0_ID_Msk & ((value) << CAN_RX_ELEMENT_R0_ID_Pos)))
 
#define CAN_RX_ELEMENT_R0_RTR_Pos   29
 
#define CAN_RX_ELEMENT_R0_RTR   (0x1ul << CAN_RX_ELEMENT_R0_RTR_Pos)
 
#define CAN_RX_ELEMENT_R0_XTD_Pos   30
 
#define CAN_RX_ELEMENT_R0_XTD   (0x1ul << CAN_RX_ELEMENT_R0_XTD_Pos)
 
#define CAN_RX_ELEMENT_R0_ESI_Pos   31
 
#define CAN_RX_ELEMENT_R0_ESI   (0x1ul << CAN_RX_ELEMENT_R0_ESI_Pos)
 
#define CAN_RX_ELEMENT_R1_RXTS_Pos   0
 
#define CAN_RX_ELEMENT_R1_RXTS_Msk   (0xFFFFul << CAN_RX_ELEMENT_R1_RXTS_Pos)
 
#define CAN_RX_ELEMENT_R1_RXTS(value)   ((CAN_RX_ELEMENT_R1_RXTS_Msk & ((value) << CAN_RX_ELEMENT_R1_RXTS_Pos)))
 
#define CAN_RX_ELEMENT_R1_DLC_Pos   16
 
#define CAN_RX_ELEMENT_R1_DLC_Msk   (0xFul << CAN_RX_ELEMENT_R1_DLC_Pos)
 
#define CAN_RX_ELEMENT_R1_DLC(value)   ((CAN_RX_ELEMENT_R1_DLC_Msk & ((value) << CAN_RX_ELEMENT_R1_DLC_Pos)))
 
#define CAN_RX_ELEMENT_R1_BRS_Pos   20
 
#define CAN_RX_ELEMENT_R1_BRS   (0x1ul << CAN_RX_ELEMENT_R1_BRS_Pos)
 
#define CAN_RX_ELEMENT_R1_FDF_Pos   21
 
#define CAN_RX_ELEMENT_R1_FDF   (0x1ul << CAN_RX_ELEMENT_R1_FDF_Pos)
 
#define CAN_RX_ELEMENT_R1_FIDX_Pos   24
 
#define CAN_RX_ELEMENT_R1_FIDX_Msk   (0x7Ful << CAN_RX_ELEMENT_R1_FIDX_Pos)
 
#define CAN_RX_ELEMENT_R1_FIDX(value)   ((CAN_RX_ELEMENT_R1_FIDX_Msk & ((value) << CAN_RX_ELEMENT_R1_FIDX_Pos)))
 
#define CAN_RX_ELEMENT_R1_ANMF_Pos   31
 
#define CAN_RX_ELEMENT_R1_ANMF   (0x1ul << CAN_RX_ELEMENT_R1_ANMF_Pos)
 
#define CAN_TX_ELEMENT_T0_EXTENDED_ID_Pos   0
 
#define CAN_TX_ELEMENT_T0_EXTENDED_ID_Msk   (0x1FFFFFFFul << CAN_TX_ELEMENT_T0_EXTENDED_ID_Pos)
 
#define CAN_TX_ELEMENT_T0_EXTENDED_ID(value)   ((CAN_TX_ELEMENT_T0_EXTENDED_ID_Msk & ((value) << CAN_TX_ELEMENT_T0_EXTENDED_ID_Pos)))
 
#define CAN_TX_ELEMENT_T0_STANDARD_ID_Pos   18
 
#define CAN_TX_ELEMENT_T0_STANDARD_ID_Msk   (0x7FFul << CAN_TX_ELEMENT_T0_STANDARD_ID_Pos)
 
#define CAN_TX_ELEMENT_T0_STANDARD_ID(value)   ((CAN_TX_ELEMENT_T0_STANDARD_ID_Msk & ((value) << CAN_TX_ELEMENT_T0_STANDARD_ID_Pos)))
 
#define CAN_TX_ELEMENT_T0_RTR_Pos   29
 
#define CAN_TX_ELEMENT_T0_RTR   (0x1ul << CAN_TX_ELEMENT_T0_RTR_Pos)
 
#define CAN_TX_ELEMENT_T0_XTD_Pos   30
 
#define CAN_TX_ELEMENT_T0_XTD   (0x1ul << CAN_TX_ELEMENT_T0_XTD_Pos)
 
#define CAN_TX_ELEMENT_T0_ESI_Pos   31
 
#define CAN_TX_ELEMENT_T0_ESI   (0x1ul << CAN_TX_ELEMENT_T0_ESI_Pos)
 
#define CAN_TX_ELEMENT_T1_DLC_Pos   16
 
#define CAN_TX_ELEMENT_T1_DLC_Msk   (0xFul << CAN_TX_ELEMENT_T1_DLC_Pos)
 
#define CAN_TX_ELEMENT_T1_DLC(value)   ((CAN_TX_ELEMENT_T1_DLC_Msk & ((value) << CAN_TX_ELEMENT_T1_DLC_Pos)))
 
#define CAN_TX_ELEMENT_T1_DLC_DATA8_Val   0x8ul
 (CAN_RXESC) 8 byte data field More...
 
#define CAN_TX_ELEMENT_T1_DLC_DATA12_Val   0x9ul
 (CAN_RXESC) 12 byte data field More...
 
#define CAN_TX_ELEMENT_T1_DLC_DATA16_Val   0xAul
 (CAN_RXESC) 16 byte data field More...
 
#define CAN_TX_ELEMENT_T1_DLC_DATA20_Val   0xBul
 (CAN_RXESC) 20 byte data field More...
 
#define CAN_TX_ELEMENT_T1_DLC_DATA24_Val   0xCul
 (CAN_RXESC) 24 byte data field More...
 
#define CAN_TX_ELEMENT_T1_DLC_DATA32_Val   0xDul
 (CAN_RXESC) 32 byte data field More...
 
#define CAN_TX_ELEMENT_T1_DLC_DATA48_Val   0xEul
 (CAN_RXESC) 48 byte data field More...
 
#define CAN_TX_ELEMENT_T1_DLC_DATA64_Val   0xFul
 (CAN_RXESC) 64 byte data field More...
 
#define CAN_TX_ELEMENT_T1_BRS_Pos   20
 
#define CAN_TX_ELEMENT_T1_BRS   (0x1ul << CAN_TX_ELEMENT_T1_BRS_Pos)
 
#define CAN_TX_ELEMENT_T1_FDF_Pos   21
 
#define CAN_TX_ELEMENT_T1_FDF   (0x1ul << CAN_TX_ELEMENT_T1_FDF_Pos)
 
#define CAN_TX_ELEMENT_T1_EFC_Pos   23
 
#define CAN_TX_ELEMENT_T1_EFC   (0x1ul << CAN_TX_ELEMENT_T1_EFC_Pos)
 
#define CAN_TX_ELEMENT_T1_MM_Pos   24
 
#define CAN_TX_ELEMENT_T1_MM_Msk   (0xFFul << CAN_TX_ELEMENT_T1_MM_Pos)
 
#define CAN_TX_ELEMENT_T1_MM(value)   ((CAN_TX_ELEMENT_T1_MM_Msk & ((value) << CAN_TX_ELEMENT_T1_MM_Pos)))
 
#define CAN_TX_EVENT_ELEMENT_E0_ID_Pos   0
 
#define CAN_TX_EVENT_ELEMENT_E0_ID_Msk   (0x1FFFFFFFul << CAN_TX_EVENT_ELEMENT_E0_ID_Pos)
 
#define CAN_TX_EVENT_ELEMENT_E0_ID(value)   ((CAN_TX_EVENT_ELEMENT_E0_ID_Msk & ((value) << CAN_TX_EVENT_ELEMENT_E0_ID_Pos)))
 
#define CAN_TX_EVENT_ELEMENT_E0_RTR_Pos   29
 
#define CAN_TX_EVENT_ELEMENT_E0_RTR   (0x1ul << CAN_TX_EVENT_ELEMENT_E0_RTR_Pos)
 
#define CAN_TX_EVENT_ELEMENT_E0_XTD_Pos   30
 
#define CAN_TX_EVENT_ELEMENT_E0_XTD   (0x1ul << CAN_TX_EVENT_ELEMENT_E0_XTD_Pos)
 
#define CAN_TX_EVENT_ELEMENT_E0_ESI_Pos   31
 
#define CAN_TX_EVENT_ELEMENT_E0_ESI   (0x1ul << CAN_TX_EVENT_ELEMENT_E0_ESI_Pos)
 
#define CAN_TX_EVENT_ELEMENT_E1_TXTS_Pos   0
 
#define CAN_TX_EVENT_ELEMENT_E1_TXTS_Msk   (0xFFFFul << CAN_TX_EVENT_ELEMENT_E1_TXTS_Pos)
 
#define CAN_TX_EVENT_ELEMENT_E1_TXTS(value)   ((CAN_TX_EVENT_ELEMENT_E1_TXTS_Msk & ((value) << CAN_TX_EVENT_ELEMENT_E1_TXTS_Pos)))
 
#define CAN_TX_EVENT_ELEMENT_E1_DLC_Pos   16
 
#define CAN_TX_EVENT_ELEMENT_E1_DLC_Msk   (0xFul << CAN_TX_EVENT_ELEMENT_E1_DLC_Pos)
 
#define CAN_TX_EVENT_ELEMENT_E1_DLC(value)   ((CAN_TX_EVENT_ELEMENT_E1_DLC_Msk & ((value) << CAN_TX_EVENT_ELEMENT_E1_DLC_Pos)))
 
#define CAN_TX_EVENT_ELEMENT_E1_BRS_Pos   20
 
#define CAN_TX_EVENT_ELEMENT_E1_BRS   (0x1ul << CAN_TX_EVENT_ELEMENT_E1_BRS_Pos)
 
#define CAN_TX_EVENT_ELEMENT_E1_FDF_Pos   21
 
#define CAN_TX_EVENT_ELEMENT_E1_FDF   (0x1ul << CAN_TX_EVENT_ELEMENT_E1_FDF_Pos)
 
#define CAN_TX_EVENT_ELEMENT_E1_ET_Pos   22
 
#define CAN_TX_EVENT_ELEMENT_E1_ET_Msk   (0x3ul << CAN_TX_EVENT_ELEMENT_E1_ET_Pos)
 
#define CAN_TX_EVENT_ELEMENT_E1_ET(value)   ((CAN_TX_EVENT_ELEMENT_E1_ET_Msk & ((value) << CAN_TX_EVENT_ELEMENT_E1_ET_Pos)))
 
#define CAN_TX_EVENT_ELEMENT_E1_MM_Pos   24
 
#define CAN_TX_EVENT_ELEMENT_E1_MM_Msk   (0xFFul << CAN_TX_EVENT_ELEMENT_E1_MM_Pos)
 
#define CAN_TX_EVENT_ELEMENT_E1_MM(value)   ((CAN_TX_EVENT_ELEMENT_E1_MM_Msk & ((value) << CAN_TX_EVENT_ELEMENT_E1_MM_Pos)))
 
#define CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFID2_Pos   0
 
#define CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFID2_Msk   (0x7FFul << CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFID2_Pos)
 
#define CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFID2(value)   ((CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFID2_Msk & ((value) << CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFID2_Pos)))
 
#define CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFID1_Pos   16
 
#define CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFID1_Msk   (0x7FFul << CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFID1_Pos)
 
#define CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFID1(value)   ((CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFID1_Msk & ((value) << CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFID1_Pos)))
 
#define CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFEC_Pos   27
 
#define CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFEC_Msk   (0x7ul << CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFEC_Pos)
 
#define CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFEC(value)   ((CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFEC_Msk & ((value) << CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFEC_Pos)))
 
#define CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFEC_DISABLE_Val   0
 
#define CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFEC_STF0M_Val   1
 
#define CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFEC_STF1M_Val   2
 
#define CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFEC_REJECT_Val   3
 
#define CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFEC_PRIORITY_Val   4
 
#define CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFEC_PRIF0M_Val   5
 
#define CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFEC_PRIF1M_Val   6
 
#define CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFEC_STRXBUF_Val   7
 
#define CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFT_Pos   30
 
#define CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFT_Msk   (0x3ul << CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFT_Pos)
 
#define CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFT(value)   ((CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFT_Msk & ((value) << CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFT_Pos)))
 
#define CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFT_RANGE   CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFT(0)
 
#define CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFT_DUAL   CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFT(1)
 
#define CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFT_CLASSIC   CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFT(2)
 
#define CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_EFID1_Pos   0
 
#define CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_EFID1_Msk   (0x1FFFFFFFul << CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_EFID1_Pos)
 
#define CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_EFID1(value)   ((CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_EFID1_Msk & ((value) << CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_EFID1_Pos)))
 
#define CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_EFEC_Pos   29
 
#define CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_EFEC_Msk   (0x7ul << CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_EFEC_Pos)
 
#define CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_EFEC(value)   ((CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_EFEC_Msk & ((value) << CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_EFEC_Pos)))
 
#define CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_EFEC_DISABLE_Val   0
 
#define CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_EFEC_STF0M_Val   1
 
#define CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_EFEC_STF1M_Val   2
 
#define CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_EFEC_REJECT_Val   3
 
#define CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_EFEC_PRIORITY_Val   4
 
#define CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_EFEC_PRIF0M_Val   5
 
#define CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_EFEC_PRIF1M_Val   6
 
#define CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_EFEC_STRXBUF_Val   7
 
#define CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_EFID2_Pos   0
 
#define CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_EFID2_Msk   (0x1FFFFFFFul << CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_EFID2_Pos)
 
#define CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_EFID2(value)   ((CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_EFID2_Msk & ((value) << CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_EFID2_Pos)))
 
#define CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_EFT_Pos   30
 
#define CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_EFT_Msk   (0x3ul << CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_EFT_Pos)
 
#define CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_EFT(value)   ((CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_EFT_Msk & ((value) << CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_EFT_Pos)))
 
#define CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_EFT_RANGEM   CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_EFT(0)
 
#define CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_EFT_DUAL   CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_EFT(1)
 
#define CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_EFT_CLASSIC   CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_EFT(2)
 
#define CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_EFT_RANGE   CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_EFT(3)
 

Functions

Rx Handling
static uint32_t can_read_high_priority_message_status (struct can_module *const module_inst)
 Read high priority message status. More...
 
static bool can_rx_get_buffer_status (struct can_module *const module_inst, uint32_t index)
 Get Rx buffer status. More...
 
static void can_rx_clear_buffer_status (struct can_module *const module_inst, uint32_t index)
 Clear Rx buffer status. More...
 
static uint32_t can_rx_get_fifo_status (struct can_module *const module_inst, bool fifo_number)
 Get Rx FIFO status. More...
 
static void can_rx_fifo_acknowledge (struct can_module *const module_inst, bool fifo_number, uint32_t index)
 Set Rx acknowledge. More...
 
static void can_get_standard_message_filter_element_default (struct can_standard_message_filter_element *sd_filter)
 Get the standard message filter default value. More...
 
enum status_code can_set_rx_standard_filter (struct can_module *const module_inst, struct can_standard_message_filter_element *sd_filter, uint32_t index)
 Set the standard message filter. More...
 
static void can_get_extended_message_filter_element_default (struct can_extended_message_filter_element *et_filter)
 Get the extended message filter default value. More...
 
enum status_code can_set_rx_extended_filter (struct can_module *const module_inst, struct can_extended_message_filter_element *et_filter, uint32_t index)
 Set the extended message filter. More...
 
enum status_code can_get_rx_buffer_element (struct can_module *const module_inst, struct can_rx_element_buffer *rx_element, uint32_t index)
 Get the pointer to the receive buffer element. More...
 
enum status_code can_get_rx_fifo_0_element (struct can_module *const module_inst, struct can_rx_element_fifo_0 *rx_element, uint32_t index)
 Get the pointer to the receive FIFO 0 element. More...
 
enum status_code can_get_rx_fifo_1_element (struct can_module *const module_inst, struct can_rx_element_fifo_1 *rx_element, uint32_t index)
 Get the pointer to the receive FIFO 1 element. More...
 
Tx Handling
static uint32_t can_tx_get_fifo_queue_status (struct can_module *const module_inst)
 Get Tx FIFO/Queue status. More...
 
static uint32_t can_tx_get_pending_status (struct can_module *const module_inst)
 Get Tx buffer request pending status. More...
 
static enum status_code can_tx_transfer_request (struct can_module *const module_inst, uint32_t trig_mask)
 Tx buffer add transfer request. More...
 
static enum status_code can_tx_cancel_request (struct can_module *const module_inst, uint32_t trig_mask)
 Set Tx Queue operation. More...
 
static uint32_t can_tx_get_transmission_status (struct can_module *const module_inst)
 Get Tx transmission status. More...
 
static uint32_t can_tx_get_cancellation_status (struct can_module *const module_inst)
 Get Tx cancellation status. More...
 
static uint32_t can_tx_get_event_fifo_status (struct can_module *const module_inst)
 Get Tx event FIFO status. More...
 
static void can_tx_event_fifo_acknowledge (struct can_module *const module_inst, uint32_t index)
 Set Tx Queue operation. More...
 
static void can_get_tx_buffer_element_defaults (struct can_tx_element *tx_element)
 Get the default transfer buffer element. More...
 
enum status_code can_set_tx_buffer_element (struct can_module *const module_inst, struct can_tx_element *tx_element, uint32_t index)
 Set the transfer buffer element. More...
 
enum status_code can_get_tx_event_fifo_element (struct can_module *const module_inst, struct can_tx_event_element *tx_event_element, uint32_t index)
 Get the pointer to the transfer event FIFO element. More...
 

Module Setting

enum  can_timeout_mode {
  CAN_TIMEOUT_CONTINUES = CAN_TOCC_TOS_CONT,
  CAN_TIMEOUT_TX_EVEN_FIFO = CAN_TOCC_TOS_TXEF,
  CAN_TIMEOUT_RX_FIFO_0 = CAN_TOCC_TOS_RXF0,
  CAN_TIMEOUT_RX_FIFO_1 = CAN_TOCC_TOS_RXF1
}
 Can time out modes. More...
 
enum  can_nonmatching_frames_action {
  CAN_NONMATCHING_FRAMES_FIFO_0,
  CAN_NONMATCHING_FRAMES_FIFO_1,
  CAN_NONMATCHING_FRAMES_REJECT
}
 Can nonmatching frames action. More...
 
static void can_get_config_defaults (struct can_config *const config)
 Initializes an CAN configuration structure to defaults. More...
 
void can_init (struct can_module *const module_inst, Can *hw, struct can_config *config)
 Initializes CAN module. More...
 
void can_set_baudrate (Can *hw, uint32_t baudrate)
 Set CAN baudrate. More...
 
void can_fd_set_baudrate (Can *hw, uint32_t baudrate)
 Set CAN_FD baudrate. More...
 
void can_start (struct can_module *const module_inst)
 Start CAN module communication. More...
 
void can_stop (struct can_module *const module_inst)
 Stop CAN module communication. More...
 
void can_enable_fd_mode (struct can_module *const module_inst)
 Enable CAN FD mode. More...
 
void can_disable_fd_mode (struct can_module *const module_inst)
 Disable CAN FD mode. More...
 
void can_enable_restricted_operation_mode (struct can_module *const module_inst)
 Enable CAN restricted operation mode. More...
 
void can_disable_restricted_operation_mode (struct can_module *const module_inst)
 Disable CAN restricted operation mode. More...
 
void can_enable_bus_monitor_mode (struct can_module *const module_inst)
 Enable CAN bus monitor mode. More...
 
void can_disable_bus_monitor_mode (struct can_module *const module_inst)
 Disable CAN bus monitor mode. More...
 
void can_enable_sleep_mode (struct can_module *const module_inst)
 Enable CAN sleep mode. More...
 
void can_disable_sleep_mode (struct can_module *const module_inst)
 Disable CAN sleep mode. More...
 
void can_enable_test_mode (struct can_module *const module_inst)
 Enable CAN test mode. More...
 
void can_disable_test_mode (struct can_module *const module_inst)
 Disable CAN test mode. More...
 
static uint16_t can_read_timestamp_count_value (struct can_module *const module_inst)
 Can read timestamp count value. More...
 
static uint16_t can_read_timeout_count_value (struct can_module *const module_inst)
 Can read timeout count value. More...
 
static uint32_t can_read_error_count (struct can_module *const module_inst)
 Can read error count. More...
 
static uint32_t can_read_protocal_status (struct can_module *const module_inst)
 Can read protocol status. More...
 

Interrupt Handling

enum  can_interrupt_source {
  CAN_RX_FIFO_0_NEW_MESSAGE = CAN_IE_RF0NE,
  CAN_RX_FIFO_0_WATERMARK = CAN_IE_RF0WE,
  CAN_RX_FIFO_0_FULL = CAN_IE_RF0FE,
  CAN_RX_FIFO_0_LOST_MESSAGE = CAN_IE_RF0LE,
  CAN_RX_FIFO_1_NEW_MESSAGE = CAN_IE_RF1NE,
  CAN_RX_FIFO_1_WATERMARK = CAN_IE_RF1WE,
  CAN_RX_FIFO_1_FULL = CAN_IE_RF1FE,
  CAN_RX_FIFO_1_MESSAGE_LOST = CAN_IE_RF1LE,
  CAN_RX_HIGH_PRIORITY_MESSAGE = CAN_IE_HPME,
  CAN_TIMESTAMP_COMPLETE = CAN_IE_TCE,
  CAN_TX_CANCELLATION_FINISH = CAN_IE_TCFE,
  CAN_TX_FIFO_EMPTY = CAN_IE_TFEE,
  CAN_TX_EVENT_FIFO_NEW_ENTRY = CAN_IE_TEFNE,
  CAN_TX_EVENT_FIFO_WATERMARK = CAN_IE_TEFWE,
  CAN_TX_EVENT_FIFO_FULL = CAN_IE_TEFFE,
  CAN_TX_EVENT_FIFO_ELEMENT_LOST = CAN_IE_TEFLE,
  CAN_TIMESTAMP_WRAPAROUND = CAN_IE_TSWE,
  CAN_MESSAGE_RAM_ACCESS_FAILURE = CAN_IE_MRAFE,
  CAN_TIMEOUT_OCCURRED = CAN_IE_TOOE,
  CAN_RX_BUFFER_NEW_MESSAGE = CAN_IE_DRXE,
  CAN_BIT_ERROR_CORRECTED = CAN_IE_BECE,
  CAN_BIT_ERROR_UNCORRECTED = CAN_IE_BEUE,
  CAN_ERROR_LOGGING_OVERFLOW = CAN_IE_ELOE,
  CAN_ERROR_PASSIVE = CAN_IE_EPE,
  CAN_WARNING_STATUS = CAN_IE_EWE,
  CAN_BUS_OFF = CAN_IE_BOE,
  CAN_WATCHDOG = CAN_IE_WDIE,
  CAN_PROTOCOL_ERROR_ARBITRATION = CAN_IE_PEAE,
  CAN_PROTOCOL_ERROR_DATA = CAN_IE_PEDE,
  CAN_ACCESS_RESERVED_ADDRESS = CAN_IE_ARAE
}
 Can module interrupt source. More...
 
static void can_enable_interrupt (struct can_module *const module_inst, const enum can_interrupt_source source)
 Enable CAN interrupt. More...
 
static void can_disable_interrupt (struct can_module *const module_inst, const enum can_interrupt_source source)
 Disable CAN interrupt. More...
 
static uint32_t can_read_interrupt_status (struct can_module *const module_inst)
 Get CAN interrupt status. More...
 
static void can_clear_interrupt_status (struct can_module *const module_inst, const enum can_interrupt_source source)
 Clear CAN interrupt status. More...
 

#define CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_EFEC (   value)    ((CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_EFEC_Msk & ((value) << CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_EFEC_Pos)))
#define CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_EFEC_DISABLE_Val   0
#define CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_EFEC_Msk   (0x7ul << CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_EFEC_Pos)
#define CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_EFEC_Pos   29
#define CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_EFEC_PRIF0M_Val   5
#define CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_EFEC_PRIF1M_Val   6
#define CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_EFEC_PRIORITY_Val   4
#define CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_EFEC_REJECT_Val   3
#define CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_EFEC_STF0M_Val   1
#define CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_EFEC_STF1M_Val   2
#define CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_EFEC_STRXBUF_Val   7
#define CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_EFID1 (   value)    ((CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_EFID1_Msk & ((value) << CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_EFID1_Pos)))
#define CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_EFID1_Msk   (0x1FFFFFFFul << CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_EFID1_Pos)
#define CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_EFID1_Pos   0
#define CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_EFID2 (   value)    ((CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_EFID2_Msk & ((value) << CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_EFID2_Pos)))
#define CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_EFID2_Msk   (0x1FFFFFFFul << CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_EFID2_Pos)
#define CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_EFID2_Pos   0
#define CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_EFT (   value)    ((CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_EFT_Msk & ((value) << CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_EFT_Pos)))
#define CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_EFT_CLASSIC   CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_EFT(2)
#define CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_EFT_DUAL   CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_EFT(1)
#define CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_EFT_Msk   (0x3ul << CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_EFT_Pos)
#define CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_EFT_Pos   30
#define CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_EFT_RANGE   CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_EFT(3)
#define CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_EFT_RANGEM   CAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_EFT(0)
#define CAN_RX_ELEMENT_R0_ESI   (0x1ul << CAN_RX_ELEMENT_R0_ESI_Pos)
#define CAN_RX_ELEMENT_R0_ESI_Pos   31
#define CAN_RX_ELEMENT_R0_ID (   value)    ((CAN_RX_ELEMENT_R0_ID_Msk & ((value) << CAN_RX_ELEMENT_R0_ID_Pos)))
#define CAN_RX_ELEMENT_R0_ID_Msk   (0x1FFFFFFFul << CAN_RX_ELEMENT_R0_ID_Pos)
#define CAN_RX_ELEMENT_R0_ID_Pos   0
#define CAN_RX_ELEMENT_R0_RTR   (0x1ul << CAN_RX_ELEMENT_R0_RTR_Pos)
#define CAN_RX_ELEMENT_R0_RTR_Pos   29
#define CAN_RX_ELEMENT_R0_XTD   (0x1ul << CAN_RX_ELEMENT_R0_XTD_Pos)
#define CAN_RX_ELEMENT_R0_XTD_Pos   30
#define CAN_RX_ELEMENT_R1_ANMF   (0x1ul << CAN_RX_ELEMENT_R1_ANMF_Pos)
#define CAN_RX_ELEMENT_R1_ANMF_Pos   31
#define CAN_RX_ELEMENT_R1_BRS   (0x1ul << CAN_RX_ELEMENT_R1_BRS_Pos)
#define CAN_RX_ELEMENT_R1_BRS_Pos   20
#define CAN_RX_ELEMENT_R1_DLC (   value)    ((CAN_RX_ELEMENT_R1_DLC_Msk & ((value) << CAN_RX_ELEMENT_R1_DLC_Pos)))
#define CAN_RX_ELEMENT_R1_DLC_Msk   (0xFul << CAN_RX_ELEMENT_R1_DLC_Pos)
#define CAN_RX_ELEMENT_R1_DLC_Pos   16
#define CAN_RX_ELEMENT_R1_FDF   (0x1ul << CAN_RX_ELEMENT_R1_FDF_Pos)
#define CAN_RX_ELEMENT_R1_FDF_Pos   21
#define CAN_RX_ELEMENT_R1_FIDX (   value)    ((CAN_RX_ELEMENT_R1_FIDX_Msk & ((value) << CAN_RX_ELEMENT_R1_FIDX_Pos)))
#define CAN_RX_ELEMENT_R1_FIDX_Msk   (0x7Ful << CAN_RX_ELEMENT_R1_FIDX_Pos)
#define CAN_RX_ELEMENT_R1_FIDX_Pos   24
#define CAN_RX_ELEMENT_R1_RXTS (   value)    ((CAN_RX_ELEMENT_R1_RXTS_Msk & ((value) << CAN_RX_ELEMENT_R1_RXTS_Pos)))
#define CAN_RX_ELEMENT_R1_RXTS_Msk   (0xFFFFul << CAN_RX_ELEMENT_R1_RXTS_Pos)
#define CAN_RX_ELEMENT_R1_RXTS_Pos   0
#define CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFEC (   value)    ((CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFEC_Msk & ((value) << CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFEC_Pos)))
#define CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFEC_DISABLE_Val   0
#define CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFEC_Msk   (0x7ul << CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFEC_Pos)
#define CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFEC_Pos   27
#define CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFEC_PRIF0M_Val   5
#define CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFEC_PRIF1M_Val   6
#define CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFEC_PRIORITY_Val   4
#define CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFEC_REJECT_Val   3
#define CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFEC_STF0M_Val   1
#define CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFEC_STF1M_Val   2
#define CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFEC_STRXBUF_Val   7
#define CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFID1 (   value)    ((CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFID1_Msk & ((value) << CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFID1_Pos)))
#define CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFID1_Msk   (0x7FFul << CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFID1_Pos)
#define CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFID1_Pos   16
#define CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFID2 (   value)    ((CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFID2_Msk & ((value) << CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFID2_Pos)))
#define CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFID2_Msk   (0x7FFul << CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFID2_Pos)
#define CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFID2_Pos   0
#define CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFT (   value)    ((CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFT_Msk & ((value) << CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFT_Pos)))
#define CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFT_CLASSIC   CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFT(2)
#define CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFT_DUAL   CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFT(1)
#define CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFT_Msk   (0x3ul << CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFT_Pos)
#define CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFT_Pos   30
#define CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFT_RANGE   CAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFT(0)
#define CAN_TX_ELEMENT_T0_ESI   (0x1ul << CAN_TX_ELEMENT_T0_ESI_Pos)
#define CAN_TX_ELEMENT_T0_ESI_Pos   31
#define CAN_TX_ELEMENT_T0_EXTENDED_ID (   value)    ((CAN_TX_ELEMENT_T0_EXTENDED_ID_Msk & ((value) << CAN_TX_ELEMENT_T0_EXTENDED_ID_Pos)))
#define CAN_TX_ELEMENT_T0_EXTENDED_ID_Msk   (0x1FFFFFFFul << CAN_TX_ELEMENT_T0_EXTENDED_ID_Pos)
#define CAN_TX_ELEMENT_T0_EXTENDED_ID_Pos   0
#define CAN_TX_ELEMENT_T0_RTR   (0x1ul << CAN_TX_ELEMENT_T0_RTR_Pos)
#define CAN_TX_ELEMENT_T0_RTR_Pos   29
#define CAN_TX_ELEMENT_T0_STANDARD_ID (   value)    ((CAN_TX_ELEMENT_T0_STANDARD_ID_Msk & ((value) << CAN_TX_ELEMENT_T0_STANDARD_ID_Pos)))
#define CAN_TX_ELEMENT_T0_STANDARD_ID_Msk   (0x7FFul << CAN_TX_ELEMENT_T0_STANDARD_ID_Pos)
#define CAN_TX_ELEMENT_T0_STANDARD_ID_Pos   18
#define CAN_TX_ELEMENT_T0_XTD   (0x1ul << CAN_TX_ELEMENT_T0_XTD_Pos)
#define CAN_TX_ELEMENT_T0_XTD_Pos   30
#define CAN_TX_ELEMENT_T1_BRS   (0x1ul << CAN_TX_ELEMENT_T1_BRS_Pos)
#define CAN_TX_ELEMENT_T1_BRS_Pos   20
#define CAN_TX_ELEMENT_T1_DLC_DATA12_Val   0x9ul

(CAN_RXESC) 12 byte data field

#define CAN_TX_ELEMENT_T1_DLC_DATA16_Val   0xAul

(CAN_RXESC) 16 byte data field

#define CAN_TX_ELEMENT_T1_DLC_DATA20_Val   0xBul

(CAN_RXESC) 20 byte data field

#define CAN_TX_ELEMENT_T1_DLC_DATA24_Val   0xCul

(CAN_RXESC) 24 byte data field

#define CAN_TX_ELEMENT_T1_DLC_DATA32_Val   0xDul

(CAN_RXESC) 32 byte data field

#define CAN_TX_ELEMENT_T1_DLC_DATA48_Val   0xEul

(CAN_RXESC) 48 byte data field

#define CAN_TX_ELEMENT_T1_DLC_DATA64_Val   0xFul

(CAN_RXESC) 64 byte data field

Referenced by can_fd_send_extended_message(), and can_fd_send_standard_message().

#define CAN_TX_ELEMENT_T1_DLC_DATA8_Val   0x8ul

(CAN_RXESC) 8 byte data field

Referenced by can_get_tx_buffer_element_defaults().

#define CAN_TX_ELEMENT_T1_DLC_Msk   (0xFul << CAN_TX_ELEMENT_T1_DLC_Pos)
#define CAN_TX_ELEMENT_T1_DLC_Pos   16
#define CAN_TX_ELEMENT_T1_EFC   (0x1ul << CAN_TX_ELEMENT_T1_EFC_Pos)
#define CAN_TX_ELEMENT_T1_EFC_Pos   23
#define CAN_TX_ELEMENT_T1_FDF   (0x1ul << CAN_TX_ELEMENT_T1_FDF_Pos)
#define CAN_TX_ELEMENT_T1_FDF_Pos   21
#define CAN_TX_ELEMENT_T1_MM (   value)    ((CAN_TX_ELEMENT_T1_MM_Msk & ((value) << CAN_TX_ELEMENT_T1_MM_Pos)))
#define CAN_TX_ELEMENT_T1_MM_Msk   (0xFFul << CAN_TX_ELEMENT_T1_MM_Pos)
#define CAN_TX_ELEMENT_T1_MM_Pos   24
#define CAN_TX_EVENT_ELEMENT_E0_ESI   (0x1ul << CAN_TX_EVENT_ELEMENT_E0_ESI_Pos)
#define CAN_TX_EVENT_ELEMENT_E0_ESI_Pos   31
#define CAN_TX_EVENT_ELEMENT_E0_ID (   value)    ((CAN_TX_EVENT_ELEMENT_E0_ID_Msk & ((value) << CAN_TX_EVENT_ELEMENT_E0_ID_Pos)))
#define CAN_TX_EVENT_ELEMENT_E0_ID_Msk   (0x1FFFFFFFul << CAN_TX_EVENT_ELEMENT_E0_ID_Pos)
#define CAN_TX_EVENT_ELEMENT_E0_ID_Pos   0
#define CAN_TX_EVENT_ELEMENT_E0_RTR   (0x1ul << CAN_TX_EVENT_ELEMENT_E0_RTR_Pos)
#define CAN_TX_EVENT_ELEMENT_E0_RTR_Pos   29
#define CAN_TX_EVENT_ELEMENT_E0_XTD   (0x1ul << CAN_TX_EVENT_ELEMENT_E0_XTD_Pos)
#define CAN_TX_EVENT_ELEMENT_E0_XTD_Pos   30
#define CAN_TX_EVENT_ELEMENT_E1_BRS   (0x1ul << CAN_TX_EVENT_ELEMENT_E1_BRS_Pos)
#define CAN_TX_EVENT_ELEMENT_E1_BRS_Pos   20
#define CAN_TX_EVENT_ELEMENT_E1_DLC (   value)    ((CAN_TX_EVENT_ELEMENT_E1_DLC_Msk & ((value) << CAN_TX_EVENT_ELEMENT_E1_DLC_Pos)))
#define CAN_TX_EVENT_ELEMENT_E1_DLC_Msk   (0xFul << CAN_TX_EVENT_ELEMENT_E1_DLC_Pos)
#define CAN_TX_EVENT_ELEMENT_E1_DLC_Pos   16
#define CAN_TX_EVENT_ELEMENT_E1_ET (   value)    ((CAN_TX_EVENT_ELEMENT_E1_ET_Msk & ((value) << CAN_TX_EVENT_ELEMENT_E1_ET_Pos)))
#define CAN_TX_EVENT_ELEMENT_E1_ET_Msk   (0x3ul << CAN_TX_EVENT_ELEMENT_E1_ET_Pos)
#define CAN_TX_EVENT_ELEMENT_E1_ET_Pos   22
#define CAN_TX_EVENT_ELEMENT_E1_FDF   (0x1ul << CAN_TX_EVENT_ELEMENT_E1_FDF_Pos)
#define CAN_TX_EVENT_ELEMENT_E1_FDF_Pos   21
#define CAN_TX_EVENT_ELEMENT_E1_MM (   value)    ((CAN_TX_EVENT_ELEMENT_E1_MM_Msk & ((value) << CAN_TX_EVENT_ELEMENT_E1_MM_Pos)))
#define CAN_TX_EVENT_ELEMENT_E1_MM_Msk   (0xFFul << CAN_TX_EVENT_ELEMENT_E1_MM_Pos)
#define CAN_TX_EVENT_ELEMENT_E1_MM_Pos   24
#define CAN_TX_EVENT_ELEMENT_E1_TXTS (   value)    ((CAN_TX_EVENT_ELEMENT_E1_TXTS_Msk & ((value) << CAN_TX_EVENT_ELEMENT_E1_TXTS_Pos)))
#define CAN_TX_EVENT_ELEMENT_E1_TXTS_Msk   (0xFFFFul << CAN_TX_EVENT_ELEMENT_E1_TXTS_Pos)
#define CAN_TX_EVENT_ELEMENT_E1_TXTS_Pos   0