From d2b3ab9d1efe64a81954b84b1a0915defdcc6acf Mon Sep 17 00:00:00 2001 From: Xu Si Yu Date: Wed, 6 Nov 2024 15:09:08 +0800 Subject: [PATCH] [spinel] replace otLinkGetFrameCounter with otPlatRadioGetFrameCounter in radio spinel --- include/openthread/platform/radio.h | 2 ++ src/core/radio/radio_platform.cpp | 5 +++++ src/lib/spinel/radio_spinel.cpp | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/include/openthread/platform/radio.h b/include/openthread/platform/radio.h index c793bd748a5..e6152a03dc5 100644 --- a/include/openthread/platform/radio.h +++ b/include/openthread/platform/radio.h @@ -734,6 +734,8 @@ void otPlatRadioSetMacFrameCounterIfLarger(otInstance *aInstance, uint32_t aMacF */ uint64_t otPlatRadioGetNow(otInstance *aInstance); +uint32_t otPlatRadioGetFrameCounter(otInstance *aInstance); + /** * Get the bus speed in bits/second between the host and the radio chip. * diff --git a/src/core/radio/radio_platform.cpp b/src/core/radio/radio_platform.cpp index 1db6af755c9..82fcdf3ac9c 100644 --- a/src/core/radio/radio_platform.cpp +++ b/src/core/radio/radio_platform.cpp @@ -268,6 +268,11 @@ extern "C" OT_TOOL_WEAK uint64_t otPlatRadioGetNow(otInstance *aInstance) return otPlatTimeGet(); } +extern "C" OT_TOOL_WEAK uint32_t otPlatRadioGetFrameCounter(otInstance *aInstance) +{ + return otLinkGetFrameCounter(aInstance); +} + extern "C" OT_TOOL_WEAK uint32_t otPlatRadioGetBusSpeed(otInstance *aInstance) { OT_UNUSED_VARIABLE(aInstance); diff --git a/src/lib/spinel/radio_spinel.cpp b/src/lib/spinel/radio_spinel.cpp index 82a82922629..86b33a49096 100644 --- a/src/lib/spinel/radio_spinel.cpp +++ b/src/lib/spinel/radio_spinel.cpp @@ -2181,7 +2181,7 @@ void RadioSpinel::RestoreProperties(void) static constexpr uint16_t kFrameCounterGuard = 1000; SuccessOrDie(Set(SPINEL_PROP_RCP_MAC_FRAME_COUNTER, SPINEL_DATATYPE_UINT32_S, - otLinkGetFrameCounter(mInstance) + kFrameCounterGuard)); + otPlatRadioGetFrameCounter(mInstance) + kFrameCounterGuard)); } for (int i = 0; i < mSrcMatchShortEntryCount; ++i)