refactor(driver_twai): remove errata config selection 2

This commit is contained in:
wanckl
2025-11-11 13:18:14 +08:00
parent 7fa65f4cff
commit 08de38ae62
3 changed files with 10 additions and 14 deletions
+4 -13
View File
@@ -7,12 +7,6 @@ menu "Legacy TWAI Driver Configurations"
help help
Place the TWAI ISR in to IRAM to reduce latency and increase performance Place the TWAI ISR in to IRAM to reduce latency and increase performance
config TWAI_SKIP_LEGACY_CONFLICT_CHECK
bool "Skip legacy driver conflict check"
default n
help
This configuration option used to bypass the conflict check mechanism with legacy code.
config TWAI_SUPPRESS_DEPRECATE_WARN config TWAI_SUPPRESS_DEPRECATE_WARN
bool "Suppress legacy driver deprecated warning" bool "Suppress legacy driver deprecated warning"
default n default n
@@ -21,14 +15,11 @@ menu "Legacy TWAI Driver Configurations"
(driver/twai.h). If you want to continue using the legacy driver, (driver/twai.h). If you want to continue using the legacy driver,
and don't want to see related deprecation warnings, you can enable this option. and don't want to see related deprecation warnings, you can enable this option.
config TWAI_ERRATA_FIX_TX_INTR_LOST config TWAI_SKIP_LEGACY_CONFLICT_CHECK
bool "Add SW workaround for TX interrupt lost errata" bool "Skip legacy driver conflict check"
depends on IDF_TARGET_ESP32 default n
default y
help help
On the ESP32, when a transmit interrupt occurs, and interrupt register is read on the same APB clock This configuration option used to bypass the conflict check mechanism with legacy code.
cycle, the transmit interrupt could be lost. Enabling this option will add a workaround that checks the
transmit buffer status bit to recover any lost transmit interrupt.
config TWAI_ERRATA_FIX_RX_FRAME_INVALID config TWAI_ERRATA_FIX_RX_FRAME_INVALID
bool "Add SW workaround for invalid RX frame errata" bool "Add SW workaround for invalid RX frame errata"
@@ -36,6 +36,10 @@
// condition is that both TEC and REC become 0. // condition is that both TEC and REC become 0.
#define TWAI_LL_HAS_BUSOFF_REC_ISSUE 1 #define TWAI_LL_HAS_BUSOFF_REC_ISSUE 1
// On the ESP32, when a transmit interrupt occurs, and interrupt register is read on the same APB clock
// cycle, the transmit interrupt could be lost.
#define TWAI_LL_HAS_INTR_LOST_ISSUE 1
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
+2 -1
View File
@@ -231,7 +231,8 @@ static inline uint32_t twai_hal_decode_interrupt(twai_hal_context_t *hal_ctx)
TWAI_HAL_SET_BITS(events, TWAI_HAL_EVENT_RX_BUFF_FRAME); TWAI_HAL_SET_BITS(events, TWAI_HAL_EVENT_RX_BUFF_FRAME);
} }
//Transmit interrupt set whenever TX buffer becomes free //Transmit interrupt set whenever TX buffer becomes free
#ifdef CONFIG_TWAI_ERRATA_FIX_TX_INTR_LOST #if TWAI_LL_HAS_INTR_LOST_ISSUE
// Errata workaround: Check the transmit buffer status bit to recover any lost transmit interrupt.
if ((interrupts & TWAI_LL_INTR_TI || hal_ctx->state_flags & TWAI_HAL_STATE_FLAG_TX_BUFF_OCCUPIED) && status & TWAI_LL_STATUS_TBS) { if ((interrupts & TWAI_LL_INTR_TI || hal_ctx->state_flags & TWAI_HAL_STATE_FLAG_TX_BUFF_OCCUPIED) && status & TWAI_LL_STATUS_TBS) {
#else #else
if (interrupts & TWAI_LL_INTR_TI) { if (interrupts & TWAI_LL_INTR_TI) {