From 801d4227c8396874a11a5ca837b71dab11af097d Mon Sep 17 00:00:00 2001 From: Eduardo Montoya Date: Thu, 20 Aug 2020 19:30:35 +0200 Subject: [PATCH] [style] prettier CSL comments and logs (#5431) Mostly renaming 'Csl' to 'CSL', and some other minor changes. --- include/openthread/platform/radio.h | 2 +- src/core/mac/mac.cpp | 2 +- src/core/mac/mac.hpp | 6 +++--- src/core/mac/sub_mac.cpp | 2 +- src/core/mac/sub_mac.hpp | 2 +- src/core/radio/radio.hpp | 6 +++--- src/core/thread/csl_tx_scheduler.cpp | 14 +++++++------- src/core/thread/csl_tx_scheduler.hpp | 6 +++--- 8 files changed, 20 insertions(+), 20 deletions(-) diff --git a/include/openthread/platform/radio.h b/include/openthread/platform/radio.h index 703952ea8..a6db1fa39 100644 --- a/include/openthread/platform/radio.h +++ b/include/openthread/platform/radio.h @@ -230,7 +230,7 @@ typedef struct otRadioFrame uint8_t mMaxFrameRetries; ///< Maximum number of retries allowed after a transmission failure. bool mIsARetx : 1; ///< True if this frame is a retransmission (ignored by radio driver). bool mCsmaCaEnabled : 1; ///< Set to true to enable CSMA-CA for this packet, false otherwise. - bool mCslPresent : 1; ///< Set to true if CSL header ie is present. + bool mCslPresent : 1; ///< Set to true if CSL header IE is present. bool mIsSecurityProcessed : 1; ///< True if SubMac should skip the AES processing of this frame. } mTxInfo; diff --git a/src/core/mac/mac.cpp b/src/core/mac/mac.cpp index 75c022d02..372938559 100644 --- a/src/core/mac/mac.cpp +++ b/src/core/mac/mac.cpp @@ -2270,7 +2270,7 @@ otError Mac::AppendHeaderIe(bool aIsTimeSync, TxFrame &aFrame) const { OT_UNUSED_VARIABLE(aIsTimeSync); - const size_t kMaxNumHeaderIe = 3; // TimeSync + Csl + Termination2 + const size_t kMaxNumHeaderIe = 3; // TimeSync + CSL + Termination2 HeaderIe ieList[kMaxNumHeaderIe]; otError error = OT_ERROR_NONE; uint8_t ieCount = 0; diff --git a/src/core/mac/mac.hpp b/src/core/mac/mac.hpp index 7c66b00fb..6f57d46d0 100644 --- a/src/core/mac/mac.hpp +++ b/src/core/mac/mac.hpp @@ -220,9 +220,9 @@ public: #if OPENTHREAD_CONFIG_MAC_CSL_TRANSMITTER_ENABLE /** - * This method requests `Mac` to start a Csl Tx operation after a delay of @p aDelay time. + * This method requests `Mac` to start a CSL tx operation after a delay of @p aDelay time. * - * @param[in] aDelay Delay time for `Mac` to start a Csl Tx, in units of milliseconds. + * @param[in] aDelay Delay time for `Mac` to start a CSL tx, in units of milliseconds. * */ void RequestCslFrameTransmission(uint32_t aDelay); @@ -754,7 +754,7 @@ public: * This method updates frame control field. * * If the frame would contain header IEs, IE present field would be set. - * If this is a csl transmission frame or header IE is present in this frame, + * If this is a CSL transmission frame or header IE is present in this frame, * the version should be set to 2015. Otherwise, the version would be set to 2006. * * @param[in] aNeighbor A pointer to the destination device, could be `nullptr`. diff --git a/src/core/mac/sub_mac.cpp b/src/core/mac/sub_mac.cpp index 063f63cad..8f48e4169 100644 --- a/src/core/mac/sub_mac.cpp +++ b/src/core/mac/sub_mac.cpp @@ -862,7 +862,7 @@ void SubMac::SetCslPeriod(uint16_t aPeriod) } } - otLogDebgMac("Csl Period: %u", mCslPeriod); + otLogDebgMac("CSL Period: %u", mCslPeriod); exit: return; diff --git a/src/core/mac/sub_mac.hpp b/src/core/mac/sub_mac.hpp index eb8e68337..23bcf5021 100644 --- a/src/core/mac/sub_mac.hpp +++ b/src/core/mac/sub_mac.hpp @@ -587,7 +587,7 @@ private: }; /** - * Csl state, always updated by `mCslTimer`. + * CSL state, always updated by `mCslTimer`. * */ enum CslState : uint8_t{ diff --git a/src/core/radio/radio.hpp b/src/core/radio/radio.hpp index 0e618640f..bfe9eb592 100644 --- a/src/core/radio/radio.hpp +++ b/src/core/radio/radio.hpp @@ -414,14 +414,14 @@ public: otError Receive(uint8_t aChannel) { return otPlatRadioReceive(GetInstance(), aChannel); } /** - * This method updates the csl sample time in radio. + * This method updates the CSL sample time in radio. * - * @param[in] aCslSampleTime The csl sample time. + * @param[in] aCslSampleTime The CSL sample time. * */ void UpdateCslSampleTime(uint32_t aCslSampleTime) { otPlatRadioUpdateCslSampleTime(GetInstance(), aCslSampleTime); } - /** This method enables csl sampling in radio. + /** This method enables CSL sampling in radio. * * @param[in] aCslPeriod CSL period, 0 for disabling CSL. * @param[in] aExtAddr The extended source address of CSL receiver's parent device (when the platforms diff --git a/src/core/thread/csl_tx_scheduler.cpp b/src/core/thread/csl_tx_scheduler.cpp index 62a695085..593307524 100644 --- a/src/core/thread/csl_tx_scheduler.cpp +++ b/src/core/thread/csl_tx_scheduler.cpp @@ -58,7 +58,7 @@ inline void CslTxScheduler::Callbacks::HandleSentFrameToChild(const Mac::TxFrame } //--------------------------------------------------------- -// + CslTxScheduler::CslTxScheduler(Instance &aInstance) : InstanceLocator(aInstance) , mCslTxChild(nullptr) @@ -102,9 +102,9 @@ void CslTxScheduler::Clear(void) } /** - * This method always finds the most recent csl tx among all children, - * and request `Mac` to do csl tx at specific time. It shouldn't be called - * when `Mac` is already starting to do the csl tx (indicated by `mCslTxMessage`). + * This method always finds the most recent CSL tx among all children, + * and requests `Mac` to do CSL tx at specific time. It shouldn't be called + * when `Mac` is already starting to do the CSL tx (indicated by `mCslTxMessage`). * */ void CslTxScheduler::RescheduleCslTx(void) @@ -222,16 +222,16 @@ void CslTxScheduler::HandleSentFrame(const Mac::TxFrame &aFrame, otError aError, case OT_ERROR_NO_ACK: aChild.IncrementCslTxAttempts(); - otLogInfoMac("Csl tx to child %04x failed, attempt %d/%d", aChild.GetRloc16(), aChild.GetCslTxAttempts(), + otLogInfoMac("CSL tx to child %04x failed, attempt %d/%d", aChild.GetRloc16(), aChild.GetCslTxAttempts(), kMaxCslTriggeredTxAttempts); // Fall through case OT_ERROR_CHANNEL_ACCESS_FAILURE: case OT_ERROR_ABORT: - // Even if Csl Tx attempts count reaches max, the message won't be + // Even if CSL tx attempts count reaches max, the message won't be // dropped until indirect tx attempts count reaches max. So here it - // would set sequence number and schedule next csl tx. + // would set sequence number and schedule next CSL tx. if (!aFrame.IsEmpty()) { diff --git a/src/core/thread/csl_tx_scheduler.hpp b/src/core/thread/csl_tx_scheduler.hpp index b5c6c0fef..d534dcd22 100644 --- a/src/core/thread/csl_tx_scheduler.hpp +++ b/src/core/thread/csl_tx_scheduler.hpp @@ -102,13 +102,13 @@ public: void SetCslLastHeard(TimeMilli aCslLastHeard) { mCslLastHeard = aCslLastHeard; } private: - uint8_t mCslTxAttempts : 7; ///< Number of csl triggered tx attempts. + uint8_t mCslTxAttempts : 7; ///< Number of CSL triggered tx attempts. bool mCslSynchronized : 1; ///< Indicates whether or not the child is CSL synchronized. uint8_t mCslChannel; ///< The channel the device will listen on. uint32_t mCslTimeout; ///< The sync timeout, in seconds. uint16_t mCslPeriod; ///< CSL sampled listening period in units of 10 symbols (160 microseconds). uint16_t mCslPhase; ///< The time when the next CSL sample will start. - TimeMilli mCslLastHeard; ///< Time when last frame containing CSL IE heard. + TimeMilli mCslLastHeard; ///< Time when last frame containing CSL IE was heard. static_assert(kMaxCslTriggeredTxAttempts < (1 << 7), "mCslTxAttempts cannot fit max!"); }; @@ -163,7 +163,7 @@ public: Child & aChild); }; /** - * This constructor initializes the csl tx scheduler object. + * This constructor initializes the CSL tx scheduler object. * * @param[in] aInstance A reference to the OpenThread instance. *