예제 #1
0
파일: bspstart.c 프로젝트: kptran/rtems
void bsp_pretasking_hook(void)
{
	#if MPC55XX_CHIP_TYPE / 10 == 564
		_Heap_Extend(
			RTEMS_Malloc_Heap,
			bsp_section_rwextra_end,
			(uintptr_t) bsp_ram_end
				- (uintptr_t) bsp_section_rwextra_end,
			NULL
		);
	#endif
}
예제 #2
0
rtems_status_code rtems_region_extend(
  rtems_id   id,
  void      *starting_address,
  uintptr_t  length
)
{
  uintptr_t           amount_extended;
  Objects_Locations   location;
  rtems_status_code   return_status;
  Region_Control     *the_region;

  if ( !starting_address )
    return RTEMS_INVALID_ADDRESS;

  _RTEMS_Lock_allocator(); /* to prevent deletion */

    the_region = _Region_Get( id, &location );
    switch ( location ) {

      case OBJECTS_LOCAL:

        amount_extended = _Heap_Extend(
          &the_region->Memory,
          starting_address,
          length,
          0
        );

        if ( amount_extended > 0 ) {
          the_region->length                += amount_extended;
          the_region->maximum_segment_size  += amount_extended;
          return_status = RTEMS_SUCCESSFUL;
        } else {
          return_status = RTEMS_INVALID_ADDRESS;
        }
        break;

#if defined(RTEMS_MULTIPROCESSING)
      case OBJECTS_REMOTE:        /* this error cannot be returned */
        break;
#endif

      case OBJECTS_ERROR:
      default:
        return_status = RTEMS_INVALID_ID;
        break;
    }

  _RTEMS_Unlock_allocator();

  return return_status;
}
예제 #3
0
bool _Protected_heap_Extend(
  Heap_Control *the_heap,
  void         *starting_address,
  uintptr_t     size
)
{
  bool      extend_ok;
  uintptr_t amount_extended;

  _RTEMS_Lock_allocator();
    extend_ok = _Heap_Extend(the_heap, starting_address, size, &amount_extended);
  _RTEMS_Unlock_allocator();
  return extend_ok;
}
boolean _Protected_heap_Extend(
  Heap_Control *the_heap,
  void         *starting_address,
  size_t        size
)
{
  Heap_Extend_status status;
  uint32_t           amount_extended;

  _RTEMS_Lock_allocator();
    status = _Heap_Extend(the_heap, starting_address, size, &amount_extended);
  _RTEMS_Unlock_allocator();
  return (status == HEAP_EXTEND_SUCCESSFUL);
}
예제 #5
0
static void add_area(
  void *area_begin,
  uintptr_t area_size
)
{
  Heap_Control *heap = cache_coherent_heap;

  if ( heap == NULL ) {
    bool ok;

    heap = &cache_coherent_heap_instance;

    ok = _Heap_Initialize( heap, area_begin, area_size, 0 );
    if ( ok ) {
      cache_coherent_heap = heap;
    }
  } else {
    _Heap_Extend( heap, area_begin, area_size, 0 );
  }
}
예제 #6
0
파일: regionextend.c 프로젝트: AoLaD/rtems
rtems_status_code rtems_region_extend(
  rtems_id   id,
  void      *starting_address,
  uintptr_t  length
)
{
  rtems_status_code  status;
  Region_Control    *the_region;
  uintptr_t          amount_extended;

  if ( starting_address == NULL ) {
    return RTEMS_INVALID_ADDRESS;
  }

  the_region = _Region_Get_and_lock( id );

  if ( the_region == NULL ) {
    return RTEMS_INVALID_ID;
  }

  amount_extended = _Heap_Extend(
    &the_region->Memory,
    starting_address,
    length,
    0
  );

  if ( amount_extended > 0 ) {
    the_region->maximum_segment_size += amount_extended;
    status = RTEMS_SUCCESSFUL;
  } else {
    status = RTEMS_INVALID_ADDRESS;
  }

  _Region_Unlock( the_region );
  return status;
}