1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

boards/seeedstudio-gd32: extend Kconfig by clock configuration

The configuration whether a HXTAL is present and what its clock frequency is will be added to Kconfig. Since it is the only GD32V board at the moment, the configuration is added to the Kconfig of the board, but should be moved to a common Kconfig later when more GD32V boards are added.
This commit is contained in:
Gunar Schorcht 2023-01-09 21:51:28 +01:00
parent f4d6b2d642
commit 72d11d84b8
3 changed files with 23 additions and 4 deletions

View File

@ -13,3 +13,19 @@ config BOARD_SEEEDSTUDIO_GD32
default y
select CPU_MODEL_GD32VF103VBT6
select HAS_PERIPH_UART
select BOARD_HAS_HXTAL
select BOARD_HAS_LXTAL
config BOARD_HAS_HXTAL
bool
help
Indicates that the board is providing an HXTAL oscillator
config BOARD_HAS_LXTAL
bool
help
Indicates that the board is providing an LXTAL oscillator
config CLOCK_HXTAL
int
default 80000000

View File

@ -28,11 +28,14 @@ extern "C" {
/* This board provides an high frequency oscillator */
#ifndef CONFIG_BOARD_HAS_HXTAL
#define CONFIG_BOARD_HAS_HXTAL 1
#define CONFIG_BOARD_HAS_HXTAL 1
#endif
#define CLOCK_HXTAL MHZ(8) /**< HXTAL frequency */
#define CLOCK_CORECLOCK MHZ(108) /**< CPU clock frequency in Hz */
#ifndef CONFIG_CLOCK_HXTAL
#define CONFIG_CLOCK_HXTAL MHZ(8) /**< HXTAL frequency */
#endif
#define CLOCK_CORECLOCK MHZ(108) /**< CPU clock frequency in Hz */
/**
* @name Timer configuration

View File

@ -36,7 +36,7 @@
#define PREDV0_CONF 1 /* Divide by 2 */
#ifdef CONFIG_BOARD_HAS_HXTAL
#define PLL_MULT_FACTOR (CLOCK_CORECLOCK / \
(CLOCK_HXTAL / (PREDV0_CONF + 1)) - 1)
(CONFIG_CLOCK_HXTAL / (PREDV0_CONF + 1)) - 1)
#else
#define PLL_MULT_FACTOR (CLOCK_CORECLOCK / (MHZ(8) / 2 ) - 1)
#endif