This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 20af03b31e arch/{nrf52|nrf53}/usbd: fix IN endpoint completion logic
20af03b31e is described below
commit 20af03b31e570158333d21889c54ecfdf2d603b2
Author: raiden00pl <[email protected]>
AuthorDate: Fri May 26 14:16:58 2023 +0200
arch/{nrf52|nrf53}/usbd: fix IN endpoint completion logic
Confirmation of the IN request must be done immediately after all data has
been transferred,
otherwise sending data when more than one request has been added to the
queue will
not work properly.
---
arch/arm/src/nrf52/nrf52_usbd.c | 4 +++-
arch/arm/src/nrf53/nrf53_usbd.c | 4 +++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/arch/arm/src/nrf52/nrf52_usbd.c b/arch/arm/src/nrf52/nrf52_usbd.c
index bf45e8ba80..4ae480b688 100644
--- a/arch/arm/src/nrf52/nrf52_usbd.c
+++ b/arch/arm/src/nrf52/nrf52_usbd.c
@@ -1143,7 +1143,9 @@ static void nrf52_epin_request(struct nrf52_usbdev_s
*priv,
privreq->req.xfrd += nbytes;
}
- else if (privreq->req.xfrd >= privreq->req.len)
+ /* Has all the request data been sent? */
+
+ if (privreq->req.xfrd >= privreq->req.len)
{
usbtrace(TRACE_COMPLETE(privep->epphy), privreq->req.xfrd);
diff --git a/arch/arm/src/nrf53/nrf53_usbd.c b/arch/arm/src/nrf53/nrf53_usbd.c
index 79070d62d2..44760a768f 100644
--- a/arch/arm/src/nrf53/nrf53_usbd.c
+++ b/arch/arm/src/nrf53/nrf53_usbd.c
@@ -1143,7 +1143,9 @@ static void nrf53_epin_request(struct nrf53_usbdev_s
*priv,
privreq->req.xfrd += nbytes;
}
- else if (privreq->req.xfrd >= privreq->req.len)
+ /* Has all the request data been sent? */
+
+ if (privreq->req.xfrd >= privreq->req.len)
{
usbtrace(TRACE_COMPLETE(privep->epphy), privreq->req.xfrd);