mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-30 18:57:19 +02:00
fix(802154): fix pending tx will be delayed issue
This commit is contained in:
@ -89,6 +89,7 @@ typedef enum {
|
|||||||
} ieee802154_ll_rx_abort_reason_t;
|
} ieee802154_ll_rx_abort_reason_t;
|
||||||
|
|
||||||
typedef uint32_t ieee802154_ll_rx_abort_events;
|
typedef uint32_t ieee802154_ll_rx_abort_events;
|
||||||
|
#define IEEE802154_RX_ABORT_ALL 0x7fffffff
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief IEEE802154 transmission failed reason.
|
* @brief IEEE802154 transmission failed reason.
|
||||||
@ -112,6 +113,7 @@ typedef enum {
|
|||||||
} ieee802154_ll_tx_abort_reason_t;
|
} ieee802154_ll_tx_abort_reason_t;
|
||||||
|
|
||||||
typedef uint32_t ieee802154_ll_tx_abort_events;
|
typedef uint32_t ieee802154_ll_tx_abort_events;
|
||||||
|
#define IEEE802154_TX_ABORT_ALL 0x7fffffff
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief IEEE802154 CCA mode.
|
* @brief IEEE802154 CCA mode.
|
||||||
|
@ -351,6 +351,8 @@ static IRAM_ATTR void next_operation(void)
|
|||||||
{
|
{
|
||||||
#if !CONFIG_IEEE802154_TEST
|
#if !CONFIG_IEEE802154_TEST
|
||||||
if (s_pending_tx.frame) {
|
if (s_pending_tx.frame) {
|
||||||
|
// Here the driver needs to recover the setting of rx aborts, see function `ieee802154_transmit`.
|
||||||
|
ieee802154_ll_enable_rx_abort_events(BIT(IEEE802154_RX_ABORT_BY_TX_ACK_TIMEOUT - 1) | BIT(IEEE802154_RX_ABORT_BY_TX_ACK_COEX_BREAK - 1));
|
||||||
ieee802154_transmit_internal(s_pending_tx.frame, s_pending_tx.cca);
|
ieee802154_transmit_internal(s_pending_tx.frame, s_pending_tx.cca);
|
||||||
s_pending_tx.frame = NULL;
|
s_pending_tx.frame = NULL;
|
||||||
} else
|
} else
|
||||||
@ -482,18 +484,18 @@ static IRAM_ATTR void isr_handle_rx_abort(void)
|
|||||||
IEEE802154_ASSERT(s_ieee802154_state == IEEE802154_STATE_RX);
|
IEEE802154_ASSERT(s_ieee802154_state == IEEE802154_STATE_RX);
|
||||||
#if CONFIG_IEEE802154_TEST
|
#if CONFIG_IEEE802154_TEST
|
||||||
esp_ieee802154_receive_failed(rx_status);
|
esp_ieee802154_receive_failed(rx_status);
|
||||||
next_operation();
|
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case IEEE802154_RX_ABORT_BY_COEX_BREAK:
|
case IEEE802154_RX_ABORT_BY_COEX_BREAK:
|
||||||
IEEE802154_ASSERT(s_ieee802154_state == IEEE802154_STATE_RX);
|
IEEE802154_ASSERT(s_ieee802154_state == IEEE802154_STATE_RX);
|
||||||
|
#if CONFIG_IEEE802154_TEST
|
||||||
esp_ieee802154_receive_failed(rx_status);
|
esp_ieee802154_receive_failed(rx_status);
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
case IEEE802154_RX_ABORT_BY_ED_ABORT:
|
case IEEE802154_RX_ABORT_BY_ED_ABORT:
|
||||||
case IEEE802154_RX_ABORT_BY_ED_COEX_REJECT:
|
case IEEE802154_RX_ABORT_BY_ED_COEX_REJECT:
|
||||||
IEEE802154_ASSERT(s_ieee802154_state == IEEE802154_STATE_ED || s_ieee802154_state == IEEE802154_STATE_CCA);
|
IEEE802154_ASSERT(s_ieee802154_state == IEEE802154_STATE_ED || s_ieee802154_state == IEEE802154_STATE_CCA);
|
||||||
esp_ieee802154_ed_failed(rx_status);
|
esp_ieee802154_ed_failed(rx_status);
|
||||||
next_operation();
|
|
||||||
break;
|
break;
|
||||||
case IEEE802154_RX_ABORT_BY_TX_ACK_TIMEOUT:
|
case IEEE802154_RX_ABORT_BY_TX_ACK_TIMEOUT:
|
||||||
case IEEE802154_RX_ABORT_BY_TX_ACK_COEX_BREAK:
|
case IEEE802154_RX_ABORT_BY_TX_ACK_COEX_BREAK:
|
||||||
@ -503,7 +505,6 @@ static IRAM_ATTR void isr_handle_rx_abort(void)
|
|||||||
#else
|
#else
|
||||||
esp_ieee802154_receive_failed(rx_status);
|
esp_ieee802154_receive_failed(rx_status);
|
||||||
#endif
|
#endif
|
||||||
next_operation();
|
|
||||||
break;
|
break;
|
||||||
case IEEE802154_RX_ABORT_BY_ENHACK_SECURITY_ERROR:
|
case IEEE802154_RX_ABORT_BY_ENHACK_SECURITY_ERROR:
|
||||||
IEEE802154_ASSERT(s_ieee802154_state == IEEE802154_STATE_TX_ENH_ACK);
|
IEEE802154_ASSERT(s_ieee802154_state == IEEE802154_STATE_TX_ENH_ACK);
|
||||||
@ -512,11 +513,11 @@ static IRAM_ATTR void isr_handle_rx_abort(void)
|
|||||||
#else
|
#else
|
||||||
esp_ieee802154_receive_failed(rx_status);
|
esp_ieee802154_receive_failed(rx_status);
|
||||||
#endif
|
#endif
|
||||||
next_operation();
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
IEEE802154_ASSERT(false);
|
IEEE802154_ASSERT(false);
|
||||||
}
|
}
|
||||||
|
next_operation();
|
||||||
}
|
}
|
||||||
|
|
||||||
static IRAM_ATTR void isr_handle_tx_abort(void)
|
static IRAM_ATTR void isr_handle_tx_abort(void)
|
||||||
@ -816,6 +817,7 @@ static inline esp_err_t ieee802154_transmit_internal(const uint8_t *frame, bool
|
|||||||
esp_err_t ieee802154_transmit(const uint8_t *frame, bool cca)
|
esp_err_t ieee802154_transmit(const uint8_t *frame, bool cca)
|
||||||
{
|
{
|
||||||
#if !CONFIG_IEEE802154_TEST
|
#if !CONFIG_IEEE802154_TEST
|
||||||
|
ieee802154_enter_critical();
|
||||||
if ((s_ieee802154_state == IEEE802154_STATE_RX && ieee802154_ll_is_current_rx_frame())
|
if ((s_ieee802154_state == IEEE802154_STATE_RX && ieee802154_ll_is_current_rx_frame())
|
||||||
|| s_ieee802154_state == IEEE802154_STATE_TX_ACK || s_ieee802154_state == IEEE802154_STATE_TX_ENH_ACK) {
|
|| s_ieee802154_state == IEEE802154_STATE_TX_ACK || s_ieee802154_state == IEEE802154_STATE_TX_ENH_ACK) {
|
||||||
// If the current radio is processing an RX frame or sending an ACK, do not shut down the ongoing process.
|
// If the current radio is processing an RX frame or sending an ACK, do not shut down the ongoing process.
|
||||||
@ -824,8 +826,13 @@ esp_err_t ieee802154_transmit(const uint8_t *frame, bool cca)
|
|||||||
s_pending_tx.frame = frame;
|
s_pending_tx.frame = frame;
|
||||||
s_pending_tx.cca = cca;
|
s_pending_tx.cca = cca;
|
||||||
IEEE802154_TX_DEFERRED_NUMS_UPDATE();
|
IEEE802154_TX_DEFERRED_NUMS_UPDATE();
|
||||||
|
// Here we enable all rx interrupts due to the driver needs to know when the current RX has finished.
|
||||||
|
// Will recover the setting of rx abort in function `next_operation`.
|
||||||
|
ieee802154_ll_enable_rx_abort_events(IEEE802154_RX_ABORT_ALL);
|
||||||
|
ieee802154_exit_critical();
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
ieee802154_exit_critical();
|
||||||
#endif
|
#endif
|
||||||
return ieee802154_transmit_internal(frame, cca);
|
return ieee802154_transmit_internal(frame, cca);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user