forked from Imagelibrary/rtems
changed _TOD_Is_set from a function to a boolean variable
This commit is contained in:
@@ -48,14 +48,14 @@ rtems_status_code rtems_clock_get(
|
|||||||
|
|
||||||
switch ( option ) {
|
switch ( option ) {
|
||||||
case RTEMS_CLOCK_GET_TOD:
|
case RTEMS_CLOCK_GET_TOD:
|
||||||
if ( !_TOD_Is_set() )
|
if ( !_TOD_Is_set )
|
||||||
return RTEMS_NOT_DEFINED;
|
return RTEMS_NOT_DEFINED;
|
||||||
|
|
||||||
*(rtems_time_of_day *)time_buffer = _TOD_Current;
|
*(rtems_time_of_day *)time_buffer = _TOD_Current;
|
||||||
return RTEMS_SUCCESSFUL;
|
return RTEMS_SUCCESSFUL;
|
||||||
|
|
||||||
case RTEMS_CLOCK_GET_SECONDS_SINCE_EPOCH:
|
case RTEMS_CLOCK_GET_SECONDS_SINCE_EPOCH:
|
||||||
if ( !_TOD_Is_set() )
|
if ( !_TOD_Is_set )
|
||||||
return RTEMS_NOT_DEFINED;
|
return RTEMS_NOT_DEFINED;
|
||||||
|
|
||||||
*(rtems_interval *)time_buffer = _TOD_Seconds_since_epoch;
|
*(rtems_interval *)time_buffer = _TOD_Seconds_since_epoch;
|
||||||
@@ -70,7 +70,7 @@ rtems_status_code rtems_clock_get(
|
|||||||
return RTEMS_SUCCESSFUL;
|
return RTEMS_SUCCESSFUL;
|
||||||
|
|
||||||
case RTEMS_CLOCK_GET_TIME_VALUE:
|
case RTEMS_CLOCK_GET_TIME_VALUE:
|
||||||
if ( !_TOD_Is_set() )
|
if ( !_TOD_Is_set )
|
||||||
return RTEMS_NOT_DEFINED;
|
return RTEMS_NOT_DEFINED;
|
||||||
|
|
||||||
_ISR_Disable( level );
|
_ISR_Disable( level );
|
||||||
|
|||||||
@@ -48,14 +48,14 @@ rtems_status_code rtems_clock_get(
|
|||||||
|
|
||||||
switch ( option ) {
|
switch ( option ) {
|
||||||
case RTEMS_CLOCK_GET_TOD:
|
case RTEMS_CLOCK_GET_TOD:
|
||||||
if ( !_TOD_Is_set() )
|
if ( !_TOD_Is_set )
|
||||||
return RTEMS_NOT_DEFINED;
|
return RTEMS_NOT_DEFINED;
|
||||||
|
|
||||||
*(rtems_time_of_day *)time_buffer = _TOD_Current;
|
*(rtems_time_of_day *)time_buffer = _TOD_Current;
|
||||||
return RTEMS_SUCCESSFUL;
|
return RTEMS_SUCCESSFUL;
|
||||||
|
|
||||||
case RTEMS_CLOCK_GET_SECONDS_SINCE_EPOCH:
|
case RTEMS_CLOCK_GET_SECONDS_SINCE_EPOCH:
|
||||||
if ( !_TOD_Is_set() )
|
if ( !_TOD_Is_set )
|
||||||
return RTEMS_NOT_DEFINED;
|
return RTEMS_NOT_DEFINED;
|
||||||
|
|
||||||
*(rtems_interval *)time_buffer = _TOD_Seconds_since_epoch;
|
*(rtems_interval *)time_buffer = _TOD_Seconds_since_epoch;
|
||||||
@@ -70,7 +70,7 @@ rtems_status_code rtems_clock_get(
|
|||||||
return RTEMS_SUCCESSFUL;
|
return RTEMS_SUCCESSFUL;
|
||||||
|
|
||||||
case RTEMS_CLOCK_GET_TIME_VALUE:
|
case RTEMS_CLOCK_GET_TIME_VALUE:
|
||||||
if ( !_TOD_Is_set() )
|
if ( !_TOD_Is_set )
|
||||||
return RTEMS_NOT_DEFINED;
|
return RTEMS_NOT_DEFINED;
|
||||||
|
|
||||||
_ISR_Disable( level );
|
_ISR_Disable( level );
|
||||||
|
|||||||
@@ -277,7 +277,7 @@ rtems_status_code rtems_timer_fire_when(
|
|||||||
Objects_Locations location;
|
Objects_Locations location;
|
||||||
rtems_interval seconds;
|
rtems_interval seconds;
|
||||||
|
|
||||||
if ( !_TOD_Is_set() )
|
if ( !_TOD_Is_set )
|
||||||
return RTEMS_NOT_DEFINED;
|
return RTEMS_NOT_DEFINED;
|
||||||
|
|
||||||
if ( !_TOD_Validate( wall_time ) )
|
if ( !_TOD_Validate( wall_time ) )
|
||||||
|
|||||||
@@ -1034,7 +1034,7 @@ rtems_time_of_day *time_buffer
|
|||||||
{
|
{
|
||||||
Watchdog_Interval seconds;
|
Watchdog_Interval seconds;
|
||||||
|
|
||||||
if ( !_TOD_Is_set() )
|
if ( !_TOD_Is_set )
|
||||||
return RTEMS_NOT_DEFINED;
|
return RTEMS_NOT_DEFINED;
|
||||||
|
|
||||||
time_buffer->ticks = 0;
|
time_buffer->ticks = 0;
|
||||||
|
|||||||
@@ -277,7 +277,7 @@ rtems_status_code rtems_timer_fire_when(
|
|||||||
Objects_Locations location;
|
Objects_Locations location;
|
||||||
rtems_interval seconds;
|
rtems_interval seconds;
|
||||||
|
|
||||||
if ( !_TOD_Is_set() )
|
if ( !_TOD_Is_set )
|
||||||
return RTEMS_NOT_DEFINED;
|
return RTEMS_NOT_DEFINED;
|
||||||
|
|
||||||
if ( !_TOD_Validate( wall_time ) )
|
if ( !_TOD_Validate( wall_time ) )
|
||||||
|
|||||||
@@ -67,6 +67,13 @@ typedef struct { /* RTEID style time/date */
|
|||||||
unsigned32 ticks; /* elapsed ticks between secs */
|
unsigned32 ticks; /* elapsed ticks between secs */
|
||||||
} TOD_Control;
|
} 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.
|
* The following contains the current time of day.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -67,6 +67,13 @@ typedef struct { /* RTEID style time/date */
|
|||||||
unsigned32 ticks; /* elapsed ticks between secs */
|
unsigned32 ticks; /* elapsed ticks between secs */
|
||||||
} TOD_Control;
|
} 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.
|
* The following contains the current time of day.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -17,21 +17,6 @@
|
|||||||
#ifndef __TIME_OF_DAY_inl
|
#ifndef __TIME_OF_DAY_inl
|
||||||
#define __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
|
/*PAGE
|
||||||
*
|
*
|
||||||
* _TOD_Tickle_ticks
|
* _TOD_Tickle_ticks
|
||||||
|
|||||||
@@ -17,21 +17,6 @@
|
|||||||
#ifndef __TIME_OF_DAY_inl
|
#ifndef __TIME_OF_DAY_inl
|
||||||
#define __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
|
/*PAGE
|
||||||
*
|
*
|
||||||
* _TOD_Tickle_ticks
|
* _TOD_Tickle_ticks
|
||||||
|
|||||||
@@ -17,15 +17,6 @@
|
|||||||
#ifndef __TIME_OF_DAY_inl
|
#ifndef __TIME_OF_DAY_inl
|
||||||
#define __TIME_OF_DAY_inl
|
#define __TIME_OF_DAY_inl
|
||||||
|
|
||||||
/*PAGE
|
|
||||||
*
|
|
||||||
* _TOD_Is_set
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define _TOD_Is_set() \
|
|
||||||
_Watchdog_Is_active( &_TOD_Seconds_watchdog )
|
|
||||||
|
|
||||||
/*PAGE
|
/*PAGE
|
||||||
*
|
*
|
||||||
* _TOD_Tickle_ticks
|
* _TOD_Tickle_ticks
|
||||||
|
|||||||
@@ -17,15 +17,6 @@
|
|||||||
#ifndef __TIME_OF_DAY_inl
|
#ifndef __TIME_OF_DAY_inl
|
||||||
#define __TIME_OF_DAY_inl
|
#define __TIME_OF_DAY_inl
|
||||||
|
|
||||||
/*PAGE
|
|
||||||
*
|
|
||||||
* _TOD_Is_set
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define _TOD_Is_set() \
|
|
||||||
_Watchdog_Is_active( &_TOD_Seconds_watchdog )
|
|
||||||
|
|
||||||
/*PAGE
|
/*PAGE
|
||||||
*
|
*
|
||||||
* _TOD_Tickle_ticks
|
* _TOD_Tickle_ticks
|
||||||
|
|||||||
@@ -54,6 +54,9 @@ void _TOD_Handler_initialization(
|
|||||||
TOD_MICROSECONDS_PER_SECOND / microseconds_per_tick;
|
TOD_MICROSECONDS_PER_SECOND / microseconds_per_tick;
|
||||||
|
|
||||||
_Watchdog_Initialize( &_TOD_Seconds_watchdog, _TOD_Tickle, 0, NULL );
|
_Watchdog_Initialize( &_TOD_Seconds_watchdog, _TOD_Tickle, 0, NULL );
|
||||||
|
|
||||||
|
_TOD_Is_set = FALSE;
|
||||||
|
_TOD_Activate( _TOD_Ticks_per_second );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*PAGE
|
/*PAGE
|
||||||
@@ -93,6 +96,7 @@ void _TOD_Set(
|
|||||||
|
|
||||||
_TOD_Current = *the_tod;
|
_TOD_Current = *the_tod;
|
||||||
_TOD_Seconds_since_epoch = seconds_since_epoch;
|
_TOD_Seconds_since_epoch = seconds_since_epoch;
|
||||||
|
_TOD_Is_set = TRUE;
|
||||||
_TOD_Activate( ticks_until_next_second );
|
_TOD_Activate( ticks_until_next_second );
|
||||||
|
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
|
|||||||
@@ -54,6 +54,9 @@ void _TOD_Handler_initialization(
|
|||||||
TOD_MICROSECONDS_PER_SECOND / microseconds_per_tick;
|
TOD_MICROSECONDS_PER_SECOND / microseconds_per_tick;
|
||||||
|
|
||||||
_Watchdog_Initialize( &_TOD_Seconds_watchdog, _TOD_Tickle, 0, NULL );
|
_Watchdog_Initialize( &_TOD_Seconds_watchdog, _TOD_Tickle, 0, NULL );
|
||||||
|
|
||||||
|
_TOD_Is_set = FALSE;
|
||||||
|
_TOD_Activate( _TOD_Ticks_per_second );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*PAGE
|
/*PAGE
|
||||||
@@ -93,6 +96,7 @@ void _TOD_Set(
|
|||||||
|
|
||||||
_TOD_Current = *the_tod;
|
_TOD_Current = *the_tod;
|
||||||
_TOD_Seconds_since_epoch = seconds_since_epoch;
|
_TOD_Seconds_since_epoch = seconds_since_epoch;
|
||||||
|
_TOD_Is_set = TRUE;
|
||||||
_TOD_Activate( ticks_until_next_second );
|
_TOD_Activate( ticks_until_next_second );
|
||||||
|
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
|
|||||||
@@ -48,14 +48,14 @@ rtems_status_code rtems_clock_get(
|
|||||||
|
|
||||||
switch ( option ) {
|
switch ( option ) {
|
||||||
case RTEMS_CLOCK_GET_TOD:
|
case RTEMS_CLOCK_GET_TOD:
|
||||||
if ( !_TOD_Is_set() )
|
if ( !_TOD_Is_set )
|
||||||
return RTEMS_NOT_DEFINED;
|
return RTEMS_NOT_DEFINED;
|
||||||
|
|
||||||
*(rtems_time_of_day *)time_buffer = _TOD_Current;
|
*(rtems_time_of_day *)time_buffer = _TOD_Current;
|
||||||
return RTEMS_SUCCESSFUL;
|
return RTEMS_SUCCESSFUL;
|
||||||
|
|
||||||
case RTEMS_CLOCK_GET_SECONDS_SINCE_EPOCH:
|
case RTEMS_CLOCK_GET_SECONDS_SINCE_EPOCH:
|
||||||
if ( !_TOD_Is_set() )
|
if ( !_TOD_Is_set )
|
||||||
return RTEMS_NOT_DEFINED;
|
return RTEMS_NOT_DEFINED;
|
||||||
|
|
||||||
*(rtems_interval *)time_buffer = _TOD_Seconds_since_epoch;
|
*(rtems_interval *)time_buffer = _TOD_Seconds_since_epoch;
|
||||||
@@ -70,7 +70,7 @@ rtems_status_code rtems_clock_get(
|
|||||||
return RTEMS_SUCCESSFUL;
|
return RTEMS_SUCCESSFUL;
|
||||||
|
|
||||||
case RTEMS_CLOCK_GET_TIME_VALUE:
|
case RTEMS_CLOCK_GET_TIME_VALUE:
|
||||||
if ( !_TOD_Is_set() )
|
if ( !_TOD_Is_set )
|
||||||
return RTEMS_NOT_DEFINED;
|
return RTEMS_NOT_DEFINED;
|
||||||
|
|
||||||
_ISR_Disable( level );
|
_ISR_Disable( level );
|
||||||
|
|||||||
@@ -277,7 +277,7 @@ rtems_status_code rtems_timer_fire_when(
|
|||||||
Objects_Locations location;
|
Objects_Locations location;
|
||||||
rtems_interval seconds;
|
rtems_interval seconds;
|
||||||
|
|
||||||
if ( !_TOD_Is_set() )
|
if ( !_TOD_Is_set )
|
||||||
return RTEMS_NOT_DEFINED;
|
return RTEMS_NOT_DEFINED;
|
||||||
|
|
||||||
if ( !_TOD_Validate( wall_time ) )
|
if ( !_TOD_Validate( wall_time ) )
|
||||||
|
|||||||
@@ -1034,7 +1034,7 @@ rtems_time_of_day *time_buffer
|
|||||||
{
|
{
|
||||||
Watchdog_Interval seconds;
|
Watchdog_Interval seconds;
|
||||||
|
|
||||||
if ( !_TOD_Is_set() )
|
if ( !_TOD_Is_set )
|
||||||
return RTEMS_NOT_DEFINED;
|
return RTEMS_NOT_DEFINED;
|
||||||
|
|
||||||
time_buffer->ticks = 0;
|
time_buffer->ticks = 0;
|
||||||
|
|||||||
@@ -67,6 +67,13 @@ typedef struct { /* RTEID style time/date */
|
|||||||
unsigned32 ticks; /* elapsed ticks between secs */
|
unsigned32 ticks; /* elapsed ticks between secs */
|
||||||
} TOD_Control;
|
} 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.
|
* The following contains the current time of day.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -17,21 +17,6 @@
|
|||||||
#ifndef __TIME_OF_DAY_inl
|
#ifndef __TIME_OF_DAY_inl
|
||||||
#define __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
|
/*PAGE
|
||||||
*
|
*
|
||||||
* _TOD_Tickle_ticks
|
* _TOD_Tickle_ticks
|
||||||
|
|||||||
@@ -17,15 +17,6 @@
|
|||||||
#ifndef __TIME_OF_DAY_inl
|
#ifndef __TIME_OF_DAY_inl
|
||||||
#define __TIME_OF_DAY_inl
|
#define __TIME_OF_DAY_inl
|
||||||
|
|
||||||
/*PAGE
|
|
||||||
*
|
|
||||||
* _TOD_Is_set
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define _TOD_Is_set() \
|
|
||||||
_Watchdog_Is_active( &_TOD_Seconds_watchdog )
|
|
||||||
|
|
||||||
/*PAGE
|
/*PAGE
|
||||||
*
|
*
|
||||||
* _TOD_Tickle_ticks
|
* _TOD_Tickle_ticks
|
||||||
|
|||||||
@@ -54,6 +54,9 @@ void _TOD_Handler_initialization(
|
|||||||
TOD_MICROSECONDS_PER_SECOND / microseconds_per_tick;
|
TOD_MICROSECONDS_PER_SECOND / microseconds_per_tick;
|
||||||
|
|
||||||
_Watchdog_Initialize( &_TOD_Seconds_watchdog, _TOD_Tickle, 0, NULL );
|
_Watchdog_Initialize( &_TOD_Seconds_watchdog, _TOD_Tickle, 0, NULL );
|
||||||
|
|
||||||
|
_TOD_Is_set = FALSE;
|
||||||
|
_TOD_Activate( _TOD_Ticks_per_second );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*PAGE
|
/*PAGE
|
||||||
@@ -93,6 +96,7 @@ void _TOD_Set(
|
|||||||
|
|
||||||
_TOD_Current = *the_tod;
|
_TOD_Current = *the_tod;
|
||||||
_TOD_Seconds_since_epoch = seconds_since_epoch;
|
_TOD_Seconds_since_epoch = seconds_since_epoch;
|
||||||
|
_TOD_Is_set = TRUE;
|
||||||
_TOD_Activate( ticks_until_next_second );
|
_TOD_Activate( ticks_until_next_second );
|
||||||
|
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
|
|||||||
Reference in New Issue
Block a user