source: rtems/cpukit/score/macros/rtems/score/heap.inl @ d6154c7

4.104.114.84.95
Last change on this file since d6154c7 was d6154c7, checked in by Ralf Corsepius <ralf.corsepius@…>, on 03/29/04 at 16:41:13

2004-03-29 Ralf Corsepius <ralf_corsepius@…>

  • score/include/rtems/debug.h, score/include/rtems/score/bitfield.h, score/include/rtems/score/chain.h, score/include/rtems/score/coremsg.h, score/include/rtems/score/coremutex.h, score/include/rtems/score/coresem.h, score/include/rtems/score/heap.h, score/include/rtems/score/interr.h, score/include/rtems/score/isr.h, score/include/rtems/score/mpci.h, score/include/rtems/score/mppkt.h, score/include/rtems/score/object.h, score/include/rtems/score/objectmp.h, score/include/rtems/score/priority.h, score/include/rtems/score/stack.h, score/include/rtems/score/states.h, score/include/rtems/score/thread.h, score/include/rtems/score/threadmp.h, score/include/rtems/score/threadq.h, score/include/rtems/score/tod.h, score/include/rtems/score/tqdata.h, score/include/rtems/score/userext.h, score/include/rtems/score/watchdog.h, score/include/rtems/score/wkspace.h, score/inline/rtems/score/address.inl, score/inline/rtems/score/coremsg.inl, score/inline/rtems/score/coresem.inl, score/inline/rtems/score/heap.inl, score/inline/rtems/score/isr.inl, score/inline/rtems/score/object.inl, score/inline/rtems/score/priority.inl, score/inline/rtems/score/stack.inl, score/inline/rtems/score/thread.inl, score/inline/rtems/score/tqdata.inl, score/inline/rtems/score/userext.inl, score/inline/rtems/score/wkspace.inl, score/macros/rtems/score/address.inl, score/macros/rtems/score/heap.inl, score/macros/rtems/score/object.inl, score/macros/rtems/score/priority.inl, score/macros/rtems/score/userext.inl: Convert to using c99 fixed size types.
  • Property mode set to 100644
File size: 2.6 KB
Line 
1/*  heap.inl
2 *
3 *  This file contains the macro implementation of the inlined
4 *  routines from the heap handler.
5 *
6 *  COPYRIGHT (c) 1989-1999.
7 *  On-Line Applications Research Corporation (OAR).
8 *
9 *  The license and distribution terms for this file may be
10 *  found in the file LICENSE in this distribution or at
11 *  http://www.rtems.com/license/LICENSE.
12 *
13 *  $Id$
14 */
15
16#ifndef __HEAP_inl
17#define __HEAP_inl
18
19#include <rtems/score/address.h>
20
21/*PAGE
22 *
23 *  _Heap_Head
24 */
25
26#define _Heap_Head( _the_heap ) \
27  ((Heap_Block *)&(_the_heap)->start)
28
29/*PAGE
30 *
31 *  _Heap_Tail
32 */
33
34#define _Heap_Tail( _the_heap ) \
35  ((Heap_Block *)&(_the_heap)->final)
36
37/*PAGE
38 *
39 *  _Heap_Previous_block
40 */
41
42#define _Heap_Previous_block( _the_block ) \
43  ( (Heap_Block *) _Addresses_Subtract_offset( \
44      (void *)(_the_block), \
45      (_the_block)->back_flag & ~ HEAP_BLOCK_USED \
46    ) \
47  )
48
49/*PAGE
50 *
51 *  _Heap_Next_block
52 */
53
54#define _Heap_Next_block( _the_block ) \
55  ( (Heap_Block *) _Addresses_Add_offset( \
56      (void *)(_the_block), \
57      (_the_block)->front_flag & ~ HEAP_BLOCK_USED \
58    ) \
59  )
60
61/*PAGE
62 *
63 *  _Heap_Block_at
64 */
65
66#define _Heap_Block_at( _base, _offset ) \
67  ( (Heap_Block *) \
68     _Addresses_Add_offset( (void *)(_base), (_offset) ) )
69
70/*PAGE
71 *
72 *  _Heap_User_block_at
73 *
74 */
75 
76#define _Heap_User_block_at( _base ) \
77  _Heap_Block_at( \
78    (_base), \
79    -*(((uint32_t   *) (_base)) - 1) + -HEAP_BLOCK_USED_OVERHEAD \
80  )
81
82/*PAGE
83 *
84 *  _Heap_Is_previous_block_free
85 */
86
87#define _Heap_Is_previous_block_free( _the_block ) \
88  ( !((_the_block)->back_flag & HEAP_BLOCK_USED) )
89
90/*PAGE
91 *
92 *  _Heap_Is_block_free
93 */
94
95#define _Heap_Is_block_free( _the_block ) \
96  ( !((_the_block)->front_flag & HEAP_BLOCK_USED) )
97
98/*PAGE
99 *
100 *  _Heap_Is_block_used
101 */
102
103#define _Heap_Is_block_used( _the_block ) \
104  ((_the_block)->front_flag & HEAP_BLOCK_USED)
105
106/*PAGE
107 *
108 *  _Heap_Block_size
109 */
110
111#define _Heap_Block_size( _the_block )    \
112  ((_the_block)->front_flag & ~HEAP_BLOCK_USED)
113
114/*PAGE
115 *
116 *  _Heap_Start_of_user_area
117 */
118
119#define _Heap_Start_of_user_area( _the_block ) \
120  ((void *) &(_the_block)->next)
121
122/*PAGE
123 *
124 *  _Heap_Is_block_in
125 */
126
127#define _Heap_Is_block_in( _the_heap, _the_block ) \
128  ( ((_the_block) >= (_the_heap)->start) && \
129    ((_the_block) <= (_the_heap)->final) )
130
131/*PAGE
132 *
133 *  _Heap_Is_page_size_valid
134 */
135
136#define _Heap_Is_page_size_valid( _page_size ) \
137  ( ((_page_size) != 0) && \
138    (((_page_size) % CPU_HEAP_ALIGNMENT) == 0) )
139
140/*PAGE
141 *
142 *  _Heap_Build_flag
143 */
144
145#define _Heap_Build_flag( _size, _in_use_flag ) \
146  ( (_size) | (_in_use_flag))
147
148#endif
149/* end of include file */
Note: See TracBrowser for help on using the repository browser.