[rcp] fix transaction ID caching and guard max power table code (#8408)

- Separate out max power table related code.
- Cache the transaction ID for async response only if
  otLinkRawTransmit() succeeds.
This commit is contained in:
parag-silabs
2022-12-15 21:37:12 -08:00
committed by GitHub
parent 8ec9ede47a
commit f2ed78770e
2 changed files with 6 additions and 4 deletions
+2
View File
@@ -2388,6 +2388,7 @@ void RadioSpinel<InterfaceType, ProcessContextType>::RestoreProperties(void)
SuccessOrDie(Set(SPINEL_PROP_PHY_FEM_LNA_GAIN, SPINEL_DATATYPE_INT8_S, mFemLnaGain));
}
#if OPENTHREAD_POSIX_CONFIG_MAX_POWER_TABLE_ENABLE
for (uint8_t channel = Radio::kChannelMin; channel <= Radio::kChannelMax; channel++)
{
int8_t power = mMaxPowerTable.GetTransmitPower(channel);
@@ -2403,6 +2404,7 @@ void RadioSpinel<InterfaceType, ProcessContextType>::RestoreProperties(void)
}
}
}
#endif // OPENTHREAD_POSIX_CONFIG_MAX_POWER_TABLE_ENABLE
CalcRcpTimeOffset();
}
+4 -4
View File
@@ -446,12 +446,12 @@ otError NcpBase::HandlePropertySet_SPINEL_PROP_STREAM_RAW(uint8_t aHeader)
SuccessOrExit(error = DecodeStreamRawTxRequest(*frame));
// Cache the transaction ID for async response
mCurTransmitTID = SPINEL_HEADER_GET_TID(aHeader);
// Pass frame to the radio layer. Note, this fails if we
// haven't enabled raw stream or are already transmitting.
error = otLinkRawTransmit(mInstance, &NcpBase::LinkRawTransmitDone);
SuccessOrExit(error = otLinkRawTransmit(mInstance, &NcpBase::LinkRawTransmitDone));
// Cache the transaction ID for async response
mCurTransmitTID = SPINEL_HEADER_GET_TID(aHeader);
exit: