summaryrefslogtreecommitdiff
path: root/nuttx/drivers/usbhost/usbhost_storage.c
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2013-09-08 13:42:56 -0600
committerGregory Nutt <gnutt@nuttx.org>2013-09-08 13:42:56 -0600
commit8b5a8f98e261f31f15cae44fe8847ada4a0654e0 (patch)
tree7b76274110ab8ea553ae6629208a5bfa7410df90 /nuttx/drivers/usbhost/usbhost_storage.c
parent56ecc7ff06b521dbda03a4c7b6274459a5709ab2 (diff)
downloadnuttx-8b5a8f98e261f31f15cae44fe8847ada4a0654e0.tar.gz
nuttx-8b5a8f98e261f31f15cae44fe8847ada4a0654e0.tar.bz2
nuttx-8b5a8f98e261f31f15cae44fe8847ada4a0654e0.zip
Trivial updates assocaited with USB host mass storage and SAMA5 EHCI
Diffstat (limited to 'nuttx/drivers/usbhost/usbhost_storage.c')
-rw-r--r--nuttx/drivers/usbhost/usbhost_storage.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/nuttx/drivers/usbhost/usbhost_storage.c b/nuttx/drivers/usbhost/usbhost_storage.c
index 89ec6238f..d72203bdf 100644
--- a/nuttx/drivers/usbhost/usbhost_storage.c
+++ b/nuttx/drivers/usbhost/usbhost_storage.c
@@ -102,8 +102,9 @@
#define USBHOST_BOUTFOUND 0x04
#define USBHOST_ALLFOUND 0x07
-#define USBHOST_MAX_RETRIES 100
-#define USBHOST_MAX_CREFS 0x7fff
+#define USBHOST_RETRY_USEC (50*1000) /* Retry each 50 milliseconds */
+#define USBHOST_MAX_RETRIES 100 /* Give up after 5 seconds */
+#define USBHOST_MAX_CREFS INT16_MAX /* Max cref count before signed overflow */
/****************************************************************************
* Private Types
@@ -700,6 +701,7 @@ static inline int usbhost_maxlunreq(FAR struct usbhost_state_s *priv)
*(priv->tbuffer) = 0;
}
+
return OK;
}
@@ -1218,9 +1220,12 @@ static inline int usbhost_initvolume(FAR struct usbhost_state_s *priv)
/* Wait just a bit */
- usleep(50*1000);
+ usleep(USBHOST_RETRY_USEC);
- /* Send TESTUNITREADY to see if the unit is ready */
+ /* Send TESTUNITREADY to see if the unit is ready. The most likely error
+ * error that can occur here is a a stall which simply means that the
+ * the device is not yet able to respond.
+ */
ret = usbhost_testunitready(priv);
if (ret == OK)