[rcp] apply receive channel after tx done (#10649)

This commit applies the RxChannelAfterTxDone in the tx done callbacks,
so that vendors doesn't have to implement in platform layer.
This commit is contained in:
Yakun Xu
2024-09-27 09:11:46 -07:00
committed by GitHub
parent a9805ed93a
commit 6e46e2e9f1
+13
View File
@@ -30,6 +30,8 @@
* This file implements the radio platform callbacks into OpenThread and default/weak radio platform APIs.
*/
#include <openthread/instance.h>
#include <openthread/platform/radio.h>
#include <openthread/platform/time.h>
#include "instance/instance.hpp"
@@ -83,6 +85,12 @@ extern "C" void otPlatRadioTxDone(otInstance *aInstance, otRadioFrame *aFrame, o
Instance &instance = AsCoreType(aInstance);
Mac::TxFrame &txFrame = *static_cast<Mac::TxFrame *>(aFrame);
Mac::RxFrame *ackFrame = static_cast<Mac::RxFrame *>(aAckFrame);
#if OPENTHREAD_RADIO
uint8_t channel = txFrame.mInfo.mTxInfo.mRxChannelAfterTxDone;
OT_ASSERT((otPlatRadioGetSupportedChannelMask(aInstance) & (1UL << channel)) != 0);
IgnoreError(otPlatRadioReceive(aInstance, channel));
#endif
VerifyOrExit(instance.IsInitialized());
@@ -141,7 +149,12 @@ extern "C" void otPlatDiagRadioReceiveDone(otInstance *aInstance, otRadioFrame *
extern "C" void otPlatDiagRadioTransmitDone(otInstance *aInstance, otRadioFrame *aFrame, otError aError)
{
Mac::TxFrame &txFrame = *static_cast<Mac::TxFrame *>(aFrame);
#if OPENTHREAD_RADIO
uint8_t channel = txFrame.mInfo.mTxInfo.mRxChannelAfterTxDone;
OT_ASSERT((otPlatRadioGetSupportedChannelMask(aInstance) & (1UL << channel)) != 0);
IgnoreError(otPlatRadioReceive(aInstance, channel));
#endif
#if OPENTHREAD_CONFIG_MULTI_RADIO
txFrame.SetRadioType(Mac::kRadioTypeIeee802154);
#endif