From db77b92977831c0cf023fc49dd74d9b18e121ff2 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Mon, 15 Sep 2008 22:05:19 +0000 Subject: 2008-09-15 Joel Sherrill * shared/startup/bspstart.c, shared/startup/pretaskinghook.c: Add use of bsp_get_work_area() in its own file and rely on BSP Framework to perform more initialization. * shared/startup/bspgetworkarea.c: New file. --- .../libbsp/powerpc/shared/startup/bspgetworkarea.c | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 c/src/lib/libbsp/powerpc/shared/startup/bspgetworkarea.c (limited to 'c/src/lib/libbsp/powerpc/shared/startup/bspgetworkarea.c') diff --git a/c/src/lib/libbsp/powerpc/shared/startup/bspgetworkarea.c b/c/src/lib/libbsp/powerpc/shared/startup/bspgetworkarea.c new file mode 100644 index 0000000000..fc49315f7c --- /dev/null +++ b/c/src/lib/libbsp/powerpc/shared/startup/bspgetworkarea.c @@ -0,0 +1,42 @@ +/* + * 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$ + */ + +#include +#include +#include + +extern void *__rtems_end; +extern uint32_t _bsp_sbrk_init(uint32_t, uint32_t*); + +/* + * This method returns the base address and size of the area which + * is to be allocated between the RTEMS Workspace and the C Program + * Heap. + */ +void bsp_get_work_area( + void **work_area_start, + size_t *work_area_size, + void **heap_start, + size_t *heap_size +) +{ + uintptr_t size; + uintptr_t reserve; + uintptr_t spared; + + reserve = (uintptr_t)BSP_INIT_STACK_SIZE; + reserve += rtems_configuration_get_interrupt_stack_size(); + size = (uintptr_t)BSP_mem_size - (uintptr_t)&__rtems_end + reserve; + + *work_area_start = (void *)(&__rtems_end + reserve); + *work_area_size = size; + spared = _bsp_sbrk_init( *work_area_start, work_area_size ); + *heap_start = BSP_BOOTCARD_HEAP_USES_WORK_AREA; + *heap_size = BSP_BOOTCARD_HEAP_SIZE_DEFAULT; +} + -- cgit v1.2.3