1 | /* watchdog.inl |
---|
2 | * |
---|
3 | * This file contains the macro implementation of all inlined routines |
---|
4 | * 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 | * $Id$ |
---|
14 | */ |
---|
15 | |
---|
16 | #ifndef __WATCHDOG_inl |
---|
17 | #define __WATCHDOG_inl |
---|
18 | |
---|
19 | #include <rtems/score/object.h> |
---|
20 | |
---|
21 | /*PAGE |
---|
22 | * |
---|
23 | * _Watchdog_Initialize |
---|
24 | * |
---|
25 | */ |
---|
26 | |
---|
27 | #define _Watchdog_Initialize( _the_watchdog, _routine, _id, _user_data ) \ |
---|
28 | { \ |
---|
29 | (_the_watchdog)->state = WATCHDOG_INACTIVE; \ |
---|
30 | (_the_watchdog)->routine = (_routine); \ |
---|
31 | (_the_watchdog)->id = (_id); \ |
---|
32 | (_the_watchdog)->user_data = (_user_data); \ |
---|
33 | } |
---|
34 | |
---|
35 | /*PAGE |
---|
36 | * |
---|
37 | * _Watchdog_Is_active |
---|
38 | * |
---|
39 | */ |
---|
40 | |
---|
41 | #define _Watchdog_Is_active( _the_watchdog ) \ |
---|
42 | ( (_the_watchdog)->state == WATCHDOG_ACTIVE ) |
---|
43 | |
---|
44 | /*PAGE |
---|
45 | * |
---|
46 | * _Watchdog_Activate |
---|
47 | * |
---|
48 | */ |
---|
49 | |
---|
50 | #define _Watchdog_Activate( _the_watchdog ) \ |
---|
51 | (_the_watchdog)->state = WATCHDOG_ACTIVE |
---|
52 | |
---|
53 | /*PAGE |
---|
54 | * |
---|
55 | * _Watchdog_Deactivate |
---|
56 | * |
---|
57 | */ |
---|
58 | |
---|
59 | #define _Watchdog_Deactivate( _the_watchdog ) \ |
---|
60 | (_the_watchdog)->state = WATCHDOG_REMOVE_IT |
---|
61 | |
---|
62 | /*PAGE |
---|
63 | * |
---|
64 | * _Watchdog_Tickle_ticks |
---|
65 | * |
---|
66 | */ |
---|
67 | |
---|
68 | #define _Watchdog_Tickle_ticks() \ |
---|
69 | _Watchdog_Tickle( &_Watchdog_Ticks_chain ) |
---|
70 | |
---|
71 | /*PAGE |
---|
72 | * |
---|
73 | * _Watchdog_Tickle_seconds |
---|
74 | * |
---|
75 | */ |
---|
76 | |
---|
77 | #define _Watchdog_Tickle_seconds() \ |
---|
78 | _Watchdog_Tickle( &_Watchdog_Seconds_chain ) |
---|
79 | |
---|
80 | /*PAGE |
---|
81 | * |
---|
82 | * _Watchdog_Insert_ticks |
---|
83 | * |
---|
84 | */ |
---|
85 | |
---|
86 | #define _Watchdog_Insert_ticks( _the_watchdog, _units ) \ |
---|
87 | do { \ |
---|
88 | (_the_watchdog)->initial = (_units); \ |
---|
89 | _Watchdog_Insert( &_Watchdog_Ticks_chain, (_the_watchdog) ); \ |
---|
90 | } while ( 0 ) |
---|
91 | |
---|
92 | /*PAGE |
---|
93 | * |
---|
94 | * _Watchdog_Insert_seconds |
---|
95 | * |
---|
96 | */ |
---|
97 | |
---|
98 | #define _Watchdog_Insert_seconds( _the_watchdog, _units ) \ |
---|
99 | do { \ |
---|
100 | (_the_watchdog)->initial = (_units); \ |
---|
101 | _Watchdog_Insert( &_Watchdog_Seconds_chain, (_the_watchdog) ); \ |
---|
102 | } while ( 0 ) |
---|
103 | |
---|
104 | /*PAGE |
---|
105 | * |
---|
106 | * _Watchdog_Adjust_seconds |
---|
107 | * |
---|
108 | */ |
---|
109 | |
---|
110 | #define _Watchdog_Adjust_seconds( _direction, _units ) \ |
---|
111 | _Watchdog_Adjust( &_Watchdog_Seconds_chain, (_direction), (_units) ) |
---|
112 | |
---|
113 | /*PAGE |
---|
114 | * |
---|
115 | * _Watchdog_Adjust_ticks |
---|
116 | * |
---|
117 | */ |
---|
118 | |
---|
119 | #define _Watchdog_Adjust_ticks( _direction, _units ) \ |
---|
120 | _Watchdog_Adjust( &_Watchdog_Ticks_chain, (_direction), (_units) ) |
---|
121 | |
---|
122 | /*PAGE |
---|
123 | * |
---|
124 | * _Watchdog_Reset |
---|
125 | * |
---|
126 | */ |
---|
127 | |
---|
128 | #define _Watchdog_Reset( _the_watchdog ) \ |
---|
129 | { \ |
---|
130 | (void) _Watchdog_Remove( (_the_watchdog) ); \ |
---|
131 | _Watchdog_Insert( &_Watchdog_Ticks_chain, (_the_watchdog) ); \ |
---|
132 | } |
---|
133 | |
---|
134 | /*PAGE |
---|
135 | * |
---|
136 | * _Watchdog_Next |
---|
137 | * |
---|
138 | */ |
---|
139 | |
---|
140 | #define _Watchdog_Next( _watchdog ) \ |
---|
141 | ((Watchdog_Control *) (_watchdog)->Node.next) |
---|
142 | |
---|
143 | /*PAGE |
---|
144 | * |
---|
145 | * _Watchdog_Previous |
---|
146 | * |
---|
147 | */ |
---|
148 | |
---|
149 | #define _Watchdog_Previous( _watchdog ) \ |
---|
150 | ((Watchdog_Control *) (_watchdog)->Node.previous) |
---|
151 | |
---|
152 | /*PAGE |
---|
153 | * |
---|
154 | * _Watchdog_First |
---|
155 | * |
---|
156 | */ |
---|
157 | |
---|
158 | #define _Watchdog_First( _header ) \ |
---|
159 | ((Watchdog_Control *) (_header)->first) |
---|
160 | |
---|
161 | /*PAGE |
---|
162 | * |
---|
163 | * _Watchdog_Last |
---|
164 | * |
---|
165 | */ |
---|
166 | |
---|
167 | #define _Watchdog_Last( _header ) \ |
---|
168 | ((Watchdog_Control *) (_header)->last) |
---|
169 | |
---|
170 | #endif |
---|
171 | /* end of include file */ |
---|