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>
This commit is contained in:
Kevin O'Connor 2021-12-19 13:42:55 -05:00
parent 7d2c966241
commit a4a02e86af
1 changed files with 1 additions and 1 deletions

View File

@ -47,7 +47,7 @@ struct ep_mem {
#define EPM ((struct ep_mem *)USB_PMAADDR) #define EPM ((struct ep_mem *)USB_PMAADDR)
#define CALC_ADDR(p) (((epmword_t*)(p) - (epmword_t*)EPM) * 2) #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) : DIV_ROUND_UP((s), 2) << 10)
// Setup the transfer descriptors in dedicated usb memory // Setup the transfer descriptors in dedicated usb memory