change(sdm): move driver to a new component: esp_driver_sdm

pull/12732/head
morris 2023-11-30 20:57:54 +08:00
rodzic 846751216b
commit d171a7b958
22 zmienionych plików z 59 dodań i 47 usunięć

Wyświetl plik

@ -12,14 +12,13 @@ set(includes "deprecated"
"i2c/include"
"ledc/include"
"parlio/include"
"sigma_delta/include"
"touch_sensor/include"
"twai/include"
"uart/include"
"usb_serial_jtag/include")
# Always included linker fragments
set(ldfragments "linker.lf")
set(ldfragments "")
# ADC related source files (dprecated)
if(CONFIG_SOC_ADC_SUPPORTED)
@ -86,10 +85,9 @@ if(CONFIG_SOC_RMT_SUPPORTED)
list(APPEND srcs "deprecated/rmt_legacy.c")
endif()
# Sigma-Delta Modulation related source files
# Sigma-Delta Modulation legacy driver
if(CONFIG_SOC_SDM_SUPPORTED)
list(APPEND srcs "sigma_delta/sdm.c"
"deprecated/sigma_delta_legacy.c")
list(APPEND srcs "deprecated/sigma_delta_legacy.c")
endif()
# Temperature Sensor related source files
@ -144,7 +142,7 @@ else()
# have a public dependency on other "esp_driver_foo" components
esp_driver_gpio esp_driver_pcnt esp_driver_gptimer esp_driver_spi esp_driver_mcpwm
esp_driver_ana_cmpr esp_driver_i2s esp_driver_sdmmc esp_driver_sdspi esp_driver_sdio
esp_driver_dac esp_driver_rmt esp_driver_tsens
esp_driver_dac esp_driver_rmt esp_driver_tsens esp_driver_sdm
LDFRAGMENTS ${ldfragments}
)
endif()

Wyświetl plik

@ -66,32 +66,6 @@ menu "Driver Configurations"
orsource "./uart/Kconfig.uart"
menu "Sigma Delta Modulator Configuration"
depends on SOC_SDM_SUPPORTED
config SDM_CTRL_FUNC_IN_IRAM
bool "Place SDM control functions into IRAM"
default n
help
Place SDM control functions (like set_duty) into IRAM,
so that these functions can be IRAM-safe and able to be called in the other IRAM interrupt context.
Enabling this option can improve driver performance as well.
config SDM_SUPPRESS_DEPRECATE_WARN
bool "Suppress legacy driver deprecated warning"
default n
help
Wether to suppress the deprecation warnings when using legacy sigma delta driver.
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_ENABLE_DEBUG_LOG
bool "Enable debug log"
default n
help
Wether to enable the debug log message for SDM driver.
Note that, this option only controls the SDM driver log, won't affect other drivers.
endmenu # Sigma Delta Modulator Configuration
menu "USB Serial/JTAG Configuration"
depends on SOC_USB_SERIAL_JTAG_SUPPORTED
config USJ_NO_AUTO_LS_ON_CONNECTION

Wyświetl plik

@ -62,7 +62,7 @@ components/driver/test_apps/legacy_sigma_delta_driver:
disable:
- if: SOC_SDM_SUPPORTED != 1
depends_filepatterns:
- components/driver/deprecated/**/*
- components/driver/deprecated/**/*sigma*
depends_components:
- esp_driver_gpio
@ -88,14 +88,6 @@ components/driver/test_apps/rs485:
temporary: true
reason: lack of runners
components/driver/test_apps/sigma_delta:
disable:
- if: SOC_SDM_SUPPORTED != 1
depends_filepatterns:
- components/driver/sigma_delta/**/*
depends_components:
- esp_driver_gpio
components/driver/test_apps/touch_sensor_v1:
disable:
- if: SOC_TOUCH_SENSOR_VERSION != 1

Wyświetl plik

@ -0,0 +1,11 @@
set(srcs)
set(public_include "include")
if(CONFIG_SOC_SDM_SUPPORTED)
list(APPEND srcs "src/sdm.c")
endif()
idf_component_register(SRCS ${srcs}
INCLUDE_DIRS ${public_include}
PRIV_REQUIRES "esp_pm" "esp_driver_gpio"
LDFRAGMENTS "linker.lf"
)

Wyświetl plik

@ -0,0 +1,25 @@
menu "ESP-Driver:Sigma Delta Modulator Configurations"
depends on SOC_SDM_SUPPORTED
config SDM_CTRL_FUNC_IN_IRAM
bool "Place SDM control functions into IRAM"
default n
help
Place SDM control functions (like set_duty) into IRAM,
so that these functions can be IRAM-safe and able to be called in the other IRAM interrupt context.
Enabling this option can improve driver performance as well.
config SDM_SUPPRESS_DEPRECATE_WARN
bool "Suppress legacy driver deprecated warning"
default n
help
Wether to suppress the deprecation warnings when using legacy sigma delta driver.
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_ENABLE_DEBUG_LOG
bool "Enable debug log"
default n
help
Wether to enable the debug log message for SDM driver.
Note that, this option only controls the SDM driver log, won't affect other drivers.
endmenu # Sigma Delta Modulator Configurations

Wyświetl plik

@ -1,5 +1,5 @@
[mapping:driver]
archive: libdriver.a
[mapping:sdm_driver]
archive: libesp_driver_sdm.a
entries:
if SDM_CTRL_FUNC_IN_IRAM = y:
sdm: sdm_channel_set_pulse_density (noflash)

Wyświetl plik

@ -210,7 +210,7 @@ esp_err_t sdm_new_channel(const sdm_config_t *config, sdm_channel_handle_t *ret_
ESP_GOTO_ON_FALSE(group->clk_src == 0 || group->clk_src == config->clk_src, ESP_ERR_INVALID_ARG, err, TAG, "clock source conflict");
uint32_t src_clk_hz = 0;
ESP_GOTO_ON_ERROR(esp_clk_tree_src_get_freq_hz((soc_module_clk_t)config->clk_src,
ESP_CLK_TREE_SRC_FREQ_PRECISION_CACHED, &src_clk_hz), err, TAG, "get source clock frequency failed");
ESP_CLK_TREE_SRC_FREQ_PRECISION_CACHED, &src_clk_hz), err, TAG, "get source clock frequency failed");
#if CONFIG_PM_ENABLE
esp_pm_lock_type_t pm_type = ESP_PM_NO_LIGHT_SLEEP;

Wyświetl plik

@ -0,0 +1,8 @@
# Documentation: .gitlab/ci/README.md#manifest-file-to-control-the-buildtest-apps
components/esp_driver_sdm/test_apps/sigma_delta:
disable:
- if: SOC_SDM_SUPPORTED != 1
depends_components:
- esp_driver_gpio
- esp_driver_sdm

Wyświetl plik

@ -10,7 +10,7 @@ project(sigma_delta_test)
if(CONFIG_COMPILER_DUMP_RTL_FILES)
add_custom_target(check_test_app_sections ALL
COMMAND ${PYTHON} $ENV{IDF_PATH}/tools/ci/check_callgraph.py
--rtl-dirs ${CMAKE_BINARY_DIR}/esp-idf/driver/,${CMAKE_BINARY_DIR}/esp-idf/hal/
--rtl-dirs ${CMAKE_BINARY_DIR}/esp-idf/esp_driver_sdm/,${CMAKE_BINARY_DIR}/esp-idf/hal/
--elf-file ${CMAKE_BINARY_DIR}/sigma_delta_test.elf
find-refs
--from-sections=.iram0.text

Wyświetl plik

@ -7,5 +7,5 @@ endif()
# In order for the cases defined by `TEST_CASE` to be linked into the final elf,
# the component can be registered as WHOLE_ARCHIVE
idf_component_register(SRCS ${srcs}
PRIV_REQUIRES unity driver
PRIV_REQUIRES unity esp_driver_sdm
WHOLE_ARCHIVE)

Wyświetl plik

@ -79,7 +79,6 @@ INPUT = \
$(PROJECT_PATH)/components/driver/ledc/include/driver/ledc.h \
$(PROJECT_PATH)/components/driver/parlio/include/driver/parlio_tx.h \
$(PROJECT_PATH)/components/driver/parlio/include/driver/parlio_types.h \
$(PROJECT_PATH)/components/driver/sigma_delta/include/driver/sdm.h \
$(PROJECT_PATH)/components/driver/touch_sensor/include/driver/touch_sensor_common.h \
$(PROJECT_PATH)/components/driver/twai/include/driver/twai.h \
$(PROJECT_PATH)/components/driver/uart/include/driver/uart.h \
@ -134,6 +133,7 @@ INPUT = \
$(PROJECT_PATH)/components/esp_driver_rmt/include/driver/rmt_tx.h \
$(PROJECT_PATH)/components/esp_driver_rmt/include/driver/rmt_types.h \
$(PROJECT_PATH)/components/esp_driver_sdio/include/driver/sdio_slave.h \
$(PROJECT_PATH)/components/esp_driver_sdm/include/driver/sdm.h \
$(PROJECT_PATH)/components/esp_driver_sdmmc/include/driver/sdmmc_default_configs.h \
$(PROJECT_PATH)/components/esp_driver_sdmmc/include/driver/sdmmc_host.h \
$(PROJECT_PATH)/components/esp_driver_sdmmc/include/driver/sdmmc_types.h \

Wyświetl plik

@ -18,6 +18,7 @@ In order to control the dependence of other components on drivers at a smaller g
- `esp_driver_dac` - Driver for DAC
- `esp_driver_rmt` - Driver for RMT
- `esp_driver_tsens` - Driver for Temperature Sensor
- `esp_driver_sdm` - Driver for Sigma-Delta Modulator
For compatibility, the original `driver`` component is still treated as an all-in-one component by registering these `esp_driver_xyz`` components as its public dependencies. In other words, you do not need to modify the CMake file of an existing project, but you now have a way to specify the specific peripheral driver that your project depends on.

Wyświetl plik

@ -18,6 +18,7 @@
- `esp_driver_dac` - DAC 驱动
- `esp_driver_rmt` - RMT 驱动
- `esp_driver_tsens` - 温度传感器驱动
- `esp_driver_sdm` - Sigma-Delta 调制器驱动
为了兼容性,原来的 `driver` 组件仍然存在,并作为一个 “all-in-one" 的组件,将以上这些 `esp_driver_xyz` 组件注册成自己的公共依赖。换句话说,你无需修改既有项目的 CMake 文件,但是你现在多了一个途径去指定你项目依赖的具体的外设驱动。

Wyświetl plik

@ -290,6 +290,8 @@ examples/peripherals/secure_element/atecc608_ecdsa:
examples/peripherals/sigma_delta:
disable:
- if: SOC_SDM_SUPPORTED != 1
depends_components:
- esp_driver_sdm
examples/peripherals/spi_master/hd_eeprom:
disable: