diff --git a/components/driver/CMakeLists.txt b/components/driver/CMakeLists.txt index 7e87587368..9b95625fd9 100644 --- a/components/driver/CMakeLists.txt +++ b/components/driver/CMakeLists.txt @@ -15,7 +15,6 @@ set(includes "include" "i2c/include" "i2s/include" "ledc/include" - "mcpwm/include" "parlio/include" "rmt/include" "sdio_slave/include" @@ -103,21 +102,9 @@ if(CONFIG_SOC_LEDC_SUPPORTED) list(APPEND ldfragments "ledc/linker.lf") endif() -# MCPWM related source files +# MCPWM legacy driver if(CONFIG_SOC_MCPWM_SUPPORTED) - list(APPEND srcs "mcpwm/mcpwm_cap.c" - "mcpwm/mcpwm_cmpr.c" - "mcpwm/mcpwm_com.c" - "mcpwm/mcpwm_fault.c" - "mcpwm/mcpwm_gen.c" - "mcpwm/mcpwm_oper.c" - "mcpwm/mcpwm_sync.c" - "mcpwm/mcpwm_timer.c" - "deprecated/mcpwm_legacy.c") - if(CONFIG_SOC_MCPWM_SUPPORT_ETM) - list(APPEND srcs "mcpwm/mcpwm_etm.c") - endif() - list(APPEND ldfragments "mcpwm/linker.lf") + list(APPEND srcs "deprecated/mcpwm_legacy.c") endif() # PCNT legacy driver @@ -211,7 +198,7 @@ else() REQUIRES esp_pm esp_ringbuf freertos soc hal esp_hw_support # for backward compatibility, the driver component needs to # have a public dependency on other "esp_driver_foo" components - esp_driver_gpio esp_driver_pcnt esp_driver_gptimer esp_driver_spi + esp_driver_gpio esp_driver_pcnt esp_driver_gptimer esp_driver_spi esp_driver_mcpwm LDFRAGMENTS ${ldfragments} ) endif() diff --git a/components/driver/Kconfig b/components/driver/Kconfig index 85cc0e3254..63365b40ae 100644 --- a/components/driver/Kconfig +++ b/components/driver/Kconfig @@ -147,8 +147,6 @@ menu "Driver Configurations" orsource "./rmt/Kconfig.rmt" - orsource "./mcpwm/Kconfig.mcpwm" - menu "I2S Configuration" depends on SOC_I2S_SUPPORTED config I2S_ISR_IRAM_SAFE diff --git a/components/driver/test_apps/.build-test-rules.yml b/components/driver/test_apps/.build-test-rules.yml index b7da4d17f1..e1509edc22 100644 --- a/components/driver/test_apps/.build-test-rules.yml +++ b/components/driver/test_apps/.build-test-rules.yml @@ -74,10 +74,14 @@ components/driver/test_apps/legacy_i2c_driver: components/driver/test_apps/legacy_mcpwm_driver: disable: - if: SOC_MCPWM_SUPPORTED != 1 + depends_filepatterns: + - components/driver/deprecated/**/*mcpwm* components/driver/test_apps/legacy_pcnt_driver: disable: - if: SOC_PCNT_SUPPORTED != 1 + depends_filepatterns: + - components/driver/deprecated/**/*pcnt* components/driver/test_apps/legacy_rmt_driver: disable: @@ -98,10 +102,8 @@ components/driver/test_apps/legacy_sigma_delta_driver: components/driver/test_apps/legacy_timer_driver: disable: - if: SOC_GPTIMER_SUPPORTED != 1 - -components/driver/test_apps/mcpwm: - disable: - - if: SOC_MCPWM_SUPPORTED != 1 + depends_filepatterns: + - components/driver/deprecated/**/*timer* components/driver/test_apps/parlio: disable: diff --git a/components/esp_driver_gptimer/test_apps/gptimer/main/CMakeLists.txt b/components/esp_driver_gptimer/test_apps/gptimer/main/CMakeLists.txt index 7e2ef128f4..2768a1f04e 100644 --- a/components/esp_driver_gptimer/test_apps/gptimer/main/CMakeLists.txt +++ b/components/esp_driver_gptimer/test_apps/gptimer/main/CMakeLists.txt @@ -8,5 +8,5 @@ endif() # In order for the cases defined by `TEST_CASE` to be linked into the final elf, # the component can be registered as WHOLE_ARCHIVE idf_component_register(SRCS ${srcs} - PRIV_REQUIRES unity driver + PRIV_REQUIRES unity esp_driver_gptimer WHOLE_ARCHIVE) diff --git a/components/esp_driver_mcpwm/CMakeLists.txt b/components/esp_driver_mcpwm/CMakeLists.txt new file mode 100644 index 0000000000..15483918a4 --- /dev/null +++ b/components/esp_driver_mcpwm/CMakeLists.txt @@ -0,0 +1,21 @@ +set(srcs) +set(public_include "include") +if(CONFIG_SOC_MCPWM_SUPPORTED) + list(APPEND srcs "src/mcpwm_cap.c" + "src/mcpwm_cmpr.c" + "src/mcpwm_com.c" + "src/mcpwm_fault.c" + "src/mcpwm_gen.c" + "src/mcpwm_oper.c" + "src/mcpwm_sync.c" + "src/mcpwm_timer.c") + if(CONFIG_SOC_MCPWM_SUPPORT_ETM) + list(APPEND srcs "src/mcpwm_etm.c") + endif() +endif() + +idf_component_register(SRCS ${srcs} + INCLUDE_DIRS ${public_include} + PRIV_REQUIRES "esp_pm" "esp_driver_gpio" + LDFRAGMENTS "linker.lf" + ) diff --git a/components/driver/mcpwm/Kconfig.mcpwm b/components/esp_driver_mcpwm/Kconfig similarity index 96% rename from components/driver/mcpwm/Kconfig.mcpwm rename to components/esp_driver_mcpwm/Kconfig index b1a7fd8c81..0b5bb37bdd 100644 --- a/components/driver/mcpwm/Kconfig.mcpwm +++ b/components/esp_driver_mcpwm/Kconfig @@ -1,4 +1,4 @@ -menu "MCPWM Configuration" +menu "ESP-Driver:MCPWM Configurations" depends on SOC_MCPWM_SUPPORTED config MCPWM_ISR_IRAM_SAFE bool "Place MCPWM ISR function into IRAM" @@ -30,4 +30,4 @@ menu "MCPWM Configuration" help Wether to enable the debug log message for MCPWM driver. Note that, this option only controls the MCPWM driver log, won't affect other drivers. -endmenu # MCPWM Configuration +endmenu diff --git a/components/driver/mcpwm/include/driver/mcpwm_cap.h b/components/esp_driver_mcpwm/include/driver/mcpwm_cap.h similarity index 100% rename from components/driver/mcpwm/include/driver/mcpwm_cap.h rename to components/esp_driver_mcpwm/include/driver/mcpwm_cap.h diff --git a/components/driver/mcpwm/include/driver/mcpwm_cmpr.h b/components/esp_driver_mcpwm/include/driver/mcpwm_cmpr.h similarity index 100% rename from components/driver/mcpwm/include/driver/mcpwm_cmpr.h rename to components/esp_driver_mcpwm/include/driver/mcpwm_cmpr.h diff --git a/components/driver/mcpwm/include/driver/mcpwm_etm.h b/components/esp_driver_mcpwm/include/driver/mcpwm_etm.h similarity index 100% rename from components/driver/mcpwm/include/driver/mcpwm_etm.h rename to components/esp_driver_mcpwm/include/driver/mcpwm_etm.h diff --git a/components/driver/mcpwm/include/driver/mcpwm_fault.h b/components/esp_driver_mcpwm/include/driver/mcpwm_fault.h similarity index 100% rename from components/driver/mcpwm/include/driver/mcpwm_fault.h rename to components/esp_driver_mcpwm/include/driver/mcpwm_fault.h diff --git a/components/driver/mcpwm/include/driver/mcpwm_gen.h b/components/esp_driver_mcpwm/include/driver/mcpwm_gen.h similarity index 100% rename from components/driver/mcpwm/include/driver/mcpwm_gen.h rename to components/esp_driver_mcpwm/include/driver/mcpwm_gen.h diff --git a/components/driver/mcpwm/include/driver/mcpwm_oper.h b/components/esp_driver_mcpwm/include/driver/mcpwm_oper.h similarity index 100% rename from components/driver/mcpwm/include/driver/mcpwm_oper.h rename to components/esp_driver_mcpwm/include/driver/mcpwm_oper.h diff --git a/components/driver/mcpwm/include/driver/mcpwm_prelude.h b/components/esp_driver_mcpwm/include/driver/mcpwm_prelude.h similarity index 100% rename from components/driver/mcpwm/include/driver/mcpwm_prelude.h rename to components/esp_driver_mcpwm/include/driver/mcpwm_prelude.h diff --git a/components/driver/mcpwm/include/driver/mcpwm_sync.h b/components/esp_driver_mcpwm/include/driver/mcpwm_sync.h similarity index 100% rename from components/driver/mcpwm/include/driver/mcpwm_sync.h rename to components/esp_driver_mcpwm/include/driver/mcpwm_sync.h diff --git a/components/driver/mcpwm/include/driver/mcpwm_timer.h b/components/esp_driver_mcpwm/include/driver/mcpwm_timer.h similarity index 100% rename from components/driver/mcpwm/include/driver/mcpwm_timer.h rename to components/esp_driver_mcpwm/include/driver/mcpwm_timer.h diff --git a/components/driver/mcpwm/include/driver/mcpwm_types.h b/components/esp_driver_mcpwm/include/driver/mcpwm_types.h similarity index 100% rename from components/driver/mcpwm/include/driver/mcpwm_types.h rename to components/esp_driver_mcpwm/include/driver/mcpwm_types.h diff --git a/components/driver/include/esp_private/mcpwm.h b/components/esp_driver_mcpwm/include/esp_private/mcpwm.h similarity index 100% rename from components/driver/include/esp_private/mcpwm.h rename to components/esp_driver_mcpwm/include/esp_private/mcpwm.h diff --git a/components/driver/mcpwm/linker.lf b/components/esp_driver_mcpwm/linker.lf similarity index 85% rename from components/driver/mcpwm/linker.lf rename to components/esp_driver_mcpwm/linker.lf index ccc448ea74..7729fa00f1 100644 --- a/components/driver/mcpwm/linker.lf +++ b/components/esp_driver_mcpwm/linker.lf @@ -1,5 +1,5 @@ [mapping:mcpwm_driver] -archive: libdriver.a +archive: libesp_driver_mcpwm.a entries: if MCPWM_CTRL_FUNC_IN_IRAM = y: mcpwm_cmpr: mcpwm_comparator_set_compare_value (noflash) diff --git a/components/driver/mcpwm/mcpwm_cap.c b/components/esp_driver_mcpwm/src/mcpwm_cap.c similarity index 98% rename from components/driver/mcpwm/mcpwm_cap.c rename to components/esp_driver_mcpwm/src/mcpwm_cap.c index fda51f38c8..d369530005 100644 --- a/components/driver/mcpwm/mcpwm_cap.c +++ b/components/esp_driver_mcpwm/src/mcpwm_cap.c @@ -392,8 +392,8 @@ esp_err_t mcpwm_capture_channel_register_event_callbacks(mcpwm_cap_channel_handl int isr_flags = MCPWM_INTR_ALLOC_FLAG; isr_flags |= mcpwm_get_intr_priority_flag(group); ESP_RETURN_ON_ERROR(esp_intr_alloc_intrstatus(mcpwm_periph_signals.groups[group_id].irq_id, isr_flags, - (uint32_t)mcpwm_ll_intr_get_status_reg(hal->dev), MCPWM_LL_EVENT_CAPTURE(cap_chan_id), - mcpwm_capture_default_isr, cap_channel, &cap_channel->intr), TAG, "install interrupt service for cap channel failed"); + (uint32_t)mcpwm_ll_intr_get_status_reg(hal->dev), MCPWM_LL_EVENT_CAPTURE(cap_chan_id), + mcpwm_capture_default_isr, cap_channel, &cap_channel->intr), TAG, "install interrupt service for cap channel failed"); } portENTER_CRITICAL(&group->spinlock); diff --git a/components/driver/mcpwm/mcpwm_cmpr.c b/components/esp_driver_mcpwm/src/mcpwm_cmpr.c similarity index 97% rename from components/driver/mcpwm/mcpwm_cmpr.c rename to components/esp_driver_mcpwm/src/mcpwm_cmpr.c index 1fccdc7d06..307d0b026c 100644 --- a/components/driver/mcpwm/mcpwm_cmpr.c +++ b/components/esp_driver_mcpwm/src/mcpwm_cmpr.c @@ -255,8 +255,8 @@ esp_err_t mcpwm_comparator_register_event_callbacks(mcpwm_cmpr_handle_t cmpr, co int isr_flags = MCPWM_INTR_ALLOC_FLAG & ~ ESP_INTR_FLAG_INTRDISABLED; isr_flags |= mcpwm_get_intr_priority_flag(group); ESP_RETURN_ON_ERROR(esp_intr_alloc_intrstatus(mcpwm_periph_signals.groups[group_id].irq_id, isr_flags, - (uint32_t)mcpwm_ll_intr_get_status_reg(hal->dev), MCPWM_LL_EVENT_CMP_EQUAL(oper_id, cmpr_id), - mcpwm_comparator_default_isr, oper_cmpr, &oper_cmpr->intr), TAG, "install interrupt service for comparator failed"); + (uint32_t)mcpwm_ll_intr_get_status_reg(hal->dev), MCPWM_LL_EVENT_CMP_EQUAL(oper_id, cmpr_id), + mcpwm_comparator_default_isr, oper_cmpr, &oper_cmpr->intr), TAG, "install interrupt service for comparator failed"); } portENTER_CRITICAL(&group->spinlock); diff --git a/components/driver/mcpwm/mcpwm_com.c b/components/esp_driver_mcpwm/src/mcpwm_com.c similarity index 100% rename from components/driver/mcpwm/mcpwm_com.c rename to components/esp_driver_mcpwm/src/mcpwm_com.c diff --git a/components/driver/mcpwm/mcpwm_etm.c b/components/esp_driver_mcpwm/src/mcpwm_etm.c similarity index 100% rename from components/driver/mcpwm/mcpwm_etm.c rename to components/esp_driver_mcpwm/src/mcpwm_etm.c diff --git a/components/driver/mcpwm/mcpwm_fault.c b/components/esp_driver_mcpwm/src/mcpwm_fault.c similarity index 97% rename from components/driver/mcpwm/mcpwm_fault.c rename to components/esp_driver_mcpwm/src/mcpwm_fault.c index 52070ca712..5961b1eec8 100644 --- a/components/driver/mcpwm/mcpwm_fault.c +++ b/components/esp_driver_mcpwm/src/mcpwm_fault.c @@ -255,8 +255,8 @@ esp_err_t mcpwm_fault_register_event_callbacks(mcpwm_fault_handle_t fault, const int isr_flags = MCPWM_INTR_ALLOC_FLAG & ~ESP_INTR_FLAG_INTRDISABLED; isr_flags |= mcpwm_get_intr_priority_flag(group); ESP_RETURN_ON_ERROR(esp_intr_alloc_intrstatus(mcpwm_periph_signals.groups[group_id].irq_id, isr_flags, - (uint32_t)mcpwm_ll_intr_get_status_reg(hal->dev), MCPWM_LL_EVENT_FAULT_MASK(fault_id), - mcpwm_gpio_fault_default_isr, gpio_fault, &gpio_fault->intr), TAG, "install interrupt service for gpio fault failed"); + (uint32_t)mcpwm_ll_intr_get_status_reg(hal->dev), MCPWM_LL_EVENT_FAULT_MASK(fault_id), + mcpwm_gpio_fault_default_isr, gpio_fault, &gpio_fault->intr), TAG, "install interrupt service for gpio fault failed"); } // different mcpwm events share the same interrupt control register diff --git a/components/driver/mcpwm/mcpwm_gen.c b/components/esp_driver_mcpwm/src/mcpwm_gen.c similarity index 95% rename from components/driver/mcpwm/mcpwm_gen.c rename to components/esp_driver_mcpwm/src/mcpwm_gen.c index 47db3f176f..fd7eaf3267 100644 --- a/components/driver/mcpwm/mcpwm_gen.c +++ b/components/esp_driver_mcpwm/src/mcpwm_gen.c @@ -167,7 +167,7 @@ esp_err_t mcpwm_generator_set_action_on_timer_event(mcpwm_gen_handle_t gen, mcpw ESP_RETURN_ON_FALSE(false, ESP_ERR_INVALID_ARG, TAG, "UTEP and DTEZ can't be reached under MCPWM_TIMER_COUNT_MODE_UP_DOWN mode"); } mcpwm_ll_generator_set_action_on_timer_event(group->hal.dev, oper->oper_id, gen->gen_id, - ev_act.direction, ev_act.event, ev_act.action); + ev_act.direction, ev_act.event, ev_act.action); return ESP_OK; } @@ -195,7 +195,7 @@ esp_err_t mcpwm_generator_set_actions_on_timer_event(mcpwm_gen_handle_t gen, mcp ESP_RETURN_ON_FALSE(false, ESP_ERR_INVALID_ARG, TAG, "UTEP and DTEZ can't be reached under MCPWM_TIMER_COUNT_MODE_UP_DOWN mode"); } mcpwm_ll_generator_set_action_on_timer_event(group->hal.dev, oper->oper_id, gen->gen_id, - ev_act_itor.direction, ev_act_itor.event, ev_act_itor.action); + ev_act_itor.direction, ev_act_itor.event, ev_act_itor.action); ev_act_itor = va_arg(it, mcpwm_gen_timer_event_action_t); } va_end(it); @@ -209,7 +209,7 @@ esp_err_t mcpwm_generator_set_action_on_compare_event(mcpwm_gen_handle_t gen, mc mcpwm_oper_t *oper = gen->oper; mcpwm_group_t *group = oper->group; mcpwm_ll_generator_set_action_on_compare_event(group->hal.dev, oper->oper_id, gen->gen_id, - ev_act.direction, ev_act.comparator->cmpr_id, ev_act.action); + ev_act.direction, ev_act.comparator->cmpr_id, ev_act.action); return ESP_OK; } @@ -223,7 +223,7 @@ esp_err_t mcpwm_generator_set_actions_on_compare_event(mcpwm_gen_handle_t gen, m va_start(it, ev_act); while (ev_act_itor.comparator) { mcpwm_ll_generator_set_action_on_compare_event(group->hal.dev, oper->oper_id, gen->gen_id, - ev_act_itor.direction, ev_act_itor.comparator->cmpr_id, ev_act_itor.action); + ev_act_itor.direction, ev_act_itor.comparator->cmpr_id, ev_act_itor.action); ev_act_itor = va_arg(it, mcpwm_gen_compare_event_action_t); } va_end(it); @@ -237,7 +237,7 @@ esp_err_t mcpwm_generator_set_action_on_brake_event(mcpwm_gen_handle_t gen, mcpw mcpwm_oper_t *oper = gen->oper; mcpwm_group_t *group = oper->group; mcpwm_ll_generator_set_action_on_brake_event(group->hal.dev, oper->oper_id, gen->gen_id, - ev_act.direction, ev_act.brake_mode, ev_act.action); + ev_act.direction, ev_act.brake_mode, ev_act.action); return ESP_OK; } @@ -251,7 +251,7 @@ esp_err_t mcpwm_generator_set_actions_on_brake_event(mcpwm_gen_handle_t gen, mcp va_start(it, ev_act); while (ev_act_itor.brake_mode != MCPWM_OPER_BRAKE_MODE_INVALID) { mcpwm_ll_generator_set_action_on_brake_event(group->hal.dev, oper->oper_id, gen->gen_id, - ev_act_itor.direction, ev_act_itor.brake_mode, ev_act_itor.action); + ev_act_itor.direction, ev_act_itor.brake_mode, ev_act_itor.action); ev_act_itor = va_arg(it, mcpwm_gen_brake_event_action_t); } va_end(it); @@ -280,7 +280,7 @@ esp_err_t mcpwm_generator_set_action_on_fault_event(mcpwm_gen_handle_t gen, mcpw mcpwm_gpio_fault_t *gpio_fault = __containerof(fault, mcpwm_gpio_fault_t, base); mcpwm_ll_operator_set_trigger_from_gpio_fault(group->hal.dev, oper->oper_id, trigger_id, gpio_fault->fault_id); mcpwm_ll_generator_set_action_on_trigger_event(group->hal.dev, oper->oper_id, gen->gen_id, - ev_act.direction, trigger_id, ev_act.action); + ev_act.direction, trigger_id, ev_act.action); return ESP_OK; } @@ -308,7 +308,7 @@ esp_err_t mcpwm_generator_set_action_on_sync_event(mcpwm_gen_handle_t gen, mcpwm ESP_RETURN_ON_FALSE(trigger_id >= 0, ESP_ERR_NOT_FOUND, TAG, "no free trigger in operator (%d,%d)", group->group_id, oper->oper_id); mcpwm_ll_operator_set_trigger_from_sync(group->hal.dev, oper->oper_id, trigger_id); mcpwm_ll_generator_set_action_on_trigger_event(group->hal.dev, oper->oper_id, gen->gen_id, - ev_act.direction, trigger_id, ev_act.action); + ev_act.direction, trigger_id, ev_act.action); return ESP_OK; } diff --git a/components/driver/mcpwm/mcpwm_oper.c b/components/esp_driver_mcpwm/src/mcpwm_oper.c similarity index 98% rename from components/driver/mcpwm/mcpwm_oper.c rename to components/esp_driver_mcpwm/src/mcpwm_oper.c index 27167d477e..ce8d3a7f09 100644 --- a/components/driver/mcpwm/mcpwm_oper.c +++ b/components/esp_driver_mcpwm/src/mcpwm_oper.c @@ -258,8 +258,8 @@ esp_err_t mcpwm_operator_register_event_callbacks(mcpwm_oper_handle_t oper, cons int isr_flags = MCPWM_INTR_ALLOC_FLAG & ~ ESP_INTR_FLAG_INTRDISABLED; isr_flags |= mcpwm_get_intr_priority_flag(group); ESP_RETURN_ON_ERROR(esp_intr_alloc_intrstatus(mcpwm_periph_signals.groups[group_id].irq_id, isr_flags, - (uint32_t)mcpwm_ll_intr_get_status_reg(hal->dev), MCPWM_LL_EVENT_OPER_MASK(oper_id), - mcpwm_operator_default_isr, oper, &oper->intr), TAG, "install interrupt service for operator failed"); + (uint32_t)mcpwm_ll_intr_get_status_reg(hal->dev), MCPWM_LL_EVENT_OPER_MASK(oper_id), + mcpwm_operator_default_isr, oper, &oper->intr), TAG, "install interrupt service for operator failed"); } // enable/disable interrupt events diff --git a/components/driver/mcpwm/mcpwm_private.h b/components/esp_driver_mcpwm/src/mcpwm_private.h similarity index 100% rename from components/driver/mcpwm/mcpwm_private.h rename to components/esp_driver_mcpwm/src/mcpwm_private.h diff --git a/components/driver/mcpwm/mcpwm_sync.c b/components/esp_driver_mcpwm/src/mcpwm_sync.c similarity index 100% rename from components/driver/mcpwm/mcpwm_sync.c rename to components/esp_driver_mcpwm/src/mcpwm_sync.c diff --git a/components/driver/mcpwm/mcpwm_timer.c b/components/esp_driver_mcpwm/src/mcpwm_timer.c similarity index 100% rename from components/driver/mcpwm/mcpwm_timer.c rename to components/esp_driver_mcpwm/src/mcpwm_timer.c diff --git a/components/esp_driver_mcpwm/test_apps/.build-test-rules.yml b/components/esp_driver_mcpwm/test_apps/.build-test-rules.yml new file mode 100644 index 0000000000..cbc941233c --- /dev/null +++ b/components/esp_driver_mcpwm/test_apps/.build-test-rules.yml @@ -0,0 +1,7 @@ +# Documentation: .gitlab/ci/README.md#manifest-file-to-control-the-buildtest-apps + +components/esp_driver_mcpwm/test_apps/mcpwm: + disable: + - if: SOC_MCPWM_SUPPORTED != 1 + depends_components: + - esp_driver_mcpwm diff --git a/components/driver/test_apps/mcpwm/CMakeLists.txt b/components/esp_driver_mcpwm/test_apps/mcpwm/CMakeLists.txt similarity index 87% rename from components/driver/test_apps/mcpwm/CMakeLists.txt rename to components/esp_driver_mcpwm/test_apps/mcpwm/CMakeLists.txt index 9e9a606d46..9bd915a8ce 100644 --- a/components/driver/test_apps/mcpwm/CMakeLists.txt +++ b/components/esp_driver_mcpwm/test_apps/mcpwm/CMakeLists.txt @@ -10,7 +10,7 @@ project(mcpwm_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_mcpwm/,${CMAKE_BINARY_DIR}/esp-idf/hal/ --elf-file ${CMAKE_BINARY_DIR}/mcpwm_test.elf find-refs --from-sections=.iram0.text diff --git a/components/driver/test_apps/mcpwm/README.md b/components/esp_driver_mcpwm/test_apps/mcpwm/README.md similarity index 100% rename from components/driver/test_apps/mcpwm/README.md rename to components/esp_driver_mcpwm/test_apps/mcpwm/README.md diff --git a/components/driver/test_apps/mcpwm/main/CMakeLists.txt b/components/esp_driver_mcpwm/test_apps/mcpwm/main/CMakeLists.txt similarity index 88% rename from components/driver/test_apps/mcpwm/main/CMakeLists.txt rename to components/esp_driver_mcpwm/test_apps/mcpwm/main/CMakeLists.txt index 6cf3fe2cf4..119892a0b4 100644 --- a/components/driver/test_apps/mcpwm/main/CMakeLists.txt +++ b/components/esp_driver_mcpwm/test_apps/mcpwm/main/CMakeLists.txt @@ -16,5 +16,5 @@ endif() # In order for the cases defined by `TEST_CASE` to be linked into the final elf, # the component can be registered as WHOLE_ARCHIVE idf_component_register(SRCS ${srcs} - PRIV_REQUIRES unity driver + PRIV_REQUIRES unity esp_driver_mcpwm esp_driver_gpio WHOLE_ARCHIVE) diff --git a/components/driver/test_apps/mcpwm/main/test_app_main.c b/components/esp_driver_mcpwm/test_apps/mcpwm/main/test_app_main.c similarity index 100% rename from components/driver/test_apps/mcpwm/main/test_app_main.c rename to components/esp_driver_mcpwm/test_apps/mcpwm/main/test_app_main.c diff --git a/components/driver/test_apps/mcpwm/main/test_mcpwm_cap.c b/components/esp_driver_mcpwm/test_apps/mcpwm/main/test_mcpwm_cap.c similarity index 100% rename from components/driver/test_apps/mcpwm/main/test_mcpwm_cap.c rename to components/esp_driver_mcpwm/test_apps/mcpwm/main/test_mcpwm_cap.c diff --git a/components/driver/test_apps/mcpwm/main/test_mcpwm_cmpr.c b/components/esp_driver_mcpwm/test_apps/mcpwm/main/test_mcpwm_cmpr.c similarity index 100% rename from components/driver/test_apps/mcpwm/main/test_mcpwm_cmpr.c rename to components/esp_driver_mcpwm/test_apps/mcpwm/main/test_mcpwm_cmpr.c diff --git a/components/driver/test_apps/mcpwm/main/test_mcpwm_common.c b/components/esp_driver_mcpwm/test_apps/mcpwm/main/test_mcpwm_common.c similarity index 99% rename from components/driver/test_apps/mcpwm/main/test_mcpwm_common.c rename to components/esp_driver_mcpwm/test_apps/mcpwm/main/test_mcpwm_common.c index f31efcc65a..7ec047b454 100644 --- a/components/driver/test_apps/mcpwm/main/test_mcpwm_common.c +++ b/components/esp_driver_mcpwm/test_apps/mcpwm/main/test_mcpwm_common.c @@ -163,7 +163,6 @@ TEST_CASE("mcpwm_group_set_prescale_dynamically", "[mcpwm]") carrier_config.first_pulse_duration_us = 5; TEST_ESP_OK(mcpwm_operator_apply_carrier(oper, &carrier_config)); - TEST_ESP_OK(mcpwm_del_generator(generator)); TEST_ESP_OK(mcpwm_del_operator(oper)); TEST_ESP_OK(mcpwm_del_timer(timer)); diff --git a/components/driver/test_apps/mcpwm/main/test_mcpwm_fault.c b/components/esp_driver_mcpwm/test_apps/mcpwm/main/test_mcpwm_fault.c similarity index 100% rename from components/driver/test_apps/mcpwm/main/test_mcpwm_fault.c rename to components/esp_driver_mcpwm/test_apps/mcpwm/main/test_mcpwm_fault.c diff --git a/components/driver/test_apps/mcpwm/main/test_mcpwm_gen.c b/components/esp_driver_mcpwm/test_apps/mcpwm/main/test_mcpwm_gen.c similarity index 79% rename from components/driver/test_apps/mcpwm/main/test_mcpwm_gen.c rename to components/esp_driver_mcpwm/test_apps/mcpwm/main/test_mcpwm_gen.c index f4a6fef386..dcfc749e6e 100644 --- a/components/driver/test_apps/mcpwm/main/test_mcpwm_gen.c +++ b/components/esp_driver_mcpwm/test_apps/mcpwm/main/test_mcpwm_gen.c @@ -170,7 +170,7 @@ TEST_CASE("mcpwm_generator_force_level_recovery", "[mcpwm]") TEST_ESP_OK(mcpwm_generator_set_force_level(generator, 0, false)); TEST_ASSERT_EQUAL(0, gpio_get_level(gen_gpio)); TEST_ESP_OK(mcpwm_generator_set_action_on_timer_event(generator, - MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH))); + MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH))); // generator should output high level on tez event, the previous force level should disappear TEST_ESP_OK(mcpwm_timer_start_stop(timer, MCPWM_TIMER_START_NO_STOP)); vTaskDelay(pdMS_TO_TICKS(200)); @@ -181,7 +181,7 @@ TEST_CASE("mcpwm_generator_force_level_recovery", "[mcpwm]") TEST_ESP_OK(mcpwm_generator_set_force_level(generator, 1, false)); TEST_ASSERT_EQUAL(1, gpio_get_level(gen_gpio)); TEST_ESP_OK(mcpwm_generator_set_action_on_timer_event(generator, - MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_LOW))); + MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_LOW))); // generator should output low level on tez event, the previous force level should disappear TEST_ESP_OK(mcpwm_timer_start_stop(timer, MCPWM_TIMER_START_NO_STOP)); vTaskDelay(pdMS_TO_TICKS(200)); @@ -230,9 +230,9 @@ TEST_CASE("mcpwm_generator_action_on_timer_event", "[mcpwm]") printf("set generator to output high on timer full\r\n"); TEST_ESP_OK(mcpwm_generator_set_actions_on_timer_event(gen, - MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_FULL, MCPWM_GEN_ACTION_HIGH), - MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_KEEP), - MCPWM_GEN_TIMER_EVENT_ACTION_END())); + MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_FULL, MCPWM_GEN_ACTION_HIGH), + MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_KEEP), + MCPWM_GEN_TIMER_EVENT_ACTION_END())); printf("start timer\r\n"); TEST_ESP_OK(mcpwm_timer_start_stop(timer, MCPWM_TIMER_START_NO_STOP)); vTaskDelay(pdMS_TO_TICKS(100)); @@ -242,9 +242,9 @@ TEST_CASE("mcpwm_generator_action_on_timer_event", "[mcpwm]") printf("set generator to output low on timer full\r\n"); TEST_ESP_OK(mcpwm_generator_set_actions_on_timer_event(gen, - MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_FULL, MCPWM_GEN_ACTION_LOW), - MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_KEEP), - MCPWM_GEN_TIMER_EVENT_ACTION_END())); + MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_FULL, MCPWM_GEN_ACTION_LOW), + MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_KEEP), + MCPWM_GEN_TIMER_EVENT_ACTION_END())); printf("start timer\r\n"); TEST_ESP_OK(mcpwm_timer_start_stop(timer, MCPWM_TIMER_START_NO_STOP)); vTaskDelay(pdMS_TO_TICKS(100)); @@ -262,7 +262,7 @@ TEST_CASE("mcpwm_generator_action_on_timer_event", "[mcpwm]") typedef void (*set_gen_actions_cb_t)(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb, mcpwm_cmpr_handle_t cmpa, mcpwm_cmpr_handle_t cmpb); static void mcpwm_gen_action_test_template(uint32_t timer_resolution, uint32_t period, mcpwm_timer_count_mode_t count_mode, - uint32_t cmpa, uint32_t cmpb, int gpioa, int gpiob, set_gen_actions_cb_t set_generator_actions) + uint32_t cmpa, uint32_t cmpb, int gpioa, int gpiob, set_gen_actions_cb_t set_generator_actions) { mcpwm_timer_config_t timer_config = { .group_id = 0, @@ -321,72 +321,72 @@ static void mcpwm_gen_action_test_template(uint32_t timer_resolution, uint32_t p static void single_edge_active_high(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb, mcpwm_cmpr_handle_t cmpa, mcpwm_cmpr_handle_t cmpb) { TEST_ESP_OK(mcpwm_generator_set_action_on_timer_event(gena, - MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH))); + MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH))); TEST_ESP_OK(mcpwm_generator_set_action_on_compare_event(gena, - MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpa, MCPWM_GEN_ACTION_LOW))); + MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpa, MCPWM_GEN_ACTION_LOW))); TEST_ESP_OK(mcpwm_generator_set_action_on_timer_event(genb, - MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH))); + MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH))); TEST_ESP_OK(mcpwm_generator_set_action_on_compare_event(genb, - MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpb, MCPWM_GEN_ACTION_LOW))); + MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpb, MCPWM_GEN_ACTION_LOW))); } static void single_edge_active_low(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb, mcpwm_cmpr_handle_t cmpa, mcpwm_cmpr_handle_t cmpb) { TEST_ESP_OK(mcpwm_generator_set_action_on_timer_event(gena, - MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_FULL, MCPWM_GEN_ACTION_LOW))); + MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_FULL, MCPWM_GEN_ACTION_LOW))); TEST_ESP_OK(mcpwm_generator_set_action_on_compare_event(gena, - MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpa, MCPWM_GEN_ACTION_HIGH))); + MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpa, MCPWM_GEN_ACTION_HIGH))); TEST_ESP_OK(mcpwm_generator_set_action_on_timer_event(genb, - MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_FULL, MCPWM_GEN_ACTION_LOW))); + MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_FULL, MCPWM_GEN_ACTION_LOW))); TEST_ESP_OK(mcpwm_generator_set_action_on_compare_event(genb, - MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpb, MCPWM_GEN_ACTION_HIGH))); + MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpb, MCPWM_GEN_ACTION_HIGH))); } static void pulse_placement(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb, mcpwm_cmpr_handle_t cmpa, mcpwm_cmpr_handle_t cmpb) { TEST_ESP_OK(mcpwm_generator_set_actions_on_compare_event(gena, - MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpa, MCPWM_GEN_ACTION_HIGH), - MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpb, MCPWM_GEN_ACTION_LOW), - MCPWM_GEN_COMPARE_EVENT_ACTION_END())); + MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpa, MCPWM_GEN_ACTION_HIGH), + MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpb, MCPWM_GEN_ACTION_LOW), + MCPWM_GEN_COMPARE_EVENT_ACTION_END())); TEST_ESP_OK(mcpwm_generator_set_actions_on_timer_event(genb, - MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_TOGGLE), - MCPWM_GEN_TIMER_EVENT_ACTION_END())); + MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_TOGGLE), + MCPWM_GEN_TIMER_EVENT_ACTION_END())); } static void dual_edge_active_low_asym(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb, mcpwm_cmpr_handle_t cmpa, mcpwm_cmpr_handle_t cmpb) { TEST_ESP_OK(mcpwm_generator_set_actions_on_compare_event(gena, - MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpa, MCPWM_GEN_ACTION_HIGH), - MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_DOWN, cmpb, MCPWM_GEN_ACTION_LOW), - MCPWM_GEN_COMPARE_EVENT_ACTION_END())); + MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpa, MCPWM_GEN_ACTION_HIGH), + MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_DOWN, cmpb, MCPWM_GEN_ACTION_LOW), + MCPWM_GEN_COMPARE_EVENT_ACTION_END())); TEST_ESP_OK(mcpwm_generator_set_actions_on_timer_event(genb, - MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_LOW), - MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_DOWN, MCPWM_TIMER_EVENT_FULL, MCPWM_GEN_ACTION_HIGH), - MCPWM_GEN_TIMER_EVENT_ACTION_END())); + MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_LOW), + MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_DOWN, MCPWM_TIMER_EVENT_FULL, MCPWM_GEN_ACTION_HIGH), + MCPWM_GEN_TIMER_EVENT_ACTION_END())); } static void dual_edge_active_low_sym(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb, mcpwm_cmpr_handle_t cmpa, mcpwm_cmpr_handle_t cmpb) { TEST_ESP_OK(mcpwm_generator_set_actions_on_compare_event(gena, - MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpa, MCPWM_GEN_ACTION_HIGH), - MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_DOWN, cmpa, MCPWM_GEN_ACTION_LOW), - MCPWM_GEN_COMPARE_EVENT_ACTION_END())); + MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpa, MCPWM_GEN_ACTION_HIGH), + MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_DOWN, cmpa, MCPWM_GEN_ACTION_LOW), + MCPWM_GEN_COMPARE_EVENT_ACTION_END())); TEST_ESP_OK(mcpwm_generator_set_actions_on_compare_event(genb, - MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpb, MCPWM_GEN_ACTION_HIGH), - MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_DOWN, cmpb, MCPWM_GEN_ACTION_LOW), - MCPWM_GEN_COMPARE_EVENT_ACTION_END())); + MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpb, MCPWM_GEN_ACTION_HIGH), + MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_DOWN, cmpb, MCPWM_GEN_ACTION_LOW), + MCPWM_GEN_COMPARE_EVENT_ACTION_END())); } static void dual_edge_complementary(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb, mcpwm_cmpr_handle_t cmpa, mcpwm_cmpr_handle_t cmpb) { TEST_ESP_OK(mcpwm_generator_set_actions_on_compare_event(gena, - MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpa, MCPWM_GEN_ACTION_HIGH), - MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_DOWN, cmpa, MCPWM_GEN_ACTION_LOW), - MCPWM_GEN_COMPARE_EVENT_ACTION_END())); + MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpa, MCPWM_GEN_ACTION_HIGH), + MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_DOWN, cmpa, MCPWM_GEN_ACTION_LOW), + MCPWM_GEN_COMPARE_EVENT_ACTION_END())); TEST_ESP_OK(mcpwm_generator_set_actions_on_compare_event(genb, - MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpb, MCPWM_GEN_ACTION_LOW), - MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_DOWN, cmpb, MCPWM_GEN_ACTION_HIGH), - MCPWM_GEN_COMPARE_EVENT_ACTION_END())); + MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpb, MCPWM_GEN_ACTION_LOW), + MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_DOWN, cmpb, MCPWM_GEN_ACTION_HIGH), + MCPWM_GEN_COMPARE_EVENT_ACTION_END())); } TEST_CASE("mcpwm_generator_action_on_compare_event", "[mcpwm]") @@ -425,7 +425,7 @@ TEST_CASE("mcpwm_generator_action_on_compare_event", "[mcpwm]") typedef void (*set_dead_time_cb_t)(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb); static void mcpwm_deadtime_test_template(uint32_t timer_resolution, uint32_t period, uint32_t cmpa, uint32_t cmpb, int gpioa, int gpiob, - set_gen_actions_cb_t set_generator_actions, set_dead_time_cb_t set_dead_time) + set_gen_actions_cb_t set_generator_actions, set_dead_time_cb_t set_dead_time) { mcpwm_timer_config_t timer_config = { .group_id = 0, @@ -485,9 +485,9 @@ static void mcpwm_deadtime_test_template(uint32_t timer_resolution, uint32_t per static void ahc_set_generator_actions(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb, mcpwm_cmpr_handle_t cmpa, mcpwm_cmpr_handle_t cmpb) { TEST_ESP_OK(mcpwm_generator_set_action_on_timer_event(gena, - MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH))); + MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH))); TEST_ESP_OK(mcpwm_generator_set_action_on_compare_event(gena, - MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpa, MCPWM_GEN_ACTION_LOW))); + MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpa, MCPWM_GEN_ACTION_LOW))); } static void ahc_set_dead_time(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb) @@ -506,9 +506,9 @@ static void ahc_set_dead_time(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb) static void alc_set_generator_actions(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb, mcpwm_cmpr_handle_t cmpa, mcpwm_cmpr_handle_t cmpb) { TEST_ESP_OK(mcpwm_generator_set_action_on_timer_event(gena, - MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH))); + MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH))); TEST_ESP_OK(mcpwm_generator_set_action_on_compare_event(gena, - MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpa, MCPWM_GEN_ACTION_LOW))); + MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpa, MCPWM_GEN_ACTION_LOW))); } static void alc_set_dead_time(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb) @@ -528,9 +528,9 @@ static void alc_set_dead_time(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb) static void ah_set_generator_actions(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb, mcpwm_cmpr_handle_t cmpa, mcpwm_cmpr_handle_t cmpb) { TEST_ESP_OK(mcpwm_generator_set_action_on_timer_event(gena, - MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH))); + MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH))); TEST_ESP_OK(mcpwm_generator_set_action_on_compare_event(gena, - MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpa, MCPWM_GEN_ACTION_LOW))); + MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpa, MCPWM_GEN_ACTION_LOW))); } static void ah_set_dead_time(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb) @@ -548,9 +548,9 @@ static void ah_set_dead_time(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb) static void al_set_generator_actions(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb, mcpwm_cmpr_handle_t cmpa, mcpwm_cmpr_handle_t cmpb) { TEST_ESP_OK(mcpwm_generator_set_action_on_timer_event(gena, - MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH))); + MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH))); TEST_ESP_OK(mcpwm_generator_set_action_on_compare_event(gena, - MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpa, MCPWM_GEN_ACTION_LOW))); + MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpa, MCPWM_GEN_ACTION_LOW))); } static void al_set_dead_time(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb) @@ -569,13 +569,13 @@ static void al_set_dead_time(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb) static void reda_only_set_generator_actions(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb, mcpwm_cmpr_handle_t cmpa, mcpwm_cmpr_handle_t cmpb) { TEST_ESP_OK(mcpwm_generator_set_action_on_timer_event(gena, - MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH))); + MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH))); TEST_ESP_OK(mcpwm_generator_set_action_on_compare_event(gena, - MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpa, MCPWM_GEN_ACTION_LOW))); + MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpa, MCPWM_GEN_ACTION_LOW))); TEST_ESP_OK(mcpwm_generator_set_action_on_timer_event(genb, - MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH))); + MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH))); TEST_ESP_OK(mcpwm_generator_set_action_on_compare_event(genb, - MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpb, MCPWM_GEN_ACTION_LOW))); + MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpb, MCPWM_GEN_ACTION_LOW))); } static void reda_only_set_dead_time(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb) @@ -594,13 +594,13 @@ static void reda_only_set_dead_time(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t static void fedb_only_set_generator_actions(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb, mcpwm_cmpr_handle_t cmpa, mcpwm_cmpr_handle_t cmpb) { TEST_ESP_OK(mcpwm_generator_set_action_on_timer_event(gena, - MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH))); + MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH))); TEST_ESP_OK(mcpwm_generator_set_action_on_compare_event(gena, - MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpa, MCPWM_GEN_ACTION_LOW))); + MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpa, MCPWM_GEN_ACTION_LOW))); TEST_ESP_OK(mcpwm_generator_set_action_on_timer_event(genb, - MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH))); + MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH))); TEST_ESP_OK(mcpwm_generator_set_action_on_compare_event(genb, - MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpb, MCPWM_GEN_ACTION_LOW))); + MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpb, MCPWM_GEN_ACTION_LOW))); } static void fedb_only_set_dead_time(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb) @@ -620,13 +620,13 @@ static void fedb_only_set_dead_time(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t static void redfedb_only_set_generator_actions(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb, mcpwm_cmpr_handle_t cmpa, mcpwm_cmpr_handle_t cmpb) { TEST_ESP_OK(mcpwm_generator_set_action_on_timer_event(gena, - MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH))); + MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH))); TEST_ESP_OK(mcpwm_generator_set_action_on_compare_event(gena, - MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpa, MCPWM_GEN_ACTION_LOW))); + MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpa, MCPWM_GEN_ACTION_LOW))); TEST_ESP_OK(mcpwm_generator_set_action_on_timer_event(genb, - MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH))); + MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH))); TEST_ESP_OK(mcpwm_generator_set_action_on_compare_event(genb, - MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpb, MCPWM_GEN_ACTION_LOW))); + MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpb, MCPWM_GEN_ACTION_LOW))); } static void redfedb_only_set_dead_time(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb) @@ -727,9 +727,9 @@ TEST_CASE("mcpwm_duty_empty_full", "[mcpwm]") printf("set generator actions on timer and compare events\r\n"); TEST_ESP_OK(mcpwm_generator_set_action_on_timer_event(gen, - MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH))); + MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH))); TEST_ESP_OK(mcpwm_generator_set_action_on_compare_event(gen, - MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, comparator, MCPWM_GEN_ACTION_LOW))); + MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, comparator, MCPWM_GEN_ACTION_LOW))); printf("start timer\r\n"); TEST_ESP_OK(mcpwm_timer_enable(timer)); @@ -800,12 +800,12 @@ TEST_CASE("mcpwm_generator_action_on_fault_trigger_event", "[mcpwm]") printf("set generator to output high on trigger0 and low on trigger1\r\n"); TEST_ESP_OK(mcpwm_generator_set_action_on_fault_event(gen, - MCPWM_GEN_FAULT_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, gpio_faults[0], MCPWM_GEN_ACTION_HIGH))); + MCPWM_GEN_FAULT_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, gpio_faults[0], MCPWM_GEN_ACTION_HIGH))); TEST_ESP_OK(mcpwm_generator_set_action_on_fault_event(gen, - MCPWM_GEN_FAULT_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, gpio_faults[1], MCPWM_GEN_ACTION_LOW))); + MCPWM_GEN_FAULT_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, gpio_faults[1], MCPWM_GEN_ACTION_LOW))); // no free trigger TEST_ESP_ERR(ESP_ERR_NOT_FOUND, mcpwm_generator_set_action_on_fault_event(gen, - MCPWM_GEN_FAULT_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, gpio_faults[2], MCPWM_GEN_ACTION_LOW))); + MCPWM_GEN_FAULT_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, gpio_faults[2], MCPWM_GEN_ACTION_LOW))); TEST_ASSERT_EQUAL(0, gpio_get_level(generator_gpio)); gpio_set_level(fault_gpio_num[0], 1); @@ -872,13 +872,13 @@ TEST_CASE("mcpwm_generator_action_on_soft_sync_trigger_event", "[mcpwm]") printf("set generator to output high on soft sync trigger\r\n"); TEST_ESP_OK(mcpwm_generator_set_action_on_sync_event(gen, - MCPWM_GEN_SYNC_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, soft_sync, MCPWM_GEN_ACTION_HIGH))); + MCPWM_GEN_SYNC_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, soft_sync, MCPWM_GEN_ACTION_HIGH))); //more than 1 sync is not supported mcpwm_sync_handle_t invalid_soft_sync = NULL; TEST_ESP_OK(mcpwm_new_soft_sync_src(&soft_sync_config, &invalid_soft_sync)); TEST_ESP_ERR(ESP_ERR_INVALID_STATE, mcpwm_generator_set_action_on_sync_event(gen, - MCPWM_GEN_SYNC_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, invalid_soft_sync, MCPWM_GEN_ACTION_LOW))); + MCPWM_GEN_SYNC_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, invalid_soft_sync, MCPWM_GEN_ACTION_LOW))); TEST_ASSERT_EQUAL(0, gpio_get_level(generator_gpio)); mcpwm_soft_sync_activate(soft_sync); @@ -941,7 +941,7 @@ TEST_CASE("mcpwm_generator_action_on_timer_sync_trigger_event", "[mcpwm]") printf("set generator to output high on timer sync trigger\r\n"); TEST_ESP_OK(mcpwm_generator_set_action_on_sync_event(gen, - MCPWM_GEN_SYNC_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, timer_sync, MCPWM_GEN_ACTION_HIGH))); + MCPWM_GEN_SYNC_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, timer_sync, MCPWM_GEN_ACTION_HIGH))); TEST_ESP_OK(mcpwm_timer_enable(timer)); @@ -1011,7 +1011,7 @@ TEST_CASE("mcpwm_generator_action_on_gpio_sync_trigger_event", "[mcpwm]") printf("set generator to output high on gpio sync trigger\r\n"); TEST_ESP_OK(mcpwm_generator_set_action_on_sync_event(gen, - MCPWM_GEN_SYNC_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, gpio_sync, MCPWM_GEN_ACTION_HIGH))); + MCPWM_GEN_SYNC_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, gpio_sync, MCPWM_GEN_ACTION_HIGH))); TEST_ASSERT_EQUAL(0, gpio_get_level(generator_gpio)); gpio_set_level(gpio_sync_config.gpio_num, 1); diff --git a/components/driver/test_apps/mcpwm/main/test_mcpwm_iram.c b/components/esp_driver_mcpwm/test_apps/mcpwm/main/test_mcpwm_iram.c similarity index 95% rename from components/driver/test_apps/mcpwm/main/test_mcpwm_iram.c rename to components/esp_driver_mcpwm/test_apps/mcpwm/main/test_mcpwm_iram.c index cc60e467c5..0a0ae2fd88 100644 --- a/components/driver/test_apps/mcpwm/main/test_mcpwm_iram.c +++ b/components/esp_driver_mcpwm/test_apps/mcpwm/main/test_mcpwm_iram.c @@ -146,9 +146,9 @@ TEST_CASE("mcpwm_comparator_iram_safe", "[mcpwm]") printf("set generator actions on timer and compare events\r\n"); TEST_ESP_OK(mcpwm_generator_set_action_on_timer_event(gen, - MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH))); + MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH))); TEST_ESP_OK(mcpwm_generator_set_action_on_compare_event(gen, - MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, comparator, MCPWM_GEN_ACTION_LOW))); + MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, comparator, MCPWM_GEN_ACTION_LOW))); printf("register compare event callback\r\n"); mcpwm_comparator_event_callbacks_t cbs = { diff --git a/components/driver/test_apps/mcpwm/main/test_mcpwm_oper.c b/components/esp_driver_mcpwm/test_apps/mcpwm/main/test_mcpwm_oper.c similarity index 91% rename from components/driver/test_apps/mcpwm/main/test_mcpwm_oper.c rename to components/esp_driver_mcpwm/test_apps/mcpwm/main/test_mcpwm_oper.c index c201d4147c..1c138a63bc 100644 --- a/components/driver/test_apps/mcpwm/main/test_mcpwm_oper.c +++ b/components/esp_driver_mcpwm/test_apps/mcpwm/main/test_mcpwm_oper.c @@ -193,15 +193,15 @@ TEST_CASE("mcpwm_operator_brake_on_gpio_fault", "[mcpwm]") printf("set generator actions on timer event\r\n"); TEST_ESP_OK(mcpwm_generator_set_action_on_timer_event(gen_a, - MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_LOW))); + MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_LOW))); TEST_ESP_OK(mcpwm_generator_set_action_on_timer_event(gen_b, - MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_LOW))); + MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_LOW))); printf("set generator actions on brake event\r\n"); TEST_ESP_OK(mcpwm_generator_set_action_on_brake_event(gen_a, - MCPWM_GEN_BRAKE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_OPER_BRAKE_MODE_CBC, MCPWM_GEN_ACTION_HIGH))); + MCPWM_GEN_BRAKE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_OPER_BRAKE_MODE_CBC, MCPWM_GEN_ACTION_HIGH))); TEST_ESP_OK(mcpwm_generator_set_action_on_brake_event(gen_b, - MCPWM_GEN_BRAKE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_OPER_BRAKE_MODE_OST, MCPWM_GEN_ACTION_HIGH))); + MCPWM_GEN_BRAKE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_OPER_BRAKE_MODE_OST, MCPWM_GEN_ACTION_HIGH))); printf("enable and start timer\r\n"); TEST_ESP_OK(mcpwm_timer_enable(timer)); @@ -299,15 +299,15 @@ TEST_CASE("mcpwm_operator_brake_on_soft_fault", "[mcpwm]") printf("set generator actions on timer event\r\n"); TEST_ESP_OK(mcpwm_generator_set_action_on_timer_event(gen_a, - MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_LOW))); + MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_LOW))); TEST_ESP_OK(mcpwm_generator_set_action_on_timer_event(gen_b, - MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_LOW))); + MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_LOW))); printf("set generator actions on brake event\r\n"); TEST_ESP_OK(mcpwm_generator_set_action_on_brake_event(gen_a, - MCPWM_GEN_BRAKE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_OPER_BRAKE_MODE_CBC, MCPWM_GEN_ACTION_HIGH))); + MCPWM_GEN_BRAKE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_OPER_BRAKE_MODE_CBC, MCPWM_GEN_ACTION_HIGH))); TEST_ESP_OK(mcpwm_generator_set_action_on_brake_event(gen_b, - MCPWM_GEN_BRAKE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_OPER_BRAKE_MODE_OST, MCPWM_GEN_ACTION_HIGH))); + MCPWM_GEN_BRAKE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_OPER_BRAKE_MODE_OST, MCPWM_GEN_ACTION_HIGH))); printf("enable and start timer\r\n"); TEST_ESP_OK(mcpwm_timer_enable(timer)); diff --git a/components/driver/test_apps/mcpwm/main/test_mcpwm_sync.c b/components/esp_driver_mcpwm/test_apps/mcpwm/main/test_mcpwm_sync.c similarity index 100% rename from components/driver/test_apps/mcpwm/main/test_mcpwm_sync.c rename to components/esp_driver_mcpwm/test_apps/mcpwm/main/test_mcpwm_sync.c diff --git a/components/driver/test_apps/mcpwm/main/test_mcpwm_timer.c b/components/esp_driver_mcpwm/test_apps/mcpwm/main/test_mcpwm_timer.c similarity index 100% rename from components/driver/test_apps/mcpwm/main/test_mcpwm_timer.c rename to components/esp_driver_mcpwm/test_apps/mcpwm/main/test_mcpwm_timer.c diff --git a/components/driver/test_apps/mcpwm/main/test_mcpwm_utils.c b/components/esp_driver_mcpwm/test_apps/mcpwm/main/test_mcpwm_utils.c similarity index 100% rename from components/driver/test_apps/mcpwm/main/test_mcpwm_utils.c rename to components/esp_driver_mcpwm/test_apps/mcpwm/main/test_mcpwm_utils.c diff --git a/components/driver/test_apps/mcpwm/main/test_mcpwm_utils.h b/components/esp_driver_mcpwm/test_apps/mcpwm/main/test_mcpwm_utils.h similarity index 100% rename from components/driver/test_apps/mcpwm/main/test_mcpwm_utils.h rename to components/esp_driver_mcpwm/test_apps/mcpwm/main/test_mcpwm_utils.h diff --git a/components/driver/test_apps/mcpwm/pytest_mcpwm.py b/components/esp_driver_mcpwm/test_apps/mcpwm/pytest_mcpwm.py similarity index 100% rename from components/driver/test_apps/mcpwm/pytest_mcpwm.py rename to components/esp_driver_mcpwm/test_apps/mcpwm/pytest_mcpwm.py diff --git a/components/driver/test_apps/mcpwm/sdkconfig.ci.iram_safe b/components/esp_driver_mcpwm/test_apps/mcpwm/sdkconfig.ci.iram_safe similarity index 100% rename from components/driver/test_apps/mcpwm/sdkconfig.ci.iram_safe rename to components/esp_driver_mcpwm/test_apps/mcpwm/sdkconfig.ci.iram_safe diff --git a/components/driver/test_apps/mcpwm/sdkconfig.ci.release b/components/esp_driver_mcpwm/test_apps/mcpwm/sdkconfig.ci.release similarity index 100% rename from components/driver/test_apps/mcpwm/sdkconfig.ci.release rename to components/esp_driver_mcpwm/test_apps/mcpwm/sdkconfig.ci.release diff --git a/components/driver/test_apps/mcpwm/sdkconfig.defaults b/components/esp_driver_mcpwm/test_apps/mcpwm/sdkconfig.defaults similarity index 100% rename from components/driver/test_apps/mcpwm/sdkconfig.defaults rename to components/esp_driver_mcpwm/test_apps/mcpwm/sdkconfig.defaults diff --git a/components/esp_driver_pcnt/test_apps/pulse_cnt/main/CMakeLists.txt b/components/esp_driver_pcnt/test_apps/pulse_cnt/main/CMakeLists.txt index 82fd921095..67bb690c46 100644 --- a/components/esp_driver_pcnt/test_apps/pulse_cnt/main/CMakeLists.txt +++ b/components/esp_driver_pcnt/test_apps/pulse_cnt/main/CMakeLists.txt @@ -9,6 +9,5 @@ endif() # In order for the cases defined by `TEST_CASE` to be linked into the final elf, # the component can be registered as WHOLE_ARCHIVE idf_component_register(SRCS ${srcs} - PRIV_REQUIRES unity esp_driver_pcnt spi_flash - driver # will be replaced by esp_driver_gpio + PRIV_REQUIRES unity esp_driver_pcnt esp_driver_gpio spi_flash WHOLE_ARCHIVE) diff --git a/components/esp_hw_support/test_apps/.build-test-rules.yml b/components/esp_hw_support/test_apps/.build-test-rules.yml index badd45f01a..7db7e32420 100644 --- a/components/esp_hw_support/test_apps/.build-test-rules.yml +++ b/components/esp_hw_support/test_apps/.build-test-rules.yml @@ -16,8 +16,9 @@ components/esp_hw_support/test_apps/etm: depends_components: - esp_driver_gptimer - esp_driver_gpio + - esp_driver_mcpwm - esp_timer - - driver # TODO: replace with esp_driver_mcpwm, esp_driver_ana_cmpr + - driver # TODO: replace with esp_driver_ana_cmpr (IDF-8521) components/esp_hw_support/test_apps/host_test_linux: enable: diff --git a/components/esp_hw_support/test_apps/etm/main/CMakeLists.txt b/components/esp_hw_support/test_apps/etm/main/CMakeLists.txt index 7b84296f73..93692b32fd 100644 --- a/components/esp_hw_support/test_apps/etm/main/CMakeLists.txt +++ b/components/esp_hw_support/test_apps/etm/main/CMakeLists.txt @@ -29,6 +29,6 @@ endif() # In order for the cases defined by `TEST_CASE` to be linked into the final elf, # the component can be registered as WHOLE_ARCHIVE idf_component_register(SRCS ${srcs} - PRIV_REQUIRES unity esp_timer esp_driver_gptimer esp_driver_gpio - driver # TODO: replace with esp_driver_mcpwm (IDF-8379), esp_driver_ana_cmpr + PRIV_REQUIRES unity esp_timer esp_driver_gptimer esp_driver_gpio esp_driver_mcpwm + driver # TODO: replace with esp_driver_ana_cmpr (IDF-8521) WHOLE_ARCHIVE) diff --git a/components/hal/include/hal/color_types.h b/components/hal/include/hal/color_types.h index 5ccd6b4ad3..b9cdc60344 100644 --- a/components/hal/include/hal/color_types.h +++ b/components/hal/include/hal/color_types.h @@ -92,7 +92,7 @@ typedef union { Color Conversion ---------------------------------------------------------------*/ /** - * @brief LCD color range + * @brief Color range * @note The difference between a full range color and a limited range color is * the amount of shades of black and white that they can display. */ diff --git a/docs/doxygen/Doxyfile b/docs/doxygen/Doxyfile index 68ab27e866..a56cbec54a 100644 --- a/docs/doxygen/Doxyfile +++ b/docs/doxygen/Doxyfile @@ -89,15 +89,6 @@ INPUT = \ $(PROJECT_PATH)/components/driver/i2s/include/driver/i2s_tdm.h \ $(PROJECT_PATH)/components/driver/i2s/include/driver/i2s_types.h \ $(PROJECT_PATH)/components/driver/ledc/include/driver/ledc.h \ - $(PROJECT_PATH)/components/driver/mcpwm/include/driver/mcpwm_cap.h \ - $(PROJECT_PATH)/components/driver/mcpwm/include/driver/mcpwm_cmpr.h \ - $(PROJECT_PATH)/components/driver/mcpwm/include/driver/mcpwm_etm.h \ - $(PROJECT_PATH)/components/driver/mcpwm/include/driver/mcpwm_fault.h \ - $(PROJECT_PATH)/components/driver/mcpwm/include/driver/mcpwm_gen.h \ - $(PROJECT_PATH)/components/driver/mcpwm/include/driver/mcpwm_oper.h \ - $(PROJECT_PATH)/components/driver/mcpwm/include/driver/mcpwm_sync.h \ - $(PROJECT_PATH)/components/driver/mcpwm/include/driver/mcpwm_timer.h \ - $(PROJECT_PATH)/components/driver/mcpwm/include/driver/mcpwm_types.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 \ @@ -142,6 +133,15 @@ INPUT = \ $(PROJECT_PATH)/components/esp_driver_gptimer/include/driver/gptimer.h \ $(PROJECT_PATH)/components/esp_driver_gptimer/include/driver/gptimer_etm.h \ $(PROJECT_PATH)/components/esp_driver_gptimer/include/driver/gptimer_types.h \ + $(PROJECT_PATH)/components/esp_driver_mcpwm/include/driver/mcpwm_cap.h \ + $(PROJECT_PATH)/components/esp_driver_mcpwm/include/driver/mcpwm_cmpr.h \ + $(PROJECT_PATH)/components/esp_driver_mcpwm/include/driver/mcpwm_etm.h \ + $(PROJECT_PATH)/components/esp_driver_mcpwm/include/driver/mcpwm_fault.h \ + $(PROJECT_PATH)/components/esp_driver_mcpwm/include/driver/mcpwm_gen.h \ + $(PROJECT_PATH)/components/esp_driver_mcpwm/include/driver/mcpwm_oper.h \ + $(PROJECT_PATH)/components/esp_driver_mcpwm/include/driver/mcpwm_sync.h \ + $(PROJECT_PATH)/components/esp_driver_mcpwm/include/driver/mcpwm_timer.h \ + $(PROJECT_PATH)/components/esp_driver_mcpwm/include/driver/mcpwm_types.h \ $(PROJECT_PATH)/components/esp_driver_pcnt/include/driver/pulse_cnt.h \ $(PROJECT_PATH)/components/esp_eth/include/esp_eth_com.h \ $(PROJECT_PATH)/components/esp_eth/include/esp_eth_driver.h \ diff --git a/docs/en/api-reference/peripherals/mcpwm.rst b/docs/en/api-reference/peripherals/mcpwm.rst index 0179156215..9d6acedd8b 100644 --- a/docs/en/api-reference/peripherals/mcpwm.rst +++ b/docs/en/api-reference/peripherals/mcpwm.rst @@ -1044,7 +1044,7 @@ API Reference .. include-build-file:: inc/mcpwm_sync.inc .. include-build-file:: inc/mcpwm_cap.inc .. include-build-file:: inc/mcpwm_etm.inc -.. include-build-file:: inc/components/driver/mcpwm/include/driver/mcpwm_types.inc +.. include-build-file:: inc/components/esp_driver_mcpwm/include/driver/mcpwm_types.inc .. include-build-file:: inc/components/hal/include/hal/mcpwm_types.inc diff --git a/docs/en/migration-guides/release-5.x/5.3/peripherals.rst b/docs/en/migration-guides/release-5.x/5.3/peripherals.rst index 492fef863e..25e7641e9d 100644 --- a/docs/en/migration-guides/release-5.x/5.3/peripherals.rst +++ b/docs/en/migration-guides/release-5.x/5.3/peripherals.rst @@ -9,6 +9,7 @@ In order to control the dependence of other components on drivers at a smaller g - `esp_driver_pcnt` - Driver for pulse counter - `esp_driver_gpio` - Driver for GPIO - `esp_driver_spi` - Driver for GPSPI +- `esp_driver_mcpwm` - Driver for Motor Control PWM 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. diff --git a/docs/zh_CN/api-reference/peripherals/mcpwm.rst b/docs/zh_CN/api-reference/peripherals/mcpwm.rst index 0fc6d89b0c..a0a96de9dc 100644 --- a/docs/zh_CN/api-reference/peripherals/mcpwm.rst +++ b/docs/zh_CN/api-reference/peripherals/mcpwm.rst @@ -1044,7 +1044,7 @@ API Reference .. include-build-file:: inc/mcpwm_sync.inc .. include-build-file:: inc/mcpwm_cap.inc .. include-build-file:: inc/mcpwm_etm.inc -.. include-build-file:: inc/components/driver/mcpwm/include/driver/mcpwm_types.inc +.. include-build-file:: inc/components/esp_driver_mcpwm/include/driver/mcpwm_types.inc .. include-build-file:: inc/components/hal/include/hal/mcpwm_types.inc diff --git a/docs/zh_CN/migration-guides/release-5.x/5.3/peripherals.rst b/docs/zh_CN/migration-guides/release-5.x/5.3/peripherals.rst index 2d9a5c7449..e5a8d8a23e 100644 --- a/docs/zh_CN/migration-guides/release-5.x/5.3/peripherals.rst +++ b/docs/zh_CN/migration-guides/release-5.x/5.3/peripherals.rst @@ -9,6 +9,7 @@ - `esp_driver_pcnt` - 脉冲计数器驱动 - `esp_driver_gpio` - GPIO 驱动 - `esp_driver_spi` - 通用 SPI 驱动 +- `esp_driver_mcpwm` - 电机控制 PWM 驱动 为了兼容性,原来的 `driver` 组件仍然存在,并作为一个 “all-in-one" 的组件,将以上这些 `esp_driver_xyz` 组件注册成自己的公共依赖。换句话说,你无需修改既有项目的 CMake 文件,但是你现在多了一个途径去指定你项目依赖的具体的外设驱动。 diff --git a/examples/peripherals/.build-test-rules.yml b/examples/peripherals/.build-test-rules.yml index bb0d996384..b73f3068e2 100644 --- a/examples/peripherals/.build-test-rules.yml +++ b/examples/peripherals/.build-test-rules.yml @@ -151,10 +151,14 @@ examples/peripherals/ledc/ledc_gamma_curve_fade: examples/peripherals/mcpwm: disable: - if: SOC_MCPWM_SUPPORTED != 1 + depends_components: + - esp_driver_mcpwm examples/peripherals/mcpwm/mcpwm_bdc_speed_control: disable: - if: SOC_MCPWM_SUPPORTED != 1 + depends_components: + - esp_driver_mcpwm disable_test: - if: IDF_TARGET != "esp32s3" temporary: true @@ -163,6 +167,8 @@ examples/peripherals/mcpwm/mcpwm_bdc_speed_control: examples/peripherals/mcpwm/mcpwm_bldc_hall_control: disable: - if: SOC_MCPWM_SUPPORTED != 1 + depends_components: + - esp_driver_mcpwm disable_test: - if: IDF_TARGET != "esp32s3" temporary: true @@ -171,6 +177,8 @@ examples/peripherals/mcpwm/mcpwm_bldc_hall_control: examples/peripherals/mcpwm/mcpwm_foc_svpwm_open_loop: disable: - if: SOC_MCPWM_SUPPORTED != 1 + depends_components: + - esp_driver_mcpwm disable_test: - if: IDF_TARGET != "esp32s3" temporary: true diff --git a/tools/test_apps/system/g1_components/CMakeLists.txt b/tools/test_apps/system/g1_components/CMakeLists.txt index 357a81a635..ef31eac5b8 100644 --- a/tools/test_apps/system/g1_components/CMakeLists.txt +++ b/tools/test_apps/system/g1_components/CMakeLists.txt @@ -35,7 +35,7 @@ set(extra_components_which_shouldnt_be_included cxx # [refactor-todo]: driver is a dependency of esp_pm, spi_flash, vfs, esp_wifi # all of these should be removed from G1 except for spi_flash. - driver esp_driver_gpio esp_driver_pcnt esp_driver_gptimer esp_driver_spi + driver esp_driver_gpio esp_driver_pcnt esp_driver_gptimer esp_driver_spi esp_driver_mcpwm # esp_app_format is dependency of bootloader_support, app_update esp_app_format # esp_bootloader_format is dependency of bootloader_support, app_update