LPC17 USB host: Direction bit being set wrong from allocated control endpoints

This commit is contained in:
Gregory Nutt 2015-04-24 19:46:00 -06:00
parent 64fe226669
commit ed5287855f
2 changed files with 17 additions and 11 deletions

View File

@ -2059,9 +2059,15 @@ static int lpc17_epalloc(struct usbhost_driver_s *drvr,
(uint32_t)(epdesc->addr) << ED_CONTROL_EN_SHIFT |
(uint32_t)(epdesc->mxpacketsize) << ED_CONTROL_MPS_SHIFT;
/* Get the direction of the endpoint */
/* Get the direction of the endpoint. For control endpoints, the
* direction is in the TD.
*/
if (epdesc->in)
if (epdesc->xfrtype == USB_EP_ATTR_XFER_CONTROL)
{
ed->hw.ctrl |= ED_CONTROL_D_TD1;
}
else if (epdesc->in)
{
ed->hw.ctrl |= ED_CONTROL_D_IN;
}

View File

@ -799,16 +799,16 @@ static void usbhost_hub_event(FAR void *arg)
connection = status & USBHUB_PORT_STAT_CONNECTION;
}
if ((change & USBHUB_PORT_STAT_CCONNECTION) != 0)
{
ctrlreq->type = USBHUB_REQ_TYPE_PORT;
ctrlreq->req = USBHUB_REQ_CLEARFEATURE;
usbhost_putle16(ctrlreq->value, USBHUB_PORT_FEAT_CCONNECTION);
usbhost_putle16(ctrlreq->index, port);
usbhost_putle16(ctrlreq->len, 0);
if ((change & USBHUB_PORT_STAT_CCONNECTION) != 0)
{
ctrlreq->type = USBHUB_REQ_TYPE_PORT;
ctrlreq->req = USBHUB_REQ_CLEARFEATURE;
usbhost_putle16(ctrlreq->value, USBHUB_PORT_FEAT_CCONNECTION);
usbhost_putle16(ctrlreq->index, port);
usbhost_putle16(ctrlreq->len, 0);
(void)DRVR_CTRLOUT(hport->drvr, hport->ep0, ctrlreq, NULL);
}
(void)DRVR_CTRLOUT(hport->drvr, hport->ep0, ctrlreq, NULL);
}
debouncetime += 25;
up_mdelay(25);