summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2015-04-10 15:31:31 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2015-05-19 12:00:43 +0200
commita382010c62455df73552eb5f0baa1faebe9702c7 (patch)
tree32764a1f1ce7aec8cd5dce3bf4a363ec4c2de179 /cpukit/score/src
parentscore: Move _Watchdog_Tickle() (diff)
downloadrtems-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')
-rw-r--r--cpukit/score/src/watchdogadjust.c35
-rw-r--r--cpukit/score/src/watchdogadjusttochain.c75
-rw-r--r--cpukit/score/src/watchdoginsert.c21
3 files changed, 37 insertions, 94 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 );
}
diff --git a/cpukit/score/src/watchdogadjusttochain.c b/cpukit/score/src/watchdogadjusttochain.c
deleted file mode 100644
index b3063e4109..0000000000
--- a/cpukit/score/src/watchdogadjusttochain.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/**
- * @file
- *
- * @brief Watchdog Adjust to Chain
- * @ingroup ScoreWatchdog
- */
-
-/*
- * COPYRIGHT (c) 1989-2009.
- * On-Line Applications Research Corporation (OAR).
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
- */
-
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <rtems/score/watchdogimpl.h>
-#include <rtems/score/isrlevel.h>
-
-void _Watchdog_Adjust_to_chain(
- Watchdog_Header *header,
- Watchdog_Interval units_arg,
- Chain_Control *to_fire
-
-)
-{
- Watchdog_Interval units = units_arg;
- ISR_lock_Context lock_context;
- Watchdog_Control *first;
-
- _Watchdog_Acquire( header, &lock_context );
-
- while ( 1 ) {
- if ( _Watchdog_Is_empty( header ) ) {
- break;
- }
- first = _Watchdog_First( header );
-
- /*
- * If it is longer than "units" until the first element on the chain
- * fires, then bump it and quit.
- */
- if ( units < first->delta_interval ) {
- first->delta_interval -= units;
- break;
- }
-
- /*
- * The first set happens in less than units, so take all of them
- * off the chain and adjust units to reflect this.
- */
- units -= first->delta_interval;
- first->delta_interval = 0;
-
- while ( 1 ) {
- _Chain_Extract_unprotected( &first->Node );
- _Chain_Append_unprotected( to_fire, &first->Node );
-
- _Watchdog_Flash( header, &lock_context );
-
- if ( _Watchdog_Is_empty( header ) )
- break;
- first = _Watchdog_First( header );
- if ( first->delta_interval != 0 )
- break;
- }
- }
-
- _Watchdog_Release( header, &lock_context );
-}
-
diff --git a/cpukit/score/src/watchdoginsert.c b/cpukit/score/src/watchdoginsert.c
index 6d2df8222f..6b81c7b872 100644
--- a/cpukit/score/src/watchdoginsert.c
+++ b/cpukit/score/src/watchdoginsert.c
@@ -47,15 +47,12 @@ static void _Watchdog_Insert_fixup(
}
}
-void _Watchdog_Insert(
+void _Watchdog_Insert_locked(
Watchdog_Header *header,
- Watchdog_Control *the_watchdog
+ Watchdog_Control *the_watchdog,
+ ISR_lock_Context *lock_context
)
{
- ISR_lock_Context lock_context;
-
- _Watchdog_Acquire( header, &lock_context );
-
if ( the_watchdog->state == WATCHDOG_INACTIVE ) {
Watchdog_Iterator iterator;
Chain_Node *current;
@@ -86,7 +83,7 @@ void _Watchdog_Insert(
iterator.delta_interval = delta - delta_next;
iterator.current = next;
- _Watchdog_Flash( header, &lock_context );
+ _Watchdog_Flash( header, lock_context );
if ( the_watchdog->state != WATCHDOG_BEING_INSERTED ) {
goto abort_insert;
@@ -105,6 +102,16 @@ abort_insert:
_Chain_Extract_unprotected( &iterator.Node );
}
+}
+void _Watchdog_Insert(
+ Watchdog_Header *header,
+ Watchdog_Control *the_watchdog
+)
+{
+ ISR_lock_Context lock_context;
+
+ _Watchdog_Acquire( header, &lock_context );
+ _Watchdog_Insert_locked( header, the_watchdog, &lock_context );
_Watchdog_Release( header, &lock_context );
}