mirror of
https://github.com/espressif/openthread.git
synced 2026-08-07 11:17:46 +00:00
[rcp] always support sleep-to-tx capability (#10856)
This commit declares sleep-to-tx capability on RCP side so that the host doesn't need to issue Receive() before Transmit().
This commit is contained in:
@@ -139,6 +139,10 @@ otRadioCaps SubMac::GetCaps(void) const
|
||||
caps |= OT_RADIO_CAPS_RX_ON_WHEN_IDLE;
|
||||
#endif
|
||||
|
||||
#if OPENTHREAD_RADIO
|
||||
caps |= OT_RADIO_CAPS_SLEEP_TO_TX;
|
||||
#endif
|
||||
|
||||
#else
|
||||
caps = OT_RADIO_CAPS_ACK_TIMEOUT | OT_RADIO_CAPS_CSMA_BACKOFF | OT_RADIO_CAPS_TRANSMIT_RETRIES |
|
||||
OT_RADIO_CAPS_ENERGY_SCAN | OT_RADIO_CAPS_TRANSMIT_SEC | OT_RADIO_CAPS_TRANSMIT_TIMING |
|
||||
|
||||
@@ -89,7 +89,6 @@ TEST(RadioSpinelTransmit, shouldPassDesiredTxPowerToRadioPlatform)
|
||||
.Times(1);
|
||||
|
||||
ASSERT_EQ(platform.mRadioSpinel.Enable(FakePlatform::CurrentInstance()), kErrorNone);
|
||||
ASSERT_EQ(platform.mRadioSpinel.Receive(11), kErrorNone);
|
||||
ASSERT_EQ(platform.mRadioSpinel.Transmit(txFrame), kErrorNone);
|
||||
|
||||
platform.GoInMs(1000);
|
||||
@@ -129,7 +128,6 @@ TEST(RadioSpinelTransmit, shouldCauseSwitchingToRxChannelAfterTxDone)
|
||||
txFrame.mInfo.mTxInfo.mRxChannelAfterTxDone = 25;
|
||||
|
||||
ASSERT_EQ(platform.mRadioSpinel.Enable(FakePlatform::CurrentInstance()), kErrorNone);
|
||||
ASSERT_EQ(platform.mRadioSpinel.Receive(11), kErrorNone);
|
||||
ASSERT_EQ(platform.mRadioSpinel.Transmit(txFrame), kErrorNone);
|
||||
platform.GoInMs(1000);
|
||||
EXPECT_EQ(platform.GetReceiveChannel(), 25);
|
||||
@@ -186,7 +184,6 @@ TEST(RadioSpinelTransmit, shouldSkipCsmaCaWhenDisabled)
|
||||
EXPECT_CALL(platform, Receive(11)).Times(1);
|
||||
|
||||
ASSERT_EQ(platform.mRadioSpinel.Enable(FakePlatform::CurrentInstance()), kErrorNone);
|
||||
ASSERT_EQ(platform.mRadioSpinel.Receive(12), kErrorNone);
|
||||
ASSERT_EQ(platform.mRadioSpinel.Transmit(txFrame), kErrorNone);
|
||||
|
||||
platform.GoInMs(1000);
|
||||
@@ -237,14 +234,12 @@ TEST(RadioSpinelTransmit, shouldPerformCsmaCaWhenEnabled)
|
||||
})))
|
||||
.Times(1);
|
||||
|
||||
EXPECT_CALL(platform, Receive).Times(AnyNumber());
|
||||
// Receive(11) will be called exactly twice:
|
||||
// 1. one time to prepare for TX because the fake platform doesn't support sleep-to-tx capability.
|
||||
// 2. one time in CSMA backoff because rx-on-when-idle is true.
|
||||
EXPECT_CALL(platform, Receive(11)).Times(2);
|
||||
|
||||
ASSERT_EQ(platform.mRadioSpinel.Enable(FakePlatform::CurrentInstance()), kErrorNone);
|
||||
ASSERT_EQ(platform.mRadioSpinel.Receive(12), kErrorNone);
|
||||
ASSERT_EQ(platform.mRadioSpinel.Transmit(txFrame), kErrorNone);
|
||||
|
||||
platform.GoInMs(1000);
|
||||
|
||||
Reference in New Issue
Block a user