Skip to content
Commit 0f419505 authored by Tomasz Moń's avatar Tomasz Moń Committed by Carles Cufí
Browse files

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: default avatarTomasz Moń <tomasz.mon@nordicsemi.no>
parent debc7446
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment