From 992016217851072beac0fd9b8dc94c38b5c2ffad Mon Sep 17 00:00:00 2001 From: patacongo Date: Fri, 22 Jul 2011 20:12:50 +0000 Subject: [PATCH] apps/examples/usbstorage can now be built as NSH built-in commands; configs/stm3210e-eval/nsh2 now uses these usb storage commands git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3812 42af7a65-404d-4744-a932-0658087f49c3 --- configs/stm3210e-eval/README.txt | 1 + configs/stm3210e-eval/nsh2/appconfig | 1 + configs/stm3210e-eval/nsh2/defconfig | 60 ++++++++++++++++++++-- configs/stm3210e-eval/src/up_nsh.c | 4 +- configs/stm3210e-eval/src/up_usbstrg.c | 15 +++++- configs/stm3210e-eval/usbstorage/defconfig | 33 ++++++++++-- 6 files changed, 103 insertions(+), 11 deletions(-) diff --git a/configs/stm3210e-eval/README.txt b/configs/stm3210e-eval/README.txt index f01d3987dc..bf35141c91 100755 --- a/configs/stm3210e-eval/README.txt +++ b/configs/stm3210e-eval/README.txt @@ -477,6 +477,7 @@ Where is one of the following: ----------- ----------------------- -------------------------------- Built-in None apps/examples/nx Apps apps/examples/nxhello + apps/examples/usbstorage =========== ======================= ================================ * You will probably need to modify nsh/setenv.sh or nsh2/setenv.sh diff --git a/configs/stm3210e-eval/nsh2/appconfig b/configs/stm3210e-eval/nsh2/appconfig index d3fe4cc28d..22b63c04ab 100644 --- a/configs/stm3210e-eval/nsh2/appconfig +++ b/configs/stm3210e-eval/nsh2/appconfig @@ -45,5 +45,6 @@ CONFIGURED_APPS += nshlib CONFIGURED_APPS += examples/nx CONFIGURED_APPS += examples/nxhello +CONFIGURED_APPS += examples/usbstorage diff --git a/configs/stm3210e-eval/nsh2/defconfig b/configs/stm3210e-eval/nsh2/defconfig index 694bdd1c02..7d0ae8eb3e 100644 --- a/configs/stm3210e-eval/nsh2/defconfig +++ b/configs/stm3210e-eval/nsh2/defconfig @@ -321,12 +321,15 @@ CONFIG_HAVE_LIBM=n # thread. Default: CONFIG_IDLETHREAD_STACKSIZE. # CONFIG_SIG_SIGWORK - The signal number that will be used to wake-up # the worker thread. Default: 4 +# CONFIG_SCHED_WAITPID - Enable the waitpid() API +# CONFIG_SCHED_ATEXIT - Enabled the atexit() API # #CONFIG_APPS_DIR= CONFIG_DEBUG=n CONFIG_DEBUG_VERBOSE=n CONFIG_DEBUG_GRAPHICS=n CONFIG_DEBUG_LCD=n +CONFIG_DEBUG_USB=n CONFIG_DEBUG_SYMBOLS=n CONFIG_MM_REGIONS=1 CONFIG_ARCH_LOWPUTC=y @@ -352,6 +355,8 @@ CONFIG_SCHED_WORKPRIORITY=50 CONFIG_SCHED_WORKPERIOD=(50*1000) CONFIG_SCHED_WORKSTACKSIZE=1024 CONFIG_SIG_SIGWORK=4 +CONFIG_SCHED_WAITPID=y +CONFIG_SCHED_ATEXIT=n # # Settings for NXFLAT @@ -647,7 +652,7 @@ CONFIG_NET_RESOLV_ENTRIES=4 # CONFIG_USBDEV_TRACE_NRECORDS # Number of trace entries to remember # -CONFIG_USBDEV=n +CONFIG_USBDEV=y CONFIG_USBDEV_ISOCHRONOUS=n CONFIG_USBDEV_DUALSPEED=n CONFIG_USBDEV_SELFPOWERED=y @@ -715,7 +720,7 @@ CONFIG_USBSER_TXBUFSIZE=512 # CONFIG_USBSTRG_REMOVABLE # Select if the media is removable # -CONFIG_USBSTRG=n +CONFIG_USBSTRG=y CONFIG_USBSTRG_EP0MAXPACKET=64 CONFIG_USBSTRG_EPBULKOUT=2 CONFIG_USBSTRG_EPBULKIN=5 @@ -1009,7 +1014,7 @@ CONFIG_EXAMPLES_NX_NOTIFYSIGNO=4 CONFIG_EXAMPLES_NX_EXTERNINIT=n # -# Settings for examples/nx +# Settings for examples/nxhello # # CONFIG_EXAMPLES_NXHELLO_BUILTIN -- Build the NXHELLO example as a "built-in" # that can be executed from the NSH command line @@ -1074,6 +1079,55 @@ CONFIG_EXAMPLES_NXIMAGE_YSCALE1p5=y CONFIG_EXAMPLES_NXIMAGE_YSCALE2p0=n CONFIG_EXAMPLES_NXIMAGE_EXTERNINIT=n +# +# Settings for examples/usbstorage +# +# CONFIG_EXAMPLES_USBSTRG_BUILTIN +# This example can be built as two NSH "built-in" commands if this option +# is selection: 'msconn' will connect the USB mass storage device; 'msdis' +# will disconnect the USB storage device. +# CONFIG_EXAMPLES_USBSTRG_NLUNS +# Defines the number of logical units (LUNs) exported by the USB storage +# driver. Each LUN corresponds to one exported block driver (or partition +# of a block driver). May be 1, 2, or 3. Default is 1. +# CONFIG_EXAMPLES_USBSTRG_DEVMINOR1 +# The minor device number of the block driver for the first LUN. For +# example, N in /dev/mmcsdN. Used for registering the block driver. Default +# is zero. +# CONFIG_EXAMPLES_USBSTRG_DEVPATH1 +# The full path to the registered block driver. Default is "/dev/mmcsd0" +# CONFIG_EXAMPLES_USBSTRG_DEVMINOR2 and CONFIG_EXAMPLES_USBSTRG_DEVPATH2 +# Similar parameters that would have to be provided if CONFIG_EXAMPLES_USBSTRG_NLUNS +# is 2 or 3. No defaults. +# CONFIG_EXAMPLES_USBSTRG_DEVMINOR3 and CONFIG_EXAMPLES_USBSTRG_DEVPATH3 +# Similar parameters that would have to be provided if CONFIG_EXAMPLES_USBSTRG_NLUNS +# is 3. No defaults. +# +# If CONFIG_USBDEV_TRACE is enabled (or CONFIG_DEBUG and CONFIG_DEBUG_USB), then +# the example code will also manage the USB trace output. The amount of trace output +# can be controlled using: +# +# CONFIG_EXAMPLES_USBSTRG_TRACEINIT +# Show initialization events +# CONFIG_EXAMPLES_USBSTRG_TRACECLASS +# Show class driver events +# CONFIG_EXAMPLES_USBSTRG_TRACETRANSFERS +# Show data transfer events +# CONFIG_EXAMPLES_USBSTRG_TRACECONTROLLER +# Show controller events +# CONFIG_EXAMPLES_USBSTRG_TRACEINTERRUPTS +# Show interrupt-related events. +# +CONFIG_EXAMPLES_USBSTRG_BUILTIN=y +CONFIG_EXAMPLES_USBSTRG_NLUNS=1 +CONFIG_EXAMPLES_USBSTRG_DEVMINOR1=0 +CONFIG_EXAMPLES_USBSTRG_DEVPATH1="/dev/mmcsd0" +CONFIG_EXAMPLES_USBSTRG_TRACEINIT=n +CONFIG_EXAMPLES_USBSTRG_TRACECLASS=n +CONFIG_EXAMPLES_USBSTRG_TRACETRANSFERS=n +CONFIG_EXAMPLES_USBSTRG_TRACECONTROLLER=n +CONFIG_EXAMPLES_USBSTRG_TRACEINTERRUPTS=n + # # Stack and heap information # diff --git a/configs/stm3210e-eval/src/up_nsh.c b/configs/stm3210e-eval/src/up_nsh.c index ab4b625f0e..36430a52a6 100755 --- a/configs/stm3210e-eval/src/up_nsh.c +++ b/configs/stm3210e-eval/src/up_nsh.c @@ -2,7 +2,7 @@ * config/stm3210e_eval/src/up_nsh.c * arch/arm/src/board/up_nsh.c * - * Copyright (C) 2009 Gregory Nutt. All rights reserved. + * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -190,7 +190,7 @@ int nsh_archinitialize(void) return -ENODEV; } - /* Now bind the SPI interface to the MMC/SD driver */ + /* Now bind the SDIO interface to the MMC/SD driver */ message("nsh_archinitialize: Bind SDIO to the MMC/SD driver, minor=%d\n", CONFIG_NSH_MMCSDMINOR); diff --git a/configs/stm3210e-eval/src/up_usbstrg.c b/configs/stm3210e-eval/src/up_usbstrg.c index add9a7ed9c..f7ba205cca 100755 --- a/configs/stm3210e-eval/src/up_usbstrg.c +++ b/configs/stm3210e-eval/src/up_usbstrg.c @@ -1,7 +1,7 @@ /**************************************************************************** * configs/stm3210e-eval/src/up_usbstrg.c * - * Copyright (C) 2009 Gregory Nutt. All rights reserved. + * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Configure and register the STM32 MMC/SD SDIO block driver. @@ -50,6 +50,8 @@ #include "stm32_internal.h" +/* There is nothing to do here if SDIO support is not selected. */ + #ifdef CONFIG_STM32_SDIO /**************************************************************************** @@ -107,6 +109,12 @@ int usbstrg_archinitialize(void) { + /* If examples/usbstrg is built as an NSH command, then SD slot should + * already have been initized in nsh_archinitialize() (see up_nsh.c). In + * this case, there is nothing further to be done here. + */ + +#ifndef CONFIG_EXAMPLES_USBSTRG_BUILTIN FAR struct sdio_dev_s *sdio; int ret; @@ -124,7 +132,7 @@ int usbstrg_archinitialize(void) return -ENODEV; } - /* Now bind the SPI interface to the MMC/SD driver */ + /* Now bind the SDIO interface to the MMC/SD driver */ message("usbstrg_archinitialize: " "Bind SDIO to the MMC/SD driver, minor=%d\n", @@ -147,6 +155,9 @@ int usbstrg_archinitialize(void) */ sdio_mediachange(sdio, true); + +#endif /* CONFIG_EXAMPLES_USBSTRG_BUILTIN */ + return OK; } diff --git a/configs/stm3210e-eval/usbstorage/defconfig b/configs/stm3210e-eval/usbstorage/defconfig index 3eaaa800ac..a560b9a7b8 100755 --- a/configs/stm3210e-eval/usbstorage/defconfig +++ b/configs/stm3210e-eval/usbstorage/defconfig @@ -303,9 +303,6 @@ CONFIG_HAVE_LIBM=n # CONFIG_SDCLONE_DISABLE. Disable cloning of all socket # desciptors by task_create() when a new task is started. If # set, all sockets will appear to be closed in the new task. -# CONFIG_NXFLAT. Enable support for the NXFLAT binary format. -# This format will support execution of NuttX binaries located -# in a ROMFS filesystem (see examples/nxflat). # CONFIG_SCHED_WORKQUEUE. Create a dedicated "worker" thread to # handle delayed processing from interrupt handlers. This feature # is required for some drivers but, if there are not complaints, @@ -350,13 +347,29 @@ CONFIG_SEM_NNESTPRIO=0 CONFIG_FDCLONE_DISABLE=n CONFIG_FDCLONE_STDIO=n CONFIG_SDCLONE_DISABLE=y -CONFIG_NXFLAT=n CONFIG_SCHED_WORKQUEUE=y CONFIG_SCHED_WORKPRIORITY=50 CONFIG_SCHED_WORKPERIOD=(50*1000) CONFIG_SCHED_WORKSTACKSIZE=1024 CONFIG_SIG_SIGWORK=4 +# +# Settings for NXFLAT +# +# CONFIG_NXFLAT. Enable support for the NXFLAT binary format. +# This format will support execution of NuttX binaries located +# in a ROMFS filesystem (see examples/nxflat). +# CONFIG_NXFLAT_DUMPBUFFER. Dump a most buffers that NXFFLAT deals +# with. CONFIG_DEBUG, CONFIG_DEBUG_VERBOSE, and +# CONFIG_DEBUG_BINFMT have to be defined or +# CONFIG_NXFLAT_DUMPBUFFER does nothing. +# CONFIG_SYMTAB_ORDEREDBYNAME. Select if the system symbol table +# is ordered by symbol name +# +CONFIG_NXFLAT=n +CONFIG_NXFLAT_DUMPBUFFER=n +CONFIG_SYMTAB_ORDEREDBYNAME=y + # # The following can be used to disable categories of # APIs supported by the OS. If the compiler supports @@ -728,6 +741,9 @@ CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3 # # Settings for apps/nshlib # +# CONFIG_NSH_BUILTIN_APPS - Support external registered, +# "named" applications that can be executed from the NSH +# command line (see apps/README.txt for more information). # CONFIG_NSH_FILEIOSIZE - Size of a static I/O buffer # CONFIG_NSH_STRERROR - Use strerror(errno) # CONFIG_NSH_LINELEN - Maximum length of one command line @@ -737,6 +753,8 @@ CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3 # CONFIG_NSH_DISABLEBG - Disable background commands # CONFIG_NSH_ROMFSETC - Use startup script in /etc # CONFIG_NSH_CONSOLE - Use serial console front end +# CONFIG_NSH_CONDEV - Select the serial device used to support +# the NSH console. Default: stdin and stdout # CONFIG_NSH_TELNET - Use telnetd console front end # CONFIG_NSH_ARCHINIT - Platform provides architecture # specific initialization (nsh_archinitialize()). @@ -759,6 +777,7 @@ CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3 # CONFIG_NSH_FATNSECTORS - FAT FS number of sectors # CONFIG_NSH_FATMOUNTPT - FAT FS mountpoint # +CONFIG_NSH_BUILTIN_APPS=n CONFIG_NSH_FILEIOSIZE=512 CONFIG_NSH_STRERROR=n CONFIG_NSH_LINELEN=64 @@ -768,6 +787,7 @@ CONFIG_NSH_DISABLESCRIPT=n CONFIG_NSH_DISABLEBG=n CONFIG_NSH_ROMFSETC=n CONFIG_NSH_CONSOLE=y +#CONFIG_NSH_CONDEV="/dev/ttyS1" CONFIG_NSH_TELNET=n CONFIG_NSH_ARCHINIT=y CONFIG_NSH_IOBUFFER_SIZE=512 @@ -818,6 +838,10 @@ CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n # # Settings for examples/usbstorage # +# CONFIG_EXAMPLES_USBSTRG_BUILTIN +# This example can be built as two NSH "built-in" commands if this option +# is selection: 'msconn' will connect the USB mass storage device; 'msdis' +# will disconnect the USB storage device. # CONFIG_EXAMPLES_USBSTRG_NLUNS # Defines the number of logical units (LUNs) exported by the USB storage # driver. Each LUN corresponds to one exported block driver (or partition @@ -850,6 +874,7 @@ CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n # CONFIG_EXAMPLES_USBSTRG_TRACEINTERRUPTS # Show interrupt-related events. # +CONFIG_EXAMPLES_USBSTRG_BUILTIN=n CONFIG_EXAMPLES_USBSTRG_NLUNS=1 CONFIG_EXAMPLES_USBSTRG_DEVMINOR1=0 CONFIG_EXAMPLES_USBSTRG_DEVPATH1="/dev/mmcsd0"