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

4.115
Last change on this file since f68401e was 4b48ece0, checked in by Sebastian Huber <sebastian.huber@…>, on 07/22/13 at 08:21:03

score: Create watchdog implementation header

Move implementation specific parts of watchdog.h and watchdog.inl into
new header file watchdogimpl.h. The watchdog.h contains now only the
application visible API.

  • 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.com/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.