diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2015-04-10 15:31:31 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2015-05-19 12:00:43 +0200 |
commit | a382010c62455df73552eb5f0baa1faebe9702c7 (patch) | |
tree | 32764a1f1ce7aec8cd5dce3bf4a363ec4c2de179 /cpukit/score/src/watchdogadjust.c | |
parent | score: Move _Watchdog_Tickle() (diff) | |
download | rtems-a382010c62455df73552eb5f0baa1faebe9702c7.tar.bz2 |
score: New timer server implementation
Use mostly the standard watchdog operations. Use a system event for
synchronization. This implementation is simpler and offers better SMP
performance.
Close #2131.
Diffstat (limited to 'cpukit/score/src/watchdogadjust.c')
-rw-r--r-- | cpukit/score/src/watchdogadjust.c | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/cpukit/score/src/watchdogadjust.c b/cpukit/score/src/watchdogadjust.c index 04fc1a55a7..32b5f7990e 100644 --- a/cpukit/score/src/watchdogadjust.c +++ b/cpukit/score/src/watchdogadjust.c @@ -19,26 +19,18 @@ #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_lock_Context lock_context; - - _Watchdog_Acquire( header, &lock_context ); - if ( !_Watchdog_Is_empty( header ) ) { _Watchdog_First( header )->delta_interval += units; } - - _Watchdog_Release( header, &lock_context ); } -void _Watchdog_Adjust_forward( +void _Watchdog_Adjust_backward( Watchdog_Header *header, Watchdog_Interval units ) @@ -46,7 +38,16 @@ void _Watchdog_Adjust_forward( ISR_lock_Context lock_context; _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; - _Watchdog_Release( header, &lock_context ); + _Watchdog_Release( header, lock_context ); _Watchdog_Tickle( header ); - _Watchdog_Acquire( header, &lock_context ); + _Watchdog_Acquire( header, lock_context ); } } +} +void _Watchdog_Adjust_forward( + Watchdog_Header *header, + Watchdog_Interval units +) +{ + ISR_lock_Context lock_context; + + _Watchdog_Acquire( header, &lock_context ); + _Watchdog_Adjust_forward_locked( header, units, &lock_context ); _Watchdog_Release( header, &lock_context ); } |