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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [exec/] [score/] [include/] [rtems/] [score/] [watchdog.h] - Blame information for rev 587

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

Line No. Rev Author Line
1 30 unneback
/*  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
 *  $Id: watchdog.h,v 1.2 2001-09-27 11:59:32 chris 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
typedef unsigned32 Watchdog_Interval;
32
 
33
/*
34
 *  The following types define a pointer to a watchdog service routine.
35
 */
36
 
37
typedef void Watchdog_Service_routine;
38
 
39
typedef Watchdog_Service_routine ( *Watchdog_Service_routine_entry )(
40
                 Objects_Id,
41
                 void *
42
             );
43
 
44
/*
45
 *  Constant for indefinite wait.  (actually an illegal interval)
46
 */
47
 
48
#define WATCHDOG_NO_TIMEOUT  0
49
 
50
/*
51
 *  The following enumerated type lists the states in which a
52
 *  watchdog timer may be at any given time.
53
 */
54
 
55
typedef enum {
56
  WATCHDOG_INACTIVE,       /* off all chains */
57
  WATCHDOG_BEING_INSERTED, /* off all chains, searching for insertion point */
58
  WATCHDOG_ACTIVE,         /* on chain, allowed to fire */
59
  WATCHDOG_REMOVE_IT       /* on chain, remove without firing if expires */
60
} Watchdog_States;
61
 
62
/*
63
 *  The following enumerated type details the manner in which
64
 *  a watchdog chain may be adjusted by the Watchdog_Adjust
65
 *  routine.  The direction indicates a movement FORWARD
66
 *  or BACKWARD in time.
67
 */
68
 
69
typedef enum {
70
  WATCHDOG_FORWARD,      /* adjust delta value forward */
71
  WATCHDOG_BACKWARD      /* adjust delta value backward */
72
} Watchdog_Adjust_directions;
73
 
74
/*
75
 *  The following record defines the control block used
76
 *  to manage each watchdog timer.
77
 */
78
 
79
typedef struct {
80
  Chain_Node                      Node;
81
  Watchdog_States                 state;
82
  Watchdog_Interval               initial;
83
  Watchdog_Interval               delta_interval;
84
  Watchdog_Interval               start_time;
85
  Watchdog_Interval               stop_time;
86
  Watchdog_Service_routine_entry  routine;
87
  Objects_Id                      id;
88
  void                           *user_data;
89
}   Watchdog_Control;
90
 
91
/*
92
 *  The following are used for synchronization purposes
93
 *  during an insert on a watchdog delta chain.
94
 */
95
 
96
SCORE_EXTERN volatile unsigned32  _Watchdog_Sync_level;
97
SCORE_EXTERN volatile unsigned32  _Watchdog_Sync_count;
98
 
99
/*
100
 *  The following contains the number of ticks since the
101
 *  system was booted.
102
 */
103
 
104
SCORE_EXTERN Watchdog_Interval _Watchdog_Ticks_since_boot;
105
 
106
/*
107
 *  The following defines the watchdog chains which are managed
108
 *  on ticks and second boundaries.
109
 */
110
 
111
SCORE_EXTERN Chain_Control _Watchdog_Ticks_chain;
112
SCORE_EXTERN Chain_Control _Watchdog_Seconds_chain;
113
 
114
/*
115
 *  _Watchdog_Handler_initialization
116
 *
117
 *  DESCRIPTION:
118
 *
119
 *  This routine initializes the watchdog handler.  The watchdog
120
 *  synchronization flag is initialized and the watchdog chains are
121
 *  initialized and emptied.
122
 */
123
 
124
void _Watchdog_Handler_initialization( void );
125
 
126
/*
127
 *  _Watchdog_Remove
128
 *
129
 *  DESCRIPTION:
130
 *
131
 *  This routine removes THE_WATCHDOG from the watchdog chain on which
132
 *  it resides and returns the state THE_WATCHDOG timer was in.
133
 */
134
 
135
Watchdog_States _Watchdog_Remove (
136
  Watchdog_Control *the_watchdog
137
);
138
 
139
/*
140
 *  _Watchdog_Adjust
141
 *
142
 *  DESCRIPTION:
143
 *
144
 *  This routine adjusts the HEADER watchdog chain in the forward
145
 *  or backward DIRECTION for UNITS ticks.
146
 */
147
 
148
void _Watchdog_Adjust (
149
  Chain_Control              *header,
150
  Watchdog_Adjust_directions  direction,
151
  Watchdog_Interval           units
152
);
153
 
154
/*
155
 *  _Watchdog_Insert
156
 *
157
 *  DESCRIPTION:
158
 *
159
 *  This routine inserts THE_WATCHDOG into the HEADER watchdog chain
160
 *  for a time of UNITS.  The INSERT_MODE indicates whether
161
 *  THE_WATCHDOG is to be activated automatically or later, explicitly
162
 *  by the caller.
163
 *
164
 */
165
 
166
void _Watchdog_Insert (
167
  Chain_Control         *header,
168
  Watchdog_Control      *the_watchdog
169
);
170
 
171
/*
172
 *  _Watchdog_Tickle
173
 *
174
 *  DESCRIPTION:
175
 *
176
 *  This routine is invoked at appropriate intervals to update
177
 *  the HEADER watchdog chain.
178
 */
179
 
180
void _Watchdog_Tickle (
181
  Chain_Control *header
182
);
183
 
184
#ifndef __RTEMS_APPLICATION__
185
#include <rtems/score/watchdog.inl>
186
#endif
187
 
188
#ifdef __cplusplus
189
}
190
#endif
191
 
192
#endif
193
/* end of include file */

powered by: WebSVN 2.1.0

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