mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-10-17 02:57:54 +08:00
Add and use rtems_bsd_get_task_stack_size()
This commit is contained in:
@@ -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;
|
||||
|
@@ -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 */
|
||||
|
46
rtemsbsd/rtems/rtems-bsd-get-task-stack-size.c
Normal file
46
rtemsbsd/rtems/rtems-bsd-get-task-stack-size.c
Normal file
@@ -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;
|
||||
}
|
@@ -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) {
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user