Changeset 77998753 in rtems for testsuites/support


Ignore:
Timestamp:
Feb 17, 2012, 3:54:23 PM (8 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
39e8aa9
Parents:
622d670
git-author:
Sebastian Huber <sebastian.huber@…> (02/17/12 15:54:23)
git-committer:
Sebastian Huber <sebastian.huber@…> (02/17/12 15:56:17)
Message:

Use alternative API

Replaced Allocate_majority_of_workspace() with
rtems_workspace_allocate(). Replaced Allocate_majority_of_heap() with
rtems_heap_greedy_allocate().

Location:
testsuites/support
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • testsuites/support/include/test_support.h

    r622d670 r77998753  
    1616extern "C" {
    1717#endif
    18 
    19 /*
    20  *  Allocate a number of small blocks from the workspace
    21  *  until the largest free block of memory available is
    22  *  smaller than smallest.
    23  *
    24  *  NOTE: The memory CANNOT be freed.
    25  */
    26 void Allocate_majority_of_workspace( int smallest );
    27 
    28 /*
    29  *  Allocate a number of small blocks from the heap
    30  *  until the largest free block of memory available is
    31  *  smaller than smallest.
    32  *
    33  *  NOTE: The memory CANNOT be freed.
    34  */
    35 void Allocate_majority_of_heap( int smallest );
    3618
    3719/*
  • testsuites/support/src/test_support.c

    r622d670 r77998753  
    4141  return Longest_Name;
    4242}
    43 
    44 void Allocate_majority_of_workspace( int smallest )
    45 {
    46   bool                   result;
    47   Heap_Information_block info;
    48   void                   *temp;
    49 
    50   puts("Allocate_majority_of_workspace: ");
    51   result = rtems_workspace_get_information( &info );
    52   if ( result != TRUE )
    53     perror("==> Error Getting workspace information");
    54 
    55   do {
    56     result = rtems_workspace_allocate(
    57       info.Free.largest - HEAP_BLOCK_HEADER_SIZE,
    58       &temp
    59     );
    60     if ((!result) || (!temp))
    61       perror("Unable to allocate from workspace");
    62     result = rtems_workspace_get_information( &info );
    63   } while ( info.Free.largest >= smallest );
    64 
    65 }
    66 
    67 void Allocate_majority_of_heap( int smallest )
    68 {
    69   size_t    size;
    70   void     *temp;
    71 
    72   puts("Allocate_majority_of_heap: ");
    73   size = malloc_free_space();
    74   do {
    75     temp = malloc( size - HEAP_BLOCK_HEADER_SIZE );
    76     if (!temp)
    77       perror("Unable to allocate from workspace");
    78     size = malloc_free_space();
    79   } while ( size >= smallest );
    80 
    81 }
Note: See TracChangeset for help on using the changeset viewer.