feat(openthread): add APIs to clear a single src match short and extended entry in esp radio spinel

This commit is contained in:
Xu Si Yu
2026-06-22 15:58:32 +08:00
parent e1713f44fb
commit f3cf13ad71
2 changed files with 50 additions and 6 deletions

View File

@@ -176,7 +176,8 @@ esp_err_t esp_radio_spinel_set_short_address(uint16_t short_address, esp_radio_s
/**
* @brief Set the extended address.
*
* @param[in] ext_address The extended address.
* @param[in] ext_address The extended address in IEEE 802.15.4 EUI-64 byte order
* (MSB first, same as the address display format).
* @param[in] idx The index of 802.15.4 related protocol stack.
*
* @return
@@ -184,7 +185,7 @@ esp_err_t esp_radio_spinel_set_short_address(uint16_t short_address, esp_radio_s
* - ESP_FAIL on failures
*
*/
esp_err_t esp_radio_spinel_set_extended_address(uint8_t *ext_address, esp_radio_spinel_idx_t idx);
esp_err_t esp_radio_spinel_set_extended_address(const uint8_t *ext_address, esp_radio_spinel_idx_t idx);
/**
* @brief Set the coordinator mode.
@@ -253,6 +254,19 @@ esp_err_t esp_radio_spinel_transmit(uint8_t *frame, uint8_t channel, bool cca, e
*/
esp_err_t esp_radio_spinel_clear_short_entries(esp_radio_spinel_idx_t idx);
/**
* @brief Clear a short address from the source address match table.
*
* @param[in] short_address The short address to be cleared.
* @param[in] idx The index of 802.15.4 related protocol stack.
*
* @return
* - ESP_OK on success
* - ESP_FAIL on failures
*
*/
esp_err_t esp_radio_spinel_clear_short_entry(uint16_t short_address, esp_radio_spinel_idx_t idx);
/**
* @brief Add a short address to the source address match table.
*
@@ -278,10 +292,26 @@ esp_err_t esp_radio_spinel_add_short_entry(uint16_t short_address, esp_radio_spi
*/
esp_err_t esp_radio_spinel_clear_extended_entries(esp_radio_spinel_idx_t idx);
/**
* @brief Clear an extended address from the source address match table.
*
* @param[in] ext_address The extended address in IEEE 802.15.4 EUI-64 byte order
* (MSB first, same as the address display format).
* @param[in] idx The index of 802.15.4 related protocol stack.
*
* @return
* - ESP_OK on success
* - ESP_FAIL on failures
*
*/
esp_err_t esp_radio_spinel_clear_extended_entry(const uint8_t *ext_address, esp_radio_spinel_idx_t idx);
/**
* @brief Add an extended address to the source address match table.
*
* @param[in] ext_address The extended address to be added.
* @param[in] ext_address The extended address in IEEE 802.15.4 EUI-64 byte order
* (MSB first, same as the address display format).
* @param[in] idx The index of 802.15.4 related protocol stack.
*
* @return
@@ -289,7 +319,7 @@ esp_err_t esp_radio_spinel_clear_extended_entries(esp_radio_spinel_idx_t idx);
* - ESP_FAIL on failures
*
*/
esp_err_t esp_radio_spinel_add_extended_entry(uint8_t *ext_address, esp_radio_spinel_idx_t idx);
esp_err_t esp_radio_spinel_add_extended_entry(const uint8_t *ext_address, esp_radio_spinel_idx_t idx);
/**
* @brief Sets the status of promiscuous mode.

View File

@@ -109,6 +109,8 @@ void ReceiveDone(otInstance *aInstance, otRadioFrame *aFrame, otError aError)
frame[0] = aFrame->mLength;
memcpy((void *)(frame + 1), aFrame->mPsdu, frame[0]);
frame_info.rssi = aFrame->mInfo.mRxInfo.mRssi;
frame_info.channel = aFrame->mChannel;
frame_info.lqi = aFrame->mInfo.mRxInfo.mLqi;
frame_info.timestamp = aFrame->mInfo.mRxInfo.mTimestamp;
frame_info.pending = aFrame->mInfo.mRxInfo.mAckedWithFramePending;
s_esp_radio_spinel_callbacks[idx].receive_done(frame, &frame_info);
@@ -251,7 +253,7 @@ esp_err_t esp_radio_spinel_set_short_address(uint16_t short_address, esp_radio_s
return (s_radio[idx].SetShortAddress(short_address) == OT_ERROR_NONE) ? ESP_OK : ESP_FAIL;
}
esp_err_t esp_radio_spinel_set_extended_address(uint8_t *ext_address, esp_radio_spinel_idx_t idx)
esp_err_t esp_radio_spinel_set_extended_address(const uint8_t *ext_address, esp_radio_spinel_idx_t idx)
{
otExtAddress aExtAddress;
memcpy(aExtAddress.m8, (void *)ext_address, OT_EXT_ADDRESS_SIZE);
@@ -284,6 +286,11 @@ esp_err_t esp_radio_spinel_clear_short_entries(esp_radio_spinel_idx_t idx)
return (s_radio[idx].ClearSrcMatchShortEntries() == OT_ERROR_NONE) ? ESP_OK : ESP_FAIL;
}
esp_err_t esp_radio_spinel_clear_short_entry(uint16_t short_address, esp_radio_spinel_idx_t idx)
{
return (s_radio[idx].ClearSrcMatchShortEntry(short_address) == OT_ERROR_NONE) ? ESP_OK : ESP_FAIL;
}
esp_err_t esp_radio_spinel_add_short_entry(uint16_t short_address, esp_radio_spinel_idx_t idx)
{
return (s_radio[idx].AddSrcMatchShortEntry(short_address) == OT_ERROR_NONE) ? ESP_OK : ESP_FAIL;
@@ -294,7 +301,14 @@ esp_err_t esp_radio_spinel_clear_extended_entries(esp_radio_spinel_idx_t idx)
return (s_radio[idx].ClearSrcMatchExtEntries() == OT_ERROR_NONE) ? ESP_OK : ESP_FAIL;
}
esp_err_t esp_radio_spinel_add_extended_entry(uint8_t *ext_address, esp_radio_spinel_idx_t idx)
esp_err_t esp_radio_spinel_clear_extended_entry(const uint8_t *ext_address, esp_radio_spinel_idx_t idx)
{
otExtAddress aExtAddress;
memcpy(aExtAddress.m8, (void *)ext_address, OT_EXT_ADDRESS_SIZE);
return (s_radio[idx].ClearSrcMatchExtEntry(aExtAddress) == OT_ERROR_NONE) ? ESP_OK : ESP_FAIL;
}
esp_err_t esp_radio_spinel_add_extended_entry(const uint8_t *ext_address, esp_radio_spinel_idx_t idx)
{
otExtAddress aExtAddress;
memcpy(aExtAddress.m8, (void *)ext_address, OT_EXT_ADDRESS_SIZE);