Skip to content

Commit 4f8bf6b

Browse files
author
Jiang Jiang Jian
committed
Merge branch 'fix/fix_coex_macro_control' into 'master'
fix(openthread): use the correct macros to control code compilation See merge request espressif/esp-idf!36362
2 parents 5766873 + b982374 commit 4f8bf6b

File tree

9 files changed

+28
-26
lines changed

9 files changed

+28
-26
lines changed

components/ieee802154/driver/esp_ieee802154_dev.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ static IRAM_ATTR void isr_handle_tx_abort(ieee802154_ll_tx_abort_reason_t tx_abo
602602
NEEDS_NEXT_OPT(true);
603603
break;
604604
case IEEE802154_TX_ABORT_BY_TX_COEX_BREAK:
605-
#if CONFIG_ESP_COEX_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE
605+
#if (CONFIG_ESP_COEX_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE)
606606
esp_coex_ieee802154_coex_break_notify();
607607
#endif
608608
IEEE802154_ASSERT(s_ieee802154_state == IEEE802154_STATE_TX || s_ieee802154_state == IEEE802154_STATE_TX_CCA);

components/openthread/private_include/esp_openthread_radio.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2021-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -12,7 +12,7 @@
1212
#include "esp_openthread_types.h"
1313
#include "openthread/instance.h"
1414

15-
#if !CONFIG_IEEE802154_TEST && (CONFIG_ESP_COEX_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE)
15+
#if (CONFIG_ESP_COEX_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE)
1616
#include "esp_coex_i154.h"
1717
#endif
1818

@@ -58,7 +58,7 @@ void esp_openthread_radio_update(esp_openthread_mainloop_context_t *mainloop);
5858
esp_err_t esp_openthread_radio_process(otInstance *instance, const esp_openthread_mainloop_context_t *mainloop);
5959

6060

61-
#if !CONFIG_IEEE802154_TEST && (CONFIG_ESP_COEX_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE)
61+
#if (CONFIG_ESP_COEX_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE)
6262

6363
/**
6464
* @brief Set the coexist config.

components/openthread/private_include/openthread-core-esp32x-ftd-config.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2021-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -461,7 +461,7 @@
461461
#define OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE 1
462462
#endif
463463

464-
#if !CONFIG_OPENTHREAD_RADIO_NATIVE
464+
#if (CONFIG_OPENTHREAD_RADIO_SPINEL_UART || CONFIG_OPENTHREAD_RADIO_SPINEL_SPI)
465465
/**
466466
* @def OPENTHREAD_SPINEL_CONFIG_COMPATIBILITY_ERROR_CALLBACK_ENABLE
467467
*
@@ -494,7 +494,7 @@
494494
#define OPENTHREAD_POSIX_CONFIG_RCP_TIME_SYNC_INTERVAL (60 * 1000 * 1000)
495495
#endif
496496

497-
#if !CONFIG_IEEE802154_TEST && (CONFIG_ESP_COEX_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE)
497+
#if CONFIG_EXTERNAL_COEX_ENABLE
498498
/**
499499
* @def OPENTHREAD_SPINEL_CONFIG_VENDOR_HOOK_ENABLE
500500
*
@@ -504,7 +504,7 @@
504504
#define OPENTHREAD_SPINEL_CONFIG_VENDOR_HOOK_ENABLE 1
505505
#endif
506506
#endif
507-
#endif // !CONFIG_OPENTHREAD_RADIO_NATIVE
507+
#endif // CONFIG_OPENTHREAD_RADIO_SPINEL_UART || CONFIG_OPENTHREAD_RADIO_SPINEL_SPI
508508

509509
#if CONFIG_OPENTHREAD_LINK_METRICS
510510
/**

components/openthread/src/ncp/esp_openthread_ncp.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -9,7 +9,7 @@
99
#include "esp_openthread_ncp.h"
1010
#include "ncp_base.hpp"
1111

12-
#if !CONFIG_IEEE802154_TEST && (CONFIG_ESP_COEX_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE)
12+
#if (CONFIG_ESP_COEX_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE)
1313
#include "esp_coex_i154.h"
1414
#endif
1515

@@ -70,7 +70,7 @@ otError NcpBase::VendorGetPropertyHandler(spinel_prop_key_t aPropKey)
7070
switch (aPropKey)
7171
{
7272
case SPINEL_PROP_VENDOR_ESP_COEX_EVENT: {
73-
#if !CONFIG_IEEE802154_TEST && (CONFIG_ESP_COEX_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE)
73+
#if (CONFIG_ESP_COEX_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE)
7474
esp_ieee802154_coex_config_t config = esp_ieee802154_get_coex_config();
7575
const uint8_t *args = reinterpret_cast<const uint8_t *>(&config);
7676
error = mEncoder.WriteDataWithLen(args, sizeof(esp_ieee802154_coex_config_t));
@@ -110,7 +110,7 @@ otError NcpBase::VendorSetPropertyHandler(spinel_prop_key_t aPropKey)
110110
break;
111111
}
112112
case SPINEL_PROP_VENDOR_ESP_COEX_EVENT: {
113-
#if !CONFIG_IEEE802154_TEST && (CONFIG_ESP_COEX_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE)
113+
#if (CONFIG_ESP_COEX_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE)
114114
const uint8_t *args = nullptr;
115115
uint16_t len = 0;
116116
mDecoder.ReadDataWithLen(args, len);

components/openthread/src/port/esp_openthread_radio.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2021-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -32,7 +32,7 @@
3232
#include "utils/link_metrics.h"
3333
#include "utils/mac_frame.h"
3434

35-
#if !CONFIG_IEEE802154_TEST && (CONFIG_ESP_COEX_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE)
35+
#if (CONFIG_ESP_COEX_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE)
3636
#include "esp_coex_i154.h"
3737
#endif
3838

@@ -815,7 +815,7 @@ uint32_t otPlatRadioGetSupportedChannelMask(otInstance *aInstance)
815815
return CONFIG_OPENTHREAD_SUPPORTED_CHANNEL_MASK;
816816
}
817817

818-
#if !CONFIG_IEEE802154_TEST && (CONFIG_ESP_COEX_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE)
818+
#if (CONFIG_ESP_COEX_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE)
819819
void esp_openthread_set_coex_config(esp_ieee802154_coex_config_t config)
820820
{
821821
esp_ieee802154_set_coex_config(config);

components/openthread/src/port/esp_openthread_radio_spinel.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -56,7 +56,7 @@ static const esp_openthread_radio_config_t *s_esp_openthread_radio_config = NULL
5656

5757
static esp_openthread_compatibility_error_callback s_compatibility_error_callback = NULL;
5858

59-
#if !CONFIG_IEEE802154_TEST && (CONFIG_ESP_COEX_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE)
59+
#if CONFIG_EXTERNAL_COEX_ENABLE
6060

6161
#define SPINEL_PROP_VENDOR_ESP_COEX_EVENT (SPINEL_PROP_VENDOR_ESP__BEGIN + 3)
6262

@@ -138,7 +138,7 @@ esp_err_t esp_openthread_radio_init(const esp_openthread_platform_config_t *conf
138138
s_spinel_driver.Init(s_spinel_interface.GetSpinelInterface(), true, iidList, ot::Spinel::kSpinelHeaderMaxNumIid);
139139
s_radio.SetCompatibilityErrorCallback(ot_spinel_compatibility_error_callback, esp_openthread_get_instance());
140140
s_radio.Init(/*skip_rcp_compatibility_check=*/false, /*reset_radio=*/true, &s_spinel_driver, s_radio_caps, /*RCP_time_sync=*/true);
141-
#if !CONFIG_IEEE802154_TEST && (CONFIG_ESP_COEX_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE)
141+
#if CONFIG_EXTERNAL_COEX_ENABLE
142142
ESP_RETURN_ON_ERROR(esp_openthread_radio_spinel_coex_config_init(), OT_PLAT_LOG_TAG, "Coex config init failed");
143143
#endif
144144
#if CONFIG_OPENTHREAD_RADIO_SPINEL_SPI // CONFIG_OPENTHREAD_RADIO_SPINEL_SPI
@@ -516,7 +516,7 @@ uint32_t otPlatRadioGetSupportedChannelMask(otInstance *aInstance)
516516
return s_radio.GetRadioChannelMask(false);
517517
}
518518

519-
#if !CONFIG_IEEE802154_TEST && (CONFIG_ESP_COEX_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE)
519+
#if CONFIG_EXTERNAL_COEX_ENABLE
520520

521521
void esp_openthread_set_coex_config(esp_ieee802154_coex_config_t config)
522522
{

components/openthread/src/port/esp_openthread_state.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -63,7 +63,7 @@ static void handle_ot_netdata_change(void)
6363

6464
static void handle_ot_role_change(otInstance* instance)
6565
{
66-
#if !CONFIG_IEEE802154_TEST && (CONFIG_ESP_COEX_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE)
66+
#if ((CONFIG_ESP_COEX_SW_COEXIST_ENABLE && OPENTHREAD_RADIO_NATIVE) || CONFIG_EXTERNAL_COEX_ENABLE)
6767
otLinkModeConfig linkmode = otThreadGetLinkMode(instance);
6868
esp_ieee802154_coex_config_t config = esp_openthread_get_coex_config();
6969
config.txrx = (linkmode.mRxOnWhenIdle) ? IEEE802154_LOW : IEEE802154_MIDDLE;
@@ -83,14 +83,13 @@ static void handle_ot_role_change(otInstance* instance)
8383
otOperationalDataset dataset;
8484
ESP_GOTO_ON_FALSE(otDatasetGetActive(instance, &dataset) == OT_ERROR_NONE, ESP_FAIL, exit, TAG,
8585
"Failed to get the active dataset");
86-
ESP_GOTO_ON_ERROR(esp_event_post(OPENTHREAD_EVENT, OPENTHREAD_EVENT_ATTACHED, &dataset, sizeof(dataset), 0),
87-
exit, TAG, "Failed to post OPENTHREAD_EVENT_ATTACHED. Err: %s", esp_err_to_name(ret));
86+
ret = esp_event_post(OPENTHREAD_EVENT, OPENTHREAD_EVENT_ATTACHED, &dataset, sizeof(dataset), 0);
87+
ESP_GOTO_ON_ERROR(ret, exit, TAG, "Failed to post OPENTHREAD_EVENT_ATTACHED. Err: %s", esp_err_to_name(ret));
8888
}
8989
} else if (role == OT_DEVICE_ROLE_DETACHED) {
9090
if (s_previous_role != OT_DEVICE_ROLE_DISABLED) {
91-
ESP_GOTO_ON_ERROR(
92-
esp_event_post(OPENTHREAD_EVENT, OPENTHREAD_EVENT_DETACHED, &s_previous_role, sizeof(s_previous_role), 0),
93-
exit, TAG, "Failed to post OPENTHREAD_EVENT_DETACHED. Err: %s", esp_err_to_name(ret));
91+
ret = esp_event_post(OPENTHREAD_EVENT, OPENTHREAD_EVENT_DETACHED, &s_previous_role, sizeof(s_previous_role), 0);
92+
ESP_GOTO_ON_ERROR(ret, exit, TAG, "Failed to post OPENTHREAD_EVENT_DETACHED. Err: %s", esp_err_to_name(ret));
9493
}
9594
}
9695
exit:
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CONFIG_OPENTHREAD_RADIO_TREL=y
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
CONFIG_OPENTHREAD_RADIO_TREL=y
2+
CONFIG_EXTERNAL_COEX_ENABLE=y

0 commit comments

Comments
 (0)