mirror of
https://github.com/espressif/esp-idf.git
synced 2025-09-30 19:19:21 +00:00
openthread: support automatic RCP update upon boot in border router
This commit is contained in:
@@ -60,6 +60,18 @@ esp_err_t esp_openthread_border_router_deinit(void);
|
||||
*/
|
||||
esp_netif_t *esp_openthread_get_backbone_netif(void);
|
||||
|
||||
/**
|
||||
* @brief Registers the callback for RCP failure.
|
||||
*
|
||||
*/
|
||||
void esp_openthread_register_rcp_failure_handler(esp_openthread_rcp_failure_handler handler);
|
||||
|
||||
/**
|
||||
* @brief Deinitializes the conneciton to RCP.
|
||||
*
|
||||
*/
|
||||
void esp_openthread_rcp_deinit();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@@ -39,7 +39,6 @@ esp_err_t esp_openthread_cli_input(const char *line);
|
||||
*/
|
||||
void esp_openthread_cli_create_task(void);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@@ -1,50 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "esp_openthread.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief This function triggers an RCP firmware update.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK
|
||||
* - ESP_FAIL
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_openthread_rcp_update_start(void);
|
||||
|
||||
/**
|
||||
* @brief This function writes sequential firmware update data to the RCP.
|
||||
*
|
||||
* @param[in] data The firmware data slice
|
||||
* @param[in] size The data slice size
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK
|
||||
* - ESP_FAIL
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_openthread_rcp_update_write(uint8_t *data, size_t size);
|
||||
|
||||
/**
|
||||
* @brief This function commits the firmware update and reboots the RCP.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK
|
||||
* - ESP_FAIL
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_openthread_rcp_update_commit(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@@ -6,37 +6,42 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "hal/uart_types.h"
|
||||
#include "sys/_stdint.h"
|
||||
#include "sys/select.h"
|
||||
#include <stdint.h>
|
||||
|
||||
#include <sys/select.h>
|
||||
|
||||
#include "esp_event_base.h"
|
||||
#include "hal/uart_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define RCP_FIRMWARE_DIR_SIZE 20
|
||||
|
||||
/**
|
||||
* @brief OpenThread event declarations
|
||||
*
|
||||
*/
|
||||
typedef enum {
|
||||
OPENTHREAD_EVENT_START, /*!< OpenThread stack start */
|
||||
OPENTHREAD_EVENT_STOP, /*!< OpenThread stack stop */
|
||||
OPENTHREAD_EVENT_IF_UP, /*!< OpenThread network interface up */
|
||||
OPENTHREAD_EVENT_IF_DOWN, /*!< OpenThread network interface down */
|
||||
OPENTHREAD_EVENT_GOT_IP6, /*!< OpenThread stack added IPv6 address */
|
||||
OPENTHREAD_EVENT_LOST_IP6, /*!< OpenThread stack removed IPv6 address */
|
||||
OPENTHREAD_EVENT_MULTICAST_GROUP_JOIN, /*!< OpenThread stack joined IPv6 multicast group */
|
||||
OPENTHREAD_EVENT_MULTICAST_GROUP_LEAVE, /*!< OpenThread stack left IPv6 multicast group */
|
||||
OPENTHREAD_EVENT_TREL_ADD_IP6, /*!< OpenThread stack added TREL IPv6 address */
|
||||
OPENTHREAD_EVENT_TREL_REMOVE_IP6, /*!< OpenThread stack removed TREL IPv6 address */
|
||||
OPENTHREAD_EVENT_TREL_MULTICAST_GROUP_JOIN, /*!< OpenThread stack joined TREL IPv6 multicast group */
|
||||
* @brief OpenThread event declarations
|
||||
*
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
OPENTHREAD_EVENT_START, /*!< OpenThread stack start */
|
||||
OPENTHREAD_EVENT_STOP, /*!< OpenThread stack stop */
|
||||
OPENTHREAD_EVENT_IF_UP, /*!< OpenThread network interface up */
|
||||
OPENTHREAD_EVENT_IF_DOWN, /*!< OpenThread network interface down */
|
||||
OPENTHREAD_EVENT_GOT_IP6, /*!< OpenThread stack added IPv6 address */
|
||||
OPENTHREAD_EVENT_LOST_IP6, /*!< OpenThread stack removed IPv6 address */
|
||||
OPENTHREAD_EVENT_MULTICAST_GROUP_JOIN, /*!< OpenThread stack joined IPv6 multicast group */
|
||||
OPENTHREAD_EVENT_MULTICAST_GROUP_LEAVE, /*!< OpenThread stack left IPv6 multicast group */
|
||||
OPENTHREAD_EVENT_TREL_ADD_IP6, /*!< OpenThread stack added TREL IPv6 address */
|
||||
OPENTHREAD_EVENT_TREL_REMOVE_IP6, /*!< OpenThread stack removed TREL IPv6 address */
|
||||
OPENTHREAD_EVENT_TREL_MULTICAST_GROUP_JOIN, /*!< OpenThread stack joined TREL IPv6 multicast group */
|
||||
} esp_openthread_event_t;
|
||||
|
||||
/**
|
||||
* @brief OpenThread event base declaration
|
||||
*
|
||||
*/
|
||||
* @brief OpenThread event base declaration
|
||||
*
|
||||
*/
|
||||
ESP_EVENT_DECLARE_BASE(OPENTHREAD_EVENT);
|
||||
|
||||
/**
|
||||
@@ -44,11 +49,11 @@ ESP_EVENT_DECLARE_BASE(OPENTHREAD_EVENT);
|
||||
*
|
||||
*/
|
||||
typedef struct {
|
||||
fd_set read_fds; /*!< The read file descriptors */
|
||||
fd_set write_fds; /*!< The write file descriptors */
|
||||
fd_set error_fds; /*!< The error file descriptors */
|
||||
int max_fd; /*!< The max file descriptor */
|
||||
struct timeval timeout; /*!< The timeout */
|
||||
fd_set read_fds; /*!< The read file descriptors */
|
||||
fd_set write_fds; /*!< The write file descriptors */
|
||||
fd_set error_fds; /*!< The error file descriptors */
|
||||
int max_fd; /*!< The max file descriptor */
|
||||
struct timeval timeout; /*!< The timeout */
|
||||
} esp_openthread_mainloop_context_t;
|
||||
|
||||
/**
|
||||
@@ -56,28 +61,30 @@ typedef struct {
|
||||
*
|
||||
*/
|
||||
typedef struct {
|
||||
uart_port_t port; /*!< UART port number */
|
||||
uart_config_t uart_config; /*!< UART configuration, see uart_config_t docs */
|
||||
int rx_pin; /*!< UART RX pin */
|
||||
int tx_pin; /*!< UART TX pin */
|
||||
uart_port_t port; /*!< UART port number */
|
||||
uart_config_t uart_config; /*!< UART configuration, see uart_config_t docs */
|
||||
int rx_pin; /*!< UART RX pin */
|
||||
int tx_pin; /*!< UART TX pin */
|
||||
} esp_openthread_uart_config_t;
|
||||
|
||||
/**
|
||||
* @brief The radio mode of OpenThread.
|
||||
*
|
||||
*/
|
||||
typedef enum {
|
||||
RADIO_MODE_NATIVE = 0x0, /*!< Use the native 15.4 radio */
|
||||
RADIO_MODE_UART_RCP = 0x1, /*!< UART connection to a 15.4 capable radio co-processor (RCP) */
|
||||
RADIO_MODE_SPI_RCP = 0x2, /*!< SPI connection to a 15.4 capable radio co-processor (RCP) */
|
||||
typedef enum
|
||||
{
|
||||
RADIO_MODE_NATIVE = 0x0, /*!< Use the native 15.4 radio */
|
||||
RADIO_MODE_UART_RCP = 0x1, /*!< UART connection to a 15.4 capable radio co-processor (RCP) */
|
||||
RADIO_MODE_SPI_RCP = 0x2, /*!< SPI connection to a 15.4 capable radio co-processor (RCP) */
|
||||
} esp_openthread_radio_mode_t;
|
||||
|
||||
/**
|
||||
* @brief How OpenThread connects to the host.
|
||||
*
|
||||
*/
|
||||
typedef enum {
|
||||
HOST_CONNECTION_MODE_NONE = 0x0, /*!< Disable host connection */
|
||||
typedef enum
|
||||
{
|
||||
HOST_CONNECTION_MODE_NONE = 0x0, /*!< Disable host connection */
|
||||
HOST_CONNECTION_MODE_CLI_UART = 0x1, /*!< CLI UART connection to the host */
|
||||
HOST_CONNECTION_MODE_RCP_UART = 0x2, /*!< RCP UART connection to the host */
|
||||
} esp_openthread_host_connection_mode_t;
|
||||
@@ -87,8 +94,8 @@ typedef enum {
|
||||
*
|
||||
*/
|
||||
typedef struct {
|
||||
esp_openthread_radio_mode_t radio_mode; /*!< The radio mode */
|
||||
esp_openthread_uart_config_t radio_uart_config; /*!< The uart configuration to RCP */
|
||||
esp_openthread_radio_mode_t radio_mode; /*!< The radio mode */
|
||||
esp_openthread_uart_config_t radio_uart_config; /*!< The uart configuration to RCP */
|
||||
} esp_openthread_radio_config_t;
|
||||
|
||||
/**
|
||||
@@ -96,8 +103,8 @@ typedef struct {
|
||||
*
|
||||
*/
|
||||
typedef struct {
|
||||
esp_openthread_host_connection_mode_t host_connection_mode; /*!< The host connection mode */
|
||||
esp_openthread_uart_config_t host_uart_config; /*!< The uart configuration to host */
|
||||
esp_openthread_host_connection_mode_t host_connection_mode; /*!< The host connection mode */
|
||||
esp_openthread_uart_config_t host_uart_config; /*!< The uart configuration to host */
|
||||
} esp_openthread_host_connection_config_t;
|
||||
|
||||
/**
|
||||
@@ -115,11 +122,13 @@ typedef struct {
|
||||
*
|
||||
*/
|
||||
typedef struct {
|
||||
esp_openthread_radio_config_t radio_config; /*!< The radio configuration */
|
||||
esp_openthread_host_connection_config_t host_config; /*!< The host connection configuration */
|
||||
esp_openthread_port_config_t port_config; /*!< The port configuration */
|
||||
esp_openthread_radio_config_t radio_config; /*!< The radio configuration */
|
||||
esp_openthread_host_connection_config_t host_config; /*!< The host connection configuration */
|
||||
esp_openthread_port_config_t port_config; /*!< The port configuration */
|
||||
} esp_openthread_platform_config_t;
|
||||
|
||||
typedef void (*esp_openthread_rcp_failure_handler)(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user