Tentative USBv1 and USBv2 fix about wrong size of PMA buffers larger than 62.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@16214 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
Giovanni Di Sirio 2023-04-11 11:45:28 +00:00
parent ccdceba6a7
commit dfaec14d06
2 changed files with 8 additions and 6 deletions

View File

@ -639,11 +639,13 @@ void usb_lld_init_endpoint(USBDriver *usbp, usbep_t ep) {
uint16_t nblocks;
/* Endpoint size and address initialization.*/
if (epcp->out_maxsize > 62)
nblocks = (((((epcp->out_maxsize - 1U) | 0x1FU) + 1U) / 32U) << 10) |
0x8000;
else
nblocks = ((((epcp->out_maxsize - 1U) | 1U) + 1U) / 2U) << 10;
if (epcp->out_maxsize > 62) {
nblocks = (((((uint32_t)epcp->out_maxsize - 1U) | 0x1FU) / 32U) << 10) |
0x8000U;
}
else {
nblocks = ((((uint32_t)(epcp->out_maxsize - 1U) | 1U) + 1U) / 2U) << 10;
}
dp->RXCOUNT0 = nblocks;
dp->RXADDR0 = usb_pm_alloc(usbp, epcp->out_maxsize);

View File

@ -753,7 +753,7 @@ void usb_lld_init_endpoint(USBDriver *usbp, usbep_t ep) {
/* Endpoint size and address initialization.*/
if (epcp->out_maxsize > 62U) {
nblocks = ((((((uint32_t)epcp->out_maxsize - 1U) | 0x1FU) + 1U) / 32U) << 26) |
nblocks = (((((uint32_t)epcp->out_maxsize - 1U) | 0x1FU) / 32U) << 26) |
0x80000000U;
}
else {