diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2021-12-19 13:42:55 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2021-12-23 22:15:25 -0500 |
commit | a4a02e86af21303f1874555597814bebd621e011 (patch) | |
tree | 14145259c47c4fafdc8c03cf756fa71fda3aeb7b /src/stm32/usbfs.c | |
parent | 7d2c96624124ef7eb5f41fb55b86d14fe1766b20 (diff) | |
download | kutter-a4a02e86af21303f1874555597814bebd621e011.tar.gz kutter-a4a02e86af21303f1874555597814bebd621e011.tar.xz kutter-a4a02e86af21303f1874555597814bebd621e011.zip |
stm32: Fix buffer size calculation in usbfs.c
When the buffers are over 32 bytes, a block count of 1 starts at 0.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/stm32/usbfs.c')
-rw-r--r-- | src/stm32/usbfs.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/stm32/usbfs.c b/src/stm32/usbfs.c index baaa0c2b..e2e2928f 100644 --- a/src/stm32/usbfs.c +++ b/src/stm32/usbfs.c @@ -47,7 +47,7 @@ struct ep_mem { #define EPM ((struct ep_mem *)USB_PMAADDR) #define CALC_ADDR(p) (((epmword_t*)(p) - (epmword_t*)EPM) * 2) -#define CALC_SIZE(s) ((s) > 32 ? (DIV_ROUND_UP((s), 32) << 10) | 0x8000 \ +#define CALC_SIZE(s) ((s) > 30 ? ((DIV_ROUND_UP((s), 32) - 1) << 10) | 0x8000 \ : DIV_ROUND_UP((s), 2) << 10) // Setup the transfer descriptors in dedicated usb memory |