mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 03:00:34 +03:00
Merge branch 'feat/support_multipan_feature_rcp_20260603_v6.1' into 'release/v6.1'
feat(openthread): support multipan feature for RCP (v6.1) See merge request espressif/esp-idf!51777
This commit is contained in:
@@ -31,6 +31,10 @@ if(CONFIG_IEEE802154_DEBUG)
|
||||
list(APPEND srcs "driver/esp_ieee802154_debug.c")
|
||||
endif()
|
||||
|
||||
if(CONFIG_IEEE802154_MULTI_PAN_ENABLE)
|
||||
list(APPEND srcs "esp_ieee802154_multipan.c")
|
||||
endif()
|
||||
|
||||
idf_component_register(
|
||||
SRCS "${srcs}"
|
||||
INCLUDE_DIRS "${include}"
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "hal/ieee802154_ll.h"
|
||||
#include "esp_attr.h"
|
||||
#include "esp_err.h"
|
||||
#include "esp_ieee802154_ack.h"
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "hal/ieee802154_ll.h"
|
||||
#include "esp_ieee802154_util.h"
|
||||
#include "esp_log.h"
|
||||
|
||||
|
||||
@@ -24,10 +24,13 @@
|
||||
#include "esp_ieee802154_sec.h"
|
||||
#include "esp_ieee802154_util.h"
|
||||
#include "esp_ieee802154_timer.h"
|
||||
#include "hal/ieee802154_ll.h"
|
||||
#include "esp_attr.h"
|
||||
#include "esp_phy_init.h"
|
||||
|
||||
#if CONFIG_IEEE802154_MULTI_PAN_ENABLE
|
||||
#include "esp_ieee802154_multipan.h"
|
||||
#endif
|
||||
|
||||
#if CONFIG_PM_ENABLE
|
||||
#include "esp_pm.h"
|
||||
#include "esp_private/esp_clk.h"
|
||||
@@ -124,6 +127,16 @@ esp_err_t ieee802154_receive_handle_done(const uint8_t *data)
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
static void ieee802154_rx_buffer_clear(void)
|
||||
{
|
||||
memset(s_rx_frame, 0, sizeof(s_rx_frame));
|
||||
memset(s_rx_frame_info, 0, sizeof(s_rx_frame_info));
|
||||
s_rx_index = 0;
|
||||
s_recent_rx_frame_info_index = 0;
|
||||
s_needs_next_operation = false;
|
||||
s_pending_rx_stop = false;
|
||||
}
|
||||
|
||||
static IRAM_ATTR void event_end_process(void)
|
||||
{
|
||||
ieee802154_etm_channel_clear(IEEE802154_ETM_CHANNEL0);
|
||||
@@ -915,8 +928,7 @@ esp_err_t ieee802154_mac_init(void)
|
||||
|
||||
ieee802154_txon_delay_set();
|
||||
|
||||
memset(s_rx_frame, 0, sizeof(s_rx_frame));
|
||||
|
||||
ieee802154_rx_buffer_clear();
|
||||
ieee802154_set_state(IEEE802154_STATE_IDLE);
|
||||
|
||||
// TODO: Add flags for IEEE802154 ISR allocating. TZ-102
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include "sdkconfig.h"
|
||||
#include "hal/ieee802154_ll.h"
|
||||
#include "esp_check.h"
|
||||
#include "esp_ieee802154_pib.h"
|
||||
#include "esp_ieee802154_util.h"
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include "sdkconfig.h"
|
||||
#include <string.h>
|
||||
#include "esp_err.h"
|
||||
#include "hal/ieee802154_ll.h"
|
||||
#include "esp_ieee802154_frame.h"
|
||||
#include "esp_ieee802154_sec.h"
|
||||
#include "esp_ieee802154_util.h"
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
*/
|
||||
|
||||
#include "soc/soc.h"
|
||||
#include "hal/ieee802154_ll.h"
|
||||
#include "esp_check.h"
|
||||
#include "esp_ieee802154_timer.h"
|
||||
#include "esp_ieee802154_util.h"
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include "esp_private/esp_modem_clock.h"
|
||||
#include "soc/soc.h"
|
||||
#include "soc/periph_defs.h"
|
||||
#include "hal/ieee802154_ll.h"
|
||||
#include "esp_check.h"
|
||||
#include "esp_coex_i154.h"
|
||||
#include "esp_ieee802154_util.h"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2020-2025 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2020-2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -20,7 +20,6 @@
|
||||
#include "esp_ieee802154_util.h"
|
||||
#include "esp_log.h"
|
||||
#include "esp_coex_i154.h"
|
||||
#include "hal/ieee802154_ll.h"
|
||||
#include "hal/ieee802154_common_ll.h"
|
||||
|
||||
esp_err_t esp_ieee802154_event_callback_list_register(esp_ieee802154_event_cb_list_t cb_list)
|
||||
@@ -49,6 +48,11 @@ esp_err_t esp_ieee802154_disable(void)
|
||||
return ieee802154_mac_deinit();
|
||||
}
|
||||
|
||||
int8_t esp_ieee802154_get_receive_sensitivity(void)
|
||||
{
|
||||
return IEEE802154_RX_SENSITIVITY;
|
||||
}
|
||||
|
||||
uint8_t esp_ieee802154_get_channel(void)
|
||||
{
|
||||
return ieee802154_pib_get_channel();
|
||||
@@ -166,96 +170,6 @@ esp_err_t esp_ieee802154_set_coordinator(bool enable)
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
#if CONFIG_IEEE802154_MULTI_PAN_ENABLE
|
||||
|
||||
uint16_t esp_ieee802154_get_multipan_panid(esp_ieee802154_multipan_index_t index)
|
||||
{
|
||||
assert(index < CONFIG_IEEE802154_INTERFACE_NUM);
|
||||
return ieee802154_ll_get_multipan_panid(index);
|
||||
}
|
||||
|
||||
esp_err_t esp_ieee802154_set_multipan_panid(esp_ieee802154_multipan_index_t index, uint16_t panid)
|
||||
{
|
||||
assert(index < CONFIG_IEEE802154_INTERFACE_NUM);
|
||||
ieee802154_ll_set_multipan_panid(index, panid);
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
uint16_t esp_ieee802154_get_multipan_short_address(esp_ieee802154_multipan_index_t index)
|
||||
{
|
||||
assert(index < CONFIG_IEEE802154_INTERFACE_NUM);
|
||||
return ieee802154_ll_get_multipan_short_addr(index);
|
||||
}
|
||||
|
||||
esp_err_t esp_ieee802154_set_multipan_short_address(esp_ieee802154_multipan_index_t index, uint16_t short_address)
|
||||
{
|
||||
assert(index < CONFIG_IEEE802154_INTERFACE_NUM);
|
||||
ieee802154_ll_set_multipan_short_addr(index, short_address);
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t esp_ieee802154_get_multipan_extended_address(esp_ieee802154_multipan_index_t index, uint8_t *ext_addr)
|
||||
{
|
||||
assert(index < CONFIG_IEEE802154_INTERFACE_NUM);
|
||||
assert(ext_addr != NULL);
|
||||
ieee802154_ll_get_multipan_ext_addr(index, ext_addr);
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t esp_ieee802154_set_multipan_extended_address(esp_ieee802154_multipan_index_t index, const uint8_t *ext_addr)
|
||||
{
|
||||
assert(index < CONFIG_IEEE802154_INTERFACE_NUM);
|
||||
assert(ext_addr != NULL);
|
||||
ieee802154_ll_set_multipan_ext_addr(index, ext_addr);
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
uint8_t esp_ieee802154_get_multipan_enable(void)
|
||||
{
|
||||
return ieee802154_ll_get_multipan_enable_mask();
|
||||
}
|
||||
|
||||
esp_err_t esp_ieee802154_set_multipan_enable(uint8_t mask)
|
||||
{
|
||||
assert(mask < (1 << CONFIG_IEEE802154_INTERFACE_NUM));
|
||||
ieee802154_ll_set_multipan_enable_mask(mask);
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_ieee802154_pending_mode_t esp_ieee802154_multipan_get_pending_mode(esp_ieee802154_multipan_index_t index)
|
||||
{
|
||||
assert(index < CONFIG_IEEE802154_INTERFACE_NUM);
|
||||
return ieee802154_pib_get_pending_mode(index);
|
||||
}
|
||||
|
||||
esp_err_t esp_ieee802154_multipan_set_pending_mode(esp_ieee802154_multipan_index_t inf_index, esp_ieee802154_pending_mode_t pending_mode)
|
||||
{
|
||||
assert(inf_index < CONFIG_IEEE802154_INTERFACE_NUM);
|
||||
ieee802154_pib_set_pending_mode(inf_index, pending_mode);
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t esp_ieee802154_multipan_add_pending_addr(esp_ieee802154_multipan_index_t inf_index, const uint8_t *addr, bool is_short)
|
||||
{
|
||||
assert(inf_index < CONFIG_IEEE802154_INTERFACE_NUM);
|
||||
return ieee802154_add_pending_addr(inf_index, addr, is_short);
|
||||
}
|
||||
|
||||
esp_err_t esp_ieee802154_multipan_clear_pending_addr(esp_ieee802154_multipan_index_t inf_index, const uint8_t *addr, bool is_short)
|
||||
{
|
||||
assert(inf_index < CONFIG_IEEE802154_INTERFACE_NUM);
|
||||
return ieee802154_clear_pending_addr(inf_index, addr, is_short);
|
||||
}
|
||||
|
||||
esp_err_t esp_ieee802154_multipan_reset_pending_table(esp_ieee802154_multipan_index_t inf_index, bool is_short)
|
||||
{
|
||||
assert(inf_index < CONFIG_IEEE802154_INTERFACE_NUM);
|
||||
ieee802154_reset_pending_table(inf_index, is_short);
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
#endif // CONFIG_IEEE802154_MULTI_PAN_ENABLE
|
||||
|
||||
esp_err_t esp_ieee802154_set_ack_timeout(uint32_t timeout)
|
||||
{
|
||||
// Divide by 16 and round it up.
|
||||
|
||||
@@ -0,0 +1,141 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include "sdkconfig.h"
|
||||
#include <stdint.h>
|
||||
|
||||
#include "esp_err.h"
|
||||
#include "esp_ieee802154_ack.h"
|
||||
#include "esp_ieee802154_pib.h"
|
||||
#include "esp_ieee802154_util.h"
|
||||
|
||||
static uint8_t s_rx_when_idle_mask = 0;
|
||||
|
||||
uint16_t esp_ieee802154_get_multipan_panid(esp_ieee802154_multipan_index_t index)
|
||||
{
|
||||
IEEE802154_ASSERT(index < CONFIG_IEEE802154_INTERFACE_NUM);
|
||||
return ieee802154_ll_get_multipan_panid(index);
|
||||
}
|
||||
|
||||
esp_err_t esp_ieee802154_set_multipan_panid(esp_ieee802154_multipan_index_t index, uint16_t panid)
|
||||
{
|
||||
IEEE802154_ASSERT(index < CONFIG_IEEE802154_INTERFACE_NUM);
|
||||
ieee802154_ll_set_multipan_panid(index, panid);
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
uint16_t esp_ieee802154_get_multipan_short_address(esp_ieee802154_multipan_index_t index)
|
||||
{
|
||||
IEEE802154_ASSERT(index < CONFIG_IEEE802154_INTERFACE_NUM);
|
||||
return ieee802154_ll_get_multipan_short_addr(index);
|
||||
}
|
||||
|
||||
esp_err_t esp_ieee802154_set_multipan_short_address(esp_ieee802154_multipan_index_t index, uint16_t short_address)
|
||||
{
|
||||
IEEE802154_ASSERT(index < CONFIG_IEEE802154_INTERFACE_NUM);
|
||||
ieee802154_ll_set_multipan_short_addr(index, short_address);
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t esp_ieee802154_get_multipan_extended_address(esp_ieee802154_multipan_index_t index, uint8_t *ext_addr)
|
||||
{
|
||||
IEEE802154_ASSERT(index < CONFIG_IEEE802154_INTERFACE_NUM);
|
||||
IEEE802154_ASSERT(ext_addr != NULL);
|
||||
ieee802154_ll_get_multipan_ext_addr(index, ext_addr);
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t esp_ieee802154_set_multipan_extended_address(esp_ieee802154_multipan_index_t index, const uint8_t *ext_addr)
|
||||
{
|
||||
IEEE802154_ASSERT(index < CONFIG_IEEE802154_INTERFACE_NUM);
|
||||
IEEE802154_ASSERT(ext_addr != NULL);
|
||||
ieee802154_ll_set_multipan_ext_addr(index, ext_addr);
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
uint8_t esp_ieee802154_get_multipan_enable(void)
|
||||
{
|
||||
return ieee802154_ll_get_multipan_enable_mask();
|
||||
}
|
||||
|
||||
esp_err_t esp_ieee802154_set_multipan_enable(uint8_t mask)
|
||||
{
|
||||
IEEE802154_ASSERT(mask < (1 << CONFIG_IEEE802154_INTERFACE_NUM));
|
||||
ieee802154_ll_set_multipan_enable_mask(mask);
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_ieee802154_pending_mode_t esp_ieee802154_multipan_get_pending_mode(esp_ieee802154_multipan_index_t index)
|
||||
{
|
||||
IEEE802154_ASSERT(index < CONFIG_IEEE802154_INTERFACE_NUM);
|
||||
return ieee802154_pib_get_pending_mode(index);
|
||||
}
|
||||
|
||||
esp_err_t esp_ieee802154_multipan_set_pending_mode(esp_ieee802154_multipan_index_t inf_index, esp_ieee802154_pending_mode_t pending_mode)
|
||||
{
|
||||
IEEE802154_ASSERT(inf_index < CONFIG_IEEE802154_INTERFACE_NUM);
|
||||
ieee802154_pib_set_pending_mode(inf_index, pending_mode);
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t esp_ieee802154_multipan_add_pending_addr(esp_ieee802154_multipan_index_t inf_index, const uint8_t *addr, bool is_short)
|
||||
{
|
||||
IEEE802154_ASSERT(inf_index < CONFIG_IEEE802154_INTERFACE_NUM);
|
||||
return ieee802154_add_pending_addr(inf_index, addr, is_short);
|
||||
}
|
||||
|
||||
esp_err_t esp_ieee802154_multipan_clear_pending_addr(esp_ieee802154_multipan_index_t inf_index, const uint8_t *addr, bool is_short)
|
||||
{
|
||||
IEEE802154_ASSERT(inf_index < CONFIG_IEEE802154_INTERFACE_NUM);
|
||||
return ieee802154_clear_pending_addr(inf_index, addr, is_short);
|
||||
}
|
||||
|
||||
esp_err_t esp_ieee802154_multipan_reset_pending_table(esp_ieee802154_multipan_index_t inf_index, bool is_short)
|
||||
{
|
||||
IEEE802154_ASSERT(inf_index < CONFIG_IEEE802154_INTERFACE_NUM);
|
||||
ieee802154_reset_pending_table(inf_index, is_short);
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t esp_ieee802154_multipan_sleep(int8_t idx)
|
||||
{
|
||||
IEEE802154_ASSERT(idx >= 0 && idx < CONFIG_IEEE802154_INTERFACE_NUM);
|
||||
uint8_t enable_mask = ieee802154_ll_get_multipan_enable_mask();
|
||||
enable_mask &= ~(1 << idx);
|
||||
IEEE802154_ASSERT(enable_mask < (1 << CONFIG_IEEE802154_INTERFACE_NUM));
|
||||
ieee802154_ll_set_multipan_enable_mask(enable_mask);
|
||||
if (enable_mask == 0) {
|
||||
return ieee802154_sleep();
|
||||
}
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t esp_ieee802154_multipan_receive(int8_t idx)
|
||||
{
|
||||
IEEE802154_ASSERT(idx >= 0 && idx < CONFIG_IEEE802154_INTERFACE_NUM);
|
||||
uint8_t enable_mask = ieee802154_ll_get_multipan_enable_mask();
|
||||
enable_mask |= (1 << idx);
|
||||
IEEE802154_ASSERT(enable_mask < (1 << CONFIG_IEEE802154_INTERFACE_NUM));
|
||||
ieee802154_ll_set_multipan_enable_mask(enable_mask);
|
||||
return ieee802154_receive();
|
||||
}
|
||||
|
||||
esp_err_t esp_ieee802154_multipan_set_rx_when_idle(int8_t idx, bool enable)
|
||||
{
|
||||
IEEE802154_ASSERT(idx >= 0 && idx < CONFIG_IEEE802154_INTERFACE_NUM);
|
||||
if (enable) {
|
||||
s_rx_when_idle_mask |= (1 << idx);
|
||||
ieee802154_pib_set_rx_when_idle(true);
|
||||
} else {
|
||||
s_rx_when_idle_mask &= ~(1 << idx);
|
||||
if (s_rx_when_idle_mask == 0) {
|
||||
ieee802154_pib_set_rx_when_idle(false);
|
||||
}
|
||||
}
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
// Note: multipan receive_at is not supported yet.
|
||||
@@ -39,6 +39,14 @@ esp_err_t esp_ieee802154_enable(void);
|
||||
*/
|
||||
esp_err_t esp_ieee802154_disable(void);
|
||||
|
||||
/**
|
||||
* @brief Get the receive sensitivity.
|
||||
*
|
||||
* @return The receive sensitivity in dBm.
|
||||
*
|
||||
*/
|
||||
int8_t esp_ieee802154_get_receive_sensitivity(void);
|
||||
|
||||
/**
|
||||
* @brief Get the operational channel.
|
||||
*
|
||||
@@ -278,98 +286,6 @@ esp_err_t esp_ieee802154_get_extended_address(uint8_t *ext_addr);
|
||||
*/
|
||||
esp_err_t esp_ieee802154_set_extended_address(const uint8_t *ext_addr);
|
||||
|
||||
/**
|
||||
* @brief Get the device PAN ID for specific interface.
|
||||
*
|
||||
* @param[in] index The interface index.
|
||||
*
|
||||
* @return The device PAN ID.
|
||||
*
|
||||
*/
|
||||
uint16_t esp_ieee802154_get_multipan_panid(esp_ieee802154_multipan_index_t index);
|
||||
|
||||
/**
|
||||
* @brief Set the device PAN ID for specific interface.
|
||||
*
|
||||
* @param[in] index The interface index.
|
||||
* @param[in] panid The device PAN ID.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK on success.
|
||||
* - ESP_FAIL on failure.
|
||||
*/
|
||||
esp_err_t esp_ieee802154_set_multipan_panid(esp_ieee802154_multipan_index_t index, uint16_t panid);
|
||||
|
||||
/**
|
||||
* @brief Get the device short address for specific interface.
|
||||
*
|
||||
* @param[in] index The interface index.
|
||||
*
|
||||
* @return The device short address.
|
||||
*
|
||||
*/
|
||||
uint16_t esp_ieee802154_get_multipan_short_address(esp_ieee802154_multipan_index_t index);
|
||||
|
||||
/**
|
||||
* @brief Set the device short address for specific interface.
|
||||
*
|
||||
* @param[in] index The interface index.
|
||||
* @param[in] short_address The device short address.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK on success.
|
||||
* - ESP_FAIL on failure.
|
||||
*/
|
||||
esp_err_t esp_ieee802154_set_multipan_short_address(esp_ieee802154_multipan_index_t index, uint16_t short_address);
|
||||
|
||||
/**
|
||||
* @brief Get the device extended address for specific interface.
|
||||
*
|
||||
* @param[in] index The interface index.
|
||||
* @param[out] ext_addr The pointer to the device extended address. Must not be NULL.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK on success.
|
||||
* - ESP_ERR_INVALID_ARG if ext_addr is NULL.
|
||||
* - ESP_FAIL on failure.
|
||||
*/
|
||||
esp_err_t esp_ieee802154_get_multipan_extended_address(esp_ieee802154_multipan_index_t index, uint8_t *ext_addr);
|
||||
|
||||
/**
|
||||
* @brief Set the device extended address for specific interface.
|
||||
*
|
||||
* @param[in] index The interface index.
|
||||
* @param[in] ext_addr The pointer to the device extended address. Must not be NULL.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK on success.
|
||||
* - ESP_ERR_INVALID_ARG if addr is NULL.
|
||||
* - ESP_FAIL on failure.
|
||||
*/
|
||||
esp_err_t esp_ieee802154_set_multipan_extended_address(esp_ieee802154_multipan_index_t index, const uint8_t *ext_addr);
|
||||
|
||||
/**
|
||||
* @brief Get the device current multipan interface enable mask.
|
||||
*
|
||||
* @return Current multipan interface enable mask.
|
||||
*
|
||||
*/
|
||||
uint8_t esp_ieee802154_get_multipan_enable(void);
|
||||
|
||||
/**
|
||||
* @brief Enable specific interface for the device.
|
||||
*
|
||||
* As an example, call `esp_ieee802154_set_multipan_enable(BIT(ESP_IEEE802154_MULTIPAN_0) | BIT(ESP_IEEE802154_MULTIPAN_1));`
|
||||
* to enable multipan interface 0 and 1.
|
||||
*
|
||||
* @param[in] mask The multipan interface bit mask.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK on success.
|
||||
* - ESP_FAIL on failure.
|
||||
*/
|
||||
esp_err_t esp_ieee802154_set_multipan_enable(uint8_t mask);
|
||||
|
||||
/**
|
||||
* @brief Get the device coordinator.
|
||||
*
|
||||
@@ -771,80 +687,6 @@ esp_err_t esp_ieee802154_event_callback_list_register(esp_ieee802154_event_cb_li
|
||||
*/
|
||||
esp_err_t esp_ieee802154_event_callback_list_unregister(void);
|
||||
|
||||
/**
|
||||
* @brief Add a pending address to the multipan table for the specified interface.
|
||||
*
|
||||
* @note This API should be called only when the IEEE 802.15.4 subsystem is enabled.
|
||||
*
|
||||
* @param inf_index Index of the interface.
|
||||
* @param addr Pointer to the address to add.
|
||||
* @param is_short True if the address is a short address, false if extended.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK on success.
|
||||
* - ESP_FAIL on failure.
|
||||
*/
|
||||
esp_err_t esp_ieee802154_multipan_add_pending_addr(esp_ieee802154_multipan_index_t inf_index, const uint8_t *addr, bool is_short);
|
||||
|
||||
/**
|
||||
* @brief Remove a pending address from the multipan table for the specified interface.
|
||||
*
|
||||
* @note This API should be called only when the IEEE 802.15.4 subsystem is enabled.
|
||||
*
|
||||
* @param inf_index Index of the interface.
|
||||
* @param addr Pointer to the address to remove.
|
||||
* @param is_short True if the address is a short address, false if extended.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK on success.
|
||||
* - ESP_FAIL on failure.
|
||||
*/
|
||||
esp_err_t esp_ieee802154_multipan_clear_pending_addr(esp_ieee802154_multipan_index_t inf_index, const uint8_t *addr, bool is_short);
|
||||
|
||||
/**
|
||||
* @brief Reset the pending address table for the specified interface.
|
||||
*
|
||||
* @note This API clears all pending addresses of the specified type (short or extended) for the interface.
|
||||
*
|
||||
* @param inf_index Index of the interface.
|
||||
* @param is_short True to reset short addresses, false to reset extended addresses.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK on success.
|
||||
* - ESP_FAIL on failure.
|
||||
*/
|
||||
esp_err_t esp_ieee802154_multipan_reset_pending_table(esp_ieee802154_multipan_index_t inf_index, bool is_short);
|
||||
|
||||
/**
|
||||
* @brief Get the auto frame pending mode of the specified multipan interface.
|
||||
*
|
||||
* @note This API returns the logical pending mode configured for a given multipan
|
||||
* interface. The value is used by the ACK generation logic together with the
|
||||
* per-interface pending address table.
|
||||
*
|
||||
* @param inf_index Index of the multipan interface.
|
||||
*
|
||||
* @return
|
||||
* - Current pending mode of type refer to esp_ieee802154_pending_mode_t
|
||||
*/
|
||||
esp_ieee802154_pending_mode_t esp_ieee802154_multipan_get_pending_mode(esp_ieee802154_multipan_index_t inf_index);
|
||||
|
||||
/**
|
||||
* @brief Set the auto frame pending mode of the specified multipan interface.
|
||||
*
|
||||
* @note This API configures the logical pending mode for a given multipan interface.
|
||||
* The configured mode is used by the ACK generation logic together with the
|
||||
* per-interface pending address table.
|
||||
*
|
||||
* @param inf_index Index of the multipan interface.
|
||||
* @param pending_mode Pending mode to set for this interface.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK on success.
|
||||
* - ESP_FAIL on failure.
|
||||
*/
|
||||
esp_err_t esp_ieee802154_multipan_set_pending_mode(esp_ieee802154_multipan_index_t inf_index, esp_ieee802154_pending_mode_t pending_mode);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,224 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "sdkconfig.h"
|
||||
#include "esp_err.h"
|
||||
#include "esp_ieee802154_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Get the device PAN ID for specific interface.
|
||||
*
|
||||
* @param[in] index The interface index.
|
||||
*
|
||||
* @return The device PAN ID.
|
||||
*
|
||||
*/
|
||||
uint16_t esp_ieee802154_get_multipan_panid(esp_ieee802154_multipan_index_t index);
|
||||
|
||||
/**
|
||||
* @brief Set the device PAN ID for specific interface.
|
||||
*
|
||||
* @param[in] index The interface index.
|
||||
* @param[in] panid The device PAN ID.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK on success.
|
||||
* - ESP_FAIL on failure.
|
||||
*/
|
||||
esp_err_t esp_ieee802154_set_multipan_panid(esp_ieee802154_multipan_index_t index, uint16_t panid);
|
||||
|
||||
/**
|
||||
* @brief Get the device short address for specific interface.
|
||||
*
|
||||
* @param[in] index The interface index.
|
||||
*
|
||||
* @return The device short address.
|
||||
*
|
||||
*/
|
||||
uint16_t esp_ieee802154_get_multipan_short_address(esp_ieee802154_multipan_index_t index);
|
||||
|
||||
/**
|
||||
* @brief Set the device short address for specific interface.
|
||||
*
|
||||
* @param[in] index The interface index.
|
||||
* @param[in] short_address The device short address.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK on success.
|
||||
* - ESP_FAIL on failure.
|
||||
*/
|
||||
esp_err_t esp_ieee802154_set_multipan_short_address(esp_ieee802154_multipan_index_t index, uint16_t short_address);
|
||||
|
||||
/**
|
||||
* @brief Get the device extended address for specific interface.
|
||||
*
|
||||
* @param[in] index The interface index.
|
||||
* @param[out] ext_addr The pointer to the device extended address. Must not be NULL.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK on success.
|
||||
* - ESP_ERR_INVALID_ARG if ext_addr is NULL.
|
||||
* - ESP_FAIL on failure.
|
||||
*/
|
||||
esp_err_t esp_ieee802154_get_multipan_extended_address(esp_ieee802154_multipan_index_t index, uint8_t *ext_addr);
|
||||
|
||||
/**
|
||||
* @brief Set the device extended address for specific interface.
|
||||
*
|
||||
* @param[in] index The interface index.
|
||||
* @param[in] ext_addr The pointer to the device extended address. Must not be NULL.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK on success.
|
||||
* - ESP_ERR_INVALID_ARG if addr is NULL.
|
||||
* - ESP_FAIL on failure.
|
||||
*/
|
||||
esp_err_t esp_ieee802154_set_multipan_extended_address(esp_ieee802154_multipan_index_t index, const uint8_t *ext_addr);
|
||||
|
||||
/**
|
||||
* @brief Get the device current multipan interface enable mask.
|
||||
*
|
||||
* @return Current multipan interface enable mask.
|
||||
*
|
||||
*/
|
||||
uint8_t esp_ieee802154_get_multipan_enable(void);
|
||||
|
||||
/**
|
||||
* @brief Enable specific interface for the device.
|
||||
*
|
||||
* As an example, call `esp_ieee802154_set_multipan_enable(BIT(ESP_IEEE802154_MULTIPAN_0) | BIT(ESP_IEEE802154_MULTIPAN_1));`
|
||||
* to enable multipan interface 0 and 1.
|
||||
*
|
||||
* @param[in] mask The multipan interface bit mask.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK on success.
|
||||
* - ESP_FAIL on failure.
|
||||
*/
|
||||
esp_err_t esp_ieee802154_set_multipan_enable(uint8_t mask);
|
||||
|
||||
/**
|
||||
* @brief Add a pending address to the multipan table for the specified interface.
|
||||
*
|
||||
* @note This API should be called only when the IEEE 802.15.4 subsystem is enabled.
|
||||
*
|
||||
* @param inf_index Index of the interface.
|
||||
* @param addr Pointer to the address to add.
|
||||
* @param is_short True if the address is a short address, false if extended.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK on success.
|
||||
* - ESP_FAIL on failure.
|
||||
*/
|
||||
esp_err_t esp_ieee802154_multipan_add_pending_addr(esp_ieee802154_multipan_index_t inf_index, const uint8_t *addr, bool is_short);
|
||||
|
||||
/**
|
||||
* @brief Remove a pending address from the multipan table for the specified interface.
|
||||
*
|
||||
* @note This API should be called only when the IEEE 802.15.4 subsystem is enabled.
|
||||
*
|
||||
* @param inf_index Index of the interface.
|
||||
* @param addr Pointer to the address to remove.
|
||||
* @param is_short True if the address is a short address, false if extended.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK on success.
|
||||
* - ESP_FAIL on failure.
|
||||
*/
|
||||
esp_err_t esp_ieee802154_multipan_clear_pending_addr(esp_ieee802154_multipan_index_t inf_index, const uint8_t *addr, bool is_short);
|
||||
|
||||
/**
|
||||
* @brief Reset the pending address table for the specified interface.
|
||||
*
|
||||
* @note This API clears all pending addresses of the specified type (short or extended) for the interface.
|
||||
*
|
||||
* @param inf_index Index of the interface.
|
||||
* @param is_short True to reset short addresses, false to reset extended addresses.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK on success.
|
||||
* - ESP_FAIL on failure.
|
||||
*/
|
||||
esp_err_t esp_ieee802154_multipan_reset_pending_table(esp_ieee802154_multipan_index_t inf_index, bool is_short);
|
||||
|
||||
/**
|
||||
* @brief Get the auto frame pending mode of the specified multipan interface.
|
||||
*
|
||||
* @note This API returns the logical pending mode configured for a given multipan
|
||||
* interface. The value is used by the ACK generation logic together with the
|
||||
* per-interface pending address table.
|
||||
*
|
||||
* @param inf_index Index of the multipan interface.
|
||||
*
|
||||
* @return
|
||||
* - Current pending mode of type refer to esp_ieee802154_pending_mode_t
|
||||
*/
|
||||
esp_ieee802154_pending_mode_t esp_ieee802154_multipan_get_pending_mode(esp_ieee802154_multipan_index_t inf_index);
|
||||
|
||||
/**
|
||||
* @brief Set the auto frame pending mode of the specified multipan interface.
|
||||
*
|
||||
* @note This API configures the logical pending mode for a given multipan interface.
|
||||
* The configured mode is used by the ACK generation logic together with the
|
||||
* per-interface pending address table.
|
||||
*
|
||||
* @param inf_index Index of the multipan interface.
|
||||
* @param pending_mode Pending mode to set for this interface.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK on success.
|
||||
* - ESP_FAIL on failure.
|
||||
*/
|
||||
esp_err_t esp_ieee802154_multipan_set_pending_mode(esp_ieee802154_multipan_index_t inf_index, esp_ieee802154_pending_mode_t pending_mode);
|
||||
|
||||
/**
|
||||
* @brief Set the IEEE 802.15.4 Radio to sleep state for the specified multipan interface.
|
||||
*
|
||||
* @param[in] idx Index of the multipan interface.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK on success.
|
||||
* - ESP_FAIL on failure.
|
||||
*/
|
||||
esp_err_t esp_ieee802154_multipan_sleep(int8_t idx);
|
||||
|
||||
/**
|
||||
* @brief Set the IEEE 802.15.4 Radio to receive state for the specified multipan interface.
|
||||
*
|
||||
* @param[in] idx Index of the multipan interface.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK on success.
|
||||
* - ESP_FAIL on failure.
|
||||
*/
|
||||
esp_err_t esp_ieee802154_multipan_receive(int8_t idx);
|
||||
|
||||
/**
|
||||
* @brief Set the RxOnWhenIdle mode for the specified multipan interface.
|
||||
*
|
||||
* Each interface owns one bit in an internal mask. The hardware RxOnWhenIdle
|
||||
* setting is enabled when any interface requests it, and is disabled only
|
||||
* when all interface bits are cleared.
|
||||
*
|
||||
* @param[in] idx Index of the multipan interface.
|
||||
* @param[in] enable True to enable RxOnWhenIdle for this interface.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK on success.
|
||||
*/
|
||||
esp_err_t esp_ieee802154_multipan_set_rx_when_idle(int8_t idx, bool enable);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -79,9 +79,9 @@ entries:
|
||||
esp_ieee802154_util: ieee802154_channel_to_freq (noflash)
|
||||
|
||||
if IEEE802154_MULTI_PAN_ENABLE = y:
|
||||
esp_ieee802154: esp_ieee802154_get_multipan_extended_address (noflash)
|
||||
esp_ieee802154: esp_ieee802154_get_multipan_panid (noflash)
|
||||
esp_ieee802154: esp_ieee802154_get_multipan_short_address (noflash)
|
||||
esp_ieee802154_multipan: esp_ieee802154_get_multipan_extended_address (noflash)
|
||||
esp_ieee802154_multipan: esp_ieee802154_get_multipan_panid (noflash)
|
||||
esp_ieee802154_multipan: esp_ieee802154_get_multipan_short_address (noflash)
|
||||
esp_ieee802154_dev: is_broadcast_addr (noflash)
|
||||
esp_ieee802154_dev: is_broadcast_panid (noflash)
|
||||
esp_ieee802154_dev: update_mpf_index (noflash)
|
||||
|
||||
Reference in New Issue
Block a user