Skip to content

Commit b835986

Browse files
committed
Merge branch 'feat/support_vendor_hook_for_rcp_spi' into 'master'
feat(openthread): support vendor hook for rcp spi Closes IDFGH-13771 See merge request espressif/esp-idf!33773
2 parents 76b3cf5 + 1c75f46 commit b835986

17 files changed

+62
-44
lines changed

components/openthread/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,13 @@ if(CONFIG_OPENTHREAD_ENABLED)
156156
if(CONFIG_OPENTHREAD_NCP_VENDOR_HOOK)
157157
list(APPEND src_dirs
158158
"src/ncp")
159+
if(CONFIG_OPENTHREAD_RCP_UART)
160+
list(APPEND exclude_srcs
161+
"src/ncp/esp_openthread_ncp_spi.cpp")
162+
elseif(CONFIG_OPENTHREAD_RCP_SPI)
163+
list(APPEND exclude_srcs
164+
"src/ncp/esp_openthread_ncp_hdlc.cpp")
165+
endif()
159166
endif()
160167

161168
if(NOT CONFIG_OPENTHREAD_DNS64_CLIENT)

components/openthread/src/ncp/esp_openthread_ncp.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

7+
#include "sdkconfig.h"
78
#include "esp_ieee802154.h"
89
#include "esp_openthread_ncp.h"
910
#include "ncp_base.hpp"
1011

11-
#if OPENTHREAD_ENABLE_NCP_VENDOR_HOOK
12-
1312
#if CONFIG_OPENTHREAD_RCP_UART
1413
#include "utils/uart.h"
1514
#endif
@@ -107,5 +106,3 @@ otError NcpBase::VendorSetPropertyHandler(spinel_prop_key_t aPropKey)
107106

108107
} // namespace Ncp
109108
} // namespace ot
110-
111-
#endif // #if OPENTHREAD_ENABLE_NCP_VENDOR_HOOK

components/openthread/src/ncp/esp_openthread_ncp_hdlc.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
/*
2-
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

77
#include "common/new.hpp"
88
#include "ncp_hdlc.hpp"
99

10-
#if OPENTHREAD_ENABLE_NCP_VENDOR_HOOK
11-
1210
namespace ot {
1311
namespace Ncp {
1412

@@ -29,5 +27,3 @@ extern "C" void otNcpHdlcInit(otInstance *aInstance, otNcpHdlcSendCallback aSend
2927

3028
} // namespace Ncp
3129
} // namespace ot
32-
33-
#endif // #if OPENTHREAD_ENABLE_NCP_VENDOR_HOOK
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include "common/new.hpp"
8+
#include "ncp_spi.hpp"
9+
10+
namespace ot {
11+
namespace Ncp {
12+
13+
static OT_DEFINE_ALIGNED_VAR(sNcpRaw, sizeof(NcpSpi), uint64_t);
14+
15+
extern "C" void otNcpSpiInit(otInstance *aInstance)
16+
{
17+
NcpSpi *ncpSpi = nullptr;
18+
Instance *instance = static_cast<Instance *>(aInstance);
19+
20+
ncpSpi = new (&sNcpRaw) NcpSpi(instance);
21+
22+
if (ncpSpi == nullptr || ncpSpi != NcpBase::GetNcpInstance())
23+
{
24+
OT_ASSERT(false);
25+
}
26+
}
27+
28+
} // namespace Ncp
29+
} // namespace ot

examples/openthread/.build-test-rules.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ examples/openthread/ot_rcp:
3838
enable:
3939
- if: SOC_IEEE802154_SUPPORTED == 1
4040
disable_test:
41-
- if: IDF_TARGET not in ["esp32c6"]
42-
reason: only test on esp32c6
41+
- if: IDF_TARGET not in ["esp32h2", "esp32c6"]
42+
reason: only test on esp32h2 and esp32c6
4343
<<: *openthread_dependencies
4444

4545
examples/openthread/ot_sleepy_device/deep_sleep:
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CONFIG_OPENTHREAD_RADIO_SPINEL_SPI=y

examples/openthread/ot_cli/sdkconfig.ci.cli

Whitespace-only changes.

examples/openthread/ot_cli/sdkconfig.ci.cli_c6

Lines changed: 0 additions & 2 deletions
This file was deleted.

examples/openthread/ot_cli/sdkconfig.ci.cli_h2

Lines changed: 0 additions & 2 deletions
This file was deleted.
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
CONFIG_IDF_TARGET="esp32h2"
2-
CONFIG_IDF_TARGET_ESP32H2=y
31
CONFIG_OPENTHREAD_CLI=n
42
CONFIG_OPENTHREAD_CLI_ESP_EXTENSION=n

0 commit comments

Comments
 (0)