forked from nuttx/nuttx-update
Move helper macro into sched.h
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3430 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
7b69f1af91
commit
c5ec593bc4
2 changed files with 29 additions and 19 deletions
|
@ -1,7 +1,7 @@
|
|||
/********************************************************************************
|
||||
* include/sched.h
|
||||
*
|
||||
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -50,7 +50,7 @@
|
|||
* Pre-processor Definitions
|
||||
********************************************************************************/
|
||||
|
||||
/* Task Management Definitins ***************************************************/
|
||||
/* Task Management Definitions **************************************************/
|
||||
|
||||
/* POSIX-like scheduling policies */
|
||||
|
||||
|
@ -63,6 +63,21 @@
|
|||
|
||||
#define PTHREAD_KEYS_MAX CONFIG_NPTHREAD_KEYS
|
||||
|
||||
/* Non-standard Helper **********************************************************/
|
||||
/* One processor family supported by NuttX has a single, fixed hardware stack.
|
||||
* That is the 8051 family. So for that family only, there is a variant form
|
||||
* of task_create() that does not task a stack size of a parameter. The following
|
||||
* helper macro is provided to work around the ugliness of that exception.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_CUSTOM_STACK
|
||||
# define TASK_INIT(t,n,p,m,s,e,a) task_init(t,n,p,m,s,e,a)
|
||||
# define TASK_CREATE(n,p,s,e,a) task_create(n,p,s,e,a)
|
||||
#else
|
||||
# define TASK_INIT(t,n,p,m,s,e,a) task_init(t,n,p,e,a)
|
||||
# define TASK_CREATE(n,p,s,e,a) task_create(n,p,e,a)
|
||||
#endif
|
||||
|
||||
/********************************************************************************
|
||||
* Global Type Definitions
|
||||
********************************************************************************/
|
||||
|
@ -126,8 +141,8 @@ EXTERN int sched_lock(void);
|
|||
EXTERN int sched_unlock(void);
|
||||
EXTERN int32_t sched_lockcount(void);
|
||||
|
||||
/* If instrumentation of the scheduler is enabled, then some
|
||||
* outboard logic must provide the following interfaces.
|
||||
/* If instrumentation of the scheduler is enabled, then some outboard logic
|
||||
* must provide the following interfaces.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_SCHED_INSTRUMENTATION
|
||||
|
@ -149,3 +164,4 @@ EXTERN void sched_note_switch(FAR _TCB *pFromTcb, FAR _TCB *pToTcb);
|
|||
#endif /* __ASSEMBLY__ */
|
||||
|
||||
#endif /* __INCLUDE_SCHED_H */
|
||||
|
||||
|
|
|
@ -62,12 +62,6 @@
|
|||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_CUSTOM_STACK
|
||||
# define START_TASK(n,p,s,e,a) task_create(n,p,s,e,a)
|
||||
#else
|
||||
# define START_TASK(n,p,s,e,a) task_create(n,p,e,a)
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
|
@ -133,9 +127,9 @@ int os_bringup(void)
|
|||
#ifdef CONFIG_PAGING
|
||||
svdbg("Starting paging thread\n");
|
||||
|
||||
g_pgworker = START_TASK("pgfill", CONFIG_PAGING_DEFPRIO,
|
||||
CONFIG_PAGING_STACKSIZE,
|
||||
(main_t)pg_worker, (const char **)NULL);
|
||||
g_pgworker = TASK_CREATE("pgfill", CONFIG_PAGING_DEFPRIO,
|
||||
CONFIG_PAGING_STACKSIZE,
|
||||
(main_t)pg_worker, (const char **)NULL);
|
||||
ASSERT(g_pgworker != ERROR);
|
||||
#endif
|
||||
|
||||
|
@ -144,9 +138,9 @@ int os_bringup(void)
|
|||
#ifdef CONFIG_SCHED_WORKQUEUE
|
||||
svdbg("Starting worker thread\n");
|
||||
|
||||
g_worker = START_TASK("work", CONFIG_SCHED_WORKPRIORITY,
|
||||
CONFIG_SCHED_WORKSTACKSIZE,
|
||||
(main_t)work_thread, (const char **)NULL);
|
||||
g_worker = TASK_CREATE("work", CONFIG_SCHED_WORKPRIORITY,
|
||||
CONFIG_SCHED_WORKSTACKSIZE,
|
||||
(main_t)work_thread, (const char **)NULL);
|
||||
ASSERT(g_worker != ERROR);
|
||||
#endif
|
||||
|
||||
|
@ -165,9 +159,9 @@ int os_bringup(void)
|
|||
#else
|
||||
/* Start the default application at user_start() */
|
||||
|
||||
init_taskid = START_TASK("init", SCHED_PRIORITY_DEFAULT,
|
||||
CONFIG_USERMAIN_STACKSIZE,
|
||||
(main_t)user_start, (const char **)NULL);
|
||||
init_taskid = TASK_CREATE("init", SCHED_PRIORITY_DEFAULT,
|
||||
CONFIG_USERMAIN_STACKSIZE,
|
||||
(main_t)user_start, (const char **)NULL);
|
||||
#endif
|
||||
ASSERT(init_taskid != ERROR);
|
||||
return OK;
|
||||
|
|
Loading…
Reference in a new issue