summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/powerpc/shared/startup/bspgetworkarea.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2008-09-15 22:05:19 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2008-09-15 22:05:19 +0000
commitdb77b92977831c0cf023fc49dd74d9b18e121ff2 (patch)
tree9126a6a52d5f7c78515b547460f51cbb2e91e0d7 /c/src/lib/libbsp/powerpc/shared/startup/bspgetworkarea.c
parent2008-09-15 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-db77b92977831c0cf023fc49dd74d9b18e121ff2.tar.bz2
2008-09-15 Joel Sherrill <joel.sherrill@oarcorp.com>
* 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.
Diffstat (limited to 'c/src/lib/libbsp/powerpc/shared/startup/bspgetworkarea.c')
-rw-r--r--c/src/lib/libbsp/powerpc/shared/startup/bspgetworkarea.c42
1 files changed, 42 insertions, 0 deletions
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 <bsp.h>
+#include <bsp/bootcard.h>
+#include <stdint.h>
+
+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;
+}
+