Skip to content

Commit 1923b18

Browse files
author
Aladdin Bakosh
committed
fix(RA_hcd): STALL status can be also 3 not only 2
1 parent f1e006d commit 1923b18

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

src/host/usbh.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,7 @@ bool usbh_edpt_xfer_with_callback(uint8_t dev_addr, uint8_t ep_addr, uint8_t * b
791791
uint8_t const dir = tu_edpt_dir(ep_addr);
792792
tu_edpt_state_t* ep_state = &dev->ep_status[epnum][dir];
793793

794-
TU_LOG_USBH(" Queue EP %02X with %u bytes ... ", ep_addr, total_bytes);
794+
TU_LOG_USBH(" Queue EP %02X with %u bytes ... \r\n", ep_addr, total_bytes);
795795

796796
// Attempt to transfer on a busy endpoint, sound like an race condition !
797797
TU_ASSERT(ep_state->busy == 0);

src/portable/renesas/rusb2/hcd_rusb2.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ static unsigned find_pipe(unsigned xfer)
116116
for (int i = 3; i <= 5; ++i) {
117117
if (0 == _hcd.pipe[i].ep) return i;
118118
}
119-
for (int i = 1; i <= 1; ++i) {
119+
for (int i = 1; i <= 2; ++i) {
120120
if (0 == _hcd.pipe[i].ep) return i;
121121
}
122122
break;
@@ -413,6 +413,7 @@ static void process_pipe_nrdy(uint8_t rhport, unsigned num)
413413
switch (*ctr & RUSB2_PIPE_CTR_PID_Msk) {
414414
default: return;
415415
case RUSB2_PIPE_CTR_PID_STALL: result = XFER_RESULT_STALLED; break;
416+
case RUSB2_PIPE_CTR_PID_STALL2: result = XFER_RESULT_STALLED; break;
416417
case RUSB2_PIPE_CTR_PID_NAK: result = XFER_RESULT_FAILED; break;
417418
}
418419
pipe_state_t *pipe = &_hcd.pipe[num];
@@ -586,7 +587,7 @@ void hcd_device_close(uint8_t rhport, uint8_t dev_addr)
586587
uint8_t *ep = &_hcd.ep[dev_addr - 1][0][0];
587588
for (int i = 0; i < 2 * 15; ++i, ++ep) {
588589
unsigned num = *ep;
589-
if (!num || dev_addr != _hcd.pipe[num].dev) continue;
590+
if (!num || (dev_addr != _hcd.pipe[num].dev)) continue;
590591

591592
ctr = (uint16_t volatile*)&RUSB2->PIPE_CTR[num - 1];
592593
*ctr = 0;

src/portable/renesas/rusb2/rusb2_type.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1568,6 +1568,7 @@ TU_ATTR_BIT_FIELD_ORDER_END
15681568
#define RUSB2_PIPE_CTR_PID_NAK (0U << RUSB2_PIPE_CTR_PID_Pos) /* NAK response */
15691569
#define RUSB2_PIPE_CTR_PID_BUF (1U << RUSB2_PIPE_CTR_PID_Pos) /* BUF response (depends buffer state) */
15701570
#define RUSB2_PIPE_CTR_PID_STALL (2U << RUSB2_PIPE_CTR_PID_Pos) /* STALL response */
1571+
#define RUSB2_PIPE_CTR_PID_STALL2 (3U << RUSB2_PIPE_CTR_PID_Pos) /* Also STALL response */
15711572

15721573
#define RUSB2_DVSTCTR0_RHST_LS (1U << RUSB2_DVSTCTR0_RHST_Pos) /* Low-speed connection */
15731574
#define RUSB2_DVSTCTR0_RHST_FS (2U << RUSB2_DVSTCTR0_RHST_Pos) /* Full-speed connection */

0 commit comments

Comments
 (0)