diff options
| author | hathach <[email protected]> | 2024-10-31 10:50:09 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2024-10-31 10:50:09 +0700 |
| commit | 92e7ac6c237bdba001660894d6be4008480ad7ba (patch) | |
| tree | e0cd4c0cd914d22b8c394414b5c1fa561f13d12a /src | |
| parent | 80d8157048170bcf2bbb77499b1496ea3c79c193 (diff) | |
fix bulk out and txfifo_empty(), should not rely on hcchar_bm.ep_size for OUT. msc explorer seems to work well.
Diffstat (limited to 'src')
| -rw-r--r-- | src/portable/synopsys/dwc2/hcd_dwc2.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/portable/synopsys/dwc2/hcd_dwc2.c b/src/portable/synopsys/dwc2/hcd_dwc2.c index e80f8d0ba..432aac1ea 100644 --- a/src/portable/synopsys/dwc2/hcd_dwc2.c +++ b/src/portable/synopsys/dwc2/hcd_dwc2.c @@ -882,12 +882,12 @@ bool handle_txfifo_empty(dwc2_regs_t* dwc2, bool is_periodic) { hcd_xfer_t* xfer = &_hcd_data.xfer[ch_id]; const uint16_t remain_packets = channel->hctsiz_bm.packet_count; for (uint16_t i = 0; i < remain_packets; i++) { - const uint16_t remain_bytes = (uint16_t) channel->hctsiz_bm.xfer_size; + const uint16_t remain_bytes = xfer->buf_len - xfer->out_fifo_bytes; const uint16_t xact_bytes = tu_min16(remain_bytes, channel->hcchar_bm.ep_size); - // check if there is enough space in FIFO and RequestQueue. + // skip if there is not enough space in FIFO and RequestQueue. // Packet's last word written to FIFO will trigger a request queue - if ((xact_bytes > (txsts_bm->fifo_available << 2)) && (txsts_bm->req_queue_available > 0)) { + if ((xact_bytes > (txsts_bm->fifo_available << 2)) || (txsts_bm->req_queue_available == 0)) { return true; } |
