SysTick derived clock. More...
#include <cmsis-plus/rtos/os.h>
Inheritance diagram for os::rtos::clock_systick:Public Types | |
Types & Constants | |
| using | duration_t = port::clock::duration_t |
| Type of variables holding clock durations. | |
| using | timestamp_t = port::clock::timestamp_t |
| Type of variables holding clock time stamps. | |
| using | offset_t = port::clock::offset_t |
| Type of variables holding clock offsets. | |
Public Member Functions | |
Constructors & Destructor | |
| clock_systick () | |
| Construct a SysTick clock object instance. | |
| virtual | ~clock_systick () override |
| Destruct the SysTick clock object instance. | |
Public Member Functions | |
| virtual timestamp_t | now (void) |
| Tell the current time, possibly adjusted for epoch. | |
| timestamp_t | steady_now (void) |
| Tell the current time since startup. | |
| result_t | sleep_for (duration_t duration) |
| Sleep for a relative duration. | |
| virtual result_t | sleep_until (timestamp_t timestamp) |
| Sleep until an absolute timestamp. | |
| result_t | wait_for (duration_t timeout) |
| Timed wait for an event. | |
| timestamp_t | update_for_slept_time (duration_t duration) |
| Increase the internal count after a deep sleep. | |
| virtual offset_t | offset (void) |
| Get adjustment offset (placeholder). | |
| virtual offset_t | offset (offset_t value) |
| Set adjustment offset (placeholder) | |
Public Member Functions | |
| const char * | name (void) const |
| Get object name. | |
Static Public Attributes | |
Types & Constants | |
| static constexpr uint32_t | frequency_hz = OS_INTEGER_SYSTICK_FREQUENCY_HZ |
| SysTick frequency in Hz. | |
Public Member Functions | |
| virtual void | start (void) override |
| Start the clock. | |
| template<typename Rep_T > | |
| static constexpr clock::duration_t | ticks_cast (Rep_T microsec) |
| Convert microseconds to ticks. | |
Definition at line 460 of file os-clocks.h.
| os::rtos::clock_systick::clock_systick | ( | ) |
|
overridevirtual |
|
inlineinherited |
All objects return a non-null string; anonymous objects return "-".
Definition at line 753 of file os-decls.h.
Referenced by os::memory::lifo::lifo(), os::memory::malloc_memory_resource::malloc_memory_resource(), os::rtos::message_queue_typed< T, Allocator >::message_queue_typed(), os::memory::block_pool::~block_pool(), os::rtos::event_flags::~event_flags(), os::memory::first_fit_top::~first_fit_top(), os::memory::lifo::~lifo(), os::memory::malloc_memory_resource::~malloc_memory_resource(), os::rtos::memory_pool::~memory_pool(), os::rtos::message_queue::~message_queue(), os::rtos::mutex::~mutex(), os::rtos::semaphore::~semaphore(), os::rtos::thread::~thread(), os::rtos::timer::~timer(), os::rtos::memory_pool::alloc(), os::rtos::thread::cancel(), os::rtos::event_flags::clear(), os::rtos::mutex::consistent(), os::rtos::thread::detach(), os::memory::new_delete_memory_resource::do_allocate(), os::memory::block_pool::do_allocate(), os::memory::first_fit_top::do_allocate(), os::memory::lifo::do_allocate(), os::memory::malloc_memory_resource::do_allocate(), os::rtos::thread::flags_raise(), os::rtos::memory_pool::free(), os::rtos::event_flags::get(), os::rtos::thread::interrupt(), os::rtos::thread::join(), os::rtos::thread::kill(), os::rtos::internal::terminated_threads_list::link(), os::rtos::mutex::lock(), os::rtos::memory::memory_resource::out_of_memory_handler(), os::rtos::semaphore::post(), os::rtos::mutex::prio_ceiling(), os::rtos::mutex::prio_ceiling(), os::rtos::thread::priority(), os::rtos::thread::priority_inherited(), os::rtos::event_flags::raise(), os::rtos::message_queue::receive(), os::rtos::memory_pool::reset(), os::rtos::message_queue::reset(), os::rtos::mutex::reset(), os::rtos::semaphore::reset(), os::rtos::thread::resume(), os::rtos::message_queue::send(), os::rtos::clock::sleep_for(), os::rtos::timer::start(), os::rtos::timer::stop(), os::rtos::memory_pool::timed_alloc(), os::rtos::mutex::timed_lock(), os::rtos::message_queue::timed_receive(), os::rtos::message_queue::timed_send(), os::rtos::semaphore::timed_wait(), os::rtos::event_flags::timed_wait(), os::rtos::memory::memory_resource::trace_print_statistics(), os::rtos::memory_pool::try_alloc(), os::rtos::mutex::try_lock(), os::rtos::message_queue::try_receive(), os::rtos::message_queue::try_send(), os::rtos::event_flags::try_wait(), os::rtos::semaphore::try_wait(), os::rtos::internal::ready_threads_list::unlink_head(), os::rtos::mutex::unlock(), os::rtos::event_flags::wait(), os::rtos::semaphore::wait(), and os::rtos::event_flags::waiting().
|
virtualinherited |
Reimplemented in os::rtos::adjustable_clock, and os::rtos::clock_highres.
Definition at line 147 of file os-clocks.cpp.
Referenced by os::rtos::internal::clock_timestamps_list::check_timestamp(), os::estd::chrono::systick_clock::now(), os::estd::chrono::system_clock::now(), os_sysclock_now(), and os::rtos::clock::sleep_until().
| [in] | value | Ignored for steady clocks. |
Reimplemented in os::rtos::adjustable_clock.
|
virtualinherited |
Reimplemented in os::rtos::adjustable_clock.
Definition at line 335 of file os-clocks.cpp.
|
inherited |
| [in] | duration | The number of clock units (ticks or seconds) to sleep. |
| ETIMEDOUT | The sleep lasted the entire duration. |
| EPERM | Cannot be invoked from an Interrupt Service Routines. |
| EINTR | The sleep was interrupted. |
Definition at line 175 of file os-clocks.cpp.
References os::rtos::interrupts::in_handler_mode(), os::rtos::scheduler::locked(), os::rtos::internal::object_named::name(), os::rtos::result::ok, os_assert_err, os::trace::printf(), os::rtos::clock::steady_now(), and os::rtos::this_thread::thread().
Referenced by os_sysclock_sleep_for(), and osDelay().
|
virtualinherited |
| [in] | timestamp | The absolute moment in time, in clock units. |
| ETIMEDOUT | The sleep lasted the entire duration. |
| EPERM | Cannot be invoked from an Interrupt Service Routines. |
| EINTR | The sleep was interrupted. |
Reimplemented in os::rtos::adjustable_clock.
Definition at line 225 of file os-clocks.cpp.
References os::rtos::interrupts::in_handler_mode(), os::rtos::scheduler::locked(), os::rtos::clock::now(), os::rtos::result::ok, os_assert_err, os::trace::printf(), and os::rtos::this_thread::thread().
Referenced by os_sysclock_sleep_until().
|
overridevirtual |
For system clocks it is called from the system startup code.
Implements os::rtos::clock.
Referenced by os::rtos::scheduler::start().
|
inherited |
Definition at line 161 of file os-clocks.cpp.
Referenced by os::rtos::clock::sleep_for(), and os::rtos::clock::wait_for().
|
staticconstexpr |
| Rep_T | Type of input, auto deduced (usually uint32_t or uin64_t) |
| [in] | microsec | The number of microseconds. |
Referenced by osDelay(), osMutexWait(), osSignalWait(), and osTimerStart().
|
inherited |
| duration | Number of ticks lost during sleep. |
During deep sleep the interrupts used to count clock ticks are usually disabled and an external RTC is configured to wake-up the device, so a number of clock ticks are lost.
To keep the clocks accurate, it is recommended to sample the external RTC before entering deep sleep and again when the device is back to life, compute the time slept as difference, and use this function to update the internal clock counter.
Definition at line 315 of file os-clocks.cpp.
|
inherited |
| [in] | timeout | The timeout in clock units. |
| result::ok | An event occurred before the timeout. |
| ETIMEDOUT | The wait lasted the entire duration. |
| EPERM | Cannot be invoked from an Interrupt Service Routines. |
| EINTR | The sleep was interrupted. |
Definition at line 264 of file os-clocks.cpp.
References os::rtos::interrupts::in_handler_mode(), os::rtos::scheduler::locked(), os_assert_err, os::trace::printf(), os::rtos::clock::steady_now(), and os::rtos::this_thread::thread().
Referenced by os_sysclock_wait_for().
|
staticconstexpr |
Definition at line 471 of file os-clocks.h.
Referenced by main(), and os_systick_handler().