diff --git a/components/esp_driver_rmt/src/rmt_private.h b/components/esp_driver_rmt/src/rmt_private.h index 0fc8a7c011..827b9462f5 100644 --- a/components/esp_driver_rmt/src/rmt_private.h +++ b/components/esp_driver_rmt/src/rmt_private.h @@ -74,7 +74,7 @@ typedef dma_descriptor_align4_t rmt_dma_descriptor_t; #define ALIGN_DOWN(num, align) ((num) & ~((align) - 1)) // Use retention link only when the target supports sleep retention and PM is enabled -#define RMT_USE_RETENTION_LINK (SOC_RMT_SUPPORT_SLEEP_BACKUP && CONFIG_PM_ENABLE && CONFIG_PM_POWER_DOWN_PERIPHERAL_IN_LIGHT_SLEEP) +#define RMT_USE_RETENTION_LINK (SOC_RMT_SUPPORT_SLEEP_RETENTION && CONFIG_PM_POWER_DOWN_PERIPHERAL_IN_LIGHT_SLEEP) typedef struct { struct { diff --git a/components/esp_driver_rmt/src/rmt_rx.c b/components/esp_driver_rmt/src/rmt_rx.c index df40e66e28..a169a8720a 100644 --- a/components/esp_driver_rmt/src/rmt_rx.c +++ b/components/esp_driver_rmt/src/rmt_rx.c @@ -188,9 +188,9 @@ esp_err_t rmt_new_rx_channel(const rmt_rx_channel_config_t *config, rmt_channel_ ESP_RETURN_ON_FALSE(config->flags.with_dma == 0, ESP_ERR_NOT_SUPPORTED, TAG, "DMA not supported"); #endif // SOC_RMT_SUPPORT_DMA -#if !SOC_RMT_SUPPORT_SLEEP_BACKUP +#if !SOC_RMT_SUPPORT_SLEEP_RETENTION ESP_RETURN_ON_FALSE(config->flags.backup_before_sleep == 0, ESP_ERR_NOT_SUPPORTED, TAG, "register back up is not supported"); -#endif // SOC_RMT_SUPPORT_SLEEP_BACKUP +#endif // SOC_RMT_SUPPORT_SLEEP_RETENTION // malloc channel memory uint32_t mem_caps = RMT_MEM_ALLOC_CAPS; diff --git a/components/esp_driver_rmt/src/rmt_tx.c b/components/esp_driver_rmt/src/rmt_tx.c index c6ed3579d1..9d3074c702 100644 --- a/components/esp_driver_rmt/src/rmt_tx.c +++ b/components/esp_driver_rmt/src/rmt_tx.c @@ -256,9 +256,9 @@ esp_err_t rmt_new_tx_channel(const rmt_tx_channel_config_t *config, rmt_channel_ ESP_RETURN_ON_FALSE(config->flags.with_dma == 0, ESP_ERR_NOT_SUPPORTED, TAG, "DMA not supported"); #endif -#if !SOC_RMT_SUPPORT_SLEEP_BACKUP +#if !SOC_RMT_SUPPORT_SLEEP_RETENTION ESP_RETURN_ON_FALSE(config->flags.backup_before_sleep == 0, ESP_ERR_NOT_SUPPORTED, TAG, "register back up is not supported"); -#endif // SOC_RMT_SUPPORT_SLEEP_BACKUP +#endif // SOC_RMT_SUPPORT_SLEEP_RETENTION // malloc channel memory uint32_t mem_caps = RMT_MEM_ALLOC_CAPS; diff --git a/components/esp_driver_rmt/test_apps/rmt/main/test_rmt_sleep.c b/components/esp_driver_rmt/test_apps/rmt/main/test_rmt_sleep.c index f653661455..21c6db4a58 100644 --- a/components/esp_driver_rmt/test_apps/rmt/main/test_rmt_sleep.c +++ b/components/esp_driver_rmt/test_apps/rmt/main/test_rmt_sleep.c @@ -132,7 +132,7 @@ static void test_rmt_tx_rx_sleep_retention(bool back_up_before_sleep) TEST_CASE("rmt tx+rx after light sleep", "[rmt]") { test_rmt_tx_rx_sleep_retention(false); -#if SOC_RMT_SUPPORT_SLEEP_BACKUP +#if SOC_RMT_SUPPORT_SLEEP_RETENTION test_rmt_tx_rx_sleep_retention(true); #endif } diff --git a/components/esp_hw_support/sleep_system_peripheral.c b/components/esp_hw_support/sleep_system_peripheral.c index e602c63ee5..faab3bd827 100644 --- a/components/esp_hw_support/sleep_system_peripheral.c +++ b/components/esp_hw_support/sleep_system_peripheral.c @@ -149,7 +149,7 @@ bool peripheral_domain_pd_allowed(void) const uint32_t created_modules = sleep_retention_get_created_modules(); uint32_t mask = (const uint32_t) (BIT(SLEEP_RETENTION_MODULE_SYS_PERIPH)); -#if SOC_RMT_SUPPORT_SLEEP_BACKUP +#if SOC_RMT_SUPPORT_SLEEP_RETENTION mask |= BIT(SLEEP_RETENTION_MODULE_RMT0); #endif diff --git a/components/soc/esp32c6/include/soc/Kconfig.soc_caps.in b/components/soc/esp32c6/include/soc/Kconfig.soc_caps.in index de9509eabe..bf6283a243 100644 --- a/components/soc/esp32c6/include/soc/Kconfig.soc_caps.in +++ b/components/soc/esp32c6/include/soc/Kconfig.soc_caps.in @@ -799,7 +799,7 @@ config SOC_RMT_SUPPORT_RC_FAST bool default y -config SOC_RMT_SUPPORT_SLEEP_BACKUP +config SOC_RMT_SUPPORT_SLEEP_RETENTION bool default y diff --git a/components/soc/esp32c6/include/soc/soc_caps.h b/components/soc/esp32c6/include/soc/soc_caps.h index 81f76fc0e3..fc54a1ad56 100644 --- a/components/soc/esp32c6/include/soc/soc_caps.h +++ b/components/soc/esp32c6/include/soc/soc_caps.h @@ -314,7 +314,7 @@ #define SOC_RMT_SUPPORT_TX_CARRIER_DATA_ONLY 1 /*!< TX carrier can be modulated to data phase only */ #define SOC_RMT_SUPPORT_XTAL 1 /*!< Support set XTAL clock as the RMT clock source */ #define SOC_RMT_SUPPORT_RC_FAST 1 /*!< Support set RC_FAST as the RMT clock source */ -#define SOC_RMT_SUPPORT_SLEEP_BACKUP 1 /*!< Support back up registers before sleep */ +#define SOC_RMT_SUPPORT_SLEEP_RETENTION 1 /*!< The sleep retention feature can help back up RMT registers before sleep */ /*-------------------------- MCPWM CAPS --------------------------------------*/ #define SOC_MCPWM_GROUPS (1U) ///< 1 MCPWM groups on the chip (i.e., the number of independent MCPWM peripherals) diff --git a/components/soc/esp32h2/include/soc/Kconfig.soc_caps.in b/components/soc/esp32h2/include/soc/Kconfig.soc_caps.in index d0e2138770..dc12083efb 100644 --- a/components/soc/esp32h2/include/soc/Kconfig.soc_caps.in +++ b/components/soc/esp32h2/include/soc/Kconfig.soc_caps.in @@ -783,7 +783,7 @@ config SOC_RMT_SUPPORT_RC_FAST bool default y -config SOC_RMT_SUPPORT_SLEEP_BACKUP +config SOC_RMT_SUPPORT_SLEEP_RETENTION bool default y diff --git a/components/soc/esp32h2/include/soc/soc_caps.h b/components/soc/esp32h2/include/soc/soc_caps.h index 2807c9fcf5..f49d4b89f2 100644 --- a/components/soc/esp32h2/include/soc/soc_caps.h +++ b/components/soc/esp32h2/include/soc/soc_caps.h @@ -306,7 +306,7 @@ #define SOC_RMT_SUPPORT_TX_CARRIER_DATA_ONLY 1 /*!< TX carrier can be modulated to data phase only */ #define SOC_RMT_SUPPORT_XTAL 1 /*!< Support set XTAL clock as the RMT clock source */ #define SOC_RMT_SUPPORT_RC_FAST 1 /*!< Support set RC_FAST as the RMT clock source */ -#define SOC_RMT_SUPPORT_SLEEP_BACKUP 1 /*!< Support back up registers before sleep */ +#define SOC_RMT_SUPPORT_SLEEP_RETENTION 1 /*!< The sleep retention feature can help back up RMT registers before sleep */ /*-------------------------- MCPWM CAPS --------------------------------------*/ #define SOC_MCPWM_GROUPS (1U) ///< 1 MCPWM groups on the chip (i.e., the number of independent MCPWM peripherals) diff --git a/components/soc/include/soc/rmt_periph.h b/components/soc/include/soc/rmt_periph.h index eff0d9eaa5..a85b5930a2 100644 --- a/components/soc/include/soc/rmt_periph.h +++ b/components/soc/include/soc/rmt_periph.h @@ -30,7 +30,7 @@ typedef struct { extern const rmt_signal_conn_t rmt_periph_signals; -#if SOC_RMT_SUPPORT_SLEEP_BACKUP +#if SOC_RMT_SUPPORT_SLEEP_RETENTION typedef struct { const regdma_entries_config_t *regdma_entry_array; uint32_t array_size; @@ -40,7 +40,7 @@ typedef struct { // - save memory when not all RMT channels are used // - specify different retention dependency, e.g. only RMT channel x is capable to use DMA, we only want to add the DMA dependency for that channel extern const rmt_reg_retention_info_t rmt_reg_retention_info[SOC_RMT_GROUPS]; -#endif // SOC_RMT_SUPPORT_SLEEP_BACKUP +#endif // SOC_RMT_SUPPORT_SLEEP_RETENTION #endif // SOC_RMT_SUPPORTED diff --git a/docs/en/api-reference/peripherals/rmt.rst b/docs/en/api-reference/peripherals/rmt.rst index 5ecea35c0c..92d6a25b0d 100644 --- a/docs/en/api-reference/peripherals/rmt.rst +++ b/docs/en/api-reference/peripherals/rmt.rst @@ -555,7 +555,7 @@ When power management is enabled, i.e., :ref:`CONFIG_PM_ENABLE` is on, the syste The driver can prevent the above issue by creating a power management lock. The lock type is set based on different clock sources. The driver will acquire the lock in :cpp:func:`rmt_enable`, and release it in :cpp:func:`rmt_disable`. That means, any RMT transactions in between these two functions are guaranteed to work correctly, regardless of the power management strategy. The clock source won't be disabled or adjusted its frequency during this time. -.. only:: SOC_RMT_SUPPORT_SLEEP_BACKUP +.. only:: SOC_RMT_SUPPORT_SLEEP_RETENTION Besides the potential changes to the clock source, when the power management is enabled, the system can also power down a domain where RMT register located. To ensure the RMT driver can continue work after sleep, we can either backup the RMT registers to the RAM, or just refuse to power down. You can choose what to do in :cpp:member:`rmt_tx_channel_config_t::backup_before_sleep` and :cpp:member:`rmt_rx_channel_config_t::backup_before_sleep`. It's a balance between power saving and memory consumption. Set it based on your application requirements. diff --git a/docs/zh_CN/api-reference/peripherals/rmt.rst b/docs/zh_CN/api-reference/peripherals/rmt.rst index dff8002360..2e9b9712cf 100644 --- a/docs/zh_CN/api-reference/peripherals/rmt.rst +++ b/docs/zh_CN/api-reference/peripherals/rmt.rst @@ -555,7 +555,7 @@ RMT 编码器是 RMT TX 事务的一部分,用于在特定时间生成正确 驱动程序可以通过创建一个电源管理锁来防止上述问题。锁的类型会根据不同的时钟源来设置。驱动程序将在 :cpp:func:`rmt_enable` 中拿锁,并在 :cpp:func:`rmt_disable` 中释放锁。这意味着,无论电源管理策略如何,在这两个函数之间的任何 RMT 事务都可以保证正常工作。在此期间,时钟源不会被禁用或调整频率。 -.. only:: SOC_RMT_SUPPORT_SLEEP_BACKUP +.. only:: SOC_RMT_SUPPORT_SLEEP_RETENTION 除了时钟源的潜在变化外,当启用电源管理时,系统还可以关闭 RMT 寄存器所在的电源域。为确保 RMT 驱动程序在睡眠后继续工作,用户要么选择将 RMT 相关的寄存器备份到 RAM 中,要么拒绝关闭电源域。你可以根据应用需求在 :cpp:member:`rmt_tx_channel_config_t::backup_before_sleep` 和 :cpp:member:`rmt_rx_channel_config_t::backup_before_sleep` 中设置是否需要启用寄存器备份,在功耗和内存使用之间做权衡。