13#ifndef CMSIS_PLUS_RTOS_OS_CLOCKS_H_
14#define CMSIS_PLUS_RTOS_OS_CLOCKS_H_
18#if defined(__cplusplus)
22#if defined(OS_USE_OS_APP_CONFIG_H)
23#include <cmsis-plus/os-app-config.h>
30#pragma GCC diagnostic push
32#pragma clang diagnostic ignored "-Wc++98-compat"
33#pragma clang diagnostic ignored "-Wdocumentation-unknown-command"
50#pragma GCC diagnostic push
52#pragma clang diagnostic ignored "-Wpadded"
53#elif defined(__GNUC__)
54#pragma GCC diagnostic ignored "-Wpadded"
55#pragma GCC diagnostic ignored "-Wsuggest-final-methods"
56#pragma GCC diagnostic ignored "-Wsuggest-final-types"
133 operator= (
const clock&) =
delete;
135 operator= (
clock&&) =
delete;
253 internal_increment_count (
void);
256 internal_check_timestamps (
void);
313#pragma GCC diagnostic pop
522 start (
void)
override;
530 template<
typename Rep_T>
550#if defined(OS_USE_RTOS_PORT_CLOCK_SYSTICK_WAIT_FOR)
659 start (
void)
override;
669#if defined(OS_USE_RTOS_PORT_CLOCK_REALTIME_WAIT_FOR)
681 internal_wait_until_ (
timestamp_t timestamp, clock_timestamps_list& list);
752 start (
void)
override;
811 clock::clock (
const char* name) :
812 internal::object_named
817 inline internal::clock_timestamps_list&
818 __attribute__((always_inline))
819 clock::steady_list (
void)
825 __attribute__((always_inline))
826 clock::internal_increment_count (
void)
830#pragma GCC diagnostic push
831#if defined(__clang__)
832#pragma clang diagnostic ignored "-Wdeprecated-volatile"
833#elif defined(__GNUC__)
834#pragma GCC diagnostic ignored "-Wvolatile"
837#pragma GCC diagnostic pop
841 __attribute__((always_inline))
842 clock::internal_check_timestamps (
void)
844 steady_list_.check_timestamp (steady_count_);
858 adjustable_clock::adjustable_clock (
const char* name) :
865 __attribute__((always_inline))
868 clock::internal_check_timestamps ();
870#pragma GCC diagnostic push
871#if defined(__clang__)
872#pragma clang diagnostic ignored "-Wsign-conversion"
873#elif defined(__GNUC__)
874#pragma GCC diagnostic ignored "-Wsign-conversion"
876 adjusted_list_.check_timestamp (steady_count_ + offset_);
877#pragma GCC diagnostic pop
894 template<
typename Rep_T>
901 +
static_cast<Rep_T
> (1000000ul) - 1)
902 /
static_cast<Rep_T
> (1000000ul));
905#pragma GCC diagnostic push
906#if defined(__clang__)
907#pragma clang diagnostic ignored "-Wc++98-compat"
912#pragma GCC diagnostic pop
916 __attribute__((always_inline))
920#pragma GCC diagnostic push
921#if defined(__clang__)
922#pragma clang diagnostic ignored "-Wdeprecated-volatile"
923#elif defined(__GNUC__)
924#pragma GCC diagnostic ignored "-Wvolatile"
927#pragma GCC diagnostic pop
931 __attribute__((always_inline))
942#pragma GCC diagnostic pop
Adjustable (non-steady) clock.
virtual ~adjustable_clock() override
Destruct the clock object instance.
virtual timestamp_t now(void) override
Tell the current time adjusted for epoch.
virtual result_t sleep_until(timestamp_t timestamp) override
Sleep until an absolute timestamp.
virtual offset_t offset(void) override
Get 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
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 ~clock_systick() override
Destruct the SysTick clock object instance.
clock_systick()
Construct a SysTick clock object instance.
static constexpr clock::duration_t ticks_cast(Rep_T microsec)
Convert microseconds to ticks.
virtual void start(void) override
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.