Skip to content

Commit 2b8b8a3

Browse files
committed
Fix hcd_edpt_clear_stall
1 parent 7456073 commit 2b8b8a3

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/portable/renesas/usba/hcd_usba.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -765,19 +765,17 @@ bool hcd_edpt_clear_stall(uint8_t dev_addr, uint8_t ep_addr)
765765
{
766766
uint16_t volatile *ctr = addr_to_pipectr(dev_addr, ep_addr);
767767
TU_ASSERT(ctr);
768+
769+
const uint32_t pid = *ctr & 0x3;
770+
if (pid & 2) {
771+
*ctr = pid & 2;
772+
*ctr = 0;
773+
}
768774
*ctr = USB_PIPECTR_SQCLR;
769775
unsigned const epn = tu_edpt_number(ep_addr);
770776
if (!epn) return true;
771777

772-
if (tu_edpt_dir(ep_addr)) { /* IN */
773-
const unsigned num = _hcd.ep[dev_addr - 1][1][epn - 1];
774-
hcd_int_disable(0);
775-
USB0.PIPESEL.WORD = num;
776-
if (USB0.PIPECFG.BIT.TYPE != 1) {
777-
*ctr = USB_PIPECTR_PID_BUF;
778-
}
779-
hcd_int_enable(0);
780-
} else {
778+
if (!tu_edpt_dir(ep_addr)) { /* OUT */
781779
*ctr = USB_PIPECTR_PID_BUF;
782780
}
783781
return true;

0 commit comments

Comments
 (0)