mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
fix(openthread): set spinel frame buffer to member variables
This commit is contained in:
parent
1688c699db
commit
65a261b290
@ -260,7 +260,7 @@ menu "OpenThread"
|
||||
|
||||
config OPENTHREAD_SPINEL_RX_FRAME_BUFFER_SIZE
|
||||
int "The size of openthread spinel rx frame buffer"
|
||||
depends on OPENTHREAD_ENABLED
|
||||
depends on OPENTHREAD_ENABLED || OPENTHREAD_SPINEL_ONLY
|
||||
default 1024
|
||||
range 512 8192
|
||||
|
||||
|
@ -110,8 +110,12 @@ void esp_radio_spinel_init(esp_radio_spinel_idx_t idx);
|
||||
*
|
||||
* @param[in] idx The index of 802.15.4 related protocol stack.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK on success
|
||||
* - ESP_FAIL on failures
|
||||
*
|
||||
*/
|
||||
void esp_radio_spinel_enable(esp_radio_spinel_idx_t idx);
|
||||
esp_err_t esp_radio_spinel_enable(esp_radio_spinel_idx_t idx);
|
||||
|
||||
/**
|
||||
* @brief Set the pending mode.
|
||||
@ -119,8 +123,12 @@ void esp_radio_spinel_enable(esp_radio_spinel_idx_t idx);
|
||||
* @param[in] pending_mode The pending mode.
|
||||
* @param[in] idx The index of 802.15.4 related protocol stack.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK on success
|
||||
* - ESP_FAIL on failures
|
||||
*
|
||||
*/
|
||||
void esp_radio_spinel_set_pending_mode(esp_ieee802154_pending_mode_t pending_mode, esp_radio_spinel_idx_t idx);
|
||||
esp_err_t esp_radio_spinel_set_pending_mode(esp_ieee802154_pending_mode_t pending_mode, esp_radio_spinel_idx_t idx);
|
||||
|
||||
/**
|
||||
* @brief Get the EUI-64.
|
||||
@ -128,8 +136,12 @@ void esp_radio_spinel_set_pending_mode(esp_ieee802154_pending_mode_t pending_mod
|
||||
* @param[in] eui64 A pointer to the EUI-64.
|
||||
* @param[in] idx The index of 802.15.4 related protocol stack.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK on success
|
||||
* - ESP_FAIL on failures
|
||||
*
|
||||
*/
|
||||
void esp_radio_spinel_get_eui64(uint8_t *eui64, esp_radio_spinel_idx_t idx);
|
||||
esp_err_t esp_radio_spinel_get_eui64(uint8_t *eui64, esp_radio_spinel_idx_t idx);
|
||||
|
||||
/**
|
||||
* @brief Set the panid.
|
||||
@ -137,8 +149,12 @@ void esp_radio_spinel_get_eui64(uint8_t *eui64, esp_radio_spinel_idx_t idx);
|
||||
* @param[in] panid The panid.
|
||||
* @param[in] idx The index of 802.15.4 related protocol stack.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK on success
|
||||
* - ESP_FAIL on failures
|
||||
*
|
||||
*/
|
||||
void esp_radio_spinel_set_panid(uint16_t panid, esp_radio_spinel_idx_t idx);
|
||||
esp_err_t esp_radio_spinel_set_panid(uint16_t panid, esp_radio_spinel_idx_t idx);
|
||||
|
||||
/**
|
||||
* @brief Set the short address.
|
||||
@ -146,8 +162,12 @@ void esp_radio_spinel_set_panid(uint16_t panid, esp_radio_spinel_idx_t idx);
|
||||
* @param[in] short_address The short address.
|
||||
* @param[in] idx The index of 802.15.4 related protocol stack.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK on success
|
||||
* - ESP_FAIL on failures
|
||||
*
|
||||
*/
|
||||
void esp_radio_spinel_set_short_address(uint16_t short_address, esp_radio_spinel_idx_t idx);
|
||||
esp_err_t esp_radio_spinel_set_short_address(uint16_t short_address, esp_radio_spinel_idx_t idx);
|
||||
|
||||
/**
|
||||
* @brief Set the extended address.
|
||||
@ -155,8 +175,12 @@ void esp_radio_spinel_set_short_address(uint16_t short_address, esp_radio_spinel
|
||||
* @param[in] ext_address The extended address.
|
||||
* @param[in] idx The index of 802.15.4 related protocol stack.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK on success
|
||||
* - ESP_FAIL on failures
|
||||
*
|
||||
*/
|
||||
void 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(uint8_t *ext_address, esp_radio_spinel_idx_t idx);
|
||||
|
||||
/**
|
||||
* @brief Set the coordinator mode.
|
||||
@ -164,8 +188,12 @@ void esp_radio_spinel_set_extended_address(uint8_t *ext_address, esp_radio_spine
|
||||
* @param[in] enable Enable or disable the coordinator mode.
|
||||
* @param[in] idx The index of 802.15.4 related protocol stack.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK on success
|
||||
* - ESP_FAIL on failures
|
||||
*
|
||||
*/
|
||||
void esp_radio_spinel_set_pan_coord(bool enable, esp_radio_spinel_idx_t idx);
|
||||
esp_err_t esp_radio_spinel_set_pan_coord(bool enable, esp_radio_spinel_idx_t idx);
|
||||
|
||||
/**
|
||||
* @brief Enable the RCP reception.
|
||||
@ -173,8 +201,12 @@ void esp_radio_spinel_set_pan_coord(bool enable, esp_radio_spinel_idx_t idx);
|
||||
* @param[in] channel The channel of reception.
|
||||
* @param[in] idx The index of 802.15.4 related protocol stack.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK on success
|
||||
* - ESP_FAIL on failures
|
||||
*
|
||||
*/
|
||||
void esp_radio_spinel_receive(uint8_t channel, esp_radio_spinel_idx_t idx);
|
||||
esp_err_t esp_radio_spinel_receive(uint8_t channel, esp_radio_spinel_idx_t idx);
|
||||
|
||||
/**
|
||||
* @brief Perform the energy scan.
|
||||
@ -183,8 +215,12 @@ void esp_radio_spinel_receive(uint8_t channel, esp_radio_spinel_idx_t idx);
|
||||
* @param[in] scan_duration The duration for energy scan.
|
||||
* @param[in] idx The index of 802.15.4 related protocol stack.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK on success
|
||||
* - ESP_FAIL on failures
|
||||
*
|
||||
*/
|
||||
void esp_radio_spinel_energy_scan(uint8_t scan_channel, uint16_t scan_duration, esp_radio_spinel_idx_t idx);
|
||||
esp_err_t esp_radio_spinel_energy_scan(uint8_t scan_channel, uint16_t scan_duration, esp_radio_spinel_idx_t idx);
|
||||
|
||||
/**
|
||||
* @brief Perform the transmission.
|
||||
@ -194,16 +230,24 @@ void esp_radio_spinel_energy_scan(uint8_t scan_channel, uint16_t scan_duration,
|
||||
* @param[in] cca Perform clear channel assessment(if it's true) or not(if it's false)
|
||||
* @param[in] idx The index of 802.15.4 related protocol stack.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK on success
|
||||
* - ESP_FAIL on failures
|
||||
*
|
||||
*/
|
||||
void esp_radio_spinel_transmit(uint8_t *frame, uint8_t channel, bool cca, esp_radio_spinel_idx_t idx);
|
||||
esp_err_t esp_radio_spinel_transmit(uint8_t *frame, uint8_t channel, bool cca, esp_radio_spinel_idx_t idx);
|
||||
|
||||
/**
|
||||
* @brief Clear all short addresses from the source address match table.
|
||||
*
|
||||
* @param[in] idx The index of 802.15.4 related protocol stack.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK on success
|
||||
* - ESP_FAIL on failures
|
||||
*
|
||||
*/
|
||||
void esp_radio_spinel_clear_short_entries(esp_radio_spinel_idx_t idx);
|
||||
esp_err_t esp_radio_spinel_clear_short_entries(esp_radio_spinel_idx_t idx);
|
||||
|
||||
/**
|
||||
* @brief Add a short address to the source address match table.
|
||||
@ -223,8 +267,12 @@ esp_err_t esp_radio_spinel_add_short_entry(uint16_t short_address, esp_radio_spi
|
||||
*
|
||||
* @param[in] idx The index of 802.15.4 related protocol stack.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK on success
|
||||
* - ESP_FAIL on failures
|
||||
*
|
||||
*/
|
||||
void esp_radio_spinel_clear_extened_entries(esp_radio_spinel_idx_t idx);
|
||||
esp_err_t esp_radio_spinel_clear_extended_entries(esp_radio_spinel_idx_t idx);
|
||||
|
||||
/**
|
||||
* @brief Add an extended address to the source address match table.
|
||||
@ -237,7 +285,7 @@ void esp_radio_spinel_clear_extened_entries(esp_radio_spinel_idx_t idx);
|
||||
* - ESP_FAIL on failures
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_radio_spinel_add_extened_entry(uint8_t *ext_address, esp_radio_spinel_idx_t idx);
|
||||
esp_err_t esp_radio_spinel_add_extended_entry(uint8_t *ext_address, esp_radio_spinel_idx_t idx);
|
||||
|
||||
/**
|
||||
* @brief Sets the status of promiscuous mode.
|
||||
@ -245,8 +293,12 @@ esp_err_t esp_radio_spinel_add_extened_entry(uint8_t *ext_address, esp_radio_spi
|
||||
* @param[in] enable Whether to enable or disable promiscuous mode.
|
||||
* @param[in] idx The index of 802.15.4 related protocol stack.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK on success
|
||||
* - ESP_FAIL on failures
|
||||
*
|
||||
*/
|
||||
void esp_radio_spinel_set_promiscuous_mode(bool enable, esp_radio_spinel_idx_t idx);
|
||||
esp_err_t esp_radio_spinel_set_promiscuous_mode(bool enable, esp_radio_spinel_idx_t idx);
|
||||
|
||||
/**
|
||||
* @brief Update the ESP radio spinel.
|
||||
@ -271,8 +323,12 @@ void esp_radio_spinel_radio_process(esp_radio_spinel_mainloop_context_t *mainloo
|
||||
*
|
||||
* @param[in] idx The index of 802.15.4 related protocol stack.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK on success
|
||||
* - ESP_FAIL on failures
|
||||
*
|
||||
*/
|
||||
void esp_radio_spinel_sleep(esp_radio_spinel_idx_t idx);
|
||||
esp_err_t esp_radio_spinel_sleep(esp_radio_spinel_idx_t idx);
|
||||
|
||||
/**
|
||||
* @brief Set the radio's transmit power in dBm.
|
||||
@ -280,8 +336,12 @@ void esp_radio_spinel_sleep(esp_radio_spinel_idx_t idx);
|
||||
* @param[in] power The transmit power in dBm.
|
||||
* @param[in] idx The index of 802.15.4 related protocol stack.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK on success
|
||||
* - ESP_FAIL on failures
|
||||
*
|
||||
*/
|
||||
void esp_radio_spinel_set_tx_power(int8_t power, esp_radio_spinel_idx_t idx);
|
||||
esp_err_t esp_radio_spinel_set_tx_power(int8_t power, esp_radio_spinel_idx_t idx);
|
||||
|
||||
/**
|
||||
* @brief Get the radio's transmit power in dBm.
|
||||
@ -289,8 +349,12 @@ void esp_radio_spinel_set_tx_power(int8_t power, esp_radio_spinel_idx_t idx);
|
||||
* @param[in] power A pointer to the transmit power.
|
||||
* @param[in] idx The index of 802.15.4 related protocol stack.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK on success
|
||||
* - ESP_FAIL on failures
|
||||
*
|
||||
*/
|
||||
void esp_radio_spinel_get_tx_power(int8_t *power, esp_radio_spinel_idx_t idx);
|
||||
esp_err_t esp_radio_spinel_get_tx_power(int8_t *power, esp_radio_spinel_idx_t idx);
|
||||
|
||||
/**
|
||||
* @brief Register a handler to process the RCP failure.
|
||||
|
@ -198,6 +198,8 @@ private:
|
||||
esp_radio_spinel_rcp_failure_handler mRcpFailureHandler;
|
||||
esp_radio_spinel_uart_init_handler mUartInitHandler;
|
||||
esp_radio_spinel_uart_deinit_handler mUartDeinitHandler;
|
||||
|
||||
ot::Spinel::FrameBuffer<kMaxFrameSize> encoder_buffer;
|
||||
};
|
||||
|
||||
} // namespace radio_spinel
|
||||
|
@ -195,6 +195,8 @@ private:
|
||||
UartSpinelInterface &operator=(const UartSpinelInterface &);
|
||||
|
||||
esp_openthread_rcp_failure_handler mRcpFailureHandler;
|
||||
|
||||
ot::Spinel::FrameBuffer<kMaxFrameSize> encoder_buffer;
|
||||
};
|
||||
|
||||
} // namespace openthread
|
||||
|
@ -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
|
||||
*/
|
||||
@ -37,3 +37,12 @@
|
||||
#ifndef OPENTHREAD_SPINEL_CONFIG_RCP_CUSTOM_RESTORATION
|
||||
#define OPENTHREAD_SPINEL_CONFIG_RCP_CUSTOM_RESTORATION 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_PLATFORM_RADIO_SPINEL_RX_FRAME_BUFFER_SIZE
|
||||
*
|
||||
* Specifies the rx frame buffer size used by `SpinelInterface` in RCP host code. This is applicable/used when
|
||||
* `RadioSpinel` platform is used.
|
||||
*
|
||||
*/
|
||||
#define OPENTHREAD_CONFIG_PLATFORM_RADIO_SPINEL_RX_FRAME_BUFFER_SIZE CONFIG_OPENTHREAD_SPINEL_RX_FRAME_BUFFER_SIZE
|
||||
|
@ -112,7 +112,9 @@ esp_err_t esp_openthread_rcp_init(void)
|
||||
#endif // CONFIG_OPENTHREAD_RADIO_SPINEL_UART
|
||||
|
||||
ESP_RETURN_ON_FALSE(s_radio.Enable(esp_openthread_get_instance()) == OT_ERROR_NONE, ESP_FAIL, OT_PLAT_LOG_TAG, "Fail to enable radio");
|
||||
#if OPENTHREAD_SPINEL_CONFIG_RCP_RESTORATION_MAX_COUNT > 0
|
||||
s_radio.RestoreProperties();
|
||||
#endif
|
||||
return esp_openthread_platform_workflow_register(&esp_openthread_radio_update, &esp_openthread_radio_process,
|
||||
radiospinel_workflow);
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ esp_err_t UartSpinelInterface::Disable(void)
|
||||
otError UartSpinelInterface::SendFrame(const uint8_t *frame, uint16_t length)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
ot::Spinel::FrameBuffer<kMaxFrameSize> encoder_buffer;
|
||||
encoder_buffer.Clear();
|
||||
ot::Hdlc::Encoder hdlc_encoder(encoder_buffer);
|
||||
|
||||
SuccessOrExit(error = hdlc_encoder.BeginFrame());
|
||||
|
@ -215,67 +215,67 @@ void esp_radio_spinel_init(esp_radio_spinel_idx_t idx)
|
||||
s_radio[idx].Init(s_spinel_interface[idx].GetSpinelInterface(), /*reset_radio=*/true, /*skip_rcp_compatibility_check=*/false, iidList, ot::Spinel::kSpinelHeaderMaxNumIid);
|
||||
}
|
||||
|
||||
void esp_radio_spinel_enable(esp_radio_spinel_idx_t idx)
|
||||
esp_err_t esp_radio_spinel_enable(esp_radio_spinel_idx_t idx)
|
||||
{
|
||||
otInstance *instance = get_instance_from_index(idx);
|
||||
s_radio[idx].Enable(instance);
|
||||
return (s_radio[idx].Enable(instance) == OT_ERROR_NONE) ? ESP_OK : ESP_FAIL;
|
||||
}
|
||||
|
||||
void esp_radio_spinel_set_pending_mode(esp_ieee802154_pending_mode_t pending_mode, esp_radio_spinel_idx_t idx)
|
||||
esp_err_t esp_radio_spinel_set_pending_mode(esp_ieee802154_pending_mode_t pending_mode, esp_radio_spinel_idx_t idx)
|
||||
{
|
||||
s_radio[idx].Set(SPINEL_PROP_VENDOR_ESP_SET_PENDINGMODE, SPINEL_DATATYPE_INT32_S, static_cast<int32_t>(pending_mode));
|
||||
return (s_radio[idx].Set(SPINEL_PROP_VENDOR_ESP_SET_PENDINGMODE, SPINEL_DATATYPE_INT32_S, static_cast<int32_t>(pending_mode)) == OT_ERROR_NONE) ? ESP_OK : ESP_FAIL;
|
||||
}
|
||||
|
||||
void esp_radio_spinel_get_eui64(uint8_t *eui64, esp_radio_spinel_idx_t idx)
|
||||
esp_err_t esp_radio_spinel_get_eui64(uint8_t *eui64, esp_radio_spinel_idx_t idx)
|
||||
{
|
||||
SuccessOrDie(s_radio[idx].GetIeeeEui64(eui64));
|
||||
return (s_radio[idx].GetIeeeEui64(eui64) == OT_ERROR_NONE) ? ESP_OK : ESP_FAIL;
|
||||
}
|
||||
|
||||
void esp_radio_spinel_set_panid(uint16_t panid, esp_radio_spinel_idx_t idx)
|
||||
esp_err_t esp_radio_spinel_set_panid(uint16_t panid, esp_radio_spinel_idx_t idx)
|
||||
{
|
||||
SuccessOrDie(s_radio[idx].SetPanId(panid));
|
||||
return (s_radio[idx].SetPanId(panid) == OT_ERROR_NONE) ? ESP_OK : ESP_FAIL;
|
||||
}
|
||||
|
||||
void esp_radio_spinel_set_short_address(uint16_t short_address, esp_radio_spinel_idx_t idx)
|
||||
esp_err_t esp_radio_spinel_set_short_address(uint16_t short_address, esp_radio_spinel_idx_t idx)
|
||||
{
|
||||
SuccessOrDie(s_radio[idx].SetShortAddress(short_address));
|
||||
return (s_radio[idx].SetShortAddress(short_address) == OT_ERROR_NONE) ? ESP_OK : ESP_FAIL;
|
||||
}
|
||||
|
||||
void 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(uint8_t *ext_address, esp_radio_spinel_idx_t idx)
|
||||
{
|
||||
otExtAddress aExtAddress;
|
||||
memcpy(aExtAddress.m8, (void *)ext_address, OT_EXT_ADDRESS_SIZE);
|
||||
SuccessOrDie(s_radio[idx].SetExtendedAddress(aExtAddress));
|
||||
return (s_radio[idx].SetExtendedAddress(aExtAddress) == OT_ERROR_NONE) ? ESP_OK : ESP_FAIL;
|
||||
}
|
||||
|
||||
void esp_radio_spinel_set_pan_coord(bool enable, esp_radio_spinel_idx_t idx)
|
||||
esp_err_t esp_radio_spinel_set_pan_coord(bool enable, esp_radio_spinel_idx_t idx)
|
||||
{
|
||||
s_radio[idx].Set(SPINEL_PROP_VENDOR_ESP_SET_COORDINATOR, SPINEL_DATATYPE_BOOL_S, enable);
|
||||
return (s_radio[idx].Set(SPINEL_PROP_VENDOR_ESP_SET_COORDINATOR, SPINEL_DATATYPE_BOOL_S, enable) == OT_ERROR_NONE) ? ESP_OK : ESP_FAIL;
|
||||
}
|
||||
|
||||
void esp_radio_spinel_receive(uint8_t channel, esp_radio_spinel_idx_t idx)
|
||||
esp_err_t esp_radio_spinel_receive(uint8_t channel, esp_radio_spinel_idx_t idx)
|
||||
{
|
||||
s_radio[idx].Receive(channel);
|
||||
return (s_radio[idx].Receive(channel) == OT_ERROR_NONE) ? ESP_OK : ESP_FAIL;
|
||||
}
|
||||
|
||||
void esp_radio_spinel_energy_scan(uint8_t scan_channel, uint16_t scan_duration, esp_radio_spinel_idx_t idx)
|
||||
esp_err_t esp_radio_spinel_energy_scan(uint8_t scan_channel, uint16_t scan_duration, esp_radio_spinel_idx_t idx)
|
||||
{
|
||||
s_radio[idx].EnergyScan(scan_channel, scan_duration);
|
||||
return (s_radio[idx].EnergyScan(scan_channel, scan_duration) == OT_ERROR_NONE) ? ESP_OK : ESP_FAIL;
|
||||
}
|
||||
|
||||
void esp_radio_spinel_transmit(uint8_t *frame, uint8_t channel, bool cca, esp_radio_spinel_idx_t idx)
|
||||
esp_err_t esp_radio_spinel_transmit(uint8_t *frame, uint8_t channel, bool cca, esp_radio_spinel_idx_t idx)
|
||||
{
|
||||
s_transmit_frame.mLength = frame[0];
|
||||
s_transmit_frame.mPsdu = frame + 1;
|
||||
s_transmit_frame.mInfo.mTxInfo.mCsmaCaEnabled = cca;
|
||||
s_transmit_frame.mChannel = channel;
|
||||
s_transmit_frame.mInfo.mTxInfo.mRxChannelAfterTxDone = channel;
|
||||
SuccessOrDie(s_radio[idx].Transmit(s_transmit_frame));
|
||||
return (s_radio[idx].Transmit(s_transmit_frame) == OT_ERROR_NONE) ? ESP_OK : ESP_FAIL;
|
||||
}
|
||||
|
||||
void esp_radio_spinel_clear_short_entries(esp_radio_spinel_idx_t idx)
|
||||
esp_err_t esp_radio_spinel_clear_short_entries(esp_radio_spinel_idx_t idx)
|
||||
{
|
||||
SuccessOrDie(s_radio[idx].ClearSrcMatchShortEntries());
|
||||
return (s_radio[idx].ClearSrcMatchShortEntries() == 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)
|
||||
@ -283,21 +283,21 @@ esp_err_t esp_radio_spinel_add_short_entry(uint16_t short_address, esp_radio_spi
|
||||
return (s_radio[idx].AddSrcMatchShortEntry(short_address) == OT_ERROR_NONE) ? ESP_OK : ESP_FAIL;
|
||||
}
|
||||
|
||||
void esp_radio_spinel_clear_extened_entries(esp_radio_spinel_idx_t idx)
|
||||
esp_err_t esp_radio_spinel_clear_extended_entries(esp_radio_spinel_idx_t idx)
|
||||
{
|
||||
SuccessOrDie(s_radio[idx].ClearSrcMatchExtEntries());
|
||||
return (s_radio[idx].ClearSrcMatchExtEntries() == OT_ERROR_NONE) ? ESP_OK : ESP_FAIL;
|
||||
}
|
||||
|
||||
esp_err_t esp_radio_spinel_add_extened_entry(uint8_t *ext_address, esp_radio_spinel_idx_t idx)
|
||||
esp_err_t esp_radio_spinel_add_extended_entry(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].AddSrcMatchExtEntry(aExtAddress) == OT_ERROR_NONE) ? ESP_OK : ESP_FAIL;
|
||||
}
|
||||
|
||||
void esp_radio_spinel_set_promiscuous_mode(bool enable, esp_radio_spinel_idx_t idx)
|
||||
esp_err_t esp_radio_spinel_set_promiscuous_mode(bool enable, esp_radio_spinel_idx_t idx)
|
||||
{
|
||||
SuccessOrDie(s_radio[idx].SetPromiscuous(enable));
|
||||
return (s_radio[idx].SetPromiscuous(enable) == OT_ERROR_NONE) ? ESP_OK : ESP_FAIL;
|
||||
}
|
||||
|
||||
void esp_radio_spinel_radio_update(esp_radio_spinel_mainloop_context_t *mainloop_context, esp_radio_spinel_idx_t idx)
|
||||
@ -310,21 +310,23 @@ void esp_radio_spinel_radio_process(esp_radio_spinel_mainloop_context_t *mainloo
|
||||
s_radio[idx].Process(static_cast<void *>(mainloop_context));
|
||||
}
|
||||
|
||||
void esp_radio_spinel_sleep(esp_radio_spinel_idx_t idx)
|
||||
esp_err_t esp_radio_spinel_sleep(esp_radio_spinel_idx_t idx)
|
||||
{
|
||||
s_radio[idx].Sleep();
|
||||
return (s_radio[idx].Sleep() == OT_ERROR_NONE) ? ESP_OK : ESP_FAIL;
|
||||
}
|
||||
|
||||
void esp_radio_spinel_set_tx_power(int8_t power, esp_radio_spinel_idx_t idx)
|
||||
esp_err_t esp_radio_spinel_set_tx_power(int8_t power, esp_radio_spinel_idx_t idx)
|
||||
{
|
||||
s_radio[idx].SetTransmitPower(power);
|
||||
return (s_radio[idx].SetTransmitPower(power) == OT_ERROR_NONE) ? ESP_OK : ESP_FAIL;
|
||||
}
|
||||
|
||||
void esp_radio_spinel_get_tx_power(int8_t *power, esp_radio_spinel_idx_t idx)
|
||||
esp_err_t esp_radio_spinel_get_tx_power(int8_t *power, esp_radio_spinel_idx_t idx)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
int8_t aPower;
|
||||
s_radio[idx].GetTransmitPower(aPower);
|
||||
error = s_radio[idx].GetTransmitPower(aPower);
|
||||
*power = aPower;
|
||||
return (error == OT_ERROR_NONE) ? ESP_OK : ESP_FAIL;
|
||||
}
|
||||
|
||||
void esp_radio_spinel_register_rcp_failure_handler(esp_radio_spinel_rcp_failure_handler handler, esp_radio_spinel_idx_t idx)
|
||||
|
@ -76,7 +76,7 @@ esp_err_t UartSpinelInterface::Disable(void)
|
||||
otError UartSpinelInterface::SendFrame(const uint8_t *frame, uint16_t length)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
ot::Spinel::FrameBuffer<kMaxFrameSize> encoder_buffer;
|
||||
encoder_buffer.Clear();
|
||||
ot::Hdlc::Encoder hdlc_encoder(encoder_buffer);
|
||||
|
||||
SuccessOrExit(error = hdlc_encoder.BeginFrame());
|
||||
|
Loading…
Reference in New Issue
Block a user