From 3e52e73669f87a4c39616a71e5e70b40b09aa549 Mon Sep 17 00:00:00 2001 From: Gunar Schorcht Date: Mon, 27 Mar 2023 01:41:19 +0200 Subject: [PATCH] cpu/esp32: remove ESP-IDF periph_ctrl interface API --- cpu/esp32/esp-idf-api/periph_ctrl.c | 30 ---------------- cpu/esp32/include/esp_idf_api/periph_ctrl.h | 39 --------------------- cpu/esp32/periph/pwm.c | 7 ++-- cpu/esp32/periph/spi.c | 4 +-- cpu/esp32/periph/timer.c | 5 ++- cpu/esp_common/periph/uart.c | 7 ++-- 6 files changed, 10 insertions(+), 82 deletions(-) delete mode 100644 cpu/esp32/esp-idf-api/periph_ctrl.c delete mode 100644 cpu/esp32/include/esp_idf_api/periph_ctrl.h diff --git a/cpu/esp32/esp-idf-api/periph_ctrl.c b/cpu/esp32/esp-idf-api/periph_ctrl.c deleted file mode 100644 index d9e69b2e925cb..0000000000000 --- a/cpu/esp32/esp-idf-api/periph_ctrl.c +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2022 Gunar Schorcht - * - * This file is subject to the terms and conditions of the GNU Lesser - * General Public License v2.1. See the file LICENSE in the top level - * directory for more details. - */ - -/** - * @ingroup cpu_esp32_esp_idf_api - * @{ - * - * @file - * @brief Interface for ESP-IDF peripherals control API - * - * @author Gunar Schorcht - * @} - */ - -#include "driver/periph_ctrl.h" - -void esp_idf_periph_module_enable(periph_module_t periph) -{ - periph_module_enable(periph); -} - -void esp_idf_periph_module_disable(periph_module_t periph) -{ - periph_module_disable(periph); -} diff --git a/cpu/esp32/include/esp_idf_api/periph_ctrl.h b/cpu/esp32/include/esp_idf_api/periph_ctrl.h deleted file mode 100644 index 017ab009cfd16..0000000000000 --- a/cpu/esp32/include/esp_idf_api/periph_ctrl.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2022 Gunar Schorcht - * - * This file is subject to the terms and conditions of the GNU Lesser - * General Public License v2.1. See the file LICENSE in the top level - * directory for more details. - */ - -/** - * @ingroup cpu_esp32_esp_idf_api - * @{ - * - * @file - * @brief Interface for ESP-IDF peripherals control API - * - * @author Gunar Schorcht - * @} - */ - -#ifndef ESP_IDF_API_PERIPH_CTRL_H -#define ESP_IDF_API_PERIPH_CTRL_H - -#ifndef DOXYGEN /* Hide implementation details from doxygen */ - -#include "soc/periph_defs.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void esp_idf_periph_module_enable(periph_module_t periph); -void esp_idf_periph_module_disable(periph_module_t periph); - -#ifdef __cplusplus -} -#endif - -#endif /* DOXYGEN */ -#endif /* ESP_IDF_API_PERIPH_CTRL_H */ diff --git a/cpu/esp32/periph/pwm.c b/cpu/esp32/periph/pwm.c index be64f107225cd..0f50ef092fe43 100644 --- a/cpu/esp32/periph/pwm.c +++ b/cpu/esp32/periph/pwm.c @@ -28,14 +28,13 @@ #include "periph/pwm.h" #include "periph/gpio.h" +#include "driver/periph_ctrl.h" #include "esp_common.h" #include "esp_rom_gpio.h" #include "hal/ledc_hal.h" #include "soc/ledc_struct.h" #include "soc/rtc.h" -#include "esp_idf_api/periph_ctrl.h" - #define ENABLE_DEBUG 0 #include "debug.h" @@ -253,7 +252,7 @@ void pwm_poweron(pwm_t pwm) DEBUG("%s pwm=%u\n", __func__, pwm); /* enable and init the module and select the right clock source */ - esp_idf_periph_module_enable(_CFG.module); + periph_module_enable(_CFG.module); ledc_hal_init(&_DEV.hw, _CFG.group); ledc_hal_set_slow_clk_sel(&_DEV.hw, LEDC_SLOW_CLK_APB); ledc_hal_set_clock_source(&_DEV.hw, _CFG.timer, LEDC_APB_CLK); @@ -317,7 +316,7 @@ void pwm_poweroff(pwm_t pwm) /* if all devices of the same hardware module are disable, it is powered off */ if (i == PWM_NUMOF) { - esp_idf_periph_module_disable(_CFG.module); + periph_module_disable(_CFG.module); } } diff --git a/cpu/esp32/periph/spi.c b/cpu/esp32/periph/spi.c index be72c6b36d80a..b2187824869d0 100644 --- a/cpu/esp32/periph/spi.c +++ b/cpu/esp32/periph/spi.c @@ -38,13 +38,13 @@ #include "periph/spi.h" #include "syscalls.h" +#include "driver/periph_ctrl.h" #include "esp_attr.h" #include "esp_rom_gpio.h" #include "hal/spi_hal.h" #include "hal/spi_types.h" #include "soc/rtc.h" -#include "esp_idf_api/periph_ctrl.h" #include "esp_idf_api/gpio.h" #undef MHZ @@ -117,7 +117,7 @@ void IRAM_ATTR spi_init(spi_t bus) } /* enable (power on) the according SPI module */ - esp_idf_periph_module_enable(_spi[bus].periph->module); + periph_module_enable(_spi[bus].periph->module); /* initialize SPI peripheral */ spi_ll_master_init(_spi[bus].periph->hw); diff --git a/cpu/esp32/periph/timer.c b/cpu/esp32/periph/timer.c index 7a58973a07b2c..0d1e4e248a801 100644 --- a/cpu/esp32/periph/timer.c +++ b/cpu/esp32/periph/timer.c @@ -26,6 +26,7 @@ */ #include "periph/timer.h" +#include "driver/periph_ctrl.h" #include "esp/common_macros.h" #include "hal/interrupt_controller_types.h" #include "hal/interrupt_controller_ll.h" @@ -40,8 +41,6 @@ #include "xtensa/xtensa_api.h" #endif -#include "esp_idf_api/periph_ctrl.h" - #include "esp_common.h" #include "irq_arch.h" #include "syscalls.h" @@ -244,7 +243,7 @@ int timer_init(tim_t dev, uint32_t freq, timer_cb_t cb, void *arg) intr_cntrl_ll_enable_interrupts(BIT(CPU_INUM_TIMER)); /* enable TMG module */ - esp_idf_periph_module_enable(_timers_desc[dev].module); + periph_module_enable(_timers_desc[dev].module); /* hardware timer configuration */ timer_hal_init(&_timers[dev].hw, _timers_desc[dev].group, _timers_desc[dev].index); diff --git a/cpu/esp_common/periph/uart.c b/cpu/esp_common/periph/uart.c index d7459fe86ac5a..1d320cc372851 100644 --- a/cpu/esp_common/periph/uart.c +++ b/cpu/esp_common/periph/uart.c @@ -59,6 +59,7 @@ #else /* defined(MCU_ESP8266) */ +#include "driver/periph_ctrl.h" #include "esp_rom_gpio.h" #include "esp_rom_uart.h" #include "hal/interrupt_controller_types.h" @@ -73,8 +74,6 @@ #include "soc/uart_reg.h" #include "soc/uart_struct.h" -#include "esp_idf_api/periph_ctrl.h" - #undef UART_CLK_FREQ #define UART_CLK_FREQ rtc_clk_apb_freq_get() /* APB_CLK is used */ @@ -232,7 +231,7 @@ void uart_poweron(uart_t uart) assert(uart < UART_NUMOF); #ifndef MCU_ESP8266 - esp_idf_periph_module_enable(_uarts[uart].mod); + periph_module_enable(_uarts[uart].mod); #endif _uart_config(uart); } @@ -242,7 +241,7 @@ void uart_poweroff(uart_t uart) assert(uart < UART_NUMOF); #ifndef MCU_ESP8266 - esp_idf_periph_module_disable(_uarts[uart].mod); + periph_module_disable(_uarts[uart].mod); #endif }