apps/-related updates
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3364 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
21757e7349
commit
0aaf5df60d
@ -124,7 +124,7 @@ void up_initialize(void)
|
|||||||
|
|
||||||
up_irqinitialize();
|
up_irqinitialize();
|
||||||
|
|
||||||
/* Initialize the DMA subsystem if the weak function stm32_dmainitialize has been
|
/* Initialize the DMA subsystem if the weak function up_dmainitialize has been
|
||||||
* brought into the build
|
* brought into the build
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -848,6 +848,7 @@ CONFIG_BUILTIN_APP_START=
|
|||||||
# apps from command line. See apps/README for more information.
|
# apps from command line. See apps/README for more information.
|
||||||
#
|
#
|
||||||
CONFIG_EXAMPLES_NSH_BUILTIN_APPS=y
|
CONFIG_EXAMPLES_NSH_BUILTIN_APPS=y
|
||||||
|
CONFIG_SCHED_WAITPID=y
|
||||||
|
|
||||||
#
|
#
|
||||||
########################################################################
|
########################################################################
|
||||||
|
@ -499,23 +499,23 @@ static int nsh_execute(FAR struct nsh_vtbl_s *vtbl, int argc, char *argv[])
|
|||||||
if ((ret = exec_nuttapp(cmd, argv)) < 0)
|
if ((ret = exec_nuttapp(cmd, argv)) < 0)
|
||||||
{
|
{
|
||||||
if (errno != ENOENT)
|
if (errno != ENOENT)
|
||||||
{
|
{
|
||||||
return -errno;
|
return -errno;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Is the background mode or foreground mode desired? */
|
#ifdef CONFIG_SCHED_WAITPID
|
||||||
#if 0
|
if (vtbl->np.np_bg == false)
|
||||||
if (argc > 1 && strcmp(argv[argc-1], "&") == 0)
|
{
|
||||||
{
|
waitpid(ret, NULL, 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
waitpid(ret, );
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
return ret;
|
{
|
||||||
|
nsh_output(vtbl, "%s [%d:%d]\n", cmd, ret, 128); // \todo get priority from new pid?
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -1176,6 +1176,7 @@ int nsh_parse(FAR struct nsh_vtbl_s *vtbl, char *cmdline)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* Check if the output was re-directed using > or >> */
|
/* Check if the output was re-directed using > or >> */
|
||||||
|
|
||||||
if (argc > 2)
|
if (argc > 2)
|
||||||
@ -1229,10 +1230,16 @@ int nsh_parse(FAR struct nsh_vtbl_s *vtbl, char *cmdline)
|
|||||||
nsh_output(vtbl, g_fmttoomanyargs, cmd);
|
nsh_output(vtbl, g_fmttoomanyargs, cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Handle the case where the command is executed in background */
|
/* Handle the case where the command is executed in background.
|
||||||
|
* However is app is to be started as nuttapp new process will
|
||||||
|
* be created anyway, so skip this step. */
|
||||||
|
|
||||||
#ifndef CONFIG_EXAMPLES_NSH_DISABLEBG
|
#ifndef CONFIG_EXAMPLES_NSH_DISABLEBG
|
||||||
if (vtbl->np.np_bg)
|
if (vtbl->np.np_bg
|
||||||
|
#ifdef CONFIG_EXAMPLES_NSH_BUILTIN_APPS
|
||||||
|
&& nuttapp_isavail(argv[0]) < 0
|
||||||
|
#endif
|
||||||
|
)
|
||||||
{
|
{
|
||||||
struct sched_param param;
|
struct sched_param param;
|
||||||
struct nsh_vtbl_s *bkgvtbl;
|
struct nsh_vtbl_s *bkgvtbl;
|
||||||
|
@ -72,6 +72,45 @@ extern "C" {
|
|||||||
#define EXTERN extern
|
#define EXTERN extern
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: check for availability of builtin NuttX application
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Checks for availabiliy of application registerred during compile time.
|
||||||
|
*
|
||||||
|
* Input Parameter:
|
||||||
|
* filename - Name of the linked-in binary to be started.
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* This is an end-user function, so it follows the normal convention:
|
||||||
|
* Returns index of builtin application. If it is not found then it
|
||||||
|
* returns -1 (ERROR) and sets errno appropriately.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
EXTERN int nuttapp_isavail(FAR const char *appname);
|
||||||
|
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: get name of built-in application
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Returns pointer to a name of built-in application pointed by the
|
||||||
|
* index.
|
||||||
|
*
|
||||||
|
* Input Parameter:
|
||||||
|
* index, from 0 and on ...
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* Returns valid pointer pointing to the app name if index is valid.
|
||||||
|
* Otherwise NULL is returned.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
EXTERN const char * nuttapp_getname(int index);
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: execute builtin NuttX application
|
* Name: execute builtin NuttX application
|
||||||
*
|
*
|
||||||
@ -88,33 +127,10 @@ extern "C" {
|
|||||||
* Returns the PID of the exec'ed module. On failure, it.returns
|
* Returns the PID of the exec'ed module. On failure, it.returns
|
||||||
* -1 (ERROR) and sets errno appropriately.
|
* -1 (ERROR) and sets errno appropriately.
|
||||||
*
|
*
|
||||||
* Implementation within drivers/bchsbin
|
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
EXTERN int exec_nuttapp(FAR const char *appname, FAR const char *argv[]);
|
EXTERN int exec_nuttapp(FAR const char *appname, FAR const char *argv[]);
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Name: execute a nutt shell command
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Invokes an application that is either:
|
|
||||||
* - invokes a nsh script or directly invoke:
|
|
||||||
* - system application list, registerred via XXXX
|
|
||||||
* - resides in a file system compiled/linked in NXFLAT model
|
|
||||||
* - resides in a non-executable file-system, which is loaded
|
|
||||||
* into the memory first and then executed.
|
|
||||||
*
|
|
||||||
* Input Parameter:
|
|
||||||
* Sheel command.
|
|
||||||
*
|
|
||||||
* Returned Value:
|
|
||||||
* Zero on success or -1 on error with errno set.
|
|
||||||
*
|
|
||||||
* TODO: move this command to the stdlib.h (?) and
|
|
||||||
* merge implementation with the nuttshell sh command
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
EXTERN FAR int system(const char *command);
|
|
||||||
|
|
||||||
#undef EXTERN
|
#undef EXTERN
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
|
Loading…
Reference in New Issue
Block a user