source: rtems/cpukit/score/src/watchdogadjusttochain.c @ 37ac61f0

4.9
Last change on this file since 37ac61f0 was 37ac61f0, checked in by Joel Sherrill <joel.sherrill@…>, on 12/03/08 at 21:01:09

2008-12-03 Joel Sherrill <joel.sherrill@…>

PR 1347/cpukit

  • rtems/include/rtems/rtems/timer.h, rtems/src/rtemstimer.c, rtems/src/timerreset.c, rtems/src/timerserver.c, rtems/src/timerserverfireafter.c, rtems/src/timerserverfirewhen.c, score/Makefile.am, score/include/rtems/score/watchdog.h: Rework Timer Server to ensure that the context allows for blocking, allocating memory, and acquiring semaphores and mutexes.
  • score/src/watchdogadjusttochain.c: New file.
  • Property mode set to 100644
File size: 1.4 KB
Line 
1/**
2 *  @file watchdogadjusttochain.c
3 *
4 *  This is used by the Timer Server task.
5 */
6
7/*  COPYRIGHT (c) 1989-2008.
8 *  On-Line Applications Research Corporation (OAR).
9 *
10 *  The license and distribution terms for this file may be
11 *  found in the file LICENSE in this distribution or at
12 *  http://www.rtems.com/license/LICENSE.
13 *
14 *  $Id$
15 */
16
17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <rtems/system.h>
22#include <rtems/score/isr.h>
23#include <rtems/score/watchdog.h>
24
25void _Watchdog_Adjust_to_chain(
26  Chain_Control               *header,
27  Watchdog_Interval            units_arg,
28  Chain_Control               *to_fire
29
30)
31{
32  Watchdog_Interval  units = units_arg;
33  ISR_Level          level;
34  Chain_Node        *node;
35
36  if ( !units ) {
37    return;
38  }
39  _ISR_Disable( level );
40
41  if ( !_Chain_Is_empty( header ) ) {
42    while ( units ) {
43      if ( units < _Watchdog_First( header )->delta_interval ) {
44        _Watchdog_First( header )->delta_interval -= units;
45        break;
46      } else {
47        units -= _Watchdog_First( header )->delta_interval;
48        _Watchdog_First( header )->delta_interval = 0;
49
50        do {
51          node = _Chain_Get_unprotected( header );
52          _Chain_Append_unprotected( to_fire, node );
53
54          _ISR_Flash( level );
55
56        } while ( !_Chain_Is_empty( header ) &&
57                  _Watchdog_First( header )->delta_interval == 0 );
58
59        if ( _Chain_Is_empty( header ) )
60          break;
61      }
62    }
63
64  }
65  _ISR_Enable( level );
66}
67
Note: See TracBrowser for help on using the repository browser.