From 7fea679b6f4c376cf068eaee987d3ff4e415b23e Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Fri, 6 Sep 1996 15:16:19 +0000 Subject: changed _TOD_Is_set from a function to a boolean variable --- c/src/exec/rtems/src/clock.c | 6 +++--- c/src/exec/rtems/src/rtclock.c | 6 +++--- c/src/exec/rtems/src/rtemstimer.c | 2 +- c/src/exec/rtems/src/tasks.c | 2 +- c/src/exec/rtems/src/timer.c | 2 +- c/src/exec/score/headers/tod.h | 7 +++++++ c/src/exec/score/include/rtems/score/tod.h | 7 +++++++ c/src/exec/score/inline/rtems/score/tod.inl | 15 --------------- c/src/exec/score/inline/tod.inl | 15 --------------- c/src/exec/score/macros/rtems/score/tod.inl | 9 --------- c/src/exec/score/macros/tod.inl | 9 --------- c/src/exec/score/src/coretod.c | 4 ++++ c/src/exec/score/src/tod.c | 4 ++++ 13 files changed, 31 insertions(+), 57 deletions(-) (limited to 'c') diff --git a/c/src/exec/rtems/src/clock.c b/c/src/exec/rtems/src/clock.c index f73401809c..4b7b5f5b31 100644 --- a/c/src/exec/rtems/src/clock.c +++ b/c/src/exec/rtems/src/clock.c @@ -48,14 +48,14 @@ rtems_status_code rtems_clock_get( switch ( option ) { case RTEMS_CLOCK_GET_TOD: - if ( !_TOD_Is_set() ) + if ( !_TOD_Is_set ) return RTEMS_NOT_DEFINED; *(rtems_time_of_day *)time_buffer = _TOD_Current; return RTEMS_SUCCESSFUL; case RTEMS_CLOCK_GET_SECONDS_SINCE_EPOCH: - if ( !_TOD_Is_set() ) + if ( !_TOD_Is_set ) return RTEMS_NOT_DEFINED; *(rtems_interval *)time_buffer = _TOD_Seconds_since_epoch; @@ -70,7 +70,7 @@ rtems_status_code rtems_clock_get( return RTEMS_SUCCESSFUL; case RTEMS_CLOCK_GET_TIME_VALUE: - if ( !_TOD_Is_set() ) + if ( !_TOD_Is_set ) return RTEMS_NOT_DEFINED; _ISR_Disable( level ); diff --git a/c/src/exec/rtems/src/rtclock.c b/c/src/exec/rtems/src/rtclock.c index f73401809c..4b7b5f5b31 100644 --- a/c/src/exec/rtems/src/rtclock.c +++ b/c/src/exec/rtems/src/rtclock.c @@ -48,14 +48,14 @@ rtems_status_code rtems_clock_get( switch ( option ) { case RTEMS_CLOCK_GET_TOD: - if ( !_TOD_Is_set() ) + if ( !_TOD_Is_set ) return RTEMS_NOT_DEFINED; *(rtems_time_of_day *)time_buffer = _TOD_Current; return RTEMS_SUCCESSFUL; case RTEMS_CLOCK_GET_SECONDS_SINCE_EPOCH: - if ( !_TOD_Is_set() ) + if ( !_TOD_Is_set ) return RTEMS_NOT_DEFINED; *(rtems_interval *)time_buffer = _TOD_Seconds_since_epoch; @@ -70,7 +70,7 @@ rtems_status_code rtems_clock_get( return RTEMS_SUCCESSFUL; case RTEMS_CLOCK_GET_TIME_VALUE: - if ( !_TOD_Is_set() ) + if ( !_TOD_Is_set ) return RTEMS_NOT_DEFINED; _ISR_Disable( level ); diff --git a/c/src/exec/rtems/src/rtemstimer.c b/c/src/exec/rtems/src/rtemstimer.c index 6c3005ffbe..40ee526f26 100644 --- a/c/src/exec/rtems/src/rtemstimer.c +++ b/c/src/exec/rtems/src/rtemstimer.c @@ -277,7 +277,7 @@ rtems_status_code rtems_timer_fire_when( Objects_Locations location; rtems_interval seconds; - if ( !_TOD_Is_set() ) + if ( !_TOD_Is_set ) return RTEMS_NOT_DEFINED; if ( !_TOD_Validate( wall_time ) ) diff --git a/c/src/exec/rtems/src/tasks.c b/c/src/exec/rtems/src/tasks.c index 403a26e0d4..2f78b015f4 100644 --- a/c/src/exec/rtems/src/tasks.c +++ b/c/src/exec/rtems/src/tasks.c @@ -1034,7 +1034,7 @@ rtems_time_of_day *time_buffer { Watchdog_Interval seconds; - if ( !_TOD_Is_set() ) + if ( !_TOD_Is_set ) return RTEMS_NOT_DEFINED; time_buffer->ticks = 0; diff --git a/c/src/exec/rtems/src/timer.c b/c/src/exec/rtems/src/timer.c index 6c3005ffbe..40ee526f26 100644 --- a/c/src/exec/rtems/src/timer.c +++ b/c/src/exec/rtems/src/timer.c @@ -277,7 +277,7 @@ rtems_status_code rtems_timer_fire_when( Objects_Locations location; rtems_interval seconds; - if ( !_TOD_Is_set() ) + if ( !_TOD_Is_set ) return RTEMS_NOT_DEFINED; if ( !_TOD_Validate( wall_time ) ) diff --git a/c/src/exec/score/headers/tod.h b/c/src/exec/score/headers/tod.h index 3788a74256..ea7a7855f1 100644 --- a/c/src/exec/score/headers/tod.h +++ b/c/src/exec/score/headers/tod.h @@ -67,6 +67,13 @@ typedef struct { /* RTEID style time/date */ unsigned32 ticks; /* elapsed ticks between secs */ } TOD_Control; +/* + * The following is TRUE if the application has set the current + * time of day, and FALSE otherwise. + */ + +SCORE_EXTERN boolean _TOD_Is_set; + /* * The following contains the current time of day. */ diff --git a/c/src/exec/score/include/rtems/score/tod.h b/c/src/exec/score/include/rtems/score/tod.h index 3788a74256..ea7a7855f1 100644 --- a/c/src/exec/score/include/rtems/score/tod.h +++ b/c/src/exec/score/include/rtems/score/tod.h @@ -67,6 +67,13 @@ typedef struct { /* RTEID style time/date */ unsigned32 ticks; /* elapsed ticks between secs */ } TOD_Control; +/* + * The following is TRUE if the application has set the current + * time of day, and FALSE otherwise. + */ + +SCORE_EXTERN boolean _TOD_Is_set; + /* * The following contains the current time of day. */ diff --git a/c/src/exec/score/inline/rtems/score/tod.inl b/c/src/exec/score/inline/rtems/score/tod.inl index 17e7f014e8..5fa9193419 100644 --- a/c/src/exec/score/inline/rtems/score/tod.inl +++ b/c/src/exec/score/inline/rtems/score/tod.inl @@ -17,21 +17,6 @@ #ifndef __TIME_OF_DAY_inl #define __TIME_OF_DAY_inl -/*PAGE - * - * _TOD_Is_set - * - * DESCRIPTION: - * - * This function returns TRUE if the application has set the current - * time of day, and FALSE otherwise. - */ - -RTEMS_INLINE_ROUTINE boolean _TOD_Is_set( void ) -{ - return _Watchdog_Is_active( &_TOD_Seconds_watchdog ); -} - /*PAGE * * _TOD_Tickle_ticks diff --git a/c/src/exec/score/inline/tod.inl b/c/src/exec/score/inline/tod.inl index 17e7f014e8..5fa9193419 100644 --- a/c/src/exec/score/inline/tod.inl +++ b/c/src/exec/score/inline/tod.inl @@ -17,21 +17,6 @@ #ifndef __TIME_OF_DAY_inl #define __TIME_OF_DAY_inl -/*PAGE - * - * _TOD_Is_set - * - * DESCRIPTION: - * - * This function returns TRUE if the application has set the current - * time of day, and FALSE otherwise. - */ - -RTEMS_INLINE_ROUTINE boolean _TOD_Is_set( void ) -{ - return _Watchdog_Is_active( &_TOD_Seconds_watchdog ); -} - /*PAGE * * _TOD_Tickle_ticks diff --git a/c/src/exec/score/macros/rtems/score/tod.inl b/c/src/exec/score/macros/rtems/score/tod.inl index 63c50bc515..17ac5395af 100644 --- a/c/src/exec/score/macros/rtems/score/tod.inl +++ b/c/src/exec/score/macros/rtems/score/tod.inl @@ -17,15 +17,6 @@ #ifndef __TIME_OF_DAY_inl #define __TIME_OF_DAY_inl -/*PAGE - * - * _TOD_Is_set - * - */ - -#define _TOD_Is_set() \ - _Watchdog_Is_active( &_TOD_Seconds_watchdog ) - /*PAGE * * _TOD_Tickle_ticks diff --git a/c/src/exec/score/macros/tod.inl b/c/src/exec/score/macros/tod.inl index 63c50bc515..17ac5395af 100644 --- a/c/src/exec/score/macros/tod.inl +++ b/c/src/exec/score/macros/tod.inl @@ -17,15 +17,6 @@ #ifndef __TIME_OF_DAY_inl #define __TIME_OF_DAY_inl -/*PAGE - * - * _TOD_Is_set - * - */ - -#define _TOD_Is_set() \ - _Watchdog_Is_active( &_TOD_Seconds_watchdog ) - /*PAGE * * _TOD_Tickle_ticks diff --git a/c/src/exec/score/src/coretod.c b/c/src/exec/score/src/coretod.c index 8c7fb93d79..9da6f11510 100644 --- a/c/src/exec/score/src/coretod.c +++ b/c/src/exec/score/src/coretod.c @@ -54,6 +54,9 @@ void _TOD_Handler_initialization( TOD_MICROSECONDS_PER_SECOND / microseconds_per_tick; _Watchdog_Initialize( &_TOD_Seconds_watchdog, _TOD_Tickle, 0, NULL ); + + _TOD_Is_set = FALSE; + _TOD_Activate( _TOD_Ticks_per_second ); } /*PAGE @@ -93,6 +96,7 @@ void _TOD_Set( _TOD_Current = *the_tod; _TOD_Seconds_since_epoch = seconds_since_epoch; + _TOD_Is_set = TRUE; _TOD_Activate( ticks_until_next_second ); _Thread_Enable_dispatch(); diff --git a/c/src/exec/score/src/tod.c b/c/src/exec/score/src/tod.c index 8c7fb93d79..9da6f11510 100644 --- a/c/src/exec/score/src/tod.c +++ b/c/src/exec/score/src/tod.c @@ -54,6 +54,9 @@ void _TOD_Handler_initialization( TOD_MICROSECONDS_PER_SECOND / microseconds_per_tick; _Watchdog_Initialize( &_TOD_Seconds_watchdog, _TOD_Tickle, 0, NULL ); + + _TOD_Is_set = FALSE; + _TOD_Activate( _TOD_Ticks_per_second ); } /*PAGE @@ -93,6 +96,7 @@ void _TOD_Set( _TOD_Current = *the_tod; _TOD_Seconds_since_epoch = seconds_since_epoch; + _TOD_Is_set = TRUE; _TOD_Activate( ticks_until_next_second ); _Thread_Enable_dispatch(); -- cgit v1.2.3