source: rtems/cpukit/score/src/watchdogadjust.c @ 6af81435

4.104.114.84.95
Last change on this file since 6af81435 was 82cb78d8, checked in by Joel Sherrill <joel.sherrill@…>, on 11/02/99 at 21:45:15

Split core message queue and watchdog handler objects into separate files.

  • Property mode set to 100644
File size: 1.6 KB
Line 
1/*
2 *  Watchdog Handler
3 *
4 *
5 *  COPYRIGHT (c) 1989-1998.
6 *  On-Line Applications Research Corporation (OAR).
7 *  Copyright assigned to U.S. Government, 1994.
8 *
9 *  The license and distribution terms for this file may be
10 *  found in the file LICENSE in this distribution or at
11 *  http://www.OARcorp.com/rtems/license.html.
12 *
13 *  $Id$
14 */
15
16#include <rtems/system.h>
17#include <rtems/score/isr.h>
18#include <rtems/score/watchdog.h>
19
20/*PAGE
21 *
22 *  _Watchdog_Adjust
23 *
24 *  This routine adjusts the delta chain backward or forward in response
25 *  to a time change.
26 *
27 *  Input parameters:
28 *    header    - pointer to the delta chain to be adjusted
29 *    direction - forward or backward adjustment to delta chain
30 *    units     - units to adjust
31 *
32 *  Output parameters:
33 */
34
35void _Watchdog_Adjust(
36  Chain_Control               *header,
37  Watchdog_Adjust_directions   direction,
38  Watchdog_Interval            units
39)
40{
41  if ( !_Chain_Is_empty( header ) ) {
42    switch ( direction ) {
43      case WATCHDOG_BACKWARD:
44        _Watchdog_First( header )->delta_interval += units;
45        break;
46      case WATCHDOG_FORWARD:
47        while ( units ) {
48          if ( units < _Watchdog_First( header )->delta_interval ) {
49            _Watchdog_First( header )->delta_interval -= units;
50            break;
51          } else {
52            units -= _Watchdog_First( header )->delta_interval;
53            _Watchdog_First( header )->delta_interval = 1;
54            _Watchdog_Tickle( header );
55            if ( _Chain_Is_empty( header ) )
56              break;
57          }
58        }
59        break;
60    }
61  }
62}
63
Note: See TracBrowser for help on using the repository browser.