diff --git a/components/driver/i2c/i2c.c b/components/driver/i2c/i2c.c index 7a8fc82659..5e849ae1e8 100644 --- a/components/driver/i2c/i2c.c +++ b/components/driver/i2c/i2c.c @@ -21,7 +21,7 @@ #include "soc/soc_memory_layout.h" #include "hal/i2c_hal.h" #include "hal/gpio_hal.h" -#include "soc/i2c_periph.h" +#include "hal/i2c_periph.h" #include "driver/i2c_types_legacy.h" #include "esp_private/periph_ctrl.h" #include "esp_rom_gpio.h" diff --git a/components/driver/test_apps/legacy_i2c_driver/main/test_i2c.c b/components/driver/test_apps/legacy_i2c_driver/main/test_i2c.c index 9de8145efc..6caf72da90 100644 --- a/components/driver/test_apps/legacy_i2c_driver/main/test_i2c.c +++ b/components/driver/test_apps/legacy_i2c_driver/main/test_i2c.c @@ -12,7 +12,7 @@ #include "esp_attr.h" #include "esp_log.h" #include "soc/gpio_periph.h" -#include "soc/i2c_periph.h" +#include "hal/i2c_periph.h" #include "esp_system.h" #include "soc/uart_struct.h" #include "esp_private/periph_ctrl.h" diff --git a/components/esp_driver_dac/test_apps/dac/main/test_dac.c b/components/esp_driver_dac/test_apps/dac/main/test_dac.c index d33f135cbe..ed0d895283 100644 --- a/components/esp_driver_dac/test_apps/dac/main/test_dac.c +++ b/components/esp_driver_dac/test_apps/dac/main/test_dac.c @@ -20,7 +20,6 @@ // Following headers are used to test the conversion frequency #include "soc/i2s_periph.h" #include "driver/pulse_cnt.h" -#include "soc/pcnt_periph.h" #elif CONFIG_IDF_TARGET_ESP32S2 #include "esp_private/spi_common_internal.h" #endif @@ -257,7 +256,6 @@ TEST_CASE("DAC_dma_convert_frequency_test", "[dac]") gpio_set_direction(GPIO_NUM_4, GPIO_MODE_INPUT_OUTPUT); // The DAC conversion frequency is equal to I2S bclk. esp_rom_gpio_connect_out_signal(GPIO_NUM_4, i2s_periph_signal[0].m_tx_ws_sig, 0, 0); - esp_rom_gpio_connect_in_signal(GPIO_NUM_4, soc_pcnt_signals[0].units[0].channels[0].pulse_sig_id_matrix, 0); size_t len = 800; uint8_t data[len]; diff --git a/components/esp_driver_i2c/i2c_common.c b/components/esp_driver_i2c/i2c_common.c index 8880bdcfd5..c938adc111 100644 --- a/components/esp_driver_i2c/i2c_common.c +++ b/components/esp_driver_i2c/i2c_common.c @@ -23,7 +23,7 @@ #include "i2c_private.h" #include "driver/gpio.h" #include "soc/clk_tree_defs.h" -#include "soc/i2c_periph.h" +#include "hal/i2c_periph.h" #include "esp_clk_tree.h" #include "clk_ctrl_os.h" #include "esp_private/gpio.h" diff --git a/components/esp_driver_i2c/i2c_master.c b/components/esp_driver_i2c/i2c_master.c index e3eec56d47..2a761acd46 100644 --- a/components/esp_driver_i2c/i2c_master.c +++ b/components/esp_driver_i2c/i2c_master.c @@ -21,7 +21,7 @@ #include "esp_intr_alloc.h" #include "freertos/FreeRTOS.h" #include "freertos/semphr.h" -#include "soc/i2c_periph.h" +#include "hal/i2c_periph.h" #include "esp_private/periph_ctrl.h" #include "esp_private/esp_clk.h" #include "esp_rom_gpio.h" diff --git a/components/esp_driver_i2s/test_apps/i2s/main/test_i2s.c b/components/esp_driver_i2s/test_apps/i2s/main/test_i2s.c index 77a2770296..417d0d5fe3 100644 --- a/components/esp_driver_i2s/test_apps/i2s/main/test_i2s.c +++ b/components/esp_driver_i2s/test_apps/i2s/main/test_i2s.c @@ -32,7 +32,7 @@ #include "esp_private/i2s_platform.h" #if SOC_PCNT_SUPPORTED #include "driver/pulse_cnt.h" -#include "soc/pcnt_periph.h" +#include "hal/pcnt_periph.h" #endif #include "../../test_inc/test_i2s.h" diff --git a/components/esp_driver_pcnt/CMakeLists.txt b/components/esp_driver_pcnt/CMakeLists.txt index 5a0474cac6..ec9303b44f 100644 --- a/components/esp_driver_pcnt/CMakeLists.txt +++ b/components/esp_driver_pcnt/CMakeLists.txt @@ -6,6 +6,7 @@ if(CONFIG_SOC_PCNT_SUPPORTED) list(APPEND srcs "src/pulse_cnt.c") endif() +set(requires esp_hal_pcnt) if(${target} STREQUAL "linux") set(priv_requires "") else() @@ -14,6 +15,7 @@ endif() idf_component_register(SRCS ${srcs} INCLUDE_DIRS ${public_include} + REQUIRES "${requires}" PRIV_REQUIRES "${priv_requires}" LDFRAGMENTS "linker.lf" ) diff --git a/components/esp_driver_pcnt/src/pulse_cnt.c b/components/esp_driver_pcnt/src/pulse_cnt.c index b9daab3090..3782915562 100644 --- a/components/esp_driver_pcnt/src/pulse_cnt.c +++ b/components/esp_driver_pcnt/src/pulse_cnt.c @@ -21,7 +21,7 @@ #include "esp_pm.h" #include "esp_rom_gpio.h" #include "soc/soc_caps.h" -#include "soc/pcnt_periph.h" +#include "hal/pcnt_periph.h" #include "soc/gpio_pins.h" #include "hal/pcnt_hal.h" #include "hal/pcnt_ll.h" @@ -75,8 +75,8 @@ typedef struct pcnt_chan_t pcnt_chan_t; struct pcnt_platform_t { _lock_t mutex; // platform level mutex lock - pcnt_group_t *groups[SOC_PCNT_ATTR(INST_NUM)]; // pcnt group pool - int group_ref_counts[SOC_PCNT_ATTR(INST_NUM)]; // reference count used to protect group install/uninstall + pcnt_group_t *groups[PCNT_LL_GET(INST_NUM)]; // pcnt group pool + int group_ref_counts[PCNT_LL_GET(INST_NUM)]; // reference count used to protect group install/uninstall }; struct pcnt_group_t { @@ -85,7 +85,7 @@ struct pcnt_group_t { pcnt_clock_source_t clk_src; // PCNT clock source portMUX_TYPE spinlock; // to protect per-group register level concurrent access pcnt_hal_context_t hal; - pcnt_unit_t *units[SOC_PCNT_ATTR(UNITS_PER_INST)]; // array of PCNT units + pcnt_unit_t *units[PCNT_LL_GET(UNITS_PER_INST)]; // array of PCNT units #if CONFIG_PM_ENABLE esp_pm_lock_handle_t pm_lock; // power management lock #endif @@ -120,7 +120,7 @@ struct pcnt_unit_t { int clear_signal_gpio_num; // which gpio clear signal input int accum_value; // accumulated count value pcnt_step_interval_t step_info; // step interval info - pcnt_chan_t *channels[SOC_PCNT_ATTR(CHANS_PER_UNIT)]; // array of PCNT channels + pcnt_chan_t *channels[PCNT_LL_GET(CHANS_PER_UNIT)]; // array of PCNT channels pcnt_watch_point_t watchers[PCNT_LL_WATCH_EVENT_MAX]; // array of PCNT watchers intr_handle_t intr; // interrupt handle pcnt_unit_fsm_t fsm; // record PCNT unit's driver state @@ -154,12 +154,12 @@ static esp_err_t pcnt_register_to_group(pcnt_unit_t *unit) { pcnt_group_t *group = NULL; int unit_id = -1; - for (int i = 0; i < SOC_PCNT_ATTR(INST_NUM); i++) { + for (int i = 0; i < PCNT_LL_GET(INST_NUM); i++) { group = pcnt_acquire_group_handle(i); ESP_RETURN_ON_FALSE(group, ESP_ERR_NO_MEM, TAG, "no mem for group (%d)", i); // loop to search free unit in the group portENTER_CRITICAL(&group->spinlock); - for (int j = 0; j < SOC_PCNT_ATTR(UNITS_PER_INST); j++) { + for (int j = 0; j < PCNT_LL_GET(UNITS_PER_INST); j++) { if (!group->units[j]) { unit_id = j; group->units[j] = unit; @@ -324,7 +324,7 @@ esp_err_t pcnt_del_unit(pcnt_unit_handle_t unit) int group_id = group->group_id; int unit_id = unit->unit_id; - for (int i = 0; i < SOC_PCNT_ATTR(CHANS_PER_UNIT); i++) { + for (int i = 0; i < PCNT_LL_GET(CHANS_PER_UNIT); i++) { ESP_RETURN_ON_FALSE(!unit->channels[i], ESP_ERR_INVALID_STATE, TAG, "channel %d still in working", i); } @@ -607,7 +607,7 @@ esp_err_t pcnt_unit_add_watch_point(pcnt_unit_handle_t unit, int watch_point) } // other threshold watch point else { - int thres_num = SOC_PCNT_ATTR(THRES_POINT_PER_UNIT) - 1; + int thres_num = PCNT_LL_GET(THRES_POINT_PER_UNIT) - 1; switch (thres_num) { case 1: if (unit->watchers[PCNT_LL_WATCH_EVENT_THRES1].event_id == PCNT_LL_WATCH_EVENT_INVALID) { @@ -794,7 +794,7 @@ esp_err_t pcnt_new_channel(pcnt_unit_handle_t unit, const pcnt_chan_config_t *co // search for a free channel int channel_id = -1; portENTER_CRITICAL(&unit->spinlock); - for (int i = 0; i < SOC_PCNT_ATTR(CHANS_PER_UNIT); i++) { + for (int i = 0; i < PCNT_LL_GET(CHANS_PER_UNIT); i++) { if (!unit->channels[i]) { channel_id = i; unit->channels[channel_id] = channel; diff --git a/components/esp_driver_pcnt/test_apps/pulse_cnt/CMakeLists.txt b/components/esp_driver_pcnt/test_apps/pulse_cnt/CMakeLists.txt index 153e442fc4..cff5e4f2bb 100644 --- a/components/esp_driver_pcnt/test_apps/pulse_cnt/CMakeLists.txt +++ b/components/esp_driver_pcnt/test_apps/pulse_cnt/CMakeLists.txt @@ -9,9 +9,19 @@ project(pcnt_test) idf_build_get_property(elf EXECUTABLE) if(CONFIG_COMPILER_DUMP_RTL_FILES) + + # Collect RTL directories in a variable for readability. Join them + # with commas so they are passed as a single --rtl-dirs argument to the script. + set(PCNT_RTL_DIRS + ${CMAKE_BINARY_DIR}/esp-idf/esp_driver_pcnt + ${CMAKE_BINARY_DIR}/esp-idf/hal + ${CMAKE_BINARY_DIR}/esp-idf/esp_hal_pcnt + ) + string(JOIN "," PCNT_RTL_DIRS_JOINED ${PCNT_RTL_DIRS}) + 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/esp_driver_pcnt/,${CMAKE_BINARY_DIR}/esp-idf/hal/ + --rtl-dirs ${PCNT_RTL_DIRS_JOINED} --elf-file ${CMAKE_BINARY_DIR}/pcnt_test.elf find-refs --from-sections=.iram0.text diff --git a/components/esp_driver_pcnt/test_apps/pulse_cnt/main/test_pulse_cnt.c b/components/esp_driver_pcnt/test_apps/pulse_cnt/main/test_pulse_cnt.c index 057405fbd6..543b1d3a92 100644 --- a/components/esp_driver_pcnt/test_apps/pulse_cnt/main/test_pulse_cnt.c +++ b/components/esp_driver_pcnt/test_apps/pulse_cnt/main/test_pulse_cnt.c @@ -10,7 +10,7 @@ #include "freertos/task.h" #include "unity.h" #include "soc/soc_caps.h" -#include "soc/pcnt_periph.h" +#include "hal/pcnt_periph.h" #include "hal/pcnt_ll.h" #include "driver/pulse_cnt.h" #include "driver/gpio.h" @@ -24,11 +24,11 @@ TEST_CASE("pcnt_unit_install_uninstall", "[pcnt]") .high_limit = 100, .intr_priority = 0, }; - pcnt_unit_handle_t units[SOC_PCNT_ATTR(UNITS_PER_INST)]; + pcnt_unit_handle_t units[PCNT_LL_GET(UNITS_PER_INST)]; int count_value = 0; printf("install pcnt units and check initial count\r\n"); - for (int i = 0; i < SOC_PCNT_ATTR(UNITS_PER_INST) - 1; i++) { + for (int i = 0; i < PCNT_LL_GET(UNITS_PER_INST) - 1; i++) { TEST_ESP_OK(pcnt_new_unit(&unit_config, &units[i])); TEST_ESP_OK(pcnt_unit_get_count(units[i], &count_value)); TEST_ASSERT_EQUAL(0, count_value); @@ -36,9 +36,9 @@ TEST_CASE("pcnt_unit_install_uninstall", "[pcnt]") // unit with a different interrupt priority unit_config.intr_priority = 3; - TEST_ESP_ERR(ESP_ERR_INVALID_STATE, pcnt_new_unit(&unit_config, &units[SOC_PCNT_ATTR(UNITS_PER_INST) - 1])); + TEST_ESP_ERR(ESP_ERR_INVALID_STATE, pcnt_new_unit(&unit_config, &units[PCNT_LL_GET(UNITS_PER_INST) - 1])); unit_config.intr_priority = 0; - TEST_ESP_OK(pcnt_new_unit(&unit_config, &units[SOC_PCNT_ATTR(UNITS_PER_INST) - 1])); + TEST_ESP_OK(pcnt_new_unit(&unit_config, &units[PCNT_LL_GET(UNITS_PER_INST) - 1])); // no more free pcnt units TEST_ASSERT_EQUAL(ESP_ERR_NOT_FOUND, pcnt_new_unit(&unit_config, &units[0])); @@ -47,7 +47,7 @@ TEST_CASE("pcnt_unit_install_uninstall", "[pcnt]") pcnt_glitch_filter_config_t filter_config = { .max_glitch_ns = 1000, }; - for (int i = 0; i < SOC_PCNT_ATTR(UNITS_PER_INST); i++) { + for (int i = 0; i < PCNT_LL_GET(UNITS_PER_INST); i++) { TEST_ESP_OK(pcnt_unit_set_glitch_filter(units[i], &filter_config)); } // invalid glitch configuration @@ -57,30 +57,30 @@ TEST_CASE("pcnt_unit_install_uninstall", "[pcnt]") .on_reach = NULL, }; printf("enable pcnt units\r\n"); - for (int i = 0; i < SOC_PCNT_ATTR(UNITS_PER_INST); i++) { + for (int i = 0; i < PCNT_LL_GET(UNITS_PER_INST); i++) { TEST_ESP_OK(pcnt_unit_register_event_callbacks(units[i], &cbs, NULL)); TEST_ESP_OK(pcnt_unit_enable(units[i])); } printf("start pcnt units\r\n"); - for (int i = 0; i < SOC_PCNT_ATTR(UNITS_PER_INST); i++) { + for (int i = 0; i < PCNT_LL_GET(UNITS_PER_INST); i++) { TEST_ESP_OK(pcnt_unit_start(units[i])); } printf("stop pcnt units\r\n"); - for (int i = 0; i < SOC_PCNT_ATTR(UNITS_PER_INST); i++) { + for (int i = 0; i < PCNT_LL_GET(UNITS_PER_INST); i++) { TEST_ESP_OK(pcnt_unit_stop(units[i])); } // can't uninstall unit before disable it TEST_ASSERT_EQUAL(ESP_ERR_INVALID_STATE, pcnt_del_unit(units[0])); printf("disable pcnt units\r\n"); - for (int i = 0; i < SOC_PCNT_ATTR(UNITS_PER_INST); i++) { + for (int i = 0; i < PCNT_LL_GET(UNITS_PER_INST); i++) { TEST_ESP_OK(pcnt_unit_disable(units[i])); } printf("uninstall pcnt units\r\n"); - for (int i = 0; i < SOC_PCNT_ATTR(UNITS_PER_INST); i++) { + for (int i = 0; i < PCNT_LL_GET(UNITS_PER_INST); i++) { TEST_ESP_OK(pcnt_del_unit(units[i])); } } @@ -97,17 +97,17 @@ TEST_CASE("pcnt_channel_install_uninstall", "[pcnt]") .edge_gpio_num = TEST_PCNT_GPIO_A, // only detect edge signal in this case .level_gpio_num = -1, }; - pcnt_unit_handle_t units[SOC_PCNT_ATTR(UNITS_PER_INST)]; - pcnt_channel_handle_t chans[SOC_PCNT_ATTR(UNITS_PER_INST)][SOC_PCNT_ATTR(CHANS_PER_UNIT)]; + pcnt_unit_handle_t units[PCNT_LL_GET(UNITS_PER_INST)]; + pcnt_channel_handle_t chans[PCNT_LL_GET(UNITS_PER_INST)][PCNT_LL_GET(CHANS_PER_UNIT)]; printf("install pcnt units\r\n"); - for (int i = 0; i < SOC_PCNT_ATTR(UNITS_PER_INST); i++) { + for (int i = 0; i < PCNT_LL_GET(UNITS_PER_INST); i++) { TEST_ESP_OK(pcnt_new_unit(&unit_config, &units[i])); } printf("install pcnt channels\r\n"); - for (int i = 0; i < SOC_PCNT_ATTR(UNITS_PER_INST); i++) { - for (int j = 0; j < SOC_PCNT_ATTR(CHANS_PER_UNIT); j++) { + for (int i = 0; i < PCNT_LL_GET(UNITS_PER_INST); i++) { + for (int j = 0; j < PCNT_LL_GET(CHANS_PER_UNIT); j++) { TEST_ESP_OK(pcnt_new_channel(units[i], &chan_config, &chans[i][j])); TEST_ESP_OK(pcnt_channel_set_edge_action(chans[i][j], PCNT_CHANNEL_EDGE_ACTION_INCREASE, PCNT_CHANNEL_EDGE_ACTION_HOLD)); TEST_ESP_OK(pcnt_channel_set_level_action(chans[i][j], PCNT_CHANNEL_LEVEL_ACTION_KEEP, PCNT_CHANNEL_LEVEL_ACTION_KEEP)); @@ -118,55 +118,55 @@ TEST_CASE("pcnt_channel_install_uninstall", "[pcnt]") printf("start units\r\n"); int count_value = 0; - for (int i = 0; i < SOC_PCNT_ATTR(UNITS_PER_INST); i++) { + for (int i = 0; i < PCNT_LL_GET(UNITS_PER_INST); i++) { // start unit TEST_ESP_OK(pcnt_unit_start(units[i])); // trigger 10 rising edge on GPIO0 test_gpio_simulate_rising_edge(TEST_PCNT_GPIO_A, 10); TEST_ESP_OK(pcnt_unit_get_count(units[i], &count_value)); // each channel increases to the same unit counter - TEST_ASSERT_EQUAL(10 * SOC_PCNT_ATTR(CHANS_PER_UNIT), count_value); + TEST_ASSERT_EQUAL(10 * PCNT_LL_GET(CHANS_PER_UNIT), count_value); } printf("clear counts\r\n"); - for (int i = 0; i < SOC_PCNT_ATTR(UNITS_PER_INST); i++) { + for (int i = 0; i < PCNT_LL_GET(UNITS_PER_INST); i++) { TEST_ESP_OK(pcnt_unit_clear_count(units[i])); TEST_ESP_OK(pcnt_unit_get_count(units[i], &count_value)); TEST_ASSERT_EQUAL(0, count_value); } printf("stop unit\r\n"); - for (int i = 0; i < SOC_PCNT_ATTR(UNITS_PER_INST); i++) { + for (int i = 0; i < PCNT_LL_GET(UNITS_PER_INST); i++) { // stop unit TEST_ESP_OK(pcnt_unit_stop(units[i])); } // trigger 10 rising edge on GPIO0 shouldn't increase the counter test_gpio_simulate_rising_edge(TEST_PCNT_GPIO_A, 10); - for (int i = 0; i < SOC_PCNT_ATTR(UNITS_PER_INST); i++) { + for (int i = 0; i < PCNT_LL_GET(UNITS_PER_INST); i++) { TEST_ESP_OK(pcnt_unit_get_count(units[i], &count_value)); TEST_ASSERT_EQUAL(0, count_value); } printf("restart units\r\n"); - for (int i = 0; i < SOC_PCNT_ATTR(UNITS_PER_INST); i++) { + for (int i = 0; i < PCNT_LL_GET(UNITS_PER_INST); i++) { // start unit TEST_ESP_OK(pcnt_unit_start(units[i])); // trigger 10 rising edge on GPIO test_gpio_simulate_rising_edge(TEST_PCNT_GPIO_A, 10); TEST_ESP_OK(pcnt_unit_get_count(units[i], &count_value)); // each channel increases to the same unit counter - TEST_ASSERT_EQUAL(10 * SOC_PCNT_ATTR(CHANS_PER_UNIT), count_value); + TEST_ASSERT_EQUAL(10 * PCNT_LL_GET(CHANS_PER_UNIT), count_value); } printf("uninstall channels and units\r\n"); - for (int i = 0; i < SOC_PCNT_ATTR(UNITS_PER_INST); i++) { + for (int i = 0; i < PCNT_LL_GET(UNITS_PER_INST); i++) { // stop unit TEST_ESP_OK(pcnt_unit_stop(units[i])); TEST_ESP_OK(pcnt_unit_disable(units[i])); // can't uninstall unit when channel is still alive TEST_ASSERT_EQUAL(ESP_ERR_INVALID_STATE, pcnt_del_unit(units[i])); - for (int j = 0; j < SOC_PCNT_ATTR(CHANS_PER_UNIT); j++) { + for (int j = 0; j < PCNT_LL_GET(CHANS_PER_UNIT); j++) { TEST_ESP_OK(pcnt_del_channel(chans[i][j])); } TEST_ESP_OK(pcnt_del_unit(units[i])); diff --git a/components/esp_hal_i2c/esp32/i2c_periph.c b/components/esp_hal_i2c/esp32/i2c_periph.c index 4a440fca4d..243279b51b 100644 --- a/components/esp_hal_i2c/esp32/i2c_periph.c +++ b/components/esp_hal_i2c/esp32/i2c_periph.c @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include "soc/i2c_periph.h" +#include "hal/i2c_periph.h" #include "soc/gpio_sig_map.h" /* diff --git a/components/esp_hal_i2c/esp32/include/hal/i2c_ll.h b/components/esp_hal_i2c/esp32/include/hal/i2c_ll.h index b8ea21965c..564bd1f799 100644 --- a/components/esp_hal_i2c/esp32/include/hal/i2c_ll.h +++ b/components/esp_hal_i2c/esp32/include/hal/i2c_ll.h @@ -10,7 +10,7 @@ #include #include "hal/misc.h" -#include "soc/i2c_periph.h" +#include "hal/i2c_periph.h" #include "soc/i2c_struct.h" #include "soc/clk_tree_defs.h" #include "soc/dport_reg.h" diff --git a/components/esp_hal_i2c/esp32c2/i2c_periph.c b/components/esp_hal_i2c/esp32c2/i2c_periph.c index 4df019865b..528bdec964 100644 --- a/components/esp_hal_i2c/esp32c2/i2c_periph.c +++ b/components/esp_hal_i2c/esp32c2/i2c_periph.c @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include "soc/i2c_periph.h" +#include "hal/i2c_periph.h" #include "soc/gpio_sig_map.h" /* diff --git a/components/esp_hal_i2c/esp32c2/include/hal/i2c_ll.h b/components/esp_hal_i2c/esp32c2/include/hal/i2c_ll.h index b5a02817af..b2a20de0bc 100644 --- a/components/esp_hal_i2c/esp32c2/include/hal/i2c_ll.h +++ b/components/esp_hal_i2c/esp32c2/include/hal/i2c_ll.h @@ -11,7 +11,7 @@ #include #include "hal/misc.h" #include "hal/assert.h" -#include "soc/i2c_periph.h" +#include "hal/i2c_periph.h" #include "soc/soc_caps.h" #include "soc/i2c_struct.h" #include "hal/i2c_types.h" diff --git a/components/esp_hal_i2c/esp32c3/i2c_periph.c b/components/esp_hal_i2c/esp32c3/i2c_periph.c index 6f18557a3a..a4a8e1881b 100644 --- a/components/esp_hal_i2c/esp32c3/i2c_periph.c +++ b/components/esp_hal_i2c/esp32c3/i2c_periph.c @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include "soc/i2c_periph.h" +#include "hal/i2c_periph.h" #include "soc/gpio_sig_map.h" /* diff --git a/components/esp_hal_i2c/esp32c3/include/hal/i2c_ll.h b/components/esp_hal_i2c/esp32c3/include/hal/i2c_ll.h index 687ea77e6b..6bb29f24b2 100644 --- a/components/esp_hal_i2c/esp32c3/include/hal/i2c_ll.h +++ b/components/esp_hal_i2c/esp32c3/include/hal/i2c_ll.h @@ -11,7 +11,7 @@ #include "stdbool.h" #include "hal/misc.h" #include "hal/assert.h" -#include "soc/i2c_periph.h" +#include "hal/i2c_periph.h" #include "soc/soc_caps.h" #include "soc/i2c_struct.h" #include "hal/i2c_types.h" diff --git a/components/esp_hal_i2c/esp32c5/i2c_periph.c b/components/esp_hal_i2c/esp32c5/i2c_periph.c index 4436a046c5..c2d5a00a82 100644 --- a/components/esp_hal_i2c/esp32c5/i2c_periph.c +++ b/components/esp_hal_i2c/esp32c5/i2c_periph.c @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include "soc/i2c_periph.h" +#include "hal/i2c_periph.h" #include "soc/gpio_sig_map.h" #define LP_I2C_MUX_FUNC (3) diff --git a/components/esp_hal_i2c/esp32c5/include/hal/i2c_ll.h b/components/esp_hal_i2c/esp32c5/include/hal/i2c_ll.h index a13d5962a2..9e583ad05c 100644 --- a/components/esp_hal_i2c/esp32c5/include/hal/i2c_ll.h +++ b/components/esp_hal_i2c/esp32c5/include/hal/i2c_ll.h @@ -12,7 +12,7 @@ #include "soc/soc_caps.h" #include "hal/misc.h" #include "hal/assert.h" -#include "soc/i2c_periph.h" +#include "hal/i2c_periph.h" #include "soc/soc_caps.h" #include "soc/i2c_struct.h" #include "soc/pcr_struct.h" diff --git a/components/esp_hal_i2c/esp32c6/i2c_periph.c b/components/esp_hal_i2c/esp32c6/i2c_periph.c index 2d03a38dbe..a51c5b821c 100644 --- a/components/esp_hal_i2c/esp32c6/i2c_periph.c +++ b/components/esp_hal_i2c/esp32c6/i2c_periph.c @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include "soc/i2c_periph.h" +#include "hal/i2c_periph.h" #include "soc/gpio_sig_map.h" #include "soc/regdma.h" #include "soc/i2c_reg.h" diff --git a/components/esp_hal_i2c/esp32c6/include/hal/i2c_ll.h b/components/esp_hal_i2c/esp32c6/include/hal/i2c_ll.h index 571034b050..70feb45eea 100644 --- a/components/esp_hal_i2c/esp32c6/include/hal/i2c_ll.h +++ b/components/esp_hal_i2c/esp32c6/include/hal/i2c_ll.h @@ -11,7 +11,7 @@ #include #include "hal/misc.h" #include "hal/assert.h" -#include "soc/i2c_periph.h" +#include "hal/i2c_periph.h" #include "soc/soc_caps.h" #include "soc/i2c_struct.h" #include "soc/pcr_struct.h" diff --git a/components/esp_hal_i2c/esp32c61/i2c_periph.c b/components/esp_hal_i2c/esp32c61/i2c_periph.c index 63369e2810..951b665d03 100644 --- a/components/esp_hal_i2c/esp32c61/i2c_periph.c +++ b/components/esp_hal_i2c/esp32c61/i2c_periph.c @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include "soc/i2c_periph.h" +#include "hal/i2c_periph.h" #include "soc/gpio_sig_map.h" /* diff --git a/components/esp_hal_i2c/esp32c61/include/hal/i2c_ll.h b/components/esp_hal_i2c/esp32c61/include/hal/i2c_ll.h index 5e50d96967..0f23e2f418 100644 --- a/components/esp_hal_i2c/esp32c61/include/hal/i2c_ll.h +++ b/components/esp_hal_i2c/esp32c61/include/hal/i2c_ll.h @@ -12,7 +12,7 @@ #include "soc/soc_caps.h" #include "hal/misc.h" #include "hal/assert.h" -#include "soc/i2c_periph.h" +#include "hal/i2c_periph.h" #include "soc/soc_caps.h" #include "soc/i2c_struct.h" #include "soc/pcr_struct.h" diff --git a/components/esp_hal_i2c/esp32h2/i2c_periph.c b/components/esp_hal_i2c/esp32h2/i2c_periph.c index 7c629655b5..b39d28e18b 100644 --- a/components/esp_hal_i2c/esp32h2/i2c_periph.c +++ b/components/esp_hal_i2c/esp32h2/i2c_periph.c @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include "soc/i2c_periph.h" +#include "hal/i2c_periph.h" #include "soc/gpio_sig_map.h" #include "soc/regdma.h" #include "soc/i2c_reg.h" diff --git a/components/esp_hal_i2c/esp32h2/include/hal/i2c_ll.h b/components/esp_hal_i2c/esp32h2/include/hal/i2c_ll.h index e0e8334f93..51689ac1c9 100644 --- a/components/esp_hal_i2c/esp32h2/include/hal/i2c_ll.h +++ b/components/esp_hal_i2c/esp32h2/include/hal/i2c_ll.h @@ -11,7 +11,7 @@ #include #include "hal/misc.h" #include "hal/assert.h" -#include "soc/i2c_periph.h" +#include "hal/i2c_periph.h" #include "soc/soc_caps.h" #include "soc/i2c_struct.h" #include "soc/pcr_struct.h" diff --git a/components/esp_hal_i2c/esp32h21/i2c_periph.c b/components/esp_hal_i2c/esp32h21/i2c_periph.c index 5633761438..bc8a9bdffd 100644 --- a/components/esp_hal_i2c/esp32h21/i2c_periph.c +++ b/components/esp_hal_i2c/esp32h21/i2c_periph.c @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include "soc/i2c_periph.h" +#include "hal/i2c_periph.h" #include "soc/gpio_sig_map.h" /* diff --git a/components/esp_hal_i2c/esp32h21/include/hal/i2c_ll.h b/components/esp_hal_i2c/esp32h21/include/hal/i2c_ll.h index 903a77fec6..9d98296b30 100644 --- a/components/esp_hal_i2c/esp32h21/include/hal/i2c_ll.h +++ b/components/esp_hal_i2c/esp32h21/include/hal/i2c_ll.h @@ -11,7 +11,7 @@ #include #include "hal/misc.h" #include "hal/assert.h" -#include "soc/i2c_periph.h" +#include "hal/i2c_periph.h" #include "soc/i2c_struct.h" #include "soc/pcr_struct.h" #include "hal/i2c_types.h" diff --git a/components/esp_hal_i2c/esp32h4/i2c_periph.c b/components/esp_hal_i2c/esp32h4/i2c_periph.c index 30662b6b27..73f672d978 100644 --- a/components/esp_hal_i2c/esp32h4/i2c_periph.c +++ b/components/esp_hal_i2c/esp32h4/i2c_periph.c @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include "soc/i2c_periph.h" +#include "hal/i2c_periph.h" #include "soc/gpio_sig_map.h" #include "soc/regdma.h" #include "soc/i2c_reg.h" diff --git a/components/esp_hal_i2c/esp32h4/include/hal/i2c_ll.h b/components/esp_hal_i2c/esp32h4/include/hal/i2c_ll.h index a1d0bb9a98..47bea5c970 100644 --- a/components/esp_hal_i2c/esp32h4/include/hal/i2c_ll.h +++ b/components/esp_hal_i2c/esp32h4/include/hal/i2c_ll.h @@ -11,7 +11,7 @@ #include #include "hal/misc.h" #include "hal/assert.h" -#include "soc/i2c_periph.h" +#include "hal/i2c_periph.h" #include "soc/soc_caps.h" #include "soc/i2c_struct.h" #include "soc/pcr_struct.h" diff --git a/components/esp_hal_i2c/esp32p4/i2c_periph.c b/components/esp_hal_i2c/esp32p4/i2c_periph.c index 6bf7b35482..e4365e6b41 100644 --- a/components/esp_hal_i2c/esp32p4/i2c_periph.c +++ b/components/esp_hal_i2c/esp32p4/i2c_periph.c @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include "soc/i2c_periph.h" +#include "hal/i2c_periph.h" #include "soc/gpio_sig_map.h" #include "soc/lp_gpio_sig_map.h" diff --git a/components/esp_hal_i2c/esp32p4/include/hal/i2c_ll.h b/components/esp_hal_i2c/esp32p4/include/hal/i2c_ll.h index db62795bbb..403ef15119 100644 --- a/components/esp_hal_i2c/esp32p4/include/hal/i2c_ll.h +++ b/components/esp_hal_i2c/esp32p4/include/hal/i2c_ll.h @@ -11,7 +11,7 @@ #include #include "hal/misc.h" #include "hal/assert.h" -#include "soc/i2c_periph.h" +#include "hal/i2c_periph.h" #include "soc/soc_caps.h" #include "soc/i2c_struct.h" #include "hal/i2c_types.h" diff --git a/components/esp_hal_i2c/esp32s2/i2c_periph.c b/components/esp_hal_i2c/esp32s2/i2c_periph.c index 4a440fca4d..243279b51b 100644 --- a/components/esp_hal_i2c/esp32s2/i2c_periph.c +++ b/components/esp_hal_i2c/esp32s2/i2c_periph.c @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include "soc/i2c_periph.h" +#include "hal/i2c_periph.h" #include "soc/gpio_sig_map.h" /* diff --git a/components/esp_hal_i2c/esp32s2/include/hal/i2c_ll.h b/components/esp_hal_i2c/esp32s2/include/hal/i2c_ll.h index 0949cb3939..28831bc8a8 100644 --- a/components/esp_hal_i2c/esp32s2/include/hal/i2c_ll.h +++ b/components/esp_hal_i2c/esp32s2/include/hal/i2c_ll.h @@ -8,7 +8,7 @@ #pragma once #include -#include "soc/i2c_periph.h" +#include "hal/i2c_periph.h" #include "soc/i2c_struct.h" #include "soc/clk_tree_defs.h" #include "soc/system_reg.h" diff --git a/components/esp_hal_i2c/esp32s3/i2c_periph.c b/components/esp_hal_i2c/esp32s3/i2c_periph.c index 4a440fca4d..243279b51b 100644 --- a/components/esp_hal_i2c/esp32s3/i2c_periph.c +++ b/components/esp_hal_i2c/esp32s3/i2c_periph.c @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include "soc/i2c_periph.h" +#include "hal/i2c_periph.h" #include "soc/gpio_sig_map.h" /* diff --git a/components/esp_hal_i2c/esp32s3/include/hal/i2c_ll.h b/components/esp_hal_i2c/esp32s3/include/hal/i2c_ll.h index 6b172a7702..20ccff5a19 100644 --- a/components/esp_hal_i2c/esp32s3/include/hal/i2c_ll.h +++ b/components/esp_hal_i2c/esp32s3/include/hal/i2c_ll.h @@ -11,7 +11,7 @@ #include "stdbool.h" #include "hal/misc.h" #include "hal/assert.h" -#include "soc/i2c_periph.h" +#include "hal/i2c_periph.h" #include "soc/soc_caps.h" #include "soc/i2c_struct.h" #include "soc/clk_tree_defs.h" diff --git a/components/esp_hal_i2c/include/soc/i2c_periph.h b/components/esp_hal_i2c/include/hal/i2c_periph.h similarity index 100% rename from components/esp_hal_i2c/include/soc/i2c_periph.h rename to components/esp_hal_i2c/include/hal/i2c_periph.h diff --git a/components/esp_hal_pcnt/CMakeLists.txt b/components/esp_hal_pcnt/CMakeLists.txt new file mode 100644 index 0000000000..a2ab249822 --- /dev/null +++ b/components/esp_hal_pcnt/CMakeLists.txt @@ -0,0 +1,21 @@ +idf_build_get_property(target IDF_TARGET) + +if(${target} STREQUAL "linux") + return() # This component is not supported by the POSIX/Linux simulator +endif() + +set(srcs) +set(includes "include") + +if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/${target}/include") + list(APPEND includes "${target}/include") +endif() + +# PCNT related source files +if(CONFIG_SOC_PCNT_SUPPORTED) + list(APPEND srcs "pcnt_hal.c" "${target}/pcnt_periph.c") +endif() + +idf_component_register(SRCS ${srcs} + INCLUDE_DIRS ${includes} + REQUIRES soc hal) diff --git a/components/esp_hal_pcnt/README.md b/components/esp_hal_pcnt/README.md new file mode 100644 index 0000000000..c4c9b474a1 --- /dev/null +++ b/components/esp_hal_pcnt/README.md @@ -0,0 +1,56 @@ +# ESP Hardware Abstraction Layer for PCNT Peripherals + +> [!NOTE] +> This component is currently in beta. Its API, behavior, and compatibility may change at any time and without notice; backward compatibility is not guaranteed. Use caution when integrating into production systems. + +## Overview + +The `esp_hal_pcnt` component provides a **Hardware Abstraction Layer** for PCNT (Pulse Counter) peripherals across ESP-IDF supported targets. This HAL enables efficient counting of external pulses and signals, with support for quadrature encoders, frequency measurement, and position tracking applications. + +## Architecture + +The PCNT HAL is structured in two main sub-layers: + +1. **HAL Layer (Upper)**: Defines the operational steps and data structures required to control PCNT peripherals (e.g., initialization). + +2. **Low-Level Layer (Bottom)**: Serves as a translation layer between the HAL and the register files defined in the `soc` component, handling target-specific register configurations. + +## Features + +### Core Counting Features +- Bidirectional pulse counting (increment/decrement) +- Configurable counting range with high/low limits +- Counter value read operations +- Counter clear and reset functionality +- Start/stop control for counting operations + +### Channel Configuration +- Edge action configuration: + - Hold: Keep current count value + - Increase: Increment count value + - Decrease: Decrement count value +- Level action configuration: + - Keep: Maintain current count mode + - Inverse: Invert count direction + - Hold: Freeze count value + +### Event Detection +- Threshold events +- High/low limit events +- Zero-crossing events +- Watch-point events +- Step events + +### Signal Processing +- Glitch filtering with configurable filter width + +## Usage + +The HAL functions primarily serve ESP-IDF PCNT peripheral drivers such as `esp_driver_pcnt` component. + +Advanced developers can use these interfaces directly when implementing custom pulse counting applications, with the understanding that API stability is not guaranteed. + +## Dependencies + +- `soc`: Provides chip-specific register definitions and peripheral capabilities +- `hal`: Core hardware abstraction utilities and macros diff --git a/components/hal/esp32/include/hal/pcnt_ll.h b/components/esp_hal_pcnt/esp32/include/hal/pcnt_ll.h similarity index 96% rename from components/hal/esp32/include/hal/pcnt_ll.h rename to components/esp_hal_pcnt/esp32/include/hal/pcnt_ll.h index 5a589c9001..db186c03ec 100644 --- a/components/hal/esp32/include/hal/pcnt_ll.h +++ b/components/esp_hal_pcnt/esp32/include/hal/pcnt_ll.h @@ -29,6 +29,9 @@ extern "C" { #endif +// Get PCNT attribute +#define PCNT_LL_GET(attr) (PCNT_LL_ ## attr) + #define PCNT_LL_GET_HW(num) (((num) == 0) ? (&PCNT) : NULL) #define PCNT_LL_MAX_GLITCH_WIDTH 1023 #define PCNT_LL_MAX_LIM SHRT_MAX @@ -44,6 +47,12 @@ typedef enum { PCNT_LL_WATCH_EVENT_MAX } pcnt_ll_watch_event_id_t; +// SoC-based capabilities +#define PCNT_LL_INST_NUM 1 // Number of PCNT instances +#define PCNT_LL_UNITS_PER_INST 8 // Number of units in each PCNT instance +#define PCNT_LL_CHANS_PER_UNIT 2 // Number of channels in each PCNT unit +#define PCNT_LL_THRES_POINT_PER_UNIT 2 // Number of threshold points in each PCNT unit + #define PCNT_LL_WATCH_EVENT_MASK ((1 << PCNT_LL_WATCH_EVENT_MAX) - 1) #define PCNT_LL_UNIT_WATCH_EVENT(unit_id) (1 << (unit_id)) #define PCNT_LL_CLOCK_SUPPORT_APB 1 diff --git a/components/esp_hal_pcnt/esp32/pcnt_periph.c b/components/esp_hal_pcnt/esp32/pcnt_periph.c new file mode 100644 index 0000000000..a85d7c4b94 --- /dev/null +++ b/components/esp_hal_pcnt/esp32/pcnt_periph.c @@ -0,0 +1,114 @@ +/* + * SPDX-FileCopyrightText: 2020-2025 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "hal/pcnt_periph.h" +#include "soc/gpio_sig_map.h" +#include "soc/soc.h" + +const soc_pcnt_signal_desc_t soc_pcnt_signals[1] = { + [0] = { + .irq_id = ETS_PCNT_INTR_SOURCE, + .module_name = "pcnt0", + .units = { + [0] = { + .channels = { + [0] = { + .ctl_sig_id_matrix = PCNT_CTRL_CH0_IN0_IDX, + .pulse_sig_id_matrix = PCNT_SIG_CH0_IN0_IDX + }, + [1] = { + .ctl_sig_id_matrix = PCNT_CTRL_CH1_IN0_IDX, + .pulse_sig_id_matrix = PCNT_SIG_CH1_IN0_IDX + } + } + }, + [1] = { + .channels = { + [0] = { + .ctl_sig_id_matrix = PCNT_CTRL_CH0_IN1_IDX, + .pulse_sig_id_matrix = PCNT_SIG_CH0_IN1_IDX + }, + [1] = { + .ctl_sig_id_matrix = PCNT_CTRL_CH1_IN1_IDX, + .pulse_sig_id_matrix = PCNT_SIG_CH1_IN1_IDX + } + } + }, + [2] = { + .channels = { + [0] = { + .ctl_sig_id_matrix = PCNT_CTRL_CH0_IN2_IDX, + .pulse_sig_id_matrix = PCNT_SIG_CH0_IN2_IDX + }, + [1] = { + .ctl_sig_id_matrix = PCNT_CTRL_CH1_IN2_IDX, + .pulse_sig_id_matrix = PCNT_SIG_CH1_IN2_IDX + } + } + }, + [3] = { + .channels = { + [0] = { + .ctl_sig_id_matrix = PCNT_CTRL_CH0_IN3_IDX, + .pulse_sig_id_matrix = PCNT_SIG_CH0_IN3_IDX + }, + [1] = { + .ctl_sig_id_matrix = PCNT_CTRL_CH1_IN3_IDX, + .pulse_sig_id_matrix = PCNT_SIG_CH1_IN3_IDX + } + } + }, + [4] = { + .channels = { + [0] = { + .ctl_sig_id_matrix = PCNT_CTRL_CH0_IN4_IDX, + .pulse_sig_id_matrix = PCNT_SIG_CH0_IN4_IDX + }, + [1] = { + .ctl_sig_id_matrix = PCNT_CTRL_CH1_IN4_IDX, + .pulse_sig_id_matrix = PCNT_SIG_CH1_IN4_IDX + } + } + }, + [5] = { + .channels = { + [0] = { + .ctl_sig_id_matrix = PCNT_CTRL_CH0_IN5_IDX, + .pulse_sig_id_matrix = PCNT_SIG_CH0_IN5_IDX + }, + [1] = { + .ctl_sig_id_matrix = PCNT_CTRL_CH1_IN5_IDX, + .pulse_sig_id_matrix = PCNT_SIG_CH1_IN5_IDX + } + } + }, + [6] = { + .channels = { + [0] = { + .ctl_sig_id_matrix = PCNT_CTRL_CH0_IN6_IDX, + .pulse_sig_id_matrix = PCNT_SIG_CH0_IN6_IDX + }, + [1] = { + .ctl_sig_id_matrix = PCNT_CTRL_CH1_IN6_IDX, + .pulse_sig_id_matrix = PCNT_SIG_CH1_IN6_IDX + } + } + }, + [7] = { + .channels = { + [0] = { + .ctl_sig_id_matrix = PCNT_CTRL_CH0_IN7_IDX, + .pulse_sig_id_matrix = PCNT_SIG_CH0_IN7_IDX + }, + [1] = { + .ctl_sig_id_matrix = PCNT_CTRL_CH1_IN7_IDX, + .pulse_sig_id_matrix = PCNT_SIG_CH1_IN7_IDX + } + } + } + } + } +}; diff --git a/components/hal/esp32c5/include/hal/pcnt_ll.h b/components/esp_hal_pcnt/esp32c5/include/hal/pcnt_ll.h similarity index 96% rename from components/hal/esp32c5/include/hal/pcnt_ll.h rename to components/esp_hal_pcnt/esp32c5/include/hal/pcnt_ll.h index e7f84e102c..2aa5f59484 100644 --- a/components/hal/esp32c5/include/hal/pcnt_ll.h +++ b/components/esp_hal_pcnt/esp32c5/include/hal/pcnt_ll.h @@ -19,6 +19,9 @@ extern "C" { #endif +// Get PCNT attribute +#define PCNT_LL_GET(attr) (PCNT_LL_ ## attr) + #define PCNT_LL_GET_HW(num) (((num) == 0) ? (&PCNT) : NULL) #define PCNT_LL_MAX_GLITCH_WIDTH 1023 #define PCNT_LL_MAX_LIM SHRT_MAX @@ -39,6 +42,12 @@ typedef enum { PCNT_LL_STEP_EVENT_REACH_INTERVAL_BACKWARD, } pcnt_ll_step_event_id_t; +// SoC-based capabilities +#define PCNT_LL_INST_NUM 1 // Number of PCNT instances +#define PCNT_LL_UNITS_PER_INST 4 // Number of units in each PCNT instance +#define PCNT_LL_CHANS_PER_UNIT 2 // Number of channels in each PCNT unit +#define PCNT_LL_THRES_POINT_PER_UNIT 2 // Number of threshold points in each PCNT unit + #define PCNT_LL_WATCH_EVENT_MASK ((1 << PCNT_LL_WATCH_EVENT_MAX) - 1) #define PCNT_LL_UNIT_WATCH_EVENT(unit_id) (1 << (unit_id)) #define PCNT_LL_CLOCK_SUPPORT_APB 1 @@ -512,7 +521,6 @@ static inline bool pcnt_ll_is_step_notify_supported(int group_id) return true; } - #ifdef __cplusplus } #endif diff --git a/components/soc/esp32c5/pcnt_periph.c b/components/esp_hal_pcnt/esp32c5/pcnt_periph.c similarity index 98% rename from components/soc/esp32c5/pcnt_periph.c rename to components/esp_hal_pcnt/esp32c5/pcnt_periph.c index 641341582d..0a7958719a 100644 --- a/components/soc/esp32c5/pcnt_periph.c +++ b/components/esp_hal_pcnt/esp32c5/pcnt_periph.c @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include "soc/pcnt_periph.h" +#include "hal/pcnt_periph.h" #include "soc/gpio_sig_map.h" #include "soc/pcnt_reg.h" diff --git a/components/hal/esp32c6/include/hal/pcnt_ll.h b/components/esp_hal_pcnt/esp32c6/include/hal/pcnt_ll.h similarity index 96% rename from components/hal/esp32c6/include/hal/pcnt_ll.h rename to components/esp_hal_pcnt/esp32c6/include/hal/pcnt_ll.h index a328d2b558..a2be251b15 100644 --- a/components/hal/esp32c6/include/hal/pcnt_ll.h +++ b/components/esp_hal_pcnt/esp32c6/include/hal/pcnt_ll.h @@ -26,6 +26,9 @@ extern "C" { #endif +// Get PCNT attribute +#define PCNT_LL_GET(attr) (PCNT_LL_ ## attr) + #define PCNT_LL_GET_HW(num) (((num) == 0) ? (&PCNT) : NULL) #define PCNT_LL_MAX_GLITCH_WIDTH 1023 #define PCNT_LL_MAX_LIM SHRT_MAX @@ -41,6 +44,12 @@ typedef enum { PCNT_LL_WATCH_EVENT_MAX } pcnt_ll_watch_event_id_t; +// SoC-based capabilities +#define PCNT_LL_INST_NUM 1 // Number of PCNT instances +#define PCNT_LL_UNITS_PER_INST 4 // Number of units in each PCNT instance +#define PCNT_LL_CHANS_PER_UNIT 2 // Number of channels in each PCNT unit +#define PCNT_LL_THRES_POINT_PER_UNIT 2 // Number of threshold points in each PCNT unit + #define PCNT_LL_WATCH_EVENT_MASK ((1 << PCNT_LL_WATCH_EVENT_MAX) - 1) #define PCNT_LL_UNIT_WATCH_EVENT(unit_id) (1 << (unit_id)) #define PCNT_LL_CLOCK_SUPPORT_APB 1 diff --git a/components/soc/esp32c6/pcnt_periph.c b/components/esp_hal_pcnt/esp32c6/pcnt_periph.c similarity index 98% rename from components/soc/esp32c6/pcnt_periph.c rename to components/esp_hal_pcnt/esp32c6/pcnt_periph.c index 490f2ed821..a1a25f0cbe 100644 --- a/components/soc/esp32c6/pcnt_periph.c +++ b/components/esp_hal_pcnt/esp32c6/pcnt_periph.c @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include "soc/pcnt_periph.h" +#include "hal/pcnt_periph.h" #include "soc/gpio_sig_map.h" #include "soc/pcnt_reg.h" diff --git a/components/hal/esp32h2/include/hal/pcnt_ll.h b/components/esp_hal_pcnt/esp32h2/include/hal/pcnt_ll.h similarity index 97% rename from components/hal/esp32h2/include/hal/pcnt_ll.h rename to components/esp_hal_pcnt/esp32h2/include/hal/pcnt_ll.h index 9ff52d658c..da724cead5 100644 --- a/components/hal/esp32h2/include/hal/pcnt_ll.h +++ b/components/esp_hal_pcnt/esp32h2/include/hal/pcnt_ll.h @@ -29,6 +29,9 @@ extern "C" { #endif +// Get PCNT attribute +#define PCNT_LL_GET(attr) (PCNT_LL_ ## attr) + #define PCNT_LL_GET_HW(num) (((num) == 0) ? (&PCNT) : NULL) #define PCNT_LL_MAX_GLITCH_WIDTH 1023 #define PCNT_LL_MAX_LIM SHRT_MAX @@ -49,6 +52,12 @@ typedef enum { PCNT_LL_STEP_EVENT_REACH_INTERVAL } pcnt_ll_step_event_id_t; +// SoC-based capabilities +#define PCNT_LL_INST_NUM 1 // Number of PCNT instances +#define PCNT_LL_UNITS_PER_INST 4 // Number of units in each PCNT instance +#define PCNT_LL_CHANS_PER_UNIT 2 // Number of channels in each PCNT unit +#define PCNT_LL_THRES_POINT_PER_UNIT 2 // Number of threshold points in each PCNT unit + #define PCNT_LL_WATCH_EVENT_MASK ((1 << PCNT_LL_WATCH_EVENT_MAX) - 1) #define PCNT_LL_UNIT_WATCH_EVENT(unit_id) (1 << (unit_id)) #define PCNT_LL_STEP_NOTIFY_DIR_LIMIT 1 @@ -532,7 +541,6 @@ static inline bool pcnt_ll_is_step_notify_supported(int group_id) return ESP_CHIP_REV_ABOVE(efuse_hal_chip_revision(), 102); } - #ifdef __cplusplus } #endif diff --git a/components/soc/esp32h2/pcnt_periph.c b/components/esp_hal_pcnt/esp32h2/pcnt_periph.c similarity index 98% rename from components/soc/esp32h2/pcnt_periph.c rename to components/esp_hal_pcnt/esp32h2/pcnt_periph.c index 490f2ed821..a1a25f0cbe 100644 --- a/components/soc/esp32h2/pcnt_periph.c +++ b/components/esp_hal_pcnt/esp32h2/pcnt_periph.c @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include "soc/pcnt_periph.h" +#include "hal/pcnt_periph.h" #include "soc/gpio_sig_map.h" #include "soc/pcnt_reg.h" diff --git a/components/hal/esp32h21/include/hal/pcnt_ll.h b/components/esp_hal_pcnt/esp32h21/include/hal/pcnt_ll.h similarity index 96% rename from components/hal/esp32h21/include/hal/pcnt_ll.h rename to components/esp_hal_pcnt/esp32h21/include/hal/pcnt_ll.h index 16e9c46642..a5524923a9 100644 --- a/components/hal/esp32h21/include/hal/pcnt_ll.h +++ b/components/esp_hal_pcnt/esp32h21/include/hal/pcnt_ll.h @@ -19,6 +19,9 @@ extern "C" { #endif +// Get PCNT attribute +#define PCNT_LL_GET(attr) (PCNT_LL_ ## attr) + #define PCNT_LL_GET_HW(num) (((num) == 0) ? (&PCNT) : NULL) #define PCNT_LL_MAX_GLITCH_WIDTH 1023 #define PCNT_LL_MAX_LIM SHRT_MAX @@ -39,6 +42,12 @@ typedef enum { PCNT_LL_STEP_EVENT_REACH_INTERVAL_BACKWARD, } pcnt_ll_step_event_id_t; +// SoC-based capabilities +#define PCNT_LL_INST_NUM 1 // Number of PCNT instances +#define PCNT_LL_UNITS_PER_INST 4 // Number of units in each PCNT instance +#define PCNT_LL_CHANS_PER_UNIT 2 // Number of channels in each PCNT unit +#define PCNT_LL_THRES_POINT_PER_UNIT 2 // Number of threshold points in each PCNT unit + #define PCNT_LL_WATCH_EVENT_MASK ((1 << PCNT_LL_WATCH_EVENT_MAX) - 1) #define PCNT_LL_UNIT_WATCH_EVENT(unit_id) (1 << (unit_id)) #define PCNT_LL_CLOCK_SUPPORT_APB 1 @@ -512,7 +521,6 @@ static inline bool pcnt_ll_is_step_notify_supported(int group_id) return true; } - #ifdef __cplusplus } #endif diff --git a/components/soc/esp32h4/pcnt_periph.c b/components/esp_hal_pcnt/esp32h21/pcnt_periph.c similarity index 98% rename from components/soc/esp32h4/pcnt_periph.c rename to components/esp_hal_pcnt/esp32h21/pcnt_periph.c index 3f16293c77..3628b0b4cc 100644 --- a/components/soc/esp32h4/pcnt_periph.c +++ b/components/esp_hal_pcnt/esp32h21/pcnt_periph.c @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include "soc/pcnt_periph.h" +#include "hal/pcnt_periph.h" #include "soc/gpio_sig_map.h" #include "soc/pcnt_reg.h" diff --git a/components/hal/esp32h4/include/hal/pcnt_ll.h b/components/esp_hal_pcnt/esp32h4/include/hal/pcnt_ll.h similarity index 96% rename from components/hal/esp32h4/include/hal/pcnt_ll.h rename to components/esp_hal_pcnt/esp32h4/include/hal/pcnt_ll.h index b2bbba30ba..3c61d40657 100644 --- a/components/hal/esp32h4/include/hal/pcnt_ll.h +++ b/components/esp_hal_pcnt/esp32h4/include/hal/pcnt_ll.h @@ -19,6 +19,9 @@ extern "C" { #endif +// Get PCNT attribute +#define PCNT_LL_GET(attr) (PCNT_LL_ ## attr) + #define PCNT_LL_GET_HW(num) (((num) == 0) ? (&PCNT) : NULL) #define PCNT_LL_MAX_GLITCH_WIDTH 1023 #define PCNT_LL_MAX_LIM SHRT_MAX @@ -39,6 +42,12 @@ typedef enum { PCNT_LL_STEP_EVENT_REACH_INTERVAL_BACKWARD, } pcnt_ll_step_event_id_t; +// SoC-based capabilities +#define PCNT_LL_INST_NUM 1 // Number of PCNT instances +#define PCNT_LL_UNITS_PER_INST 4 // Number of units in each PCNT instance +#define PCNT_LL_CHANS_PER_UNIT 2 // Number of channels in each PCNT unit +#define PCNT_LL_THRES_POINT_PER_UNIT 2 // Number of threshold points in each PCNT unit + #define PCNT_LL_WATCH_EVENT_MASK ((1 << PCNT_LL_WATCH_EVENT_MAX) - 1) #define PCNT_LL_UNIT_WATCH_EVENT(unit_id) (1 << (unit_id)) diff --git a/components/soc/esp32h21/pcnt_periph.c b/components/esp_hal_pcnt/esp32h4/pcnt_periph.c similarity index 98% rename from components/soc/esp32h21/pcnt_periph.c rename to components/esp_hal_pcnt/esp32h4/pcnt_periph.c index 3f16293c77..3628b0b4cc 100644 --- a/components/soc/esp32h21/pcnt_periph.c +++ b/components/esp_hal_pcnt/esp32h4/pcnt_periph.c @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include "soc/pcnt_periph.h" +#include "hal/pcnt_periph.h" #include "soc/gpio_sig_map.h" #include "soc/pcnt_reg.h" diff --git a/components/hal/esp32p4/include/hal/pcnt_ll.h b/components/esp_hal_pcnt/esp32p4/include/hal/pcnt_ll.h similarity index 97% rename from components/hal/esp32p4/include/hal/pcnt_ll.h rename to components/esp_hal_pcnt/esp32p4/include/hal/pcnt_ll.h index fba58b90a3..981f0fa94d 100644 --- a/components/hal/esp32p4/include/hal/pcnt_ll.h +++ b/components/esp_hal_pcnt/esp32p4/include/hal/pcnt_ll.h @@ -27,6 +27,9 @@ extern "C" { #endif +// Get PCNT attribute +#define PCNT_LL_GET(attr) (PCNT_LL_ ## attr) + #define PCNT_LL_GET_HW(num) (((num) == 0) ? (&PCNT) : NULL) #define PCNT_LL_MAX_GLITCH_WIDTH 1023 #define PCNT_LL_MAX_LIM SHRT_MAX @@ -42,6 +45,12 @@ typedef enum { PCNT_LL_WATCH_EVENT_MAX } pcnt_ll_watch_event_id_t; +// SoC-based capabilities +#define PCNT_LL_INST_NUM 1 // Number of PCNT instances +#define PCNT_LL_UNITS_PER_INST 4 // Number of units in each PCNT instance +#define PCNT_LL_CHANS_PER_UNIT 2 // Number of channels in each PCNT unit +#define PCNT_LL_THRES_POINT_PER_UNIT 2 // Number of threshold points in each PCNT unit + #define PCNT_LL_WATCH_EVENT_MASK ((1 << PCNT_LL_WATCH_EVENT_MAX) - 1) #define PCNT_LL_UNIT_WATCH_EVENT(unit_id) (1 << (unit_id)) #define PCNT_LL_CLOCK_SUPPORT_APB 1 diff --git a/components/soc/esp32p4/pcnt_periph.c b/components/esp_hal_pcnt/esp32p4/pcnt_periph.c similarity index 98% rename from components/soc/esp32p4/pcnt_periph.c rename to components/esp_hal_pcnt/esp32p4/pcnt_periph.c index 8ed3e5a4d2..d52198ee33 100644 --- a/components/soc/esp32p4/pcnt_periph.c +++ b/components/esp_hal_pcnt/esp32p4/pcnt_periph.c @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include "soc/pcnt_periph.h" +#include "hal/pcnt_periph.h" #include "soc/gpio_sig_map.h" #include "soc/pcnt_reg.h" diff --git a/components/hal/esp32s2/include/hal/pcnt_ll.h b/components/esp_hal_pcnt/esp32s2/include/hal/pcnt_ll.h similarity index 96% rename from components/hal/esp32s2/include/hal/pcnt_ll.h rename to components/esp_hal_pcnt/esp32s2/include/hal/pcnt_ll.h index 13c02abd91..cf32680693 100644 --- a/components/hal/esp32s2/include/hal/pcnt_ll.h +++ b/components/esp_hal_pcnt/esp32s2/include/hal/pcnt_ll.h @@ -27,6 +27,9 @@ extern "C" { #endif +// Get PCNT attribute +#define PCNT_LL_GET(attr) (PCNT_LL_ ## attr) + #define PCNT_LL_GET_HW(num) (((num) == 0) ? (&PCNT) : NULL) #define PCNT_LL_MAX_GLITCH_WIDTH 1023 #define PCNT_LL_MAX_LIM SHRT_MAX @@ -42,6 +45,12 @@ typedef enum { PCNT_LL_WATCH_EVENT_MAX } pcnt_ll_watch_event_id_t; +// SoC-based capabilities +#define PCNT_LL_INST_NUM 1 // Number of PCNT instances +#define PCNT_LL_UNITS_PER_INST 4 // Number of units in each PCNT instance +#define PCNT_LL_CHANS_PER_UNIT 2 // Number of channels in each PCNT unit +#define PCNT_LL_THRES_POINT_PER_UNIT 2 // Number of threshold points in each PCNT unit + #define PCNT_LL_WATCH_EVENT_MASK ((1 << PCNT_LL_WATCH_EVENT_MAX) - 1) #define PCNT_LL_UNIT_WATCH_EVENT(unit_id) (1 << (unit_id)) #define PCNT_LL_CLOCK_SUPPORT_APB 1 @@ -491,7 +500,6 @@ static inline void pcnt_ll_reset_register(int group_id) pcnt_ll_reset_register(__VA_ARGS__); \ } while(0) - #ifdef __cplusplus } #endif diff --git a/components/soc/esp32s3/pcnt_periph.c b/components/esp_hal_pcnt/esp32s2/pcnt_periph.c similarity index 98% rename from components/soc/esp32s3/pcnt_periph.c rename to components/esp_hal_pcnt/esp32s2/pcnt_periph.c index d28cd840b0..8e2df9c511 100644 --- a/components/soc/esp32s3/pcnt_periph.c +++ b/components/esp_hal_pcnt/esp32s2/pcnt_periph.c @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include "soc/pcnt_periph.h" +#include "hal/pcnt_periph.h" #include "soc/gpio_sig_map.h" const soc_pcnt_signal_desc_t soc_pcnt_signals[1] = { diff --git a/components/hal/esp32s3/include/hal/pcnt_ll.h b/components/esp_hal_pcnt/esp32s3/include/hal/pcnt_ll.h similarity index 96% rename from components/hal/esp32s3/include/hal/pcnt_ll.h rename to components/esp_hal_pcnt/esp32s3/include/hal/pcnt_ll.h index 5a67c3e682..e2c5a60a8d 100644 --- a/components/hal/esp32s3/include/hal/pcnt_ll.h +++ b/components/esp_hal_pcnt/esp32s3/include/hal/pcnt_ll.h @@ -26,6 +26,9 @@ extern "C" { #endif +// Get PCNT attribute +#define PCNT_LL_GET(attr) (PCNT_LL_ ## attr) + #define PCNT_LL_GET_HW(num) (((num) == 0) ? (&PCNT) : NULL) #define PCNT_LL_MAX_GLITCH_WIDTH 1023 #define PCNT_LL_MAX_LIM SHRT_MAX @@ -41,6 +44,12 @@ typedef enum { PCNT_LL_WATCH_EVENT_MAX } pcnt_ll_watch_event_id_t; +// SoC-based capabilities +#define PCNT_LL_INST_NUM 1 // Number of PCNT instances +#define PCNT_LL_UNITS_PER_INST 4 // Number of units in each PCNT instance +#define PCNT_LL_CHANS_PER_UNIT 2 // Number of channels in each PCNT unit +#define PCNT_LL_THRES_POINT_PER_UNIT 2 // Number of threshold points in each PCNT unit + #define PCNT_LL_WATCH_EVENT_MASK ((1 << PCNT_LL_WATCH_EVENT_MAX) - 1) #define PCNT_LL_UNIT_WATCH_EVENT(unit_id) (1 << (unit_id)) #define PCNT_LL_CLOCK_SUPPORT_APB 1 diff --git a/components/soc/esp32s2/pcnt_periph.c b/components/esp_hal_pcnt/esp32s3/pcnt_periph.c similarity index 98% rename from components/soc/esp32s2/pcnt_periph.c rename to components/esp_hal_pcnt/esp32s3/pcnt_periph.c index d28cd840b0..8e2df9c511 100644 --- a/components/soc/esp32s2/pcnt_periph.c +++ b/components/esp_hal_pcnt/esp32s3/pcnt_periph.c @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include "soc/pcnt_periph.h" +#include "hal/pcnt_periph.h" #include "soc/gpio_sig_map.h" const soc_pcnt_signal_desc_t soc_pcnt_signals[1] = { diff --git a/components/hal/include/hal/pcnt_hal.h b/components/esp_hal_pcnt/include/hal/pcnt_hal.h similarity index 100% rename from components/hal/include/hal/pcnt_hal.h rename to components/esp_hal_pcnt/include/hal/pcnt_hal.h diff --git a/components/soc/include/soc/pcnt_periph.h b/components/esp_hal_pcnt/include/hal/pcnt_periph.h similarity index 70% rename from components/soc/include/soc/pcnt_periph.h rename to components/esp_hal_pcnt/include/hal/pcnt_periph.h index dfd6060f9f..ee49b39b56 100644 --- a/components/soc/include/soc/pcnt_periph.h +++ b/components/esp_hal_pcnt/include/hal/pcnt_periph.h @@ -8,11 +8,11 @@ #include #include -#include "soc/soc_caps_full.h" +#include "soc/soc_caps.h" #include "soc/interrupts.h" - -// helper macros to access module attributes -#define SOC_PCNT_ATTR(_attr) SOC_MODULE_ATTR(PCNT, _attr) +#if SOC_HAS(PCNT) +#include "hal/pcnt_ll.h" +#endif #ifdef __cplusplus extern "C" { @@ -26,13 +26,13 @@ typedef struct { struct { const int pulse_sig_id_matrix; // pulse signal ID in the GPIO matrix const int ctl_sig_id_matrix; // control signal ID in the GPIO matrix - } channels[SOC_PCNT_ATTR(CHANS_PER_UNIT)]; + } channels[PCNT_LL_GET(CHANS_PER_UNIT)]; const int clear_sig_id_matrix; // clear signal ID in the GPIO matrix - } units[SOC_PCNT_ATTR(UNITS_PER_INST)]; + } units[PCNT_LL_GET(UNITS_PER_INST)]; const int irq_id; // interrupt source ID } soc_pcnt_signal_desc_t; -extern const soc_pcnt_signal_desc_t soc_pcnt_signals[SOC_PCNT_ATTR(INST_NUM)]; +extern const soc_pcnt_signal_desc_t soc_pcnt_signals[PCNT_LL_GET(INST_NUM)]; #endif // SOC_HAS(PCNT) diff --git a/components/hal/include/hal/pcnt_types.h b/components/esp_hal_pcnt/include/hal/pcnt_types.h similarity index 100% rename from components/hal/include/hal/pcnt_types.h rename to components/esp_hal_pcnt/include/hal/pcnt_types.h diff --git a/components/hal/pcnt_hal.c b/components/esp_hal_pcnt/pcnt_hal.c similarity index 100% rename from components/hal/pcnt_hal.c rename to components/esp_hal_pcnt/pcnt_hal.c diff --git a/components/esp_system/CMakeLists.txt b/components/esp_system/CMakeLists.txt index db6baa2752..ff61334a0b 100644 --- a/components/esp_system/CMakeLists.txt +++ b/components/esp_system/CMakeLists.txt @@ -84,6 +84,7 @@ else() esp_hal_mcpwm esp_hal_jpeg esp_hal_emac + esp_hal_pcnt LDFRAGMENTS "linker.lf" "app.lf") add_subdirectory(port) diff --git a/components/hal/CMakeLists.txt b/components/hal/CMakeLists.txt index 0241bd3bb2..e73532a31b 100644 --- a/components/hal/CMakeLists.txt +++ b/components/hal/CMakeLists.txt @@ -111,10 +111,6 @@ elseif(NOT BOOTLOADER_BUILD) list(APPEND srcs "rmt_hal.c") endif() - if(CONFIG_SOC_PCNT_SUPPORTED) - list(APPEND srcs "pcnt_hal.c") - endif() - if(CONFIG_SOC_UHCI_SUPPORTED) list(APPEND srcs "uhci_hal.c") endif() diff --git a/components/soc/CMakeLists.txt b/components/soc/CMakeLists.txt index f4c470f4a1..12bc810081 100644 --- a/components/soc/CMakeLists.txt +++ b/components/soc/CMakeLists.txt @@ -93,10 +93,6 @@ if(CONFIG_SOC_LEDC_SUPPORTED) list(APPEND srcs "${target_folder}/ledc_periph.c") endif() -if(CONFIG_SOC_PCNT_SUPPORTED) - list(APPEND srcs "${target_folder}/pcnt_periph.c") -endif() - if(CONFIG_SOC_RMT_SUPPORTED) list(APPEND srcs "${target_folder}/rmt_periph.c") endif() diff --git a/components/soc/esp32/include/soc/soc_caps_full.h b/components/soc/esp32/include/soc/soc_caps_full.h index cdb04a3175..2cf0547f26 100644 --- a/components/soc/esp32/include/soc/soc_caps_full.h +++ b/components/soc/esp32/include/soc/soc_caps_full.h @@ -13,12 +13,6 @@ #define _SOC_CAPS_SDM_INST_NUM 1 // Number of SDM instances #define _SOC_CAPS_SDM_CHANS_PER_INST 8 // Number of channels in each SDM instance -/*--------------------------- PCNT (Pulse Counter) ------------------------*/ -#define _SOC_CAPS_PCNT_INST_NUM 1 // Number of PCNT instances -#define _SOC_CAPS_PCNT_UNITS_PER_INST 8 // Number of units in each PCNT instance -#define _SOC_CAPS_PCNT_CHANS_PER_UNIT 2 // Number of channels in each PCNT unit -#define _SOC_CAPS_PCNT_THRES_POINT_PER_UNIT 2 // Number of threshold points in each PCNT unit - /*------------------------------- I2S ---------------------------------------*/ // helper macros to access module attributes #define _SOC_CAPS_I2S_INST_NUM 2 // Number of I2S instances diff --git a/components/soc/esp32/pcnt_periph.c b/components/soc/esp32/pcnt_periph.c index 0190bd06b2..a85d7c4b94 100644 --- a/components/soc/esp32/pcnt_periph.c +++ b/components/soc/esp32/pcnt_periph.c @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include "soc/pcnt_periph.h" +#include "hal/pcnt_periph.h" #include "soc/gpio_sig_map.h" #include "soc/soc.h" diff --git a/components/soc/esp32c5/include/soc/soc_caps_full.h b/components/soc/esp32c5/include/soc/soc_caps_full.h index c5641329fb..ad114f13eb 100644 --- a/components/soc/esp32c5/include/soc/soc_caps_full.h +++ b/components/soc/esp32c5/include/soc/soc_caps_full.h @@ -17,12 +17,6 @@ #define _SOC_CAPS_SDM_INST_NUM 1 // Number of SDM instances #define _SOC_CAPS_SDM_CHANS_PER_INST 4 // Number of channels in each SDM instance -/*--------------------------- PCNT (Pulse Counter) ------------------------*/ -#define _SOC_CAPS_PCNT_INST_NUM 1 // Number of PCNT instances -#define _SOC_CAPS_PCNT_UNITS_PER_INST 4 // Number of units in each PCNT instance -#define _SOC_CAPS_PCNT_CHANS_PER_UNIT 2 // Number of channels in each PCNT unit -#define _SOC_CAPS_PCNT_THRES_POINT_PER_UNIT 2 // Number of threshold points in each PCNT unit - /*--------------------------- ETM (Event Task Matrix) ----------------------------*/ #define _SOC_CAPS_ETM_INST_NUM 1 // Number of ETM instances #define _SOC_CAPS_ETM_CHANS_PER_INST 50 // Number of channels in each ETM instance diff --git a/components/soc/esp32c6/include/soc/soc_caps_full.h b/components/soc/esp32c6/include/soc/soc_caps_full.h index c5641329fb..ad114f13eb 100644 --- a/components/soc/esp32c6/include/soc/soc_caps_full.h +++ b/components/soc/esp32c6/include/soc/soc_caps_full.h @@ -17,12 +17,6 @@ #define _SOC_CAPS_SDM_INST_NUM 1 // Number of SDM instances #define _SOC_CAPS_SDM_CHANS_PER_INST 4 // Number of channels in each SDM instance -/*--------------------------- PCNT (Pulse Counter) ------------------------*/ -#define _SOC_CAPS_PCNT_INST_NUM 1 // Number of PCNT instances -#define _SOC_CAPS_PCNT_UNITS_PER_INST 4 // Number of units in each PCNT instance -#define _SOC_CAPS_PCNT_CHANS_PER_UNIT 2 // Number of channels in each PCNT unit -#define _SOC_CAPS_PCNT_THRES_POINT_PER_UNIT 2 // Number of threshold points in each PCNT unit - /*--------------------------- ETM (Event Task Matrix) ----------------------------*/ #define _SOC_CAPS_ETM_INST_NUM 1 // Number of ETM instances #define _SOC_CAPS_ETM_CHANS_PER_INST 50 // Number of channels in each ETM instance diff --git a/components/soc/esp32h2/include/soc/soc_caps_full.h b/components/soc/esp32h2/include/soc/soc_caps_full.h index c5641329fb..ad114f13eb 100644 --- a/components/soc/esp32h2/include/soc/soc_caps_full.h +++ b/components/soc/esp32h2/include/soc/soc_caps_full.h @@ -17,12 +17,6 @@ #define _SOC_CAPS_SDM_INST_NUM 1 // Number of SDM instances #define _SOC_CAPS_SDM_CHANS_PER_INST 4 // Number of channels in each SDM instance -/*--------------------------- PCNT (Pulse Counter) ------------------------*/ -#define _SOC_CAPS_PCNT_INST_NUM 1 // Number of PCNT instances -#define _SOC_CAPS_PCNT_UNITS_PER_INST 4 // Number of units in each PCNT instance -#define _SOC_CAPS_PCNT_CHANS_PER_UNIT 2 // Number of channels in each PCNT unit -#define _SOC_CAPS_PCNT_THRES_POINT_PER_UNIT 2 // Number of threshold points in each PCNT unit - /*--------------------------- ETM (Event Task Matrix) ----------------------------*/ #define _SOC_CAPS_ETM_INST_NUM 1 // Number of ETM instances #define _SOC_CAPS_ETM_CHANS_PER_INST 50 // Number of channels in each ETM instance diff --git a/components/soc/esp32h21/include/soc/soc_caps_full.h b/components/soc/esp32h21/include/soc/soc_caps_full.h index 6c40b2b49b..6712b6ea04 100644 --- a/components/soc/esp32h21/include/soc/soc_caps_full.h +++ b/components/soc/esp32h21/include/soc/soc_caps_full.h @@ -13,12 +13,6 @@ #define _SOC_CAPS_SDM_INST_NUM 1 // Number of SDM instances #define _SOC_CAPS_SDM_CHANS_PER_INST 4 // Number of channels in each SDM instance -/*--------------------------- PCNT (Pulse Counter) ------------------------*/ -#define _SOC_CAPS_PCNT_INST_NUM 1 // Number of PCNT instances -#define _SOC_CAPS_PCNT_UNITS_PER_INST 4 // Number of units in each PCNT instance -#define _SOC_CAPS_PCNT_CHANS_PER_UNIT 2 // Number of channels in each PCNT unit -#define _SOC_CAPS_PCNT_THRES_POINT_PER_UNIT 2 // Number of threshold points in each PCNT unit - /*--------------------------- ETM (Event Task Matrix) ----------------------------*/ #define _SOC_CAPS_ETM_INST_NUM 1 // Number of ETM instances #define _SOC_CAPS_ETM_CHANS_PER_INST 50 // Number of channels in each ETM instance diff --git a/components/soc/esp32h4/include/soc/soc_caps_full.h b/components/soc/esp32h4/include/soc/soc_caps_full.h index 6c40b2b49b..6712b6ea04 100644 --- a/components/soc/esp32h4/include/soc/soc_caps_full.h +++ b/components/soc/esp32h4/include/soc/soc_caps_full.h @@ -13,12 +13,6 @@ #define _SOC_CAPS_SDM_INST_NUM 1 // Number of SDM instances #define _SOC_CAPS_SDM_CHANS_PER_INST 4 // Number of channels in each SDM instance -/*--------------------------- PCNT (Pulse Counter) ------------------------*/ -#define _SOC_CAPS_PCNT_INST_NUM 1 // Number of PCNT instances -#define _SOC_CAPS_PCNT_UNITS_PER_INST 4 // Number of units in each PCNT instance -#define _SOC_CAPS_PCNT_CHANS_PER_UNIT 2 // Number of channels in each PCNT unit -#define _SOC_CAPS_PCNT_THRES_POINT_PER_UNIT 2 // Number of threshold points in each PCNT unit - /*--------------------------- ETM (Event Task Matrix) ----------------------------*/ #define _SOC_CAPS_ETM_INST_NUM 1 // Number of ETM instances #define _SOC_CAPS_ETM_CHANS_PER_INST 50 // Number of channels in each ETM instance diff --git a/components/soc/esp32p4/include/soc/soc_caps_full.h b/components/soc/esp32p4/include/soc/soc_caps_full.h index a19b6b3268..8adb004c2b 100644 --- a/components/soc/esp32p4/include/soc/soc_caps_full.h +++ b/components/soc/esp32p4/include/soc/soc_caps_full.h @@ -17,12 +17,6 @@ #define _SOC_CAPS_SDM_INST_NUM 1 // Number of SDM instances #define _SOC_CAPS_SDM_CHANS_PER_INST 8 // Number of channels in each SDM instance -/*--------------------------- PCNT (Pulse Counter) ------------------------*/ -#define _SOC_CAPS_PCNT_INST_NUM 1 // Number of PCNT instances -#define _SOC_CAPS_PCNT_UNITS_PER_INST 4 // Number of units in each PCNT instance -#define _SOC_CAPS_PCNT_CHANS_PER_UNIT 2 // Number of channels in each PCNT unit -#define _SOC_CAPS_PCNT_THRES_POINT_PER_UNIT 2 // Number of threshold points in each PCNT unit - /*--------------------------- ETM (Event Task Matrix) ----------------------------*/ #define _SOC_CAPS_ETM_INST_NUM 1 // Number of ETM instances #define _SOC_CAPS_ETM_CHANS_PER_INST 50 // Number of channels in each ETM instance diff --git a/components/soc/esp32s2/include/soc/soc_caps_full.h b/components/soc/esp32s2/include/soc/soc_caps_full.h index b8add7e05a..8535ad85ac 100644 --- a/components/soc/esp32s2/include/soc/soc_caps_full.h +++ b/components/soc/esp32s2/include/soc/soc_caps_full.h @@ -13,12 +13,6 @@ #define _SOC_CAPS_SDM_INST_NUM 1 // Number of SDM instances #define _SOC_CAPS_SDM_CHANS_PER_INST 8 // Number of channels in each SDM instance -/*--------------------------- PCNT (Pulse Counter) ------------------------*/ -#define _SOC_CAPS_PCNT_INST_NUM 1 // Number of PCNT instances -#define _SOC_CAPS_PCNT_UNITS_PER_INST 4 // Number of units in each PCNT instance -#define _SOC_CAPS_PCNT_CHANS_PER_UNIT 2 // Number of channels in each PCNT unit -#define _SOC_CAPS_PCNT_THRES_POINT_PER_UNIT 2 // Number of threshold points in each PCNT unit - /*------------------------------- Dedicated GPIO ------------------------------*/ #define _SOC_CAPS_DEDIC_GPIO_OUT_CHANS_PER_CPU 8 /*!< 8 outward channels on each CPU core */ #define _SOC_CAPS_DEDIC_GPIO_IN_CHANS_PER_CPU 8 /*!< 8 inward channels on each CPU core */ diff --git a/components/soc/esp32s3/include/soc/soc_caps_full.h b/components/soc/esp32s3/include/soc/soc_caps_full.h index dd9d339169..3227fd5849 100644 --- a/components/soc/esp32s3/include/soc/soc_caps_full.h +++ b/components/soc/esp32s3/include/soc/soc_caps_full.h @@ -13,12 +13,6 @@ #define _SOC_CAPS_SDM_INST_NUM 1 // Number of SDM instances #define _SOC_CAPS_SDM_CHANS_PER_INST 8 // Number of channels in each SDM instance -/*--------------------------- PCNT (Pulse Counter) ------------------------*/ -#define _SOC_CAPS_PCNT_INST_NUM 1 // Number of PCNT instances -#define _SOC_CAPS_PCNT_UNITS_PER_INST 4 // Number of units in each PCNT instance -#define _SOC_CAPS_PCNT_CHANS_PER_UNIT 2 // Number of channels in each PCNT unit -#define _SOC_CAPS_PCNT_THRES_POINT_PER_UNIT 2 // Number of threshold points in each PCNT unit - /*------------------------------- Dedicated GPIO ------------------------------*/ #define _SOC_CAPS_DEDIC_GPIO_OUT_CHANS_PER_CPU 8 /*!< 8 outward channels on each CPU core */ #define _SOC_CAPS_DEDIC_GPIO_IN_CHANS_PER_CPU 8 /*!< 8 inward channels on each CPU core */ diff --git a/docs/doxygen/Doxyfile b/docs/doxygen/Doxyfile index cfde8df1c5..3286412557 100644 --- a/docs/doxygen/Doxyfile +++ b/docs/doxygen/Doxyfile @@ -261,7 +261,7 @@ INPUT = \ $(PROJECT_PATH)/components/hal/include/hal/ledc_types.h \ $(PROJECT_PATH)/components/hal/include/hal/mcpwm_types.h \ $(PROJECT_PATH)/components/hal/include/hal/parlio_types.h \ - $(PROJECT_PATH)/components/hal/include/hal/pcnt_types.h \ + $(PROJECT_PATH)/components/esp_hal_pcnt/include/hal/pcnt_types.h \ $(PROJECT_PATH)/components/hal/include/hal/rmt_types.h \ $(PROJECT_PATH)/components/hal/include/hal/rtc_io_types.h \ $(PROJECT_PATH)/components/hal/include/hal/sdio_slave_types.h \