1 | /* watchdog.inl |
---|
2 | * |
---|
3 | * This file contains the static inline implementation of all inlined |
---|
4 | * routines in the Watchdog Handler. |
---|
5 | * |
---|
6 | * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. |
---|
7 | * On-Line Applications Research Corporation (OAR). |
---|
8 | * All rights assigned to U.S. Government, 1994. |
---|
9 | * |
---|
10 | * This material may be reproduced by or for the U.S. Government pursuant |
---|
11 | * to the copyright license under the clause at DFARS 252.227-7013. This |
---|
12 | * notice must appear in all copies of this file and its derivatives. |
---|
13 | * |
---|
14 | * $Id$ |
---|
15 | */ |
---|
16 | |
---|
17 | #ifndef __WATCHDOG_inl |
---|
18 | #define __WATCHDOG_inl |
---|
19 | |
---|
20 | /*PAGE |
---|
21 | * |
---|
22 | * _Watchdog_Initialize |
---|
23 | * |
---|
24 | * DESCRIPTION: |
---|
25 | * |
---|
26 | * This routine initializes the specified watchdog. The watchdog is |
---|
27 | * made inactive, the watchdog id and handler routine are set to the |
---|
28 | * specified values. |
---|
29 | */ |
---|
30 | |
---|
31 | STATIC INLINE void _Watchdog_Initialize( |
---|
32 | Watchdog_Control *the_watchdog, |
---|
33 | Watchdog_Service_routine_entry routine, |
---|
34 | Objects_Id id, |
---|
35 | void *user_data |
---|
36 | ) |
---|
37 | { |
---|
38 | the_watchdog->state = WATCHDOG_INACTIVE; |
---|
39 | the_watchdog->routine = routine; |
---|
40 | the_watchdog->id = id; |
---|
41 | the_watchdog->user_data = user_data; |
---|
42 | } |
---|
43 | |
---|
44 | /*PAGE |
---|
45 | * |
---|
46 | * _Watchdog_Is_active |
---|
47 | * |
---|
48 | * DESCRIPTION: |
---|
49 | * |
---|
50 | * This routine returns TRUE if the watchdog timer is in the ACTIVE |
---|
51 | * state, and FALSE otherwise. |
---|
52 | */ |
---|
53 | |
---|
54 | STATIC INLINE boolean _Watchdog_Is_active( |
---|
55 | Watchdog_Control *the_watchdog |
---|
56 | ) |
---|
57 | { |
---|
58 | |
---|
59 | return ( the_watchdog->state == WATCHDOG_ACTIVE ); |
---|
60 | |
---|
61 | } |
---|
62 | |
---|
63 | /*PAGE |
---|
64 | * |
---|
65 | * _Watchdog_Activate |
---|
66 | * |
---|
67 | * DESCRIPTION: |
---|
68 | * |
---|
69 | * This routine activates THE_WATCHDOG timer which is already |
---|
70 | * on a watchdog chain. |
---|
71 | */ |
---|
72 | |
---|
73 | STATIC INLINE void _Watchdog_Activate( |
---|
74 | Watchdog_Control *the_watchdog |
---|
75 | ) |
---|
76 | { |
---|
77 | |
---|
78 | the_watchdog->state = WATCHDOG_ACTIVE; |
---|
79 | |
---|
80 | } |
---|
81 | |
---|
82 | /*PAGE |
---|
83 | * |
---|
84 | * _Watchdog_Deactivate |
---|
85 | * |
---|
86 | * DESCRIPTION: |
---|
87 | * |
---|
88 | * This routine deactivates THE_WATCHDOG timer which will remain |
---|
89 | * on a watchdog chain. |
---|
90 | */ |
---|
91 | |
---|
92 | STATIC INLINE void _Watchdog_Deactivate( |
---|
93 | Watchdog_Control *the_watchdog |
---|
94 | ) |
---|
95 | { |
---|
96 | |
---|
97 | the_watchdog->state = WATCHDOG_REMOVE_IT; |
---|
98 | |
---|
99 | } |
---|
100 | |
---|
101 | /*PAGE |
---|
102 | * |
---|
103 | * _Watchdog_Tickle_ticks |
---|
104 | * |
---|
105 | * DESCRIPTION: |
---|
106 | * |
---|
107 | * This routine is invoked at each clock tick to update the ticks |
---|
108 | * watchdog chain. |
---|
109 | */ |
---|
110 | |
---|
111 | STATIC INLINE void _Watchdog_Tickle_ticks( void ) |
---|
112 | { |
---|
113 | |
---|
114 | _Watchdog_Tickle( &_Watchdog_Ticks_chain ); |
---|
115 | |
---|
116 | } |
---|
117 | |
---|
118 | /*PAGE |
---|
119 | * |
---|
120 | * _Watchdog_Tickle_seconds |
---|
121 | * |
---|
122 | * DESCRIPTION: |
---|
123 | * |
---|
124 | * This routine is invoked at each clock tick to update the seconds |
---|
125 | * watchdog chain. |
---|
126 | */ |
---|
127 | |
---|
128 | STATIC INLINE void _Watchdog_Tickle_seconds( void ) |
---|
129 | { |
---|
130 | |
---|
131 | _Watchdog_Tickle( &_Watchdog_Seconds_chain ); |
---|
132 | |
---|
133 | } |
---|
134 | |
---|
135 | /*PAGE |
---|
136 | * |
---|
137 | * _Watchdog_Insert_ticks |
---|
138 | * |
---|
139 | * DESCRIPTION: |
---|
140 | * |
---|
141 | * This routine inserts THE_WATCHDOG into the ticks watchdog chain |
---|
142 | * for a time of UNITS ticks. The INSERT_MODE indicates whether |
---|
143 | * THE_WATCHDOG is to be activated automatically or later, explicitly |
---|
144 | * by the caller. |
---|
145 | */ |
---|
146 | |
---|
147 | STATIC INLINE void _Watchdog_Insert_ticks( |
---|
148 | Watchdog_Control *the_watchdog, |
---|
149 | Watchdog_Interval units |
---|
150 | ) |
---|
151 | { |
---|
152 | |
---|
153 | the_watchdog->initial = units; |
---|
154 | |
---|
155 | _Watchdog_Insert( &_Watchdog_Ticks_chain, the_watchdog ); |
---|
156 | |
---|
157 | } |
---|
158 | |
---|
159 | /*PAGE |
---|
160 | * |
---|
161 | * _Watchdog_Insert_seconds |
---|
162 | * |
---|
163 | * DESCRIPTION: |
---|
164 | * |
---|
165 | * This routine inserts THE_WATCHDOG into the seconds watchdog chain |
---|
166 | * for a time of UNITS seconds. The INSERT_MODE indicates whether |
---|
167 | * THE_WATCHDOG is to be activated automatically or later, explicitly |
---|
168 | * by the caller. |
---|
169 | */ |
---|
170 | |
---|
171 | STATIC INLINE void _Watchdog_Insert_seconds( |
---|
172 | Watchdog_Control *the_watchdog, |
---|
173 | Watchdog_Interval units |
---|
174 | ) |
---|
175 | { |
---|
176 | |
---|
177 | the_watchdog->initial = units; |
---|
178 | |
---|
179 | _Watchdog_Insert( &_Watchdog_Seconds_chain, the_watchdog ); |
---|
180 | |
---|
181 | } |
---|
182 | |
---|
183 | /*PAGE |
---|
184 | * |
---|
185 | * _Watchdog_Adjust_seconds |
---|
186 | * |
---|
187 | * DESCRIPTION: |
---|
188 | * |
---|
189 | * This routine adjusts the seconds watchdog chain in the forward |
---|
190 | * or backward DIRECTION for UNITS seconds. This is invoked when the |
---|
191 | * current time of day is changed. |
---|
192 | */ |
---|
193 | |
---|
194 | STATIC INLINE void _Watchdog_Adjust_seconds( |
---|
195 | Watchdog_Adjust_directions direction, |
---|
196 | Watchdog_Interval units |
---|
197 | ) |
---|
198 | { |
---|
199 | |
---|
200 | _Watchdog_Adjust( &_Watchdog_Seconds_chain, direction, units ); |
---|
201 | |
---|
202 | } |
---|
203 | |
---|
204 | /*PAGE |
---|
205 | * |
---|
206 | * _Watchdog_Adjust_ticks |
---|
207 | * |
---|
208 | * DESCRIPTION: |
---|
209 | * |
---|
210 | * This routine adjusts the ticks watchdog chain in the forward |
---|
211 | * or backward DIRECTION for UNITS ticks. |
---|
212 | */ |
---|
213 | |
---|
214 | STATIC INLINE void _Watchdog_Adjust_ticks( |
---|
215 | Watchdog_Adjust_directions direction, |
---|
216 | Watchdog_Interval units |
---|
217 | ) |
---|
218 | { |
---|
219 | |
---|
220 | _Watchdog_Adjust( &_Watchdog_Ticks_chain, direction, units ); |
---|
221 | |
---|
222 | } |
---|
223 | |
---|
224 | /*PAGE |
---|
225 | * |
---|
226 | * _Watchdog_Reset |
---|
227 | * |
---|
228 | * DESCRIPTION: |
---|
229 | * |
---|
230 | * This routine resets THE_WATCHDOG timer to its state at INSERT |
---|
231 | * time. This routine is valid only on interval watchdog timers |
---|
232 | * and is used to make an interval watchdog timer fire "every" so |
---|
233 | * many ticks. |
---|
234 | */ |
---|
235 | |
---|
236 | STATIC INLINE void _Watchdog_Reset( |
---|
237 | Watchdog_Control *the_watchdog |
---|
238 | ) |
---|
239 | { |
---|
240 | |
---|
241 | (void) _Watchdog_Remove( the_watchdog ); |
---|
242 | |
---|
243 | _Watchdog_Insert( &_Watchdog_Ticks_chain, the_watchdog ); |
---|
244 | |
---|
245 | } |
---|
246 | |
---|
247 | /*PAGE |
---|
248 | * |
---|
249 | * _Watchdog_Next |
---|
250 | * |
---|
251 | * DESCRIPTION: |
---|
252 | * |
---|
253 | * This routine returns a pointer to the watchdog timer following |
---|
254 | * THE_WATCHDOG on the watchdog chain. |
---|
255 | */ |
---|
256 | |
---|
257 | STATIC INLINE Watchdog_Control *_Watchdog_Next( |
---|
258 | Watchdog_Control *the_watchdog |
---|
259 | ) |
---|
260 | { |
---|
261 | |
---|
262 | return ( (Watchdog_Control *) the_watchdog->Node.next ); |
---|
263 | |
---|
264 | } |
---|
265 | |
---|
266 | /*PAGE |
---|
267 | * |
---|
268 | * _Watchdog_Previous |
---|
269 | * |
---|
270 | * DESCRIPTION: |
---|
271 | * |
---|
272 | * This routine returns a pointer to the watchdog timer preceding |
---|
273 | * THE_WATCHDOG on the watchdog chain. |
---|
274 | */ |
---|
275 | |
---|
276 | STATIC INLINE Watchdog_Control *_Watchdog_Previous( |
---|
277 | Watchdog_Control *the_watchdog |
---|
278 | ) |
---|
279 | { |
---|
280 | |
---|
281 | return ( (Watchdog_Control *) the_watchdog->Node.previous ); |
---|
282 | |
---|
283 | } |
---|
284 | |
---|
285 | /*PAGE |
---|
286 | * |
---|
287 | * _Watchdog_First |
---|
288 | * |
---|
289 | * DESCRIPTION: |
---|
290 | * |
---|
291 | * This routine returns a pointer to the first watchdog timer |
---|
292 | * on the watchdog chain HEADER. |
---|
293 | */ |
---|
294 | |
---|
295 | STATIC INLINE Watchdog_Control *_Watchdog_First( |
---|
296 | Chain_Control *header |
---|
297 | ) |
---|
298 | { |
---|
299 | |
---|
300 | return ( (Watchdog_Control *) header->first ); |
---|
301 | |
---|
302 | } |
---|
303 | |
---|
304 | /*PAGE |
---|
305 | * |
---|
306 | * _Watchdog_Last |
---|
307 | * |
---|
308 | * DESCRIPTION: |
---|
309 | * |
---|
310 | * This routine returns a pointer to the last watchdog timer |
---|
311 | * on the watchdog chain HEADER. |
---|
312 | */ |
---|
313 | |
---|
314 | STATIC INLINE Watchdog_Control *_Watchdog_Last( |
---|
315 | Chain_Control *header |
---|
316 | ) |
---|
317 | { |
---|
318 | |
---|
319 | return ( (Watchdog_Control *) header->last ); |
---|
320 | |
---|
321 | } |
---|
322 | |
---|
323 | #endif |
---|
324 | /* end of include file */ |
---|