feat(rmt): move the driver to a new component

pull/12702/head
morris 2023-11-22 10:22:29 +08:00
rodzic b403ef9527
commit f2751213fd
44 zmienionych plików z 59 dodań i 41 usunięć

Wyświetl plik

@ -8,12 +8,10 @@ endif()
set(srcs)
# Always included headers
set(includes "include"
"deprecated"
set(includes "deprecated"
"i2c/include"
"ledc/include"
"parlio/include"
"rmt/include"
"sigma_delta/include"
"temperature_sensor/include"
"touch_sensor/include"
@ -84,14 +82,9 @@ if(CONFIG_SOC_PCNT_SUPPORTED)
list(APPEND srcs "deprecated/pcnt_legacy.c")
endif()
# RMT related source files
# RMT legacy driver
if(CONFIG_SOC_RMT_SUPPORTED)
list(APPEND srcs "rmt/rmt_common.c"
"rmt/rmt_encoder.c"
"rmt/rmt_rx.c"
"rmt/rmt_tx.c"
"deprecated/rmt_legacy.c")
list(APPEND ldfragments "rmt/linker.lf")
list(APPEND srcs "deprecated/rmt_legacy.c")
endif()
# Sigma-Delta Modulation related source files
@ -153,7 +146,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_dac esp_driver_rmt
LDFRAGMENTS ${ldfragments}
)
endif()

Wyświetl plik

@ -120,8 +120,6 @@ menu "Driver Configurations"
Note that, this option only controls the SDM driver log, won't affect other drivers.
endmenu # Sigma Delta Modulator Configuration
orsource "./rmt/Kconfig.rmt"
menu "USB Serial/JTAG Configuration"
depends on SOC_USB_SERIAL_JTAG_SUPPORTED
config USJ_NO_AUTO_LS_ON_CONNECTION

Wyświetl plik

@ -51,6 +51,8 @@ components/driver/test_apps/legacy_pcnt_driver:
components/driver/test_apps/legacy_rmt_driver:
disable:
- if: SOC_RMT_SUPPORTED != 1
depends_filepatterns:
- components/driver/deprecated/**/*rmt*
components/driver/test_apps/legacy_rtc_temp_driver:
disable:
@ -78,10 +80,6 @@ components/driver/test_apps/parlio:
temporary: true
reason: lack of runner
components/driver/test_apps/rmt:
disable:
- if: SOC_RMT_SUPPORTED != 1
components/driver/test_apps/rs485:
disable:
- if: SOC_UART_SUPPORTED != 1

Wyświetl plik

@ -297,7 +297,8 @@ esp_err_t mcpwm_generator_set_action_on_sync_event(mcpwm_gen_handle_t gen, mcpwm
if (oper->triggers[i] == MCPWM_TRIGGER_SYNC_EVENT) {
trigger_sync_used = 1;
break;
} else if (oper->triggers[i] == MCPWM_TRIGGER_NO_ASSIGN) {
}
if (oper->triggers[i] == MCPWM_TRIGGER_NO_ASSIGN) {
trigger_id = i;
oper->triggers[i] = MCPWM_TRIGGER_SYNC_EVENT;
break;

Wyświetl plik

@ -0,0 +1,14 @@
set(srcs)
set(public_include "include")
if(CONFIG_SOC_RMT_SUPPORTED)
list(APPEND srcs "src/rmt_common.c"
"src/rmt_encoder.c"
"src/rmt_rx.c"
"src/rmt_tx.c")
endif()
idf_component_register(SRCS ${srcs}
INCLUDE_DIRS ${public_include}
PRIV_REQUIRES "esp_pm" "esp_driver_gpio"
LDFRAGMENTS "linker.lf"
)

Wyświetl plik

@ -1,4 +1,4 @@
menu "RMT Configuration"
menu "ESP-Driver:RMT Configurations"
depends on SOC_RMT_SUPPORTED
config RMT_ISR_IRAM_SAFE
bool "RMT ISR IRAM-Safe"
@ -32,4 +32,4 @@ menu "RMT Configuration"
help
Wether to enable the debug log message for RMT driver.
Note that, this option only controls the RMT driver log, won't affect other drivers.
endmenu # RMT Configuration
endmenu

Wyświetl plik

@ -1,5 +1,5 @@
[mapping:rmt_driver]
archive: libdriver.a
archive: libesp_driver_rmt.a
entries:
if RMT_RECV_FUNC_IN_IRAM = y:
rmt_rx: rmt_receive (noflash)

Wyświetl plik

@ -48,7 +48,7 @@ static esp_err_t rmt_bytes_encoder_reset(rmt_encoder_t *encoder)
}
static size_t IRAM_ATTR rmt_encode_bytes(rmt_encoder_t *encoder, rmt_channel_handle_t channel,
const void *primary_data, size_t data_size, rmt_encode_state_t *ret_state)
const void *primary_data, size_t data_size, rmt_encode_state_t *ret_state)
{
rmt_bytes_encoder_t *bytes_encoder = __containerof(encoder, rmt_bytes_encoder_t, base);
rmt_tx_channel_t *tx_chan = __containerof(channel, rmt_tx_channel_t, base);

Wyświetl plik

@ -0,0 +1,7 @@
# Documentation: .gitlab/ci/README.md#manifest-file-to-control-the-buildtest-apps
components/esp_driver_rmt/test_apps/rmt:
disable:
- if: SOC_RMT_SUPPORTED != 1
depends_components:
- esp_driver_rmt

Wyświetl plik

@ -10,7 +10,7 @@ project(rmt_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_rmt/,${CMAKE_BINARY_DIR}/esp-idf/hal/
--elf-file ${CMAKE_BINARY_DIR}/rmt_test.elf
find-refs
--from-sections=.iram0.text

Wyświetl plik

@ -9,5 +9,5 @@ if(CONFIG_RMT_ISR_IRAM_SAFE)
endif()
idf_component_register(SRCS "${srcs}"
PRIV_REQUIRES unity driver esp_timer esp_psram
PRIV_REQUIRES unity esp_driver_rmt esp_driver_gpio esp_timer esp_psram
WHOLE_ARCHIVE)

Wyświetl plik

@ -48,7 +48,6 @@
#define SOC_RTC_MEM_SUPPORTED 1
#define SOC_RMT_SUPPORTED 1
#define SOC_I2S_SUPPORTED 1
// #define SOC_RMT_SUPPORTED 1 //TODO: IDF-7476
// #define SOC_SDM_SUPPORTED 1 //TODO: IDF-7551
#define SOC_GPSPI_SUPPORTED 1
#define SOC_LEDC_SUPPORTED 1

Wyświetl plik

@ -79,11 +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/rmt/include/driver/rmt_common.h \
$(PROJECT_PATH)/components/driver/rmt/include/driver/rmt_encoder.h \
$(PROJECT_PATH)/components/driver/rmt/include/driver/rmt_rx.h \
$(PROJECT_PATH)/components/driver/rmt/include/driver/rmt_tx.h \
$(PROJECT_PATH)/components/driver/rmt/include/driver/rmt_types.h \
$(PROJECT_PATH)/components/driver/sigma_delta/include/driver/sdm.h \
$(PROJECT_PATH)/components/driver/temperature_sensor/include/driver/temperature_sensor.h \
$(PROJECT_PATH)/components/driver/touch_sensor/include/driver/touch_sensor_common.h \
@ -134,6 +129,11 @@ INPUT = \
$(PROJECT_PATH)/components/esp_driver_i2s/include/driver/i2s_tdm.h \
$(PROJECT_PATH)/components/esp_driver_i2s/include/driver/i2s_types.h \
$(PROJECT_PATH)/components/esp_driver_pcnt/include/driver/pulse_cnt.h \
$(PROJECT_PATH)/components/esp_driver_rmt/include/driver/rmt_common.h \
$(PROJECT_PATH)/components/esp_driver_rmt/include/driver/rmt_encoder.h \
$(PROJECT_PATH)/components/esp_driver_rmt/include/driver/rmt_rx.h \
$(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_sdmmc/include/driver/sdmmc_default_configs.h \
$(PROJECT_PATH)/components/esp_driver_sdmmc/include/driver/sdmmc_host.h \

Wyświetl plik

@ -609,7 +609,7 @@ API Reference
.. include-build-file:: inc/rmt_rx.inc
.. include-build-file:: inc/rmt_common.inc
.. include-build-file:: inc/rmt_encoder.inc
.. include-build-file:: inc/components/driver/rmt/include/driver/rmt_types.inc
.. include-build-file:: inc/components/esp_driver_rmt/include/driver/rmt_types.inc
.. include-build-file:: inc/components/hal/include/hal/rmt_types.inc

Wyświetl plik

@ -16,6 +16,7 @@ In order to control the dependence of other components on drivers at a smaller g
- `esp_driver_ana_cmpr` - Driver for Analog Comparator
- `esp_driver_i2s` - Driver for I2S
- `esp_driver_dac` - Driver for DAC
- `esp_driver_rmt` - Driver for RMT
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

@ -609,7 +609,7 @@ API 参考
.. include-build-file:: inc/rmt_rx.inc
.. include-build-file:: inc/rmt_common.inc
.. include-build-file:: inc/rmt_encoder.inc
.. include-build-file:: inc/components/driver/rmt/include/driver/rmt_types.inc
.. include-build-file:: inc/components/esp_driver_rmt/include/driver/rmt_types.inc
.. include-build-file:: inc/components/hal/include/hal/rmt_types.inc

Wyświetl plik

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

Wyświetl plik

@ -229,6 +229,8 @@ examples/peripherals/pcnt:
examples/peripherals/rmt:
disable:
- if: SOC_RMT_SUPPORTED != 1
depends_components:
- esp_driver_rmt
examples/peripherals/rmt/ir_nec_transceiver:
disable:
@ -237,14 +239,20 @@ examples/peripherals/rmt/ir_nec_transceiver:
- if: IDF_TARGET != "esp32"
temporary: true
reason: lack of runners
depends_components:
- esp_driver_rmt
examples/peripherals/rmt/musical_buzzer:
disable:
- if: SOC_RMT_SUPPORT_TX_LOOP_COUNT != 1
depends_components:
- esp_driver_rmt
examples/peripherals/rmt/stepper_motor:
disable:
- if: SOC_RMT_SUPPORT_TX_LOOP_AUTO_STOP != 1
depends_components:
- esp_driver_rmt
examples/peripherals/sdio/host:
disable:

Wyświetl plik

@ -9,11 +9,11 @@ set(include_dirs
"${IDF_PATH}/components/esp_driver_gpio/include"
"${IDF_PATH}/components/esp_driver_spi/include/driver"
"${IDF_PATH}/components/esp_driver_spi/include"
"${IDF_PATH}/components/esp_driver_rmt/include/driver"
"${IDF_PATH}/components/esp_driver_rmt/include"
"${original_driver_dir}/i2c/include/driver"
"${original_driver_dir}/rmt/include/driver"
"${original_driver_dir}/usb_serial_jtag/include/driver"
"${original_driver_dir}/i2c/include"
"${original_driver_dir}/rmt/include"
"${original_driver_dir}/usb_serial_jtag/include")
# Note: "hal" and "soc" are only required for corresponding header files and their definitions
@ -24,9 +24,9 @@ idf_component_mock(INCLUDE_DIRS ${include_dirs}
${IDF_PATH}/components/esp_driver_gpio/include/driver/gpio.h
${IDF_PATH}/components/esp_driver_spi/include/driver/spi_master.h
${IDF_PATH}/components/esp_driver_spi/include/driver/spi_common.h
${IDF_PATH}/components/esp_driver_rmt/include/driver/rmt_rx.h
${IDF_PATH}/components/esp_driver_rmt/include/driver/rmt_tx.h
${IDF_PATH}/components/esp_driver_rmt/include/driver/rmt_common.h
${IDF_PATH}/components/esp_driver_rmt/include/driver/rmt_encoder.h
${original_driver_dir}/i2c/include/driver/i2c.h
${original_driver_dir}/rmt/include/driver/rmt_rx.h
${original_driver_dir}/rmt/include/driver/rmt_tx.h
${original_driver_dir}/rmt/include/driver/rmt_common.h
${original_driver_dir}/rmt/include/driver/rmt_encoder.h
${original_driver_dir}/usb_serial_jtag/include/driver/usb_serial_jtag.h)

Wyświetl plik

@ -16,7 +16,5 @@ endif()
idf_component_register(SRCS ${srcs}
INCLUDE_DIRS include
REQUIRES esp_partition idf_test cmock
PRIV_REQUIRES perfmon esp_driver_pcnt esp_driver_gptimer esp_netif
driver # TODO: replace with esp_driver_rmt
)
PRIV_REQUIRES perfmon esp_driver_pcnt esp_driver_gptimer esp_driver_rmt esp_netif)
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")