forked from Imagelibrary/rtems
2010-08-10 Joel Sherrill <joel.sherrill@oarcorp.com>
PR 1661/testing * malloc04/init.c: Add public methods to get/set malloc heap pointer so the tests do not have to peer behind the API.
This commit is contained in:
@@ -1,3 +1,9 @@
|
|||||||
|
2010-08-10 Joel Sherrill <joel.sherrill@oarcorp.com>
|
||||||
|
|
||||||
|
PR 1661/testing
|
||||||
|
* malloc04/init.c: Add public methods to get/set malloc heap pointer so
|
||||||
|
the tests do not have to peer behind the API.
|
||||||
|
|
||||||
2010-08-09 Bharath Suri <bharath.s.jois@gmail.com>
|
2010-08-09 Bharath Suri <bharath.s.jois@gmail.com>
|
||||||
|
|
||||||
PR 1661/testing
|
PR 1661/testing
|
||||||
|
|||||||
@@ -15,15 +15,26 @@
|
|||||||
#include <rtems/malloc.h>
|
#include <rtems/malloc.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
/* configuration information */
|
||||||
|
/* At top of file to have access to configuration variables */
|
||||||
|
|
||||||
|
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
|
||||||
|
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
|
||||||
|
|
||||||
|
#define CONFIGURE_MAXIMUM_TASKS 1
|
||||||
|
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
|
||||||
|
|
||||||
|
#define CONFIGURE_INIT
|
||||||
|
#include <rtems/confdefs.h>
|
||||||
|
/* end of configuration */
|
||||||
|
|
||||||
char Malloc_Heap[ 128 ] CPU_STRUCTURE_ALIGNMENT;
|
char Malloc_Heap[ 128 ] CPU_STRUCTURE_ALIGNMENT;
|
||||||
int sbrk_count;
|
int sbrk_count;
|
||||||
Heap_Control Heap_Holder;
|
Heap_Control Heap_Holder;
|
||||||
|
Heap_Control TempHeap;
|
||||||
|
|
||||||
/* Heap variables we need to peek and poke at */
|
/* Heap variables we need to peek and poke at */
|
||||||
extern Heap_Control *RTEMS_Malloc_Heap;
|
|
||||||
extern size_t RTEMS_Malloc_Sbrk_amount;
|
extern size_t RTEMS_Malloc_Sbrk_amount;
|
||||||
extern rtems_malloc_sbrk_functions_t *rtems_malloc_sbrk_helpers;
|
|
||||||
extern rtems_malloc_sbrk_functions_t rtems_malloc_sbrk_helpers_table;
|
|
||||||
|
|
||||||
size_t offset;
|
size_t offset;
|
||||||
|
|
||||||
@@ -52,6 +63,7 @@ rtems_task Init(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
void *p1, *p2, *p3, *p4;
|
void *p1, *p2, *p3, *p4;
|
||||||
|
Heap_Control *TempHeap;
|
||||||
|
|
||||||
sbrk_count = 0;
|
sbrk_count = 0;
|
||||||
offset = 0;
|
offset = 0;
|
||||||
@@ -59,7 +71,8 @@ rtems_task Init(
|
|||||||
puts( "\n\n*** TEST MALLOC 04 ***" );
|
puts( "\n\n*** TEST MALLOC 04 ***" );
|
||||||
|
|
||||||
/* Safe information on real heap */
|
/* Safe information on real heap */
|
||||||
Heap_Holder = *RTEMS_Malloc_Heap;
|
TempHeap = malloc_get_heap_pointer();
|
||||||
|
Heap_Holder = *TempHeap;
|
||||||
rtems_malloc_sbrk_helpers = &rtems_malloc_sbrk_helpers_table;
|
rtems_malloc_sbrk_helpers = &rtems_malloc_sbrk_helpers_table;
|
||||||
|
|
||||||
puts( "Initialize heap with some memory" );
|
puts( "Initialize heap with some memory" );
|
||||||
@@ -112,7 +125,7 @@ rtems_task Init(
|
|||||||
p4 = malloc(48);
|
p4 = malloc(48);
|
||||||
|
|
||||||
/* Restore information on real heap */
|
/* Restore information on real heap */
|
||||||
*RTEMS_Malloc_Heap = Heap_Holder;
|
malloc_set_heap_pointer( TempHeap );
|
||||||
rtems_malloc_sbrk_helpers = NULL;
|
rtems_malloc_sbrk_helpers = NULL;
|
||||||
|
|
||||||
puts( "*** END OF TEST MALLOC 04 ***" );
|
puts( "*** END OF TEST MALLOC 04 ***" );
|
||||||
@@ -120,15 +133,4 @@ rtems_task Init(
|
|||||||
rtems_test_exit(0);
|
rtems_test_exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* configuration information */
|
|
||||||
|
|
||||||
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
|
|
||||||
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
|
|
||||||
|
|
||||||
#define CONFIGURE_MAXIMUM_TASKS 1
|
|
||||||
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
|
|
||||||
|
|
||||||
#define CONFIGURE_INIT
|
|
||||||
|
|
||||||
#include <rtems/confdefs.h>
|
|
||||||
/* end of file */
|
/* end of file */
|
||||||
|
|||||||
Reference in New Issue
Block a user