diff options
| author | Ha Thach <[email protected]> | 2026-03-09 11:23:23 +0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-03-09 11:23:23 +0700 |
| commit | 205d9b044fdb96cea001603368c43c1f34fa1cf5 (patch) | |
| tree | 8a716428ec90f479ecde8aa1cfe55ae0a2e370f2 | |
| parent | 66d67026f29101b76d7837646bd291b95d69f4bb (diff) | |
| parent | 2a4b82e3e12b68705f394bf8d800c64ab81ab1c0 (diff) | |
Merge pull request #3538 from sidcha/fix-hwfifo-PMA-pointer
Fix hwfifo PMA pointer advance on ring buffer wrap
| -rw-r--r-- | src/common/tusb_fifo.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/common/tusb_fifo.c b/src/common/tusb_fifo.c index 8bd79e56d..991ee18ff 100644 --- a/src/common/tusb_fifo.c +++ b/src/common/tusb_fifo.c @@ -280,7 +280,7 @@ static void hwff_push_n(const tu_fifo_t *f, const void *app_buf, uint16_t n, uin const uint32_t odd_mask = data_stride - 1; uint16_t lin_even = lin_bytes & ~odd_mask; tu_hwfifo_read(hwfifo, ff_buf, lin_even, access_mode); - HWFIFO_ADDR_NEXT_N(hwfifo, const, lin_even); + HWFIFO_ADDR_NEXT_N(hwfifo, const, (lin_even / data_stride) * CFG_TUSB_FIFO_HWFIFO_ADDR_STRIDE); ff_buf += lin_even; // There could be odd 1 byte (16bit) or 1-3 bytes (32bit) before the wrap-around boundary @@ -337,7 +337,7 @@ static void hwff_pull_n(const tu_fifo_t *f, void *app_buf, uint16_t n, uint16_t const uint32_t odd_mask = data_stride - 1; uint16_t lin_even = lin_bytes & ~odd_mask; tu_hwfifo_write(hwfifo, ff_buf, lin_even, access_mode); - HWFIFO_ADDR_NEXT_N(hwfifo, , lin_even); + HWFIFO_ADDR_NEXT_N(hwfifo, , (lin_even / data_stride) * CFG_TUSB_FIFO_HWFIFO_ADDR_STRIDE); ff_buf += lin_even; // There could be odd 1 byte (16bit) or 1-3 bytes (32bit) before the wrap-around boundary |
