Merge branch 'refactor/lp_core_etm_ll' into 'master'

refactor(lp_core): unify LL functions of ETM wake up lp system

See merge request espressif/esp-idf!33790
This commit is contained in:
morris 2024-09-26 17:56:06 +08:00
commit bcfa928850
10 changed files with 60 additions and 91 deletions

View File

@ -115,10 +115,6 @@ static inline void etm_ll_channel_set_task(soc_etm_dev_t *hw, uint32_t chan, uin
HAL_FORCE_MODIFY_U32_REG_FIELD(hw->channel[chan].tid, chn_task_id, task);
}
#define etm_ll_is_lpcore_wakeup_triggered() lp_aon_ll_get_lpcore_etm_wakeup_flag()
#define etm_ll_clear_lpcore_wakeup_status() lp_aon_ll_clear_lpcore_etm_wakeup_flag()
#ifdef __cplusplus
}
#endif

View File

@ -92,24 +92,6 @@ static inline void lp_aon_ll_inform_wakeup_type(bool dslp)
}
}
/**
* @brief Get the flag that marks whether LP CPU is awakened by ETM
*
* @return Return true if lpcore is woken up by soc_etm
*/
static inline bool lp_aon_ll_get_lpcore_etm_wakeup_flag(void)
{
return REG_GET_BIT(LP_AON_LPCORE_REG, LP_AON_LPCORE_ETM_WAKEUP_FLAG);
}
/**
* @brief Clear the flag that marks whether LP CPU is awakened by soc_etm
*/
static inline void lp_aon_ll_clear_lpcore_etm_wakeup_flag(void)
{
REG_SET_BIT(LP_AON_LPCORE_REG, LP_AON_LPCORE_ETM_WAKEUP_FLAG_CLR);
}
/**
* @brief Set the maximum number of linked lists supported by REGDMA
* @param count: the maximum number of regdma link

View File

@ -14,6 +14,7 @@
#include <stdbool.h>
#include "soc/lpperi_struct.h"
#include "soc/pmu_struct.h"
#include "soc/lp_aon_struct.h"
#ifdef __cplusplus
extern "C" {
@ -130,6 +131,24 @@ static inline uint8_t lp_core_ll_get_triggered_interrupt_srcs(void)
return LPPERI.interrupt_source.lp_interrupt_source;
}
/**
* @brief Get the flag that marks whether LP CPU is awakened by ETM
*
* @return Return true if lpcore is woken up by soc_etm
*/
static inline bool lp_core_ll_get_etm_wakeup_flag(void)
{
return LP_AON.lpcore.lpcore_etm_wakeup_flag;
}
/**
* @brief Clear the flag that marks whether LP CPU is awakened by soc_etm
*/
static inline void lp_core_ll_clear_etm_wakeup_flag(void)
{
LP_AON.lpcore.lpcore_etm_wakeup_flag_clr = 0x01;
}
#ifdef __cplusplus
}
#endif

View File

@ -113,10 +113,6 @@ static inline void etm_ll_channel_set_task(soc_etm_dev_t *hw, uint32_t chan, uin
HAL_FORCE_MODIFY_U32_REG_FIELD(hw->channel[chan].tid, task_id, task);
}
#define etm_ll_is_lpcore_wakeup_triggered() lp_aon_ll_get_lpcore_etm_wakeup_flag()
#define etm_ll_clear_lpcore_wakeup_status() lp_aon_ll_clear_lpcore_etm_wakeup_flag()
#ifdef __cplusplus
}
#endif

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -85,24 +85,6 @@ static inline void lp_aon_ll_inform_wakeup_type(bool dslp)
}
}
/**
* @brief Get the flag that marks whether LP CPU is awakened by ETM
*
* @return Return true if lpcore is woken up by soc_etm
*/
static inline bool lp_aon_ll_get_lpcore_etm_wakeup_flag(void)
{
return REG_GET_BIT(LP_AON_LPCORE_REG, LP_AON_LPCORE_ETM_WAKEUP_FLAG);
}
/**
* @brief Clear the flag that marks whether LP CPU is awakened by soc_etm
*/
static inline void lp_aon_ll_clear_lpcore_etm_wakeup_flag(void)
{
REG_SET_BIT(LP_AON_LPCORE_REG, LP_AON_LPCORE_ETM_WAKEUP_FLAG_CLR);
}
#ifdef __cplusplus
}
#endif

View File

@ -136,6 +136,24 @@ static inline uint8_t lp_core_ll_get_triggered_interrupt_srcs(void)
return LPPERI.interrupt_source.lp_interrupt_source;
}
/**
* @brief Get the flag that marks whether LP CPU is awakened by ETM
*
* @return Return true if lpcore is woken up by soc_etm
*/
static inline bool lp_core_ll_get_etm_wakeup_flag(void)
{
return LP_AON.lpcore.lpcore_etm_wakeup_flag;
}
/**
* @brief Clear the flag that marks whether LP CPU is awakened by soc_etm
*/
static inline void lp_core_ll_clear_etm_wakeup_flag(void)
{
LP_AON.lpcore.lpcore_etm_wakeup_flag_clr = 0x01;
}
#ifdef __cplusplus
}
#endif

View File

@ -92,23 +92,6 @@ static inline void lp_aon_ll_inform_wakeup_type(bool dslp)
}
}
/**
* @brief Get the flag that marks whether LP CPU is awakened by ETM
*
* @return Return true if lpcore is woken up by soc_etm
*/
static inline bool lp_aon_ll_get_lpcore_etm_wakeup_flag(void)
{
return REG_GET_BIT(LP_AON_LPCORE_REG, LP_AON_LPCORE_ETM_WAKEUP_FLAG);
}
/**
* @brief Clear the flag that marks whether LP CPU is awakened by soc_etm
*/
static inline void lp_aon_ll_clear_lpcore_etm_wakeup_flag(void)
{
REG_SET_BIT(LP_AON_LPCORE_REG, LP_AON_LPCORE_ETM_WAKEUP_FLAG_CLR);
}
#ifdef __cplusplus
}
#endif

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -123,24 +123,6 @@ static inline void etm_ll_channel_set_task(soc_etm_dev_t *hw, uint32_t chan, uin
HAL_FORCE_MODIFY_U32_REG_FIELD(hw->channel[chan].tid, task_id, task);
}
/**
* @brief Get the flag that marks whether LP CPU is awakened by ETM
*
* @return Return true if lpcore is woken up by soc etm flag
*/
static inline bool etm_ll_is_lpcore_wakeup_triggered(void)
{
return SOC_ETM.task_st5.ulp_task_wakeup_cpu_st;
}
/**
* @brief Clear the flag that marks whether LP CPU is awakened by ETM
*/
static inline void etm_ll_clear_lpcore_wakeup_status(void)
{
SOC_ETM.task_st5_clr.ulp_task_wakeup_cpu_st_clr = 1;
}
#ifdef __cplusplus
}
#endif

View File

@ -15,6 +15,7 @@
#include "soc/lpperi_struct.h"
#include "soc/pmu_struct.h"
#include "soc/lp_system_struct.h"
#include "soc/soc_etm_struct.h"
#ifdef __cplusplus
extern "C" {
@ -157,6 +158,24 @@ static inline void lp_core_ll_clear_etm_wakeup_status(void)
LP_SYS.sys_ctrl.lp_core_etm_wakeup_flag_clr = 1;
}
/**
* @brief Get the flag that marks whether LP CPU is awakened by ETM
*
* @return Return true if lpcore is woken up by soc etm flag
*/
static inline bool lp_core_ll_get_etm_wakeup_flag(void)
{
return SOC_ETM.task_st5.ulp_task_wakeup_cpu_st;
}
/**
* @brief Clear the flag that marks whether LP CPU is awakened by ETM
*/
static inline void lp_core_ll_clear_etm_wakeup_flag(void)
{
SOC_ETM.task_st5_clr.ulp_task_wakeup_cpu_st_clr = 1;
}
#ifdef __cplusplus
}
#endif

View File

@ -15,14 +15,6 @@
#include "hal/uart_ll.h"
#include "hal/rtc_io_ll.h"
#if !CONFIG_IDF_TARGET_ESP32P4
#include "hal/lp_aon_ll.h"
#endif
#if SOC_ETM_SUPPORTED
#include "hal/etm_ll.h"
#endif
#if SOC_LP_TIMER_SUPPORTED
#include "hal/lp_timer_ll.h"
#endif
@ -66,12 +58,12 @@ void ulp_lp_core_update_wakeup_cause(void)
#if SOC_ETM_SUPPORTED
if ((lp_core_ll_get_wakeup_source() & LP_CORE_LL_WAKEUP_SOURCE_ETM) \
&& etm_ll_is_lpcore_wakeup_triggered()) {
&& lp_core_ll_get_etm_wakeup_flag()) {
lp_wakeup_cause |= LP_CORE_LL_WAKEUP_SOURCE_ETM;
#if CONFIG_IDF_TARGET_ESP32P4
lp_core_ll_clear_etm_wakeup_status();
#else
lp_aon_ll_clear_lpcore_etm_wakeup_flag();
lp_core_ll_clear_etm_wakeup_flag();
#endif
}
#endif /* SOC_ETM_SUPPORTED */