From 1be923acb46bfe32745aed4aee645a129149e115 Mon Sep 17 00:00:00 2001 From: morris Date: Mon, 2 Nov 2020 18:03:33 +0800 Subject: [PATCH] rmt: rename always_on to aware_dfs --- components/driver/include/driver/rmt.h | 6 +++++- components/driver/rmt.c | 2 +- components/driver/test/test_rmt.c | 4 ++-- docs/en/api-reference/peripherals/rmt.rst | 4 ++-- docs/en/api-reference/system/power_management.rst | 2 +- docs/zh_CN/api-reference/system/power_management.rst | 2 +- 6 files changed, 12 insertions(+), 8 deletions(-) diff --git a/components/driver/include/driver/rmt.h b/components/driver/include/driver/rmt.h index ef7f0f2323..3d0f90bf94 100644 --- a/components/driver/include/driver/rmt.h +++ b/components/driver/include/driver/rmt.h @@ -28,7 +28,11 @@ extern "C" { #include "soc/rmt_struct.h" #include "hal/rmt_types.h" -#define RMT_CHANNEL_FLAGS_ALWAYS_ON (1 << 0) /*!< Channel can work during APB clock scaling */ +#define RMT_CHANNEL_FLAGS_AWARE_DFS (1 << 0) /*!< Channel can work during APB clock scaling */ + +/** @cond */ +#define RMT_CHANNEL_FLAGS_ALWAYS_ON RMT_CHANNEL_FLAGS_AWARE_DFS /*!< Deprecated name, defined here for compatibility */ +/** @endcond */ /** * @brief Define memory space of each RMT channel (in words = 4 bytes) diff --git a/components/driver/rmt.c b/components/driver/rmt.c index 08f921bc59..15d489ce12 100644 --- a/components/driver/rmt.c +++ b/components/driver/rmt.c @@ -577,7 +577,7 @@ static esp_err_t rmt_internal_config(rmt_dev_t *dev, const rmt_config_t *rmt_par RMT_ENTER_CRITICAL(); rmt_ll_enable_mem_access(dev, true); - if (rmt_param->flags & RMT_CHANNEL_FLAGS_ALWAYS_ON) { + if (rmt_param->flags & RMT_CHANNEL_FLAGS_AWARE_DFS) { #if SOC_RMT_SUPPORT_XTAL // clock src: XTAL_CLK rmt_source_clk_hz = rtc_clk_xtal_freq_get() * 1000000; diff --git a/components/driver/test/test_rmt.c b/components/driver/test/test_rmt.c index 28b4293f2f..9ae1b5d74e 100644 --- a/components/driver/test/test_rmt.c +++ b/components/driver/test/test_rmt.c @@ -32,7 +32,7 @@ static void rmt_setup_testbench(int tx_channel, int rx_channel, uint32_t flags) if (tx_channel >= 0) { rmt_config_t tx_config = RMT_DEFAULT_CONFIG_TX(RMT_DATA_IO, tx_channel); if (flags & RMT_TESTBENCH_FLAGS_ALWAYS_ON) { - tx_config.flags |= RMT_CHANNEL_FLAGS_ALWAYS_ON; + tx_config.flags |= RMT_CHANNEL_FLAGS_AWARE_DFS; } if (flags & RMT_TESTBENCH_FLAGS_CARRIER_ON) { tx_config.tx_config.carrier_en = true; @@ -49,7 +49,7 @@ static void rmt_setup_testbench(int tx_channel, int rx_channel, uint32_t flags) if (rx_channel >= 0) { rmt_config_t rx_config = RMT_DEFAULT_CONFIG_RX(RMT_DATA_IO, rx_channel); if (flags & RMT_TESTBENCH_FLAGS_ALWAYS_ON) { - rx_config.flags |= RMT_CHANNEL_FLAGS_ALWAYS_ON; + rx_config.flags |= RMT_CHANNEL_FLAGS_AWARE_DFS; } #if SOC_RMT_SUPPORT_RX_DEMODULATION if (flags & RMT_TESTBENCH_FLAGS_CARRIER_ON) { diff --git a/docs/en/api-reference/peripherals/rmt.rst b/docs/en/api-reference/peripherals/rmt.rst index 8420ee363a..4540bcf9c8 100644 --- a/docs/en/api-reference/peripherals/rmt.rst +++ b/docs/en/api-reference/peripherals/rmt.rst @@ -115,9 +115,9 @@ Common Parameters * How many **memory blocks** will be used by the channel, set with **mem_block_num**. * Extra miscellaneous parameters for the channel can be set in the **flags**. - * When **RMT_CHANNEL_FLAGS_ALWAYS_ON** is set, RMT channel will take REF_TICK as source clock. The benefit is, RMT channel can continue work even when APB clock is changing. See :doc:`power_management <../system/power_management>` for more information. + * When **RMT_CHANNEL_FLAGS_AWARE_DFS** is set, RMT channel will take REF_TICK or XTAL as source clock. The benefit is, RMT channel can continue work even when APB clock is changing. See :doc:`power_management <../system/power_management>` for more information. -* A **clock divider**, that will determine the range of pulse length generated by the RMT transmitter or discriminated by the receiver. Selected by setting **clk_div** to a value within [1 .. 255] range. The RMT source clock is typically APB CLK, 80Mhz by default. But when **RMT_CHANNEL_FLAGS_ALWAYS_ON** is set in **flags**, RMT source clock is changed to REF_TICK. +* A **clock divider**, that will determine the range of pulse length generated by the RMT transmitter or discriminated by the receiver. Selected by setting **clk_div** to a value within [1 .. 255] range. The RMT source clock is typically APB CLK, 80Mhz by default. But when **RMT_CHANNEL_FLAGS_AWARE_DFS** is set in **flags**, RMT source clock is changed to REF_TICK or XTAL. .. note:: diff --git a/docs/en/api-reference/system/power_management.rst b/docs/en/api-reference/system/power_management.rst index 94d8661471..ede03ebd66 100644 --- a/docs/en/api-reference/system/power_management.rst +++ b/docs/en/api-reference/system/power_management.rst @@ -93,7 +93,7 @@ The following peripherals work normally even when the APB frequency is changing: - **UART**: if REF_TICK is used as a clock source. See `use_ref_tick` member of :cpp:class:`uart_config_t`. - **LEDC**: if REF_TICK is used as a clock source. See :cpp:func:`ledc_timer_config` function. -- **RMT**: if REF_TICK is used as a clock source. See `flags` member of :cpp:class:`rmt_config_t` and macro `RMT_CHANNEL_FLAGS_ALWAYS_ON`. +- **RMT**: if REF_TICK or XTAL is used as a clock source. See `flags` member of :cpp:class:`rmt_config_t` and macro `RMT_CHANNEL_FLAGS_AWARE_DFS`. Currently, the following peripheral drivers are aware of DFS and will use the ``ESP_PM_APB_FREQ_MAX`` lock for the duration of the transaction: diff --git a/docs/zh_CN/api-reference/system/power_management.rst b/docs/zh_CN/api-reference/system/power_management.rst index 38613e03d8..8e770a104b 100644 --- a/docs/zh_CN/api-reference/system/power_management.rst +++ b/docs/zh_CN/api-reference/system/power_management.rst @@ -89,7 +89,7 @@ ESP-IDF 中集成的电源管理算法可以根据应用程序组件的需求, - **UART**:如果 REF_TICK 用作时钟源,则 UART 不受 APB 频率变更影响。请查看 :cpp:class:`uart_config_t` 中的 `use_ref_tick`。 - **LEDC**:如果 REF_TICK 用作时钟源,则 LEDC 不受 APB 频率变更影响。请查看 :cpp:func:`ledc_timer_config` 函数。 -- **RMT**:如果 REF_TICK 用作时钟源,则 RMT 不受 APB 频率变更影响。请查看 :cpp:class:`rmt_config_t` 结构体中的 `flags` 成员以及 `RMT_CHANNEL_FLAGS_ALWAYS_ON` 宏。 +- **RMT**:如果 REF_TICK 或者 XTAL 被用作时钟源,则 RMT 不受 APB 频率变更影响。请查看 :cpp:class:`rmt_config_t` 结构体中的 `flags` 成员以及 `RMT_CHANNEL_FLAGS_AWARE_DFS` 宏。 目前以下外设驱动程序可感知动态调频,并在调频期间使用 ``ESP_PM_APB_FREQ_MAX`` 锁: