Basic USB host functionality in place
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@3236 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
parent
8601223815
commit
82af4cea99
|
@ -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 */
|
||||
|
||||
|
|
|
@ -401,7 +401,7 @@ struct ohci_gtd_s
|
|||
|
||||
struct ohci_itd_s
|
||||
{
|
||||
volatile uint32_t status; /* TD status/control bits */
|
||||
volatile uint32_t ctrl; /* TD status/control bits */
|
||||
volatile uint32_t bp0; /* Buffer page 0 (BP0 */
|
||||
volatile uint32_t nexttd; /* Next TD (NextTD) */
|
||||
volatile uint32_t be; /* Buffer End (BE) */
|
||||
|
|
|
@ -526,10 +526,10 @@ struct usbhost_driver_s
|
|||
struct usbhost_epdesc_s
|
||||
{
|
||||
uint8_t addr : 4; /* Endpoint address */
|
||||
uint8_t pad1 : 3;
|
||||
uint8_t pad : 3;
|
||||
uint8_t in : 1; /* Direction: 1->IN */
|
||||
uint8_t funcaddr : 7; /* USB address of function containing endpoint */
|
||||
uint8_t pad2 : 1;
|
||||
uint8_t toggle : 1; /* Last toggle (modified by the driver) */
|
||||
uint16_t mxpacketsize; /* Max packetsize */
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue