1 | /* chain.h |
---|
2 | * |
---|
3 | * This include file contains all the constants and structures associated |
---|
4 | * with doubly linked chains. This file actually just provides an |
---|
5 | * interface to the chain object in rtems. |
---|
6 | * |
---|
7 | * COPYRIGHT (c) 1989-1997. |
---|
8 | * On-Line Applications Research Corporation (OAR). |
---|
9 | * Copyright assigned to U.S. Government, 1994. |
---|
10 | * |
---|
11 | * The license and distribution terms for this file may in |
---|
12 | * the file LICENSE in this distribution or at |
---|
13 | * http://www.OARcorp.com/rtems/license.html. |
---|
14 | * |
---|
15 | * $ld: |
---|
16 | */ |
---|
17 | |
---|
18 | #ifndef __CHAIN_h |
---|
19 | #define __CHAIN_h |
---|
20 | |
---|
21 | #include <rtems.h> |
---|
22 | |
---|
23 | /* |
---|
24 | * Chain_Initialize |
---|
25 | * |
---|
26 | * This routine initializes the_chain structure to manage the |
---|
27 | * contiguous array of number_nodes nodes which starts at |
---|
28 | * starting_address. Each node is of node_size bytes. |
---|
29 | * |
---|
30 | * Chain_Control *the_chain, * IN * |
---|
31 | * void *starting_address, * IN * |
---|
32 | * rtems_unsigned32 number_nodes, * IN * |
---|
33 | * rtems_unsigned32 node_size * IN * |
---|
34 | */ |
---|
35 | |
---|
36 | #define Chain_Initialize( the_chain, starting_address, \ |
---|
37 | number_nodes, node_size ) \ |
---|
38 | _Chain_Initialize( the_chain, starting_address, \ |
---|
39 | number_nodes, node_size ) \ |
---|
40 | |
---|
41 | |
---|
42 | /* |
---|
43 | * Chain_Initialize_empty |
---|
44 | * |
---|
45 | * This routine initializes the specified chain to contain zero nodes. |
---|
46 | * |
---|
47 | * Chain_Control *the_chain * IN * |
---|
48 | */ |
---|
49 | |
---|
50 | #define Chain_Initialize_empty( the_chain ) \ |
---|
51 | _Chain_Initialize_empty( the_chain ) |
---|
52 | |
---|
53 | |
---|
54 | /* |
---|
55 | * Chain_Are_nodes_equal |
---|
56 | * |
---|
57 | * This function returns TRUE if LEFT and RIGHT are equal, |
---|
58 | * and FALSE otherwise. |
---|
59 | * |
---|
60 | * Chain_Node *left, * IN * |
---|
61 | * Chain_Node *right * IN * |
---|
62 | */ |
---|
63 | |
---|
64 | #define Chain_Are_nodes_equal( left, right ) \ |
---|
65 | _Chain_Are_nodes_equal( left, right ) |
---|
66 | |
---|
67 | |
---|
68 | /* |
---|
69 | * Chain_Extract_unprotected |
---|
70 | * |
---|
71 | * This routine extracts the_node from the chain on which it resides. |
---|
72 | * It does NOT disable interrupts to insure the atomicity of the |
---|
73 | * extract operation. |
---|
74 | * |
---|
75 | * Chain_Node *the_node * IN * |
---|
76 | */ |
---|
77 | |
---|
78 | #define Chain_Extract_unprotected( the_node ) \ |
---|
79 | _Chain_Extract_unprotected( the_node ) |
---|
80 | |
---|
81 | |
---|
82 | /* |
---|
83 | * Chain_Extract |
---|
84 | * |
---|
85 | * This routine extracts the_node from the chain on which it resides. |
---|
86 | * It disables interrupts to insure the atomicity of the |
---|
87 | * extract operation. |
---|
88 | * |
---|
89 | * Chain_Node *the_node * IN * |
---|
90 | */ |
---|
91 | |
---|
92 | #define Chain_Extract( the_node ) \ |
---|
93 | _Chain_Extract( the_node ) |
---|
94 | |
---|
95 | |
---|
96 | /* |
---|
97 | * Chain_Get_unprotected |
---|
98 | * |
---|
99 | * This function removes the first node from the_chain and returns |
---|
100 | * a pointer to that node. If the_chain is empty, then NULL is returned. |
---|
101 | * It does NOT disable interrupts to insure the atomicity of the |
---|
102 | * get operation. |
---|
103 | * |
---|
104 | * Chain_Control *the_chain * IN * |
---|
105 | */ |
---|
106 | |
---|
107 | #define Chain_Get_unprotected( the_chain ) \ |
---|
108 | _Chain_Get_unprotected( the_chain ) |
---|
109 | |
---|
110 | |
---|
111 | /* |
---|
112 | * Chain_Get |
---|
113 | * |
---|
114 | * This function removes the first node from the_chain and returns |
---|
115 | * a pointer to that node. If the_chain is empty, then NULL is returned. |
---|
116 | * It disables interrupts to insure the atomicity of the |
---|
117 | * get operation. |
---|
118 | * |
---|
119 | * Chain_Control *the_chain * IN * |
---|
120 | */ |
---|
121 | |
---|
122 | #define Chain_Get( the_chain ) \ |
---|
123 | _Chain_Get( the_chain ) |
---|
124 | |
---|
125 | |
---|
126 | /* |
---|
127 | * Chain_Get_first_unprotected |
---|
128 | * |
---|
129 | * This function removes the first node from the_chain and returns |
---|
130 | * a pointer to that node. It does NOT disable interrupts to insure |
---|
131 | * the atomicity of the get operation. |
---|
132 | * |
---|
133 | * Chain_Control *the_chain * IN * |
---|
134 | */ |
---|
135 | |
---|
136 | #define Chain_Get_first_unprotected( the_chain ) \ |
---|
137 | _Chain_Get_first_unprotected( the_chain ) |
---|
138 | |
---|
139 | |
---|
140 | /* |
---|
141 | * Chain_Insert_unprotected |
---|
142 | * |
---|
143 | * This routine inserts the_node on a chain immediately following |
---|
144 | * after_node. It does NOT disable interrupts to insure the atomicity |
---|
145 | * of the extract operation. |
---|
146 | * |
---|
147 | * Chain_Node *after_node, * IN * |
---|
148 | * Chain_Node *the_node * IN * |
---|
149 | */ |
---|
150 | |
---|
151 | #define Chain_Insert_unprotected( after_node, the_node ) \ |
---|
152 | _Chain_Insert_unprotected( after_node, the_node ) |
---|
153 | |
---|
154 | |
---|
155 | /* |
---|
156 | * Chain_Insert |
---|
157 | * |
---|
158 | * This routine inserts the_node on a chain immediately following |
---|
159 | * after_node. It disables interrupts to insure the atomicity |
---|
160 | * of the extract operation. |
---|
161 | * |
---|
162 | * Chain_Node *after_node, * IN * |
---|
163 | * Chain_Node *the_node * IN * |
---|
164 | */ |
---|
165 | |
---|
166 | #define Chain_Insert( after_node, the_node ) \ |
---|
167 | _Chain_Insert( after_node, the_node ) |
---|
168 | |
---|
169 | |
---|
170 | /* |
---|
171 | * Chain_Append_unprotected |
---|
172 | * |
---|
173 | * This routine appends the_node onto the end of the_chain. |
---|
174 | * It does NOT disable interrupts to insure the atomicity of the |
---|
175 | * append operation. |
---|
176 | * |
---|
177 | * Chain_Control *the_chain, * IN * |
---|
178 | * Chain_Node *the_node * IN * |
---|
179 | */ |
---|
180 | |
---|
181 | #define Chain_Append_unprotected( the_chain, the_node ) \ |
---|
182 | _Chain_Append_unprotected( the_chain, the_node ) |
---|
183 | |
---|
184 | |
---|
185 | /* |
---|
186 | * Chain_Append |
---|
187 | * |
---|
188 | * This routine appends the_node onto the end of the_chain. |
---|
189 | * It disables interrupts to insure the atomicity of the |
---|
190 | * append operation. |
---|
191 | * |
---|
192 | * Chain_Control *the_chain, * IN * |
---|
193 | * Chain_Node *the_node * IN * |
---|
194 | */ |
---|
195 | |
---|
196 | #define Chain_Append( the_chain, the_node ) \ |
---|
197 | _Chain_Append( the_chain, the_node ) |
---|
198 | |
---|
199 | |
---|
200 | /* |
---|
201 | * Chain_Prepend_unprotected |
---|
202 | * |
---|
203 | * This routine prepends the_node onto the front of the_chain. |
---|
204 | * It does NOT disable interrupts to insure the atomicity of the |
---|
205 | * prepend operation. |
---|
206 | * |
---|
207 | * Chain_Control *the_chain, * IN * |
---|
208 | * Chain_Node *the_node * IN * |
---|
209 | */ |
---|
210 | |
---|
211 | #define Chain_Prepend_unprotected( the_chain, the_node ) \ |
---|
212 | _Chain_Prepend_unprotected( the_chain, the_node ) |
---|
213 | |
---|
214 | |
---|
215 | /* |
---|
216 | * Chain_Prepend |
---|
217 | * |
---|
218 | * This routine prepends the_node onto the front of the_chain. |
---|
219 | * It disables interrupts to insure the atomicity of the |
---|
220 | * prepend operation. |
---|
221 | * |
---|
222 | * Chain_Control *the_chain, * IN * |
---|
223 | * Chain_Node *the_node * IN * |
---|
224 | */ |
---|
225 | |
---|
226 | #define Chain_Prepend( the_chain, the_node ) \ |
---|
227 | _Chain_Prepend( the_chain, the_node ) |
---|
228 | |
---|
229 | |
---|
230 | /* |
---|
231 | * Chain_Head |
---|
232 | * |
---|
233 | * This function returns a pointer to the first node on the chain. |
---|
234 | * |
---|
235 | * Chain_Control *the_chain * IN * |
---|
236 | */ |
---|
237 | |
---|
238 | #define Chain_Head( the_chain ) \ |
---|
239 | _Chain_Head( the_chain ) |
---|
240 | |
---|
241 | |
---|
242 | /* |
---|
243 | * Chain_Tail |
---|
244 | * |
---|
245 | * This function returns a pointer to the last node on the chain. |
---|
246 | * |
---|
247 | * Chain_Control *the_chain * IN * |
---|
248 | */ |
---|
249 | |
---|
250 | #define Chain_Tail( the_chain ) \ |
---|
251 | _Chain_Tail( the_chain ) |
---|
252 | |
---|
253 | |
---|
254 | /* |
---|
255 | * Chain_Is_head |
---|
256 | * |
---|
257 | * This function returns TRUE if the_node is the head of the_chain and |
---|
258 | * FALSE otherwise. |
---|
259 | * |
---|
260 | * Chain_Control *the_chain, * IN * |
---|
261 | * Chain_Node *the_node * IN * |
---|
262 | */ |
---|
263 | |
---|
264 | #define Chain_Is_head( the_chain, the_node ) \ |
---|
265 | _Chain_Is_head( the_chain, the_node ) |
---|
266 | |
---|
267 | |
---|
268 | /* |
---|
269 | * Chain_Is_tail |
---|
270 | * |
---|
271 | * This function returns TRUE if the_node is the tail of the_chain and |
---|
272 | * FALSE otherwise. |
---|
273 | * |
---|
274 | * Chain_Control *the_chain, * IN * |
---|
275 | * Chain_Node *the_node * IN * |
---|
276 | */ |
---|
277 | |
---|
278 | #define Chain_Is_tail( the_chain, the_node ) \ |
---|
279 | _Chain_Is_tail( the_chain, the_node ) |
---|
280 | |
---|
281 | |
---|
282 | /* |
---|
283 | * Chain_Is_first |
---|
284 | * |
---|
285 | * This function returns TRUE if the_node is the first node on a chain and |
---|
286 | * FALSE otherwise. |
---|
287 | * |
---|
288 | * Chain_Node *the_node * IN * |
---|
289 | */ |
---|
290 | |
---|
291 | #define Chain_Is_first( the_node ) \ |
---|
292 | _Chain_Is_first( the_node ) |
---|
293 | |
---|
294 | |
---|
295 | /* |
---|
296 | * Chain_Is_last |
---|
297 | * |
---|
298 | * This function returns TRUE if the_node is the last node on a chain and |
---|
299 | * FALSE otherwise. |
---|
300 | * |
---|
301 | * Chain_Node *the_node * IN * |
---|
302 | */ |
---|
303 | |
---|
304 | #define Chain_Is_last( the_node ) \ |
---|
305 | _Chain_Is_last( the_node ) |
---|
306 | |
---|
307 | |
---|
308 | /* |
---|
309 | * Chain_Is_empty |
---|
310 | * |
---|
311 | * This function returns TRUE if there are no nodes on the_chain and |
---|
312 | * FALSE otherwise. |
---|
313 | * |
---|
314 | * Chain_Control *the_chain * IN * |
---|
315 | */ |
---|
316 | |
---|
317 | #define Chain_Is_empty( the_chain ) \ |
---|
318 | _Chain_Is_empty( the_chain ) |
---|
319 | |
---|
320 | |
---|
321 | /* |
---|
322 | * Chain_Has_only_one_node |
---|
323 | * |
---|
324 | * This function returns TRUE if there is only one node on the_chain and |
---|
325 | * FALSE otherwise. |
---|
326 | * |
---|
327 | * Chain_Control *the_chain * IN * |
---|
328 | */ |
---|
329 | |
---|
330 | #define Chain_Has_only_one_node( the_chain ) \ |
---|
331 | _Chain_Has_only_one_node( the_chain ) |
---|
332 | |
---|
333 | |
---|
334 | /* |
---|
335 | * Chain_Is_null |
---|
336 | * |
---|
337 | * This function returns TRUE if the_chain is NULL and FALSE otherwise. |
---|
338 | * |
---|
339 | * Chain_Control *the_chain * IN * |
---|
340 | */ |
---|
341 | |
---|
342 | #define Chain_Is_null( the_chain ) \ |
---|
343 | _Chain_Is_null( the_chain ) |
---|
344 | |
---|
345 | |
---|
346 | /* |
---|
347 | * Chain_Is_null_node |
---|
348 | * |
---|
349 | * This function returns TRUE if the_node is NULL and FALSE otherwise. |
---|
350 | * |
---|
351 | * Chain_Node *the_node * IN * |
---|
352 | */ |
---|
353 | |
---|
354 | #define Chain_Is_null_node( the_node ) \ |
---|
355 | _Chain_Is_null_node( the_node ) |
---|
356 | |
---|
357 | |
---|
358 | #undef __RTEMS_APPLICATION__ |
---|
359 | #include <rtems/score/chain.inl> |
---|
360 | #define __RTEMS_APPLICATION__ |
---|
361 | #endif |
---|
362 | /* end of include file */ |
---|