diff --git a/arch/arm/src/lpc214x/lpc214x_usbdev.c b/arch/arm/src/lpc214x/lpc214x_usbdev.c index ddd03fc90e..2bee48e667 100644 --- a/arch/arm/src/lpc214x/lpc214x_usbdev.c +++ b/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/configs/mcu123-lpc214x/src/Makefile b/configs/mcu123-lpc214x/src/Makefile index ab71e0ccea..aad225d089 100644 --- a/configs/mcu123-lpc214x/src/Makefile +++ b/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/examples/usbstorage/usbstrg_lpc214x.c b/configs/mcu123-lpc214x/src/up_usbstrg.c old mode 100644 new mode 100755 similarity index 86% rename from examples/usbstorage/usbstrg_lpc214x.c rename to configs/mcu123-lpc214x/src/up_usbstrg.c index aea0f0ae56..aab15f13a2 --- a/examples/usbstorage/usbstrg_lpc214x.c +++ b/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/configs/stm3210e-eval/README.txt b/configs/stm3210e-eval/README.txt index 6c4b157c15..e6c55b332e 100755 --- a/configs/stm3210e-eval/README.txt +++ b/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/examples/usbstorage/Makefile b/examples/usbstorage/Makefile index 3ba5aadf67..43bd4d4e6b 100644 --- a/examples/usbstorage/Makefile +++ b/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/examples/usbstorage/usbstrg.h b/examples/usbstorage/usbstrg.h index acbf5733f8..9cf7af9d54 100644 --- a/examples/usbstorage/usbstrg.h +++ b/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/examples/usbstorage/usbstrg_main.c b/examples/usbstorage/usbstrg_main.c index 6057a73e36..61f546b244 100644 --- a/examples/usbstorage/usbstrg_main.c +++ b/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/include/nuttx/usbdev.h b/include/nuttx/usbdev.h index 9cfb74350a..2073297d33 100644 --- a/include/nuttx/usbdev.h +++ b/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);