summaryrefslogtreecommitdiff
path: root/nuttx/arch/arm/src/lpc17xx/lpc17_usbhost.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-01-09 15:35:08 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-01-09 15:35:08 +0000
commit29c706c9e17447ef58198c36168457c37a00ff4e (patch)
tree9d83ade9fa10c17da6252dc45d29bd5bf1c8ed70 /nuttx/arch/arm/src/lpc17xx/lpc17_usbhost.c
parent5bdca5bec60da89395a77402c0eea7d0c627eb98 (diff)
downloadpx4-nuttx-29c706c9e17447ef58198c36168457c37a00ff4e.tar.gz
px4-nuttx-29c706c9e17447ef58198c36168457c37a00ff4e.tar.bz2
px4-nuttx-29c706c9e17447ef58198c36168457c37a00ff4e.zip
Basic USB host functionality in place
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3236 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch/arm/src/lpc17xx/lpc17_usbhost.c')
-rwxr-xr-xnuttx/arch/arm/src/lpc17xx/lpc17_usbhost.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_usbhost.c b/nuttx/arch/arm/src/lpc17xx/lpc17_usbhost.c
index 9b73ed0d2..950a0ffe7 100755
--- a/nuttx/arch/arm/src/lpc17xx/lpc17_usbhost.c
+++ b/nuttx/arch/arm/src/lpc17xx/lpc17_usbhost.c
@@ -1282,8 +1282,8 @@ static int lpc17_transfer(FAR struct usbhost_driver_s *drvr,
int ret;
DEBUGASSERT(drvr && ep && buffer && buflen > 0);
- uvdbg("EP%d %s maxpacket:%d buflen:%d\n",
- ep->addr, ep->in ? "IN" : "OUT", ep->mxpacketsize, buflen);
+ uvdbg("EP%d %s toggle:%d maxpacket:%d buflen:%d\n",
+ ep->addr, ep->in ? "IN" : "OUT", ep->toggle, ep->mxpacketsize, buflen);
/* Allocate an IO buffer if the user buffer does not lie in AHB SRAM */
@@ -1346,7 +1346,9 @@ static int lpc17_transfer(FAR struct usbhost_driver_s *drvr,
goto errout;
}
- /* Format the endpoint descriptor */
+ /* Format the endpoint descriptor. This could be a lot simpler if
+ * the OHCI ED structure were exposed outside of the driver.
+ */
lpc17_edinit(ed);
ed->ctrl = (uint32_t)(ep->funcaddr) << ED_CONTROL_FA_SHIFT |
@@ -1366,6 +1368,13 @@ static int lpc17_transfer(FAR struct usbhost_driver_s *drvr,
dirpid = GTD_STATUS_DP_OUT;
}
+ /* Set/restore the toggle carry bit */
+
+ if (ep->toggle)
+ {
+ ed->headp = ED_HEADP_C;
+ }
+
/* Then enqueue the transfer */
priv->tdstatus = TD_CC_NOERROR;
@@ -1411,6 +1420,20 @@ static int lpc17_transfer(FAR struct usbhost_driver_s *drvr,
ret = -EIO;
}
+ /* Save the toggle carry bit. This bit is updated each time that an
+ * ED is retired. This could be a lot simpler if the OHCI ED structure
+ * were exposed outside of the driver.
+ */
+
+ if ((ed->headp & ED_HEADP_C) != 0)
+ {
+ ep->toggle = 1;
+ }
+ else
+ {
+ ep->toggle = 0;
+ }
+
errout:
/* Free any temporary IO buffers */