OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rtems-20020807/] [cpukit/] [score/] [inline/] [rtems/] [score/] [watchdog.inl] - Blame information for rev 1774

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.