28#ifndef CMSIS_PLUS_RTOS_OS_CLOCKS_H_
29#define CMSIS_PLUS_RTOS_OS_CLOCKS_H_
33#if defined(__cplusplus)
41#pragma GCC diagnostic push
44#pragma clang diagnostic ignored "-Wc++98-compat"
45#pragma clang diagnostic ignored "-Wdocumentation-unknown-command"
57#pragma GCC diagnostic push
58#pragma GCC diagnostic ignored "-Wpadded"
140 operator= (
const clock&) =
delete;
142 operator= (
clock&&) =
delete;
260 internal_increment_count (
void);
263 internal_check_timestamps (
void);
321#pragma GCC diagnostic pop
530 start (
void)
override;
538 template<
typename Rep_T>
558#if defined(OS_USE_RTOS_PORT_CLOCK_SYSTICK_WAIT_FOR)
667 start (
void)
override;
677#if defined(OS_USE_RTOS_PORT_CLOCK_REALTIME_WAIT_FOR)
689 internal_wait_until_ (
timestamp_t timestamp, clock_timestamps_list& list);
760 start (
void)
override;
819 clock::clock (
const char* name) :
820 internal::object_named
826 inline internal::clock_timestamps_list&
827 __attribute__((always_inline))
828 clock::steady_list (
void)
834 __attribute__((always_inline))
835 clock::internal_increment_count (
void)
839#pragma GCC diagnostic push
840#if defined(__clang__)
841#pragma clang diagnostic ignored "-Wdeprecated-volatile"
844#pragma GCC diagnostic pop
848 __attribute__((always_inline))
849 clock::internal_check_timestamps (
void)
851 steady_list_.check_timestamp (steady_count_);
865 adjustable_clock::adjustable_clock (
const char* name) :
873 __attribute__((always_inline))
876 clock::internal_check_timestamps ();
878#pragma GCC diagnostic push
879#pragma GCC diagnostic ignored "-Wsign-conversion"
880 adjusted_list_.check_timestamp (steady_count_ + offset_);
881#pragma GCC diagnostic pop
898 template<
typename Rep_T>
905 +
static_cast<Rep_T
> (1000000ul) - 1)
906 /
static_cast<Rep_T
> (1000000ul));
909#pragma GCC diagnostic push
910#if defined(__clang__)
911#pragma clang diagnostic ignored "-Wc++98-compat"
916#pragma GCC diagnostic pop
920 __attribute__((always_inline))
924#pragma GCC diagnostic push
925#if defined(__clang__)
926#pragma clang diagnostic ignored "-Wdeprecated-volatile"
929#pragma GCC diagnostic pop
933 __attribute__((always_inline))
944#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.