summaryrefslogtreecommitdiffstats
path: root/c/src/exec/score/src/watchdogremove.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>1999-11-02 21:45:15 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>1999-11-02 21:45:15 +0000
commit82cb78d84c7962d2b55e1f83c9f8cbcbef386d87 (patch)
treebae0b9595689a38992ffcc4bad8ddfea285fc16b /c/src/exec/score/src/watchdogremove.c
parentSplit Heap and Time of Day Handlers. (diff)
downloadrtems-82cb78d84c7962d2b55e1f83c9f8cbcbef386d87.tar.bz2
Split core message queue and watchdog handler objects into separate files.
Diffstat (limited to 'c/src/exec/score/src/watchdogremove.c')
-rw-r--r--c/src/exec/score/src/watchdogremove.c71
1 files changed, 71 insertions, 0 deletions
diff --git a/c/src/exec/score/src/watchdogremove.c b/c/src/exec/score/src/watchdogremove.c
new file mode 100644
index 0000000000..1f19d2f49b
--- /dev/null
+++ b/c/src/exec/score/src/watchdogremove.c
@@ -0,0 +1,71 @@
+/*
+ * Watchdog Handler
+ *
+ *
+ * COPYRIGHT (c) 1989-1998.
+ * On-Line Applications Research Corporation (OAR).
+ * Copyright assigned to U.S. Government, 1994.
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.OARcorp.com/rtems/license.html.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/watchdog.h>
+
+/*PAGE
+ *
+ * _Watchdog_Remove
+ *
+ * The routine removes a watchdog from a delta chain and updates
+ * the delta counters of the remaining watchdogs.
+ */
+
+Watchdog_States _Watchdog_Remove(
+ Watchdog_Control *the_watchdog
+)
+{
+ ISR_Level level;
+ Watchdog_States previous_state;
+ Watchdog_Control *next_watchdog;
+
+ _ISR_Disable( level );
+ previous_state = the_watchdog->state;
+ switch ( previous_state ) {
+ case WATCHDOG_INACTIVE:
+ break;
+
+ case WATCHDOG_BEING_INSERTED:
+
+ /*
+ * It is not actually on the chain so just change the state and
+ * the Insert operation we interrupted will be aborted.
+ */
+ the_watchdog->state = WATCHDOG_INACTIVE;
+ break;
+
+ case WATCHDOG_ACTIVE:
+ case WATCHDOG_REMOVE_IT:
+
+ the_watchdog->state = WATCHDOG_INACTIVE;
+ next_watchdog = _Watchdog_Next( the_watchdog );
+
+ if ( _Watchdog_Next(next_watchdog) )
+ next_watchdog->delta_interval += the_watchdog->delta_interval;
+
+ if ( _Watchdog_Sync_count )
+ _Watchdog_Sync_level = _ISR_Nest_level;
+
+ _Chain_Extract_unprotected( &the_watchdog->Node );
+ break;
+ }
+ the_watchdog->stop_time = _Watchdog_Ticks_since_boot;
+
+ _ISR_Enable( level );
+ return( previous_state );
+}
+