source: rtems/cpukit/score/include/rtems/score/watchdog.h @ c39b35f

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

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

  • include/rtems/bspIo.h, include/rtems/fs.h, include/rtems/userenv.h, score/include/rtems/debug.h, score/include/rtems/seterr.h, score/include/rtems/system.h, score/include/rtems/score/address.h, score/include/rtems/score/apiext.h, score/include/rtems/score/apimutex.h, score/include/rtems/score/bitfield.h, score/include/rtems/score/chain.h, score/include/rtems/score/context.h, score/include/rtems/score/copyrt.h, score/include/rtems/score/coremsg.h, score/include/rtems/score/coremutex.h, score/include/rtems/score/coresem.h, score/include/rtems/score/heap.h, score/include/rtems/score/interr.h, score/include/rtems/score/isr.h, score/include/rtems/score/mpci.h, score/include/rtems/score/mppkt.h, score/include/rtems/score/object.h, score/include/rtems/score/objectmp.h, score/include/rtems/score/priority.h, score/include/rtems/score/stack.h, score/include/rtems/score/states.h, score/include/rtems/score/sysstate.h, score/include/rtems/score/thread.h, score/include/rtems/score/threadmp.h, score/include/rtems/score/threadq.h, score/include/rtems/score/tod.h, score/include/rtems/score/tqdata.h, score/include/rtems/score/userext.h, score/include/rtems/score/watchdog.h, score/include/rtems/score/wkspace.h, score/inline/rtems/score/address.inl, score/inline/rtems/score/chain.inl, score/inline/rtems/score/coremsg.inl, score/inline/rtems/score/coremutex.inl, score/inline/rtems/score/coresem.inl, score/inline/rtems/score/heap.inl, score/inline/rtems/score/isr.inl, score/inline/rtems/score/mppkt.inl, score/inline/rtems/score/object.inl, score/inline/rtems/score/objectmp.inl, score/inline/rtems/score/priority.inl, score/inline/rtems/score/stack.inl, score/inline/rtems/score/states.inl, score/inline/rtems/score/sysstate.inl, score/inline/rtems/score/thread.inl, score/inline/rtems/score/threadmp.inl, score/inline/rtems/score/tod.inl, score/inline/rtems/score/tqdata.inl, score/inline/rtems/score/userext.inl, score/inline/rtems/score/watchdog.inl, score/inline/rtems/score/wkspace.inl, score/macros/rtems/score/address.inl, score/macros/rtems/score/chain.inl, score/macros/rtems/score/coremsg.inl, score/macros/rtems/score/coremutex.inl, score/macros/rtems/score/coresem.inl, score/macros/rtems/score/heap.inl, score/macros/rtems/score/isr.inl, score/macros/rtems/score/mppkt.inl, score/macros/rtems/score/object.inl, score/macros/rtems/score/objectmp.inl, score/macros/rtems/score/priority.inl, score/macros/rtems/score/stack.inl, score/macros/rtems/score/states.inl, score/macros/rtems/score/sysstate.inl, score/macros/rtems/score/thread.inl, score/macros/rtems/score/threadmp.inl, score/macros/rtems/score/tod.inl, score/macros/rtems/score/tqdata.inl, score/macros/rtems/score/userext.inl, score/macros/rtems/score/watchdog.inl, score/macros/rtems/score/wkspace.inl: URL for license changed.
  • Property mode set to 100644
File size: 4.5 KB
Line 
1/*  watchdog.h
2 *
3 *  This include file contains all the constants and structures associated
4 *  with watchdog timers.   This Handler provides mechanisms which can be
5 *   used to initialize and manipulate watchdog timers.
6 *
7 *  COPYRIGHT (c) 1989-1999.
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#ifndef __WATCHDOG_h
18#define __WATCHDOG_h
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
24#include <rtems/score/object.h>
25
26/*
27 *  The following type defines the control block used to manage
28 *  intervals.
29 */
30
31#define WATCHDOG_MAXIMUM_INTERVAL ((Watchdog_Interval) 0xffffffff)
32
33typedef unsigned32 Watchdog_Interval;
34
35/*
36 *  The following types define a pointer to a watchdog service routine.
37 */
38
39typedef void Watchdog_Service_routine;
40
41typedef Watchdog_Service_routine ( *Watchdog_Service_routine_entry )(
42                 Objects_Id,
43                 void *
44             );
45
46/*
47 *  Constant for indefinite wait.  (actually an illegal interval)
48 */
49
50#define WATCHDOG_NO_TIMEOUT  0
51
52/*
53 *  The following enumerated type lists the states in which a
54 *  watchdog timer may be at any given time.
55 */
56
57typedef enum {
58  WATCHDOG_INACTIVE,       /* off all chains */
59  WATCHDOG_BEING_INSERTED, /* off all chains, searching for insertion point */
60  WATCHDOG_ACTIVE,         /* on chain, allowed to fire */
61  WATCHDOG_REMOVE_IT       /* on chain, remove without firing if expires */
62} Watchdog_States;
63
64/*
65 *  The following enumerated type details the manner in which
66 *  a watchdog chain may be adjusted by the Watchdog_Adjust
67 *  routine.  The direction indicates a movement FORWARD
68 *  or BACKWARD in time.
69 */
70
71typedef enum {
72  WATCHDOG_FORWARD,      /* adjust delta value forward */
73  WATCHDOG_BACKWARD      /* adjust delta value backward */
74} Watchdog_Adjust_directions;
75
76/*
77 *  The following record defines the control block used
78 *  to manage each watchdog timer.
79 */
80
81typedef struct {
82  Chain_Node                      Node;
83  Watchdog_States                 state;
84  Watchdog_Interval               initial;
85  Watchdog_Interval               delta_interval;
86  Watchdog_Interval               start_time;
87  Watchdog_Interval               stop_time;
88  Watchdog_Service_routine_entry  routine;
89  Objects_Id                      id;
90  void                           *user_data;
91}   Watchdog_Control;
92
93/*
94 *  The following are used for synchronization purposes
95 *  during an insert on a watchdog delta chain.
96 */
97
98SCORE_EXTERN volatile unsigned32  _Watchdog_Sync_level;
99SCORE_EXTERN volatile unsigned32  _Watchdog_Sync_count;
100
101/*
102 *  The following contains the number of ticks since the
103 *  system was booted.
104 */
105
106SCORE_EXTERN volatile Watchdog_Interval _Watchdog_Ticks_since_boot;
107
108/*
109 *  The following defines the watchdog chains which are managed
110 *  on ticks and second boundaries.
111 */
112
113SCORE_EXTERN Chain_Control _Watchdog_Ticks_chain;
114SCORE_EXTERN Chain_Control _Watchdog_Seconds_chain;
115
116/*
117 *  _Watchdog_Handler_initialization
118 *
119 *  DESCRIPTION:
120 *
121 *  This routine initializes the watchdog handler.  The watchdog
122 *  synchronization flag is initialized and the watchdog chains are
123 *  initialized and emptied.
124 */
125
126void _Watchdog_Handler_initialization( void );
127
128/*
129 *  _Watchdog_Remove
130 *
131 *  DESCRIPTION:
132 *
133 *  This routine removes THE_WATCHDOG from the watchdog chain on which
134 *  it resides and returns the state THE_WATCHDOG timer was in.
135 */
136
137Watchdog_States _Watchdog_Remove (
138  Watchdog_Control *the_watchdog
139);
140
141/*
142 *  _Watchdog_Adjust
143 *
144 *  DESCRIPTION:
145 *
146 *  This routine adjusts the HEADER watchdog chain in the forward
147 *  or backward DIRECTION for UNITS ticks.
148 */
149
150void _Watchdog_Adjust (
151  Chain_Control              *header,
152  Watchdog_Adjust_directions  direction,
153  Watchdog_Interval           units
154);
155
156/*
157 *  _Watchdog_Insert
158 *
159 *  DESCRIPTION:
160 *
161 *  This routine inserts THE_WATCHDOG into the HEADER watchdog chain
162 *  for a time of UNITS.  The INSERT_MODE indicates whether
163 *  THE_WATCHDOG is to be activated automatically or later, explicitly
164 *  by the caller.
165 *
166 */
167
168void _Watchdog_Insert (
169  Chain_Control         *header,
170  Watchdog_Control      *the_watchdog
171);
172
173/*
174 *  _Watchdog_Tickle
175 *
176 *  DESCRIPTION:
177 *
178 *  This routine is invoked at appropriate intervals to update
179 *  the HEADER watchdog chain.
180 */
181
182void _Watchdog_Tickle (
183  Chain_Control *header
184);
185
186#ifndef __RTEMS_APPLICATION__
187#include <rtems/score/watchdog.inl>
188#endif
189
190#ifdef __cplusplus
191}
192#endif
193
194#endif
195/* end of include file */
Note: See TracBrowser for help on using the repository browser.