change(esp_hal_rtc_timer): unify lp_timer/rtc_timer naming to RTC_TIMER

This commit is contained in:
wuzhenghui
2026-01-31 22:31:34 +08:00
committed by morris
parent 12b9fb6549
commit 2d8c6ed6b4
88 changed files with 1117 additions and 941 deletions
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2020-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2020-2026 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -16,8 +16,15 @@
extern "C" {
#endif
FORCE_INLINE_ATTR void rtc_timer_ll_set_wakeup_timer(uint64_t t)
/**
* @brief Set wakeup timer value
*
* @param timer_id Timer ID (ignored for V1 hardware, only one timer supported)
* @param ticks Timer value in RTC slow clock ticks
*/
FORCE_INLINE_ATTR void rtc_timer_ll_set_wakeup_time(uint8_t timer_id, uint64_t t)
{
(void)timer_id; // V1 hardware only supports one timer
WRITE_PERI_REG(RTC_CNTL_SLP_TIMER0_REG, t & UINT32_MAX);
WRITE_PERI_REG(RTC_CNTL_SLP_TIMER1_REG, t >> 32);
@@ -25,8 +32,15 @@ FORCE_INLINE_ATTR void rtc_timer_ll_set_wakeup_timer(uint64_t t)
SET_PERI_REG_MASK(RTC_CNTL_SLP_TIMER1_REG, RTC_CNTL_MAIN_TIMER_ALARM_EN_M);
}
FORCE_INLINE_ATTR uint64_t rtc_timer_ll_get_rtc_time(void)
/**
* @brief Get current RTC timer cycle count
*
* @param timer_id Timer ID (ignored for V1 hardware, only one timer supported)
* @return Current RTC time in RTC slow clock ticks
*/
FORCE_INLINE_ATTR uint64_t rtc_timer_ll_get_cycle_count(uint8_t timer_id)
{
(void)timer_id; // V1 hardware only supports one timer
SET_PERI_REG_MASK(RTC_CNTL_TIME_UPDATE_REG, RTC_CNTL_TIME_UPDATE);
uint64_t t = READ_PERI_REG(RTC_CNTL_TIME0_REG);
t |= ((uint64_t) READ_PERI_REG(RTC_CNTL_TIME1_REG)) << 32;