Move apps/examples/usbmsc to apps/system/usbmsc

This commit is contained in:
Gregory Nutt 2013-09-25 16:54:39 -06:00
parent 4e6f5be08a
commit edde864e45
13 changed files with 126 additions and 196 deletions

View file

@ -663,4 +663,4 @@
compilation probably introduced on 2013-9-9 (2013-9-23).
* apps/system/stackmonitor: Add a daemon that can be used to
monitor stack usage by all threads (2013-9-24).
* system/usbmsc: Move examples/usbmsc to system/usbmsc (2013-9-25).

View file

@ -62,7 +62,6 @@ source "$APPSDIR/examples/udp/Kconfig"
source "$APPSDIR/examples/discover/Kconfig"
source "$APPSDIR/examples/uip/Kconfig"
source "$APPSDIR/examples/usbserial/Kconfig"
source "$APPSDIR/examples/usbmsc/Kconfig"
source "$APPSDIR/examples/usbterm/Kconfig"
source "$APPSDIR/examples/watchdog/Kconfig"
source "$APPSDIR/examples/wget/Kconfig"

View file

@ -270,10 +270,6 @@ ifeq ($(CONFIG_EXAMPLES_USBSERIAL),y)
CONFIGURED_APPS += examples/usbserial
endif
ifeq ($(CONFIG_EXAMPLES_USBMSC),y)
CONFIGURED_APPS += examples/usbmsc
endif
ifeq ($(CONFIG_EXAMPLES_USBTERM),y)
CONFIGURED_APPS += examples/usbterm
endif

View file

@ -43,8 +43,8 @@ SUBDIRS += lcdrw mm modbus mount mtdpart nettest nrf24l01_term nsh null
SUBDIRS += nx nxconsole nxffs nxflat nxhello nximage nxlines nxtext ostest
SUBDIRS += pashello pipe poll posix_spawn pwm qencoder relays rgmp romfs
SUBDIRS += sendmail serloop slcd smart smart_test tcpecho telnetd thttpd tiff
SUBDIRS += touchscreen udp uip usbserial usbmsc usbterm watchdog
SUBDIRS += wget wgetjson xmlrpc
SUBDIRS += touchscreen udp uip usbserial usbterm watchdog wget wgetjson
SUBDIRS += xmlrpc
# Sub-directories that might need context setup. Directories may need
# context setup for a variety of reasons, but the most common is because
@ -57,7 +57,7 @@ CNTXTDIRS += adc can cc3000 cdcacm composite cxxtest dhcpd discover flash_test
CNTXTDIRS += ftpd hello helloxx json keypadtestmodbus lcdrw mtdpart nettest
CNTXTDIRS += nx nxhello nximage nxlines nxtext nrf24l01_term ostest relays
CNTXTDIRS += qencoder slcd smart_test tcpecho telnetd tiff touchscreen
CNTXTDIRS += usbmsc usbterm watchdog wgetjson
CNTXTDIRS += usbterm watchdog wgetjson
endif
all: nothing

View file

@ -1825,83 +1825,6 @@ examples/usbserial
The host and target will exchange are variety of very small and very large
serial messages.
examples/usbmsc
^^^^^^^^^^^^^^^
This example registers a block device driver, then exports the block
the device using the USB storage class driver. In order to use this
example, your board-specific logic must provide the function:
void usbmsc_archinitialize(void);
This function will be called by the example/usbmsc in order to
do the actual registration of the block device drivers. For examples
of the implementation of usbmsc_archinitialize() see
configs/mcu123-lpc124x/src/up_usbmsc.c or
configs/stm3210e-eval/src/usbmsc.c
Configuration options:
CONFIG_NSH_BUILTIN_APPS
This example can be built as two NSH "built-in" commands if this option
is selected: 'msconn' will connect the USB mass storage device; 'msdis'
will disconnect the USB storage device.
CONFIG_EXAMPLES_USBMSC_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_USBMSC_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_USBMSC_DEVPATH1
The full path to the registered block driver. Default is "/dev/mmcsd0"
CONFIG_EXAMPLES_USBMSC_DEVMINOR2 and CONFIG_EXAMPLES_USBMSC_DEVPATH2
Similar parameters that would have to be provided if CONFIG_EXAMPLES_USBMSC_NLUNS
is 2 or 3. No defaults.
CONFIG_EXAMPLES_USBMSC_DEVMINOR3 and CONFIG_EXAMPLES_USBMSC_DEVPATH3
Similar parameters that would have to be provided if CONFIG_EXAMPLES_USBMSC_NLUNS
is 3. No defaults.
CONFIG_EXAMPLES_USBMSC_DEBUGMM
Enables some debug tests to check for memory usage and memory leaks.
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_USBMSC_TRACEINIT
Show initialization events
CONFIG_EXAMPLES_USBMSC_TRACECLASS
Show class driver events
CONFIG_EXAMPLES_USBMSC_TRACETRANSFERS
Show data transfer events
CONFIG_EXAMPLES_USBMSC_TRACECONTROLLER
Show controller events
CONFIG_EXAMPLES_USBMSC_TRACEINTERRUPTS
Show interrupt-related events.
Error results are always shown in the trace output
NOTE 1: When built as an NSH add-on command (CONFIG_NSH_BUILTIN_APPS=y),
Caution should be used to assure that the SD drive (or other storage device) is
not in use when the USB storage device is configured. Specifically, the SD
driver should be unmounted like:
nsh> mount -t vfat /dev/mmcsd0 /mnt/sdcard # Card is mounted in NSH
...
nsh> umount /mnd/sdcard # Unmount before connecting USB!!!
nsh> msconn # Connect the USB storage device
...
nsh> msdis # Disconnect USB storate device
nsh> mount -t vfat /dev/mmcsd0 /mnt/sdcard # Restore the mount
Failure to do this could result in corruption of the SD card format.
NOTE 2: This test exercises internal USB device driver interfaces. As such,
it relies on internal OS interfaces that are not normally available to a
user-space program. As a result, this example cannot be used if a
NuttX is built as a protected, supervisor kernel (CONFIG_NUTTX_KERNEL).
examples/usbterm
^^^^^^^^^^^^^^^^

View file

@ -51,6 +51,10 @@ menu "Stack Monitor"
source "$APPSDIR/system/stackmonitor/Kconfig"
endmenu
menu "USB Mass Storage Class"
source "$APPSDIR/system/usbmsc/Kconfig"
endmenu
menu "Zmodem Commands"
source "$APPSDIR/system/zmodem/Kconfig"
endmenu

View file

@ -82,6 +82,10 @@ ifeq ($(CONFIG_SYSTEM_STACKMONITOR),y)
CONFIGURED_APPS += system/stackmonitor
endif
ifeq ($(CONFIG_SYSTEM_USBMSC),y)
CONFIGURED_APPS += system/usbmsc
endif
ifeq ($(CONFIG_SYSTEM_ZMODEM),y)
CONFIGURED_APPS += system/zmodem
endif

View file

@ -38,7 +38,7 @@
# Sub-directories containing system task
SUBDIRS = flash_eraseall free i2c install poweroff ramtest ramtron readline
SUBDIRS += sdcard stackmonitor sysinfo usbmonitor zmodem
SUBDIRS += sdcard stackmonitor sysinfo usbmonitor usbmsc zmodem
# Create the list of installed runtime modules (INSTALLED_DIRS)

View file

@ -3,15 +3,19 @@
# see misc/tools/kconfig-language.txt.
#
config EXAMPLES_USBMSC
bool "USB mass storage class example"
config SYSTEM_USBMSC
bool "USB mass storage class controls"
default n
depends on USBMSC
---help---
Enable the USB mass storage class example
Enable the USB mass storage class controls. These controls include:
if EXAMPLES_USBMSC
msconn: Connect the mass storage device to the host
msdis : Disconnect the mass storage device to the host
config EXAMPLES_USBMSC_NLUNS
if SYSTEM_USBMSC
config SYSTEM_USBMSC_NLUNS
int "Number of LUNs"
default 1
---help---
@ -19,7 +23,7 @@ config EXAMPLES_USBMSC_NLUNS
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_USBMSC_DEVMINOR1
config SYSTEM_USBMSC_DEVMINOR1
int "LUN1 Minor Device Number"
default 0
---help---
@ -27,110 +31,110 @@ config EXAMPLES_USBMSC_DEVMINOR1
example, N in /dev/mmcsdN. Used for registering the block driver.
Default is zero.
config EXAMPLES_USBMSC_DEVPATH1
config SYSTEM_USBMSC_DEVPATH1
string "LUN1 Device Path"
default "/dev/mmcsd0"
---help---
The full path to the registered block driver. Default is
"/dev/mmcsd0"
config EXAMPLES_USBMSC_DEVMINOR2
config SYSTEM_USBMSC_DEVMINOR2
int "LUN2 Minor Device Number"
default 1
---help---
The minor device number of the block driver for the second LUN. For
example, N in /dev/mmcsdN. Used for registering the block driver.
Ignored if EXAMPLES_USBMSC_NLUNS < 2. Default is one.
Ignored if SYSTEM_USBMSC_NLUNS < 2. Default is one.
config EXAMPLES_USBMSC_DEVPATH2
config SYSTEM_USBMSC_DEVPATH2
string "LUN2 Device Path"
default "/dev/mmcsd1"
---help---
The full path to the registered block driver. Ignored if
EXAMPLES_USBMSC_NLUNS < 2. Default is "/dev/mmcsd1"
SYSTEM_USBMSC_NLUNS < 2. Default is "/dev/mmcsd1"
config EXAMPLES_USBMSC_DEVMINOR3
config SYSTEM_USBMSC_DEVMINOR3
int "LUN3 Minor Device Number"
default 2
---help---
The minor device number of the block driver for the third LUN. For
example, N in /dev/mmcsdN. Used for registering the block driver.
Ignored if EXAMPLES_USBMSC_NLUNS < 2. Default is two.
Ignored if SYSTEM_USBMSC_NLUNS < 2. Default is two.
config EXAMPLES_USBMSC_DEVPATH3
config SYSTEM_USBMSC_DEVPATH3
string "LUN3 Device Path"
default "/dev/mmcsd2"
---help---
The full path to the registered block driver. Ignored if
EXAMPLES_USBMSC_NLUNS < 2. Default is "/dev/mmcsd2"
SYSTEM_USBMSC_NLUNS < 2. Default is "/dev/mmcsd2"
config EXAMPLES_USBMSC_DEBUGMM
config SYSTEM_USBMSC_DEBUGMM
bool "USB MSC MM Debug"
default n
---help---
Enables some debug tests to check for memory usage and memory leaks.
config EXAMPLES_USBMSC_TRACE
config SYSTEM_USBMSC_TRACE
bool "Trace USB activity"
default n
depends on (USBDEV_TRACE || DEBUG_USB) && !NSH_BUILTIN_APPS
---help---
If this example is built as a standalone task and if USB device tracing is
enabled, then this example can be configured to unobtrusively monitor
If this add-on is built as a standalone task and if USB device tracing is
enabled, then this add-on can be configured to unobtrusively monitor
USB activity by selecting this option.
if EXAMPLES_USBMSC_TRACE
if SYSTEM_USBMSC_TRACE
config EXAMPLES_USBMSC_TRACEINIT
config SYSTEM_USBMSC_TRACEINIT
bool "USB Trace Initialization"
default n
---help---
If USBDEV_TRACE is enabled (or DEBUG and DEBUG_USB),
then the example code will also manage the USB trace output. The
then the add-on code will also manage the USB trace output. The
amount of trace output can be controlled this configuration value:
This setting will show USB initialization events
config EXAMPLES_USBMSC_TRACECLASS
config SYSTEM_USBMSC_TRACECLASS
bool "USB Trace Class"
default n
---help---
If USBDEV_TRACE is enabled (or DEBUG and DEBUG_USB),
then the example code will also manage the USB trace output. The
then the add-on code will also manage the USB trace output. The
amount of trace output can be controlled this configuration value:
This setting will show USB class driver events
config EXAMPLES_USBMSC_TRACETRANSFERS
config SYSTEM_USBMSC_TRACETRANSFERS
bool "USB Trace Transfers"
default n
---help---
If USBDEV_TRACE is enabled (or DEBUG and DEBUG_USB),
then the example code will also manage the USB trace output. The
then the add-on code will also manage the USB trace output. The
amount of trace output can be controlled this configuration value:
This setting will show USB data transfer events
config EXAMPLES_USBMSC_TRACECONTROLLER
config SYSTEM_USBMSC_TRACECONTROLLER
bool "USB Trace Device Controller Events"
default n
---help---
If USBDEV_TRACE is enabled (or DEBUG and DEBUG_USB),
then the example code will also manage the USB trace output. The
then the add-on code will also manage the USB trace output. The
amount of trace output can be controlled this configuration value:
This setting will show USB device controller events
config EXAMPLES_USBMSC_TRACEINTERRUPTS
config SYSTEM_USBMSC_TRACEINTERRUPTS
bool "USB Trace Device Controller Interrupt Events"
default n
---help---
If USBDEV_TRACE is enabled (or DEBUG and DEBUG_USB),
then the example code will also manage the USB trace output. The
then the add-on code will also manage the USB trace output. The
amount of trace output can be controlled this configuration value:
This setting will show USB device controller interrupt-related events.
endif # EXAMPLES_USBMSC_TRACE
endif # SYSTEM_USBMSC_TRACE
if NSH_BUILTIN_APPS
config EXAMPLES_USBMSC_CMD_STACKSIZE
config SYSTEM_USBMSC_CMD_STACKSIZE
int "Stacksize of msconn and msdis commands"
default 768
---help---
@ -138,13 +142,13 @@ config EXAMPLES_USBMSC_CMD_STACKSIZE
applications. Warning, just because the applications are small,
the stack usage could still be deep!
config EXAMPLES_USBMSC_CMD_PRIORITY
config SYSTEM_USBMSC_CMD_PRIORITY
int "Priority of the msconn and msdis commands"
default 100
---help---
Priority of the small 'msconn' and 'msdis' command applications.
config EXAMPLES_USBMSC_DAEMON_STACKSIZE
config SYSTEM_USBMSC_DAEMON_STACKSIZE
int "Stacksize of msconn daemon"
default 2048
---help---
@ -153,7 +157,7 @@ config EXAMPLES_USBMSC_DAEMON_STACKSIZE
to the NSH command line immediately. This is the stack used for
that short-lived USB MSC initialization daemon.
config EXAMPLES_USBMSC_DAEMON_PRIORITY
config SYSTEM_USBMSC_DAEMON_PRIORITY
int "Priority of the msconn daemon"
default 100
---help---
@ -163,5 +167,5 @@ config EXAMPLES_USBMSC_DAEMON_PRIORITY
that short-lived USB MSC initialization daemon.
endif # NSH_BUILTIN_APPS
endif # EXAMPLES_USBMSC
endif # SYSTEM_USBMSC

View file

@ -1,5 +1,5 @@
############################################################################
# apps/examples/usbmsc/Makefile
# apps/system/usbmsc/Makefile
#
# Copyright (C) 2008, 2010-2012 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
@ -37,7 +37,7 @@
-include $(TOPDIR)/Make.defs
include $(APPDIR)/Make.defs
# USB device mass storage example
# USB device mass storage add-on
ASRCS =
CSRCS = usbmsc_main.c
@ -62,16 +62,16 @@ ROOTDEPPATH = --dep-path .
# USB storage built-in application info
CONFIG_EXAMPLES_USBMSC_CMD_STACKSIZE ?= 768
CONFIG_EXAMPLES_USBMSC_CMD_PRIORITY ?= SCHED_PRIORITY_DEFAULT
CONFIG_SYSTEM_USBMSC_CMD_STACKSIZE ?= 768
CONFIG_SYSTEM_USBMSC_CMD_PRIORITY ?= SCHED_PRIORITY_DEFAULT
APPNAME1 = msconn
PRIORITY1 = $(CONFIG_EXAMPLES_USBMSC_CMD_PRIORITY)
STACKSIZE1 = $(CONFIG_EXAMPLES_USBMSC_CMD_STACKSIZE)
PRIORITY1 = $(CONFIG_SYSTEM_USBMSC_CMD_PRIORITY)
STACKSIZE1 = $(CONFIG_SYSTEM_USBMSC_CMD_STACKSIZE)
APPNAME2 = msdis
PRIORITY2 = $(CONFIG_EXAMPLES_USBMSC_CMD_PRIORITY)
STACKSIZE2 = $(CONFIG_EXAMPLES_USBMSC_CMD_STACKSIZE)
PRIORITY2 = $(CONFIG_SYSTEM_USBMSC_CMD_PRIORITY)
STACKSIZE2 = $(CONFIG_SYSTEM_USBMSC_CMD_STACKSIZE)
# Common build

View file

@ -1,5 +1,5 @@
/****************************************************************************
* examples/usbmsc/usbmsc.h
* system/usbmsc/usbmsc.h
*
* Copyright (C) 2008-2009, 2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@ -49,49 +49,49 @@
/* Configuration ************************************************************/
#ifndef CONFIG_EXAMPLES_USBMSC_NLUNS
# define CONFIG_EXAMPLES_USBMSC_NLUNS 1
#ifndef CONFIG_SYSTEM_USBMSC_NLUNS
# define CONFIG_SYSTEM_USBMSC_NLUNS 1
#endif
#ifndef CONFIG_EXAMPLES_USBMSC_DEVMINOR1
# define CONFIG_EXAMPLES_USBMSC_DEVMINOR1 0
#ifndef CONFIG_SYSTEM_USBMSC_DEVMINOR1
# define CONFIG_SYSTEM_USBMSC_DEVMINOR1 0
#endif
#ifndef CONFIG_EXAMPLES_USBMSC_DEVPATH1
# define CONFIG_EXAMPLES_USBMSC_DEVPATH1 "/dev/mmcsd0"
#ifndef CONFIG_SYSTEM_USBMSC_DEVPATH1
# define CONFIG_SYSTEM_USBMSC_DEVPATH1 "/dev/mmcsd0"
#endif
#if CONFIG_EXAMPLES_USBMSC_NLUNS > 1
# ifndef CONFIG_EXAMPLES_USBMSC_DEVMINOR2
# error "CONFIG_EXAMPLES_USBMSC_DEVMINOR2 for LUN=2"
#if CONFIG_SYSTEM_USBMSC_NLUNS > 1
# ifndef CONFIG_SYSTEM_USBMSC_DEVMINOR2
# error "CONFIG_SYSTEM_USBMSC_DEVMINOR2 for LUN=2"
# endif
# ifndef CONFIG_EXAMPLES_USBMSC_DEVPATH2
# error "CONFIG_EXAMPLES_USBMSC_DEVPATH2 for LUN=2"
# ifndef CONFIG_SYSTEM_USBMSC_DEVPATH2
# error "CONFIG_SYSTEM_USBMSC_DEVPATH2 for LUN=2"
# endif
# if CONFIG_EXAMPLES_USBMSC_NLUNS > 2
# ifndef CONFIG_EXAMPLES_USBMSC_DEVMINOR3
# error "CONFIG_EXAMPLES_USBMSC_DEVMINOR2 for LUN=3"
# if CONFIG_SYSTEM_USBMSC_NLUNS > 2
# ifndef CONFIG_SYSTEM_USBMSC_DEVMINOR3
# error "CONFIG_SYSTEM_USBMSC_DEVMINOR2 for LUN=3"
# endif
# ifndef CONFIG_EXAMPLES_USBMSC_DEVPATH3
# error "CONFIG_EXAMPLES_USBMSC_DEVPATH3 for LUN=3"
# ifndef CONFIG_SYSTEM_USBMSC_DEVPATH3
# error "CONFIG_SYSTEM_USBMSC_DEVPATH3 for LUN=3"
# endif
# if CONFIG_EXAMPLES_USBMSC_NLUNS > 3
# error "CONFIG_EXAMPLES_USBMSC_NLUNS must be {1,2,3}"
# if CONFIG_SYSTEM_USBMSC_NLUNS > 3
# error "CONFIG_SYSTEM_USBMSC_NLUNS must be {1,2,3}"
# endif
# else
# undef CONFIG_EXAMPLES_USBMSC_DEVMINOR3
# undef CONFIG_EXAMPLES_USBMSC_DEVPATH3
# undef CONFIG_SYSTEM_USBMSC_DEVMINOR3
# undef CONFIG_SYSTEM_USBMSC_DEVPATH3
# endif
#else
# undef CONFIG_EXAMPLES_USBMSC_DEVMINOR2
# undef CONFIG_EXAMPLES_USBMSC_DEVPATH2
# undef CONFIG_EXAMPLES_USBMSC_DEVMINOR3
# undef CONFIG_EXAMPLES_USBMSC_DEVPATH3
# undef CONFIG_SYSTEM_USBMSC_DEVMINOR2
# undef CONFIG_SYSTEM_USBMSC_DEVPATH2
# undef CONFIG_SYSTEM_USBMSC_DEVMINOR3
# undef CONFIG_SYSTEM_USBMSC_DEVPATH3
#endif
#if defined(CONFIG_NSH_BUILTIN_APPS) && defined(CONFIG_SCHED_WAITPID)
# ifndef CONFIG_EXAMPLES_USBMSC_DAEMON_STACKSIZE
# define CONFIG_EXAMPLES_USBMSC_DAEMON_STACKSIZE 2048
# ifndef CONFIG_SYSTEM_USBMSC_DAEMON_STACKSIZE
# define CONFIG_SYSTEM_USBMSC_DAEMON_STACKSIZE 2048
# endif
#endif
@ -119,15 +119,15 @@
* Public Types
****************************************************************************/
/* All global variables used by this example are packed into a structure in
/* All global variables used by this add-on are packed into a structure in
* order to avoid name collisions.
*/
#if defined(CONFIG_NSH_BUILTIN_APPS) || defined(CONFIG_EXAMPLES_USBMSC_DEBUGMM)
#if defined(CONFIG_NSH_BUILTIN_APPS) || defined(CONFIG_SYSTEM_USBMSC_DEBUGMM)
struct usbmsc_state_s
{
/* This is the handle that references to this particular USB storage driver
* instance. It is only needed if the USB mass storage device example is
* instance. It is only needed if the USB mass storage device add-on is
* built using CONFIG_NSH_BUILTIN_APPS. In this case, the value
* of the driver handle must be remembered between the 'msconn' and 'msdis'
* commands.
@ -141,7 +141,7 @@ struct usbmsc_state_s
* usage and for tracking down memoryh leaks.
*/
#ifdef CONFIG_EXAMPLES_USBMSC_DEBUGMM
#ifdef CONFIG_SYSTEM_USBMSC_DEBUGMM
struct mallinfo mmstart; /* Memory usage before the connection */
struct mallinfo mmprevious; /* The last memory usage sample */
struct mallinfo mmcurrent; /* The current memory usage sample */
@ -153,11 +153,11 @@ struct usbmsc_state_s
* Public Data
****************************************************************************/
/* All global variables used by this example are packed into a structure in
/* All global variables used by this add-on are packed into a structure in
* order to avoid name collisions.
*/
#if defined(CONFIG_NSH_BUILTIN_APPS) || defined(CONFIG_EXAMPLES_USBMSC_DEBUGMM)
#if defined(CONFIG_NSH_BUILTIN_APPS) || defined(CONFIG_SYSTEM_USBMSC_DEBUGMM)
extern struct usbmsc_state_s g_usbmsc;
#endif
@ -171,7 +171,7 @@ extern struct usbmsc_state_s g_usbmsc;
* Description:
* Perform architecture specific initialization. This function must
* configure the block device to export via USB. This function must be
* provided by architecture-specific logic in order to use this example.
* provided by architecture-specific logic in order to use this add-on.
*
****************************************************************************/

View file

@ -1,5 +1,5 @@
/****************************************************************************
* examples/usbmsc/usbmsc_main.c
* system/usbmsc/usbmsc_main.c
*
* Copyright (C) 2008-2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@ -54,7 +54,7 @@
* Definitions
****************************************************************************/
#ifdef CONFIG_EXAMPLES_USBMSC_TRACEINIT
#ifdef CONFIG_SYSTEM_USBMSC_TRACEINIT
# define TRACE_INIT_BITS (TRACE_INIT_BIT)
#else
# define TRACE_INIT_BITS (0)
@ -62,26 +62,26 @@
#define TRACE_ERROR_BITS (TRACE_DEVERROR_BIT|TRACE_CLSERROR_BIT)
#ifdef CONFIG_EXAMPLES_USBMSC_TRACECLASS
#ifdef CONFIG_SYSTEM_USBMSC_TRACECLASS
# define TRACE_CLASS_BITS (TRACE_CLASS_BIT|TRACE_CLASSAPI_BIT|TRACE_CLASSSTATE_BIT)
#else
# define TRACE_CLASS_BITS (0)
#endif
#ifdef CONFIG_EXAMPLES_USBMSC_TRACETRANSFERS
#ifdef CONFIG_SYSTEM_USBMSC_TRACETRANSFERS
# define TRACE_TRANSFER_BITS (TRACE_OUTREQQUEUED_BIT|TRACE_INREQQUEUED_BIT|TRACE_READ_BIT|\
TRACE_WRITE_BIT|TRACE_COMPLETE_BIT)
#else
# define TRACE_TRANSFER_BITS (0)
#endif
#ifdef CONFIG_EXAMPLES_USBMSC_TRACECONTROLLER
#ifdef CONFIG_SYSTEM_USBMSC_TRACECONTROLLER
# define TRACE_CONTROLLER_BITS (TRACE_EP_BIT|TRACE_DEV_BIT)
#else
# define TRACE_CONTROLLER_BITS (0)
#endif
#ifdef CONFIG_EXAMPLES_USBMSC_TRACEINTERRUPTS
#ifdef CONFIG_SYSTEM_USBMSC_TRACEINTERRUPTS
# define TRACE_INTERRUPT_BITS (TRACE_INTENTRY_BIT|TRACE_INTDECODE_BIT|TRACE_INTEXIT_BIT)
#else
# define TRACE_INTERRUPT_BITS (0)
@ -94,11 +94,11 @@
* Private Data
****************************************************************************/
/* All global variables used by this example are packed into a structure in
/* All global variables used by this add-on are packed into a structure in
* order to avoid name collisions.
*/
#if defined(CONFIG_NSH_BUILTIN_APPS) || defined(CONFIG_EXAMPLES_USBMSC_DEBUGMM)
#if defined(CONFIG_NSH_BUILTIN_APPS) || defined(CONFIG_SYSTEM_USBMSC_DEBUGMM)
struct usbmsc_state_s g_usbmsc;
#endif
@ -110,7 +110,7 @@ struct usbmsc_state_s g_usbmsc;
* Name: show_memory_usage
****************************************************************************/
#ifdef CONFIG_EXAMPLES_USBMSC_DEBUGMM
#ifdef CONFIG_SYSTEM_USBMSC_DEBUGMM
static void show_memory_usage(struct mallinfo *mmbefore,
struct mallinfo *mmafter)
{
@ -140,7 +140,7 @@ static void show_memory_usage(struct mallinfo *mmbefore,
* Name: check_test_memory_usage
****************************************************************************/
#ifdef CONFIG_EXAMPLES_USBMSC_DEBUGMM
#ifdef CONFIG_SYSTEM_USBMSC_DEBUGMM
static void check_test_memory_usage(FAR const char *msg)
{
/* Get the current memory usage */
@ -172,7 +172,7 @@ static void check_test_memory_usage(FAR const char *msg)
* Name: check_test_memory_usage
****************************************************************************/
#ifdef CONFIG_EXAMPLES_USBMSC_DEBUGMM
#ifdef CONFIG_SYSTEM_USBMSC_DEBUGMM
static void final_memory_usage(FAR const char *msg)
{
/* Get the current memory usage */
@ -196,7 +196,7 @@ static void final_memory_usage(FAR const char *msg)
* Name: usbmsc_enumerate
****************************************************************************/
#ifdef CONFIG_EXAMPLES_USBMSC_TRACE
#ifdef CONFIG_SYSTEM_USBMSC_TRACE
static int usbmsc_enumerate(struct usbtrace_s *trace, void *arg)
{
switch (trace->event)
@ -406,7 +406,7 @@ static int msconn_daemon(int argc, char *argv[])
}
#endif
#ifdef CONFIG_EXAMPLES_USBMSC_DEBUGMM
#ifdef CONFIG_SYSTEM_USBMSC_DEBUGMM
# ifdef CONFIG_CAN_PASS_STRUCTS
g_usbmsc.mmstart = mallinfo();
g_usbmsc.mmprevious = g_usbmsc.mmstart;
@ -418,7 +418,7 @@ static int msconn_daemon(int argc, char *argv[])
/* Initialize USB trace output IDs */
#ifdef CONFIG_EXAMPLES_USBMSC_TRACE
#ifdef CONFIG_SYSTEM_USBMSC_TRACE
usbtrace_enable(TRACE_BITSET);
check_test_memory_usage("After usbtrace_enable()");
#endif
@ -436,8 +436,8 @@ static int msconn_daemon(int argc, char *argv[])
/* Then exports the LUN(s) */
message("msconn_main: Configuring with NLUNS=%d\n", CONFIG_EXAMPLES_USBMSC_NLUNS);
ret = usbmsc_configure(CONFIG_EXAMPLES_USBMSC_NLUNS, &handle);
message("msconn_main: Configuring with NLUNS=%d\n", CONFIG_SYSTEM_USBMSC_NLUNS);
ret = usbmsc_configure(CONFIG_SYSTEM_USBMSC_NLUNS, &handle);
if (ret < 0)
{
message("msconn_main: usbmsc_configure failed: %d\n", -ret);
@ -447,38 +447,38 @@ static int msconn_daemon(int argc, char *argv[])
message("msconn_main: handle=%p\n", handle);
check_test_memory_usage("After usbmsc_configure()");
message("msconn_main: Bind LUN=0 to %s\n", CONFIG_EXAMPLES_USBMSC_DEVPATH1);
ret = usbmsc_bindlun(handle, CONFIG_EXAMPLES_USBMSC_DEVPATH1, 0, 0, 0, false);
message("msconn_main: Bind LUN=0 to %s\n", CONFIG_SYSTEM_USBMSC_DEVPATH1);
ret = usbmsc_bindlun(handle, CONFIG_SYSTEM_USBMSC_DEVPATH1, 0, 0, 0, false);
if (ret < 0)
{
message("msconn_main: usbmsc_bindlun failed for LUN 1 using %s: %d\n",
CONFIG_EXAMPLES_USBMSC_DEVPATH1, -ret);
CONFIG_SYSTEM_USBMSC_DEVPATH1, -ret);
usbmsc_uninitialize(handle);
return EXIT_FAILURE;
}
check_test_memory_usage("After usbmsc_bindlun()");
#if CONFIG_EXAMPLES_USBMSC_NLUNS > 1
#if CONFIG_SYSTEM_USBMSC_NLUNS > 1
message("msconn_main: Bind LUN=1 to %s\n", CONFIG_EXAMPLES_USBMSC_DEVPATH2);
ret = usbmsc_bindlun(handle, CONFIG_EXAMPLES_USBMSC_DEVPATH2, 1, 0, 0, false);
message("msconn_main: Bind LUN=1 to %s\n", CONFIG_SYSTEM_USBMSC_DEVPATH2);
ret = usbmsc_bindlun(handle, CONFIG_SYSTEM_USBMSC_DEVPATH2, 1, 0, 0, false);
if (ret < 0)
{
message("msconn_main: usbmsc_bindlun failed for LUN 2 using %s: %d\n",
CONFIG_EXAMPLES_USBMSC_DEVPATH2, -ret);
CONFIG_SYSTEM_USBMSC_DEVPATH2, -ret);
usbmsc_uninitialize(handle);
return EXIT_FAILURE;
}
check_test_memory_usage("After usbmsc_bindlun() #2");
#if CONFIG_EXAMPLES_USBMSC_NLUNS > 2
#if CONFIG_SYSTEM_USBMSC_NLUNS > 2
message("msconn_main: Bind LUN=2 to %s\n", CONFIG_EXAMPLES_USBMSC_DEVPATH3);
ret = usbmsc_bindlun(handle, CONFIG_EXAMPLES_USBMSC_DEVPATH3, 2, 0, 0, false);
message("msconn_main: Bind LUN=2 to %s\n", CONFIG_SYSTEM_USBMSC_DEVPATH3);
ret = usbmsc_bindlun(handle, CONFIG_SYSTEM_USBMSC_DEVPATH3, 2, 0, 0, false);
if (ret < 0)
{
message("msconn_main: usbmsc_bindlun failed for LUN 3 using %s: %d\n",
CONFIG_EXAMPLES_USBMSC_DEVPATH3, -ret);
CONFIG_SYSTEM_USBMSC_DEVPATH3, -ret);
usbmsc_uninitialize(handle);
return EXIT_FAILURE;
}
@ -510,7 +510,7 @@ static int msconn_daemon(int argc, char *argv[])
msgflush();
sleep(5);
# ifdef CONFIG_EXAMPLES_USBMSC_TRACE
# ifdef CONFIG_SYSTEM_USBMSC_TRACE
message("\nmsconn_main: USB TRACE DATA:\n");
ret = usbtrace_enumerate(usbmsc_enumerate, NULL);
if (ret < 0)
@ -592,7 +592,7 @@ int msconn_main(int argc, char *argv[])
return 1;
}
#ifndef CONFIG_EXAMPLES_USBMSC_DAEMON_PRIORITY
#ifndef CONFIG_SYSTEM_USBMSC_DAEMON_PRIORITY
/* Set the daemon to the same priority as this task */
ret = sched_getparam(0, &param);
@ -602,11 +602,11 @@ int msconn_main(int argc, char *argv[])
return EXIT_FAILURE;
}
#else
param.sched_priority = CONFIG_EXAMPLES_USBMSC_DAEMON_PRIORITY;
param.sched_priority = CONFIG_SYSTEM_USBMSC_DAEMON_PRIORITY;
#endif
ret = TASK_CREATE("msconn daemon", param.sched_priority,
CONFIG_EXAMPLES_USBMSC_DAEMON_STACKSIZE,
CONFIG_SYSTEM_USBMSC_DAEMON_STACKSIZE,
msconn_daemon, newargv);
if (ret < 0)
{