Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing tests alignments for nrf54l15 #68618

Merged
merged 3 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ toolchain:
ram: 256
flash: 1536
supported:
- counter
- gpio
- i2c
- spi
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
&timer00 {
prescaler = <6>;
status = "okay";
};

&timer10 {
prescaler = <4>;
status = "okay";
};

&timer20 {
prescaler = <4>;
status = "okay";
};

&timer21 {
prescaler = <4>;
status = "okay";
};

&timer22 {
prescaler = <4>;
status = "okay";
};

&timer23 {
prescaler = <4>;
status = "okay";
};

&timer24 {
prescaler = <4>;
status = "okay";
};
9 changes: 9 additions & 0 deletions tests/drivers/timer/nrf_grtc_timer/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 3.20.0)

find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(nrf_grtc_timer)

FILE(GLOB app_sources src/*.c)
target_sources(app PRIVATE ${app_sources})
2 changes: 2 additions & 0 deletions tests/drivers/timer/nrf_grtc_timer/prj.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CONFIG_ZTEST=y
CONFIG_NRF_GRTC_TIMER=y
40 changes: 40 additions & 0 deletions tests/drivers/timer/nrf_grtc_timer/src/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright (c) 2022, Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/ztest.h>
#include <zephyr/drivers/timer/nrf_grtc_timer.h>
#include <hal/nrf_grtc.h>

#define GRTC_SLEW_TICKS 10

ZTEST(nrf_grtc_timer, test_get_ticks)
{
k_timeout_t t = K_MSEC(1);

uint64_t exp_ticks = z_nrf_grtc_timer_read() + t.ticks;
int64_t ticks;

/* Relative 1ms from now timeout converted to GRTC */
ticks = z_nrf_grtc_timer_get_ticks(t);
zassert_true((ticks >= exp_ticks) && (ticks <= (exp_ticks + GRTC_SLEW_TICKS)),
"Unexpected result %" PRId64 " (expected: %" PRId64 ")", ticks, exp_ticks);

/* Absolute timeout 1ms in the past */
t = Z_TIMEOUT_TICKS(Z_TICK_ABS(sys_clock_tick_get() - K_MSEC(1).ticks));

exp_ticks = z_nrf_grtc_timer_read() - K_MSEC(1).ticks;
ticks = z_nrf_grtc_timer_get_ticks(t);
zassert_true((ticks >= exp_ticks) && (ticks <= (exp_ticks + GRTC_SLEW_TICKS)),
"Unexpected result %" PRId64 " (expected: %" PRId64 ")", ticks, exp_ticks);

/* Absolute timeout 10ms in the future */
t = Z_TIMEOUT_TICKS(Z_TICK_ABS(sys_clock_tick_get() + K_MSEC(10).ticks));
exp_ticks = z_nrf_grtc_timer_read() + K_MSEC(10).ticks;
ticks = z_nrf_grtc_timer_get_ticks(t);
zassert_true((ticks >= exp_ticks) && (ticks <= (exp_ticks + GRTC_SLEW_TICKS)),
"Unexpected result %" PRId64 " (expected: %" PRId64 ")", ticks, exp_ticks);
}

ZTEST_SUITE(nrf_grtc_timer, NULL, NULL, NULL, NULL, NULL);
4 changes: 4 additions & 0 deletions tests/drivers/timer/nrf_grtc_timer/testcase.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
tests:
drivers.timer.nrf_grtc_timer:
tags: drivers
platform_allow: nrf54l15pdk/nrf54l15/cpuapp
Loading