1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @ingroup ScoreProtHeap |
---|
5 | * |
---|
6 | * @brief Protected Heap Handler API |
---|
7 | */ |
---|
8 | |
---|
9 | /* |
---|
10 | * COPYRIGHT (c) 1989-2007. |
---|
11 | * On-Line Applications Research Corporation (OAR). |
---|
12 | * |
---|
13 | * The license and distribution terms for this file may be |
---|
14 | * found in the file LICENSE in this distribution or at |
---|
15 | * http://www.rtems.org/license/LICENSE. |
---|
16 | */ |
---|
17 | |
---|
18 | #ifndef _RTEMS_SCORE_PROTECTED_HEAP_H |
---|
19 | #define _RTEMS_SCORE_PROTECTED_HEAP_H |
---|
20 | |
---|
21 | #include <rtems/score/heapimpl.h> |
---|
22 | #include <rtems/score/apimutex.h> |
---|
23 | |
---|
24 | #ifdef __cplusplus |
---|
25 | extern "C" { |
---|
26 | #endif |
---|
27 | |
---|
28 | /** |
---|
29 | * @defgroup ScoreProtHeap Protected Heap Handler |
---|
30 | * |
---|
31 | * @ingroup ScoreHeap |
---|
32 | * |
---|
33 | * @brief Provides protected heap services. |
---|
34 | * |
---|
35 | * The @ref ScoreAllocatorMutex is used to protect the heap accesses. |
---|
36 | * |
---|
37 | */ |
---|
38 | /**@{**/ |
---|
39 | |
---|
40 | /** |
---|
41 | * @brief See _Heap_Initialize(). |
---|
42 | */ |
---|
43 | RTEMS_INLINE_ROUTINE uintptr_t _Protected_heap_Initialize( |
---|
44 | Heap_Control *heap, |
---|
45 | void *area_begin, |
---|
46 | uintptr_t area_size, |
---|
47 | uintptr_t page_size |
---|
48 | ) |
---|
49 | { |
---|
50 | return _Heap_Initialize( heap, area_begin, area_size, page_size ); |
---|
51 | } |
---|
52 | |
---|
53 | /** |
---|
54 | * @brief See _Heap_Extend(). |
---|
55 | * |
---|
56 | * Returns @a true in case of success, and @a false otherwise. |
---|
57 | */ |
---|
58 | bool _Protected_heap_Extend( |
---|
59 | Heap_Control *heap, |
---|
60 | void *area_begin, |
---|
61 | uintptr_t area_size |
---|
62 | ); |
---|
63 | |
---|
64 | /** |
---|
65 | * @brief See _Heap_Allocate_aligned_with_boundary(). |
---|
66 | */ |
---|
67 | void *_Protected_heap_Allocate_aligned_with_boundary( |
---|
68 | Heap_Control *heap, |
---|
69 | uintptr_t size, |
---|
70 | uintptr_t alignment, |
---|
71 | uintptr_t boundary |
---|
72 | ); |
---|
73 | |
---|
74 | /** |
---|
75 | * @brief See _Heap_Allocate_aligned_with_boundary() with boundary equals zero. |
---|
76 | */ |
---|
77 | RTEMS_INLINE_ROUTINE void *_Protected_heap_Allocate_aligned( |
---|
78 | Heap_Control *heap, |
---|
79 | uintptr_t size, |
---|
80 | uintptr_t alignment |
---|
81 | ) |
---|
82 | { |
---|
83 | return |
---|
84 | _Protected_heap_Allocate_aligned_with_boundary( heap, size, alignment, 0 ); |
---|
85 | } |
---|
86 | |
---|
87 | /** |
---|
88 | * @brief See _Heap_Allocate_aligned_with_boundary() with alignment and |
---|
89 | * boundary equals zero. |
---|
90 | */ |
---|
91 | RTEMS_INLINE_ROUTINE void *_Protected_heap_Allocate( |
---|
92 | Heap_Control *heap, |
---|
93 | uintptr_t size |
---|
94 | ) |
---|
95 | { |
---|
96 | return _Protected_heap_Allocate_aligned_with_boundary( heap, size, 0, 0 ); |
---|
97 | } |
---|
98 | |
---|
99 | /** |
---|
100 | * @brief See _Heap_Size_of_alloc_area(). |
---|
101 | */ |
---|
102 | bool _Protected_heap_Get_block_size( |
---|
103 | Heap_Control *heap, |
---|
104 | void *addr, |
---|
105 | uintptr_t *size |
---|
106 | ); |
---|
107 | |
---|
108 | /** |
---|
109 | * @brief See _Heap_Resize_block(). |
---|
110 | * |
---|
111 | * Returns @a true in case of success, and @a false otherwise. |
---|
112 | */ |
---|
113 | bool _Protected_heap_Resize_block( |
---|
114 | Heap_Control *heap, |
---|
115 | void *addr, |
---|
116 | uintptr_t size |
---|
117 | ); |
---|
118 | |
---|
119 | /** |
---|
120 | * @brief See _Heap_Free(). |
---|
121 | * |
---|
122 | * Returns @a true in case of success, and @a false otherwise. |
---|
123 | */ |
---|
124 | bool _Protected_heap_Free( Heap_Control *heap, void *addr ); |
---|
125 | |
---|
126 | /** |
---|
127 | * @brief See _Heap_Walk(). |
---|
128 | */ |
---|
129 | bool _Protected_heap_Walk( Heap_Control *heap, int source, bool dump ); |
---|
130 | |
---|
131 | /** |
---|
132 | * @brief See _Heap_Iterate(). |
---|
133 | */ |
---|
134 | void _Protected_heap_Iterate( |
---|
135 | Heap_Control *heap, |
---|
136 | Heap_Block_visitor visitor, |
---|
137 | void *visitor_arg |
---|
138 | ); |
---|
139 | |
---|
140 | /** |
---|
141 | * @brief See _Heap_Get_information(). |
---|
142 | * |
---|
143 | * Returns @a true in case of success, and @a false otherwise. |
---|
144 | */ |
---|
145 | bool _Protected_heap_Get_information( |
---|
146 | Heap_Control *heap, |
---|
147 | Heap_Information_block *info |
---|
148 | ); |
---|
149 | |
---|
150 | /** |
---|
151 | * @brief See _Heap_Get_free_information(). |
---|
152 | * |
---|
153 | * Returns @a true in case of success, and @a false otherwise. |
---|
154 | */ |
---|
155 | bool _Protected_heap_Get_free_information( |
---|
156 | Heap_Control *heap, |
---|
157 | Heap_Information *info |
---|
158 | ); |
---|
159 | |
---|
160 | /** |
---|
161 | * @brief See _Heap_Get_size(). |
---|
162 | */ |
---|
163 | uintptr_t _Protected_heap_Get_size( Heap_Control *heap ); |
---|
164 | |
---|
165 | /** @} */ |
---|
166 | |
---|
167 | #ifdef __cplusplus |
---|
168 | } |
---|
169 | #endif |
---|
170 | |
---|
171 | #endif |
---|
172 | /* end of include file */ |
---|