diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-08-09 16:48:00 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-10-25 14:54:06 +0200 |
commit | 47a3cd8f73780bad3eff5135f0eb58e8c98af91d (patch) | |
tree | 8acdfc6ebe5d596f9c6b974e6c460dc69e824e3c /cpukit/libcsupport/include/rtems/malloc.h | |
parent | score: Append to free list in _Heap_Extend() (diff) | |
download | rtems-47a3cd8f73780bad3eff5135f0eb58e8c98af91d.tar.bz2 |
score: Work area initialization API change
The work areas (RTEMS work space and C program heap) will be initialized
now in a separate step and are no longer part of
rtems_initialize_data_structures(). Initialization is performed with
tables of Heap_Area entries. This allows usage of scattered memory
areas present on various small scale micro-controllers.
The sbrk() support API changes also. The bsp_sbrk_init() must now deal
with a minimum size for the first memory chunk to take the configured
work space size into account.
Diffstat (limited to 'cpukit/libcsupport/include/rtems/malloc.h')
-rw-r--r-- | cpukit/libcsupport/include/rtems/malloc.h | 45 |
1 files changed, 36 insertions, 9 deletions
diff --git a/cpukit/libcsupport/include/rtems/malloc.h b/cpukit/libcsupport/include/rtems/malloc.h index d195b9fef1..9d475d33b1 100644 --- a/cpukit/libcsupport/include/rtems/malloc.h +++ b/cpukit/libcsupport/include/rtems/malloc.h @@ -26,6 +26,20 @@ extern "C" { #endif +/** + * @brief C program heap control. + * + * This is the pointer to the heap control structure used to manage the C + * program heap. + */ +extern Heap_Control *RTEMS_Malloc_Heap; + +void RTEMS_Malloc_Initialize( + const Heap_Area *areas, + size_t area_count, + Heap_Initialization_or_extend_handler extend +); + /* * Malloc Statistics Structure */ @@ -54,16 +68,29 @@ extern rtems_malloc_statistics_functions_t rtems_malloc_statistics_helpers_table; extern rtems_malloc_statistics_functions_t *rtems_malloc_statistics_helpers; -/* - * Malloc Heap Extension (sbrk) plugin - */ -typedef struct { - void *(*initialize)(void *, size_t); - void *(*extend)(size_t); -} rtems_malloc_sbrk_functions_t; +extern ptrdiff_t RTEMS_Malloc_Sbrk_amount; + +static inline void rtems_heap_set_sbrk_amount( ptrdiff_t sbrk_amount ) +{ + RTEMS_Malloc_Sbrk_amount = sbrk_amount; +} + +typedef void *(*rtems_heap_extend_handler)( + Heap_Control *heap, + size_t alloc_size +); + +void *rtems_heap_extend_via_sbrk( + Heap_Control *heap, + size_t alloc_size +); + +void *rtems_heap_null_extend( + Heap_Control *heap, + size_t alloc_size +); -extern rtems_malloc_sbrk_functions_t rtems_malloc_sbrk_helpers_table; -extern rtems_malloc_sbrk_functions_t *rtems_malloc_sbrk_helpers; +extern const rtems_heap_extend_handler rtems_malloc_extend_handler; /* * Malloc Plugin to Dirty Memory at Allocation Time |