From 5c74483fb69d91bfea6752fa66a6443bb874e3f5 Mon Sep 17 00:00:00 2001 From: zwx Date: Thu, 1 Feb 2024 11:34:37 +0800 Subject: [PATCH] feat(openthread): disable the rx on when idle in coex scenario --- components/openthread/Kconfig | 9 +++++++++ components/openthread/src/port/esp_openthread_radio.c | 8 +++++++- .../openthread/src/port/esp_openthread_radio_spinel.cpp | 3 +++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/components/openthread/Kconfig b/components/openthread/Kconfig index ec98241f5819..c291ede13156 100644 --- a/components/openthread/Kconfig +++ b/components/openthread/Kconfig @@ -376,6 +376,15 @@ menu "OpenThread" default n help Select this option to enable the OpenThread Radio Spinel for external protocol stack, such as Zigbee. + + config OPENTHREAD_RX_ON_WHEN_IDLE + bool "Enable OpenThread radio capibility rx on when idle" + default y if !ESP_COEX_SW_COEXIST_ENABLE + default n if ESP_COEX_SW_COEXIST_ENABLE + help + Select this option to enable OpenThread radio capibility rx on when idle. Do not support this feature when + SW coexistence is enabled. + menu "Thread Address Query Config" config OPENTHREAD_ADDRESS_QUERY_TIMEOUT int "Timeout value (in seconds) for a address notification response after sending an address query." diff --git a/components/openthread/src/port/esp_openthread_radio.c b/components/openthread/src/port/esp_openthread_radio.c index c98989e086a5..3079d75e16ef 100644 --- a/components/openthread/src/port/esp_openthread_radio.c +++ b/components/openthread/src/port/esp_openthread_radio.c @@ -343,7 +343,11 @@ int8_t otPlatRadioGetRssi(otInstance *aInstance) otRadioCaps otPlatRadioGetCaps(otInstance *aInstance) { - return (otRadioCaps)(OT_RADIO_CAPS_ENERGY_SCAN | OT_RADIO_CAPS_RX_ON_WHEN_IDLE | +// FIXME: Remove `CONFIG_OPENTHREAD_RX_ON_WHEN_IDLE` when JIRA: TZ-609 fixed. + return (otRadioCaps)(OT_RADIO_CAPS_ENERGY_SCAN | +#if CONFIG_OPENTHREAD_RX_ON_WHEN_IDLE + OT_RADIO_CAPS_RX_ON_WHEN_IDLE | +#endif OT_RADIO_CAPS_TRANSMIT_SEC | OT_RADIO_CAPS_RECEIVE_TIMING | OT_RADIO_CAPS_TRANSMIT_TIMING | OT_RADIO_CAPS_ACK_TIMEOUT | OT_RADIO_CAPS_SLEEP_TO_TX); } @@ -771,8 +775,10 @@ otError otPlatRadioSetChannelMaxTransmitPower(otInstance *aInstance, uint8_t aCh return OT_ERROR_NONE; } +#if CONFIG_OPENTHREAD_RX_ON_WHEN_IDLE void otPlatRadioSetRxOnWhenIdle(otInstance *aInstance, bool aEnable) { OT_UNUSED_VARIABLE(aInstance); esp_ieee802154_set_rx_when_idle(aEnable); } +#endif diff --git a/components/openthread/src/port/esp_openthread_radio_spinel.cpp b/components/openthread/src/port/esp_openthread_radio_spinel.cpp index 2574bd2b139a..a926138f9a5a 100644 --- a/components/openthread/src/port/esp_openthread_radio_spinel.cpp +++ b/components/openthread/src/port/esp_openthread_radio_spinel.cpp @@ -6,6 +6,7 @@ #include "esp_openthread_radio.h" +#include "sdkconfig.h" #include "esp_check.h" #include "esp_err.h" #include "esp_openthread_border_router.h" @@ -413,7 +414,9 @@ otError otPlatRadioConfigureEnhAckProbing(otInstance *aInstance, otLinkMetrics a } #endif +#if CONFIG_OPENTHREAD_RX_ON_WHEN_IDLE void otPlatRadioSetRxOnWhenIdle(otInstance *aInstance, bool aEnable) { s_radio.SetRxOnWhenIdle(aEnable); } +#endif