HPM SDK
HPMicro Software Development Kit
hpm_mcan_drv.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2023 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 {
42 };
43 
47 #define MCAN_INT_ACCESS_TO_RESERVED_ADDR MCAN_IR_ARA_MASK
48 #define MCAN_INT_PROTOCOL_ERR_IN_DATA_PHASE MCAN_IR_PED_MASK
49 #define MCAN_INT_PROTOCOL_ERR_IN_ARB_PHASE MCAN_IR_PEA_MASK
50 #define MCAN_INT_WATCHDOG_INT MCAN_IR_WDI_MASK
52 #define MCAN_INT_BUS_OFF_STATUS MCAN_IR_BO_MASK
53 #define MCAN_INT_WARNING_STATUS MCAN_IR_EW_MASK
54 #define MCAN_INT_ERROR_PASSIVE MCAN_IR_EP_MASK
55 #define MCAN_INT_ERROR_LOGGING_OVERFLOW MCAN_IR_ELO_MASK
56 #define MCAN_INT_BIT_ERROR_UNCORRECTED MCAN_IR_BEU_MASK
57 #define MCAN_INT_BIT_ERROR_CORRECTED MCAN_IR_BEC_MASK
59 #define MCAN_INT_MSG_STORE_TO_RXBUF MCAN_IR_DRX_MASK
60 #define MCAN_INT_TIMEOUT_OCCURRED MCAN_IR_TOO_MASK
61 #define MCAN_INT_MSG_RAM_ACCESS_FAILURE MCAN_IR_MRAF_MASK
62 #define MCAN_INT_TIMESTAMP_WRAPAROUND MCAN_IR_TSW_MASK
64 #define MCAN_INT_TX_EVT_FIFO_EVT_LOST MCAN_IR_TEFL_MASK
65 #define MCAN_INT_TX_EVT_FIFO_FULL MCAN_IR_TEFF_MASK
66 #define MCAN_INT_TX_EVT_FIFO_WMK_REACHED MCAN_IR_TEFW_MASK
67 #define MCAN_INT_TX_EVT_FIFO_NEW_ENTRY MCAN_IR_TEFN_MASK
69 #define MCAN_INT_TXFIFO_EMPTY MCAN_IR_TFE_MASK
70 #define MCAN_INT_TX_CANCEL_FINISHED MCAN_IR_TCF_MASK
71 #define MCAN_INT_TX_COMPLETED MCAN_IR_TC_MASK
72 #define MCAN_INT_HIGH_PRIORITY_MSG MCAN_IR_HPM_MASK
74 #define MCAN_INT_RXFIFO1_MSG_LOST MCAN_IR_RF1L_MASK
75 #define MCAN_INT_RXFIFO1_FULL MCAN_IR_RF1F_MASK
76 #define MCAN_INT_RXFIFO1_WMK_REACHED MCAN_IR_RF1W_MASK
77 #define MCAN_INT_RXFIFO1_NEW_MSG MCAN_IR_RF1N_MASK
79 #define MCAN_INT_RXFIFO0_MSG_LOST MCAN_IR_RF0L_MASK
80 #define MCAN_INT_RXFIFO0_FULL MCAN_IR_RF0F_MASK
81 #define MCAN_INT_RXFIFO0_WMK_REACHED MCAN_IR_RF0W_MASK
82 #define MCAN_INT_RXFIFO0_NEW_MSG MCAN_IR_RF0N_MASK
87 #define MCAN_EVENT_RECEIVE (MCAN_INT_RXFIFO0_NEW_MSG | MCAN_INT_RXFIFO1_NEW_MSG | MCAN_INT_MSG_STORE_TO_RXBUF)
88 
92 #define MCAN_EVENT_TRANSMIT (MCAN_INT_TX_COMPLETED)
96 #define MCAN_EVENT_ERROR (MCAN_INT_BUS_OFF_STATUS | MCAN_INT_WARNING_STATUS \
97  | MCAN_INT_ERROR_PASSIVE | MCAN_INT_BIT_ERROR_UNCORRECTED \
98  | MCAN_INT_PROTOCOL_ERR_IN_DATA_PHASE | MCAN_INT_PROTOCOL_ERR_IN_ARB_PHASE)
99 
103 #define MCAN_TX_RETRY_COUNT_MAX (10000000UL)
107 #define MCAN_RX_RETRY_COUNT_MAX (80000000UL)
108 
112 typedef enum mcan_last_error_code {
122 
126 typedef enum mcan_activity_enum {
132 
133 /***********************************************************************************************************************
134  * @brief Default CAN RAM definitions
135  **********************************************************************************************************************/
136 #define MCAN_RAM_WORD_SIZE (640U)
137 /* CAN Filter Element Size Definitions */
138 #define MCAN_FILTER_ELEM_STD_ID_SIZE (4U)
139 #define MCAN_FILTER_ELEM_EXT_ID_SIZE (8U)
140 #define MCAN_STD_FILTER_ELEM_SIZE_MAX (128U)
141 #define MCAN_EXT_FILTER_ELEM_SIZE_MAX (64U)
142 /* MCAN Default Field Size Definitions for CAN2.0 */
143 #define MCAN_TXRX_ELEM_SIZE_CAN_MAX (4U * sizeof(uint32_t))
144 #define MCAN_FILTER_SIZE_CAN_DEFAULT (32U)
145 #define MCAN_TXBUF_SIZE_CAN_DEFAULT (32U)
146 #define MCAN_RXFIFO_SIZE_CAN_DEFAULT (32U)
147 #define MCAN_RXBUF_SIZE_CAN_DEFAULT (16U)
148 /* MCAN Default Field Size Definitions for CANFD */
149 #define MCAN_TXRX_ELEM_SIZE_CANFD_MAX (18U * sizeof(uint32_t))
150 #define MCAN_FILTER_SIZE_CANFD_DEFAULT (16U)
151 #define MCAN_TXBUF_SIZE_CANFD_DEFAULT (8U)
152 #define MCAN_RXFIFO_SIZE_CANFD_DEFAULT (8U)
153 #define MCAN_RXBUF_SIZE_CANFD_DEFAULT (4U)
154 
155 #define MCAN_TXEVT_ELEM_SIZE (8U)
156 
161  uint16_t prescaler;
162  uint16_t num_seg1;
163  uint16_t num_seg2;
164  uint8_t num_sjw;
165  bool enable_tdc;
167 
176 
180 #define MCAN_MESSAGE_HEADER_SIZE_IN_BYTES (8U)
181 #define MCAN_MESSAGE_HEADER_SIZE_IN_WORDS (2U)
182 
190 typedef struct mcan_tx_message_struct {
191  union {
192  struct {
193  uint32_t ext_id: 29;
194  uint32_t rtr: 1;
195  uint32_t use_ext_id: 1;
196  uint32_t error_state_indicator: 1;
197  };
198  struct {
199  uint32_t : 18;
200  uint32_t std_id: 11;
201  uint32_t : 3;
202  };
203  };
204  struct {
205  uint32_t : 8;
206  uint32_t message_marker_h: 8;
207  uint32_t dlc: 4;
208  uint32_t bitrate_switch: 1;
209  uint32_t canfd_frame: 1;
211  uint32_t event_fifo_control: 1;
212  uint32_t message_marker_l: 8;
213  };
214  union {
215  uint8_t data_8[64];
216  uint32_t data_32[16];
217  };
219 
227 typedef struct mcan_rx_message_struct {
228  union {
229  struct {
230  uint32_t ext_id: 29;
231  uint32_t rtr: 1;
232  uint32_t use_ext_id: 1;
233  uint32_t error_state_indicator: 1;
234  };
235  struct {
236  uint32_t : 18;
237  uint32_t std_id: 11;
238  uint32_t : 3;
239  };
240  };
241  struct {
242  union {
243  uint16_t rx_timestamp;
244  struct {
245  uint16_t rx_timestamp_pointer: 4;
246  uint16_t rx_timestamp_captured: 1;
247  uint16_t : 11;
248  };
249  };
250  };
251  struct {
252  uint16_t dlc: 4;
253  uint16_t bitrate_switch: 1;
254  uint16_t canfd_frame: 1;
255  uint16_t : 1;
256  uint16_t filter_index: 7;
258  };
259  union {
260  uint8_t data_8[64];
261  uint32_t data_32[16];
262  };
264 
269  struct {
270  /* First word */
271  union {
272  struct {
273  uint32_t ext_id: 29;
274  uint32_t rtr: 1;
275  uint32_t extend_id: 1;
276  uint32_t error_state_indicator: 1;
277  };
278  struct {
279  uint32_t : 18;
280  uint32_t std_id: 11;
281  uint32_t : 3;
282  };
283  };
284 
285  /* first 16-bit of the 2nd word */
286  union {
287  uint16_t tx_timestamp;
288  struct {
289  uint16_t tx_timestamp_pointer: 4;
290  uint16_t tx_timestamp_captured: 1;
291  uint16_t : 11;
292  };
293  };
294  /* high-half 16-bit of the 2nd word */
295  struct {
296  uint16_t dlc: 4;
297  uint16_t bitrate_switch: 1;
298  uint16_t canfd_frame: 1;
299  uint16_t event_type: 2;
300  uint16_t message_marker: 8;
301  };
302  };
303  uint32_t words[2];
305 
306 
307 
311 #define MCAN_CAN_ID_TYPE_STANDARD (0U)
312 #define MCAN_CAN_ID_TYPE_EXTENDED (1U)
318  struct {
319  uint16_t list_start_addr;
320  uint16_t list_size;
321  };
322  uint32_t reg_val;
324 
329  struct {
330  uint32_t start_addr: 16;
331  uint32_t fifo_size: 8;
332  uint32_t watermark: 7;
333  uint32_t operation_mode: 1;
334  };
335  uint32_t reg_val;
337 
341 typedef struct {
342  uint32_t start_addr;
344 
348 #define MCAN_DATA_FIELD_SIZE_8BYTES (0U)
349 #define MCAN_DATA_FIELD_SIZE_12BYTES (1U)
350 #define MCAN_DATA_FIELD_SIZE_16BYTES (2U)
351 #define MCAN_DATA_FIELD_SIZE_20BYTES (3U)
352 #define MCAN_DATA_FIELD_SIZE_24BYTES (4U)
353 #define MCAN_DATA_FIELD_SIZE_32BYTES (5U)
354 #define MCAN_DATA_FIELD_SIZE_48BYTES (6U)
355 #define MCAN_DATA_FIELD_SIZE_64BYTES (7U)
356 
360 #define MCAN_FIFO_OPERATION_MODE_BLOCKING (0U)
361 #define MCAN_FIFO_OPERATION_MODE_OVERWRITE (1U)
362 
367  struct {
368  uint32_t fifo0_data_field_size: 4;
369  uint32_t fifo1_data_field_size: 4;
370  uint32_t buf_data_field_size: 4;
371  uint32_t : 20;
372  };
373  uint32_t reg_val;
375 
379 #define MCAN_TXBUF_OPERATION_MODE_FIFO (0U)
380 #define MCAN_TXBUF_OPERATION_MODE_QUEUE (1U)
381 
382 
384  struct {
385  uint32_t start_addr: 16;
386  uint32_t dedicated_tx_buf_size: 6;
387  uint32_t : 2;
388  uint32_t fifo_queue_size: 6;
389  uint32_t tx_fifo_queue_mode: 1;
390  uint32_t : 1;
391  };
392  uint32_t reg_val;
394 
396  uint32_t data_field_size;
398 
402 typedef union {
403  struct {
404  uint16_t start_addr;
405  uint8_t fifo_size;
406  uint8_t fifo_watermark;
407  };
408  uint32_t reg_val;
410 
438 
446 typedef struct mcan_ram_config_struct {
453  struct {
454  uint32_t enable: 4;
455  uint32_t elem_count: 8;
456  uint32_t watermark: 8;
457  uint32_t operation_mode: 4;
458  uint32_t data_field_size: 8;
459  } rxfifos[2];
460 
475 
479 #define MCAN_ACCEPT_NON_MATCHING_FRAME_OPTION_IN_RXFIFO0 (0U)
480 #define MCAN_ACCEPT_NON_MATCHING_FRAME_OPTION_IN_RXFIFO1 (1U)
481 #define MCAN_ACCEPT_NON_MATCHING_FRAME_OPTION_REJECT (2U)
492 
496 #define MCAN_FILTER_TYPE_RANGE_FILTER (0U)
497 #define MCAN_FILTER_TYPE_SPECIFIED_ID_FILTER (1U)
498 #define MCAN_FILTER_TYPE_CLASSIC_FILTER (2U)
499 #define MCAN_FILTER_TYPE_FILTER_DISABLED (3U)
500 #define MCAN_FILTER_TYPE_DUAL_ID_EXT_FILTER_IGNORE_MASK
505 #define MCAN_FILTER_ELEM_CFG_DISABLED (0)
506 #define MCAN_FILTER_ELEM_CFG_STORE_IN_RX_FIFO0_IF_MATCH (1U)
507 #define MCAN_FILTER_ELEM_CFG_STORE_IN_RX_FIFO1_IF_MATCH (2U)
508 #define MCAN_FILTER_ELEM_CFG_REJECT_ID_IF_MATCH (3U)
509 #define MCAN_FILTER_ELEM_CFG_SET_PRIORITY_IF_MATCH (4U)
511 #define MCAN_FILTER_ELEM_CFG_SET_PRIORITY_AND_STORE_IN_FIFO0_IF_MATCH (5U)
513 #define MCAN_FILTER_ELEM_CFG_SET_PRIORITY_AND_STORE_IN_FIFO1_IF_MATCH (6U)
514 #define MCAN_FILTER_ELEM_CFG_STORE_INTO_RX_BUFFER_OR_AS_DBG_MSG (7U)
520  uint8_t filter_type;
521  uint8_t filter_config;
522  uint8_t can_id_type;
523  uint8_t sync_message;
524  union {
525  /* This definition takes effect if the filter type is range filter */
526  struct {
527  uint32_t start_id;
528  uint32_t end_id;
529  };
530  /* This definition takes effect if the filter type is dual id filter */
531  struct {
532  uint32_t id1;
533  uint32_t id2;
534  };
535  /* This definition takes effect if the filter type is classic filter */
536  struct {
537  uint32_t filter_id;
538  uint32_t filter_mask;
539  };
540  /* This definition takes effect if the filter configuration is "store into RX Buffer or as debug message"
541  *
542  * In this definition, only the exact ID matching mode is activated
543  */
544  struct {
545  uint32_t match_id;
546  uint32_t offset: 6;
547  uint32_t filter_event: 3;
548  uint32_t store_location: 2;
549  uint32_t : 21;
550  };
551  };
553 
561 
569  uint32_t ext_id_mask;
573 
577 typedef enum mcan_node_mode_enum {
583 
588  bool is_16bit;
589  bool is_32bit;
590  bool is_64bit;
591  bool is_empty;
592  union {
593  uint16_t ts_16bit;
594  uint32_t ts_32bit;
595  uint64_t ts_64bit;
596  uint32_t words[2];
597  };
599 
603 typedef struct mcan_tsu_config_struct {
604  uint16_t prescaler;
608  uint8_t tbsel_option;
609  bool enable_tsu;
612 
616 #define MCAN_TIMESTAMP_SEL_MIN (0U)
617 #define MCAN_TIMESTAMP_SEL_VALUE_ALWAYS_ZERO (0U)
618 #define MCAN_TIMESTAMP_SEL_VALUE_INCREMENT (1U)
619 #define MCAN_TIMESTAMP_SEL_EXT_TS_VAL_USED (2U)
620 #define MCAN_TIMESTAMP_SEL_MAX (MCAN_TIMESTAMP_SEL_EXT_TS_VAL_USED)
621 
629 
633 typedef enum mcan_timeout_sel_enum {
639 
646  uint16_t timeout_period;
648 
652 typedef struct mcan_config_struct {
653  union {
654  /* This struct takes effect if "use_lowlevel_timing_setting = false" */
655  struct {
656  uint32_t baudrate;
657  uint32_t baudrate_fd;
662  };
663  /* This struct takes effect if "use_lowlevel_timing_setting = true" */
664  struct {
667  };
668  };
678  bool enable_tdc;
681  uint8_t padding[2];
689  uint32_t interrupt_mask;
693 
697 #define MCAN_TIMEOUT_SEL_TYPE_CONTINUOUS_OPERATION (0U)
698 #define MCAN_TIMEOUT_SEL_TYPE_TIMEOUT_CTRL_BY_TX_EVT_FIFO (1U)
699 #define MCAN_TIMEOUT_SEL_TYPE_TIMEOUT_CTRL_BY_RX_FIFO0 (2U)
700 #define MCAN_TIMEOUT_SEL_TYPE_TIMEOUT_CTRL_BY_RX_FIFO1 (3U)
701 
708  uint16_t timeout_period;
710 
714 typedef struct mcan_error_count_struct {
720 
724 typedef struct mcan_protocol_status {
725  uint8_t tdc_val;
736 
740 typedef struct mcan_tdc_config_t {
741  uint8_t ssp_offset;
744 
745 
749 #define MCAN_MESSAGE_STORAGE_INDICATOR_NO_FIFO_SELECTED (0U)
750 #define MCAN_MESSAGE_STORAGE_INDICATOR_FIFO_MESSAGE_LOST (1U)
751 #define MCAN_MESSAGE_STORAGE_INDICATOR_RXFIFO0 (2U)
752 #define MCAN_MESSAGE_STORAGE_INDICATOR_RXFIFO1 (3U)
753 
759  uint8_t filter_index;
761  uint8_t buffer_index;
763 
768 static inline void mcan_enable_transmit_pause(MCAN_Type *ptr)
769 {
770  ptr->CCCR |= MCAN_CCCR_TXP_MASK;
771 }
772 
777 static inline void mcan_disable_transmit_pause(MCAN_Type *ptr)
778 {
779  ptr->CCCR &= ~MCAN_CCCR_TXP_MASK;
780 }
781 
786 static inline void mcan_enable_edge_filtering(MCAN_Type *ptr)
787 {
788  ptr->CCCR |= MCAN_CCCR_EFBI_MASK;
789 }
790 
795 static inline void mcan_disable_edge_filtering(MCAN_Type *ptr)
796 {
797  ptr->CCCR &= ~MCAN_CCCR_EFBI_MASK;
798 }
799 
805 {
806  ptr->CCCR &= ~MCAN_CCCR_PXHD_MASK;
807 }
808 
814 {
815  ptr->CCCR |= MCAN_CCCR_PXHD_MASK;
816 }
817 
823 {
824  ptr->CCCR |= MCAN_CCCR_WMM_MASK;
825 }
826 
832 {
833  ptr->CCCR &= ~MCAN_CCCR_WMM_MASK;
834 }
835 
840 static inline void mcan_enable_tsu(MCAN_Type *ptr)
841 {
842  ptr->CCCR |= MCAN_CCCR_UTSU_MASK;
843 }
844 
849 static inline void mcan_disable_tsu(MCAN_Type *ptr)
850 {
851  ptr->CCCR &= ~MCAN_CCCR_UTSU_MASK;
852 }
853 
860 static inline bool mcan_is_tsu_used(MCAN_Type *ptr)
861 {
862  return ((ptr->CCCR & MCAN_CCCR_UTSU_MASK) != 0U);
863 }
864 
872 {
873  return ((ptr->TSCFG & MCAN_TSCFG_EN64_MASK) != 0U);
874 }
875 
880 static inline void mcan_enable_bitrate_switch(MCAN_Type *ptr)
881 {
882  ptr->CCCR |= MCAN_CCCR_BRSE_MASK;
883 }
884 
889 static inline void mcan_disable_bitrate_switch(MCAN_Type *ptr)
890 {
891  ptr->CCCR &= ~MCAN_CCCR_BRSE_MASK;
892 }
893 
899 {
900  ptr->CCCR &= ~MCAN_CCCR_DAR_MASK;
901 }
902 
908 {
909  ptr->CCCR |= MCAN_CCCR_DAR_MASK;
910 }
911 
917 {
918  ptr->CCCR |= MCAN_CCCR_MON_MASK;
919 }
920 
925 static inline void mcan_stop_clock(MCAN_Type *ptr)
926 {
927  ptr->CCCR |= MCAN_CCCR_CSR_MASK;
928 }
929 
934 static inline void mcan_enable_clock(MCAN_Type *ptr)
935 {
936  ptr->CCCR &= ~MCAN_CCCR_CSR_MASK;
937 }
938 
939 static inline bool mcan_is_clock_enabled(MCAN_Type *ptr)
940 {
941  return ((ptr->CCCR & MCAN_CCCR_CSR_MASK) == 0UL);
942 }
943 
949 {
950  ptr->CCCR &= ~MCAN_CCCR_MON_MASK;
951 }
952 
957 static inline bool mcan_is_clock_stopped(MCAN_Type *ptr)
958 {
959  return ((ptr->CCCR & MCAN_CCCR_CSA_MASK) != 0U);
960 }
961 
967 {
968  ptr->CCCR |= MCAN_CCCR_ASM_MASK;
969 }
970 
976 {
977  ptr->CCCR &= ~MCAN_CCCR_ASM_MASK;
978 }
979 
985 {
986  ptr->CCCR |= MCAN_CCCR_CCE_MASK;
987 }
988 
994 {
995  ptr->CCCR &= ~MCAN_CCCR_CCE_MASK;
996 }
997 
1003 static inline uint16_t mcan_get_timestamp_counter_value(MCAN_Type *ptr)
1004 {
1005  return ptr->TSCV;
1006 }
1007 
1012 static inline void mcan_enter_init_mode(MCAN_Type *ptr)
1013 {
1014  ptr->CCCR |= MCAN_CCCR_INIT_MASK;
1015 }
1016 
1021 static inline void mcan_enter_normal_mode(MCAN_Type *ptr)
1022 {
1023  ptr->CCCR &= ~MCAN_CCCR_INIT_MASK;
1024 }
1025 
1031 static inline uint16_t mcan_get_timeout_counter_value(MCAN_Type *ptr)
1032 {
1033  return ptr->TOCV;
1034 }
1035 
1042 {
1043  *((volatile uint32_t *) &ptr->TOCV) = 0;
1044 }
1045 
1051 static inline void mcan_get_error_counter(MCAN_Type *ptr, mcan_error_count_t *err_cnt)
1052 {
1053  uint32_t ecr = ptr->ECR;
1054  err_cnt->transmit_error_count = MCAN_ECR_TEC_GET(ecr);
1055  err_cnt->receive_error_count = MCAN_ECR_REC_GET(ecr);
1056  err_cnt->receive_error_passive = (MCAN_ECR_RP_GET(ecr) == 1U);
1057  err_cnt->can_error_logging_count = MCAN_ECR_CEL_GET(ecr);
1058 }
1059 
1065 static inline uint8_t mcan_get_last_error_code(MCAN_Type *ptr)
1066 {
1067  return MCAN_PSR_LEC_GET(ptr->PSR);
1068 }
1069 
1075 static inline uint8_t mcan_get_last_data_error_code(MCAN_Type *ptr)
1076 {
1077  return MCAN_PSR_DLEC_GET(ptr->PSR);
1078 }
1079 
1085 static inline uint8_t mcan_get_activity(MCAN_Type *ptr)
1086 {
1087  return MCAN_PSR_ACT_GET(ptr->PSR);
1088 }
1089 
1095 static inline bool mcan_is_in_err_passive_state(MCAN_Type *ptr)
1096 {
1097  return (MCAN_PSR_EP_GET(ptr->PSR) == 1U);
1098 }
1099 
1106 {
1107  return (MCAN_PSR_EW_GET(ptr->PSR) == 1U);
1108 }
1109 
1115 static inline bool mcan_is_in_busoff_state(MCAN_Type *ptr)
1116 {
1117  return (MCAN_PSR_BO_GET(ptr->PSR) == 1U);
1118 }
1119 
1127 {
1128  return MCAN_PSR_DLEC_GET(ptr->PSR);
1129 }
1130 
1137 {
1138  return (MCAN_PSR_RESI_GET(ptr->PSR) == 1U);
1139 }
1140 
1147 {
1148  return (MCAN_PSR_RBRS_GET(ptr->PSR) == 1U);
1149 }
1150 
1157 {
1158  return (MCAN_PSR_RFDF_GET(ptr->PSR) == 1U);
1159 }
1160 
1167 {
1168  return (MCAN_PSR_PXE_GET(ptr->PSR) == 1U);
1169 }
1170 
1177 {
1178  return MCAN_PSR_TDCV_GET(ptr->PSR);
1179 }
1180 
1186 static inline uint32_t mcan_get_interrupt_flags(MCAN_Type *ptr)
1187 {
1188  return ptr->IR;
1189 }
1190 
1196 static inline void mcan_clear_interrupt_flags(MCAN_Type *ptr, uint32_t mask)
1197 {
1198  ptr->IR = mask;
1199 }
1200 
1206 static inline void mcan_enable_interrupts(MCAN_Type *ptr, uint32_t mask)
1207 {
1208  ptr->ILS &= ~mask;
1209  ptr->IE |= mask;
1210  ptr->ILE = 1U;
1211 }
1212 
1219 static inline void mcan_enable_txbuf_interrupt(MCAN_Type *ptr, uint32_t mask)
1220 {
1221  ptr->TXBTIE |= mask;
1222 }
1223 
1230 static inline void mcan_disable_txbuf_interrupt(MCAN_Type *ptr, uint32_t mask)
1231 {
1232  ptr->TXBTIE &= ~mask;
1233 }
1234 
1240 static inline void mcan_disable_interrupts(MCAN_Type *ptr, uint32_t mask)
1241 {
1242  ptr->IE &= ~mask;
1243 }
1244 
1250 static inline void mcan_enable_txbuf_transmission_interrupt(MCAN_Type *ptr, uint32_t mask)
1251 {
1252  ptr->TXBTIE |= mask;
1253 }
1254 
1260 static inline void mcan_disable_txbuf_transmission_interrupt(MCAN_Type *ptr, uint32_t mask)
1261 {
1262  ptr->TXBTIE &= ~mask;
1263 }
1264 
1270 static inline void mcan_enable_txbuf_cancel_finish_interrupt(MCAN_Type *ptr, uint32_t mask)
1271 {
1272  ptr->TXBCIE |= mask;
1273 }
1274 
1280 static inline void mcan_disable_txbuf_cancel_finish_interrupt(MCAN_Type *ptr, uint32_t mask)
1281 {
1282  ptr->TXBCIE &= ~mask;
1283 }
1284 
1291 static inline void mcan_interrupt_line_select(MCAN_Type *ptr, uint32_t mask, uint8_t line_index)
1292 {
1293  if (line_index == 0) {
1294  ptr->ILS &= ~mask;
1295  } else {
1296  ptr->ILS |= mask;
1297  }
1298  ptr->ILE = (1UL << line_index);
1299 }
1300 
1307 static inline bool mcan_is_transmit_request_pending(MCAN_Type *ptr, uint32_t index)
1308 {
1309  return ((ptr->TXBRP & ((1UL << index))) != 0U);
1310 }
1311 
1317 static inline bool mcan_is_txfifo_full(MCAN_Type *ptr)
1318 {
1319  return ((ptr->TXFQS & MCAN_TXFQS_TFQF_MASK) != 0U);
1320 }
1321 
1327 static inline uint32_t mcan_get_txfifo_put_index(MCAN_Type *ptr)
1328 {
1329  return MCAN_TXFQS_TFQPI_GET(ptr->TXFQS);
1330 }
1331 
1337 static inline void mcan_send_add_request(MCAN_Type *ptr, uint32_t index)
1338 {
1339  ptr->TXBAR = (1UL << index);
1340 }
1341 
1348 static inline bool mcan_is_transmit_occurred(MCAN_Type *ptr, uint32_t index)
1349 {
1350  return ((ptr->TXBTO & (1UL << index)) != 0U);
1351 }
1352 
1359 static inline bool mcan_is_rxbuf_data_available(MCAN_Type *ptr, uint32_t index)
1360 {
1361  bool result;
1362  if (index < 32U) {
1363  result = (ptr->NDAT1 & (1UL << index)) != 0U;
1364  } else if (index < 64U) {
1365  result = (ptr->NDAT2 & (1UL << (index - 32U))) != 0U;
1366  } else {
1367  result = false;
1368  }
1369  return result;
1370 }
1371 
1377 static inline void mcan_clear_rxbuf_data_available_flag(MCAN_Type *ptr, uint32_t index)
1378 {
1379  if (index < 32U) {
1380  ptr->NDAT1 = (1UL << index);
1381  } else if (index < 64U) {
1382  ptr->NDAT2 = (1UL << (index - 32U));
1383  } else {
1384  /* Do nothing */
1385  }
1386 }
1387 
1394 static inline bool mcan_is_interrupt_flag_set(MCAN_Type *ptr, uint32_t mask)
1395 {
1396  return ((ptr->IR & mask) != 0U);
1397 }
1398 
1407 static inline bool mcan_is_tsu_timestamp_available(MCAN_Type *ptr, uint32_t index)
1408 {
1409  bool is_available = false;
1410  if (index < ARRAY_SIZE(ptr->TS_SEL)) {
1411  is_available = ((ptr->TSS1 & (1UL << index)) != 0U);
1412  }
1413  return is_available;
1414 }
1415 
1422 uint32_t mcan_read_32bit_tsu_timestamp(MCAN_Type *ptr, uint32_t index);
1423 
1430 uint64_t mcan_read_64bit_tsu_timestamp(MCAN_Type *ptr, uint32_t index);
1431 
1438 
1444 void mcan_get_default_config(MCAN_Type *ptr, mcan_config_t *config);
1445 
1451 uint8_t mcan_get_message_size_from_dlc(uint8_t dlc);
1452 
1459 uint8_t mcan_get_data_field_size(uint8_t data_field_size_option);
1460 
1513 void mcan_get_default_ram_flexible_config(MCAN_Type *ptr, mcan_ram_flexible_config_t *ram_config, bool enable_canfd);
1514 
1567 void mcan_get_default_ram_config(MCAN_Type *ptr, mcan_ram_config_t *simple_config, bool enable_canfd);
1568 
1577 hpm_stat_t mcan_init(MCAN_Type *ptr, mcan_config_t *config, uint32_t src_clk_freq);
1578 
1584 void mcan_deinit(MCAN_Type *ptr);
1585 
1593 
1601 
1609 
1617 
1625 
1633 hpm_stat_t mcan_set_filter_element(MCAN_Type *ptr, const mcan_filter_elem_t *filter_elem, uint32_t index);
1634 
1642 hpm_stat_t mcan_write_txbuf(MCAN_Type *ptr, uint32_t index, mcan_tx_frame_t *tx_frame);
1643 
1651 
1659 hpm_stat_t mcan_read_rxbuf(MCAN_Type *ptr, uint32_t index, mcan_rx_message_t *rx_frame);
1660 
1668 hpm_stat_t mcan_read_rxfifo(MCAN_Type *ptr, uint32_t fifo_index, mcan_rx_message_t *rx_frame);
1669 
1679 
1687 
1696 hpm_stat_t mcan_transmit_via_txfifo_nonblocking(MCAN_Type *ptr, mcan_tx_frame_t *tx_frame, uint32_t *fifo_index);
1697 
1706 
1714 hpm_stat_t mcan_receive_from_buf_blocking(MCAN_Type *ptr, uint32_t index, mcan_rx_message_t *rx_frame);
1715 
1723 hpm_stat_t mcan_receive_from_fifo_blocking(MCAN_Type *ptr, uint32_t fifo_index, mcan_rx_message_t *rx_frame);
1724 
1735  const mcan_tx_event_fifo_elem_t *tx_evt,
1736  mcan_timestamp_value_t *timestamp);
1737 
1748  const mcan_rx_message_t *rx_msg,
1749  mcan_timestamp_value_t *timestamp);
1750 
1759 hpm_stat_t mcan_parse_protocol_status(uint32_t psr, mcan_protocol_status_t *protocol_status);
1760 
1770 
1776 #ifdef __cplusplus
1777 }
1778 #endif
1779 
1780 
1781 #endif /* HPM_MCAN_DRV_H */
uint32_t hpm_stat_t
Definition: hpm_common.h:119
#define ARRAY_SIZE(a)
Definition: hpm_common.h:42
#define MAKE_STATUS(group, code)
Definition: hpm_common.h:128
@ status_group_mcan
Definition: hpm_common.h:157
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:1021
uint8_t mcan_get_message_size_from_dlc(uint8_t dlc)
Get message Size from Data Length Code.
Definition: hpm_mcan_drv.c:1349
static void mcan_enable_clock(MCAN_Type *ptr)
Enable MCAN clock.
Definition: hpm_mcan_drv.h:934
static void mcan_disable_protocol_exception_handling(MCAN_Type *ptr)
Disable Protocol Exception Handling.
Definition: hpm_mcan_drv.h:813
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:1085
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:1250
static void mcan_stop_clock(MCAN_Type *ptr)
Stop MCAN clock.
Definition: hpm_mcan_drv.h:925
mcan_bit_timing_option
CAN Bit Timing Options.
Definition: hpm_mcan_drv.h:171
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:1348
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:1236
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 Timstamp from MCAN TX Event.
Definition: hpm_mcan_drv.c:1788
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:1359
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:1857
static void mcan_disable_auto_retransmission(MCAN_Type *ptr)
Disable Auto Transmission.
Definition: hpm_mcan_drv.h:907
static void mcan_disable_tsu(MCAN_Type *ptr)
Disable External Timestamp Unit.
Definition: hpm_mcan_drv.h:849
static void mcan_reset_timeout_counter_value(MCAN_Type *ptr)
Reset Timeout counter value.
Definition: hpm_mcan_drv.h:1041
static void mcan_interrupt_line_select(MCAN_Type *ptr, uint32_t mask, uint8_t line_index)
Select Interrupt Line.
Definition: hpm_mcan_drv.h:1291
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:1377
static void mcan_enable_auto_retransmission(MCAN_Type *ptr)
Enable Auto Retransmission.
Definition: hpm_mcan_drv.h:898
static void mcan_clear_interrupt_flags(MCAN_Type *ptr, uint32_t mask)
Clear Interrupt Flags.
Definition: hpm_mcan_drv.h:1196
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:1691
static void mcan_enter_init_mode(MCAN_Type *ptr)
Switch MCAN to Initialization mode.
Definition: hpm_mcan_drv.h:1012
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:1434
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:831
static void mcan_disable_interrupts(MCAN_Type *ptr, uint32_t mask)
Disable Interrupts.
Definition: hpm_mcan_drv.h:1240
static void mcan_disable_edge_filtering(MCAN_Type *ptr)
Disable Edge Filtering.
Definition: hpm_mcan_drv.h:795
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:1726
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:1611
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:1280
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:1003
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:822
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:916
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:1666
static bool mcan_is_txfifo_full(MCAN_Type *ptr)
Check whether TXFIFO is full.
Definition: hpm_mcan_drv.h:1317
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:1327
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:984
static void mcan_disable_restricted_operation_mode(MCAN_Type *ptr)
Disable Restricted Operation Mode.
Definition: hpm_mcan_drv.h:975
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:1593
static void mcan_enable_txbuf_interrupt(MCAN_Type *ptr, uint32_t mask)
Enable TXBUF Interrupt.
Definition: hpm_mcan_drv.h:1219
static bool mcan_is_clock_stopped(MCAN_Type *ptr)
Check whether CAN clock is stopped or not.
Definition: hpm_mcan_drv.h:957
static void mcan_disable_write_to_prot_config_registers(MCAN_Type *ptr)
Disalbe Write Access to Protected Configuration Registers.
Definition: hpm_mcan_drv.h:993
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:1896
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:1493
static void mcan_disable_bus_monitoring_mode(MCAN_Type *ptr)
Disable Bus monitoring Mode.
Definition: hpm_mcan_drv.h:948
static uint8_t mcan_get_last_error_code(MCAN_Type *ptr)
Get Last Error Code.
Definition: hpm_mcan_drv.h:1065
static void mcan_send_add_request(MCAN_Type *ptr, uint32_t index)
Request A Transmission via specified TXBUF Index.
Definition: hpm_mcan_drv.h:1337
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:1463
static bool mcan_is_canfd_message_received(MCAN_Type *ptr)
Check whether CANFD messages were received.
Definition: hpm_mcan_drv.h:1156
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:436
static void mcan_enable_txbuf_cancel_finish_interrupt(MCAN_Type *ptr, uint32_t mask)
Enable TXBUF Cancellation Finish interrupt.
Definition: hpm_mcan_drv.h:1270
union mcan_txbuf_config_struct mcan_txbuf_config_t
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:509
static void mcan_disable_txbuf_interrupt(MCAN_Type *ptr, uint32_t mask)
Disable TXBUF Interrupt.
Definition: hpm_mcan_drv.h:1230
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:1031
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:1166
static void mcan_disable_transmit_pause(MCAN_Type *ptr)
Disable Transmit Pause.
Definition: hpm_mcan_drv.h:777
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:1362
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:889
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:1398
static uint8_t mcan_get_last_data_error_code(MCAN_Type *ptr)
Get Last Data Phase Error Code.
Definition: hpm_mcan_drv.h:1075
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:799
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:1763
static void mcan_enable_bitrate_switch(MCAN_Type *ptr)
Enable Bit Rate Switch.
Definition: hpm_mcan_drv.h:880
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:804
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:1558
static void mcan_enable_restricted_operation_mode(MCAN_Type *ptr)
Enable Restricted Operation Mode.
Definition: hpm_mcan_drv.h:966
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:1146
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 Timstamp from MCAN RX frame.
Definition: hpm_mcan_drv.c:1823
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:1126
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:1136
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:662
static uint8_t mcan_get_transmitter_delay_compensation_value(MCAN_Type *ptr)
Get the Transmitter Delay Compensation Value.
Definition: hpm_mcan_drv.h:1176
static void mcan_enable_tsu(MCAN_Type *ptr)
Enable External Timestamp Unit.
Definition: hpm_mcan_drv.h:840
static void mcan_enable_edge_filtering(MCAN_Type *ptr)
Enable Edge Filtering.
Definition: hpm_mcan_drv.h:786
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:996
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:1407
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:1095
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:860
static void mcan_disable_txbuf_transmission_interrupt(MCAN_Type *ptr, uint32_t mask)
Disable TXBUF Transmission interrupt.
Definition: hpm_mcan_drv.h:1260
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:1307
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:1115
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:1105
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:1747
static uint32_t mcan_get_interrupt_flags(MCAN_Type *ptr)
Get Interrupt Flags.
Definition: hpm_mcan_drv.h:1186
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:1717
static void mcan_enable_transmit_pause(MCAN_Type *ptr)
Enable Transmit Pause.
Definition: hpm_mcan_drv.h:768
void mcan_get_default_config(MCAN_Type *ptr, mcan_config_t *config)
Get Default CAN configuration.
Definition: hpm_mcan_drv.c:599
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:1637
static void mcan_enable_interrupts(MCAN_Type *ptr, uint32_t mask)
Enable Interrupts.
Definition: hpm_mcan_drv.h:1206
enum mcan_activity_enum mcan_activity_state_t
MCAN Communication State.
mcan_activity_enum
MCAN Communication State.
Definition: hpm_mcan_drv.h:126
mcan_timeout_sel_enum
MCAN Timeout Selection Options.
Definition: hpm_mcan_drv.h:633
uint64_t mcan_read_64bit_tsu_timestamp(MCAN_Type *ptr, uint32_t index)
Read 64bit Timestamp value from TSU.
Definition: hpm_mcan_drv.c:1772
void mcan_deinit(MCAN_Type *ptr)
De-Initialize CAN controller.
Definition: hpm_mcan_drv.c:1200
static bool mcan_is_interrupt_flag_set(MCAN_Type *ptr, uint32_t mask)
Check whether specified Interrupt is set.
Definition: hpm_mcan_drv.h:1394
static void mcan_get_error_counter(MCAN_Type *ptr, mcan_error_count_t *err_cnt)
Get Error Counter Information.
Definition: hpm_mcan_drv.h:1051
mcan_last_error_code
MCAN Last Error Code.
Definition: hpm_mcan_drv.h:112
mcan_node_mode_enum
CAN Node Mode types.
Definition: hpm_mcan_drv.h:577
static bool mcan_is_64bit_tsu_timestamp_used(MCAN_Type *ptr)
Check whether 64-bit TSU timestamp is used.
Definition: hpm_mcan_drv.h:871
static bool mcan_is_clock_enabled(MCAN_Type *ptr)
Definition: hpm_mcan_drv.h:939
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:877
@ mcan_bit_timing_canfd_nominal
Definition: hpm_mcan_drv.h:173
@ mcan_bit_timing_can2_0
Definition: hpm_mcan_drv.h:172
@ mcan_bit_timing_canfd_data
Definition: hpm_mcan_drv.h:174
@ 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_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:128
@ mcan_activity_receiver
Definition: hpm_mcan_drv.h:129
@ mcan_activity_sync
Definition: hpm_mcan_drv.h:127
@ mcan_activity_transmitter
Definition: hpm_mcan_drv.h:130
@ mcan_timeout_triggered_by_rx_fifo1
Definition: hpm_mcan_drv.h:637
@ mcan_timeout_continuous_operation
Definition: hpm_mcan_drv.h:634
@ mcan_timeout_triggered_by_rx_fifo0
Definition: hpm_mcan_drv.h:636
@ mcan_timeout_triggered_by_tx_evt_fifo
Definition: hpm_mcan_drv.h:635
@ mcan_last_error_code_crc_error
Definition: hpm_mcan_drv.h:119
@ mcan_last_error_code_ack_error
Definition: hpm_mcan_drv.h:116
@ mcan_last_error_code_bit0_error
Definition: hpm_mcan_drv.h:118
@ mcan_last_error_code_stuff_error
Definition: hpm_mcan_drv.h:114
@ mcan_last_error_code_format_error
Definition: hpm_mcan_drv.h:115
@ mcan_last_error_code_no_change
Definition: hpm_mcan_drv.h:120
@ mcan_last_error_code_no_error
Definition: hpm_mcan_drv.h:113
@ mcan_last_error_code_bit1_error
Definition: hpm_mcan_drv.h:117
@ mcan_mode_normal
Definition: hpm_mcan_drv.h:578
@ mcan_mode_loopback_internal
Definition: hpm_mcan_drv.h:579
@ mcan_mode_loopback_external
Definition: hpm_mcan_drv.h:580
@ mcan_mode_listen_only
Definition: hpm_mcan_drv.h:581
#define MCAN_CCCR_UTSU_MASK
Definition: hpm_mcan_regs.h:331
#define MCAN_CCCR_INIT_MASK
Definition: hpm_mcan_regs.h:453
#define MCAN_PSR_TDCV_GET(x)
Definition: hpm_mcan_regs.h:651
#define MCAN_CCCR_DAR_MASK
Definition: hpm_mcan_regs.h:380
#define MCAN_CCCR_WMM_MASK
Definition: hpm_mcan_regs.h:316
#define MCAN_CCCR_CCE_MASK
Definition: hpm_mcan_regs.h:441
#define MCAN_PSR_RESI_GET(x)
Definition: hpm_mcan_regs.h:702
#define MCAN_PSR_EP_GET(x)
Definition: hpm_mcan_regs.h:747
#define MCAN_TSCFG_EN64_MASK
Definition: hpm_mcan_regs.h:2769
#define MCAN_PSR_RFDF_GET(x)
Definition: hpm_mcan_regs.h:676
#define MCAN_TXFQS_TFQPI_GET(x)
Definition: hpm_mcan_regs.h:2402
#define MCAN_CCCR_BRSE_MASK
Definition: hpm_mcan_regs.h:344
#define MCAN_PSR_BO_GET(x)
Definition: hpm_mcan_regs.h:725
#define MCAN_ECR_REC_GET(x)
Definition: hpm_mcan_regs.h:628
#define MCAN_CCCR_TXP_MASK
Definition: hpm_mcan_regs.h:278
#define MCAN_PSR_LEC_GET(x)
Definition: hpm_mcan_regs.h:790
#define MCAN_CCCR_ASM_MASK
Definition: hpm_mcan_regs.h:429
#define MCAN_PSR_EW_GET(x)
Definition: hpm_mcan_regs.h:736
#define MCAN_TXFQS_TFQF_MASK
Definition: hpm_mcan_regs.h:2390
#define MCAN_PSR_ACT_GET(x)
Definition: hpm_mcan_regs.h:762
#define MCAN_ECR_TEC_GET(x)
Definition: hpm_mcan_regs.h:639
#define MCAN_ECR_RP_GET(x)
Definition: hpm_mcan_regs.h:618
#define MCAN_PSR_PXE_GET(x)
Definition: hpm_mcan_regs.h:663
#define MCAN_PSR_DLEC_GET(x)
Definition: hpm_mcan_regs.h:714
#define MCAN_CCCR_CSR_MASK
Definition: hpm_mcan_regs.h:405
#define MCAN_CCCR_PXHD_MASK
Definition: hpm_mcan_regs.h:303
#define MCAN_CCCR_EFBI_MASK
Definition: hpm_mcan_regs.h:290
#define MCAN_CCCR_CSA_MASK
Definition: hpm_mcan_regs.h:417
#define MCAN_ECR_CEL_GET(x)
Definition: hpm_mcan_regs.h:607
#define MCAN_CCCR_MON_MASK
Definition: hpm_mcan_regs.h:393
#define MCAN_PSR_RBRS_GET(x)
Definition: hpm_mcan_regs.h:689
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
__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 TS_SEL[16]
Definition: hpm_mcan_regs.h:66
__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
__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
MCAN Configuration for all filters.
Definition: hpm_mcan_drv.h:567
mcan_filter_elem_list_t std_id_filter_list
Definition: hpm_mcan_drv.h:570
mcan_global_filter_config_t global_filter_config
Definition: hpm_mcan_drv.h:568
mcan_filter_elem_list_t ext_id_filter_list
Definition: hpm_mcan_drv.h:571
uint32_t ext_id_mask
Definition: hpm_mcan_drv.h:569
CAN Bit Timing Parameters.
Definition: hpm_mcan_drv.h:160
uint16_t num_seg2
Definition: hpm_mcan_drv.h:163
uint8_t num_sjw
Definition: hpm_mcan_drv.h:164
uint16_t num_seg1
Definition: hpm_mcan_drv.h:162
bool enable_tdc
Definition: hpm_mcan_drv.h:165
uint16_t prescaler
Definition: hpm_mcan_drv.h:161
MCAN Configuration Structure.
Definition: hpm_mcan_drv.h:652
bool enable_canfd
Definition: hpm_mcan_drv.h:677
uint32_t baudrate_fd
Definition: hpm_mcan_drv.h:657
mcan_tsu_config_t tsu_config
Definition: hpm_mcan_drv.h:683
bool enable_wide_message_marker
Definition: hpm_mcan_drv.h:675
mcan_ram_config_t ram_config
Definition: hpm_mcan_drv.h:684
uint32_t txbuf_cancel_finish_interrupt_mask
Definition: hpm_mcan_drv.h:691
uint32_t baudrate
Definition: hpm_mcan_drv.h:656
mcan_internal_timestamp_config_t timestamp_cfg
Definition: hpm_mcan_drv.h:682
bool enable_non_iso_mode
Definition: hpm_mcan_drv.h:671
mcan_bit_timing_param_t can_timing
Definition: hpm_mcan_drv.h:665
mcan_timeout_config_t timeout_cfg
Definition: hpm_mcan_drv.h:687
mcan_bit_timing_param_t canfd_timing
Definition: hpm_mcan_drv.h:666
uint8_t padding[2]
Definition: hpm_mcan_drv.h:681
bool enable_tdc
Definition: hpm_mcan_drv.h:678
bool disable_auto_retransmission
Definition: hpm_mcan_drv.h:680
uint32_t txbuf_trans_interrupt_mask
Definition: hpm_mcan_drv.h:690
uint16_t can20_samplepoint_max
Definition: hpm_mcan_drv.h:659
uint32_t interrupt_mask
Definition: hpm_mcan_drv.h:689
bool enable_restricted_operation_mode
Definition: hpm_mcan_drv.h:679
uint16_t canfd_samplepoint_max
Definition: hpm_mcan_drv.h:661
uint16_t can20_samplepoint_min
Definition: hpm_mcan_drv.h:658
mcan_node_mode_t mode
Definition: hpm_mcan_drv.h:670
bool enable_edge_filtering
Definition: hpm_mcan_drv.h:673
bool disable_protocol_exception_handling
Definition: hpm_mcan_drv.h:674
bool use_lowlevel_timing_setting
Definition: hpm_mcan_drv.h:669
uint16_t canfd_samplepoint_min
Definition: hpm_mcan_drv.h:660
bool enable_transmit_pause
Definition: hpm_mcan_drv.h:672
bool use_timestamping_unit
Definition: hpm_mcan_drv.h:676
mcan_all_filters_config_t all_filters_config
Definition: hpm_mcan_drv.h:685
MCAN Error Count Information.
Definition: hpm_mcan_drv.h:714
bool receive_error_passive
Definition: hpm_mcan_drv.h:717
uint8_t transmit_error_count
Definition: hpm_mcan_drv.h:715
uint8_t can_error_logging_count
Definition: hpm_mcan_drv.h:718
uint8_t receive_error_count
Definition: hpm_mcan_drv.h:716
MCAN Filter Element List structure.
Definition: hpm_mcan_drv.h:557
const mcan_filter_elem_t * filter_elem_list
Definition: hpm_mcan_drv.h:559
uint32_t mcan_filter_elem_count
Definition: hpm_mcan_drv.h:558
MCAN Global CAN configuration.
Definition: hpm_mcan_drv.h:486
bool reject_remote_std_frame
Definition: hpm_mcan_drv.h:489
bool reject_remote_ext_frame
Definition: hpm_mcan_drv.h:490
uint8_t accept_non_matching_ext_frame_option
Definition: hpm_mcan_drv.h:488
uint8_t accept_non_matching_std_frame_option
Definition: hpm_mcan_drv.h:487
MCAN High Priority Message Status Information.
Definition: hpm_mcan_drv.h:757
uint8_t filter_index
Definition: hpm_mcan_drv.h:759
uint8_t buffer_index
Definition: hpm_mcan_drv.h:761
uint8_t filter_list_type
Definition: hpm_mcan_drv.h:758
uint8_t message_storage_indicator
Definition: hpm_mcan_drv.h:760
MCAN Internal timestamp configuration.
Definition: hpm_mcan_drv.h:625
uint8_t timestamp_selection
Definition: hpm_mcan_drv.h:627
uint8_t counter_prescaler
Definition: hpm_mcan_drv.h:626
MCAN Protocol Status.
Definition: hpm_mcan_drv.h:724
mcan_activity_state_t activity
Definition: hpm_mcan_drv.h:726
bool in_bus_off_state
Definition: hpm_mcan_drv.h:732
bool canfd_msg_received
Definition: hpm_mcan_drv.h:729
bool in_error_passive_state
Definition: hpm_mcan_drv.h:734
bool in_warning_state
Definition: hpm_mcan_drv.h:733
bool esi_flag_set_in_last_rcv_canfd_msg
Definition: hpm_mcan_drv.h:731
uint8_t tdc_val
Definition: hpm_mcan_drv.h:725
bool protocol_exception_evt_occurred
Definition: hpm_mcan_drv.h:728
bool brs_flag_set_in_last_rcv_canfd_msg
Definition: hpm_mcan_drv.h:730
mcan_last_err_code_t last_error_code
Definition: hpm_mcan_drv.h:727
MCAN RAM configuration.
Definition: hpm_mcan_drv.h:446
uint32_t watermark
Definition: hpm_mcan_drv.h:456
uint8_t txbuf_data_field_size
Definition: hpm_mcan_drv.h:466
uint32_t data_field_size
Definition: hpm_mcan_drv.h:458
uint8_t std_filter_elem_count
Definition: hpm_mcan_drv.h:448
uint8_t rxbuf_elem_count
Definition: hpm_mcan_drv.h:462
bool enable_txbuf
Definition: hpm_mcan_drv.h:465
bool enable_std_filter
Definition: hpm_mcan_drv.h:447
uint8_t txbuf_dedicated_txbuf_elem_count
Definition: hpm_mcan_drv.h:467
uint8_t ext_filter_elem_count
Definition: hpm_mcan_drv.h:451
bool enable_tx_evt_fifo
Definition: hpm_mcan_drv.h:471
uint8_t txfifo_or_txqueue_mode
Definition: hpm_mcan_drv.h:469
uint8_t tx_evt_fifo_watermark
Definition: hpm_mcan_drv.h:473
uint32_t operation_mode
Definition: hpm_mcan_drv.h:457
uint32_t elem_count
Definition: hpm_mcan_drv.h:455
bool enable_ext_filter
Definition: hpm_mcan_drv.h:450
bool enable_rxbuf
Definition: hpm_mcan_drv.h:461
uint8_t tx_evt_fifo_elem_count
Definition: hpm_mcan_drv.h:472
uint32_t enable
Definition: hpm_mcan_drv.h:454
uint8_t txbuf_fifo_or_queue_elem_count
Definition: hpm_mcan_drv.h:468
uint16_t rxbuf_data_field_size
Definition: hpm_mcan_drv.h:463
struct mcan_ram_config_struct::@130 rxfifos[2]
MCAN RAM Flexible Configuration.
Definition: hpm_mcan_drv.h:417
mcan_rxbuf_config_t rxbuf_config
Definition: hpm_mcan_drv.h:435
bool enable_tx_evt_fifo
Definition: hpm_mcan_drv.h:424
bool enable_txbuf
Definition: hpm_mcan_drv.h:423
bool enable_rxbuf
Definition: hpm_mcan_drv.h:422
bool enable_ext_filter
Definition: hpm_mcan_drv.h:419
mcan_txbuf_elem_config_t txbuf_elem_config
Definition: hpm_mcan_drv.h:430
bool enable_std_filter
Definition: hpm_mcan_drv.h:418
mcan_tx_evt_fifo_config_t tx_evt_fifo_config
Definition: hpm_mcan_drv.h:431
mcan_rxfifo_config_t rxfifo1_config
Definition: hpm_mcan_drv.h:434
mcan_rxfifo_config_t rxfifo0_config
Definition: hpm_mcan_drv.h:433
mcan_txbuf_config_t txbuf_config
Definition: hpm_mcan_drv.h:429
mcan_filter_config_t ext_filter_config
Definition: hpm_mcan_drv.h:427
bool enable_rxfifo0
Definition: hpm_mcan_drv.h:420
mcan_rx_fifo_or_buf_elem_config_t rx_elem_config
Definition: hpm_mcan_drv.h:436
mcan_filter_config_t std_filter_config
Definition: hpm_mcan_drv.h:426
bool enable_rxfifo1
Definition: hpm_mcan_drv.h:421
CAN Receive Message Frame.
Definition: hpm_mcan_drv.h:227
uint16_t accepted_non_matching_frame
Definition: hpm_mcan_drv.h:257
uint32_t data_32[16]
Definition: hpm_mcan_drv.h:261
uint16_t bitrate_switch
Definition: hpm_mcan_drv.h:253
uint32_t ext_id
Definition: hpm_mcan_drv.h:230
uint8_t data_8[64]
Definition: hpm_mcan_drv.h:260
uint16_t canfd_frame
Definition: hpm_mcan_drv.h:254
uint16_t rx_timestamp_pointer
Definition: hpm_mcan_drv.h:245
uint32_t std_id
Definition: hpm_mcan_drv.h:237
uint16_t filter_index
Definition: hpm_mcan_drv.h:256
uint16_t rx_timestamp_captured
Definition: hpm_mcan_drv.h:246
uint32_t rtr
Definition: hpm_mcan_drv.h:231
uint32_t use_ext_id
Definition: hpm_mcan_drv.h:232
uint16_t dlc
Definition: hpm_mcan_drv.h:252
uint16_t rx_timestamp
Definition: hpm_mcan_drv.h:243
uint32_t error_state_indicator
Definition: hpm_mcan_drv.h:233
MCAN RXBUF Configuration.
Definition: hpm_mcan_drv.h:341
uint32_t start_addr
Definition: hpm_mcan_drv.h:342
MCAN Filter Element definitions.
Definition: hpm_mcan_drv.h:519
uint32_t offset
Definition: hpm_mcan_drv.h:546
uint8_t can_id_type
Definition: hpm_mcan_drv.h:522
uint8_t filter_type
Definition: hpm_mcan_drv.h:520
uint32_t start_id
Definition: hpm_mcan_drv.h:527
uint32_t store_location
Definition: hpm_mcan_drv.h:548
uint8_t sync_message
Definition: hpm_mcan_drv.h:523
uint32_t filter_id
Definition: hpm_mcan_drv.h:537
uint32_t filter_mask
Definition: hpm_mcan_drv.h:538
uint32_t filter_event
Definition: hpm_mcan_drv.h:547
uint32_t id2
Definition: hpm_mcan_drv.h:533
uint32_t end_id
Definition: hpm_mcan_drv.h:528
uint32_t id1
Definition: hpm_mcan_drv.h:532
uint8_t filter_config
Definition: hpm_mcan_drv.h:521
uint32_t match_id
Definition: hpm_mcan_drv.h:545
MCAN Transmitter Delay Compensation Configuration.
Definition: hpm_mcan_drv.h:740
uint8_t filter_window_length
Definition: hpm_mcan_drv.h:742
uint8_t ssp_offset
Definition: hpm_mcan_drv.h:741
MCAN Timeout configuration structure.
Definition: hpm_mcan_drv.h:643
uint16_t timeout_period
Definition: hpm_mcan_drv.h:646
bool enable_timeout_counter
Definition: hpm_mcan_drv.h:644
mcan_timeout_sel_t timeout_sel
Definition: hpm_mcan_drv.h:645
MCAN Timeout Counter Configuration.
Definition: hpm_mcan_drv.h:705
bool enable_timeout_counter
Definition: hpm_mcan_drv.h:706
uint16_t timeout_period
Definition: hpm_mcan_drv.h:708
uint8_t timeout_selection
Definition: hpm_mcan_drv.h:707
MCAN Timestamp Value.
Definition: hpm_mcan_drv.h:587
uint16_t ts_16bit
Definition: hpm_mcan_drv.h:593
uint64_t ts_64bit
Definition: hpm_mcan_drv.h:595
uint32_t ts_32bit
Definition: hpm_mcan_drv.h:594
bool is_empty
Definition: hpm_mcan_drv.h:591
bool is_32bit
Definition: hpm_mcan_drv.h:589
bool is_64bit
Definition: hpm_mcan_drv.h:590
uint32_t words[2]
Definition: hpm_mcan_drv.h:596
bool is_16bit
Definition: hpm_mcan_drv.h:588
MCAN TSU Configuration.
Definition: hpm_mcan_drv.h:603
bool use_ext_timebase
Definition: hpm_mcan_drv.h:606
uint8_t ext_timebase_src
Definition: hpm_mcan_drv.h:607
uint8_t tbsel_option
Definition: hpm_mcan_drv.h:608
bool enable_64bit_timestamp
Definition: hpm_mcan_drv.h:610
bool capture_on_sof
Definition: hpm_mcan_drv.h:605
bool enable_tsu
Definition: hpm_mcan_drv.h:609
uint16_t prescaler
Definition: hpm_mcan_drv.h:604
CAN Transmit Message Frame.
Definition: hpm_mcan_drv.h:190
uint32_t dlc
Definition: hpm_mcan_drv.h:207
uint32_t rtr
Definition: hpm_mcan_drv.h:194
uint32_t event_fifo_control
Definition: hpm_mcan_drv.h:211
uint32_t std_id
Definition: hpm_mcan_drv.h:200
uint32_t use_ext_id
Definition: hpm_mcan_drv.h:195
uint32_t canfd_frame
Definition: hpm_mcan_drv.h:209
uint32_t timestamp_capture_enable
Definition: hpm_mcan_drv.h:210
uint32_t error_state_indicator
Definition: hpm_mcan_drv.h:196
uint32_t message_marker_h
Definition: hpm_mcan_drv.h:206
uint8_t data_8[64]
Definition: hpm_mcan_drv.h:215
uint32_t message_marker_l
Definition: hpm_mcan_drv.h:212
uint32_t bitrate_switch
Definition: hpm_mcan_drv.h:208
uint32_t data_32[16]
Definition: hpm_mcan_drv.h:216
uint32_t ext_id
Definition: hpm_mcan_drv.h:193
Definition: hpm_mcan_drv.h:395
uint32_t data_field_size
Definition: hpm_mcan_drv.h:396
MCAN Filter Configuration.
Definition: hpm_mcan_drv.h:317
uint16_t list_size
Definition: hpm_mcan_drv.h:320
uint32_t reg_val
Definition: hpm_mcan_drv.h:322
uint16_t list_start_addr
Definition: hpm_mcan_drv.h:319
MCAN RXBUF or RXFIFO Element Configuration.
Definition: hpm_mcan_drv.h:366
uint32_t buf_data_field_size
Definition: hpm_mcan_drv.h:370
uint32_t reg_val
Definition: hpm_mcan_drv.h:373
uint32_t fifo0_data_field_size
Definition: hpm_mcan_drv.h:368
uint32_t fifo1_data_field_size
Definition: hpm_mcan_drv.h:369
MCAN RXFIFO Configuration.
Definition: hpm_mcan_drv.h:328
uint32_t watermark
Definition: hpm_mcan_drv.h:332
uint32_t start_addr
Definition: hpm_mcan_drv.h:330
uint32_t operation_mode
Definition: hpm_mcan_drv.h:333
uint32_t fifo_size
Definition: hpm_mcan_drv.h:331
uint32_t reg_val
Definition: hpm_mcan_drv.h:335
TX Event Fifo Element Structure.
Definition: hpm_mcan_drv.h:268
uint16_t tx_timestamp
Definition: hpm_mcan_drv.h:287
uint32_t error_state_indicator
Definition: hpm_mcan_drv.h:276
uint16_t message_marker
Definition: hpm_mcan_drv.h:300
uint16_t canfd_frame
Definition: hpm_mcan_drv.h:298
uint16_t tx_timestamp_captured
Definition: hpm_mcan_drv.h:290
uint16_t tx_timestamp_pointer
Definition: hpm_mcan_drv.h:289
uint16_t event_type
Definition: hpm_mcan_drv.h:299
uint32_t ext_id
Definition: hpm_mcan_drv.h:273
uint32_t rtr
Definition: hpm_mcan_drv.h:274
uint16_t bitrate_switch
Definition: hpm_mcan_drv.h:297
uint16_t dlc
Definition: hpm_mcan_drv.h:296
uint32_t extend_id
Definition: hpm_mcan_drv.h:275
uint32_t words[2]
Definition: hpm_mcan_drv.h:303
uint32_t std_id
Definition: hpm_mcan_drv.h:280
MCAN TX Event FIFO Structure.
Definition: hpm_mcan_drv.h:402
uint32_t reg_val
Definition: hpm_mcan_drv.h:408
uint8_t fifo_size
Definition: hpm_mcan_drv.h:405
uint16_t start_addr
Definition: hpm_mcan_drv.h:404
uint8_t fifo_watermark
Definition: hpm_mcan_drv.h:406
Definition: hpm_mcan_drv.h:383
uint32_t fifo_queue_size
Definition: hpm_mcan_drv.h:388
uint32_t reg_val
Definition: hpm_mcan_drv.h:392
uint32_t tx_fifo_queue_mode
Definition: hpm_mcan_drv.h:389
uint32_t dedicated_tx_buf_size
Definition: hpm_mcan_drv.h:386
uint32_t start_addr
Definition: hpm_mcan_drv.h:385