diff options
author | Joel Sherrill <joel.sherrill@oarcorp.com> | 2015-05-21 18:08:32 -0500 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@oarcorp.com> | 2015-05-21 18:08:32 -0500 |
commit | 24acc6d0c092c244881dd6ffadc3782a8136fccc (patch) | |
tree | 864b4985a7a431bd3520e9d815927eee5315c2df /cpukit/score/src/watchdogadjust.c | |
parent | Merge branch 'master' of ssh://dispatch.rtems.org/data/git/rtems (diff) | |
parent | doc: Add new documentation section for Epiphany architecture (diff) | |
download | rtems-24acc6d0c092c244881dd6ffadc3782a8136fccc.tar.bz2 |
Merge branch 'master' of ssh://dispatch.rtems.org/data/git/rtems
Diffstat (limited to 'cpukit/score/src/watchdogadjust.c')
-rw-r--r-- | cpukit/score/src/watchdogadjust.c | 41 |
1 files changed, 26 insertions, 15 deletions
diff --git a/cpukit/score/src/watchdogadjust.c b/cpukit/score/src/watchdogadjust.c index 687f063482..32b5f7990e 100644 --- a/cpukit/score/src/watchdogadjust.c +++ b/cpukit/score/src/watchdogadjust.c @@ -19,34 +19,35 @@ #endif #include <rtems/score/watchdogimpl.h> -#include <rtems/score/chainimpl.h> -#include <rtems/score/isrlevel.h> -void _Watchdog_Adjust_backward( +void _Watchdog_Adjust_backward_locked( Watchdog_Header *header, Watchdog_Interval units ) { - ISR_Level level; - - _ISR_Disable( level ); - if ( !_Watchdog_Is_empty( header ) ) { _Watchdog_First( header )->delta_interval += units; } - - _ISR_Enable( level ); } -void _Watchdog_Adjust_forward( +void _Watchdog_Adjust_backward( Watchdog_Header *header, Watchdog_Interval units ) { - ISR_Level level; + ISR_lock_Context lock_context; - _ISR_Disable( level ); + _Watchdog_Acquire( header, &lock_context ); + _Watchdog_Adjust_backward_locked( header, units ); + _Watchdog_Release( header, &lock_context ); +} +void _Watchdog_Adjust_forward_locked( + Watchdog_Header *header, + Watchdog_Interval units, + ISR_lock_Context *lock_context +) +{ while ( !_Watchdog_Is_empty( header ) && units > 0 ) { Watchdog_Control *first = _Watchdog_First( header ); @@ -57,13 +58,23 @@ void _Watchdog_Adjust_forward( units -= first->delta_interval; first->delta_interval = 1; - _ISR_Enable( level ); + _Watchdog_Release( header, lock_context ); _Watchdog_Tickle( header ); - _ISR_Disable( level ); + _Watchdog_Acquire( header, lock_context ); } } +} + +void _Watchdog_Adjust_forward( + Watchdog_Header *header, + Watchdog_Interval units +) +{ + ISR_lock_Context lock_context; - _ISR_Enable( level ); + _Watchdog_Acquire( header, &lock_context ); + _Watchdog_Adjust_forward_locked( header, units, &lock_context ); + _Watchdog_Release( header, &lock_context ); } |