From 03d2e32dc15adf9ee28772dfaecc52fac940f0d9 Mon Sep 17 00:00:00 2001 From: kkitayam <45088311+kkitayam@users.noreply.github.com> Date: Thu, 27 Jan 2022 23:38:19 +0900 Subject: [PATCH] Fix handling for pending transfers --- src/portable/nxp/khci/hcd_khci.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/portable/nxp/khci/hcd_khci.c b/src/portable/nxp/khci/hcd_khci.c index 133d65a6..92ec04d4 100644 --- a/src/portable/nxp/khci/hcd_khci.c +++ b/src/portable/nxp/khci/hcd_khci.c @@ -269,7 +269,8 @@ static void suspend_transfer(int pipenum, buffer_descriptor_t *bd) pipe_state_t *pipe = &_hcd.pipe[pipenum]; pipe->buffer = bd->addr; pipe->data = bd->data ^ 1; - if (TUSB_XFER_INTERRUPT == pipe->xfer) { + if ((TUSB_XFER_INTERRUPT == pipe->xfer) || + (TUSB_XFER_BULK == pipe->xfer)) { _hcd.pending |= TU_BIT(pipenum); KHCI->INTEN |= USB_ISTAT_SOFTOK_MASK; } @@ -613,7 +614,8 @@ void hcd_int_handler(uint8_t rhport) if (_hcd.pending) { int pipenum = __builtin_ctz(_hcd.pending); _hcd.pending = 0; - resume_transfer(pipenum); + if (!(is & USB_ISTAT_TOKDNE_MASK)) + resume_transfer(pipenum); } } if (is & USB_ISTAT_TOKDNE_MASK) {