feat(ulp): add api to get lp_cpu wakeup cause and clear wakeup source at startup

Closes https://github.com/espressif/esp-idf/issues/12651
This commit is contained in:
wuzhenghui
2023-12-12 21:03:52 +08:00
parent e2b537550d
commit a967a207c9
12 changed files with 185 additions and 0 deletions

View File

@@ -12,6 +12,7 @@
#include "soc/soc.h"
#include "soc/rtc.h"
#include "soc/lp_timer_struct.h"
#include "soc/lp_timer_reg.h"
#include "soc/lp_system_reg.h"
#include "hal/lp_timer_types.h"
#include "esp_attr.h"
@@ -61,6 +62,16 @@ FORCE_INLINE_ATTR void lp_timer_ll_clear_lp_alarm_intr_status(lp_timer_dev_t *de
dev->lp_int_clr.main_timer_lp_int_clr = 1;
}
FORCE_INLINE_ATTR uint32_t lp_timer_ll_get_lp_intr_raw(lp_timer_dev_t *dev)
{
return dev->lp_int_raw.val;
}
FORCE_INLINE_ATTR void lp_timer_ll_clear_lp_intsts_mask(lp_timer_dev_t *dev, uint32_t mask)
{
dev->lp_int_clr.val = mask;
}
FORCE_INLINE_ATTR uint64_t lp_timer_ll_time_to_count(uint64_t time_in_us)
{
uint32_t slow_clk_value = REG_READ(LP_SYSTEM_REG_LP_STORE1_REG);