mirror of
https://github.com/hathach/tinyusb.git
synced 2025-02-07 05:54:11 +08:00
update limit each transfer not less than 64
This commit is contained in:
parent
e9c22e4a5c
commit
164778a716
@ -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)
|
if (ep_addr != ep->ep_addr)
|
||||||
{
|
{
|
||||||
// Direction has flipped so re init it but with same properties
|
// 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);
|
_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)
|
bool hcd_edpt_stalled(uint8_t dev_addr, uint8_t ep_addr)
|
||||||
{
|
{
|
||||||
panic("hcd_pipe_stalled");
|
panic("hcd_pipe_stalled");
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hcd_edpt_clear_stall(uint8_t dev_addr, uint8_t ep_addr)
|
bool hcd_edpt_clear_stall(uint8_t dev_addr, uint8_t ep_addr)
|
||||||
|
@ -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
|
// Fill in info now that we're kicking off the hw
|
||||||
ep->total_len = total_len;
|
ep->total_len = total_len;
|
||||||
ep->len = 0;
|
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->active = true;
|
||||||
ep->user_buf = buffer;
|
ep->user_buf = buffer;
|
||||||
#if TUSB_OPT_HOST_ENABLED
|
#if TUSB_OPT_HOST_ENABLED
|
||||||
@ -240,8 +243,9 @@ bool _hw_endpoint_xfer_continue(struct hw_endpoint *ep)
|
|||||||
_hw_endpoint_xfer_sync(ep);
|
_hw_endpoint_xfer_sync(ep);
|
||||||
|
|
||||||
// Now we have synced our state with the hardware. Is there more data to transfer?
|
// 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;
|
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
|
#if TUSB_OPT_HOST_ENABLED
|
||||||
_hw_endpoint_update_last_buf(ep);
|
_hw_endpoint_update_last_buf(ep);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user