summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorkkitayam <[email protected]>2021-03-27 16:03:04 +0900
committerkkitayam <[email protected]>2021-03-27 16:03:04 +0900
commita1f1941c3f965483e274993e43d18a9ede5e1f09 (patch)
tree02b079663c9cd251768758dd965a00cad03abef3 /src
parente48b2c681e9d7eaf07f3e1d4125ab24872645f32 (diff)
fixed a OUT transfer did not completed multiple of the max packet size
Diffstat (limited to 'src')
-rw-r--r--src/portable/renesas/usba/dcd_usba.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/portable/renesas/usba/dcd_usba.c b/src/portable/renesas/usba/dcd_usba.c
index e7518b01f..844fa3856 100644
--- a/src/portable/renesas/usba/dcd_usba.c
+++ b/src/portable/renesas/usba/dcd_usba.c
@@ -261,7 +261,7 @@ static int write_fifo(volatile void *fifo, pipe_state_t* pipe, unsigned mps)
return 0;
}
-/* 1 if the number of bytes read is less than 64 bytes
+/* 1 if the number of bytes read is less than mps bytes
* 0 otherwise */
static int read_fifo(volatile void *fifo, pipe_state_t* pipe, unsigned mps, size_t len)
{
@@ -272,12 +272,14 @@ static int read_fifo(volatile void *fifo, pipe_state_t* pipe, unsigned mps, size
hw_fifo_t *reg = (hw_fifo_t*)fifo;
uintptr_t addr = pipe->addr;
- while (len--) {
+ unsigned loop = len;
+ while (loop--) {
*(uint8_t *)addr = reg->u8;
++addr;
}
pipe->addr = addr;
- if (rem < mps) return 1;
+ if (rem < mps) return 1;
+ if (rem == len) return 2;
return 0;
}
@@ -419,7 +421,7 @@ static bool process_pipe_xfer(uint8_t rhport, uint8_t ep_addr, uint8_t* buffer,
*ctr = USB_PIPECTR_PID_BUF;
}
}
- //TU_LOG1("X %x %d\r\n", ep_addr, total_bytes);
+ // TU_LOG1("X %x %d\r\n", ep_addr, total_bytes);
return true;
}