summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/watchdogtickle.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2003-07-18 14:47:55 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2003-07-18 14:47:55 +0000
commitfbbe5fde57bdc9d0c7f809931c2addb43bc1bd42 (patch)
tree52468f8511082fc9893f46b9020817d23bf0c398 /cpukit/score/src/watchdogtickle.c
parentFixed formatting so scripts work. (diff)
downloadrtems-fbbe5fde57bdc9d0c7f809931c2addb43bc1bd42.tar.bz2
2003-07-18 Till Straumann <strauman@slac.stanford.edu>
PR 430/rtems * include/rtems/score/watchdog.h: _Watchdog_Ticks_since_boot should be a VOLATILE variable. * src/watchdoginsert.c: 'restart' algorithm needs to enforce reloading the list head in case a TICK interrupt during ISR_Flash() modified the list. This is achieved by a proper VOLATILE cast. Also _Watchdog_Sync_count++ should be protected by _ISR_Disable (prevent corruption in case ISR calls watchdoginsert) * src/watchdogadjust.c: ISR protection added. * src/watchdogtickle.c: ISR protection added. NOTE: PowerPC BSPs using the new exception processing MUST BE UPDATED to maintain _ISR_Nest_level. See also PR288 which provides fixes for the affected BSPs distributed with RTEMS.
Diffstat (limited to 'cpukit/score/src/watchdogtickle.c')
-rw-r--r--cpukit/score/src/watchdogtickle.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/cpukit/score/src/watchdogtickle.c b/cpukit/score/src/watchdogtickle.c
index fe07f566ff..80b1784152 100644
--- a/cpukit/score/src/watchdogtickle.c
+++ b/cpukit/score/src/watchdogtickle.c
@@ -33,18 +33,32 @@ void _Watchdog_Tickle(
Chain_Control *header
)
{
+ ISR_Level level;
Watchdog_Control *the_watchdog;
+ Watchdog_States watchdog_state;
+
+ /*
+ * See the comment in watchdoginsert.c and watchdogadjust.c
+ * about why it's safe not to declare header a pointer to
+ * volatile data - till, 2003/7
+ */
+
+ _ISR_Disable( level );
if ( _Chain_Is_empty( header ) )
- return;
+ goto leave;
the_watchdog = _Watchdog_First( header );
the_watchdog->delta_interval--;
if ( the_watchdog->delta_interval != 0 )
- return;
+ goto leave;
do {
- switch( _Watchdog_Remove( the_watchdog ) ) {
+ watchdog_state = _Watchdog_Remove( the_watchdog );
+
+ _ISR_Enable( level );
+
+ switch( watchdog_state ) {
case WATCHDOG_ACTIVE:
(*the_watchdog->routine)(
the_watchdog->id,
@@ -71,7 +85,13 @@ void _Watchdog_Tickle(
case WATCHDOG_REMOVE_IT:
break;
}
+
+ _ISR_Disable( level );
+
the_watchdog = _Watchdog_First( header );
} while ( !_Chain_Is_empty( header ) &&
(the_watchdog->delta_interval == 0) );
+
+leave:
+ _ISR_Enable(level);
}