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

cpu/esp32: remove ESP-IDF periph_ctrl interface API

This commit is contained in:
Gunar Schorcht 2023-03-27 01:41:19 +02:00
parent c2f3102a4d
commit 343369476b
6 changed files with 10 additions and 82 deletions

View File

@ -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 <gunar@schorcht.net>
* @}
*/
#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);
}

View File

@ -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 <gunar@schorcht.net>
* @}
*/
#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 */

View File

@ -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);
}
}

View File

@ -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);

View File

@ -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);

View File

@ -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
}