12#ifndef CMSIS_PLUS_RTOS_OS_CLOCKS_H_
13#define CMSIS_PLUS_RTOS_OS_CLOCKS_H_
17#if defined(__cplusplus)
21#if defined(OS_USE_OS_APP_CONFIG_H)
22#include <cmsis-plus/os-app-config.h>
29#pragma GCC diagnostic push
31#pragma clang diagnostic ignored "-Wc++98-compat"
32#pragma clang diagnostic ignored "-Wdocumentation-unknown-command"
52#pragma GCC diagnostic push
54#pragma clang diagnostic ignored "-Wpadded"
55#elif defined(__GNUC__)
56#pragma GCC diagnostic ignored "-Wpadded"
57#pragma GCC diagnostic ignored "-Wsuggest-final-methods"
58#pragma GCC diagnostic ignored "-Wsuggest-final-types"
136 operator= (
const clock&)
257 internal_increment_count (
void);
260 internal_check_timestamps (
void);
316#pragma GCC diagnostic pop
531 template <
typename Rep_T>
550#if defined(OS_USE_RTOS_PORT_CLOCK_SYSTICK_WAIT_FOR)
669#if defined(OS_USE_RTOS_PORT_CLOCK_REALTIME_WAIT_FOR)
682 clock_timestamps_list& list);
808 inline clock::clock (
const char* name) : internal::object_named{ name }
812 inline internal::clock_timestamps_list& __attribute__ ((always_inline))
813 clock::steady_list (
void)
818 inline void __attribute__ ((always_inline))
819 clock::internal_increment_count (
void)
823#pragma GCC diagnostic push
824#if defined(__clang__)
825#pragma clang diagnostic ignored "-Wdeprecated-volatile"
826#elif defined(__GNUC__)
827#pragma GCC diagnostic ignored "-Wvolatile"
830#pragma GCC diagnostic pop
833 inline void __attribute__ ((always_inline))
834 clock::internal_check_timestamps (
void)
836 steady_list_.check_timestamp (steady_count_);
849 inline adjustable_clock::adjustable_clock (
const char* name)
854 inline void __attribute__ ((always_inline))
857 clock::internal_check_timestamps ();
859#pragma GCC diagnostic push
860#if defined(__clang__)
861#pragma clang diagnostic ignored "-Wsign-conversion"
862#elif defined(__GNUC__)
863#pragma GCC diagnostic ignored "-Wsign-conversion"
865 adjusted_list_.check_timestamp (steady_count_ + offset_);
866#pragma GCC diagnostic pop
883 template <
typename Rep_T>
890 +
static_cast<Rep_T
> (1000000ul) - 1)
891 /
static_cast<Rep_T
> (1000000ul));
894#pragma GCC diagnostic push
895#if defined(__clang__)
896#pragma clang diagnostic ignored "-Wc++98-compat"
901#pragma GCC diagnostic pop
904 inline void __attribute__ ((always_inline))
908#pragma GCC diagnostic push
909#if defined(__clang__)
910#pragma clang diagnostic ignored "-Wdeprecated-volatile"
911#elif defined(__GNUC__)
912#pragma GCC diagnostic ignored "-Wvolatile"
915#pragma GCC diagnostic pop
918 inline uint32_t __attribute__ ((always_inline))
929#pragma GCC diagnostic pop
Adjustable (non-steady) clock.
virtual timestamp_t now(void) override
Tell the current time adjusted for epoch.
virtual offset_t offset(void) override
Get adjustment offset.
virtual result_t sleep_until(timestamp_t timestamp) override
Sleep until an absolute timestamp.
virtual ~adjustable_clock() override
Destruct the clock object instance.
virtual offset_t offset(offset_t value) override
Set adjustment offset.
void internal_check_timestamps(void)
High Resolution derived clock.
void internal_increment_count(void)
virtual ~clock_highres() override
Destruct the SysTick clock object instance.
virtual void start(void) override
Start the clock.
uint32_t input_clock_frequency_hz(void)
clock_highres()
Construct a SysTick clock object instance.
virtual timestamp_t now(void) override
Tell the current time.
static constexpr uint32_t frequency_hz
Real time clock frequency in Hz.
virtual void start(void) override
Initialise and make the RTC tick.
virtual ~clock_rtc() override
Destruct the real time clock object instance.
clock_rtc()
Construct a real time clock object instance.
static constexpr uint32_t frequency_hz
SysTick frequency in Hz.
virtual void start(void) override
Start the clock.
clock_systick()
Construct a SysTick clock object instance.
static constexpr clock::duration_t ticks_cast(Rep_T microsec)
Convert microseconds to ticks.
virtual ~clock_systick() override
Destruct the SysTick clock object instance.
virtual offset_t offset(void)
Get adjustment offset (placeholder).
virtual offset_t offset(offset_t value)
Set adjustment offset (placeholder)
result_t wait_for(duration_t timeout)
Timed wait for an event.
virtual result_t sleep_until(timestamp_t timestamp)
Sleep until an absolute timestamp.
timestamp_t update_for_slept_time(duration_t duration)
Increase the internal count after a deep sleep.
timestamp_t steady_now(void)
Tell the current time since startup.
virtual timestamp_t now(void)
Tell the current time, possibly adjusted for epoch.
virtual void start(void)=0
Start the clock.
virtual ~clock()
Destruct the clock object instance.
result_t sleep_for(duration_t duration)
Sleep for a relative duration.
Ordered list of time stamp nodes.
Base class for named objects.
const char * name(void) const
Get object name.
static uint32_t input_clock_frequency_hz(void)
static uint32_t cycles_per_tick(void)
#define OS_INTEGER_SYSTICK_FREQUENCY_HZ
Define the scheduler frequency, in Hz.
port::clock::duration_t duration_t
Type of variables holding clock durations.
clock_highres hrclock
The high resolution clock object instance.
clock_rtc rtclock
The real time clock object instance.
port::clock::timestamp_t timestamp_t
Type of variables holding clock time stamps.
clock_systick sysclock
The system clock object instance.
port::clock::offset_t offset_t
Type of variables holding clock offsets.
uint32_t duration_t
Type of variables holding timer durations.
uint64_t timestamp_t
Type of variables holding time stamps.
uint32_t result_t
Type of values returned by RTOS functions.