fixed a OUT transfer did not completed multiple of the max packet size
@@ -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 == len) return 2;
return 0;
}
