diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-06-13 11:29:53 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-06-14 14:20:30 +0200 |
commit | 3246b0f8fcbf6e3ae3d7c2a87117f67b79cb1665 (patch) | |
tree | 1bab5f10ebe6413148ecaccd8ee7195450984d94 /cpukit/score | |
parent | sapi: Add nanoseconds_per_tick to configuration (diff) | |
download | rtems-3246b0f8fcbf6e3ae3d7c2a87117f67b79cb1665.tar.bz2 |
score: New structure TOD_Control
Group the global TOD variables (_TOD_Now, _TOD_Uptime, and _TOD_Is_set)
in a structure to reduce address loads in _TOD_Tickle_ticks().
Diffstat (limited to 'cpukit/score')
-rw-r--r-- | cpukit/score/include/rtems/score/tod.h | 45 | ||||
-rw-r--r-- | cpukit/score/src/coretod.c | 6 | ||||
-rw-r--r-- | cpukit/score/src/coretodget.c | 4 | ||||
-rw-r--r-- | cpukit/score/src/coretodgetuptime.c | 4 | ||||
-rw-r--r-- | cpukit/score/src/coretodset.c | 4 | ||||
-rw-r--r-- | cpukit/score/src/coretodtickle.c | 4 |
6 files changed, 35 insertions, 32 deletions
diff --git a/cpukit/score/include/rtems/score/tod.h b/cpukit/score/include/rtems/score/tod.h index e9a2e84381..06cc9003dd 100644 --- a/cpukit/score/include/rtems/score/tod.h +++ b/cpukit/score/include/rtems/score/tod.h @@ -123,26 +123,29 @@ extern "C" { /**@{*/ /** - * @brief Is the Time Of Day Set - * - * This is true if the application has set the current - * time of day, and false otherwise. - */ -SCORE_EXTERN bool _TOD_Is_set; - -/** - * @brief Current Time of Day (Timespec) - * - * The following contains the current time of day. - */ -SCORE_EXTERN Timestamp_Control _TOD_Now; - -/** - * @brief Current Time of Day (Timespec) - * - * The following contains the running uptime. - */ -SCORE_EXTERN Timestamp_Control _TOD_Uptime; + * @brief TOD control. + */ +typedef struct { + /** + * @brief Current time of day value. + */ + Timestamp_Control now; + + /** + * @brief System uptime. + */ + Timestamp_Control uptime; + + /** + * @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 Seconds Since RTEMS Epoch @@ -151,7 +154,7 @@ SCORE_EXTERN Timestamp_Control _TOD_Uptime; * January 1, TOD_BASE_YEAR until the current time of day. */ #define _TOD_Seconds_since_epoch() \ - _Timestamp_Get_seconds(&_TOD_Now) + _Timestamp_Get_seconds(&_TOD.now) /** * @brief _TOD_Handler_initialization diff --git a/cpukit/score/src/coretod.c b/cpukit/score/src/coretod.c index 30efa76d79..1784a897a4 100644 --- a/cpukit/score/src/coretod.c +++ b/cpukit/score/src/coretod.c @@ -33,12 +33,12 @@ void _TOD_Handler_initialization(void) { /* POSIX format TOD (timespec) */ - _Timestamp_Set( &_TOD_Now, TOD_SECONDS_1970_THROUGH_1988, 0 ); + _Timestamp_Set( &_TOD.now, TOD_SECONDS_1970_THROUGH_1988, 0 ); /* Uptime (timespec) */ - _Timestamp_Set_to_zero( &_TOD_Uptime ); + _Timestamp_Set_to_zero( &_TOD.uptime ); /* TOD has not been set */ - _TOD_Is_set = false; + _TOD.is_set = false; _TOD_Activate(); } diff --git a/cpukit/score/src/coretodget.c b/cpukit/score/src/coretodget.c index 3e73a8daab..94517e5926 100644 --- a/cpukit/score/src/coretodget.c +++ b/cpukit/score/src/coretodget.c @@ -31,9 +31,9 @@ void _TOD_Get_as_timestamp( /* assume time checked for NULL by caller */ - /* _TOD_Now is the native current time */ + /* _TOD.now is the native current time */ _ISR_Disable( level ); - now = _TOD_Now; + now = _TOD.now; nanoseconds = (*_Watchdog_Nanoseconds_since_tick_handler)(); _ISR_Enable( level ); diff --git a/cpukit/score/src/coretodgetuptime.c b/cpukit/score/src/coretodgetuptime.c index 454252921e..c3c05aed3c 100644 --- a/cpukit/score/src/coretodgetuptime.c +++ b/cpukit/score/src/coretodgetuptime.c @@ -42,9 +42,9 @@ void _TOD_Get_uptime( /* assume time checked for NULL by caller */ - /* _TOD_Uptime is in native timestamp format */ + /* _TOD.uptime is in native timestamp format */ _ISR_Disable( level ); - up = _TOD_Uptime; + up = _TOD.uptime; nanoseconds = (*_Watchdog_Nanoseconds_since_tick_handler)(); _ISR_Enable( level ); diff --git a/cpukit/score/src/coretodset.c b/cpukit/score/src/coretodset.c index e1b86a3976..9708ef9477 100644 --- a/cpukit/score/src/coretodset.c +++ b/cpukit/score/src/coretodset.c @@ -38,8 +38,8 @@ void _TOD_Set_with_timestamp( else _Watchdog_Adjust_seconds( WATCHDOG_FORWARD, seconds_next - seconds_now ); - _TOD_Now = *tod; - _TOD_Is_set = true; + _TOD.now = *tod; + _TOD.is_set = true; _TOD_Activate(); _Thread_Enable_dispatch(); diff --git a/cpukit/score/src/coretodtickle.c b/cpukit/score/src/coretodtickle.c index 25ab6f3408..fbf67fda79 100644 --- a/cpukit/score/src/coretodtickle.c +++ b/cpukit/score/src/coretodtickle.c @@ -44,11 +44,11 @@ void _TOD_Tickle_ticks( void ) _Watchdog_Ticks_since_boot += 1; /* Update the timespec format uptime */ - _Timestamp_Add_to( &_TOD_Uptime, &tick ); + _Timestamp_Add_to( &_TOD.uptime, &tick ); /* we do not care how much the uptime changed */ /* Update the timespec format TOD */ - seconds = _Timestamp_Add_to_at_tick( &_TOD_Now, &tick ); + seconds = _Timestamp_Add_to_at_tick( &_TOD.now, &tick ); while ( seconds ) { _Watchdog_Tickle_seconds(); seconds--; |