diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2007-12-31 23:52:53 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2007-12-31 23:52:53 +0000 |
commit | 768b31742994a7270a11f6b0393329b3404b2af0 (patch) | |
tree | 07225e24cd679bcd042f722dc39514fa90ba541c /nuttx/examples/nsh | |
parent | e56f12fd3dbddb72e0a3996a1247d27bad227cd5 (diff) | |
download | px4-nuttx-768b31742994a7270a11f6b0393329b3404b2af0.tar.gz px4-nuttx-768b31742994a7270a11f6b0393329b3404b2af0.tar.bz2 px4-nuttx-768b31742994a7270a11f6b0393329b3404b2af0.zip |
Debug NSH on z80sim
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@474 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/examples/nsh')
-rw-r--r-- | nuttx/examples/nsh/nsh.h | 10 | ||||
-rw-r--r-- | nuttx/examples/nsh/nsh_fscmds.c | 14 | ||||
-rw-r--r-- | nuttx/examples/nsh/nsh_main.c | 8 | ||||
-rw-r--r-- | nuttx/examples/nsh/nsh_proccmds.c | 34 |
4 files changed, 45 insertions, 21 deletions
diff --git a/nuttx/examples/nsh/nsh.h b/nuttx/examples/nsh/nsh.h index 39514656a..659a59d17 100644 --- a/nuttx/examples/nsh/nsh.h +++ b/nuttx/examples/nsh/nsh.h @@ -1,7 +1,7 @@ /**************************************************************************** - * nsh.h + * examples/nsh/nsh.h * - * Copyright (C) 2007 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -14,7 +14,7 @@ * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. - * 3. Neither the name Gregory Nutt nor the names of its contributors may be + * 3. Neither the name NuttX nor the names of its contributors may be * used to endorse or promote products derived from this software * without specific prior written permission. * @@ -118,8 +118,10 @@ extern void cmd_ls(FAR void *handle, int argc, char **argv); #endif #if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 extern void cmd_mkdir(FAR void *handle, int argc, char **argv); +#ifdef CONFIG_FS_FAT /* Need at least one filesytem in configuration */ extern void cmd_mount(FAR void *handle, int argc, char **argv); #endif +#endif extern void cmd_ps(FAR void *handle, int argc, char **argv); #ifndef CONFIG_DISABLE_ENVIRON extern void cmd_set(FAR void *handle, int argc, char **argv); @@ -127,8 +129,10 @@ extern void cmd_set(FAR void *handle, int argc, char **argv); #if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 extern void cmd_rm(FAR void *handle, int argc, char **argv); extern void cmd_rmdir(FAR void *handle, int argc, char **argv); +#ifdef CONFIG_FS_FAT /* Need at least one filesytem in configuration */ extern void cmd_umount(FAR void *handle, int argc, char **argv); #endif +#endif #ifndef CONFIG_DISABLE_ENVIRON extern void cmd_unset(FAR void *handle, int argc, char **argv); #endif diff --git a/nuttx/examples/nsh/nsh_fscmds.c b/nuttx/examples/nsh/nsh_fscmds.c index 6f7a38a50..d5dc1c947 100644 --- a/nuttx/examples/nsh/nsh_fscmds.c +++ b/nuttx/examples/nsh/nsh_fscmds.c @@ -1,7 +1,7 @@ /**************************************************************************** - * nsh_fscmds.c + * examples/nsh/nsh_fscmds.c * - * Copyright (C) 2007 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -14,7 +14,7 @@ * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. - * 3. Neither the name Gregory Nutt nor the names of its contributors may be + * 3. Neither the name NuttX nor the names of its contributors may be * used to endorse or promote products derived from this software * without specific prior written permission. * @@ -45,7 +45,9 @@ # include <fcntl.h> #endif #if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 -# include <sys/mount.h> +# ifdef CONFIG_FS_FAT /* Need at least one filesytem in configuration */ +# include <sys/mount.h> +# endif #endif #include <stdio.h> @@ -636,6 +638,7 @@ void cmd_mkdir(FAR void *handle, int argc, char **argv) ****************************************************************************/ #if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 +#ifdef CONFIG_FS_FAT /* Need at least one filesytem in configuration */ void cmd_mount(FAR void *handle, int argc, char **argv) { char *filesystem = 0; @@ -684,6 +687,7 @@ void cmd_mount(FAR void *handle, int argc, char **argv) } } #endif +#endif /**************************************************************************** * Name: cmd_rm @@ -718,6 +722,7 @@ void cmd_rmdir(FAR void *handle, int argc, char **argv) ****************************************************************************/ #if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 +#ifdef CONFIG_FS_FAT /* Need at least one filesytem in configuration */ void cmd_umount(FAR void *handle, int argc, char **argv) { /* Perform the umount */ @@ -728,3 +733,4 @@ void cmd_umount(FAR void *handle, int argc, char **argv) } } #endif +#endif diff --git a/nuttx/examples/nsh/nsh_main.c b/nuttx/examples/nsh/nsh_main.c index 72bd175a1..3bf3044ea 100644 --- a/nuttx/examples/nsh/nsh_main.c +++ b/nuttx/examples/nsh/nsh_main.c @@ -1,7 +1,7 @@ /**************************************************************************** * nsh_main.c * - * Copyright (C) 2007 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -14,7 +14,7 @@ * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. - * 3. Neither the name Gregory Nutt nor the names of its contributors may be + * 3. Neither the name NuttX nor the names of its contributors may be * used to endorse or promote products derived from this software * without specific prior written permission. * @@ -100,8 +100,10 @@ static const struct cmdmap_s g_cmdmap[] = #endif #if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 { "mkdir", cmd_mkdir, 2, 2, "<path>" }, +#ifdef CONFIG_FS_FAT /* Need at least one filesytem in configuration */ { "mount", cmd_mount, 4, 5, "-t <fstype> <block-device> <dir-path>" }, #endif +#endif { "ps", cmd_ps, 1, 1, NULL }, #ifndef CONFIG_DISABLE_ENVIRON { "set", cmd_set, 3, 3, "<name> <value>" }, @@ -109,8 +111,10 @@ static const struct cmdmap_s g_cmdmap[] = #if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 { "rm", cmd_rm, 2, 2, "<file-path>" }, { "rmdir", cmd_rmdir, 2, 2, "<dir-path>" }, +# ifdef CONFIG_FS_FAT /* Need at least one filesytem in configuration */ { "umount", cmd_umount, 2, 2, "<dir-path>" }, #endif +#endif #ifndef CONFIG_DISABLE_ENVIRON { "unset", cmd_unset, 2, 2, "<name>" }, #endif diff --git a/nuttx/examples/nsh/nsh_proccmds.c b/nuttx/examples/nsh/nsh_proccmds.c index 70a5add0c..d7cf37e1b 100644 --- a/nuttx/examples/nsh/nsh_proccmds.c +++ b/nuttx/examples/nsh/nsh_proccmds.c @@ -1,7 +1,7 @@ /**************************************************************************** - * nsh_proccmds.c + * examples/nsh/nsh_proccmds.c * - * Copyright (C) 2007 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -14,7 +14,7 @@ * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. - * 3. Neither the name Gregory Nutt nor the names of its contributors may be + * 3. Neither the name NuttX nor the names of its contributors may be * used to endorse or promote products derived from this software * without specific prior written permission. * @@ -97,6 +97,9 @@ static void ps_task(FAR _TCB *tcb, FAR void *arg) { boolean needcomma = FALSE; int i; + + /* Show task status */ + nsh_output(arg, "%5d %3d %4s %7s%c%c %8s ", tcb->pid, tcb->sched_priority, tcb->flags & TCB_FLAG_ROUND_ROBIN ? "RR " : "FIFO", @@ -105,18 +108,25 @@ static void ps_task(FAR _TCB *tcb, FAR void *arg) tcb->flags & TCB_FLAG_CANCEL_PENDING ? 'P' : ' ', g_statenames[tcb->task_state]); + /* Show task name and arguments */ + nsh_output(arg, "%s(", tcb->argv[0]); - for (i = 1; i < CONFIG_MAX_TASK_ARGS+1 && tcb->argv[i]; i++) + + /* Special case 1st argument (no comma) */ + + if (tcb->argv[1]) { - if (needcomma) - { - nsh_output(arg, ", %p", tcb->argv[i]); - } - else - { - nsh_output(arg, "%p", tcb->argv[i]); - } + nsh_output(arg, "%p", tcb->argv[1]); + } + + /* Then any additional arguments */ + +#if CONFIG_MAX_TASK_ARGS > 2 + for (i = 2; i <= CONFIG_MAX_TASK_ARGS && tcb->argv[i]; i++) + { + nsh_output(arg, ", %p", tcb->argv[i]); } +#endif nsh_output(arg, ")\n"); } |