From 471460c6101f06231b4f00e2b4dc727ca4013ffd Mon Sep 17 00:00:00 2001 From: Abtin Keshavarzian Date: Fri, 3 Jul 2026 21:06:16 -0700 Subject: [PATCH] [radio] define `OT_CONFIG_RADIO_TIME_ENABLE` derived configuration (#13280) This commit defines `OT_CONFIG_RADIO_TIME_ENABLE` as a derived internal configuration macro in `radio.hpp`. It consolidates conditional checks for features that depend on radio clock time (CSL receiver/transmitter, wakeup, and time synchronization). --- src/core/radio/radio.hpp | 11 ++++------- src/core/radio/radio_types.hpp | 9 +++++++++ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/core/radio/radio.hpp b/src/core/radio/radio.hpp index bfb8ad1a5..09a0bbe3b 100644 --- a/src/core/radio/radio.hpp +++ b/src/core/radio/radio.hpp @@ -560,8 +560,7 @@ public: Error ResetCsl(void); #endif // OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE -#if OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE || OPENTHREAD_CONFIG_MAC_CSL_TRANSMITTER_ENABLE || \ - OPENTHREAD_CONFIG_TIME_SYNC_ENABLE +#if OT_CONFIG_RADIO_TIME_ENABLE /** * Get the current radio time in microseconds referenced to a continuous monotonic local radio clock (64 bits * width). @@ -592,7 +591,7 @@ public: * @returns The CSL Uncertainty in units of 10 us. */ uint8_t GetCslUncertainty(void); -#endif // OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE || OPENTHREAD_CONFIG_MAC_CSL_TRANSMITTER_ENABLE +#endif // OT_CONFIG_RADIO_TIME_ENABLE /** * Gets the radio transmit frame buffer. @@ -1019,8 +1018,7 @@ inline Error Radio::EnableCsl(uint32_t aCslPeriod, Mac::ShortAddress aShortAddr, inline Error Radio::ResetCsl(void) { return otPlatRadioResetCsl(GetInstancePtr()); } #endif -#if OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE || OPENTHREAD_CONFIG_MAC_CSL_TRANSMITTER_ENABLE || \ - OPENTHREAD_CONFIG_TIME_SYNC_ENABLE +#if OT_CONFIG_RADIO_TIME_ENABLE inline RadioTime64 Radio::GetNow(void) { return otPlatRadioGetNow(GetInstancePtr()); } inline uint8_t Radio::GetCslAccuracy(void) { return otPlatRadioGetCslAccuracy(GetInstancePtr()); } @@ -1127,8 +1125,7 @@ inline Error Radio::EnableCsl(uint32_t, Mac::ShortAddress, const Mac::ExtAddress inline Error Radio::ResetCsl(void) { return kErrorNotImplemented; } #endif -#if OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE || OPENTHREAD_CONFIG_MAC_CSL_TRANSMITTER_ENABLE || \ - OPENTHREAD_CONFIG_TIME_SYNC_ENABLE +#if OT_CONFIG_RADIO_TIME_ENABLE inline RadioTime64 Radio::GetNow(void) { return NumericLimits::kMax; } inline uint8_t Radio::GetCslAccuracy(void) { return NumericLimits::kMax; } diff --git a/src/core/radio/radio_types.hpp b/src/core/radio/radio_types.hpp index 5cf03f8a3..e2e066dda 100644 --- a/src/core/radio/radio_types.hpp +++ b/src/core/radio/radio_types.hpp @@ -40,6 +40,15 @@ namespace ot { +#ifdef OT_CONFIG_RADIO_TIME_ENABLE +#error "OT_CONFIG_RADIO_TIME_ENABLE MUST NOT be defined directly. It is derived from other configs" +#endif + +#define OT_CONFIG_RADIO_TIME_ENABLE \ + (OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE || OPENTHREAD_CONFIG_MAC_CSL_TRANSMITTER_ENABLE || \ + OPENTHREAD_CONFIG_WAKEUP_END_DEVICE_ENABLE || OPENTHREAD_CONFIG_WAKEUP_COORDINATOR_ENABLE || \ + OPENTHREAD_CONFIG_TIME_SYNC_ENABLE) + /** * Represents a 64-bit radio time in microseconds referenced to a continuous monotonic local radio clock. */