feat(legacy_driver): add kconfig to skip legacy confilct check

This commit is contained in:
Chen Jichang
2024-12-12 19:00:26 +08:00
parent a41e39cd49
commit 94d50d90e2
16 changed files with 93 additions and 1 deletions

View File

@@ -20,6 +20,12 @@ 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
@@ -137,6 +143,12 @@ menu "Driver Configurations"
(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.
config TEMP_SENSOR_ENABLE_DEBUG_LOG
bool "Enable debug log"
default n
@@ -192,6 +204,12 @@ 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 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.
config SDM_ENABLE_DEBUG_LOG
bool "Enable debug log"
default n
@@ -248,6 +266,12 @@ menu "Driver Configurations"
help
Enable this option will suppress the deprecation warnings of using APIs in legacy I2S driver.
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.
config I2S_ENABLE_DEBUG_LOG
bool "Enable I2S debug log"
default n
@@ -300,6 +324,12 @@ menu "Driver Configurations"
Only disable this option when you decide to do this step by yourself.
Note that the driver will allocate a new piece of memory to save the converted data.
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 # DAC Configuration
menu "USB Serial/JTAG Configuration"

View File

@@ -572,6 +572,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
*/
@@ -587,6 +588,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
/*---------------------------------------------------------------

View File

@@ -917,6 +917,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
*/
@@ -932,6 +933,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
/*---------------------------------------------------------------

View File

@@ -129,6 +129,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
*/
@@ -144,3 +145,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

View File

@@ -1900,6 +1900,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
*/
@@ -1913,3 +1914,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

View File

@@ -1042,6 +1042,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
*/
@@ -1057,3 +1058,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

View File

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

View File

@@ -1390,6 +1390,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
*/
@@ -1405,3 +1406,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

View File

@@ -152,6 +152,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
*/
@@ -167,3 +168,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

View File

@@ -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
*/
@@ -128,3 +128,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

View File

@@ -465,6 +465,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
*/
@@ -480,3 +481,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

View File

@@ -30,6 +30,12 @@ menu "GPTimer Configuration"
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.
config GPTIMER_ENABLE_DEBUG_LOG
bool "Enable debug log"
default n

View File

@@ -1676,6 +1676,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
*/
@@ -1691,3 +1692,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

View File

@@ -30,4 +30,10 @@ menu "MCPWM Configuration"
help
Wether to enable the debug log message for MCPWM driver.
Note that, this option only controls the MCPWM driver log, won't affect other drivers.
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 # MCPWM Configuration

View File

@@ -23,6 +23,12 @@ menu "PCNT Configuration"
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.
config PCNT_ENABLE_DEBUG_LOG
bool "Enable debug log"
default n

View File

@@ -26,6 +26,12 @@ menu "RMT Configuration"
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.
config RMT_ENABLE_DEBUG_LOG
bool "Enable debug log"
default n