Skip to content

Commit 306b1b8

Browse files
author
Raffael Rostagno
committed
tests: drivers: counter: esp32: Add RTC counter support
Add RTC counter support (LP TIMER and RTC) for ESP32 chips. Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
1 parent 648c4de commit 306b1b8

File tree

10 files changed

+77
-0
lines changed

10 files changed

+77
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
1+
/*
2+
* Copyright (c) 2025 Espressif Systems (Shanghai) Co., Ltd.
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
17
&timer0 {
28
status = "okay";
39
counter {
410
status = "okay";
511
};
612
};
713

14+
&rtc_timer {
15+
status = "okay";
16+
};
17+
818
&clock {
919
slow-clk-src = <ESP32_RTC_SLOW_CLK_SRC_RC_FAST_D256>;
1020
};

tests/drivers/counter/counter_basic_api/socs/esp32c2.overlay

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
/*
2+
* Copyright (c) 2025 Espressif Systems (Shanghai) Co., Ltd.
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
17
&timer0 {
28
status = "okay";
39
counter {
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
1+
/*
2+
* Copyright (c) 2025 Espressif Systems (Shanghai) Co., Ltd.
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
17
&timer0 {
28
status = "okay";
39
counter {
410
status = "okay";
511
};
612
};
713

14+
&rtc_timer {
15+
status = "okay";
16+
};
17+
818
&clock {
919
slow-clk-src = <ESP32_RTC_SLOW_CLK_SRC_RC_FAST_D256>;
1020
};
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
1+
/*
2+
* Copyright (c) 2025 Espressif Systems (Shanghai) Co., Ltd.
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
17
&timer0 {
28
status = "okay";
39
counter {
410
status = "okay";
511
};
612
};
713

14+
&rtc_timer {
15+
status = "okay";
16+
};
17+
818
&clock {
919
slow-clk-src = <ESP32_RTC_SLOW_CLK_SRC_RC_FAST_D256>;
1020
};

tests/drivers/counter/counter_basic_api/socs/esp32c6_hpcore.overlay

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
/*
2+
* Copyright (c) 2025 Espressif Systems (Shanghai) Co., Ltd.
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
17
&timer0 {
28
status = "okay";
39
counter {
@@ -11,3 +17,7 @@
1117
status = "okay";
1218
};
1319
};
20+
21+
&rtc_timer {
22+
status = "okay";
23+
};
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# LP Timer is driven by RC_SLOW, which has limited precision
2+
CONFIG_TEST_DRIVER_COUNTER_TOLERANCE=20

tests/drivers/counter/counter_basic_api/socs/esp32h2.overlay

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
/*
2+
* Copyright (c) 2025 Espressif Systems (Shanghai) Co., Ltd.
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
17
&timer0 {
28
status = "okay";
39
counter {
@@ -11,3 +17,7 @@
1117
status = "okay";
1218
};
1319
};
20+
21+
&rtc_timer {
22+
status = "okay";
23+
};
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
1+
/*
2+
* Copyright (c) 2025 Espressif Systems (Shanghai) Co., Ltd.
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
17
&timer0 {
28
status = "okay";
39
counter {
410
status = "okay";
511
};
612
};
713

14+
&rtc_timer {
15+
status = "okay";
16+
};
17+
818
&clock {
919
slow-clk-src = <ESP32_RTC_SLOW_CLK_SRC_RC_FAST_D256>;
1020
};

tests/drivers/counter/counter_basic_api/socs/esp32s3_procpu.overlay

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
/*
2+
* Copyright (c) 2025 Espressif Systems (Shanghai) Co., Ltd.
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
17
&timer0 {
28
status = "okay";
39
counter {

tests/drivers/counter/counter_basic_api/src/test_counter.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@ static const struct device *const devices[] = {
105105
#ifdef CONFIG_COUNTER_TMR_ESP32
106106
DEVS_FOR_DT_COMPAT(espressif_esp32_counter)
107107
#endif
108+
#ifdef CONFIG_COUNTER_RTC_ESP32
109+
DEVS_FOR_DT_COMPAT(espressif_esp32_rtc_timer)
110+
#endif
108111
#ifdef CONFIG_COUNTER_NXP_S32_SYS_TIMER
109112
DEVS_FOR_DT_COMPAT(nxp_s32_sys_timer)
110113
#endif

0 commit comments

Comments
 (0)