diff --git a/nuttx/arch/arm/src/lpc214x/lpc214x_usbdev.c b/nuttx/arch/arm/src/lpc214x/lpc214x_usbdev.c index ddd03fc90..2bee48e66 100644 --- a/nuttx/arch/arm/src/lpc214x/lpc214x_usbdev.c +++ b/nuttx/arch/arm/src/lpc214x/lpc214x_usbdev.c @@ -1,7 +1,7 @@ /******************************************************************************* * arch/arm/src/lpc214x/lpc214x_usbdev.c * - * Copyright (C) 2008 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without diff --git a/nuttx/configs/mcu123-lpc214x/src/Makefile b/nuttx/configs/mcu123-lpc214x/src/Makefile index ab71e0cce..aad225d08 100644 --- a/nuttx/configs/mcu123-lpc214x/src/Makefile +++ b/nuttx/configs/mcu123-lpc214x/src/Makefile @@ -51,6 +51,10 @@ CSRCS = up_spi.c up_leds.c ifeq ($(CONFIG_EXAMPLES_NSH_ARCHINIT),y) CSRCS += up_nsh.c endif +ifeq ($(CONFIG_EXAMPLE),usbstorage) +CSRCS += up_usbstrg.c +endif + COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) diff --git a/nuttx/examples/usbstorage/usbstrg_lpc214x.c b/nuttx/configs/mcu123-lpc214x/src/up_usbstrg.c old mode 100644 new mode 100755 similarity index 86% rename from nuttx/examples/usbstorage/usbstrg_lpc214x.c rename to nuttx/configs/mcu123-lpc214x/src/up_usbstrg.c index aea0f0ae5..aab15f13a --- a/nuttx/examples/usbstorage/usbstrg_lpc214x.c +++ b/nuttx/configs/mcu123-lpc214x/src/up_usbstrg.c @@ -1,7 +1,7 @@ /**************************************************************************** - * examples/usbstorage/usbstrg_lpc214x.c + * configs/mcu123-lpc214x/src/up_usbstrg.c * - * Copyright (C) 2008 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Configure and register the LPC214x MMC/SD SPI block driver. @@ -49,14 +49,16 @@ #include #include -#include "usbstrg.h" - /**************************************************************************** * Pre-Processor Definitions ****************************************************************************/ /* Configuration ************************************************************/ +#ifndef CONFIG_EXAMPLES_USBSTRG_DEVMINOR1 +# define CONFIG_EXAMPLES_USBSTRG_DEVMINOR1 0 +#endif + /* PORT and SLOT number probably depend on the board configuration */ #ifdef CONFIG_ARCH_BOARD_MCU123 @@ -69,6 +71,27 @@ # error "Unrecognized LPC214x 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 ****************************************************************************/ diff --git a/nuttx/configs/stm3210e-eval/README.txt b/nuttx/configs/stm3210e-eval/README.txt index 6c4b157c1..e6c55b332 100755 --- a/nuttx/configs/stm3210e-eval/README.txt +++ b/nuttx/configs/stm3210e-eval/README.txt @@ -418,3 +418,8 @@ Where is one of the following: This configuration directory exercises the USB serial class driver at examples/usbserial. See examples/README.txt for more information. + + usbstorage: + This configuration directory exercises the USB mass storage + class driver at examples/usbstorage. See examples/README.txt for + more information. diff --git a/nuttx/examples/usbstorage/Makefile b/nuttx/examples/usbstorage/Makefile index 3ba5aadf6..43bd4d4e6 100644 --- a/nuttx/examples/usbstorage/Makefile +++ b/nuttx/examples/usbstorage/Makefile @@ -39,10 +39,6 @@ ASRCS = CSRCS = usbstrg_main.c -ifeq ($(CONFIG_ARCH_CHIP),lpc214x) -CSRCS += usbstrg_lpc214x.c -endif - AOBJS = $(ASRCS:.S=$(OBJEXT)) COBJS = $(CSRCS:.c=$(OBJEXT)) diff --git a/nuttx/examples/usbstorage/usbstrg.h b/nuttx/examples/usbstorage/usbstrg.h index acbf5733f..9cf7af9d5 100644 --- a/nuttx/examples/usbstorage/usbstrg.h +++ b/nuttx/examples/usbstorage/usbstrg.h @@ -1,7 +1,7 @@ /**************************************************************************** * examples/usbstorage/usbstrg.h * - * Copyright (C) 2008 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -33,6 +33,9 @@ * ****************************************************************************/ +#ifndef __EXAMPLES_USBSTORAGE_USBSTRG_H +#define __EXAMPLES_USBSTORAGE_USBSTRG_H + /**************************************************************************** * Included Files ****************************************************************************/ @@ -106,8 +109,12 @@ * Name: usbstrg_archinitialize * * Description: - * Perform architecture specific initialization + * Perform architecture specific initialization. This function must + * configure the block device to export via USB. This function must be + * provided by architecture-specific logic in order to use this example. * ****************************************************************************/ extern int usbstrg_archinitialize(void); + +#endif /* __EXAMPLES_USBSTORAGE_USBSTRG_H */ diff --git a/nuttx/examples/usbstorage/usbstrg_main.c b/nuttx/examples/usbstorage/usbstrg_main.c index 6057a73e3..61f546b24 100644 --- a/nuttx/examples/usbstorage/usbstrg_main.c +++ b/nuttx/examples/usbstorage/usbstrg_main.c @@ -1,7 +1,7 @@ /**************************************************************************** * examples/usbstorage/usbstrg_main.c * - * Copyright (C) 2008 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without diff --git a/nuttx/include/nuttx/usbdev.h b/nuttx/include/nuttx/usbdev.h index 9cfb74350..2073297d3 100644 --- a/nuttx/include/nuttx/usbdev.h +++ b/nuttx/include/nuttx/usbdev.h @@ -278,6 +278,7 @@ struct usbdev_s /* USB Device Class Implementations *************************************************/ +struct usbdevclass_driver_s; struct usbdevclass_driverops_s { int (*bind)(FAR struct usbdev_s *dev, FAR struct usbdevclass_driver_s *driver);