From 8138f8bb02b52bfd0f70575560815e3a87d32866 Mon Sep 17 00:00:00 2001 From: morris Date: Sat, 14 May 2022 19:12:13 +0800 Subject: [PATCH] driver: remove deprecated code that declared as deprecated in the previous release --- .../deprecated/driver/rmt_types_legacy.h | 1 - components/driver/deprecated/driver/timer.h | 49 ----------- .../deprecated/driver/timer_types_legacy.h | 7 -- components/driver/deprecated/timer_legacy.c | 36 --------- components/driver/include/driver/ledc.h | 5 +- components/driver/include/driver/mcpwm.h | 81 ------------------- components/driver/include/driver/rtc_io.h | 2 +- components/driver/include/driver/sdmmc_host.h | 20 ----- components/driver/include/driver/spi_master.h | 17 +--- components/driver/include/driver/uart.h | 28 +------ components/driver/mcpwm.c | 73 ----------------- components/driver/sdmmc_host.c | 3 - components/driver/spi_master.c | 5 -- components/hal/include/hal/i2c_types.h | 10 --- components/hal/include/hal/uart_types.h | 5 +- .../api-reference/system/power_management.rst | 2 +- docs/en/migration-guides/peripherals.rst | 70 +++++++++++++++- .../api-reference/system/power_management.rst | 2 +- 18 files changed, 75 insertions(+), 341 deletions(-) diff --git a/components/driver/deprecated/driver/rmt_types_legacy.h b/components/driver/deprecated/driver/rmt_types_legacy.h index b297999b9f..f21c8851e5 100644 --- a/components/driver/deprecated/driver/rmt_types_legacy.h +++ b/components/driver/deprecated/driver/rmt_types_legacy.h @@ -18,7 +18,6 @@ extern "C" { #define RMT_CHANNEL_FLAGS_AWARE_DFS (1 << 0) /*!< Channel can work during APB clock scaling */ #define RMT_CHANNEL_FLAGS_INVERT_SIG (1 << 1) /*!< Invert RMT signal */ -#define RMT_CHANNEL_FLAGS_ALWAYS_ON _Pragma ("GCC warning \"'RMT_CHANNEL_FLAGS_ALWAYS_ON' macro is deprecated\"") RMT_CHANNEL_FLAGS_AWARE_DFS /** * @brief Define memory space of each RMT channel (in words = 4 bytes) diff --git a/components/driver/deprecated/driver/timer.h b/components/driver/deprecated/driver/timer.h index e035d16522..2569718641 100644 --- a/components/driver/deprecated/driver/timer.h +++ b/components/driver/deprecated/driver/timer.h @@ -315,14 +315,6 @@ esp_err_t timer_enable_intr(timer_group_t group_num, timer_idx_t timer_num); */ esp_err_t timer_disable_intr(timer_group_t group_num, timer_idx_t timer_num); -/** @brief Clear timer interrupt status, just used in ISR - * - * @param group_num Timer group number, 0 for TIMERG0 or 1 for TIMERG1 - * @param timer_num Timer index. - * - */ -void timer_group_intr_clr_in_isr(timer_group_t group_num, timer_idx_t timer_num) __attribute__((deprecated)); - /** @brief Clear timer interrupt status, just used in ISR * * @param group_num Timer group number, 0 for TIMERG0 or 1 for TIMERG1 @@ -367,14 +359,6 @@ void timer_group_set_alarm_value_in_isr(timer_group_t group_num, timer_idx_t tim */ void timer_group_set_counter_enable_in_isr(timer_group_t group_num, timer_idx_t timer_num, timer_start_t counter_en); -/** @brief Get the masked interrupt status, just used in ISR - * - * @param group_num Timer group number, 0 for TIMERG0 or 1 for TIMERG1 - * - * @return - * - Interrupt status - */ -timer_intr_t timer_group_intr_get_in_isr(timer_group_t group_num) __attribute__((deprecated)); /** @brief Get interrupt status, just used in ISR * @@ -384,15 +368,6 @@ timer_intr_t timer_group_intr_get_in_isr(timer_group_t group_num) __attribute__( * - Interrupt status */ uint32_t timer_group_get_intr_status_in_isr(timer_group_t group_num); - -/** @brief Clear the masked interrupt status, just used in ISR - * - * @param group_num Timer group number, 0 for TIMERG0 or 1 for TIMERG1 - * @param intr_mask Masked interrupt. - * - */ -void timer_group_clr_intr_sta_in_isr(timer_group_t group_num, timer_intr_t intr_mask) __attribute__((deprecated)); - /** @brief Get auto reload enable status, just used in ISR * * @param group_num Timer group number, 0 for TIMERG0 or 1 for TIMERG1 @@ -404,30 +379,6 @@ void timer_group_clr_intr_sta_in_isr(timer_group_t group_num, timer_intr_t intr_ */ bool timer_group_get_auto_reload_in_isr(timer_group_t group_num, timer_idx_t timer_num); -/** @brief Take timer spinlock to enter critical protect - * - * @note Deprecated, the recommended way is to use ISR callbacks instead, see timer_group_example_main - * - * @param group_num Timer group number, 0 for TIMERG0 or 1 for TIMERG1 - * - * @return - * - ESP_OK Success - * - ESP_ERR_INVALID_ARG Parameter error - */ -esp_err_t timer_spinlock_take(timer_group_t group_num) __attribute__ ((deprecated)); - -/** @brief Give timer spinlock to exit critical protect - * - * @note Deprecated, the recommended way is to use ISR callbacks instead, see timer_group_example_main - * - * @param group_num Timer group number, 0 for TIMERG0 or 1 for TIMERG1 - * - * @return - * - ESP_OK Success - * - ESP_ERR_INVALID_ARG Parameter error - */ -esp_err_t timer_spinlock_give(timer_group_t group_num) __attribute__ ((deprecated)); - #ifdef __cplusplus } #endif diff --git a/components/driver/deprecated/driver/timer_types_legacy.h b/components/driver/deprecated/driver/timer_types_legacy.h index 1099b4580f..16eaaf2061 100644 --- a/components/driver/deprecated/driver/timer_types_legacy.h +++ b/components/driver/deprecated/driver/timer_types_legacy.h @@ -16,13 +16,6 @@ extern "C" { #endif -/** - * @brief Frequency of the clock on the input of the timer groups - * @note This macro is not correct for Timer Groups with multiple clock sources (e.g. APB, XTAL) - * So please don't use it in your application, we keep it here only for backward compatible - */ -#define TIMER_BASE_CLK _Pragma ("GCC warning \"'TIMER_BASE_CLK' macro is deprecated\"") APB_CLK_FREQ - /** * @brief Timer-Group ID */ diff --git a/components/driver/deprecated/timer_legacy.c b/components/driver/deprecated/timer_legacy.c index f43a38652b..d753a75f16 100644 --- a/components/driver/deprecated/timer_legacy.c +++ b/components/driver/deprecated/timer_legacy.c @@ -406,12 +406,6 @@ esp_err_t timer_group_intr_disable(timer_group_t group_num, timer_intr_t disable return ESP_OK; } -/* This function is deprecated */ -timer_intr_t IRAM_ATTR timer_group_intr_get_in_isr(timer_group_t group_num) -{ - return timer_ll_get_intr_status(TIMER_LL_GET_HW(group_num)); -} - uint32_t IRAM_ATTR timer_group_get_intr_status_in_isr(timer_group_t group_num) { uint32_t intr_status = 0; @@ -431,12 +425,6 @@ void IRAM_ATTR timer_group_clr_intr_status_in_isr(timer_group_t group_num, timer timer_ll_clear_intr_status(p_timer_obj[group_num][timer_num]->hal.dev, TIMER_LL_EVENT_ALARM(timer_num)); } -/* This function is deprecated */ -void IRAM_ATTR timer_group_intr_clr_in_isr(timer_group_t group_num, timer_idx_t timer_num) -{ - timer_group_clr_intr_status_in_isr(group_num, timer_num); -} - void IRAM_ATTR timer_group_enable_alarm_in_isr(timer_group_t group_num, timer_idx_t timer_num) { timer_ll_enable_alarm(p_timer_obj[group_num][timer_num]->hal.dev, timer_num, true); @@ -460,35 +448,11 @@ void IRAM_ATTR timer_group_set_counter_enable_in_isr(timer_group_t group_num, ti p_timer_obj[group_num][timer_num]->counter_en = counter_en; } -/* This function is deprecated */ -void IRAM_ATTR timer_group_clr_intr_sta_in_isr(timer_group_t group_num, timer_intr_t intr_mask) -{ - for (uint32_t timer_idx = 0; timer_idx < TIMER_MAX; timer_idx++) { - if (intr_mask & BIT(timer_idx)) { - timer_group_clr_intr_status_in_isr(group_num, timer_idx); - } - } -} - bool IRAM_ATTR timer_group_get_auto_reload_in_isr(timer_group_t group_num, timer_idx_t timer_num) { return p_timer_obj[group_num][timer_num]->auto_reload_en; } -esp_err_t IRAM_ATTR timer_spinlock_take(timer_group_t group_num) -{ - ESP_RETURN_ON_FALSE(group_num < TIMER_GROUP_MAX, ESP_ERR_INVALID_ARG, TIMER_TAG, TIMER_GROUP_NUM_ERROR); - TIMER_ENTER_CRITICAL(&timer_spinlock[group_num]); - return ESP_OK; -} - -esp_err_t IRAM_ATTR timer_spinlock_give(timer_group_t group_num) -{ - ESP_RETURN_ON_FALSE(group_num < TIMER_GROUP_MAX, ESP_ERR_INVALID_ARG, TIMER_TAG, TIMER_GROUP_NUM_ERROR); - TIMER_EXIT_CRITICAL(&timer_spinlock[group_num]); - return ESP_OK; -} - /** * @brief This function will be called during start up, to check that this legacy timer group driver is not running along with the gptimer driver */ diff --git a/components/driver/include/driver/ledc.h b/components/driver/include/driver/ledc.h index 5754292414..05b499e2dc 100644 --- a/components/driver/include/driver/ledc.h +++ b/components/driver/include/driver/ledc.h @@ -55,10 +55,7 @@ typedef struct { */ typedef struct { ledc_mode_t speed_mode; /*!< LEDC speed speed_mode, high-speed mode or low-speed mode */ - union { - ledc_timer_bit_t duty_resolution; /*!< LEDC channel duty resolution */ - ledc_timer_bit_t bit_num __attribute__((deprecated)); /*!< Deprecated in ESP-IDF 3.0. This is an alias to 'duty_resolution' for backward compatibility with ESP-IDF 2.1 */ - }; + ledc_timer_bit_t duty_resolution; /*!< LEDC channel duty resolution */ ledc_timer_t timer_num; /*!< The timer source of channel (0 - 3) */ uint32_t freq_hz; /*!< LEDC timer frequency (Hz) */ ledc_clk_cfg_t clk_cfg; /*!< Configure LEDC source clock from ledc_clk_cfg_t. diff --git a/components/driver/include/driver/mcpwm.h b/components/driver/include/driver/mcpwm.h index aa435a71a3..7f900f78d4 100644 --- a/components/driver/include/driver/mcpwm.h +++ b/components/driver/include/driver/mcpwm.h @@ -170,16 +170,6 @@ typedef enum { MCPWM_BOTH_EDGE = BIT(1) | BIT(0), /*!dev, context[mcpwm_num].group_pre_scale); - mcpwm_ll_capture_enable_timer(hal->dev, true); - mcpwm_ll_capture_enable_channel(hal->dev, cap_sig, true); - mcpwm_ll_capture_enable_negedge(hal->dev, cap_sig, cap_edge & MCPWM_NEG_EDGE); - mcpwm_ll_capture_enable_posedge(hal->dev, cap_sig, cap_edge & MCPWM_POS_EDGE); - mcpwm_ll_capture_set_prescale(hal->dev, cap_sig, num_of_pulse + 1); - // capture feature should be used with interupt, so enable it by default - mcpwm_ll_intr_enable_capture(hal->dev, cap_sig, true); - mcpwm_ll_intr_clear_capture_status(hal->dev, 1 << cap_sig); - mcpwm_critical_exit(mcpwm_num); - return ESP_OK; -} - -esp_err_t mcpwm_capture_disable(mcpwm_unit_t mcpwm_num, mcpwm_capture_signal_t cap_sig) -{ - ESP_RETURN_ON_FALSE(mcpwm_num < SOC_MCPWM_GROUPS, ESP_ERR_INVALID_ARG, TAG, MCPWM_GROUP_NUM_ERROR); - ESP_RETURN_ON_FALSE(cap_sig < SOC_MCPWM_CAPTURE_CHANNELS_PER_TIMER, ESP_ERR_INVALID_ARG, TAG, MCPWM_CAPTURE_ERROR); - mcpwm_hal_context_t *hal = &context[mcpwm_num].hal; - - mcpwm_critical_enter(mcpwm_num); - mcpwm_ll_capture_enable_channel(hal->dev, cap_sig, false); - mcpwm_ll_intr_enable_capture(hal->dev, cap_sig, false); - mcpwm_critical_exit(mcpwm_num); - periph_module_disable(mcpwm_periph_signals.groups[mcpwm_num].module); - return ESP_OK; -} - esp_err_t mcpwm_capture_enable_channel(mcpwm_unit_t mcpwm_num, mcpwm_capture_channel_id_t cap_channel, const mcpwm_capture_config_t *cap_conf) { ESP_RETURN_ON_FALSE(mcpwm_num < SOC_MCPWM_GROUPS, ESP_ERR_INVALID_ARG, TAG, MCPWM_GROUP_NUM_ERROR); @@ -897,29 +856,6 @@ uint32_t MCPWM_ISR_ATTR mcpwm_capture_signal_get_edge(mcpwm_unit_t mcpwm_num, mc return mcpwm_ll_capture_is_negedge(hal->dev, cap_sig) ? 2 : 1; } -esp_err_t mcpwm_sync_enable(mcpwm_unit_t mcpwm_num, mcpwm_timer_t timer_num, mcpwm_sync_signal_t sync_sig, - uint32_t phase_val) -{ - MCPWM_TIMER_CHECK(mcpwm_num, timer_num); - ESP_RETURN_ON_FALSE(sync_sig <= MCPWM_SELECT_GPIO_SYNC2, ESP_ERR_INVALID_ARG, TAG, "invalid sync_sig"); - ESP_RETURN_ON_FALSE(phase_val < 1000, ESP_ERR_INVALID_ARG, TAG, "phase_val must within 0~999"); - mcpwm_hal_context_t *hal = &context[mcpwm_num].hal; - - mcpwm_critical_enter(mcpwm_num); - uint32_t set_phase = mcpwm_ll_timer_get_peak(hal->dev, timer_num, false) * phase_val / 1000; - mcpwm_ll_timer_set_sync_phase_value(hal->dev, timer_num, set_phase); - if (sync_sig == MCPWM_SELECT_NO_INPUT) { - mcpwm_ll_timer_set_soft_synchro(hal->dev, timer_num); - } else if (sync_sig <= MCPWM_SELECT_TIMER2_SYNC) { - mcpwm_ll_timer_set_timer_synchro(hal->dev, timer_num, sync_sig - MCPWM_SELECT_TIMER0_SYNC); - } else { - mcpwm_ll_timer_set_gpio_synchro(hal->dev, timer_num, sync_sig - MCPWM_SELECT_GPIO_SYNC0); - } - mcpwm_ll_timer_enable_sync_input(hal->dev, timer_num, true); - mcpwm_critical_exit(mcpwm_num); - return ESP_OK; -} - esp_err_t mcpwm_sync_configure(mcpwm_unit_t mcpwm_num, mcpwm_timer_t timer_num, const mcpwm_sync_config_t *sync_conf) { MCPWM_TIMER_CHECK(mcpwm_num, timer_num); @@ -1003,12 +939,3 @@ esp_err_t mcpwm_set_timer_sync_output(mcpwm_unit_t mcpwm_num, mcpwm_timer_t time mcpwm_critical_exit(mcpwm_num); return ESP_OK; } - -esp_err_t mcpwm_isr_register(mcpwm_unit_t mcpwm_num, void (*fn)(void *), void *arg, int intr_alloc_flags, intr_handle_t *handle) -{ - esp_err_t ret; - ESP_RETURN_ON_FALSE(mcpwm_num < SOC_MCPWM_GROUPS, ESP_ERR_INVALID_ARG, TAG, MCPWM_GROUP_NUM_ERROR); - ESP_RETURN_ON_FALSE(fn, ESP_ERR_INVALID_ARG, TAG, MCPWM_PARAM_ADDR_ERROR); - ret = esp_intr_alloc(mcpwm_periph_signals.groups[mcpwm_num].irq_id, intr_alloc_flags, fn, arg, handle); - return ret; -} diff --git a/components/driver/sdmmc_host.c b/components/driver/sdmmc_host.c index d2773518e4..1f2b281602 100644 --- a/components/driver/sdmmc_host.c +++ b/components/driver/sdmmc_host.c @@ -718,6 +718,3 @@ static esp_err_t sdmmc_host_pullup_en_internal(int slot, int width) } return ESP_OK; } - -/* Deprecared public function */ -esp_err_t sdmmc_host_pullup_en(int slot, int width) __attribute__((alias("sdmmc_host_pullup_en_internal"))); diff --git a/components/driver/spi_master.c b/components/driver/spi_master.c index 456b051c2e..30d5a2fb5c 100644 --- a/components/driver/spi_master.c +++ b/components/driver/spi_master.c @@ -456,11 +456,6 @@ esp_err_t spi_bus_remove_device(spi_device_handle_t handle) return ESP_OK; } -int spi_cal_clock(int fapb, int hz, int duty_cycle, uint32_t *reg_o) -{ - return spi_ll_master_cal_clock(fapb, hz, duty_cycle, reg_o); -} - int spi_get_actual_clock(int fapb, int hz, int duty_cycle) { return spi_hal_master_cal_clock(fapb, hz, duty_cycle); diff --git a/components/hal/include/hal/i2c_types.h b/components/hal/include/hal/i2c_types.h index fba0bc9c70..1864b696cc 100644 --- a/components/hal/include/hal/i2c_types.h +++ b/components/hal/include/hal/i2c_types.h @@ -76,16 +76,6 @@ typedef enum { /// Use the highest speed that is available for the clock source picked by clk_flags #define I2C_CLK_FREQ_MAX (-1) -#if CONFIG_IDF_TARGET_ESP32 -typedef enum{ - I2C_CMD_RESTART = 0, /*!