summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/watchdogadjust.c
diff options
context:
space:
mode:
Diffstat (limited to 'cpukit/score/src/watchdogadjust.c')
-rw-r--r--cpukit/score/src/watchdogadjust.c67
1 files changed, 31 insertions, 36 deletions
diff --git a/cpukit/score/src/watchdogadjust.c b/cpukit/score/src/watchdogadjust.c
index bbfda4d0cf..5d841049dc 100644
--- a/cpukit/score/src/watchdogadjust.c
+++ b/cpukit/score/src/watchdogadjust.c
@@ -18,57 +18,52 @@
#include "config.h"
#endif
-#include <rtems/system.h>
-#include <rtems/score/isr.h>
#include <rtems/score/watchdogimpl.h>
+#include <rtems/score/chainimpl.h>
+#include <rtems/score/isrlevel.h>
-void _Watchdog_Adjust(
- Chain_Control *header,
- Watchdog_Adjust_directions direction,
- Watchdog_Interval units
+void _Watchdog_Adjust_backward(
+ Chain_Control *header,
+ Watchdog_Interval units
)
{
ISR_Level level;
_ISR_Disable( level );
- /*
- * NOTE: It is safe NOT to make 'header' a pointer
- * to volatile data (contrast this with watchdoginsert.c)
- * because we call _Watchdog_Tickle() below and
- * hence the compiler must not assume *header to remain
- * unmodified across that call.
- *
- * Till Straumann, 7/2003
- */
if ( !_Chain_Is_empty( header ) ) {
- switch ( direction ) {
- case WATCHDOG_BACKWARD:
- _Watchdog_First( header )->delta_interval += units;
- break;
- case WATCHDOG_FORWARD:
- while ( units ) {
- if ( units < _Watchdog_First( header )->delta_interval ) {
- _Watchdog_First( header )->delta_interval -= units;
- break;
- } else {
- units -= _Watchdog_First( header )->delta_interval;
- _Watchdog_First( header )->delta_interval = 1;
+ _Watchdog_First( header )->delta_interval += units;
+ }
+
+ _ISR_Enable( level );
+}
+
+void _Watchdog_Adjust_forward(
+ Chain_Control *header,
+ Watchdog_Interval units
+)
+{
+ ISR_Level level;
+
+ _ISR_Disable( level );
+
+ while ( !_Chain_Is_empty( header ) && units > 0 ) {
+ Watchdog_Control *first = _Watchdog_First( header );
- _ISR_Enable( level );
+ if ( units < first->delta_interval ) {
+ first->delta_interval -= units;
+ break;
+ } else {
+ units -= first->delta_interval;
+ first->delta_interval = 1;
- _Watchdog_Tickle( header );
+ _ISR_Enable( level );
- _ISR_Disable( level );
+ _Watchdog_Tickle( header );
- if ( _Chain_Is_empty( header ) )
- break;
- }
- }
- break;
+ _ISR_Disable( level );
}
}
_ISR_Enable( level );
-
}