From d0224ab19f017acec98ea64db1eed0c07eae58bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Fri, 12 Apr 2024 07:45:14 +0200 Subject: [PATCH] tests: drivers: counter: nrf_rtc: Add nrf52_bsim overlay and adapt test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .../counter_nrf_rtc/fixed_top/boards/nrf52_bsim.overlay | 8 ++++++++ .../fixed_top/src/test_counter_fixed_top.c | 6 ++++++ 2 files changed, 14 insertions(+) create mode 100644 tests/drivers/counter/counter_nrf_rtc/fixed_top/boards/nrf52_bsim.overlay 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 00000000000..ebfed9cf903 --- /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 a86384d1305..66fabc91725 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 @@ static void test_top_handler_on_instance(int idx) .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);