Mov apps/examples/composite to apps/system/composite; convert configs/stm3210e-eval/composite to use kconfig-frontend tools -- untested

This commit is contained in:
Gregory Nutt 2013-09-25 18:50:14 -06:00
parent 4bfd7f7f5e
commit 5f16a8c304
15 changed files with 329 additions and 237 deletions

View File

@ -665,3 +665,5 @@
monitor stack usage by all threads (2013-9-24).
* system/usbmsc: Move examples/usbmsc to system/usbmsc (2013-9-25).
* system/cdcacm: Move examples/cdcacm to system/cdcacm (2013-9-25).
* system/composite: Move examples/composite to system/composite
(2013-9-25).

View File

@ -7,7 +7,6 @@ source "$APPSDIR/examples/adc/Kconfig"
source "$APPSDIR/examples/buttons/Kconfig"
source "$APPSDIR/examples/can/Kconfig"
source "$APPSDIR/examples/cc3000/Kconfig"
source "$APPSDIR/examples/composite/Kconfig"
source "$APPSDIR/examples/cxxtest/Kconfig"
source "$APPSDIR/examples/dhcpd/Kconfig"
source "$APPSDIR/examples/elf/Kconfig"

View File

@ -50,10 +50,6 @@ ifeq ($(CONFIG_EXAMPLES_CC3000BASIC),y)
CONFIGURED_APPS += examples/cc3000
endif
ifeq ($(CONFIG_EXAMPLES_COMPOSITE),y)
CONFIGURED_APPS += examples/composite
endif
ifeq ($(CONFIG_EXAMPLES_CXXTEST),y)
CONFIGURED_APPS += examples/cxxtest
endif

View File

@ -37,10 +37,10 @@
# Sub-directories
SUBDIRS = adc buttons can cc3000 composite cxxtest dhcpd discover elf
SUBDIRS += flash_test ftpc ftpd hello helloxx hidkbd igmp json keypadtest
SUBDIRS += lcdrw mm modbus mount mtdpart nettest nrf24l01_term nsh null
SUBDIRS += nx nxconsole nxffs nxflat nxhello nximage nxlines nxtext ostest
SUBDIRS = adc buttons can cc3000 cxxtest dhcpd discover elf flash_test
SUBDIRS += ftpc ftpd hello helloxx hidkbd igmp json keypadtest lcdrw
SUBDIRS += mm modbus mount mtdpart nettest nrf24l01_term nsh null nx
SUBDIRS += 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 usbterm watchdog wget wgetjson
@ -53,8 +53,8 @@ SUBDIRS += xmlrpc
CNTXTDIRS = pwm
ifeq ($(CONFIG_NSH_BUILTIN_APPS),y)
CNTXTDIRS += adc can cc3000 composite cxxtest dhcpd discover flash_test
CNTXTDIRS += ftpd hello helloxx json keypadtestmodbus lcdrw mtdpart nettest
CNTXTDIRS += adc can cc3000 cxxtest dhcpd discover flash_test ftpd
CNTXTDIRS += 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 += usbterm watchdog wgetjson

View File

@ -131,84 +131,6 @@ examples/cc3000
This is a test for the TI CC3000 wireless networking module.
examples/composite
^^^^^^^^^^^^^^^^^^
This example test a USB composite device. The only supported composite is
CDC/ACM serial with a USB mass storage device.
Required overall configuration:
CONFIG_USBDEV=y - USB device support
CONFIG_USBDEV_COMPOSITE=y - USB composite device support
CONFIG_COMPOSITE_IAD=y - Interface associate descriptor needed
CONFIG_CDCACM=y - USB CDC/ACM serial device support
CONFIG_CDCACM_COMPOSITE=y - USB CDC/ACM serial composite device support
CONFIG_CDCACM_IFNOBASE=0 - CDC/ACM interfaces start with number 0
CONFIG_CDCACM_STRBASE=4 - Base of string numbers (not really needed)
CONFIG_CDCACM_EPINTIN=1 - Endpoint numbers must be unique
CONFIG_CDCACM_EPBULKIN=2
CONFIG_CDCACM_EPBULKOUT=3
CONFIG_USBMSC - USB mass storage device support
CONFIG_USBMSC_COMPOSITE=y - USB mass storage composite device support
CONFIG_USBMSC_IFNOBASE=2 - USB mass storage interfaces start with number 2
CONFIG_USBMSC_STRBASE=4 - Base of string numbers (needed)
CONFIG_USBMSC_EPBULKOUT=4 - Endpoint numbers must be unique
CONFIG_USBMSC_EPBULKIN=5
CONFIG_NSH_BUILTIN_APPS
This example can be built as two NSH "built-in" commands if this option
is selected: 'conn' will connect the USB composite device; 'msdis'
will disconnect the USB composite device.
Configuration options unique to this example:
CONFIG_EXAMPLES_COMPOSITE_DEBUGMM
Enables some debug tests to check for memory usage and memory leaks.
CONFIG_EXAMPLES_COMPOSITE_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_COMPOSITE_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_COMPOSITE_DEVPATH1
The full path to the registered block driver. Default is "/dev/mmcsd0"
CONFIG_EXAMPLES_COMPOSITE_DEVMINOR2 and CONFIG_EXAMPLES_COMPOSITE_DEVPATH2
Similar parameters that would have to be provided if CONFIG_EXAMPLES_COMPOSITE_NLUNS
is 2 or 3. No defaults.
CONFIG_EXAMPLES_COMPOSITE_DEVMINOR3 and CONFIG_EXAMPLES_COMPOSITE_DEVPATH2
Similar parameters that would have to be provided if CONFIG_EXAMPLES_COMPOSITE_NLUNS
is 3. No defaults.
CONFIG_EXAMPLES_COMPOSITE_BUFLEN. Default 256.
CONFIG_EXAMPLES_COMPOSITE_TTYUSB - The minor number of the USB serial device.
Default is zero (corresponding to /dev/ttyUSB0 or /dev/ttyACM0). Default is zero.
CCONFIG_EXAMPLES_COMPOSITE_SERDEV - The string corresponding to
CONFIG_EXAMPLES_COMPOSITE_TTYUSB. The default is "/dev/ttyUSB0" (for the PL2303
emulation) or "/dev/ttyACM0" (for the CDC/ACM serial device).
CONFIG_EXAMPLES_COMPOSITE_BUFSIZE - The size of the serial I/O buffer in
bytes. Default 256 bytes.
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_COMPOSITE_TRACEINIT
Show initialization events
CONFIG_EXAMPLES_COMPOSITE_TRACECLASS
Show class driver events
CONFIG_EXAMPLES_COMPOSITE_TRACETRANSFERS
Show data transfer events
CONFIG_EXAMPLES_COMPOSITE_TRACECONTROLLER
Show controller events
CONFIG_EXAMPLES_COMPOSITE_TRACEINTERRUPTS
Show interrupt-related events.
examples/cxxtest
^^^^^^^^^^^^^^^^

View File

@ -1,64 +0,0 @@
#
# For a description of the syntax of this configuration file,
# see misc/tools/kconfig-language.txt.
#
config EXAMPLES_COMPOSITE
bool "USB composite class driver example"
default n
---help---
Enable the USB compsite class driver example
if EXAMPLES_COMPOSITE
config EXAMPLES_COMPOSITE_TRACEINIT
bool "USB Trace Initialization"
default n
depends on USBDEV_TRACE || DEBUG_USB
---help---
If USBDEV_TRACE is enabled (or DEBUG and DEBUG_USB),
then the example 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_COMPOSITE_TRACECLASS
bool "USB Trace Class"
default n
depends on USBDEV_TRACE || DEBUG_USB
---help---
If USBDEV_TRACE is enabled (or DEBUG and DEBUG_USB),
then the example 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_COMPOSITE_TRACETRANSFERS
bool "USB Trace Transfers"
default n
depends on USBDEV_TRACE || DEBUG_USB
---help---
If USBDEV_TRACE is enabled (or DEBUG and DEBUG_USB),
then the example 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_COMPOSITE_TRACECONTROLLER
bool "USB Trace Device Controller Events"
default n
depends on USBDEV_TRACE || DEBUG_USB
---help---
If USBDEV_TRACE is enabled (or DEBUG and DEBUG_USB),
then the example 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_COMPOSITE_TRACEINTERRUPTS
bool "USB Trace Device Controller Interrupt Events"
default n
depends on USBDEV_TRACE || DEBUG_USB
---help---
If USBDEV_TRACE is enabled (or DEBUG and DEBUG_USB),
then the example 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

View File

@ -3,10 +3,14 @@
# see misc/tools/kconfig-language.txt.
#
menu "USB CDC/ACM Class Commands"
menu "USB CDC/ACM Device Commands"
source "$APPSDIR/system/cdcacm/Kconfig"
endmenu
menu "USB Composite Device Commands"
source "$APPSDIR/system/composite/Kconfig"
endmenu
menu "Custom Free Memory Command"
source "$APPSDIR/system/free/Kconfig"
endmenu
@ -55,7 +59,7 @@ menu "Stack Monitor"
source "$APPSDIR/system/stackmonitor/Kconfig"
endmenu
menu "USB Mass Storage Class Commands"
menu "USB Mass Storage Device Commands"
source "$APPSDIR/system/usbmsc/Kconfig"
endmenu

View File

@ -38,6 +38,10 @@ ifeq ($(CONFIG_SYSTEM_CDCACM),y)
CONFIGURED_APPS += system/cdcacm
endif
ifeq ($(CONFIG_SYSTEM_COMPOSITE),y)
CONFIGURED_APPS += system/composite
endif
ifeq ($(CONFIG_SYSTEM_FREE),y)
CONFIGURED_APPS += system/free
endif

View File

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

156
system/composite/Kconfig Normal file
View File

@ -0,0 +1,156 @@
#
# For a description of the syntax of this configuration file,
# see misc/tools/kconfig-language.txt.
#
config SYSTEM_COMPOSITE
bool "USB composite class controls"
default n
depends on USBDEV_COMPOSITE && !KERNEL_BUILD
---help---
Enable the USB composite class controls. These controls include:
conn: Connect the mass storage device to the host
disconn: Disconnect the mass storage device to the host
if SYSTEM_COMPOSITE
if USBMSC_COMPOSITE
config SYSTEM_COMPOSITE_NLUNS
int "Number of LUNs"
default 1
---help---
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 SYSTEM_COMPOSITE_DEVMINOR1
int "LUN1 Minor Device Number"
default 0
---help---
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 SYSTEM_COMPOSITE_DEVPATH1
string "LUN1 Device Path"
default "/dev/mmcsd0"
---help---
The full path to the registered block driver. Default is
"/dev/mmcsd0"
config SYSTEM_COMPOSITE_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 SYSTEM_COMPOSITE_NLUNS < 2. Default is one.
config SYSTEM_COMPOSITE_DEVPATH2
string "LUN2 Device Path"
default "/dev/mmcsd1"
---help---
The full path to the registered block driver. Ignored if
SYSTEM_COMPOSITE_NLUNS < 2. Default is "/dev/mmcsd1"
config SYSTEM_COMPOSITE_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 SYSTEM_COMPOSITE_NLUNS < 2. Default is two.
config SYSTEM_COMPOSITE_DEVPATH3
string "LUN3 Device Path"
default "/dev/mmcsd2"
---help---
The full path to the registered block driver. Ignored if
SYSTEM_COMPOSITE_NLUNS < 2. Default is "/dev/mmcsd2"
endif # USBMSC_COMPOSITE
if CDCACM_COMPOSITE
config SYSTEM_COMPOSITE_TTYUSB
int "USB serial device minor number
default 0
---help---
The minor number of the USB serial device. Default is zero
(corresponding to /dev/ttyUSB0 or /dev/ttyACM0).
config SYSTEM_COMPOSITE_SERDEV
string "USB serial device path"
default "/dev/ttyACM0"
---help---
The string corresponding to SYSTEM_COMPOSITE_TTYUSB. If
SYSTEM_COMPOSITE_TTYUSB is zero, then this would be "/dev/ttyUSB0"
(for the PL2303 emulation) or "/dev/ttyACM0" (for the CDC/ACM serial
device).
config SYSTEM_COMPOSITE_BUFSIZE
int "Serial I/O buffer size"
default 256
---help---
The size of the serial I/O buffer in bytes. Default 256 bytes.
endif # CDCACM_COMPOSITE
if USBDEV_TRACE || DEBUG_USB
config SYSTEM_COMPOSITE_TRACEINIT
bool "USB Trace Initialization"
default n
---help---
If USBDEV_TRACE is enabled (or DEBUG and DEBUG_USB),
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 SYSTEM_COMPOSITE_TRACECLASS
bool "USB Trace Class"
default n
---help---
If USBDEV_TRACE is enabled (or DEBUG and DEBUG_USB),
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 SYSTEM_COMPOSITE_TRACETRANSFERS
bool "USB Trace Transfers"
default n
---help---
If USBDEV_TRACE is enabled (or DEBUG and DEBUG_USB),
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 SYSTEM_COMPOSITE_TRACECONTROLLER
bool "USB Trace Device Controller Events"
default n
---help---
If USBDEV_TRACE is enabled (or DEBUG and DEBUG_USB),
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 SYSTEM_COMPOSITE_TRACEINTERRUPTS
bool "USB Trace Device Controller Interrupt Events"
default n
---help---
If USBDEV_TRACE is enabled (or DEBUG and DEBUG_USB),
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 # USBDEV_TRACE || DEBUG_USB
config SYSTEM_COMPOSITE_DEBUGMM
bool "Memory usage debug"
default n
---help---
Enables some debug tests to check for memory usage and memory leaks.
endif

View File

@ -1,5 +1,5 @@
############################################################################
# apps/examples/composite/Makefile
# apps/system/composite/Makefile
#
# Copyright (C) 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 = composite_main.c

76
system/composite/README.txt Executable file
View File

@ -0,0 +1,76 @@
system/composite
^^^^^^^^^^^^^^^^^^
This logic adds a NXH command to control a USB composite device. The only
supported composite is CDC/ACM serial with a USB mass storage device.
Required overall configuration:
CONFIG_USBDEV=y - USB device support
CONFIG_USBDEV_COMPOSITE=y - USB composite device support
CONFIG_COMPOSITE_IAD=y - Interface associate descriptor needed
CONFIG_CDCACM=y - USB CDC/ACM serial device support
CONFIG_CDCACM_COMPOSITE=y - USB CDC/ACM serial composite device support
CONFIG_CDCACM_IFNOBASE=0 - CDC/ACM interfaces start with number 0
CONFIG_CDCACM_STRBASE=4 - Base of string numbers (not really needed)
CONFIG_CDCACM_EPINTIN=1 - Endpoint numbers must be unique
CONFIG_CDCACM_EPBULKIN=2
CONFIG_CDCACM_EPBULKOUT=3
CONFIG_USBMSC - USB mass storage device support
CONFIG_USBMSC_COMPOSITE=y - USB mass storage composite device support
CONFIG_USBMSC_IFNOBASE=2 - USB mass storage interfaces start with number 2
CONFIG_USBMSC_STRBASE=4 - Base of string numbers (needed)
CONFIG_USBMSC_EPBULKOUT=4 - Endpoint numbers must be unique
CONFIG_USBMSC_EPBULKIN=5
CONFIG_NSH_BUILTIN_APPS
This add-on can be built as two NSH "built-in" commands if this option
is selected: 'conn' will connect the USB composite device; 'msdis'
will disconnect the USB composite device.
Configuration options unique to this add-on:
CONFIG_SYSTEM_COMPOSITE_DEBUGMM
Enables some debug tests to check for memory usage and memory leaks.
CONFIG_SYSTEM_COMPOSITE_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_SYSTEM_COMPOSITE_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_SYSTEM_COMPOSITE_DEVPATH1
The full path to the registered block driver. Default is "/dev/mmcsd0"
CONFIG_SYSTEM_COMPOSITE_DEVMINOR2 and CONFIG_SYSTEM_COMPOSITE_DEVPATH2
Similar parameters that would have to be provided if CONFIG_SYSTEM_COMPOSITE_NLUNS
is 2 or 3. No defaults.
CONFIG_SYSTEM_COMPOSITE_DEVMINOR3 and CONFIG_SYSTEM_COMPOSITE_DEVPATH2
Similar parameters that would have to be provided if CONFIG_SYSTEM_COMPOSITE_NLUNS
is 3. No defaults.
CONFIG_SYSTEM_COMPOSITE_TTYUSB - The minor number of the USB serial device.
Default is zero (corresponding to /dev/ttyUSB0 or /dev/ttyACM0). Default is zero.
CCONFIG_SYSTEM_COMPOSITE_SERDEV - The string corresponding to
CONFIG_SYSTEM_COMPOSITE_TTYUSB. The default is "/dev/ttyUSB0" (for the PL2303
emulation) or "/dev/ttyACM0" (for the CDC/ACM serial device).
CONFIG_SYSTEM_COMPOSITE_BUFSIZE - The size of the serial I/O buffer in
bytes. Default 256 bytes.
If CONFIG_USBDEV_TRACE is enabled (or CONFIG_DEBUG and CONFIG_DEBUG_USB), then
the add-on code will also manage the USB trace output. The amount of trace output
can be controlled using:
CONFIG_SYSTEM_COMPOSITE_TRACEINIT
Show initialization events
CONFIG_SYSTEM_COMPOSITE_TRACECLASS
Show class driver events
CONFIG_SYSTEM_COMPOSITE_TRACETRANSFERS
Show data transfer events
CONFIG_SYSTEM_COMPOSITE_TRACECONTROLLER
Show controller events
CONFIG_SYSTEM_COMPOSITE_TRACEINTERRUPTS
Show interrupt-related events.

View File

@ -1,7 +1,7 @@
/****************************************************************************
* examples/composite/composite.h
* system/composite/composite.h
*
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
* Copyright (C) 2012-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -33,8 +33,8 @@
*
****************************************************************************/
#ifndef __EXAMPLES_COMPOSITE_COMPOSITE_H
#define __EXAMPLES_COMPOSITE_COMPOSITE_H
#ifndef __SYSTEM_COMPOSITE_COMPOSITE_H
#define __SYSTEM_COMPOSITE_COMPOSITE_H
/****************************************************************************
* Included Files
@ -73,67 +73,63 @@
# error "USB mass storage composite device support is not enabled (CONFIG_USBMSC_COMPOSITE)"
#endif
/* Example MSC default values */
/* Add-on Mass Storagte Class default values */
#ifndef CONFIG_EXAMPLES_COMPOSITE_NLUNS
# define CONFIG_EXAMPLES_COMPOSITE_NLUNS 1
#ifndef CONFIG_SYSTEM_COMPOSITE_NLUNS
# define CONFIG_SYSTEM_COMPOSITE_NLUNS 1
#endif
#ifndef CONFIG_EXAMPLES_COMPOSITE_DEVMINOR1
# define CONFIG_EXAMPLES_COMPOSITE_DEVMINOR1 0
#ifndef CONFIG_SYSTEM_COMPOSITE_DEVMINOR1
# define CONFIG_SYSTEM_COMPOSITE_DEVMINOR1 0
#endif
#ifndef CONFIG_EXAMPLES_COMPOSITE_DEVPATH1
# define CONFIG_EXAMPLES_COMPOSITE_DEVPATH1 "/dev/mmcsd0"
#ifndef CONFIG_SYSTEM_COMPOSITE_DEVPATH1
# define CONFIG_SYSTEM_COMPOSITE_DEVPATH1 "/dev/mmcsd0"
#endif
#if CONFIG_EXAMPLES_COMPOSITE_NLUNS > 1
# ifndef CONFIG_EXAMPLES_COMPOSITE_DEVMINOR2
# error "CONFIG_EXAMPLES_COMPOSITE_DEVMINOR2 for LUN=2"
#if CONFIG_SYSTEM_COMPOSITE_NLUNS > 1
# ifndef CONFIG_SYSTEM_COMPOSITE_DEVMINOR2
# error "CONFIG_SYSTEM_COMPOSITE_DEVMINOR2 for LUN=2"
# endif
# ifndef CONFIG_EXAMPLES_COMPOSITE_DEVPATH2
# error "CONFIG_EXAMPLES_COMPOSITE_DEVPATH2 for LUN=2"
# ifndef CONFIG_SYSTEM_COMPOSITE_DEVPATH2
# error "CONFIG_SYSTEM_COMPOSITE_DEVPATH2 for LUN=2"
# endif
# if CONFIG_EXAMPLES_COMPOSITE_NLUNS > 2
# ifndef CONFIG_EXAMPLES_COMPOSITE_DEVMINOR3
# error "CONFIG_EXAMPLES_COMPOSITE_DEVMINOR2 for LUN=3"
# if CONFIG_SYSTEM_COMPOSITE_NLUNS > 2
# ifndef CONFIG_SYSTEM_COMPOSITE_DEVMINOR3
# error "CONFIG_SYSTEM_COMPOSITE_DEVMINOR2 for LUN=3"
# endif
# ifndef CONFIG_EXAMPLES_COMPOSITE_DEVPATH2
# error "CONFIG_EXAMPLES_COMPOSITE_DEVPATH2 for LUN=3"
# ifndef CONFIG_SYSTEM_COMPOSITE_DEVPATH2
# error "CONFIG_SYSTEM_COMPOSITE_DEVPATH2 for LUN=3"
# endif
# if CONFIG_EXAMPLES_COMPOSITE_NLUNS > 3
# error "CONFIG_EXAMPLES_COMPOSITE_NLUNS must be {1,2,3}"
# if CONFIG_SYSTEM_COMPOSITE_NLUNS > 3
# error "CONFIG_SYSTEM_COMPOSITE_NLUNS must be {1,2,3}"
# endif
# endif
#endif
#ifndef CONFIG_EXAMPLES_COMPOSITE_BUFLEN
# define CONFIG_EXAMPLES_COMPOSITE_BUFLEN 256
/* Add-on CDC/ACM default values */
#ifndef CONFIG_SYSTEM_COMPOSITE_TTYUSB
# define CONFIG_SYSTEM_COMPOSITE_TTYUSB 0
#endif
/* Example MSC default values */
#ifndef CONFIG_EXAMPLES_COMPOSITE_TTYUSB
# define CONFIG_EXAMPLES_COMPOSITE_TTYUSB 0
#endif
#ifndef CONFIG_EXAMPLES_COMPOSITE_SERDEV
# if CONFIG_EXAMPLES_COMPOSITE_TTYUSB != 0
# error "Serial device unknown (CONFIG_EXAMPLES_COMPOSITE_SERDEV)"
#ifndef CONFIG_SYSTEM_COMPOSITE_SERDEV
# if CONFIG_SYSTEM_COMPOSITE_TTYUSB != 0
# error "Serial device unknown (CONFIG_SYSTEM_COMPOSITE_SERDEV)"
# elif defined(CONFIG_CDCACM)
# define CONFIG_EXAMPLES_COMPOSITE_SERDEV "/dev/ttyACM0"
# define CONFIG_SYSTEM_COMPOSITE_SERDEV "/dev/ttyACM0"
# else
# define CONFIG_EXAMPLES_COMPOSITE_SERDEV "/dev/ttyUSB0"
# define CONFIG_SYSTEM_COMPOSITE_SERDEV "/dev/ttyUSB0"
# endif
#endif
#ifndef CONFIG_EXAMPLES_COMPOSITE_BUFSIZE
# define CONFIG_EXAMPLES_COMPOSITE_BUFSIZE 256
#ifndef CONFIG_SYSTEM_COMPOSITE_BUFSIZE
# define CONFIG_SYSTEM_COMPOSITE_BUFSIZE 256
#endif
/* Trace initialization *****************************************************/
#ifdef CONFIG_EXAMPLES_COMPOSITE_TRACEINIT
#ifdef CONFIG_SYSTEM_COMPOSITE_TRACEINIT
# define TRACE_INIT_BITS (TRACE_INIT_BIT)
#else
# define TRACE_INIT_BITS (0)
@ -141,26 +137,26 @@
#define TRACE_ERROR_BITS (TRACE_DEVERROR_BIT|TRACE_CLSERROR_BIT)
#ifdef CONFIG_EXAMPLES_COMPOSITE_TRACECLASS
#ifdef CONFIG_SYSTEM_COMPOSITE_TRACECLASS
# define TRACE_CLASS_BITS (TRACE_CLASS_BIT|TRACE_CLASSAPI_BIT|TRACE_CLASSSTATE_BIT)
#else
# define TRACE_CLASS_BITS (0)
#endif
#ifdef CONFIG_EXAMPLES_COMPOSITE_TRACETRANSFERS
#ifdef CONFIG_SYSTEM_COMPOSITE_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_COMPOSITE_TRACECONTROLLER
#ifdef CONFIG_SYSTEM_COMPOSITE_TRACECONTROLLER
# define TRACE_CONTROLLER_BITS (TRACE_EP_BIT|TRACE_DEV_BIT)
#else
# define TRACE_CONTROLLER_BITS (0)
#endif
#ifdef CONFIG_EXAMPLES_COMPOSITE_TRACEINTERRUPTS
#ifdef CONFIG_SYSTEM_COMPOSITE_TRACEINTERRUPTS
# define TRACE_INTERRUPT_BITS (TRACE_INTENTRY_BIT|TRACE_INTDECODE_BIT|TRACE_INTEXIT_BIT)
#else
# define TRACE_INTERRUPT_BITS (0)
@ -193,16 +189,16 @@
* 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.
*/
struct composite_state_s
{
/* This is the handle that references to this particular USB composite driver
* instance. It is only needed if the example is built using
* CONFIG_NSH_BUILTIN_APPS. In this case, the value of the driver handle
* must be remembered between the 'conn' and 'disconn' commands.
/* This is the handle that references to this particular USB composite
* driver instance. It is only needed if the add-on is built using
* CONFIG_NSH_BUILTIN_APPS. In this case, the value of the driver handle
* must be remembered between the 'conn' and 'disconn' commands.
*/
FAR void *cmphandle; /* Composite device handle */
@ -219,7 +215,7 @@ struct composite_state_s
* usage and for tracking down memoryh leaks.
*/
#ifdef CONFIG_EXAMPLES_COMPOSITE_DEBUGMM
#ifdef CONFIG_SYSTEM_COMPOSITE_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 */
@ -228,7 +224,7 @@ struct composite_state_s
/* Serial I/O buffer */
#if !defined(CONFIG_NSH_BUILTIN_APPS) || defined(CONFIG_DISABLE_SIGNALS)
uint8_t serbuf[CONFIG_EXAMPLES_COMPOSITE_BUFSIZE];
uint8_t serbuf[CONFIG_SYSTEM_COMPOSITE_BUFSIZE];
#endif
};
@ -236,7 +232,7 @@ struct composite_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.
*/
@ -256,4 +252,4 @@ extern struct composite_state_s g_composite;
extern int composite_archinitialize(void);
#endif /* __EXAMPLES_COMPOSITE_COMPOSITE_H */
#endif /* __SYSTEM_COMPOSITE_COMPOSITE_H */

View File

@ -1,7 +1,7 @@
/****************************************************************************
* examples/composite/composite_main.c
* system/composite/composite_main.c
*
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
* Copyright (C) 2012-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -63,7 +63,7 @@
* 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.
*/
@ -77,7 +77,7 @@ struct composite_state_s g_composite;
* Name: show_memory_usage
****************************************************************************/
#ifdef CONFIG_EXAMPLES_COMPOSITE_DEBUGMM
#ifdef CONFIG_SYSTEM_COMPOSITE_DEBUGMM
static void show_memory_usage(struct mallinfo *mmbefore,
struct mallinfo *mmafter)
{
@ -107,7 +107,7 @@ static void show_memory_usage(struct mallinfo *mmbefore,
* Name: check_test_memory_usage
****************************************************************************/
#ifdef CONFIG_EXAMPLES_COMPOSITE_DEBUGMM
#ifdef CONFIG_SYSTEM_COMPOSITE_DEBUGMM
static void check_test_memory_usage(FAR const char *msg)
{
/* Get the current memory usage */
@ -139,7 +139,7 @@ static void check_test_memory_usage(FAR const char *msg)
* Name: check_test_memory_usage
****************************************************************************/
#ifdef CONFIG_EXAMPLES_COMPOSITE_DEBUGMM
#ifdef CONFIG_SYSTEM_COMPOSITE_DEBUGMM
static void final_memory_usage(FAR const char *msg)
{
/* Get the current memory usage */
@ -382,12 +382,12 @@ static int open_serial(void)
do
{
message("open_serial: Opening USB serial driver\n");
g_composite.outfd = open(CONFIG_EXAMPLES_COMPOSITE_SERDEV, O_WRONLY);
g_composite.outfd = open(CONFIG_SYSTEM_COMPOSITE_SERDEV, O_WRONLY);
if (g_composite.outfd < 0)
{
errcode = errno;
message("open_serial: ERROR: Failed to open %s for writing: %d\n",
CONFIG_EXAMPLES_COMPOSITE_SERDEV, errcode);
CONFIG_SYSTEM_COMPOSITE_SERDEV, errcode);
/* ENOTCONN means that the USB device is not yet connected */
@ -421,12 +421,12 @@ static int open_serial(void)
/* Open the USB serial device for reading (non-blocking) */
g_composite.infd = open(CONFIG_EXAMPLES_COMPOSITE_SERDEV, O_RDONLY|O_NONBLOCK);
g_composite.infd = open(CONFIG_SYSTEM_COMPOSITE_SERDEV, O_RDONLY|O_NONBLOCK);
if (g_composite.infd < 0)
{
errcode = errno;
message("open_serial: ERROR: Failed to open%s for reading: %d\n",
CONFIG_EXAMPLES_COMPOSITE_SERDEV, errcode);
CONFIG_SYSTEM_COMPOSITE_SERDEV, errcode);
close(g_composite.outfd);
return -errcode;
}
@ -448,7 +448,7 @@ static int echo_serial(void)
/* Read data */
bytesread = read(g_composite.infd, g_composite.serbuf, CONFIG_EXAMPLES_COMPOSITE_BUFSIZE);
bytesread = read(g_composite.infd, g_composite.serbuf, CONFIG_SYSTEM_COMPOSITE_BUFSIZE);
if (bytesread < 0)
{
errcode = errno;
@ -517,8 +517,8 @@ int board_mscclassobject(FAR struct usbdevclass_driver_s **classdev)
/* Configure the mass storage device */
message("board_mscclassobject: Configuring with NLUNS=%d\n", CONFIG_EXAMPLES_COMPOSITE_NLUNS);
ret = usbmsc_configure(CONFIG_EXAMPLES_COMPOSITE_NLUNS, &g_composite.mschandle);
message("board_mscclassobject: Configuring with NLUNS=%d\n", CONFIG_SYSTEM_COMPOSITE_NLUNS);
ret = usbmsc_configure(CONFIG_SYSTEM_COMPOSITE_NLUNS, &g_composite.mschandle);
if (ret < 0)
{
message("board_mscclassobject: usbmsc_configure failed: %d\n", -ret);
@ -529,38 +529,38 @@ int board_mscclassobject(FAR struct usbdevclass_driver_s **classdev)
/* Bind the LUN(s) */
message("board_mscclassobject: Bind LUN=0 to %s\n", CONFIG_EXAMPLES_COMPOSITE_DEVPATH1);
ret = usbmsc_bindlun(g_composite.mschandle, CONFIG_EXAMPLES_COMPOSITE_DEVPATH1, 0, 0, 0, false);
message("board_mscclassobject: Bind LUN=0 to %s\n", CONFIG_SYSTEM_COMPOSITE_DEVPATH1);
ret = usbmsc_bindlun(g_composite.mschandle, CONFIG_SYSTEM_COMPOSITE_DEVPATH1, 0, 0, 0, false);
if (ret < 0)
{
message("board_mscclassobject: usbmsc_bindlun failed for LUN 1 using %s: %d\n",
CONFIG_EXAMPLES_COMPOSITE_DEVPATH1, -ret);
CONFIG_SYSTEM_COMPOSITE_DEVPATH1, -ret);
usbmsc_uninitialize(g_composite.mschandle);
return ret;
}
check_test_memory_usage("After usbmsc_bindlun()");
#if CONFIG_EXAMPLES_COMPOSITE_NLUNS > 1
#if CONFIG_SYSTEM_COMPOSITE_NLUNS > 1
message("board_mscclassobject: Bind LUN=1 to %s\n", CONFIG_EXAMPLES_COMPOSITE_DEVPATH2);
ret = usbmsc_bindlun(g_composite.mschandle, CONFIG_EXAMPLES_COMPOSITE_DEVPATH2, 1, 0, 0, false);
message("board_mscclassobject: Bind LUN=1 to %s\n", CONFIG_SYSTEM_COMPOSITE_DEVPATH2);
ret = usbmsc_bindlun(g_composite.mschandle, CONFIG_SYSTEM_COMPOSITE_DEVPATH2, 1, 0, 0, false);
if (ret < 0)
{
message("board_mscclassobject: usbmsc_bindlun failed for LUN 2 using %s: %d\n",
CONFIG_EXAMPLES_COMPOSITE_DEVPATH2, -ret);
CONFIG_SYSTEM_COMPOSITE_DEVPATH2, -ret);
usbmsc_uninitialize(g_composite.mschandle);
return ret;
}
check_test_memory_usage("After usbmsc_bindlun() #2");
#if CONFIG_EXAMPLES_COMPOSITE_NLUNS > 2
#if CONFIG_SYSTEM_COMPOSITE_NLUNS > 2
message("board_mscclassobject: Bind LUN=2 to %s\n", CONFIG_EXAMPLES_COMPOSITE_DEVPATH3);
ret = usbmsc_bindlun(g_composite.mschandle, CONFIG_EXAMPLES_COMPOSITE_DEVPATH3, 2, 0, 0, false);
message("board_mscclassobject: Bind LUN=2 to %s\n", CONFIG_SYSTEM_COMPOSITE_DEVPATH3);
ret = usbmsc_bindlun(g_composite.mschandle, CONFIG_SYSTEM_COMPOSITE_DEVPATH3, 2, 0, 0, false);
if (ret < 0)
{
message("board_mscclassobject: usbmsc_bindlun failed for LUN 3 using %s: %d\n",
CONFIG_EXAMPLES_COMPOSITE_DEVPATH3, -ret);
CONFIG_SYSTEM_COMPOSITE_DEVPATH3, -ret);
usbmsc_uninitialize(g_composite.mschandle);
return ret;
}
@ -629,7 +629,7 @@ int board_cdcclassobject(FAR struct usbdevclass_driver_s **classdev)
/* Initialize the USB serial driver */
message("board_cdcclassobject: Initializing USB serial driver\n");
ret = cdcacm_classobject(CONFIG_EXAMPLES_COMPOSITE_TTYUSB, classdev);
ret = cdcacm_classobject(CONFIG_SYSTEM_COMPOSITE_TTYUSB, classdev);
if (ret < 0)
{
message("board_cdcclassobject: ERROR: Failed to create the USB serial device: %d\n", -ret);
@ -692,7 +692,7 @@ int conn_main(int argc, char *argv[])
}
#endif
#ifdef CONFIG_EXAMPLES_COMPOSITE_DEBUGMM
#ifdef CONFIG_SYSTEM_COMPOSITE_DEBUGMM
# ifdef CONFIG_CAN_PASS_STRUCTS
g_composite.mmstart = mallinfo();
g_composite.mmprevious = g_composite.mmstart;