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