From 5b00e42bfabc6967fd4e5f96dd60bff86a7d16f0 Mon Sep 17 00:00:00 2001 From: patacongo Date: Wed, 11 Apr 2012 17:13:04 +0000 Subject: [PATCH] Misc STM32 OTF FS driver fixes + More Kconfig files git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4590 42af7a65-404d-4744-a932-0658087f49c3 --- arch/arm/src/stm32/stm32_otgfsdev.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/arch/arm/src/stm32/stm32_otgfsdev.c b/arch/arm/src/stm32/stm32_otgfsdev.c index 587dd4bcabc..2f297d09f66 100755 --- a/arch/arm/src/stm32/stm32_otgfsdev.c +++ b/arch/arm/src/stm32/stm32_otgfsdev.c @@ -1020,6 +1020,16 @@ static void stm32_epin_request(FAR struct stm32_usbdev_s *priv, privep->epphy, privreq, privreq->req.len, privreq->req.xfrd, privep->zlp); + /* Check for a special case: If we are just starting a request (xfrd==0) and + * the class driver is trying to send a zero-length packet (len==0). Then set + * the ZLP flag so that the packet will be sent. + */ + + if (privreq->req.len == 0) + { + privep->zlp = true; + } + /* Loop while there are still bytes to be transferred (or a zero-length- * packet, ZLP, to be sent). The loop will also be terminated if there * is insufficient space remaining in the TxFIFO to send a complete @@ -1043,7 +1053,7 @@ static void stm32_epin_request(FAR struct stm32_usbdev_s *priv, * the request. */ - privep->zlp = 0; + privep->zlp = false; if (nbytes >= privep->ep.maxpacket) { nbytes = privep->ep.maxpacket; @@ -1056,7 +1066,7 @@ static void stm32_epin_request(FAR struct stm32_usbdev_s *priv, if (bytesleft == privep->ep.maxpacket && (privreq->req.flags & USBDEV_REQFLAGS_NULLPKT) != 0) { - privep->zlp = 1; + privep->zlp = true; } } } @@ -1127,7 +1137,7 @@ static void stm32_epin_request(FAR struct stm32_usbdev_s *priv, usbtrace(TRACE_COMPLETE(privep->epphy), privreq->req.xfrd); stm32_req_complete(privep, OK); - privep->zlp = 0; + privep->zlp = false; privep->active = false; } }