summaryrefslogtreecommitdiffstats
path: root/rtemsbsd
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2015-01-20 08:57:36 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2015-01-20 09:19:04 +0100
commit33a15c304bf9ae77697eb7383972125526e9bd7c (patch)
tree5f597d4d03665279cb6ec727bf921ce8b75afb6c /rtemsbsd
parentAdd and use rtems_bsd_get_task_priority() (diff)
downloadrtems-libbsd-33a15c304bf9ae77697eb7383972125526e9bd7c.tar.bz2
Add and use rtems_bsd_get_task_stack_size()
Diffstat (limited to 'rtemsbsd')
-rw-r--r--rtemsbsd/include/machine/rtems-bsd-thread.h3
-rw-r--r--rtemsbsd/include/rtems/bsd/bsd.h13
-rw-r--r--rtemsbsd/rtems/rtems-bsd-get-task-stack-size.c46
-rw-r--r--rtemsbsd/rtems/rtems-bsd-init.c2
-rw-r--r--rtemsbsd/rtems/rtems-bsd-nexus.c2
-rw-r--r--rtemsbsd/rtems/rtems-bsd-thread.c3
6 files changed, 63 insertions, 6 deletions
diff --git a/rtemsbsd/include/machine/rtems-bsd-thread.h b/rtemsbsd/include/machine/rtems-bsd-thread.h
index 64862df2..2f99ad10 100644
--- a/rtemsbsd/include/machine/rtems-bsd-thread.h
+++ b/rtemsbsd/include/machine/rtems-bsd-thread.h
@@ -50,9 +50,6 @@
#define BSD_TASK_NAME rtems_build_name('_', 'B', 'S', 'D')
-/* FIXME */
-#define BSD_MINIMUM_TASK_STACK_SIZE ((size_t) 32 * 1024)
-
struct sleepqueue {
Thread_queue_Control sq_blocked;
LIST_ENTRY(sleepqueue) sq_hash;
diff --git a/rtemsbsd/include/rtems/bsd/bsd.h b/rtemsbsd/include/rtems/bsd/bsd.h
index 6aea27f2..2e161e97 100644
--- a/rtemsbsd/include/rtems/bsd/bsd.h
+++ b/rtemsbsd/include/rtems/bsd/bsd.h
@@ -90,6 +90,19 @@ rtems_status_code rtems_bsd_initialize(void);
*/
rtems_task_priority rtems_bsd_get_task_priority(const char *name);
+/**
+ * @brief Returns the stack size for a task specified by its name.
+ *
+ * Applications may provide their own implementation of this function. For
+ * example they can define their implementation in the same module which calls
+ * rtems_bsd_initialize().
+ *
+ * @param[in] name The task name.
+ *
+ * @return The desired task stack size.
+ */
+size_t rtems_bsd_get_task_stack_size(const char *name);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff --git a/rtemsbsd/rtems/rtems-bsd-get-task-stack-size.c b/rtemsbsd/rtems/rtems-bsd-get-task-stack-size.c
new file mode 100644
index 00000000..0eb80210
--- /dev/null
+++ b/rtemsbsd/rtems/rtems-bsd-get-task-stack-size.c
@@ -0,0 +1,46 @@
+/**
+ * @file
+ *
+ * @ingroup rtems_bsd_rtems
+ *
+ * @brief TODO.
+ */
+
+/*
+ * Copyright (c) 2015 embedded brains GmbH. All rights reserved.
+ *
+ * embedded brains GmbH
+ * Dornierstr. 4
+ * 82178 Puchheim
+ * Germany
+ * <rtems@embedded-brains.de>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <rtems/bsd/bsd.h>
+
+size_t
+rtems_bsd_get_task_stack_size(const char *name)
+{
+ return 32 * 1024;
+}
diff --git a/rtemsbsd/rtems/rtems-bsd-init.c b/rtemsbsd/rtems/rtems-bsd-init.c
index dbc2cc6c..b585f7a5 100644
--- a/rtemsbsd/rtems/rtems-bsd-init.c
+++ b/rtemsbsd/rtems/rtems-bsd-init.c
@@ -90,7 +90,7 @@ rtems_bsd_initialize(void)
sc = rtems_timer_initiate_server(
rtems_bsd_get_task_priority(name),
- BSD_MINIMUM_TASK_STACK_SIZE,
+ rtems_bsd_get_task_stack_size(name),
RTEMS_DEFAULT_ATTRIBUTES
);
if (sc != RTEMS_SUCCESSFUL) {
diff --git a/rtemsbsd/rtems/rtems-bsd-nexus.c b/rtemsbsd/rtems/rtems-bsd-nexus.c
index a6b99258..f7e4eba5 100644
--- a/rtemsbsd/rtems/rtems-bsd-nexus.c
+++ b/rtemsbsd/rtems/rtems-bsd-nexus.c
@@ -79,7 +79,7 @@ nexus_probe(device_t dev)
#ifndef DISABLE_INTERRUPT_EXTENSION
status = rtems_interrupt_server_initialize(
rtems_bsd_get_task_priority(name),
- BSD_MINIMUM_TASK_STACK_SIZE,
+ rtems_bsd_get_task_stack_size(name),
RTEMS_DEFAULT_MODES,
RTEMS_DEFAULT_ATTRIBUTES,
NULL
diff --git a/rtemsbsd/rtems/rtems-bsd-thread.c b/rtemsbsd/rtems/rtems-bsd-thread.c
index a05d7437..4fd5184c 100644
--- a/rtemsbsd/rtems/rtems-bsd-thread.c
+++ b/rtemsbsd/rtems/rtems-bsd-thread.c
@@ -258,7 +258,8 @@ rtems_bsd_thread_start(struct thread **td_ptr, void (*func)(void *), void *arg,
sc = rtems_task_create(
BSD_TASK_NAME,
rtems_bsd_get_task_priority(name),
- BSD_MINIMUM_TASK_STACK_SIZE + (size_t) pages * PAGE_SIZE,
+ rtems_bsd_get_task_stack_size(name)
+ + (size_t) pages * PAGE_SIZE,
RTEMS_DEFAULT_MODES,
RTEMS_DEFAULT_ATTRIBUTES,
&task_id