HPM SDK
HPMicro Software Development Kit
hpm_mcan_drv.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2023-2024 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 
349 #define MCAN_DATA_FIELD_SIZE_8BYTES (0U)
350 #define MCAN_DATA_FIELD_SIZE_12BYTES (1U)
351 #define MCAN_DATA_FIELD_SIZE_16BYTES (2U)
352 #define MCAN_DATA_FIELD_SIZE_20BYTES (3U)
353 #define MCAN_DATA_FIELD_SIZE_24BYTES (4U)
354 #define MCAN_DATA_FIELD_SIZE_32BYTES (5U)
355 #define MCAN_DATA_FIELD_SIZE_48BYTES (6U)
356 #define MCAN_DATA_FIELD_SIZE_64BYTES (7U)
357 
361 #define MCAN_FIFO_OPERATION_MODE_BLOCKING (0U)
362 #define MCAN_FIFO_OPERATION_MODE_OVERWRITE (1U)
363 
368  struct {
369  uint32_t fifo0_data_field_size: 4;
370  uint32_t fifo1_data_field_size: 4;
371  uint32_t buf_data_field_size: 4;
372  uint32_t : 20;
373  };
374  uint32_t reg_val;
376 
380 #define MCAN_TXBUF_OPERATION_MODE_FIFO (0U)
381 #define MCAN_TXBUF_OPERATION_MODE_QUEUE (1U)
382 
383 
385  struct {
386  uint32_t start_addr: 16;
387  uint32_t dedicated_tx_buf_size: 6;
388  uint32_t : 2;
389  uint32_t fifo_queue_size: 6;
390  uint32_t tx_fifo_queue_mode: 1;
391  uint32_t : 1;
392  };
393  uint32_t reg_val;
395 
397  uint32_t data_field_size;
399 
403 typedef union {
404  struct {
405  uint16_t start_addr;
406  uint8_t fifo_size;
407  uint8_t fifo_watermark;
408  };
409  uint32_t reg_val;
411 
439 
447 typedef struct mcan_ram_config_struct {
454  struct {
455  uint32_t enable: 4;
456  uint32_t elem_count: 8;
457  uint32_t watermark: 8;
458  uint32_t operation_mode: 4;
459  uint32_t data_field_size: 8;
460  } rxfifos[2];
461 
476 
480 #define MCAN_ACCEPT_NON_MATCHING_FRAME_OPTION_IN_RXFIFO0 (0U)
481 #define MCAN_ACCEPT_NON_MATCHING_FRAME_OPTION_IN_RXFIFO1 (1U)
482 #define MCAN_ACCEPT_NON_MATCHING_FRAME_OPTION_REJECT (2U)
493 
497 #define MCAN_FILTER_TYPE_RANGE_FILTER (0U)
498 #define MCAN_FILTER_TYPE_SPECIFIED_ID_FILTER (1U)
499 #define MCAN_FILTER_TYPE_CLASSIC_FILTER (2U)
500 #define MCAN_FILTER_TYPE_FILTER_DISABLED (3U)
501 #define MCAN_FILTER_TYPE_DUAL_ID_EXT_FILTER_IGNORE_MASK
506 #define MCAN_FILTER_ELEM_CFG_DISABLED (0)
507 #define MCAN_FILTER_ELEM_CFG_STORE_IN_RX_FIFO0_IF_MATCH (1U)
508 #define MCAN_FILTER_ELEM_CFG_STORE_IN_RX_FIFO1_IF_MATCH (2U)
509 #define MCAN_FILTER_ELEM_CFG_REJECT_ID_IF_MATCH (3U)
510 #define MCAN_FILTER_ELEM_CFG_SET_PRIORITY_IF_MATCH (4U)
512 #define MCAN_FILTER_ELEM_CFG_SET_PRIORITY_AND_STORE_IN_FIFO0_IF_MATCH (5U)
514 #define MCAN_FILTER_ELEM_CFG_SET_PRIORITY_AND_STORE_IN_FIFO1_IF_MATCH (6U)
515 #define MCAN_FILTER_ELEM_CFG_STORE_INTO_RX_BUFFER_OR_AS_DBG_MSG (7U)
521  uint8_t filter_type;
522  uint8_t filter_config;
523  uint8_t can_id_type;
524  uint8_t sync_message;
525  union {
526  /* This definition takes effect if the filter type is range filter */
527  struct {
528  uint32_t start_id;
529  uint32_t end_id;
530  };
531  /* This definition takes effect if the filter type is dual id filter */
532  struct {
533  uint32_t id1;
534  uint32_t id2;
535  };
536  /* This definition takes effect if the filter type is classic filter */
537  struct {
538  uint32_t filter_id;
539  uint32_t filter_mask;
540  };
541  /* This definition takes effect if the filter configuration is "store into RX Buffer or as debug message"
542  *
543  * In this definition, only the exact ID matching mode is activated
544  */
545  struct {
546  uint32_t match_id;
547  uint32_t offset: 6;
548  uint32_t filter_event: 3;
549  uint32_t store_location: 2;
550  uint32_t : 21;
551  };
552  };
554 
562 
570  uint32_t ext_id_mask;
574 
578 typedef enum mcan_node_mode_enum {
584 
589  bool is_16bit;
590  bool is_32bit;
591  bool is_64bit;
592  bool is_empty;
593  union {
594  uint16_t ts_16bit;
595  uint32_t ts_32bit;
596  uint64_t ts_64bit;
597  uint32_t words[2];
598  };
600 
604 typedef struct mcan_tsu_config_struct {
605  uint16_t prescaler;
609  uint8_t tbsel_option;
610  bool enable_tsu;
613 
617 #define MCAN_TIMESTAMP_SEL_MIN (0U)
618 #define MCAN_TIMESTAMP_SEL_VALUE_ALWAYS_ZERO (0U)
619 #define MCAN_TIMESTAMP_SEL_VALUE_INCREMENT (1U)
620 #define MCAN_TIMESTAMP_SEL_EXT_TS_VAL_USED (2U)
621 #define MCAN_TIMESTAMP_SEL_MAX (MCAN_TIMESTAMP_SEL_EXT_TS_VAL_USED)
622 
630 
634 typedef enum mcan_timeout_sel_enum {
640 
647  uint16_t timeout_period;
649 
653 typedef struct mcan_tdc_config_t {
654  uint8_t ssp_offset;
657 
658 
662 typedef struct mcan_config_struct {
663  union {
664  /* This struct takes effect if "use_lowlevel_timing_setting = false" */
665  struct {
666  uint32_t baudrate;
667  uint32_t baudrate_fd;
672  };
673  /* This struct takes effect if "use_lowlevel_timing_setting = true" */
674  struct {
677  };
678  };
688  bool enable_tdc;
699  uint32_t interrupt_mask;
703 
707 #define MCAN_TIMEOUT_SEL_TYPE_CONTINUOUS_OPERATION (0U)
708 #define MCAN_TIMEOUT_SEL_TYPE_TIMEOUT_CTRL_BY_TX_EVT_FIFO (1U)
709 #define MCAN_TIMEOUT_SEL_TYPE_TIMEOUT_CTRL_BY_RX_FIFO0 (2U)
710 #define MCAN_TIMEOUT_SEL_TYPE_TIMEOUT_CTRL_BY_RX_FIFO1 (3U)
711 
718  uint16_t timeout_period;
720 
724 typedef struct mcan_error_count_struct {
730 
734 typedef struct mcan_protocol_status {
735  uint8_t tdc_val;
746 
750 #define MCAN_MESSAGE_STORAGE_INDICATOR_NO_FIFO_SELECTED (0U)
751 #define MCAN_MESSAGE_STORAGE_INDICATOR_FIFO_MESSAGE_LOST (1U)
752 #define MCAN_MESSAGE_STORAGE_INDICATOR_RXFIFO0 (2U)
753 #define MCAN_MESSAGE_STORAGE_INDICATOR_RXFIFO1 (3U)
754 
760  uint8_t filter_index;
762  uint8_t buffer_index;
764 
769 static inline void mcan_enable_transmit_pause(MCAN_Type *ptr)
770 {
771  ptr->CCCR |= MCAN_CCCR_TXP_MASK;
772 }
773 
778 static inline void mcan_disable_transmit_pause(MCAN_Type *ptr)
779 {
780  ptr->CCCR &= ~MCAN_CCCR_TXP_MASK;
781 }
782 
787 static inline void mcan_enable_edge_filtering(MCAN_Type *ptr)
788 {
789  ptr->CCCR |= MCAN_CCCR_EFBI_MASK;
790 }
791 
796 static inline void mcan_disable_edge_filtering(MCAN_Type *ptr)
797 {
798  ptr->CCCR &= ~MCAN_CCCR_EFBI_MASK;
799 }
800 
806 {
807  ptr->CCCR &= ~MCAN_CCCR_PXHD_MASK;
808 }
809 
815 {
816  ptr->CCCR |= MCAN_CCCR_PXHD_MASK;
817 }
818 
824 {
825  ptr->CCCR |= MCAN_CCCR_WMM_MASK;
826 }
827 
833 {
834  ptr->CCCR &= ~MCAN_CCCR_WMM_MASK;
835 }
836 
841 static inline void mcan_enable_tsu(MCAN_Type *ptr)
842 {
843  ptr->CCCR |= MCAN_CCCR_UTSU_MASK;
844 }
845 
850 static inline void mcan_disable_tsu(MCAN_Type *ptr)
851 {
852  ptr->CCCR &= ~MCAN_CCCR_UTSU_MASK;
853 }
854 
861 static inline bool mcan_is_tsu_used(MCAN_Type *ptr)
862 {
863  return ((ptr->CCCR & MCAN_CCCR_UTSU_MASK) != 0U);
864 }
865 
873 {
874  return ((ptr->TSCFG & MCAN_TSCFG_EN64_MASK) != 0U);
875 }
876 
881 static inline void mcan_enable_bitrate_switch(MCAN_Type *ptr)
882 {
883  ptr->CCCR |= MCAN_CCCR_BRSE_MASK;
884 }
885 
890 static inline void mcan_disable_bitrate_switch(MCAN_Type *ptr)
891 {
892  ptr->CCCR &= ~MCAN_CCCR_BRSE_MASK;
893 }
894 
900 {
901  ptr->CCCR &= ~MCAN_CCCR_DAR_MASK;
902 }
903 
909 {
910  ptr->CCCR |= MCAN_CCCR_DAR_MASK;
911 }
912 
918 {
919  ptr->CCCR |= MCAN_CCCR_MON_MASK;
920 }
921 
926 static inline void mcan_stop_clock(MCAN_Type *ptr)
927 {
928  ptr->CCCR |= MCAN_CCCR_CSR_MASK;
929 }
930 
935 static inline void mcan_enable_clock(MCAN_Type *ptr)
936 {
937  ptr->CCCR &= ~MCAN_CCCR_CSR_MASK;
938 }
939 
940 static inline bool mcan_is_clock_enabled(MCAN_Type *ptr)
941 {
942  return ((ptr->CCCR & MCAN_CCCR_CSR_MASK) == 0UL);
943 }
944 
950 {
951  ptr->CCCR &= ~MCAN_CCCR_MON_MASK;
952 }
953 
958 static inline bool mcan_is_clock_stopped(MCAN_Type *ptr)
959 {
960  return ((ptr->CCCR & MCAN_CCCR_CSA_MASK) != 0U);
961 }
962 
968 {
969  ptr->CCCR |= MCAN_CCCR_ASM_MASK;
970 }
971 
977 {
978  ptr->CCCR &= ~MCAN_CCCR_ASM_MASK;
979 }
980 
986 {
987  ptr->CCCR |= MCAN_CCCR_CCE_MASK;
988 }
989 
995 {
996  ptr->CCCR &= ~MCAN_CCCR_CCE_MASK;
997 }
998 
1004 static inline uint16_t mcan_get_timestamp_counter_value(MCAN_Type *ptr)
1005 {
1006  return ptr->TSCV;
1007 }
1008 
1013 static inline void mcan_enter_init_mode(MCAN_Type *ptr)
1014 {
1015  ptr->CCCR |= MCAN_CCCR_INIT_MASK;
1016 }
1017 
1022 static inline void mcan_enter_normal_mode(MCAN_Type *ptr)
1023 {
1024  ptr->CCCR &= ~MCAN_CCCR_INIT_MASK;
1025 }
1026 
1032 static inline uint16_t mcan_get_timeout_counter_value(MCAN_Type *ptr)
1033 {
1034  return ptr->TOCV;
1035 }
1036 
1043 {
1044  *((volatile uint32_t *) &ptr->TOCV) = 0;
1045 }
1046 
1052 static inline void mcan_get_error_counter(MCAN_Type *ptr, mcan_error_count_t *err_cnt)
1053 {
1054  uint32_t ecr = ptr->ECR;
1055  err_cnt->transmit_error_count = MCAN_ECR_TEC_GET(ecr);
1056  err_cnt->receive_error_count = MCAN_ECR_REC_GET(ecr);
1057  err_cnt->receive_error_passive = (MCAN_ECR_RP_GET(ecr) == 1U);
1058  err_cnt->can_error_logging_count = MCAN_ECR_CEL_GET(ecr);
1059 }
1060 
1066 static inline uint8_t mcan_get_last_error_code(MCAN_Type *ptr)
1067 {
1068  return MCAN_PSR_LEC_GET(ptr->PSR);
1069 }
1070 
1076 static inline uint8_t mcan_get_last_data_error_code(MCAN_Type *ptr)
1077 {
1078  return MCAN_PSR_DLEC_GET(ptr->PSR);
1079 }
1080 
1086 static inline uint8_t mcan_get_activity(MCAN_Type *ptr)
1087 {
1088  return MCAN_PSR_ACT_GET(ptr->PSR);
1089 }
1090 
1096 static inline bool mcan_is_in_err_passive_state(MCAN_Type *ptr)
1097 {
1098  return (MCAN_PSR_EP_GET(ptr->PSR) == 1U);
1099 }
1100 
1107 {
1108  return (MCAN_PSR_EW_GET(ptr->PSR) == 1U);
1109 }
1110 
1116 static inline bool mcan_is_in_busoff_state(MCAN_Type *ptr)
1117 {
1118  return (MCAN_PSR_BO_GET(ptr->PSR) == 1U);
1119 }
1120 
1128 {
1129  return MCAN_PSR_DLEC_GET(ptr->PSR);
1130 }
1131 
1138 {
1139  return (MCAN_PSR_RESI_GET(ptr->PSR) == 1U);
1140 }
1141 
1148 {
1149  return (MCAN_PSR_RBRS_GET(ptr->PSR) == 1U);
1150 }
1151 
1158 {
1159  return (MCAN_PSR_RFDF_GET(ptr->PSR) == 1U);
1160 }
1161 
1168 {
1169  return (MCAN_PSR_PXE_GET(ptr->PSR) == 1U);
1170 }
1171 
1178 {
1179  return MCAN_PSR_TDCV_GET(ptr->PSR);
1180 }
1181 
1187 static inline uint32_t mcan_get_interrupt_flags(MCAN_Type *ptr)
1188 {
1189  return ptr->IR;
1190 }
1191 
1197 static inline void mcan_clear_interrupt_flags(MCAN_Type *ptr, uint32_t mask)
1198 {
1199  ptr->IR = mask;
1200 }
1201 
1207 static inline void mcan_enable_interrupts(MCAN_Type *ptr, uint32_t mask)
1208 {
1209  ptr->ILS &= ~mask;
1210  ptr->IE |= mask;
1211  ptr->ILE = 1U;
1212 }
1213 
1220 static inline void mcan_enable_txbuf_interrupt(MCAN_Type *ptr, uint32_t mask)
1221 {
1222  ptr->TXBTIE |= mask;
1223 }
1224 
1231 static inline void mcan_disable_txbuf_interrupt(MCAN_Type *ptr, uint32_t mask)
1232 {
1233  ptr->TXBTIE &= ~mask;
1234 }
1235 
1241 static inline void mcan_disable_interrupts(MCAN_Type *ptr, uint32_t mask)
1242 {
1243  ptr->IE &= ~mask;
1244 }
1245 
1251 static inline void mcan_enable_txbuf_transmission_interrupt(MCAN_Type *ptr, uint32_t mask)
1252 {
1253  ptr->TXBTIE |= mask;
1254 }
1255 
1261 static inline void mcan_disable_txbuf_transmission_interrupt(MCAN_Type *ptr, uint32_t mask)
1262 {
1263  ptr->TXBTIE &= ~mask;
1264 }
1265 
1271 static inline void mcan_enable_txbuf_cancel_finish_interrupt(MCAN_Type *ptr, uint32_t mask)
1272 {
1273  ptr->TXBCIE |= mask;
1274 }
1275 
1281 static inline void mcan_disable_txbuf_cancel_finish_interrupt(MCAN_Type *ptr, uint32_t mask)
1282 {
1283  ptr->TXBCIE &= ~mask;
1284 }
1285 
1292 static inline void mcan_interrupt_line_select(MCAN_Type *ptr, uint32_t mask, uint8_t line_index)
1293 {
1294  if (line_index == 0) {
1295  ptr->ILS &= ~mask;
1296  } else {
1297  ptr->ILS |= mask;
1298  }
1299  ptr->ILE = (1UL << line_index);
1300 }
1301 
1308 static inline bool mcan_is_transmit_request_pending(MCAN_Type *ptr, uint32_t index)
1309 {
1310  return ((ptr->TXBRP & ((1UL << index))) != 0U);
1311 }
1312 
1318 static inline bool mcan_is_txfifo_full(MCAN_Type *ptr)
1319 {
1320  return ((ptr->TXFQS & MCAN_TXFQS_TFQF_MASK) != 0U);
1321 }
1322 
1328 static inline uint32_t mcan_get_txfifo_put_index(MCAN_Type *ptr)
1329 {
1330  return MCAN_TXFQS_TFQPI_GET(ptr->TXFQS);
1331 }
1332 
1338 static inline void mcan_send_add_request(MCAN_Type *ptr, uint32_t index)
1339 {
1340  ptr->TXBAR = (1UL << index);
1341 }
1342 
1349 static inline void mcan_send_add_multiple_requests(MCAN_Type *ptr, uint32_t index_bitmask)
1350 {
1351  ptr->TXBAR = index_bitmask;
1352 }
1353 
1359 static inline void mcan_cancel_tx_buf_send_request(MCAN_Type *ptr, uint32_t index)
1360 {
1361  ptr->TXBCR = (1UL << index);
1362 }
1363 
1370 static inline bool mcan_is_transmit_occurred(MCAN_Type *ptr, uint32_t index)
1371 {
1372  return ((ptr->TXBTO & (1UL << index)) != 0U);
1373 }
1374 
1381 static inline bool mcan_is_rxbuf_data_available(MCAN_Type *ptr, uint32_t index)
1382 {
1383  bool result;
1384  if (index < 32U) {
1385  result = (ptr->NDAT1 & (1UL << index)) != 0U;
1386  } else if (index < 64U) {
1387  result = (ptr->NDAT2 & (1UL << (index - 32U))) != 0U;
1388  } else {
1389  result = false;
1390  }
1391  return result;
1392 }
1393 
1399 static inline void mcan_clear_rxbuf_data_available_flag(MCAN_Type *ptr, uint32_t index)
1400 {
1401  if (index < 32U) {
1402  ptr->NDAT1 = (1UL << index);
1403  } else if (index < 64U) {
1404  ptr->NDAT2 = (1UL << (index - 32U));
1405  } else {
1406  /* Do nothing */
1407  }
1408 }
1409 
1416 static inline bool mcan_is_interrupt_flag_set(MCAN_Type *ptr, uint32_t mask)
1417 {
1418  return ((ptr->IR & mask) != 0U);
1419 }
1420 
1429 static inline bool mcan_is_tsu_timestamp_available(MCAN_Type *ptr, uint32_t index)
1430 {
1431  bool is_available = false;
1432  if (index < ARRAY_SIZE(ptr->TS_SEL)) {
1433  is_available = ((ptr->TSS1 & (1UL << index)) != 0U);
1434  }
1435  return is_available;
1436 }
1437 
1444 uint32_t mcan_read_32bit_tsu_timestamp(MCAN_Type *ptr, uint32_t index);
1445 
1452 uint64_t mcan_read_64bit_tsu_timestamp(MCAN_Type *ptr, uint32_t index);
1453 
1460 
1466 void mcan_get_default_config(MCAN_Type *ptr, mcan_config_t *config);
1467 
1473 uint8_t mcan_get_message_size_from_dlc(uint8_t dlc);
1474 
1481 uint8_t mcan_get_data_field_size(uint8_t data_field_size_option);
1482 
1535 void mcan_get_default_ram_flexible_config(MCAN_Type *ptr, mcan_ram_flexible_config_t *ram_config, bool enable_canfd);
1536 
1589 void mcan_get_default_ram_config(MCAN_Type *ptr, mcan_ram_config_t *simple_config, bool enable_canfd);
1590 
1599 hpm_stat_t mcan_init(MCAN_Type *ptr, mcan_config_t *config, uint32_t src_clk_freq);
1600 
1606 void mcan_deinit(MCAN_Type *ptr);
1607 
1615 
1623 
1631 
1639 
1647 
1655 hpm_stat_t mcan_set_filter_element(MCAN_Type *ptr, const mcan_filter_elem_t *filter_elem, uint32_t index);
1656 
1664 hpm_stat_t mcan_write_txbuf(MCAN_Type *ptr, uint32_t index, mcan_tx_frame_t *tx_frame);
1665 
1673 
1681 hpm_stat_t mcan_read_rxbuf(MCAN_Type *ptr, uint32_t index, mcan_rx_message_t *rx_frame);
1682 
1690 hpm_stat_t mcan_read_rxfifo(MCAN_Type *ptr, uint32_t fifo_index, mcan_rx_message_t *rx_frame);
1691 
1701 
1709 
1720 hpm_stat_t mcan_request_and_fill_txfifo(MCAN_Type *ptr, mcan_tx_frame_t *tx_frame, uint32_t *fifo_index);
1721 
1730 hpm_stat_t mcan_transmit_via_txfifo_nonblocking(MCAN_Type *ptr, mcan_tx_frame_t *tx_frame, uint32_t *fifo_index);
1731 
1740 
1748 hpm_stat_t mcan_receive_from_buf_blocking(MCAN_Type *ptr, uint32_t index, mcan_rx_message_t *rx_frame);
1749 
1757 hpm_stat_t mcan_receive_from_fifo_blocking(MCAN_Type *ptr, uint32_t fifo_index, mcan_rx_message_t *rx_frame);
1758 
1769  const mcan_tx_event_fifo_elem_t *tx_evt,
1770  mcan_timestamp_value_t *timestamp);
1771 
1782  const mcan_rx_message_t *rx_msg,
1783  mcan_timestamp_value_t *timestamp);
1784 
1793 hpm_stat_t mcan_parse_protocol_status(uint32_t psr, mcan_protocol_status_t *protocol_status);
1794 
1804 
1810 #ifdef __cplusplus
1811 }
1812 #endif
1813 
1814 
1815 #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:123
#define ARRAY_SIZE(a)
Definition: hpm_common.h:42
#define MAKE_STATUS(group, code)
Definition: hpm_common.h:132
@ status_group_mcan
Definition: hpm_common.h:161
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:1022
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:1349
uint8_t mcan_get_message_size_from_dlc(uint8_t dlc)
Get message Size from Data Length Code.
Definition: hpm_mcan_drv.c:1415
static void mcan_enable_clock(MCAN_Type *ptr)
Enable MCAN clock.
Definition: hpm_mcan_drv.h:935
static void mcan_disable_protocol_exception_handling(MCAN_Type *ptr)
Disable Protocol Exception Handling.
Definition: hpm_mcan_drv.h:814
static void mcan_cancel_tx_buf_send_request(MCAN_Type *ptr, uint32_t index)
Cancel the TXBUF Send request.
Definition: hpm_mcan_drv.h:1359
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:1086
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:1251
static void mcan_stop_clock(MCAN_Type *ptr)
Stop MCAN clock.
Definition: hpm_mcan_drv.h:926
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:1370
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:1302
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:1889
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:1381
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:1958
static void mcan_disable_auto_retransmission(MCAN_Type *ptr)
Disable Auto Transmission.
Definition: hpm_mcan_drv.h:908
static void mcan_disable_tsu(MCAN_Type *ptr)
Disable External Timestamp Unit.
Definition: hpm_mcan_drv.h:850
static void mcan_reset_timeout_counter_value(MCAN_Type *ptr)
Reset Timeout counter value.
Definition: hpm_mcan_drv.h:1042
static void mcan_interrupt_line_select(MCAN_Type *ptr, uint32_t mask, uint8_t line_index)
Select Interrupt Line.
Definition: hpm_mcan_drv.h:1292
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:1399
static void mcan_enable_auto_retransmission(MCAN_Type *ptr)
Enable Auto Retransmission.
Definition: hpm_mcan_drv.h:899
static void mcan_clear_interrupt_flags(MCAN_Type *ptr, uint32_t mask)
Clear Interrupt Flags.
Definition: hpm_mcan_drv.h:1197
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:1792
static void mcan_enter_init_mode(MCAN_Type *ptr)
Switch MCAN to Initialization mode.
Definition: hpm_mcan_drv.h:1013
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:1500
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:832
static void mcan_disable_interrupts(MCAN_Type *ptr, uint32_t mask)
Disable Interrupts.
Definition: hpm_mcan_drv.h:1241
static void mcan_disable_edge_filtering(MCAN_Type *ptr)
Disable Edge Filtering.
Definition: hpm_mcan_drv.h:796
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:1827
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:1687
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:1281
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:1004
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:823
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:917
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:1767
static bool mcan_is_txfifo_full(MCAN_Type *ptr)
Check whether TXFIFO is full.
Definition: hpm_mcan_drv.h:1318
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:1328
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:985
static void mcan_disable_restricted_operation_mode(MCAN_Type *ptr)
Disable Restricted Operation Mode.
Definition: hpm_mcan_drv.h:976
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:1659
static void mcan_enable_txbuf_interrupt(MCAN_Type *ptr, uint32_t mask)
Enable TXBUF Interrupt.
Definition: hpm_mcan_drv.h:1220
static bool mcan_is_clock_stopped(MCAN_Type *ptr)
Check whether CAN clock is stopped or not.
Definition: hpm_mcan_drv.h:958
static void mcan_disable_write_to_prot_config_registers(MCAN_Type *ptr)
Disable Write Access to Protected Configuration Registers.
Definition: hpm_mcan_drv.h:994
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:1997
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:1559
static void mcan_disable_bus_monitoring_mode(MCAN_Type *ptr)
Disable Bus monitoring Mode.
Definition: hpm_mcan_drv.h:949
static uint8_t mcan_get_last_error_code(MCAN_Type *ptr)
Get Last Error Code.
Definition: hpm_mcan_drv.h:1066
static void mcan_send_add_request(MCAN_Type *ptr, uint32_t index)
Request A Transmission via specified TXBUF Index.
Definition: hpm_mcan_drv.h:1338
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:1529
static bool mcan_is_canfd_message_received(MCAN_Type *ptr)
Check whether CANFD messages were received.
Definition: hpm_mcan_drv.h:1157
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:480
static void mcan_enable_txbuf_cancel_finish_interrupt(MCAN_Type *ptr, uint32_t mask)
Enable TXBUF Cancellation Finish interrupt.
Definition: hpm_mcan_drv.h:1271
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:1713
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:554
static void mcan_disable_txbuf_interrupt(MCAN_Type *ptr, uint32_t mask)
Disable TXBUF Interrupt.
Definition: hpm_mcan_drv.h:1231
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:1032
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:1167
static void mcan_disable_transmit_pause(MCAN_Type *ptr)
Disable Transmit Pause.
Definition: hpm_mcan_drv.h:778
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:1428
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:890
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:1464
static uint8_t mcan_get_last_data_error_code(MCAN_Type *ptr)
Get Last Data Phase Error Code.
Definition: hpm_mcan_drv.h:1076
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:844
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:1864
static void mcan_enable_bitrate_switch(MCAN_Type *ptr)
Enable Bit Rate Switch.
Definition: hpm_mcan_drv.h:881
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:805
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:1624
static void mcan_enable_restricted_operation_mode(MCAN_Type *ptr)
Enable Restricted Operation Mode.
Definition: hpm_mcan_drv.h:967
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:1147
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:1924
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:1127
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:1137
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:707
static uint8_t mcan_get_transmitter_delay_compensation_value(MCAN_Type *ptr)
Get the Transmitter Delay Compensation Value.
Definition: hpm_mcan_drv.h:1177
static void mcan_enable_tsu(MCAN_Type *ptr)
Enable External Timestamp Unit.
Definition: hpm_mcan_drv.h:841
static void mcan_enable_edge_filtering(MCAN_Type *ptr)
Enable Edge Filtering.
Definition: hpm_mcan_drv.h:787
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:1041
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:1429
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:1096
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:861
static void mcan_disable_txbuf_transmission_interrupt(MCAN_Type *ptr, uint32_t mask)
Disable TXBUF Transmission interrupt.
Definition: hpm_mcan_drv.h:1261
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:1308
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:1116
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:1106
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:1848
static uint32_t mcan_get_interrupt_flags(MCAN_Type *ptr)
Get Interrupt Flags.
Definition: hpm_mcan_drv.h:1187
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:1818
static void mcan_enable_transmit_pause(MCAN_Type *ptr)
Enable Transmit Pause.
Definition: hpm_mcan_drv.h:769
void mcan_get_default_config(MCAN_Type *ptr, mcan_config_t *config)
Get Default CAN configuration.
Definition: hpm_mcan_drv.c:644
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:1737
static void mcan_enable_interrupts(MCAN_Type *ptr, uint32_t mask)
Enable Interrupts.
Definition: hpm_mcan_drv.h:1207
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:634
uint64_t mcan_read_64bit_tsu_timestamp(MCAN_Type *ptr, uint32_t index)
Read 64bit Timestamp value from TSU.
Definition: hpm_mcan_drv.c:1873
void mcan_deinit(MCAN_Type *ptr)
De-Initialize CAN controller.
Definition: hpm_mcan_drv.c:1266
static bool mcan_is_interrupt_flag_set(MCAN_Type *ptr, uint32_t mask)
Check whether specified Interrupt is set.
Definition: hpm_mcan_drv.h:1416
static void mcan_get_error_counter(MCAN_Type *ptr, mcan_error_count_t *err_cnt)
Get Error Counter Information.
Definition: hpm_mcan_drv.h:1052
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:578
static bool mcan_is_64bit_tsu_timestamp_used(MCAN_Type *ptr)
Check whether 64-bit TSU timestamp is used.
Definition: hpm_mcan_drv.h:872
static bool mcan_is_clock_enabled(MCAN_Type *ptr)
Definition: hpm_mcan_drv.h:940
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:922
@ 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:638
@ mcan_timeout_continuous_operation
Definition: hpm_mcan_drv.h:635
@ mcan_timeout_triggered_by_rx_fifo0
Definition: hpm_mcan_drv.h:637
@ mcan_timeout_triggered_by_tx_evt_fifo
Definition: hpm_mcan_drv.h:636
@ 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:579
@ mcan_mode_loopback_internal
Definition: hpm_mcan_drv.h:580
@ mcan_mode_loopback_external
Definition: hpm_mcan_drv.h:581
@ mcan_mode_listen_only
Definition: hpm_mcan_drv.h:582
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
__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:568
mcan_filter_elem_list_t std_id_filter_list
Definition: hpm_mcan_drv.h:571
mcan_global_filter_config_t global_filter_config
Definition: hpm_mcan_drv.h:569
mcan_filter_elem_list_t ext_id_filter_list
Definition: hpm_mcan_drv.h:572
uint32_t ext_id_mask
Definition: hpm_mcan_drv.h:570
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:662
bool enable_canfd
Definition: hpm_mcan_drv.h:687
uint32_t baudrate_fd
Definition: hpm_mcan_drv.h:667
mcan_tsu_config_t tsu_config
Definition: hpm_mcan_drv.h:693
bool enable_wide_message_marker
Definition: hpm_mcan_drv.h:685
mcan_ram_config_t ram_config
Definition: hpm_mcan_drv.h:694
uint32_t txbuf_cancel_finish_interrupt_mask
Definition: hpm_mcan_drv.h:701
uint32_t baudrate
Definition: hpm_mcan_drv.h:666
mcan_internal_timestamp_config_t timestamp_cfg
Definition: hpm_mcan_drv.h:692
bool enable_non_iso_mode
Definition: hpm_mcan_drv.h:681
mcan_bit_timing_param_t can_timing
Definition: hpm_mcan_drv.h:675
mcan_timeout_config_t timeout_cfg
Definition: hpm_mcan_drv.h:697
mcan_bit_timing_param_t canfd_timing
Definition: hpm_mcan_drv.h:676
bool enable_tdc
Definition: hpm_mcan_drv.h:688
bool disable_auto_retransmission
Definition: hpm_mcan_drv.h:690
uint32_t txbuf_trans_interrupt_mask
Definition: hpm_mcan_drv.h:700
uint16_t can20_samplepoint_max
Definition: hpm_mcan_drv.h:669
uint32_t interrupt_mask
Definition: hpm_mcan_drv.h:699
mcan_tdc_config_t tdc_config
Definition: hpm_mcan_drv.h:691
bool enable_restricted_operation_mode
Definition: hpm_mcan_drv.h:689
uint16_t canfd_samplepoint_max
Definition: hpm_mcan_drv.h:671
uint16_t can20_samplepoint_min
Definition: hpm_mcan_drv.h:668
mcan_node_mode_t mode
Definition: hpm_mcan_drv.h:680
bool enable_edge_filtering
Definition: hpm_mcan_drv.h:683
bool disable_protocol_exception_handling
Definition: hpm_mcan_drv.h:684
bool use_lowlevel_timing_setting
Definition: hpm_mcan_drv.h:679
uint16_t canfd_samplepoint_min
Definition: hpm_mcan_drv.h:670
bool enable_transmit_pause
Definition: hpm_mcan_drv.h:682
bool use_timestamping_unit
Definition: hpm_mcan_drv.h:686
mcan_all_filters_config_t all_filters_config
Definition: hpm_mcan_drv.h:695
MCAN Error Count Information.
Definition: hpm_mcan_drv.h:724
bool receive_error_passive
Definition: hpm_mcan_drv.h:727
uint8_t transmit_error_count
Definition: hpm_mcan_drv.h:725
uint8_t can_error_logging_count
Definition: hpm_mcan_drv.h:728
uint8_t receive_error_count
Definition: hpm_mcan_drv.h:726
MCAN Filter Element List structure.
Definition: hpm_mcan_drv.h:558
const mcan_filter_elem_t * filter_elem_list
Definition: hpm_mcan_drv.h:560
uint32_t mcan_filter_elem_count
Definition: hpm_mcan_drv.h:559
MCAN Global CAN configuration.
Definition: hpm_mcan_drv.h:487
bool reject_remote_std_frame
Definition: hpm_mcan_drv.h:490
bool reject_remote_ext_frame
Definition: hpm_mcan_drv.h:491
uint8_t accept_non_matching_ext_frame_option
Definition: hpm_mcan_drv.h:489
uint8_t accept_non_matching_std_frame_option
Definition: hpm_mcan_drv.h:488
MCAN High Priority Message Status Information.
Definition: hpm_mcan_drv.h:758
uint8_t filter_index
Definition: hpm_mcan_drv.h:760
uint8_t buffer_index
Definition: hpm_mcan_drv.h:762
uint8_t filter_list_type
Definition: hpm_mcan_drv.h:759
uint8_t message_storage_indicator
Definition: hpm_mcan_drv.h:761
MCAN Internal timestamp configuration.
Definition: hpm_mcan_drv.h:626
uint8_t timestamp_selection
Definition: hpm_mcan_drv.h:628
uint8_t counter_prescaler
Definition: hpm_mcan_drv.h:627
MCAN Protocol Status.
Definition: hpm_mcan_drv.h:734
mcan_activity_state_t activity
Definition: hpm_mcan_drv.h:736
bool in_bus_off_state
Definition: hpm_mcan_drv.h:742
bool canfd_msg_received
Definition: hpm_mcan_drv.h:739
bool in_error_passive_state
Definition: hpm_mcan_drv.h:744
bool in_warning_state
Definition: hpm_mcan_drv.h:743
bool esi_flag_set_in_last_rcv_canfd_msg
Definition: hpm_mcan_drv.h:741
uint8_t tdc_val
Definition: hpm_mcan_drv.h:735
bool protocol_exception_evt_occurred
Definition: hpm_mcan_drv.h:738
bool brs_flag_set_in_last_rcv_canfd_msg
Definition: hpm_mcan_drv.h:740
mcan_last_err_code_t last_error_code
Definition: hpm_mcan_drv.h:737
MCAN RAM configuration.
Definition: hpm_mcan_drv.h:447
uint32_t watermark
Definition: hpm_mcan_drv.h:457
uint8_t txbuf_data_field_size
Definition: hpm_mcan_drv.h:467
uint32_t data_field_size
Definition: hpm_mcan_drv.h:459
uint8_t std_filter_elem_count
Definition: hpm_mcan_drv.h:449
struct mcan_ram_config_struct::@133 rxfifos[2]
uint8_t rxbuf_elem_count
Definition: hpm_mcan_drv.h:463
bool enable_txbuf
Definition: hpm_mcan_drv.h:466
bool enable_std_filter
Definition: hpm_mcan_drv.h:448
uint8_t txbuf_dedicated_txbuf_elem_count
Definition: hpm_mcan_drv.h:468
uint8_t ext_filter_elem_count
Definition: hpm_mcan_drv.h:452
bool enable_tx_evt_fifo
Definition: hpm_mcan_drv.h:472
uint8_t txfifo_or_txqueue_mode
Definition: hpm_mcan_drv.h:470
uint8_t tx_evt_fifo_watermark
Definition: hpm_mcan_drv.h:474
uint32_t operation_mode
Definition: hpm_mcan_drv.h:458
uint32_t elem_count
Definition: hpm_mcan_drv.h:456
bool enable_ext_filter
Definition: hpm_mcan_drv.h:451
bool enable_rxbuf
Definition: hpm_mcan_drv.h:462
uint8_t tx_evt_fifo_elem_count
Definition: hpm_mcan_drv.h:473
uint32_t enable
Definition: hpm_mcan_drv.h:455
uint8_t txbuf_fifo_or_queue_elem_count
Definition: hpm_mcan_drv.h:469
uint16_t rxbuf_data_field_size
Definition: hpm_mcan_drv.h:464
MCAN RAM Flexible Configuration.
Definition: hpm_mcan_drv.h:418
mcan_rxbuf_config_t rxbuf_config
Definition: hpm_mcan_drv.h:436
bool enable_tx_evt_fifo
Definition: hpm_mcan_drv.h:425
bool enable_txbuf
Definition: hpm_mcan_drv.h:424
bool enable_rxbuf
Definition: hpm_mcan_drv.h:423
bool enable_ext_filter
Definition: hpm_mcan_drv.h:420
mcan_txbuf_elem_config_t txbuf_elem_config
Definition: hpm_mcan_drv.h:431
bool enable_std_filter
Definition: hpm_mcan_drv.h:419
mcan_tx_evt_fifo_config_t tx_evt_fifo_config
Definition: hpm_mcan_drv.h:432
mcan_rxfifo_config_t rxfifo1_config
Definition: hpm_mcan_drv.h:435
mcan_rxfifo_config_t rxfifo0_config
Definition: hpm_mcan_drv.h:434
mcan_txbuf_config_t txbuf_config
Definition: hpm_mcan_drv.h:430
mcan_filter_config_t ext_filter_config
Definition: hpm_mcan_drv.h:428
bool enable_rxfifo0
Definition: hpm_mcan_drv.h:421
mcan_rx_fifo_or_buf_elem_config_t rx_elem_config
Definition: hpm_mcan_drv.h:437
mcan_filter_config_t std_filter_config
Definition: hpm_mcan_drv.h:427
bool enable_rxfifo1
Definition: hpm_mcan_drv.h:422
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:520
uint32_t offset
Definition: hpm_mcan_drv.h:547
uint8_t can_id_type
Definition: hpm_mcan_drv.h:523
uint8_t filter_type
Definition: hpm_mcan_drv.h:521
uint32_t start_id
Definition: hpm_mcan_drv.h:528
uint32_t store_location
Definition: hpm_mcan_drv.h:549
uint8_t sync_message
Definition: hpm_mcan_drv.h:524
uint32_t filter_id
Definition: hpm_mcan_drv.h:538
uint32_t filter_mask
Definition: hpm_mcan_drv.h:539
uint32_t filter_event
Definition: hpm_mcan_drv.h:548
uint32_t id2
Definition: hpm_mcan_drv.h:534
uint32_t end_id
Definition: hpm_mcan_drv.h:529
uint32_t id1
Definition: hpm_mcan_drv.h:533
uint8_t filter_config
Definition: hpm_mcan_drv.h:522
uint32_t match_id
Definition: hpm_mcan_drv.h:546
MCAN Transmitter Delay Compensation Configuration.
Definition: hpm_mcan_drv.h:653
uint8_t filter_window_length
Definition: hpm_mcan_drv.h:655
uint8_t ssp_offset
Definition: hpm_mcan_drv.h:654
MCAN Timeout configuration structure.
Definition: hpm_mcan_drv.h:644
uint16_t timeout_period
Definition: hpm_mcan_drv.h:647
bool enable_timeout_counter
Definition: hpm_mcan_drv.h:645
mcan_timeout_sel_t timeout_sel
Definition: hpm_mcan_drv.h:646
MCAN Timeout Counter Configuration.
Definition: hpm_mcan_drv.h:715
bool enable_timeout_counter
Definition: hpm_mcan_drv.h:716
uint16_t timeout_period
Definition: hpm_mcan_drv.h:718
uint8_t timeout_selection
Definition: hpm_mcan_drv.h:717
MCAN Timestamp Value.
Definition: hpm_mcan_drv.h:588
uint16_t ts_16bit
Definition: hpm_mcan_drv.h:594
uint64_t ts_64bit
Definition: hpm_mcan_drv.h:596
uint32_t ts_32bit
Definition: hpm_mcan_drv.h:595
bool is_empty
Definition: hpm_mcan_drv.h:592
bool is_32bit
Definition: hpm_mcan_drv.h:590
bool is_64bit
Definition: hpm_mcan_drv.h:591
uint32_t words[2]
Definition: hpm_mcan_drv.h:597
bool is_16bit
Definition: hpm_mcan_drv.h:589
MCAN TSU Configuration.
Definition: hpm_mcan_drv.h:604
bool use_ext_timebase
Definition: hpm_mcan_drv.h:607
uint8_t ext_timebase_src
Definition: hpm_mcan_drv.h:608
uint8_t tbsel_option
Definition: hpm_mcan_drv.h:609
bool enable_64bit_timestamp
Definition: hpm_mcan_drv.h:611
bool capture_on_sof
Definition: hpm_mcan_drv.h:606
bool enable_tsu
Definition: hpm_mcan_drv.h:610
uint16_t prescaler
Definition: hpm_mcan_drv.h:605
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:396
uint32_t data_field_size
Definition: hpm_mcan_drv.h:397
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:367
uint32_t buf_data_field_size
Definition: hpm_mcan_drv.h:371
uint32_t reg_val
Definition: hpm_mcan_drv.h:374
uint32_t fifo0_data_field_size
Definition: hpm_mcan_drv.h:369
uint32_t fifo1_data_field_size
Definition: hpm_mcan_drv.h:370
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:403
uint32_t reg_val
Definition: hpm_mcan_drv.h:409
uint8_t fifo_size
Definition: hpm_mcan_drv.h:406
uint16_t start_addr
Definition: hpm_mcan_drv.h:405
uint8_t fifo_watermark
Definition: hpm_mcan_drv.h:407
Definition: hpm_mcan_drv.h:384
uint32_t fifo_queue_size
Definition: hpm_mcan_drv.h:389
uint32_t reg_val
Definition: hpm_mcan_drv.h:393
uint32_t tx_fifo_queue_mode
Definition: hpm_mcan_drv.h:390
uint32_t dedicated_tx_buf_size
Definition: hpm_mcan_drv.h:387
uint32_t start_addr
Definition: hpm_mcan_drv.h:386