12#if defined(OS_USE_OS_APP_CONFIG_H)
13#include <cmsis-plus/os-app-config.h>
21#pragma clang diagnostic ignored "-Wc++98-compat"
40#if defined(OS_USE_RTOS_PORT_SCHEDULER)
48#if defined(OS_TRACE_RTOS_SYSCLOCK_TICK)
50#elif defined(OS_TRACE_RTOS_SYSCLOCK_TICK_BRACES)
58 sysclock.internal_increment_count ();
62 sysclock.internal_check_timestamps ();
63 hrclock.internal_check_timestamps ();
65#if !defined(OS_INCLUDE_RTOS_REALTIME_CLOCK_DRIVER)
79#if !defined(OS_USE_RTOS_PORT_SCHEDULER)
85#if defined(OS_TRACE_RTOS_SYSCLOCK_TICK_BRACES)
98#if defined(OS_USE_RTOS_PORT_SCHEDULER)
106#if defined(OS_TRACE_RTOS_RTC_TICK)
114 rtclock.internal_increment_count ();
153 return steady_count_;
167 return steady_count_;
177#if defined(OS_TRACE_RTOS_CLOCKS)
179#pragma GCC diagnostic push
180#if defined(__clang__)
181#elif defined(__GNUC__)
182#pragma GCC diagnostic ignored "-Wuseless-cast"
185 static_cast<unsigned int> (duration),
187#pragma GCC diagnostic pop
200 res = internal_wait_until_ (timestamp, steady_list_);
218 return ENOTRECOVERABLE;
227#if defined(OS_TRACE_RTOS_CLOCKS)
239 res = internal_wait_until_ (timestamp, steady_list_);
257 return ENOTRECOVERABLE;
266#if defined(OS_TRACE_RTOS_CLOCKS)
268#pragma GCC diagnostic push
269#if defined(__clang__)
270#elif defined(__GNUC__)
271#pragma GCC diagnostic ignored "-Wuseless-cast"
274 static_cast<unsigned int> (timeout));
275#pragma GCC diagnostic pop
287 res = internal_wait_until_ (timestamp, steady_list_);
320#pragma GCC diagnostic push
321#if defined(__clang__)
322#pragma clang diagnostic ignored "-Wdeprecated-volatile"
323#elif defined(__GNUC__)
324#pragma GCC diagnostic ignored "-Wvolatile"
326 steady_count_ += duration;
327#pragma GCC diagnostic pop
329 internal_check_timestamps ();
330 return steady_count_;
350#pragma GCC diagnostic push
351#if defined(__clang__)
352#elif defined(__GNUC__)
353#pragma GCC diagnostic ignored "-Wsuggest-final-methods"
354#pragma GCC diagnostic ignored "-Wsuggest-final-types"
357 clock::internal_wait_until_ (timestamp_t timestamp,
376 crt_thread.clock_node_ = &node;
389 crt_thread.clock_node_ =
nullptr;
396#pragma GCC diagnostic pop
413#pragma GCC diagnostic push
414#if defined(__clang__)
415#elif defined(__GNUC__)
416#pragma GCC diagnostic ignored "-Wsuggest-final-methods"
425#pragma GCC diagnostic push
426#if defined(__clang__)
427#pragma clang diagnostic ignored "-Wsign-conversion"
428#elif defined(__GNUC__)
429#pragma GCC diagnostic ignored "-Wsign-conversion"
431 return steady_count_ + offset_;
432#pragma GCC diagnostic pop
435#pragma GCC diagnostic pop
443#if defined(OS_TRACE_RTOS_CLOCKS)
455 res = internal_wait_until_ (timestamp, adjusted_list_);
473 return ENOTRECOVERABLE;
544#pragma GCC diagnostic push
545#if defined(__clang__)
546#pragma clang diagnostic ignored "-Wglobal-constructors"
547#pragma clang diagnostic ignored "-Wexit-time-destructors"
554#pragma GCC diagnostic pop
578#if defined(OS_TRACE_RTOS_CLOCKS)
586#if defined(OS_USE_RTOS_PORT_CLOCK_SYSTICK_WAIT_FOR)
589 clock_systick::internal_wait_until_ (timestamp_t timestamp,
591 __attribute__ ((unused)))
646#pragma GCC diagnostic push
647#if defined(__clang__)
648#pragma clang diagnostic ignored "-Wglobal-constructors"
649#pragma clang diagnostic ignored "-Wexit-time-destructors"
656#pragma GCC diagnostic pop
685#if defined(OS_TRACE_RTOS_CLOCKS)
696#pragma GCC diagnostic push
697#if defined(__clang__)
698#pragma clang diagnostic ignored "-Wglobal-constructors"
699#pragma clang diagnostic ignored "-Wexit-time-destructors"
706#pragma GCC diagnostic pop
730#if defined(OS_TRACE_RTOS_CLOCKS)
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.
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.
clock_highres()
Construct a SysTick clock object instance.
virtual timestamp_t now(void) override
Tell the current time.
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.
virtual ~clock_systick() override
Destruct the SysTick clock object instance.
virtual offset_t offset(void)
Get 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.
void link(timestamp_node &node)
Add a new thread node to the list.
const char * name(void) const
Get object name.
Double linked list node, with time stamp and thread.
Interrupts critical section RAII helper.
static uint32_t cycles_since_tick(void)
static void internal_interrupt_service_routine(void)
RTC implementation hook.
static result_t wait_for(clock::duration_t ticks)
static void internal_interrupt_service_routine(void)
SysTick implementation hook.
POSIX compliant thread, using the default RTOS allocator.
int printf(const char *format,...)
Write a formatted string to the trace device.
int putchar(int c)
Write the single character to the trace device.
void os_systick_handler(void)
SysTick interrupt handler.
void os_rtc_handler(void)
RTC interrupt handler.
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.
bool in_handler_mode(void)
Check if the CPU is in handler mode.
uint64_t timestamp_t
Type of variables holding time stamps.
void prepare_suspend(void)
@ ok
Function completed; no errors or events occurred.
bool started(void)
Check if the scheduler was started.
bool locked(void)
Check if the scheduler is locked.
uint64_t duration_t
Type of variables holding durations in CPU cycles.
thread & thread(void)
Get the current running thread.
uint32_t result_t
Type of values returned by RTOS functions.
#define os_assert_err(__e, __er)
Assert or return an error.
Single file µOS++ RTOS definitions.
@ suspended
Not present in the READY list, waiting for an event.