From 4b1eecad66736d6f47befabd1d5c812b946a4f0b Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sun, 8 Sep 2019 06:58:34 -0600 Subject: [PATCH] EFM32 OTG host: Adam porters fix for STM32 FS/HS probably should be applied to EFM32 host which which has very similar IP. --- arch/arm/src/efm32/efm32_usbhost.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/arm/src/efm32/efm32_usbhost.c b/arch/arm/src/efm32/efm32_usbhost.c index 0192ad07cc..3db5c8d434 100644 --- a/arch/arm/src/efm32/efm32_usbhost.c +++ b/arch/arm/src/efm32/efm32_usbhost.c @@ -2177,6 +2177,7 @@ static ssize_t efm32_out_transfer(FAR struct efm32_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) @@ -2185,8 +2186,9 @@ static ssize_t efm32_out_transfer(FAR struct efm32_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 @@ -2263,6 +2265,7 @@ static ssize_t efm32_out_transfer(FAR struct efm32_usbhost_s *priv, int chidx, buffer += xfrlen; buflen -= xfrlen; xfrd += chan->xfrd; + zlp = false; } }