summaryrefslogtreecommitdiff
path: root/nuttx/arch/arm/src/stm32/stm32_otgfsdev.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-04-11 18:12:03 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-04-11 18:12:03 +0000
commit7d770cc270d1e3f73899309ca4a2ac9a1739ffcc (patch)
treec6ed698ba446d8c202e564579ce0802d34a61979 /nuttx/arch/arm/src/stm32/stm32_otgfsdev.c
parent36e82d637fffd680dfa0e4bbb245231640ac0ba1 (diff)
downloadpx4-nuttx-7d770cc270d1e3f73899309ca4a2ac9a1739ffcc.tar.gz
px4-nuttx-7d770cc270d1e3f73899309ca4a2ac9a1739ffcc.tar.bz2
px4-nuttx-7d770cc270d1e3f73899309ca4a2ac9a1739ffcc.zip
Correction to the ZLP fix for the STM32 F4 OTG FS driver
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4591 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch/arm/src/stm32/stm32_otgfsdev.c')
-rwxr-xr-xnuttx/arch/arm/src/stm32/stm32_otgfsdev.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/nuttx/arch/arm/src/stm32/stm32_otgfsdev.c b/nuttx/arch/arm/src/stm32/stm32_otgfsdev.c
index 2f297d09f..948ee4510 100755
--- a/nuttx/arch/arm/src/stm32/stm32_otgfsdev.c
+++ b/nuttx/arch/arm/src/stm32/stm32_otgfsdev.c
@@ -1027,6 +1027,11 @@ static void stm32_epin_request(FAR struct stm32_usbdev_s *priv,
if (privreq->req.len == 0)
{
+ /* The ZLP flag is set TRUE whenever we want to force the driver to
+ * send a zero-length-packet on the next pass through the loop (below).
+ * The flag is cleared whenever a packet is sent in the loop below.
+ */
+
privep->zlp = true;
}
@@ -1043,6 +1048,10 @@ static void stm32_epin_request(FAR struct stm32_usbdev_s *priv,
bytesleft = privreq->req.len - privreq->req.xfrd;
nbytes = bytesleft;
+ /* Assume no zero-length-packet on the next pass through this loop */
+
+ privep->zlp = false;
+
/* Limit the size of the transfer to one full packet and handle
* zero-length packets (ZLPs).
*/
@@ -1053,7 +1062,6 @@ static void stm32_epin_request(FAR struct stm32_usbdev_s *priv,
* the request.
*/
- privep->zlp = false;
if (nbytes >= privep->ep.maxpacket)
{
nbytes = privep->ep.maxpacket;
@@ -1066,6 +1074,14 @@ static void stm32_epin_request(FAR struct stm32_usbdev_s *priv,
if (bytesleft == privep->ep.maxpacket &&
(privreq->req.flags & USBDEV_REQFLAGS_NULLPKT) != 0)
{
+ /* The ZLP flag is set TRUE whenever we want to force
+ * the driver to send a zero-length-packet on the next
+ * pass through this loop. The flag is cleared (above)
+ * whenever we are committed to sending any packet and
+ * set here when we want to force one more pass through
+ * the loop.
+ */
+
privep->zlp = true;
}
}