mirror of
https://github.com/espressif/openthread.git
synced 2026-08-03 17:37:46 +00:00
[csl] split min receive window into MHR ahead and after times (#9041)
Existing `kMinCslWindow` does not account for needed radio on time before MHR. Solve it by splitting the configuration option into both ahead and after minimum times.
This commit is contained in:
+18
-7
@@ -489,16 +489,27 @@
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_CSL_MIN_RECEIVE_ON
|
||||
* @def OPENTHREAD_CONFIG_MIN_RECEIVE_ON_AHEAD
|
||||
*
|
||||
* The minimum CSL receive window (in microseconds) required to receive an IEEE 802.15.4 frame.
|
||||
* - Maximum frame size with preamble: 6*2+127*2 symbols
|
||||
* - AIFS: 12 symbols
|
||||
* - Maximum ACK size with preamble: 6*2+33*2 symbols
|
||||
* The minimum time (in microseconds) before the MHR start that the radio should be in receive state and ready to
|
||||
* properly receive in order to properly receive any IEEE 802.15.4 frame. Defaults to the duration of SHR + PHR.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_CSL_MIN_RECEIVE_ON
|
||||
#define OPENTHREAD_CONFIG_CSL_MIN_RECEIVE_ON 356 * 16
|
||||
#ifndef OPENTHREAD_CONFIG_MIN_RECEIVE_ON_AHEAD
|
||||
#define OPENTHREAD_CONFIG_MIN_RECEIVE_ON_AHEAD (6 * 32)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_MIN_RECEIVE_ON_AFTER
|
||||
*
|
||||
* The minimum time (in microseconds) after the MHR start that the radio should be in receive state in order
|
||||
* to properly receive any IEEE 802.15.4 frame. Defaults to the duration of a maximum size frame, plus AIFS,
|
||||
* plus the duration of maximum enh-ack frame. Platforms are encouraged to improve this value for energy
|
||||
* efficiency purposes.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_MIN_RECEIVE_ON_AFTER
|
||||
#define OPENTHREAD_CONFIG_MIN_RECEIVE_ON_AFTER ((127 + 6 + 39) * 32)
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
||||
@@ -668,4 +668,9 @@
|
||||
"OPENTHREAD_CONFIG_SRP_SERVER_DEFAULT_ADDRESS_MODE."
|
||||
#endif
|
||||
|
||||
#ifdef OPENTHREAD_CONFIG_CSL_MIN_RECEIVE_ON
|
||||
#error "OPENTHREAD_CONFIG_CSL_MIN_RECEIVE_ON was replaced with "\
|
||||
"OPENTHREAD_CONFIG_MIN_RECEIVE_ON_AHEAD and OPENTHREAD_CONFIG_MIN_RECEIVE_ON_AFTER"
|
||||
#endif
|
||||
|
||||
#endif // OPENTHREAD_CORE_CONFIG_CHECK_H_
|
||||
|
||||
@@ -1195,8 +1195,8 @@ void SubMac::GetCslWindowEdges(uint32_t &aAhead, uint32_t &aAfter)
|
||||
(Get<Radio>().GetCslAccuracy() + mCslParentAccuracy.GetClockAccuracy()) / 1000000);
|
||||
semiWindow += mCslParentAccuracy.GetUncertaintyInMicrosec() + Get<Radio>().GetCslUncertainty() * 10;
|
||||
|
||||
aAhead = Min(semiPeriod, semiWindow + kCslReceiveTimeAhead);
|
||||
aAfter = Min(semiPeriod, semiWindow + kMinCslWindow);
|
||||
aAhead = Min(semiPeriod, semiWindow + kMinReceiveOnAhead + kCslReceiveTimeAhead);
|
||||
aAfter = Min(semiPeriod, semiWindow + kMinReceiveOnAfter);
|
||||
}
|
||||
#endif // OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE
|
||||
|
||||
|
||||
@@ -573,9 +573,9 @@ private:
|
||||
};
|
||||
|
||||
#if OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE
|
||||
// CSL receive window for the longest possible frame and
|
||||
// ack duration.
|
||||
static constexpr uint32_t kMinCslWindow = OPENTHREAD_CONFIG_CSL_MIN_RECEIVE_ON;
|
||||
// Radio on times needed before and after MHR time for proper frame detection
|
||||
static constexpr uint32_t kMinReceiveOnAhead = OPENTHREAD_CONFIG_MIN_RECEIVE_ON_AHEAD;
|
||||
static constexpr uint32_t kMinReceiveOnAfter = OPENTHREAD_CONFIG_MIN_RECEIVE_ON_AFTER;
|
||||
|
||||
// CSL receivers would wake up `kCslReceiveTimeAhead` earlier
|
||||
// than expected sample window. The value is in usec.
|
||||
|
||||
Reference in New Issue
Block a user