summaryrefslogtreecommitdiff
path: root/nuttx/sched
diff options
context:
space:
mode:
Diffstat (limited to 'nuttx/sched')
-rw-r--r--nuttx/sched/init/os_bringup.c10
-rw-r--r--nuttx/sched/init/os_start.c5
-rw-r--r--nuttx/sched/sched/sched_releasetcb.c10
-rw-r--r--nuttx/sched/task/task_create.c25
-rw-r--r--nuttx/sched/task/task_init.c7
-rw-r--r--nuttx/sched/task/task_posixspawn.c2
-rw-r--r--nuttx/sched/task/task_setup.c15
-rw-r--r--nuttx/sched/task/task_spawn.c6
8 files changed, 20 insertions, 60 deletions
diff --git a/nuttx/sched/init/os_bringup.c b/nuttx/sched/init/os_bringup.c
index b084bd1b0..f85a33ef1 100644
--- a/nuttx/sched/init/os_bringup.c
+++ b/nuttx/sched/init/os_bringup.c
@@ -182,7 +182,7 @@ static inline void os_pgworker(void)
svdbg("Starting paging thread\n");
- g_pgworker = KERNEL_THREAD("pgfill", CONFIG_PAGING_DEFPRIO,
+ g_pgworker = kernel_thread("pgfill", CONFIG_PAGING_DEFPRIO,
CONFIG_PAGING_STACKSIZE,
(main_t)pg_worker, (FAR char * const *)NULL);
DEBUGASSERT(g_pgworker > 0);
@@ -221,7 +221,7 @@ static inline void os_workqueues(void)
svdbg("Starting kernel worker thread\n");
#endif
- g_work[HPWORK].pid = KERNEL_THREAD(HPWORKNAME, CONFIG_SCHED_WORKPRIORITY,
+ g_work[HPWORK].pid = kernel_thread(HPWORKNAME, CONFIG_SCHED_WORKPRIORITY,
CONFIG_SCHED_WORKSTACKSIZE,
(main_t)work_hpthread,
(FAR char * const *)NULL);
@@ -235,7 +235,7 @@ static inline void os_workqueues(void)
svdbg("Starting low-priority kernel worker thread\n");
- g_work[LPWORK].pid = KERNEL_THREAD(LPWORKNAME, CONFIG_SCHED_LPWORKPRIORITY,
+ g_work[LPWORK].pid = kernel_thread(LPWORKNAME, CONFIG_SCHED_LPWORKPRIORITY,
CONFIG_SCHED_LPWORKSTACKSIZE,
(main_t)work_lpthread,
(FAR char * const *)NULL);
@@ -288,11 +288,11 @@ static inline void os_init_thread(void)
#ifdef CONFIG_BUILD_PROTECTED
DEBUGASSERT(USERSPACE->us_entrypoint != NULL);
- taskid = TASK_CREATE("init", SCHED_PRIORITY_DEFAULT,
+ taskid = task_create("init", SCHED_PRIORITY_DEFAULT,
CONFIG_USERMAIN_STACKSIZE, USERSPACE->us_entrypoint,
(FAR char * const *)NULL);
#else
- taskid = TASK_CREATE("init", SCHED_PRIORITY_DEFAULT,
+ taskid = task_create("init", SCHED_PRIORITY_DEFAULT,
CONFIG_USERMAIN_STACKSIZE,
(main_t)CONFIG_USER_ENTRYPOINT,
(FAR char * const *)NULL);
diff --git a/nuttx/sched/init/os_start.c b/nuttx/sched/init/os_start.c
index 4f6da4ea5..cf83b93b9 100644
--- a/nuttx/sched/init/os_start.c
+++ b/nuttx/sched/init/os_start.c
@@ -311,14 +311,13 @@ void os_start(void)
* and there is no support that yet.
*/
-#if defined(CONFIG_CUSTOM_STACK) || (!defined(CONFIG_BUILD_PROTECTED) && \
- !defined(CONFIG_BUILD_KERNEL))
+#if !defined(CONFIG_BUILD_PROTECTED) && !defined(CONFIG_BUILD_KERNEL)
#if CONFIG_TASK_NAME_SIZE > 0
g_idletcb.argv[0] = g_idletcb.cmn.name;
#else
g_idletcb.argv[0] = (char*)g_idlename;
#endif /* CONFIG_TASK_NAME_SIZE */
-#endif /* CONFIG_CUSTOM_STACK || (!CONFIG_BUILD_PROTECTED && !CONFIG_BUILD_KERNEL) */
+#endif /* !CONFIG_BUILD_PROTECTED && !CONFIG_BUILD_KERNEL */
/* Then add the idle task's TCB to the head of the ready to run list */
diff --git a/nuttx/sched/sched/sched_releasetcb.c b/nuttx/sched/sched/sched_releasetcb.c
index ecfaf72ce..724e9e409 100644
--- a/nuttx/sched/sched/sched_releasetcb.c
+++ b/nuttx/sched/sched/sched_releasetcb.c
@@ -111,8 +111,7 @@ static void sched_releasepid(pid_t pid)
int sched_releasetcb(FAR struct tcb_s *tcb, uint8_t ttype)
{
int ret = OK;
-#if defined(CONFIG_CUSTOM_STACK) || (!defined(CONFIG_BUILD_PROTECTED) && \
- !defined(CONFIG_BUILD_KERNEL))
+#if !defined(CONFIG_BUILD_PROTECTED) && !defined(CONFIG_BUILD_KERNEL)
int i;
#endif
@@ -146,12 +145,10 @@ int sched_releasetcb(FAR struct tcb_s *tcb, uint8_t ttype)
/* Delete the thread's stack if one has been allocated */
-#ifndef CONFIG_CUSTOM_STACK
if (tcb->stack_alloc_ptr)
{
up_release_stack(tcb, ttype);
}
-#endif
/* Delete the tasks's allocated DSpace region (external modules only) */
@@ -169,8 +166,7 @@ int sched_releasetcb(FAR struct tcb_s *tcb, uint8_t ttype)
}
#endif
-#if defined(CONFIG_CUSTOM_STACK) || (!defined(CONFIG_BUILD_PROTECTED) && \
- !defined(CONFIG_BUILD_KERNEL))
+#if !defined(CONFIG_BUILD_PROTECTED) && !defined(CONFIG_BUILD_KERNEL)
/* Release command line arguments that were allocated for task
* start/re-start.
*
@@ -190,7 +186,7 @@ int sched_releasetcb(FAR struct tcb_s *tcb, uint8_t ttype)
}
}
-#endif /* CONFIG_CUSTOM_STACK || (!CONFIG_BUILD_PROTECTED && !CONFIG_BUILD_KERNEL) */
+#endif /* !CONFIG_BUILD_PROTECTED && !CONFIG_BUILD_KERNEL */
/* Release this thread's reference to the address environment */
diff --git a/nuttx/sched/task/task_create.c b/nuttx/sched/task/task_create.c
index ca0ed892f..4e7d656f7 100644
--- a/nuttx/sched/task/task_create.c
+++ b/nuttx/sched/task/task_create.c
@@ -100,13 +100,8 @@
*
****************************************************************************/
-#ifndef CONFIG_CUSTOM_STACK
static int thread_create(FAR const char *name, uint8_t ttype, int priority,
int stack_size, main_t entry, FAR char * const argv[])
-#else
-static int thread_create(FAR const char *name, uint8_t ttype, int priority,
- main_t entry, FAR char * const argv[])
-#endif
{
FAR struct task_tcb_s *tcb;
pid_t pid;
@@ -147,14 +142,12 @@ static int thread_create(FAR const char *name, uint8_t ttype, int priority,
/* Allocate the stack for the TCB */
-#ifndef CONFIG_CUSTOM_STACK
ret = up_create_stack((FAR struct tcb_s *)tcb, stack_size, ttype);
if (ret < OK)
{
errcode = -ret;
goto errout_with_tcb;
}
-#endif
/* Initialize the task control block */
@@ -245,19 +238,10 @@ errout:
*
****************************************************************************/
-#ifndef CONFIG_CUSTOM_STACK
int task_create(FAR const char *name, int priority,
int stack_size, main_t entry, FAR char * const argv[])
-#else
-int task_create(FAR const char *name, int priority,
- main_t entry, FAR char * const argv[])
-#endif
{
-#ifndef CONFIG_CUSTOM_STACK
return thread_create(name, TCB_FLAG_TTYPE_TASK, priority, stack_size, entry, argv);
-#else
- return thread_create(name, TCB_FLAG_TTYPE_TASK, priority, entry, argv);
-#endif
}
/****************************************************************************
@@ -276,18 +260,9 @@ int task_create(FAR const char *name, int priority,
*
****************************************************************************/
-#ifndef CONFIG_CUSTOM_STACK
int kernel_thread(FAR const char *name, int priority,
int stack_size, main_t entry, FAR char * const argv[])
-#else
-int kernel_thread(FAR const char *name, int priority,
- main_t entry, FAR char * const argv[])
-#endif
{
-#ifndef CONFIG_CUSTOM_STACK
return thread_create(name, TCB_FLAG_TTYPE_KERNEL, priority, stack_size, entry, argv);
-#else
- return thread_create(name, TCB_FLAG_TTYPE_KERNEL, priority, entry, argv);
-#endif
}
diff --git a/nuttx/sched/task/task_init.c b/nuttx/sched/task/task_init.c
index f1fa91edf..6ad31e7f2 100644
--- a/nuttx/sched/task/task_init.c
+++ b/nuttx/sched/task/task_init.c
@@ -112,14 +112,9 @@
*
****************************************************************************/
-#ifndef CONFIG_CUSTOM_STACK
int task_init(FAR struct tcb_s *tcb, const char *name, int priority,
FAR uint32_t *stack, uint32_t stack_size,
main_t entry, FAR char * const argv[])
-#else
-int task_init(FAR struct tcb_s *tcb, const char *name, int priority,
- main_t entry, FAR char * const argv[])
-#endif
{
FAR struct task_tcb_s *ttcb = (FAR struct task_tcb_s *)tcb;
int errcode;
@@ -156,9 +151,7 @@ int task_init(FAR struct tcb_s *tcb, const char *name, int priority,
/* Configure the user provided stack region */
-#ifndef CONFIG_CUSTOM_STACK
up_use_stack(tcb, stack, stack_size);
-#endif
/* Initialize the task control block */
diff --git a/nuttx/sched/task/task_posixspawn.c b/nuttx/sched/task/task_posixspawn.c
index 5a831b95a..87d868093 100644
--- a/nuttx/sched/task/task_posixspawn.c
+++ b/nuttx/sched/task/task_posixspawn.c
@@ -424,7 +424,7 @@ int posix_spawn(FAR pid_t *pid, FAR const char *path,
* task.
*/
- proxy = TASK_CREATE("posix_spawn_proxy", param.sched_priority,
+ proxy = task_create("posix_spawn_proxy", param.sched_priority,
CONFIG_POSIX_SPAWN_PROXY_STACKSIZE,
(main_t)posix_spawn_proxy,
(FAR char * const *)NULL);
diff --git a/nuttx/sched/task/task_setup.c b/nuttx/sched/task/task_setup.c
index a0eaa9af6..9ef1b0d39 100644
--- a/nuttx/sched/task/task_setup.c
+++ b/nuttx/sched/task/task_setup.c
@@ -448,8 +448,7 @@ static void task_namesetup(FAR struct task_tcb_s *tcb, FAR const char *name)
*
****************************************************************************/
-#if defined(CONFIG_CUSTOM_STACK) || (!defined(CONFIG_BUILD_PROTECTED) && \
- !defined(CONFIG_BUILD_KERNEL))
+#if !defined(CONFIG_BUILD_PROTECTED) && !defined(CONFIG_BUILD_KERNEL)
static int task_tcbargsetup(FAR struct task_tcb_s *tcb,
FAR char * const argv[])
{
@@ -489,7 +488,7 @@ static int task_tcbargsetup(FAR struct task_tcb_s *tcb,
return OK;
}
-#endif /* CONFIG_CUSTOM_STACK || (!CONFIG_BUILD_PROTECTED && !CONFIG_BUILD_KERNEL) */
+#endif /* !CONFIG_BUILD_PROTECTED && !CONFIG_BUILD_KERNEL */
/****************************************************************************
* Name: task_stackargsetup
@@ -516,8 +515,7 @@ static int task_tcbargsetup(FAR struct task_tcb_s *tcb,
*
****************************************************************************/
-#if !defined(CONFIG_CUSTOM_STACK) && (defined(CONFIG_BUILD_PROTECTED) || \
- defined(CONFIG_BUILD_KERNEL))
+#if defined(CONFIG_BUILD_PROTECTED) || defined(CONFIG_BUILD_KERNEL)
static int task_stackargsetup(FAR struct task_tcb_s *tcb,
FAR char * const argv[])
{
@@ -619,7 +617,7 @@ static int task_stackargsetup(FAR struct task_tcb_s *tcb,
return OK;
}
-#endif /* !CONFIG_CUSTOM_STACK && (CONFIG_BUILD_PROTECTED || CONFIG_BUILD_KERNEL) */
+#endif /* CONFIG_BUILD_PROTECTED || CONFIG_BUILD_KERNEL */
/****************************************************************************
* Public Functions
@@ -744,8 +742,7 @@ int task_argsetup(FAR struct task_tcb_s *tcb, FAR const char *name,
task_namesetup(tcb, name);
-#if !defined(CONFIG_CUSTOM_STACK) && (defined(CONFIG_BUILD_PROTECTED) || \
- defined(CONFIG_BUILD_KERNEL))
+#if defined(CONFIG_BUILD_PROTECTED) || defined(CONFIG_BUILD_KERNEL)
/* In the kernel build case, the argv[] array and all strings are copied
* to the task's stack. This is done because the TCB (and kernel allocated
* strings) are only accessible in kernel-mode. Data on the stack, on the
@@ -762,7 +759,7 @@ int task_argsetup(FAR struct task_tcb_s *tcb, FAR const char *name,
ret = task_tcbargsetup(tcb, argv);
-#endif /* !CONFIG_CUSTOM_STACK && (CONFIG_BUILD_PROTECTED || CONFIG_BUILD_KERNEL) */
+#endif /* CONFIG_BUILD_PROTECTED || CONFIG_BUILD_KERNEL */
return ret;
}
diff --git a/nuttx/sched/task/task_spawn.c b/nuttx/sched/task/task_spawn.c
index 2f556120f..2b09e63bb 100644
--- a/nuttx/sched/task/task_spawn.c
+++ b/nuttx/sched/task/task_spawn.c
@@ -149,11 +149,11 @@ static int task_spawn_exec(FAR pid_t *pidp, FAR const char *name,
/* Start the task */
- pid = TASK_CREATE(name, priority, stacksize, entry, argv);
+ pid = task_create(name, priority, stacksize, entry, argv);
if (pid < 0)
{
ret = get_errno();
- sdbg("ERROR: TASK_CREATE failed: %d\n", ret);
+ sdbg("ERROR: task_create failed: %d\n", ret);
goto errout;
}
@@ -416,7 +416,7 @@ int task_spawn(FAR pid_t *pid, FAR const char *name, main_t entry,
* task.
*/
- proxy = TASK_CREATE("task_spawn_proxy", param.sched_priority,
+ proxy = task_create("task_spawn_proxy", param.sched_priority,
CONFIG_POSIX_SPAWN_PROXY_STACKSIZE,
(main_t)task_spawn_proxy,
(FAR char * const*)NULL);