C API clocks definitions. More...
Classes | |
struct | os_clock_s |
Clock object storage. More... | |
Typedefs | |
typedef struct os_clock_s | os_clock_t |
Clock object storage. | |
Clock handlers | |
void | os_systick_handler (void) |
SysTick interrupt handler. | |
void | os_rtc_handler (void) |
RTC interrupt handler. | |
C API clocks definitions.
typedef struct os_clock_s os_clock_t |
Clock object storage.
This C structure has the same size as the C++ os::rtos::clock
object.
The members of this structure are hidden and should not be used directly, but only through specific functions.
os_clock_t * os_clock_get_hrclock | ( | void | ) |
Get hrclock
(the high resolution clock).
Definition at line 1208 of file os-c-wrapper.cpp.
const char * os_clock_get_name | ( | os_clock_t * | clock | ) |
Get the clock name.
[in] | clock | Pointer to clock object instance. |
Definition at line 1073 of file os-c-wrapper.cpp.
os_clock_offset_t os_clock_get_offset | ( | os_clock_t * | clock | ) |
Get adjustment offset.
[in] | clock | Pointer to clock object instance. |
Definition at line 1154 of file os-c-wrapper.cpp.
os_clock_t * os_clock_get_rtclock | ( | void | ) |
Get rtclock
(the real-time clock).
Definition at line 1196 of file os-c-wrapper.cpp.
os_clock_t * os_clock_get_sysclock | ( | void | ) |
Get sysclock
(the system clock).
Definition at line 1184 of file os-c-wrapper.cpp.
os_clock_timestamp_t os_clock_now | ( | os_clock_t * | clock | ) |
Tell the current time, possibly adjusted for epoch.
[in] | clock | Pointer to clock object instance. |
Definition at line 1086 of file os-c-wrapper.cpp.
os_clock_offset_t os_clock_set_offset | ( | os_clock_t * | clock, |
os_clock_offset_t | offset | ||
) |
Set adjustment offset.
[in] | clock | Pointer to clock object instance. |
[in] | offset | Integer representing the offset to epoch (positive). |
Definition at line 1168 of file os-c-wrapper.cpp.
os_result_t os_clock_sleep_for | ( | os_clock_t * | clock, |
os_clock_duration_t | duration | ||
) |
Sleep for a relative duration.
[in] | clock | Pointer to clock object instance. |
[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 1112 of file os-c-wrapper.cpp.
os_result_t os_clock_sleep_until | ( | os_clock_t * | clock, |
os_clock_timestamp_t | timestamp | ||
) |
Sleep until an absolute timestamp.
[in] | clock | Pointer to clock object instance. |
[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. |
Definition at line 1126 of file os-c-wrapper.cpp.
os_clock_timestamp_t os_clock_steady_now | ( | os_clock_t * | clock | ) |
Tell the current time since startup.
[in] | clock | Pointer to clock object instance. |
Definition at line 1099 of file os-c-wrapper.cpp.
os_result_t os_clock_wait_for | ( | os_clock_t * | clock, |
os_clock_duration_t | timeout | ||
) |
Timed wait for an event.
[in] | clock | Pointer to clock object instance. |
[in] | timeout | The timeout in clock units. |
os_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 1140 of file os-c-wrapper.cpp.
void os_rtc_handler | ( | void | ) |
RTC interrupt handler.
Must be called from the physical RTC interrupt handler.
Definition at line 105 of file os-clocks.cpp.
os_clock_timestamp_t os_sysclock_now | ( | void | ) |
Tell the current time since startup.
Definition at line 1222 of file os-c-wrapper.cpp.
os_result_t os_sysclock_sleep_for | ( | os_clock_duration_t | duration | ) |
Sleep for a relative duration.
[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 1234 of file os-c-wrapper.cpp.
os_result_t os_sysclock_sleep_until | ( | os_clock_timestamp_t | timestamp | ) |
Sleep until an absolute timestamp.
[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. |
Definition at line 1246 of file os-c-wrapper.cpp.
|
inline |
Convert microseconds to ticks.
[in] | microsec | The number of microseconds. |
Definition at line 983 of file os-c-api.h.
|
inline |
Convert microseconds to ticks.
[in] | microsec | The number of microseconds. |
Definition at line 997 of file os-c-api.h.
os_result_t os_sysclock_wait_for | ( | os_clock_duration_t | timeout | ) |
Timed wait for an event.
[in] | timeout | The timeout in clock units. |
os_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 1258 of file os-c-wrapper.cpp.
void os_systick_handler | ( | void | ) |
SysTick interrupt handler.
Must be called from the physical interrupt handler.
Definition at line 48 of file os-clocks.cpp.