tests: drivers: counter: nrf_rtc: Add nrf52_bsim overlay and adapt test
Add overlay for nrf52_bsim to the fixed_top test.
For bsim board RTC register address has to be translated.
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
diff --git a/tests/drivers/counter/counter_nrf_rtc/fixed_top/boards/nrf52_bsim.overlay b/tests/drivers/counter/counter_nrf_rtc/fixed_top/boards/nrf52_bsim.overlay
new file mode 100644
index 0000000..ebfed9c
--- /dev/null
+++ b/tests/drivers/counter/counter_nrf_rtc/fixed_top/boards/nrf52_bsim.overlay
@@ -0,0 +1,8 @@
+&rtc0 {
+ status = "okay";
+ fixed-top;
+};
+&rtc2 {
+ status = "okay";
+ fixed-top;
+};
diff --git a/tests/drivers/counter/counter_nrf_rtc/fixed_top/src/test_counter_fixed_top.c b/tests/drivers/counter/counter_nrf_rtc/fixed_top/src/test_counter_fixed_top.c
index a86384d..66fabc9 100644
--- a/tests/drivers/counter/counter_nrf_rtc/fixed_top/src/test_counter_fixed_top.c
+++ b/tests/drivers/counter/counter_nrf_rtc/fixed_top/src/test_counter_fixed_top.c
@@ -100,6 +100,12 @@
.callback = top_handler,
.flags = 0
};
+#if defined(CONFIG_SOC_SERIES_BSIM_NRFXX)
+ /* For simulated devices we need to convert the hardcoded DT address from the real
+ * peripheral into the correct one for simulation
+ */
+ reg = nhw_convert_periph_base_addr(reg);
+#endif
top_cfg.ticks = counter_get_max_top_value(dev);