heap.h File Reference

#include <rtems/score/heap.inl>

Include dependency graph for heap.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  Heap_Block_struct
struct  Heap_Statistics
struct  Heap_Control
struct  Heap_Information
struct  Heap_Information_block

Defines

#define HEAP_PREV_USED   1
#define HEAP_MIN_BLOCK_SIZE   (sizeof(Heap_Block))
#define HEAP_BLOCK_HEADER_OFFSET   (sizeof(uint32_t))
#define HEAP_BLOCK_USER_OFFSET   (sizeof(uint32_t) * 2)
#define HEAP_BLOCK_USED_OVERHEAD   (HEAP_BLOCK_USER_OFFSET - HEAP_BLOCK_HEADER_OFFSET)
#define HEAP_OVERHEAD   HEAP_BLOCK_USER_OFFSET
#define _H_p2u(_p)   ((_H_uptr_t)(_p))
#define _HAssert(cond_)   ((void)0)

Typedefs

typedef uintptr_t _H_uptr_t
typedef struct Heap_Block_struct Heap_Block

Enumerations

enum  Heap_Extend_status { HEAP_EXTEND_SUCCESSFUL, HEAP_EXTEND_ERROR, HEAP_EXTEND_NOT_IMPLEMENTED }
enum  Heap_Resize_status { HEAP_RESIZE_SUCCESSFUL, HEAP_RESIZE_UNSATISFIED, HEAP_RESIZE_FATAL_ERROR }
enum  Heap_Get_information_status { HEAP_GET_INFORMATION_SUCCESSFUL = 0, HEAP_GET_INFORMATION_BLOCK_ERROR }

Functions

uint32_t _Heap_Initialize (Heap_Control *the_heap, void *starting_address, size_t size, uint32_t page_size)
Heap_Extend_status _Heap_Extend (Heap_Control *the_heap, void *starting_address, size_t size, uint32_t *amount_extended)
void * _Heap_Allocate (Heap_Control *the_heap, size_t size)
void * _Heap_Allocate_aligned (Heap_Control *the_heap, size_t size, uint32_t alignment)
boolean _Heap_Size_of_user_area (Heap_Control *the_heap, void *starting_address, size_t *size)
Heap_Resize_status _Heap_Resize_block (Heap_Control *the_heap, void *starting_address, size_t size, uint32_t *old_mem_size, uint32_t *avail_mem_size)
boolean _Heap_Free (Heap_Control *the_heap, void *start_address)
boolean _Heap_Walk (Heap_Control *the_heap, int source, boolean do_dump)
Heap_Get_information_status _Heap_Get_information (Heap_Control *the_heap, Heap_Information_block *the_info)
void _Heap_Get_free_information (Heap_Control *the_heap, Heap_Information *info)
size_t _Heap_Calc_block_size (size_t size, uint32_t page_size, uint32_t min_size)
uint32_t _Heap_Block_allocate (Heap_Control *the_heap, Heap_Block *the_block, uint32_t alloc_size)


Detailed Description

This include file contains the information pertaining to the Heap Handler. A heap is a doubly linked list of variable size blocks which are allocated using the first fit method. Garbage collection is performed each time a block is returned to the heap by coalescing neighbor blocks. Control information for both allocated and unallocated blocks is contained in the heap space. A heap control structure contains control information for the heap.

FIXME: the alignment routines could be made faster should we require only powers of two to be supported both for 'page_size' and for 'alignment' arguments. However, both workspace and malloc heaps are initialized with CPU_HEAP_ALIGNMENT as 'page_size', and while all the BSPs seem to use CPU_ALIGNMENT (that is power of two) as CPU_HEAP_ALIGNMENT, for whatever reason CPU_HEAP_ALIGNMENT is only required to be multiple of CPU_ALIGNMENT and explicitly not required to be a power of two.

COPYRIGHT (c) 1989-2006. On-Line Applications Research Corporation (OAR).

The license and distribution terms for this file may be found in the file LICENSE in this distribution or at http://www.rtems.com/license/LICENSE.

Id
heap.h,v 1.29 2008/01/29 23:58:17 joel Exp

Generated on Sat Jul 19 18:16:16 2008 for RTEMSSuperCore by  doxygen 1.5.6