From 31f2897951c9dfd89364121f0581622416e77a7b Mon Sep 17 00:00:00 2001 From: Abtin Keshavarzian Date: Fri, 28 Feb 2025 07:16:19 -0800 Subject: [PATCH] [csl] update CSL methods to use core MAC address types (#11306) This commit updates `SubMac::UpdateCsl()` and related methods to use the core types `Mac::ExtAddress` and `Mac::ShortAddress` instead of C-style public/platform types. The extended address input is also changed from a pointer to a reference. --- src/core/mac/mac.cpp | 2 +- src/core/mac/mac_links.hpp | 2 +- src/core/mac/sub_mac.hpp | 2 +- src/core/mac/sub_mac_csl_receiver.cpp | 2 +- src/core/radio/radio.hpp | 8 ++++---- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/core/mac/mac.cpp b/src/core/mac/mac.cpp index 3f5a9f725..f58606828 100644 --- a/src/core/mac/mac.cpp +++ b/src/core/mac/mac.cpp @@ -2429,7 +2429,7 @@ void Mac::UpdateCsl(void) uint8_t channel = GetCslChannel() ? GetCslChannel() : mRadioChannel; if (mLinks.UpdateCsl(period, channel, Get().GetParent().GetRloc16(), - &Get().GetParent().GetExtAddress())) + Get().GetParent().GetExtAddress())) { if (Get().IsChild()) { diff --git a/src/core/mac/mac_links.hpp b/src/core/mac/mac_links.hpp index 8de50f392..592d48e0b 100644 --- a/src/core/mac/mac_links.hpp +++ b/src/core/mac/mac_links.hpp @@ -471,7 +471,7 @@ public: * @retval TRUE if CSL Period or CSL Channel changed. * @retval FALSE if CSL Period and CSL Channel did not change. */ - bool UpdateCsl(uint16_t aPeriod, uint8_t aChannel, otShortAddress aShortAddr, const otExtAddress *aExtAddr) + bool UpdateCsl(uint16_t aPeriod, uint8_t aChannel, ShortAddress aShortAddr, const ExtAddress &aExtAddr) { bool retval = false; diff --git a/src/core/mac/sub_mac.hpp b/src/core/mac/sub_mac.hpp index 2a472d5f5..b0cf14566 100644 --- a/src/core/mac/sub_mac.hpp +++ b/src/core/mac/sub_mac.hpp @@ -386,7 +386,7 @@ public: * @retval TRUE if CSL Period or CSL Channel changed. * @retval FALSE if CSL Period and CSL Channel did not change. */ - bool UpdateCsl(uint16_t aPeriod, uint8_t aChannel, otShortAddress aShortAddr, const otExtAddress *aExtAddr); + bool UpdateCsl(uint16_t aPeriod, uint8_t aChannel, ShortAddress aShortAddr, const ExtAddress &aExtAddr); /** * Returns parent CSL accuracy (clock accuracy and uncertainty). diff --git a/src/core/mac/sub_mac_csl_receiver.cpp b/src/core/mac/sub_mac_csl_receiver.cpp index bef89c579..1b75e3af6 100644 --- a/src/core/mac/sub_mac_csl_receiver.cpp +++ b/src/core/mac/sub_mac_csl_receiver.cpp @@ -107,7 +107,7 @@ exit: return; } -bool SubMac::UpdateCsl(uint16_t aPeriod, uint8_t aChannel, otShortAddress aShortAddr, const otExtAddress *aExtAddr) +bool SubMac::UpdateCsl(uint16_t aPeriod, uint8_t aChannel, ShortAddress aShortAddr, const ExtAddress &aExtAddr) { bool diffPeriod = aPeriod != mCslPeriod; bool diffChannel = aChannel != mCslChannel; diff --git a/src/core/radio/radio.hpp b/src/core/radio/radio.hpp index 321ac4b12..4d35a3f18 100644 --- a/src/core/radio/radio.hpp +++ b/src/core/radio/radio.hpp @@ -540,7 +540,7 @@ public: * @retval kErrorFailed Other platform specific errors. * @retval kErrorNone Successfully enabled or disabled CSL. */ - Error EnableCsl(uint32_t aCslPeriod, otShortAddress aShortAddr, const otExtAddress *aExtAddr); + Error EnableCsl(uint32_t aCslPeriod, Mac::ShortAddress aShortAddr, const Mac::ExtAddress &aExtAddr); /** * Resets CSL receiver in radio. @@ -980,9 +980,9 @@ inline void Radio::UpdateCslSampleTime(uint32_t aCslSampleTime) otPlatRadioUpdateCslSampleTime(GetInstancePtr(), aCslSampleTime); } -inline Error Radio::EnableCsl(uint32_t aCslPeriod, otShortAddress aShortAddr, const otExtAddress *aExtAddr) +inline Error Radio::EnableCsl(uint32_t aCslPeriod, Mac::ShortAddress aShortAddr, const Mac::ExtAddress &aExtAddr) { - return otPlatRadioEnableCsl(GetInstancePtr(), aCslPeriod, aShortAddr, aExtAddr); + return otPlatRadioEnableCsl(GetInstancePtr(), aCslPeriod, aShortAddr, &aExtAddr); } inline Error Radio::ResetCsl(void) { return otPlatRadioResetCsl(GetInstancePtr()); } @@ -1087,7 +1087,7 @@ inline Error Radio::ReceiveAt(uint8_t, uint32_t, uint32_t) { return kErrorNone; #if OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE inline void Radio::UpdateCslSampleTime(uint32_t) {} -inline Error Radio::EnableCsl(uint32_t, otShortAddress aShortAddr, const otExtAddress *) +inline Error Radio::EnableCsl(uint32_t, Mac::ShortAddress aShortAddr, const Mac::ExtAddress &) { return kErrorNotImplemented; }