OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rtems-20020807/] [cpukit/] [score/] [src/] [watchdogadjust.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1026 ivang
/*
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
 *  watchdogadjust.c,v 1.2 1999/11/17 17:50:43 joel Exp
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
 
34
void _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
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.