drivers: clock_control: add validation for SYS_CLOCK_HW_CYCLES_PER_SEC
Check whether the value of SYS_CLOCK_HW_CYCLES_PER_SEC is valid. Signed-off-by: Alvis Sun <yfsun@nuvoton.com>
This commit is contained in:
parent
d789d13ec0
commit
2027d97dac
1 changed files with 2 additions and 0 deletions
|
@ -161,6 +161,8 @@ static DEVICE_API(clock_control, npcx_clock_control_api) = {
|
|||
};
|
||||
|
||||
/* valid clock frequency check */
|
||||
BUILD_ASSERT(CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC == OFMCLK / (APB2DIV_VAL + 1),
|
||||
"SYS_CLOCK_HW_CYCLES_PER_SEC must equal to OFMCLK/APB2DIV_VAL");
|
||||
BUILD_ASSERT(OFMCLK <= MAX_OFMCLK, "Exceed maximum OFMCLK setting");
|
||||
BUILD_ASSERT(CORE_CLK <= MAX_OFMCLK && CORE_CLK >= MHZ(4) &&
|
||||
OFMCLK % CORE_CLK == 0 &&
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue