28 #ifndef CMSIS_PLUS_RTOS_OS_CLOCKS_H_ 29 #define CMSIS_PLUS_RTOS_OS_CLOCKS_H_ 33 #if defined(__cplusplus) 46 #pragma GCC diagnostic push 47 #pragma GCC diagnostic ignored "-Wpadded" 129 operator= (
const clock&) =
delete;
131 operator= (
clock&&) =
delete;
249 internal_increment_count (
void);
252 internal_check_timestamps (
void);
310 #pragma GCC diagnostic pop 406 offset (
void)
override;
417 internal_check_timestamps (
void);
519 start (
void)
override;
527 template<
typename Rep_T>
529 ticks_cast (Rep_T microsec);
547 #if defined(OS_USE_RTOS_PORT_CLOCK_SYSTICK_WAIT_FOR) 599 static constexpr uint32_t frequency_hz = 1;
656 start (
void)
override;
666 #if defined(OS_USE_RTOS_PORT_CLOCK_REALTIME_WAIT_FOR) 678 internal_wait_until_ (
timestamp_t timestamp, clock_timestamps_list& list);
749 start (
void)
override;
761 input_clock_frequency_hz (
void);
764 internal_increment_count (
void);
816 __attribute__((always_inline))
817 clock::steady_list (
void)
823 __attribute__((always_inline))
824 clock::internal_increment_count (
void)
831 __attribute__((always_inline))
832 clock::internal_check_timestamps (
void)
847 adjustable_clock::adjustable_clock (
const char* name) :
855 __attribute__((always_inline))
858 clock::internal_check_timestamps ();
860 #pragma GCC diagnostic push 861 #pragma GCC diagnostic ignored "-Wsign-conversion" 862 adjusted_list_.check_timestamp (steady_count_ + offset_);
863 #pragma GCC diagnostic pop 880 template<
typename Rep_T>
886 * (static_cast<Rep_T> (frequency_hz)))
887 +
static_cast<Rep_T
> (1000000ul) - 1)
888 /
static_cast<Rep_T
> (1000000ul));
896 __attribute__((always_inline))
904 __attribute__((always_inline))
virtual ~clock()
Destruct the clock object instance.
port::clock::timestamp_t timestamp_t
Type of variables holding clock time stamps.
High Resolution derived clock.
uint64_t timestamp_t
Type of variables holding time stamps.
timestamp_t steady_now(void)
Tell the current time since startup.
port::clock::offset_t offset_t
Type of variables holding clock offsets.
virtual void start(void)=0
Start the clock.
clock_highres hrclock
The high resolution clock object instance.
clock_rtc rtclock
The real time clock object instance.
static uint32_t input_clock_frequency_hz(void)
const char * name(void) const
Get object name.
result_t sleep_for(duration_t duration)
Sleep for a relative duration.
port::clock::duration_t duration_t
Type of variables holding clock durations.
result_t wait_for(duration_t timeout)
Timed wait for an event.
Base class for named objects.
clock_systick sysclock
The system clock object instance.
#define OS_INTEGER_SYSTICK_FREQUENCY_HZ
Define the scheduler frequency, in Hz.
static uint32_t cycles_per_tick(void)
virtual result_t sleep_until(timestamp_t timestamp)
Sleep until an absolute timestamp.
void check_timestamp(port::clock::timestamp_t now)
Check list time stamps.
Adjustable (non-steady) clock.
Ordered list of time stamp nodes.
uint32_t duration_t
Type of variables holding timer durations.
uint32_t result_t
Type of values returned by RTOS functions.
timestamp_t update_for_slept_time(duration_t duration)
Increase the internal count after a deep sleep.
void internal_check_timestamps(void)
static constexpr clock::duration_t ticks_cast(Rep_T microsec)
Convert microseconds to ticks.
virtual timestamp_t now(void)
Tell the current time, possibly adjusted for epoch.