summaryrefslogtreecommitdiffstats
path: root/cpukit/score/include/rtems/score
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2012-08-09 16:48:00 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2012-10-25 14:54:06 +0200
commit47a3cd8f73780bad3eff5135f0eb58e8c98af91d (patch)
tree8acdfc6ebe5d596f9c6b974e6c460dc69e824e3c /cpukit/score/include/rtems/score
parentscore: Append to free list in _Heap_Extend() (diff)
downloadrtems-47a3cd8f73780bad3eff5135f0eb58e8c98af91d.tar.bz2
score: Work area initialization API change
The work areas (RTEMS work space and C program heap) will be initialized now in a separate step and are no longer part of rtems_initialize_data_structures(). Initialization is performed with tables of Heap_Area entries. This allows usage of scattered memory areas present on various small scale micro-controllers. The sbrk() support API changes also. The bsp_sbrk_init() must now deal with a minimum size for the first memory chunk to take the configured work space size into account.
Diffstat (limited to '')
-rw-r--r--cpukit/score/include/rtems/score/heap.h30
-rw-r--r--cpukit/score/include/rtems/score/interr.h3
-rw-r--r--cpukit/score/include/rtems/score/wkspace.h14
3 files changed, 41 insertions, 6 deletions
diff --git a/cpukit/score/include/rtems/score/heap.h b/cpukit/score/include/rtems/score/heap.h
index 964386a36f..36ef48f3b6 100644
--- a/cpukit/score/include/rtems/score/heap.h
+++ b/cpukit/score/include/rtems/score/heap.h
@@ -675,6 +675,36 @@ Heap_Resize_status _Heap_Resize_block(
uintptr_t *new_size
);
+RTEMS_INLINE_ROUTINE uintptr_t _Heap_Align_up(
+ uintptr_t value,
+ uintptr_t alignment
+)
+{
+ uintptr_t remainder = value % alignment;
+
+ if ( remainder != 0 ) {
+ return value - remainder + alignment;
+ } else {
+ return value;
+ }
+}
+
+/**
+ * @brief Returns the worst case overhead to manage a memory area.
+ */
+RTEMS_INLINE_ROUTINE uintptr_t _Heap_Area_overhead(
+ uintptr_t page_size
+)
+{
+ if ( page_size != 0 ) {
+ page_size = _Heap_Align_up( page_size, CPU_ALIGNMENT );
+ } else {
+ page_size = CPU_ALIGNMENT;
+ }
+
+ return 2 * (page_size - 1) + HEAP_BLOCK_HEADER_SIZE;
+}
+
#if !defined(__RTEMS_APPLICATION__)
#include <rtems/score/heap.inl>
diff --git a/cpukit/score/include/rtems/score/interr.h b/cpukit/score/include/rtems/score/interr.h
index 19342a3db8..2a21fe01eb 100644
--- a/cpukit/score/include/rtems/score/interr.h
+++ b/cpukit/score/include/rtems/score/interr.h
@@ -72,7 +72,8 @@ typedef enum {
INTERNAL_ERROR_UNLIMITED_AND_MAXIMUM_IS_0,
INTERNAL_ERROR_SHUTDOWN_WHEN_NOT_UP,
INTERNAL_ERROR_GXX_KEY_ADD_FAILED,
- INTERNAL_ERROR_GXX_MUTEX_INIT_FAILED
+ INTERNAL_ERROR_GXX_MUTEX_INIT_FAILED,
+ INTERNAL_ERROR_NO_MEMORY_FOR_HEAP
} Internal_errors_Core_list;
typedef uint32_t Internal_errors_t;
diff --git a/cpukit/score/include/rtems/score/wkspace.h b/cpukit/score/include/rtems/score/wkspace.h
index 10b80ccaab..db6eb38f96 100644
--- a/cpukit/score/include/rtems/score/wkspace.h
+++ b/cpukit/score/include/rtems/score/wkspace.h
@@ -36,19 +36,23 @@ extern "C" {
#include <rtems/score/interr.h>
/**
- * @brief Executive Workspace Control
+ * @brief Executive workspace control.
*
- * The is the heap control structure that used to manage the
- * RTEMS Executive Workspace.
+ * This is the heap control structure used to manage the RTEMS Executive
+ * Workspace.
*/
-SCORE_EXTERN Heap_Control _Workspace_Area; /* executive heap header */
+SCORE_EXTERN Heap_Control _Workspace_Area;
/**
* @brief Workspace Handler Initialization
*
* This routine performs the initialization necessary for this handler.
*/
-void _Workspace_Handler_initialization(void);
+void _Workspace_Handler_initialization(
+ Heap_Area *areas,
+ size_t area_count,
+ Heap_Initialization_or_extend_handler extend
+);
/**
* @brief Allocate Memory from Workspace