summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-03-26 01:04:10 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-03-26 01:04:10 +0000
commit54150a8f62d57bd3af5efce1439ba3c29e20f07f (patch)
tree4c791787398c9f76ccd9c8a56e1dd139c2a4e8e4 /apps
parentc62abcf9c8c26757ac5e6fbf0fd9813f1ba087a6 (diff)
downloadnuttx-54150a8f62d57bd3af5efce1439ba3c29e20f07f.tar.gz
nuttx-54150a8f62d57bd3af5efce1439ba3c29e20f07f.tar.bz2
nuttx-54150a8f62d57bd3af5efce1439ba3c29e20f07f.zip
Incorporate changes from Uros Platise
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3419 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'apps')
-rwxr-xr-xapps/ChangeLog.txt43
-rw-r--r--apps/nshlib/nsh_apps.c9
-rw-r--r--apps/vsn/poweroff/poweroff.c12
-rw-r--r--apps/vsn/sdcard/sdcard.c51
4 files changed, 77 insertions, 38 deletions
diff --git a/apps/ChangeLog.txt b/apps/ChangeLog.txt
index 8e3733a95..a6375554c 100755
--- a/apps/ChangeLog.txt
+++ b/apps/ChangeLog.txt
@@ -1,21 +1,22 @@
-5.19 2011-03-12 Gregory Nutt <spudmonkey@racsa.co.cr>
-
- * Initial version of the apps/ directory was released as contributed by
- Uros Platise.
-
-6.0 2011-03-21 Gregory Nutt <spudmonkey@racsa.co.cr>
-
- * README.txt -- README cosmetics
- * hello/ -- hello world minor changes
- * Makefile -- Makefile cosmetics (I am slowly adding the Darjeeling JVM)
- * Make.defs -- New file adds common make definitions for applications.
- * hello/Makefile -- Now uses new Make.defs definitions. Added README.txt.
- * apps/poweroff -- New application to turn off board power.
- * Moved NSH library, netutils, and examples from the nuttx/ directory to
- the apps/ directory
- * Moved exec_nuttapp machinery into the nuttapp/ directory.
-
-6.0 2011-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
-
- * Creation of auto-generated header files now occurs during the context
- build phase.
+5.19 2011-03-12 Gregory Nutt <spudmonkey@racsa.co.cr>
+
+ * Initial version of the apps/ directory was released as contributed by
+ Uros Platise.
+
+6.0 2011-03-21 Gregory Nutt <spudmonkey@racsa.co.cr>
+
+ * README.txt -- README cosmetics
+ * hello/ -- hello world minor changes
+ * Makefile -- Makefile cosmetics (I am slowly adding the Darjeeling JVM)
+ * Make.defs -- New file adds common make definitions for applications.
+ * hello/Makefile -- Now uses new Make.defs definitions. Added README.txt.
+ * apps/poweroff -- New application to turn off board power.
+ * Moved NSH library, netutils, and examples from the nuttx/ directory to
+ the apps/ directory
+ * Moved exec_nuttapp machinery into the nuttapp/ directory.
+
+6.0 2011-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
+
+ * Creation of auto-generated header files now occurs during the context
+ build phase.
+ * Added sdcard insert and eject, nsh command '?' and some code remarks
diff --git a/apps/nshlib/nsh_apps.c b/apps/nshlib/nsh_apps.c
index e792f0781..7ebc1280e 100644
--- a/apps/nshlib/nsh_apps.c
+++ b/apps/nshlib/nsh_apps.c
@@ -107,8 +107,15 @@ int nsh_execapp(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd,
nsh_output(vtbl, "%s ", name);
}
nsh_output(vtbl, "\nand type 'help' for more NSH commands.\n\n");
+
+ /* If the failing command was '?', then do not report an error */
- return err;
+ if (strcmp(cmd, "?") != 0)
+ {
+ return err;
+ }
+
+ return OK;
}
#ifdef CONFIG_SCHED_WAITPID
diff --git a/apps/vsn/poweroff/poweroff.c b/apps/vsn/poweroff/poweroff.c
index f8b56e0d8..ca3f056e8 100644
--- a/apps/vsn/poweroff/poweroff.c
+++ b/apps/vsn/poweroff/poweroff.c
@@ -37,6 +37,18 @@
int poweroff_main(int argc, char *argv[])
{
+/* TODO:
+ * - replace this by sending general system signal to shutdown, where i.e. nsh
+ * must issue down script (it may check whether nsh is running before spawning
+ * a new process with nsh poweroff)
+ * - wait for some time (~0.5 second for VSN), that SDcard is flashed and synced
+ * - call poweroff
+ *
+ * TODO on boot:
+ * - if external key is pressed, do not start the nsh! but wait until it is released
+ * (to get rid of bad mounts of the sdcard etc.) this could be handled in the
+ * button driver immediately on system boot
+ */
board_power_off();
return 0;
}
diff --git a/apps/vsn/sdcard/sdcard.c b/apps/vsn/sdcard/sdcard.c
index bf3e82a07..2f6c44f89 100644
--- a/apps/vsn/sdcard/sdcard.c
+++ b/apps/vsn/sdcard/sdcard.c
@@ -48,13 +48,13 @@
# include <nuttx/mmcsd.h>
#endif
-
+// TODO get the structure out from the slot number
+static FAR struct sdio_dev_s *sdio = NULL;
/* Create device device for the SDIO-based MMC/SD block driver */
int sdcard_start(int slotno)
{
- FAR struct sdio_dev_s *sdio;
int ret;
/* First, get an instance of the SDIO interface */
@@ -89,22 +89,41 @@ int sdcard_start(int slotno)
int sdcard_main(int argc, char *argv[])
{
- int slotno;
+ int slotno = 0;
- if (argc == 3) {
- slotno = atoi(argv[2]);
+ if (argc >= 2) {
- if (!strcmp(argv[1], "start")) {
- return sdcard_start(slotno);
- }
- else if (!strcmp(argv[1], "stop")) {
- }
- else if (!strcmp(argv[1], "insert")) {
- }
- else if (!strcmp(argv[1], "eject")) {
+ /* The 3rd argument is expected to be a slot number, if given */
+ if (argc==3)
+ slotno = atoi(argv[2]);
+
+ /* Commands */
+
+ if (!strcmp(argv[1], "start")) {
+ return sdcard_start(slotno);
+ }
+ else if (!strcmp(argv[1], "stop")) {
+ fprintf(stderr, "Not implemented yet\n");
+ }
+ else if (!strcmp(argv[1], "insert")) {
+ if (sdio) {
+ return sdio_mediachange(sdio, true);
+ }
+ }
+ else if (!strcmp(argv[1], "eject")) {
+ if (sdio) {
+ return sdio_mediachange(sdio, false);
+ }
+ }
+ else if (!strcmp(argv[1], "status")) {
+ printf("SDcard #%d Status:\n", slotno);
+#ifndef CONFIG_MMCSD_HAVECARDDETECT
+ printf("\t - Without SDcard detect capability\n");
+#endif
+ return 0;
+ }
}
- }
- printf("%s: <start" /*|stop|insert|eject*/ "> <slotno>\n", argv[0]);
- return -1;
+ printf("%s: <start|stop|insert|eject|status> {slotno}\n", argv[0]);
+ return -1;
}