From 98871be8ee12619273ca6c36c86c82b91cb7e58f Mon Sep 17 00:00:00 2001 From: xiaqilin Date: Wed, 14 Dec 2022 17:51:28 +0800 Subject: [PATCH] ieee802154: add multipan api --- .../ieee802154/include/esp_ieee802154.h | 77 ++++++++++++++++++- .../ieee802154/include/esp_ieee802154_types.h | 10 +++ components/ieee802154/lib | 2 +- 3 files changed, 87 insertions(+), 2 deletions(-) diff --git a/components/ieee802154/include/esp_ieee802154.h b/components/ieee802154/include/esp_ieee802154.h index 0cee0b56a7..d2e91e01cc 100644 --- a/components/ieee802154/include/esp_ieee802154.h +++ b/components/ieee802154/include/esp_ieee802154.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -184,6 +184,81 @@ void esp_ieee802154_get_extended_address(uint8_t *ext_addr); */ void 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. + * + */ +void 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. + * + */ +void 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. + * + */ +void 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. + * + */ +void 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. + * + */ +void esp_ieee802154_set_multipan_enable(uint8_t mask); + /** * @brief Get the device coordinator. * diff --git a/components/ieee802154/include/esp_ieee802154_types.h b/components/ieee802154/include/esp_ieee802154_types.h index 4393de7640..5769c4cc3a 100644 --- a/components/ieee802154/include/esp_ieee802154_types.h +++ b/components/ieee802154/include/esp_ieee802154_types.h @@ -58,6 +58,16 @@ typedef enum { ESP_IEEE802154_AUTO_PENDING_ZIGBEE, /*!< Frame pending bit set to 0 only if src address is short address and matches in table, in the ack to Data Request */ } esp_ieee802154_pending_mode_t; +/** +* @brief The four groups of mac filter interface index. +*/ +typedef enum { + ESP_IEEE802154_MULTIPAN_0 = 0, + ESP_IEEE802154_MULTIPAN_1 = 1, + ESP_IEEE802154_MULTIPAN_2 = 2, + ESP_IEEE802154_MULTIPAN_3 = 3, +} esp_ieee802154_multipan_index_t; + /** * @brief The information of received 15.4 frame. * diff --git a/components/ieee802154/lib b/components/ieee802154/lib index 6ddc1b2d80..c9fb54daa7 160000 --- a/components/ieee802154/lib +++ b/components/ieee802154/lib @@ -1 +1 @@ -Subproject commit 6ddc1b2d80d7db565f144f76e60f77a0f98a2cbd +Subproject commit c9fb54daa7c9d9c7a3322c332bcf2ff6a6930d94