[spinel] add an API to enable/disable the RCP restoration feature (#11011)

This commit is contained in:
Zhanglong Xia
2024-12-10 07:42:29 -08:00
committed by GitHub
parent fe7d34f9d8
commit 124f0508cb
4 changed files with 24 additions and 0 deletions
+3
View File
@@ -90,6 +90,7 @@ RadioSpinel::RadioSpinel(void)
, mSrcMatchShortEntryCount(0) , mSrcMatchShortEntryCount(0)
, mSrcMatchExtEntryCount(0) , mSrcMatchExtEntryCount(0)
, mSrcMatchEnabled(false) , mSrcMatchEnabled(false)
, mRcpRestorationEnabled(true)
, mMacKeySet(false) , mMacKeySet(false)
, mCcaEnergyDetectThresholdSet(false) , mCcaEnergyDetectThresholdSet(false)
, mTransmitPowerSet(false) , mTransmitPowerSet(false)
@@ -2039,6 +2040,8 @@ void RadioSpinel::RecoverFromRcpFailure(void)
State recoveringState = mState; State recoveringState = mState;
bool skipReset = false; bool skipReset = false;
VerifyOrExit(mRcpRestorationEnabled);
if (mRcpFailure == kRcpFailureNone) if (mRcpFailure == kRcpFailureNone)
{ {
ExitNow(); ExitNow();
+10
View File
@@ -1078,6 +1078,15 @@ public:
*/ */
void SetTimeSyncState(bool aOn) { mTimeSyncOn = aOn; } void SetTimeSyncState(bool aOn) { mTimeSyncOn = aOn; }
#if OPENTHREAD_SPINEL_CONFIG_RCP_RESTORATION_MAX_COUNT > 0
/**
* Enables or disables the RCP restoration feature.
*
* @param[in] aEnabled TRUE to enable the RCP restoration feature, FALSE otherwise.
*/
void SetRcpRestorationEnabled(bool aEnabled) { mRcpRestorationEnabled = aEnabled; }
#endif
private: private:
enum enum
{ {
@@ -1283,6 +1292,7 @@ private:
int8_t mFemLnaGain; int8_t mFemLnaGain;
bool mCoexEnabled : 1; bool mCoexEnabled : 1;
bool mSrcMatchEnabled : 1; bool mSrcMatchEnabled : 1;
bool mRcpRestorationEnabled : 1;
bool mMacKeySet : 1; ///< Whether MAC key has been set. bool mMacKeySet : 1; ///< Whether MAC key has been set.
bool mCcaEnergyDetectThresholdSet : 1; ///< Whether CCA energy detect threshold has been set. bool mCcaEnergyDetectThresholdSet : 1; ///< Whether CCA energy detect threshold has been set.
@@ -320,6 +320,13 @@ void otSysTrelInit(const char *aInterfaceName);
*/ */
void otSysTrelDeinit(void); void otSysTrelDeinit(void);
/**
* Enables or disables the RCP restoration feature.
*
* @param[in] aEnabled TRUE to enable the RCP restoration feature, FALSE otherwise.
*/
void otSysSetRcpRestorationEnabled(bool aEnabled);
#ifdef __cplusplus #ifdef __cplusplus
} // end of extern "C" } // end of extern "C"
#endif #endif
+4
View File
@@ -1070,3 +1070,7 @@ const otRcpInterfaceMetrics *otSysGetRcpInterfaceMetrics(void)
{ {
return sRadio.GetSpinelInterface().GetRcpInterfaceMetrics(); return sRadio.GetSpinelInterface().GetRcpInterfaceMetrics();
} }
#if OPENTHREAD_SPINEL_CONFIG_RCP_RESTORATION_MAX_COUNT > 0
void otSysSetRcpRestorationEnabled(bool aEnabled) { return GetRadioSpinel().SetRcpRestorationEnabled(aEnabled); }
#endif