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)
167bool _TOD_Is_owner(
void );
205 const struct timespec *tod,
214static inline void _TOD_Get(
231static inline void _TOD_Get_uptime(
245static inline void _TOD_Get_zero_based_uptime(
259static inline void _TOD_Get_zero_based_uptime_as_timespec(
260 struct timespec *time
275static inline uint32_t _TOD_Seconds_since_epoch(
void )
300#define TOD_TICKS_PER_SECOND TOD_TICKS_PER_SECOND_method()
324 const struct timespec *delta
417 const struct timespec *tod
Constants and Structures Associated with Watchdog Timers.
#define RTEMS_INLINE_ROUTINE
Definition: basedefs.h:66
Status_Control _TOD_Hook_Run(TOD_Action action, const struct timespec *tod)
Run the TOD Action Hooks.
Definition: coretodhookrun.c:45
Chain_Control _TOD_Hooks
Set of registered methods for TOD Actions.
Definition: coretodhookdata.c:44
void _TOD_Hook_Unregister(TOD_Hook *hook)
Remove a TOD Action Hook.
Definition: coretodhookunregister.c:44
struct TOD_Hook TOD_Hook
Structure to manage each TOD action hook.
void _TOD_Hook_Register(TOD_Hook *hook)
Add a TOD Action Hook.
Definition: coretodhookregister.c:44
TOD_Action
Possible actions where a registered hook could be invoked.
Definition: todimpl.h:359
@ TOD_ACTION_SET_CLOCK
Constant to indicate the TOD is being set.
Definition: todimpl.h:363
Status_Control _TOD_Set(const struct timespec *tod, ISR_lock_Context *lock_context)
Sets the time of day.
Definition: coretodset.c:44
TOD_Control _TOD
TOD Management information.
Definition: coretod.c:24
void _TOD_Unlock(void)
Unlocks the time of day mutex.
Definition: coretod.c:33
RTEMS_INLINE_ROUTINE void _TOD_Get_timeval(struct timeval *time)
This routine returns a timeval based upon the internal timespec format TOD.
Definition: todimpl.h:308
void _TOD_Adjust(const struct timespec *delta)
Adjusts the Time of Time.
Definition: coretodadjust.c:24
uint32_t TOD_TICKS_PER_SECOND_method(void)
Gets number of ticks in a second.
Definition: coretodtickspersec.c:25
void _TOD_Lock(void)
Locks the time of day mutex.
Definition: coretod.c:28
RTEMS_INLINE_ROUTINE bool _TOD_Is_set(void)
Check if the TOD is Set.
Definition: todimpl.h:333
void _Timecounter_Microtime(struct timeval *tv)
Returns the wall clock time in the timeval format.
void _Timecounter_Nanotime(struct timespec *ts)
Returns the wall clock time in the timespec format.
int64_t _Timecounter_Sbinuptime(void)
Returns the uptime in the sbintime_t format.
volatile time_t _Timecounter_Time_second
The wall clock time in seconds.
void _Timecounter_Nanouptime(struct timespec *ts)
Returns the uptime in the timespec format.
#define _Timecounter_Release(lock_context)
Releases the timecounter lock.
Definition: timecounter.h:211
#define _Timecounter_Acquire(lock_context)
Lock to protect the timecounter mechanic.
Definition: timecounter.h:201
int64_t Timestamp_Control
Definition: timestamp.h:57
Local ISR lock context for acquire and release pairs.
Definition: isrlock.h:65
TOD control.
Definition: todimpl.h:135
bool is_set
Indicates if the time of day is set.
Definition: todimpl.h:142
Structure to manage each TOD action hook.
Definition: todimpl.h:369
Status_Control(* handler)(TOD_Action, const struct timespec *)
Definition: todimpl.h:374
Chain_Node Node
Definition: todimpl.h:371
Timecounter Implementation.
Helpers for Manipulating Timestamps.