From d3f76c5c165323bc0c21718252e5012cc4229713 Mon Sep 17 00:00:00 2001 From: Pavel Kirienko Date: Mon, 7 Apr 2014 14:54:26 +0400 Subject: [PATCH] STM32: Renamed CriticalSectionLocker --- libuavcan_drivers/stm32/driver/src/internal.hpp | 6 +++--- .../stm32/driver/src/uc_stm32_can.cpp | 16 ++++++++-------- .../stm32/driver/src/uc_stm32_clock.cpp | 8 ++++---- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/libuavcan_drivers/stm32/driver/src/internal.hpp b/libuavcan_drivers/stm32/driver/src/internal.hpp index 4497bde791..76e041e31a 100644 --- a/libuavcan_drivers/stm32/driver/src/internal.hpp +++ b/libuavcan_drivers/stm32/driver/src/internal.hpp @@ -80,10 +80,10 @@ static void UAVCAN_STM32_TRACE(const char* fmt, ...) namespace uavcan_stm32 { -struct CriticalSectionLock +struct CriticalSectionLocker { - CriticalSectionLock() { chSysSuspend(); } - ~CriticalSectionLock() { chSysEnable(); } + CriticalSectionLocker() { chSysSuspend(); } + ~CriticalSectionLocker() { chSysEnable(); } }; namespace clock diff --git a/libuavcan_drivers/stm32/driver/src/uc_stm32_can.cpp b/libuavcan_drivers/stm32/driver/src/uc_stm32_can.cpp index bdf1ee3678..35f8c0e4e4 100644 --- a/libuavcan_drivers/stm32/driver/src/uc_stm32_can.cpp +++ b/libuavcan_drivers/stm32/driver/src/uc_stm32_can.cpp @@ -194,7 +194,7 @@ uavcan::int16_t CanIface::send(const uavcan::CanFrame& frame, uavcan::MonotonicT return -1; // WTF man how to handle that } - CriticalSectionLock lock; + CriticalSectionLocker lock; /* * Seeking for an empty slot @@ -262,7 +262,7 @@ uavcan::int16_t CanIface::receive(uavcan::CanFrame& out_frame, uavcan::Monotonic out_ts_monotonic = clock::getMonotonic(); // High precision is not required for monotonic timestamps uavcan::uint64_t utc_usec = 0; { - CriticalSectionLock lock; + CriticalSectionLocker lock; if (rx_queue_.getLength() == 0) { return 0; @@ -277,7 +277,7 @@ uavcan::int16_t CanIface::configureFilters(const uavcan::CanFilterConfig* filter uavcan::uint16_t num_configs) { // TODO: Hardware filter support - CriticalSectionLock lock; + CriticalSectionLocker lock; (void)filter_configs; (void)num_configs; return -1; @@ -484,7 +484,7 @@ void CanIface::handleStatusInterrupt() void CanIface::discardTimedOutTxMailboxes(uavcan::MonotonicTime current_time) { static const uavcan::uint32_t AbortFlags[NumTxMailboxes] = { CAN_TSR_ABRQ0, CAN_TSR_ABRQ1, CAN_TSR_ABRQ2 }; - CriticalSectionLock lock; + CriticalSectionLocker lock; for (int i = 0; i < NumTxMailboxes; i++) { TxItem& txi = pending_tx_[i]; @@ -504,19 +504,19 @@ bool CanIface::isTxBufferFull() const bool CanIface::isRxBufferEmpty() const { - CriticalSectionLock lock; + CriticalSectionLocker lock; return rx_queue_.getLength() == 0; } uavcan::uint64_t CanIface::getErrorCount() const { - CriticalSectionLock lock; + CriticalSectionLocker lock; return error_cnt_ + rx_queue_.getOverflowCount(); } uavcan::uint8_t CanIface::yieldLastHardwareErrorCode() { - CriticalSectionLock lock; + CriticalSectionLocker lock; const uavcan::uint8_t val = last_hw_error_code_; last_hw_error_code_ = 0; return val; @@ -571,7 +571,7 @@ int CanDriver::init(uavcan::uint32_t bitrate) { int res = 0; - CriticalSectionLock lock; + CriticalSectionLocker lock; /* * CAN1 diff --git a/libuavcan_drivers/stm32/driver/src/uc_stm32_clock.cpp b/libuavcan_drivers/stm32/driver/src/uc_stm32_clock.cpp index 07e22c9617..570ed8767e 100644 --- a/libuavcan_drivers/stm32/driver/src/uc_stm32_clock.cpp +++ b/libuavcan_drivers/stm32/driver/src/uc_stm32_clock.cpp @@ -50,7 +50,7 @@ const uavcan::int32_t MaxUtcSpeedCorrectionX16 = 100 * 16; void init() { - CriticalSectionLock lock; + CriticalSectionLocker lock; if (initialized) { return; @@ -117,7 +117,7 @@ uavcan::MonotonicTime getMonotonic() { uavcan::uint64_t usec = 0; { - CriticalSectionLock locker; + CriticalSectionLocker locker; usec = sampleFromCriticalSection(&time_mono); #if !NDEBUG static uavcan::uint64_t prev_usec = 0; // Self-test @@ -134,7 +134,7 @@ uavcan::UtcTime getUtc() { uavcan::uint64_t usec = 0; { - CriticalSectionLock locker; + CriticalSectionLocker locker; usec = sampleFromCriticalSection(&time_utc); } return uavcan::UtcTime::fromUSec(usec); @@ -180,7 +180,7 @@ void adjustUtc(uavcan::UtcDuration adjustment) const uavcan::int64_t adj_usec = adjustment.toUSec(); { - CriticalSectionLock locker; + CriticalSectionLocker locker; if ((adj_usec < 0) && uavcan::uint64_t(-adj_usec) > time_utc) { time_utc = 1;