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.
This commit is contained in:
Joel Sherrill
2009-03-02 18:10:34 +00:00
parent 6387939e5c
commit 7246c8e997
6 changed files with 65 additions and 5 deletions
+8
View File
@@ -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
+3 -2
View File
@@ -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);
}
+3 -3
View File
@@ -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 \
@@ -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
+15
View File
@@ -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
+24
View File
@@ -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 );
}