diff --git a/arch/arm/src/arm/up_cache.S b/arch/arm/src/arm/up_cache.S index eacd8cb57e1..74f337e9583 100644 --- a/arch/arm/src/arm/up_cache.S +++ b/arch/arm/src/arm/up_cache.S @@ -149,6 +149,9 @@ cp15_invalidate_icache: /* Invalidate D-Cache in the region described by r0=start and r1=end. */ + .globl cp15_invalidate_dcache + .type cp15_invalidate_dcache, function + cp15_invalidate_dcache: bic r0, r0, #CACHE_DLINESIZE - 1 mcr p15, 0, r0, c7, c6, 1 /* Invalidate D entry */ @@ -161,8 +164,8 @@ cp15_invalidate_dcache: #if 0 /* Not used */ /* Invalidate Dcache */ - .globl cp15_invalidate_dcache - .type cp15_invalidate_dcache, function + .globl cp15_invalidate_dcache_all + .type cp15_invalidate_dcache_all, function cp15_invalidate_dcache_all: mov r0, #0 @@ -176,7 +179,7 @@ cp15_invalidate_dcache_all: nop nop bx lr - .size cp15_invalidate_dcache, . - cp15_invalidate_dcache + .size cp15_invalidate_dcache_all, . - cp15_invalidate_dcache_all /* CP15 Prefetch Icache line c7 * Performs an Icache lookup of the specified modified virtual address. diff --git a/configs/olimex-lpc-h3131/README.txt b/configs/olimex-lpc-h3131/README.txt index d5113176ef5..3034eb6bac9 100644 --- a/configs/olimex-lpc-h3131/README.txt +++ b/configs/olimex-lpc-h3131/README.txt @@ -569,3 +569,43 @@ Configurations nsh: Configures the NuttShell (nsh) located at examples/nsh. The Configuration enables only the serial NSH interface. + + General Configuration. These are easily change by modifying the NuttX + configuration: + + - Console on UART -> UART-to-USB converter + - Platform: Windows with Cygwin + - Toolchain: CodeSourcery for Windows + + NOTES: + 1. This configuration has been used to test USB host functionaly. USB + host is *not* enabled by default. If you will to enable USB host + support in the NSH configuration, please modify the NuttX + configuration as follows: + + Drivers -> USB Host Driver Support + CONFIG_USBHOST=y : General USB host support + CONFIG_USBHOST_MSC=y : Mass storage class support + CONFIG_USBHOST_INT_DISABLE=y : Not needed + CONFIG_USBHOST_ISOC_DISABLE=y : Not needed + + System Type -> Peripherals + CONFIG_LPC31_USBOTG=y : Enable the USB OTG peripheral + + System Type -> USB host configuration + CONFIG_LPC31_EHCI_BUFSIZE=128 + CONFIG_LPC31_EHCI_PREALLOCATE=y + + Library Routines + CONFIG_SCHED_WORKQUEUE=y : Work queue support is needed + + The USB monitor can also be enabled: + + Drivers -> USB Host Driver Support + CONFIG_USBHOST_TRACE=y + CONFIG_USBHOST_TRACE_NRECORDS=128 + CONFIG_USBHOST_TRACE_VERBOSE=y + + Application Configuration -> System Add-Ons + CONFIG_SYSTEM_USBMONITOR=y + CONFIG_SYSTEM_USBMONITOR_INTERVAL=1 diff --git a/configs/olimex-lpc-h3131/nsh/defconfig b/configs/olimex-lpc-h3131/nsh/defconfig index 91fd24554b4..73f15ceb818 100644 --- a/configs/olimex-lpc-h3131/nsh/defconfig +++ b/configs/olimex-lpc-h3131/nsh/defconfig @@ -354,8 +354,9 @@ CONFIG_FS_READABLE=y CONFIG_FS_WRITABLE=y # CONFIG_FS_RAMMAP is not set CONFIG_FS_FAT=y -# CONFIG_FAT_LCNAMES is not set -# CONFIG_FAT_LFN is not set +CONFIG_FAT_LCNAMES=y +CONFIG_FAT_LFN=y +CONFIG_FAT_MAXFNAME=32 # CONFIG_FS_FATTIME is not set # CONFIG_FAT_DMAMEMORY is not set # CONFIG_FS_NXFFS is not set diff --git a/configs/olimex-lpc-h3131/src/lpc31_boot.c b/configs/olimex-lpc-h3131/src/lpc31_boot.c index 46976c6fe49..50fb56dcfc7 100644 --- a/configs/olimex-lpc-h3131/src/lpc31_boot.c +++ b/configs/olimex-lpc-h3131/src/lpc31_boot.c @@ -107,11 +107,8 @@ void lpc31_boardinitialize(void) * selected. */ -#if defined(CONFIG_SAMA5_UHPHS) || defined(CONFIG_SAMA5_UDPHS) - if (lpc31_usbhost_bootinitialize) - { - lpc31_usbhost_bootinitialize(); - } +#if defined(CONFIG_USBHOST) || defined(CONFIG_LPC31_USBOTG) + lpc31_usbhost_bootinitialize(); #endif /* Configure on-board LEDs in all cases */ diff --git a/configs/olimex-lpc-h3131/src/lpc31_nsh.c b/configs/olimex-lpc-h3131/src/lpc31_nsh.c index 2f660c15a21..969bd59a77b 100644 --- a/configs/olimex-lpc-h3131/src/lpc31_nsh.c +++ b/configs/olimex-lpc-h3131/src/lpc31_nsh.c @@ -49,8 +49,14 @@ # include #endif +#ifdef CONFIG_SYSTEM_USBMONITOR +# include +#endif + #include "lpc31_internal.h" +#include "lpc_h3131.h" + /**************************************************************************** * Pre-Processor Definitions ****************************************************************************/ @@ -59,7 +65,9 @@ /* PORT and SLOT number probably depend on the board configuration */ -#define NSH_HAVEMMCSD 1 +#define HAVE_MMCSD 1 +#define HAVE_USBHOST 1 +#define HAVE_USBMONTOR 1 #if defined(CONFIG_NSH_MMCSDSLOTNO) && CONFIG_NSH_MMCSDSLOTNO != 0 # error "Only one MMC/SD slot" @@ -74,13 +82,29 @@ */ #if defined(CONFIG_DISABLE_MOUNTPOINT) || !defined(CONFIG_LPC31_MCI) -# undef NSH_HAVEMMCSD +# undef HAVE_MMCSD #endif #ifndef CONFIG_NSH_MMCSDMINOR # define CONFIG_NSH_MMCSDMINOR 0 #endif +/* Can't support USB host features if USB host is not enabled */ + +#if !defined(CONFIG_LPC31_USBOTG) || !defined(CONFIG_USBHOST) +# undef HAVE_USBHOST +#endif + +/* Check if we need to support the USB monitor */ + +#ifndef HAVE_USBHOST +# undef CONFIG_USBHOST_TRACE +#endif + +#if !defined(CONFIG_SYSTEM_USBMONITOR) || !defined(CONFIG_USBHOST_TRACE) +# undef HAVE_USBMONITOR +#endif + /* Debug ********************************************************************/ #ifdef CONFIG_CPP_HAVE_VARARGS @@ -111,10 +135,14 @@ int nsh_archinitialize(void) { -#ifdef NSH_HAVEMMCSD +#ifdef HAVE_MMCSD FAR struct sdio_dev_s *sdio; +#endif +#if defined(HAVE_MMCSD) || defined(HAVE_USBHOST) int ret; +#endif +#ifdef HAVE_MMCSD /* First, get an instance of the SDIO interface */ message("nsh_archinitialize: Initializing SDIO slot %d\n", @@ -146,5 +174,29 @@ int nsh_archinitialize(void) sdio_mediachange(sdio, true); #endif + +#ifdef HAVE_USBHOST + /* Initialize USB host operation. lpc31_usbhost_initialize() starts a thread + * will monitor for USB connection and disconnection events. + */ + + ret = lpc31_usbhost_initialize(); + if (ret != OK) + { + message("ERROR: Failed to initialize USB host: %d\n", ret); + return ret; + } +#endif + +#ifdef HAVE_USBMONITOR + /* Start the USB Monitor */ + + ret = usbmonitor_start(0, NULL); + if (ret != OK) + { + message("nsh_archinitialize: Start USB monitor: %d\n", ret); + } +#endif + return OK; } diff --git a/configs/olimex-lpc-h3131/src/lpc31_usbhost.c b/configs/olimex-lpc-h3131/src/lpc31_usbhost.c index cbf2b7c1391..13d7a8a4233 100644 --- a/configs/olimex-lpc-h3131/src/lpc31_usbhost.c +++ b/configs/olimex-lpc-h3131/src/lpc31_usbhost.c @@ -56,7 +56,7 @@ #include "lpc31_internal.h" #include "lpc_h3131.h" -#if defined(CONFIG_LPC31_USBOTG) || defined(CONFIG_USBHOST) +#if defined(CONFIG_LPC31_USBOTG) && defined(CONFIG_USBHOST) /************************************************************************************ * Pre-processor Definitions @@ -70,10 +70,6 @@ # define CONFIG_USBHOST_STACKSIZE 1024 #endif -#ifdef HAVE_USBDEV -# undef CONFIG_LPC31_USBOTG_RHPORT1 -#endif - /************************************************************************************ * Private Data ************************************************************************************/ @@ -239,8 +235,9 @@ int lpc31_usbhost_initialize(void) * each platform that implements the OHCI or EHCI host interface * * Input Parameters: - * rhport - Selects root hub port to be powered host interface. See SAM_RHPORT_* - * definitions above. + * rhport - Selects root hub port to be powered host interface. Since the LPC31 + * has only a downstream port, zero is the only possible value for this + * parameter. * enable - true: enable VBUS power; false: disable VBUS power * * Returned Value: