diff options
| author | HiFiPhile <[email protected]> | 2024-04-27 17:09:05 +0200 |
|---|---|---|
| committer | HiFiPhile <[email protected]> | 2024-04-27 17:09:05 +0200 |
| commit | 98e85a296deb89dbcc05033bda26e3c9581d535b (patch) | |
| tree | 9d8de6da23aa3b38f702c327e4569e1f450fefb6 /src/class/usbtmc | |
| parent | 9e674fa109348d97fb4280ac534be665f619a4d8 (diff) | |
bulk_in: copy buffer to ensure alignment correctness.
Diffstat (limited to 'src/class/usbtmc')
| -rw-r--r-- | src/class/usbtmc/usbtmc_device.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/class/usbtmc/usbtmc_device.c b/src/class/usbtmc/usbtmc_device.c index 4092c37ea..81e969732 100644 --- a/src/class/usbtmc/usbtmc_device.c +++ b/src/class/usbtmc/usbtmc_device.c @@ -552,9 +552,10 @@ bool usbtmcd_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t result, uint case STATE_TX_INITIATED: if(usbtmc_state.transfer_size_remaining >= sizeof(usbtmc_state.ep_bulk_in_buf)) { - // FIXME! This removes const below! + // Copy buffer to ensure alignment correctness + memcpy(usbtmc_state.ep_bulk_in_buf, usbtmc_state.devInBuffer, sizeof(usbtmc_state.ep_bulk_in_buf)); TU_VERIFY( usbd_edpt_xfer(rhport, usbtmc_state.ep_bulk_in, - (void*)(uintptr_t) usbtmc_state.devInBuffer, sizeof(usbtmc_state.ep_bulk_in_buf))); + usbtmc_state.ep_bulk_in_buf, sizeof(usbtmc_state.ep_bulk_in_buf))); usbtmc_state.devInBuffer += sizeof(usbtmc_state.ep_bulk_in_buf); usbtmc_state.transfer_size_remaining -= sizeof(usbtmc_state.ep_bulk_in_buf); usbtmc_state.transfer_size_sent += sizeof(usbtmc_state.ep_bulk_in_buf); |
