From 4d19b77fce2e449c97abc4e1d62b66860d5c4cec Mon Sep 17 00:00:00 2001 From: Gunar Schorcht Date: Sun, 19 Dec 2021 12:20:34 +0100 Subject: [PATCH] cpu/esp8266: add CPU frequency selection to Kconfig --- cpu/esp8266/Kconfig | 16 ++++++++++++++++ cpu/esp8266/include/cpu_conf.h | 14 ++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/cpu/esp8266/Kconfig b/cpu/esp8266/Kconfig index cca627a7d6..c4390765d7 100644 --- a/cpu/esp8266/Kconfig +++ b/cpu/esp8266/Kconfig @@ -64,6 +64,22 @@ config CPU_MODEL config CPU default "esp8266" if CPU_FAM_ESP8266 +menu "ESP8266 specific configurations" + depends on TEST_KCONFIG + depends on HAS_ARCH_ESP8266 + + choice + bool "CPU clock frequency" + default ESP8266_CPU_FREQUENCY_80 + + config ESP8266_CPU_FREQUENCY_80 + bool "80 MHz" + config ESP8266_CPU_FREQUENCY_160 + bool "160 MHz" + endchoice + +endmenu + source "$(RIOTCPU)/esp_common/Kconfig" config MODULE_ESP_I2C_SW diff --git a/cpu/esp8266/include/cpu_conf.h b/cpu/esp8266/include/cpu_conf.h index 380f710684..09642c9b49 100644 --- a/cpu/esp8266/include/cpu_conf.h +++ b/cpu/esp8266/include/cpu_conf.h @@ -33,6 +33,16 @@ extern "C" { * @name Clock configuration * @{ */ + +#ifndef DOXYGEN +/* Mapping of Kconfig defines to the respective enumeration values */ +#if CONFIG_ESP8266_CPU_FREQUENCY_80 +#define ESP8266_CPU_FREQUENCY 80 +#elif CONFIG_ESP8266_CPU_FREQUENCY_160 +#define ESP8266_CPU_FREQUENCY 160 +#endif +#endif + /** * @brief Defines the CPU frequency in MHz * @@ -41,6 +51,10 @@ extern "C" { #ifndef ESP8266_CPU_FREQUENCY #define ESP8266_CPU_FREQUENCY (80) #endif + +/** + * @brief Mapping configured ESP8266 default clock to CLOCK_CORECLOCK define + */ #define CLOCK_CORECLOCK (1000000UL * ESP8266_CPU_FREQUENCY) /** @} */