18 #ifndef _RTEMS_SCORE_TODIMPL_H 19 #define _RTEMS_SCORE_TODIMPL_H 21 #include <rtems/score/status.h> 49 #define TOD_SECONDS_PER_MINUTE (uint32_t)60 54 #define TOD_MINUTES_PER_HOUR (uint32_t)60 59 #define TOD_MONTHS_PER_YEAR (uint32_t)12 64 #define TOD_DAYS_PER_YEAR (uint32_t)365 69 #define TOD_HOURS_PER_DAY (uint32_t)24 75 #define TOD_SECONDS_PER_DAY (uint32_t) (TOD_SECONDS_PER_MINUTE * \ 76 TOD_MINUTES_PER_HOUR * \ 82 #define TOD_SECONDS_PER_NON_LEAP_YEAR (365 * TOD_SECONDS_PER_DAY) 87 #define TOD_MILLISECONDS_PER_SECOND (uint32_t)1000 92 #define TOD_MICROSECONDS_PER_SECOND (uint32_t)1000000 97 #define TOD_NANOSECONDS_PER_SECOND (uint32_t)1000000000 102 #define TOD_NANOSECONDS_PER_MICROSECOND (uint32_t)1000 111 #define TOD_SECONDS_1970_THROUGH_1988 \ 112 (((1987 - 1970 + 1) * TOD_SECONDS_PER_NON_LEAP_YEAR) + \ 113 (4 * TOD_SECONDS_PER_DAY)) 122 #define TOD_BASE_YEAR 1988 166 #if defined(RTEMS_DEBUG) 167 bool _TOD_Is_owner(
void );
205 const struct timespec *tod,
260 struct timespec *time
300 #define TOD_TICKS_PER_SECOND TOD_TICKS_PER_SECOND_method() 324 const struct timespec *delta
417 const struct timespec *tod
static __inline__ bool _TOD_Is_set(void)
Check if the TOD is Set.
Status_Control _TOD_Set(const struct timespec *tod, ISR_lock_Context *lock_context)
Sets the time of day.
static void _TOD_Get_uptime(Timestamp_Control *time)
Gets the system uptime with potential accuracy to the nanosecond.
int64_t Timestamp_Control
#define _Timecounter_Release(lock_context)
Releases the timecounter lock.
Helpers for Manipulating Timestamps.
void _Timecounter_Nanouptime(struct timespec *ts)
Returns the uptime in the timespec format.
static void _TOD_Get_zero_based_uptime(Timestamp_Control *time)
Gets the system uptime with potential accuracy to the nanosecond.
struct TOD_Hook TOD_Hook
Structure to manage each TOD action hook.
Constant to indicate the TOD is being set.
Constants and Structures Associated with Watchdog Timers.
bool is_set
Indicates if the time of day is set.
TOD_Action
Possible actions where a registered hook could be invoked.
#define _Timecounter_Acquire(lock_context)
Lock to protect the timecounter mechanic.
static void _TOD_Release(ISR_lock_Context *lock_context)
Releases the lock context for the timecounter.
volatile time_t _Timecounter_Time_second
The wall clock time in seconds.
void _TOD_Adjust(const struct timespec *delta)
Adjusts the Time of Time.
Chain_Control _TOD_Hooks
Set of registered methods for TOD Actions.
void _TOD_Hook_Unregister(TOD_Hook *hook)
Remove a TOD Action Hook.
static void _TOD_Acquire(ISR_lock_Context *lock_context)
Checks if api mutex is owner of the time of day mutex.
Status_Control _TOD_Hook_Run(TOD_Action action, const struct timespec *tod)
Run the TOD Action Hooks.
TOD_Control _TOD
TOD Management information.
Status_Control(* handler)(TOD_Action, const struct timespec *)
void _TOD_Hook_Register(TOD_Hook *hook)
Add a TOD Action Hook.
Structure to manage each TOD action hook.
Timecounter Implementation.
static void _TOD_Get(struct timespec *tod)
Gets the current time in the timespec format.
void _TOD_Unlock(void)
Unlocks the time of day mutex.
static __inline__ void _TOD_Get_timeval(struct timeval *time)
This routine returns a timeval based upon the internal timespec format TOD.
static uint32_t _TOD_Seconds_since_epoch(void)
Returns Number of seconds Since RTEMS epoch.
void _Timecounter_Nanotime(struct timespec *ts)
Returns the wall clock time in the timespec format.
static void _TOD_Get_zero_based_uptime_as_timespec(struct timespec *time)
Gets the system uptime with potential accuracy to the nanosecond.
Local ISR lock context for acquire and release pairs.
#define RTEMS_INLINE_ROUTINE
Gives a hint to the compiler in a function declaration to inline this function.
int64_t _Timecounter_Sbinuptime(void)
Returns the uptime in the sbintime_t format.
void _Timecounter_Microtime(struct timeval *tv)
Returns the wall clock time in the timeval format.
uint32_t TOD_TICKS_PER_SECOND_method(void)
Gets number of ticks in a second.
void _TOD_Lock(void)
Locks the time of day mutex.