source: rtems/cpukit/score/src/watchdogadjust.c @ a6eef8b

Last change on this file since a6eef8b was a6eef8b, checked in by Joel Sherrill <joel.sherrill@…>, on 09/04/03 at 18:52:48

2003-09-04 Joel Sherrill <joel@…>

  • apiext.c, chain.c, coremsg.c, coremsgbroadcast.c, coremsgclose.c, coremsgflush.c, coremsgflushsupp.c, coremsgflushwait.c, coremsginsert.c, coremsgseize.c, coremsgsubmit.c, coremutex.c, coremutexflush.c, coremutexseize.c, coremutexsurrender.c, coresem.c, coresemflush.c, coresemseize.c, coresemsurrender.c, coretod.c, coretodset.c, coretodtickle.c, coretodtoseconds.c, coretodvalidate.c, heap.c, heapallocate.c, heapextend.c, heapfree.c, heapgetinfo.c, heapsizeofuserarea.c, heapwalk.c, interr.c, isr.c, mpci.c, object.c, objectallocate.c, objectallocatebyindex.c, objectclearname.c, objectcomparenameraw.c, objectcomparenamestring.c, objectcopynameraw.c, objectcopynamestring.c, objectextendinformation.c, objectfree.c, objectget.c, objectgetbyindex.c, objectgetisr.c, objectgetnext.c, objectgetnoprotection.c, objectinitializeinformation.c, objectmp.c, objectnametoid.c, objectshrinkinformation.c, thread.c, threadchangepriority.c, threadclearstate.c, threadclose.c, threadcreateidle.c, threaddelayended.c, threaddispatch.c, threadevaluatemode.c, threadget.c, threadhandler.c, threadidlebody.c, threadinitialize.c, threadloadenv.c, threadmp.c, threadq.c, threadqdequeue.c, threadqdequeuefifo.c, threadqdequeuepriority.c, threadqenqueue.c, threadqenqueuefifo.c, threadqenqueuepriority.c, threadqextract.c, threadqextractfifo.c, threadqextractpriority.c, threadqextractwithproxy.c, threadqfirst.c, threadqfirstfifo.c, threadqfirstpriority.c, threadqflush.c, threadqtimeout.c, threadready.c, threadreset.c, threadresettimeslice.c, threadrestart.c, threadresume.c, threadrotatequeue.c, threadsetpriority.c, threadsetstate.c, threadsettransient.c, threadstackallocate.c, threadstackfree.c, threadstart.c, threadstartmultitasking.c, threadsuspend.c, threadtickletimeslice.c, threadyieldprocessor.c, userext.c, watchdog.c, watchdogadjust.c, watchdoginsert.c, watchdogremove.c, watchdogtickle.c, wkspace.c: URL for license changed.
  • Property mode set to 100644
File size: 2.0 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_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  ISR_Level level;
41
42  _ISR_Disable( level );
43
44  /*
45   * NOTE: It is safe NOT to make 'header' a pointer
46   *       to volatile data (contrast this with watchdoginsert.c)
47   *       because we call _Watchdog_Tickle() below and
48   *       hence the compiler must not assume *header to remain
49   *       unmodified across that call.
50   *
51   *       Till Straumann, 7/2003
52   */
53  if ( !_Chain_Is_empty( header ) ) {
54    switch ( direction ) {
55      case WATCHDOG_BACKWARD:
56        _Watchdog_First( header )->delta_interval += units;
57        break;
58      case WATCHDOG_FORWARD:
59        while ( units ) {
60          if ( units < _Watchdog_First( header )->delta_interval ) {
61            _Watchdog_First( header )->delta_interval -= units;
62            break;
63          } else {
64            units -= _Watchdog_First( header )->delta_interval;
65            _Watchdog_First( header )->delta_interval = 1;
66
67                        _ISR_Enable( level );
68
69            _Watchdog_Tickle( header );
70
71                        _ISR_Disable( level );
72
73            if ( _Chain_Is_empty( header ) )
74              break;
75          }
76        }
77        break;
78    }
79  }
80
81  _ISR_Enable( level );
82
83}
84
Note: See TracBrowser for help on using the repository browser.