From f031df0e637e3194494e34e97b94fb02a3933526 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Wed, 31 Jul 2013 13:42:07 +0200 Subject: score: Rename tod.h to todimpl.h --- cpukit/libcsupport/src/__gettod.c | 2 +- cpukit/libcsupport/src/__times.c | 2 +- cpukit/libmisc/cpuuse/cpuusagereport.c | 2 +- cpukit/libmisc/cpuuse/cpuusagereset.c | 2 +- cpukit/posix/src/adjtime.c | 2 +- cpukit/posix/src/alarm.c | 2 +- cpukit/posix/src/clockgetres.c | 2 +- cpukit/posix/src/clockgettime.c | 2 +- cpukit/posix/src/clocksettime.c | 2 +- cpukit/posix/src/mqueueopen.c | 2 +- cpukit/posix/src/posixtimespecabsolutetimeout.c | 2 +- cpukit/posix/src/sysconf.c | 2 +- cpukit/posix/src/timergettime.c | 2 +- cpukit/posix/src/timersettime.c | 2 +- cpukit/posix/src/timertsr.c | 2 +- cpukit/posix/src/ualarm.c | 2 +- cpukit/rtems/src/clockgetsecondssinceepoch.c | 2 +- cpukit/rtems/src/clockgettickspersecond.c | 2 +- cpukit/rtems/src/clockgettod.c | 2 +- cpukit/rtems/src/clockgettodtimeval.c | 2 +- cpukit/rtems/src/clockgetuptime.c | 2 +- cpukit/rtems/src/clockgetuptimeseconds.c | 2 +- cpukit/rtems/src/clockgetuptimetimeval.c | 2 +- cpukit/rtems/src/clockset.c | 2 +- cpukit/rtems/src/clocktick.c | 2 +- cpukit/rtems/src/clocktodtoseconds.c | 2 +- cpukit/rtems/src/clocktodvalidate.c | 2 +- cpukit/rtems/src/ratemonperiod.c | 2 +- cpukit/rtems/src/taskwakewhen.c | 2 +- cpukit/rtems/src/timerfirewhen.c | 2 +- cpukit/rtems/src/timerserver.c | 2 +- cpukit/rtems/src/timerserverfirewhen.c | 2 +- cpukit/sapi/src/exinit.c | 2 +- cpukit/score/Makefile.am | 2 +- cpukit/score/include/rtems/score/threadimpl.h | 2 +- cpukit/score/include/rtems/score/tod.h | 328 ------------------------ cpukit/score/include/rtems/score/todimpl.h | 328 ++++++++++++++++++++++++ cpukit/score/preinstall.am | 6 +- cpukit/score/src/coretod.c | 2 +- cpukit/score/src/coretodget.c | 2 +- cpukit/score/src/coretodgetuptimetimespec.c | 2 +- cpukit/score/src/coretodset.c | 2 +- cpukit/score/src/coretodtickle.c | 2 +- cpukit/score/src/coretodtickspersec.c | 2 +- cpukit/score/src/threaddispatch.c | 2 +- cpukit/score/src/timespecaddto.c | 2 +- cpukit/score/src/timespecdivide.c | 2 +- cpukit/score/src/timespecdividebyinteger.c | 2 +- cpukit/score/src/timespecfromticks.c | 2 +- cpukit/score/src/timespecisvalid.c | 2 +- cpukit/score/src/timespecsubtract.c | 2 +- cpukit/score/src/timespectoticks.c | 2 +- 52 files changed, 380 insertions(+), 380 deletions(-) delete mode 100644 cpukit/score/include/rtems/score/tod.h create mode 100644 cpukit/score/include/rtems/score/todimpl.h (limited to 'cpukit') diff --git a/cpukit/libcsupport/src/__gettod.c b/cpukit/libcsupport/src/__gettod.c index d73e681353..7de6a1cd24 100644 --- a/cpukit/libcsupport/src/__gettod.c +++ b/cpukit/libcsupport/src/__gettod.c @@ -23,7 +23,7 @@ #if defined(RTEMS_NEWLIB) #include #include -#include +#include #include #if defined(RTEMS_NEWLIB) && !defined(HAVE_GETTIMEOFDAY) diff --git a/cpukit/libcsupport/src/__times.c b/cpukit/libcsupport/src/__times.c index 4596453d56..13e26058c2 100644 --- a/cpukit/libcsupport/src/__times.c +++ b/cpukit/libcsupport/src/__times.c @@ -25,7 +25,7 @@ #include #include #include -#include +#include #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ #include #endif diff --git a/cpukit/libmisc/cpuuse/cpuusagereport.c b/cpukit/libmisc/cpuuse/cpuusagereport.c index fcf7d26be4..4fa05ff866 100644 --- a/cpukit/libmisc/cpuuse/cpuusagereport.c +++ b/cpukit/libmisc/cpuuse/cpuusagereport.c @@ -26,7 +26,7 @@ #include #include -#include +#include #include #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ diff --git a/cpukit/libmisc/cpuuse/cpuusagereset.c b/cpukit/libmisc/cpuuse/cpuusagereset.c index b86350efe1..6b0539f8bc 100644 --- a/cpukit/libmisc/cpuuse/cpuusagereset.c +++ b/cpukit/libmisc/cpuuse/cpuusagereset.c @@ -20,7 +20,7 @@ #include #include -#include +#include #include static void CPU_usage_Per_thread_handler( diff --git a/cpukit/posix/src/adjtime.c b/cpukit/posix/src/adjtime.c index 8b49c75eca..1d00d156c1 100644 --- a/cpukit/posix/src/adjtime.c +++ b/cpukit/posix/src/adjtime.c @@ -24,7 +24,7 @@ #include #include -#include +#include #include #include diff --git a/cpukit/posix/src/alarm.c b/cpukit/posix/src/alarm.c index 065fae642d..d46d571d98 100644 --- a/cpukit/posix/src/alarm.c +++ b/cpukit/posix/src/alarm.c @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include /* diff --git a/cpukit/posix/src/clockgetres.c b/cpukit/posix/src/clockgetres.c index d35d50f2ba..507bd522d8 100644 --- a/cpukit/posix/src/clockgetres.c +++ b/cpukit/posix/src/clockgetres.c @@ -21,7 +21,7 @@ #include #include -#include +#include #include #include diff --git a/cpukit/posix/src/clockgettime.c b/cpukit/posix/src/clockgettime.c index ebd04968d4..46a62f9292 100644 --- a/cpukit/posix/src/clockgettime.c +++ b/cpukit/posix/src/clockgettime.c @@ -21,7 +21,7 @@ #include #include -#include +#include #include /* diff --git a/cpukit/posix/src/clocksettime.c b/cpukit/posix/src/clocksettime.c index 8d1107d961..a2910eb2e6 100644 --- a/cpukit/posix/src/clocksettime.c +++ b/cpukit/posix/src/clocksettime.c @@ -22,7 +22,7 @@ #include #include -#include +#include #include /* diff --git a/cpukit/posix/src/mqueueopen.c b/cpukit/posix/src/mqueueopen.c index 79e7422bd8..2a3991dd55 100644 --- a/cpukit/posix/src/mqueueopen.c +++ b/cpukit/posix/src/mqueueopen.c @@ -38,7 +38,7 @@ #include #include -#include +#include #include #include #include diff --git a/cpukit/posix/src/posixtimespecabsolutetimeout.c b/cpukit/posix/src/posixtimespecabsolutetimeout.c index 47cb87542d..6298e94d11 100644 --- a/cpukit/posix/src/posixtimespecabsolutetimeout.c +++ b/cpukit/posix/src/posixtimespecabsolutetimeout.c @@ -28,7 +28,7 @@ #include #include -#include +#include #include /* diff --git a/cpukit/posix/src/sysconf.c b/cpukit/posix/src/sysconf.c index eb94e17a4f..4ab1936e98 100644 --- a/cpukit/posix/src/sysconf.c +++ b/cpukit/posix/src/sysconf.c @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include #include diff --git a/cpukit/posix/src/timergettime.c b/cpukit/posix/src/timergettime.c index e4fd60dd96..1ee4ea9edf 100644 --- a/cpukit/posix/src/timergettime.c +++ b/cpukit/posix/src/timergettime.c @@ -24,7 +24,7 @@ #include #include -#include +#include #include #include diff --git a/cpukit/posix/src/timersettime.c b/cpukit/posix/src/timersettime.c index a1bd40b223..c9040a912c 100644 --- a/cpukit/posix/src/timersettime.c +++ b/cpukit/posix/src/timersettime.c @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include diff --git a/cpukit/posix/src/timertsr.c b/cpukit/posix/src/timertsr.c index 9c8f035b66..d5080864f1 100644 --- a/cpukit/posix/src/timertsr.c +++ b/cpukit/posix/src/timertsr.c @@ -27,7 +27,7 @@ #include #include #include -#include +#include /* * This is the operation that is run when a timer expires diff --git a/cpukit/posix/src/ualarm.c b/cpukit/posix/src/ualarm.c index ae65a637d1..fcf760295e 100644 --- a/cpukit/posix/src/ualarm.c +++ b/cpukit/posix/src/ualarm.c @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include static void _POSIX_signals_Ualarm_TSR( Objects_Id id, void *argument ); diff --git a/cpukit/rtems/src/clockgetsecondssinceepoch.c b/cpukit/rtems/src/clockgetsecondssinceepoch.c index 1f23072f17..f8265c4061 100644 --- a/cpukit/rtems/src/clockgetsecondssinceepoch.c +++ b/cpukit/rtems/src/clockgetsecondssinceepoch.c @@ -19,7 +19,7 @@ #endif #include -#include +#include rtems_status_code rtems_clock_get_seconds_since_epoch( rtems_interval *the_interval diff --git a/cpukit/rtems/src/clockgettickspersecond.c b/cpukit/rtems/src/clockgettickspersecond.c index 87ae7bbcc1..aa65a7ad72 100644 --- a/cpukit/rtems/src/clockgettickspersecond.c +++ b/cpukit/rtems/src/clockgettickspersecond.c @@ -19,7 +19,7 @@ #endif #include -#include +#include #include rtems_interval rtems_clock_get_ticks_per_second(void) diff --git a/cpukit/rtems/src/clockgettod.c b/cpukit/rtems/src/clockgettod.c index 8710b0f94d..41d29d48b8 100644 --- a/cpukit/rtems/src/clockgettod.c +++ b/cpukit/rtems/src/clockgettod.c @@ -19,7 +19,7 @@ #endif #include -#include +#include #include rtems_status_code rtems_clock_get_tod( diff --git a/cpukit/rtems/src/clockgettodtimeval.c b/cpukit/rtems/src/clockgettodtimeval.c index b10c4f26bc..a742fc4fb1 100644 --- a/cpukit/rtems/src/clockgettodtimeval.c +++ b/cpukit/rtems/src/clockgettodtimeval.c @@ -19,7 +19,7 @@ #endif #include -#include +#include rtems_status_code rtems_clock_get_tod_timeval( struct timeval *time diff --git a/cpukit/rtems/src/clockgetuptime.c b/cpukit/rtems/src/clockgetuptime.c index 0645b8e71f..0ece74b381 100644 --- a/cpukit/rtems/src/clockgetuptime.c +++ b/cpukit/rtems/src/clockgetuptime.c @@ -19,7 +19,7 @@ #endif #include -#include +#include /* * rtems_clock_get_uptime diff --git a/cpukit/rtems/src/clockgetuptimeseconds.c b/cpukit/rtems/src/clockgetuptimeseconds.c index e4436c1075..c1dfbf3785 100644 --- a/cpukit/rtems/src/clockgetuptimeseconds.c +++ b/cpukit/rtems/src/clockgetuptimeseconds.c @@ -25,7 +25,7 @@ #include #include -#include +#include time_t rtems_clock_get_uptime_seconds( void ) { diff --git a/cpukit/rtems/src/clockgetuptimetimeval.c b/cpukit/rtems/src/clockgetuptimetimeval.c index ef1388257c..78a25164c5 100644 --- a/cpukit/rtems/src/clockgetuptimetimeval.c +++ b/cpukit/rtems/src/clockgetuptimetimeval.c @@ -24,7 +24,7 @@ #endif #include -#include +#include void rtems_clock_get_uptime_timeval( struct timeval *uptime ) { diff --git a/cpukit/rtems/src/clockset.c b/cpukit/rtems/src/clockset.c index 868d486854..5bbf4df76f 100644 --- a/cpukit/rtems/src/clockset.c +++ b/cpukit/rtems/src/clockset.c @@ -20,7 +20,7 @@ #include #include -#include +#include #include rtems_status_code rtems_clock_set( diff --git a/cpukit/rtems/src/clocktick.c b/cpukit/rtems/src/clocktick.c index 1b1624f211..77a06d0867 100644 --- a/cpukit/rtems/src/clocktick.c +++ b/cpukit/rtems/src/clocktick.c @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include rtems_status_code rtems_clock_tick( void ) diff --git a/cpukit/rtems/src/clocktodtoseconds.c b/cpukit/rtems/src/clocktodtoseconds.c index daa33b4b12..9a736a3253 100644 --- a/cpukit/rtems/src/clocktodtoseconds.c +++ b/cpukit/rtems/src/clocktodtoseconds.c @@ -19,7 +19,7 @@ #endif #include -#include +#include #define TOD_SECONDS_AT_2100_03_01_00_00 4107538800UL diff --git a/cpukit/rtems/src/clocktodvalidate.c b/cpukit/rtems/src/clocktodvalidate.c index c464c37572..ad07098b31 100644 --- a/cpukit/rtems/src/clocktodvalidate.c +++ b/cpukit/rtems/src/clocktodvalidate.c @@ -19,7 +19,7 @@ #endif #include -#include +#include #include /* diff --git a/cpukit/rtems/src/ratemonperiod.c b/cpukit/rtems/src/ratemonperiod.c index 25e64b2f30..76f523a139 100644 --- a/cpukit/rtems/src/ratemonperiod.c +++ b/cpukit/rtems/src/ratemonperiod.c @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include bool _Rate_monotonic_Get_status( diff --git a/cpukit/rtems/src/taskwakewhen.c b/cpukit/rtems/src/taskwakewhen.c index 759cb2eec1..a63c496d4f 100644 --- a/cpukit/rtems/src/taskwakewhen.c +++ b/cpukit/rtems/src/taskwakewhen.c @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include rtems_status_code rtems_task_wake_when( diff --git a/cpukit/rtems/src/timerfirewhen.c b/cpukit/rtems/src/timerfirewhen.c index c2be8b8a0f..68da48a631 100644 --- a/cpukit/rtems/src/timerfirewhen.c +++ b/cpukit/rtems/src/timerfirewhen.c @@ -20,7 +20,7 @@ #include #include -#include +#include #include rtems_status_code rtems_timer_fire_when( diff --git a/cpukit/rtems/src/timerserver.c b/cpukit/rtems/src/timerserver.c index a76f346216..165bcc32bc 100644 --- a/cpukit/rtems/src/timerserver.c +++ b/cpukit/rtems/src/timerserver.c @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include static Timer_server_Control _Timer_server_Default; diff --git a/cpukit/rtems/src/timerserverfirewhen.c b/cpukit/rtems/src/timerserverfirewhen.c index bf1f7d5c5e..43f4fcf1d3 100644 --- a/cpukit/rtems/src/timerserverfirewhen.c +++ b/cpukit/rtems/src/timerserverfirewhen.c @@ -20,7 +20,7 @@ #include #include -#include +#include #include /* diff --git a/cpukit/sapi/src/exinit.c b/cpukit/sapi/src/exinit.c index b35393c324..5574b43910 100644 --- a/cpukit/sapi/src/exinit.c +++ b/cpukit/sapi/src/exinit.c @@ -48,7 +48,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/cpukit/score/Makefile.am b/cpukit/score/Makefile.am index eb7376dd79..015b23020e 100644 --- a/cpukit/score/Makefile.am +++ b/cpukit/score/Makefile.am @@ -70,7 +70,7 @@ include_rtems_score_HEADERS += include/rtems/score/threadsync.h include_rtems_score_HEADERS += include/rtems/score/timespec.h include_rtems_score_HEADERS += include/rtems/score/timestamp.h include_rtems_score_HEADERS += include/rtems/score/timestamp64.h -include_rtems_score_HEADERS += include/rtems/score/tod.h +include_rtems_score_HEADERS += include/rtems/score/todimpl.h include_rtems_score_HEADERS += include/rtems/score/userext.h include_rtems_score_HEADERS += include/rtems/score/userextimpl.h include_rtems_score_HEADERS += include/rtems/score/watchdog.h diff --git a/cpukit/score/include/rtems/score/threadimpl.h b/cpukit/score/include/rtems/score/threadimpl.h index e818bc8c50..fcd3f07bb4 100644 --- a/cpukit/score/include/rtems/score/threadimpl.h +++ b/cpukit/score/include/rtems/score/threadimpl.h @@ -23,7 +23,7 @@ #include #include #include -#include +#include #ifdef __cplusplus extern "C" { diff --git a/cpukit/score/include/rtems/score/tod.h b/cpukit/score/include/rtems/score/tod.h deleted file mode 100644 index 0cbbe2f46a..0000000000 --- a/cpukit/score/include/rtems/score/tod.h +++ /dev/null @@ -1,328 +0,0 @@ -/** - * @file - * - * @ingroup ScoreTOD - * - * @brief Time of Day Handler API - */ - -/* - * COPYRIGHT (c) 1989-2009. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.com/license/LICENSE. - */ - -#ifndef _RTEMS_SCORE_TOD_H -#define _RTEMS_SCORE_TOD_H - -#include -#include - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @defgroup ScoreTOD Time of Day Handler - * - * @ingroup Score - * - * The following constants are related to the time of day and are - * independent of RTEMS. - */ -/**@{*/ - -/** - * This constant represents the number of seconds in a minute. - */ -#define TOD_SECONDS_PER_MINUTE (uint32_t)60 - -/** - * This constant represents the number of minutes per hour. - */ -#define TOD_MINUTES_PER_HOUR (uint32_t)60 - -/** - * This constant represents the number of months in a year. - */ -#define TOD_MONTHS_PER_YEAR (uint32_t)12 - -/** - * This constant represents the number of days in a non-leap year. - */ -#define TOD_DAYS_PER_YEAR (uint32_t)365 - -/** - * This constant represents the number of hours per day. - */ -#define TOD_HOURS_PER_DAY (uint32_t)24 - -/** - * This constant represents the number of seconds in a day which does - * not include a leap second. - */ -#define TOD_SECONDS_PER_DAY (uint32_t) (TOD_SECONDS_PER_MINUTE * \ - TOD_MINUTES_PER_HOUR * \ - TOD_HOURS_PER_DAY) - -/** - * This constant represents the number of seconds in a non-leap year. - */ -#define TOD_SECONDS_PER_NON_LEAP_YEAR (365 * TOD_SECONDS_PER_DAY) - -/** - * This constant represents the number of millisecond in a second. - */ -#define TOD_MILLISECONDS_PER_SECOND (uint32_t)1000 - -/** - * This constant represents the number of microseconds in a second. - */ -#define TOD_MICROSECONDS_PER_SECOND (uint32_t)1000000 - -/** - * This constant represents the number of nanoseconds in a second. - */ -#define TOD_NANOSECONDS_PER_SECOND (uint32_t)1000000000 - -/** - * This constant represents the number of nanoseconds in a mircosecond. - */ -#define TOD_NANOSECONDS_PER_MICROSECOND (uint32_t)1000 - -/**@}*/ - -/** - * Seconds from January 1, 1970 to January 1, 1988. Used to account for - * differences between POSIX API and RTEMS core. The timespec format time - * is kept in POSIX compliant form. - */ -#define TOD_SECONDS_1970_THROUGH_1988 \ - (((1987 - 1970 + 1) * TOD_SECONDS_PER_NON_LEAP_YEAR) + \ - (4 * TOD_SECONDS_PER_DAY)) - -/** - * @brief Earliest year to which an time of day can be initialized. - * - * The following constant define the earliest year to which an - * time of day can be initialized. This is considered the - * epoch. - */ -#define TOD_BASE_YEAR 1988 - -/** - * @defgroup ScoreTOD Time Of Day (TOD) Handler - * - * @ingroup Score - * - * This handler encapsulates functionality used to manage time of day. - */ -/**@{*/ - -/** - * @brief TOD control. - */ -typedef struct { - /** - * @brief Current time of day value. - */ - Timestamp_Control now; - - /** - * @brief System uptime. - */ - Timestamp_Control uptime; - - /** - * @brief Time of day seconds trigger. - * - * This value specifies the nanoseconds since the last time of day second. - * It is updated and evaluated in _TOD_Tickle_ticks(). It is set in - * _TOD_Set_with_timestamp(). - */ - uint32_t seconds_trigger; - - /** - * @brief Indicates if the time of day is set. - * - * This is true if the application has set the current - * time of day, and false otherwise. - */ - bool is_set; -} TOD_Control; - -SCORE_EXTERN TOD_Control _TOD; - -/** - * @brief Number of seconds Since RTEMS epoch. - * - * The following contains the number of seconds from 00:00:00 - * January 1, TOD_BASE_YEAR until the current time of day. - */ -#define _TOD_Seconds_since_epoch() \ - _Timestamp_Get_seconds(&_TOD.now) - -/** - * @brief Initializes the time of day handler. - * - * Performs the initialization necessary for the Time Of Day handler. - */ -void _TOD_Handler_initialization(void); - -/** - * @brief Sets the time of day from timestamp. - * - * The @a tod_as_timestamp timestamp represents the time since UNIX epoch. - * The watchdog seconds chain will be adjusted. - * - * @param[in] tod_as_timestamp is the constant of the time of day as a timestamp - */ -void _TOD_Set_with_timestamp( - const Timestamp_Control *tod_as_timestamp -); - -static inline void _TOD_Set( - const struct timespec *tod_as_timespec -) -{ - Timestamp_Control tod_as_timestamp; - - _Timestamp_Set( - &tod_as_timestamp, - tod_as_timespec->tv_sec, - tod_as_timespec->tv_nsec - ); - _TOD_Set_with_timestamp( &tod_as_timestamp ); -} - -/** - * @brief Returns a snapshot of a clock. - * - * This function invokes the nanoseconds extension. - * - * @param[out] snapshot points to an area that will contain the current - * TOD plus the BSP nanoseconds since last tick adjustment - * @param[in] clock contains the current TOD - * - * @retval @a snapshot - */ -Timestamp_Control *_TOD_Get_with_nanoseconds( - Timestamp_Control *snapshot, - const Timestamp_Control *clock -); - -static inline void _TOD_Get( - struct timespec *tod_as_timespec -) -{ - Timestamp_Control tod_as_timestamp; - Timestamp_Control *tod_as_timestamp_ptr; - - tod_as_timestamp_ptr = - _TOD_Get_with_nanoseconds( &tod_as_timestamp, &_TOD.now ); - _Timestamp_To_timespec( tod_as_timestamp_ptr, tod_as_timespec ); -} - -/** - * @brief Gets the system uptime with potential accuracy to the nanosecond. - * - * This routine returns the system uptime with potential accuracy - * to the nanosecond. - * - * @param[in] time is a pointer to the uptime to be returned - */ -static inline void _TOD_Get_uptime( - Timestamp_Control *time -) -{ - _TOD_Get_with_nanoseconds( time, &_TOD.uptime ); -} - -/** - * @brief Gets the system uptime with potential accuracy to the nanosecond. - * - * This routine returns the system uptime with potential accuracy - * to the nanosecond. - * - * @param[in] time is a pointer to the uptime to be returned - */ -void _TOD_Get_uptime_as_timespec( - struct timespec *time -); - -/** - * @brief Increments time of day at each clock tick. - * - * This routine increments the ticks field of the current time of - * day at each clock tick. - */ -void _TOD_Tickle_ticks( void ); - -/** - * @brief Gets number of ticks in a second. - * - * This method returns the number of ticks in a second. - * - * @note If the clock tick value does not multiply evenly into a second - * then this number of ticks will be slightly shorter than a second. - */ -uint32_t TOD_TICKS_PER_SECOND_method(void); - -/** - * @brief Gets number of ticks in a second. - * - * This method exists to hide the fact that TOD_TICKS_PER_SECOND can not - * be implemented as a macro in a .h file due to visibility issues. - * The Configuration Table is not available to SuperCore .h files but - * is available to their .c files. - */ -#define TOD_TICKS_PER_SECOND TOD_TICKS_PER_SECOND_method() - -/** - * This routine deactivates updating of the current time of day. - */ - -RTEMS_INLINE_ROUTINE void _TOD_Deactivate( void ) -{ - /* XXX do we need something now that we are using timespec for TOD */ -} - -/** - * This routine activates updating of the current time of day. - */ - -RTEMS_INLINE_ROUTINE void _TOD_Activate( void ) -{ - /* XXX do we need something now that we are using timespec for TOD */ -} - -/** - * This routine returns a timeval based upon the internal timespec format TOD. - */ - -RTEMS_INLINE_ROUTINE void _TOD_Get_timeval( - struct timeval *time -) -{ - Timestamp_Control snapshot_as_timestamp; - Timestamp_Control *snapshot_as_timestamp_ptr; - - snapshot_as_timestamp_ptr = - _TOD_Get_with_nanoseconds( &snapshot_as_timestamp, &_TOD.now ); - _Timestamp_To_timeval( snapshot_as_timestamp_ptr, time ); -} - -/**@}*/ - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/cpukit/score/include/rtems/score/todimpl.h b/cpukit/score/include/rtems/score/todimpl.h new file mode 100644 index 0000000000..f16390ec12 --- /dev/null +++ b/cpukit/score/include/rtems/score/todimpl.h @@ -0,0 +1,328 @@ +/** + * @file + * + * @ingroup ScoreTOD + * + * @brief Time of Day Handler API + */ + +/* + * COPYRIGHT (c) 1989-2009. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + */ + +#ifndef _RTEMS_SCORE_TODIMPL_H +#define _RTEMS_SCORE_TODIMPL_H + +#include +#include + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @defgroup ScoreTOD Time of Day Handler + * + * @ingroup Score + * + * The following constants are related to the time of day and are + * independent of RTEMS. + */ +/**@{*/ + +/** + * This constant represents the number of seconds in a minute. + */ +#define TOD_SECONDS_PER_MINUTE (uint32_t)60 + +/** + * This constant represents the number of minutes per hour. + */ +#define TOD_MINUTES_PER_HOUR (uint32_t)60 + +/** + * This constant represents the number of months in a year. + */ +#define TOD_MONTHS_PER_YEAR (uint32_t)12 + +/** + * This constant represents the number of days in a non-leap year. + */ +#define TOD_DAYS_PER_YEAR (uint32_t)365 + +/** + * This constant represents the number of hours per day. + */ +#define TOD_HOURS_PER_DAY (uint32_t)24 + +/** + * This constant represents the number of seconds in a day which does + * not include a leap second. + */ +#define TOD_SECONDS_PER_DAY (uint32_t) (TOD_SECONDS_PER_MINUTE * \ + TOD_MINUTES_PER_HOUR * \ + TOD_HOURS_PER_DAY) + +/** + * This constant represents the number of seconds in a non-leap year. + */ +#define TOD_SECONDS_PER_NON_LEAP_YEAR (365 * TOD_SECONDS_PER_DAY) + +/** + * This constant represents the number of millisecond in a second. + */ +#define TOD_MILLISECONDS_PER_SECOND (uint32_t)1000 + +/** + * This constant represents the number of microseconds in a second. + */ +#define TOD_MICROSECONDS_PER_SECOND (uint32_t)1000000 + +/** + * This constant represents the number of nanoseconds in a second. + */ +#define TOD_NANOSECONDS_PER_SECOND (uint32_t)1000000000 + +/** + * This constant represents the number of nanoseconds in a mircosecond. + */ +#define TOD_NANOSECONDS_PER_MICROSECOND (uint32_t)1000 + +/**@}*/ + +/** + * Seconds from January 1, 1970 to January 1, 1988. Used to account for + * differences between POSIX API and RTEMS core. The timespec format time + * is kept in POSIX compliant form. + */ +#define TOD_SECONDS_1970_THROUGH_1988 \ + (((1987 - 1970 + 1) * TOD_SECONDS_PER_NON_LEAP_YEAR) + \ + (4 * TOD_SECONDS_PER_DAY)) + +/** + * @brief Earliest year to which an time of day can be initialized. + * + * The following constant define the earliest year to which an + * time of day can be initialized. This is considered the + * epoch. + */ +#define TOD_BASE_YEAR 1988 + +/** + * @defgroup ScoreTOD Time Of Day (TOD) Handler + * + * @ingroup Score + * + * This handler encapsulates functionality used to manage time of day. + */ +/**@{*/ + +/** + * @brief TOD control. + */ +typedef struct { + /** + * @brief Current time of day value. + */ + Timestamp_Control now; + + /** + * @brief System uptime. + */ + Timestamp_Control uptime; + + /** + * @brief Time of day seconds trigger. + * + * This value specifies the nanoseconds since the last time of day second. + * It is updated and evaluated in _TOD_Tickle_ticks(). It is set in + * _TOD_Set_with_timestamp(). + */ + uint32_t seconds_trigger; + + /** + * @brief Indicates if the time of day is set. + * + * This is true if the application has set the current + * time of day, and false otherwise. + */ + bool is_set; +} TOD_Control; + +SCORE_EXTERN TOD_Control _TOD; + +/** + * @brief Number of seconds Since RTEMS epoch. + * + * The following contains the number of seconds from 00:00:00 + * January 1, TOD_BASE_YEAR until the current time of day. + */ +#define _TOD_Seconds_since_epoch() \ + _Timestamp_Get_seconds(&_TOD.now) + +/** + * @brief Initializes the time of day handler. + * + * Performs the initialization necessary for the Time Of Day handler. + */ +void _TOD_Handler_initialization(void); + +/** + * @brief Sets the time of day from timestamp. + * + * The @a tod_as_timestamp timestamp represents the time since UNIX epoch. + * The watchdog seconds chain will be adjusted. + * + * @param[in] tod_as_timestamp is the constant of the time of day as a timestamp + */ +void _TOD_Set_with_timestamp( + const Timestamp_Control *tod_as_timestamp +); + +static inline void _TOD_Set( + const struct timespec *tod_as_timespec +) +{ + Timestamp_Control tod_as_timestamp; + + _Timestamp_Set( + &tod_as_timestamp, + tod_as_timespec->tv_sec, + tod_as_timespec->tv_nsec + ); + _TOD_Set_with_timestamp( &tod_as_timestamp ); +} + +/** + * @brief Returns a snapshot of a clock. + * + * This function invokes the nanoseconds extension. + * + * @param[out] snapshot points to an area that will contain the current + * TOD plus the BSP nanoseconds since last tick adjustment + * @param[in] clock contains the current TOD + * + * @retval @a snapshot + */ +Timestamp_Control *_TOD_Get_with_nanoseconds( + Timestamp_Control *snapshot, + const Timestamp_Control *clock +); + +static inline void _TOD_Get( + struct timespec *tod_as_timespec +) +{ + Timestamp_Control tod_as_timestamp; + Timestamp_Control *tod_as_timestamp_ptr; + + tod_as_timestamp_ptr = + _TOD_Get_with_nanoseconds( &tod_as_timestamp, &_TOD.now ); + _Timestamp_To_timespec( tod_as_timestamp_ptr, tod_as_timespec ); +} + +/** + * @brief Gets the system uptime with potential accuracy to the nanosecond. + * + * This routine returns the system uptime with potential accuracy + * to the nanosecond. + * + * @param[in] time is a pointer to the uptime to be returned + */ +static inline void _TOD_Get_uptime( + Timestamp_Control *time +) +{ + _TOD_Get_with_nanoseconds( time, &_TOD.uptime ); +} + +/** + * @brief Gets the system uptime with potential accuracy to the nanosecond. + * + * This routine returns the system uptime with potential accuracy + * to the nanosecond. + * + * @param[in] time is a pointer to the uptime to be returned + */ +void _TOD_Get_uptime_as_timespec( + struct timespec *time +); + +/** + * @brief Increments time of day at each clock tick. + * + * This routine increments the ticks field of the current time of + * day at each clock tick. + */ +void _TOD_Tickle_ticks( void ); + +/** + * @brief Gets number of ticks in a second. + * + * This method returns the number of ticks in a second. + * + * @note If the clock tick value does not multiply evenly into a second + * then this number of ticks will be slightly shorter than a second. + */ +uint32_t TOD_TICKS_PER_SECOND_method(void); + +/** + * @brief Gets number of ticks in a second. + * + * This method exists to hide the fact that TOD_TICKS_PER_SECOND can not + * be implemented as a macro in a .h file due to visibility issues. + * The Configuration Table is not available to SuperCore .h files but + * is available to their .c files. + */ +#define TOD_TICKS_PER_SECOND TOD_TICKS_PER_SECOND_method() + +/** + * This routine deactivates updating of the current time of day. + */ + +RTEMS_INLINE_ROUTINE void _TOD_Deactivate( void ) +{ + /* XXX do we need something now that we are using timespec for TOD */ +} + +/** + * This routine activates updating of the current time of day. + */ + +RTEMS_INLINE_ROUTINE void _TOD_Activate( void ) +{ + /* XXX do we need something now that we are using timespec for TOD */ +} + +/** + * This routine returns a timeval based upon the internal timespec format TOD. + */ + +RTEMS_INLINE_ROUTINE void _TOD_Get_timeval( + struct timeval *time +) +{ + Timestamp_Control snapshot_as_timestamp; + Timestamp_Control *snapshot_as_timestamp_ptr; + + snapshot_as_timestamp_ptr = + _TOD_Get_with_nanoseconds( &snapshot_as_timestamp, &_TOD.now ); + _Timestamp_To_timeval( snapshot_as_timestamp_ptr, time ); +} + +/**@}*/ + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ diff --git a/cpukit/score/preinstall.am b/cpukit/score/preinstall.am index aff76c900b..6d0cb81348 100644 --- a/cpukit/score/preinstall.am +++ b/cpukit/score/preinstall.am @@ -263,9 +263,9 @@ $(PROJECT_INCLUDE)/rtems/score/timestamp64.h: include/rtems/score/timestamp64.h $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/timestamp64.h PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/timestamp64.h -$(PROJECT_INCLUDE)/rtems/score/tod.h: include/rtems/score/tod.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp) - $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/tod.h -PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/tod.h +$(PROJECT_INCLUDE)/rtems/score/todimpl.h: include/rtems/score/todimpl.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp) + $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/todimpl.h +PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/todimpl.h $(PROJECT_INCLUDE)/rtems/score/userext.h: include/rtems/score/userext.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp) $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/userext.h diff --git a/cpukit/score/src/coretod.c b/cpukit/score/src/coretod.c index 1dcf19fea7..28df21f598 100644 --- a/cpukit/score/src/coretod.c +++ b/cpukit/score/src/coretod.c @@ -18,7 +18,7 @@ #include "config.h" #endif -#include +#include void _TOD_Handler_initialization(void) { diff --git a/cpukit/score/src/coretodget.c b/cpukit/score/src/coretodget.c index 3e2cb4f4de..b45930a2a4 100644 --- a/cpukit/score/src/coretodget.c +++ b/cpukit/score/src/coretodget.c @@ -18,7 +18,7 @@ #include "config.h" #endif -#include +#include #include #include diff --git a/cpukit/score/src/coretodgetuptimetimespec.c b/cpukit/score/src/coretodgetuptimetimespec.c index 16e519e36b..ac053b93bc 100644 --- a/cpukit/score/src/coretodgetuptimetimespec.c +++ b/cpukit/score/src/coretodgetuptimetimespec.c @@ -18,7 +18,7 @@ #include "config.h" #endif -#include +#include void _TOD_Get_uptime_as_timespec( struct timespec *uptime diff --git a/cpukit/score/src/coretodset.c b/cpukit/score/src/coretodset.c index 23ba2e6ce8..f2f743ddc8 100644 --- a/cpukit/score/src/coretodset.c +++ b/cpukit/score/src/coretodset.c @@ -18,7 +18,7 @@ #include "config.h" #endif -#include +#include #include #include diff --git a/cpukit/score/src/coretodtickle.c b/cpukit/score/src/coretodtickle.c index 41644b980c..4586e8496f 100644 --- a/cpukit/score/src/coretodtickle.c +++ b/cpukit/score/src/coretodtickle.c @@ -18,7 +18,7 @@ #include "config.h" #endif -#include +#include #include #include diff --git a/cpukit/score/src/coretodtickspersec.c b/cpukit/score/src/coretodtickspersec.c index 58e7e04c88..9744cbb9eb 100644 --- a/cpukit/score/src/coretodtickspersec.c +++ b/cpukit/score/src/coretodtickspersec.c @@ -18,7 +18,7 @@ #include "config.h" #endif -#include +#include #include uint32_t TOD_TICKS_PER_SECOND_method(void) diff --git a/cpukit/score/src/threaddispatch.c b/cpukit/score/src/threaddispatch.c index 09b5dbe105..c659f9fd67 100644 --- a/cpukit/score/src/threaddispatch.c +++ b/cpukit/score/src/threaddispatch.c @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include diff --git a/cpukit/score/src/timespecaddto.c b/cpukit/score/src/timespecaddto.c index a1d6c871c0..ef6091002a 100644 --- a/cpukit/score/src/timespecaddto.c +++ b/cpukit/score/src/timespecaddto.c @@ -19,7 +19,7 @@ #endif #include -#include +#include #include uint32_t _Timespec_Add_to( diff --git a/cpukit/score/src/timespecdivide.c b/cpukit/score/src/timespecdivide.c index 3434fdf7f1..a4a1b8515d 100644 --- a/cpukit/score/src/timespecdivide.c +++ b/cpukit/score/src/timespecdivide.c @@ -19,7 +19,7 @@ #endif #include -#include +#include void _Timespec_Divide( const struct timespec *lhs, diff --git a/cpukit/score/src/timespecdividebyinteger.c b/cpukit/score/src/timespecdividebyinteger.c index 6d97dcbc41..9d146db52f 100644 --- a/cpukit/score/src/timespecdividebyinteger.c +++ b/cpukit/score/src/timespecdividebyinteger.c @@ -20,7 +20,7 @@ #endif #include -#include +#include void _Timespec_Divide_by_integer( const struct timespec *time, diff --git a/cpukit/score/src/timespecfromticks.c b/cpukit/score/src/timespecfromticks.c index 3e994a03f2..231da3313f 100644 --- a/cpukit/score/src/timespecfromticks.c +++ b/cpukit/score/src/timespecfromticks.c @@ -19,7 +19,7 @@ #endif #include -#include +#include #include void _Timespec_From_ticks( diff --git a/cpukit/score/src/timespecisvalid.c b/cpukit/score/src/timespecisvalid.c index 61dce72830..98bb3ba032 100644 --- a/cpukit/score/src/timespecisvalid.c +++ b/cpukit/score/src/timespecisvalid.c @@ -19,7 +19,7 @@ #endif #include -#include +#include bool _Timespec_Is_valid( const struct timespec *time diff --git a/cpukit/score/src/timespecsubtract.c b/cpukit/score/src/timespecsubtract.c index 8d29f17197..14fcdcc28f 100644 --- a/cpukit/score/src/timespecsubtract.c +++ b/cpukit/score/src/timespecsubtract.c @@ -19,7 +19,7 @@ #endif #include -#include +#include void _Timespec_Subtract( const struct timespec *start, diff --git a/cpukit/score/src/timespectoticks.c b/cpukit/score/src/timespectoticks.c index 12eaadaa96..a6288184e7 100644 --- a/cpukit/score/src/timespectoticks.c +++ b/cpukit/score/src/timespectoticks.c @@ -16,7 +16,7 @@ #endif #include -#include +#include #include /** -- cgit v1.2.3