mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 11:10:54 +03:00
feat(openthread): turn off rx earlier for csl if no packet received
This commit is contained in:
@@ -66,6 +66,7 @@ static uint8_t s_rx_frame[CONFIG_IEEE802154_RX_BUFFER_SIZE + 1][IEEE802154_RX_FR
|
|||||||
static esp_ieee802154_frame_info_t s_rx_frame_info[CONFIG_IEEE802154_RX_BUFFER_SIZE + 1];
|
static esp_ieee802154_frame_info_t s_rx_frame_info[CONFIG_IEEE802154_RX_BUFFER_SIZE + 1];
|
||||||
|
|
||||||
static bool s_needs_next_operation = false;
|
static bool s_needs_next_operation = false;
|
||||||
|
static volatile bool s_pending_rx_stop = false;
|
||||||
|
|
||||||
static uint8_t s_rx_index = 0;
|
static uint8_t s_rx_index = 0;
|
||||||
static uint8_t s_enh_ack_frame[128];
|
static uint8_t s_enh_ack_frame[128];
|
||||||
@@ -457,6 +458,13 @@ static void enable_rx(void)
|
|||||||
|
|
||||||
static IRAM_ATTR void next_operation(void)
|
static IRAM_ATTR void next_operation(void)
|
||||||
{
|
{
|
||||||
|
if (s_pending_rx_stop) {
|
||||||
|
ieee802154_ll_disable_rx_abort_events(IEEE802154_RX_ABORT_ALL);
|
||||||
|
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));
|
||||||
|
esp_ieee802154_receive_at_done();
|
||||||
|
s_pending_rx_stop = false;
|
||||||
|
}
|
||||||
|
|
||||||
if (ieee802154_pib_get_rx_when_idle()) {
|
if (ieee802154_pib_get_rx_when_idle()) {
|
||||||
enable_rx();
|
enable_rx();
|
||||||
} else {
|
} else {
|
||||||
@@ -1044,8 +1052,15 @@ esp_err_t ieee802154_receive(void)
|
|||||||
IEEE802154_NOINLINE static void ieee802154_finish_receive_at(void* ctx)
|
IEEE802154_NOINLINE static void ieee802154_finish_receive_at(void* ctx)
|
||||||
{
|
{
|
||||||
(void)ctx;
|
(void)ctx;
|
||||||
stop_current_operation();
|
if (s_ieee802154_state == IEEE802154_STATE_RX && ieee802154_ll_is_current_rx_frame()) {
|
||||||
esp_ieee802154_receive_at_done();
|
// if we successfully receive SFD, then continue receiving
|
||||||
|
ieee802154_ll_enable_rx_abort_events(IEEE802154_RX_ABORT_ALL);
|
||||||
|
s_pending_rx_stop = true;
|
||||||
|
} else {
|
||||||
|
// or else we go back to sleep
|
||||||
|
stop_current_operation();
|
||||||
|
esp_ieee802154_receive_at_done();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IEEE802154_NOINLINE static void ieee802154_start_receive_at(void* ctx)
|
IEEE802154_NOINLINE static void ieee802154_start_receive_at(void* ctx)
|
||||||
|
|||||||
@@ -357,7 +357,7 @@ menu "OpenThread"
|
|||||||
|
|
||||||
config OPENTHREAD_CSL_UNCERTAIN
|
config OPENTHREAD_CSL_UNCERTAIN
|
||||||
int "The CSL Uncertainty in units of 10 us."
|
int "The CSL Uncertainty in units of 10 us."
|
||||||
default 0
|
default 50
|
||||||
help
|
help
|
||||||
The fixed uncertainty of the Device for scheduling CSL Transmissions in units of 10 microseconds.
|
The fixed uncertainty of the Device for scheduling CSL Transmissions in units of 10 microseconds.
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2021-2025 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2021-2026 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@@ -868,6 +868,16 @@
|
|||||||
#define OPENTHREAD_CONFIG_CSL_RECEIVE_TIME_AHEAD (OPENTHREAD_CONFIG_MAC_CSL_REQUEST_AHEAD_US + 320)
|
#define OPENTHREAD_CONFIG_CSL_RECEIVE_TIME_AHEAD (OPENTHREAD_CONFIG_MAC_CSL_REQUEST_AHEAD_US + 320)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @def OPENTHREAD_CONFIG_MIN_RECEIVE_ON_AFTER
|
||||||
|
*
|
||||||
|
* Additional time for CSL receiver to remain in rx active after SFD has been received, in units of microseconds.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#ifndef OPENTHREAD_CONFIG_MIN_RECEIVE_ON_AFTER
|
||||||
|
#define OPENTHREAD_CONFIG_MIN_RECEIVE_ON_AFTER 0
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @def OPENTHREAD_CONFIG_OPERATIONAL_DATASET_AUTO_INIT
|
* @def OPENTHREAD_CONFIG_OPERATIONAL_DATASET_AUTO_INIT
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2021-2025 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2021-2026 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@@ -450,6 +450,16 @@
|
|||||||
#define OPENTHREAD_CONFIG_CSL_RECEIVE_TIME_AHEAD (OPENTHREAD_CONFIG_MAC_CSL_REQUEST_AHEAD_US + 320)
|
#define OPENTHREAD_CONFIG_CSL_RECEIVE_TIME_AHEAD (OPENTHREAD_CONFIG_MAC_CSL_REQUEST_AHEAD_US + 320)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @def OPENTHREAD_CONFIG_MIN_RECEIVE_ON_AFTER
|
||||||
|
*
|
||||||
|
* Additional time for CSL receiver to remain in rx active after SFD has been received, in units of microseconds.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#ifndef OPENTHREAD_CONFIG_MIN_RECEIVE_ON_AFTER
|
||||||
|
#define OPENTHREAD_CONFIG_MIN_RECEIVE_ON_AFTER 0
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @def OPENTHREAD_CONFIG_PARENT_SEARCH_ENABLE
|
* @def OPENTHREAD_CONFIG_PARENT_SEARCH_ENABLE
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -5,5 +5,5 @@ CONFIG_LOG_MAXIMUM_LEVEL_DEBUG=y
|
|||||||
CONFIG_ESP_SLEEP_CACHE_SAFE_ASSERTION=y
|
CONFIG_ESP_SLEEP_CACHE_SAFE_ASSERTION=y
|
||||||
CONFIG_OPENTHREAD_CSL_ENABLE=y
|
CONFIG_OPENTHREAD_CSL_ENABLE=y
|
||||||
CONFIG_OPENTHREAD_CSL_ACCURACY=50
|
CONFIG_OPENTHREAD_CSL_ACCURACY=50
|
||||||
CONFIG_OPENTHREAD_CSL_UNCERTAIN=0
|
CONFIG_OPENTHREAD_CSL_UNCERTAIN=50
|
||||||
CONFIG_RTC_CLK_SRC_EXT_CRYS=y
|
CONFIG_RTC_CLK_SRC_EXT_CRYS=y
|
||||||
|
|||||||
Reference in New Issue
Block a user