diff options
Diffstat (limited to 'apps/vsn')
-rw-r--r-- | apps/vsn/poweroff/poweroff.c | 12 | ||||
-rw-r--r-- | apps/vsn/sdcard/sdcard.c | 51 |
2 files changed, 47 insertions, 16 deletions
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; } |