Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[nrf fromtree] usb: device_next: Respect granularity in UDC buf pool …
…define Round up buffer size used in UDC_BUF_POOL_DEFINE() to respect the required buffer granularity. The issue was observed with UAC2 explicit feedback data, but the problem applies to any UDC_BUF_POOL_DEFINE() use. In order for every buffer returned by UDC_BUF_POOL_DEFINE() to be both aligned and to have required granurality, it is required to allocate the buffers for ROUND_UP(size, LCM(UDC_BUF_GRANULARITY, UDC_BUF_ALIGN)). Because we do not have Least Common Multiple nor Greatest Common Divisor compile time macros, assume that granularity is multiple of alignment. Validate the assumption with a build time assert. When we get a target where this assumption fails we would have to come up with a solution to compute LCM and/or GCD at compile time. Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no> (cherry picked from commit 0f41950) Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
- Loading branch information