source: rtems/c/src/exec/score/src/watchdogadjust.c @ df49c60

4.104.114.84.95
Last change on this file since df49c60 was 08311cc3, checked in by Joel Sherrill <joel.sherrill@…>, on 11/17/99 at 17:51:34

Updated copyright notice.

  • Property mode set to 100644
File size: 1.5 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.OARcorp.com/rtems/license.html.
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_Adjust
22 *
23 *  This routine adjusts the delta chain backward or forward in response
24 *  to a time change.
25 *
26 *  Input parameters:
27 *    header    - pointer to the delta chain to be adjusted
28 *    direction - forward or backward adjustment to delta chain
29 *    units     - units to adjust
30 *
31 *  Output parameters:
32 */
33
34void _Watchdog_Adjust(
35  Chain_Control               *header,
36  Watchdog_Adjust_directions   direction,
37  Watchdog_Interval            units
38)
39{
40  if ( !_Chain_Is_empty( header ) ) {
41    switch ( direction ) {
42      case WATCHDOG_BACKWARD:
43        _Watchdog_First( header )->delta_interval += units;
44        break;
45      case WATCHDOG_FORWARD:
46        while ( units ) {
47          if ( units < _Watchdog_First( header )->delta_interval ) {
48            _Watchdog_First( header )->delta_interval -= units;
49            break;
50          } else {
51            units -= _Watchdog_First( header )->delta_interval;
52            _Watchdog_First( header )->delta_interval = 1;
53            _Watchdog_Tickle( header );
54            if ( _Chain_Is_empty( header ) )
55              break;
56          }
57        }
58        break;
59    }
60  }
61}
62
Note: See TracBrowser for help on using the repository browser.