mirror of
https://github.com/espressif/openthread.git
synced 2026-08-20 09:29:51 +00:00
[low-power] enable CCA sampling before CSL transmission (#5862)
CCA should be performed before CSL transmission. This commit enables CCA for CSL transmissions on nRF platform.
This commit is contained in:
@@ -477,9 +477,8 @@ otError otPlatRadioTransmit(otInstance *aInstance, otRadioFrame *aFrame)
|
||||
#if OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2
|
||||
if (aFrame->mInfo.mTxInfo.mTxDelay != 0)
|
||||
{
|
||||
if (!nrf_802154_transmit_raw_at(&aFrame->mPsdu[-1], aFrame->mInfo.mTxInfo.mCsmaCaEnabled,
|
||||
aFrame->mInfo.mTxInfo.mTxDelayBaseTime, aFrame->mInfo.mTxInfo.mTxDelay,
|
||||
aFrame->mChannel))
|
||||
if (!nrf_802154_transmit_raw_at(&aFrame->mPsdu[-1], true, aFrame->mInfo.mTxInfo.mTxDelayBaseTime,
|
||||
aFrame->mInfo.mTxInfo.mTxDelay, aFrame->mChannel))
|
||||
{
|
||||
error = OT_ERROR_INVALID_STATE;
|
||||
}
|
||||
|
||||
@@ -403,7 +403,7 @@
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_CSL_RECEIVE_TIME_AHEAD
|
||||
#define OPENTHREAD_CONFIG_CSL_RECEIVE_TIME_AHEAD 1
|
||||
#define OPENTHREAD_CONFIG_CSL_RECEIVE_TIME_AHEAD 2
|
||||
#endif
|
||||
|
||||
#endif // CONFIG_MAC_H_
|
||||
|
||||
@@ -357,9 +357,10 @@ void SubMac::StartCsmaBackoff(void)
|
||||
if (ShouldHandleTransmitTargetTime())
|
||||
{
|
||||
if (Time(static_cast<uint32_t>(otPlatRadioGetNow(&GetInstance()))) <
|
||||
Time(mTransmitFrame.mInfo.mTxInfo.mTxDelayBaseTime) + mTransmitFrame.mInfo.mTxInfo.mTxDelay)
|
||||
Time(mTransmitFrame.mInfo.mTxInfo.mTxDelayBaseTime) + mTransmitFrame.mInfo.mTxInfo.mTxDelay -
|
||||
kCcaSampleInterval)
|
||||
{
|
||||
mTimer.StartAt(Time(mTransmitFrame.mInfo.mTxInfo.mTxDelayBaseTime),
|
||||
mTimer.StartAt(Time(mTransmitFrame.mInfo.mTxInfo.mTxDelayBaseTime) - kCcaSampleInterval,
|
||||
mTransmitFrame.mInfo.mTxInfo.mTxDelay);
|
||||
}
|
||||
else // Transmit without delay
|
||||
|
||||
@@ -509,11 +509,12 @@ private:
|
||||
|
||||
enum
|
||||
{
|
||||
kMinBE = 3, ///< macMinBE (IEEE 802.15.4-2006).
|
||||
kMaxBE = 5, ///< macMaxBE (IEEE 802.15.4-2006).
|
||||
kUnitBackoffPeriod = 20, ///< Number of symbols (IEEE 802.15.4-2006).
|
||||
kMinBackoff = 1, ///< Minimum backoff (milliseconds).
|
||||
kAckTimeout = 16, ///< Timeout for waiting on an ACK (milliseconds).
|
||||
kMinBE = 3, ///< macMinBE (IEEE 802.15.4-2006).
|
||||
kMaxBE = 5, ///< macMaxBE (IEEE 802.15.4-2006).
|
||||
kUnitBackoffPeriod = 20, ///< Number of symbols (IEEE 802.15.4-2006).
|
||||
kMinBackoff = 1, ///< Minimum backoff (milliseconds).
|
||||
kAckTimeout = 16, ///< Timeout for waiting on an ACK (milliseconds).
|
||||
kCcaSampleInterval = 128, ///< CCA sample interval, 128 usec.
|
||||
|
||||
#if OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE
|
||||
kEnergyScanRssiSampleInterval = 128, ///< RSSI sample interval during energy scan, 128 usec
|
||||
|
||||
Reference in New Issue
Block a user