Skip to content

Commit a9eba40

Browse files
jath03sudeep-mohanty
authored andcommitted
feat(ulp): LP Timer interrupt support
This commit adds support for the LP Timer interrupt to be used by the LP Core. Merges #15717
1 parent 53e84d9 commit a9eba40

File tree

7 files changed

+52
-1
lines changed

7 files changed

+52
-1
lines changed

components/hal/esp32c5/include/hal/lp_timer_ll.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,11 @@ FORCE_INLINE_ATTR void lp_timer_ll_clear_lp_intsts_mask(lp_timer_dev_t *dev, uin
7373
dev->lp_int_clr.val = mask;
7474
}
7575

76+
FORCE_INLINE_ATTR void lp_timer_ll_lp_alarm_intr_enable(lp_timer_dev_t *dev, bool enable)
77+
{
78+
dev->lp_int_ena.main_timer_lp_int_ena = enable;
79+
}
80+
7681
#ifdef __cplusplus
7782
}
7883
#endif

components/hal/esp32c6/include/hal/lp_timer_ll.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -73,6 +73,11 @@ FORCE_INLINE_ATTR void lp_timer_ll_clear_lp_intsts_mask(lp_timer_dev_t *dev, uin
7373
dev->lp_int_clr.val = mask;
7474
}
7575

76+
FORCE_INLINE_ATTR void lp_timer_ll_lp_alarm_intr_enable(lp_timer_dev_t *dev, bool enable)
77+
{
78+
dev->lp_int_en.alarm = enable;
79+
}
80+
7681
#ifdef __cplusplus
7782
}
7883
#endif

components/hal/esp32c61/include/hal/lp_timer_ll.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,11 @@ FORCE_INLINE_ATTR void lp_timer_ll_clear_lp_intsts_mask(lp_timer_dev_t *dev, uin
7373
dev->lp_int_clr.val = mask;
7474
}
7575

76+
FORCE_INLINE_ATTR void lp_timer_ll_lp_alarm_intr_enable(lp_timer_dev_t *dev, bool enable)
77+
{
78+
dev->lp_int_ena.main_timer_lp_int_ena = enable;
79+
}
80+
7681
#ifdef __cplusplus
7782
}
7883
#endif

components/hal/esp32h2/include/hal/lp_timer_ll.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ FORCE_INLINE_ATTR void lp_timer_ll_clear_overflow_intr_status(lp_timer_dev_t *de
5757
dev->int_clr.overflow = 1;
5858
}
5959

60+
FORCE_INLINE_ATTR void lp_timer_ll_lp_alarm_intr_enable(lp_timer_dev_t *dev, bool enable)
61+
{
62+
dev->lp_int_en.alarm = enable;
63+
}
64+
6065
#ifdef __cplusplus
6166
}
6267
#endif

components/hal/esp32p4/include/hal/lp_timer_ll.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,11 @@ FORCE_INLINE_ATTR void lp_timer_ll_clear_lp_intsts_mask(lp_timer_dev_t *dev, uin
7373
dev->lp_int_clr.val = mask;
7474
}
7575

76+
FORCE_INLINE_ATTR void lp_timer_ll_lp_alarm_intr_enable(lp_timer_dev_t *dev, bool enable)
77+
{
78+
dev->lp_int_ena.main_timer_lp_int_ena = enable;
79+
}
80+
7681
#ifdef __cplusplus
7782
}
7883
#endif

components/ulp/lp_core/lp_core/include/ulp_lp_core_utils.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,20 @@ void ulp_lp_core_sw_intr_enable(bool enable);
104104
*/
105105
void ulp_lp_core_sw_intr_clear(void);
106106

107+
#if SOC_LP_TIMER_SUPPORTED
108+
/**
109+
* @brief Enable the LP Timer interrupt
110+
*
111+
*/
112+
void ulp_lp_core_lp_timer_intr_enable(bool enable);
113+
114+
/**
115+
* @brief Clear the interrupt status for the LP Timer interrupt
116+
*
117+
*/
118+
void ulp_lp_core_lp_timer_intr_clear(void);
119+
#endif
120+
107121
/**
108122
* @brief Puts the CPU into a wait state until an interrupt is triggered
109123
*

components/ulp/lp_core/lp_core/lp_core_utils.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,18 @@ void ulp_lp_core_sw_intr_clear(void)
191191
pmu_ll_lp_clear_sw_intr_status(&PMU);
192192
}
193193

194+
#if SOC_LP_TIMER_SUPPORTED
195+
void ulp_lp_core_lp_timer_intr_enable(bool enable)
196+
{
197+
lp_timer_ll_lp_alarm_intr_enable(&LP_TIMER, enable);
198+
}
199+
200+
void ulp_lp_core_lp_timer_intr_clear(void)
201+
{
202+
lp_timer_ll_clear_lp_alarm_intr_status(&LP_TIMER);
203+
}
204+
#endif
205+
194206
void ulp_lp_core_wait_for_intr(void)
195207
{
196208
asm volatile("wfi");

0 commit comments

Comments
 (0)