source: rtems/cpukit/score/src/watchdogtickle.c @ 2bc236ba

4.104.114.84.95
Last change on this file since 2bc236ba was a0ed4ed, checked in by Ralf Corsepius <ralf.corsepius@…>, on 04/18/04 at 06:13:55

Remove stray white spaces.

  • Property mode set to 100644
File size: 2.2 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#include <rtems/system.h>
16#include <rtems/score/isr.h>
17#include <rtems/score/watchdog.h>
18
19/*PAGE
20 *
21 *  _Watchdog_Tickle
22 *
23 *  This routine decrements the delta counter in response to a tick.  The
24 *  delta chain is updated accordingly.
25 *
26 *  Input parameters:
27 *    header - pointer to the delta chain to be tickled
28 *
29 *  Output parameters: NONE
30 */
31
32void _Watchdog_Tickle(
33  Chain_Control *header
34)
35{
36  ISR_Level level;
37  Watchdog_Control *the_watchdog;
38  Watchdog_States  watchdog_state;
39
40  /*
41   * See the comment in watchdoginsert.c and watchdogadjust.c
42   * about why it's safe not to declare header a pointer to
43   * volatile data - till, 2003/7
44   */
45
46  _ISR_Disable( level );
47
48  if ( _Chain_Is_empty( header ) )
49    goto leave;
50
51  the_watchdog = _Watchdog_First( header );
52  the_watchdog->delta_interval--;
53  if ( the_watchdog->delta_interval != 0 )
54    goto leave;
55
56  do {
57         watchdog_state = _Watchdog_Remove( the_watchdog );
58
59         _ISR_Enable( level );
60
61     switch( watchdog_state ) {
62       case WATCHDOG_ACTIVE:
63         (*the_watchdog->routine)(
64           the_watchdog->id,
65           the_watchdog->user_data
66         );
67         break;
68
69       case WATCHDOG_INACTIVE:
70         /*
71          *  This state indicates that the watchdog is not on any chain.
72          *  Thus, it is NOT on a chain being tickled.  This case should
73          *  never occur.
74          */
75         break;
76
77       case WATCHDOG_BEING_INSERTED:
78         /*
79          *  This state indicates that the watchdog is in the process of
80          *  BEING inserted on the chain.  Thus, it can NOT be on a chain
81          *  being tickled.  This case should never occur.
82          */
83         break;
84
85       case WATCHDOG_REMOVE_IT:
86         break;
87     }
88
89         _ISR_Disable( level );
90
91     the_watchdog = _Watchdog_First( header );
92   } while ( !_Chain_Is_empty( header ) &&
93             (the_watchdog->delta_interval == 0) );
94
95leave:
96   _ISR_Enable(level);
97}
Note: See TracBrowser for help on using the repository browser.