mirror of
https://github.com/apache/nuttx.git
synced 2026-06-04 14:53:47 +08:00
Squashed commit of the following:
sched/init/nx_bringup.c: Fix a naming collision.
sched/init: Rename os_start() to nx_start()
sched/init: Rename os_smp* to nx_smp*
sched/init: Rename os_bringup to nx_bringup
sched/init: rename all internal static functions to begin with nx_ vs os_
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
############################################################################
|
||||
# sched/init/Make.defs
|
||||
#
|
||||
# Copyright (C) 2014 Gregory Nutt. All rights reserved.
|
||||
# Copyright (C) 2014, 2019 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
@@ -33,10 +33,10 @@
|
||||
#
|
||||
############################################################################
|
||||
|
||||
CSRCS += os_start.c os_bringup.c
|
||||
CSRCS += nx_start.c nx_bringup.c
|
||||
|
||||
ifeq ($(CONFIG_SMP),y)
|
||||
CSRCS += os_smpstart.c
|
||||
CSRCS += nx_smpstart.c
|
||||
endif
|
||||
|
||||
# Include init build support
|
||||
|
||||
+12
-12
@@ -47,7 +47,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: os_start
|
||||
* Name: nx_start
|
||||
*
|
||||
* Description:
|
||||
* This function is called to initialize the operating system and to spawn
|
||||
@@ -62,10 +62,10 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void os_start(void);
|
||||
void nx_start(void);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: os_smp_start
|
||||
* Name: nx_smp_start
|
||||
*
|
||||
* Description:
|
||||
* In an SMP configution, only one CPU is initially active (CPU 0). System
|
||||
@@ -82,15 +82,15 @@ void os_start(void);
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
int os_smp_start(void);
|
||||
int nx_smp_start(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: os_idle_trampoline
|
||||
* Name: nx_idle_trampoline
|
||||
*
|
||||
* Description:
|
||||
* This is the common IDLE task for CPUs 1 through (CONFIG_SMP_NCPUS-1).
|
||||
* It is equivalent to the CPU 0 IDLE logic in os_start.c
|
||||
* It is equivalent to the CPU 0 IDLE logic in nx_start.c
|
||||
*
|
||||
* Input Parameters:
|
||||
* Standard task arguments.
|
||||
@@ -101,15 +101,15 @@ int os_smp_start(void);
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
void os_idle_trampoline(void);
|
||||
void nx_idle_trampoline(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: os_idle_task
|
||||
* Name: nx_idle_task
|
||||
*
|
||||
* Description:
|
||||
* This is the common IDLE task for CPUs 1 through (CONFIG_SMP_NCPUS-1).
|
||||
* It is equivalent to the CPU 0 IDLE logic in os_start.c
|
||||
* It is equivalent to the CPU 0 IDLE logic in nx_start.c
|
||||
*
|
||||
* Input Parameters:
|
||||
* Standard task arguments.
|
||||
@@ -120,11 +120,11 @@ void os_idle_trampoline(void);
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
int os_idle_task(int argc, FAR char *argv[]);
|
||||
int nx_idle_task(int argc, FAR char *argv[]);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: os_bringup
|
||||
* Name: nx_bringup
|
||||
*
|
||||
* Description:
|
||||
* Start all initial system tasks. This does the "system bring-up" after
|
||||
@@ -151,6 +151,6 @@ int os_idle_task(int argc, FAR char *argv[]);
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int os_bringup(void);
|
||||
int nx_bringup(void);
|
||||
|
||||
#endif /* __SCHED_INIT_INIT_H */
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* sched/init/os_bringup.c
|
||||
* sched/init/nx_bringup.c
|
||||
*
|
||||
* Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2011-2012, 2019 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* With extensions by:
|
||||
@@ -135,7 +135,7 @@ extern const int CONFIG_INIT_NEXPORTS;
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: os_pgworker
|
||||
* Name: nx_pgworker
|
||||
*
|
||||
* Description:
|
||||
* Start the page fill worker kernel thread that will resolve page faults.
|
||||
@@ -151,7 +151,7 @@ extern const int CONFIG_INIT_NEXPORTS;
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_PAGING
|
||||
static inline void os_pgworker(void)
|
||||
static inline void nx_pgworker(void)
|
||||
{
|
||||
/* Start the page fill worker kernel thread that will resolve page faults.
|
||||
* This should always be the first thread started because it may have to
|
||||
@@ -167,12 +167,12 @@ static inline void os_pgworker(void)
|
||||
}
|
||||
|
||||
#else /* CONFIG_PAGING */
|
||||
# define os_pgworker()
|
||||
# define nx_pgworker()
|
||||
|
||||
#endif /* CONFIG_PAGING */
|
||||
|
||||
/****************************************************************************
|
||||
* Name: os_workqueues
|
||||
* Name: nx_workqueues
|
||||
*
|
||||
* Description:
|
||||
* Start the worker threads that service the work queues.
|
||||
@@ -186,7 +186,7 @@ static inline void os_pgworker(void)
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_SCHED_WORKQUEUE
|
||||
static inline void os_workqueues(void)
|
||||
static inline void nx_workqueues(void)
|
||||
{
|
||||
#ifdef CONFIG_LIB_USRWORK
|
||||
pid_t pid;
|
||||
@@ -221,12 +221,12 @@ static inline void os_workqueues(void)
|
||||
}
|
||||
|
||||
#else /* CONFIG_SCHED_WORKQUEUE */
|
||||
# define os_workqueues()
|
||||
# define nx_workqueues()
|
||||
|
||||
#endif /* CONFIG_SCHED_WORKQUEUE */
|
||||
|
||||
/****************************************************************************
|
||||
* Name: os_start_application
|
||||
* Name: nx_start_application
|
||||
*
|
||||
* Description:
|
||||
* Execute the board initialization function (if so configured) and start
|
||||
@@ -241,7 +241,7 @@ static inline void os_workqueues(void)
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_INIT_ENTRYPOINT)
|
||||
static inline void os_do_appstart(void)
|
||||
static inline void nx_start_application(void)
|
||||
{
|
||||
int pid;
|
||||
|
||||
@@ -277,7 +277,7 @@ static inline void os_do_appstart(void)
|
||||
}
|
||||
|
||||
#elif defined(CONFIG_INIT_FILEPATH)
|
||||
static inline void os_do_appstart(void)
|
||||
static inline void nx_start_application(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
@@ -313,7 +313,7 @@ static inline void os_do_appstart(void)
|
||||
}
|
||||
|
||||
#elif defined(CONFIG_INIT_NONE)
|
||||
# define os_do_appstart()
|
||||
# define nx_start_application()
|
||||
|
||||
#else
|
||||
# error "Cannot start initialization thread"
|
||||
@@ -321,7 +321,7 @@ static inline void os_do_appstart(void)
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: os_start_task
|
||||
* Name: nx_start_task
|
||||
*
|
||||
* Description:
|
||||
* This is the framework for a short duration worker thread. It off-loads
|
||||
@@ -337,17 +337,17 @@ static inline void os_do_appstart(void)
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_BOARD_INITTHREAD
|
||||
static int os_start_task(int argc, FAR char **argv)
|
||||
static int nx_start_task(int argc, FAR char **argv)
|
||||
{
|
||||
/* Do the board/application initialization and exit */
|
||||
|
||||
os_do_appstart();
|
||||
nx_start_application();
|
||||
return OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: os_start_application
|
||||
* Name: nx_create_initthread
|
||||
*
|
||||
* Description:
|
||||
* Execute the board initialization function (if so configured) and start
|
||||
@@ -363,7 +363,7 @@ static int os_start_task(int argc, FAR char **argv)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static inline void os_start_application(void)
|
||||
static inline void nx_create_initthread(void)
|
||||
{
|
||||
#ifdef CONFIG_BOARD_INITTHREAD
|
||||
int pid;
|
||||
@@ -374,13 +374,13 @@ static inline void os_start_application(void)
|
||||
|
||||
pid = kthread_create("AppBringUp", CONFIG_BOARD_INITTHREAD_PRIORITY,
|
||||
CONFIG_BOARD_INITTHREAD_STACKSIZE,
|
||||
(main_t)os_start_task, (FAR char * const *)NULL);
|
||||
(main_t)nx_start_task, (FAR char * const *)NULL);
|
||||
DEBUGASSERT(pid > 0);
|
||||
UNUSED(pid);
|
||||
#else
|
||||
/* Do the board/application initialization on this thread of execution. */
|
||||
|
||||
os_do_appstart();
|
||||
nx_start_application();
|
||||
|
||||
#endif
|
||||
}
|
||||
@@ -390,7 +390,7 @@ static inline void os_start_application(void)
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: os_bringup
|
||||
* Name: nx_bringup
|
||||
*
|
||||
* Description:
|
||||
* Start all initial system tasks. This does the "system bring-up" after
|
||||
@@ -423,21 +423,23 @@ static inline void os_start_application(void)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int os_bringup(void)
|
||||
int nx_bringup(void)
|
||||
{
|
||||
#ifndef CONFIG_DISABLE_ENVIRON
|
||||
/* Setup up the initial environment for the idle task. At present, this
|
||||
* may consist of only the initial PATH variable. The PATH variable is
|
||||
* (probably) not used by the IDLE task. However, the environment
|
||||
* containing the PATH variable will be inherited by all of the threads
|
||||
* created by the IDLE task.
|
||||
* may consist of only the initial PATH variable and/or and init library
|
||||
* path variable. These path variables are not used by the IDLE task.
|
||||
* However, the environment containing the PATH variable will be inherited
|
||||
* by all of the threads created by the IDLE task.
|
||||
*/
|
||||
|
||||
#if !defined(CONFIG_DISABLE_ENVIRON) && defined(CONFIG_PATH_INITIAL)
|
||||
#ifdef CONFIG_PATH_INITIAL
|
||||
(void)setenv("PATH", CONFIG_PATH_INITIAL, 1);
|
||||
#endif
|
||||
|
||||
#if !defined(CONFIG_DISABLE_ENVIRON) && defined(CONFIG_LDPATH_INITIAL)
|
||||
#ifdef CONFIG_LDPATH_INITIAL
|
||||
(void)setenv("LD_LIBRARY_PATH", CONFIG_LDPATH_INITIAL, 1);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Start the page fill worker kernel thread that will resolve page faults.
|
||||
@@ -445,24 +447,25 @@ int os_bringup(void)
|
||||
* resolve page faults in other threads
|
||||
*/
|
||||
|
||||
os_pgworker();
|
||||
nx_pgworker();
|
||||
|
||||
/* Start the worker thread that will serve as the device driver "bottom-
|
||||
* half" and will perform misc garbage clean-up.
|
||||
*/
|
||||
|
||||
os_workqueues();
|
||||
nx_workqueues();
|
||||
|
||||
/* Once the operating system has been initialized, the system must be
|
||||
* started by spawning the user initialization thread of execution. This
|
||||
* will be the first user-mode thread.
|
||||
*/
|
||||
|
||||
os_start_application();
|
||||
nx_create_initthread();
|
||||
|
||||
#if !defined(CONFIG_DISABLE_ENVIRON) && (defined(CONFIG_PATH_INITIAL) || \
|
||||
defined(CONFIG_LDPATH_INITIAL))
|
||||
/* We an save a few bytes by discarding the IDLE thread's environment. */
|
||||
|
||||
#if !defined(CONFIG_DISABLE_ENVIRON) && (defined(CONFIG_PATH_INITIAL) || defined(CONFIG_LDPATH_INITIAL))
|
||||
(void)clearenv();
|
||||
#endif
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* sched/init/os_smpstart.c
|
||||
* sched/init/nx_smpstart.c
|
||||
*
|
||||
* Copyright (C) 2016 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2016, 2019 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -59,7 +59,7 @@
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
|
||||
struct os_tcballoc_s
|
||||
struct nx_tcballoc_s
|
||||
{
|
||||
struct task_tcb_s tcb; /* IDLE task TCB */
|
||||
FAR char *idleargv[2]; /* Argument list */
|
||||
@@ -78,7 +78,7 @@ static const char g_idlename[] = "CPUn Idle"
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: os_idle_trampoline
|
||||
* Name: nx_idle_trampoline
|
||||
*
|
||||
* Description:
|
||||
* This is the common start-up logic for the IDLE task for CPUs 1 through
|
||||
@@ -95,7 +95,7 @@ static const char g_idlename[] = "CPUn Idle"
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void os_idle_trampoline(void)
|
||||
void nx_idle_trampoline(void)
|
||||
{
|
||||
#ifdef CONFIG_SCHED_INSTRUMENTATION
|
||||
FAR struct tcb_s *tcb = this_task();
|
||||
@@ -107,7 +107,7 @@ void os_idle_trampoline(void)
|
||||
|
||||
/* Then transfer control to the IDLE task */
|
||||
|
||||
(void)os_idle_task(0, NULL);
|
||||
(void)nx_idle_task(0, NULL);
|
||||
|
||||
/* The IDLE task should never return */
|
||||
|
||||
@@ -115,11 +115,11 @@ void os_idle_trampoline(void)
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: os_idle_task
|
||||
* Name: nx_idle_task
|
||||
*
|
||||
* Description:
|
||||
* This is the common IDLE task for CPUs 1 through (CONFIG_SMP_NCPUS-1).
|
||||
* It is equivalent to the CPU 0 IDLE logic in os_start.c
|
||||
* It is equivalent to the CPU 0 IDLE logic in nx_start.c
|
||||
*
|
||||
* Input Parameters:
|
||||
* Standard task arguments.
|
||||
@@ -129,7 +129,7 @@ void os_idle_trampoline(void)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int os_idle_task(int argc, FAR char *argv[])
|
||||
int nx_idle_task(int argc, FAR char *argv[])
|
||||
{
|
||||
/* Enter the IDLE loop */
|
||||
|
||||
@@ -170,7 +170,7 @@ int os_idle_task(int argc, FAR char *argv[])
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: os_smp_start
|
||||
* Name: nx_smp_start
|
||||
*
|
||||
* Description:
|
||||
* In an SMP configuration, only one CPU is initially active (CPU 0).
|
||||
@@ -191,7 +191,7 @@ int os_idle_task(int argc, FAR char *argv[])
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int os_smp_start(void)
|
||||
int nx_smp_start(void)
|
||||
{
|
||||
int ret;
|
||||
int cpu;
|
||||
@@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* sched/init/os_start.c
|
||||
* sched/init/nx_start.c
|
||||
*
|
||||
* Copyright (C) 2007-2014, 2016, 2018 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
@@ -331,7 +331,7 @@ const struct tasklist_s g_tasklisttable[NUM_TASK_STATES] =
|
||||
* hardware resources may not yet be available to the kernel logic.
|
||||
*/
|
||||
|
||||
uint8_t g_os_initstate; /* See enum os_initstate_e */
|
||||
uint8_t g_nx_initstate; /* See enum nx_initstate_e */
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
@@ -376,7 +376,7 @@ static FAR char *g_idleargv[1][2];
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: os_start
|
||||
* Name: nx_start
|
||||
*
|
||||
* Description:
|
||||
* This function is called to initialize the operating system and to spawn
|
||||
@@ -391,7 +391,7 @@ static FAR char *g_idleargv[1][2];
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void os_start(void)
|
||||
void nx_start(void)
|
||||
{
|
||||
#ifdef CONFIG_SMP
|
||||
int cpu;
|
||||
@@ -404,7 +404,7 @@ void os_start(void)
|
||||
|
||||
/* Boot up is complete */
|
||||
|
||||
g_os_initstate = OSINIT_BOOT;
|
||||
g_nx_initstate = OSINIT_BOOT;
|
||||
|
||||
/* Initialize RTOS Data ***************************************************/
|
||||
/* Initialize all task lists */
|
||||
@@ -485,14 +485,14 @@ void os_start(void)
|
||||
#ifdef CONFIG_SMP
|
||||
if (cpu > 0)
|
||||
{
|
||||
g_idletcb[cpu].cmn.start = os_idle_trampoline;
|
||||
g_idletcb[cpu].cmn.entry.main = os_idle_task;
|
||||
g_idletcb[cpu].cmn.start = nx_idle_trampoline;
|
||||
g_idletcb[cpu].cmn.entry.main = nx_idle_task;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
g_idletcb[cpu].cmn.start = (start_t)os_start;
|
||||
g_idletcb[cpu].cmn.entry.main = (main_t)os_start;
|
||||
g_idletcb[cpu].cmn.start = (start_t)nx_start;
|
||||
g_idletcb[cpu].cmn.entry.main = (main_t)nx_start;
|
||||
}
|
||||
|
||||
/* Set the task flags to indicate that this is a kernel thread and, if
|
||||
@@ -568,7 +568,7 @@ void os_start(void)
|
||||
|
||||
/* Task lists are initialized */
|
||||
|
||||
g_os_initstate = OSINIT_TASKLISTS;
|
||||
g_nx_initstate = OSINIT_TASKLISTS;
|
||||
|
||||
/* Initialize RTOS facilities *********************************************/
|
||||
/* Initialize the semaphore facility. This has to be done very early
|
||||
@@ -617,7 +617,7 @@ void os_start(void)
|
||||
|
||||
/* The memory manager is available */
|
||||
|
||||
g_os_initstate = OSINIT_MEMORY;
|
||||
g_nx_initstate = OSINIT_MEMORY;
|
||||
|
||||
#if defined(CONFIG_SCHED_HAVE_PARENT) && defined(CONFIG_SCHED_CHILD_STATUS)
|
||||
/* Initialize tasking data structures */
|
||||
@@ -721,7 +721,7 @@ void os_start(void)
|
||||
|
||||
/* Hardware resources are available */
|
||||
|
||||
g_os_initstate = OSINIT_HARDWARE;
|
||||
g_nx_initstate = OSINIT_HARDWARE;
|
||||
|
||||
#ifdef CONFIG_MM_SHM
|
||||
/* Initialize shared memory support */
|
||||
@@ -811,18 +811,18 @@ void os_start(void)
|
||||
|
||||
/* Then start the other CPUs */
|
||||
|
||||
DEBUGVERIFY(os_smp_start());
|
||||
DEBUGVERIFY(nx_smp_start());
|
||||
|
||||
#endif /* CONFIG_SMP */
|
||||
|
||||
/* Bring Up the System ****************************************************/
|
||||
/* The OS is fully initialized and we are beginning multi-tasking */
|
||||
|
||||
g_os_initstate = OSINIT_OSREADY;
|
||||
g_nx_initstate = OSINIT_OSREADY;
|
||||
|
||||
/* Create initial tasks and bring-up the system */
|
||||
|
||||
DEBUGVERIFY(os_bringup());
|
||||
DEBUGVERIFY(nx_bringup());
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
/* Let other threads have access to the memory manager */
|
||||
Reference in New Issue
Block a user