source: rtems/cpukit/score/src/watchdogremove.c @ 25f5730f

4.11
Last change on this file since 25f5730f was c499856, checked in by Chris Johns <chrisj@…>, on Mar 20, 2014 at 9:10:47 PM

Change all references of rtems.com to rtems.org.

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