From c13ac70aa7171dfedc361bcff0b4699a5413ed8c Mon Sep 17 00:00:00 2001 From: laokaiyao Date: Tue, 14 Jan 2025 16:54:36 +0800 Subject: [PATCH] ci: check register half word --- .../esp_adc/test_apps/adc/CMakeLists.txt | 6 +++ .../analog_comparator/CMakeLists.txt | 5 +++ .../test_apps/csi/CMakeLists.txt | 6 +++ .../test_apps/dac/CMakeLists.txt | 5 +++ .../test_apps/i2s/CMakeLists.txt | 5 +++ .../test_apps/lp_i2s/CMakeLists.txt | 5 +++ .../test_apps/isp/CMakeLists.txt | 6 +++ .../test_apps/master/CMakeLists.txt | 5 +++ .../test_apps/touch_sens/CMakeLists.txt | 6 +++ components/esp_hw_support/esp_clock_output.c | 1 + .../hal/esp32/include/hal/touch_sensor_ll.h | 6 +-- components/hal/esp32c5/include/hal/i2s_ll.h | 2 +- components/hal/esp32c5/include/hal/spi_ll.h | 2 +- components/hal/esp32c61/include/hal/spi_ll.h | 2 +- components/hal/esp32p4/include/hal/adc_ll.h | 4 +- components/hal/esp32p4/include/hal/isp_ll.h | 40 +++++++++---------- .../hal/esp32p4/include/hal/lp_i2s_ll.h | 4 +- components/hal/esp32p4/include/hal/spi_ll.h | 10 ++--- .../hal/esp32p4/include/hal/touch_sensor_ll.h | 6 +-- .../hal/esp32s2/include/hal/touch_sensor_ll.h | 6 +-- .../soc/esp32/register/soc/rtc_io_struct.h | 2 +- .../soc/esp32s2/register/soc/rtc_io_struct.h | 2 +- tools/ci/check_register_rw_half_word.py | 2 +- 23 files changed, 94 insertions(+), 44 deletions(-) diff --git a/components/esp_adc/test_apps/adc/CMakeLists.txt b/components/esp_adc/test_apps/adc/CMakeLists.txt index d941bb8ebd..f5a1bb70ea 100644 --- a/components/esp_adc/test_apps/adc/CMakeLists.txt +++ b/components/esp_adc/test_apps/adc/CMakeLists.txt @@ -21,3 +21,9 @@ if(CONFIG_COMPILER_DUMP_RTL_FILES) DEPENDS ${elf} ) endif() + +message(STATUS "Checking adc registers are not read-write by half-word") +include($ENV{IDF_PATH}/tools/ci/check_register_rw_half_word.cmake) +check_register_rw_half_word(SOC_MODULES "rtc_io" "sens" "syscon" "rtc_cntl" "apb_saradc" + "system" "pmu" "pcr" "hp_sys_clkrst" "lpperi" "lp_adc" + HAL_MODULES "adc") diff --git a/components/esp_driver_ana_cmpr/test_apps/analog_comparator/CMakeLists.txt b/components/esp_driver_ana_cmpr/test_apps/analog_comparator/CMakeLists.txt index c5b8c3e782..6bc3f82173 100644 --- a/components/esp_driver_ana_cmpr/test_apps/analog_comparator/CMakeLists.txt +++ b/components/esp_driver_ana_cmpr/test_apps/analog_comparator/CMakeLists.txt @@ -19,3 +19,8 @@ if(CONFIG_COMPILER_DUMP_RTL_FILES) DEPENDS ${elf} ) endif() + +message(STATUS "Checking analog comparator registers are not read-write by half-word") +include($ENV{IDF_PATH}/tools/ci/check_register_rw_half_word.cmake) +check_register_rw_half_word(SOC_MODULES "gpio_ext" "lp_system" "gpio" + HAL_MODULES "ana_cmpr") diff --git a/components/esp_driver_cam/test_apps/csi/CMakeLists.txt b/components/esp_driver_cam/test_apps/csi/CMakeLists.txt index ce5bab63b2..b8463898a6 100644 --- a/components/esp_driver_cam/test_apps/csi/CMakeLists.txt +++ b/components/esp_driver_cam/test_apps/csi/CMakeLists.txt @@ -6,3 +6,9 @@ set(COMPONENTS main) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(test_csi) + + +message(STATUS "Checking camera registers are not read-write by half-word") +include($ENV{IDF_PATH}/tools/ci/check_register_rw_half_word.cmake) +check_register_rw_half_word(SOC_MODULES "lcd_cam" "hp_sys_clkrst" "*csi*" + HAL_MODULES "cam" "*csi*") diff --git a/components/esp_driver_dac/test_apps/dac/CMakeLists.txt b/components/esp_driver_dac/test_apps/dac/CMakeLists.txt index 0e63a58084..3bb25973d8 100644 --- a/components/esp_driver_dac/test_apps/dac/CMakeLists.txt +++ b/components/esp_driver_dac/test_apps/dac/CMakeLists.txt @@ -19,3 +19,8 @@ if(CONFIG_COMPILER_DUMP_RTL_FILES) DEPENDS ${elf} ) endif() + +message(STATUS "Checking dac registers are not read-write by half-word") +include($ENV{IDF_PATH}/tools/ci/check_register_rw_half_word.cmake) +check_register_rw_half_word(SOC_MODULES "rtc_io" "sens" "apb_saradc" + HAL_MODULES "dac") diff --git a/components/esp_driver_i2s/test_apps/i2s/CMakeLists.txt b/components/esp_driver_i2s/test_apps/i2s/CMakeLists.txt index 13fa5a9dc0..a5d1a43fad 100644 --- a/components/esp_driver_i2s/test_apps/i2s/CMakeLists.txt +++ b/components/esp_driver_i2s/test_apps/i2s/CMakeLists.txt @@ -19,3 +19,8 @@ if(CONFIG_COMPILER_DUMP_RTL_FILES) DEPENDS ${elf} ) endif() + +message(STATUS "Checking i2s registers are not read-write by half-word") +include($ENV{IDF_PATH}/tools/ci/check_register_rw_half_word.cmake) +check_register_rw_half_word(SOC_MODULES "i2s" "pcr" "hp_sys_clkrst" + HAL_MODULES "i2s") diff --git a/components/esp_driver_i2s/test_apps/lp_i2s/CMakeLists.txt b/components/esp_driver_i2s/test_apps/lp_i2s/CMakeLists.txt index ec34dfb4ba..710d76198e 100644 --- a/components/esp_driver_i2s/test_apps/lp_i2s/CMakeLists.txt +++ b/components/esp_driver_i2s/test_apps/lp_i2s/CMakeLists.txt @@ -6,3 +6,8 @@ set(COMPONENTS main) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(lp_i2s_test) + +message(STATUS "Checking lp_i2s registers are not read-write by half-word") +include($ENV{IDF_PATH}/tools/ci/check_register_rw_half_word.cmake) +check_register_rw_half_word(SOC_MODULES "lp_i2s" "pcr" "hp_sys_clkrst" + HAL_MODULES "lp_i2s") diff --git a/components/esp_driver_isp/test_apps/isp/CMakeLists.txt b/components/esp_driver_isp/test_apps/isp/CMakeLists.txt index d940d8240b..62a2bf08e1 100644 --- a/components/esp_driver_isp/test_apps/isp/CMakeLists.txt +++ b/components/esp_driver_isp/test_apps/isp/CMakeLists.txt @@ -6,3 +6,9 @@ set(COMPONENTS main) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(test_isp) + + +message(STATUS "Checking isp registers are not read-write by half-word") +include($ENV{IDF_PATH}/tools/ci/check_register_rw_half_word.cmake) +check_register_rw_half_word(SOC_MODULES "isp" "hp_sys_clkrst" + HAL_MODULES "isp") diff --git a/components/esp_driver_spi/test_apps/master/CMakeLists.txt b/components/esp_driver_spi/test_apps/master/CMakeLists.txt index a089345e26..4dcfbc1419 100644 --- a/components/esp_driver_spi/test_apps/master/CMakeLists.txt +++ b/components/esp_driver_spi/test_apps/master/CMakeLists.txt @@ -19,3 +19,8 @@ if(CONFIG_COMPILER_DUMP_RTL_FILES) DEPENDS ${elf} ) endif() + +message(STATUS "Checking spi registers are not read-write by half-word") +include($ENV{IDF_PATH}/tools/ci/check_register_rw_half_word.cmake) +check_register_rw_half_word(SOC_MODULES "spi" "syscon" "pcr" "system" "hp_sys_clkrst" + HAL_MODULES "spi") diff --git a/components/esp_driver_touch_sens/test_apps/touch_sens/CMakeLists.txt b/components/esp_driver_touch_sens/test_apps/touch_sens/CMakeLists.txt index e774828c4d..8c138d6cdb 100644 --- a/components/esp_driver_touch_sens/test_apps/touch_sens/CMakeLists.txt +++ b/components/esp_driver_touch_sens/test_apps/touch_sens/CMakeLists.txt @@ -20,3 +20,9 @@ if(CONFIG_COMPILER_DUMP_RTL_FILES) DEPENDS ${elf} ) endif() + +message(STATUS "Checking touch sensor registers are not read-write by half-word") +include($ENV{IDF_PATH}/tools/ci/check_register_rw_half_word.cmake) +check_register_rw_half_word(SOC_MODULES "rtc_cntl" "sens" "rtc_io" "lp_analog_peri" + "lp_clkrst" "lp_system" "lpperi" "touch" "pmu" + HAL_MODULES "touch_sensor") diff --git a/components/esp_hw_support/esp_clock_output.c b/components/esp_hw_support/esp_clock_output.c index 4b89591375..7c0fc8ef2d 100644 --- a/components/esp_hw_support/esp_clock_output.c +++ b/components/esp_hw_support/esp_clock_output.c @@ -17,6 +17,7 @@ #include "hal/clk_tree_ll.h" #include "soc/soc_caps.h" #include "soc/io_mux_reg.h" +#include "esp_private/gpio.h" typedef struct clkout_channel_handle { bool is_mapped; diff --git a/components/hal/esp32/include/hal/touch_sensor_ll.h b/components/hal/esp32/include/hal/touch_sensor_ll.h index 268a35e1be..455626b004 100644 --- a/components/hal/esp32/include/hal/touch_sensor_ll.h +++ b/components/hal/esp32/include/hal/touch_sensor_ll.h @@ -270,7 +270,7 @@ static inline void touch_ll_set_measure_interval_ticks(uint16_t interval_ticks) */ static inline void touch_ll_set_charge_speed(uint32_t touch_num, touch_charge_speed_t charge_speed) { - RTCIO.touch_pad[touch_num].dac = charge_speed; + RTCIO.touch_pad[touch_num].slope = charge_speed; } /** @@ -586,7 +586,7 @@ static inline void touch_ll_get_voltage_attenuation(touch_volt_atten_t *atten) */ static inline void touch_ll_set_slope(touch_pad_t touch_num, touch_cnt_slope_t slope) { - RTCIO.touch_pad[touch_num].dac = slope; + RTCIO.touch_pad[touch_num].slope = slope; } /** @@ -601,7 +601,7 @@ static inline void touch_ll_set_slope(touch_pad_t touch_num, touch_cnt_slope_t s */ static inline void touch_ll_get_slope(touch_pad_t touch_num, touch_cnt_slope_t *slope) { - *slope = (touch_cnt_slope_t)RTCIO.touch_pad[touch_num].dac; + *slope = (touch_cnt_slope_t)RTCIO.touch_pad[touch_num].slope; } /** diff --git a/components/hal/esp32c5/include/hal/i2s_ll.h b/components/hal/esp32c5/include/hal/i2s_ll.h index 0a33745fd7..45cc720a76 100644 --- a/components/hal/esp32c5/include/hal/i2s_ll.h +++ b/components/hal/esp32c5/include/hal/i2s_ll.h @@ -496,7 +496,7 @@ static inline void i2s_ll_rx_set_ws_width(i2s_dev_t *hw, int width) */ static inline void i2s_ll_rx_set_eof_num(i2s_dev_t *hw, int eof_num) { - hw->rx_eof_num.rx_eof_num = eof_num; + HAL_FORCE_MODIFY_U32_REG_FIELD(hw->rx_eof_num, rx_eof_num, eof_num); } /** diff --git a/components/hal/esp32c5/include/hal/spi_ll.h b/components/hal/esp32c5/include/hal/spi_ll.h index 943143f3f4..44363e920a 100644 --- a/components/hal/esp32c5/include/hal/spi_ll.h +++ b/components/hal/esp32c5/include/hal/spi_ll.h @@ -180,7 +180,7 @@ static inline void spi_ll_clk_source_pre_div(spi_dev_t *hw, uint8_t hs_div, uint { // In IDF master driver 'mst_div' will be const 2 and 'hs_div' is actually pre_div temporally (void) hs_div; - PCR.spi2_clkm_conf.spi2_clkm_div_num = mst_div - 1; + HAL_FORCE_MODIFY_U32_REG_FIELD(PCR.spi2_clkm_conf, spi2_clkm_div_num, mst_div - 1); } /** diff --git a/components/hal/esp32c61/include/hal/spi_ll.h b/components/hal/esp32c61/include/hal/spi_ll.h index 7b5c03332e..70fcfe9d70 100644 --- a/components/hal/esp32c61/include/hal/spi_ll.h +++ b/components/hal/esp32c61/include/hal/spi_ll.h @@ -181,7 +181,7 @@ static inline void spi_ll_clk_source_pre_div(spi_dev_t *hw, uint8_t hs_div, uint { // In IDF master driver 'mst_div' will be const 2 and 'hs_div' is actually pre_div temporally (void) hs_div; - PCR.spi2_clkm_conf.spi2_clkm_div_num = mst_div - 1; + HAL_FORCE_MODIFY_U32_REG_FIELD(PCR.spi2_clkm_conf, spi2_clkm_div_num, mst_div - 1); } /** diff --git a/components/hal/esp32p4/include/hal/adc_ll.h b/components/hal/esp32p4/include/hal/adc_ll.h index 3b18c4d3f2..f0ee358b9f 100644 --- a/components/hal/esp32p4/include/hal/adc_ll.h +++ b/components/hal/esp32p4/include/hal/adc_ll.h @@ -205,8 +205,8 @@ static inline void adc_ll_digi_set_convert_mode(adc_ll_digi_convert_mode_t mode) static inline void adc_ll_digi_controller_clk_div(uint32_t div_num, uint32_t div_b, uint32_t div_a) { HAL_FORCE_MODIFY_U32_REG_FIELD(HP_SYS_CLKRST.peri_clk_ctrl23, reg_adc_clk_div_num, div_num); - HP_SYS_CLKRST.peri_clk_ctrl23.reg_adc_clk_div_numerator = div_a; - HP_SYS_CLKRST.peri_clk_ctrl23.reg_adc_clk_div_denominator = div_b; + HAL_FORCE_MODIFY_U32_REG_FIELD(HP_SYS_CLKRST.peri_clk_ctrl23, reg_adc_clk_div_numerator, div_a); + HAL_FORCE_MODIFY_U32_REG_FIELD(HP_SYS_CLKRST.peri_clk_ctrl23, reg_adc_clk_div_denominator, div_b); } /** diff --git a/components/hal/esp32p4/include/hal/isp_ll.h b/components/hal/esp32p4/include/hal/isp_ll.h index 90b83ebb7a..5284263091 100644 --- a/components/hal/esp32p4/include/hal/isp_ll.h +++ b/components/hal/esp32p4/include/hal/isp_ll.h @@ -555,7 +555,7 @@ static inline void isp_ll_af_manual_update(isp_dev_t *hw) static inline void isp_ll_af_set_edge_thresh_mode(isp_dev_t *hw, isp_ll_af_edge_detector_mode_t mode) { if (mode == ISP_LL_AF_EDGE_DETECTOR_MODE_AUTO) { - hw->af_threshold.af_threshold = 0; + HAL_FORCE_MODIFY_U32_REG_FIELD(hw->af_threshold, af_threshold, 0); } } @@ -569,7 +569,7 @@ static inline void isp_ll_af_set_edge_thresh(isp_dev_t *hw, uint32_t thresh) { HAL_ASSERT(thresh != 0); - hw->af_threshold.af_threshold = thresh; + HAL_FORCE_MODIFY_U32_REG_FIELD(hw->af_threshold, af_threshold, thresh); } /** @@ -580,7 +580,7 @@ static inline void isp_ll_af_set_edge_thresh(isp_dev_t *hw, uint32_t thresh) */ static inline void isp_ll_af_set_auto_edge_thresh_pixel_num(isp_dev_t *hw, uint32_t pixel_num) { - HAL_ASSERT(hw->af_threshold.af_threshold == 0); + HAL_ASSERT(HAL_FORCE_READ_U32_REG_FIELD(hw->af_threshold, af_threshold) == 0); hw->af_ctrl1.af_thpixnum = pixel_num; } @@ -686,7 +686,7 @@ static inline uint32_t isp_ll_af_get_window_lum(isp_dev_t *hw, uint32_t window_i */ static inline void isp_ll_af_env_detector_set_period(isp_dev_t *hw, uint32_t period) { - hw->af_ctrl0.af_env_period = period; + HAL_FORCE_MODIFY_U32_REG_FIELD(hw->af_ctrl0, af_env_period, period); } /** @@ -789,7 +789,7 @@ static inline void isp_ll_bf_set_padding_mode(isp_dev_t *hw, isp_bf_edge_padding */ static inline void isp_ll_bf_set_padding_data(isp_dev_t *hw, uint32_t padding_data) { - hw->bf_matrix_ctrl.bf_padding_data = padding_data; + HAL_FORCE_MODIFY_U32_REG_FIELD(hw->bf_matrix_ctrl, bf_padding_data, padding_data); } /** @@ -800,7 +800,7 @@ static inline void isp_ll_bf_set_padding_data(isp_dev_t *hw, uint32_t padding_da */ static inline void isp_ll_bf_set_padding_line_tail_valid_start_pixel(isp_dev_t *hw, uint32_t start_pixel) { - hw->bf_matrix_ctrl.bf_tail_pixen_pulse_tl = start_pixel; + HAL_FORCE_MODIFY_U32_REG_FIELD(hw->bf_matrix_ctrl, bf_tail_pixen_pulse_tl, start_pixel); } /** @@ -811,7 +811,7 @@ static inline void isp_ll_bf_set_padding_line_tail_valid_start_pixel(isp_dev_t * */ static inline void isp_ll_bf_set_padding_line_tail_valid_end_pixel(isp_dev_t *hw, uint32_t end_pixel) { - hw->bf_matrix_ctrl.bf_tail_pixen_pulse_th = end_pixel; + HAL_FORCE_MODIFY_U32_REG_FIELD(hw->bf_matrix_ctrl, bf_tail_pixen_pulse_th, end_pixel); } /** @@ -1174,8 +1174,8 @@ static inline void isp_ll_ae_set_subwin_pixnum_recip(isp_dev_t *hw, int subwin_p */ static inline void isp_ll_ae_env_detector_set_thresh(isp_dev_t *hw, uint32_t low_thresh, uint32_t high_thresh) { - hw->ae_monitor.ae_monitor_tl = low_thresh; - hw->ae_monitor.ae_monitor_th = high_thresh; + HAL_FORCE_MODIFY_U32_REG_FIELD(hw->ae_monitor, ae_monitor_tl, low_thresh); + HAL_FORCE_MODIFY_U32_REG_FIELD(hw->ae_monitor, ae_monitor_th, high_thresh); } /** @@ -1557,7 +1557,7 @@ static inline void isp_ll_demosaic_set_padding_mode(isp_dev_t *hw, isp_demosaic_ __attribute__((always_inline)) static inline void isp_ll_demosaic_set_padding_data(isp_dev_t *hw, uint32_t padding_data) { - hw->demosaic_matrix_ctrl.demosaic_padding_data = padding_data; + HAL_FORCE_MODIFY_U32_REG_FIELD(hw->demosaic_matrix_ctrl, demosaic_padding_data, padding_data); } /** @@ -1569,7 +1569,7 @@ static inline void isp_ll_demosaic_set_padding_data(isp_dev_t *hw, uint32_t padd __attribute__((always_inline)) static inline void isp_ll_demosaic_set_padding_line_tail_valid_start_pixel(isp_dev_t *hw, uint32_t start_pixel) { - hw->demosaic_matrix_ctrl.demosaic_tail_pixen_pulse_tl = start_pixel; + HAL_FORCE_MODIFY_U32_REG_FIELD(hw->demosaic_matrix_ctrl, demosaic_tail_pixen_pulse_tl, start_pixel); } /** @@ -1581,7 +1581,7 @@ static inline void isp_ll_demosaic_set_padding_line_tail_valid_start_pixel(isp_d __attribute__((always_inline)) static inline void isp_ll_demosaic_set_padding_line_tail_valid_end_pixel(isp_dev_t *hw, uint32_t end_pixel) { - hw->demosaic_matrix_ctrl.demosaic_tail_pixen_pulse_th = end_pixel; + HAL_FORCE_MODIFY_U32_REG_FIELD(hw->demosaic_matrix_ctrl, demosaic_tail_pixen_pulse_th, end_pixel); } /*--------------------------------------------------------------- @@ -1618,7 +1618,7 @@ static inline void isp_ll_sharp_enable(isp_dev_t *hw, bool enable) __attribute__((always_inline)) static inline void isp_ll_sharp_set_low_thresh(isp_dev_t *hw, uint8_t thresh) { - hw->sharp_ctrl0.sharp_threshold_low = thresh; + HAL_FORCE_MODIFY_U32_REG_FIELD(hw->sharp_ctrl0, sharp_threshold_low, thresh); } /** @@ -1630,7 +1630,7 @@ static inline void isp_ll_sharp_set_low_thresh(isp_dev_t *hw, uint8_t thresh) __attribute__((always_inline)) static inline void isp_ll_sharp_set_high_thresh(isp_dev_t *hw, uint8_t thresh) { - hw->sharp_ctrl0.sharp_threshold_high = thresh; + HAL_FORCE_MODIFY_U32_REG_FIELD(hw->sharp_ctrl0, sharp_threshold_high, thresh); } /** @@ -1643,7 +1643,7 @@ __attribute__((always_inline)) static inline void isp_ll_sharp_set_medium_freq_coeff(isp_dev_t *hw, isp_sharpen_m_freq_coeff coeff) { //val between `sharp_amount_low` and `sharp_threshold_high` will be multiplied by `sharp_amount_low` - hw->sharp_ctrl0.sharp_amount_low = coeff.val; + HAL_FORCE_MODIFY_U32_REG_FIELD(hw->sharp_ctrl0, sharp_amount_low, coeff.val); } /** @@ -1656,7 +1656,7 @@ __attribute__((always_inline)) static inline void isp_ll_sharp_set_high_freq_coeff(isp_dev_t *hw, isp_sharpen_h_freq_coeff_t coeff) { //val higher than `sharp_threshold_high` will be multiplied by `sharp_amount_high` - hw->sharp_ctrl0.sharp_amount_high = coeff.val; + HAL_FORCE_MODIFY_U32_REG_FIELD(hw->sharp_ctrl0, sharp_amount_high, coeff.val); } /** @@ -1680,7 +1680,7 @@ static inline void isp_ll_sharp_set_padding_mode(isp_dev_t *hw, isp_sharpen_edge __attribute__((always_inline)) static inline void isp_ll_sharp_set_padding_data(isp_dev_t *hw, uint32_t padding_data) { - hw->sharp_matrix_ctrl.sharp_padding_data = padding_data; + HAL_FORCE_MODIFY_U32_REG_FIELD(hw->sharp_matrix_ctrl, sharp_padding_data, padding_data); } /** @@ -1692,7 +1692,7 @@ static inline void isp_ll_sharp_set_padding_data(isp_dev_t *hw, uint32_t padding __attribute__((always_inline)) static inline void isp_ll_sharp_set_padding_line_tail_valid_start_pixel(isp_dev_t *hw, uint32_t start_pixel) { - hw->sharp_matrix_ctrl.sharp_tail_pixen_pulse_tl = start_pixel; + HAL_FORCE_MODIFY_U32_REG_FIELD(hw->sharp_matrix_ctrl, sharp_tail_pixen_pulse_tl, start_pixel); } /** @@ -1704,7 +1704,7 @@ static inline void isp_ll_sharp_set_padding_line_tail_valid_start_pixel(isp_dev_ __attribute__((always_inline)) static inline void isp_ll_sharp_set_padding_line_tail_valid_end_pixel(isp_dev_t *hw, uint32_t end_pixel) { - hw->sharp_matrix_ctrl.sharp_tail_pixen_pulse_th = end_pixel; + HAL_FORCE_MODIFY_U32_REG_FIELD(hw->sharp_matrix_ctrl, sharp_tail_pixen_pulse_th, end_pixel); } /** @@ -1741,7 +1741,7 @@ static inline void isp_ll_sharp_set_template(isp_dev_t *hw, uint8_t template_arr __attribute__((always_inline)) static inline uint8_t isp_ll_sharp_get_high_freq_pixel_max(isp_dev_t *hw) { - return hw->sharp_ctrl1.sharp_gradient_max; + return HAL_FORCE_READ_U32_REG_FIELD(hw->sharp_ctrl1, sharp_gradient_max); } /*--------------------------------------------------------------- diff --git a/components/hal/esp32p4/include/hal/lp_i2s_ll.h b/components/hal/esp32p4/include/hal/lp_i2s_ll.h index 23e81cd2a5..ed6851a58c 100644 --- a/components/hal/esp32p4/include/hal/lp_i2s_ll.h +++ b/components/hal/esp32p4/include/hal/lp_i2s_ll.h @@ -114,7 +114,7 @@ static inline void lp_i2s_ll_enable_mem(int id, bool en) static inline void lp_i2s_ll_set_rx_mem_threshold(lp_i2s_dev_t *hw, uint32_t words) { - LP_I2S.rx_mem_conf.rx_mem_threshold = words; + HAL_FORCE_MODIFY_U32_REG_FIELD(hw->rx_mem_conf, rx_mem_threshold, words); } /*--------------------------------------------------------------- @@ -785,7 +785,7 @@ static inline void lp_vad_ll_set_speak_activity_thresh(lp_i2s_dev_t *hw, int thr */ static inline void lp_vad_ll_set_non_speak_activity_thresh(lp_i2s_dev_t *hw, int thresh) { - hw->vad_param1.param_hangover_silent = thresh; + HAL_FORCE_MODIFY_U32_REG_FIELD(hw->vad_param1, param_hangover_silent, thresh); } /** diff --git a/components/hal/esp32p4/include/hal/spi_ll.h b/components/hal/esp32p4/include/hal/spi_ll.h index 2b7211f4d6..5adb3c3750 100644 --- a/components/hal/esp32p4/include/hal/spi_ll.h +++ b/components/hal/esp32p4/include/hal/spi_ll.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -215,11 +215,11 @@ __attribute__((always_inline)) static inline void spi_ll_clk_source_pre_div(spi_dev_t *hw, uint8_t hs_div, uint8_t mst_div) { if (hw == &GPSPI2) { - HP_SYS_CLKRST.peri_clk_ctrl116.reg_gpspi2_hs_clk_div_num = hs_div - 1; - HP_SYS_CLKRST.peri_clk_ctrl116.reg_gpspi2_mst_clk_div_num = mst_div - 1; + HAL_FORCE_MODIFY_U32_REG_FIELD(HP_SYS_CLKRST.peri_clk_ctrl116, reg_gpspi2_hs_clk_div_num, hs_div - 1); + HAL_FORCE_MODIFY_U32_REG_FIELD(HP_SYS_CLKRST.peri_clk_ctrl116, reg_gpspi2_mst_clk_div_num, mst_div - 1); } else if (hw == &GPSPI3) { - HP_SYS_CLKRST.peri_clk_ctrl117.reg_gpspi3_hs_clk_div_num = hs_div - 1; - HP_SYS_CLKRST.peri_clk_ctrl117.reg_gpspi3_mst_clk_div_num = mst_div - 1; + HAL_FORCE_MODIFY_U32_REG_FIELD(HP_SYS_CLKRST.peri_clk_ctrl117, reg_gpspi3_hs_clk_div_num, hs_div - 1); + HAL_FORCE_MODIFY_U32_REG_FIELD(HP_SYS_CLKRST.peri_clk_ctrl117, reg_gpspi3_mst_clk_div_num, mst_div - 1); } } diff --git a/components/hal/esp32p4/include/hal/touch_sensor_ll.h b/components/hal/esp32p4/include/hal/touch_sensor_ll.h index f7d34bb56a..76639412b9 100644 --- a/components/hal/esp32p4/include/hal/touch_sensor_ll.h +++ b/components/hal/esp32p4/include/hal/touch_sensor_ll.h @@ -408,7 +408,7 @@ static inline void touch_ll_read_chan_data(uint32_t touch_num, uint8_t sample_cf LP_ANA_PERI.touch_mux0.touch_freq_sel = sample_cfg_id; LP_ANA_PERI.touch_mux0.touch_data_sel = type; // Channel shift workaround - *data = LP_TOUCH.chn_data[touch_num + 1].pad_data; + *data = HAL_FORCE_READ_U32_REG_FIELD(LP_TOUCH.chn_data[touch_num + 1], pad_data); } /** @@ -564,7 +564,7 @@ static inline uint32_t touch_ll_get_intr_status_mask(void) static inline void touch_ll_set_timeout(uint32_t timeout_cycles) { if (timeout_cycles) { - LP_ANA_PERI.touch_scan_ctrl2.touch_timeout_num = timeout_cycles; + HAL_FORCE_MODIFY_U32_REG_FIELD(LP_ANA_PERI.touch_scan_ctrl2, touch_timeout_num, timeout_cycles); LP_ANA_PERI.touch_scan_ctrl2.touch_timeout_en = 1; } else { LP_ANA_PERI.touch_scan_ctrl2.touch_timeout_en = 0; @@ -847,7 +847,7 @@ static inline void touch_ll_set_proximity_sensing_channel(uint8_t prox_chan, uin */ static inline void touch_ll_proximity_set_total_scan_times(uint32_t scan_times) { - LP_ANA_PERI.touch_filter1.touch_approach_limit = scan_times; + HAL_FORCE_MODIFY_U32_REG_FIELD(LP_ANA_PERI.touch_filter1, touch_approach_limit, scan_times); } /** diff --git a/components/hal/esp32s2/include/hal/touch_sensor_ll.h b/components/hal/esp32s2/include/hal/touch_sensor_ll.h index 78de4e8bff..a5e38e8982 100644 --- a/components/hal/esp32s2/include/hal/touch_sensor_ll.h +++ b/components/hal/esp32s2/include/hal/touch_sensor_ll.h @@ -260,7 +260,7 @@ static inline void touch_ll_set_measure_interval_ticks(uint16_t interval_ticks) */ static inline void touch_ll_set_charge_speed(uint32_t touch_num, touch_charge_speed_t charge_speed) { - RTCIO.touch_pad[touch_num].dac = charge_speed; + RTCIO.touch_pad[touch_num].slope = charge_speed; } /** @@ -923,7 +923,7 @@ static inline void touch_ll_get_voltage_attenuation(touch_volt_atten_t *atten) */ static inline void touch_ll_set_slope(touch_pad_t touch_num, touch_cnt_slope_t slope) { - RTCIO.touch_pad[touch_num].dac = slope; + RTCIO.touch_pad[touch_num].slope = slope; } /** @@ -938,7 +938,7 @@ static inline void touch_ll_set_slope(touch_pad_t touch_num, touch_cnt_slope_t s */ static inline void touch_ll_get_slope(touch_pad_t touch_num, touch_cnt_slope_t *slope) { - *slope = (touch_cnt_slope_t)RTCIO.touch_pad[touch_num].dac; + *slope = (touch_cnt_slope_t)RTCIO.touch_pad[touch_num].slope; } /** diff --git a/components/soc/esp32/register/soc/rtc_io_struct.h b/components/soc/esp32/register/soc/rtc_io_struct.h index ced01aa512..69aa73a038 100644 --- a/components/soc/esp32/register/soc/rtc_io_struct.h +++ b/components/soc/esp32/register/soc/rtc_io_struct.h @@ -236,7 +236,7 @@ typedef volatile struct rtc_io_dev_s { uint32_t xpd: 1; /*touch sensor power on.*/ uint32_t tie_opt: 1; /*default touch sensor tie option. 0: tie low 1: tie high.*/ uint32_t start: 1; /*start touch sensor.*/ - uint32_t dac: 3; /*touch sensor slope control. 3-bit for each touch panel default 100.*/ + uint32_t slope: 3; /*touch sensor slope control. 3-bit for each touch panel default 100.*/ uint32_t reserved26: 1; uint32_t rue: 1; /*the pull up enable of the pad*/ uint32_t rde: 1; /*the pull down enable of the pad*/ diff --git a/components/soc/esp32s2/register/soc/rtc_io_struct.h b/components/soc/esp32s2/register/soc/rtc_io_struct.h index cc10eabcf2..71642c1a1f 100644 --- a/components/soc/esp32s2/register/soc/rtc_io_struct.h +++ b/components/soc/esp32s2/register/soc/rtc_io_struct.h @@ -117,7 +117,7 @@ typedef volatile struct rtc_io_dev_s { uint32_t xpd: 1; /*TOUCH_XPD*/ uint32_t tie_opt: 1; /*TOUCH_TIE_OPT*/ uint32_t start: 1; /*TOUCH_START*/ - uint32_t dac: 3; /*TOUCH_DAC*/ + uint32_t slope: 3; /*TOUCH_SLOPE*/ uint32_t reserved26: 1; uint32_t rue: 1; /*RUE*/ uint32_t rde: 1; /*RDE*/ diff --git a/tools/ci/check_register_rw_half_word.py b/tools/ci/check_register_rw_half_word.py index 3a5aa569dd..05c31c9e6c 100644 --- a/tools/ci/check_register_rw_half_word.py +++ b/tools/ci/check_register_rw_half_word.py @@ -50,7 +50,7 @@ def main( for capture in captures: error_usages = [f'.{capture}', f'->{capture}'] for error_usage in error_usages: - word_bound_pattern = rf'{re.escape(error_usage)}\b' + word_bound_pattern = rf'{re.escape(error_usage)}\s*[;|=](.*)\b' # print the line number where the error_usage is found for match in re.finditer(word_bound_pattern, content, re.MULTILINE): no_violation_found = False