Merge branch 'fix/twai_hid_provider_word_ctu' into 'master'

fix(driver_twai): hide the provider keyword ctu in idf

See merge request espressif/esp-idf!42142
This commit is contained in:
Wan Lei
2025-09-30 00:58:32 +08:00
12 changed files with 138 additions and 138 deletions

View File

@@ -11,18 +11,18 @@ entries:
archive: libhal.a archive: libhal.a
entries: entries:
if TWAI_ISR_IN_IRAM = y: if TWAI_ISR_IN_IRAM = y:
twai_hal_sja1000: twai_hal_decode_interrupt (noflash) twai_hal_v1: twai_hal_decode_interrupt (noflash)
twai_hal_sja1000: twai_hal_get_events (noflash) twai_hal_v1: twai_hal_get_events (noflash)
twai_hal_sja1000: twai_hal_format_frame (noflash) twai_hal_v1: twai_hal_format_frame (noflash)
twai_hal_sja1000: twai_hal_parse_frame (noflash) twai_hal_v1: twai_hal_parse_frame (noflash)
twai_hal_sja1000: twai_hal_set_tx_buffer_and_transmit (noflash) twai_hal_v1: twai_hal_set_tx_buffer_and_transmit (noflash)
twai_hal_sja1000: twai_hal_get_rx_msg_count (noflash) twai_hal_v1: twai_hal_get_rx_msg_count (noflash)
twai_hal_sja1000: twai_hal_read_rx_fifo (noflash) twai_hal_v1: twai_hal_read_rx_fifo (noflash)
twai_hal_sja1000: twai_hal_check_state_flags (noflash) twai_hal_v1: twai_hal_check_state_flags (noflash)
if TWAI_ERRATA_FIX_RX_FRAME_INVALID = y || TWAI_ERRATA_FIX_RX_FIFO_CORRUPT = y: if TWAI_ERRATA_FIX_RX_FRAME_INVALID = y || TWAI_ERRATA_FIX_RX_FIFO_CORRUPT = y:
twai_hal_sja1000: twai_hal_prepare_for_reset (noflash) twai_hal_v1: twai_hal_prepare_for_reset (noflash)
twai_hal_sja1000: twai_hal_recover_from_reset (noflash) twai_hal_v1: twai_hal_recover_from_reset (noflash)
twai_hal_sja1000: twai_hal_backup_config (noflash) twai_hal_v1: twai_hal_backup_config (noflash)
twai_hal_sja1000: twai_hal_restore_config (noflash) twai_hal_v1: twai_hal_restore_config (noflash)
twai_hal_sja1000: twai_hal_get_reset_lost_rx_cnt (noflash) twai_hal_v1: twai_hal_get_reset_lost_rx_cnt (noflash)

View File

@@ -16,25 +16,25 @@ archive: libhal.a
entries: entries:
if TWAI_ISR_IN_IRAM = y: if TWAI_ISR_IN_IRAM = y:
if SOC_TWAI_SUPPORT_FD = y: if SOC_TWAI_SUPPORT_FD = y:
twai_hal_ctufd: twai_hal_format_frame (noflash) twai_hal_v2: twai_hal_format_frame (noflash)
twai_hal_ctufd: twai_hal_parse_frame (noflash) twai_hal_v2: twai_hal_parse_frame (noflash)
twai_hal_ctufd: twai_hal_set_tx_buffer_and_transmit (noflash) twai_hal_v2: twai_hal_set_tx_buffer_and_transmit (noflash)
twai_hal_ctufd: twai_hal_get_rx_msg_count (noflash) twai_hal_v2: twai_hal_get_rx_msg_count (noflash)
twai_hal_ctufd: twai_hal_read_rx_fifo (noflash) twai_hal_v2: twai_hal_read_rx_fifo (noflash)
twai_hal_ctufd: twai_hal_get_events (noflash) twai_hal_v2: twai_hal_get_events (noflash)
else: else:
twai_hal_sja1000: twai_hal_format_frame (noflash) twai_hal_v1: twai_hal_format_frame (noflash)
twai_hal_sja1000: twai_hal_parse_frame (noflash) twai_hal_v1: twai_hal_parse_frame (noflash)
twai_hal_sja1000: twai_hal_set_tx_buffer_and_transmit (noflash) twai_hal_v1: twai_hal_set_tx_buffer_and_transmit (noflash)
twai_hal_sja1000: twai_hal_get_rx_msg_count (noflash) twai_hal_v1: twai_hal_get_rx_msg_count (noflash)
twai_hal_sja1000: twai_hal_read_rx_fifo (noflash) twai_hal_v1: twai_hal_read_rx_fifo (noflash)
twai_hal_sja1000: twai_hal_get_events (noflash) twai_hal_v1: twai_hal_get_events (noflash)
twai_hal_sja1000: twai_hal_decode_interrupt (noflash) twai_hal_v1: twai_hal_decode_interrupt (noflash)
twai_hal_sja1000: twai_hal_soft_filter_check_msg (noflash) twai_hal_v1: twai_hal_soft_filter_check_msg (noflash)
if IDF_TARGET_ESP32 = y: if IDF_TARGET_ESP32 = y:
twai_hal_sja1000: twai_hal_prepare_for_reset (noflash) twai_hal_v1: twai_hal_prepare_for_reset (noflash)
twai_hal_sja1000: twai_hal_recover_from_reset (noflash) twai_hal_v1: twai_hal_recover_from_reset (noflash)
twai_hal_sja1000: twai_hal_backup_config (noflash) twai_hal_v1: twai_hal_backup_config (noflash)
twai_hal_sja1000: twai_hal_restore_config (noflash) twai_hal_v1: twai_hal_restore_config (noflash)
twai_hal_sja1000: twai_hal_clear_rx_fifo_overrun (noflash) twai_hal_v1: twai_hal_clear_rx_fifo_overrun (noflash)

View File

@@ -115,9 +115,9 @@ elseif(NOT BOOTLOADER_BUILD)
if(CONFIG_SOC_TWAI_SUPPORTED) if(CONFIG_SOC_TWAI_SUPPORTED)
if(CONFIG_SOC_TWAI_SUPPORT_FD) if(CONFIG_SOC_TWAI_SUPPORT_FD)
list(APPEND srcs "twai_hal_ctufd.c") list(APPEND srcs "twai_hal_v2.c")
else() else()
list(APPEND srcs "twai_hal_sja1000.c") list(APPEND srcs "twai_hal_v1.c")
endif() endif()
endif() endif()

View File

@@ -42,7 +42,7 @@ extern "C" {
*/ */
#define TWAIFD_MODE_SETTINGS_REG(i) (REG_TWAI_BASE(i) + 0x4) #define TWAIFD_MODE_SETTINGS_REG(i) (REG_TWAI_BASE(i) + 0x4)
/** TWAIFD_RST : WO; bitpos: [0]; default: 0; /** TWAIFD_RST : WO; bitpos: [0]; default: 0;
* Soft reset. Writing logic 1 resets CTU CAN FD. After writing logic 1, logic 0 does * Soft reset. Writing logic 1 resets CAN FD. After writing logic 1, logic 0 does
* not need to be written, this bit * not need to be written, this bit
* is automatically cleared. * is automatically cleared.
* 0: invalid * 0: invalid
@@ -53,11 +53,11 @@ extern "C" {
#define TWAIFD_RST_V 0x00000001U #define TWAIFD_RST_V 0x00000001U
#define TWAIFD_RST_S 0 #define TWAIFD_RST_S 0
/** TWAIFD_BMM : R/W; bitpos: [1]; default: 0; /** TWAIFD_BMM : R/W; bitpos: [1]; default: 0;
* Bus monitoring mode. In this mode CTU CAN FD only receives frames and sends only * Bus monitoring mode. In this mode CAN FD only receives frames and sends only
* recessive bits on CAN * recessive bits on CAN
* bus. When a dominant bit is sent, it is re-routed internally so that bus value is * bus. When a dominant bit is sent, it is re-routed internally so that bus value is
* not changed. When this mode is * not changed. When this mode is
* enabled, CTU CAN FD will not transmit any frame from TXT Buffers, * enabled, CAN FD will not transmit any frame from TXT Buffers,
* 0b0 - BMM_DISABLED - Bus monitoring mode disabled. * 0b0 - BMM_DISABLED - Bus monitoring mode disabled.
* 0b1 - BMM_ENABLED - Bus monitoring mode enabled. * 0b1 - BMM_ENABLED - Bus monitoring mode enabled.
*/ */
@@ -89,7 +89,7 @@ extern "C" {
#define TWAIFD_AFM_V 0x00000001U #define TWAIFD_AFM_V 0x00000001U
#define TWAIFD_AFM_S 3 #define TWAIFD_AFM_S 3
/** TWAIFD_FDE : R/W; bitpos: [4]; default: 1; /** TWAIFD_FDE : R/W; bitpos: [4]; default: 1;
* Flexible data rate enable. When flexible data rate is enabled CTU CAN FD recognizes * Flexible data rate enable. When flexible data rate is enabled CAN FD recognizes
* CAN FD frames (FDF bit * CAN FD frames (FDF bit
* = 1). * = 1).
* 0b0 - FDE_DISABLE - Flexible data-rate support disabled. * 0b0 - FDE_DISABLE - Flexible data-rate support disabled.
@@ -157,16 +157,16 @@ extern "C" {
#define TWAIFD_TXBBM_S 10 #define TWAIFD_TXBBM_S 10
/** TWAIFD_SAM : R/W; bitpos: [11]; default: 0; /** TWAIFD_SAM : R/W; bitpos: [11]; default: 0;
* Self-acknowledge mode.\\ * Self-acknowledge mode.\\
* 0b0 - SAM_DISABLE - Do not send dominant ACK bit when CTU CAN FD sends Acknowledge * 0b0 - SAM_DISABLE - Do not send dominant ACK bit when CAN FD sends Acknowledge
* bit.\\ * bit.\\
* 0b1 - SAM_ENABLE - Send dominant ACK bit when CTU CAN FD transmits CAN frame.\\ * 0b1 - SAM_ENABLE - Send dominant ACK bit when CAN FD transmits CAN frame.\\
*/ */
#define TWAIFD_SAM (BIT(11)) #define TWAIFD_SAM (BIT(11))
#define TWAIFD_SAM_M (TWAIFD_SAM_V << TWAIFD_SAM_S) #define TWAIFD_SAM_M (TWAIFD_SAM_V << TWAIFD_SAM_S)
#define TWAIFD_SAM_V 0x00000001U #define TWAIFD_SAM_V 0x00000001U
#define TWAIFD_SAM_S 11 #define TWAIFD_SAM_S 11
/** TWAIFD_RTRLE : R/W; bitpos: [16]; default: 0; /** TWAIFD_RTRLE : R/W; bitpos: [16]; default: 0;
* Retransmitt Limit Enable. If enabled, CTU CAN FD only attempts to retransmitt each * Retransmitt Limit Enable. If enabled, CAN FD only attempts to retransmitt each
* frame up to RTR_TH * frame up to RTR_TH
* times. * times.
* 0b0 - RTRLE_DISABLED - Retransmitt limit is disabled. * 0b0 - RTRLE_DISABLED - Retransmitt limit is disabled.
@@ -186,7 +186,7 @@ extern "C" {
#define TWAIFD_RTRTH_V 0x0000000FU #define TWAIFD_RTRTH_V 0x0000000FU
#define TWAIFD_RTRTH_S 17 #define TWAIFD_RTRTH_S 17
/** TWAIFD_ILBP : R/W; bitpos: [21]; default: 0; /** TWAIFD_ILBP : R/W; bitpos: [21]; default: 0;
* Internal Loop Back mode. When enabled, CTU CAN FD receives any frame it transmits. * Internal Loop Back mode. When enabled, CAN FD receives any frame it transmits.
* 0b0 - INT_LOOP_DISABLED - Internal loop-back is disabled. * 0b0 - INT_LOOP_DISABLED - Internal loop-back is disabled.
* 0b1 - INT_LOOP_ENABLED - Internal loop-back is enabled. * 0b1 - INT_LOOP_ENABLED - Internal loop-back is enabled.
*/ */
@@ -195,18 +195,18 @@ extern "C" {
#define TWAIFD_ILBP_V 0x00000001U #define TWAIFD_ILBP_V 0x00000001U
#define TWAIFD_ILBP_S 21 #define TWAIFD_ILBP_S 21
/** TWAIFD_ENA : R/W; bitpos: [22]; default: 0; /** TWAIFD_ENA : R/W; bitpos: [22]; default: 0;
* Main enable bit of CTU CAN FD. When enabled, CTU CAN FD communicates on CAN bus. * Main enable bit of CAN FD. When enabled, CAN FD communicates on CAN bus.
* When disabled, it * When disabled, it
* is bus-off and does not take part of CAN bus communication. * is bus-off and does not take part of CAN bus communication.
* 0b0 - CTU_CAN_DISABLED - The CAN Core is disabled. * 0b0 - CAN_DISABLED - The CAN Core is disabled.
* 0b1 - CTU_CAN_ENABLED - The CAN Core is enabled. * 0b1 - CAN_ENABLED - The CAN Core is enabled.
*/ */
#define TWAIFD_ENA (BIT(22)) #define TWAIFD_ENA (BIT(22))
#define TWAIFD_ENA_M (TWAIFD_ENA_V << TWAIFD_ENA_S) #define TWAIFD_ENA_M (TWAIFD_ENA_V << TWAIFD_ENA_S)
#define TWAIFD_ENA_V 0x00000001U #define TWAIFD_ENA_V 0x00000001U
#define TWAIFD_ENA_S 22 #define TWAIFD_ENA_S 22
/** TWAIFD_NISOFD : R/W; bitpos: [23]; default: 0; /** TWAIFD_NISOFD : R/W; bitpos: [23]; default: 0;
* Non ISO FD. When this bit is set, CTU CAN FD is compliant to NON-ISO CAN FD * Non ISO FD. When this bit is set, CAN FD is compliant to NON-ISO CAN FD
* specification (no stuff * specification (no stuff
* count field). This bit should be modified only when SETTINGS[ENA]=0. * count field). This bit should be modified only when SETTINGS[ENA]=0.
* 0b0 - ISO_FD - The CAN Controller conforms to ISO CAN FD specification. * 0b0 - ISO_FD - The CAN Controller conforms to ISO CAN FD specification.
@@ -218,7 +218,7 @@ extern "C" {
#define TWAIFD_NISOFD_V 0x00000001U #define TWAIFD_NISOFD_V 0x00000001U
#define TWAIFD_NISOFD_S 23 #define TWAIFD_NISOFD_S 23
/** TWAIFD_PEX : R/W; bitpos: [24]; default: 0; /** TWAIFD_PEX : R/W; bitpos: [24]; default: 0;
* Protocol exception handling. When this bit is set, CTU CAN FD will start * Protocol exception handling. When this bit is set, CAN FD will start
* integration upon detection of protocol * integration upon detection of protocol
* exception. This should be modified only when SETTINGS[ENA] = 0. * exception. This should be modified only when SETTINGS[ENA] = 0.
* 0b0 - PROTOCOL_EXCEPTION_DISABLED - Protocol exception handling is disabled. * 0b0 - PROTOCOL_EXCEPTION_DISABLED - Protocol exception handling is disabled.
@@ -229,11 +229,11 @@ extern "C" {
#define TWAIFD_PEX_V 0x00000001U #define TWAIFD_PEX_V 0x00000001U
#define TWAIFD_PEX_S 24 #define TWAIFD_PEX_S 24
/** TWAIFD_TBFBO : R/W; bitpos: [25]; default: 1; /** TWAIFD_TBFBO : R/W; bitpos: [25]; default: 1;
* All TXT buffers shall go to "TX failed" state when CTU CAN FD becomes bus-off. * All TXT buffers shall go to "TX failed" state when CAN FD becomes bus-off.
* 0b0 - TXTBUF_FAILED_BUS_OFF_DISABLED - TXT Buffers dont go to "TX failed" state * 0b0 - TXTBUF_FAILED_BUS_OFF_DISABLED - TXT Buffers dont go to "TX failed" state
* when CTU CAN * when CAN
* FD becomes bus-off. * FD becomes bus-off.
* 0b1 - TXTBUF_FAILED_BUS_OFF_ENABLED - TXT Buffers go to "TX failed" state when CTU * 0b1 - TXTBUF_FAILED_BUS_OFF_ENABLED - TXT Buffers go to "TX failed" state when
* CAN FD * CAN FD
* becomes bus-off. * becomes bus-off.
*/ */
@@ -301,7 +301,7 @@ extern "C" {
#define TWAIFD_EFT_V 0x00000001U #define TWAIFD_EFT_V 0x00000001U
#define TWAIFD_EFT_S 3 #define TWAIFD_EFT_S 3
/** TWAIFD_RXS : RO; bitpos: [4]; default: 0; /** TWAIFD_RXS : RO; bitpos: [4]; default: 0;
* CTU CAN FD is receiver of CAN Frame. * CAN FD is receiver of CAN Frame.
* 0: not receiving * 0: not receiving
* 1: receiving * 1: receiving
*/ */
@@ -310,7 +310,7 @@ extern "C" {
#define TWAIFD_RXS_V 0x00000001U #define TWAIFD_RXS_V 0x00000001U
#define TWAIFD_RXS_S 4 #define TWAIFD_RXS_S 4
/** TWAIFD_TXS : RO; bitpos: [5]; default: 0; /** TWAIFD_TXS : RO; bitpos: [5]; default: 0;
* CTU CAN FD is transmitter of CAN Frame. * CAN FD is transmitter of CAN Frame.
* 0: not transmitting * 0: not transmitting
* 1: transmitting * 1: transmitting
*/ */
@@ -329,7 +329,7 @@ extern "C" {
#define TWAIFD_EWL_V 0x00000001U #define TWAIFD_EWL_V 0x00000001U
#define TWAIFD_EWL_S 6 #define TWAIFD_EWL_S 6
/** TWAIFD_IDLE : RO; bitpos: [7]; default: 1; /** TWAIFD_IDLE : RO; bitpos: [7]; default: 1;
* Bus is idle (no frame is being transmitted/received) or CTU CAN FD is bus-off. * Bus is idle (no frame is being transmitted/received) or CAN FD is bus-off.
* 0: active * 0: active
* 1: not active * 1: not active
*/ */
@@ -1556,11 +1556,11 @@ extern "C" {
/** TWAIFD_TXTB0_STATE : RO; bitpos: [3:0]; default: 8; /** TWAIFD_TXTB0_STATE : RO; bitpos: [3:0]; default: 8;
* Status of TXT buffer 1. * Status of TXT buffer 1.
* 0b0000 - TXT_NOT_EXIST - TXT buffer does not exist in the core (applies only to TXT * 0b0000 - TXT_NOT_EXIST - TXT buffer does not exist in the core (applies only to TXT
* buffers 3-8, when CTU * buffers 3-8, when
* CAN FD was synthesized with less than 8 TXT buffers). * CAN FD was synthesized with less than 8 TXT buffers).
* 0b0001 - TXT_RDY - TXT buffer is in "Ready" state, it is waiting for CTU CAN FD to * 0b0001 - TXT_RDY - TXT buffer is in "Ready" state, it is waiting for CAN FD to
* start transmission from it. * start transmission from it.
* 0b0010 - TXT_TRAN - TXT buffer is in "TX in progress" state. CTU CAN FD is * 0b0010 - TXT_TRAN - TXT buffer is in "TX in progress" state. CAN FD is
* transmitting frame. * transmitting frame.
* 0b0011 - TXT_ABTP - TXT buffer is in "Abort in progress" state. * 0b0011 - TXT_ABTP - TXT buffer is in "Abort in progress" state.
* 0b0100 - TXT_TOK - TXT buffer is in "TX OK" state. * 0b0100 - TXT_TOK - TXT buffer is in "TX OK" state.
@@ -1716,7 +1716,7 @@ extern "C" {
#define TWAIFD_TXB8_V 0x00000001U #define TWAIFD_TXB8_V 0x00000001U
#define TWAIFD_TXB8_S 15 #define TWAIFD_TXB8_S 15
/** TWAIFD_TXT_BUFFER_COUNT : RO; bitpos: [19:16]; default: 4; /** TWAIFD_TXT_BUFFER_COUNT : RO; bitpos: [19:16]; default: 4;
* Number of TXT buffers present in CTU CAN FD. Lowest buffer is always 1. Highest * Number of TXT buffers present in CAN FD. Lowest buffer is always 1. Highest
* buffer * buffer
* is at index equal to number of present buffers. * is at index equal to number of present buffers.
*/ */
@@ -1861,7 +1861,7 @@ extern "C" {
#define TWAIFD_ALC_ID_FIELD_V 0x00000007U #define TWAIFD_ALC_ID_FIELD_V 0x00000007U
#define TWAIFD_ALC_ID_FIELD_S 21 #define TWAIFD_ALC_ID_FIELD_S 21
/** TWAIFD_TS_BITS : RO; bitpos: [29:24]; default: 0; /** TWAIFD_TS_BITS : RO; bitpos: [29:24]; default: 0;
* Number of active bits of CTU CAN FD time-base minus 1 (0x3F = 64 bit time-base). * Number of active bits of CAN FD time-base minus 1 (0x3F = 64 bit time-base).
*/ */
#define TWAIFD_TS_BITS 0x0000003FU #define TWAIFD_TS_BITS 0x0000003FU
#define TWAIFD_TS_BITS_M (TWAIFD_TS_BITS_V << TWAIFD_TS_BITS_S) #define TWAIFD_TS_BITS_M (TWAIFD_TS_BITS_V << TWAIFD_TS_BITS_S)
@@ -1905,7 +1905,7 @@ extern "C" {
*/ */
#define TWAIFD_RX_FR_CTR_REG(i) (REG_TWAI_BASE(i) + 0x84) #define TWAIFD_RX_FR_CTR_REG(i) (REG_TWAI_BASE(i) + 0x84)
/** TWAIFD_RX_FR_CTR_VAL : RO; bitpos: [31:0]; default: 0; /** TWAIFD_RX_FR_CTR_VAL : RO; bitpos: [31:0]; default: 0;
* Number of received frames by CTU CAN FD. * Number of received frames by CAN FD.
*/ */
#define TWAIFD_RX_FR_CTR_VAL 0xFFFFFFFFU #define TWAIFD_RX_FR_CTR_VAL 0xFFFFFFFFU
#define TWAIFD_RX_FR_CTR_VAL_M (TWAIFD_RX_FR_CTR_VAL_V << TWAIFD_RX_FR_CTR_VAL_S) #define TWAIFD_RX_FR_CTR_VAL_M (TWAIFD_RX_FR_CTR_VAL_V << TWAIFD_RX_FR_CTR_VAL_S)
@@ -1917,7 +1917,7 @@ extern "C" {
*/ */
#define TWAIFD_TX_FR_CTR_REG(i) (REG_TWAI_BASE(i) + 0x88) #define TWAIFD_TX_FR_CTR_REG(i) (REG_TWAI_BASE(i) + 0x88)
/** TWAIFD_TX_CTR_VAL : RO; bitpos: [31:0]; default: 0; /** TWAIFD_TX_CTR_VAL : RO; bitpos: [31:0]; default: 0;
* Number of transmitted frames by CTU CAN FD. * Number of transmitted frames by CAN FD.
*/ */
#define TWAIFD_TX_CTR_VAL 0xFFFFFFFFU #define TWAIFD_TX_CTR_VAL 0xFFFFFFFFU
#define TWAIFD_TX_CTR_VAL_M (TWAIFD_TX_CTR_VAL_V << TWAIFD_TX_CTR_VAL_S) #define TWAIFD_TX_CTR_VAL_M (TWAIFD_TX_CTR_VAL_V << TWAIFD_TX_CTR_VAL_S)

View File

@@ -40,7 +40,7 @@ typedef union {
typedef union { typedef union {
struct { struct {
/** rst : WO; bitpos: [0]; default: 0; /** rst : WO; bitpos: [0]; default: 0;
* Soft reset. Writing logic 1 resets CTU CAN FD. After writing logic 1, logic 0 does * Soft reset. Writing logic 1 resets CAN FD. After writing logic 1, logic 0 does
* not need to be written, this bit * not need to be written, this bit
* is automatically cleared. * is automatically cleared.
* 0: invalid * 0: invalid
@@ -48,11 +48,11 @@ typedef union {
*/ */
uint32_t rst:1; uint32_t rst:1;
/** bmm : R/W; bitpos: [1]; default: 0; /** bmm : R/W; bitpos: [1]; default: 0;
* Bus monitoring mode. In this mode CTU CAN FD only receives frames and sends only * Bus monitoring mode. In this mode CAN FD only receives frames and sends only
* recessive bits on CAN * recessive bits on CAN
* bus. When a dominant bit is sent, it is re-routed internally so that bus value is * bus. When a dominant bit is sent, it is re-routed internally so that bus value is
* not changed. When this mode is * not changed. When this mode is
* enabled, CTU CAN FD will not transmit any frame from TXT Buffers, * enabled, CAN FD will not transmit any frame from TXT Buffers,
* 0b0 - BMM_DISABLED - Bus monitoring mode disabled. * 0b0 - BMM_DISABLED - Bus monitoring mode disabled.
* 0b1 - BMM_ENABLED - Bus monitoring mode enabled. * 0b1 - BMM_ENABLED - Bus monitoring mode enabled.
*/ */
@@ -75,7 +75,7 @@ typedef union {
*/ */
uint32_t afm:1; uint32_t afm:1;
/** fde : R/W; bitpos: [4]; default: 1; /** fde : R/W; bitpos: [4]; default: 1;
* Flexible data rate enable. When flexible data rate is enabled CTU CAN FD recognizes * Flexible data rate enable. When flexible data rate is enabled CAN FD recognizes
* CAN FD frames (FDF bit * CAN FD frames (FDF bit
* = 1). * = 1).
* 0b0 - FDE_DISABLE - Flexible data-rate support disabled. * 0b0 - FDE_DISABLE - Flexible data-rate support disabled.
@@ -122,7 +122,7 @@ typedef union {
uint32_t txbbm:1; uint32_t txbbm:1;
uint32_t reserved_11:5; uint32_t reserved_11:5;
/** rtrle : R/W; bitpos: [16]; default: 0; /** rtrle : R/W; bitpos: [16]; default: 0;
* Retransmitt Limit Enable. If enabled, CTU CAN FD only attempts to retransmitt each * Retransmitt Limit Enable. If enabled, CAN FD only attempts to retransmitt each
* frame up to RTR_TH * frame up to RTR_TH
* times. * times.
* 0b0 - RTRLE_DISABLED - Retransmitt limit is disabled. * 0b0 - RTRLE_DISABLED - Retransmitt limit is disabled.
@@ -136,21 +136,21 @@ typedef union {
*/ */
uint32_t rtrth:4; uint32_t rtrth:4;
/** ilbp : R/W; bitpos: [21]; default: 0; /** ilbp : R/W; bitpos: [21]; default: 0;
* Internal Loop Back mode. When enabled, CTU CAN FD receives any frame it transmits. * Internal Loop Back mode. When enabled, CAN FD receives any frame it transmits.
* 0b0 - INT_LOOP_DISABLED - Internal loop-back is disabled. * 0b0 - INT_LOOP_DISABLED - Internal loop-back is disabled.
* 0b1 - INT_LOOP_ENABLED - Internal loop-back is enabled. * 0b1 - INT_LOOP_ENABLED - Internal loop-back is enabled.
*/ */
uint32_t ilbp:1; uint32_t ilbp:1;
/** ena : R/W; bitpos: [22]; default: 0; /** ena : R/W; bitpos: [22]; default: 0;
* Main enable bit of CTU CAN FD. When enabled, CTU CAN FD communicates on CAN bus. * Main enable bit of CAN FD. When enabled, CAN FD communicates on CAN bus.
* When disabled, it * When disabled, it
* is bus-off and does not take part of CAN bus communication. * is bus-off and does not take part of CAN bus communication.
* 0b0 - CTU_CAN_DISABLED - The CAN Core is disabled. * 0b0 - CAN_DISABLED - The CAN Core is disabled.
* 0b1 - CTU_CAN_ENABLED - The CAN Core is enabled. * 0b1 - CAN_ENABLED - The CAN Core is enabled.
*/ */
uint32_t ena:1; uint32_t ena:1;
/** nisofd : R/W; bitpos: [23]; default: 0; /** nisofd : R/W; bitpos: [23]; default: 0;
* Non ISO FD. When this bit is set, CTU CAN FD is compliant to NON-ISO CAN FD * Non ISO FD. When this bit is set, CAN FD is compliant to NON-ISO CAN FD
* specification (no stuff * specification (no stuff
* count field). This bit should be modified only when SETTINGS[ENA]=0. * count field). This bit should be modified only when SETTINGS[ENA]=0.
* 0b0 - ISO_FD - The CAN Controller conforms to ISO CAN FD specification. * 0b0 - ISO_FD - The CAN Controller conforms to ISO CAN FD specification.
@@ -159,7 +159,7 @@ typedef union {
*/ */
uint32_t nisofd:1; uint32_t nisofd:1;
/** pex : R/W; bitpos: [24]; default: 0; /** pex : R/W; bitpos: [24]; default: 0;
* Protocol exception handling. When this bit is set, CTU CAN FD will start * Protocol exception handling. When this bit is set, CAN FD will start
* integration upon detection of protocol * integration upon detection of protocol
* exception. This should be modified only when SETTINGS[ENA] = 0. * exception. This should be modified only when SETTINGS[ENA] = 0.
* 0b0 - PROTOCOL_EXCEPTION_DISABLED - Protocol exception handling is disabled. * 0b0 - PROTOCOL_EXCEPTION_DISABLED - Protocol exception handling is disabled.
@@ -167,11 +167,11 @@ typedef union {
*/ */
uint32_t pex:1; uint32_t pex:1;
/** tbfbo : R/W; bitpos: [25]; default: 1; /** tbfbo : R/W; bitpos: [25]; default: 1;
* All TXT buffers shall go to "TX failed" state when CTU CAN FD becomes bus-off. * All TXT buffers shall go to "TX failed" state when CAN FD becomes bus-off.
* 0b0 - TXTBUF_FAILED_BUS_OFF_DISABLED - TXT Buffers dont go to "TX failed" state * 0b0 - TXTBUF_FAILED_BUS_OFF_DISABLED - TXT Buffers dont go to "TX failed" state
* when CTU CAN * when CAN
* FD becomes bus-off. * FD becomes bus-off.
* 0b1 - TXTBUF_FAILED_BUS_OFF_ENABLED - TXT Buffers go to "TX failed" state when CTU * 0b1 - TXTBUF_FAILED_BUS_OFF_ENABLED - TXT Buffers go to "TX failed" state when
* CAN FD * CAN FD
* becomes bus-off. * becomes bus-off.
*/ */
@@ -638,13 +638,13 @@ typedef union {
*/ */
uint32_t eft:1; uint32_t eft:1;
/** rxs : RO; bitpos: [4]; default: 0; /** rxs : RO; bitpos: [4]; default: 0;
* CTU CAN FD is receiver of CAN Frame. * CAN FD is receiver of CAN Frame.
* 0: not receiving * 0: not receiving
* 1: receiving * 1: receiving
*/ */
uint32_t rxs:1; uint32_t rxs:1;
/** txs : RO; bitpos: [5]; default: 0; /** txs : RO; bitpos: [5]; default: 0;
* CTU CAN FD is transmitter of CAN Frame. * CAN FD is transmitter of CAN Frame.
* 0: not transmitting * 0: not transmitting
* 1: transmitting * 1: transmitting
*/ */
@@ -657,7 +657,7 @@ typedef union {
*/ */
uint32_t ewl:1; uint32_t ewl:1;
/** idle : RO; bitpos: [7]; default: 1; /** idle : RO; bitpos: [7]; default: 1;
* Bus is idle (no frame is being transmitted/received) or CTU CAN FD is bus-off. * Bus is idle (no frame is being transmitted/received) or CAN FD is bus-off.
* 0: active * 0: active
* 1: not active * 1: not active
*/ */
@@ -796,11 +796,11 @@ typedef union {
/** txtb0_state : RO; bitpos: [3:0]; default: 8; /** txtb0_state : RO; bitpos: [3:0]; default: 8;
* Status of TXT buffer 1. * Status of TXT buffer 1.
* 0b0000 - TXT_NOT_EXIST - TXT buffer does not exist in the core (applies only to TXT * 0b0000 - TXT_NOT_EXIST - TXT buffer does not exist in the core (applies only to TXT
* buffers 3-8, when CTU * buffers 3-8, when
* CAN FD was synthesized with less than 8 TXT buffers). * CAN FD was synthesized with less than 8 TXT buffers).
* 0b0001 - TXT_RDY - TXT buffer is in "Ready" state, it is waiting for CTU CAN FD to * 0b0001 - TXT_RDY - TXT buffer is in "Ready" state, it is waiting for CAN FD to
* start transmission from it. * start transmission from it.
* 0b0010 - TXT_TRAN - TXT buffer is in "TX in progress" state. CTU CAN FD is * 0b0010 - TXT_TRAN - TXT buffer is in "TX in progress" state. CAN FD is
* transmitting frame. * transmitting frame.
* 0b0011 - TXT_ABTP - TXT buffer is in "Abort in progress" state. * 0b0011 - TXT_ABTP - TXT buffer is in "Abort in progress" state.
* 0b0100 - TXT_TOK - TXT buffer is in "TX OK" state. * 0b0100 - TXT_TOK - TXT buffer is in "TX OK" state.
@@ -897,7 +897,7 @@ typedef union {
*/ */
uint32_t alc_id_field:3; uint32_t alc_id_field:3;
/** ts_bits : RO; bitpos: [29:24]; default: 0; /** ts_bits : RO; bitpos: [29:24]; default: 0;
* Number of active bits of CTU CAN FD time-base minus 1 (0x3F = 64 bit time-base). * Number of active bits of CAN FD time-base minus 1 (0x3F = 64 bit time-base).
*/ */
uint32_t ts_bits:6; uint32_t ts_bits:6;
uint32_t reserved_30:2; uint32_t reserved_30:2;
@@ -1536,7 +1536,7 @@ typedef union {
*/ */
uint32_t txb8:1; uint32_t txb8:1;
/** txt_buffer_count : RO; bitpos: [19:16]; default: 4; /** txt_buffer_count : RO; bitpos: [19:16]; default: 4;
* Number of TXT buffers present in CTU CAN FD. Lowest buffer is always 1. Highest * Number of TXT buffers present in CAN FD. Lowest buffer is always 1. Highest
* buffer * buffer
* is at index equal to number of present buffers. * is at index equal to number of present buffers.
*/ */
@@ -1609,7 +1609,7 @@ typedef union {
typedef union { typedef union {
struct { struct {
/** rx_fr_ctr_val : RO; bitpos: [31:0]; default: 0; /** rx_fr_ctr_val : RO; bitpos: [31:0]; default: 0;
* Number of received frames by CTU CAN FD. * Number of received frames by CAN FD.
*/ */
uint32_t rx_fr_ctr_val:32; uint32_t rx_fr_ctr_val:32;
}; };
@@ -1622,7 +1622,7 @@ typedef union {
typedef union { typedef union {
struct { struct {
/** tx_ctr_val : RO; bitpos: [31:0]; default: 0; /** tx_ctr_val : RO; bitpos: [31:0]; default: 0;
* Number of transmitted frames by CTU CAN FD. * Number of transmitted frames by CAN FD.
*/ */
uint32_t tx_ctr_val:32; uint32_t tx_ctr_val:32;
}; };

View File

@@ -42,7 +42,7 @@ extern "C" {
*/ */
#define TWAIFD_MODE_SETTINGS_REG (DR_REG_TWAIFD_BASE + 0x4) #define TWAIFD_MODE_SETTINGS_REG (DR_REG_TWAIFD_BASE + 0x4)
/** TWAIFD_RST : WO; bitpos: [0]; default: 0; /** TWAIFD_RST : WO; bitpos: [0]; default: 0;
* Soft reset. Writing logic 1 resets CTU CAN FD. After writing logic 1, logic 0 does * Soft reset. Writing logic 1 resets CAN FD. After writing logic 1, logic 0 does
* not need to be written, this bit * not need to be written, this bit
* is automatically cleared. * is automatically cleared.
* 0: invalid * 0: invalid
@@ -53,11 +53,11 @@ extern "C" {
#define TWAIFD_RST_V 0x00000001U #define TWAIFD_RST_V 0x00000001U
#define TWAIFD_RST_S 0 #define TWAIFD_RST_S 0
/** TWAIFD_BMM : R/W; bitpos: [1]; default: 0; /** TWAIFD_BMM : R/W; bitpos: [1]; default: 0;
* Bus monitoring mode. In this mode CTU CAN FD only receives frames and sends only * Bus monitoring mode. In this mode CAN FD only receives frames and sends only
* recessive bits on CAN * recessive bits on CAN
* bus. When a dominant bit is sent, it is re-routed internally so that bus value is * bus. When a dominant bit is sent, it is re-routed internally so that bus value is
* not changed. When this mode is * not changed. When this mode is
* enabled, CTU CAN FD will not transmit any frame from TXT Buffers, * enabled, CAN FD will not transmit any frame from TXT Buffers,
* 0b0 - BMM_DISABLED - Bus monitoring mode disabled. * 0b0 - BMM_DISABLED - Bus monitoring mode disabled.
* 0b1 - BMM_ENABLED - Bus monitoring mode enabled. * 0b1 - BMM_ENABLED - Bus monitoring mode enabled.
*/ */
@@ -89,7 +89,7 @@ extern "C" {
#define TWAIFD_AFM_V 0x00000001U #define TWAIFD_AFM_V 0x00000001U
#define TWAIFD_AFM_S 3 #define TWAIFD_AFM_S 3
/** TWAIFD_FDE : R/W; bitpos: [4]; default: 1; /** TWAIFD_FDE : R/W; bitpos: [4]; default: 1;
* Flexible data rate enable. When flexible data rate is enabled CTU CAN FD recognizes * Flexible data rate enable. When flexible data rate is enabled CAN FD recognizes
* CAN FD frames (FDF bit * CAN FD frames (FDF bit
* = 1). * = 1).
* 0b0 - FDE_DISABLE - Flexible data-rate support disabled. * 0b0 - FDE_DISABLE - Flexible data-rate support disabled.
@@ -156,7 +156,7 @@ extern "C" {
#define TWAIFD_TXBBM_V 0x00000001U #define TWAIFD_TXBBM_V 0x00000001U
#define TWAIFD_TXBBM_S 10 #define TWAIFD_TXBBM_S 10
/** TWAIFD_RTRLE : R/W; bitpos: [16]; default: 0; /** TWAIFD_RTRLE : R/W; bitpos: [16]; default: 0;
* Retransmitt Limit Enable. If enabled, CTU CAN FD only attempts to retransmitt each * Retransmitt Limit Enable. If enabled, CAN FD only attempts to retransmitt each
* frame up to RTR_TH * frame up to RTR_TH
* times. * times.
* 0b0 - RTRLE_DISABLED - Retransmitt limit is disabled. * 0b0 - RTRLE_DISABLED - Retransmitt limit is disabled.
@@ -176,7 +176,7 @@ extern "C" {
#define TWAIFD_RTRTH_V 0x0000000FU #define TWAIFD_RTRTH_V 0x0000000FU
#define TWAIFD_RTRTH_S 17 #define TWAIFD_RTRTH_S 17
/** TWAIFD_ILBP : R/W; bitpos: [21]; default: 0; /** TWAIFD_ILBP : R/W; bitpos: [21]; default: 0;
* Internal Loop Back mode. When enabled, CTU CAN FD receives any frame it transmits. * Internal Loop Back mode. When enabled, CAN FD receives any frame it transmits.
* 0b0 - INT_LOOP_DISABLED - Internal loop-back is disabled. * 0b0 - INT_LOOP_DISABLED - Internal loop-back is disabled.
* 0b1 - INT_LOOP_ENABLED - Internal loop-back is enabled. * 0b1 - INT_LOOP_ENABLED - Internal loop-back is enabled.
*/ */
@@ -185,18 +185,18 @@ extern "C" {
#define TWAIFD_ILBP_V 0x00000001U #define TWAIFD_ILBP_V 0x00000001U
#define TWAIFD_ILBP_S 21 #define TWAIFD_ILBP_S 21
/** TWAIFD_ENA : R/W; bitpos: [22]; default: 0; /** TWAIFD_ENA : R/W; bitpos: [22]; default: 0;
* Main enable bit of CTU CAN FD. When enabled, CTU CAN FD communicates on CAN bus. * Main enable bit of CAN FD. When enabled, CAN FD communicates on CAN bus.
* When disabled, it * When disabled, it
* is bus-off and does not take part of CAN bus communication. * is bus-off and does not take part of CAN bus communication.
* 0b0 - CTU_CAN_DISABLED - The CAN Core is disabled. * 0b0 - CAN_DISABLED - The CAN Core is disabled.
* 0b1 - CTU_CAN_ENABLED - The CAN Core is enabled. * 0b1 - CAN_ENABLED - The CAN Core is enabled.
*/ */
#define TWAIFD_ENA (BIT(22)) #define TWAIFD_ENA (BIT(22))
#define TWAIFD_ENA_M (TWAIFD_ENA_V << TWAIFD_ENA_S) #define TWAIFD_ENA_M (TWAIFD_ENA_V << TWAIFD_ENA_S)
#define TWAIFD_ENA_V 0x00000001U #define TWAIFD_ENA_V 0x00000001U
#define TWAIFD_ENA_S 22 #define TWAIFD_ENA_S 22
/** TWAIFD_NISOFD : R/W; bitpos: [23]; default: 0; /** TWAIFD_NISOFD : R/W; bitpos: [23]; default: 0;
* Non ISO FD. When this bit is set, CTU CAN FD is compliant to NON-ISO CAN FD * Non ISO FD. When this bit is set, CAN FD is compliant to NON-ISO CAN FD
* specification (no stuff * specification (no stuff
* count field). This bit should be modified only when SETTINGS[ENA]=0. * count field). This bit should be modified only when SETTINGS[ENA]=0.
* 0b0 - ISO_FD - The CAN Controller conforms to ISO CAN FD specification. * 0b0 - ISO_FD - The CAN Controller conforms to ISO CAN FD specification.
@@ -208,7 +208,7 @@ extern "C" {
#define TWAIFD_NISOFD_V 0x00000001U #define TWAIFD_NISOFD_V 0x00000001U
#define TWAIFD_NISOFD_S 23 #define TWAIFD_NISOFD_S 23
/** TWAIFD_PEX : R/W; bitpos: [24]; default: 0; /** TWAIFD_PEX : R/W; bitpos: [24]; default: 0;
* Protocol exception handling. When this bit is set, CTU CAN FD will start * Protocol exception handling. When this bit is set, CAN FD will start
* integration upon detection of protocol * integration upon detection of protocol
* exception. This should be modified only when SETTINGS[ENA] = 0. * exception. This should be modified only when SETTINGS[ENA] = 0.
* 0b0 - PROTOCOL_EXCEPTION_DISABLED - Protocol exception handling is disabled. * 0b0 - PROTOCOL_EXCEPTION_DISABLED - Protocol exception handling is disabled.
@@ -219,11 +219,11 @@ extern "C" {
#define TWAIFD_PEX_V 0x00000001U #define TWAIFD_PEX_V 0x00000001U
#define TWAIFD_PEX_S 24 #define TWAIFD_PEX_S 24
/** TWAIFD_TBFBO : R/W; bitpos: [25]; default: 1; /** TWAIFD_TBFBO : R/W; bitpos: [25]; default: 1;
* All TXT buffers shall go to "TX failed" state when CTU CAN FD becomes bus-off. * All TXT buffers shall go to "TX failed" state when CAN FD becomes bus-off.
* 0b0 - TXTBUF_FAILED_BUS_OFF_DISABLED - TXT Buffers dont go to "TX failed" state * 0b0 - TXTBUF_FAILED_BUS_OFF_DISABLED - TXT Buffers dont go to "TX failed" state
* when CTU CAN * when CAN
* FD becomes bus-off. * FD becomes bus-off.
* 0b1 - TXTBUF_FAILED_BUS_OFF_ENABLED - TXT Buffers go to "TX failed" state when CTU * 0b1 - TXTBUF_FAILED_BUS_OFF_ENABLED - TXT Buffers go to "TX failed" state when
* CAN FD * CAN FD
* becomes bus-off. * becomes bus-off.
*/ */
@@ -291,7 +291,7 @@ extern "C" {
#define TWAIFD_EFT_V 0x00000001U #define TWAIFD_EFT_V 0x00000001U
#define TWAIFD_EFT_S 3 #define TWAIFD_EFT_S 3
/** TWAIFD_RXS : RO; bitpos: [4]; default: 0; /** TWAIFD_RXS : RO; bitpos: [4]; default: 0;
* CTU CAN FD is receiver of CAN Frame. * CAN FD is receiver of CAN Frame.
* 0: not receiving * 0: not receiving
* 1: receiving * 1: receiving
*/ */
@@ -300,7 +300,7 @@ extern "C" {
#define TWAIFD_RXS_V 0x00000001U #define TWAIFD_RXS_V 0x00000001U
#define TWAIFD_RXS_S 4 #define TWAIFD_RXS_S 4
/** TWAIFD_TXS : RO; bitpos: [5]; default: 0; /** TWAIFD_TXS : RO; bitpos: [5]; default: 0;
* CTU CAN FD is transmitter of CAN Frame. * CAN FD is transmitter of CAN Frame.
* 0: not transmitting * 0: not transmitting
* 1: transmitting * 1: transmitting
*/ */
@@ -319,7 +319,7 @@ extern "C" {
#define TWAIFD_EWL_V 0x00000001U #define TWAIFD_EWL_V 0x00000001U
#define TWAIFD_EWL_S 6 #define TWAIFD_EWL_S 6
/** TWAIFD_IDLE : RO; bitpos: [7]; default: 1; /** TWAIFD_IDLE : RO; bitpos: [7]; default: 1;
* Bus is idle (no frame is being transmitted/received) or CTU CAN FD is bus-off. * Bus is idle (no frame is being transmitted/received) or CAN FD is bus-off.
* 0: active * 0: active
* 1: not active * 1: not active
*/ */
@@ -1546,11 +1546,11 @@ extern "C" {
/** TWAIFD_TXTB0_STATE : RO; bitpos: [3:0]; default: 8; /** TWAIFD_TXTB0_STATE : RO; bitpos: [3:0]; default: 8;
* Status of TXT buffer 1. * Status of TXT buffer 1.
* 0b0000 - TXT_NOT_EXIST - TXT buffer does not exist in the core (applies only to TXT * 0b0000 - TXT_NOT_EXIST - TXT buffer does not exist in the core (applies only to TXT
* buffers 3-8, when CTU * buffers 3-8, when
* CAN FD was synthesized with less than 8 TXT buffers). * CAN FD was synthesized with less than 8 TXT buffers).
* 0b0001 - TXT_RDY - TXT buffer is in "Ready" state, it is waiting for CTU CAN FD to * 0b0001 - TXT_RDY - TXT buffer is in "Ready" state, it is waiting for CAN FD to
* start transmission from it. * start transmission from it.
* 0b0010 - TXT_TRAN - TXT buffer is in "TX in progress" state. CTU CAN FD is * 0b0010 - TXT_TRAN - TXT buffer is in "TX in progress" state. CAN FD is
* transmitting frame. * transmitting frame.
* 0b0011 - TXT_ABTP - TXT buffer is in "Abort in progress" state. * 0b0011 - TXT_ABTP - TXT buffer is in "Abort in progress" state.
* 0b0100 - TXT_TOK - TXT buffer is in "TX OK" state. * 0b0100 - TXT_TOK - TXT buffer is in "TX OK" state.
@@ -1706,7 +1706,7 @@ extern "C" {
#define TWAIFD_TXB8_V 0x00000001U #define TWAIFD_TXB8_V 0x00000001U
#define TWAIFD_TXB8_S 15 #define TWAIFD_TXB8_S 15
/** TWAIFD_TXT_BUFFER_COUNT : RO; bitpos: [19:16]; default: 4; /** TWAIFD_TXT_BUFFER_COUNT : RO; bitpos: [19:16]; default: 4;
* Number of TXT buffers present in CTU CAN FD. Lowest buffer is always 1. Highest * Number of TXT buffers present in CAN FD. Lowest buffer is always 1. Highest
* buffer * buffer
* is at index equal to number of present buffers. * is at index equal to number of present buffers.
*/ */
@@ -1851,7 +1851,7 @@ extern "C" {
#define TWAIFD_ALC_ID_FIELD_V 0x00000007U #define TWAIFD_ALC_ID_FIELD_V 0x00000007U
#define TWAIFD_ALC_ID_FIELD_S 21 #define TWAIFD_ALC_ID_FIELD_S 21
/** TWAIFD_TS_BITS : RO; bitpos: [29:24]; default: 0; /** TWAIFD_TS_BITS : RO; bitpos: [29:24]; default: 0;
* Number of active bits of CTU CAN FD time-base minus 1 (0x3F = 64 bit time-base). * Number of active bits of CAN FD time-base minus 1 (0x3F = 64 bit time-base).
*/ */
#define TWAIFD_TS_BITS 0x0000003FU #define TWAIFD_TS_BITS 0x0000003FU
#define TWAIFD_TS_BITS_M (TWAIFD_TS_BITS_V << TWAIFD_TS_BITS_S) #define TWAIFD_TS_BITS_M (TWAIFD_TS_BITS_V << TWAIFD_TS_BITS_S)
@@ -1895,7 +1895,7 @@ extern "C" {
*/ */
#define TWAIFD_RX_FR_CTR_REG (DR_REG_TWAIFD_BASE + 0x84) #define TWAIFD_RX_FR_CTR_REG (DR_REG_TWAIFD_BASE + 0x84)
/** TWAIFD_RX_FR_CTR_VAL : RO; bitpos: [31:0]; default: 0; /** TWAIFD_RX_FR_CTR_VAL : RO; bitpos: [31:0]; default: 0;
* Number of received frames by CTU CAN FD. * Number of received frames by CAN FD.
*/ */
#define TWAIFD_RX_FR_CTR_VAL 0xFFFFFFFFU #define TWAIFD_RX_FR_CTR_VAL 0xFFFFFFFFU
#define TWAIFD_RX_FR_CTR_VAL_M (TWAIFD_RX_FR_CTR_VAL_V << TWAIFD_RX_FR_CTR_VAL_S) #define TWAIFD_RX_FR_CTR_VAL_M (TWAIFD_RX_FR_CTR_VAL_V << TWAIFD_RX_FR_CTR_VAL_S)
@@ -1907,7 +1907,7 @@ extern "C" {
*/ */
#define TWAIFD_TX_FR_CTR_REG (DR_REG_TWAIFD_BASE + 0x88) #define TWAIFD_TX_FR_CTR_REG (DR_REG_TWAIFD_BASE + 0x88)
/** TWAIFD_TX_CTR_VAL : RO; bitpos: [31:0]; default: 0; /** TWAIFD_TX_CTR_VAL : RO; bitpos: [31:0]; default: 0;
* Number of transmitted frames by CTU CAN FD. * Number of transmitted frames by CAN FD.
*/ */
#define TWAIFD_TX_CTR_VAL 0xFFFFFFFFU #define TWAIFD_TX_CTR_VAL 0xFFFFFFFFU
#define TWAIFD_TX_CTR_VAL_M (TWAIFD_TX_CTR_VAL_V << TWAIFD_TX_CTR_VAL_S) #define TWAIFD_TX_CTR_VAL_M (TWAIFD_TX_CTR_VAL_V << TWAIFD_TX_CTR_VAL_S)

View File

@@ -40,7 +40,7 @@ typedef union {
typedef union { typedef union {
struct { struct {
/** rst : WO; bitpos: [0]; default: 0; /** rst : WO; bitpos: [0]; default: 0;
* Soft reset. Writing logic 1 resets CTU CAN FD. After writing logic 1, logic 0 does * Soft reset. Writing logic 1 resets CAN FD. After writing logic 1, logic 0 does
* not need to be written, this bit * not need to be written, this bit
* is automatically cleared. * is automatically cleared.
* 0: invalid * 0: invalid
@@ -48,11 +48,11 @@ typedef union {
*/ */
uint32_t rst:1; uint32_t rst:1;
/** bmm : R/W; bitpos: [1]; default: 0; /** bmm : R/W; bitpos: [1]; default: 0;
* Bus monitoring mode. In this mode CTU CAN FD only receives frames and sends only * Bus monitoring mode. In this mode CAN FD only receives frames and sends only
* recessive bits on CAN * recessive bits on CAN
* bus. When a dominant bit is sent, it is re-routed internally so that bus value is * bus. When a dominant bit is sent, it is re-routed internally so that bus value is
* not changed. When this mode is * not changed. When this mode is
* enabled, CTU CAN FD will not transmit any frame from TXT Buffers, * enabled, CAN FD will not transmit any frame from TXT Buffers,
* 0b0 - BMM_DISABLED - Bus monitoring mode disabled. * 0b0 - BMM_DISABLED - Bus monitoring mode disabled.
* 0b1 - BMM_ENABLED - Bus monitoring mode enabled. * 0b1 - BMM_ENABLED - Bus monitoring mode enabled.
*/ */
@@ -75,7 +75,7 @@ typedef union {
*/ */
uint32_t afm:1; uint32_t afm:1;
/** fde : R/W; bitpos: [4]; default: 1; /** fde : R/W; bitpos: [4]; default: 1;
* Flexible data rate enable. When flexible data rate is enabled CTU CAN FD recognizes * Flexible data rate enable. When flexible data rate is enabled CAN FD recognizes
* CAN FD frames (FDF bit * CAN FD frames (FDF bit
* = 1). * = 1).
* 0b0 - FDE_DISABLE - Flexible data-rate support disabled. * 0b0 - FDE_DISABLE - Flexible data-rate support disabled.
@@ -122,14 +122,14 @@ typedef union {
uint32_t txbbm:1; uint32_t txbbm:1;
/** sam : R/W; bitpos: [11]; default: 0; /** sam : R/W; bitpos: [11]; default: 0;
* Self-acknowledge mode. * Self-acknowledge mode.
* 0b0 - SAM_DISABLE - Do not send dominant ACK bit when CTU CAN FD sends Acknowledge * 0b0 - SAM_DISABLE - Do not send dominant ACK bit when CAN FD sends Acknowledge
* bit. * bit.
* 0b1 - SAM_ENABLE - Send dominant ACK bit when CTU CAN FD transmits CAN frame. * 0b1 - SAM_ENABLE - Send dominant ACK bit when CAN FD transmits CAN frame.
*/ */
uint32_t sam:1; uint32_t sam:1;
uint32_t reserved_12:4; uint32_t reserved_12:4;
/** rtrle : R/W; bitpos: [16]; default: 0; /** rtrle : R/W; bitpos: [16]; default: 0;
* Retransmitt Limit Enable. If enabled, CTU CAN FD only attempts to retransmitt each * Retransmitt Limit Enable. If enabled, CAN FD only attempts to retransmitt each
* frame up to RTR_TH * frame up to RTR_TH
* times. * times.
* 0b0 - RTRLE_DISABLED - Retransmitt limit is disabled. * 0b0 - RTRLE_DISABLED - Retransmitt limit is disabled.
@@ -143,21 +143,21 @@ typedef union {
*/ */
uint32_t rtrth:4; uint32_t rtrth:4;
/** ilbp : R/W; bitpos: [21]; default: 0; /** ilbp : R/W; bitpos: [21]; default: 0;
* Internal Loop Back mode. When enabled, CTU CAN FD receives any frame it transmits. * Internal Loop Back mode. When enabled, CAN FD receives any frame it transmits.
* 0b0 - INT_LOOP_DISABLED - Internal loop-back is disabled. * 0b0 - INT_LOOP_DISABLED - Internal loop-back is disabled.
* 0b1 - INT_LOOP_ENABLED - Internal loop-back is enabled. * 0b1 - INT_LOOP_ENABLED - Internal loop-back is enabled.
*/ */
uint32_t ilbp:1; uint32_t ilbp:1;
/** ena : R/W; bitpos: [22]; default: 0; /** ena : R/W; bitpos: [22]; default: 0;
* Main enable bit of CTU CAN FD. When enabled, CTU CAN FD communicates on CAN bus. * Main enable bit of CAN FD. When enabled, CAN FD communicates on CAN bus.
* When disabled, it * When disabled, it
* is bus-off and does not take part of CAN bus communication. * is bus-off and does not take part of CAN bus communication.
* 0b0 - CTU_CAN_DISABLED - The CAN Core is disabled. * 0b0 - CAN_DISABLED - The CAN Core is disabled.
* 0b1 - CTU_CAN_ENABLED - The CAN Core is enabled. * 0b1 - CAN_ENABLED - The CAN Core is enabled.
*/ */
uint32_t ena:1; uint32_t ena:1;
/** nisofd : R/W; bitpos: [23]; default: 0; /** nisofd : R/W; bitpos: [23]; default: 0;
* Non ISO FD. When this bit is set, CTU CAN FD is compliant to NON-ISO CAN FD * Non ISO FD. When this bit is set, CAN FD is compliant to NON-ISO CAN FD
* specification (no stuff * specification (no stuff
* count field). This bit should be modified only when SETTINGS[ENA]=0. * count field). This bit should be modified only when SETTINGS[ENA]=0.
* 0b0 - ISO_FD - The CAN Controller conforms to ISO CAN FD specification. * 0b0 - ISO_FD - The CAN Controller conforms to ISO CAN FD specification.
@@ -166,7 +166,7 @@ typedef union {
*/ */
uint32_t nisofd:1; uint32_t nisofd:1;
/** pex : R/W; bitpos: [24]; default: 0; /** pex : R/W; bitpos: [24]; default: 0;
* Protocol exception handling. When this bit is set, CTU CAN FD will start * Protocol exception handling. When this bit is set, CAN FD will start
* integration upon detection of protocol * integration upon detection of protocol
* exception. This should be modified only when SETTINGS[ENA] = 0. * exception. This should be modified only when SETTINGS[ENA] = 0.
* 0b0 - PROTOCOL_EXCEPTION_DISABLED - Protocol exception handling is disabled. * 0b0 - PROTOCOL_EXCEPTION_DISABLED - Protocol exception handling is disabled.
@@ -174,11 +174,11 @@ typedef union {
*/ */
uint32_t pex:1; uint32_t pex:1;
/** tbfbo : R/W; bitpos: [25]; default: 1; /** tbfbo : R/W; bitpos: [25]; default: 1;
* All TXT buffers shall go to "TX failed" state when CTU CAN FD becomes bus-off. * All TXT buffers shall go to "TX failed" state when CAN FD becomes bus-off.
* 0b0 - TXTBUF_FAILED_BUS_OFF_DISABLED - TXT Buffers dont go to "TX failed" state * 0b0 - TXTBUF_FAILED_BUS_OFF_DISABLED - TXT Buffers dont go to "TX failed" state
* when CTU CAN * when CAN
* FD becomes bus-off. * FD becomes bus-off.
* 0b1 - TXTBUF_FAILED_BUS_OFF_ENABLED - TXT Buffers go to "TX failed" state when CTU * 0b1 - TXTBUF_FAILED_BUS_OFF_ENABLED - TXT Buffers go to "TX failed" state when
* CAN FD * CAN FD
* becomes bus-off. * becomes bus-off.
*/ */
@@ -645,13 +645,13 @@ typedef union {
*/ */
uint32_t eft:1; uint32_t eft:1;
/** rxs : RO; bitpos: [4]; default: 0; /** rxs : RO; bitpos: [4]; default: 0;
* CTU CAN FD is receiver of CAN Frame. * CAN FD is receiver of CAN Frame.
* 0: not receiving * 0: not receiving
* 1: receiving * 1: receiving
*/ */
uint32_t rxs:1; uint32_t rxs:1;
/** txs : RO; bitpos: [5]; default: 0; /** txs : RO; bitpos: [5]; default: 0;
* CTU CAN FD is transmitter of CAN Frame. * CAN FD is transmitter of CAN Frame.
* 0: not transmitting * 0: not transmitting
* 1: transmitting * 1: transmitting
*/ */
@@ -664,7 +664,7 @@ typedef union {
*/ */
uint32_t ewl:1; uint32_t ewl:1;
/** idle : RO; bitpos: [7]; default: 1; /** idle : RO; bitpos: [7]; default: 1;
* Bus is idle (no frame is being transmitted/received) or CTU CAN FD is bus-off. * Bus is idle (no frame is being transmitted/received) or CAN FD is bus-off.
* 0: active * 0: active
* 1: not active * 1: not active
*/ */
@@ -803,11 +803,11 @@ typedef union {
/** txtb0_state : RO; bitpos: [3:0]; default: 8; /** txtb0_state : RO; bitpos: [3:0]; default: 8;
* Status of TXT buffer 1. * Status of TXT buffer 1.
* 0b0000 - TXT_NOT_EXIST - TXT buffer does not exist in the core (applies only to TXT * 0b0000 - TXT_NOT_EXIST - TXT buffer does not exist in the core (applies only to TXT
* buffers 3-8, when CTU * buffers 3-8, when
* CAN FD was synthesized with less than 8 TXT buffers). * CAN FD was synthesized with less than 8 TXT buffers).
* 0b0001 - TXT_RDY - TXT buffer is in "Ready" state, it is waiting for CTU CAN FD to * 0b0001 - TXT_RDY - TXT buffer is in "Ready" state, it is waiting for CAN FD to
* start transmission from it. * start transmission from it.
* 0b0010 - TXT_TRAN - TXT buffer is in "TX in progress" state. CTU CAN FD is * 0b0010 - TXT_TRAN - TXT buffer is in "TX in progress" state. CAN FD is
* transmitting frame. * transmitting frame.
* 0b0011 - TXT_ABTP - TXT buffer is in "Abort in progress" state. * 0b0011 - TXT_ABTP - TXT buffer is in "Abort in progress" state.
* 0b0100 - TXT_TOK - TXT buffer is in "TX OK" state. * 0b0100 - TXT_TOK - TXT buffer is in "TX OK" state.
@@ -904,7 +904,7 @@ typedef union {
*/ */
uint32_t alc_id_field:3; uint32_t alc_id_field:3;
/** ts_bits : RO; bitpos: [29:24]; default: 0; /** ts_bits : RO; bitpos: [29:24]; default: 0;
* Number of active bits of CTU CAN FD time-base minus 1 (0x3F = 64 bit time-base). * Number of active bits of CAN FD time-base minus 1 (0x3F = 64 bit time-base).
*/ */
uint32_t ts_bits:6; uint32_t ts_bits:6;
uint32_t reserved_30:2; uint32_t reserved_30:2;
@@ -1543,7 +1543,7 @@ typedef union {
*/ */
uint32_t txb8:1; uint32_t txb8:1;
/** txt_buffer_count : RO; bitpos: [19:16]; default: 4; /** txt_buffer_count : RO; bitpos: [19:16]; default: 4;
* Number of TXT buffers present in CTU CAN FD. Lowest buffer is always 1. Highest * Number of TXT buffers present in CAN FD. Lowest buffer is always 1. Highest
* buffer * buffer
* is at index equal to number of present buffers. * is at index equal to number of present buffers.
*/ */
@@ -1616,7 +1616,7 @@ typedef union {
typedef union { typedef union {
struct { struct {
/** rx_fr_ctr_val : RO; bitpos: [31:0]; default: 0; /** rx_fr_ctr_val : RO; bitpos: [31:0]; default: 0;
* Number of received frames by CTU CAN FD. * Number of received frames by CAN FD.
*/ */
uint32_t rx_fr_ctr_val:32; uint32_t rx_fr_ctr_val:32;
}; };
@@ -1629,7 +1629,7 @@ typedef union {
typedef union { typedef union {
struct { struct {
/** tx_ctr_val : RO; bitpos: [31:0]; default: 0; /** tx_ctr_val : RO; bitpos: [31:0]; default: 0;
* Number of transmitted frames by CTU CAN FD. * Number of transmitted frames by CAN FD.
*/ */
uint32_t tx_ctr_val:32; uint32_t tx_ctr_val:32;
}; };

View File

@@ -16,7 +16,7 @@ TWAI is a highly reliable, multi-master, real-time, serial asynchronous communic
.. only:: SOC_TWAI_SUPPORT_FD .. only:: SOC_TWAI_SUPPORT_FD
The TWAI controllers on the {IDF_TARGET_NAME} also compatible with FD format frames defined in ISO 11898-1, and can transmit and receive both classic and FD format frames. The TWAI controllers on the {IDF_TARGET_NAME} also compatible with FD format (a.k.a. CAN FD) frames defined in ISO 11898-1, and can transmit and receive both classic and FD format frames.
.. only:: not SOC_TWAI_SUPPORT_FD .. only:: not SOC_TWAI_SUPPORT_FD

View File

@@ -16,7 +16,7 @@ TWAI 是一种适用于汽车和工业应用的高可靠性的多主机实时串
.. only:: SOC_TWAI_SUPPORT_FD .. only:: SOC_TWAI_SUPPORT_FD
{IDF_TARGET_NAME} TWAI 控制器兼容 ISO11898-1 FD 格式帧,可以发送和接收经典格式和 FD 格式帧。 {IDF_TARGET_NAME} TWAI 控制器兼容 ISO11898-1 FD (a.k.a. CAN FD) 格式帧,可以发送和接收经典格式和 FD 格式帧。
.. only:: not SOC_TWAI_SUPPORT_FD .. only:: not SOC_TWAI_SUPPORT_FD

View File

@@ -13,7 +13,7 @@ ignores:
- "components/hal/test_apps/**/*" - "components/hal/test_apps/**/*"
- "components/esp_hal*/test_apps/**/*" - "components/esp_hal*/test_apps/**/*"
# the following files should be refactored to remove Kconfig macros # the following files should be refactored to remove Kconfig macros
- "components/hal/twai_hal_sja1000.c" - "components/hal/twai_hal_v1.c"
- "components/hal/esp32/include/hal/twai_ll.h" - "components/hal/esp32/include/hal/twai_ll.h"
- "components/hal/esp32/include/hal/uart_ll.h" - "components/hal/esp32/include/hal/uart_ll.h"
- "components/hal/include/hal/twai_types_deprecated.h" - "components/hal/include/hal/twai_types_deprecated.h"
@@ -49,7 +49,7 @@ ignores:
- "components/hal/test_apps/**/*" - "components/hal/test_apps/**/*"
- "components/esp_hal*/test_apps/**/*" - "components/esp_hal*/test_apps/**/*"
# the following files should be refactored to remove sdkconfig.h # the following files should be refactored to remove sdkconfig.h
- "components/hal/twai_hal_sja1000.c" - "components/hal/twai_hal_v1.c"
- "components/hal/include/hal/twai_types_deprecated.h" - "components/hal/include/hal/twai_types_deprecated.h"
rule: rule:
kind: preproc_include kind: preproc_include