summaryrefslogtreecommitdiffstats
path: root/cpukit/score/include/rtems/score/heap.h
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2010-06-07 09:35:01 +0000
committerSebastian Huber <sebastian.huber@embedded-brains.de>2010-06-07 09:35:01 +0000
commitb2a0214d4395787eca8e74375d283bf26c9ca4a1 (patch)
treeeb91086d7da6342ea88ad774939bb90afcfd3e4f /cpukit/score/include/rtems/score/heap.h
parent2010-06-07 Sebastian Huber <sebastian.huber@embedded-brains.de> (diff)
downloadrtems-b2a0214d4395787eca8e74375d283bf26c9ca4a1.tar.bz2
2010-06-07 Sebastian Huber <sebastian.huber@embedded-brains.de>
* score/include/rtems/score/heap.h: Declare _Heap_Get_first_and_last_block(). Removed Heap_Extend_status. Changed return type of _Heap_Extend() to bool. * score/inline/rtems/score/heap.inl: Define _Heap_Set_last_block_size(). * score/src/heap.c: Define and use _Heap_Get_first_and_last_block(). * score/src/heapgetinfo.c: Removed assert statements. Do not count the last block. This ensures that all size values are an integral multiple of the page size which is consistent with the other statistics. * score/src/heapextend.c: Implemented support for scattered heap areas. * score/src/heapwalk.c: Dump also last block. Changes for new first and last block values. * ./score/src/pheapextend.c, rtems/src/regionextend.c: Update for _Heap_Extend() changes.
Diffstat (limited to '')
-rw-r--r--cpukit/score/include/rtems/score/heap.h49
1 files changed, 35 insertions, 14 deletions
diff --git a/cpukit/score/include/rtems/score/heap.h b/cpukit/score/include/rtems/score/heap.h
index c2286bf2af..286cc94218 100644
--- a/cpukit/score/include/rtems/score/heap.h
+++ b/cpukit/score/include/rtems/score/heap.h
@@ -92,7 +92,10 @@ extern "C" {
* <tr><td>heap->area_begin</td><td colspan=2>heap area begin address</td></tr>
* <tr>
* <td>first_block->prev_size</td>
- * <td colspan=2>page size (the value is arbitrary)</td>
+ * <td colspan=2>
+ * subordinate heap area end address (this will be used to maintain a
+ * linked list of scattered heap areas)
+ * </td>
* </tr>
* <tr>
* <td>first_block->size</td>
@@ -311,15 +314,6 @@ typedef struct {
} Heap_Information_block;
/**
- * @brief See _Heap_Extend().
- */
-typedef enum {
- HEAP_EXTEND_SUCCESSFUL,
- HEAP_EXTEND_ERROR,
- HEAP_EXTEND_NOT_IMPLEMENTED
-} Heap_Extend_status;
-
-/**
* @brief See _Heap_Resize_block().
*/
typedef enum {
@@ -329,6 +323,29 @@ typedef enum {
} Heap_Resize_status;
/**
+ * @brief Gets the first and last block for the heap area with begin
+ * @a heap_area_begin and size @a heap_area_size.
+ *
+ * A page size of @a page_size and minimal block size of @a min_block_size will
+ * be used for calculation.
+ *
+ * Nothing will be written to this area.
+ *
+ * In case of success the pointers to the first and last block will be returned
+ * via @a first_block_ptr and @a last_block_ptr.
+ *
+ * Returns @c true if the area is big enough, and @c false otherwise.
+ */
+bool _Heap_Get_first_and_last_block(
+ uintptr_t heap_area_begin,
+ uintptr_t heap_area_size,
+ uintptr_t page_size,
+ uintptr_t min_block_size,
+ Heap_Block **first_block_ptr,
+ Heap_Block **last_block_ptr
+);
+
+/**
* @brief Initializes the heap control block @a heap to manage the area
* starting at @a area_begin of size @a area_size bytes.
*
@@ -350,11 +367,15 @@ uintptr_t _Heap_Initialize(
* starting at @a area_begin of size @a area_size bytes.
*
* The extended space available for allocation will be returned in
- * @a amount_extended.
+ * @a amount_extended. This pointer may be @c NULL.
+ *
+ * The memory area must be big enough to contain some maintainance blocks. It
+ * must not overlap parts of the current heap areas. Disconnected subordinate
+ * heap areas will lead to used blocks which cover the gaps.
*
- * The memory area must start at the end of the currently used memory area.
+ * Returns @c true in case of success, and @c false otherwise.
*/
-Heap_Extend_status _Heap_Extend(
+bool _Heap_Extend(
Heap_Control *heap,
void *area_begin,
uintptr_t area_size,
@@ -368,7 +389,7 @@ Heap_Extend_status _Heap_Extend(
* memory area will begin at an address aligned by this value.
*
* If the boundary parameter @a boundary is not equal to zero, the allocated
- * memory area will fulfill a boundary constraint. The boudnary value
+ * memory area will fulfill a boundary constraint. The boundary value
* specifies the set of addresses which are aligned by the boundary value. The
* interior of the allocated memory area will not contain an element of this
* set. The begin or end address of the area may be a member of the set.