summaryrefslogtreecommitdiffstats
path: root/testsuites/libtests/heapwalk/init.c
blob: 1aeadb4be46285356510abfe6fa4814a27486154 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
 *  Test of Heap Walker
 *
 *  COPYRIGHT (c) 1989-2008.
 *  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$
 */

#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__
#define CONFIGURE_INIT
#include "system.h"

#include <stdlib.h>
#include <inttypes.h>
#include <errno.h>
#include <rtems/score/heap.h>

#define TEST_HEAP_SIZE 1024
uint8_t TestHeapMemory[TEST_HEAP_SIZE];
Heap_Control TestHeap;

void test_heap_init(void)
{
  _Heap_Initialize( &TestHeap, TestHeapMemory, TEST_HEAP_SIZE, 0 );
}

void test_walk_freshly_initialized(void)
{
  puts( "Walk freshly initialized heap" );
  test_heap_init();

  _Heap_Walk( &TestHeap, 0x01, true );
}

rtems_task Init(
  rtems_task_argument argument
)
{
  puts( "\n\n*** HEAP WALK TEST ***" );

  test_walk_freshly_initialized();

  puts( "*** END OF HEAP WALK TEST ***" );
  rtems_test_exit(0);
}