summaryrefslogtreecommitdiff
path: root/src/tusb.c
diff options
context:
space:
mode:
authorHa Thach <[email protected]>2026-03-12 14:57:29 +0700
committerGitHub <[email protected]>2026-03-12 14:57:29 +0700
commitac61a5b176b44db503d8bcc287a622463b65e48e (patch)
treeffae5c864f88a540b1689763dbd7494b4ad29c8e /src/tusb.c
parentf2450788b13f8424b2f75e33240ed21329a875ad (diff)
parent9e5345e70228153ab4efff6f6666c4e54471a4aa (diff)
Merge pull request #3487 from hathach/zlp-hs-on-fs
fix transfer length when high speed capable device/host working at full speed
Diffstat (limited to 'src/tusb.c')
-rw-r--r--src/tusb.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/tusb.c b/src/tusb.c
index 4ea396715..5e4422e41 100644
--- a/src/tusb.c
+++ b/src/tusb.c
@@ -322,7 +322,7 @@ bool tu_bind_driver_to_ep_itf(uint8_t driver_id, uint8_t ep2drv[][2], uint8_t it
//--------------------------------------------------------------------+
bool tu_edpt_stream_init(tu_edpt_stream_t *s, bool is_host, bool is_tx, bool overwritable, void *ff_buf,
- uint16_t ff_bufsize, uint8_t *ep_buf, uint16_t ep_bufsize) {
+ uint16_t ff_bufsize, uint8_t *ep_buf) {
(void) is_tx;
if (ff_buf == NULL || ff_bufsize == 0) {
@@ -340,7 +340,6 @@ bool tu_edpt_stream_init(tu_edpt_stream_t *s, bool is_host, bool is_tx, bool ove
#endif
s->ep_buf = ep_buf;
- s->ep_bufsize = ep_bufsize;
return true;
}
@@ -410,7 +409,7 @@ uint32_t tu_edpt_stream_write_xfer(tu_edpt_stream_t *s) {
if (s->ep_buf == NULL) {
count = tu_fifo_count(&s->ff); // re-get count since fifo can be changed
} else {
- count = tu_fifo_read_n(&s->ff, s->ep_buf, s->ep_bufsize);
+ count = tu_fifo_read_n(&s->ff, s->ep_buf, s->xfer_len);
}
if (count > 0) {
@@ -457,7 +456,7 @@ uint32_t tu_edpt_stream_read_xfer(tu_edpt_stream_t *s) {
if (available >= s->mps) {
// multiple of packet size limit by ep bufsize
uint16_t count = (uint16_t) (available & ~(s->mps - 1));
- count = tu_min16(count, s->ep_bufsize);
+ count = tu_min16(count, s->xfer_len);
TU_ASSERT(stream_xfer(s, count), 0);
return count;
} else {