In the test scenario without alarms, it might
be the case that counter is already running and
it will not match the expected tick.
This adds a tick offset into the expected value
based on current counter reading.
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
Some counter drivers do not support alarms, so I added testcase which
starts the counter, checks if the value is in range after certain time and
stops the counter, to check if the counter is running correctly.
Signed-off-by: Krystof Sadlik <krystof.sadlik@nxp.com>
Co-authored-by: Michal Smola <michal.smola@nxp.com>
This reverts commit 331442f059.
Change was introduced because it was failing on slow core
(nrf54h20/cpuppr) however it turned out that there was a bug in the
driver and now test passes without this tweak which make the test
last twice longer.
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
When running this test with multiple counter instances enabled that
support different capabilities, if one of the instances does not
support the test required capabilities, the test will be
immediately skipped not giving the chance to run to the subsequent
instances.
Fix this by marking the test as skipped, only of all counter instances
under test were skipped.
Fixes#74358
Signed-off-by: Manuel Argüelles <marguelles.dev@gmail.com>
This commit adds a missing #ifdef check which prevents building the
'counter_basic_api' test for boards under the following conditions:
* RTC node is defined in device tree (compatible = "st,stm32-rtc")
* RTC node is disabled in device tree (status = "disabled")
* Kconfig "CONFIG_COUNTER_RTC_STM32=n" is specified
This check matches the ones done a few lines above for NXP MCUs.
Without this check, building the test under the conditions listed above
failed with the infamous `undefined reference to '__device_dts_ord_N'`
linker error, because the test attempts to obtain RTC's `struct device`
despite CONFIG_COUNTER_RTC_STM32=n, which ultimately fails because the
RTC driver is not built unless there is an enabled RTC node in DT.
Signed-off-by: Mathieu Choplain <mathieu.choplain@st.com>
For slow processors it is possible that setting 1 ms alarm and
then canceling it could lead to alarm expiring before it is canceled
and that was not expected in the test. Increasing timeout to 1.5ms.
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
Updating the nxp,pit driver to support mutliple
channels. Updating the dts and board overlays
to account for the changes.
Signed-off-by: Emilio Benavente <emilio.benavente@nxp.com>
Add initial version of Infineon CAT1 counter driver
Add initial version of binding file for Infineon
Add counters to psco6 dtsi
Add external trigger pin that runs counter
Signed-off-by: Pavlo Havrylyuk <pavlo.havrylyuk@infineon.com>
Overlay adds 4 timers for testing and selects various frequencies
to select high speed (DIVN) and low-speed (LP-CLK) as sources.
Different prescalers are applied for different timers to
test wider range of conditions.
Signed-off-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>
Some Nordic platforms start counter with the delay and
test_short_relative_alarm test expects very early alarm,
just after starting the counter. Adding the delay which
is applicable only for counter based on Nordic RTC peripheral.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Modifying counter drivers (rtc and timer) to rely completely on
device tree and not on Kconfig of MDK flags.
Adapting dtsi for all SoCs and adapting test configuration.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
In short_relative_capable test it is possible that short alarm
setting is repeated few times and it is possible that alarm
does not expire shortely after setting. Increase the delay after
expiration is checked.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Commit fd65800 introduced a regression for the counter_basic_api test for
STM32 by using a Silabs Gecko Kconfig to enable the STM32 RTC.
This commit uses the proper STM32 Kconfig for the RTC instead.
Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
Enable counter_basic_api test for s32z270dc2_r52 boards, using
System Timer counter instances with different prescaler values.
Signed-off-by: Manuel Arguelles <manuel.arguelles@nxp.com>
In test_all_instances(), if ARRAY_SIZE(devices) is 0, the test is not
performed. At this time, the test result should be TC_FAIL, instead of
TC_PASS. A zassert is needed to filter this case.
Fixes: #45647
Signed-off-by: Hu Zhenyu <zhenyu.hu@intel.com>
It is frequent to find variable definitions like this:
```c
static const struct device *dev = DEVICE_DT_GET(...)
```
That is, module level variables that are statically initialized with a
device reference. Such value is, in most cases, never changed meaning
the variable can also be declared as const (immutable). This patch
constifies all such cases.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Add a bunch of missing "zephyr/" prefixes to #include statements in
various test and test framework files.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Move to pass 'struct device *' instead of a 'char *'. This lets us move
from device_get_binding to DEVICE_DT_GET.
Reworked get_counter_period_us() to not be name based, but instead
we keep a list of devices that need a different period value to check
against.
Signed-off-by: Kumar Gala <galak@kernel.org>
We do the same check for determining the period in a number of the
tests. Refactor that code into get_counter_period_us().
Signed-off-by: Kumar Gala <galak@kernel.org>
Skip the test_multiple_alarms() test when the settop value is
not supported. This is to avoid the case where wrap around
take a long time thereby causing test failures
Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
In order to bring consistency in-tree, migrate all tests to the new
prefix <zephyr/...>. Note that the conversion has been scripted, refer
to #45388 for more details.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Set the top value relative to the current time. This is
so that we avoid the case of setting the top value that
is prior to the current value.
Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
Modified test to handle case when counter handlers are called in
ZLI interrupt context where kernel primitives cannot be used. In
that case volatile counters are used to track number of handlers
calls.
Added configuration for nrf52840dk board where zli feature is enabled
for all counters.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>