summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhathach <[email protected]>2021-05-28 17:42:13 +0700
committerhathach <[email protected]>2021-05-28 17:42:13 +0700
commit164778a71682559670cc2549565b4d8d5f021fa9 (patch)
tree5da0e890dc5b9e152cf04bf3906a717da73f0126 /src
parente9c22e4a5c797e33c4ed5a735bf0d3d6e45b9a78 (diff)
update limit each transfer not less than 64
Diffstat (limited to 'src')
-rw-r--r--src/portable/raspberrypi/rp2040/hcd_rp2040.c2
-rw-r--r--src/portable/raspberrypi/rp2040/rp2040_usb.c8
2 files changed, 8 insertions, 2 deletions
diff --git a/src/portable/raspberrypi/rp2040/hcd_rp2040.c b/src/portable/raspberrypi/rp2040/hcd_rp2040.c
index 5201d1d4c..eff950de2 100644
--- a/src/portable/raspberrypi/rp2040/hcd_rp2040.c
+++ b/src/portable/raspberrypi/rp2040/hcd_rp2040.c
@@ -452,6 +452,7 @@ bool hcd_edpt_xfer(uint8_t rhport, uint8_t dev_addr, uint8_t ep_addr, uint8_t *
if (ep_addr != ep->ep_addr)
{
// Direction has flipped so re init it but with same properties
+ // TODO treat IN and OUT as invidual endpoints
_hw_endpoint_init(ep, dev_addr, ep_addr, ep->wMaxPacketSize, ep->transfer_type, 0);
}
@@ -531,6 +532,7 @@ bool hcd_edpt_busy(uint8_t dev_addr, uint8_t ep_addr)
bool hcd_edpt_stalled(uint8_t dev_addr, uint8_t ep_addr)
{
panic("hcd_pipe_stalled");
+ return false;
}
bool hcd_edpt_clear_stall(uint8_t dev_addr, uint8_t ep_addr)
diff --git a/src/portable/raspberrypi/rp2040/rp2040_usb.c b/src/portable/raspberrypi/rp2040/rp2040_usb.c
index 98ffea9a3..88d94aaec 100644
--- a/src/portable/raspberrypi/rp2040/rp2040_usb.c
+++ b/src/portable/raspberrypi/rp2040/rp2040_usb.c
@@ -161,7 +161,10 @@ void _hw_endpoint_xfer_start(struct hw_endpoint *ep, uint8_t *buffer, uint16_t t
// Fill in info now that we're kicking off the hw
ep->total_len = total_len;
ep->len = 0;
- ep->transfer_size = tu_min16(total_len, ep->wMaxPacketSize);
+
+ // Limit by packet size but not less 64 (i.e low speed 8 bytes EP0)
+ ep->transfer_size = tu_min16(total_len, tu_max16(64, ep->wMaxPacketSize));
+
ep->active = true;
ep->user_buf = buffer;
#if TUSB_OPT_HOST_ENABLED
@@ -240,8 +243,9 @@ bool _hw_endpoint_xfer_continue(struct hw_endpoint *ep)
_hw_endpoint_xfer_sync(ep);
// Now we have synced our state with the hardware. Is there more data to transfer?
+ // Limit by packet size but not less 64 (i.e low speed 8 bytes EP0)
uint16_t remaining_bytes = ep->total_len - ep->len;
- ep->transfer_size = tu_min16(remaining_bytes, ep->wMaxPacketSize);
+ ep->transfer_size = tu_min16(remaining_bytes, tu_max16(64, ep->wMaxPacketSize));
#if TUSB_OPT_HOST_ENABLED
_hw_endpoint_update_last_buf(ep);
#endif