Basic USB host functionality in place

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3236 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2011-01-09 15:35:08 +00:00
parent 62fc52a04b
commit 6992701370

View File

@ -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 */