37 #ifndef MCAN_H_INCLUDED 38 #define MCAN_H_INCLUDED 64 #define MCAN_RX_ELEMENT_R0_ID_Pos 0 65 #define MCAN_RX_ELEMENT_R0_ID_Msk (0x1FFFFFFFul << MCAN_RX_ELEMENT_R0_ID_Pos) 66 #define MCAN_RX_ELEMENT_R0_ID(value) ((MCAN_RX_ELEMENT_R0_ID_Msk & ((value) << MCAN_RX_ELEMENT_R0_ID_Pos))) 67 #define MCAN_RX_ELEMENT_R0_RTR_Pos 29 68 #define MCAN_RX_ELEMENT_R0_RTR (0x1ul << MCAN_RX_ELEMENT_R0_RTR_Pos) 69 #define MCAN_RX_ELEMENT_R0_XTD_Pos 30 70 #define MCAN_RX_ELEMENT_R0_XTD (0x1ul << MCAN_RX_ELEMENT_R0_XTD_Pos) 71 #define MCAN_RX_ELEMENT_R0_ESI_Pos 31 72 #define MCAN_RX_ELEMENT_R0_ESI (0x1ul << MCAN_RX_ELEMENT_R0_ESI_Pos) 96 #define MCAN_RX_ELEMENT_R1_RXTS_Pos 0 97 #define MCAN_RX_ELEMENT_R1_RXTS_Msk (0xFFFFul << MCAN_RX_ELEMENT_R1_RXTS_Pos) 98 #define MCAN_RX_ELEMENT_R1_RXTS(value) ((MCAN_RX_ELEMENT_R1_RXTS_Msk & ((value) << MCAN_RX_ELEMENT_R1_RXTS_Pos))) 99 #define MCAN_RX_ELEMENT_R1_DLC_Pos 16 100 #define MCAN_RX_ELEMENT_R1_DLC_Msk (0xFul << MCAN_RX_ELEMENT_R1_DLC_Pos) 101 #define MCAN_RX_ELEMENT_R1_DLC(value) ((MCAN_RX_ELEMENT_R1_DLC_Msk & ((value) << MCAN_RX_ELEMENT_R1_DLC_Pos))) 102 #define MCAN_RX_ELEMENT_R1_BRS_Pos 20 103 #define MCAN_RX_ELEMENT_R1_BRS (0x1ul << MCAN_RX_ELEMENT_R1_BRS_Pos) 104 #define MCAN_RX_ELEMENT_R1_FDF_Pos 21 105 #define MCAN_RX_ELEMENT_R1_FDF (0x1ul << MCAN_RX_ELEMENT_R1_FDF_Pos) 106 #define MCAN_RX_ELEMENT_R1_FIDX_Pos 24 107 #define MCAN_RX_ELEMENT_R1_FIDX_Msk (0x7Ful << MCAN_RX_ELEMENT_R1_FIDX_Pos) 108 #define MCAN_RX_ELEMENT_R1_FIDX(value) ((MCAN_RX_ELEMENT_R1_FIDX_Msk & ((value) << MCAN_RX_ELEMENT_R1_FIDX_Pos))) 109 #define MCAN_RX_ELEMENT_R1_ANMF_Pos 31 110 #define MCAN_RX_ELEMENT_R1_ANMF (0x1ul << MCAN_RX_ELEMENT_R1_ANMF_Pos) 148 #if (SAMV71B || SAME70B || SAMV70B) 160 #define MCAN_TX_ELEMENT_T0_EXTENDED_ID_Pos 0 161 #define MCAN_TX_ELEMENT_T0_EXTENDED_ID_Msk (0x1FFFFFFFul << MCAN_TX_ELEMENT_T0_EXTENDED_ID_Pos) 162 #define MCAN_TX_ELEMENT_T0_EXTENDED_ID(value) ((MCAN_TX_ELEMENT_T0_EXTENDED_ID_Msk & ((value) << MCAN_TX_ELEMENT_T0_EXTENDED_ID_Pos))) 163 #define MCAN_TX_ELEMENT_T0_STANDARD_ID_Pos 18 164 #define MCAN_TX_ELEMENT_T0_STANDARD_ID_Msk (0x7FFul << MCAN_TX_ELEMENT_T0_STANDARD_ID_Pos) 165 #define MCAN_TX_ELEMENT_T0_STANDARD_ID(value) ((MCAN_TX_ELEMENT_T0_STANDARD_ID_Msk & ((value) << MCAN_TX_ELEMENT_T0_STANDARD_ID_Pos))) 166 #define MCAN_TX_ELEMENT_T0_RTR_Pos 29 167 #define MCAN_TX_ELEMENT_T0_RTR (0x1ul << MCAN_TX_ELEMENT_T0_RTR_Pos) 168 #define MCAN_TX_ELEMENT_T0_XTD_Pos 30 169 #define MCAN_TX_ELEMENT_T0_XTD (0x1ul << MCAN_TX_ELEMENT_T0_XTD_Pos) 170 #if (SAMV71B || SAME70B || SAMV70B) 171 #define MCAN_TX_ELEMENT_T0_ESI_Pos 31 172 #define MCAN_TX_ELEMENT_T0_ESI (0x1ul << MCAN_TX_ELEMENT_T0_ESI_Pos) 182 #if (SAMV71B || SAME70B || SAMV70B) 202 #define MCAN_TX_ELEMENT_T1_DLC_Pos 16 203 #define MCAN_TX_ELEMENT_T1_DLC_Msk (0xFul << MCAN_TX_ELEMENT_T1_DLC_Pos) 204 #define MCAN_TX_ELEMENT_T1_DLC(value) ((MCAN_TX_ELEMENT_T1_DLC_Msk & ((value) << MCAN_TX_ELEMENT_T1_DLC_Pos))) 206 #define MCAN_TX_ELEMENT_T1_DLC_DATA8_Val 0x8ul 208 #define MCAN_TX_ELEMENT_T1_DLC_DATA12_Val 0x9ul 210 #define MCAN_TX_ELEMENT_T1_DLC_DATA16_Val 0xAul 212 #define MCAN_TX_ELEMENT_T1_DLC_DATA20_Val 0xBul 214 #define MCAN_TX_ELEMENT_T1_DLC_DATA24_Val 0xCul 216 #define MCAN_TX_ELEMENT_T1_DLC_DATA32_Val 0xDul 218 #define MCAN_TX_ELEMENT_T1_DLC_DATA48_Val 0xEul 220 #define MCAN_TX_ELEMENT_T1_DLC_DATA64_Val 0xFul 221 #if (SAMV71B || SAME70B || SAMV70B) 222 #define MCAN_TX_ELEMENT_T1_BRS_Pos 20 223 #define MCAN_TX_ELEMENT_T1_BRS (0x1ul << MCAN_TX_ELEMENT_T1_BRS_Pos) 224 #define MCAN_TX_ELEMENT_T1_FDF_Pos 21 225 #define MCAN_TX_ELEMENT_T1_FDF (0x1ul << MCAN_TX_ELEMENT_T1_FDF_Pos) 227 #define MCAN_TX_ELEMENT_T1_EFC_Pos 23 228 #define MCAN_TX_ELEMENT_T1_EFC (0x1ul << MCAN_TX_ELEMENT_T1_EFC_Pos) 229 #define MCAN_TX_ELEMENT_T1_MM_Pos 24 230 #define MCAN_TX_ELEMENT_T1_MM_Msk (0xFFul << MCAN_TX_ELEMENT_T1_MM_Pos) 231 #define MCAN_TX_ELEMENT_T1_MM(value) ((MCAN_TX_ELEMENT_T1_MM_Msk & ((value) << MCAN_TX_ELEMENT_T1_MM_Pos))) 260 #define MCAN_TX_EVENT_ELEMENT_E0_ID_Pos 0 261 #define MCAN_TX_EVENT_ELEMENT_E0_ID_Msk (0x1FFFFFFFul << MCAN_TX_EVENT_ELEMENT_E0_ID_Pos) 262 #define MCAN_TX_EVENT_ELEMENT_E0_ID(value) ((MCAN_TX_EVENT_ELEMENT_E0_ID_Msk & ((value) << MCAN_TX_EVENT_ELEMENT_E0_ID_Pos))) 263 #define MCAN_TX_EVENT_ELEMENT_E0_RTR_Pos 29 264 #define MCAN_TX_EVENT_ELEMENT_E0_RTR (0x1ul << MCAN_TX_EVENT_ELEMENT_E0_RTR_Pos) 265 #define MCAN_TX_EVENT_ELEMENT_E0_XTD_Pos 30 266 #define MCAN_TX_EVENT_ELEMENT_E0_XTD (0x1ul << MCAN_TX_EVENT_ELEMENT_E0_XTD_Pos) 267 #define MCAN_TX_EVENT_ELEMENT_E0_ESI_Pos 31 268 #define MCAN_TX_EVENT_ELEMENT_E0_ESI (0x1ul << MCAN_TX_EVENT_ELEMENT_E0_ESI_Pos) 290 #define MCAN_TX_EVENT_ELEMENT_E1_TXTS_Pos 0 291 #define MCAN_TX_EVENT_ELEMENT_E1_TXTS_Msk (0xFFFFul << MCAN_TX_EVENT_ELEMENT_E1_TXTS_Pos) 292 #define MCAN_TX_EVENT_ELEMENT_E1_TXTS(value) ((MCAN_TX_EVENT_ELEMENT_E1_TXTS_Msk & ((value) << MCAN_TX_EVENT_ELEMENT_E1_TXTS_Pos))) 293 #define MCAN_TX_EVENT_ELEMENT_E1_DLC_Pos 16 294 #define MCAN_TX_EVENT_ELEMENT_E1_DLC_Msk (0xFul << MCAN_TX_EVENT_ELEMENT_E1_DLC_Pos) 295 #define MCAN_TX_EVENT_ELEMENT_E1_DLC(value) ((MCAN_TX_EVENT_ELEMENT_E1_DLC_Msk & ((value) << MCAN_TX_EVENT_ELEMENT_E1_DLC_Pos))) 296 #define MCAN_TX_EVENT_ELEMENT_E1_BRS_Pos 20 297 #define MCAN_TX_EVENT_ELEMENT_E1_BRS (0x1ul << MCAN_TX_EVENT_ELEMENT_E1_BRS_Pos) 298 #define MCAN_TX_EVENT_ELEMENT_E1_FDF_Pos 21 299 #define MCAN_TX_EVENT_ELEMENT_E1_FDF (0x1ul << MCAN_TX_EVENT_ELEMENT_E1_FDF_Pos) 300 #define MCAN_TX_EVENT_ELEMENT_E1_ET_Pos 22 301 #define MCAN_TX_EVENT_ELEMENT_E1_ET_Msk (0x3ul << MCAN_TX_EVENT_ELEMENT_E1_ET_Pos) 302 #define MCAN_TX_EVENT_ELEMENT_E1_ET(value) ((MCAN_TX_EVENT_ELEMENT_E1_ET_Msk & ((value) << MCAN_TX_EVENT_ELEMENT_E1_ET_Pos))) 303 #define MCAN_TX_EVENT_ELEMENT_E1_MM_Pos 24 304 #define MCAN_TX_EVENT_ELEMENT_E1_MM_Msk (0xFFul << MCAN_TX_EVENT_ELEMENT_E1_MM_Pos) 305 #define MCAN_TX_EVENT_ELEMENT_E1_MM(value) ((MCAN_TX_EVENT_ELEMENT_E1_MM_Msk & ((value) << MCAN_TX_EVENT_ELEMENT_E1_MM_Pos))) 335 #define MCAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFID2_Pos 0 336 #define MCAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFID2_Msk (0x7FFul << MCAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFID2_Pos) 337 #define MCAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFID2(value) ((MCAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFID2_Msk & ((value) << MCAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFID2_Pos))) 338 #define MCAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFID1_Pos 16 339 #define MCAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFID1_Msk (0x7FFul << MCAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFID1_Pos) 340 #define MCAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFID1(value) ((MCAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFID1_Msk & ((value) << MCAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFID1_Pos))) 341 #define MCAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFEC_Pos 27 342 #define MCAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFEC_Msk (0x7ul << MCAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFEC_Pos) 343 #define MCAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFEC(value) ((MCAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFEC_Msk & ((value) << MCAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFEC_Pos))) 344 #define MCAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFEC_DISABLE_Val 0 345 #define MCAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFEC_STF0M_Val 1 346 #define MCAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFEC_STF1M_Val 2 347 #define MCAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFEC_REJECT_Val 3 348 #define MCAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFEC_PRIORITY_Val 4 349 #define MCAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFEC_PRIF0M_Val 5 350 #define MCAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFEC_PRIF1M_Val 6 351 #define MCAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFEC_STRXBUF_Val 7 352 #define MCAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFT_Pos 30 353 #define MCAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFT_Msk (0x3ul << MCAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFT_Pos) 354 #define MCAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFT(value) ((MCAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFT_Msk & ((value) << MCAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFT_Pos))) 355 #define MCAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFT_RANGE MCAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFT(0) 356 #define MCAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFT_DUAL MCAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFT(1) 357 #define MCAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFT_CLASSIC MCAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFT(2) 380 #define MCAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_EFID1_Pos 0 381 #define MCAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_EFID1_Msk (0x1FFFFFFFul << MCAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_EFID1_Pos) 382 #define MCAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_EFID1(value) ((MCAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_EFID1_Msk & ((value) << MCAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_EFID1_Pos))) 383 #define MCAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_EFEC_Pos 29 384 #define MCAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_EFEC_Msk (0x7ul << MCAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_EFEC_Pos) 385 #define MCAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_EFEC(value) ((MCAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_EFEC_Msk & ((value) << MCAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_EFEC_Pos))) 386 #define MCAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_EFEC_DISABLE_Val 0 387 #define MCAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_EFEC_STF0M_Val 1 388 #define MCAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_EFEC_STF1M_Val 2 389 #define MCAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_EFEC_REJECT_Val 3 390 #define MCAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_EFEC_PRIORITY_Val 4 391 #define MCAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_EFEC_PRIF0M_Val 5 392 #define MCAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_EFEC_PRIF1M_Val 6 393 #define MCAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_EFEC_STRXBUF_Val 7 409 #define MCAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_EFID2_Pos 0 410 #define MCAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_EFID2_Msk (0x1FFFFFFFul << MCAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_EFID2_Pos) 411 #define MCAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_EFID2(value) ((MCAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_EFID2_Msk & ((value) << MCAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_EFID2_Pos))) 412 #define MCAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_EFT_Pos 30 413 #define MCAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_EFT_Msk (0x3ul << MCAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_EFT_Pos) 414 #define MCAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_EFT(value) ((MCAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_EFT_Msk & ((value) << MCAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_EFT_Pos))) 415 #define MCAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_EFT_RANGEM MCAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_EFT(0) 416 #define MCAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_EFT_DUAL MCAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_EFT(1) 417 #define MCAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_EFT_CLASSIC MCAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_EFT(2) 418 #define MCAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_EFT_RANGE MCAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_EFT(3) 544 #if !defined(__DOXYGEN__) 561 uint8_t watchdog_configuration;
567 bool protocol_exception_handling;
569 bool automatic_retransmission;
571 bool clock_stop_request;
573 bool clock_stop_acknowledge;
575 uint8_t timestamp_prescaler;
577 uint16_t timeout_period;
585 uint8_t delay_compensation_offset;
586 #if (SAMV71B || SAME70B || SAMV70B) 588 uint8_t delay_compensation_filter_window_length;
595 bool remote_frames_standard_reject;
597 bool remote_frames_extended_reject;
599 uint32_t extended_id_mask;
601 bool rx_fifo_0_overwrite;
603 uint8_t rx_fifo_0_watermark;
605 bool rx_fifo_1_overwrite;
607 uint8_t rx_fifo_1_watermark;
611 uint8_t tx_event_fifo_watermark;
672 #if (SAMV71B || SAME70B || SAMV70B) 673 config->delay_compensation_filter_window_length = 0;
854 struct mcan_module *
const module_inst,
bool fifo_number, uint32_t index)
1060 tx_element->
T0.
reg = 0;
#define MCAN_IE_TOOE
(MCAN_IE) Timeout Occurred Interrupt Enable
__I uint32_t MCAN_HPMS
(Mcan Offset: 0x94) High Priority Message Status Register
enum mcan_nonmatching_frames_action nonmatching_frames_action_standard
mcan_nonmatching_frames_action
Can nonmatching frames action.
MCAN transfer event FIFO element structure.
MCAN receive element structure for FIFO 0.
MCAN receive element structure for buffer.
bool automatic_retransmission
__I uint32_t MCAN_RXF0S
(Mcan Offset: 0xA4) Receive FIFO 0 Status Register
static uint16_t mcan_read_timestamp_count_value(struct mcan_module *const module_inst)
Can read timestamp count value.
#define MCAN_IE_RF0LE
(MCAN_IE) Receive FIFO 0 Message Lost Interrupt Enable
static void mcan_enable_interrupt(struct mcan_module *const module_inst, const enum mcan_interrupt_source source)
Enable MCAN interrupt.
__I uint32_t MCAN_TXBTO
(Mcan Offset: 0xD8) Transmit Buffer Transmission Occurred Register
MCAN transfer element structure.
#define MCAN_TOCC_TOS_RX1_EV_TIMEOUT
(MCAN_TOCC) Timeout controlled by Receive FIFO 1
#define MCAN_TX_ELEMENT_T1_DLC(value)
(MCAN_RXESC) 8 byte data field
#define MCAN_IE_HPME
(MCAN_IE) High Priority Message Interrupt Enable
#define MCAN_IE_WDIE
(MCAN_IE) Watchdog Interrupt Enable
static uint32_t mcan_tx_get_cancellation_status(struct mcan_module *const module_inst)
Get Tx cancellation status.
__IO uint32_t MCAN_TXBCR
(Mcan Offset: 0xD4) Transmit Buffer Cancellation Request Register
__IO uint32_t MCAN_TXBAR
(Mcan Offset: 0xD0) Transmit Buffer Add Request Register
__I uint32_t MCAN_TXBRP
(Mcan Offset: 0xCC) Transmit Buffer Request Pending Register
static void mcan_rx_clear_buffer_status(struct mcan_module *const module_inst, uint32_t index)
Clear Rx buffer status.
#define MCAN_RXF1A_F1AI(value)
__IO uint32_t MCAN_IE
(Mcan Offset: 0x54) Interrupt Enable Register
MCAN extended message ID filter element structure.
#define MCAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_EFT_CLASSIC
#define MCAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFEC(value)
__IO MCAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_Type F0
static uint32_t mcan_read_high_priority_message_status(struct mcan_module *const module_inst)
Read high priority message status.
static uint16_t mcan_read_timeout_count_value(struct mcan_module *const module_inst)
Can read timeout count value.
#define MCAN_IE_TFEE
(MCAN_IE) Tx FIFO Empty Interrupt Enable
#define MCAN_CCCR_CCE
(MCAN_CCCR) Configuration Change Enable (read/write, write protection)
enum status_code mcan_get_tx_event_fifo_element(struct mcan_module *const module_inst, struct mcan_tx_event_element *tx_event_element, uint32_t index)
set FIFO transmit buffer element .
uint8_t delay_compensation_offset
MCAN receive element structure for FIFO 1.
static void mcan_rx_fifo_acknowledge(struct mcan_module *const module_inst, bool fifo_number, uint32_t index)
Set Rx acknowledge.
void mcan_disable_bus_monitor_mode(struct mcan_module *const module_inst)
disable bus monitor mode of mcan module.
#define MCAN_IE_TCE
(MCAN_IE) Transmission Completed Interrupt Enable
SAM Control Area Network Driver Configuration Header.
__IO uint32_t MCAN_TOCV
(Mcan Offset: 0x2C) Timeout Counter Value Register
#define MCAN_IE_RF0NE
(MCAN_IE) Receive FIFO 0 New Message Interrupt Enable
mcan_timeout_mode
Can time out modes.
__I uint32_t MCAN_TXFQS
(Mcan Offset: 0xC4) Transmit FIFO/Queue Status Register
__IO MCAN_RX_ELEMENT_R1_Type R1
#define MCAN_IE_RF0WE
(MCAN_IE) Receive FIFO 0 Watermark Reached Interrupt Enable
void mcan_stop(struct mcan_module *const module_inst)
stop mcan module when bus off occurs
#define MCAN_TXEFA_EFAI(value)
#define MCAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_EFID1(value)
#define MCAN_IE_BOE
(MCAN_IE) Bus_Off Status Interrupt Enable
static void mcan_clear_interrupt_status(struct mcan_module *const module_inst, const enum mcan_interrupt_source source)
Clear MCAN interrupt status.
static void mcan_get_config_defaults(struct mcan_config *const config)
Initializes an MCAN configuration structure to defaults.
void mcan_enable_test_mode(struct mcan_module *const module_inst)
enable test mode of mcan module.
bool remote_frames_standard_reject
void mcan_enable_restricted_operation_mode(struct mcan_module *const module_inst)
enable restricted mode of mcan module.
void mcan_start(struct mcan_module *const module_inst)
start can module after initialization.
static uint32_t mcan_tx_get_event_fifo_status(struct mcan_module *const module_inst)
Get Tx event FIFO status.
#define CONF_MCAN_ELEMENT_DATA_SIZE
__IO uint32_t MCAN_NDAT2
(Mcan Offset: 0x9C) New Data 2 Register
Commonly used includes, types and macros.
mcan_interrupt_source
Can module interrupt source.
static void mcan_get_extended_message_filter_element_default(struct mcan_extended_message_filter_element *et_filter)
Get the extended message filter default value.
static uint32_t mcan_tx_get_pending_status(struct mcan_module *const module_inst)
Get Tx buffer request pending status.
#define MCAN_IE_STEE
(MCAN_IE) Stuff Error Interrupt Enable
MCAN configuration structure.
void mcan_disable_sleep_mode(struct mcan_module *const module_inst)
disable sleep mode of mcan module.
__IO MCAN_TX_ELEMENT_T0_Type T0
#define MCAN_TOCC_TOS_RX0_EV_TIMEOUT
(MCAN_TOCC) Timeout controlled by Receive FIFO 0
#define MCAN_IE_RF1NE
(MCAN_IE) Receive FIFO 1 New Message Interrupt Enable
#define MCAN_IE_TEFFE
(MCAN_IE) Tx Event FIFO Full Interrupt Enable
__IO uint32_t MCAN_CCCR
(Mcan Offset: 0x18) CC Control Register
#define MCAN_TOCC_TOS_CONTINUOUS
(MCAN_TOCC) Continuous operation
static uint32_t mcan_read_error_count(struct mcan_module *const module_inst)
Can read error count.
static void mcan_get_standard_message_filter_element_default(struct mcan_standard_message_filter_element *sd_filter)
Get the standard message filter default value.
enum status_code mcan_set_rx_extended_filter(struct mcan_module *const module_inst, struct mcan_extended_message_filter_element *et_filter, uint32_t index)
set extended receive CAN ID.
#define MCAN_RXF0A_F0AI(value)
enum status_code mcan_get_rx_buffer_element(struct mcan_module *const module_inst, struct mcan_rx_element_buffer *rx_element, uint32_t index)
get dedicated rx buffer element .
__IO MCAN_RX_ELEMENT_R1_Type R1
#define MCAN_IE_BEE
(MCAN_IE) Bit Error Interrupt Enable
#define MCAN_TX_ELEMENT_T1_EFC
#define MCAN_IE_EPE
(MCAN_IE) Error Passive Interrupt Enable
bool protocol_exception_handling
void mcan_disable_test_mode(struct mcan_module *const module_inst)
disable test mode of mcan module.
static uint32_t mcan_tx_get_fifo_queue_status(struct mcan_module *const module_inst)
Get Tx FIFO/Queue status.
__I uint32_t MCAN_ECR
(Mcan Offset: 0x40) Error Counter Register
#define MCAN_IE_TEFNE
(MCAN_IE) Tx Event FIFO New Entry Interrupt Enable
__I uint32_t MCAN_TXBCF
(Mcan Offset: 0xDC) Transmit Buffer Cancellation Finished Register
static bool mcan_rx_get_buffer_status(struct mcan_module *const module_inst, uint32_t index)
Get Rx buffer status.
void mcan_fd_set_baudrate(Mcan *hw, uint32_t baudrate)
Set MCAN_FD baudrate.
__IO MCAN_RX_ELEMENT_R0_Type R0
#define MCAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFEC_STF0M_Val
#define MCAN_IE_TEFLE
(MCAN_IE) Tx Event FIFO Event Lost Interrupt Enable
__IO uint32_t MCAN_RXF1A
(Mcan Offset: 0xB8) Receive FIFO 1 Acknowledge Register
__IO uint32_t MCAN_RXF0A
(Mcan Offset: 0xA8) Receive FIFO 0 Acknowledge Register
static void mcan_get_tx_buffer_element_defaults(struct mcan_tx_element *tx_element)
Get the default transfer buffer element.
__IO MCAN_TX_ELEMENT_T1_Type T1
uint8_t timestamp_prescaler
enum mcan_nonmatching_frames_action nonmatching_frames_action_extended
bool remote_frames_extended_reject
__IO uint32_t MCAN_IR
(Mcan Offset: 0x50) Interrupt Register
__IO uint32_t MCAN_TSCV
(Mcan Offset: 0x24) Timestamp Counter Value Register
static uint32_t mcan_rx_get_fifo_status(struct mcan_module *const module_inst, bool fifo_number)
Get Rx FIFO status.
#define MCAN_IE_RF1LE
(MCAN_IE) Receive FIFO 1 Message Lost Interrupt Enable
#define MCAN_IE_RF0FE
(MCAN_IE) Receive FIFO 0 Full Interrupt Enable
uint8_t watchdog_configuration
uint8_t rx_fifo_1_watermark
#define MCAN_IE_FOEE
(MCAN_IE) Format Error Interrupt Enable
enum status_code mcan_get_rx_fifo_0_element(struct mcan_module *const module_inst, struct mcan_rx_element_fifo_0 *rx_element, uint32_t index)
get FIFO rx buffer element .
static uint32_t mcan_read_protocal_status(struct mcan_module *const module_inst)
Can read protocol status.
void mcan_enable_sleep_mode(struct mcan_module *const module_inst)
enable sleep mode of mcan module.
void mcan_enable_fd_mode(struct mcan_module *const module_inst)
switch mcan module into fd mode.
#define MCAN_IE_TSWE
(MCAN_IE) Timestamp Wraparound Interrupt Enable
#define MCAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFID2_Msk
#define MCAN_IE_CRCEE
(MCAN_IE) CRC Error Interrupt Enable
static void mcan_disable_interrupt(struct mcan_module *const module_inst, const enum mcan_interrupt_source source)
Disable MCAN interrupt.
enum mcan_timeout_mode timeout_mode
void mcan_enable_bus_monitor_mode(struct mcan_module *const module_inst)
enable bus monitor mode of mcan module.
static enum status_code mcan_tx_transfer_request(struct mcan_module *const module_inst, uint32_t trig_mask)
Tx buffer add transfer request.
#define MCAN_IE_DRXE
(MCAN_IE) Message stored to Dedicated Receive Buffer Interrupt Enable
__I uint32_t MCAN_RXF1S
(Mcan Offset: 0xB4) Receive FIFO 1 Status Register
uint32_t extended_id_mask
enum status_code mcan_get_rx_fifo_1_element(struct mcan_module *const module_inst, struct mcan_rx_element_fifo_1 *rx_element, uint32_t index)
get FIFO rx buffer element .
void mcan_disable_fd_mode(struct mcan_module *const module_inst)
disable fd mode of mcan module.
void mcan_set_baudrate(Mcan *hw, uint32_t baudrate)
Set MCAN baudrate.
#define MCAN_IE_ACKEE
(MCAN_IE) Acknowledge Error Interrupt Enable
static enum status_code mcan_tx_cancel_request(struct mcan_module *const module_inst, uint32_t trig_mask)
Set Tx Queue operation.
static void mcan_tx_event_fifo_acknowledge(struct mcan_module *const module_inst, uint32_t index)
Set Tx Queue operation.
uint8_t rx_fifo_0_watermark
#define MCAN_TX_ELEMENT_T1_DLC_DATA8_Val
(MCAN_RXESC) 12 byte data field
uint8_t tx_event_fifo_watermark
__IO uint32_t MCAN_NDAT1
(Mcan Offset: 0x98) New Data 1 Register
__IO uint32_t MCAN_TXEFA
(Mcan Offset: 0xF8) Transmit Event FIFO Acknowledge Register
__IO MCAN_RX_ELEMENT_R1_Type R1
__I uint32_t MCAN_PSR
(Mcan Offset: 0x44) Protocol Status Register
#define MCAN_IE_ELOE
(MCAN_IE) Error Logging Overflow Interrupt Enable
#define MCAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFT_CLASSIC
static uint32_t mcan_read_interrupt_status(struct mcan_module *const module_inst)
Get MCAN interrupt status.
__IO MCAN_RX_ELEMENT_R0_Type R0
#define MCAN_IE_TEFWE
(MCAN_IE) Tx Event FIFO Watermark Reached Interrupt Enable
MCAN standard message ID filter element structure.
#define MCAN_IE_MRAFE
(MCAN_IE) Message RAM Access Failure Interrupt Enable
#define MCAN_TOCC_TOS_TX_EV_TIMEOUT
(MCAN_TOCC) Timeout controlled by Tx Event FIFO
#define MCAN_IE_EWE
(MCAN_IE) Warning Status Interrupt Enable
#define MCAN_IE_TCFE
(MCAN_IE) Transmission Cancellation Finished Interrupt Enable
__IO MCAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_Type S0
#define MCAN_IE_RF1FE
(MCAN_IE) Receive FIFO 1 Full Interrupt Enable
#define MCAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_EFID2_Msk
__I uint32_t MCAN_TXEFS
(Mcan Offset: 0xF4) Transmit Event FIFO Status Register
__IO MCAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F1_Type F1
enum status_code mcan_set_tx_buffer_element(struct mcan_module *const module_inst, struct mcan_tx_element *tx_element, uint32_t index)
set dedicated transmit buffer element .
void mcan_disable_restricted_operation_mode(struct mcan_module *const module_inst)
disable restricted mode of mcan module.
#define MCAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_EFEC(value)
#define MCAN_STANDARD_MESSAGE_FILTER_ELEMENT_S0_SFID1(value)
__IO MCAN_RX_ELEMENT_R0_Type R0
#define Assert(expr)
This macro is used to test fatal errors.
void mcan_init(struct mcan_module *const module_inst, Mcan *hw, struct mcan_config *config)
initialize can module.
static uint32_t mcan_tx_get_transmission_status(struct mcan_module *const module_inst)
Get Tx transmission status.
#define MCAN_IE_RF1WE
(MCAN_IE) Receive FIFO 1 Watermark Reached Interrupt Enable
bool clock_stop_acknowledge
MCAN software device instance structure.
uint8_t data[CONF_MCAN_ELEMENT_DATA_SIZE]
enum status_code mcan_set_rx_standard_filter(struct mcan_module *const module_inst, struct mcan_standard_message_filter_element *sd_filter, uint32_t index)
set standard receive CAN ID.
#define MCAN_EXTENDED_MESSAGE_FILTER_ELEMENT_F0_EFEC_STF1M_Val