source: rtems/c/src/exec/score/headers/watchdog.h @ a5f56a43

4.104.114.84.95
Last change on this file since a5f56a43 was 1a8fde6c, checked in by Joel Sherrill <joel.sherrill@…>, on 03/06/96 at 21:34:57

Removed prototyes for static inline routines and moved the comments into
the inline implementation. The impetus for this was twofold. First,
it is incorrect to have static inline prototypes when using the macro
implementation. Second, this reduced the number of lines in the include
files seen by rtems.h by about 2000 lines.

Next we restricted visibility for the inline routines to inside the
executive itself EXCEPT for a handful of objects. This reduced the
number of include files included by rtems.h by 40 files and reduced
the lines in the include files seen by rtems.h by about 6000 lines.

In total, these reduced the compile time of the entire RTEMS tree by 20%.
This results in about 8 minutes savings on the SparcStation? 10 morgana.

  • Property mode set to 100644
File size: 4.2 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, 1990, 1991, 1992, 1993, 1994.
8 *  On-Line Applications Research Corporation (OAR).
9 *  All rights assigned to U.S. Government, 1994.
10 *
11 *  This material may be reproduced by or for the U.S. Government pursuant
12 *  to the copyright license under the clause at DFARS 252.227-7013.  This
13 *  notice must appear in all copies of this file and its derivatives.
14 *
15 *  $Id$
16 */
17
18#ifndef __WATCHDOG_h
19#define __WATCHDOG_h
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
25#include <rtems/score/object.h>
26
27/*
28 *  The following type defines the control block used to manage
29 *  intervals.
30 */
31
32typedef unsigned32 Watchdog_Interval;
33
34/*
35 *  The following types define a pointer to a watchdog service routine.
36 */
37
38typedef void Watchdog_Service_routine;
39
40typedef Watchdog_Service_routine ( *Watchdog_Service_routine_entry )(
41                 Objects_Id,
42                 void *
43             );
44
45/*
46 *  Constant for indefinite wait.  (actually an illegal interval)
47 */
48
49#define WATCHDOG_NO_TIMEOUT  0
50
51/*
52 *  The following enumerated type lists the states in which a
53 *  watchdog timer may be at any given time.
54 */
55
56typedef enum {
57  WATCHDOG_INACTIVE,       /* off all chains */
58  WATCHDOG_BEING_INSERTED, /* off all chains, searching for insertion point */
59  WATCHDOG_ACTIVE,         /* on chain, allowed to fire */
60  WATCHDOG_REMOVE_IT       /* on chain, remove without firing if expires */
61} Watchdog_States;
62
63/*
64 *  The following enumerated type details the manner in which
65 *  a watchdog chain may be adjusted by the Watchdog_Adjust
66 *  routine.  The direction indicates a movement FORWARD
67 *  or BACKWARD in time.
68 */
69
70typedef enum {
71  WATCHDOG_FORWARD,      /* adjust delta value forward */
72  WATCHDOG_BACKWARD      /* adjust delta value backward */
73} Watchdog_Adjust_directions;
74
75/*
76 *  The following record defines the control block used
77 *  to manage each watchdog timer.
78 */
79
80typedef struct {
81  Chain_Node        Node;
82  Watchdog_States   state;
83  Watchdog_Interval initial;
84  Watchdog_Interval delta_interval;
85  Watchdog_Service_routine_entry  routine;
86  Objects_Id        id;
87  void             *user_data;
88}   Watchdog_Control;
89
90/*
91 *  The following are used for synchronization purposes
92 *  during an insert on a watchdog delta chain.
93 */
94
95EXTERN volatile unsigned32  _Watchdog_Sync_level;
96EXTERN volatile unsigned32  _Watchdog_Sync_count;
97
98/*
99 *  The following defines the watchdog chains which are managed
100 *  on ticks and second boundaries.
101 */
102
103EXTERN Chain_Control _Watchdog_Ticks_chain;
104EXTERN Chain_Control _Watchdog_Seconds_chain;
105
106/*
107 *  _Watchdog_Handler_initialization
108 *
109 *  DESCRIPTION:
110 *
111 *  This routine initializes the watchdog handler.  The watchdog
112 *  synchronization flag is initialized and the watchdog chains are
113 *  initialized and emptied.
114 */
115
116void _Watchdog_Handler_initialization( void );
117
118/*
119 *  _Watchdog_Remove
120 *
121 *  DESCRIPTION:
122 *
123 *  This routine removes THE_WATCHDOG from the watchdog chain on which
124 *  it resides and returns the state THE_WATCHDOG timer was in.
125 */
126
127Watchdog_States _Watchdog_Remove (
128  Watchdog_Control *the_watchdog
129);
130
131/*
132 *  _Watchdog_Adjust
133 *
134 *  DESCRIPTION:
135 *
136 *  This routine adjusts the HEADER watchdog chain in the forward
137 *  or backward DIRECTION for UNITS ticks.
138 */
139
140void _Watchdog_Adjust (
141  Chain_Control              *header,
142  Watchdog_Adjust_directions  direction,
143  Watchdog_Interval           units
144);
145
146/*
147 *  _Watchdog_Insert
148 *
149 *  DESCRIPTION:
150 *
151 *  This routine inserts THE_WATCHDOG into the HEADER watchdog chain
152 *  for a time of UNITS.  The INSERT_MODE indicates whether
153 *  THE_WATCHDOG is to be activated automatically or later, explicitly
154 *  by the caller.
155 *
156 */
157
158void _Watchdog_Insert (
159  Chain_Control         *header,
160  Watchdog_Control      *the_watchdog
161);
162
163/*
164 *  _Watchdog_Tickle
165 *
166 *  DESCRIPTION:
167 *
168 *  This routine is invoked at appropriate intervals to update
169 *  the HEADER watchdog chain.
170 */
171
172void _Watchdog_Tickle (
173  Chain_Control *header
174);
175
176#ifndef __RTEMS_APPLICATION__
177#include <rtems/score/watchdog.inl>
178#endif
179
180#ifdef __cplusplus
181}
182#endif
183
184#endif
185/* end of include file */
Note: See TracBrowser for help on using the repository browser.