RTEMS CPU Kit with SuperCore
4.11.3
|
Clock Manager API. More...
![]() |
Files | |
file | clockget.c |
Obtain Current Time of Day. | |
file | clockgetsecondssinceepoch.c |
Obtain Seconds Since Epoch. | |
file | clockgettickspersecond.c |
Obtain Ticks Per Seconds. | |
file | clockgettod.c |
Obtain Current Time of Day (Classic TOD) | |
file | clockgettodtimeval.c |
Obtain TOD in struct timeval Format. | |
file | clockgetuptime.c |
Obtain the System Uptime. | |
file | clockgetuptimenanoseconds.c |
Returns the system uptime in seconds. | |
file | clockgetuptimetimeval.c |
Gets the System Uptime in the Struct Timeval Format. | |
file | clockset.c |
Set the Current TOD. | |
file | clocktick.c |
Announce a Clock Tick. | |
file | clocktodtoseconds.c |
TOD to Seconds. | |
file | clocktodvalidate.c |
TOD Validate. | |
file | rtclock.c |
No Initialization Routine. | |
Enumerations | |
enum | rtems_clock_get_options { RTEMS_CLOCK_GET_TOD, RTEMS_CLOCK_GET_SECONDS_SINCE_EPOCH, RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, RTEMS_CLOCK_GET_TICKS_PER_SECOND, RTEMS_CLOCK_GET_TIME_VALUE } |
List of things which can be returned by the rtems_clock_get directive. More... | |
Functions | |
rtems_status_code | rtems_clock_get (rtems_clock_get_options option, void *time_buffer) |
Obtain Current Time of Day. More... | |
rtems_status_code | rtems_clock_get_tod (rtems_time_of_day *time_buffer) |
Obtain Current Time of Day (Classic TOD) More... | |
rtems_status_code | rtems_clock_get_tod_timeval (struct timeval *time) |
Obtain TOD in struct timeval Format. More... | |
rtems_status_code | rtems_clock_get_seconds_since_epoch (rtems_interval *the_interval) |
Obtain Seconds Since Epoch. More... | |
RTEMS_INLINE_ROUTINE rtems_interval | rtems_clock_get_ticks_since_boot (void) |
Gets the current ticks counter value. More... | |
RTEMS_INLINE_ROUTINE rtems_interval | rtems_clock_tick_later (rtems_interval delta) |
Returns the ticks counter value delta ticks in the future. More... | |
RTEMS_INLINE_ROUTINE rtems_interval | rtems_clock_tick_later_usec (rtems_interval delta_in_usec) |
Returns the ticks counter value at least delta microseconds in the future. More... | |
RTEMS_INLINE_ROUTINE bool | rtems_clock_tick_before (rtems_interval tick) |
Returns true if the current ticks counter value indicates a time before the time specified by the tick value and false otherwise. More... | |
rtems_interval | rtems_clock_get_ticks_per_second (void) |
Obtain Ticks Per Seconds. More... | |
rtems_status_code | rtems_clock_set (const rtems_time_of_day *time_buffer) |
Set the Current TOD. More... | |
rtems_status_code | rtems_clock_tick (void) |
Announce a Clock Tick. More... | |
rtems_status_code | rtems_clock_get_uptime (struct timespec *uptime) |
Obtain the System Uptime. More... | |
void | rtems_clock_get_uptime_timeval (struct timeval *uptime) |
Gets the System Uptime in the Struct Timeval Format. More... | |
RTEMS_INLINE_ROUTINE time_t | rtems_clock_get_uptime_seconds (void) |
Returns the system uptime in seconds. More... | |
uint64_t | rtems_clock_get_uptime_nanoseconds (void) |
Returns the system uptime in nanoseconds. More... | |
bool | _TOD_Validate (const rtems_time_of_day *the_tod) |
TOD Validate. More... | |
Watchdog_Interval | _TOD_To_seconds (const rtems_time_of_day *the_tod) |
TOD to Seconds. More... | |
Clock Manager API.
This encapsulates functionality related to the Classic API Clock Manager.
This include file contains all the constants and structures associated with the Clock Manager. This manager provides facilities to set, obtain, and continually update the current date and time.
This manager provides directives to:
List of things which can be returned by the rtems_clock_get directive.
Watchdog_Interval _TOD_To_seconds | ( | const rtems_time_of_day * | the_tod | ) |
TOD to Seconds.
This function returns the number seconds between the epoch and the_tod.
[in] | the_tod | is the TOD structure to convert to seconds |
This | method returns the number of seconds since epoch represented by the_tod |
References rtems_time_of_day::day, and rtems_time_of_day::year.
Referenced by rtems_clock_get_uptime_seconds(), rtems_clock_set(), rtems_task_wake_when(), rtems_timer_fire_when(), and rtems_timer_server_fire_when().
bool _TOD_Validate | ( | const rtems_time_of_day * | the_tod | ) |
TOD Validate.
This support function returns true if the_tod contains a valid time of day, and false otherwise.
[in] | the_tod | is the TOD structure to validate |
This | method returns true if the TOD is valid and false otherwise. |
References TOD_MICROSECONDS_PER_SECOND.
Referenced by rtems_clock_get_uptime_seconds(), rtems_clock_set(), rtems_task_wake_when(), rtems_timer_fire_when(), and rtems_timer_server_fire_when().
rtems_status_code rtems_clock_get | ( | rtems_clock_get_options | option, |
void * | time_buffer | ||
) |
Obtain Current Time of Day.
This routine implements the rtems_clock_get directive. It returns one of the following:
[in] | option | is the format of time to return |
[in] | time_buffer | points to the output area |
This | method returns RTEMS_SUCCESSFUL if there was not an error. Otherwise, a status code is returned indicating the source of the error. |
References RTEMS_CLOCK_GET_SECONDS_SINCE_EPOCH, rtems_clock_get_seconds_since_epoch(), RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, RTEMS_CLOCK_GET_TOD, rtems_clock_get_tod(), and RTEMS_INVALID_ADDRESS.
rtems_status_code rtems_clock_get_seconds_since_epoch | ( | rtems_interval * | the_interval | ) |
Obtain Seconds Since Epoch.
This routine implements the rtems_clock_get_seconds_since_epoch directive.
[in] | the_interval | points to the interval variable to fill in |
This | method returns RTEMS_SUCCESSFUL if there was not an error. Otherwise, a status code is returned indicating the source of the error. If successful, the time_buffer will be filled in with the current time of day. |
References _TOD_Is_set(), RTEMS_INVALID_ADDRESS, and RTEMS_NOT_DEFINED.
Referenced by rtems_clock_get().
rtems_interval rtems_clock_get_ticks_per_second | ( | void | ) |
Obtain Ticks Per Seconds.
This routine implements the rtems_clock_get_ticks_per_second directive.
This | method returns the number of ticks per second. It cannot fail since RTEMS is always configured to know the number of ticks per second. |
References TOD_MICROSECONDS_PER_SECOND.
RTEMS_INLINE_ROUTINE rtems_interval rtems_clock_get_ticks_since_boot | ( | void | ) |
Gets the current ticks counter value.
References _Watchdog_Ticks_since_boot.
Referenced by _times().
rtems_status_code rtems_clock_get_tod | ( | rtems_time_of_day * | time_buffer | ) |
Obtain Current Time of Day (Classic TOD)
This routine implements the rtems_clock_get_tod directive. It returns the current time of day in the format defined by RTEID.
Clock Manager - rtems_clock_get_tod
[in] | time_buffer | points to the time of day structure |
This | method returns RTEMS_SUCCESSFUL if there was not an error. Otherwise, a status code is returned indicating the source of the error. If successful, the time_buffer will be filled in with the current time of day. |
References _TOD_Get_timeval(), _TOD_Is_set(), RTEMS_INVALID_ADDRESS, and RTEMS_NOT_DEFINED.
Referenced by rtems_clock_get().
rtems_status_code rtems_clock_get_tod_timeval | ( | struct timeval * | time | ) |
Obtain TOD in struct timeval Format.
This routine implements the rtems_clock_get_tod_timeval directive.
[in] | time | points to the struct timeval variable to fill in |
This | method returns RTEMS_SUCCESSFUL if there was not an error. Otherwise, a status code is returned indicating the source of the error. If successful, the time will be filled in with the current time of day. |
References _TOD_Get_timeval(), _TOD_Is_set(), RTEMS_INVALID_ADDRESS, RTEMS_NOT_DEFINED, and RTEMS_SUCCESSFUL.
rtems_status_code rtems_clock_get_uptime | ( | struct timespec * | uptime | ) |
Obtain the System Uptime.
This directive returns the system uptime.
[in] | uptime | is a pointer to the time structure |
This | method returns RTEMS_SUCCESSFUL if there was not an error. Otherwise, a status code is returned indicating the source of the error. If successful, the uptime will be filled in. |
References RTEMS_INVALID_ADDRESS.
uint64_t rtems_clock_get_uptime_nanoseconds | ( | void | ) |
Returns the system uptime in nanoseconds.
The | system uptime in nanoseconds. |
Referenced by rtems_clock_get_uptime_seconds().
RTEMS_INLINE_ROUTINE time_t rtems_clock_get_uptime_seconds | ( | void | ) |
Returns the system uptime in seconds.
The | system uptime in seconds. |
References _Timecounter_Time_uptime, _TOD_To_seconds(), _TOD_Validate(), and rtems_clock_get_uptime_nanoseconds().
void rtems_clock_get_uptime_timeval | ( | struct timeval * | uptime | ) |
Gets the System Uptime in the Struct Timeval Format.
[out] | uptime | is a pointer to a struct timeval structure. |
This | methods returns the system uptime. |
rtems_status_code rtems_clock_set | ( | const rtems_time_of_day * | time_buffer | ) |
Set the Current TOD.
This routine implements the rtems_clock_set directive. It sets the current time of day to that in the time_buffer record.
[in] | time_buffer | points to the new TOD |
This | method returns RTEMS_SUCCESSFUL if there was not an error. Otherwise, a status code is returned indicating the source of the error. |
References _TOD_To_seconds(), _TOD_Validate(), RTEMS_INVALID_ADDRESS, and rtems_time_of_day::ticks.
rtems_status_code rtems_clock_tick | ( | void | ) |
Announce a Clock Tick.
This routine implements the rtems_clock_tick directive. It is invoked to inform RTEMS of the occurrence of a clock tick.
This | directive always returns RTEMS_SUCCESSFUL. |
References _Timecounter_Acquire, and _Timecounter_Tick_simple().
RTEMS_INLINE_ROUTINE bool rtems_clock_tick_before | ( | rtems_interval | tick | ) |
Returns true if the current ticks counter value indicates a time before the time specified by the tick value and false otherwise.
[in] | tick | The tick value. |
This can be used to write busy loops with a timeout.
true | The current ticks counter value indicates a time before the time specified by the tick value. |
false | Otherwise. |
RTEMS_INLINE_ROUTINE rtems_interval rtems_clock_tick_later | ( | rtems_interval | delta | ) |
Returns the ticks counter value delta ticks in the future.
[in] | delta | The ticks delta value. |
References _Watchdog_Ticks_since_boot.
RTEMS_INLINE_ROUTINE rtems_interval rtems_clock_tick_later_usec | ( | rtems_interval | delta_in_usec | ) |
Returns the ticks counter value at least delta microseconds in the future.
[in] | delta_in_usec | The delta value in microseconds. |