mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
boards/hifive1*: fix clock configuration
This commit is contained in:
parent
49e11626d3
commit
c190426a0e
@ -71,7 +71,6 @@ extern "C" {
|
||||
#error "Cannot use HFROSC with other clock configurations"
|
||||
#endif
|
||||
|
||||
#if CONFIG_USE_CLOCK_HFXOSC_PLL
|
||||
#define CONFIG_CLOCK_PLL_R (1) /* Divide input clock by 2, mandatory with HFXOSC */
|
||||
#ifndef CONFIG_CLOCK_PLL_F
|
||||
#define CONFIG_CLOCK_PLL_F (39) /* Multiply REFR by 80, e.g 2 * (39 + 1) */
|
||||
@ -79,6 +78,8 @@ extern "C" {
|
||||
#ifndef CONFIG_CLOCK_PLL_Q
|
||||
#define CONFIG_CLOCK_PLL_Q (1) /* Divide VCO by 2, e.g 2^1 */
|
||||
#endif
|
||||
|
||||
#if CONFIG_USE_CLOCK_HFXOSC_PLL
|
||||
#define CLOCK_PLL_INPUT_CLOCK (16000000UL)
|
||||
#define CLOCK_PLL_REFR (CLOCK_PLL_INPUT_CLOCK / (CONFIG_CLOCK_PLL_R + 1))
|
||||
#define CLOCK_PLL_VCO (CLOCK_PLL_REFR * (2 * (CONFIG_CLOCK_PLL_F + 1)))
|
||||
@ -98,27 +99,22 @@ extern "C" {
|
||||
|
||||
#elif CONFIG_USE_CLOCK_HFXOSC
|
||||
#define CLOCK_CORECLOCK (16000000UL)
|
||||
#endif
|
||||
|
||||
/*
|
||||
When using HFROSC input clock, the core clock cannot be computed from settings,
|
||||
call cpu_freq() to get the configured CPU frequency.
|
||||
*/
|
||||
#elif CONFIG_USE_CLOCK_HFROSC_PLL
|
||||
#ifndef CONFIG_CLOCK_DESIRED_FREQUENCY
|
||||
#define CONFIG_CLOCK_DESIRED_FREQUENCY (320000000UL)
|
||||
#endif
|
||||
|
||||
#elif CONFIG_USE_CLOCK_HFROSC
|
||||
#ifndef CONFIG_CLOCK_HFROSC_TRIM
|
||||
#define CONFIG_CLOCK_HFROSC_TRIM (6) /* ~72000000Hz input freq */
|
||||
#endif
|
||||
#ifndef CONFIG_CLOCK_HFROSC_DIV
|
||||
#define CONFIG_CLOCK_HFROSC_DIV (1) /* Divide by 2 */
|
||||
#endif
|
||||
|
||||
#else
|
||||
#error "Invalid clock configuration"
|
||||
#endif
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
|
@ -72,7 +72,6 @@ extern "C" {
|
||||
#error "Cannot use HFROSC with other clock configurations"
|
||||
#endif
|
||||
|
||||
#if CONFIG_USE_CLOCK_HFXOSC_PLL
|
||||
#define CONFIG_CLOCK_PLL_R (1) /* Divide input clock by 2, mandatory with HFXOSC */
|
||||
#ifndef CONFIG_CLOCK_PLL_F
|
||||
#define CONFIG_CLOCK_PLL_F (39) /* Multiply REFR by 80, e.g 2 * (39 + 1) */
|
||||
@ -80,6 +79,8 @@ extern "C" {
|
||||
#ifndef CONFIG_CLOCK_PLL_Q
|
||||
#define CONFIG_CLOCK_PLL_Q (1) /* Divide VCO by 2, e.g 2^1 */
|
||||
#endif
|
||||
|
||||
#if CONFIG_USE_CLOCK_HFXOSC_PLL
|
||||
#define CLOCK_PLL_INPUT_CLOCK (16000000UL)
|
||||
#define CLOCK_PLL_REFR (CLOCK_PLL_INPUT_CLOCK / (CONFIG_CLOCK_PLL_R + 1))
|
||||
#define CLOCK_PLL_VCO (CLOCK_PLL_REFR * (2 * (CONFIG_CLOCK_PLL_F + 1)))
|
||||
@ -99,27 +100,22 @@ extern "C" {
|
||||
|
||||
#elif CONFIG_USE_CLOCK_HFXOSC
|
||||
#define CLOCK_CORECLOCK (16000000UL)
|
||||
#endif
|
||||
|
||||
/*
|
||||
When using HFROSC input clock, the core clock cannot be computed from settings,
|
||||
call cpu_freq() to get the configured CPU frequency.
|
||||
*/
|
||||
#elif CONFIG_USE_CLOCK_HFROSC_PLL
|
||||
#ifndef CONFIG_CLOCK_DESIRED_FREQUENCY
|
||||
#define CONFIG_CLOCK_DESIRED_FREQUENCY (320000000UL)
|
||||
#endif
|
||||
|
||||
#elif CONFIG_USE_CLOCK_HFROSC
|
||||
#ifndef CONFIG_CLOCK_HFROSC_TRIM
|
||||
#define CONFIG_CLOCK_HFROSC_TRIM (6) /* ~72000000Hz input freq */
|
||||
#endif
|
||||
#ifndef CONFIG_CLOCK_HFROSC_DIV
|
||||
#define CONFIG_CLOCK_HFROSC_DIV (1) /* Divide by 2 */
|
||||
#endif
|
||||
|
||||
#else
|
||||
#error "Invalid clock configuration"
|
||||
#endif
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user