renamed _TOD_Ticks_since_boot as _Watchdog_Ticks_since_boot so the Watchdog

Handler could timestamp the starting and stopping of timers.  Since
TOD is built on top of Watchdog, this avoided a circular dependency.
This commit is contained in:
Joel Sherrill
1996-05-31 23:27:45 +00:00
parent c238a2189d
commit 5e7b6272fc
27 changed files with 55 additions and 38 deletions

View File

@@ -2,6 +2,7 @@
* $Id$ * $Id$
*/ */
#include <assert.h>
#include <sched.h> #include <sched.h>
#include <rtems/system.h> #include <rtems/system.h>

View File

@@ -174,7 +174,7 @@ int clock_gettime(
#ifdef _POSIX_CPUTIME #ifdef _POSIX_CPUTIME
case CLOCK_PROCESS_CPUTIME: case CLOCK_PROCESS_CPUTIME:
/* could base this on _TOD_Ticks_since_boot -- must make set work though*/ /* could base this on _Watchdog_Ticks_since_boot -- must make set work though*/
return POSIX_NOT_IMPLEMENTED(); return POSIX_NOT_IMPLEMENTED();
break; break;
#endif #endif

View File

@@ -25,7 +25,7 @@ unsigned int sleep(
nanosleep( &tp, &tm ); nanosleep( &tp, &tm );
return tm->tv_sec; /* seconds remaining */ return tm.tv_sec; /* seconds remaining */
} }
/* /*
* 4.8.1 Get Configurable System Variables, P1003.1b-1993, p. 95 * 4.8.1 Get Configurable System Variables, P1003.1b-1993, p. 95

View File

@@ -62,7 +62,7 @@ rtems_status_code rtems_clock_get(
return RTEMS_SUCCESSFUL; return RTEMS_SUCCESSFUL;
case RTEMS_CLOCK_GET_TICKS_SINCE_BOOT: case RTEMS_CLOCK_GET_TICKS_SINCE_BOOT:
*(rtems_interval *)time_buffer = _TOD_Ticks_since_boot; *(rtems_interval *)time_buffer = _Watchdog_Ticks_since_boot;
return RTEMS_SUCCESSFUL; return RTEMS_SUCCESSFUL;
case RTEMS_CLOCK_GET_TICKS_PER_SECOND: case RTEMS_CLOCK_GET_TICKS_PER_SECOND:

View File

@@ -62,7 +62,7 @@ rtems_status_code rtems_clock_get(
return RTEMS_SUCCESSFUL; return RTEMS_SUCCESSFUL;
case RTEMS_CLOCK_GET_TICKS_SINCE_BOOT: case RTEMS_CLOCK_GET_TICKS_SINCE_BOOT:
*(rtems_interval *)time_buffer = _TOD_Ticks_since_boot; *(rtems_interval *)time_buffer = _Watchdog_Ticks_since_boot;
return RTEMS_SUCCESSFUL; return RTEMS_SUCCESSFUL;
case RTEMS_CLOCK_GET_TICKS_PER_SECOND: case RTEMS_CLOCK_GET_TICKS_PER_SECOND:

View File

@@ -80,13 +80,6 @@ SCORE_EXTERN TOD_Control _TOD_Current;
SCORE_EXTERN Watchdog_Interval _TOD_Seconds_since_epoch; SCORE_EXTERN Watchdog_Interval _TOD_Seconds_since_epoch;
/*
* The following contains the number of ticks since the
* system was booted.
*/
SCORE_EXTERN Watchdog_Interval _TOD_Ticks_since_boot;
/* /*
* The following contains the number of microseconds per tick. * The following contains the number of microseconds per tick.
*/ */

View File

@@ -82,6 +82,8 @@ typedef struct {
Watchdog_States state; Watchdog_States state;
Watchdog_Interval initial; Watchdog_Interval initial;
Watchdog_Interval delta_interval; Watchdog_Interval delta_interval;
Watchdog_Interval start_time;
Watchdog_Interval stop_time;
Watchdog_Service_routine_entry routine; Watchdog_Service_routine_entry routine;
Objects_Id id; Objects_Id id;
void *user_data; void *user_data;
@@ -95,6 +97,13 @@ typedef struct {
SCORE_EXTERN volatile unsigned32 _Watchdog_Sync_level; SCORE_EXTERN volatile unsigned32 _Watchdog_Sync_level;
SCORE_EXTERN volatile unsigned32 _Watchdog_Sync_count; SCORE_EXTERN volatile unsigned32 _Watchdog_Sync_count;
/*
* The following contains the number of ticks since the
* system was booted.
*/
SCORE_EXTERN Watchdog_Interval _Watchdog_Ticks_since_boot;
/* /*
* The following defines the watchdog chains which are managed * The following defines the watchdog chains which are managed
* on ticks and second boundaries. * on ticks and second boundaries.

View File

@@ -80,13 +80,6 @@ SCORE_EXTERN TOD_Control _TOD_Current;
SCORE_EXTERN Watchdog_Interval _TOD_Seconds_since_epoch; SCORE_EXTERN Watchdog_Interval _TOD_Seconds_since_epoch;
/*
* The following contains the number of ticks since the
* system was booted.
*/
SCORE_EXTERN Watchdog_Interval _TOD_Ticks_since_boot;
/* /*
* The following contains the number of microseconds per tick. * The following contains the number of microseconds per tick.
*/ */

View File

@@ -82,6 +82,8 @@ typedef struct {
Watchdog_States state; Watchdog_States state;
Watchdog_Interval initial; Watchdog_Interval initial;
Watchdog_Interval delta_interval; Watchdog_Interval delta_interval;
Watchdog_Interval start_time;
Watchdog_Interval stop_time;
Watchdog_Service_routine_entry routine; Watchdog_Service_routine_entry routine;
Objects_Id id; Objects_Id id;
void *user_data; void *user_data;
@@ -95,6 +97,13 @@ typedef struct {
SCORE_EXTERN volatile unsigned32 _Watchdog_Sync_level; SCORE_EXTERN volatile unsigned32 _Watchdog_Sync_level;
SCORE_EXTERN volatile unsigned32 _Watchdog_Sync_count; SCORE_EXTERN volatile unsigned32 _Watchdog_Sync_count;
/*
* The following contains the number of ticks since the
* system was booted.
*/
SCORE_EXTERN Watchdog_Interval _Watchdog_Ticks_since_boot;
/* /*
* The following defines the watchdog chains which are managed * The following defines the watchdog chains which are managed
* on ticks and second boundaries. * on ticks and second boundaries.

View File

@@ -45,7 +45,7 @@ STATIC INLINE boolean _TOD_Is_set( void )
STATIC INLINE void _TOD_Tickle_ticks( void ) STATIC INLINE void _TOD_Tickle_ticks( void )
{ {
_TOD_Current.ticks += 1; _TOD_Current.ticks += 1;
_TOD_Ticks_since_boot += 1; _Watchdog_Ticks_since_boot += 1;
} }
/*PAGE /*PAGE

View File

@@ -45,7 +45,7 @@ STATIC INLINE boolean _TOD_Is_set( void )
STATIC INLINE void _TOD_Tickle_ticks( void ) STATIC INLINE void _TOD_Tickle_ticks( void )
{ {
_TOD_Current.ticks += 1; _TOD_Current.ticks += 1;
_TOD_Ticks_since_boot += 1; _Watchdog_Ticks_since_boot += 1;
} }
/*PAGE /*PAGE

View File

@@ -34,7 +34,7 @@
#define _TOD_Tickle_ticks() \ #define _TOD_Tickle_ticks() \
_TOD_Current.ticks++; \ _TOD_Current.ticks++; \
_TOD_Ticks_since_boot++ _Watchdog_Ticks_since_boot++
/*PAGE /*PAGE
* *

View File

@@ -34,7 +34,7 @@
#define _TOD_Tickle_ticks() \ #define _TOD_Tickle_ticks() \
_TOD_Current.ticks++; \ _TOD_Current.ticks++; \
_TOD_Ticks_since_boot++ _Watchdog_Ticks_since_boot++
/*PAGE /*PAGE
* *

View File

@@ -37,7 +37,6 @@ void _TOD_Handler_initialization(
{ {
_TOD_Microseconds_per_tick = microseconds_per_tick; _TOD_Microseconds_per_tick = microseconds_per_tick;
_TOD_Ticks_since_boot = 0;
_TOD_Seconds_since_epoch = 0; _TOD_Seconds_since_epoch = 0;
_TOD_Current.year = TOD_BASE_YEAR; _TOD_Current.year = TOD_BASE_YEAR;

View File

@@ -37,7 +37,6 @@ void _TOD_Handler_initialization(
{ {
_TOD_Microseconds_per_tick = microseconds_per_tick; _TOD_Microseconds_per_tick = microseconds_per_tick;
_TOD_Ticks_since_boot = 0;
_TOD_Seconds_since_epoch = 0; _TOD_Seconds_since_epoch = 0;
_TOD_Current.year = TOD_BASE_YEAR; _TOD_Current.year = TOD_BASE_YEAR;

View File

@@ -32,6 +32,8 @@ void _Watchdog_Handler_initialization( void )
{ {
_Watchdog_Sync_count = 0; _Watchdog_Sync_count = 0;
_Watchdog_Sync_level = 0; _Watchdog_Sync_level = 0;
_Watchdog_Ticks_since_boot = 0;
_Chain_Initialize_empty( &_Watchdog_Ticks_chain ); _Chain_Initialize_empty( &_Watchdog_Ticks_chain );
_Chain_Initialize_empty( &_Watchdog_Seconds_chain ); _Chain_Initialize_empty( &_Watchdog_Seconds_chain );
} }
@@ -82,6 +84,8 @@ Watchdog_States _Watchdog_Remove(
_Chain_Extract_unprotected( &the_watchdog->Node ); _Chain_Extract_unprotected( &the_watchdog->Node );
break; break;
} }
the_watchdog->stop_time = _Watchdog_Ticks_since_boot;
_ISR_Enable( level ); _ISR_Enable( level );
return( previous_state ); return( previous_state );
} }
@@ -200,6 +204,8 @@ restart:
_Chain_Insert_unprotected( after->Node.previous, &the_watchdog->Node ); _Chain_Insert_unprotected( after->Node.previous, &the_watchdog->Node );
the_watchdog->start_time = _Watchdog_Ticks_since_boot;
exit_insert: exit_insert:
_Watchdog_Sync_level = insert_isr_nest_level; _Watchdog_Sync_level = insert_isr_nest_level;
_Watchdog_Sync_count--; _Watchdog_Sync_count--;

View File

@@ -329,7 +329,6 @@ uninitialized =
/*tod.h*/ (sizeof _TOD_Current) + /*tod.h*/ (sizeof _TOD_Current) +
(sizeof _TOD_Seconds_since_epoch) + (sizeof _TOD_Seconds_since_epoch) +
(sizeof _TOD_Ticks_since_boot) +
(sizeof _TOD_Microseconds_per_tick) + (sizeof _TOD_Microseconds_per_tick) +
(sizeof _TOD_Ticks_per_second) + (sizeof _TOD_Ticks_per_second) +
(sizeof _TOD_Seconds_watchdog) + (sizeof _TOD_Seconds_watchdog) +
@@ -343,6 +342,7 @@ uninitialized =
/*watchdog.h*/ (sizeof _Watchdog_Sync_level) + /*watchdog.h*/ (sizeof _Watchdog_Sync_level) +
(sizeof _Watchdog_Sync_count) + (sizeof _Watchdog_Sync_count) +
(sizeof _Watchdog_Ticks_since_boot) +
(sizeof _Watchdog_Ticks_chain) + (sizeof _Watchdog_Ticks_chain) +
(sizeof _Watchdog_Seconds_chain) + (sizeof _Watchdog_Seconds_chain) +

View File

@@ -2,6 +2,7 @@
* $Id$ * $Id$
*/ */
#include <assert.h>
#include <sched.h> #include <sched.h>
#include <rtems/system.h> #include <rtems/system.h>

View File

@@ -174,7 +174,7 @@ int clock_gettime(
#ifdef _POSIX_CPUTIME #ifdef _POSIX_CPUTIME
case CLOCK_PROCESS_CPUTIME: case CLOCK_PROCESS_CPUTIME:
/* could base this on _TOD_Ticks_since_boot -- must make set work though*/ /* could base this on _Watchdog_Ticks_since_boot -- must make set work though*/
return POSIX_NOT_IMPLEMENTED(); return POSIX_NOT_IMPLEMENTED();
break; break;
#endif #endif

View File

@@ -62,7 +62,7 @@ rtems_status_code rtems_clock_get(
return RTEMS_SUCCESSFUL; return RTEMS_SUCCESSFUL;
case RTEMS_CLOCK_GET_TICKS_SINCE_BOOT: case RTEMS_CLOCK_GET_TICKS_SINCE_BOOT:
*(rtems_interval *)time_buffer = _TOD_Ticks_since_boot; *(rtems_interval *)time_buffer = _Watchdog_Ticks_since_boot;
return RTEMS_SUCCESSFUL; return RTEMS_SUCCESSFUL;
case RTEMS_CLOCK_GET_TICKS_PER_SECOND: case RTEMS_CLOCK_GET_TICKS_PER_SECOND:

View File

@@ -80,13 +80,6 @@ SCORE_EXTERN TOD_Control _TOD_Current;
SCORE_EXTERN Watchdog_Interval _TOD_Seconds_since_epoch; SCORE_EXTERN Watchdog_Interval _TOD_Seconds_since_epoch;
/*
* The following contains the number of ticks since the
* system was booted.
*/
SCORE_EXTERN Watchdog_Interval _TOD_Ticks_since_boot;
/* /*
* The following contains the number of microseconds per tick. * The following contains the number of microseconds per tick.
*/ */

View File

@@ -82,6 +82,8 @@ typedef struct {
Watchdog_States state; Watchdog_States state;
Watchdog_Interval initial; Watchdog_Interval initial;
Watchdog_Interval delta_interval; Watchdog_Interval delta_interval;
Watchdog_Interval start_time;
Watchdog_Interval stop_time;
Watchdog_Service_routine_entry routine; Watchdog_Service_routine_entry routine;
Objects_Id id; Objects_Id id;
void *user_data; void *user_data;
@@ -95,6 +97,13 @@ typedef struct {
SCORE_EXTERN volatile unsigned32 _Watchdog_Sync_level; SCORE_EXTERN volatile unsigned32 _Watchdog_Sync_level;
SCORE_EXTERN volatile unsigned32 _Watchdog_Sync_count; SCORE_EXTERN volatile unsigned32 _Watchdog_Sync_count;
/*
* The following contains the number of ticks since the
* system was booted.
*/
SCORE_EXTERN Watchdog_Interval _Watchdog_Ticks_since_boot;
/* /*
* The following defines the watchdog chains which are managed * The following defines the watchdog chains which are managed
* on ticks and second boundaries. * on ticks and second boundaries.

View File

@@ -45,7 +45,7 @@ STATIC INLINE boolean _TOD_Is_set( void )
STATIC INLINE void _TOD_Tickle_ticks( void ) STATIC INLINE void _TOD_Tickle_ticks( void )
{ {
_TOD_Current.ticks += 1; _TOD_Current.ticks += 1;
_TOD_Ticks_since_boot += 1; _Watchdog_Ticks_since_boot += 1;
} }
/*PAGE /*PAGE

View File

@@ -34,7 +34,7 @@
#define _TOD_Tickle_ticks() \ #define _TOD_Tickle_ticks() \
_TOD_Current.ticks++; \ _TOD_Current.ticks++; \
_TOD_Ticks_since_boot++ _Watchdog_Ticks_since_boot++
/*PAGE /*PAGE
* *

View File

@@ -37,7 +37,6 @@ void _TOD_Handler_initialization(
{ {
_TOD_Microseconds_per_tick = microseconds_per_tick; _TOD_Microseconds_per_tick = microseconds_per_tick;
_TOD_Ticks_since_boot = 0;
_TOD_Seconds_since_epoch = 0; _TOD_Seconds_since_epoch = 0;
_TOD_Current.year = TOD_BASE_YEAR; _TOD_Current.year = TOD_BASE_YEAR;

View File

@@ -32,6 +32,8 @@ void _Watchdog_Handler_initialization( void )
{ {
_Watchdog_Sync_count = 0; _Watchdog_Sync_count = 0;
_Watchdog_Sync_level = 0; _Watchdog_Sync_level = 0;
_Watchdog_Ticks_since_boot = 0;
_Chain_Initialize_empty( &_Watchdog_Ticks_chain ); _Chain_Initialize_empty( &_Watchdog_Ticks_chain );
_Chain_Initialize_empty( &_Watchdog_Seconds_chain ); _Chain_Initialize_empty( &_Watchdog_Seconds_chain );
} }
@@ -82,6 +84,8 @@ Watchdog_States _Watchdog_Remove(
_Chain_Extract_unprotected( &the_watchdog->Node ); _Chain_Extract_unprotected( &the_watchdog->Node );
break; break;
} }
the_watchdog->stop_time = _Watchdog_Ticks_since_boot;
_ISR_Enable( level ); _ISR_Enable( level );
return( previous_state ); return( previous_state );
} }
@@ -200,6 +204,8 @@ restart:
_Chain_Insert_unprotected( after->Node.previous, &the_watchdog->Node ); _Chain_Insert_unprotected( after->Node.previous, &the_watchdog->Node );
the_watchdog->start_time = _Watchdog_Ticks_since_boot;
exit_insert: exit_insert:
_Watchdog_Sync_level = insert_isr_nest_level; _Watchdog_Sync_level = insert_isr_nest_level;
_Watchdog_Sync_count--; _Watchdog_Sync_count--;

View File

@@ -329,7 +329,6 @@ uninitialized =
/*tod.h*/ (sizeof _TOD_Current) + /*tod.h*/ (sizeof _TOD_Current) +
(sizeof _TOD_Seconds_since_epoch) + (sizeof _TOD_Seconds_since_epoch) +
(sizeof _TOD_Ticks_since_boot) +
(sizeof _TOD_Microseconds_per_tick) + (sizeof _TOD_Microseconds_per_tick) +
(sizeof _TOD_Ticks_per_second) + (sizeof _TOD_Ticks_per_second) +
(sizeof _TOD_Seconds_watchdog) + (sizeof _TOD_Seconds_watchdog) +
@@ -343,6 +342,7 @@ uninitialized =
/*watchdog.h*/ (sizeof _Watchdog_Sync_level) + /*watchdog.h*/ (sizeof _Watchdog_Sync_level) +
(sizeof _Watchdog_Sync_count) + (sizeof _Watchdog_Sync_count) +
(sizeof _Watchdog_Ticks_since_boot) +
(sizeof _Watchdog_Ticks_chain) + (sizeof _Watchdog_Ticks_chain) +
(sizeof _Watchdog_Seconds_chain) + (sizeof _Watchdog_Seconds_chain) +