summaryrefslogtreecommitdiffstats
path: root/cpukit/score/include/rtems/score/heap.h
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2013-07-24 15:24:51 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2013-07-24 15:33:28 +0200
commit4508a5adc1fea5b19c22fb856ccaf890a42b5807 (patch)
tree3e36b8f7983f5e94509360a01323c2275d323201 /cpukit/score/include/rtems/score/heap.h
parentscore: Include <rtems/score/cpu.h> (diff)
downloadrtems-4508a5adc1fea5b19c22fb856ccaf890a42b5807.tar.bz2
score: Move _Heap_Area_overhead() definition.
This function is used in bootcard.h.
Diffstat (limited to '')
-rw-r--r--cpukit/score/include/rtems/score/heap.h32
1 files changed, 31 insertions, 1 deletions
diff --git a/cpukit/score/include/rtems/score/heap.h b/cpukit/score/include/rtems/score/heap.h
index 5a6b3a1a00..80a041ca7c 100644
--- a/cpukit/score/include/rtems/score/heap.h
+++ b/cpukit/score/include/rtems/score/heap.h
@@ -18,7 +18,7 @@
#ifndef _RTEMS_SCORE_HEAP_H
#define _RTEMS_SCORE_HEAP_H
-#include <rtems/score/basedefs.h>
+#include <rtems/score/cpu.h>
#ifdef __cplusplus
extern "C" {
@@ -434,6 +434,36 @@ uintptr_t _Heap_No_extend(
uintptr_t unused_3
);
+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;
+}
+
/** @} */
#ifdef __cplusplus