![]() |
RTEMS 6.1
|
This group contains the Timecounter Handler implementation. More...
Files | |
| file | _timecounter.h |
| This header file provides timecounter definitions for the kernel space (_KERNEL is defined before including <sys/time.h>) and RTEMS. | |
| file | timecounter.h |
| This header file provides interfaces of the Timecounter Handler which are used by the implementation and the API. | |
| file | timecounterimpl.h |
| This header file provides interfaces of the Timecounter Handler which are only used by the implementation. | |
| file | _ffcounter.h |
| This header file provides interfaces of the feed-forward clock counter. | |
| file | timeffc.h |
| This header file provides interfaces of the feed-back and feed-forward clock implementations. | |
| file | timepps.h |
| This header file provides interfaces of the Pulse Per Second (PPS) support. | |
| file | timetc.h |
| This header file provides interfaces of the timecounter implementation. | |
| file | timex.h |
| This header file provides interfaces of the Network Time Protocol (NTP) support. | |
| file | kern_ntptime.c |
| This source file contains the implementation of ntp_gettime(), ntp_adjtime(), adjtime(), and _Timecounter_NTP_update_second(). | |
| file | kern_tc.c |
| This source file contains the definition of _Timecounter, _Timecounter_Time_second, and _Timecounter_Time_uptime and the implementation of _Timecounter_Set_NTP_update_second(), _Timecounter_Binuptime(), _Timecounter_Nanouptime(), _Timecounter_Microuptime(), _Timecounter_Bintime(), _Timecounter_Nanotime(), _Timecounter_Microtime(), _Timecounter_Getbinuptime(), _Timecounter_Getnanouptime(), _Timecounter_Getmicrouptime(), _Timecounter_Getbintime(), _Timecounter_Getnanotime(), _Timecounter_Getmicrotime(), _Timecounter_Getboottime(), _Timecounter_Getboottimebin(), and _Timecounter_Install(). | |
| file | opt_compat.h |
| This header file is provided for FreeBSD compatibility. | |
| file | opt_ffclock.h |
| This header file is provided for FreeBSD compatibility. | |
| file | opt_ntp.h |
| This header file is provided for FreeBSD compatibility. | |
Macros | |
| #define | _Timecounter_Acquire(lock_context) _ISR_lock_ISR_disable_and_acquire( &_Timecounter_Lock, lock_context ) |
| Acquires the timecounter lock. | |
| #define | _Timecounter_Release(lock_context) _ISR_lock_Release_and_ISR_enable(&_Timecounter_Lock, lock_context) |
| Releases the timecounter lock. | |
Typedefs | |
| typedef void(* | Timecounter_NTP_update_second) (int64_t *adjustment, time_t *newsec) |
| Handler doing the NTP update second processing shall have this type. | |
Functions | |
| void | _Timecounter_Bintime (struct bintime *bt) |
| Returns the wall clock time in the bintime format. | |
| void | _Timecounter_Nanotime (struct timespec *ts) |
| Returns the wall clock time in the timespec format. | |
| void | _Timecounter_Microtime (struct timeval *tv) |
| Returns the wall clock time in the timeval format. | |
| void | _Timecounter_Binuptime (struct bintime *bt) |
| Returns the uptime in the bintime format. | |
| int64_t | _Timecounter_Sbinuptime (void) |
| Returns the uptime in the sbintime_t format. | |
| void | _Timecounter_Nanouptime (struct timespec *ts) |
| Returns the uptime in the timespec format. | |
| void | _Timecounter_Microuptime (struct timeval *tv) |
| Returns the uptime in the timeval format. | |
| void | _Timecounter_Getbintime (struct bintime *bt) |
| Returns the wall clock time in the bintime format. | |
| void | _Timecounter_Getnanotime (struct timespec *ts) |
| Returns the wall clock time in the timespec format. | |
| void | _Timecounter_Getmicrotime (struct timeval *tv) |
| Returns the wall clock time in the timeval format. | |
| void | _Timecounter_Getbinuptime (struct bintime *bt) |
| Returns the uptime in the bintime format. | |
| void | _Timecounter_Getnanouptime (struct timespec *ts) |
| Returns the uptime in the timespec format. | |
| void | _Timecounter_Getmicrouptime (struct timeval *tv) |
| Returns the uptime in the timeval format. | |
| void | _Timecounter_Getboottime (struct timeval *tv) |
| Returns the boot time in the timeval format. | |
| void | _Timecounter_Getboottimebin (struct bintime *bt) |
| Returns the boot time in the bintime format. | |
| void | _Timecounter_Install (struct timecounter *tc) |
| Installs the timecounter. | |
| void | _Timecounter_Tick (void) |
| Performs a timecounter tick. | |
| void | _Timecounter_Tick_simple (uint32_t delta, uint32_t offset, ISR_lock_Context *lock_context) |
| Performs a simple timecounter tick. | |
| void | _Timecounter_Set_NTP_update_second (Timecounter_NTP_update_second handler) |
| Sets the NTP update second handler. | |
| void | _Timecounter_NTP_update_second (int64_t *adjustment, time_t *newsec) |
| Updates the time adjustment and seconds according to the NTP state. | |
| uint64_t | _Timecounter_Get_frequency (void) |
| Gets the frequency in Hz of the current timecounter at some time point during the call. | |
| void | _Timecounter_Discipline (struct timespec *tsp, long nsec) |
| Updates the timecounter frequency adjustment used by _Timecounter_Set_NTP_update_second(). | |
| void | _Timecounter_Set_clock (const struct bintime *bt, ISR_lock_Context *lock_context) |
| Sets the timecounter clock to the given value. | |
Variables | |
| volatile time_t | _Timecounter_Time_second |
| The wall clock time in seconds. | |
| volatile int32_t | _Timecounter_Time_uptime |
| The uptime in seconds. | |
| struct timecounter * | _Timecounter |
| The current timecounter. | |
This group contains the Timecounter Handler implementation.
| #define _Timecounter_Acquire | ( | lock_context | ) | _ISR_lock_ISR_disable_and_acquire( &_Timecounter_Lock, lock_context ) |
Acquires the timecounter lock.
| lock_context | The lock context. |
| #define _Timecounter_Release | ( | lock_context | ) | _ISR_lock_Release_and_ISR_enable(&_Timecounter_Lock, lock_context) |
Releases the timecounter lock.
| lock_context | The lock context. |
| typedef void(* Timecounter_NTP_update_second) (int64_t *adjustment, time_t *newsec) |
Handler doing the NTP update second processing shall have this type.
| [in,out] | adjustment | is the NTP time adjustment. |
| [in,out] | newsec | is the number of seconds since Unix epoch. |
| void _Timecounter_Bintime | ( | struct bintime * | bt | ) |
Returns the wall clock time in the bintime format.
| [out] | bt | Returns the wall clock time. |
| void _Timecounter_Binuptime | ( | struct bintime * | bt | ) |
Returns the uptime in the bintime format.
| [out] | bt | Returns the uptime. |
| void _Timecounter_Discipline | ( | struct timespec * | tsp, |
| long | nsec | ||
| ) |
Updates the timecounter frequency adjustment used by _Timecounter_Set_NTP_update_second().
This function is part of the time synchronization using a PPS (Pulse Per Second) signal.
When an event (a rising or falling edge of the PPS signal) occurs, the functions pps_capture() and pps_event() are executed. Only if the kernel consumer is configured to be PPS_KC_HARDPPS, the timecounter is disciplined.
| [in] | tsp | is the time at PPS event |
| [i] | nsec is the time in nanoseconds from the last PPS event |
| uint64_t _Timecounter_Get_frequency | ( | void | ) |
Gets the frequency in Hz of the current timecounter at some time point during the call.
| void _Timecounter_Getbintime | ( | struct bintime * | bt | ) |
Returns the wall clock time in the bintime format.
This function obtains the time with a lower overhead and lower accuracy compared to the _Timecounter_Bintime() variant.
| [out] | ts | Returns the wall clock time. |
| void _Timecounter_Getbinuptime | ( | struct bintime * | bt | ) |
Returns the uptime in the bintime format.
This function obtains the time with a lower overhead and lower accuracy compared to the _Timecounter_Binuptime() variant.
| [out] | ts | Returns the uptime. |
| void _Timecounter_Getboottime | ( | struct timeval * | tv | ) |
Returns the boot time in the timeval format.
| [out] | tv | Returns the boot time. |
| void _Timecounter_Getboottimebin | ( | struct bintime * | bt | ) |
Returns the boot time in the bintime format.
| [out] | tv | Returns the boot time. |
| void _Timecounter_Getmicrotime | ( | struct timeval * | tv | ) |
Returns the wall clock time in the timeval format.
This function obtains the time with a lower overhead and lower accuracy compared to the _Timecounter_Microtime() variant.
| [out] | tv | Returns the wall clock time. |
| void _Timecounter_Getmicrouptime | ( | struct timeval * | tv | ) |
Returns the uptime in the timeval format.
This function obtains the time with a lower overhead and lower accuracy compared to the _Timecounter_Microuptime() variant.
| [out] | tv | Returns the uptime. |
| void _Timecounter_Getnanotime | ( | struct timespec * | ts | ) |
Returns the wall clock time in the timespec format.
This function obtains the time with a lower overhead and lower accuracy compared to the _Timecounter_Nanotime() variant.
| [out] | ts | Returns the wall clock time. |
| void _Timecounter_Getnanouptime | ( | struct timespec * | ts | ) |
Returns the uptime in the timespec format.
This function obtains the time with a lower overhead and lower accuracy compared to the _Timecounter_Nanouptime() variant.
| [out] | ts | Returns the uptime. |
| void _Timecounter_Install | ( | struct timecounter * | tc | ) |
Installs the timecounter.
The timecounter structure must contain valid values in the fields tc_get_timecount, tc_counter_mask, tc_frequency and tc_quality. All other fields must be zero initialized.
| tc | The timecounter. |
| void _Timecounter_Microtime | ( | struct timeval * | tv | ) |
Returns the wall clock time in the timeval format.
| [out] | tv | Returns the wall clock time. |
| void _Timecounter_Microuptime | ( | struct timeval * | tv | ) |
Returns the uptime in the timeval format.
| [out] | tv | Returns the uptime. |
| void _Timecounter_Nanotime | ( | struct timespec * | ts | ) |
Returns the wall clock time in the timespec format.
| [out] | ts | Returns the wall clock time. |
| void _Timecounter_Nanouptime | ( | struct timespec * | ts | ) |
Returns the uptime in the timespec format.
| [out] | ts | Returns the uptime. |
| void _Timecounter_NTP_update_second | ( | int64_t * | adjustment, |
| time_t * | newsec | ||
| ) |
Updates the time adjustment and seconds according to the NTP state.
| [in,out] | adjustment | is the NTP time adjustment. |
| [in,out] | newsec | is the number of seconds since Unix epoch. |
| int64_t _Timecounter_Sbinuptime | ( | void | ) |
Returns the uptime in the sbintime_t format.
| void _Timecounter_Set_clock | ( | const struct bintime * | bt, |
| ISR_lock_Context * | lock_context | ||
| ) |
Sets the timecounter clock to the given value.
| bt | The value to set the clock to. |
| lock_context | The interrupt lock context. |
| void _Timecounter_Set_NTP_update_second | ( | Timecounter_NTP_update_second | handler | ) |
Sets the NTP update second handler.
| handler | is the new NTP update second handler used to carry out the NTP update second processing. |
| void _Timecounter_Tick_simple | ( | uint32_t | delta, |
| uint32_t | offset, | ||
| ISR_lock_Context * | lock_context | ||
| ) |
Performs a simple timecounter tick.
This is a special purpose tick function for simple timecounter to support legacy clock drivers.
| delta | The time in timecounter ticks elapsed since the last call to _Timecounter_Tick_simple(). |
| offset | The current value of the timecounter. |
| ] | lock_context The lock context of the corresponding _Timecounter_Acquire(). |
|
extern |
The uptime in seconds.
For compatibility with the FreeBSD network stack the initial value is one second.