Incorporate changes from Uros Platise
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3419 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
40174767c9
commit
fbd30de285
@ -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
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
/* 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;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(argv[1], "stop")) {
|
||||
}
|
||||
else if (!strcmp(argv[1], "insert")) {
|
||||
}
|
||||
else if (!strcmp(argv[1], "eject")) {
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user