JianyuWang0623 commented on code in PR #21513:
URL: https://github.com/apache/nuttx/pull/21513#discussion_r4503743525
##########
drivers/usbdev/usbdev_fs.c:
##########
@@ -1044,29 +1060,35 @@ static int usbdev_fs_ep_bind(FAR struct usbdev_s *dev,
uint8_t epno,
{
if (epinfo->compdesc.mxburst >= USB_SS_BULK_EP_MAXBURST)
{
- reqsize = reqsize * USB_SS_BULK_EP_MAXBURST;
+ fs_ep->reqsize *= USB_SS_BULK_EP_MAXBURST;
}
else
{
- reqsize = reqsize * (epinfo->compdesc.mxburst + 1);
+ fs_ep->reqsize *= (epinfo->compdesc.mxburst + 1);
}
}
else if (transtpye == USB_EP_ATTR_XFER_INT)
{
if (epinfo->compdesc.mxburst >= USB_SS_INT_EP_MAXBURST)
{
- reqsize = reqsize * USB_SS_INT_EP_MAXBURST;
+ fs_ep->reqsize *= USB_SS_INT_EP_MAXBURST;
}
else
{
- reqsize = reqsize * (epinfo->compdesc.mxburst + 1);
+ fs_ep->reqsize *= (epinfo->compdesc.mxburst + 1);
}
}
}
#endif
fs_ep->ep->fs = fs_ep;
+#if CONFIG_USBDEV_FS_BULK_REQLEN > 0
+ fs_ep->reqsize = ALIGN_UP(CONFIG_USBDEV_FS_BULK_REQLEN, fs_ep->reqsize);
Review Comment:
@casaroli This is intentional: applying the size to every endpoint keeps
ep_bind to a single path with no per-type check, and a larger buffer does no
harm on ep0 or interrupt endpoints, whose short transfers complete as before.
The cost is RAM only, and since the option is opt-in the default 0 is
unaffected; boards short on RAM can keep it at 0 or lower USBDEV_FS_NEP0REQS.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]