forked from espressif/esp-idf
Merge branch 'backport/openthread_feature_53' into 'release/v5.3'
Backport some openthread related features (Backport v5.3) See merge request espressif/esp-idf!30973
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
[codespell]
|
||||
skip = build,*.yuv,components/fatfs/src/*,alice.txt,*.rgb,components/wpa_supplicant/*,components/esp_wifi/*
|
||||
ignore-words-list = ser,dout,rsource,fram,inout,shs,ans,aci,unstall,unstalling,hart,wheight
|
||||
ignore-words-list = ser,dout,rsource,fram,inout,shs,ans,aci,unstall,unstalling,hart,wheight,ot
|
||||
write-changes = true
|
||||
|
@@ -12,7 +12,6 @@
|
||||
|
||||
#if CONFIG_IEEE802154_DEBUG
|
||||
ieee802154_probe_info_t g_ieee802154_probe;
|
||||
#define TAG "ieee802154_debug"
|
||||
|
||||
#if CONFIG_IEEE802154_RECORD_EVENT
|
||||
static char *ieee802154_get_event_string(ieee802154_ll_event_t events)
|
||||
@@ -176,7 +175,7 @@ static char *ieee80154_tx_abort_reason_string[] = {
|
||||
void ieee802154_assert_print(void)
|
||||
{
|
||||
#if CONFIG_IEEE802154_RECORD_EVENT
|
||||
ESP_EARLY_LOGW(TAG, "Print the record event, current event index: %d", g_ieee802154_probe.event_index);
|
||||
ESP_EARLY_LOGW(IEEE802154_TAG, "Print the record event, current event index: %d", g_ieee802154_probe.event_index);
|
||||
for (uint8_t i = 0; i < IEEE802154_ASSERT_RECORD_EVENT_SIZE; i++) {
|
||||
char event_log[200] = { 0 };
|
||||
char abort_log[100] = { 0 };
|
||||
@@ -191,49 +190,49 @@ void ieee802154_assert_print(void)
|
||||
snprintf(abort_log, 100, "tx abort reason: %4x, %20s", g_ieee802154_probe.event[i].abort_reason.tx,
|
||||
ieee80154_tx_abort_reason_string[g_ieee802154_probe.event[i].abort_reason.tx]);
|
||||
}
|
||||
ESP_EARLY_LOGW(TAG, "%s %s", event_log, abort_log);
|
||||
ESP_EARLY_LOGW(IEEE802154_TAG, "%s %s", event_log, abort_log);
|
||||
}
|
||||
ESP_EARLY_LOGW(TAG,"Print the record event done.\n");
|
||||
ESP_EARLY_LOGW(IEEE802154_TAG,"Print the record event done.");
|
||||
#endif // CONFIG_IEEE802154_RECORD_EVENT
|
||||
|
||||
#if CONFIG_IEEE802154_RECORD_STATE
|
||||
ESP_EARLY_LOGW(TAG, "Print the record state, current state index: %d", g_ieee802154_probe.state_index);
|
||||
ESP_EARLY_LOGW(IEEE802154_TAG, "Print the record state, current state index: %d", g_ieee802154_probe.state_index);
|
||||
for (uint8_t i = 0; i < IEEE802154_ASSERT_RECORD_STATE_SIZE; i++) {
|
||||
ESP_EARLY_LOGW(TAG, "index %2d: line:%5s, state:%10s, timestamp: %lld",
|
||||
ESP_EARLY_LOGW(IEEE802154_TAG, "index %2d: line:%5s, state:%10s, timestamp: %lld",
|
||||
i, g_ieee802154_probe.state[i].line_str,
|
||||
ieee802154_state_string[g_ieee802154_probe.state[i].state],
|
||||
g_ieee802154_probe.state[i].timestamp);
|
||||
}
|
||||
ESP_EARLY_LOGW(TAG,"Print the record state done.\n");
|
||||
ESP_EARLY_LOGW(IEEE802154_TAG,"Print the record state done.");
|
||||
#endif // CONFIG_IEEE802154_RECORD_STATE
|
||||
|
||||
#if CONFIG_IEEE802154_RECORD_CMD
|
||||
ESP_EARLY_LOGW(TAG, "Print the record cmd, current cmd index: %d", g_ieee802154_probe.cmd_index);
|
||||
ESP_EARLY_LOGW(IEEE802154_TAG, "Print the record cmd, current cmd index: %d", g_ieee802154_probe.cmd_index);
|
||||
for (uint8_t i = 0; i < IEEE802154_ASSERT_RECORD_CMD_SIZE; i++) {
|
||||
ESP_EARLY_LOGW(TAG, "index %2d: line:%5s, cmd:%10s, timestamp: %lld",
|
||||
ESP_EARLY_LOGW(IEEE802154_TAG, "index %2d: line:%5s, cmd:%10s, timestamp: %lld",
|
||||
i, g_ieee802154_probe.cmd[i].line_str,
|
||||
ieee802154_get_cmd_string(g_ieee802154_probe.cmd[i].cmd),
|
||||
g_ieee802154_probe.cmd[i].timestamp);
|
||||
}
|
||||
ESP_EARLY_LOGW(TAG,"Print the record cmd done.\n");
|
||||
ESP_EARLY_LOGW(IEEE802154_TAG,"Print the record cmd done.");
|
||||
#endif // CONFIG_IEEE802154_RECORD_CMD
|
||||
|
||||
#if CONFIG_IEEE802154_RECORD_ABORT
|
||||
ESP_EARLY_LOGW(TAG, "Print the record abort, current abort index: %d", g_ieee802154_probe.abort_index);
|
||||
ESP_EARLY_LOGW(IEEE802154_TAG, "Print the record abort, current abort index: %d", g_ieee802154_probe.abort_index);
|
||||
for (uint8_t i = 0; i < IEEE802154_ASSERT_RECORD_ABORT_SIZE; i++) {
|
||||
if (g_ieee802154_probe.abort[i].is_tx_abort) {
|
||||
ESP_EARLY_LOGW(TAG, "index %2d: tx abort: %4x, %15s, timestamp: %lld",
|
||||
ESP_EARLY_LOGW(IEEE802154_TAG, "index %2d: tx abort: %4x, %15s, timestamp: %lld",
|
||||
i, g_ieee802154_probe.abort[i].abort_reason.tx,
|
||||
ieee80154_tx_abort_reason_string[g_ieee802154_probe.abort[i].abort_reason.tx],
|
||||
g_ieee802154_probe.abort[i].timestamp);
|
||||
} else {
|
||||
ESP_EARLY_LOGW(TAG, "index %2d: rx abort: %4x, %15s, timestamp: %lld",
|
||||
ESP_EARLY_LOGW(IEEE802154_TAG, "index %2d: rx abort: %4x, %15s, timestamp: %lld",
|
||||
i, g_ieee802154_probe.abort[i].abort_reason.rx,
|
||||
ieee80154_rx_abort_reason_string[g_ieee802154_probe.abort[i].abort_reason.rx],
|
||||
g_ieee802154_probe.abort[i].timestamp);
|
||||
}
|
||||
}
|
||||
ESP_EARLY_LOGW(TAG,"Print the record abort done.\n");
|
||||
ESP_EARLY_LOGW(IEEE802154_TAG,"Print the record abort done.");
|
||||
#endif // CONFIG_IEEE802154_RECORD_ABORT
|
||||
}
|
||||
#endif // CONFIG_IEEE802154_ASSERT
|
||||
@@ -330,43 +329,43 @@ void ieee802154_txrx_statistic_print(void)
|
||||
uint64_t rx_success_nums = s_ieee802154_txrx_statistic.rx.done_nums - s_ieee802154_txrx_statistic.rx.abort.tx_ack_coex_break_nums;
|
||||
|
||||
|
||||
ESP_LOGW(TAG, "+--------------------+-----------------------------------+--------------------------------------------------+");
|
||||
ESP_LOGW(TAG, "|%-20s|%-10s%-15llu%9.2f%%|%-25s%-15llu%9.2f%%|", "", "Done:", s_ieee802154_txrx_statistic.tx.done_nums, tx_done_ratio*100, "Success:", tx_success_nums, tx_success_ratio*100);
|
||||
ESP_LOGW(TAG, "+ + +--------------------------------------------------+");
|
||||
ESP_LOGW(TAG, "|%-20s|%-35s|%-25s%-15llu%9.2f%%|", "", "", "tx_direct_num:", tx_direct_num, tx_direct_num_ratio*100);
|
||||
ESP_LOGW(TAG, "+ + +--------------------------------------------------+");
|
||||
ESP_LOGW(TAG, "|%-20s|%-35s|%-25s%-15llu%9.2f%%|", "", "", "tx_deferred_num:", s_ieee802154_txrx_statistic.tx.deferred_nums, tx_deferred_num_ratio*100);
|
||||
ESP_LOGW(TAG, "+ +-----------------------------------+--------------------------------------------------+");
|
||||
ESP_LOGW(TAG, "|%-20s|%-35s|%-25s%-15llu%9.2f%%|", "", "", "rx_ack_coex_break:", s_ieee802154_txrx_statistic.tx.abort.rx_ack_coex_break_nums, tx_abort_rx_ack_coex_break_ratio*100);
|
||||
ESP_LOGW(TAG, "+ + +--------------------------------------------------+");
|
||||
ESP_LOGW(TAG, "|%-20s|%-35s|%-25s%-15llu%9.2f%%|", "", "", "rx_ack_timeout:", s_ieee802154_txrx_statistic.tx.abort.rx_ack_timeout_nums, tx_abort_rx_ack_timeout_ratio*100);
|
||||
ESP_LOGW(TAG, "+ + +--------------------------------------------------+");
|
||||
ESP_LOGW(TAG, "|%-5s%-15llu|%-10s%-15llu%9.2f%%|%-25s%-15llu%9.2f%%|", "TX:", s_ieee802154_txrx_statistic.tx.nums, "Abort", tx_abort_nums, tx_abort_ratio*100, "tx_coex_break:", s_ieee802154_txrx_statistic.tx.abort.tx_coex_break_nums, tx_abort_tx_coex_break_ratio*100);
|
||||
ESP_LOGW(TAG, "+ + +--------------------------------------------------+");
|
||||
ESP_LOGW(TAG, "|%-20s|%-35s|%-25s%-15llu%9.2f%%|", "", "", "tx_security_error:", s_ieee802154_txrx_statistic.tx.abort.tx_security_error_nums, tx_abort_tx_security_error_ratio*100);
|
||||
ESP_LOGW(TAG, "+ + +--------------------------------------------------+");
|
||||
ESP_LOGW(TAG, "|%-20s|%-35s|%-25s%-15llu%9.2f%%|", "", "", "cca_failed:", s_ieee802154_txrx_statistic.tx.abort.cca_failed_nums, tx_abort_cca_failed_ratio*100);
|
||||
ESP_LOGW(TAG, "+ + +--------------------------------------------------+");
|
||||
ESP_LOGW(TAG, "|%-20s|%-35s|%-25s%-15llu%9.2f%%|", "", "", "cca_busy:", s_ieee802154_txrx_statistic.tx.abort.cca_busy_nums, tx_abort_cca_busy_ratio*100);
|
||||
ESP_LOGW(TAG, "+--------------------+-----------------------------------+--------------------------------------------------+");
|
||||
ESP_LOGW(TAG, "|%-20s|%-10s%-25llu|%-25s%-25llu|", "", "Done:", s_ieee802154_txrx_statistic.rx.done_nums, "Success:", rx_success_nums);
|
||||
ESP_LOGW(TAG, "+ +-----------------------------------+--------------------------------------------------+");
|
||||
ESP_LOGW(TAG, "|%-20s|%-35s|%-25s%-25llu|", "", "", "tx_ack_coex_break:", s_ieee802154_txrx_statistic.rx.abort.tx_ack_coex_break_nums);
|
||||
ESP_LOGW(TAG, "+ + +--------------------------------------------------+");
|
||||
ESP_LOGW(TAG, "|%-20s|%-35s|%-25s%-25llu|", "", "", "sfd_timeout:", s_ieee802154_txrx_statistic.rx.abort.sfd_timeout_nums);
|
||||
ESP_LOGW(TAG, "+ + +--------------------------------------------------+");
|
||||
ESP_LOGW(TAG, "|%-20s|%-35s|%-25s%-25llu|", "", "", "crc_error:", s_ieee802154_txrx_statistic.rx.abort.crc_error_nums);
|
||||
ESP_LOGW(TAG, "+ + +--------------------------------------------------+");
|
||||
ESP_LOGW(TAG, "|%-20s|%-10s%-25llu|%-25s%-25llu|", "RX", "Abort", rx_abort_nums, "filter_fail:", s_ieee802154_txrx_statistic.rx.abort.filter_fail_nums);
|
||||
ESP_LOGW(TAG, "+ + +--------------------------------------------------+");
|
||||
ESP_LOGW(TAG, "|%-20s|%-35s|%-25s%-25llu|", "", "", "no_rss:", s_ieee802154_txrx_statistic.rx.abort.no_rss_nums);
|
||||
ESP_LOGW(TAG, "+ + +--------------------------------------------------+");
|
||||
ESP_LOGW(TAG, "|%-20s|%-35s|%-25s%-25llu|", "", "", "rx_coex_break:", s_ieee802154_txrx_statistic.rx.abort.rx_coex_break_nums);
|
||||
ESP_LOGW(TAG, "+ + +--------------------------------------------------+");
|
||||
ESP_LOGW(TAG, "|%-20s|%-35s|%-25s%-25llu|", "", "", "rx_restart:", s_ieee802154_txrx_statistic.rx.abort.rx_restart_nums);
|
||||
ESP_LOGW(TAG, "+ + +--------------------------------------------------+");
|
||||
ESP_LOGW(TAG, "|%-20s|%-35s|%-25s%-25llu|", "", "", "ed_abort:", s_ieee802154_txrx_statistic.rx.abort.ed_abort_nums);
|
||||
ESP_LOGW(TAG, "+--------------------+-----------------------------------+--------------------------------------------------+");
|
||||
ESP_LOGW(IEEE802154_TAG, "+--------------------+-----------------------------------+--------------------------------------------------+");
|
||||
ESP_LOGW(IEEE802154_TAG, "|%-20s|%-10s%-15llu%9.2f%%|%-25s%-15llu%9.2f%%|", "", "Done:", s_ieee802154_txrx_statistic.tx.done_nums, tx_done_ratio*100, "Success:", tx_success_nums, tx_success_ratio*100);
|
||||
ESP_LOGW(IEEE802154_TAG, "+ + +--------------------------------------------------+");
|
||||
ESP_LOGW(IEEE802154_TAG, "|%-20s|%-35s|%-25s%-15llu%9.2f%%|", "", "", "tx_direct_num:", tx_direct_num, tx_direct_num_ratio*100);
|
||||
ESP_LOGW(IEEE802154_TAG, "+ + +--------------------------------------------------+");
|
||||
ESP_LOGW(IEEE802154_TAG, "|%-20s|%-35s|%-25s%-15llu%9.2f%%|", "", "", "tx_deferred_num:", s_ieee802154_txrx_statistic.tx.deferred_nums, tx_deferred_num_ratio*100);
|
||||
ESP_LOGW(IEEE802154_TAG, "+ +-----------------------------------+--------------------------------------------------+");
|
||||
ESP_LOGW(IEEE802154_TAG, "|%-20s|%-35s|%-25s%-15llu%9.2f%%|", "", "", "rx_ack_coex_break:", s_ieee802154_txrx_statistic.tx.abort.rx_ack_coex_break_nums, tx_abort_rx_ack_coex_break_ratio*100);
|
||||
ESP_LOGW(IEEE802154_TAG, "+ + +--------------------------------------------------+");
|
||||
ESP_LOGW(IEEE802154_TAG, "|%-20s|%-35s|%-25s%-15llu%9.2f%%|", "", "", "rx_ack_timeout:", s_ieee802154_txrx_statistic.tx.abort.rx_ack_timeout_nums, tx_abort_rx_ack_timeout_ratio*100);
|
||||
ESP_LOGW(IEEE802154_TAG, "+ + +--------------------------------------------------+");
|
||||
ESP_LOGW(IEEE802154_TAG, "|%-5s%-15llu|%-10s%-15llu%9.2f%%|%-25s%-15llu%9.2f%%|", "TX:", s_ieee802154_txrx_statistic.tx.nums, "Abort", tx_abort_nums, tx_abort_ratio*100, "tx_coex_break:", s_ieee802154_txrx_statistic.tx.abort.tx_coex_break_nums, tx_abort_tx_coex_break_ratio*100);
|
||||
ESP_LOGW(IEEE802154_TAG, "+ + +--------------------------------------------------+");
|
||||
ESP_LOGW(IEEE802154_TAG, "|%-20s|%-35s|%-25s%-15llu%9.2f%%|", "", "", "tx_security_error:", s_ieee802154_txrx_statistic.tx.abort.tx_security_error_nums, tx_abort_tx_security_error_ratio*100);
|
||||
ESP_LOGW(IEEE802154_TAG, "+ + +--------------------------------------------------+");
|
||||
ESP_LOGW(IEEE802154_TAG, "|%-20s|%-35s|%-25s%-15llu%9.2f%%|", "", "", "cca_failed:", s_ieee802154_txrx_statistic.tx.abort.cca_failed_nums, tx_abort_cca_failed_ratio*100);
|
||||
ESP_LOGW(IEEE802154_TAG, "+ + +--------------------------------------------------+");
|
||||
ESP_LOGW(IEEE802154_TAG, "|%-20s|%-35s|%-25s%-15llu%9.2f%%|", "", "", "cca_busy:", s_ieee802154_txrx_statistic.tx.abort.cca_busy_nums, tx_abort_cca_busy_ratio*100);
|
||||
ESP_LOGW(IEEE802154_TAG, "+--------------------+-----------------------------------+--------------------------------------------------+");
|
||||
ESP_LOGW(IEEE802154_TAG, "|%-20s|%-10s%-25llu|%-25s%-25llu|", "", "Done:", s_ieee802154_txrx_statistic.rx.done_nums, "Success:", rx_success_nums);
|
||||
ESP_LOGW(IEEE802154_TAG, "+ +-----------------------------------+--------------------------------------------------+");
|
||||
ESP_LOGW(IEEE802154_TAG, "|%-20s|%-35s|%-25s%-25llu|", "", "", "tx_ack_coex_break:", s_ieee802154_txrx_statistic.rx.abort.tx_ack_coex_break_nums);
|
||||
ESP_LOGW(IEEE802154_TAG, "+ + +--------------------------------------------------+");
|
||||
ESP_LOGW(IEEE802154_TAG, "|%-20s|%-35s|%-25s%-25llu|", "", "", "sfd_timeout:", s_ieee802154_txrx_statistic.rx.abort.sfd_timeout_nums);
|
||||
ESP_LOGW(IEEE802154_TAG, "+ + +--------------------------------------------------+");
|
||||
ESP_LOGW(IEEE802154_TAG, "|%-20s|%-35s|%-25s%-25llu|", "", "", "crc_error:", s_ieee802154_txrx_statistic.rx.abort.crc_error_nums);
|
||||
ESP_LOGW(IEEE802154_TAG, "+ + +--------------------------------------------------+");
|
||||
ESP_LOGW(IEEE802154_TAG, "|%-20s|%-10s%-25llu|%-25s%-25llu|", "RX", "Abort", rx_abort_nums, "filter_fail:", s_ieee802154_txrx_statistic.rx.abort.filter_fail_nums);
|
||||
ESP_LOGW(IEEE802154_TAG, "+ + +--------------------------------------------------+");
|
||||
ESP_LOGW(IEEE802154_TAG, "|%-20s|%-35s|%-25s%-25llu|", "", "", "no_rss:", s_ieee802154_txrx_statistic.rx.abort.no_rss_nums);
|
||||
ESP_LOGW(IEEE802154_TAG, "+ + +--------------------------------------------------+");
|
||||
ESP_LOGW(IEEE802154_TAG, "|%-20s|%-35s|%-25s%-25llu|", "", "", "rx_coex_break:", s_ieee802154_txrx_statistic.rx.abort.rx_coex_break_nums);
|
||||
ESP_LOGW(IEEE802154_TAG, "+ + +--------------------------------------------------+");
|
||||
ESP_LOGW(IEEE802154_TAG, "|%-20s|%-35s|%-25s%-25llu|", "", "", "rx_restart:", s_ieee802154_txrx_statistic.rx.abort.rx_restart_nums);
|
||||
ESP_LOGW(IEEE802154_TAG, "+ + +--------------------------------------------------+");
|
||||
ESP_LOGW(IEEE802154_TAG, "|%-20s|%-35s|%-25s%-25llu|", "", "", "ed_abort:", s_ieee802154_txrx_statistic.rx.abort.ed_abort_nums);
|
||||
ESP_LOGW(IEEE802154_TAG, "+--------------------+-----------------------------------+--------------------------------------------------+");
|
||||
}
|
||||
|
||||
#endif // CONFIG_IEEE802154_TXRX_STATISTIC
|
||||
|
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "sdkconfig.h"
|
||||
#include "freertos/portmacro.h"
|
||||
#include "soc/periph_defs.h"
|
||||
#include "soc/soc.h"
|
||||
@@ -26,7 +27,7 @@
|
||||
#include "esp_attr.h"
|
||||
#include "esp_phy_init.h"
|
||||
|
||||
#if SOC_PM_MODEM_RETENTION_BY_REGDMA && CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
#if CONFIG_PM_ENABLE
|
||||
#include "esp_pm.h"
|
||||
#include "esp_private/esp_clk.h"
|
||||
#include "esp_private/sleep_retention.h"
|
||||
@@ -36,7 +37,7 @@
|
||||
#else
|
||||
#define IEEE802154_LINK_OWNER ENTRY(0) | ENTRY(2)
|
||||
#endif // SOC_PM_RETENTION_HAS_CLOCK_BUG
|
||||
#endif // SOC_PM_MODEM_RETENTION_BY_REGDMA && CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
#endif // CONFIG_PM_ENABLE
|
||||
|
||||
static bool s_rf_closed = true;
|
||||
#define CCA_DETECTION_TIME 8
|
||||
@@ -84,10 +85,10 @@ static pending_tx_t s_pending_tx = { 0 };
|
||||
static void ieee802154_receive_done(uint8_t *data, esp_ieee802154_frame_info_t *frame_info)
|
||||
{
|
||||
// If the RX done packet is written in the stub buffer, drop it silently.
|
||||
if (s_rx_index == CONFIG_IEEE802154_RX_BUFFER_SIZE) {
|
||||
esp_rom_printf("receive buffer full, drop the current frame.\n");
|
||||
} else {
|
||||
if (s_rx_index != CONFIG_IEEE802154_RX_BUFFER_SIZE) {
|
||||
// Otherwise, post it to the upper layer.
|
||||
// Ignore bit8 for the frame length, due to the max frame length is 127 based 802.15.4 spec.
|
||||
data[0] = data[0] & 0x7f;
|
||||
frame_info->process = true;
|
||||
esp_ieee802154_receive_done(data, frame_info);
|
||||
}
|
||||
@@ -97,7 +98,6 @@ static void ieee802154_transmit_done(const uint8_t *frame, const uint8_t *ack, e
|
||||
{
|
||||
if (ack && ack_frame_info) {
|
||||
if (s_rx_index == CONFIG_IEEE802154_RX_BUFFER_SIZE) {
|
||||
esp_rom_printf("receive buffer full, drop the current ack frame.\n");
|
||||
esp_ieee802154_transmit_failed(frame, ESP_IEEE802154_TX_ERR_NO_ACK);
|
||||
} else {
|
||||
ack_frame_info->process = true;
|
||||
@@ -163,7 +163,6 @@ IEEE802154_STATIC void set_next_rx_buffer(void)
|
||||
{
|
||||
uint8_t* next_rx_buffer = NULL;
|
||||
uint8_t index = 0;
|
||||
|
||||
if (s_rx_index != CONFIG_IEEE802154_RX_BUFFER_SIZE && s_rx_frame_info[s_rx_index].process == false) {
|
||||
// If buffer is not full, and current index is empty, set it to hardware.
|
||||
next_rx_buffer = s_rx_frame[s_rx_index];
|
||||
@@ -186,8 +185,10 @@ IEEE802154_STATIC void set_next_rx_buffer(void)
|
||||
if (!next_rx_buffer) {
|
||||
s_rx_index = CONFIG_IEEE802154_RX_BUFFER_SIZE;
|
||||
next_rx_buffer = s_rx_frame[CONFIG_IEEE802154_RX_BUFFER_SIZE];
|
||||
#if CONFIG_IEEE802154_DEBUG
|
||||
ESP_EARLY_LOGW(IEEE802154_TAG, "Rx buffer full.");
|
||||
#endif
|
||||
}
|
||||
|
||||
ieee802154_ll_set_rx_addr(next_rx_buffer);
|
||||
}
|
||||
|
||||
@@ -901,11 +902,11 @@ esp_err_t ieee802154_receive_at(uint32_t time)
|
||||
uint32_t rx_target_time = time - IEEE802154_RX_RAMPUP_TIME_US;
|
||||
uint32_t current_time;
|
||||
IEEE802154_RF_ENABLE();
|
||||
ieee802154_enter_critical();
|
||||
rx_init();
|
||||
IEEE802154_SET_TXRX_PTI(IEEE802154_SCENE_RX_AT);
|
||||
set_next_rx_buffer();
|
||||
ieee802154_set_state(IEEE802154_STATE_RX);
|
||||
ieee802154_enter_critical();
|
||||
ieee802154_etm_set_event_task(IEEE802154_ETM_CHANNEL1, ETM_EVENT_TIMER0_OVERFLOW, ETM_TASK_RX_START);
|
||||
current_time = (uint32_t)esp_timer_get_time();
|
||||
ieee802154_timer0_set_threshold((is_target_time_expired(rx_target_time, current_time) ? 0 : (rx_target_time - current_time))); //uint: 1us
|
||||
@@ -914,24 +915,27 @@ esp_err_t ieee802154_receive_at(uint32_t time)
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
#if SOC_PM_MODEM_RETENTION_BY_REGDMA && CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
#if CONFIG_PM_ENABLE
|
||||
static esp_err_t ieee802154_sleep_retention_init(void *arg)
|
||||
{
|
||||
esp_err_t err = ESP_OK;
|
||||
#if SOC_PM_MODEM_RETENTION_BY_REGDMA && CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
#define N_REGS_IEEE802154() (((IEEE802154_MAC_DATE_REG - IEEE802154_REG_BASE) / 4) + 1)
|
||||
const static sleep_retention_entries_config_t ieee802154_mac_regs_retention[] = {
|
||||
[0] = { .config = REGDMA_LINK_CONTINUOUS_INIT(REGDMA_MODEM_IEEE802154_LINK(0x00), IEEE802154_REG_BASE, IEEE802154_REG_BASE, N_REGS_IEEE802154(), 0, 0), .owner = IEEE802154_LINK_OWNER },
|
||||
};
|
||||
esp_err_t err = sleep_retention_entries_create(ieee802154_mac_regs_retention, ARRAY_SIZE(ieee802154_mac_regs_retention), REGDMA_LINK_PRI_IEEE802154, SLEEP_RETENTION_MODULE_802154_MAC);
|
||||
err = sleep_retention_entries_create(ieee802154_mac_regs_retention, ARRAY_SIZE(ieee802154_mac_regs_retention), REGDMA_LINK_PRI_IEEE802154, SLEEP_RETENTION_MODULE_802154_MAC);
|
||||
ESP_RETURN_ON_ERROR(err, IEEE802154_TAG, "failed to allocate memory for ieee802154 mac retention");
|
||||
ESP_LOGD(IEEE802154_TAG, "ieee802154 mac sleep retention initialization");
|
||||
#endif
|
||||
return err;
|
||||
}
|
||||
#endif
|
||||
#endif // CONFIG_PM_ENABLE
|
||||
|
||||
static esp_err_t ieee802154_sleep_init(void)
|
||||
{
|
||||
esp_err_t err = ESP_OK;
|
||||
#if SOC_PM_MODEM_RETENTION_BY_REGDMA && CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
#if CONFIG_PM_ENABLE
|
||||
sleep_retention_module_init_param_t init_param = {
|
||||
.cbs = { .create = { .handle = ieee802154_sleep_retention_init, .arg = NULL } },
|
||||
.depends = BIT(SLEEP_RETENTION_MODULE_BT_BB) | BIT(SLEEP_RETENTION_MODULE_CLOCK_MODEM)
|
||||
@@ -945,14 +949,14 @@ static esp_err_t ieee802154_sleep_init(void)
|
||||
sleep_modem_register_mac_bb_module_prepare_callback(sleep_modem_mac_bb_power_down_prepare,
|
||||
sleep_modem_mac_bb_power_up_prepare);
|
||||
#endif // SOC_PM_RETENTION_HAS_CLOCK_BUG && CONFIG_MAC_BB_PD
|
||||
#endif // SOC_PM_MODEM_RETENTION_BY_REGDMA && CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
#endif // CONFIG_PM_ENABLE
|
||||
return err;
|
||||
}
|
||||
|
||||
static esp_err_t ieee802154_sleep_deinit(void)
|
||||
{
|
||||
esp_err_t err = ESP_OK;
|
||||
#if SOC_PM_MODEM_RETENTION_BY_REGDMA && CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
#if CONFIG_PM_ENABLE
|
||||
err = sleep_retention_module_free(SLEEP_RETENTION_MODULE_802154_MAC);
|
||||
if (err == ESP_OK) {
|
||||
err = sleep_retention_module_deinit(SLEEP_RETENTION_MODULE_802154_MAC);
|
||||
@@ -961,7 +965,7 @@ static esp_err_t ieee802154_sleep_deinit(void)
|
||||
sleep_modem_unregister_mac_bb_module_prepare_callback(sleep_modem_mac_bb_power_down_prepare,
|
||||
sleep_modem_mac_bb_power_up_prepare);
|
||||
#endif // SOC_PM_RETENTION_HAS_CLOCK_BUG && CONFIG_MAC_BB_PD
|
||||
#endif // SOC_PM_MODEM_RETENTION_BY_REGDMA && CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
#endif // CONFIG_PM_ENABLE
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -9,8 +9,7 @@
|
||||
#include "esp_attr.h"
|
||||
#include "esp_ieee802154_dev.h"
|
||||
#include "esp_ieee802154_frame.h"
|
||||
|
||||
static const char *TAG = "ieee802154 frame";
|
||||
#include "esp_ieee802154_util.h"
|
||||
|
||||
IEEE802154_STATIC IEEE802154_INLINE bool is_security_enabled(const uint8_t *frame)
|
||||
{
|
||||
@@ -59,7 +58,7 @@ IEEE802154_STATIC bool is_dst_panid_present(const uint8_t *frame)
|
||||
uint8_t src_mode = src_addr_mode(frame);
|
||||
bool panid_compression = is_panid_compression(frame);
|
||||
|
||||
if (dst_mode != IEEE802154_FRAME_DST_MODE_NONE) { // dest address is present/short/extented
|
||||
if (dst_mode != IEEE802154_FRAME_DST_MODE_NONE) { // dest address is present/short/extended
|
||||
if ((src_mode == IEEE802154_FRAME_SRC_MODE_NONE && panid_compression) ||
|
||||
(dst_mode == IEEE802154_FRAME_DST_MODE_EXT && src_mode == IEEE802154_FRAME_SRC_MODE_EXT && panid_compression)) {
|
||||
dst_panid_present = false;
|
||||
@@ -163,12 +162,12 @@ IEEE802154_STATIC IRAM_ATTR uint8_t ieee802154_frame_address_size(const uint8_t
|
||||
|
||||
IEEE802154_STATIC uint8_t ieee802154_frame_security_header_offset(const uint8_t *frame)
|
||||
{
|
||||
ESP_RETURN_ON_FALSE_ISR(is_suported_frame_type(ieee802154_frame_get_type(frame)), IEEE802154_FRAME_INVALID_ADDR_MODE, TAG, "invalid frame type");
|
||||
ESP_RETURN_ON_FALSE_ISR(is_suported_frame_type(ieee802154_frame_get_type(frame)), IEEE802154_FRAME_INVALID_ADDR_MODE, IEEE802154_TAG, "invalid frame type");
|
||||
uint8_t offset = ieee802154_frame_address_offset(frame);
|
||||
uint8_t address_size = ieee802154_frame_address_size(frame);
|
||||
|
||||
ESP_RETURN_ON_FALSE_ISR(offset != IEEE802154_FRAME_INVALID_OFFSET, IEEE802154_FRAME_INVALID_OFFSET, TAG, "invalid offset");
|
||||
ESP_RETURN_ON_FALSE_ISR(address_size != IEEE802154_FRAME_INVALID_OFFSET, IEEE802154_FRAME_INVALID_OFFSET, TAG, "invalid offset");
|
||||
ESP_RETURN_ON_FALSE_ISR(offset != IEEE802154_FRAME_INVALID_OFFSET, IEEE802154_FRAME_INVALID_OFFSET, IEEE802154_TAG, "invalid offset");
|
||||
ESP_RETURN_ON_FALSE_ISR(address_size != IEEE802154_FRAME_INVALID_OFFSET, IEEE802154_FRAME_INVALID_OFFSET, IEEE802154_TAG, "invalid offset");
|
||||
|
||||
offset += address_size;
|
||||
|
||||
@@ -177,12 +176,12 @@ IEEE802154_STATIC uint8_t ieee802154_frame_security_header_offset(const uint8_t
|
||||
|
||||
IEEE802154_STATIC uint8_t ieee802154_frame_get_security_field_len(const uint8_t *frame)
|
||||
{
|
||||
ESP_RETURN_ON_FALSE_ISR(is_suported_frame_type(ieee802154_frame_get_type(frame)), IEEE802154_FRAME_INVALID_OFFSET, TAG, "invalid frame type");
|
||||
ESP_RETURN_ON_FALSE_ISR(is_suported_frame_type(ieee802154_frame_get_type(frame)), IEEE802154_FRAME_INVALID_OFFSET, IEEE802154_TAG, "invalid frame type");
|
||||
|
||||
uint8_t security_field_len = 0;
|
||||
uint8_t offset = ieee802154_frame_security_header_offset(frame);
|
||||
|
||||
ESP_RETURN_ON_FALSE_ISR(offset != IEEE802154_FRAME_INVALID_OFFSET, IEEE802154_FRAME_INVALID_OFFSET, TAG, "invalid offset");
|
||||
ESP_RETURN_ON_FALSE_ISR(offset != IEEE802154_FRAME_INVALID_OFFSET, IEEE802154_FRAME_INVALID_OFFSET, IEEE802154_TAG, "invalid offset");
|
||||
|
||||
security_field_len += IEEE802154_FRAME_SE_HEAD_SIZE;
|
||||
uint8_t security_header = frame[offset];
|
||||
@@ -315,13 +314,13 @@ bool IEEE802154_INLINE ieee802154_frame_is_ack_required(const uint8_t *frame)
|
||||
|
||||
uint8_t ieee802154_frame_get_dst_addr(const uint8_t *frame, uint8_t *addr)
|
||||
{
|
||||
ESP_RETURN_ON_FALSE_ISR(is_suported_frame_type(ieee802154_frame_get_type(frame)), IEEE802154_FRAME_INVALID_ADDR_MODE, TAG, "invalid frame type");
|
||||
ESP_RETURN_ON_FALSE_ISR(is_suported_frame_type(ieee802154_frame_get_type(frame)), IEEE802154_FRAME_INVALID_ADDR_MODE, IEEE802154_TAG, "invalid frame type");
|
||||
|
||||
uint8_t offset = ieee802154_frame_address_offset(frame);
|
||||
uint8_t dst_mode = dst_addr_mode(frame);
|
||||
uint8_t addr_size;
|
||||
|
||||
ESP_RETURN_ON_FALSE_ISR(dst_mode == IEEE802154_FRAME_DST_MODE_SHORT || dst_mode == IEEE802154_FRAME_DST_MODE_EXT, dst_mode, TAG, "invalid address mode");
|
||||
ESP_RETURN_ON_FALSE_ISR(dst_mode == IEEE802154_FRAME_DST_MODE_SHORT || dst_mode == IEEE802154_FRAME_DST_MODE_EXT, dst_mode, IEEE802154_TAG, "invalid address mode");
|
||||
|
||||
addr_size = (dst_mode == IEEE802154_FRAME_DST_MODE_SHORT) ? IEEE802154_FRAME_SHORT_ADDR_SIZE : IEEE802154_FRAME_EXT_ADDR_SIZE;
|
||||
|
||||
@@ -336,14 +335,14 @@ uint8_t ieee802154_frame_get_dst_addr(const uint8_t *frame, uint8_t *addr)
|
||||
|
||||
uint8_t ieee802154_frame_get_src_addr(const uint8_t *frame, uint8_t *addr)
|
||||
{
|
||||
ESP_RETURN_ON_FALSE_ISR(is_suported_frame_type(ieee802154_frame_get_type(frame)), IEEE802154_FRAME_INVALID_ADDR_MODE, TAG, "invalid frame type");
|
||||
ESP_RETURN_ON_FALSE_ISR(is_suported_frame_type(ieee802154_frame_get_type(frame)), IEEE802154_FRAME_INVALID_ADDR_MODE, IEEE802154_TAG, "invalid frame type");
|
||||
|
||||
uint8_t offset = ieee802154_frame_address_offset(frame);
|
||||
uint8_t dst_mode = dst_addr_mode(frame);
|
||||
uint8_t src_mode = src_addr_mode(frame);
|
||||
uint8_t addr_size;
|
||||
|
||||
ESP_RETURN_ON_FALSE_ISR(src_mode == IEEE802154_FRAME_SRC_MODE_SHORT || src_mode == IEEE802154_FRAME_SRC_MODE_EXT, src_mode, TAG, "invalid address mode");
|
||||
ESP_RETURN_ON_FALSE_ISR(src_mode == IEEE802154_FRAME_SRC_MODE_SHORT || src_mode == IEEE802154_FRAME_SRC_MODE_EXT, src_mode, IEEE802154_TAG, "invalid address mode");
|
||||
|
||||
addr_size = (src_mode == IEEE802154_FRAME_SRC_MODE_SHORT) ? IEEE802154_FRAME_SHORT_ADDR_SIZE : IEEE802154_FRAME_EXT_ADDR_SIZE;
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -8,8 +8,7 @@
|
||||
#include "hal/ieee802154_ll.h"
|
||||
#include "esp_check.h"
|
||||
#include "esp_ieee802154_timer.h"
|
||||
|
||||
static const char *TAG = "ieee802154_timer";
|
||||
#include "esp_ieee802154_util.h"
|
||||
|
||||
void ieee802154_timer0_start(void)
|
||||
{
|
||||
@@ -23,7 +22,7 @@ void ieee802154_timer0_stop(void)
|
||||
|
||||
esp_err_t ieee802154_timer0_set_threshold(uint32_t value)
|
||||
{
|
||||
ESP_RETURN_ON_FALSE((value < IEEE802154_TIMER0_THRESHOLD), ESP_ERR_INVALID_ARG, TAG, "invalid timer0 threshold\r\n");
|
||||
ESP_RETURN_ON_FALSE((value < IEEE802154_TIMER0_THRESHOLD), ESP_ERR_INVALID_ARG, IEEE802154_TAG, "invalid timer0 threshold");
|
||||
|
||||
ieee802154_ll_timer0_set_threshold(value);
|
||||
|
||||
@@ -47,7 +46,7 @@ void ieee802154_timer1_stop(void)
|
||||
|
||||
esp_err_t ieee802154_timer1_set_threshold(uint32_t value)
|
||||
{
|
||||
ESP_RETURN_ON_FALSE((value < IEEE802154_TIMER1_THRESHOLD), ESP_ERR_INVALID_ARG, TAG, "invalid timer1 threshold\r\n");
|
||||
ESP_RETURN_ON_FALSE((value < IEEE802154_TIMER1_THRESHOLD), ESP_ERR_INVALID_ARG, IEEE802154_TAG, "invalid timer1 threshold");
|
||||
|
||||
ieee802154_ll_timer1_set_threshold(value);
|
||||
|
||||
|
@@ -19,8 +19,6 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define IEEE802154_TAG "ieee802154"
|
||||
|
||||
// These three macros are in microseconds, used for transmit_at
|
||||
#define IEEE802154_ED_TRIG_TX_RAMPUP_TIME_US 256
|
||||
#define IEEE802154_TX_RAMPUP_TIME_US 98
|
||||
|
@@ -17,6 +17,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define IEEE802154_TAG "ieee802154"
|
||||
|
||||
#if SOC_PM_MODEM_RETENTION_BY_REGDMA && CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
#define IEEE802154_RF_ENABLE() ieee802154_rf_enable()
|
||||
#define IEEE802154_RF_DISABLE() ieee802154_rf_disable()
|
||||
|
@@ -111,7 +111,9 @@ if(CONFIG_OPENTHREAD_ENABLED)
|
||||
"openthread/src/core/thread/mesh_forwarder_ftd.cpp"
|
||||
"openthread/src/core/thread/mesh_forwarder_mtd.cpp"
|
||||
"openthread/src/core/thread/mle.cpp"
|
||||
"openthread/src/core/thread/mle_router.cpp"
|
||||
"openthread/src/core/thread/mle_types.cpp"
|
||||
"openthread/src/core/thread/neighbor.cpp"
|
||||
"openthread/src/core/thread/neighbor_table.cpp"
|
||||
"openthread/src/core/thread/network_data.cpp"
|
||||
"openthread/src/core/thread/network_data_leader.cpp"
|
||||
|
@@ -206,7 +206,6 @@ menu "OpenThread"
|
||||
int "The size of max commissioning joiner entries"
|
||||
depends on OPENTHREAD_COMMISSIONER
|
||||
default 2
|
||||
range 2 50
|
||||
|
||||
config OPENTHREAD_JOINER
|
||||
bool "Enable Joiner"
|
||||
@@ -228,7 +227,6 @@ menu "OpenThread"
|
||||
int "Specifies number of service entries in the SRP client service pool"
|
||||
depends on OPENTHREAD_SRP_CLIENT
|
||||
default 5
|
||||
range 2 20
|
||||
help
|
||||
Set the max buffer size of service entries in the SRP client service pool.
|
||||
|
||||
@@ -257,14 +255,11 @@ menu "OpenThread"
|
||||
int "The number of openthread message buffers"
|
||||
depends on OPENTHREAD_ENABLED
|
||||
default 65
|
||||
range 10 100 if !OPENTHREAD_PLATFORM_MSGPOOL_MANAGEMENT
|
||||
range 10 8191 if OPENTHREAD_PLATFORM_MSGPOOL_MANAGEMENT
|
||||
|
||||
config OPENTHREAD_SPINEL_RX_FRAME_BUFFER_SIZE
|
||||
int "The size of openthread spinel rx frame buffer"
|
||||
depends on OPENTHREAD_ENABLED || OPENTHREAD_SPINEL_ONLY
|
||||
default 1024
|
||||
range 512 8192
|
||||
default 2048
|
||||
|
||||
config OPENTHREAD_MAC_MAX_CSMA_BACKOFFS_DIRECT
|
||||
int "Maximum backoffs times before declaring a channel access failure."
|
||||
@@ -278,13 +273,11 @@ menu "OpenThread"
|
||||
int "The size of max MLE children entries"
|
||||
depends on OPENTHREAD_ENABLED
|
||||
default 10
|
||||
range 5 50
|
||||
|
||||
config OPENTHREAD_TMF_ADDR_CACHE_ENTRIES
|
||||
int "The size of max TMF address cache entries"
|
||||
depends on OPENTHREAD_ENABLED
|
||||
default 20
|
||||
range 5 50
|
||||
|
||||
config OPENTHREAD_DNS64_CLIENT
|
||||
bool "Use dns64 client"
|
||||
@@ -303,8 +296,7 @@ menu "OpenThread"
|
||||
config OPENTHREAD_UART_BUFFER_SIZE
|
||||
int "The uart received buffer size of openthread"
|
||||
depends on OPENTHREAD_ENABLED
|
||||
default 768
|
||||
range 128 1024
|
||||
default 2048
|
||||
help
|
||||
Set the OpenThread UART buffer size.
|
||||
|
||||
@@ -377,7 +369,7 @@ menu "OpenThread"
|
||||
default n
|
||||
help
|
||||
Select this option to enable the radio statistics feature, you can use radio command to print some radio
|
||||
Statistics informations.
|
||||
Statistics information.
|
||||
|
||||
config OPENTHREAD_SPINEL_ONLY
|
||||
bool "Enable OpenThread External Radio Spinel feature"
|
||||
@@ -386,11 +378,11 @@ menu "OpenThread"
|
||||
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"
|
||||
bool "Enable OpenThread radio capability 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
|
||||
Select this option to enable OpenThread radio capability rx on when idle. Do not support this feature when
|
||||
SW coexistence is enabled.
|
||||
|
||||
menu "Thread Address Query Config"
|
||||
@@ -398,19 +390,16 @@ menu "OpenThread"
|
||||
int "Timeout value (in seconds) for a address notification response after sending an address query."
|
||||
depends on OPENTHREAD_FTD || OPENTHREAD_MTD
|
||||
default 3
|
||||
range 1 10
|
||||
|
||||
config OPENTHREAD_ADDRESS_QUERY_RETRY_DELAY
|
||||
int "Initial retry delay for address query (in seconds)."
|
||||
depends on OPENTHREAD_FTD || OPENTHREAD_MTD
|
||||
default 15
|
||||
range 1 120
|
||||
|
||||
config OPENTHREAD_ADDRESS_QUERY_MAX_RETRY_DELAY
|
||||
int "Maximum retry delay for address query (in seconds)."
|
||||
depends on OPENTHREAD_FTD || OPENTHREAD_MTD
|
||||
default 120
|
||||
range OPENTHREAD_ADDRESS_QUERY_RETRY_DELAY 960
|
||||
endmenu
|
||||
|
||||
endmenu
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -67,7 +67,7 @@ esp_netif_t *esp_openthread_get_backbone_netif(void);
|
||||
void esp_openthread_register_rcp_failure_handler(esp_openthread_rcp_failure_handler handler);
|
||||
|
||||
/**
|
||||
* @brief Deinitializes the conneciton to RCP.
|
||||
* @brief Deinitializes the connection to RCP.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK on success
|
||||
@@ -77,7 +77,7 @@ void esp_openthread_register_rcp_failure_handler(esp_openthread_rcp_failure_hand
|
||||
esp_err_t esp_openthread_rcp_deinit(void);
|
||||
|
||||
/**
|
||||
* @brief Initializes the conneciton to RCP.
|
||||
* @brief Initializes the connection to RCP.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK on success
|
||||
@@ -86,6 +86,21 @@ esp_err_t esp_openthread_rcp_deinit(void);
|
||||
*/
|
||||
esp_err_t esp_openthread_rcp_init(void);
|
||||
|
||||
/**
|
||||
* @brief Sets the meshcop(e) instance name.
|
||||
*
|
||||
* @note This function can only be called before `esp_openthread_border_router_init`.
|
||||
* If `instance_name` is NULL, then the service will use the hostname as instance name.
|
||||
*
|
||||
* @param[in] instance_name The instance name, can be `NULL`.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK on success
|
||||
* - ESP_FAIL if fail to initialize RCP
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_openthread_set_meshcop_instance_name(const char *instance_name);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -16,7 +16,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Default configuration reference of OT esp-netif
|
||||
* @brief Default configuration reference of OpenThread esp-netif
|
||||
*/
|
||||
#define ESP_NETIF_INHERENT_DEFAULT_OPENTHREAD() \
|
||||
{ \
|
||||
@@ -67,6 +67,15 @@ void esp_openthread_netif_glue_deinit(void);
|
||||
*/
|
||||
esp_netif_t *esp_openthread_get_netif(void);
|
||||
|
||||
/**
|
||||
* @brief This function register a handler for meshcop-e service publish event and remove event.
|
||||
*
|
||||
* @param[in] handler The handler.
|
||||
* @param[in] for_publish The usage of handler, true for publish event and false for remove event.
|
||||
*
|
||||
*/
|
||||
void esp_openthread_register_meshcop_e_handler(esp_event_handler_t handler, bool for_publish);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@@ -44,6 +44,8 @@ typedef enum {
|
||||
OPENTHREAD_EVENT_TREL_REMOVE_IP6, /*!< OpenThread stack removed TREL IPv6 address */
|
||||
OPENTHREAD_EVENT_TREL_MULTICAST_GROUP_JOIN, /*!< OpenThread stack joined TREL IPv6 multicast group */
|
||||
OPENTHREAD_EVENT_SET_DNS_SERVER, /*!< OpenThread stack set DNS server >*/
|
||||
OPENTHREAD_EVENT_PUBLISH_MESHCOP_E, /*!< OpenThread stack start to publish meshcop-e service >*/
|
||||
OPENTHREAD_EVENT_REMOVE_MESHCOP_E, /*!< OpenThread stack start to remove meshcop-e service >*/
|
||||
} esp_openthread_event_t;
|
||||
|
||||
/**
|
||||
|
Submodule components/openthread/lib updated: fcee30db4b...34d698a274
Submodule components/openthread/openthread updated: 456c448284...be7d36e4ff
@@ -632,4 +632,8 @@
|
||||
#define OPENTHREAD_CONFIG_MAC_MAX_CSMA_BACKOFFS_DIRECT CONFIG_OPENTHREAD_MAC_MAX_CSMA_BACKOFFS_DIRECT
|
||||
#endif
|
||||
|
||||
#ifndef OPENTHREAD_CONFIG_THREAD_VERSION
|
||||
#define OPENTHREAD_CONFIG_THREAD_VERSION OT_THREAD_VERSION_1_4
|
||||
#endif
|
||||
|
||||
#define OPENTHREAD_FTD 1
|
||||
|
@@ -5,4 +5,4 @@ supplier: 'Organization: Espressif Systems (Shanghai) CO LTD'
|
||||
originator: 'Organization: Google LLC'
|
||||
description: OpenThread released by Google is an open-source implementation of the Thread networking
|
||||
url: https://github.com/espressif/openthread
|
||||
hash: 456c448284486abe2a9118a9fdaa468fe2383fcd
|
||||
hash: be7d36e4ff9cf7df6dfce54e58a31163c87b93f7
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -129,7 +129,7 @@ esp_err_t esp_openthread_auto_start(otOperationalDatasetTlvs *datasetTlvs)
|
||||
memcpy(dataset.mMeshLocalPrefix.m8, prefix.mPrefix.mFields.m8, sizeof(dataset.mMeshLocalPrefix.m8));
|
||||
dataset.mComponents.mIsMeshLocalPrefixPresent = true;
|
||||
} else {
|
||||
ESP_LOGE("Falied to parse mesh local prefix", CONFIG_OPENTHREAD_MESH_LOCAL_PREFIX);
|
||||
ESP_LOGE("Failed to parse mesh local prefix", CONFIG_OPENTHREAD_MESH_LOCAL_PREFIX);
|
||||
}
|
||||
|
||||
// Network Key
|
||||
@@ -213,13 +213,3 @@ esp_err_t esp_openthread_deinit(void)
|
||||
otInstanceFinalize(esp_openthread_get_instance());
|
||||
return esp_openthread_platform_deinit();
|
||||
}
|
||||
|
||||
static void stub_task(void *context)
|
||||
{
|
||||
// this is a empty function used for ot-task signal pending
|
||||
}
|
||||
|
||||
void otTaskletsSignalPending(otInstance *aInstance)
|
||||
{
|
||||
esp_openthread_task_queue_post(stub_task, NULL);
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -203,6 +203,33 @@ exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
static esp_event_handler_t meshcop_e_publish_handler = NULL;
|
||||
static void esp_openthread_meshcop_e_publish_handler(void *args, esp_event_base_t base, int32_t event_id, void *data)
|
||||
{
|
||||
if (meshcop_e_publish_handler) {
|
||||
meshcop_e_publish_handler(args, base, event_id, data);
|
||||
}
|
||||
}
|
||||
|
||||
static esp_event_handler_t meshcop_e_remove_handler = NULL;
|
||||
static void esp_openthread_meshcop_e_remove_handler(void *args, esp_event_base_t base, int32_t event_id, void *data)
|
||||
{
|
||||
if (meshcop_e_remove_handler) {
|
||||
meshcop_e_remove_handler(args, base, event_id, data);
|
||||
}
|
||||
}
|
||||
|
||||
void esp_openthread_register_meshcop_e_handler(esp_event_handler_t handler, bool for_publish)
|
||||
{
|
||||
if (for_publish) {
|
||||
meshcop_e_publish_handler = handler;
|
||||
} else if (!for_publish) {
|
||||
meshcop_e_remove_handler = handler;
|
||||
} else {
|
||||
ESP_ERROR_CHECK(ESP_FAIL);
|
||||
}
|
||||
}
|
||||
|
||||
static esp_err_t register_openthread_event_handlers(esp_netif_t *esp_netif)
|
||||
{
|
||||
ESP_RETURN_ON_ERROR(
|
||||
@@ -229,6 +256,12 @@ static esp_err_t register_openthread_event_handlers(esp_netif_t *esp_netif)
|
||||
ESP_RETURN_ON_ERROR(esp_event_handler_register(OPENTHREAD_EVENT, OPENTHREAD_EVENT_MULTICAST_GROUP_LEAVE,
|
||||
esp_netif_action_leave_ip6_multicast_group, esp_netif),
|
||||
OT_PLAT_LOG_TAG, "OpenThread interface leave ip6 multicast group event register failed");
|
||||
ESP_RETURN_ON_ERROR(esp_event_handler_register(OPENTHREAD_EVENT, OPENTHREAD_EVENT_PUBLISH_MESHCOP_E,
|
||||
esp_openthread_meshcop_e_publish_handler, NULL),
|
||||
OT_PLAT_LOG_TAG, "OpenThread publish meshcop-e service event register failed");
|
||||
ESP_RETURN_ON_ERROR(esp_event_handler_register(OPENTHREAD_EVENT, OPENTHREAD_EVENT_REMOVE_MESHCOP_E,
|
||||
esp_openthread_meshcop_e_remove_handler, NULL),
|
||||
OT_PLAT_LOG_TAG, "OpenThread remove meshcop-e service event register failed");
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
@@ -244,6 +277,8 @@ static void unregister_openthread_event_handlers(void)
|
||||
esp_netif_action_join_ip6_multicast_group);
|
||||
esp_event_handler_unregister(OPENTHREAD_EVENT, OPENTHREAD_EVENT_MULTICAST_GROUP_LEAVE,
|
||||
esp_netif_action_leave_ip6_multicast_group);
|
||||
esp_event_handler_unregister(OPENTHREAD_EVENT, OPENTHREAD_EVENT_PUBLISH_MESHCOP_E, esp_openthread_meshcop_e_publish_handler);
|
||||
esp_event_handler_unregister(OPENTHREAD_EVENT, OPENTHREAD_EVENT_REMOVE_MESHCOP_E, esp_openthread_meshcop_e_remove_handler);
|
||||
}
|
||||
|
||||
static esp_err_t openthread_netif_post_attach(esp_netif_t *esp_netif, void *args)
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -34,7 +34,7 @@ static esp_openthread_platform_workflow_t *s_workflow_list = NULL;
|
||||
esp_err_t esp_openthread_platform_workflow_register(esp_openthread_update_func update_func,
|
||||
esp_openthread_process_func process_func, const char *name)
|
||||
{
|
||||
uint8_t name_len = strnlen(name, WORKFLOW_MAX_NAMELEN);
|
||||
uint8_t name_len = strnlen(name, WORKFLOW_MAX_NAMELEN - 1);
|
||||
esp_openthread_platform_workflow_t *current_workflow = s_workflow_list;
|
||||
esp_openthread_platform_workflow_t *before_workflow = NULL;
|
||||
esp_openthread_platform_workflow_t *add_workflow =
|
||||
@@ -42,6 +42,7 @@ esp_err_t esp_openthread_platform_workflow_register(esp_openthread_update_func u
|
||||
ESP_RETURN_ON_FALSE(add_workflow != NULL, ESP_ERR_NO_MEM, OT_PLAT_LOG_TAG,
|
||||
"Failed to alloc memory for esp_openthread_workflow");
|
||||
strncpy(add_workflow->name, name, name_len);
|
||||
add_workflow->name[name_len] = '\0';
|
||||
add_workflow->update_func = update_func;
|
||||
add_workflow->process_func = process_func;
|
||||
add_workflow->next = NULL;
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/portmacro.h"
|
||||
#include "freertos/queue.h"
|
||||
#include "openthread/tasklet.h"
|
||||
|
||||
static QueueHandle_t s_task_queue = NULL;
|
||||
static int s_task_queue_event_fd = -1;
|
||||
@@ -37,6 +38,14 @@ esp_err_t esp_openthread_task_queue_init(const esp_openthread_platform_config_t
|
||||
&esp_openthread_task_queue_process, task_queue_workflow);
|
||||
}
|
||||
|
||||
void otTaskletsSignalPending(otInstance *aInstance)
|
||||
{
|
||||
uint64_t val = 1;
|
||||
ssize_t ret;
|
||||
ret = write(s_task_queue_event_fd, &val, sizeof(val));
|
||||
assert(ret == sizeof(val));
|
||||
}
|
||||
|
||||
esp_err_t IRAM_ATTR esp_openthread_task_queue_post(esp_openthread_task_t task, void *arg)
|
||||
{
|
||||
task_storage_t task_storage = {
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "esp_openthread_task_queue.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "lwip/err.h"
|
||||
#include "lwip/ip6.h"
|
||||
#include "lwip/ip6_addr.h"
|
||||
#include "lwip/ip_addr.h"
|
||||
@@ -40,24 +41,19 @@ typedef struct {
|
||||
} udp_recv_task_t;
|
||||
|
||||
typedef struct {
|
||||
TaskHandle_t source_task;
|
||||
otUdpSocket *socket;
|
||||
struct udp_pcb *pcb_ret;
|
||||
} udp_new_task_t;
|
||||
|
||||
typedef struct {
|
||||
TaskHandle_t source_task;
|
||||
struct udp_pcb *pcb;
|
||||
ip_addr_t addr;
|
||||
uint16_t port;
|
||||
err_t ret;
|
||||
} udp_bind_connect_task_t;
|
||||
|
||||
typedef struct {
|
||||
TaskHandle_t source_task;
|
||||
struct udp_pcb *pcb;
|
||||
uint8_t netif_index;
|
||||
esp_err_t err;
|
||||
} udp_bind_netif_task_t;
|
||||
|
||||
typedef struct {
|
||||
@@ -78,13 +74,6 @@ typedef struct {
|
||||
ip6_addr_t addr;
|
||||
} udp_multicast_join_leave_task_t;
|
||||
|
||||
static void wait_for_task_notification(void)
|
||||
{
|
||||
esp_openthread_task_switching_lock_release();
|
||||
ulTaskNotifyTake(pdTRUE, portMAX_DELAY);
|
||||
esp_openthread_task_switching_lock_acquire(portMAX_DELAY);
|
||||
}
|
||||
|
||||
static ip_addr_t map_openthread_addr_to_lwip_addr(const otIp6Address *address)
|
||||
{
|
||||
ip_addr_t addr;
|
||||
@@ -185,23 +174,25 @@ static void handle_udp_recv(void *ctx, struct udp_pcb *pcb, struct pbuf *p, cons
|
||||
}
|
||||
}
|
||||
|
||||
static void udp_new_task(void *ctx)
|
||||
static esp_err_t udp_new_task(void *ctx)
|
||||
{
|
||||
udp_new_task_t *task = (udp_new_task_t *)ctx;
|
||||
|
||||
task->pcb_ret = udp_new();
|
||||
ESP_RETURN_ON_FALSE(task->pcb_ret != NULL, ESP_ERR_NO_MEM, OT_PLAT_LOG_TAG, "Failed to create a new UDP pcb");
|
||||
udp_recv(task->pcb_ret, handle_udp_recv, task->socket);
|
||||
xTaskNotifyGive(task->source_task);
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
otError otPlatUdpSocket(otUdpSocket *udp_socket)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
esp_err_t err = ESP_OK;
|
||||
|
||||
udp_new_task_t task = { .source_task = xTaskGetCurrentTaskHandle(), .socket = udp_socket };
|
||||
tcpip_callback(udp_new_task, &task);
|
||||
wait_for_task_notification();
|
||||
VerifyOrExit(task.pcb_ret != NULL, error = OT_ERROR_FAILED);
|
||||
udp_new_task_t task = {.socket = udp_socket };
|
||||
esp_openthread_task_switching_lock_release();
|
||||
err = esp_netif_tcpip_exec(udp_new_task, &task);
|
||||
esp_openthread_task_switching_lock_acquire(portMAX_DELAY);
|
||||
VerifyOrExit(err == ESP_OK, error = OT_ERROR_FAILED);
|
||||
udp_socket->mHandle = task.pcb_ret;
|
||||
|
||||
exit:
|
||||
@@ -220,24 +211,25 @@ otError otPlatUdpClose(otUdpSocket *udp_socket)
|
||||
struct udp_pcb *pcb = (struct udp_pcb *)udp_socket->mHandle;
|
||||
|
||||
if (pcb) {
|
||||
esp_openthread_task_switching_lock_release();
|
||||
tcpip_callback(udp_close_task, pcb);
|
||||
esp_openthread_task_switching_lock_acquire(portMAX_DELAY);
|
||||
}
|
||||
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
static void udp_bind_task(void *ctx)
|
||||
static esp_err_t udp_bind_task(void *ctx)
|
||||
{
|
||||
udp_bind_connect_task_t *task = (udp_bind_connect_task_t *)ctx;
|
||||
|
||||
task->ret = udp_bind(task->pcb, &task->addr, task->port);
|
||||
xTaskNotifyGive(task->source_task);
|
||||
err_t ret = udp_bind(task->pcb, &task->addr, task->port);
|
||||
return (ret == ERR_OK) ? ESP_OK : ESP_FAIL;
|
||||
}
|
||||
|
||||
otError otPlatUdpBind(otUdpSocket *udp_socket)
|
||||
{
|
||||
esp_err_t err = ESP_OK;
|
||||
udp_bind_connect_task_t task = {
|
||||
.source_task = xTaskGetCurrentTaskHandle(),
|
||||
.pcb = (struct udp_pcb *)udp_socket->mHandle,
|
||||
.port = udp_socket->mSockName.mPort,
|
||||
};
|
||||
@@ -247,17 +239,18 @@ otError otPlatUdpBind(otUdpSocket *udp_socket)
|
||||
task.addr.type = IPADDR_TYPE_ANY;
|
||||
#endif
|
||||
memcpy(ip_2_ip6(&task.addr)->addr, udp_socket->mSockName.mAddress.mFields.m8, sizeof(ip_2_ip6(&task.addr)->addr));
|
||||
tcpip_callback(udp_bind_task, &task);
|
||||
wait_for_task_notification();
|
||||
esp_openthread_task_switching_lock_release();
|
||||
err = esp_netif_tcpip_exec(udp_bind_task, &task);
|
||||
esp_openthread_task_switching_lock_acquire(portMAX_DELAY);
|
||||
|
||||
return task.ret == ERR_OK ? OT_ERROR_NONE : OT_ERROR_FAILED;
|
||||
return err == ESP_OK ? OT_ERROR_NONE : OT_ERROR_FAILED;
|
||||
}
|
||||
|
||||
static void udp_bind_netif_task(void *ctx)
|
||||
static esp_err_t udp_bind_netif_task(void *ctx)
|
||||
{
|
||||
udp_bind_netif_task_t *task = (udp_bind_netif_task_t *)ctx;
|
||||
udp_bind_netif(task->pcb, netif_get_by_index(task->netif_index));
|
||||
xTaskNotifyGive(task->source_task);
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
static uint8_t get_netif_index(otNetifIdentifier netif_identifier)
|
||||
@@ -276,34 +269,30 @@ static uint8_t get_netif_index(otNetifIdentifier netif_identifier)
|
||||
|
||||
otError otPlatUdpBindToNetif(otUdpSocket *udp_socket, otNetifIdentifier netif_identifier)
|
||||
{
|
||||
otError err = OT_ERROR_NONE;
|
||||
esp_err_t err = ESP_OK;
|
||||
udp_bind_netif_task_t task = {
|
||||
.source_task = xTaskGetCurrentTaskHandle(),
|
||||
.pcb = (struct udp_pcb *)udp_socket->mHandle,
|
||||
.netif_index = get_netif_index(netif_identifier),
|
||||
.err = ESP_OK,
|
||||
};
|
||||
|
||||
tcpip_callback(udp_bind_netif_task, &task);
|
||||
wait_for_task_notification();
|
||||
if (task.err != ESP_OK) {
|
||||
err = OT_ERROR_FAILED;
|
||||
}
|
||||
return err;
|
||||
esp_openthread_task_switching_lock_release();
|
||||
err = esp_netif_tcpip_exec(udp_bind_netif_task, &task);
|
||||
esp_openthread_task_switching_lock_acquire(portMAX_DELAY);
|
||||
|
||||
return err == ESP_OK ? OT_ERROR_NONE : OT_ERROR_FAILED;
|
||||
}
|
||||
|
||||
static void udp_connect_task(void *ctx)
|
||||
static esp_err_t udp_connect_task(void *ctx)
|
||||
{
|
||||
udp_bind_connect_task_t *task = (udp_bind_connect_task_t *)ctx;
|
||||
|
||||
task->ret = udp_connect(task->pcb, &task->addr, task->port);
|
||||
xTaskNotifyGive(task->source_task);
|
||||
err_t ret = udp_connect(task->pcb, &task->addr, task->port);
|
||||
return (ret == ERR_OK) ? ESP_OK : ESP_FAIL;
|
||||
}
|
||||
|
||||
otError otPlatUdpConnect(otUdpSocket *udp_socket)
|
||||
{
|
||||
esp_err_t err = ESP_OK;
|
||||
udp_bind_connect_task_t task = {
|
||||
.source_task = xTaskGetCurrentTaskHandle(),
|
||||
.pcb = (struct udp_pcb *)udp_socket->mHandle,
|
||||
.port = udp_socket->mPeerName.mPort,
|
||||
};
|
||||
@@ -312,10 +301,11 @@ otError otPlatUdpConnect(otUdpSocket *udp_socket)
|
||||
if (ip_addr_isany_val(task.addr) && task.port == 0) {
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
tcpip_callback(udp_connect_task, &task);
|
||||
wait_for_task_notification();
|
||||
esp_openthread_task_switching_lock_release();
|
||||
err = esp_netif_tcpip_exec(udp_connect_task, &task);
|
||||
esp_openthread_task_switching_lock_acquire(portMAX_DELAY);
|
||||
|
||||
return task.ret == ERR_OK ? OT_ERROR_NONE : OT_ERROR_FAILED;
|
||||
return err == ESP_OK ? OT_ERROR_NONE : OT_ERROR_FAILED;
|
||||
}
|
||||
|
||||
static bool is_link_local(const otIp6Address *address)
|
||||
@@ -419,7 +409,9 @@ otError otPlatUdpSend(otUdpSocket *udp_socket, otMessage *message, const otMessa
|
||||
// If the destination address is a openthread mesh local address, set the netif OT.
|
||||
task->netif_index = get_netif_index(OT_NETIF_THREAD);
|
||||
}
|
||||
esp_openthread_task_switching_lock_release();
|
||||
tcpip_callback(udp_send_task, task);
|
||||
esp_openthread_task_switching_lock_acquire(portMAX_DELAY);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
@@ -458,7 +450,9 @@ otError otPlatUdpJoinMulticastGroup(otUdpSocket *socket, otNetifIdentifier netif
|
||||
task->netif_index = get_netif_index(netif_id);
|
||||
task->addr.zone = task->netif_index;
|
||||
memcpy(task->addr.addr, addr->mFields.m8, sizeof(task->addr.addr));
|
||||
esp_openthread_task_switching_lock_release();
|
||||
tcpip_callback(udp_multicast_join_leave_task, task);
|
||||
esp_openthread_task_switching_lock_acquire(portMAX_DELAY);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
@@ -475,7 +469,9 @@ otError otPlatUdpLeaveMulticastGroup(otUdpSocket *socket, otNetifIdentifier neti
|
||||
task->netif_index = get_netif_index(netif_id);
|
||||
task->addr.zone = task->netif_index;
|
||||
memcpy(task->addr.addr, addr->mFields.m8, sizeof(task->addr.addr));
|
||||
esp_openthread_task_switching_lock_release();
|
||||
tcpip_callback(udp_multicast_join_leave_task, task);
|
||||
esp_openthread_task_switching_lock_acquire(portMAX_DELAY);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -266,8 +266,8 @@ otError SpiSpinelInterface::WaitForFrame(uint64_t timeout_us)
|
||||
otError SpiSpinelInterface::HardwareReset(void)
|
||||
{
|
||||
if (mRcpFailureHandler) {
|
||||
mRcpFailureHandler();
|
||||
ConductSPITransaction(true, 0, 0); // clear
|
||||
mRcpFailureHandler();
|
||||
}
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -295,8 +295,8 @@ esp_err_t UartSpinelInterface::TryRecoverUart(void)
|
||||
otError UartSpinelInterface::HardwareReset(void)
|
||||
{
|
||||
if (mRcpFailureHandler) {
|
||||
mRcpFailureHandler();
|
||||
TryRecoverUart();
|
||||
mRcpFailureHandler();
|
||||
}
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -276,8 +276,8 @@ esp_err_t UartSpinelInterface::TryRecoverUart(void)
|
||||
otError UartSpinelInterface::HardwareReset(void)
|
||||
{
|
||||
if (mRcpFailureHandler) {
|
||||
mRcpFailureHandler();
|
||||
TryRecoverUart();
|
||||
mRcpFailureHandler();
|
||||
}
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
## IDF Component Manager Manifest File
|
||||
dependencies:
|
||||
espressif/esp_ot_cli_extension:
|
||||
version: "~1.0.0"
|
||||
version: "~1.1.0"
|
||||
espressif/mdns: "^1.0.3"
|
||||
## Required IDF version
|
||||
idf:
|
||||
@@ -10,5 +10,3 @@ dependencies:
|
||||
path: ${IDF_PATH}/examples/common_components/protocol_examples_common
|
||||
ot_led:
|
||||
path: ${IDF_PATH}/examples/openthread/ot_common_components/ot_led
|
||||
espressif/iperf:
|
||||
version: "~0.1.1"
|
||||
|
@@ -1,10 +1,8 @@
|
||||
## IDF Component Manager Manifest File
|
||||
dependencies:
|
||||
espressif/esp_ot_cli_extension:
|
||||
version: "~1.0.0"
|
||||
version: "~1.1.0"
|
||||
idf:
|
||||
version: ">=4.1.0"
|
||||
ot_led:
|
||||
path: ${IDF_PATH}/examples/openthread/ot_common_components/ot_led
|
||||
espressif/iperf:
|
||||
version: "~0.1.1"
|
||||
|
@@ -18,7 +18,7 @@ from pytest_embedded_idf.dut import IdfDut
|
||||
# This file contains the test scripts for Thread:
|
||||
|
||||
# Case 1: Thread network formation and attaching
|
||||
# A Thread Border Router forms a Thread network, Thread devices attache to it, then test ping connection between them.
|
||||
# A Thread Border Router forms a Thread network, Thread devices attach to it, then test ping connection between them.
|
||||
|
||||
# Case 2: Bidirectional IPv6 connectivity
|
||||
# Test IPv6 ping connection between Thread device and Linux Host (via Thread Border Router).
|
||||
@@ -29,10 +29,10 @@ from pytest_embedded_idf.dut import IdfDut
|
||||
# Case 4: Multicast forwarding from Thread to Wi-Fi network
|
||||
# Linux Host joins the multicast group, test group communication from Thread to Wi-Fi network.
|
||||
|
||||
# Case 5: discover Serice published by Thread device
|
||||
# Case 5: discover Service published by Thread device
|
||||
# Thread device publishes the service, Linux Host discovers the service on Wi-Fi network.
|
||||
|
||||
# Case 6: discover Serice published by W-Fi device
|
||||
# Case 6: discover Service published by W-Fi device
|
||||
# Linux Host device publishes the service on Wi-Fi network, Thread device discovers the service.
|
||||
|
||||
# Case 7: ICMP communication via NAT64
|
||||
@@ -728,7 +728,7 @@ def test_br_meshcop(Init_interface:bool, Init_avahi:bool, dut: Tuple[IdfDut, Idf
|
||||
assert 'hostname = [esp-ot-br.local]' in str(output_str)
|
||||
assert ('address = [' + ipv4_address + ']') in str(output_str)
|
||||
assert 'dn=DefaultDomain' in str(output_str)
|
||||
assert 'tv=1.3.0' in str(output_str)
|
||||
assert 'tv=1.4.0' in str(output_str)
|
||||
assert ('nn=' + networkname) in str(output_str)
|
||||
assert 'mn=BorderRouter' in str(output_str)
|
||||
assert 'vn=OpenThread' in str(output_str)
|
||||
|
Reference in New Issue
Block a user