source: rtems/cpukit/score/src/watchdoginsert.c @ 62181b21

4.115
Last change on this file since 62181b21 was 9b4422a2, checked in by Joel Sherrill <joel.sherrill@…>, on 05/03/12 at 15:09:24

Remove All CVS Id Strings Possible Using a Script

Script does what is expected and tries to do it as
smartly as possible.

+ remove occurrences of two blank comment lines

next to each other after Id string line removed.

+ remove entire comment blocks which only exited to

contain CVS Ids

+ If the processing left a blank line at the top of

a file, it was removed.

  • Property mode set to 100644
File size: 2.1 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
13#if HAVE_CONFIG_H
14#include "config.h"
15#endif
16
17#include <rtems/system.h>
18#include <rtems/score/isr.h>
19#include <rtems/score/watchdog.h>
20
21/*
22 *  _Watchdog_Insert
23 *
24 *  This routine inserts a watchdog timer on to the appropriate delta
25 *  chain while updating the delta interval counters.
26 */
27
28void _Watchdog_Insert(
29  Chain_Control         *header,
30  Watchdog_Control      *the_watchdog
31)
32{
33  ISR_Level          level;
34  Watchdog_Control  *after;
35  uint32_t           insert_isr_nest_level;
36  Watchdog_Interval  delta_interval;
37
38
39  insert_isr_nest_level   = _ISR_Nest_level;
40
41  _ISR_Disable( level );
42
43  /*
44   *  Check to see if the watchdog has just been inserted by a
45   *  higher priority interrupt.  If so, abandon this insert.
46   */
47
48  if ( the_watchdog->state != WATCHDOG_INACTIVE ) {
49    _ISR_Enable( level );
50    return;
51  }
52
53  the_watchdog->state = WATCHDOG_BEING_INSERTED;
54  _Watchdog_Sync_count++;
55
56restart:
57  delta_interval = the_watchdog->initial;
58
59  for ( after = _Watchdog_First( header ) ;
60        ;
61        after = _Watchdog_Next( after ) ) {
62
63     if ( delta_interval == 0 || !_Watchdog_Next( after ) )
64       break;
65
66     if ( delta_interval < after->delta_interval ) {
67       after->delta_interval -= delta_interval;
68       break;
69     }
70
71     delta_interval -= after->delta_interval;
72
73     _ISR_Flash( level );
74
75     if ( the_watchdog->state != WATCHDOG_BEING_INSERTED ) {
76       goto exit_insert;
77     }
78
79     if ( _Watchdog_Sync_level > insert_isr_nest_level ) {
80       _Watchdog_Sync_level = insert_isr_nest_level;
81       goto restart;
82     }
83  }
84
85  _Watchdog_Activate( the_watchdog );
86
87  the_watchdog->delta_interval = delta_interval;
88
89  _Chain_Insert_unprotected( after->Node.previous, &the_watchdog->Node );
90
91  the_watchdog->start_time = _Watchdog_Ticks_since_boot;
92
93exit_insert:
94  _Watchdog_Sync_level = insert_isr_nest_level;
95  _Watchdog_Sync_count--;
96  _ISR_Enable( level );
97}
Note: See TracBrowser for help on using the repository browser.