Skip to content

Commit

Permalink
[rcp] apply receive channel after tx done (openthread#10649)
Browse files Browse the repository at this point in the history
This commit applies the RxChannelAfterTxDone in the tx done callbacks,
so that vendors doesn't have to implement in platform layer.
  • Loading branch information
bukepo authored Sep 27, 2024
1 parent a9805ed commit 6e46e2e
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/core/radio/radio_platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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());

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 6e46e2e

Please sign in to comment.