[mac] define Mac::kCslRequestAhead constant (#10963)

This commit defines the `Mac::kCslRequestAhead` constant, which
maps to `OPENTHREAD_CONFIG_MAC_CSL_REQUEST_AHEAD_US`. This
constant is used within the core modules.
This commit is contained in:
Abtin Keshavarzian
2024-11-25 09:27:39 -08:00
committed by GitHub
parent dd6cd98064
commit 4b9134d5e1
6 changed files with 13 additions and 8 deletions
+3 -2
View File
@@ -2629,9 +2629,10 @@ Error Mac::HandleWakeupFrame(const RxFrame &aFrame)
radioNowUs = otPlatRadioGetNow(&GetInstance());
rvTimeUs = aFrame.GetRendezvousTimeIe()->GetRendezvousTime() * kUsPerTenSymbols;
rvTimestampUs = aFrame.GetTimestamp() + kRadioHeaderPhrDuration + aFrame.GetLength() * kOctetDuration + rvTimeUs;
if (rvTimestampUs > radioNowUs + OPENTHREAD_CONFIG_MAC_CSL_REQUEST_AHEAD_US)
if (rvTimestampUs > radioNowUs + kCslRequestAhead)
{
attachDelayMs = static_cast<uint32_t>(rvTimestampUs - radioNowUs - OPENTHREAD_CONFIG_MAC_CSL_REQUEST_AHEAD_US);
attachDelayMs = static_cast<uint32_t>(rvTimestampUs - radioNowUs - kCslRequestAhead);
attachDelayMs = attachDelayMs / 1000;
}
else
+6
View File
@@ -87,6 +87,12 @@ constexpr uint8_t kMaxFrameRetriesCsl = 0;
constexpr uint8_t kTxNumBcast = OPENTHREAD_CONFIG_MAC_TX_NUM_BCAST; ///< Num of times broadcast frame is tx.
/**
* Specifies the number of microseconds ahead of time that the MAC layer should deliver a CSL frame to the sub-MAC
* layer.
*/
constexpr uint16_t kCslRequestAhead = OPENTHREAD_CONFIG_MAC_CSL_REQUEST_AHEAD_US;
constexpr uint16_t kMinCslIePeriod = OPENTHREAD_CONFIG_MAC_CSL_MIN_PERIOD;
constexpr uint32_t kDefaultWedListenInterval = OPENTHREAD_CONFIG_WED_LISTEN_INTERVAL;
+1 -1
View File
@@ -167,7 +167,7 @@ void WakeupTxScheduler::UpdateFrameRequestAhead(void)
busSpeedHz = DivideAndRoundUp<uint32_t>(kWakeupFrameWeight * 8 * 1000000, busSpeedHz);
}
mTxRequestAheadTimeUs = OPENTHREAD_CONFIG_MAC_CSL_REQUEST_AHEAD_US + busTxTimeUs + busLatency;
mTxRequestAheadTimeUs = Mac::kCslRequestAhead + busTxTimeUs + busLatency;
}
} // namespace ot
+1 -2
View File
@@ -95,8 +95,7 @@ public:
void Stop(void);
/**
* Updates the value of `mTxRequestAheadTimeUs`, based on bus speed, bus latency and
* `OPENTHREAD_CONFIG_MAC_CSL_REQUEST_AHEAD_US`.
* Updates the value of `mTxRequestAheadTimeUs`, based on bus speed, bus latency and `Mac::kCslRequestAhead`.
*/
void UpdateFrameRequestAhead(void);
+1 -1
View File
@@ -59,7 +59,7 @@ void CslTxScheduler::UpdateFrameRequestAhead(void)
busTxTime = DivideAndRoundUp<uint32_t>(150 * 8 * 1000000, busSpeedHz);
}
mCslFrameRequestAheadUs = OPENTHREAD_CONFIG_MAC_CSL_REQUEST_AHEAD_US + busTxTime + busLatency;
mCslFrameRequestAheadUs = Mac::kCslRequestAhead + busTxTime + busLatency;
LogInfo("Bus TX Time: %lu usec, Latency: %lu usec. Calculated CSL Frame Request Ahead: %lu usec",
ToUlong(busTxTime), ToUlong(busLatency), ToUlong(mCslFrameRequestAheadUs));
+1 -2
View File
@@ -178,8 +178,7 @@ public:
void Clear(void);
/**
* Updates the value of `mCslFrameRequestAheadUs`, based on bus speed, bus latency
* and `OPENTHREAD_CONFIG_MAC_CSL_REQUEST_AHEAD_US`.
* Updates the value of `mCslFrameRequestAheadUs`, based on bus speed, bus latency and `Mac::kCslRequestAhead`.
*/
void UpdateFrameRequestAhead(void);