From e7bf789dd42cbbb4b4858799bcbed8824b0d98c2 Mon Sep 17 00:00:00 2001 From: Gunar Schorcht Date: Wed, 17 Aug 2022 15:50:06 +0200 Subject: [PATCH] cpu/esp32: move CLOCK_CORECLOCK to periph_cpu_*.h This define does not belong to the defines in `sdkconfig_*.h` that are used for the ESP-IDF SDK. It is therefore moved to the corresponding `periph_cpu_*.h` file. --- cpu/esp32/include/periph_cpu_esp32.h | 5 +++++ cpu/esp32/include/periph_cpu_esp32c3.h | 5 +++++ cpu/esp32/include/periph_cpu_esp32s3.h | 3 +++ cpu/esp32/include/sdkconfig_esp32.h | 5 ----- cpu/esp32/include/sdkconfig_esp32c3.h | 5 ----- cpu/esp32/include/sdkconfig_esp32s3.h | 4 ---- 6 files changed, 13 insertions(+), 14 deletions(-) diff --git a/cpu/esp32/include/periph_cpu_esp32.h b/cpu/esp32/include/periph_cpu_esp32.h index 9bdda88cad..98fe0a3a91 100644 --- a/cpu/esp32/include/periph_cpu_esp32.h +++ b/cpu/esp32/include/periph_cpu_esp32.h @@ -19,10 +19,15 @@ #ifndef PERIPH_CPU_ESP32_H #define PERIPH_CPU_ESP32_H +#include "sdkconfig.h" + #ifdef __cplusplus extern "C" { #endif +/** Mapping configured ESP32 default clock to CLOCK_CORECLOCK define */ +#define CLOCK_CORECLOCK (1000000UL * CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ) + /** * @name Predefined GPIO names * @{ diff --git a/cpu/esp32/include/periph_cpu_esp32c3.h b/cpu/esp32/include/periph_cpu_esp32c3.h index e9127ba5fa..f4bab20a77 100644 --- a/cpu/esp32/include/periph_cpu_esp32c3.h +++ b/cpu/esp32/include/periph_cpu_esp32c3.h @@ -19,10 +19,15 @@ #ifndef PERIPH_CPU_ESP32C3_H #define PERIPH_CPU_ESP32C3_H +#include "sdkconfig.h" + #ifdef __cplusplus extern "C" { #endif +/** Mapping configured ESP32-C3 default clock to CLOCK_CORECLOCK define */ +#define CLOCK_CORECLOCK (1000000UL * CONFIG_ESP32C3_DEFAULT_CPU_FREQ_MHZ) + /** * @name Predefined GPIO names * @{ diff --git a/cpu/esp32/include/periph_cpu_esp32s3.h b/cpu/esp32/include/periph_cpu_esp32s3.h index 5bc2c06f81..2856d39cfe 100644 --- a/cpu/esp32/include/periph_cpu_esp32s3.h +++ b/cpu/esp32/include/periph_cpu_esp32s3.h @@ -19,6 +19,9 @@ #ifndef PERIPH_CPU_ESP32S3_H #define PERIPH_CPU_ESP32S3_H +/** Mapping configured ESP32-S3 default clock to CLOCK_CORECLOCK define */ +#define CLOCK_CORECLOCK (1000000UL * CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ) + #ifdef __cplusplus extern "C" { #endif diff --git a/cpu/esp32/include/sdkconfig_esp32.h b/cpu/esp32/include/sdkconfig_esp32.h index 942435c37b..05fec6a33f 100644 --- a/cpu/esp32/include/sdkconfig_esp32.h +++ b/cpu/esp32/include/sdkconfig_esp32.h @@ -58,11 +58,6 @@ extern "C" { #ifndef CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ #define CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ 80 #endif - -/** - * @brief Mapping configured ESP32 default clock to CLOCK_CORECLOCK define - */ -#define CLOCK_CORECLOCK (1000000UL * CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ) /** @} */ /** diff --git a/cpu/esp32/include/sdkconfig_esp32c3.h b/cpu/esp32/include/sdkconfig_esp32c3.h index b1d5aaf60d..eac3d286d8 100644 --- a/cpu/esp32/include/sdkconfig_esp32c3.h +++ b/cpu/esp32/include/sdkconfig_esp32c3.h @@ -56,11 +56,6 @@ extern "C" { #ifndef CONFIG_ESP32C3_DEFAULT_CPU_FREQ_MHZ #define CONFIG_ESP32C3_DEFAULT_CPU_FREQ_MHZ 80 #endif - -/** - * @brief Mapping configured ESP32-C3 default clock to CLOCK_CORECLOCK define - */ -#define CLOCK_CORECLOCK (1000000UL * CONFIG_ESP32C3_DEFAULT_CPU_FREQ_MHZ) /** @} */ /** diff --git a/cpu/esp32/include/sdkconfig_esp32s3.h b/cpu/esp32/include/sdkconfig_esp32s3.h index e301ed8605..044ad0003c 100644 --- a/cpu/esp32/include/sdkconfig_esp32s3.h +++ b/cpu/esp32/include/sdkconfig_esp32s3.h @@ -58,10 +58,6 @@ extern "C" { #ifndef CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ #define CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ 80 #endif -/** - * @brief Mapping configured ESP32 default clock to CLOCK_CORECLOCK define - */ -#define CLOCK_CORECLOCK (1000000UL * CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ) /** @} */ /**