arch/arm/src/stm32/stm32_otg[fs|hs]host.c: STM32 host only initiates transfer if buflenl > 0.

This commit is contained in:
Adam Porter 2019-09-08 06:46:54 -06:00 committed by Gregory Nutt
parent 5707d01cc3
commit 5b4516d291
2 changed files with 9 additions and 2 deletions

View File

@ -2201,6 +2201,7 @@ static ssize_t stm32_out_transfer(FAR struct stm32_usbhost_s *priv, int chidx,
size_t xfrlen;
ssize_t xfrd;
int ret;
bool zlp;
/* Loop until the transfer completes (i.e., buflen is decremented to zero)
* or a fatal error occurs (any error other than a simple NAK)
@ -2209,8 +2210,9 @@ static ssize_t stm32_out_transfer(FAR struct stm32_usbhost_s *priv, int chidx,
chan = &priv->chan[chidx];
start = clock_systimer();
xfrd = 0;
zlp = (buflen == 0);
while (buflen > 0)
while (buflen > 0 || zlp)
{
/* Transfer one packet at a time. The hardware is capable of queueing
* multiple OUT packets, but I just haven't figured out how to handle
@ -2287,6 +2289,7 @@ static ssize_t stm32_out_transfer(FAR struct stm32_usbhost_s *priv, int chidx,
buffer += xfrlen;
buflen -= xfrlen;
xfrd += chan->xfrd;
zlp = false;
}
}

View File

@ -2206,6 +2206,7 @@ static ssize_t stm32_out_transfer(FAR struct stm32_usbhost_s *priv, int chidx,
size_t xfrlen;
ssize_t xfrd;
int ret;
bool zlp;
/* Loop until the transfer completes (i.e., buflen is decremented to zero)
* or a fatal error occurs (any error other than a simple NAK)
@ -2214,9 +2215,11 @@ static ssize_t stm32_out_transfer(FAR struct stm32_usbhost_s *priv, int chidx,
chan = &priv->chan[chidx];
start = clock_systimer();
xfrd = 0;
zlp = (buflen == 0);
while (buflen > 0)
while (buflen > 0 || zlp)
{
/* Transfer one packet at a time. The hardware is capable of queueing
* multiple OUT packets, but I just haven't figured out how to handle
* the case where a single OUT packet in the group is NAKed.
@ -2292,6 +2295,7 @@ static ssize_t stm32_out_transfer(FAR struct stm32_usbhost_s *priv, int chidx,
buffer += xfrlen;
buflen -= xfrlen;
xfrd += chan->xfrd;
zlp = false;
}
}