cpu/fe310: boards/hifive1*: use IS_ACTIVE where possible

This commit is contained in:
Alexandre Abadie 2020-09-01 15:44:10 +02:00
parent ace160a2a3
commit cdbb3e025a
No known key found for this signature in database
GPG Key ID: 1C919A403CAE1405
3 changed files with 15 additions and 15 deletions

View File

@ -33,22 +33,22 @@ extern "C" {
#ifndef CONFIG_USE_CLOCK_HFXOSC_PLL #ifndef CONFIG_USE_CLOCK_HFXOSC_PLL
#if IS_ACTIVE(CONFIG_USE_CLOCK_HFXOSC) || IS_ACTIVE(CONFIG_USE_CLOCK_HFROSC_PLL) || \ #if IS_ACTIVE(CONFIG_USE_CLOCK_HFXOSC) || IS_ACTIVE(CONFIG_USE_CLOCK_HFROSC_PLL) || \
IS_ACTIVE(CONFIG_USE_CLOCK_HFROSC) IS_ACTIVE(CONFIG_USE_CLOCK_HFROSC)
#define CONFIG_USE_CLOCK_HFXOSC_PLL (0) #define CONFIG_USE_CLOCK_HFXOSC_PLL 0
#else #else
#define CONFIG_USE_CLOCK_HFXOSC_PLL (1) /* Use PLL clocked by HFXOSC by default */ #define CONFIG_USE_CLOCK_HFXOSC_PLL 1 /* Use PLL clocked by HFXOSC by default */
#endif #endif
#endif /* CONFIG_USE_CLOCK_HFXOSC_PLL */ #endif /* CONFIG_USE_CLOCK_HFXOSC_PLL */
#ifndef CONFIG_USE_CLOCK_HFXOSC #ifndef CONFIG_USE_CLOCK_HFXOSC
#define CONFIG_USE_CLOCK_HFXOSC (0) #define CONFIG_USE_CLOCK_HFXOSC 0
#endif /* CONFIG_USE_CLOCK_HFXOSC */ #endif /* CONFIG_USE_CLOCK_HFXOSC */
#ifndef CONFIG_USE_CLOCK_HFROSC_PLL #ifndef CONFIG_USE_CLOCK_HFROSC_PLL
#define CONFIG_USE_CLOCK_HFROSC_PLL (0) #define CONFIG_USE_CLOCK_HFROSC_PLL 0
#endif /* CONFIG_USE_CLOCK_HFROSC_PLL */ #endif /* CONFIG_USE_CLOCK_HFROSC_PLL */
#ifndef CONFIG_USE_CLOCK_HFROSC #ifndef CONFIG_USE_CLOCK_HFROSC
#define CONFIG_USE_CLOCK_HFROSC (0) #define CONFIG_USE_CLOCK_HFROSC 0
#endif /* CONFIG_USE_CLOCK_HFROSC */ #endif /* CONFIG_USE_CLOCK_HFROSC */
#if CONFIG_USE_CLOCK_HFXOSC_PLL && \ #if CONFIG_USE_CLOCK_HFXOSC_PLL && \

View File

@ -34,22 +34,22 @@ extern "C" {
#ifndef CONFIG_USE_CLOCK_HFXOSC_PLL #ifndef CONFIG_USE_CLOCK_HFXOSC_PLL
#if IS_ACTIVE(CONFIG_USE_CLOCK_HFXOSC) || IS_ACTIVE(CONFIG_USE_CLOCK_HFROSC_PLL) || \ #if IS_ACTIVE(CONFIG_USE_CLOCK_HFXOSC) || IS_ACTIVE(CONFIG_USE_CLOCK_HFROSC_PLL) || \
IS_ACTIVE(CONFIG_USE_CLOCK_HFROSC) IS_ACTIVE(CONFIG_USE_CLOCK_HFROSC)
#define CONFIG_USE_CLOCK_HFXOSC_PLL (0) #define CONFIG_USE_CLOCK_HFXOSC_PLL 0
#else #else
#define CONFIG_USE_CLOCK_HFXOSC_PLL (1) /* Use PLL clocked by HFXOSC by default */ #define CONFIG_USE_CLOCK_HFXOSC_PLL 1 /* Use PLL clocked by HFXOSC by default */
#endif #endif
#endif /* CONFIG_USE_CLOCK_HFXOSC_PLL */ #endif /* CONFIG_USE_CLOCK_HFXOSC_PLL */
#ifndef CONFIG_USE_CLOCK_HFXOSC #ifndef CONFIG_USE_CLOCK_HFXOSC
#define CONFIG_USE_CLOCK_HFXOSC (0) #define CONFIG_USE_CLOCK_HFXOSC 0
#endif /* CONFIG_USE_CLOCK_HFXOSC */ #endif /* CONFIG_USE_CLOCK_HFXOSC */
#ifndef CONFIG_USE_CLOCK_HFROSC_PLL #ifndef CONFIG_USE_CLOCK_HFROSC_PLL
#define CONFIG_USE_CLOCK_HFROSC_PLL (0) #define CONFIG_USE_CLOCK_HFROSC_PLL 0
#endif /* CONFIG_USE_CLOCK_HFROSC_PLL */ #endif /* CONFIG_USE_CLOCK_HFROSC_PLL */
#ifndef CONFIG_USE_CLOCK_HFROSC #ifndef CONFIG_USE_CLOCK_HFROSC
#define CONFIG_USE_CLOCK_HFROSC (0) #define CONFIG_USE_CLOCK_HFROSC 0
#endif /* CONFIG_USE_CLOCK_HFROSC */ #endif /* CONFIG_USE_CLOCK_HFROSC */
#if CONFIG_USE_CLOCK_HFXOSC_PLL && \ #if CONFIG_USE_CLOCK_HFXOSC_PLL && \

View File

@ -22,7 +22,7 @@
#include "vendor/prci_driver.h" #include "vendor/prci_driver.h"
#if CONFIG_USE_CLOCK_HFROSC || CONFIG_USE_CLOCK_HFROSC_PLL #if IS_ACTIVE(CONFIG_USE_CLOCK_HFROSC) || IS_ACTIVE(CONFIG_USE_CLOCK_HFROSC_PLL)
static uint32_t _cpu_frequency = 0; static uint32_t _cpu_frequency = 0;
#endif #endif
@ -41,7 +41,7 @@ void clock_init(void)
PRCI_REG(PRCI_PLLCFG) &= ~PLL_SEL(PLL_SEL_PLL); PRCI_REG(PRCI_PLLCFG) &= ~PLL_SEL(PLL_SEL_PLL);
} }
if (CONFIG_USE_CLOCK_HFXOSC || CONFIG_USE_CLOCK_HFXOSC_PLL) { if (IS_ACTIVE(CONFIG_USE_CLOCK_HFXOSC) || IS_ACTIVE(CONFIG_USE_CLOCK_HFXOSC_PLL)) {
/* Ensure HFXOSC is enabled */ /* Ensure HFXOSC is enabled */
PRCI_REG(PRCI_HFXOSCCFG) = XOSC_EN(1); PRCI_REG(PRCI_HFXOSCCFG) = XOSC_EN(1);
@ -51,7 +51,7 @@ void clock_init(void)
/* Select HFXOSC as reference frequency and bypass PLL */ /* Select HFXOSC as reference frequency and bypass PLL */
PRCI_REG(PRCI_PLLCFG) = PLL_REFSEL(PLL_REFSEL_HFXOSC) | PLL_BYPASS(1); PRCI_REG(PRCI_PLLCFG) = PLL_REFSEL(PLL_REFSEL_HFXOSC) | PLL_BYPASS(1);
if (CONFIG_USE_CLOCK_HFXOSC_PLL) { if (IS_ACTIVE(CONFIG_USE_CLOCK_HFXOSC_PLL)) {
/* Divide final output frequency by 1 */ /* Divide final output frequency by 1 */
PRCI_REG(PRCI_PLLDIV) = (PLL_FINAL_DIV_BY_1(1) | PLL_FINAL_DIV(0)); PRCI_REG(PRCI_PLLDIV) = (PLL_FINAL_DIV_BY_1(1) | PLL_FINAL_DIV(0));
@ -71,7 +71,7 @@ void clock_init(void)
/* Turn off the HFROSC */ /* Turn off the HFROSC */
PRCI_REG(PRCI_HFROSCCFG) &= ~ROSC_EN(1); PRCI_REG(PRCI_HFROSCCFG) &= ~ROSC_EN(1);
} }
else if (CONFIG_USE_CLOCK_HFROSC_PLL) { else if (IS_ACTIVE(CONFIG_USE_CLOCK_HFROSC_PLL)) {
PRCI_set_hfrosctrim_for_f_cpu(CONFIG_CLOCK_DESIRED_FREQUENCY, PRCI_FREQ_UNDERSHOOT); PRCI_set_hfrosctrim_for_f_cpu(CONFIG_CLOCK_DESIRED_FREQUENCY, PRCI_FREQ_UNDERSHOOT);
} }
else { /* Clock HFROSC */ else { /* Clock HFROSC */
@ -91,7 +91,7 @@ void clock_init(void)
uint32_t cpu_freq(void) uint32_t cpu_freq(void)
{ {
#if CONFIG_USE_CLOCK_HFROSC || CONFIG_USE_CLOCK_HFROSC_PLL #if IS_ACTIVE(CONFIG_USE_CLOCK_HFROSC) || IS_ACTIVE(CONFIG_USE_CLOCK_HFROSC_PLL)
/* Clock frequency with HFROSC cannot be determined precisely from /* Clock frequency with HFROSC cannot be determined precisely from
settings */ settings */
/* If not done already, estimate the CPU frequency */ /* If not done already, estimate the CPU frequency */