mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-05-13 18:59:44 +08:00
Add and use rtems_bsd_get_task_stack_size()
This commit is contained in:
parent
91ea7ea614
commit
33a15c304b
1
Makefile
1
Makefile
@ -72,6 +72,7 @@ LIB_C_FILES += rtemsbsd/rtems/rtems-bsd-delay.c
|
|||||||
LIB_C_FILES += rtemsbsd/rtems/rtems-bsd-get-ethernet-addr.c
|
LIB_C_FILES += rtemsbsd/rtems/rtems-bsd-get-ethernet-addr.c
|
||||||
LIB_C_FILES += rtemsbsd/rtems/rtems-bsd-get-file.c
|
LIB_C_FILES += rtemsbsd/rtems/rtems-bsd-get-file.c
|
||||||
LIB_C_FILES += rtemsbsd/rtems/rtems-bsd-get-task-priority.c
|
LIB_C_FILES += rtemsbsd/rtems/rtems-bsd-get-task-priority.c
|
||||||
|
LIB_C_FILES += rtemsbsd/rtems/rtems-bsd-get-task-stack-size.c
|
||||||
LIB_C_FILES += rtemsbsd/rtems/rtems-bsd-init.c
|
LIB_C_FILES += rtemsbsd/rtems/rtems-bsd-init.c
|
||||||
LIB_C_FILES += rtemsbsd/rtems/rtems-bsd-jail.c
|
LIB_C_FILES += rtemsbsd/rtems/rtems-bsd-jail.c
|
||||||
LIB_C_FILES += rtemsbsd/rtems/rtems-bsd-kern_synch.c
|
LIB_C_FILES += rtemsbsd/rtems/rtems-bsd-kern_synch.c
|
||||||
|
@ -670,6 +670,7 @@ rtems.addRTEMSSourceFiles(
|
|||||||
'rtems/rtems-bsd-get-ethernet-addr.c',
|
'rtems/rtems-bsd-get-ethernet-addr.c',
|
||||||
'rtems/rtems-bsd-get-file.c',
|
'rtems/rtems-bsd-get-file.c',
|
||||||
'rtems/rtems-bsd-get-task-priority.c',
|
'rtems/rtems-bsd-get-task-priority.c',
|
||||||
|
'rtems/rtems-bsd-get-task-stack-size.c',
|
||||||
'rtems/rtems-bsd-init.c',
|
'rtems/rtems-bsd-init.c',
|
||||||
'rtems/rtems-bsd-jail.c',
|
'rtems/rtems-bsd-jail.c',
|
||||||
'rtems/rtems-bsd-kern_synch.c',
|
'rtems/rtems-bsd-kern_synch.c',
|
||||||
|
@ -236,6 +236,10 @@ application may provide their own implementation of the
|
|||||||
`rtems_bsd_get_task_priority()` function (for example in the module which calls
|
`rtems_bsd_get_task_priority()` function (for example in the module which calls
|
||||||
`rtems_bsd_initialize()`) if different values are desired.
|
`rtems_bsd_initialize()`) if different values are desired.
|
||||||
|
|
||||||
|
The task stack size is determined by the `rtems_bsd_get_task_stack_size()`
|
||||||
|
function which may be provided by the application in case the default is not
|
||||||
|
appropriate.
|
||||||
|
|
||||||
== Network Stack Features
|
== Network Stack Features
|
||||||
|
|
||||||
http://roy.marples.name/projects/dhcpcd/index[DHCPCD(8)]:: DHCP client
|
http://roy.marples.name/projects/dhcpcd/index[DHCPCD(8)]:: DHCP client
|
||||||
|
@ -50,9 +50,6 @@
|
|||||||
|
|
||||||
#define BSD_TASK_NAME rtems_build_name('_', 'B', 'S', 'D')
|
#define BSD_TASK_NAME rtems_build_name('_', 'B', 'S', 'D')
|
||||||
|
|
||||||
/* FIXME */
|
|
||||||
#define BSD_MINIMUM_TASK_STACK_SIZE ((size_t) 32 * 1024)
|
|
||||||
|
|
||||||
struct sleepqueue {
|
struct sleepqueue {
|
||||||
Thread_queue_Control sq_blocked;
|
Thread_queue_Control sq_blocked;
|
||||||
LIST_ENTRY(sleepqueue) sq_hash;
|
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);
|
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
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __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(
|
sc = rtems_timer_initiate_server(
|
||||||
rtems_bsd_get_task_priority(name),
|
rtems_bsd_get_task_priority(name),
|
||||||
BSD_MINIMUM_TASK_STACK_SIZE,
|
rtems_bsd_get_task_stack_size(name),
|
||||||
RTEMS_DEFAULT_ATTRIBUTES
|
RTEMS_DEFAULT_ATTRIBUTES
|
||||||
);
|
);
|
||||||
if (sc != RTEMS_SUCCESSFUL) {
|
if (sc != RTEMS_SUCCESSFUL) {
|
||||||
|
@ -79,7 +79,7 @@ nexus_probe(device_t dev)
|
|||||||
#ifndef DISABLE_INTERRUPT_EXTENSION
|
#ifndef DISABLE_INTERRUPT_EXTENSION
|
||||||
status = rtems_interrupt_server_initialize(
|
status = rtems_interrupt_server_initialize(
|
||||||
rtems_bsd_get_task_priority(name),
|
rtems_bsd_get_task_priority(name),
|
||||||
BSD_MINIMUM_TASK_STACK_SIZE,
|
rtems_bsd_get_task_stack_size(name),
|
||||||
RTEMS_DEFAULT_MODES,
|
RTEMS_DEFAULT_MODES,
|
||||||
RTEMS_DEFAULT_ATTRIBUTES,
|
RTEMS_DEFAULT_ATTRIBUTES,
|
||||||
NULL
|
NULL
|
||||||
|
@ -258,7 +258,8 @@ rtems_bsd_thread_start(struct thread **td_ptr, void (*func)(void *), void *arg,
|
|||||||
sc = rtems_task_create(
|
sc = rtems_task_create(
|
||||||
BSD_TASK_NAME,
|
BSD_TASK_NAME,
|
||||||
rtems_bsd_get_task_priority(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_MODES,
|
||||||
RTEMS_DEFAULT_ATTRIBUTES,
|
RTEMS_DEFAULT_ATTRIBUTES,
|
||||||
&task_id
|
&task_id
|
||||||
|
@ -43,6 +43,8 @@
|
|||||||
#include <sys/kthread.h>
|
#include <sys/kthread.h>
|
||||||
#include <sys/errno.h>
|
#include <sys/errno.h>
|
||||||
|
|
||||||
|
#include <rtems/bsd/bsd.h>
|
||||||
|
|
||||||
#include <rtems.h>
|
#include <rtems.h>
|
||||||
#include <rtems/libcsupport.h>
|
#include <rtems/libcsupport.h>
|
||||||
#include <rtems/score/threaddispatch.h>
|
#include <rtems/score/threaddispatch.h>
|
||||||
@ -210,7 +212,7 @@ test_kthread_add(void)
|
|||||||
{
|
{
|
||||||
rtems_resource_snapshot snapshot;
|
rtems_resource_snapshot snapshot;
|
||||||
void *greedy;
|
void *greedy;
|
||||||
uintptr_t take_away = 2 * BSD_MINIMUM_TASK_STACK_SIZE;
|
uintptr_t take_away = 2 * rtems_bsd_get_task_stack_size("");
|
||||||
|
|
||||||
puts("test kthread_add()");
|
puts("test kthread_add()");
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user