source: rtems/cpukit/score/src/chain.c @ 879a047

4.104.114.84.95
Last change on this file since 879a047 was 3a4ae6c, checked in by Joel Sherrill <joel.sherrill@…>, on 09/11/95 at 19:35:39

The word "RTEMS" almost completely removed from the core.

Configuration Table Template file added and all tests
modified to use this. All gvar.h and conftbl.h files
removed from test directories.

Configuration parameter maximum_devices added.

Core semaphore and mutex handlers added and RTEMS API Semaphore
Manager updated to reflect this.

Initialization sequence changed to invoke API specific initialization
routines. Initialization tasks table now owned by RTEMS Tasks Manager.

Added user extension for post-switch.

Utilized user extensions to implement API specific functionality
like signal dispatching.

Added extensions to the System Initialization Thread so that an
API can register a function to be invoked while the system
is being initialized. These are largely equivalent to the
pre-driver and post-driver hooks.

Added the Modules file oar-go32_p5, modified oar-go32, and modified
the file make/custom/go32.cfg to look at an environment varable which
determines what CPU model is being used.

All BSPs updated to reflect named devices and clock driver's IOCTL
used by the Shared Memory Driver. Also merged clock isr into
main file and removed ckisr.c where possible.

Updated spsize to reflect new and moved variables.

Makefiles for the executive source and include files updated to show
break down of files into Core, RTEMS API, and Neither.

Header and inline files installed into subdirectory based on whether
logically in the Core or a part of the RTEMS API.

  • Property mode set to 100644
File size: 4.2 KB
Line 
1/*
2 *  Chain Handler
3 *
4 *  NOTE:
5 *
6 *  The order of this file is to allow proper compilation due to the
7 *  order of inlining required by the compiler.
8 *
9 *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
10 *  On-Line Applications Research Corporation (OAR).
11 *  All rights assigned to U.S. Government, 1994.
12 *
13 *  This material may be reproduced by or for the U.S. Government pursuant
14 *  to the copyright license under the clause at DFARS 252.227-7013.  This
15 *  notice must appear in all copies of this file and its derivatives.
16 *
17 *  $Id$
18 */
19
20#include <rtems/system.h>
21#include <rtems/core/address.h>
22#include <rtems/core/chain.h>
23#include <rtems/core/isr.h>
24
25/*PAGE
26 *
27 *  _Chain_Initialize
28 *
29 *  This kernel routine initializes a doubly linked chain.
30 *
31 *  Input parameters:
32 *    the_chain        - pointer to chain header
33 *    starting_address - starting address of first node
34 *    number_nodes     - number of nodes in chain
35 *    node_size        - size of node in bytes
36 *
37 *  Output parameters:  NONE
38 */
39
40void _Chain_Initialize(
41  Chain_Control *the_chain,
42  void           *starting_address,
43  unsigned32     number_nodes,
44  unsigned32     node_size
45)
46{
47  unsigned32  count;
48  Chain_Node *current;
49  Chain_Node *next;
50
51  count                     = number_nodes;
52  current                   = _Chain_Head( the_chain );
53  the_chain->permanent_null = NULL;
54  next                      = (Chain_Node *)starting_address;
55  while ( count-- ) {
56    current->next  = next;
57    next->previous = current;
58    current        = next;
59    next           = (Chain_Node *)
60                        _Addresses_Add_offset( (void *) next, node_size );
61  }
62  current->next    = _Chain_Tail( the_chain );
63  the_chain->last  = current;
64}
65
66/*PAGE
67 *
68 *  _Chain_Get_first_unprotected
69 */
70
71#ifndef USE_INLINES
72Chain_Node *_Chain_Get_first_unprotected(
73  Chain_Control *the_chain
74)
75{
76  Chain_Node  *return_node;
77  Chain_Node  *new_first;
78
79  return_node         = the_chain->first;
80  new_first           = return_node->next;
81  the_chain->first    = new_first;
82  new_first->previous = _Chain_Head( the_chain );
83
84  return return_node;
85}
86#endif   /* USE_INLINES */
87
88/*PAGE
89 *
90 *  _Chain_Get
91 *
92 *  This kernel routine returns a pointer to a node taken from the
93 *  given chain.
94 *
95 *  Input parameters:
96 *    the_chain - pointer to chain header
97 *
98 *  Output parameters:
99 *    return_node - pointer to node in chain allocated
100 *    CHAIN_END   - if no nodes available
101 *
102 *  INTERRUPT LATENCY:
103 *    only case
104 */
105
106Chain_Node *_Chain_Get(
107  Chain_Control *the_chain
108)
109{
110  ISR_Level          level;
111  Chain_Node *return_node;
112
113  return_node = NULL;
114  _ISR_Disable( level );
115    if ( !_Chain_Is_empty( the_chain ) )
116      return_node = _Chain_Get_first_unprotected( the_chain );
117  _ISR_Enable( level );
118  return return_node;
119}
120
121/*PAGE
122 *
123 *  _Chain_Append
124 *
125 *  This kernel routine puts a node on the end of the specified chain.
126 *
127 *  Input parameters:
128 *    the_chain - pointer to chain header
129 *    node      - address of node to put at rear of chain
130 *
131 *  Output parameters:  NONE
132 *
133 *  INTERRUPT LATENCY:
134 *    only case
135 */
136
137void _Chain_Append(
138  Chain_Control *the_chain,
139  Chain_Node    *node
140)
141{
142  ISR_Level level;
143
144  _ISR_Disable( level );
145    _Chain_Append_unprotected( the_chain, node );
146  _ISR_Enable( level );
147}
148
149/*PAGE
150 *
151 *  _Chain_Extract
152 *
153 *  This kernel routine deletes the given node from a chain.
154 *
155 *  Input parameters:
156 *    node - pointer to node in chain to be deleted
157 *
158 *  Output parameters:  NONE
159 *
160 *  INTERRUPT LATENCY:
161 *    only case
162 */
163
164void _Chain_Extract(
165  Chain_Node *node
166)
167{
168  ISR_Level level;
169
170  _ISR_Disable( level );
171    _Chain_Extract_unprotected( node );
172  _ISR_Enable( level );
173}
174
175/*PAGE
176 *
177 *  _Chain_Insert
178 *
179 *  This kernel routine inserts a given node after a specified node
180 *  a requested chain.
181 *
182 *  Input parameters:
183 *    after_node - pointer to node in chain to be inserted after
184 *    node       - pointer to node to be inserted
185 *
186 *  Output parameters:  NONE
187 *
188 *  INTERRUPT LATENCY:
189 *    only case
190 */
191
192void _Chain_Insert(
193  Chain_Node *after_node,
194  Chain_Node *node
195)
196{
197  ISR_Level level;
198
199  _ISR_Disable( level );
200    _Chain_Insert_unprotected( after_node, node );
201  _ISR_Enable( level );
202}
Note: See TracBrowser for help on using the repository browser.