HPM SDK
HPMicro Software Development Kit
hpm_mcan_drv.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2023-2025 HPMicro
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 #ifndef HPM_MCAN_DRV_H
8 #define HPM_MCAN_DRV_H
9 
10 #include "hpm_common.h"
11 #include "hpm_mcan_regs.h"
12 #include "hpm_mcan_soc.h"
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
27 enum {
43 };
44 
48 #define MCAN_INT_ACCESS_TO_RESERVED_ADDR MCAN_IR_ARA_MASK
49 #define MCAN_INT_PROTOCOL_ERR_IN_DATA_PHASE MCAN_IR_PED_MASK
50 #define MCAN_INT_PROTOCOL_ERR_IN_ARB_PHASE MCAN_IR_PEA_MASK
51 #define MCAN_INT_WATCHDOG_INT MCAN_IR_WDI_MASK
53 #define MCAN_INT_BUS_OFF_STATUS MCAN_IR_BO_MASK
54 #define MCAN_INT_WARNING_STATUS MCAN_IR_EW_MASK
55 #define MCAN_INT_ERROR_PASSIVE MCAN_IR_EP_MASK
56 #define MCAN_INT_ERROR_LOGGING_OVERFLOW MCAN_IR_ELO_MASK
57 #define MCAN_INT_BIT_ERROR_UNCORRECTED MCAN_IR_BEU_MASK
58 #define MCAN_INT_BIT_ERROR_CORRECTED MCAN_IR_BEC_MASK
60 #define MCAN_INT_MSG_STORE_TO_RXBUF MCAN_IR_DRX_MASK
61 #define MCAN_INT_TIMEOUT_OCCURRED MCAN_IR_TOO_MASK
62 #define MCAN_INT_MSG_RAM_ACCESS_FAILURE MCAN_IR_MRAF_MASK
63 #define MCAN_INT_TIMESTAMP_WRAPAROUND MCAN_IR_TSW_MASK
65 #define MCAN_INT_TX_EVT_FIFO_EVT_LOST MCAN_IR_TEFL_MASK
66 #define MCAN_INT_TX_EVT_FIFO_FULL MCAN_IR_TEFF_MASK
67 #define MCAN_INT_TX_EVT_FIFO_WMK_REACHED MCAN_IR_TEFW_MASK
68 #define MCAN_INT_TX_EVT_FIFO_NEW_ENTRY MCAN_IR_TEFN_MASK
70 #define MCAN_INT_TXFIFO_EMPTY MCAN_IR_TFE_MASK
71 #define MCAN_INT_TX_CANCEL_FINISHED MCAN_IR_TCF_MASK
72 #define MCAN_INT_TX_COMPLETED MCAN_IR_TC_MASK
73 #define MCAN_INT_HIGH_PRIORITY_MSG MCAN_IR_HPM_MASK
75 #define MCAN_INT_RXFIFO1_MSG_LOST MCAN_IR_RF1L_MASK
76 #define MCAN_INT_RXFIFO1_FULL MCAN_IR_RF1F_MASK
77 #define MCAN_INT_RXFIFO1_WMK_REACHED MCAN_IR_RF1W_MASK
78 #define MCAN_INT_RXFIFO1_NEW_MSG MCAN_IR_RF1N_MASK
80 #define MCAN_INT_RXFIFO0_MSG_LOST MCAN_IR_RF0L_MASK
81 #define MCAN_INT_RXFIFO0_FULL MCAN_IR_RF0F_MASK
82 #define MCAN_INT_RXFIFO0_WMK_REACHED MCAN_IR_RF0W_MASK
83 #define MCAN_INT_RXFIFO0_NEW_MSG MCAN_IR_RF0N_MASK
88 #define MCAN_EVENT_RECEIVE (MCAN_INT_RXFIFO0_NEW_MSG | MCAN_INT_RXFIFO1_NEW_MSG | MCAN_INT_MSG_STORE_TO_RXBUF)
89 
93 #define MCAN_EVENT_TRANSMIT (MCAN_INT_TX_COMPLETED)
97 #define MCAN_EVENT_ERROR (MCAN_INT_BUS_OFF_STATUS | MCAN_INT_WARNING_STATUS \
98  | MCAN_INT_ERROR_PASSIVE | MCAN_INT_BIT_ERROR_UNCORRECTED \
99  | MCAN_INT_PROTOCOL_ERR_IN_DATA_PHASE | MCAN_INT_PROTOCOL_ERR_IN_ARB_PHASE)
100 
104 #define MCAN_TX_RETRY_COUNT_MAX (10000000UL)
108 #define MCAN_RX_RETRY_COUNT_MAX (80000000UL)
109 
113 typedef enum mcan_last_error_code {
123 
127 typedef enum mcan_activity_enum {
133 
134 /***********************************************************************************************************************
135  * @brief Default CAN RAM definitions
136  **********************************************************************************************************************/
137 #define MCAN_RAM_WORD_SIZE (640U)
138 /* CAN Filter Element Size Definitions */
139 #define MCAN_FILTER_ELEM_STD_ID_SIZE (4U)
140 #define MCAN_FILTER_ELEM_EXT_ID_SIZE (8U)
141 #define MCAN_STD_FILTER_ELEM_SIZE_MAX (128U)
142 #define MCAN_EXT_FILTER_ELEM_SIZE_MAX (64U)
143 /* MCAN Default Field Size Definitions for CAN2.0 */
144 #define MCAN_TXRX_ELEM_SIZE_CAN_MAX (4U * sizeof(uint32_t))
145 #define MCAN_FILTER_SIZE_CAN_DEFAULT (32U)
146 #define MCAN_TXBUF_SIZE_CAN_DEFAULT (32U)
147 #define MCAN_RXFIFO_SIZE_CAN_DEFAULT (32U)
148 #define MCAN_RXBUF_SIZE_CAN_DEFAULT (16U)
149 /* MCAN Default Field Size Definitions for CANFD */
150 #define MCAN_TXRX_ELEM_SIZE_CANFD_MAX (18U * sizeof(uint32_t))
151 #define MCAN_FILTER_SIZE_CANFD_DEFAULT (16U)
152 #define MCAN_TXBUF_SIZE_CANFD_DEFAULT (8U)
153 #define MCAN_RXFIFO_SIZE_CANFD_DEFAULT (8U)
154 #define MCAN_RXBUF_SIZE_CANFD_DEFAULT (4U)
155 
156 #define MCAN_TXEVT_ELEM_SIZE (8U)
157 
162  uint16_t prescaler;
163  uint16_t num_seg1;
164  uint16_t num_seg2;
165  uint8_t num_sjw;
166  bool enable_tdc;
168 
177 
181 #define MCAN_MESSAGE_HEADER_SIZE_IN_BYTES (8U)
182 #define MCAN_MESSAGE_HEADER_SIZE_IN_WORDS (2U)
183 
191 typedef struct mcan_tx_message_struct {
192  union {
193  struct {
194  uint32_t ext_id: 29;
195  uint32_t rtr: 1;
196  uint32_t use_ext_id: 1;
197  uint32_t error_state_indicator: 1;
198  };
199  struct {
200  uint32_t : 18;
201  uint32_t std_id: 11;
202  uint32_t : 3;
203  };
204  };
205  struct {
206  uint32_t : 8;
207  uint32_t message_marker_h: 8;
208  uint32_t dlc: 4;
209  uint32_t bitrate_switch: 1;
210  uint32_t canfd_frame: 1;
212  uint32_t event_fifo_control: 1;
213  uint32_t message_marker_l: 8;
214  };
215  union {
216  uint8_t data_8[64];
217  uint32_t data_32[16];
218  };
220 
228 typedef struct mcan_rx_message_struct {
229  union {
230  struct {
231  uint32_t ext_id: 29;
232  uint32_t rtr: 1;
233  uint32_t use_ext_id: 1;
234  uint32_t error_state_indicator: 1;
235  };
236  struct {
237  uint32_t : 18;
238  uint32_t std_id: 11;
239  uint32_t : 3;
240  };
241  };
242  struct {
243  union {
244  uint16_t rx_timestamp;
245  struct {
246  uint16_t rx_timestamp_pointer: 4;
247  uint16_t rx_timestamp_captured: 1;
248  uint16_t : 11;
249  };
250  };
251  };
252  struct {
253  uint16_t dlc: 4;
254  uint16_t bitrate_switch: 1;
255  uint16_t canfd_frame: 1;
256  uint16_t : 2;
257  uint16_t filter_index: 7;
259  };
260  union {
261  uint8_t data_8[64];
262  uint32_t data_32[16];
263  };
265 
270  struct {
271  /* First word */
272  union {
273  struct {
274  uint32_t ext_id: 29;
275  uint32_t rtr: 1;
276  uint32_t extend_id: 1;
277  uint32_t error_state_indicator: 1;
278  };
279  struct {
280  uint32_t : 18;
281  uint32_t std_id: 11;
282  uint32_t : 3;
283  };
284  };
285 
286  /* first 16-bit of the 2nd word */
287  union {
288  uint16_t tx_timestamp;
289  struct {
290  uint16_t tx_timestamp_pointer: 4;
291  uint16_t tx_timestamp_captured: 1;
292  uint16_t : 11;
293  };
294  };
295  /* high-half 16-bit of the 2nd word */
296  struct {
297  uint16_t dlc: 4;
298  uint16_t bitrate_switch: 1;
299  uint16_t canfd_frame: 1;
300  uint16_t event_type: 2;
301  uint16_t message_marker: 8;
302  };
303  };
304  uint32_t words[2];
306 
307 
308 
312 #define MCAN_CAN_ID_TYPE_STANDARD (0U)
313 #define MCAN_CAN_ID_TYPE_EXTENDED (1U)
319  struct {
320  uint16_t list_start_addr;
321  uint16_t list_size;
322  };
323  uint32_t reg_val;
325 
330  struct {
331  uint32_t start_addr: 16;
332  uint32_t fifo_size: 8;
333  uint32_t watermark: 7;
334  uint32_t operation_mode: 1;
335  };
336  uint32_t reg_val;
338 
342 typedef struct {
343  uint32_t start_addr;
345 
346 
351 #define MCAN_MSG_DLC_0_BYTES (0U)
352 #define MCAN_MSG_DLC_1_BYTES (1U)
353 #define MCAN_MSG_DLC_2_BYTES (2U)
354 #define MCAN_MSG_DLC_3_BYTES (3U)
355 #define MCAN_MSG_DLC_4_BYTES (4U)
356 #define MCAN_MSG_DLC_5_BYTES (5U)
357 #define MCAN_MSG_DLC_6_BYTES (6U)
358 #define MCAN_MSG_DLC_7_BYTES (7U)
359 #define MCAN_MSG_DLC_8_BYTES (8U)
360 #define MCAN_MSG_DLC_12_BYTES (9U)
361 #define MCAN_MSG_DLC_16_BYTES (10U)
362 #define MCAN_MSG_DLC_20_BYTES (11U)
363 #define MCAN_MSG_DLC_24_BYTES (12U)
364 #define MCAN_MSG_DLC_32_BYTES (13U)
365 #define MCAN_MSG_DLC_48_BYTES (14U)
366 #define MCAN_MSG_DLC_64_BYTES (15U)
367 
371 #define MCAN_DATA_FIELD_SIZE_8BYTES (0U)
372 #define MCAN_DATA_FIELD_SIZE_12BYTES (1U)
373 #define MCAN_DATA_FIELD_SIZE_16BYTES (2U)
374 #define MCAN_DATA_FIELD_SIZE_20BYTES (3U)
375 #define MCAN_DATA_FIELD_SIZE_24BYTES (4U)
376 #define MCAN_DATA_FIELD_SIZE_32BYTES (5U)
377 #define MCAN_DATA_FIELD_SIZE_48BYTES (6U)
378 #define MCAN_DATA_FIELD_SIZE_64BYTES (7U)
379 
383 #define MCAN_FIFO_OPERATION_MODE_BLOCKING (0U)
384 #define MCAN_FIFO_OPERATION_MODE_OVERWRITE (1U)
385 
390  struct {
391  uint32_t fifo0_data_field_size: 4;
392  uint32_t fifo1_data_field_size: 4;
393  uint32_t buf_data_field_size: 4;
394  uint32_t : 20;
395  };
396  uint32_t reg_val;
398 
402 #define MCAN_TXBUF_OPERATION_MODE_FIFO (0U)
403 #define MCAN_TXBUF_OPERATION_MODE_QUEUE (1U)
404 
405 
407  struct {
408  uint32_t start_addr: 16;
409  uint32_t dedicated_tx_buf_size: 6;
410  uint32_t : 2;
411  uint32_t fifo_queue_size: 6;
412  uint32_t tx_fifo_queue_mode: 1;
413  uint32_t : 1;
414  };
415  uint32_t reg_val;
417 
419  uint32_t data_field_size;
421 
425 typedef union {
426  struct {
427  uint16_t start_addr;
428  uint8_t fifo_size;
429  uint8_t fifo_watermark;
430  };
431  uint32_t reg_val;
433 
461 
469 typedef struct mcan_ram_config_struct {
476  struct {
477  uint32_t enable: 4;
478  uint32_t elem_count: 8;
479  uint32_t watermark: 8;
480  uint32_t operation_mode: 4;
481  uint32_t data_field_size: 8;
482  } rxfifos[2];
483 
498 
502 #define MCAN_ACCEPT_NON_MATCHING_FRAME_OPTION_IN_RXFIFO0 (0U)
503 #define MCAN_ACCEPT_NON_MATCHING_FRAME_OPTION_IN_RXFIFO1 (1U)
504 #define MCAN_ACCEPT_NON_MATCHING_FRAME_OPTION_REJECT (2U)
515 
519 #define MCAN_FILTER_TYPE_RANGE_FILTER (0U)
520 #define MCAN_FILTER_TYPE_SPECIFIED_ID_FILTER (1U)
521 #define MCAN_FILTER_TYPE_CLASSIC_FILTER (2U)
522 #define MCAN_FILTER_TYPE_FILTER_DISABLED (3U)
523 #define MCAN_FILTER_TYPE_DUAL_ID_EXT_FILTER_IGNORE_MASK (4U)
528 #define MCAN_FILTER_ELEM_CFG_DISABLED (0)
529 #define MCAN_FILTER_ELEM_CFG_STORE_IN_RX_FIFO0_IF_MATCH (1U)
530 #define MCAN_FILTER_ELEM_CFG_STORE_IN_RX_FIFO1_IF_MATCH (2U)
531 #define MCAN_FILTER_ELEM_CFG_REJECT_ID_IF_MATCH (3U)
532 #define MCAN_FILTER_ELEM_CFG_SET_PRIORITY_IF_MATCH (4U)
534 #define MCAN_FILTER_ELEM_CFG_SET_PRIORITY_AND_STORE_IN_FIFO0_IF_MATCH (5U)
536 #define MCAN_FILTER_ELEM_CFG_SET_PRIORITY_AND_STORE_IN_FIFO1_IF_MATCH (6U)
537 #define MCAN_FILTER_ELEM_CFG_STORE_INTO_RX_BUFFER_OR_AS_DBG_MSG (7U)
543  uint8_t filter_type;
544  uint8_t filter_config;
545  uint8_t can_id_type;
546  uint8_t sync_message;
547  union {
548  /* This definition takes effect if the filter type is range filter */
549  struct {
550  uint32_t start_id;
551  uint32_t end_id;
552  };
553  /* This definition takes effect if the filter type is dual id filter */
554  struct {
555  uint32_t id1;
556  uint32_t id2;
557  };
558  /* This definition takes effect if the filter type is classic filter */
559  struct {
560  uint32_t filter_id;
561  uint32_t filter_mask;
562  };
563  /* This definition takes effect if the filter configuration is "store into RX Buffer or as debug message"
564  *
565  * In this definition, only the exact ID matching mode is activated
566  */
567  struct {
568  uint32_t match_id;
569  uint32_t offset: 6;
570  uint32_t filter_event: 3;
571  uint32_t store_location: 2;
572  uint32_t : 21;
573  };
574  };
576 
584 
592  uint32_t ext_id_mask;
596 
600 typedef enum mcan_node_mode_enum {
606 
611  bool is_16bit;
612  bool is_32bit;
613  bool is_64bit;
614  bool is_empty;
615  union {
616  uint16_t ts_16bit;
617  uint32_t ts_32bit;
618  uint64_t ts_64bit;
619  uint32_t words[2];
620  };
622 
626 typedef struct mcan_tsu_config_struct {
627  uint16_t prescaler;
631  uint8_t tbsel_option;
632  bool enable_tsu;
635 
639 #define MCAN_TIMESTAMP_SEL_MIN (0U)
640 #define MCAN_TIMESTAMP_SEL_VALUE_ALWAYS_ZERO (0U)
641 #define MCAN_TIMESTAMP_SEL_VALUE_INCREMENT (1U)
642 #define MCAN_TIMESTAMP_SEL_EXT_TS_VAL_USED (2U)
643 #define MCAN_TIMESTAMP_SEL_MAX (MCAN_TIMESTAMP_SEL_EXT_TS_VAL_USED)
644 
652 
656 typedef enum mcan_timeout_sel_enum {
662 
669  uint16_t timeout_period;
671 
675 typedef struct mcan_tdc_config_t {
676  uint8_t ssp_offset;
679 
680 
684 typedef struct mcan_config_struct {
685  union {
686  /* This struct takes effect if "use_lowlevel_timing_setting = false" */
687  struct {
688  uint32_t baudrate;
689  uint32_t baudrate_fd;
694  };
695  /* This struct takes effect if "use_lowlevel_timing_setting = true" */
696  struct {
699  };
700  };
710  bool enable_tdc;
721  uint32_t interrupt_mask;
725 
729 #define MCAN_TIMEOUT_SEL_TYPE_CONTINUOUS_OPERATION (0U)
730 #define MCAN_TIMEOUT_SEL_TYPE_TIMEOUT_CTRL_BY_TX_EVT_FIFO (1U)
731 #define MCAN_TIMEOUT_SEL_TYPE_TIMEOUT_CTRL_BY_RX_FIFO0 (2U)
732 #define MCAN_TIMEOUT_SEL_TYPE_TIMEOUT_CTRL_BY_RX_FIFO1 (3U)
733 
740  uint16_t timeout_period;
742 
746 typedef struct mcan_error_count_struct {
752 
756 typedef struct mcan_protocol_status {
757  uint8_t tdc_val;
768 
772 #define MCAN_MESSAGE_STORAGE_INDICATOR_NO_FIFO_SELECTED (0U)
773 #define MCAN_MESSAGE_STORAGE_INDICATOR_FIFO_MESSAGE_LOST (1U)
774 #define MCAN_MESSAGE_STORAGE_INDICATOR_RXFIFO0 (2U)
775 #define MCAN_MESSAGE_STORAGE_INDICATOR_RXFIFO1 (3U)
776 
782  uint8_t filter_index;
784  uint8_t buffer_index;
786 
791 static inline void mcan_enable_transmit_pause(MCAN_Type *ptr)
792 {
793  ptr->CCCR |= MCAN_CCCR_TXP_MASK;
794 }
795 
800 static inline void mcan_disable_transmit_pause(MCAN_Type *ptr)
801 {
802  ptr->CCCR &= ~MCAN_CCCR_TXP_MASK;
803 }
804 
809 static inline void mcan_enable_edge_filtering(MCAN_Type *ptr)
810 {
811  ptr->CCCR |= MCAN_CCCR_EFBI_MASK;
812 }
813 
818 static inline void mcan_disable_edge_filtering(MCAN_Type *ptr)
819 {
820  ptr->CCCR &= ~MCAN_CCCR_EFBI_MASK;
821 }
822 
828 {
829  ptr->CCCR &= ~MCAN_CCCR_PXHD_MASK;
830 }
831 
837 {
838  ptr->CCCR |= MCAN_CCCR_PXHD_MASK;
839 }
840 
846 {
847  ptr->CCCR |= MCAN_CCCR_WMM_MASK;
848 }
849 
855 {
856  ptr->CCCR &= ~MCAN_CCCR_WMM_MASK;
857 }
858 
863 static inline void mcan_enable_tsu(MCAN_Type *ptr)
864 {
865  ptr->CCCR |= MCAN_CCCR_UTSU_MASK;
866 }
867 
872 static inline void mcan_disable_tsu(MCAN_Type *ptr)
873 {
874  ptr->CCCR &= ~MCAN_CCCR_UTSU_MASK;
875 }
876 
883 static inline bool mcan_is_tsu_used(MCAN_Type *ptr)
884 {
885  return ((ptr->CCCR & MCAN_CCCR_UTSU_MASK) != 0U);
886 }
887 
895 {
896  return ((ptr->TSCFG & MCAN_TSCFG_EN64_MASK) != 0U);
897 }
898 
903 static inline void mcan_enable_bitrate_switch(MCAN_Type *ptr)
904 {
905  ptr->CCCR |= MCAN_CCCR_BRSE_MASK;
906 }
907 
912 static inline void mcan_disable_bitrate_switch(MCAN_Type *ptr)
913 {
914  ptr->CCCR &= ~MCAN_CCCR_BRSE_MASK;
915 }
916 
922 {
923  ptr->CCCR &= ~MCAN_CCCR_DAR_MASK;
924 }
925 
931 {
932  ptr->CCCR |= MCAN_CCCR_DAR_MASK;
933 }
934 
940 {
941  ptr->CCCR |= MCAN_CCCR_MON_MASK;
942 }
943 
948 static inline void mcan_stop_clock(MCAN_Type *ptr)
949 {
950  ptr->CCCR |= MCAN_CCCR_CSR_MASK;
951 }
952 
957 static inline void mcan_enable_clock(MCAN_Type *ptr)
958 {
959  ptr->CCCR &= ~MCAN_CCCR_CSR_MASK;
960 }
961 
962 static inline bool mcan_is_clock_enabled(MCAN_Type *ptr)
963 {
964  return ((ptr->CCCR & MCAN_CCCR_CSR_MASK) == 0UL);
965 }
966 
972 {
973  ptr->CCCR &= ~MCAN_CCCR_MON_MASK;
974 }
975 
980 static inline bool mcan_is_clock_stopped(MCAN_Type *ptr)
981 {
982  return ((ptr->CCCR & MCAN_CCCR_CSA_MASK) != 0U);
983 }
984 
990 {
991  ptr->CCCR |= MCAN_CCCR_ASM_MASK;
992 }
993 
999 {
1000  ptr->CCCR &= ~MCAN_CCCR_ASM_MASK;
1001 }
1002 
1008 {
1009  ptr->CCCR |= MCAN_CCCR_CCE_MASK;
1010 }
1011 
1017 {
1018  ptr->CCCR &= ~MCAN_CCCR_CCE_MASK;
1019 }
1020 
1026 static inline uint16_t mcan_get_timestamp_counter_value(MCAN_Type *ptr)
1027 {
1028  return ptr->TSCV;
1029 }
1030 
1035 static inline void mcan_enter_init_mode(MCAN_Type *ptr)
1036 {
1037  ptr->CCCR |= MCAN_CCCR_INIT_MASK;
1038 }
1039 
1044 static inline void mcan_enter_normal_mode(MCAN_Type *ptr)
1045 {
1046  ptr->CCCR &= ~MCAN_CCCR_INIT_MASK;
1047 }
1048 
1054 static inline uint16_t mcan_get_timeout_counter_value(MCAN_Type *ptr)
1055 {
1056  return ptr->TOCV;
1057 }
1058 
1065 {
1066  *((volatile uint32_t *) &ptr->TOCV) = 0;
1067 }
1068 
1074 static inline void mcan_get_error_counter(MCAN_Type *ptr, mcan_error_count_t *err_cnt)
1075 {
1076  uint32_t ecr = ptr->ECR;
1077  err_cnt->transmit_error_count = MCAN_ECR_TEC_GET(ecr);
1078  err_cnt->receive_error_count = MCAN_ECR_REC_GET(ecr);
1079  err_cnt->receive_error_passive = (MCAN_ECR_RP_GET(ecr) == 1U);
1080  err_cnt->can_error_logging_count = MCAN_ECR_CEL_GET(ecr);
1081 }
1082 
1088 static inline uint8_t mcan_get_last_error_code(MCAN_Type *ptr)
1089 {
1090  return MCAN_PSR_LEC_GET(ptr->PSR);
1091 }
1092 
1098 static inline uint8_t mcan_get_last_data_error_code(MCAN_Type *ptr)
1099 {
1100  return MCAN_PSR_DLEC_GET(ptr->PSR);
1101 }
1102 
1108 static inline uint8_t mcan_get_activity(MCAN_Type *ptr)
1109 {
1110  return MCAN_PSR_ACT_GET(ptr->PSR);
1111 }
1112 
1118 static inline bool mcan_is_in_err_passive_state(MCAN_Type *ptr)
1119 {
1120  return (MCAN_PSR_EP_GET(ptr->PSR) == 1U);
1121 }
1122 
1129 {
1130  return (MCAN_PSR_EW_GET(ptr->PSR) == 1U);
1131 }
1132 
1138 static inline bool mcan_is_in_busoff_state(MCAN_Type *ptr)
1139 {
1140  return (MCAN_PSR_BO_GET(ptr->PSR) == 1U);
1141 }
1142 
1150 {
1151  return MCAN_PSR_DLEC_GET(ptr->PSR);
1152 }
1153 
1160 {
1161  return (MCAN_PSR_RESI_GET(ptr->PSR) == 1U);
1162 }
1163 
1170 {
1171  return (MCAN_PSR_RBRS_GET(ptr->PSR) == 1U);
1172 }
1173 
1180 {
1181  return (MCAN_PSR_RFDF_GET(ptr->PSR) == 1U);
1182 }
1183 
1190 {
1191  return (MCAN_PSR_PXE_GET(ptr->PSR) == 1U);
1192 }
1193 
1200 {
1201  return MCAN_PSR_TDCV_GET(ptr->PSR);
1202 }
1203 
1209 static inline uint32_t mcan_get_interrupt_flags(MCAN_Type *ptr)
1210 {
1211  return ptr->IR;
1212 }
1213 
1219 static inline void mcan_clear_interrupt_flags(MCAN_Type *ptr, uint32_t mask)
1220 {
1221  ptr->IR = mask;
1222 }
1223 
1229 static inline void mcan_enable_interrupts(MCAN_Type *ptr, uint32_t mask)
1230 {
1231  ptr->ILS &= ~mask;
1232  ptr->IE |= mask;
1233  ptr->ILE = 1U;
1234 }
1235 
1242 static inline void mcan_enable_txbuf_interrupt(MCAN_Type *ptr, uint32_t mask)
1243 {
1244  ptr->TXBTIE |= mask;
1245 }
1246 
1253 static inline void mcan_disable_txbuf_interrupt(MCAN_Type *ptr, uint32_t mask)
1254 {
1255  ptr->TXBTIE &= ~mask;
1256 }
1257 
1263 static inline void mcan_disable_interrupts(MCAN_Type *ptr, uint32_t mask)
1264 {
1265  ptr->IE &= ~mask;
1266 }
1267 
1273 static inline void mcan_enable_txbuf_transmission_interrupt(MCAN_Type *ptr, uint32_t mask)
1274 {
1275  ptr->TXBTIE |= mask;
1276 }
1277 
1283 static inline void mcan_disable_txbuf_transmission_interrupt(MCAN_Type *ptr, uint32_t mask)
1284 {
1285  ptr->TXBTIE &= ~mask;
1286 }
1287 
1293 static inline void mcan_enable_txbuf_cancel_finish_interrupt(MCAN_Type *ptr, uint32_t mask)
1294 {
1295  ptr->TXBCIE |= mask;
1296 }
1297 
1303 static inline void mcan_disable_txbuf_cancel_finish_interrupt(MCAN_Type *ptr, uint32_t mask)
1304 {
1305  ptr->TXBCIE &= ~mask;
1306 }
1307 
1314 static inline void mcan_interrupt_line_select(MCAN_Type *ptr, uint32_t mask, uint8_t line_index)
1315 {
1316  if (line_index == 0) {
1317  ptr->ILS &= ~mask;
1318  } else {
1319  ptr->ILS |= mask;
1320  }
1321  ptr->ILE = (1UL << line_index);
1322 }
1323 
1330 static inline bool mcan_is_transmit_request_pending(MCAN_Type *ptr, uint32_t index)
1331 {
1332  return ((ptr->TXBRP & ((1UL << index))) != 0U);
1333 }
1334 
1340 static inline bool mcan_is_txfifo_full(MCAN_Type *ptr)
1341 {
1342  return ((ptr->TXFQS & MCAN_TXFQS_TFQF_MASK) != 0U);
1343 }
1344 
1350 static inline uint32_t mcan_get_txfifo_put_index(MCAN_Type *ptr)
1351 {
1352  return MCAN_TXFQS_TFQPI_GET(ptr->TXFQS);
1353 }
1354 
1360 static inline void mcan_send_add_request(MCAN_Type *ptr, uint32_t index)
1361 {
1362  ptr->TXBAR = (1UL << index);
1363 }
1364 
1371 static inline void mcan_send_add_multiple_requests(MCAN_Type *ptr, uint32_t index_bitmask)
1372 {
1373  ptr->TXBAR = index_bitmask;
1374 }
1375 
1381 static inline void mcan_cancel_tx_buf_send_request(MCAN_Type *ptr, uint32_t index)
1382 {
1383  ptr->TXBCR = (1UL << index);
1384 }
1385 
1392 static inline bool mcan_is_tx_buf_cancellation_finished(MCAN_Type *ptr, uint32_t index)
1393 {
1394  return ((ptr->TXBCF & ((1UL << index))) != 0U);
1395 }
1396 
1403 static inline bool mcan_is_transmit_occurred(MCAN_Type *ptr, uint32_t index)
1404 {
1405  return ((ptr->TXBTO & (1UL << index)) != 0U);
1406 }
1407 
1414 static inline bool mcan_is_rxbuf_data_available(MCAN_Type *ptr, uint32_t index)
1415 {
1416  bool result;
1417  if (index < 32U) {
1418  result = (ptr->NDAT1 & (1UL << index)) != 0U;
1419  } else if (index < 64U) {
1420  result = (ptr->NDAT2 & (1UL << (index - 32U))) != 0U;
1421  } else {
1422  result = false;
1423  }
1424  return result;
1425 }
1426 
1432 static inline void mcan_clear_rxbuf_data_available_flag(MCAN_Type *ptr, uint32_t index)
1433 {
1434  if (index < 32U) {
1435  ptr->NDAT1 = (1UL << index);
1436  } else if (index < 64U) {
1437  ptr->NDAT2 = (1UL << (index - 32U));
1438  } else {
1439  /* Do nothing */
1440  }
1441 }
1442 
1449 static inline bool mcan_is_interrupt_flag_set(MCAN_Type *ptr, uint32_t mask)
1450 {
1451  return ((ptr->IR & mask) != 0U);
1452 }
1453 
1462 static inline bool mcan_is_tsu_timestamp_available(MCAN_Type *ptr, uint32_t index)
1463 {
1464  bool is_available = false;
1465  if (index < ARRAY_SIZE(ptr->TS_SEL)) {
1466  is_available = ((ptr->TSS1 & (1UL << index)) != 0U);
1467  }
1468  return is_available;
1469 }
1470 
1477 uint32_t mcan_read_32bit_tsu_timestamp(MCAN_Type *ptr, uint32_t index);
1478 
1485 uint64_t mcan_read_64bit_tsu_timestamp(MCAN_Type *ptr, uint32_t index);
1486 
1493 
1499 void mcan_get_default_config(MCAN_Type *ptr, mcan_config_t *config);
1500 
1506 uint8_t mcan_get_message_size_from_dlc(uint8_t dlc);
1507 
1514 uint8_t mcan_get_data_field_size(uint8_t data_field_size_option);
1515 
1568 void mcan_get_default_ram_flexible_config(MCAN_Type *ptr, mcan_ram_flexible_config_t *ram_config, bool enable_canfd);
1569 
1622 void mcan_get_default_ram_config(MCAN_Type *ptr, mcan_ram_config_t *simple_config, bool enable_canfd);
1623 
1632 hpm_stat_t mcan_init(MCAN_Type *ptr, mcan_config_t *config, uint32_t src_clk_freq);
1633 
1639 void mcan_deinit(MCAN_Type *ptr);
1640 
1648 
1656 
1664 
1672 
1680 
1688 hpm_stat_t mcan_set_filter_element(MCAN_Type *ptr, const mcan_filter_elem_t *filter_elem, uint32_t index);
1689 
1697 hpm_stat_t mcan_write_txbuf(MCAN_Type *ptr, uint32_t index, mcan_tx_frame_t *tx_frame);
1698 
1706 
1714 hpm_stat_t mcan_read_rxbuf(MCAN_Type *ptr, uint32_t index, mcan_rx_message_t *rx_frame);
1715 
1723 hpm_stat_t mcan_read_rxfifo(MCAN_Type *ptr, uint32_t fifo_index, mcan_rx_message_t *rx_frame);
1724 
1734 
1742 
1753 hpm_stat_t mcan_request_and_fill_txfifo(MCAN_Type *ptr, mcan_tx_frame_t *tx_frame, uint32_t *fifo_index);
1754 
1763 hpm_stat_t mcan_transmit_via_txfifo_nonblocking(MCAN_Type *ptr, mcan_tx_frame_t *tx_frame, uint32_t *fifo_index);
1764 
1773 
1781 hpm_stat_t mcan_receive_from_buf_blocking(MCAN_Type *ptr, uint32_t index, mcan_rx_message_t *rx_frame);
1782 
1790 hpm_stat_t mcan_receive_from_fifo_blocking(MCAN_Type *ptr, uint32_t fifo_index, mcan_rx_message_t *rx_frame);
1791 
1802  const mcan_tx_event_fifo_elem_t *tx_evt,
1803  mcan_timestamp_value_t *timestamp);
1804 
1815  const mcan_rx_message_t *rx_msg,
1816  mcan_timestamp_value_t *timestamp);
1817 
1826 hpm_stat_t mcan_parse_protocol_status(uint32_t psr, mcan_protocol_status_t *protocol_status);
1827 
1837 
1843 #ifdef __cplusplus
1844 }
1845 #endif
1846 
1847 
1848 #endif /* HPM_MCAN_DRV_H */
#define MCAN_CCCR_UTSU_MASK
Definition: hpm_mcan_regs.h:330
#define MCAN_CCCR_INIT_MASK
Definition: hpm_mcan_regs.h:452
#define MCAN_PSR_TDCV_GET(x)
Definition: hpm_mcan_regs.h:650
#define MCAN_CCCR_DAR_MASK
Definition: hpm_mcan_regs.h:379
#define MCAN_CCCR_WMM_MASK
Definition: hpm_mcan_regs.h:315
#define MCAN_CCCR_CCE_MASK
Definition: hpm_mcan_regs.h:440
#define MCAN_PSR_RESI_GET(x)
Definition: hpm_mcan_regs.h:701
#define MCAN_PSR_EP_GET(x)
Definition: hpm_mcan_regs.h:746
#define MCAN_TSCFG_EN64_MASK
Definition: hpm_mcan_regs.h:2768
#define MCAN_PSR_RFDF_GET(x)
Definition: hpm_mcan_regs.h:675
#define MCAN_TXFQS_TFQPI_GET(x)
Definition: hpm_mcan_regs.h:2401
#define MCAN_CCCR_BRSE_MASK
Definition: hpm_mcan_regs.h:343
#define MCAN_PSR_BO_GET(x)
Definition: hpm_mcan_regs.h:724
#define MCAN_ECR_REC_GET(x)
Definition: hpm_mcan_regs.h:627
#define MCAN_CCCR_TXP_MASK
Definition: hpm_mcan_regs.h:277
#define MCAN_PSR_LEC_GET(x)
Definition: hpm_mcan_regs.h:789
#define MCAN_CCCR_ASM_MASK
Definition: hpm_mcan_regs.h:428
#define MCAN_PSR_EW_GET(x)
Definition: hpm_mcan_regs.h:735
#define MCAN_TXFQS_TFQF_MASK
Definition: hpm_mcan_regs.h:2389
#define MCAN_PSR_ACT_GET(x)
Definition: hpm_mcan_regs.h:761
#define MCAN_ECR_TEC_GET(x)
Definition: hpm_mcan_regs.h:638
#define MCAN_ECR_RP_GET(x)
Definition: hpm_mcan_regs.h:617
#define MCAN_PSR_PXE_GET(x)
Definition: hpm_mcan_regs.h:662
#define MCAN_PSR_DLEC_GET(x)
Definition: hpm_mcan_regs.h:713
#define MCAN_CCCR_CSR_MASK
Definition: hpm_mcan_regs.h:404
#define MCAN_CCCR_PXHD_MASK
Definition: hpm_mcan_regs.h:302
#define MCAN_CCCR_EFBI_MASK
Definition: hpm_mcan_regs.h:289
#define MCAN_CCCR_CSA_MASK
Definition: hpm_mcan_regs.h:416
#define MCAN_ECR_CEL_GET(x)
Definition: hpm_mcan_regs.h:606
#define MCAN_CCCR_MON_MASK
Definition: hpm_mcan_regs.h:392
#define MCAN_PSR_RBRS_GET(x)
Definition: hpm_mcan_regs.h:688
uint32_t hpm_stat_t
Definition: hpm_common.h:135
#define ARRAY_SIZE(a)
Definition: hpm_common.h:42
#define MAKE_STATUS(group, code)
Definition: hpm_common.h:144
@ status_group_mcan
Definition: hpm_common.h:173
enum mcan_node_mode_enum mcan_node_mode_t
CAN Node Mode types.
struct mcan_tdc_config_t mcan_tdc_config_t
MCAN Transmitter Delay Compensation Configuration.
struct mcan_config_struct mcan_config_t
MCAN Configuration Structure.
static void mcan_enter_normal_mode(MCAN_Type *ptr)
Switch MCAN to Normal mode.
Definition: hpm_mcan_drv.h:1044
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 buf...
Definition: hpm_mcan_drv.h:1371
uint8_t mcan_get_message_size_from_dlc(uint8_t dlc)
Get message Size from Data Length Code.
Definition: hpm_mcan_drv.c:1439
static void mcan_enable_clock(MCAN_Type *ptr)
Enable MCAN clock.
Definition: hpm_mcan_drv.h:957
static void mcan_disable_protocol_exception_handling(MCAN_Type *ptr)
Disable Protocol Exception Handling.
Definition: hpm_mcan_drv.h:836
static void mcan_cancel_tx_buf_send_request(MCAN_Type *ptr, uint32_t index)
Cancel the TXBUF Send request.
Definition: hpm_mcan_drv.h:1381
enum mcan_bit_timing_option mcan_bit_timing_option_t
CAN Bit Timing Options.
static uint8_t mcan_get_activity(MCAN_Type *ptr)
Get CAN Activity.
Definition: hpm_mcan_drv.h:1108
struct mcan_rx_message_struct mcan_rx_message_t
CAN Receive Message Frame.
static void mcan_enable_txbuf_transmission_interrupt(MCAN_Type *ptr, uint32_t mask)
Enable TXBUF Transmission interrupt.
Definition: hpm_mcan_drv.h:1273
static void mcan_stop_clock(MCAN_Type *ptr)
Stop MCAN clock.
Definition: hpm_mcan_drv.h:948
mcan_bit_timing_option
CAN Bit Timing Options.
Definition: hpm_mcan_drv.h:172
static bool mcan_is_transmit_occurred(MCAN_Type *ptr, uint32_t index)
Check whether the Transmission completed via specified TXBUF/TXFIFO.
Definition: hpm_mcan_drv.h:1403
hpm_stat_t mcan_set_filter_element(MCAN_Type *ptr, const mcan_filter_elem_t *filter_elem, uint32_t index)
Set CAN filter element.
Definition: hpm_mcan_drv.c:1326
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.
Definition: hpm_mcan_drv.c:1924
static bool mcan_is_rxbuf_data_available(MCAN_Type *ptr, uint32_t index)
Check Whether there are data available in specified RXBUF.
Definition: hpm_mcan_drv.h:1414
hpm_stat_t mcan_parse_protocol_status(uint32_t psr, mcan_protocol_status_t *protocol_status)
Parse the Protocol Status register value.
Definition: hpm_mcan_drv.c:1995
static void mcan_disable_auto_retransmission(MCAN_Type *ptr)
Disable Auto Transmission.
Definition: hpm_mcan_drv.h:930
static void mcan_disable_tsu(MCAN_Type *ptr)
Disable External Timestamp Unit.
Definition: hpm_mcan_drv.h:872
static void mcan_reset_timeout_counter_value(MCAN_Type *ptr)
Reset Timeout counter value.
Definition: hpm_mcan_drv.h:1064
static void mcan_interrupt_line_select(MCAN_Type *ptr, uint32_t mask, uint8_t line_index)
Select Interrupt Line.
Definition: hpm_mcan_drv.h:1314
static void mcan_clear_rxbuf_data_available_flag(MCAN_Type *ptr, uint32_t index)
Clear RXBUF Data available Flag for specified RXBUF.
Definition: hpm_mcan_drv.h:1432
static void mcan_enable_auto_retransmission(MCAN_Type *ptr)
Enable Auto Retransmission.
Definition: hpm_mcan_drv.h:921
static void mcan_clear_interrupt_flags(MCAN_Type *ptr, uint32_t mask)
Clear Interrupt Flags.
Definition: hpm_mcan_drv.h:1219
enum mcan_timeout_sel_enum mcan_timeout_sel_t
MCAN Timeout Selection Options.
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.
Definition: hpm_mcan_drv.c:1826
static void mcan_enter_init_mode(MCAN_Type *ptr)
Switch MCAN to Initialization mode.
Definition: hpm_mcan_drv.h:1035
struct mcan_timeout_config_struct mcan_timeout_config_t
MCAN Timeout configuration structure.
hpm_stat_t mcan_write_txfifo(MCAN_Type *ptr, mcan_tx_frame_t *tx_frame)
Write Frame CAN to TXFIFO.
Definition: hpm_mcan_drv.c:1528
struct mcan_ram_flexible_config_struct mcan_ram_flexible_config_t
MCAN RAM Flexible Configuration.
static void mcan_disable_wide_message_marker(MCAN_Type *ptr)
Disable Wide Message Marker.
Definition: hpm_mcan_drv.h:854
static void mcan_disable_interrupts(MCAN_Type *ptr, uint32_t mask)
Disable Interrupts.
Definition: hpm_mcan_drv.h:1263
static void mcan_disable_edge_filtering(MCAN_Type *ptr)
Disable Edge Filtering.
Definition: hpm_mcan_drv.h:818
hpm_stat_t mcan_set_global_filter_config(MCAN_Type *ptr, mcan_global_filter_config_t *filter_config)
Configure Global Filter.
Definition: hpm_mcan_drv.c:1861
hpm_stat_t mcan_transmit_blocking(MCAN_Type *ptr, mcan_tx_frame_t *tx_frame)
Transmit CAN message in blocking way.
Definition: hpm_mcan_drv.c:1721
struct mcan_bit_timing_param_struct mcan_bit_timing_param_t
CAN Bit Timing Parameters.
static void mcan_disable_txbuf_cancel_finish_interrupt(MCAN_Type *ptr, uint32_t mask)
Disable TXBUF Cancellation Finish interrupt.
Definition: hpm_mcan_drv.h:1303
union mcan_filter_config_struct mcan_filter_config_t
MCAN Filter Configuration.
static uint16_t mcan_get_timestamp_counter_value(MCAN_Type *ptr)
Get Timestamp Counter Value.
Definition: hpm_mcan_drv.h:1026
struct mcan_tsu_config_struct mcan_tsu_config_t
MCAN TSU Configuration.
static void mcan_enable_wide_message_marker(MCAN_Type *ptr)
Enable Wide Message Marker.
Definition: hpm_mcan_drv.h:845
struct mcan_timestamp_value_struct mcan_timestamp_value_t
MCAN Timestamp Value.
static void mcan_enable_bus_monitoring_mode(MCAN_Type *ptr)
Enable Bus monitoring Mode.
Definition: hpm_mcan_drv.h:939
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.
Definition: hpm_mcan_drv.c:1801
static bool mcan_is_txfifo_full(MCAN_Type *ptr)
Check whether TXFIFO is full.
Definition: hpm_mcan_drv.h:1340
struct mcan_error_count_struct mcan_error_count_t
MCAN Error Count Information.
static uint32_t mcan_get_txfifo_put_index(MCAN_Type *ptr)
Get the TXFIFO Put Index.
Definition: hpm_mcan_drv.h:1350
struct mcan_txbuf_elem_config_struct mcan_txbuf_elem_config_t
static void mcan_enable_write_to_prot_config_registers(MCAN_Type *ptr)
Enable Write Access to Protected Configuration Registers.
Definition: hpm_mcan_drv.h:1007
static void mcan_disable_restricted_operation_mode(MCAN_Type *ptr)
Disable Restricted Operation Mode.
Definition: hpm_mcan_drv.h:998
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.
Definition: hpm_mcan_drv.c:1693
static void mcan_enable_txbuf_interrupt(MCAN_Type *ptr, uint32_t mask)
Enable TXBUF Interrupt.
Definition: hpm_mcan_drv.h:1242
static bool mcan_is_clock_stopped(MCAN_Type *ptr)
Check whether CAN clock is stopped or not.
Definition: hpm_mcan_drv.h:980
static void mcan_disable_write_to_prot_config_registers(MCAN_Type *ptr)
Disable Write Access to Protected Configuration Registers.
Definition: hpm_mcan_drv.h:1016
hpm_stat_t mcan_get_protocol_status(MCAN_Type *ptr, mcan_protocol_status_t *protocol_status)
Get MCAN Protocol Status.
Definition: hpm_mcan_drv.c:2034
hpm_stat_t mcan_read_rxfifo(MCAN_Type *ptr, uint32_t fifo_index, mcan_rx_message_t *rx_frame)
Read message from CAN RXBUF.
Definition: hpm_mcan_drv.c:1587
static void mcan_disable_bus_monitoring_mode(MCAN_Type *ptr)
Disable Bus monitoring Mode.
Definition: hpm_mcan_drv.h:971
static uint8_t mcan_get_last_error_code(MCAN_Type *ptr)
Get Last Error Code.
Definition: hpm_mcan_drv.h:1088
static void mcan_send_add_request(MCAN_Type *ptr, uint32_t index)
Request A Transmission via specified TXBUF Index.
Definition: hpm_mcan_drv.h:1360
hpm_stat_t mcan_read_rxbuf(MCAN_Type *ptr, uint32_t index, mcan_rx_message_t *rx_frame)
Read message from CAN RXBUF.
Definition: hpm_mcan_drv.c:1557
static bool mcan_is_canfd_message_received(MCAN_Type *ptr)
Check whether CANFD messages were received.
Definition: hpm_mcan_drv.h:1179
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,...
Definition: hpm_mcan_drv.c:492
static void mcan_enable_txbuf_cancel_finish_interrupt(MCAN_Type *ptr, uint32_t mask)
Enable TXBUF Cancellation Finish interrupt.
Definition: hpm_mcan_drv.h:1293
union mcan_txbuf_config_struct mcan_txbuf_config_t
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.
Definition: hpm_mcan_drv.c:1747
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,...
Definition: hpm_mcan_drv.c:570
static bool mcan_is_tx_buf_cancellation_finished(MCAN_Type *ptr, uint32_t index)
Check whether TXBUF cancellation was finished.
Definition: hpm_mcan_drv.h:1392
static void mcan_disable_txbuf_interrupt(MCAN_Type *ptr, uint32_t mask)
Disable TXBUF Interrupt.
Definition: hpm_mcan_drv.h:1253
union mcan_rxfifo_config_struct mcan_rxfifo_config_t
MCAN RXFIFO Configuration.
static uint16_t mcan_get_timeout_counter_value(MCAN_Type *ptr)
Get Timeout value.
Definition: hpm_mcan_drv.h:1054
enum mcan_last_error_code mcan_last_err_code_t
MCAN Last Error Code.
struct mcan_std_id_filter_elem_struct mcan_filter_elem_t
MCAN Filter Element definitions.
struct mcan_high_priority_message_status_struct mcan_high_priority_message_status_t
MCAN High Priority Message Status Information.
static bool mcan_is_protocol_exception_event_occurred(MCAN_Type *ptr)
Check whether Protocol Exception Events were occurred.
Definition: hpm_mcan_drv.h:1189
static void mcan_disable_transmit_pause(MCAN_Type *ptr)
Disable Transmit Pause.
Definition: hpm_mcan_drv.h:800
uint8_t mcan_get_data_field_size(uint8_t data_field_size_option)
Get the Data field size from data field size option.
Definition: hpm_mcan_drv.c:1455
struct mcan_global_filter_config_struct mcan_global_filter_config_t
MCAN Global CAN configuration.
static void mcan_disable_bitrate_switch(MCAN_Type *ptr)
Disable Bit Rate Switch.
Definition: hpm_mcan_drv.h:912
struct mcan_ram_config_struct mcan_ram_config_t
MCAN RAM configuration.
hpm_stat_t mcan_write_txbuf(MCAN_Type *ptr, uint32_t index, mcan_tx_frame_t *tx_frame)
Write Frame to CAN TX Buffer.
Definition: hpm_mcan_drv.c:1491
static uint8_t mcan_get_last_data_error_code(MCAN_Type *ptr)
Get Last Data Phase Error Code.
Definition: hpm_mcan_drv.h:1098
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.
Definition: hpm_mcan_drv.c:865
struct mcan_filter_elem_list_struct mcan_filter_elem_list_t
MCAN Filter Element List structure.
uint32_t mcan_read_32bit_tsu_timestamp(MCAN_Type *ptr, uint32_t index)
Read 32bit Timestamp value from TSU.
Definition: hpm_mcan_drv.c:1898
static void mcan_enable_bitrate_switch(MCAN_Type *ptr)
Enable Bit Rate Switch.
Definition: hpm_mcan_drv.h:903
union mcan_rx_fifo_or_buf_elem_config_struct mcan_rx_fifo_or_buf_elem_config_t
MCAN RXBUF or RXFIFO Element Configuration.
static void mcan_enable_protocol_exception_handling(MCAN_Type *ptr)
Enable Protocol Exception Handling.
Definition: hpm_mcan_drv.h:827
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.
Definition: hpm_mcan_drv.c:1658
static void mcan_enable_restricted_operation_mode(MCAN_Type *ptr)
Enable Restricted Operation Mode.
Definition: hpm_mcan_drv.h:989
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.
Definition: hpm_mcan_drv.h:1169
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.
Definition: hpm_mcan_drv.c:1960
struct mcan_protocol_status mcan_protocol_status_t
MCAN Protocol Status.
static uint8_t mcan_get_data_phase_last_error_code(MCAN_Type *ptr)
Get the Last Data Phase Error.
Definition: hpm_mcan_drv.h:1149
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.
Definition: hpm_mcan_drv.h:1159
hpm_stat_t mcan_config_ram(MCAN_Type *ptr, mcan_ram_config_t *config)
Configure MCAN RAM will Simplified RAM configuration.
Definition: hpm_mcan_drv.c:727
static uint8_t mcan_get_transmitter_delay_compensation_value(MCAN_Type *ptr)
Get the Transmitter Delay Compensation Value.
Definition: hpm_mcan_drv.h:1199
static void mcan_enable_tsu(MCAN_Type *ptr)
Enable External Timestamp Unit.
Definition: hpm_mcan_drv.h:863
static void mcan_enable_edge_filtering(MCAN_Type *ptr)
Enable Edge Filtering.
Definition: hpm_mcan_drv.h:809
hpm_stat_t mcan_init(MCAN_Type *ptr, mcan_config_t *config, uint32_t src_clk_freq)
Initialize CAN controller.
Definition: hpm_mcan_drv.c:1062
static bool mcan_is_tsu_timestamp_available(MCAN_Type *ptr, uint32_t index)
Check whether the TSU timestamp is available.
Definition: hpm_mcan_drv.h:1462
static bool mcan_is_in_err_passive_state(MCAN_Type *ptr)
Check whether the CAN node is under error passive state.
Definition: hpm_mcan_drv.h:1118
struct mcan_tx_message_struct mcan_tx_frame_t
CAN Transmit Message Frame.
struct mcan_timeout_counter_config_struct mcan_timeout_counter_config_t
MCAN Timeout Counter Configuration.
union mcan_tx_event_fifo_elem_struct mcan_tx_event_fifo_elem_t
TX Event Fifo Element Structure.
static bool mcan_is_tsu_used(MCAN_Type *ptr)
Check whether TSU is used.
Definition: hpm_mcan_drv.h:883
static void mcan_disable_txbuf_transmission_interrupt(MCAN_Type *ptr, uint32_t mask)
Disable TXBUF Transmission interrupt.
Definition: hpm_mcan_drv.h:1283
struct mcan_all_filters_config_struct mcan_all_filters_config_t
MCAN Configuration for all filters.
static bool mcan_is_transmit_request_pending(MCAN_Type *ptr, uint32_t index)
Check whether a TXFIFO/TXBUF transmission request is pending.
Definition: hpm_mcan_drv.h:1330
static bool mcan_is_in_busoff_state(MCAN_Type *ptr)
Check whether the CAN node is under Bus-off state.
Definition: hpm_mcan_drv.h:1138
static bool mcan_is_in_error_warning_state(MCAN_Type *ptr)
Check whether the CAN mode is under Warning State.
Definition: hpm_mcan_drv.h:1128
hpm_stat_t mcan_config_transmitter_delay_compensation(MCAN_Type *ptr, mcan_tdc_config_t *config)
Configure Transmitter Delay Compensation.
Definition: hpm_mcan_drv.c:1882
static uint32_t mcan_get_interrupt_flags(MCAN_Type *ptr)
Get Interrupt Flags.
Definition: hpm_mcan_drv.h:1209
void mcan_get_high_priority_message_status(MCAN_Type *ptr, mcan_high_priority_message_status_t *status)
Get High Priority Message Status.
Definition: hpm_mcan_drv.c:1852
static void mcan_enable_transmit_pause(MCAN_Type *ptr)
Enable Transmit Pause.
Definition: hpm_mcan_drv.h:791
void mcan_get_default_config(MCAN_Type *ptr, mcan_config_t *config)
Get Default CAN configuration.
Definition: hpm_mcan_drv.c:664
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.
Definition: hpm_mcan_drv.c:1771
static void mcan_enable_interrupts(MCAN_Type *ptr, uint32_t mask)
Enable Interrupts.
Definition: hpm_mcan_drv.h:1229
enum mcan_activity_enum mcan_activity_state_t
MCAN Communication State.
mcan_activity_enum
MCAN Communication State.
Definition: hpm_mcan_drv.h:127
mcan_timeout_sel_enum
MCAN Timeout Selection Options.
Definition: hpm_mcan_drv.h:656
uint64_t mcan_read_64bit_tsu_timestamp(MCAN_Type *ptr, uint32_t index)
Read 64bit Timestamp value from TSU.
Definition: hpm_mcan_drv.c:1907
void mcan_deinit(MCAN_Type *ptr)
De-Initialize CAN controller.
Definition: hpm_mcan_drv.c:1291
static bool mcan_is_interrupt_flag_set(MCAN_Type *ptr, uint32_t mask)
Check whether specified Interrupt is set.
Definition: hpm_mcan_drv.h:1449
static void mcan_get_error_counter(MCAN_Type *ptr, mcan_error_count_t *err_cnt)
Get Error Counter Information.
Definition: hpm_mcan_drv.h:1074
mcan_last_error_code
MCAN Last Error Code.
Definition: hpm_mcan_drv.h:113
mcan_node_mode_enum
CAN Node Mode types.
Definition: hpm_mcan_drv.h:600
static bool mcan_is_64bit_tsu_timestamp_used(MCAN_Type *ptr)
Check whether 64-bit TSU timestamp is used.
Definition: hpm_mcan_drv.h:894
static bool mcan_is_clock_enabled(MCAN_Type *ptr)
Definition: hpm_mcan_drv.h:962
struct mcan_internal_timestamp_config_struct mcan_internal_timestamp_config_t
MCAN Internal timestamp configuration.
hpm_stat_t mcan_config_all_filters(MCAN_Type *ptr, mcan_all_filters_config_t *config)
Configure All CAN filters.
Definition: hpm_mcan_drv.c:943
@ mcan_bit_timing_canfd_nominal
Definition: hpm_mcan_drv.h:174
@ mcan_bit_timing_can2_0
Definition: hpm_mcan_drv.h:173
@ mcan_bit_timing_canfd_data
Definition: hpm_mcan_drv.h:175
@ status_mcan_txbuf_index_out_of_range
Definition: hpm_mcan_drv.h:35
@ status_mcan_filter_index_out_of_range
Definition: hpm_mcan_drv.h:28
@ status_mcan_timeout
Definition: hpm_mcan_drv.h:41
@ status_mcan_rxbuf_index_out_of_range
Definition: hpm_mcan_drv.h:36
@ status_mcan_invalid_bit_timing
Definition: hpm_mcan_drv.h:42
@ status_mcan_rxfifo0_busy
Definition: hpm_mcan_drv.h:33
@ status_mcan_txbuf_full
Definition: hpm_mcan_drv.h:31
@ status_mcan_tx_evt_fifo_empty
Definition: hpm_mcan_drv.h:38
@ status_mcan_txfifo_full
Definition: hpm_mcan_drv.h:32
@ status_mcan_ram_out_of_range
Definition: hpm_mcan_drv.h:40
@ status_mcan_rxfifo_empty
Definition: hpm_mcan_drv.h:29
@ status_mcan_rxbuf_empty
Definition: hpm_mcan_drv.h:37
@ status_mcan_rxfifo_full
Definition: hpm_mcan_drv.h:30
@ status_mcan_timestamp_not_exist
Definition: hpm_mcan_drv.h:39
@ status_mcan_rxfifo1_busy
Definition: hpm_mcan_drv.h:34
@ mcan_activity_idle
Definition: hpm_mcan_drv.h:129
@ mcan_activity_receiver
Definition: hpm_mcan_drv.h:130
@ mcan_activity_sync
Definition: hpm_mcan_drv.h:128
@ mcan_activity_transmitter
Definition: hpm_mcan_drv.h:131
@ mcan_timeout_triggered_by_rx_fifo1
Definition: hpm_mcan_drv.h:660
@ mcan_timeout_continuous_operation
Definition: hpm_mcan_drv.h:657
@ mcan_timeout_triggered_by_rx_fifo0
Definition: hpm_mcan_drv.h:659
@ mcan_timeout_triggered_by_tx_evt_fifo
Definition: hpm_mcan_drv.h:658
@ mcan_last_error_code_crc_error
Definition: hpm_mcan_drv.h:120
@ mcan_last_error_code_ack_error
Definition: hpm_mcan_drv.h:117
@ mcan_last_error_code_bit0_error
Definition: hpm_mcan_drv.h:119
@ mcan_last_error_code_stuff_error
Definition: hpm_mcan_drv.h:115
@ mcan_last_error_code_format_error
Definition: hpm_mcan_drv.h:116
@ mcan_last_error_code_no_change
Definition: hpm_mcan_drv.h:121
@ mcan_last_error_code_no_error
Definition: hpm_mcan_drv.h:114
@ mcan_last_error_code_bit1_error
Definition: hpm_mcan_drv.h:118
@ mcan_mode_normal
Definition: hpm_mcan_drv.h:601
@ mcan_mode_loopback_internal
Definition: hpm_mcan_drv.h:602
@ mcan_mode_loopback_external
Definition: hpm_mcan_drv.h:603
@ mcan_mode_listen_only
Definition: hpm_mcan_drv.h:604
Definition: hpm_mcan_regs.h:12
__RW uint32_t TXBTIE
Definition: hpm_mcan_regs.h:59
__RW uint32_t IR
Definition: hpm_mcan_regs.h:30
__R uint32_t PSR
Definition: hpm_mcan_regs.h:27
__R uint32_t TSS1
Definition: hpm_mcan_regs.h:69
__RW uint32_t CCCR
Definition: hpm_mcan_regs.h:19
__R uint32_t TOCV
Definition: hpm_mcan_regs.h:24
__RW uint32_t TXBCR
Definition: hpm_mcan_regs.h:56
__R uint32_t TSCV
Definition: hpm_mcan_regs.h:22
__RW uint32_t IE
Definition: hpm_mcan_regs.h:31
__R uint32_t ECR
Definition: hpm_mcan_regs.h:26
__R uint32_t TXBTO
Definition: hpm_mcan_regs.h:57
__RW uint32_t TXBCIE
Definition: hpm_mcan_regs.h:60
__RW uint32_t TSCFG
Definition: hpm_mcan_regs.h:68
__R uint32_t TXFQS
Definition: hpm_mcan_regs.h:52
__RW uint32_t ILE
Definition: hpm_mcan_regs.h:33
__RW uint32_t TXBAR
Definition: hpm_mcan_regs.h:55
__R uint32_t TS_SEL[16]
Definition: hpm_mcan_regs.h:66
__R uint32_t TXBCF
Definition: hpm_mcan_regs.h:58
__RW uint32_t ILS
Definition: hpm_mcan_regs.h:32
__RW uint32_t NDAT2
Definition: hpm_mcan_regs.h:42
__RW uint32_t NDAT1
Definition: hpm_mcan_regs.h:41
__R uint32_t TXBRP
Definition: hpm_mcan_regs.h:54
Definition: hpm_filter.h:21
MCAN Configuration for all filters.
Definition: hpm_mcan_drv.h:590
mcan_filter_elem_list_t std_id_filter_list
Definition: hpm_mcan_drv.h:593
mcan_global_filter_config_t global_filter_config
Definition: hpm_mcan_drv.h:591
mcan_filter_elem_list_t ext_id_filter_list
Definition: hpm_mcan_drv.h:594
uint32_t ext_id_mask
Definition: hpm_mcan_drv.h:592
CAN Bit Timing Parameters.
Definition: hpm_mcan_drv.h:161
uint16_t num_seg2
Definition: hpm_mcan_drv.h:164
uint8_t num_sjw
Definition: hpm_mcan_drv.h:165
uint16_t num_seg1
Definition: hpm_mcan_drv.h:163
bool enable_tdc
Definition: hpm_mcan_drv.h:166
uint16_t prescaler
Definition: hpm_mcan_drv.h:162
MCAN Configuration Structure.
Definition: hpm_mcan_drv.h:684
bool enable_canfd
Definition: hpm_mcan_drv.h:709
uint32_t baudrate_fd
Definition: hpm_mcan_drv.h:689
mcan_tsu_config_t tsu_config
Definition: hpm_mcan_drv.h:715
bool enable_wide_message_marker
Definition: hpm_mcan_drv.h:707
mcan_ram_config_t ram_config
Definition: hpm_mcan_drv.h:716
uint32_t txbuf_cancel_finish_interrupt_mask
Definition: hpm_mcan_drv.h:723
uint32_t baudrate
Definition: hpm_mcan_drv.h:688
mcan_internal_timestamp_config_t timestamp_cfg
Definition: hpm_mcan_drv.h:714
bool enable_non_iso_mode
Definition: hpm_mcan_drv.h:703
mcan_bit_timing_param_t can_timing
Definition: hpm_mcan_drv.h:697
mcan_timeout_config_t timeout_cfg
Definition: hpm_mcan_drv.h:719
mcan_bit_timing_param_t canfd_timing
Definition: hpm_mcan_drv.h:698
bool enable_tdc
Definition: hpm_mcan_drv.h:710
bool disable_auto_retransmission
Definition: hpm_mcan_drv.h:712
uint32_t txbuf_trans_interrupt_mask
Definition: hpm_mcan_drv.h:722
uint16_t can20_samplepoint_max
Definition: hpm_mcan_drv.h:691
uint32_t interrupt_mask
Definition: hpm_mcan_drv.h:721
mcan_tdc_config_t tdc_config
Definition: hpm_mcan_drv.h:713
bool enable_restricted_operation_mode
Definition: hpm_mcan_drv.h:711
uint16_t canfd_samplepoint_max
Definition: hpm_mcan_drv.h:693
uint16_t can20_samplepoint_min
Definition: hpm_mcan_drv.h:690
mcan_node_mode_t mode
Definition: hpm_mcan_drv.h:702
bool enable_edge_filtering
Definition: hpm_mcan_drv.h:705
bool disable_protocol_exception_handling
Definition: hpm_mcan_drv.h:706
bool use_lowlevel_timing_setting
Definition: hpm_mcan_drv.h:701
uint16_t canfd_samplepoint_min
Definition: hpm_mcan_drv.h:692
bool enable_transmit_pause
Definition: hpm_mcan_drv.h:704
bool use_timestamping_unit
Definition: hpm_mcan_drv.h:708
mcan_all_filters_config_t all_filters_config
Definition: hpm_mcan_drv.h:717
MCAN Error Count Information.
Definition: hpm_mcan_drv.h:746
bool receive_error_passive
Definition: hpm_mcan_drv.h:749
uint8_t transmit_error_count
Definition: hpm_mcan_drv.h:747
uint8_t can_error_logging_count
Definition: hpm_mcan_drv.h:750
uint8_t receive_error_count
Definition: hpm_mcan_drv.h:748
MCAN Filter Element List structure.
Definition: hpm_mcan_drv.h:580
const mcan_filter_elem_t * filter_elem_list
Definition: hpm_mcan_drv.h:582
uint32_t mcan_filter_elem_count
Definition: hpm_mcan_drv.h:581
MCAN Global CAN configuration.
Definition: hpm_mcan_drv.h:509
bool reject_remote_std_frame
Definition: hpm_mcan_drv.h:512
bool reject_remote_ext_frame
Definition: hpm_mcan_drv.h:513
uint8_t accept_non_matching_ext_frame_option
Definition: hpm_mcan_drv.h:511
uint8_t accept_non_matching_std_frame_option
Definition: hpm_mcan_drv.h:510
MCAN High Priority Message Status Information.
Definition: hpm_mcan_drv.h:780
uint8_t filter_index
Definition: hpm_mcan_drv.h:782
uint8_t buffer_index
Definition: hpm_mcan_drv.h:784
uint8_t filter_list_type
Definition: hpm_mcan_drv.h:781
uint8_t message_storage_indicator
Definition: hpm_mcan_drv.h:783
MCAN Internal timestamp configuration.
Definition: hpm_mcan_drv.h:648
uint8_t timestamp_selection
Definition: hpm_mcan_drv.h:650
uint8_t counter_prescaler
Definition: hpm_mcan_drv.h:649
MCAN Protocol Status.
Definition: hpm_mcan_drv.h:756
mcan_activity_state_t activity
Definition: hpm_mcan_drv.h:758
bool in_bus_off_state
Definition: hpm_mcan_drv.h:764
bool canfd_msg_received
Definition: hpm_mcan_drv.h:761
bool in_error_passive_state
Definition: hpm_mcan_drv.h:766
bool in_warning_state
Definition: hpm_mcan_drv.h:765
bool esi_flag_set_in_last_rcv_canfd_msg
Definition: hpm_mcan_drv.h:763
uint8_t tdc_val
Definition: hpm_mcan_drv.h:757
bool protocol_exception_evt_occurred
Definition: hpm_mcan_drv.h:760
bool brs_flag_set_in_last_rcv_canfd_msg
Definition: hpm_mcan_drv.h:762
mcan_last_err_code_t last_error_code
Definition: hpm_mcan_drv.h:759
MCAN RAM configuration.
Definition: hpm_mcan_drv.h:469
uint32_t watermark
Definition: hpm_mcan_drv.h:479
uint8_t txbuf_data_field_size
Definition: hpm_mcan_drv.h:489
uint32_t data_field_size
Definition: hpm_mcan_drv.h:481
uint8_t std_filter_elem_count
Definition: hpm_mcan_drv.h:471
struct mcan_ram_config_struct::@133 rxfifos[2]
uint8_t rxbuf_elem_count
Definition: hpm_mcan_drv.h:485
bool enable_txbuf
Definition: hpm_mcan_drv.h:488
bool enable_std_filter
Definition: hpm_mcan_drv.h:470
uint8_t txbuf_dedicated_txbuf_elem_count
Definition: hpm_mcan_drv.h:490
uint8_t ext_filter_elem_count
Definition: hpm_mcan_drv.h:474
bool enable_tx_evt_fifo
Definition: hpm_mcan_drv.h:494
uint8_t txfifo_or_txqueue_mode
Definition: hpm_mcan_drv.h:492
uint8_t tx_evt_fifo_watermark
Definition: hpm_mcan_drv.h:496
uint32_t operation_mode
Definition: hpm_mcan_drv.h:480
uint32_t elem_count
Definition: hpm_mcan_drv.h:478
bool enable_ext_filter
Definition: hpm_mcan_drv.h:473
bool enable_rxbuf
Definition: hpm_mcan_drv.h:484
uint8_t tx_evt_fifo_elem_count
Definition: hpm_mcan_drv.h:495
uint32_t enable
Definition: hpm_mcan_drv.h:477
uint8_t txbuf_fifo_or_queue_elem_count
Definition: hpm_mcan_drv.h:491
uint16_t rxbuf_data_field_size
Definition: hpm_mcan_drv.h:486
MCAN RAM Flexible Configuration.
Definition: hpm_mcan_drv.h:440
mcan_rxbuf_config_t rxbuf_config
Definition: hpm_mcan_drv.h:458
bool enable_tx_evt_fifo
Definition: hpm_mcan_drv.h:447
bool enable_txbuf
Definition: hpm_mcan_drv.h:446
bool enable_rxbuf
Definition: hpm_mcan_drv.h:445
bool enable_ext_filter
Definition: hpm_mcan_drv.h:442
mcan_txbuf_elem_config_t txbuf_elem_config
Definition: hpm_mcan_drv.h:453
bool enable_std_filter
Definition: hpm_mcan_drv.h:441
mcan_tx_evt_fifo_config_t tx_evt_fifo_config
Definition: hpm_mcan_drv.h:454
mcan_rxfifo_config_t rxfifo1_config
Definition: hpm_mcan_drv.h:457
mcan_rxfifo_config_t rxfifo0_config
Definition: hpm_mcan_drv.h:456
mcan_txbuf_config_t txbuf_config
Definition: hpm_mcan_drv.h:452
mcan_filter_config_t ext_filter_config
Definition: hpm_mcan_drv.h:450
bool enable_rxfifo0
Definition: hpm_mcan_drv.h:443
mcan_rx_fifo_or_buf_elem_config_t rx_elem_config
Definition: hpm_mcan_drv.h:459
mcan_filter_config_t std_filter_config
Definition: hpm_mcan_drv.h:449
bool enable_rxfifo1
Definition: hpm_mcan_drv.h:444
CAN Receive Message Frame.
Definition: hpm_mcan_drv.h:228
uint16_t accepted_non_matching_frame
Definition: hpm_mcan_drv.h:258
uint32_t data_32[16]
Definition: hpm_mcan_drv.h:262
uint16_t bitrate_switch
Definition: hpm_mcan_drv.h:254
uint32_t ext_id
Definition: hpm_mcan_drv.h:231
uint8_t data_8[64]
Definition: hpm_mcan_drv.h:261
uint16_t canfd_frame
Definition: hpm_mcan_drv.h:255
uint16_t rx_timestamp_pointer
Definition: hpm_mcan_drv.h:246
uint32_t std_id
Definition: hpm_mcan_drv.h:238
uint16_t filter_index
Definition: hpm_mcan_drv.h:257
uint16_t rx_timestamp_captured
Definition: hpm_mcan_drv.h:247
uint32_t rtr
Definition: hpm_mcan_drv.h:232
uint32_t use_ext_id
Definition: hpm_mcan_drv.h:233
uint16_t dlc
Definition: hpm_mcan_drv.h:253
uint16_t rx_timestamp
Definition: hpm_mcan_drv.h:244
uint32_t error_state_indicator
Definition: hpm_mcan_drv.h:234
MCAN RXBUF Configuration.
Definition: hpm_mcan_drv.h:342
uint32_t start_addr
Definition: hpm_mcan_drv.h:343
MCAN Filter Element definitions.
Definition: hpm_mcan_drv.h:542
uint32_t offset
Definition: hpm_mcan_drv.h:569
uint8_t can_id_type
Definition: hpm_mcan_drv.h:545
uint8_t filter_type
Definition: hpm_mcan_drv.h:543
uint32_t start_id
Definition: hpm_mcan_drv.h:550
uint32_t store_location
Definition: hpm_mcan_drv.h:571
uint8_t sync_message
Definition: hpm_mcan_drv.h:546
uint32_t filter_id
Definition: hpm_mcan_drv.h:560
uint32_t filter_mask
Definition: hpm_mcan_drv.h:561
uint32_t filter_event
Definition: hpm_mcan_drv.h:570
uint32_t id2
Definition: hpm_mcan_drv.h:556
uint32_t end_id
Definition: hpm_mcan_drv.h:551
uint32_t id1
Definition: hpm_mcan_drv.h:555
uint8_t filter_config
Definition: hpm_mcan_drv.h:544
uint32_t match_id
Definition: hpm_mcan_drv.h:568
MCAN Transmitter Delay Compensation Configuration.
Definition: hpm_mcan_drv.h:675
uint8_t filter_window_length
Definition: hpm_mcan_drv.h:677
uint8_t ssp_offset
Definition: hpm_mcan_drv.h:676
MCAN Timeout configuration structure.
Definition: hpm_mcan_drv.h:666
uint16_t timeout_period
Definition: hpm_mcan_drv.h:669
bool enable_timeout_counter
Definition: hpm_mcan_drv.h:667
mcan_timeout_sel_t timeout_sel
Definition: hpm_mcan_drv.h:668
MCAN Timeout Counter Configuration.
Definition: hpm_mcan_drv.h:737
bool enable_timeout_counter
Definition: hpm_mcan_drv.h:738
uint16_t timeout_period
Definition: hpm_mcan_drv.h:740
uint8_t timeout_selection
Definition: hpm_mcan_drv.h:739
MCAN Timestamp Value.
Definition: hpm_mcan_drv.h:610
uint16_t ts_16bit
Definition: hpm_mcan_drv.h:616
uint64_t ts_64bit
Definition: hpm_mcan_drv.h:618
uint32_t ts_32bit
Definition: hpm_mcan_drv.h:617
bool is_empty
Definition: hpm_mcan_drv.h:614
bool is_32bit
Definition: hpm_mcan_drv.h:612
bool is_64bit
Definition: hpm_mcan_drv.h:613
uint32_t words[2]
Definition: hpm_mcan_drv.h:619
bool is_16bit
Definition: hpm_mcan_drv.h:611
MCAN TSU Configuration.
Definition: hpm_mcan_drv.h:626
bool use_ext_timebase
Definition: hpm_mcan_drv.h:629
uint8_t ext_timebase_src
Definition: hpm_mcan_drv.h:630
uint8_t tbsel_option
Definition: hpm_mcan_drv.h:631
bool enable_64bit_timestamp
Definition: hpm_mcan_drv.h:633
bool capture_on_sof
Definition: hpm_mcan_drv.h:628
bool enable_tsu
Definition: hpm_mcan_drv.h:632
uint16_t prescaler
Definition: hpm_mcan_drv.h:627
CAN Transmit Message Frame.
Definition: hpm_mcan_drv.h:191
uint32_t dlc
Definition: hpm_mcan_drv.h:208
uint32_t rtr
Definition: hpm_mcan_drv.h:195
uint32_t event_fifo_control
Definition: hpm_mcan_drv.h:212
uint32_t std_id
Definition: hpm_mcan_drv.h:201
uint32_t use_ext_id
Definition: hpm_mcan_drv.h:196
uint32_t canfd_frame
Definition: hpm_mcan_drv.h:210
uint32_t timestamp_capture_enable
Definition: hpm_mcan_drv.h:211
uint32_t error_state_indicator
Definition: hpm_mcan_drv.h:197
uint32_t message_marker_h
Definition: hpm_mcan_drv.h:207
uint8_t data_8[64]
Definition: hpm_mcan_drv.h:216
uint32_t message_marker_l
Definition: hpm_mcan_drv.h:213
uint32_t bitrate_switch
Definition: hpm_mcan_drv.h:209
uint32_t data_32[16]
Definition: hpm_mcan_drv.h:217
uint32_t ext_id
Definition: hpm_mcan_drv.h:194
Definition: hpm_mcan_drv.h:418
uint32_t data_field_size
Definition: hpm_mcan_drv.h:419
MCAN Filter Configuration.
Definition: hpm_mcan_drv.h:318
uint16_t list_size
Definition: hpm_mcan_drv.h:321
uint32_t reg_val
Definition: hpm_mcan_drv.h:323
uint16_t list_start_addr
Definition: hpm_mcan_drv.h:320
MCAN RXBUF or RXFIFO Element Configuration.
Definition: hpm_mcan_drv.h:389
uint32_t buf_data_field_size
Definition: hpm_mcan_drv.h:393
uint32_t reg_val
Definition: hpm_mcan_drv.h:396
uint32_t fifo0_data_field_size
Definition: hpm_mcan_drv.h:391
uint32_t fifo1_data_field_size
Definition: hpm_mcan_drv.h:392
MCAN RXFIFO Configuration.
Definition: hpm_mcan_drv.h:329
uint32_t watermark
Definition: hpm_mcan_drv.h:333
uint32_t start_addr
Definition: hpm_mcan_drv.h:331
uint32_t operation_mode
Definition: hpm_mcan_drv.h:334
uint32_t fifo_size
Definition: hpm_mcan_drv.h:332
uint32_t reg_val
Definition: hpm_mcan_drv.h:336
TX Event Fifo Element Structure.
Definition: hpm_mcan_drv.h:269
uint16_t tx_timestamp
Definition: hpm_mcan_drv.h:288
uint32_t error_state_indicator
Definition: hpm_mcan_drv.h:277
uint16_t message_marker
Definition: hpm_mcan_drv.h:301
uint16_t canfd_frame
Definition: hpm_mcan_drv.h:299
uint16_t tx_timestamp_captured
Definition: hpm_mcan_drv.h:291
uint16_t tx_timestamp_pointer
Definition: hpm_mcan_drv.h:290
uint16_t event_type
Definition: hpm_mcan_drv.h:300
uint32_t ext_id
Definition: hpm_mcan_drv.h:274
uint32_t rtr
Definition: hpm_mcan_drv.h:275
uint16_t bitrate_switch
Definition: hpm_mcan_drv.h:298
uint16_t dlc
Definition: hpm_mcan_drv.h:297
uint32_t extend_id
Definition: hpm_mcan_drv.h:276
uint32_t words[2]
Definition: hpm_mcan_drv.h:304
uint32_t std_id
Definition: hpm_mcan_drv.h:281
MCAN TX Event FIFO Structure.
Definition: hpm_mcan_drv.h:425
uint32_t reg_val
Definition: hpm_mcan_drv.h:431
uint8_t fifo_size
Definition: hpm_mcan_drv.h:428
uint16_t start_addr
Definition: hpm_mcan_drv.h:427
uint8_t fifo_watermark
Definition: hpm_mcan_drv.h:429
Definition: hpm_mcan_drv.h:406
uint32_t fifo_queue_size
Definition: hpm_mcan_drv.h:411
uint32_t reg_val
Definition: hpm_mcan_drv.h:415
uint32_t tx_fifo_queue_mode
Definition: hpm_mcan_drv.h:412
uint32_t dedicated_tx_buf_size
Definition: hpm_mcan_drv.h:409
uint32_t start_addr
Definition: hpm_mcan_drv.h:408