Skip to content

Commit cd0f4ae

Browse files
author
Adrian Negreanu
committed
lpc43xx_hic,system: extract SELI setup as anadecp_new
1 parent dd0bb84 commit cd0f4ae

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

source/hic_hal/nxp/lpc4322/system_LPC43xx.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,14 @@ unsigned anadeci_new(unsigned msel)
385385
}
386386
return (msel & 0x3c) + 4;
387387
}
388+
389+
/* bandwidth: compute selp from msel */
390+
unsigned anadecp_new(unsigned msel)
391+
{
392+
if (msel < 60) return (msel>>1) + 1;
393+
return 31;
394+
}
395+
388396
/******************************************************************************
389397
* SetClock
390398
******************************************************************************/
@@ -483,8 +491,7 @@ static void SetClock (void) {
483491
/* M divider */
484492
x = mdec_new(PLL0USB_M);
485493

486-
if (PLL0USB_M < 60) selp = (PLL0USB_M >> 1) + 1;
487-
else selp = 31;
494+
selp = anadecp_new(PLL0USB_M);
488495
seli = anadeci_new(PLL0USB_M);
489496
LPC_CGU->PLL0USB_MDIV = (selp << 17) |
490497
(seli << 22) |

0 commit comments

Comments
 (0)