source: rtems/cpukit/score/src/watchdogremove.c @ f172fc89

4.104.114.84.95
Last change on this file since f172fc89 was a8eed23, checked in by Ralf Corsepius <ralf.corsepius@…>, on 01/27/05 at 05:57:05

Include config.h.

  • Property mode set to 100644
File size: 1.6 KB
Line 
1/*
2 *  Watchdog Handler
3 *
4 *
5 *  COPYRIGHT (c) 1989-1999.
6 *  On-Line Applications Research Corporation (OAR).
7 *
8 *  The license and distribution terms for this file may be
9 *  found in the file LICENSE in this distribution or at
10 *  http://www.rtems.com/license/LICENSE.
11 *
12 *  $Id$
13 */
14
15#if HAVE_CONFIG_H
16#include "config.h"
17#endif
18
19#include <rtems/system.h>
20#include <rtems/score/isr.h>
21#include <rtems/score/watchdog.h>
22
23/*PAGE
24 *
25 *  _Watchdog_Remove
26 *
27 *  The routine removes a watchdog from a delta chain and updates
28 *  the delta counters of the remaining watchdogs.
29 */
30
31Watchdog_States _Watchdog_Remove(
32  Watchdog_Control *the_watchdog
33)
34{
35  ISR_Level         level;
36  Watchdog_States   previous_state;
37  Watchdog_Control *next_watchdog;
38
39  _ISR_Disable( level );
40  previous_state = the_watchdog->state;
41  switch ( previous_state ) {
42    case WATCHDOG_INACTIVE:
43      break;
44
45    case WATCHDOG_BEING_INSERTED:
46
47      /*
48       *  It is not actually on the chain so just change the state and
49       *  the Insert operation we interrupted will be aborted.
50       */
51      the_watchdog->state = WATCHDOG_INACTIVE;
52      break;
53
54    case WATCHDOG_ACTIVE:
55    case WATCHDOG_REMOVE_IT:
56
57      the_watchdog->state = WATCHDOG_INACTIVE;
58      next_watchdog = _Watchdog_Next( the_watchdog );
59
60      if ( _Watchdog_Next(next_watchdog) )
61        next_watchdog->delta_interval += the_watchdog->delta_interval;
62
63      if ( _Watchdog_Sync_count )
64        _Watchdog_Sync_level = _ISR_Nest_level;
65
66      _Chain_Extract_unprotected( &the_watchdog->Node );
67      break;
68  }
69  the_watchdog->stop_time = _Watchdog_Ticks_since_boot;
70
71  _ISR_Enable( level );
72  return( previous_state );
73}
Note: See TracBrowser for help on using the repository browser.