mirror of
https://github.com/apache/nuttx.git
synced 2026-10-12 00:30:23 +00:00
Fix a rounding problem in HSMCI divider calculation
This commit is contained in:
parent
c20f9c71b1
commit
eacf905089
1 changed files with 4 additions and 1 deletions
|
|
@ -313,7 +313,10 @@ uint32_t sam_hsmci_clkdiv(uint32_t target)
|
|||
uint32_t clkfulldiv;
|
||||
uint32_t ret;
|
||||
|
||||
clkfulldiv = BOARD_MCK_FREQUENCY / target;
|
||||
/* Get the largest divisor does not exceed the target value */
|
||||
|
||||
clkfulldiv = (BOARD_MCK_FREQUENCY + target - 1) / target;
|
||||
|
||||
if (clkfulldiv > 2)
|
||||
{
|
||||
clkfulldiv -= 2;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue