33#pragma clang diagnostic ignored "-Wc++98-compat"
52#if defined(OS_USE_RTOS_PORT_SCHEDULER)
60#if defined(OS_TRACE_RTOS_SYSCLOCK_TICK)
68 sysclock.internal_increment_count ();
72 sysclock.internal_check_timestamps ();
73 hrclock.internal_check_timestamps ();
75#if !defined(OS_INCLUDE_RTOS_REALTIME_CLOCK_DRIVER)
89#if !defined(OS_USE_RTOS_PORT_SCHEDULER)
95#if defined(OS_TRACE_RTOS_SYSCLOCK_TICK)
108#if defined(OS_USE_RTOS_PORT_SCHEDULER)
116#if defined(OS_TRACE_RTOS_RTC_TICK)
124 rtclock.internal_increment_count ();
179 return steady_count_;
193 return steady_count_;
203#if defined(OS_TRACE_RTOS_CLOCKS)
205 static_cast<unsigned int> (duration),
218 res = internal_wait_until_ (timestamp, steady_list_);
236 return ENOTRECOVERABLE;
245#if defined(OS_TRACE_RTOS_CLOCKS)
257 res = internal_wait_until_ (timestamp, steady_list_);
275 return ENOTRECOVERABLE;
284#if defined(OS_TRACE_RTOS_CLOCKS)
285 trace::printf (
"%s(%u)\n", __func__,
static_cast<unsigned int> (timeout));
296 res = internal_wait_until_ (timestamp, steady_list_);
329#pragma GCC diagnostic push
330#if defined(__clang__)
331#pragma clang diagnostic ignored "-Wdeprecated-volatile"
333 steady_count_ += duration;
334#pragma GCC diagnostic pop
336 internal_check_timestamps ();
337 return steady_count_;
352 clock::offset (offset_t offset __attribute__((unused)))
358 clock::internal_wait_until_ (timestamp_t timestamp,
367 { timestamp, crt_thread };
378 crt_thread.clock_node_ = &node;
391 crt_thread.clock_node_ =
nullptr;
422#pragma GCC diagnostic push
423#pragma GCC diagnostic ignored "-Wsign-conversion"
424 return steady_count_ + offset_;
425#pragma GCC diagnostic pop
435#if defined(OS_TRACE_RTOS_CLOCKS)
447 res = internal_wait_until_ (timestamp, adjusted_list_);
465 return ENOTRECOVERABLE;
534#pragma GCC diagnostic push
535#if defined(__clang__)
536#pragma clang diagnostic ignored "-Wglobal-constructors"
537#pragma clang diagnostic ignored "-Wexit-time-destructors"
543#pragma GCC diagnostic pop
571#if defined(OS_TRACE_RTOS_CLOCKS)
579#if defined(OS_USE_RTOS_PORT_CLOCK_SYSTICK_WAIT_FOR)
582 clock_systick::internal_wait_until_ (timestamp_t timestamp,
637#pragma GCC diagnostic push
638#if defined(__clang__)
639#pragma clang diagnostic ignored "-Wglobal-constructors"
640#pragma clang diagnostic ignored "-Wexit-time-destructors"
646#pragma GCC diagnostic pop
679#if defined(OS_TRACE_RTOS_CLOCKS)
690#pragma GCC diagnostic push
691#if defined(__clang__)
692#pragma clang diagnostic ignored "-Wglobal-constructors"
693#pragma clang diagnostic ignored "-Wexit-time-destructors"
699#pragma GCC diagnostic pop
727#if defined(OS_TRACE_RTOS_CLOCKS)
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
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 ~clock_systick() override
Destruct the SysTick clock object instance.
clock_systick()
Construct a SysTick clock object instance.
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.
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.
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.
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.
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.