mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
d0a7dc3e9f
1. Fix deep sleep wakeup IOs can not be unhold issue 2. Correct hold related APIs' description 3. Fix gpio_force_hold_all API docs: Add GPIO wakeup source to sleep_modes doc for ESP32C3 and C2
61 lines
1.4 KiB
C
61 lines
1.4 KiB
C
/*
|
|
* SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "soc/soc.h"
|
|
#include "soc/rtc.h"
|
|
#include "soc/rtc_cntl_reg.h"
|
|
#include "soc/syscon_reg.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
static inline void rtc_cntl_ll_set_wakeup_timer(uint64_t t)
|
|
{
|
|
WRITE_PERI_REG(RTC_CNTL_SLP_TIMER0_REG, t & UINT32_MAX);
|
|
WRITE_PERI_REG(RTC_CNTL_SLP_TIMER1_REG, t >> 32);
|
|
|
|
SET_PERI_REG_MASK(RTC_CNTL_INT_CLR_REG, RTC_CNTL_MAIN_TIMER_INT_CLR_M);
|
|
SET_PERI_REG_MASK(RTC_CNTL_SLP_TIMER1_REG, RTC_CNTL_MAIN_TIMER_ALARM_EN_M);
|
|
}
|
|
|
|
static inline uint32_t rtc_cntl_ll_gpio_get_wakeup_status(void)
|
|
{
|
|
return GET_PERI_REG_MASK(RTC_CNTL_GPIO_WAKEUP_REG, RTC_CNTL_GPIO_WAKEUP_STATUS);
|
|
}
|
|
|
|
static inline void rtc_cntl_ll_gpio_clear_wakeup_status(void)
|
|
{
|
|
REG_SET_BIT(RTC_CNTL_GPIO_WAKEUP_REG, RTC_CNTL_GPIO_WAKEUP_STATUS_CLR);
|
|
REG_CLR_BIT(RTC_CNTL_GPIO_WAKEUP_REG, RTC_CNTL_GPIO_WAKEUP_STATUS_CLR);
|
|
}
|
|
|
|
static inline void rtc_cntl_ll_enable_cpu_retention(uint32_t addr)
|
|
{
|
|
// ESP32H4-TODO: IDF-3383
|
|
}
|
|
|
|
static inline void rtc_cntl_ll_disable_cpu_retention(void)
|
|
{
|
|
// ESP32H4-TODO: IDF-3383
|
|
}
|
|
|
|
static inline void rtc_cntl_ll_reset_system(void)
|
|
{
|
|
REG_WRITE(RTC_CNTL_OPTIONS0_REG, RTC_CNTL_SW_SYS_RST);
|
|
}
|
|
|
|
static inline void rtc_cntl_ll_reset_cpu(int cpu_no)
|
|
{
|
|
REG_WRITE(RTC_CNTL_OPTIONS0_REG, RTC_CNTL_SW_PROCPU_RST);
|
|
}
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|