39#ifndef _RTEMS_SCORE_TODIMPL_H
40#define _RTEMS_SCORE_TODIMPL_H
71#define TOD_SECONDS_PER_MINUTE (uint32_t)60
76#define TOD_MINUTES_PER_HOUR (uint32_t)60
81#define TOD_MONTHS_PER_YEAR (uint32_t)12
86#define TOD_DAYS_PER_YEAR (uint32_t)365
91#define TOD_HOURS_PER_DAY (uint32_t)24
97#define TOD_SECONDS_PER_DAY (uint32_t) (TOD_SECONDS_PER_MINUTE * \
98 TOD_MINUTES_PER_HOUR * \
104#define TOD_SECONDS_PER_NON_LEAP_YEAR (365 * TOD_SECONDS_PER_DAY)
109#define TOD_MILLISECONDS_PER_SECOND (uint32_t)1000
114#define TOD_MICROSECONDS_PER_SECOND (uint32_t)1000000
119#define TOD_NANOSECONDS_PER_SECOND (uint32_t)1000000000
124#define TOD_NANOSECONDS_PER_MICROSECOND (uint32_t)1000
133#define TOD_SECONDS_1970_THROUGH_1988 \
134 (((1987 - 1970 + 1) * TOD_SECONDS_PER_NON_LEAP_YEAR) + \
135 (4 * TOD_SECONDS_PER_DAY))
144#define TOD_SECONDS_1970_THROUGH_2400 13569465600
153#define TOD_BASE_YEAR 1988
173#define TOD_LATEST_YEAR 2099
225#if defined(RTEMS_DEBUG)
226bool _TOD_Is_owner(
void );
258static inline size_t _TOD_Get_leap_year_index( uint32_t year )
260 _Assert( year % 4 != 0 || year % 100 != 0 || year % 400 == 0 );
261 return ( ( year % 4 ) + 3 ) / 4;
291 const struct timespec *tod,
300static inline void _TOD_Get(
317static inline void _TOD_Get_uptime(
331static inline void _TOD_Get_zero_based_uptime(
345static inline void _TOD_Get_zero_based_uptime_as_timespec(
346 struct timespec *time
361static inline uint32_t _TOD_Seconds_since_epoch(
void )
369#define TOD_TICKS_PER_SECOND _Watchdog_Ticks_per_second
377static inline void _TOD_Get_timeval(
390static inline bool _TOD_Is_set(
void )
475 const struct timespec *tod
This header file provides interfaces of the Watchdog Handler which are used by the implementation and...
#define _Assert(_e)
Assertion similar to assert() controlled via RTEMS_DEBUG instead of NDEBUG and static analysis runs.
Definition: assert.h:96
Status_Control
Status codes.
Definition: status.h:111
Status_Control _TOD_Hook_Run(TOD_Action action, const struct timespec *tod)
Run the TOD Action Hooks.
Definition: coretodhookrun.c:46
Chain_Control _TOD_Hooks
Set of registered methods for TOD Actions.
Definition: coretodhookdata.c:45
void _TOD_Hook_Unregister(TOD_Hook *hook)
Remove a TOD Action Hook.
Definition: coretodhookunregister.c:45
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:45
TOD_Action
Possible actions where a registered hook could be invoked.
Definition: todimpl.h:417
@ TOD_ACTION_SET_CLOCK
Constant to indicate the TOD is being set.
Definition: todimpl.h:421
Status_Control _TOD_Is_valid_new_time_of_day(const struct timespec *tod)
Checks the time point is a valid new time of day for _TOD_Set().
Definition: coretodcheck.c:44
Status_Control _TOD_Set(const struct timespec *tod, ISR_lock_Context *lock_context)
Sets the time of day.
Definition: coretodset.c:45
TOD_Control _TOD
TOD Management information.
Definition: coretod.c:44
void _TOD_Unlock(void)
Unlocks the time of day mutex.
Definition: coretod.c:53
const uint16_t _TOD_Days_to_date[2][13]
This array contains the number of days in all months up to the month indicated by the index of the se...
Definition: clocktodtoseconds.c:45
void _TOD_Lock(void)
Locks the time of day mutex.
Definition: coretod.c:48
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:225
#define _Timecounter_Acquire(lock_context)
Lock to protect the timecounter mechanic.
Definition: timecounter.h:215
int64_t Timestamp_Control
Definition: timestamp.h:76
This header file provides the interfaces of the Operation Status Support.
This structure represents a chain node.
Definition: chain.h:78
Local ISR lock context for acquire and release pairs.
Definition: isrlock.h:81
TOD control.
Definition: todimpl.h:186
bool is_set
Indicates if the time of day is set.
Definition: todimpl.h:193
Structure to manage each TOD action hook.
Definition: todimpl.h:427
Status_Control(* handler)(TOD_Action, const struct timespec *)
Definition: todimpl.h:432
Chain_Node Node
Definition: todimpl.h:429
This header file provides interfaces of the Timecounter Handler which are only used by the implementa...
This header file provides interfaces of the Timestamp Handler which are used by the implementation an...
This union represents a chain control block.
Definition: chain.h:96
This header file provides the interfaces of the Watchdog Handler related to watchdog ticks which are ...