diff --git a/components/driver/Kconfig b/components/driver/Kconfig index 2698ac746a..c0784d9b3f 100644 --- a/components/driver/Kconfig +++ b/components/driver/Kconfig @@ -22,6 +22,11 @@ menu "Driver Configurations" If you want to continue using the legacy driver, and don't want to see related deprecation warnings, you can enable this option. + config ADC_SKIP_LEGACY_CONFLICT_CHECK + bool "Skip legacy conflict check" + default n + help + This configuration option allows the user to bypass the conflict check mechanism with legacy code. menu "Legacy ADC Calibration Configuration" config ADC_CAL_EFUSE_TP_ENABLE @@ -72,6 +77,12 @@ menu "Driver Configurations" Whether to suppress the deprecation warnings when using legacy dac driver (driver/dac.h). If you want to continue using the legacy driver, and don't want to see related deprecation warnings, you can enable this option. + + config DAC_SKIP_LEGACY_CONFLICT_CHECK + bool "Skip legacy conflict check" + default n + help + This configuration option allows the user to bypass the conflict check mechanism with legacy code. endmenu # Legacy DAC Driver Configurations menu "Legacy MCPWM Driver Configurations" @@ -83,6 +94,12 @@ menu "Driver Configurations" Whether to suppress the deprecation warnings when using legacy MCPWM driver (driver/mcpwm.h). If you want to continue using the legacy driver, and don't want to see related deprecation warnings, you can enable this option. + + config MCPWM_SKIP_LEGACY_CONFLICT_CHECK + bool "Skip legacy conflict check" + default n + help + This configuration option allows the user to bypass the conflict check mechanism with legacy code. endmenu # Legacy MCPWM Driver Configurations menu "Legacy Timer Group Driver Configurations" @@ -95,6 +112,11 @@ menu "Driver Configurations" If you want to continue using the legacy driver, and don't want to see related deprecation warnings, you can enable this option. + config GPTIMER_SKIP_LEGACY_CONFLICT_CHECK + bool "Skip legacy conflict check" + default n + help + This configuration option allows the user to bypass the conflict check mechanism with legacy code. endmenu # Legacy Timer Group Driver Configurations menu "Legacy RMT Driver Configurations" @@ -106,6 +128,12 @@ menu "Driver Configurations" Whether to suppress the deprecation warnings when using legacy rmt driver (driver/rmt.h). If you want to continue using the legacy driver, and don't want to see related deprecation warnings, you can enable this option. + + config RMT_SKIP_LEGACY_CONFLICT_CHECK + bool "Skip legacy conflict check" + default n + help + This configuration option allows the user to bypass the conflict check mechanism with legacy code. endmenu # Legacy RMT Driver Configurations menu "Legacy I2S Driver Configurations" @@ -117,6 +145,12 @@ menu "Driver Configurations" Whether to suppress the deprecation warnings when using legacy i2s driver (driver/i2s.h). If you want to continue using the legacy driver, and don't want to see related deprecation warnings, you can enable this option. + + config I2S_SKIP_LEGACY_CONFLICT_CHECK + bool "Skip legacy conflict check" + default n + help + This configuration option allows the user to bypass the conflict check mechanism with legacy code. endmenu # Legacy I2S Driver Configurationss menu "Legacy PCNT Driver Configurations" @@ -128,6 +162,12 @@ menu "Driver Configurations" whether to suppress the deprecation warnings when using legacy PCNT driver (driver/pcnt.h). If you want to continue using the legacy driver, and don't want to see related deprecation warnings, you can enable this option. + + config PCNT_SKIP_LEGACY_CONFLICT_CHECK + bool "Skip legacy conflict check" + default n + help + This configuration option allows the user to bypass the conflict check mechanism with legacy code. endmenu # Legacy PCNT Driver Configurationss menu "Legacy SDM Driver Configurations" @@ -139,6 +179,12 @@ menu "Driver Configurations" whether to suppress the deprecation warnings when using legacy SDM driver (driver/sigmadelta.h). If you want to continue using the legacy driver, and don't want to see related deprecation warnings, you can enable this option. + + config SDM_SKIP_LEGACY_CONFLICT_CHECK + bool "Skip legacy conflict check" + default n + help + This configuration option allows the user to bypass the conflict check mechanism with legacy code. endmenu # Legacy SDM Driver Configurationss menu "Legacy Temperature Sensor Driver Configurations" @@ -150,6 +196,12 @@ menu "Driver Configurations" whether to suppress the deprecation warnings when using legacy temperature sensor driver (driver/temp_sensor.h). If you want to continue using the legacy driver, and don't want to see related deprecation warnings, you can enable this option. + + config TEMP_SENSOR_SKIP_LEGACY_CONFLICT_CHECK + bool "Skip legacy conflict check" + default n + help + This configuration option allows the user to bypass the conflict check mechanism with legacy code. endmenu # Legacy Temperature Sensor Driver Configurationss menu "Legacy Touch Sensor Driver Configurations" @@ -161,6 +213,11 @@ menu "Driver Configurations" whether to suppress the deprecation warnings when using legacy touch sensor driver (driver/touch_sensor.h). If you want to continue using the legacy driver, and don't want to see related deprecation warnings, you can enable this option. - endmenu # Legacy Touch Sensor Driver Configurationss + config TOUCH_SKIP_LEGACY_CONFLICT_CHECK + bool "Skip legacy conflict check" + default n + help + This configuration option allows the user to bypass the conflict check mechanism with legacy code. + endmenu # Legacy Touch Sensor Driver Configurationss endmenu # Driver configurations diff --git a/components/driver/deprecated/adc_dma_legacy.c b/components/driver/deprecated/adc_dma_legacy.c index a85a043714..9c7800e0fc 100644 --- a/components/driver/deprecated/adc_dma_legacy.c +++ b/components/driver/deprecated/adc_dma_legacy.c @@ -631,6 +631,7 @@ esp_err_t adc_digi_controller_configure(const adc_digi_configuration_t *config) return ESP_OK; } +#if !CONFIG_ADC_SKIP_LEGACY_CONFLICT_CHECK /** * @brief This function will be called during start up, to check that adc_continuous driver is not running along with the legacy adc_continuous driver */ @@ -646,6 +647,7 @@ static void check_adc_continuous_driver_conflict(void) } ESP_EARLY_LOGW(ADC_TAG, "legacy driver is deprecated, please migrate to `esp_adc/adc_continuous.h`"); } +#endif //CONFIG_ADC_SKIP_LEGACY_CONFLICT_CHECK #if SOC_ADC_CALIBRATION_V1_SUPPORTED /*--------------------------------------------------------------- diff --git a/components/driver/deprecated/adc_legacy.c b/components/driver/deprecated/adc_legacy.c index afca5a6d91..da6f018c49 100644 --- a/components/driver/deprecated/adc_legacy.c +++ b/components/driver/deprecated/adc_legacy.c @@ -922,6 +922,7 @@ static esp_err_t adc_hal_convert(adc_unit_t adc_n, int channel, uint32_t clk_src return ESP_OK; } +#if !CONFIG_ADC_SKIP_LEGACY_CONFLICT_CHECK /** * @brief This function will be called during start up, to check that adc_oneshot driver is not running along with the legacy adc oneshot driver */ @@ -937,6 +938,7 @@ static void check_adc_oneshot_driver_conflict(void) } ESP_EARLY_LOGW(ADC_TAG, "legacy driver is deprecated, please migrate to `esp_adc/adc_oneshot.h`"); } +#endif //CONFIG_ADC_SKIP_LEGACY_CONFLICT_CHECK #if SOC_ADC_CALIBRATION_V1_SUPPORTED /*--------------------------------------------------------------- diff --git a/components/driver/deprecated/dac_common_legacy.c b/components/driver/deprecated/dac_common_legacy.c index 0a990c286d..603363e42f 100644 --- a/components/driver/deprecated/dac_common_legacy.c +++ b/components/driver/deprecated/dac_common_legacy.c @@ -128,6 +128,7 @@ esp_err_t dac_cw_generator_config(dac_cw_config_t *cw) return ESP_OK; } +#if !CONFIG_DAC_SKIP_LEGACY_CONFLICT_CHECK /** * @brief This function will be called during start up, to check that this legacy DAC driver is not running along with the new driver */ @@ -143,3 +144,4 @@ static void check_dac_legacy_driver_conflict(void) } ESP_EARLY_LOGW(TAG, "legacy driver is deprecated, please migrate to `driver/dac_oneshot.h`, `driver/dac_cosine.h` or `driver/dac_continuous.h` instead"); } +#endif //CONFIG_DAC_SKIP_LEGACY_CONFLICT_CHECK diff --git a/components/driver/deprecated/i2s_legacy.c b/components/driver/deprecated/i2s_legacy.c index 0d76a78a5c..3310316e2b 100644 --- a/components/driver/deprecated/i2s_legacy.c +++ b/components/driver/deprecated/i2s_legacy.c @@ -1981,6 +1981,7 @@ esp_err_t i2s_set_pin(i2s_port_t i2s_num, const i2s_pin_config_t *pin) return ESP_OK; } +#if !CONFIG_I2S_SKIP_LEGACY_CONFLICT_CHECK /** * @brief This function will be called during start up, to check that the new i2s driver is not running along with the legacy i2s driver */ @@ -1994,3 +1995,4 @@ static __attribute__((constructor)) void check_i2s_driver_conflict(void) } ESP_EARLY_LOGW(TAG, "legacy i2s driver is deprecated, please migrate to use driver/i2s_std.h, driver/i2s_pdm.h or driver/i2s_tdm.h"); } +#endif //CONFIG_I2S_SKIP_LEGACY_CONFLICT_CHECK diff --git a/components/driver/deprecated/mcpwm_legacy.c b/components/driver/deprecated/mcpwm_legacy.c index 625895c741..94723decdd 100644 --- a/components/driver/deprecated/mcpwm_legacy.c +++ b/components/driver/deprecated/mcpwm_legacy.c @@ -1053,6 +1053,7 @@ esp_err_t mcpwm_set_timer_sync_output(mcpwm_unit_t mcpwm_num, mcpwm_timer_t time return ESP_OK; } +#if !CONFIG_MCPWM_SKIP_LEGACY_CONFLICT_CHECK /** * @brief This function will be called during start up, to check that this legacy mcpwm driver is not running along with the new MCPWM driver */ @@ -1068,3 +1069,4 @@ static void check_mcpwm_driver_conflict(void) } ESP_EARLY_LOGW(TAG, "legacy driver is deprecated, please migrate to `driver/mcpwm_prelude.h`"); } +#endif //CONFIG_MCPWM_SKIP_LEGACY_CONFLICT_CHECK diff --git a/components/driver/deprecated/pcnt_legacy.c b/components/driver/deprecated/pcnt_legacy.c index 2cb09efb7a..749182a728 100644 --- a/components/driver/deprecated/pcnt_legacy.c +++ b/components/driver/deprecated/pcnt_legacy.c @@ -555,6 +555,7 @@ void pcnt_isr_service_uninstall(void) _pcnt_isr_service_uninstall(PCNT_PORT_0); } +#if !CONFIG_PCNT_SKIP_LEGACY_CONFLICT_CHECK /** * @brief This function will be called during start up, to check that pulse_cnt driver is not running along with the legacy pcnt driver */ @@ -570,3 +571,4 @@ static void check_pcnt_driver_conflict(void) } ESP_EARLY_LOGW(TAG, "legacy driver is deprecated, please migrate to `driver/pulse_cnt.h`"); } +#endif //CONFIG_PCNT_SKIP_LEGACY_CONFLICT_CHECK diff --git a/components/driver/deprecated/rmt_legacy.c b/components/driver/deprecated/rmt_legacy.c index d3c319d039..baff30aa46 100644 --- a/components/driver/deprecated/rmt_legacy.c +++ b/components/driver/deprecated/rmt_legacy.c @@ -1398,6 +1398,7 @@ esp_err_t rmt_enable_tx_loop_autostop(rmt_channel_t channel, bool en) } #endif +#if !CONFIG_RMT_SKIP_LEGACY_CONFLICT_CHECK /** * @brief This function will be called during start up, to check that this legacy RMT driver is not running along with the new driver */ @@ -1413,3 +1414,4 @@ static void check_rmt_legacy_driver_conflict(void) } ESP_EARLY_LOGW(TAG, "legacy driver is deprecated, please migrate to `driver/rmt_tx.h` and/or `driver/rmt_rx.h`"); } +#endif //CONFIG_RMT_SKIP_LEGACY_CONFLICT_CHECK diff --git a/components/driver/deprecated/rtc_temperature_legacy.c b/components/driver/deprecated/rtc_temperature_legacy.c index 7433867a01..4af803e02b 100644 --- a/components/driver/deprecated/rtc_temperature_legacy.c +++ b/components/driver/deprecated/rtc_temperature_legacy.c @@ -158,6 +158,7 @@ esp_err_t temp_sensor_read_celsius(float *celsius) return ESP_OK; } +#if !CONFIG_TEMP_SENSOR_SKIP_LEGACY_CONFLICT_CHECK /** * @brief This function will be called during start up, to check that this legacy temp sensor driver is not running along with the new driver */ @@ -173,3 +174,4 @@ static void check_legacy_temp_sensor_driver_conflict(void) } ESP_EARLY_LOGW(TAG, "legacy driver is deprecated, please migrate to `driver/temperature_sensor.h`"); } +#endif //CONFIG_TEMP_SENSOR_SKIP_LEGACY_CONFLICT_CHECK diff --git a/components/driver/deprecated/sigma_delta_legacy.c b/components/driver/deprecated/sigma_delta_legacy.c index 55bd049087..0b631ce002 100644 --- a/components/driver/deprecated/sigma_delta_legacy.c +++ b/components/driver/deprecated/sigma_delta_legacy.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -129,3 +129,21 @@ esp_err_t sigmadelta_config(const sigmadelta_config_t *config) } return _sigmadelta_config(SIGMADELTA_PORT_0, config); } + +#if !CONFIG_SDM_SKIP_LEGACY_CONFLICT_CHECK +/** + * @brief This function will be called during start up, to check that sdm driver is not running along with the legacy sdm driver + */ +__attribute__((constructor)) +static void check_sdm_driver_conflict(void) +{ + // This function was declared as weak here. sdm driver has one implementation. + // So if sdm driver is not linked in, then `sdm_new_channel` should be NULL at runtime. + extern __attribute__((weak)) esp_err_t sdm_new_channel(const void *config, void **ret_unit); + if ((void *)sdm_new_channel != NULL) { + ESP_EARLY_LOGE(TAG, "CONFLICT! driver_ng is not allowed to be used with the legacy driver"); + abort(); + } + ESP_EARLY_LOGW(TAG, "legacy driver is deprecated, please migrate to `driver/sdm.h`"); +} +#endif //CONFIG_PCNT_SKIP_LEGACY_CONFLICT_CHECK diff --git a/components/driver/deprecated/timer_legacy.c b/components/driver/deprecated/timer_legacy.c index 2ee334bbeb..5b692f04e9 100644 --- a/components/driver/deprecated/timer_legacy.c +++ b/components/driver/deprecated/timer_legacy.c @@ -468,6 +468,7 @@ bool IRAM_ATTR timer_group_get_auto_reload_in_isr(timer_group_t group_num, timer return p_timer_obj[group_num][timer_num]->auto_reload_en; } +#if !CONFIG_GPTIMER_SKIP_LEGACY_CONFLICT_CHECK /** * @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 */ @@ -483,3 +484,4 @@ static void check_legacy_timer_driver_conflict(void) } ESP_EARLY_LOGW(TIMER_TAG, "legacy driver is deprecated, please migrate to `driver/gptimer.h`"); } +#endif //CONFIG_GPTIMER_SKIP_LEGACY_CONFLICT_CHECK diff --git a/components/driver/i2c/i2c.c b/components/driver/i2c/i2c.c index dc60a43f6e..e27fe6df37 100644 --- a/components/driver/i2c/i2c.c +++ b/components/driver/i2c/i2c.c @@ -1705,6 +1705,7 @@ int i2c_slave_read_buffer(i2c_port_t i2c_num, uint8_t *data, size_t max_size, Ti } #endif +#if !CONFIG_I2C_SKIP_LEGACY_CONFLICT_CHECK /** * @brief This function will be called during start up, to check that this legacy i2c driver is not running along with the new I2C driver */ @@ -1720,3 +1721,4 @@ static void check_i2c_driver_conflict(void) } ESP_EARLY_LOGW(I2C_TAG, "This driver is an old driver, please migrate your application code to adapt `driver/i2c_master.h`"); } +#endif //CONFIG_I2C_SKIP_LEGACY_CONFLICT_CHECK diff --git a/components/driver/touch_sensor/esp32s2/touch_sensor.c b/components/driver/touch_sensor/esp32s2/touch_sensor.c index 2c46fa1eb3..f4ef21d5af 100644 --- a/components/driver/touch_sensor/esp32s2/touch_sensor.c +++ b/components/driver/touch_sensor/esp32s2/touch_sensor.c @@ -685,6 +685,7 @@ esp_err_t touch_pad_sleep_channel_set_work_time(uint16_t sleep_cycle, uint16_t m return ESP_OK; } +#if !CONFIG_TOUCH_SKIP_LEGACY_CONFLICT_CHECK /** * @brief This function will be called during start up, to check that the new touch driver is not running along with the legacy touch driver */ @@ -698,3 +699,4 @@ static __attribute__((constructor)) void check_touch_driver_conflict(void) } ESP_EARLY_LOGW("legacy_touch_driver", "legacy touch driver is deprecated, please migrate to use driver/touch_sens.h"); } +#endif //CONFIG_TOUCH_SKIP_LEGACY_CONFLICT_CHECK diff --git a/components/driver/touch_sensor/esp32s3/touch_sensor.c b/components/driver/touch_sensor/esp32s3/touch_sensor.c index e29091618e..cec9222fa6 100644 --- a/components/driver/touch_sensor/esp32s3/touch_sensor.c +++ b/components/driver/touch_sensor/esp32s3/touch_sensor.c @@ -657,6 +657,7 @@ esp_err_t touch_pad_sleep_channel_set_work_time(uint16_t sleep_cycle, uint16_t m return ESP_OK; } +#if !CONFIG_TOUCH_SKIP_LEGACY_CONFLICT_CHECK /** * @brief This function will be called during start up, to check that the new touch driver is not running along with the legacy touch driver */ @@ -670,3 +671,4 @@ static __attribute__((constructor)) void check_touch_driver_conflict(void) } ESP_EARLY_LOGW("legacy_touch_driver", "legacy touch driver is deprecated, please migrate to use driver/touch_sens.h"); } +#endif //CONFIG_TOUCH_SKIP_LEGACY_CONFLICT_CHECK