summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiFiPhile <[email protected]>2026-01-15 19:13:18 +0100
committerHiFiPhile <[email protected]>2026-01-15 19:13:18 +0100
commit8ef8ee1946f3c0f600500eb49b2b0c1352f8dcb8 (patch)
tree5ab0ba2823d981e6a4e605105377fc2f458f3905
parentb03a87731cb38d7f1fbf82f07886e071f0a48bbf (diff)
dcd/musb: fix zlp IN
Signed-off-by: HiFiPhile <[email protected]>
-rw-r--r--src/portable/mentor/musb/dcd_musb.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/portable/mentor/musb/dcd_musb.c b/src/portable/mentor/musb/dcd_musb.c
index 06f62b0d3..9e6ee6f5d 100644
--- a/src/portable/mentor/musb/dcd_musb.c
+++ b/src/portable/mentor/musb/dcd_musb.c
@@ -189,14 +189,14 @@ static void process_setup_packet(uint8_t rhport) {
}
}
-static bool handle_xfer_in(uint8_t rhport, uint_fast8_t ep_addr)
+static bool handle_xfer_in(uint8_t rhport, uint_fast8_t ep_addr, bool is_zlp)
{
unsigned epnum = tu_edpt_number(ep_addr);
unsigned epnum_minus1 = epnum - 1;
pipe_state_t *pipe = &_dcd.pipe[tu_edpt_dir(ep_addr)][epnum_minus1];
const unsigned rem = pipe->remaining;
- if (!rem) {
+ if (!rem && !is_zlp) {
pipe->buf = NULL;
return true;
}
@@ -268,7 +268,7 @@ static bool edpt_n_xfer(uint8_t rhport, uint8_t ep_addr, uint8_t *buffer, uint16
pipe->remaining = total_bytes;
if (dir_in) {
- handle_xfer_in(rhport, ep_addr);
+ handle_xfer_in(rhport, ep_addr, total_bytes == 0);
} else {
musb_regs_t* musb_regs = MUSB_REGS(rhport);
musb_ep_csr_t* ep_csr = get_ep_csr(musb_regs, epnum);
@@ -445,7 +445,7 @@ static void process_edpt_n(uint8_t rhport, uint_fast8_t ep_addr)
ep_csr->tx_csrl &= ~(MUSB_TXCSRL1_STALLED | MUSB_TXCSRL1_UNDRN);
return;
}
- completed = handle_xfer_in(rhport, ep_addr);
+ completed = handle_xfer_in(rhport, ep_addr, false);
} else {
// TU_LOG1(" RX CSRL%d = %x\r\n", epn, ep_csr->rx_csrl);
if (ep_csr->rx_csrl & MUSB_RXCSRL1_STALLED) {