LPC17 USB Host: Minor clean-up after performing some regressin testing

This commit is contained in:
Gregory Nutt
2014-03-19 08:33:15 -06:00
parent 34467249b5
commit 57516a8ede
3 changed files with 23 additions and 14 deletions
+4 -3
View File
@@ -1,7 +1,7 @@
/******************************************************************************* /*******************************************************************************
* arch/arm/src/lpc17xx/lpc17_usbhost.c * arch/arm/src/lpc17xx/lpc17_usbhost.c
* *
* Copyright (C) 2010-2012 Gregory Nutt. All rights reserved. * Copyright (C) 2010-2012, 2014 Gregory Nutt. All rights reserved.
* Authors: Rafael Noronha <rafael@pdsolucoes.com.br> * Authors: Rafael Noronha <rafael@pdsolucoes.com.br>
* Gregory Nutt <gnutt@nuttx.org> * Gregory Nutt <gnutt@nuttx.org>
* *
@@ -44,6 +44,7 @@
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h>
#include <semaphore.h> #include <semaphore.h>
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
@@ -1619,7 +1620,7 @@ static int lpc17_enumerate(FAR struct usbhost_connection_s *conn, int rphndx)
/* USB 2.0 spec says at least 50ms delay before port reset */ /* USB 2.0 spec says at least 50ms delay before port reset */
up_mdelay(100); (void)usleep(100*1000);
/* Put RH port 1 in reset (the LPC176x supports only a single downstream port) */ /* Put RH port 1 in reset (the LPC176x supports only a single downstream port) */
@@ -1632,7 +1633,7 @@ static int lpc17_enumerate(FAR struct usbhost_connection_s *conn, int rphndx)
/* Release RH port 1 from reset and wait a bit */ /* Release RH port 1 from reset and wait a bit */
lpc17_putreg(OHCI_RHPORTST_PRSC, LPC17_USBHOST_RHPORTST1); lpc17_putreg(OHCI_RHPORTST_PRSC, LPC17_USBHOST_RHPORTST1);
up_mdelay(200); (void)usleep(200*1000);
/* Let the common usbhost_enumerate do all of the real work. Note that the /* Let the common usbhost_enumerate do all of the real work. Note that the
* FunctionAddress (USB address) is hardcoded to one. * FunctionAddress (USB address) is hardcoded to one.
+18 -8
View File
@@ -837,16 +837,26 @@ USB host operations. To make these modifications, do the following:
1. First configure to build the NSH configuration from the top-level 1. First configure to build the NSH configuration from the top-level
NuttX directory: NuttX directory:
cd tools cd tools
./configure nucleus2g/nsh ./configure olimex-lpc1766stk/nsh
cd .. cd ..
2. Then edit the top-level .config file to enable USB host. Make the 2. Modify the top-level .config file to enable USB host using:
following changes:
CONFIG_LPC17_USBHOST=y make menuconfig
CONFIG_USBHOST=y
CONFIG_SCHED_WORKQUEUE=y Make the following changes:
System Type -> LPC17xx Peripheral Support
CONFIG_LPC17_USBHOST=y
Device Drivers-> USB Host Driver Support
CONFIG_USBHOST=y
CONFIG_USBHOST_ISOC_DISABLE=y
CONFIG_USBHOST_MSC=y
Library Routines
CONFIG_SCHED_WORKQUEUE=y
When this change is made, NSH should be extended to support USB flash When this change is made, NSH should be extended to support USB flash
devices. When a FLASH device is inserted, you should see a device devices. When a FLASH device is inserted, you should see a device
+1 -3
View File
@@ -157,15 +157,13 @@ static struct usbhost_connection_s *g_usbconn;
static int nsh_waiter(int argc, char *argv[]) static int nsh_waiter(int argc, char *argv[])
{ {
bool connected = false; bool connected = false;
int ret;
message("nsh_waiter: Running\n"); message("nsh_waiter: Running\n");
for (;;) for (;;)
{ {
/* Wait for the device to change state */ /* Wait for the device to change state */
ret = CONN_WAIT(g_usbconn, &connected); DEBUGVERIFY(CONN_WAIT(g_usbconn, &connected));
DEBUGASSERT(ret == OK);
connected = !connected; connected = !connected;
message("nsh_waiter: %s\n", connected ? "connected" : "disconnected"); message("nsh_waiter: %s\n", connected ? "connected" : "disconnected");