feat(openthread) Add custom transport to OpenThread

- add a custom transport with Tx() and Rx() callbacks in OpenThread config
  - OpenThread calls Tx() to transmit, Rx() to receive data
  - external driver provides the transport for sending data between OT RCP and Host
- add an OpenThread call used by external driver to send a signal to OpenThread when there is incoming data
This commit is contained in:
Soh Kam Yung
2026-06-16 13:28:20 +08:00
committed by sohkamyung
parent 09d2eacbef
commit 8c87790e47
16 changed files with 818 additions and 23 deletions
@@ -11,6 +11,9 @@
#include "esp_log.h"
#include "esp_openthread_alarm.h"
#include "esp_openthread_common_macro.h"
#if CONFIG_OPENTHREAD_RCP_CUSTOM
#include "esp_openthread_transport_priv.h"
#endif
#include "esp_openthread_lock.h"
#include "esp_openthread_radio.h"
#include "esp_openthread_spi_slave.h"
@@ -112,6 +115,12 @@ static esp_err_t esp_openthread_host_interface_init(const esp_openthread_platfor
"esp_openthread_host_rcp_usb_init failed");
break;
#endif
#if CONFIG_OPENTHREAD_RCP_CUSTOM
case HOST_CONNECTION_MODE_RCP_TRANSPORT:
ESP_RETURN_ON_ERROR(esp_openthread_host_rcp_transport_init(config), OT_PLAT_LOG_TAG,
"esp_openthread_host_rcp_transport_init failed");
break;
#endif
#if CONFIG_OPENTHREAD_CONSOLE_TYPE_UART
case HOST_CONNECTION_MODE_CLI_UART:
ESP_RETURN_ON_ERROR(esp_openthread_host_cli_uart_init(config), OT_PLAT_LOG_TAG,
@@ -191,6 +200,11 @@ esp_err_t esp_openthread_platform_deinit(void)
case HOST_CONNECTION_MODE_CLI_UART:
esp_openthread_uart_deinit();
break;
#endif
#if CONFIG_OPENTHREAD_RCP_CUSTOM
case HOST_CONNECTION_MODE_RCP_TRANSPORT:
esp_openthread_host_rcp_transport_deinit();
break;
#endif
default:
break;