mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-09-21 07:46:20 +08:00
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:
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 );
|
||||
}
|
||||
Reference in New Issue
Block a user