Fixed L4 USB Driver by avoiding SETUPDONE and EPOUT_SETUP

This commit is contained in:
David Sidrane 2016-10-04 16:35:59 -10:00
parent a416b304a3
commit d4a8585d6f

View File

@ -3321,20 +3321,10 @@ static inline void stm32l4_rxinterrupt(FAR struct stm32l4_usbdev_s *priv)
{ {
usbtrace(TRACE_INTDECODE(STM32L4_TRACEINTID_SETUPDONE), epphy); usbtrace(TRACE_INTDECODE(STM32L4_TRACEINTID_SETUPDONE), epphy);
/* Now that the Setup Phase is complete if it was an OUT enable /* On the L4 This event does not occur on the next SETUP
* the endpoint * after a SETUP OUT.
* (Doing this here prevents the loss of the first FIFO word)
*/ */
if (priv->ep0state == EP0STATE_SETUP_OUT)
{
/* Clear NAKSTS so that we can receive the data */
regval = stm32l4_getreg(STM32L4_OTGFS_DOEPCTL(0));
regval |= OTGFS_DOEPCTL0_CNAK;
stm32l4_putreg(regval, STM32L4_OTGFS_DOEPCTL(0));
}
} }
break; break;
@ -3370,17 +3360,23 @@ static inline void stm32l4_rxinterrupt(FAR struct stm32l4_usbdev_s *priv)
datlen = GETUINT16(priv->ctrlreq.len); datlen = GETUINT16(priv->ctrlreq.len);
if (USB_REQ_ISOUT(priv->ctrlreq.type) && datlen > 0) if (USB_REQ_ISOUT(priv->ctrlreq.type) && datlen > 0)
{ {
/* Reset the endpoint and Stop NAK-ing */
stm32l4_ep0out_ctrlsetup(priv);
/* Wait for the data phase. */ /* Wait for the data phase. */
priv->ep0state = EP0STATE_SETUP_OUT; priv->ep0state = EP0STATE_SETUP_OUT;
} }
else else
{ {
/* We can process the setup data as soon as SETUP done word is /* We can process the setup data Now no need to wait for SETUP done word
* popped of the RxFIFO. * to be popped of the RxFIFO.
*/ */
priv->ep0state = EP0STATE_SETUP_READY; priv->ep0state = EP0STATE_SETUP_READY;
stm32l4_ep0out_setup(priv);
} }
} }
break; break;