source: rtems/cpukit/score/include/rtems/score/chain.h @ 1a8fde6c

4.104.114.84.95
Last change on this file since 1a8fde6c was 1a8fde6c, checked in by Joel Sherrill <joel.sherrill@…>, on 03/06/96 at 21:34:57

Removed prototyes for static inline routines and moved the comments into
the inline implementation. The impetus for this was twofold. First,
it is incorrect to have static inline prototypes when using the macro
implementation. Second, this reduced the number of lines in the include
files seen by rtems.h by about 2000 lines.

Next we restricted visibility for the inline routines to inside the
executive itself EXCEPT for a handful of objects. This reduced the
number of include files included by rtems.h by 40 files and reduced
the lines in the include files seen by rtems.h by about 6000 lines.

In total, these reduced the compile time of the entire RTEMS tree by 20%.
This results in about 8 minutes savings on the SparcStation? 10 morgana.

  • Property mode set to 100644
File size: 3.6 KB
Line 
1/*  chain.h
2 *
3 *  This include file contains all the constants and structures associated
4 *  with the Doubly Linked Chain Handler.
5 *
6 *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
7 *  On-Line Applications Research Corporation (OAR).
8 *  All rights assigned to U.S. Government, 1994.
9 *
10 *  This material may be reproduced by or for the U.S. Government pursuant
11 *  to the copyright license under the clause at DFARS 252.227-7013.  This
12 *  notice must appear in all copies of this file and its derivatives.
13 *
14 *  $Id$
15 */
16
17#ifndef __RTEMS_CHAIN_h
18#define __RTEMS_CHAIN_h
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
24#include <rtems/score/address.h>
25
26/*
27 *  This is used to manage each element (node) which is placed
28 *  on a chain.
29 *
30 *  NOTE:  Typically, a more complicated structure will use the
31 *         chain package.  The more complicated structure will
32 *         include a chain node as the first element in its
33 *         control structure.  It will then call the chain package
34 *         with a pointer to that node element.  The node pointer
35 *         and the higher level structure start at the same address
36 *         so the user can cast the pointers back and forth.
37 *
38 */
39
40typedef struct Chain_Node_struct Chain_Node;
41
42struct Chain_Node_struct {
43  Chain_Node *next;
44  Chain_Node *previous;
45};
46
47/*
48 *  This is used to manage a chain.  A chain consists of a doubly
49 *  linked list of zero or more nodes.
50 *
51 *  NOTE:  This implementation does not require special checks for
52 *         manipulating the first and last elements on the chain.
53 *         To accomplish this the chain control structure is
54 *         treated as two overlapping chain nodes.  The permanent
55 *         head of the chain overlays a node structure on the
56 *         first and permanent_null fields.  The permanent tail
57 *         of the chain overlays a node structure on the
58 *         permanent_null and last elements of the structure.
59 *
60 */
61
62typedef struct {
63  Chain_Node *first;
64  Chain_Node *permanent_null;
65  Chain_Node *last;
66} Chain_Control;
67
68/*
69 *  _Chain_Initialize
70 *
71 *  DESCRIPTION:
72 *
73 *  This routine initializes the_chain structure to manage the
74 *  contiguous array of number_nodes nodes which starts at
75 *  starting_address.  Each node is of node_size bytes.
76 *
77 */
78
79void _Chain_Initialize(
80  Chain_Control *the_chain,
81  void          *starting_address,
82  unsigned32     number_nodes,
83  unsigned32     node_size
84);
85
86/*
87 *  _Chain_Extract
88 *
89 *  DESCRIPTION:
90 *
91 *  This routine extracts the_node from the chain on which it resides.
92 *  It disables interrupts to insure the atomicity of the
93 *  extract operation.
94 *
95 */
96
97void _Chain_Extract(
98  Chain_Node *the_node
99);
100
101/*
102 *  _Chain_Get
103 *
104 *  DESCRIPTION:
105 *
106 *  This function removes the first node from the_chain and returns
107 *  a pointer to that node.  If the_chain is empty, then NULL is returned.
108 *  It disables interrupts to insure the atomicity of the
109 *  get operation.
110 *
111 */
112
113Chain_Node *_Chain_Get(
114  Chain_Control *the_chain
115);
116
117/*
118 *  _Chain_Insert
119 *
120 *  DESCRIPTION:
121 *
122 *  This routine inserts the_node on a chain immediately following
123 *  after_node.  It disables interrupts to insure the atomicity
124 *  of the extract operation.
125 *
126 */
127
128void _Chain_Insert(
129  Chain_Node *after_node,
130  Chain_Node *the_node
131);
132
133/*
134 *  _Chain_Append
135 *
136 *  DESCRIPTION:
137 *
138 *  This routine appends the_node onto the end of the_chain.
139 *  It disables interrupts to insure the atomicity of the
140 *  append operation.
141 *
142 */
143
144void _Chain_Append(
145  Chain_Control *the_chain,
146  Chain_Node    *the_node
147);
148
149#ifndef __RTEMS_APPLICATION__
150#include <rtems/score/chain.inl>
151#endif
152
153#ifdef __cplusplus
154}
155#endif
156
157#endif
158/* end of include file */
Note: See TracBrowser for help on using the repository browser.