1# SPDX-License-Identifier: Apache-2.0
2# Copyright (c) 2022 Intel Corporation
3
4mainmenu "Timer Behavior Test"
5
6config SYS_CLOCK_TICKS_PER_SEC
7	default 8192 if NRF_RTC_TIMER && TICKLESS_KERNEL
8
9source "Kconfig.zephyr"
10
11config TIMER_TEST_SAMPLES
12	int "The number of timer samples to gather for statistics"
13	default 1000 if (SRAM_SIZE < 24)
14	default 2000 if (SRAM_SIZE < 32)
15	default 3000 if (SRAM_SIZE < 48)
16	default 5000 if (SRAM_SIZE < 64)
17	default 7000 if (SRAM_SIZE < 96)
18	default 10000
19
20config TIMER_TEST_PERIOD
21	int "The number of microseconds to for the timer period"
22	default 1000
23
24config TIMER_TEST_MAX_STDDEV
25	int "Maximum standard deviation in microseconds allowed"
26	default 10
27
28config TIMER_TEST_MAX_DRIFT
29	int "Maximum drift in microseconds allowed (should be about 1 period allowance)"
30	default 1000
31
32config TIMER_TEST_PERIOD_MAX_DRIFT_PERCENT
33	int "Maximum drift percentage for the timer period"
34	# Use 13% on nRF platforms using the RTC timer because one tick there is
35	# ~122 us (see SYS_CLOCK_TICKS_PER_SEC configuration above) and one tick
36	# difference in the test period is nothing unusual (it can happen for
37	# example if a new tick elapses right after the kernel gets the number
38	# of elapsed ticks when scheduling a new timeout but before the timer
39	# driver sets up that timeout).
40	default 13 if NRF_RTC_TIMER && TICKLESS_KERNEL
41	default 10
42	help
43	  A value of 10 means 10%.
44
45config TIMER_EXTERNAL_TEST
46	bool "Perform test using an external tool"
47	help
48	  Toggles a GPIO pin, on every period, that can be used by an external
49	  tool (such as a logic analyzer) to gather timing data. A pytest harness
50	  is used to get the data collected by the tool and evaluate it.
51
52if TIMER_EXTERNAL_TEST
53
54config TIMER_EXTERNAL_TEST_MAX_DRIFT_PPM
55	int "Maximum drift in PPM for tests using external tool"
56	default 4500
57	help
58	  Parts Per Million of allowed drift when using an external tool
59	  connected to a GPIO pin is used to measure time behaviour.
60
61config TIMER_EXTERNAL_TEST_PERIOD_MAX_DRIFT_PPM
62	int "Maximum timer period drift in PPM for tests using external tool"
63	default 100000
64	help
65	  Parts Per Million of allowed period drift when using an external tool
66	  connected to a GPIO pin is used to measure time behaviour.
67
68config TIMER_EXTERNAL_TEST_SYNC_DELAY
69	int "Delay, in seconds, between tests, so that external tool can be ready"
70	default 3
71
72endif # TIMER_EXTERNAL_TEST
73