Skip to content

Commit 66aa429

Browse files
committed
- correctly do_ping if received nyet as transfer complete e.g msc 31 byte command
- correctly carry out OUT transfer when PING is ack
1 parent 8111e53 commit 66aa429

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/portable/synopsys/dwc2/hcd_dwc2.c

+8-5
Original file line numberDiff line numberDiff line change
@@ -959,6 +959,10 @@ static bool handle_channel_out_slave(dwc2_regs_t* dwc2, uint8_t ch_id, uint32_t
959959
is_done = true;
960960
xfer->result = XFER_RESULT_SUCCESS;
961961
channel->hcintmsk &= ~HCINT_ACK;
962+
if (hcint & HCINT_NYET) {
963+
// complete transfer with NYET, do ping next time
964+
edpt->next_do_ping = 1;
965+
}
962966
} else if (hcint & HCINT_STALL) {
963967
xfer->result = XFER_RESULT_STALLED;
964968
channel_disable(dwc2, channel);
@@ -1002,16 +1006,15 @@ static bool handle_channel_out_slave(dwc2_regs_t* dwc2, uint8_t ch_id, uint32_t
10021006
channel->hcintmsk &= ~HCINT_ACK;
10031007
if (hcsplt.split_en) {
10041008
if (!hcsplt.split_compl) {
1005-
// start split is ACK --> do complete split
1009+
// ACK for start split --> do complete split
10061010
hcsplt.split_compl = 1;
10071011
channel->hcsplt = hcsplt.value;
10081012
channel->hcchar |= HCCHAR_CHENA;
10091013
}
10101014
} else {
1011-
// Device is ready, resume transfer
1012-
edpt->next_do_ping = 0;
1013-
xfer->err_count = 0;
1014-
TU_ASSERT(channel_xfer_start(dwc2, ch_id));
1015+
// ACK interrupt is only enabled for Split and PING
1016+
// ACK for PING, which mean device is ready to receive data
1017+
channel->hcchar |= HCCHAR_CHENA;
10151018
}
10161019
}
10171020

0 commit comments

Comments
 (0)