diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2009-03-02 18:10:34 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2009-03-02 18:10:34 +0000 |
commit | 7246c8e9978e63058a688db708d8235f841a8d80 (patch) | |
tree | 58a8e68e1f6949d24820bd4a30297b356af2b517 | |
parent | 2009-03-02 Joel Sherrill <joel.sherrill@OARcorp.com> (diff) | |
download | rtems-7246c8e9978e63058a688db708d8235f841a8d80.tar.bz2 |
2009-03-02 Joel Sherrill <joel.sherrill@oarcorp.com>
* libcsupport/src/malloc_initialize.c, score/Makefile.am,
score/include/rtems/score/protectedheap.h,
score/inline/rtems/score/heap.inl: Get total heap size correct when
using unified C Program Heap and RTEMS Workspace.
* score/src/pheapgetsize.c: New file.
-rw-r--r-- | cpukit/ChangeLog | 8 | ||||
-rw-r--r-- | cpukit/libcsupport/src/malloc_initialize.c | 5 | ||||
-rw-r--r-- | cpukit/score/Makefile.am | 6 | ||||
-rw-r--r-- | cpukit/score/include/rtems/score/protectedheap.h | 12 | ||||
-rw-r--r-- | cpukit/score/inline/rtems/score/heap.inl | 15 | ||||
-rw-r--r-- | cpukit/score/src/pheapgetsize.c | 24 |
6 files changed, 65 insertions, 5 deletions
diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index 843e3a4c0c..e9a078d6f1 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,3 +1,11 @@ +2009-03-02 Joel Sherrill <joel.sherrill@oarcorp.com> + + * libcsupport/src/malloc_initialize.c, score/Makefile.am, + score/include/rtems/score/protectedheap.h, + score/inline/rtems/score/heap.inl: Get total heap size correct when + using unified C Program Heap and RTEMS Workspace. + * score/src/pheapgetsize.c: New file. + 2009-03-02 Joel Sherrill <joel.sherrill@OARcorp.com> PR 1388/cpukit diff --git a/cpukit/libcsupport/src/malloc_initialize.c b/cpukit/libcsupport/src/malloc_initialize.c index 1105724a67..eb477b23ca 100644 --- a/cpukit/libcsupport/src/malloc_initialize.c +++ b/cpukit/libcsupport/src/malloc_initialize.c @@ -101,8 +101,11 @@ void RTEMS_Malloc_Initialize( ); if ( !status ) rtems_fatal_error_occurred( status ); + } + MSBUMP( space_available, _Protected_heap_Get_size(RTEMS_Malloc_Heap->final) ); + #if defined(RTEMS_HEAP_DEBUG) if ( _Protected_heap_Walk( RTEMS_Malloc_Heap, 0, false ) ) { printk( "Malloc heap not initialized correctly\n" ); @@ -112,6 +115,4 @@ void RTEMS_Malloc_Initialize( rtems_fatal_error_occurred( RTEMS_NO_MEMORY ); } #endif - - MSBUMP(space_available, length); } diff --git a/cpukit/score/Makefile.am b/cpukit/score/Makefile.am index 472f3bd53a..7b5f76b162 100644 --- a/cpukit/score/Makefile.am +++ b/cpukit/score/Makefile.am @@ -129,9 +129,9 @@ endif ## PROTECTED_HEAP_C_FILES libscore_a_SOURCES += src/pheapallocatealigned.c src/pheapallocate.c \ - src/pheapextend.c src/pheapfree.c src/pheapgetblocksize.c \ - src/pheapgetfreeinfo.c src/pheapgetinfo.c src/pheapinit.c \ - src/pheapresizeblock.c src/pheapwalk.c + src/pheapextend.c src/pheapfree.c src/pheapgetsize.c \ + src/pheapgetblocksize.c src/pheapgetfreeinfo.c src/pheapgetinfo.c \ + src/pheapinit.c src/pheapresizeblock.c src/pheapwalk.c ## THREAD_C_FILES libscore_a_SOURCES += src/thread.c src/threadchangepriority.c \ diff --git a/cpukit/score/include/rtems/score/protectedheap.h b/cpukit/score/include/rtems/score/protectedheap.h index be657155ae..f9407b27db 100644 --- a/cpukit/score/include/rtems/score/protectedheap.h +++ b/cpukit/score/include/rtems/score/protectedheap.h @@ -205,6 +205,18 @@ void _Protected_heap_Get_free_information( Heap_Information *info ); +/** + * This function returns the maximum size of the protected heap. + * + * @param[in] the_heap points to the heap being operated upon + * + * @return This method returns the total amount of memory + * allocated to the heap. + */ +uint32_t _Protected_heap_Get_size( + Heap_Control *the_heap +); + #ifdef __cplusplus } #endif diff --git a/cpukit/score/inline/rtems/score/heap.inl b/cpukit/score/inline/rtems/score/heap.inl index 8238687726..ccff0bacb8 100644 --- a/cpukit/score/inline/rtems/score/heap.inl +++ b/cpukit/score/inline/rtems/score/heap.inl @@ -368,6 +368,21 @@ RTEMS_INLINE_ROUTINE bool _Heap_Is_block_in ( return _Addresses_Is_in_range( the_block, the_heap->start, the_heap->final ); } +/** + * This function returns the maximum size of the heap. + * + * @param[in] the_heap points to the heap being operated upon + * + * @return This method returns the total amount of memory + * allocated to the heap. + */ +RTEMS_INLINE_ROUTINE uint32_t _Heap_Get_size ( + Heap_Control *the_heap +) +{ + return the_heap->final - the_heap->start; +} + /**@}*/ #endif diff --git a/cpukit/score/src/pheapgetsize.c b/cpukit/score/src/pheapgetsize.c new file mode 100644 index 0000000000..c283d34c13 --- /dev/null +++ b/cpukit/score/src/pheapgetsize.c @@ -0,0 +1,24 @@ +/** + * COPYRIGHT (c) 1989-2009. + * 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$ + */ + +#if HAVE_CONFIG_H +#include "config.h" +#endif + +#include <rtems/system.h> +#include <rtems/score/protectedheap.h> + +uint32_t _Protected_heap_Get_size( + Heap_Control *the_heap +) +{ + return _Heap_Get_size( the_heap ); +} |