source: rtems/c/src/exec/score/inline/heap.inl @ 38ffa0c

4.104.114.84.95
Last change on this file since 38ffa0c 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: 3.2 KB
Line 
1/*  heap.inl
2 *
3 *  This file contains the static inline implementation of the inlined
4 *  routines from the heap 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 __HEAP_inl
18#define __HEAP_inl
19
20#include <rtems/core/address.h>
21
22/*PAGE
23 *
24 *  _Heap_Head
25 *
26 */
27
28STATIC INLINE Heap_Block *_Heap_Head (
29  Heap_Control *the_heap
30)
31{
32  return (Heap_Block *)&the_heap->start;
33}
34
35/*PAGE
36 *
37 *  _Heap_Tail
38 *
39 */
40
41STATIC INLINE Heap_Block *_Heap_Tail (
42  Heap_Control *the_heap
43)
44{
45  return (Heap_Block *)&the_heap->final;
46}
47
48/*PAGE
49 *
50 *  _Heap_Previous_block
51 *
52 */
53
54STATIC INLINE Heap_Block *_Heap_Previous_block (
55  Heap_Block *the_block
56)
57{
58  return (Heap_Block *) _Addresses_Subtract_offset(
59                          (void *)the_block,
60                          the_block->back_flag & ~ HEAP_BLOCK_USED
61                        );
62}
63
64/*PAGE
65 *
66 *  _Heap_Next_block
67 *
68 *  NOTE: Next_block assumes that the block is free.
69 */
70
71STATIC INLINE Heap_Block *_Heap_Next_block (
72  Heap_Block *the_block
73)
74{
75  return (Heap_Block *) _Addresses_Add_offset(
76                          (void *)the_block,
77                          the_block->front_flag & ~ HEAP_BLOCK_USED
78                        );
79}
80
81/*PAGE
82 *
83 *  _Heap_Block_at
84 *
85 */
86
87STATIC INLINE Heap_Block *_Heap_Block_at(
88  void       *base,
89  unsigned32  offset
90)
91{
92  return (Heap_Block *) _Addresses_Add_offset( (void *)base, offset );
93}
94
95/*PAGE
96 *
97 *  _Heap_Is_previous_block_free
98 *
99 */
100
101STATIC INLINE boolean _Heap_Is_previous_block_free (
102  Heap_Block *the_block
103)
104{
105  return !(the_block->back_flag & HEAP_BLOCK_USED);
106}
107
108/*PAGE
109 *
110 *  _Heap_Is_block_free
111 *
112 */
113
114STATIC INLINE boolean _Heap_Is_block_free (
115  Heap_Block *the_block
116)
117{
118  return !(the_block->front_flag & HEAP_BLOCK_USED);
119}
120
121/*PAGE
122 *
123 *  _Heap_Is_block_used
124 *
125 */
126
127STATIC INLINE boolean _Heap_Is_block_used (
128  Heap_Block *the_block
129)
130{
131  return (the_block->front_flag & HEAP_BLOCK_USED);
132}
133
134/*PAGE
135 *
136 *  _Heap_Block_size
137 *
138 */
139
140STATIC INLINE unsigned32 _Heap_Block_size (
141  Heap_Block *the_block
142)
143{
144  return (the_block->front_flag & ~HEAP_BLOCK_USED);
145}
146
147/*PAGE
148 *
149 *  _Heap_Start_of_user_area
150 *
151 */
152
153STATIC INLINE void *_Heap_Start_of_user_area (
154  Heap_Block *the_block
155)
156{
157  return (void *) &the_block->next;
158}
159
160/*PAGE
161 *
162 *  _Heap_Is_block_in
163 *
164 */
165
166STATIC INLINE boolean _Heap_Is_block_in (
167  Heap_Control *the_heap,
168  Heap_Block   *the_block
169)
170{
171  return _Addresses_Is_in_range( the_block, the_heap->start, the_heap->final );
172}
173
174/*PAGE
175 *
176 *  _Heap_Is_page_size_valid
177 *
178 */
179
180STATIC INLINE boolean _Heap_Is_page_size_valid(
181  unsigned32 page_size
182)
183{
184  return ((page_size != 0) &&
185         ((page_size % CPU_HEAP_ALIGNMENT) == 0));
186}
187
188/*PAGE
189 *
190 *  _Heap_Build_flag
191 *
192 */
193
194STATIC INLINE unsigned32 _Heap_Build_flag (
195  unsigned32 size,
196  unsigned32 in_use_flag
197)
198{
199  return  size | in_use_flag;
200}
201
202#endif
203/* end of include file */
Note: See TracBrowser for help on using the repository browser.