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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rtems-20020807/] [cpukit/] [score/] [include/] [rtems/] [score/] [watchdog.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1026 ivang
/*  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.OARcorp.com/rtems/license.html.
13
 *
14
 *  watchdog.h,v 1.17 2002/01/29 18:18:26 joel Exp
15
 */
16
 
17
#ifndef __WATCHDOG_h
18
#define __WATCHDOG_h
19
 
20
#ifdef __cplusplus
21
extern "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
 
33
typedef unsigned32 Watchdog_Interval;
34
 
35
/*
36
 *  The following types define a pointer to a watchdog service routine.
37
 */
38
 
39
typedef void Watchdog_Service_routine;
40
 
41
typedef 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
 
57
typedef 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
 
71
typedef 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
 
81
typedef 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
 
98
SCORE_EXTERN volatile unsigned32  _Watchdog_Sync_level;
99
SCORE_EXTERN volatile unsigned32  _Watchdog_Sync_count;
100
 
101
/*
102
 *  The following contains the number of ticks since the
103
 *  system was booted.
104
 */
105
 
106
SCORE_EXTERN 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
 
113
SCORE_EXTERN Chain_Control _Watchdog_Ticks_chain;
114
SCORE_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
 
126
void _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
 
137
Watchdog_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
 
150
void _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
 
168
void _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
 
182
void _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 */

powered by: WebSVN 2.1.0

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