summaryrefslogtreecommitdiffstats
path: root/cpukit/rtems/src/workspacegreedy.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--cpukit/rtems/src/workspacegreedy.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/cpukit/rtems/src/workspacegreedy.c b/cpukit/rtems/src/workspacegreedy.c
new file mode 100644
index 0000000000..6d8fd9b937
--- /dev/null
+++ b/cpukit/rtems/src/workspacegreedy.c
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2012 embedded brains GmbH. All rights reserved.
+ *
+ * embedded brains GmbH
+ * Obere Lagerstr. 30
+ * 82178 Puchheim
+ * Germany
+ * <rtems@embedded-brains.de>
+ *
+ * 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.
+ */
+
+#if HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
+#include <rtems/rtems/support.h>
+#include <rtems/score/wkspace.h>
+
+void *rtems_workspace_greedy_allocate( size_t remaining_free_space )
+{
+ void *opaque;
+
+ _Thread_Disable_dispatch();
+ opaque = _Heap_Greedy_allocate( &_Workspace_Area, remaining_free_space );
+ _Thread_Enable_dispatch();
+
+ return opaque;
+}
+
+void rtems_workspace_greedy_free( void *opaque )
+{
+ _Thread_Disable_dispatch();
+ _Heap_Greedy_free( &_Workspace_Area, opaque );
+ _Thread_Enable_dispatch();
+}