From 8f6700143c5b021a5a1bd3e21a8c20f177e8e9f2 Mon Sep 17 00:00:00 2001 From: patacongo Date: Thu, 26 Jan 2012 23:14:27 +0000 Subject: Add a text for the new composite USB device git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4341 42af7a65-404d-4744-a932-0658087f49c3 --- apps/examples/Makefile | 13 +- apps/examples/README.txt | 67 +- apps/examples/composite/Makefile | 111 ++ apps/examples/composite/composite.h | 267 +++++ apps/examples/composite/composite_main.c | 846 +++++++++++++++ nuttx/Documentation/NuttxPortingGuide.html | 16 + nuttx/configs/README.txt | 11 + nuttx/configs/stm3210e-eval/composite/Make.defs | 174 +++ nuttx/configs/stm3210e-eval/composite/appconfig | 39 + nuttx/configs/stm3210e-eval/composite/defconfig | 1114 ++++++++++++++++++++ nuttx/configs/stm3210e-eval/composite/ld.script | 112 ++ .../configs/stm3210e-eval/composite/ld.script.dfu | 111 ++ nuttx/configs/stm3210e-eval/composite/setenv.sh | 67 ++ nuttx/configs/stm3210e-eval/src/Makefile | 4 + nuttx/configs/stm3210e-eval/src/up_composite.c | 163 +++ nuttx/drivers/usbdev/cdcacm.c | 4 +- nuttx/drivers/usbdev/composite.c | 19 +- nuttx/drivers/usbdev/composite.h | 4 +- nuttx/drivers/usbdev/usbmsc.c | 48 +- nuttx/include/nuttx/usb/cdcacm.h | 7 +- nuttx/include/nuttx/usb/composite.h | 4 +- nuttx/include/nuttx/usb/usbdev_trace.h | 2 +- nuttx/include/nuttx/usb/usbmsc.h | 8 +- 23 files changed, 3183 insertions(+), 28 deletions(-) create mode 100644 apps/examples/composite/Makefile create mode 100644 apps/examples/composite/composite.h create mode 100644 apps/examples/composite/composite_main.c create mode 100755 nuttx/configs/stm3210e-eval/composite/Make.defs create mode 100644 nuttx/configs/stm3210e-eval/composite/appconfig create mode 100755 nuttx/configs/stm3210e-eval/composite/defconfig create mode 100755 nuttx/configs/stm3210e-eval/composite/ld.script create mode 100755 nuttx/configs/stm3210e-eval/composite/ld.script.dfu create mode 100755 nuttx/configs/stm3210e-eval/composite/setenv.sh create mode 100644 nuttx/configs/stm3210e-eval/src/up_composite.c diff --git a/apps/examples/Makefile b/apps/examples/Makefile index 297924d0e..c2e5fe3de 100644 --- a/apps/examples/Makefile +++ b/apps/examples/Makefile @@ -1,7 +1,7 @@ ############################################################################ # apps/examples/Makefile # -# Copyright (C) 2011 Gregory Nutt. All rights reserved. +# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -37,10 +37,11 @@ # Sub-directories -SUBDIRS = adc buttons can dhcpd ftpc hello helloxx hidkbd igmp lcdrw mm \ - mount nettest nsh null nx nxffs nxflat nxhello nximage nxlines \ - nxtext ostest pashello pipe poll pwm rgmp romfs sendmail serloop \ - thttpd tiff touchscreen udp uip usbserial usbstorage usbterm wget wlan +SUBDIRS = adc buttons can composite dhcpd ftpc hello helloxx hidkbd igmp \ + lcdrw mm mount nettest nsh null nx nxffs nxflat nxhello nximage \ + nxlines nxtext ostest pashello pipe poll pwm rgmp romfs sendmail \ + serloop thttpd tiff touchscreen udp uip usbserial usbstorage usbterm \ + wget wlan # Sub-directories that might need context setup. Directories may need # context setup for a variety of reasons, but the most common is because @@ -55,7 +56,7 @@ SUBDIRS = adc buttons can dhcpd ftpc hello helloxx hidkbd igmp lcdrw mm \ CNTXTDIRS = pwm ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) -CNTXTDIRS += adc can dhcpd nettest +CNTXTDIRS += adc can composite dhcpd nettest endif ifeq ($(CONFIG_EXAMPLES_HELLOXX_BUILTIN),y) diff --git a/apps/examples/README.txt b/apps/examples/README.txt index b123a9d7e..136e0b57d 100644 --- a/apps/examples/README.txt +++ b/apps/examples/README.txt @@ -110,6 +110,71 @@ examples/can built-in, the default is 32. Otherwise messages are sent and received indefinitely. +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 - USB device support + CONFIG_USBDEV_COMPOSITE - USB composite device support + CONFIG_CDCACM - USB CDC/ACM serial device support + CONFIG_CDCACM_COMPOSITE - USB CDC/ACM serial composite device support + CONFIG_USBMSC - USB mass storage device support + CONFIG_USBMSC_COMPOSITE - USB mass storage composite device support + + 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. + + 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. Default is zero. + CCONFIG_EXAMPLES_COMPOSITE_SERDEV - The string corresponding to + CONFIG_EXAMPLES_COMPOSITE_TTYUSB. The default is "/dev/ttyUSB0". + CONFIG_EXAMPLES_COMPOSITE_BUFSIZE - The size of the serial I/O buffer in + bytes. Default 256 byters. + + 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/dhcpd ^^^^^^^^^^^^^^ @@ -1046,7 +1111,7 @@ examples/usbstorage CONFIG_EXAMPLES_USBMSC_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' + 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 diff --git a/apps/examples/composite/Makefile b/apps/examples/composite/Makefile new file mode 100644 index 000000000..17c9f6d18 --- /dev/null +++ b/apps/examples/composite/Makefile @@ -0,0 +1,111 @@ +############################################################################ +# apps/examples/composite/Makefile +# +# Copyright (C) 2012 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config +-include $(TOPDIR)/Make.defs +include $(APPDIR)/Make.defs + +# USB device mass storage example + +ASRCS = +CSRCS = composite_main.c + +AOBJS = $(ASRCS:.S=$(OBJEXT)) +COBJS = $(CSRCS:.c=$(OBJEXT)) + +SRCS = $(ASRCS) $(CSRCS) +OBJS = $(AOBJS) $(COBJS) + +ifeq ($(WINTOOL),y) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" +else + BIN = "$(APPDIR)/libapps$(LIBEXT)" +endif + +ROOTDEPPATH = --dep-path . + +# USB storage built-in application info + +APPNAME1 = conn +PRIORITY1 = SCHED_PRIORITY_DEFAULT +STACKSIZE1 = 2048 + +APPNAME2 = disconn +PRIORITY2 = SCHED_PRIORITY_DEFAULT +STACKSIZE2 = 2048 + +# Common build + +VPATH = + +all: .built +.PHONY: context clean depend distclean + +$(AOBJS): %$(OBJEXT): %.S + $(call ASSEMBLE, $<, $@) + +$(COBJS): %$(OBJEXT): %.c + $(call COMPILE, $<, $@) + +.built: $(OBJS) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) + @touch .built + +.context: +ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) + $(call REGISTER,$(APPNAME1),$(PRIORITY1),$(STACKSIZE1),$(APPNAME1)_main) + $(call REGISTER,$(APPNAME2),$(PRIORITY2),$(STACKSIZE2),$(APPNAME2)_main) + @touch $@ +endif + +context: .context + +.depend: Makefile $(SRCS) + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @touch $@ + +depend: .depend + +clean: + @rm -f *.o *~ .*.swp .built + $(call CLEAN) + +distclean: clean + @rm -f Make.dep .depend + +-include Make.dep + diff --git a/apps/examples/composite/composite.h b/apps/examples/composite/composite.h new file mode 100644 index 000000000..48e4b155f --- /dev/null +++ b/apps/examples/composite/composite.h @@ -0,0 +1,267 @@ +/**************************************************************************** + * examples/composite/composite.h + * + * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __EXAMPLES_COMPOSITE_COMPOSITE_H +#define __EXAMPLES_COMPOSITE_COMPOSITE_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include + +/**************************************************************************** + * Pre-Processor Definitions + ****************************************************************************/ +/* Configuration ************************************************************/ +/* OS/Driver configuration checkes */ + +#ifndef CONFIG_USBDEV +# error "USB device support is not enabled (CONFIG_USBDEV)" +#endif + +#ifndef CONFIG_USBDEV_COMPOSITE +# error "USB composite device support is not enabled (CONFIG_USBDEV_COMPOSITE)" +#endif + +#ifndef CONFIG_CDCACM +# error "USB CDC/ACM serial device support is not enabled (CONFIG_CDCACM)" +#endif + +#ifndef CONFIG_CDCACM_COMPOSITE +# error "USB CDC/ACM serial composite device support is not enabled (CONFIG_CDCACM_COMPOSITE)" +#endif + +#ifndef CONFIG_USBMSC +# error "USB mass storage device support is not enabled (CONFIG_USBMSC)" +#endif + +#ifndef CONFIG_USBMSC_COMPOSITE +# error "USB mass storage composite device support is not enabled (CONFIG_USBMSC_COMPOSITE)" +#endif + +/* Example MSC default values */ + +#ifndef CONFIG_EXAMPLES_COMPOSITE_NLUNS +# define CONFIG_EXAMPLES_COMPOSITE_NLUNS 1 +#endif + +#ifndef CONFIG_EXAMPLES_COMPOSITE_DEVMINOR1 +# define CONFIG_EXAMPLES_COMPOSITE_DEVMINOR1 0 +#endif + +#ifndef CONFIG_EXAMPLES_COMPOSITE_DEVPATH1 +# define CONFIG_EXAMPLES_COMPOSITE_DEVPATH1 "/dev/mmcsd0" +#endif + +#if CONFIG_EXAMPLES_COMPOSITE_NLUNS > 1 +# ifndef CONFIG_EXAMPLES_COMPOSITE_DEVMINOR2 +# error "CONFIG_EXAMPLES_COMPOSITE_DEVMINOR2 for LUN=2" +# endif +# ifndef CONFIG_EXAMPLES_COMPOSITE_DEVPATH2 +# error "CONFIG_EXAMPLES_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" +# endif +# ifndef CONFIG_EXAMPLES_COMPOSITE_DEVPATH2 +# error "CONFIG_EXAMPLES_COMPOSITE_DEVPATH2 for LUN=3" +# endif +# if CONFIG_EXAMPLES_COMPOSITE_NLUNS > 3 +# error "CONFIG_EXAMPLES_COMPOSITE_NLUNS must be {1,2,3}" +# endif +# endif +#endif + +#ifndef CONFIG_EXAMPLES_COMPOSITE_BUFLEN +# define CONFIG_EXAMPLES_COMPOSITE_BUFLEN 256 +#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)" +# else +# define CONFIG_EXAMPLES_COMPOSITE_SERDEV "/dev/ttyUSB0" +# endif +#endif + +#ifndef CONFIG_EXAMPLES_COMPOSITE_BUFSIZE +# define CONFIG_EXAMPLES_COMPOSITE_BUFSIZE 256 +#endif + +/* Trace initialization *****************************************************/ + +#ifdef CONFIG_EXAMPLES_COMPOSITE_TRACEINIT +# define TRACE_INIT_BITS (TRACE_INIT_BIT) +#else +# define TRACE_INIT_BITS (0) +#endif + +#define TRACE_ERROR_BITS (TRACE_DEVERROR_BIT|TRACE_CLSERROR_BIT) + +#ifdef CONFIG_EXAMPLES_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 +# 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 +# define TRACE_CONTROLLER_BITS (TRACE_EP_BIT|TRACE_DEV_BIT) +#else +# define TRACE_CONTROLLER_BITS (0) +#endif + +#ifdef CONFIG_EXAMPLES_COMPOSITE_TRACEINTERRUPTS +# define TRACE_INTERRUPT_BITS (TRACE_INTENTRY_BIT|TRACE_INTDECODE_BIT|TRACE_INTEXIT_BIT) +#else +# define TRACE_INTERRUPT_BITS (0) +#endif + +#define TRACE_BITSET (TRACE_INIT_BITS|TRACE_ERROR_BITS|TRACE_CLASS_BITS|\ + TRACE_TRANSFER_BITS|TRACE_CONTROLLER_BITS|TRACE_INTERRUPT_BITS) + +/* Entry point **************************************************************/ + +#ifdef CONFIG_NSH_BUILTIN_APPS +# define MAIN_NAME conn_main +# define MAIN_NAME_STRING "conn" +#else +# define MAIN_NAME user_start +# define MAIN_NAME_STRING "user_start" +#endif + +/* Debug ********************************************************************/ + +#ifdef CONFIG_CPP_HAVE_VARARGS +# ifdef CONFIG_DEBUG +# define message(...) lib_lowprintf(__VA_ARGS__) +# define msgflush() +# else +# define message(...) printf(__VA_ARGS__) +# define msgflush() fflush(stdout) +# endif +#else +# ifdef CONFIG_DEBUG +# define message lib_lowprintf +# define msgflush() +# else +# define message printf +# define msgflush() fflush(stdout) +# endif +#endif + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +/* All global variables used by this example 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. + */ + + FAR void *cmphandle; /* Composite device handle */ + FAR void *mschandle; /* Mass storage device handle */ + + /* Serial file descriptors */ + +#if !defined(CONFIG_NSH_BUILTIN_APPS) || defined(CONFIG_DISABLE_SIGNALS) + int outfd; /* Blocking write-only */ + int infd; /* Non-blockig read-only */ +#endif + + /* Heap usage samples. These are useful for checking USB storage memory + * usage and for tracking down memoryh leaks. + */ + +#ifdef CONFIG_EXAMPLES_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 */ +#endif + + /* Serial I/O buffer */ + +#if !defined(CONFIG_NSH_BUILTIN_APPS) || defined(CONFIG_DISABLE_SIGNALS) + uint8_t serbuf[CONFIG_EXAMPLES_COMPOSITE_BUFSIZE]; +#endif +}; + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +/* All global variables used by this example are packed into a structure in + * order to avoid name collisions. + */ + +extern struct composite_state_s g_composite; + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: composite_archinitialize + * + * Description: + * Perform architecture specific initialization. + * + ****************************************************************************/ + +extern int composite_archinitialize(void); + +#endif /* __EXAMPLES_COMPOSITE_COMPOSITE_H */ diff --git a/apps/examples/composite/composite_main.c b/apps/examples/composite/composite_main.c new file mode 100644 index 000000000..b6e9bec9d --- /dev/null +++ b/apps/examples/composite/composite_main.c @@ -0,0 +1,846 @@ +/**************************************************************************** + * examples/usbstorage/composite_main.c + * + * Copyright (C) 2008-2012 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "composite.h" + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/* All global variables used by this example are packed into a structure in + * order to avoid name collisions. + */ + +struct composite_state_s g_composite; + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: show_memory_usage + ****************************************************************************/ + +#ifdef CONFIG_EXAMPLES_COMPOSITE_DEBUGMM +static void show_memory_usage(struct mallinfo *mmbefore, + struct mallinfo *mmafter) +{ + int diff; + + message(" total used free largest\n"); + message("Before:%11d%11d%11d%11d\n", + mmbefore->arena, mmbefore->uordblks, mmbefore->fordblks, mmbefore->mxordblk); + message("After: %11d%11d%11d%11d\n", + mmafter->arena, mmafter->uordblks, mmafter->fordblks, mmafter->mxordblk); + + diff = mmbefore->uordblks - mmafter->uordblks; + if (diff < 0) + { + message("Change:%11d allocated\n", -diff); + } + else if (diff > 0) + { + message("Change:%11d freed\n", diff); + } +} +#else +# define show_memory_usage(mm1, mm2) +#endif + +/**************************************************************************** + * Name: check_test_memory_usage + ****************************************************************************/ + +#ifdef CONFIG_EXAMPLES_COMPOSITE_DEBUGMM +static void check_test_memory_usage(FAR const char *msg) +{ + /* Get the current memory usage */ + +#ifdef CONFIG_CAN_PASS_STRUCTS + g_composite.mmcurrent = mallinfo(); +#else + (void)mallinfo(&g_composite.mmcurrent); +#endif + + /* Show the change from the previous time */ + + message("\%s:\n", msg); + show_memory_usage(&g_composite.mmprevious, &g_composite.mmcurrent); + + /* Set up for the next test */ + +#ifdef CONFIG_CAN_PASS_STRUCTS + g_composite.mmprevious = g_composite.mmcurrent; +#else + memcpy(&g_composite.mmprevious, &g_composite.mmcurrent, sizeof(struct mallinfo)); +#endif +} +#else +# define check_test_memory_usage(msg) +#endif + +/**************************************************************************** + * Name: check_test_memory_usage + ****************************************************************************/ + +#ifdef CONFIG_EXAMPLES_COMPOSITE_DEBUGMM +static void final_memory_usage(FAR const char *msg) +{ + /* Get the current memory usage */ + +#ifdef CONFIG_CAN_PASS_STRUCTS + g_composite.mmcurrent = mallinfo(); +#else + (void)mallinfo(&g_composite.mmcurrent); +#endif + + /* Show the change from the previous time */ + + message("\n%s:\n", msg); + show_memory_usage(&g_composite.mmstart, &g_composite.mmcurrent); +} +#else +# define final_memory_usage(msg) +#endif + +/**************************************************************************** + * Name: composite_enumerate + ****************************************************************************/ + +#ifdef CONFIG_USBDEV_TRACE +static int composite_enumerate(struct usbtrace_s *trace, void *arg) +{ + switch (trace->event) + { + case TRACE_DEVINIT: + message("USB controller initialization: %04x\n", trace->value); + break; + + case TRACE_DEVUNINIT: + message("USB controller un-initialization: %04x\n", trace->value); + break; + + case TRACE_DEVREGISTER: + message("usbdev_register(): %04x\n", trace->value); + break; + + case TRACE_DEVUNREGISTER: + message("usbdev_unregister(): %04x\n", trace->value); + break; + + case TRACE_EPCONFIGURE: + message("Endpoint configure(): %04x\n", trace->value); + break; + + case TRACE_EPDISABLE: + message("Endpoint disable(): %04x\n", trace->value); + break; + + case TRACE_EPALLOCREQ: + message("Endpoint allocreq(): %04x\n", trace->value); + break; + + case TRACE_EPFREEREQ: + message("Endpoint freereq(): %04x\n", trace->value); + break; + + case TRACE_EPALLOCBUFFER: + message("Endpoint allocbuffer(): %04x\n", trace->value); + break; + + case TRACE_EPFREEBUFFER: + message("Endpoint freebuffer(): %04x\n", trace->value); + break; + + case TRACE_EPSUBMIT: + message("Endpoint submit(): %04x\n", trace->value); + break; + + case TRACE_EPCANCEL: + message("Endpoint cancel(): %04x\n", trace->value); + break; + + case TRACE_EPSTALL: + message("Endpoint stall(true): %04x\n", trace->value); + break; + + case TRACE_EPRESUME: + message("Endpoint stall(false): %04x\n", trace->value); + break; + + case TRACE_DEVALLOCEP: + message("Device allocep(): %04x\n", trace->value); + break; + + case TRACE_DEVFREEEP: + message("Device freeep(): %04x\n", trace->value); + break; + + case TRACE_DEVGETFRAME: + message("Device getframe(): %04x\n", trace->value); + break; + + case TRACE_DEVWAKEUP: + message("Device wakeup(): %04x\n", trace->value); + break; + + case TRACE_DEVSELFPOWERED: + message("Device selfpowered(): %04x\n", trace->value); + break; + + case TRACE_DEVPULLUP: + message("Device pullup(): %04x\n", trace->value); + break; + + case TRACE_CLASSBIND: + message("Class bind(): %04x\n", trace->value); + break; + + case TRACE_CLASSUNBIND: + message("Class unbind(): %04x\n", trace->value); + break; + + case TRACE_CLASSDISCONNECT: + message("Class disconnect(): %04x\n", trace->value); + break; + + case TRACE_CLASSSETUP: + message("Class setup(): %04x\n", trace->value); + break; + + case TRACE_CLASSSUSPEND: + message("Class suspend(): %04x\n", trace->value); + break; + + case TRACE_CLASSRESUME: + message("Class resume(): %04x\n", trace->value); + break; + + case TRACE_CLASSRDCOMPLETE: + message("Class RD request complete: %04x\n", trace->value); + break; + + case TRACE_CLASSWRCOMPLETE: + message("Class WR request complete: %04x\n", trace->value); + break; + + default: + switch (TRACE_ID(trace->event)) + { + case TRACE_CLASSAPI_ID: /* Other class driver system API calls */ + message("Class API call %d: %04x\n", TRACE_DATA(trace->event), trace->value); + break; + + case TRACE_CLASSSTATE_ID: /* Track class driver state changes */ + message("Class state %d: %04x\n", TRACE_DATA(trace->event), trace->value); + break; + + case TRACE_INTENTRY_ID: /* Interrupt handler entry */ + message("Interrrupt %d entry: %04x\n", TRACE_DATA(trace->event), trace->value); + break; + + case TRACE_INTDECODE_ID: /* Decoded interrupt trace->event */ + message("Interrrupt decode %d: %04x\n", TRACE_DATA(trace->event), trace->value); + break; + + case TRACE_INTEXIT_ID: /* Interrupt handler exit */ + message("Interrrupt %d exit: %04x\n", TRACE_DATA(trace->event), trace->value); + break; + + case TRACE_OUTREQQUEUED_ID: /* Request queued for OUT endpoint */ + message("EP%d OUT request queued: %04x\n", TRACE_DATA(trace->event), trace->value); + break; + + case TRACE_INREQQUEUED_ID: /* Request queued for IN endpoint */ + message("EP%d IN request queued: %04x\n", TRACE_DATA(trace->event), trace->value); + break; + + case TRACE_READ_ID: /* Read (OUT) action */ + message("EP%d OUT read: %04x\n", TRACE_DATA(trace->event), trace->value); + break; + + case TRACE_WRITE_ID: /* Write (IN) action */ + message("EP%d IN write: %04x\n", TRACE_DATA(trace->event), trace->value); + break; + + case TRACE_COMPLETE_ID: /* Request completed */ + message("EP%d request complete: %04x\n", TRACE_DATA(trace->event), trace->value); + break; + + case TRACE_DEVERROR_ID: /* USB controller driver error event */ + message("Controller error: %02x:%04x\n", TRACE_DATA(trace->event), trace->value); + break; + + case TRACE_CLSERROR_ID: /* USB class driver error event */ + message("Class error: %02x:%04x\n", TRACE_DATA(trace->event), trace->value); + break; + + default: + message("Unrecognized event: %02x:%02x:%04x\n", + TRACE_ID(trace->event) >> 8, TRACE_DATA(trace->event), trace->value); + break; + } + } + return OK; +} +#endif + +/**************************************************************************** + * Name: dumptrace + * + * Description: + * Dump collected trace data. + * + ****************************************************************************/ + +#ifdef CONFIG_USBDEV_TRACE +static int dumptrace(void) +{ + int ret; + + ret = usbtrace_enumerate(composite_enumerate, NULL); + if (ret < 0) + { + message("dumptrace: usbtrace_enumerate failed: %d\n", -ret); + } + return ret; +} +#else +# define dumptrace() (OK) +#endif + +/**************************************************************************** + * Name: open_serial + ****************************************************************************/ + +#if !defined(CONFIG_NSH_BUILTIN_APPS) && !defined(CONFIG_DISABLE_SIGNALS) +static int open_serial(void) +{ + int errcode; + + /* Open the USB serial device for writing (blocking) */ + + do + { + message("open_serial: Opening USB serial driver\n"); + g_composite.outfd = open(CONFIG_EXAMPLES_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); + + /* ENOTCONN means that the USB device is not yet connected */ + + if (errcode == ENOTCONN) + { + message("open_serial: Not connected. Wait and try again.\n"); + sleep(5); + } + else + { + /* Give up on other errors */ + + message("open_serial: Aborting\n"); + return -errcode; + } + } + + /* If USB tracing is enabled, then dump all collected trace data to stdout */ + +#ifdef CONFIG_USBDEV_TRACE + ret = dumptrace(); + if (ret < 0) + { + goto errout; + } +#endif + } + while (g_composite.outfd < 0); + + /* Open the USB serial device for reading (non-blocking) */ + + g_composite.infd = open(CONFIG_EXAMPLES_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); + close(g_composite.outfd); + return -errcode; + } + + message("open_serial: Successfully opened the serial driver\n"); + return OK; +} +#endif + +/**************************************************************************** + * Name: echo_serial + ****************************************************************************/ + +static int echo_serial(void) +{ + ssize_t bytesread; + ssize_t byteswritten; + int errcode; + + /* Read data */ + + bytesread = read(g_composite.infd, g_composite.serbuf, CONFIG_EXAMPLES_COMPOSITE_BUFSIZE); + if (bytesread < 0) + { + errcode = errno; + if (errcode != EAGAIN) + { + message("echo_serial: ERROR: read failed: %d\n", errcode); + return -errcode; + } + return OK; + } + + /* Echo data */ + + byteswritten = write(g_composite.outfd, g_composite.serbuf, bytesread); + if (byteswritten < 0) + { + errcode = errno; + message("echo_serial: ERROR: write failed: %d\n", errcode); + return -errcode; + } + else if (byteswritten != bytesread) + { + message("echo_serial: ERROR: read size: %d write size: %d\n", + bytesread, byteswritten); + } + return OK; +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: board_mscclassobject + * + * Description: + * If the mass storage class driver is part of composite device, then + * its instantiation and configuration is a multi-step, board-specific, + * process (See comments for usbmsc_configure below). In this case, + * board-specific logic must provide board_mscclassobject(). + * + * board_mscclassobject() is called from the composite driver. It must + * encapsulate the instantiation and configuration of the mass storage + * class and the return the mass storage device's class driver instance + * to the composite dirver. + * + * Input Parameters: + * classdev - The location to return the mass storage class' device + * instance. + * + * Returned Value: + * 0 on success; a negated errno on failure + * + ****************************************************************************/ + +int board_mscclassobject(FAR struct usbdevclass_driver_s **classdev) +{ + int ret; + + DEBUGASSERT(g_composite.mschandle != NULL); + + /* Initialize USB trace output IDs */ + + usbtrace_enable(TRACE_BITSET); + check_test_memory_usage("After usbtrace_enable()"); + + /* 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); + if (ret < 0) + { + message("board_mscclassobject: usbmsc_configure failed: %d\n", -ret); + return ret; + } + message("board_mscclassobject: MSC handle=%p\n", g_composite.mschandle); + check_test_memory_usage("After usbmsc_configure()"); + + /* 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); + if (ret < 0) + { + message("board_mscclassobject: usbmsc_bindlun failed for LUN 1 using %s: %d\n", + CONFIG_EXAMPLES_COMPOSITE_DEVPATH1, -ret); + usbmsc_uninitialize(g_composite.mschandle); + return ret; + } + check_test_memory_usage("After usbmsc_bindlun()"); + +#if CONFIG_EXAMPLES_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); + if (ret < 0) + { + message("board_mscclassobject: usbmsc_bindlun failed for LUN 2 using %s: %d\n", + CONFIG_EXAMPLES_COMPOSITE_DEVPATH2, -ret); + usbmsc_uninitialize(g_composite.mschandle); + return ret; + } + check_test_memory_usage("After usbmsc_bindlun() #2"); + +#if CONFIG_EXAMPLES_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); + if (ret < 0) + { + message("board_mscclassobject: usbmsc_bindlun failed for LUN 3 using %s: %d\n", + CONFIG_EXAMPLES_COMPOSITE_DEVPATH3, -ret); + usbmsc_uninitialize(g_composite.mschandle); + return ret; + } + check_test_memory_usage("After usbmsc_bindlun() #3"); + +#endif +#endif + + /* Get the mass storage device's class object */ + + ret = usbmsc_classobject(g_composite.mschandle, classdev); + if (ret < 0) + { + message("board_mscclassobject: usbmsc_classobject failed: %d\n", -ret); + usbmsc_uninitialize(g_composite.mschandle); + } + check_test_memory_usage("After usbmsc_classobject()"); + return ret; +} + +/**************************************************************************** + * Name: board_mscuninitialize + * + * Description: + * Un-initialize the USB storage class driver. This is just an application- + * specific wrapper aboutn usbmsc_unitialize() that is called form the composite + * device logic. + * + * Input Parameters: + * classdev - The class driver instrance previously give to the composite + * driver by board_mscclassobject(). + * + * Returned Value: + * None + * + ****************************************************************************/ + +void board_mscuninitialize(FAR struct usbdevclass_driver_s *classdev) +{ + DEBUGASSERT(g_composite.mschandle != NULL && + g_composite.mschandle == (FAR void *)classdev); + usbmsc_uninitialize(g_composite.mschandle); +} + +/**************************************************************************** + * Name: board_cdcclassobject + * + * Description: + * If the CDC serial class driver is part of composite device, then + * board-specific logic must provide board_cdcclassobject(). In the simplest + * case, board_cdcclassobject() is simply a wrapper around cdcacm_classobject() + * that provides the correct device minor number. + * + * Input Parameters: + * classdev - The location to return the CDC serial class' device + * instance. + * + * Returned Value: + * 0 on success; a negated errno on failure + * + ****************************************************************************/ + +int board_cdcclassobject(FAR struct usbdevclass_driver_s **classdev) +{ + int ret; + + /* Initialize the USB serial driver */ + + message("board_cdcclassobject: Initializing USB serial driver\n"); + ret = cdcacm_classobject(CONFIG_EXAMPLES_COMPOSITE_TTYUSB, classdev); + if (ret < 0) + { + message("board_cdcclassobject: ERROR: Failed to create the USB serial device: %d\n", -ret); + } + return ret; +} + +/**************************************************************************** + * Name: board_cdcuninitialize + * + * Description: + * Un-initialize the USB serial class driver. This is just an application- + * specific wrapper aboutn cdcadm_unitialize() that is called form the composite + * device logic. + * + * Input Parameters: + * classdev - The class driver instrance previously give to the composite + * driver by board_cdcclassobject(). + * + * Returned Value: + * None + * + ****************************************************************************/ + +void board_cdcuninitialize(FAR struct usbdevclass_driver_s *classdev) +{ + DEBUGASSERT(classdev != NULL); + cdcacm_uninitialize(classdev); +} + +/**************************************************************************** + * user_start/msconn_main + * + * Description: + * This is the main program that configures the USB mass storage device + * and exports the LUN(s). If CONFIG_NSH_BUILTIN_APPS is defined + * in the NuttX configuration, then this program can be executed by + * entering the "msconn" command at the NSH console. + * + ****************************************************************************/ + +int MAIN_NAME(int argc, char *argv[]) +{ + int ret; + + /* If this program is implemented as the NSH 'msconn' command, then we need to + * do a little error checking to assure that we are not being called re-entrantly. + */ + +#ifdef CONFIG_NSH_BUILTIN_APPS + + /* Check if there is a non-NULL USB mass storage device handle (meaning that the + * USB mass storage device is already configured). + */ + + if (g_composite.cmphandle) + { + message(MAIN_NAME_STRING ": ERROR: Already connected\n"); + return 1; + } +#endif + +#ifdef CONFIG_EXAMPLES_COMPOSITE_DEBUGMM +# ifdef CONFIG_CAN_PASS_STRUCTS + g_composite.mmstart = mallinfo(); + g_composite.mmprevious = g_composite.mmstart; +# else + (void)mallinfo(&g_composite.mmstart); + memcpy(&g_composite.mmprevious, &g_composite.mmstart, sizeof(struct mallinfo)); +# endif +#endif + + /* Perform architecture-specific initialization */ + + message(MAIN_NAME_STRING ": Performing architecture-specific intialization\n"); + ret = composite_archinitialize(); + if (ret < 0) + { + message(MAIN_NAME_STRING ": composite_archinitialize failed: %d\n", -ret); + return 1; + } + check_test_memory_usage("After composite_archinitialize()"); + + /* Initialize the USB composite device device */ + + g_composite.cmphandle = composite_initialize(); + if (!g_composite.cmphandle) + { + message(MAIN_NAME_STRING ": composite_initialize failed\n"); + return 1; + } + check_test_memory_usage("After composite_initialize()"); + +#if CONFIG_USBDEV_TRACE && CONFIG_USBDEV_TRACE_INITIALIDSET != 0 + /* If USB tracing is enabled and tracing of initial USB events is specified, + * then dump all collected trace data to stdout + */ + + sleep(5); + ret = dumptrace(); + if (ret < 0) + { + goto errout; + } +#endif + + /* It this program was configued as an NSH command, then just exit now. + * Also, if signals are not enabled (and, hence, sleep() is not supported. + * then we have not real option but to exit now. + */ + +#if !defined(CONFIG_NSH_BUILTIN_APPS) && !defined(CONFIG_DISABLE_SIGNALS) + + /* Otherwise, this thread will hang around and monitor the USB activity */ + + /* Open the serial driver */ + + ret = open_serial(); + if (ret < 0) + { + goto errout; + } + + /* Now looping */ + + for (;;) + { + /* Sleep for a bit */ + + msgflush(); + sleep(5); + + /* Echo any serial data */ + + ret = echo_serial(); + if (ret < 0) + { + goto errout; + } + + /* Dump trace data */ + +# ifdef CONFIG_USBDEV_TRACE + message("\n" MAIN_NAME_STRING ": USB TRACE DATA:\n"); + ret = dumptrace(); + if (ret < 0) + { + goto errout; + } + check_test_memory_usage("After usbtrace_enumerate()"); +# else + message(MAIN_NAME_STRING ": Still alive\n"); +# endif + } +#else + + message(MAIN_NAME_STRING ": Connected\n"); + check_test_memory_usage("After composite device connection"); +#endif + + /* Dump debug memory usage */ + + message(MAIN_NAME_STRING ": Exiting\n"); +#if !defined(CONFIG_NSH_BUILTIN_APPS) && !defined(CONFIG_DISABLE_SIGNALS) + close(g_composite.infd); + close(g_composite.outfd); +#endif +#ifdef CONFIG_NSH_BUILTIN_APPS +#endif + final_memory_usage("Final memory usage"); + return 0; + +errout: +#if !defined(CONFIG_NSH_BUILTIN_APPS) && !defined(CONFIG_DISABLE_SIGNALS) + close(g_composite.infd); + close(g_composite.outfd); +#endif + composite_uninitialize(g_composite.cmphandle); + final_memory_usage("Final memory usage"); + return 1; +} + +/**************************************************************************** + * disconn_main + * + * Description: + * This is a program entry point that will disconnet the USB mass storage + * device. This program is only available if CONFIG_NSH_BUILTIN_APPS + * is defined in the NuttX configuration. In that case, this program can + * be executed by entering the "msdis" command at the NSH console. + * + ****************************************************************************/ + +#ifdef CONFIG_NSH_BUILTIN_APPS +int disconn_main(int argc, char *argv[]) +{ + /* First check if the USB mass storage device is already connected */ + + if (!g_composite.cmphandle) + { + message("disconn_main: ERROR: Not connected\n"); + return 1; + } + check_test_memory_usage("Since MS connection"); + + /* Then disconnect the device and uninitialize the USB mass storage driver */ + + composite_uninitialize(g_composite.cmphandle); + g_composite.mshandle = NULL; + message("disconn_main: Disconnected\n"); + check_test_memory_usage("After composite_uninitialize()"); + + /* Dump debug memory usage */ + + final_memory_usage("Final memory usage"); + return 0; +} +#endif diff --git a/nuttx/Documentation/NuttxPortingGuide.html b/nuttx/Documentation/NuttxPortingGuide.html index 941599b1a..d69a85a11 100644 --- a/nuttx/Documentation/NuttxPortingGuide.html +++ b/nuttx/Documentation/NuttxPortingGuide.html @@ -4933,6 +4933,13 @@ build Configure the CDC serial driver as part of a composite driver (only if CONFIG_USBDEV_COMPOSITE is also defined) +
  • + CONFIG_CDCACM_IFNOBASE: + If the CDC driver is part of a composite device, then this may need to + be defined to offset the CDC/ACM interface numbers so that they are + unique and contiguous. When used with the Mass Storage driver, the + correct value for this offset is zero. +
  • CONFIG_CDCACM_EP0MAXPACKET: Endpoint 0 max packet size. Default 64.
  • @@ -4994,6 +5001,15 @@ build CONFIG_USBMSC_COMPOSITE: Configure the mass storage driver as part of a composite driver (only if CONFIG_USBDEV_COMPOSITE is also defined) + +
  • + CONFIG_USBMSC_IFNOBASE: + If the CDC driver is part of a composite device, then this may need to + be defined to offset the mass storage interface number so that it is + unique and contiguous. When used with the CDC/ACM driver, the + correct value for this offset is two (because of the two CDC/ACM + interfaces that will precede it). +
  • CONFIG_USBMSC_EP0MAXPACKET: Max packet size for endpoint 0 diff --git a/nuttx/configs/README.txt b/nuttx/configs/README.txt index 76790e169..0a75bf017 100644 --- a/nuttx/configs/README.txt +++ b/nuttx/configs/README.txt @@ -1005,6 +1005,11 @@ defconfig -- This is a configuration file similar to the Linux CONFIG_CDCACM_COMPOSITE Configure the CDC serial driver as part of a composite driver (only if CONFIG_USBDEV_COMPOSITE is also defined) + CONFIG_CDCACM_IFNOBASE + If the CDC driver is part of a composite device, then this may need to + be defined to offset the CDC/ACM interface numbers so that they are + unique and contiguous. When used with the Mass Storage driver, the + correct value for this offset is zero. CONFIG_CDCACM_EP0MAXPACKET Endpoint 0 max packet size. Default 64. CONFIG_CDCACM_EPINTIN @@ -1057,6 +1062,12 @@ defconfig -- This is a configuration file similar to the Linux CONFIG_USBMSC_COMPOSITE Configure the mass storage driver as part of a composite driver (only if CONFIG_USBDEV_COMPOSITE is also defined) + CONFIG_USBMSC_IFNOBASE + If the CDC driver is part of a composite device, then this may need to + be defined to offset the mass storage interface number so that it is + unique and contiguous. When used with the CDC/ACM driver, the + correct value for this offset is two (because of the two CDC/ACM + interfaces that will precede it). CONFIG_USBMSC_EP0MAXPACKET Max packet size for endpoint 0 CONFIG_USBMSCEPBULKOUT and CONFIG_USBMSC_EPBULKIN diff --git a/nuttx/configs/stm3210e-eval/composite/Make.defs b/nuttx/configs/stm3210e-eval/composite/Make.defs new file mode 100755 index 000000000..39f71e430 --- /dev/null +++ b/nuttx/configs/stm3210e-eval/composite/Make.defs @@ -0,0 +1,174 @@ +############################################################################ +# configs/stm3210e-eval/composite/Make.defs +# +# Copyright (C) 2023 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +include ${TOPDIR}/.config + +# Setup for the selected toolchain + +ifeq ($(CONFIG_STM32_DFU),y) + LDSCRIPT = ld.script.dfu +else + LDSCRIPT = ld.script +endif + +ifeq ($(CONFIG_STM32_CODESOURCERYW),y) + # CodeSourcery under Windows + CROSSDEV = arm-none-eabi- + WINTOOL = y + ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft +endif +ifeq ($(CONFIG_STM32_CODESOURCERYL),y) + # CodeSourcery under Linux + CROSSDEV = arm-none-eabi- + ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft + MAXOPTIMIZATION = -O2 +endif +ifeq ($(CONFIG_STM32_DEVKITARM),y) + # devkitARM under Windows + CROSSDEV = arm-eabi- + WINTOOL = y + ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft +endif +ifeq ($(CONFIG_STM32_RAISONANCE),y) + # Raisonance RIDE7 under Windows + CROSSDEV = arm-none-eabi- + WINTOOL = y + ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft +endif +ifeq ($(CONFIG_STM32_BUILDROOT),y) + # NuttX buildroot under Linux or Cygwin + CROSSDEV = arm-elf- + ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft + MAXOPTIMIZATION = -Os +endif + +ifeq ($(WINTOOL),y) + # Windows-native toolchains + DIRLINK = $(TOPDIR)/tools/winlink.sh + DIRUNLINK = $(TOPDIR)/tools/unlink.sh + MKDEP = $(TOPDIR)/tools/mknulldeps.sh + ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" + ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}" + ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/usbstorage/$(LDSCRIPT)}" + MAXOPTIMIZATION = -O2 +else + # Linux/Cygwin-native toolchain + MKDEP = $(TOPDIR)/tools/mkdeps.sh + ARCHINCLUDES = -I. -isystem $(TOPDIR)/include + ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx + ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/usbstorage/$(LDSCRIPT) +endif + +CC = $(CROSSDEV)gcc +CXX = $(CROSSDEV)g++ +CPP = $(CROSSDEV)gcc -E +LD = $(CROSSDEV)ld +AR = $(CROSSDEV)ar rcs +NM = $(CROSSDEV)nm +OBJCOPY = $(CROSSDEV)objcopy +OBJDUMP = $(CROSSDEV)objdump + +ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'} +ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1} + +ifeq ("${CONFIG_DEBUG_SYMBOLS}","y") + ARCHOPTIMIZATION = -g +else + ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer +endif + +ARCHCFLAGS = -fno-builtin +ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fno-rtti +ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow +ARCHWARNINGSXX = -Wall -Wshadow +ARCHDEFINES = +ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10 + +CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe +CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS) +CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe +CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS) +CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) +AFLAGS = $(CFLAGS) -D__ASSEMBLY__ + +NXFLATLDFLAGS1 = -r -d -warn-common +NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections +LDNXFLATFLAGS = -e main -s 2048 + +OBJEXT = .o +LIBEXT = .a +EXEEXT = + +ifneq ($(CROSSDEV),arm-elf-) + LDFLAGS += -nostartfiles -nodefaultlibs +endif +ifeq ($(CONFIG_DEBUG_SYMBOLS),y) + LDFLAGS += -g +endif + +define PREPROCESS + @echo "CPP: $1->$2" + @$(CPP) $(CPPFLAGS) $1 -o $2 +endef + +define COMPILE + @echo "CC: $1" + @$(CC) -c $(CFLAGS) $1 -o $2 +endef + +define COMPILEXX + @echo "CXX: $1" + @$(CXX) -c $(CXXFLAGS) $1 -o $2 +endef + +define ASSEMBLE + @echo "AS: $1" + @$(CC) -c $(AFLAGS) $1 -o $2 +endef + +define ARCHIVE + echo "AR: $2"; \ + $(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; } +endef + +define CLEAN + @rm -f *.o *.a +endef + +HOSTCC = gcc +HOSTINCLUDES = -I. +HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe +HOSTLDFLAGS = + diff --git a/nuttx/configs/stm3210e-eval/composite/appconfig b/nuttx/configs/stm3210e-eval/composite/appconfig new file mode 100644 index 000000000..0219ca40b --- /dev/null +++ b/nuttx/configs/stm3210e-eval/composite/appconfig @@ -0,0 +1,39 @@ +############################################################################ +# configs/stm3210e-eval/composite/appconfig +# +# Copyright (C) 2012 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +# Path to example in apps/examples containing the user_start entry point + +CONFIGURED_APPS += examples/composite + diff --git a/nuttx/configs/stm3210e-eval/composite/defconfig b/nuttx/configs/stm3210e-eval/composite/defconfig new file mode 100755 index 000000000..0680b53e3 --- /dev/null +++ b/nuttx/configs/stm3210e-eval/composite/defconfig @@ -0,0 +1,1114 @@ +############################################################################ +# configs/stm3210e-eval/composite/defconfig +# +# Copyright (C) 2012 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +# +# architecture selection +# +# CONFIG_ARCH - identifies the arch subdirectory and, hence, the +# processor architecture. +# CONFIG_ARCH_family - for use in C code. This identifies the +# particular chip family that the architecture is implemented +# in. +# CONFIG_ARCH_architecture - for use in C code. This identifies the +# specific architecture within the chip familyl. +# CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory +# CONFIG_ARCH_CHIP_name - For use in C code +# CONFIG_ARCH_BOARD - identifies the configs subdirectory and, hence, +# the board that supports the particular chip or SoC. +# CONFIG_ARCH_BOARD_name - for use in C code +# CONFIG_ENDIAN_BIG - define if big endian (default is little endian) +# CONFIG_BOARD_LOOPSPERMSEC - for delay loops +# CONFIG_DRAM_SIZE - Describes the installed DRAM. +# CONFIG_DRAM_START - The start address of DRAM (physical) +# CONFIG_DRAM_END - Last address+1 of installed RAM +# CONFIG_ARCH_IRQPRIO - The ST32F103Z supports interrupt prioritization +# CONFIG_ARCH_INTERRUPTSTACK - This architecture supports an interrupt +# stack. If defined, this symbol is the size of the interrupt +# stack in bytes. If not defined, the user task stacks will be +# used during interrupt handling. +# CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions +# CONFIG_ARCH_BOOTLOADER - Set if you are using a bootloader. +# CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to board architecture. +# CONFIG_ARCH_BUTTONS - Enable support for buttons. Unique to board architecture. +# CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that +# cause a 100 second delay during boot-up. This 100 second delay +# serves no purpose other than it allows you to calibrate +# CONFIG_BOARD_LOOPSPERMSEC. You simply use a stop watch to measure +# the 100 second delay then adjust CONFIG_BOARD_LOOPSPERMSEC until +# the delay actually is 100 seconds. +# CONFIG_ARCH_DMA - Support DMA initialization +# +CONFIG_ARCH=arm +CONFIG_ARCH_ARM=y +CONFIG_ARCH_CORTEXM3=y +CONFIG_ARCH_CHIP=stm32 +CONFIG_ARCH_CHIP_STM32F103ZET6=y +CONFIG_ARCH_BOARD=stm3210e-eval +CONFIG_ARCH_BOARD_STM3210E_EVAL=y +CONFIG_BOARD_LOOPSPERMSEC=5483 +CONFIG_DRAM_SIZE=0x00010000 +CONFIG_DRAM_START=0x20000000 +CONFIG_DRAM_END=(CONFIG_DRAM_START+CONFIG_DRAM_SIZE) +CONFIG_ARCH_IRQPRIO=y +CONFIG_ARCH_INTERRUPTSTACK=n +CONFIG_ARCH_STACKDUMP=y +CONFIG_ARCH_BOOTLOADER=n +CONFIG_ARCH_LEDS=y +CONFIG_ARCH_BUTTONS=n +CONFIG_ARCH_CALIBRATION=n +CONFIG_ARCH_DMA=y + +# +# Identify toolchain and linker options +# +CONFIG_STM32_CODESOURCERYW=y +CONFIG_STM32_CODESOURCERYL=n +CONFIG_STM32_DEVKITARM=n +CONFIG_STM32_RAISONANCE=n +CONFIG_STM32_BUILDROOT=n + +# +# JTAG Enable settings (by default JTAG-DP and SW-DP are disabled): +# +# CONFIG_STM32_DFU - Use the DFU bootloader, not JTAG +# +# JTAG Enable options: +# +# CONFIG_STM32_JTAG_FULL_ENABLE - Enables full SWJ (JTAG-DP + SW-DP) +# CONFIG_STM32_JTAG_NOJNTRST_ENABLE - Enables full SWJ (JTAG-DP + SW-DP) +# but without JNTRST. +# CONFIG_STM32_JTAG_SW_ENABLE - Set JTAG-DP disabled and SW-DP enabled +# +CONFIG_STM32_DFU=y +CONFIG_STM32_JTAG_FULL_ENABLE=y +CONFIG_STM32_JTAG_NOJNTRST_ENABLE=n +CONFIG_STM32_JTAG_SW_ENABLE=n + +# +# Individual subsystems can be enabled: +# AHB: +CONFIG_STM32_DMA1=n +CONFIG_STM32_DMA2=y +CONFIG_STM32_CRC=n +CONFIG_STM32_FSMC=y +CONFIG_STM32_SDIO=y +# APB1: +CONFIG_STM32_TIM2=n +CONFIG_STM32_TIM3=n +CONFIG_STM32_TIM4=n +CONFIG_STM32_TIM5=n +CONFIG_STM32_TIM6=n +CONFIG_STM32_TIM7=n +CONFIG_STM32_WWDG=n +CONFIG_STM32_SPI2=n +CONFIG_STM32_SPI4=n +CONFIG_STM32_USART2=y +CONFIG_STM32_USART3=n +CONFIG_STM32_UART4=n +CONFIG_STM32_UART5=n +CONFIG_STM32_I2C1=n +CONFIG_STM32_I2C2=n +CONFIG_STM32_USB=y +CONFIG_STM32_CAN=n +CONFIG_STM32_BKP=n +CONFIG_STM32_PWR=n +CONFIG_STM32_DAC=n +# APB2: +CONFIG_STM32_ADC1=n +CONFIG_STM32_ADC2=n +CONFIG_STM32_TIM1=n +CONFIG_STM32_SPI1=n +CONFIG_STM32_TIM8=n +CONFIG_STM32_USART1=y +CONFIG_STM32_ADC3=n + +# +# Timer and I2C devices may need to the following to force power to be applied: +# +#CONFIG_STM32_FORCEPOWER=y + +# +# STM32F103Z specific serial device driver settings +# +# CONFIG_USARTn_SERIAL_CONSOLE - selects the USARTn for the +# console and ttys0 (default is the USART1). +# CONFIG_USARTn_RXBUFSIZE - Characters are buffered as received. +# This specific the size of the receive buffer +# CONFIG_USARTn_TXBUFSIZE - Characters are buffered before +# being sent. This specific the size of the transmit buffer +# CONFIG_USARTn_BAUD - The configure BAUD of the UART. Must be +# CONFIG_USARTn_BITS - The number of bits. Must be either 7 or 8. +# CONFIG_USARTn_PARTIY - 0=no parity, 1=odd parity, 2=even parity +# CONFIG_USARTn_2STOP - Two stop bits +# +CONFIG_USART1_SERIAL_CONSOLE=y +CONFIG_USART2_SERIAL_CONSOLE=n +CONFIG_USART3_SERIAL_CONSOLE=n +CONFIG_USART4_SERIAL_CONSOLE=n +CONFIG_USART5_SERIAL_CONSOLE=n + +CONFIG_USART1_TXBUFSIZE=256 +CONFIG_USART2_TXBUFSIZE=256 +CONFIG_USART3_TXBUFSIZE=256 +CONFIG_USART4_TXBUFSIZE=256 +CONFIG_USART5_TXBUFSIZE=256 + +CONFIG_USART1_RXBUFSIZE=256 +CONFIG_USART2_RXBUFSIZE=256 +CONFIG_USART3_RXBUFSIZE=256 +CONFIG_USART4_RXBUFSIZE=256 +CONFIG_USART5_RXBUFSIZE=256 + +CONFIG_USART1_BAUD=115200 +CONFIG_USART2_BAUD=115200 +CONFIG_USART3_BAUD=115200 +CONFIG_USART4_BAUD=115200 +CONFIG_USART5_BAUD=115200 + +CONFIG_USART1_BITS=8 +CONFIG_USART2_BITS=8 +CONFIG_USART3_BITS=8 +CONFIG_USART4_BITS=8 +CONFIG_USART5_BITS=8 + +CONFIG_USART1_PARITY=0 +CONFIG_USART2_PARITY=0 +CONFIG_USART3_PARITY=0 +CONFIG_USART4_PARITY=0 +CONFIG_USART5_PARITY=0 + +CONFIG_USART1_2STOP=0 +CONFIG_USART2_2STOP=0 +CONFIG_USART3_2STOP=0 +CONFIG_USART4_2STOP=0 +CONFIG_USART5_2STOP=0 + +# +# STM32F103Z specific SSI device driver settings +# +# CONFIG_SSIn_DISABLE - select to disable all support for +# the SSI +# CONFIG_SSI_POLLWAIT - Select to disable interrupt driven SSI support +# Poll-waiting is recommended if the interrupt rate would be to +# high in the interrupt driven case. +# CONFIG_SSI_TXLIMIT - Write this many words to the Tx FIFO before +# emptying the Rx FIFO. If the SPI frequency is high and this +# value is large, then larger values of this setting may cause +# Rx FIFO overrun errors. Default: half of the Tx FIFO size (4). +# +CONFIG_SSI0_DISABLE=n +CONFIG_SSI1_DISABLE=y +CONFIG_SSI_POLLWAIT=y +#CONFIG_SSI_TXLIMIT=4 + +# +# STM3210E-EVAL specific LCD settings +# +CONFIG_STM32_AM240320_DISABLE=n +CONFIG_STM32_SPFD5408B_DISABLE=n +CONFIG_STM32_R61580_DISABLE=y + +# +# General build options +# +# CONFIG_RRLOAD_BINARY - make the rrload binary format used with +# BSPs from www.ridgerun.com using the tools/mkimage.sh script +# CONFIG_INTELHEX_BINARY - make the Intel HEX binary format +# used with many different loaders using the GNU objcopy program +# Should not be selected if you are not using the GNU toolchain. +# CONFIG_MOTOROLA_SREC - make the Motorola S-Record binary format +# used with many different loaders using the GNU objcopy program +# Should not be selected if you are not using the GNU toolchain. +# CONFIG_RAW_BINARY - make a raw binary format file used with many +# different loaders using the GNU objcopy program. This option +# should not be selected if you are not using the GNU toolchain. +# CONFIG_HAVE_LIBM - toolchain supports libm.a +# +CONFIG_RRLOAD_BINARY=n +CONFIG_INTELHEX_BINARY=y +CONFIG_MOTOROLA_SREC=n +CONFIG_RAW_BINARY=n +CONFIG_HAVE_LIBM=n + +# +# General OS setup +# +# CONFIG_APPS_DIR - Identifies the relative path to the directory +# that builds the application to link with NuttX. Default: ../apps +# CONFIG_DEBUG - enables built-in debug options +# CONFIG_DEBUG_VERBOSE - enables verbose debug output +# CONFIG_DEBUG_SYMBOLS - build without optimization and with +# debug symbols (needed for use with a debugger). +# CONFIG_HAVE_CXX - Enable support for C++S +# CONFIG_MM_REGIONS - If the architecture includes multiple +# regions of memory to allocate from, this specifies the +# number of memory regions that the memory manager must +# handle and enables the API mm_addregion(start, end); +# CONFIG_ARCH_LOWPUTC - architecture supports low-level, boot +# time console output +# CONFIG_MSEC_PER_TICK - The default system timer is 100Hz +# or MSEC_PER_TICK=10. This setting may be defined to +# inform NuttX that the processor hardware is providing +# system timer interrupts at some interrupt interval other +# than 10 msec. +# CONFIG_RR_INTERVAL - The round robin timeslice will be set +# this number of milliseconds; Round robin scheduling can +# be disabled by setting this value to zero. +# CONFIG_SCHED_INSTRUMENTATION - enables instrumentation in +# scheduler to monitor system performance +# CONFIG_TASK_NAME_SIZE - Spcifies that maximum size of a +# task name to save in the TCB. Useful if scheduler +# instrumentation is selected. Set to zero to disable. +# CONFIG_START_YEAR, CONFIG_START_MONTH, CONFIG_START_DAY - +# Used to initialize the internal time logic. +# CONFIG_GREGORIAN_TIME - Enables Gregorian time conversions. +# You would only need this if you are concerned about accurate +# time conversions in the past or in the distant future. +# CONFIG_JULIAN_TIME - Enables Julian time conversions. You +# would only need this if you are concerned about accurate +# time conversion in the distand past. You must also define +# CONFIG_GREGORIAN_TIME in order to use Julian time. +# CONFIG_DEV_CONSOLE - Set if architecture-specific logic +# provides /dev/console. Enables stdout, stderr, stdin. +# CONFIG_DEV_LOWCONSOLE - Use the simple, low-level serial console +# driver (minimul support) +# CONFIG_MUTEX_TYPES: Set to enable support for recursive and +# errorcheck mutexes. Enables pthread_mutexattr_settype(). +# CONFIG_PRIORITY_INHERITANCE : Set to enable support for priority +# inheritance on mutexes and semaphores. +# CONFIG_SEM_PREALLOCHOLDERS: This setting is only used if priority +# inheritance is enabled. It defines the maximum number of +# different threads (minus one) that can take counts on a +# semaphore with priority inheritance support. This may be +# set to zero if priority inheritance is disabled OR if you +# are only using semaphores as mutexes (only one holder) OR +# if no more than two threads participate using a counting +# semaphore. +# CONFIG_SEM_NNESTPRIO. If priority inheritance is enabled, +# then this setting is the maximum number of higher priority +# threads (minus 1) than can be waiting for another thread +# to release a count on a semaphore. This value may be set +# to zero if no more than one thread is expected to wait for +# a semaphore. +# CONFIG_FDCLONE_DISABLE. Disable cloning of all file descriptors +# by task_create() when a new task is started. If set, all +# files/drivers will appear to be closed in the new task. +# CONFIG_FDCLONE_STDIO. Disable cloning of all but the first +# three file descriptors (stdin, stdout, stderr) by task_create() +# when a new task is started. If set, all files/drivers will +# appear to be closed in the new task except for stdin, stdout, +# and stderr. +# 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_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, +# can be safely disabled. The worker thread also performs +# garbage collection -- completing any delayed memory deallocations +# from interrupt handlers. If the worker thread is disabled, +# then that clean will be performed by the IDLE thread instead +# (which runs at the lowest of priority and may not be appropriate +# if memory reclamation is of high priority). If CONFIG_SCHED_WORKQUEUE +# is enabled, then the following options can also be used: +# CONFIG_SCHED_WORKPRIORITY - The execution priority of the worker +# thread. Default: 50 +# CONFIG_SCHED_WORKPERIOD - How often the worker thread checks for +# work in units of microseconds. Default: 50*1000 (50 MS). +# CONFIG_SCHED_WORKSTACKSIZE - The stack size allocated for the worker +# thread. Default: CONFIG_IDLETHREAD_STACKSIZE. +# CONFIG_SIG_SIGWORK - The signal number that will be used to wake-up +# the worker thread. Default: 4 +# +#CONFIG_APPS_DIR= +CONFIG_DEBUG=n +CONFIG_DEBUG_VERBOSE=n +CONFIG_DEBUG_FS=n +CONFIG_DEBUG_USB=n +CONFIG_DEBUG_SYMBOLS=n +CONFIG_HAVE_CXX=n +CONFIG_MM_REGIONS=1 +CONFIG_ARCH_LOWPUTC=y +CONFIG_RR_INTERVAL=200 +CONFIG_SCHED_INSTRUMENTATION=n +CONFIG_TASK_NAME_SIZE=0 +CONFIG_START_YEAR=2009 +CONFIG_START_MONTH=11 +CONFIG_START_DAY=30 +CONFIG_GREGORIAN_TIME=n +CONFIG_JULIAN_TIME=n +CONFIG_DEV_CONSOLE=y +CONFIG_DEV_LOWCONSOLE=n +CONFIG_MUTEX_TYPES=n +CONFIG_PRIORITY_INHERITANCE=n +CONFIG_SEM_PREALLOCHOLDERS=0 +CONFIG_SEM_NNESTPRIO=0 +CONFIG_FDCLONE_DISABLE=n +CONFIG_FDCLONE_STDIO=n +CONFIG_SDCLONE_DISABLE=y +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 +# weak functions, then it should not be necessary to +# disable functions unless you want to restrict usage +# of those APIs. +# +# There are certain dependency relationships in these +# features. +# +# o mq_notify logic depends on signals to awaken tasks +# waiting for queues to become full or empty. +# o pthread_condtimedwait() depends on signals to wake +# up waiting tasks. +# +CONFIG_DISABLE_CLOCK=n +CONFIG_DISABLE_POSIX_TIMERS=n +CONFIG_DISABLE_PTHREAD=n +CONFIG_DISABLE_SIGNALS=n +CONFIG_DISABLE_MQUEUE=n +CONFIG_DISABLE_MOUNTPOINT=y +CONFIG_DISABLE_ENVIRON=n +CONFIG_DISABLE_POLL=y + +# +# Misc libc settings +# +# CONFIG_NOPRINTF_FIELDWIDTH - sprintf-related logic is a +# little smaller if we do not support fieldwidthes +# +CONFIG_NOPRINTF_FIELDWIDTH=n + +# +# Allow for architecture optimized implementations +# +# The architecture can provide optimized versions of the +# following to improve system performance +# +CONFIG_ARCH_MEMCPY=n +CONFIG_ARCH_MEMCMP=n +CONFIG_ARCH_MEMMOVE=n +CONFIG_ARCH_MEMSET=n +CONFIG_ARCH_STRCMP=n +CONFIG_ARCH_STRCPY=n +CONFIG_ARCH_STRNCPY=n +CONFIG_ARCH_STRLEN=n +CONFIG_ARCH_STRNLEN=n +CONFIG_ARCH_BZERO=n + +# +# Sizes of configurable things (0 disables) +# +# CONFIG_MAX_TASKS - The maximum number of simultaneously +# active tasks. This value must be a power of two. +# CONFIG_MAX_TASK_ARGS - This controls the maximum number of +# of parameters that a task may receive (i.e., maxmum value +# of 'argc') +# CONFIG_NPTHREAD_KEYS - The number of items of thread- +# specific data that can be retained +# CONFIG_NFILE_DESCRIPTORS - The maximum number of file +# descriptors (one for each open) +# CONFIG_NFILE_STREAMS - The maximum number of streams that +# can be fopen'ed +# CONFIG_NAME_MAX - The maximum size of a file name. +# CONFIG_STDIO_BUFFER_SIZE - Size of the buffer to allocate +# on fopen. (Only if CONFIG_NFILE_STREAMS > 0) +# CONFIG_NUNGET_CHARS - Number of characters that can be +# buffered by ungetc() (Only if CONFIG_NFILE_STREAMS > 0) +# CONFIG_PREALLOC_MQ_MSGS - The number of pre-allocated message +# structures. The system manages a pool of preallocated +# message structures to minimize dynamic allocations +# CONFIG_MQ_MAXMSGSIZE - Message structures are allocated with +# a fixed payload size given by this settin (does not include +# other message structure overhead. +# CONFIG_MAX_WDOGPARMS - Maximum number of parameters that +# can be passed to a watchdog handler +# CONFIG_PREALLOC_WDOGS - The number of pre-allocated watchdog +# structures. The system manages a pool of preallocated +# watchdog structures to minimize dynamic allocations +# CONFIG_PREALLOC_TIMERS - The number of pre-allocated POSIX +# timer structures. The system manages a pool of preallocated +# timer structures to minimize dynamic allocations. Set to +# zero for all dynamic allocations. +# +CONFIG_MAX_TASKS=16 +CONFIG_MAX_TASK_ARGS=4 +CONFIG_NPTHREAD_KEYS=4 +CONFIG_NFILE_DESCRIPTORS=8 +CONFIG_NFILE_STREAMS=8 +CONFIG_NAME_MAX=32 +CONFIG_STDIO_BUFFER_SIZE=256 +CONFIG_NUNGET_CHARS=2 +CONFIG_PREALLOC_MQ_MSGS=4 +CONFIG_MQ_MAXMSGSIZE=32 +CONFIG_MAX_WDOGPARMS=2 +CONFIG_PREALLOC_WDOGS=4 +CONFIG_PREALLOC_TIMERS=4 + +# +# Filesystem configuration +# +# CONFIG_FS_FAT - Enable FAT filesystem support +# CONFIG_FAT_SECTORSIZE - Max supported sector size +# CONFIG_FAT_LCNAMES - Enable use of the NT-style upper/lower case 8.3 +# file name support. +# CONFIG_FAT_LFN - Enable FAT long file names. NOTE: Microsoft claims +# patents on FAT long file name technology. Please read the +# disclaimer in the top-level COPYING file and only enable this +# feature if you understand these issues. +# CONFIG_FAT_MAXFNAME - If CONFIG_FAT_LFN is defined, then the +# default, maximum long file name is 255 bytes. This can eat up +# a lot of memory (especially stack space). If you are willing +# to live with some non-standard, short long file names, then +# define this value. A good choice would be the same value as +# selected for CONFIG_NAME_MAX which will limit the visibility +# of longer file names anyway. +# CONFIG_FS_NXFFS: Enable NuttX FLASH file system (NXFF) support. +# CONFIG_NXFFS_ERASEDSTATE: The erased state of FLASH. +# This must have one of the values of 0xff or 0x00. +# Default: 0xff. +# CONFIG_NXFFS_PACKTHRESHOLD: When packing flash file data, +# don't both with file chunks smaller than this number of data bytes. +# CONFIG_NXFFS_MAXNAMLEN: The maximum size of an NXFFS file name. +# Default: 255. +# CONFIG_NXFFS_PACKTHRESHOLD: When packing flash file data, +# don't both with file chunks smaller than this number of data bytes. +# Default: 32. +# CONFIG_NXFFS_TAILTHRESHOLD: clean-up can either mean +# packing files together toward the end of the file or, if file are +# deleted at the end of the file, clean up can simply mean erasing +# the end of FLASH memory so that it can be re-used again. However, +# doing this can also harm the life of the FLASH part because it can +# mean that the tail end of the FLASH is re-used too often. This +# threshold determines if/when it is worth erased the tail end of FLASH +# and making it available for re-use (and possible over-wear). +# Default: 8192. +# CONFIG_FS_ROMFS - Enable ROMFS filesystem support +# CONFIG_FS_RAMMAP - For file systems that do not support XIP, this +# option will enable a limited form of memory mapping that is +# implemented by copying whole files into memory. +# +CONFIG_FS_FAT=n +CONFIG_FAT_LCNAMES=n +CONFIG_FAT_LFN=n +CONFIG_FAT_MAXFNAME=32 +CONFIG_FS_NXFFS=n +CONFIG_FS_ROMFS=n + +# +# SPI-based MMC/SD driver +# +# CONFIG_MMCSD_NSLOTS +# Number of MMC/SD slots supported by the driver +# CONFIG_MMCSD_READONLY +# Provide read-only access (default is read/write) +# CONFIG_MMCSD_SPICLOCK - Maximum SPI clock to drive MMC/SD card. +# Default is 20MHz. +# +CONFIG_MMCSD_NSLOTS=1 +CONFIG_MMCSD_READONLY=n +CONFIG_MMCSD_SPICLOCK=12500000 + +# +# Block driver buffering +# +# CONFIG_FS_READAHEAD +# Enable read-ahead buffering +# CONFIG_FS_WRITEBUFFER +# Enable write buffering +# +CONFIG_FS_READAHEAD=n +CONFIG_FS_WRITEBUFFER=n + +# +# SDIO-based MMC/SD driver +# +# CONFIG_SDIO_DMA +# SDIO driver supports DMA +# CONFIG_MMCSD_MMCSUPPORT +# Enable support for MMC cards +# CONFIG_MMCSD_HAVECARDDETECT +# SDIO driver card detection is 100% accurate +# +CONFIG_SDIO_DMA=y +CONFIG_MMCSD_MMCSUPPORT=n +CONFIG_MMCSD_HAVECARDDETECT=n + +# +# TCP/IP and UDP support via uIP +# CONFIG_NET - Enable or disable all network features +# CONFIG_NET_IPv6 - Build in support for IPv6 +# CONFIG_NSOCKET_DESCRIPTORS - Maximum number of socket descriptors per task/thread. +# CONFIG_NET_SOCKOPTS - Enable or disable support for socket options +# CONFIG_NET_BUFSIZE - uIP buffer size +# CONFIG_NET_TCP - TCP support on or off +# CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks) +# CONFIG_NET_TCP_READAHEAD_BUFSIZE - Size of TCP read-ahead buffers +# CONFIG_NET_NTCP_READAHEAD_BUFFERS - Number of TCP read-ahead buffers (may be zero) +# CONFIG_NET_TCPBACKLOG - Incoming connections pend in a backlog until +# accept() is called. The size of the backlog is selected when listen() is called. +# CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks) +# CONFIG_NET_UDP - UDP support on or off +# CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off +# CONFIG_NET_UDP_CONNS - The maximum amount of concurrent UDP connections +# CONFIG_NET_ICMP - ICMP ping response support on or off +# CONFIG_NET_ICMP_PING - ICMP ping request support on or off +# CONFIG_NET_PINGADDRCONF - Use "ping" packet for setting IP address +# CONFIG_NET_STATISTICS - uIP statistics on or off +# CONFIG_NET_RECEIVE_WINDOW - The size of the advertised receiver's window +# CONFIG_NET_ARPTAB_SIZE - The size of the ARP table +# CONFIG_NET_BROADCAST - Broadcast support +# CONFIG_NET_FWCACHE_SIZE - number of packets to remember when looking for duplicates +# +CONFIG_NET=n +CONFIG_NET_IPv6=n +CONFIG_NSOCKET_DESCRIPTORS=0 +CONFIG_NET_SOCKOPTS=y +CONFIG_NET_BUFSIZE=420 +CONFIG_NET_TCP=n +CONFIG_NET_TCP_CONNS=40 +CONFIG_NET_MAX_LISTENPORTS=40 +CONFIG_NET_UDP=n +CONFIG_NET_UDP_CHECKSUMS=y +#CONFIG_NET_UDP_CONNS=10 +CONFIG_NET_ICMP=n +CONFIG_NET_ICMP_PING=n +#CONFIG_NET_PINGADDRCONF=0 +CONFIG_NET_STATISTICS=y +#CONFIG_NET_RECEIVE_WINDOW= +#CONFIG_NET_ARPTAB_SIZE=8 +CONFIG_NET_BROADCAST=n +#CONFIG_NET_FWCACHE_SIZE=2 + +# +# UIP Network Utilities +# CONFIG_NET_DHCP_LIGHT - Reduces size of DHCP +# CONFIG_NET_RESOLV_ENTRIES - Number of resolver entries +# +CONFIG_NET_DHCP_LIGHT=n +CONFIG_NET_RESOLV_ENTRIES=4 + +# +# USB Device Configuration +# +# CONFIG_USBDEV +# Enables USB device support +# CONFIG_USBDEV_COMPOSITE +# Enables USB composite device support +# CONFIG_USBDEV_ISOCHRONOUS +# Build in extra support for isochronous endpoints +# CONFIG_USBDEV_DUALSPEED +# Hardware handles high and full speed operation (USB 2.0) +# CONFIG_USBDEV_SELFPOWERED +# Will cause USB features to indicate that the device is +# self-powered +# CONFIG_USBDEV_MAXPOWER +# Maximum power consumption in mA +# CONFIG_USBDEV_TRACE +# Enables USB tracing for debug +# CONFIG_USBDEV_TRACE_NRECORDS +# Number of trace entries to remember +# +CONFIG_USBDEV=y +CONFIG_USBDEV_COMPOSITE=y +CONFIG_USBDEV_ISOCHRONOUS=n +CONFIG_USBDEV_DUALSPEED=n +CONFIG_USBDEV_SELFPOWERED=y +CONFIG_USBDEV_REMOTEWAKEUP=n +CONFIG_USBDEV_MAXPOWER=100 +CONFIG_USBDEV_TRACE=n +CONFIG_USBDEV_TRACE_NRECORDS=128 + +# +# USB Serial Device Configuration +# +# CONFIG_PL2303 +# Enable compilation of the USB serial driver +# CONFIG_PL2303_EPINTIN +# The logical 7-bit address of a hardware endpoint that supports +# interrupt IN operation +# CONFIG_PL2303_EPBULKOUT +# The logical 7-bit address of a hardware endpoint that supports +# bulk OUT operation +# CONFIG_PL2303_EPBULKIN +# The logical 7-bit address of a hardware endpoint that supports +# bulk IN operation +# # CONFIG_PL2303_NWRREQS and CONFIG_PL2303_NRDREQS +# The number of write/read requests that can be in flight +# CONFIG_PL2303_VENDORID and CONFIG_PL2303_VENDORSTR +# The vendor ID code/string +# CONFIG_PL2303_PRODUCTID and CONFIG_PL2303_PRODUCTSTR +# The product ID code/string +# CONFIG_PL2303_RXBUFSIZE and CONFIG_PL2303_TXBUFSIZE +# Size of the serial receive/transmit buffers +# +CONFIG_PL2303=n +CONFIG_PL2303_EPINTIN=1 +CONFIG_PL2303_EPBULKOUT=2 +CONFIG_PL2303_EPBULKIN=3 +CONFIG_PL2303_NWRREQS=4 +CONFIG_PL2303_NRDREQS=4 +CONFIG_PL2303_VENDORID=0x067b +CONFIG_PL2303_PRODUCTID=0x2303 +CONFIG_PL2303_VENDORSTR="Nuttx" +CONFIG_PL2303_PRODUCTSTR="USBdev Serial" +CONFIG_PL2303_RXBUFSIZE=512 +CONFIG_PL2303_TXBUFSIZE=512 + +# +# USB Storage Device Configuration +# +# CONFIG_USBMSC +# Enable compilation of the USB storage driver +# CONFIG_USBMSC_COMPOSITE +# Configure the mass storage driver as part of a composite driver +# (only if CONFIG_USBDEV_COMPOSITE is also defined) +# CONFIG_USBMSC_IFNOBASE +# If the CDC driver is part of a composite device, then this may need to +# be defined to offset the mass storage interface number so that it is +# unique and contiguous. When used with the CDC/ACM driver, the +# correct value for this offset is two (because of the two CDC/ACM +# interfaces that will precede it). +# CONFIG_USBMSC_EP0MAXPACKET +# Max packet size for endpoint 0 +# CONFIG_USBMSC_EPBULKOUT and CONFIG_USBMSC_EPBULKIN +# The logical 7-bit address of a hardware endpoints that support +# bulk OUT and IN operations +# CONFIG_USBMSC_NWRREQS and CONFIG_USBMSC_NRDREQS +# The number of write/read requests that can be in flight +# CONFIG_USBMSC_BULKINREQLEN and CONFIG_USBMSC_BULKOUTREQLEN +# The size of the buffer in each write/read request. This +# value needs to be at least as large as the endpoint +# maxpacket and ideally as large as a block device sector. +# CONFIG_USBMSC_VENDORID and CONFIG_USBMSC_VENDORSTR +# The vendor ID code/string +# CONFIG_USBMSC_PRODUCTID and CONFIG_USBMSC_PRODUCTSTR +# The product ID code/string +# CONFIG_USBMSC_REMOVABLE +# Select if the media is removable +# +CONFIG_USBMSC=y +CONFIG_USBMSC_COMPOSITE=y +CONFIG_USBMSC_IFNOBASE=2 +CONFIG_USBMSC_EP0MAXPACKET=64 +CONFIG_USBMSC_EPBULKOUT=2 +CONFIG_USBMSC_EPBULKIN=5 +CONFIG_USBMSC_NRDREQS=2 +CONFIG_USBMSC_NWRREQS=2 +CONFIG_USBMSC_BULKINREQLEN=256 +CONFIG_USBMSC_BULKOUTREQLEN=256 +CONFIG_USBMSC_VENDORID=0x584e +CONFIG_USBMSC_VENDORSTR="NuttX" +CONFIG_USBMSC_PRODUCTID=0x5342 +CONFIG_USBMSC_PRODUCTSTR="USBdev Storage" +CONFIG_USBMSC_VERSIONNO=0x0399 +CONFIG_USBMSC_REMOVABLE=y + +# +# USB serial device class driver (Standard CDC ACM class) +# +# CONFIG_CDCACM +# Enable compilation of the USB serial driver +# CONFIG_CDCACM_COMPOSITE +# Configure the CDC serial driver as part of a composite driver +# (only if CONFIG_USBDEV_COMPOSITE is also defined) +# CONFIG_CDCACM_IFNOBASE +# If the CDC driver is part of a composite device, then this may need to +# be defined to offset the CDC/ACM interface numbers so that they are +# unique and contiguous. When used with the Mass Storage driver, the +# correct value for this offset is zero. +# CONFIG_CDCACM_EP0MAXPACKET +# Endpoint 0 max packet size. Default 64 +# CONFIG_CDCACM_EPINTIN +# The logical 7-bit address of a hardware endpoint that supports +# interrupt IN operation. Default 2. +# CONFIG_CDCACM_EPINTIN_FSSIZE +# Max package size for the interrupt IN endpoint if full speed mode. +# Default 64. +# CONFIG_CDCACM_EPINTIN_HSSIZE +# Max package size for the interrupt IN endpoint if high speed mode. +# Default 64 +# CONFIG_CDCACM_EPBULKOUT +# The logical 7-bit address of a hardware endpoint that supports +# bulk OUT operation +# CONFIG_CDCACM_EPBULKOUT_FSSIZE +# Max package size for the bulk OUT endpoint if full speed mode. +# Default 64. +# CONFIG_CDCACM_EPBULKOUT_HSSIZE +# Max package size for the bulk OUT endpoint if high speed mode. +# Default 512. +# CONFIG_CDCACM_EPBULKIN +# The logical 7-bit address of a hardware endpoint that supports +# bulk IN operation +# CONFIG_CDCACM_EPBULKIN_FSSIZE +# Max package size for the bulk IN endpoint if full speed mode. +# Default 64. +# CONFIG_CDCACM_EPBULKIN_HSSIZE +# Max package size for the bulk IN endpoint if high speed mode. +# Default 512. +# CONFIG_CDCACM_NWRREQS and CONFIG_CDCACM_NRDREQS +# The number of write/read requests that can be in flight. +# Default 256. +# CONFIG_CDCACM_VENDORID and CONFIG_CDCACM_VENDORSTR +# The vendor ID code/string. Default 0x0525 and "NuttX" +# 0x0525 is the Netchip vendor and should not be used in any +# products. This default VID was selected for compatibility with +# the Linux CDC ACM default VID. +# CONFIG_CDCACM_PRODUCTID and CONFIG_CDCACM_PRODUCTSTR +# The product ID code/string. Default 0xara7 and "CDC/ACM Serial" +# 0xa4a7 was selected for compatibility with the Linux CDC ACM +# default PID. +# CONFIG_CDCACM_RXBUFSIZE and CONFIG_CDCACM_TXBUFSIZE +# Size of the serial receive/transmit buffers. Default 256. +# +CONFIG_CDCACM=y +CONFIG_CDCACM_COMPOSITE=y +CONFIG_CDCACM_IFNOBASE=0 +#CONFIG_CDCACM_EP0MAXPACKET +#CONFIG_CDCACM_EPINTIN +#CONFIG_CDCACM_EPINTIN_FSSIZE +#CONFIG_CDCACM_EPINTIN_HSSIZE +#CONFIG_CDCACM_EPBULKOUT +#CONFIG_CDCACM_EPBULKOUT_FSSIZE +#CONFIG_CDCACM_EPBULKOUT_HSSIZE +#CONFIG_CDCACM_EPBULKIN +#CONFIG_CDCACM_EPBULKIN_FSSIZE +#CONFIG_CDCACM_EPBULKIN_HSSIZE +#CONFIG_CDCACM_NWRREQS +#CONFIG_CDCACM_NRDREQS +#CONFIG_CDCACM_VENDORID +#CONFIG_CDCACM_VENDORSTR +#CONFIG_CDCACM_PRODUCTID +#CONFIG_CDCACM_PRODUCTSTR +#CONFIG_CDCACM_RXBUFSIZE +#CONFIG_CDCACM_TXBUFSIZE + +# +# Settings for examples/uip +# +CONFIG_EXAMPLE_UIP_IPADDR=(10<<24|0<<16|0<<8|2) +CONFIG_EXAMPLE_UIP_DRIPADDR=(10<<24|0<<16|0<<8|1) +CONFIG_EXAMPLE_UIP_NETMASK=(255<<24|255<<16|255<<8|0) +CONFIG_EXAMPLE_UIP_DHCPC=n + +# +# Settings for examples/nettest +CONFIG_EXAMPLE_NETTEST_SERVER=n +CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n +CONFIG_EXAMPLE_NETTEST_NOMAC=n +CONFIG_EXAMPLE_NETTEST_IPADDR=(10<<24|0<<16|0<<8|2) +CONFIG_EXAMPLE_NETTEST_DRIPADDR=(10<<24|0<<16|0<<8|1) +CONFIG_EXAMPLE_NETTEST_NETMASK=(255<<24|255<<16|255<<8|0) +CONFIG_EXAMPLE_NETTEST_CLIENTIP=(10<<24|0<<16|0<<8|1) + +# +# Settings for examples/ostest +# +CONFIG_EXAMPLES_OSTEST_LOOPS=1 +CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048 +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 +# CONFIG_NSH_STACKSIZE - Stack size to use for new threads. +# CONFIG_NSH_NESTDEPTH - Max number of nested if-then[-else]-fi +# CONFIG_NSH_DISABLESCRIPT - Disable scripting support +# 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()). +# +# If CONFIG_NSH_TELNET is selected: +# CONFIG_NSH_IOBUFFER_SIZE -- Telnetd I/O buffer size +# CONFIG_NSH_DHCPC - Obtain address using DHCP +# CONFIG_NSH_IPADDR - Provides static IP address +# CONFIG_NSH_DRIPADDR - Provides static router IP address +# CONFIG_NSH_NETMASK - Provides static network mask +# CONFIG_NSH_NOMAC - Use a bogus MAC address +# +# If CONFIG_NSH_ROMFSETC is selected: +# CONFIG_NSH_ROMFSMOUNTPT - ROMFS mountpoint +# CONFIG_NSH_INITSCRIPT - Relative path to init script +# CONFIG_NSH_ROMFSDEVNO - ROMFS RAM device minor +# CONFIG_NSH_ROMFSSECTSIZE - ROMF sector size +# CONFIG_NSH_FATDEVNO - FAT FS RAM device minor +# CONFIG_NSH_FATSECTSIZE - FAT FS sector size +# 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 +CONFIG_NSH_STACKSIZE=2048 +CONFIG_NSH_NESTDEPTH=3 +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 +CONFIG_NSH_DHCPC=n +CONFIG_NSH_NOMAC=n +CONFIG_NSH_IPADDR=(10<<24|0<<16|0<<8|2) +CONFIG_NSH_DRIPADDR=(10<<24|0<<16|0<<8|1) +CONFIG_NSH_NETMASK=(255<<24|255<<16|255<<8|0) +CONFIG_NSH_ROMFSMOUNTPT="/etc" +CONFIG_NSH_INITSCRIPT="init.d/rcS" +CONFIG_NSH_ROMFSDEVNO=0 +CONFIG_NSH_ROMFSSECTSIZE=64 +CONFIG_NSH_FATDEVNO=1 +CONFIG_NSH_FATSECTSIZE=512 +CONFIG_NSH_FATNSECTORS=1024 +CONFIG_NSH_FATMOUNTPT=/tmp + +# +# Architecture-specific NSH options +# +CONFIG_NSH_MMCSDSPIPORTNO=0 +CONFIG_NSH_MMCSDSLOTNO=0 +CONFIG_NSH_MMCSDMINOR=0 + +# +# Settings for examples/usbserial +# +# CONFIG_EXAMPLES_USBSERIAL_INONLY +# Only verify IN (device-to-host) data transfers. Default: both +# CONFIG_EXAMPLES_USBSERIAL_OUTONLY +# Only verify OUT (host-to-device) data transfers. Default: both +# CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL +# Send only small, single packet messages. Default: Send large and small. +# CONFIG_EXAMPLES_USBSERIAL_ONLYBIG +# Send only large, multi-packet messages. Default: Send large and small. +# +CONFIG_EXAMPLES_USBSERIAL_INONLY=n +CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n +CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n +CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n + +CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n +CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n +CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n +CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n +CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n + +# +# Settings for examples/usbstorage +# +# CONFIG_EXAMPLES_USBMSC_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_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. +# +CONFIG_EXAMPLES_USBMSC_BUILTIN=n +CONFIG_EXAMPLES_USBMSC_NLUNS=1 +CONFIG_EXAMPLES_USBMSC_DEVMINOR1=0 +CONFIG_EXAMPLES_USBMSC_DEVPATH1="/dev/mmcsd0" +CONFIG_EXAMPLES_USBMSC_DEBUGMM=n +CONFIG_EXAMPLES_USBMSC_TRACEINIT=n +CONFIG_EXAMPLES_USBMSC_TRACECLASS=n +CONFIG_EXAMPLES_USBMSC_TRACETRANSFERS=n +CONFIG_EXAMPLES_USBMSC_TRACECONTROLLER=n +CONFIG_EXAMPLES_USBMSC_TRACEINTERRUPTS=n + +# +# Settings for examples/composite +# +# CONFIG_EXAMPLES_COMPOSITE_DEBUGMM +# Enables some debug tests to check for memory usage and memory leaks. +# CONFIG_COMPOSITE_VENDORID and CONFIG_COMPOSITE_PRODUCTID +# The vendor ID code/string +# CONFIG_USBMSC_PRODUCTID and CONFIG_USBMSC_PRODUCTSTR +# The product ID code/string +# CONFIG_COMPOSITE_VERSIONNO +# The device version number +# +# 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_DEVPATH3 +# Similar parameters that would have to be provided if CONFIG_EXAMPLES_COMPOSITE_NLUNS +# is 3. No defaults. +# +# CONFIG_EXAMPLES_COMPOSITE_TTYUSB - The minor number of the USB serial device. +# Default is zero (corresponding to /dev/ttyUSB0. Default is zero. +# CCONFIG_EXAMPLES_COMPOSITE_SERDEV - The string corresponding to +# CONFIG_EXAMPLES_COMPOSITE_TTYUSB. The default is "/dev/ttyUSB0". +# CONFIG_EXAMPLES_COMPOSITE_BUFSIZE - The size of the serial I/O buffer in +# bytes. Default 256 byters. +# +# 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. +# +CONFIG_EXAMPLES_COMPOSITE_DEBUGMM=n +CONFIG_COMPOSITE_VENDORID=0x03eb +CONFIG_COMPOSITE_PRODUCTID=0x2022 +CONFIG_COMPOSITE_VENDORSTR="NuttX" +CONFIG_COMPOSITE_PRODUCTSTR="Composite Device" +CONFIG_COMPOSITE_VERSIONNO +CONFIG_EXAMPLES_COMPOSITE_NLUNS=1 +CONFIG_EXAMPLES_COMPOSITE_DEVMINOR1=0 +CONFIG_EXAMPLES_COMPOSITE_DEVPATH1="/dev/mmcsd0" +CONFIG_EXAMPLES_COMPOSITE_TTYUSB=0 +CCONFIG_EXAMPLES_COMPOSITE_SERDEV="/dev/ttyUSB0" +CONFIG_EXAMPLES_COMPOSITE_BUFSIZE=256 +CONFIG_EXAMPLES_COMPOSITE_TRACEINIT=n +CONFIG_EXAMPLES_COMPOSITE_TRACECLASS=n +CONFIG_EXAMPLES_COMPOSITE_TRACETRANSFERS=n +CONFIG_EXAMPLES_COMPOSITE_TRACECONTROLLER=n +CONFIG_EXAMPLES_COMPOSITE_TRACEINTERRUPTS=n + +# +# Stack and heap information +# +# CONFIG_BOOT_RUNFROMFLASH - Some configurations support XIP +# operation from FLASH but must copy initialized .data sections to RAM. +# (should also be =n for the STM3210E-EVAL which always runs from flash) +# CONFIG_BOOT_COPYTORAM - Some configurations boot in FLASH +# but copy themselves entirely into RAM for better performance. +# CONFIG_CUSTOM_STACK - The up_ implementation will handle +# all stack operations outside of the nuttx model. +# CONFIG_STACK_POINTER - The initial stack pointer (arm7tdmi only) +# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack. +# This is the thread that (1) performs the inital boot of the system up +# to the point where user_start() is spawned, and (2) there after is the +# IDLE thread that executes only when there is no other thread ready to +# run. +# CONFIG_USERMAIN_STACKSIZE - The size of the stack to allocate +# for the main user thread that begins at the user_start() entry point. +# CONFIG_PTHREAD_STACK_MIN - Minimum pthread stack size +# CONFIG_PTHREAD_STACK_DEFAULT - Default pthread stack size +# CONFIG_HEAP_BASE - The beginning of the heap +# CONFIG_HEAP_SIZE - The size of the heap +# +CONFIG_BOOT_RUNFROMFLASH=n +CONFIG_BOOT_COPYTORAM=n +CONFIG_CUSTOM_STACK=n +CONFIG_STACK_POINTER= +CONFIG_IDLETHREAD_STACKSIZE=1024 +CONFIG_USERMAIN_STACKSIZE=2048 +CONFIG_PTHREAD_STACK_MIN=256 +CONFIG_PTHREAD_STACK_DEFAULT=2048 +CONFIG_HEAP_BASE= +CONFIG_HEAP_SIZE= diff --git a/nuttx/configs/stm3210e-eval/composite/ld.script b/nuttx/configs/stm3210e-eval/composite/ld.script new file mode 100755 index 000000000..f31c66d72 --- /dev/null +++ b/nuttx/configs/stm3210e-eval/composite/ld.script @@ -0,0 +1,112 @@ +/**************************************************************************** + * configs/stm3210e-eval/composite/ld.script + * + * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/* The STM32F103ZET6 has 512Kb of FLASH beginning at address 0x0800:0000 and + * 64Kb of SRAM beginning at address 0x2000:0000. When booting from FLASH, + * FLASH memory is aliased to address 0x0000:0000 where the code expects to + * begin execution by jumping to the entry point in the 0x0800:0000 address + * range. + */ + +MEMORY +{ + flash (rx) : ORIGIN = 0x08000000, LENGTH = 512K + sram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K +} + +OUTPUT_ARCH(arm) +ENTRY(_stext) +SECTIONS +{ + .text : { + _stext = ABSOLUTE(.); + *(.vectors) + *(.text .text.*) + *(.fixup) + *(.gnu.warning) + *(.rodata .rodata.*) + *(.gnu.linkonce.t.*) + *(.glue_7) + *(.glue_7t) + *(.got) + *(.gcc_except_table) + *(.gnu.linkonce.r.*) + _etext = ABSOLUTE(.); + } > flash + + _eronly = ABSOLUTE(.); + + /* The STM32F103Z has 64Kb of SRAM beginning at the following address */ + + .data : { + _sdata = ABSOLUTE(.); + *(.data .data.*) + *(.gnu.linkonce.d.*) + CONSTRUCTORS + _edata = ABSOLUTE(.); + } > sram AT > flash + + .ARM.extab : { + *(.ARM.extab*) + } >sram + + __exidx_start = ABSOLUTE(.); + .ARM.exidx : { + *(.ARM.exidx*) + } >sram + __exidx_end = ABSOLUTE(.); + + .bss : { + _sbss = ABSOLUTE(.); + *(.bss .bss.*) + *(.gnu.linkonce.b.*) + *(COMMON) + _ebss = ABSOLUTE(.); + } > sram + + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_info 0 : { *(.debug_info) } + .debug_line 0 : { *(.debug_line) } + .debug_pubnames 0 : { *(.debug_pubnames) } + .debug_aranges 0 : { *(.debug_aranges) } +} diff --git a/nuttx/configs/stm3210e-eval/composite/ld.script.dfu b/nuttx/configs/stm3210e-eval/composite/ld.script.dfu new file mode 100755 index 000000000..d819bca25 --- /dev/null +++ b/nuttx/configs/stm3210e-eval/composite/ld.script.dfu @@ -0,0 +1,111 @@ +/**************************************************************************** + * configs/stm3210e-eval/composite/ld.script.dfu + * + * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/* The STM32F103ZET6 has 512Kb of FLASH beginning at address 0x0800:0000 and + * 64Kb of SRAM beginning at address 0x2000:0000. Here we assume that the + * STM3210E-EVAL's DFU bootloader is being used. In that case, the corrct + * load .text load address is 0x08003000 (leaving 464Kb). + */ + +MEMORY +{ + flash (rx) : ORIGIN = 0x08003000, LENGTH = 464K + sram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K +} + +OUTPUT_ARCH(arm) +ENTRY(_stext) +SECTIONS +{ + .text : { + _stext = ABSOLUTE(.); + *(.vectors) + *(.text .text.*) + *(.fixup) + *(.gnu.warning) + *(.rodata .rodata.*) + *(.gnu.linkonce.t.*) + *(.glue_7) + *(.glue_7t) + *(.got) + *(.gcc_except_table) + *(.gnu.linkonce.r.*) + _etext = ABSOLUTE(.); + } > flash + + _eronly = ABSOLUTE(.); + + /* The STM32F103Z has 64Kb of SRAM beginning at the following address */ + + .data : { + _sdata = ABSOLUTE(.); + *(.data .data.*) + *(.gnu.linkonce.d.*) + CONSTRUCTORS + _edata = ABSOLUTE(.); + } > sram AT > flash + + .ARM.extab : { + *(.ARM.extab*) + } >sram + + __exidx_start = ABSOLUTE(.); + .ARM.exidx : { + *(.ARM.exidx*) + } >sram + __exidx_end = ABSOLUTE(.); + + .bss : { + _sbss = ABSOLUTE(.); + *(.bss .bss.*) + *(.gnu.linkonce.b.*) + *(COMMON) + _ebss = ABSOLUTE(.); + } > sram + + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_info 0 : { *(.debug_info) } + .debug_line 0 : { *(.debug_line) } + .debug_pubnames 0 : { *(.debug_pubnames) } + .debug_aranges 0 : { *(.debug_aranges) } +} diff --git a/nuttx/configs/stm3210e-eval/composite/setenv.sh b/nuttx/configs/stm3210e-eval/composite/setenv.sh new file mode 100755 index 000000000..ce267428b --- /dev/null +++ b/nuttx/configs/stm3210e-eval/composite/setenv.sh @@ -0,0 +1,67 @@ +#!/bin/bash +# configs/stm3210e-eval/composite/setenv.sh +# +# Copyright (C) 2012 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +if [ "$_" = "$0" ] ; then + echo "You must source this script, not run it!" 1>&2 + exit 1 +fi + +WD=`pwd` +if [ ! -x "setenv.sh" ]; then + echo "This script must be executed from the top-level NuttX build directory" + exit 1 +fi + +if [ -z "${PATH_ORIG}" ]; then + export PATH_ORIG="${PATH}" +fi + +# This the Cygwin path to the location where I installed the RIDE +# toolchain under windows. You will also have to edit this if you install +# the RIDE toolchain in any other location +#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/Raisonance/Ride/arm-gcc/bin" + +# This the Cygwin path to the location where I installed the CodeSourcery +# toolchain under windows. You will also have to edit this if you install +# the CodeSourcery toolchain in any other location +export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin" + +# This the Cygwin path to the location where I build the buildroot +# toolchain. +#export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin" + +# Add the path to the toolchain to the PATH varialble +export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}" + +echo "PATH : ${PATH}" diff --git a/nuttx/configs/stm3210e-eval/src/Makefile b/nuttx/configs/stm3210e-eval/src/Makefile index 7c93a2d32..d7247619a 100644 --- a/nuttx/configs/stm3210e-eval/src/Makefile +++ b/nuttx/configs/stm3210e-eval/src/Makefile @@ -60,6 +60,10 @@ ifeq ($(CONFIG_USBMSC),y) CSRCS += up_usbmsc.c endif +ifeq ($(CONFIG_USBDEV_COMPOSITE),y) +CSRCS += up_composite.c +endif + ifeq ($(CONFIG_I2C_LM75),y) CSRCS += up_lm75.c endif diff --git a/nuttx/configs/stm3210e-eval/src/up_composite.c b/nuttx/configs/stm3210e-eval/src/up_composite.c new file mode 100644 index 000000000..7368c7898 --- /dev/null +++ b/nuttx/configs/stm3210e-eval/src/up_composite.c @@ -0,0 +1,163 @@ +/**************************************************************************** + * configs/stm3210e-eval/src/up_composite.c + * + * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Configure and register the STM32 MMC/SD SDIO block driver. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include + +#include +#include +#include + +#include "stm32_internal.h" + +/* There is nothing to do here if SDIO support is not selected. */ + +#ifdef CONFIG_STM32_SDIO + +/**************************************************************************** + * Pre-Processor Definitions + ****************************************************************************/ + +/* Configuration ************************************************************/ + +#ifndef CONFIG_EXAMPLES_COMPOSITE_DEVMINOR1 +# define CONFIG_EXAMPLES_COMPOSITE_DEVMINOR1 0 +#endif + +/* SLOT number(s) could depend on the board configuration */ + +#ifdef CONFIG_ARCH_BOARD_STM3210E_EVAL +# undef STM32_MMCSDSLOTNO +# define STM32_MMCSDSLOTNO 0 +#else + /* Add configuration for new STM32 boards here */ +# error "Unrecognized STM32 board" +#endif + +/* Debug ********************************************************************/ + +#ifdef CONFIG_CPP_HAVE_VARARGS +# ifdef CONFIG_DEBUG +# define message(...) lib_lowprintf(__VA_ARGS__) +# define msgflush() +# else +# define message(...) printf(__VA_ARGS__) +# define msgflush() fflush(stdout) +# endif +#else +# ifdef CONFIG_DEBUG +# define message lib_lowprintf +# define msgflush() +# else +# define message printf +# define msgflush() fflush(stdout) +# endif +#endif + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: composite_archinitialize + * + * Description: + * Perform architecture specific initialization + * + ****************************************************************************/ + +int composite_archinitialize(void) +{ + /* If examples/composite 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. + * + * NOTE: CONFIG_NSH_BUILTIN_APPS is not a fool-proof indication that NSH + * was built. + */ + +#ifndef CONFIG_NSH_BUILTIN_APPS + FAR struct sdio_dev_s *sdio; + int ret; + + /* First, get an instance of the SDIO interface */ + + message("composite_archinitialize: Initializing SDIO slot %d\n", + STM32_MMCSDSLOTNO); + + sdio = sdio_initialize(STM32_MMCSDSLOTNO); + if (!sdio) + { + message("composite_archinitialize: Failed to initialize SDIO slot %d\n", + STM32_MMCSDSLOTNO); + return -ENODEV; + } + + /* Now bind the SDIO interface to the MMC/SD driver */ + + message("composite_archinitialize: Bind SDIO to the MMC/SD driver, minor=%d\n", + CONFIG_EXAMPLES_COMPOSITE_DEVMINOR1); + + ret = mmcsd_slotinitialize(CONFIG_EXAMPLES_COMPOSITE_DEVMINOR1, sdio); + if (ret != OK) + { + message("composite_archinitialize: Failed to bind SDIO to the MMC/SD driver: %d\n", + ret); + return ret; + } + message("composite_archinitialize: Successfully bound SDIO to the MMC/SD driver\n"); + + /* Then let's guess and say that there is a card in the slot. I need to check to + * see if the STM3210E-EVAL board supports a GPIO to detect if there is a card in + * the slot. + */ + + sdio_mediachange(sdio, true); + +#endif /* CONFIG_NSH_BUILTIN_APPS */ + + return OK; +} + +#endif /* CONFIG_STM32_SDIO */ diff --git a/nuttx/drivers/usbdev/cdcacm.c b/nuttx/drivers/usbdev/cdcacm.c index 530572408..d34728a4b 100644 --- a/nuttx/drivers/usbdev/cdcacm.c +++ b/nuttx/drivers/usbdev/cdcacm.c @@ -64,7 +64,7 @@ #include "cdcacm.h" #ifdef CONFIG_USBMSC_COMPOSITE -# include +# include # include "composite.h" #endif @@ -2116,7 +2116,7 @@ int cdcacm_initialize(int minor) * ****************************************************************************/ -#ifndef CONFIG_CDCACM_COMPOSITE +#ifdef CONFIG_CDCACM_COMPOSITE void cdcacm_uninitialize(FAR struct usbdevclass_driver_s *classdev) { FAR struct cdcacm_driver_s *drvr = (FAR struct cdcacm_driver_s *)classdev; diff --git a/nuttx/drivers/usbdev/composite.c b/nuttx/drivers/usbdev/composite.c index 69313f821..2ca583a0b 100644 --- a/nuttx/drivers/usbdev/composite.c +++ b/nuttx/drivers/usbdev/composite.c @@ -108,7 +108,7 @@ static void composite_freereq(FAR struct usbdev_ep_s *ep, /* USB class device ********************************************************/ static int composite_bind(FAR struct usbdevclass_driver_s *driver, - FAR struct usbdev_s *dev) + FAR struct usbdev_s *dev); static void composite_unbind(FAR struct usbdevclass_driver_s *driver, FAR struct usbdev_s *dev); static int composite_setup(FAR struct usbdevclass_driver_s *driver, @@ -319,7 +319,7 @@ static int composite_bind(FAR struct usbdevclass_driver_s *driver, return OK; errout: - composite_unbind(dev); + composite_unbind(driver, dev); return ret; } @@ -821,7 +821,7 @@ FAR void *composite_initialize(void) goto errout_with_alloc; } - return (FAR void *)priv; + return (FAR void *)alloc; errout_with_alloc: kfree(alloc); @@ -829,7 +829,7 @@ errout_with_alloc: } /**************************************************************************** - * Name: usbmsc_uninitialize + * Name: composite_uninitialize * * Description: * Un-initialize the USB composite driver. The handle is the USB composite @@ -846,14 +846,16 @@ errout_with_alloc: * ***************************************************************************/ -void usbmsc_uninitialize(FAR void *handle) +void composite_uninitialize(FAR void *handle) { - FAR struct composite_dev_s *priv = (FAR struct composite_dev_s *)handle; + FAR struct composite_alloc_s *alloc = (FAR struct composite_alloc_s *)handle; + FAR struct composite_dev_s *priv; - DEBUGASSERT(priv != NULL); + DEBUGASSERT(alloc != NULL); /* Uninitialize each of the member classes */ + priv = &alloc->dev; if (priv->dev1) { DEV1_UNINITIALIZE(priv->dev1); @@ -868,9 +870,10 @@ void usbmsc_uninitialize(FAR void *handle) /* Then unregister and destroy the composite class */ - usbdev_unregister(&priv->drvr.drvr); + usbdev_unregister(&alloc->drvr.drvr); /* Free any resources used by the composite driver */ + /* None */ /* Then free the composite driver state structure itself */ diff --git a/nuttx/drivers/usbdev/composite.h b/nuttx/drivers/usbdev/composite.h index 2e8476500..f1f624c1c 100644 --- a/nuttx/drivers/usbdev/composite.h +++ b/nuttx/drivers/usbdev/composite.h @@ -162,7 +162,7 @@ #elif defined(CONFIG_CDCACM_COMPOSITE) && !defined(DEV1_IS_USBMSC) # define DEV2_IS_USBMSC 1 # define DEV2_MKCFGDESC usbmsc_mkcfgdesc -# define DEV1_UNINITIALIZE board_mscuninitialize +# define DEV2_UNINITIALIZE board_mscuninitialize # define DEV2_CLASSOBJECT board_mscclassobject # define DEV2_NCONFIGS USBMSC_NCONFIGS # define DEV2_CONFIGID USBMSC_CONFIGID @@ -181,7 +181,7 @@ # warning "The first interface number should be zero" #endif -#if (DEV1_FIRSTINTERFACE + DEV2_NINTERFACES) != DEV2_FIRSTINTERFACE +#if (DEV1_FIRSTINTERFACE + DEV1_NINTERFACES) != DEV2_FIRSTINTERFACE # warning "Interface numbers are not contiguous" #endif diff --git a/nuttx/drivers/usbdev/usbmsc.c b/nuttx/drivers/usbdev/usbmsc.c index a264ab232..0c444c156 100644 --- a/nuttx/drivers/usbdev/usbmsc.c +++ b/nuttx/drivers/usbdev/usbmsc.c @@ -83,7 +83,7 @@ #include "usbmsc.h" #ifdef CONFIG_USBMSC_COMPOSITE -# include +# include # include "composite.h" #endif @@ -139,6 +139,9 @@ static void usbmsc_disconnect(FAR struct usbdevclass_driver_s *driver, /* Initialization/Uninitialization ******************************************/ static void usbmsc_lununinitialize(struct usbmsc_lun_s *lun); +#ifndef CONFIG_USBMSC_COMPOSITE +static int usbmsc_exportluns(FAR void *handle); +#endif /**************************************************************************** * Private Data @@ -1571,6 +1574,9 @@ int usbmsc_unbindlun(FAR void *handle, unsigned int lunno) * ****************************************************************************/ +#ifndef CONFIG_USBMSC_COMPOSITE +static +#endif int usbmsc_exportluns(FAR void *handle) { FAR struct usbmsc_alloc_s *alloc = (FAR struct usbmsc_alloc_s *)handle; @@ -1634,6 +1640,46 @@ errout_with_mutex: return ret; } +/**************************************************************************** + * Name: usbmsc_classobject + * + * Description: + * Register USB mass storage device and return the class object. + * + * Input Parameters: + * classdev - The location to return the CDC serial class' device + * instance. + * + * Returned Value: + * 0 on success; a negated errno on failure + + * + ****************************************************************************/ + +#ifdef CONFIG_USBMSC_COMPOSITE +int usbmsc_classobject(FAR void *handle, + FAR struct usbdevclass_driver_s **classdev) +{ + int ret; + + DEBUGASSERT(handle && classdev); + + /* Export the LUNs as with the "standalone" USB mass storage driver, but + * don't register the class instance with the USB device infrastructure. + */ + + ret = usbmsc_exportluns(handle); + if (ret == OK) + { + /* On sucess, return an (typed) instance of the class instance */ + + *classdev = (FAR struct usbdevclass_driver_s *) + &((FAR struct usbmsc_alloc_s *)handle)->dev; + } + return ret; +} +#endif + /**************************************************************************** * Name: usbmsc_uninitialize * diff --git a/nuttx/include/nuttx/usb/cdcacm.h b/nuttx/include/nuttx/usb/cdcacm.h index 7c0e260bb..012bc55db 100644 --- a/nuttx/include/nuttx/usb/cdcacm.h +++ b/nuttx/include/nuttx/usb/cdcacm.h @@ -309,6 +309,7 @@ typedef FAR void (*cdcacm_callback_t)(enum cdcacm_event_e event); ****************************************************************************/ #if defined(CONFIG_USBDEV_COMPOSITE) && defined(CONFIG_CDCACM_COMPOSITE) +struct usbdevclass_driver_s; EXTERN int board_cdcclassobject(FAR struct usbdevclass_driver_s **classdev); #endif @@ -329,7 +330,7 @@ EXTERN int board_cdcclassobject(FAR struct usbdevclass_driver_s **classdev); * ****************************************************************************/ -#if defined(CONFIG_USBMSC_COMPOSITE) && defined(CONFIG_USBMSC_COMPOSITE) +#if defined(CONFIG_USBDEV_COMPOSITE) && defined(CONFIG_CDCACM_COMPOSITE) struct usbdevclass_driver_s; EXTERN void board_cdcuninitialize(FAR struct usbdevclass_driver_s *classdev); #endif @@ -371,7 +372,9 @@ int cdcacm_classobject(int minor, FAR struct usbdevclass_driver_s **classdev); * ****************************************************************************/ +#if !defined(CONFIG_USBDEV_COMPOSITE) || !defined(CONFIG_CDCACM_COMPOSITE) EXTERN int cdcacm_initialize(int minor); +#endif /**************************************************************************** * Name: cdcacm_uninitialize @@ -387,7 +390,7 @@ EXTERN int cdcacm_initialize(int minor); * ****************************************************************************/ -#ifndef CONFIG_CDCACM_COMPOSITE +#if defined(CONFIG_USBDEV_COMPOSITE) && defined(CONFIG_CDCACM_COMPOSITE) EXTERN void cdcacm_uninitialize(FAR struct usbdevclass_driver_s *classdev); #endif diff --git a/nuttx/include/nuttx/usb/composite.h b/nuttx/include/nuttx/usb/composite.h index 53bedc34f..fc935fd67 100644 --- a/nuttx/include/nuttx/usb/composite.h +++ b/nuttx/include/nuttx/usb/composite.h @@ -115,7 +115,7 @@ extern "C" { EXTERN FAR void *composite_initialize(void); /**************************************************************************** - * Name: usbmsc_uninitialize + * Name: composite_uninitialize * * Description: * Un-initialize the USB composite driver. The handle is the USB composite @@ -132,7 +132,7 @@ EXTERN FAR void *composite_initialize(void); * ***************************************************************************/ -EXTERN void usbmsc_uninitialize(FAR void *handle); +EXTERN void composite_uninitialize(FAR void *handle); /**************************************************************************** * Name: composite_initialize diff --git a/nuttx/include/nuttx/usb/usbdev_trace.h b/nuttx/include/nuttx/usb/usbdev_trace.h index bc60da211..814478686 100644 --- a/nuttx/include/nuttx/usb/usbdev_trace.h +++ b/nuttx/include/nuttx/usb/usbdev_trace.h @@ -184,7 +184,7 @@ #define USBSER_TRACECLASSAPI_SEND 0x0009 #define USBSER_TRACECLASSAPI_TXINT 0x000a #define USBSER_TRACECLASSAPI_TXREADY 0x000b -#define RTXEMPTY 0x000c +#define USBSER_TRACECLASSAPI_TXEMPTY 0x000c /* Values of the class error ID used by the USB serial driver */ diff --git a/nuttx/include/nuttx/usb/usbmsc.h b/nuttx/include/nuttx/usb/usbmsc.h index dd2740a21..325c665c5 100644 --- a/nuttx/include/nuttx/usb/usbmsc.h +++ b/nuttx/include/nuttx/usb/usbmsc.h @@ -100,7 +100,7 @@ extern "C" * ************************************************************************************/ -#if defined(CONFIG_USBMSC_COMPOSITE) && defined(CONFIG_USBMSC_COMPOSITE) +#if defined(CONFIG_USBDEV_COMPOSITE) && defined(CONFIG_USBMSC_COMPOSITE) struct usbdevclass_driver_s; EXTERN int board_mscclassobject(FAR struct usbdevclass_driver_s **classdev); #endif @@ -122,7 +122,7 @@ EXTERN int board_mscclassobject(FAR struct usbdevclass_driver_s **classdev); * ****************************************************************************/ -#if defined(CONFIG_USBMSC_COMPOSITE) && defined(CONFIG_USBMSC_COMPOSITE) +#if defined(CONFIG_USBDEV_COMPOSITE) && defined(CONFIG_USBMSC_COMPOSITE) struct usbdevclass_driver_s; EXTERN void board_mscuninitialize(FAR struct usbdevclass_driver_s *classdev); #endif @@ -207,7 +207,9 @@ EXTERN int usbmsc_unbindlun(FAR void *handle, unsigned int lunno); * ************************************************************************************/ +#if !defined(CONFIG_USBDEV_COMPOSITE) || !defined(CONFIG_USBMSC_COMPOSITE) EXTERN int usbmsc_exportluns(FAR void *handle); +#endif /************************************************************************************ * Name: usbmsc_classobject @@ -225,7 +227,7 @@ EXTERN int usbmsc_exportluns(FAR void *handle); * ************************************************************************************/ -#if defined(CONFIG_USBMSC_COMPOSITE) && defined(CONFIG_USBMSC_COMPOSITE) +#if defined(CONFIG_USBDEV_COMPOSITE) && defined(CONFIG_USBMSC_COMPOSITE) struct usbdevclass_driver_s; EXTERN int usbmsc_classobject(FAR void *handle, FAR struct usbdevclass_driver_s **classdev); #endif -- cgit v1.2.3