Lines Matching +full:0 +full:- +full:100

7  * See the COPYING file in the top-level directory.
12 #include "libqtest-single.h"
14 #define TIMER_BLOCK_SCALE(s) ((((s) & 0xff) + 1) * 10)
19 #define TIMER_BASE_PHYS 0x1e000600
21 #define TIMER_LOAD 0x00
22 #define TIMER_COUNTER 0x04
23 #define TIMER_CONTROL 0x08
24 #define TIMER_INTSTAT 0x0C
26 #define TIMER_CONTROL_ENABLE (1 << 0)
29 #define TIMER_CONTROL_PRESCALER(p) (((p) & 0xff) << 8)
32 #define ONESHOT 0
33 #define NOSCALE 0
56 writel(TIMER_BASE_PHYS + TIMER_CONTROL, 0); in timer_stop()
67 timer_load(0); in timer_reset()
102 g_assert_cmpuint(timer_get_and_clr_int_sts(), ==, 0); in test_timer_oneshot()
107 g_assert_cmpuint(timer_counter(), ==, 0); in test_timer_oneshot()
112 g_assert_cmpuint(timer_counter(), ==, 0); in test_timer_oneshot()
113 g_assert_cmpuint(timer_get_and_clr_int_sts(), ==, 0); in test_timer_oneshot()
127 g_assert_cmpuint(timer_get_and_clr_int_sts(), ==, 0); in test_timer_pause()
132 g_assert_cmpuint(timer_get_and_clr_int_sts(), ==, 0); in test_timer_pause()
137 g_assert_cmpuint(timer_get_and_clr_int_sts(), ==, 0); in test_timer_pause()
142 g_assert_cmpuint(timer_get_and_clr_int_sts(), ==, 0); in test_timer_pause()
149 g_assert_cmpuint(timer_counter(), ==, 0); in test_timer_pause()
153 g_assert_cmpuint(timer_get_and_clr_int_sts(), ==, 0); in test_timer_pause()
154 g_assert_cmpuint(timer_counter(), ==, 0); in test_timer_pause()
167 g_assert_cmpuint(timer_counter(), ==, UINT32_MAX - 90000); in test_timer_reload()
168 g_assert_cmpuint(timer_get_and_clr_int_sts(), ==, 0); in test_timer_reload()
174 g_assert_cmpuint(timer_counter(), ==, UINT32_MAX - 90000); in test_timer_reload()
175 g_assert_cmpuint(timer_get_and_clr_int_sts(), ==, 0); in test_timer_reload()
184 timer_load(100); in test_timer_periodic()
187 while (repeat--) { in test_timer_periodic()
190 g_assert_cmpuint(timer_counter(), ==, 100 - repeat); in test_timer_periodic()
193 clock_step(TIMER_BLOCK_SCALE(scaler) * (101 - repeat) - 1); in test_timer_periodic()
208 g_assert_cmpuint(timer_get_and_clr_int_sts(), ==, 0); in test_timer_oneshot_to_periodic()
229 g_assert_cmpuint(timer_get_and_clr_int_sts(), ==, 0); in test_timer_periodic_to_oneshot()
235 g_assert_cmpuint(timer_counter(), ==, 0); in test_timer_periodic_to_oneshot()
248 g_assert_cmpuint(timer_get_and_clr_int_sts(), ==, 0); in test_timer_prescaler()
252 g_assert_cmpuint(timer_counter(), ==, 0); in test_timer_prescaler()
257 timer_start(ONESHOT, 0xAB); in test_timer_prescaler()
259 TIMER_BLOCK_STEP(0xAB, 9999998); in test_timer_prescaler()
262 g_assert_cmpuint(timer_get_and_clr_int_sts(), ==, 0); in test_timer_prescaler()
264 TIMER_BLOCK_STEP(0xAB, 1); in test_timer_prescaler()
266 g_assert_cmpuint(timer_counter(), ==, 0); in test_timer_prescaler()
279 g_assert_cmpuint(timer_get_and_clr_int_sts(), ==, 0); in test_timer_prescaler_on_the_fly()
281 timer_start(ONESHOT, 0xAB); in test_timer_prescaler_on_the_fly()
283 TIMER_BLOCK_STEP(0xAB, 9000); in test_timer_prescaler_on_the_fly()
286 g_assert_cmpuint(timer_get_and_clr_int_sts(), ==, 0); in test_timer_prescaler_on_the_fly()
299 g_assert_cmpuint(timer_counter(), ==, UINT32_MAX - 1); in test_timer_set_oneshot_counter_to_0()
300 g_assert_cmpuint(timer_get_and_clr_int_sts(), ==, 0); in test_timer_set_oneshot_counter_to_0()
302 timer_set_counter(0); in test_timer_set_oneshot_counter_to_0()
306 g_assert_cmpuint(timer_counter(), ==, 0); in test_timer_set_oneshot_counter_to_0()
320 g_assert_cmpuint(timer_counter(), ==, UINT32_MAX - 1); in test_timer_set_periodic_counter_to_0()
321 g_assert_cmpuint(timer_get_and_clr_int_sts(), ==, 0); in test_timer_set_periodic_counter_to_0()
323 timer_set_counter(0); in test_timer_set_periodic_counter_to_0()
327 g_assert_cmpuint(timer_counter(), ==, UINT32_MAX - (scaler ? 0 : 1)); in test_timer_set_periodic_counter_to_0()
336 g_assert_cmpuint(timer_counter(), ==, UINT32_MAX - 1); in test_timer_set_periodic_counter_to_0()
337 g_assert_cmpuint(timer_get_and_clr_int_sts(), ==, 0); in test_timer_set_periodic_counter_to_0()
339 timer_set_counter(0); in test_timer_set_periodic_counter_to_0()
343 g_assert_cmpuint(timer_counter(), ==, 0); in test_timer_set_periodic_counter_to_0()
356 g_assert_cmpuint(timer_counter(), ==, 0); in test_timer_noload_oneshot()
361 g_assert_cmpuint(timer_counter(), ==, 0); in test_timer_noload_oneshot()
362 g_assert_cmpuint(timer_get_and_clr_int_sts(), ==, 0); in test_timer_noload_oneshot()
374 g_assert_cmpuint(timer_counter(), ==, 0); in test_timer_noload_periodic()
379 g_assert_cmpuint(timer_counter(), ==, 0); in test_timer_noload_periodic()
393 g_assert_cmpuint(timer_counter(), ==, 0); in test_timer_zero_load_oneshot()
395 timer_load(0); in test_timer_zero_load_oneshot()
399 g_assert_cmpuint(timer_counter(), ==, 0); in test_timer_zero_load_oneshot()
404 g_assert_cmpuint(timer_counter(), ==, 0); in test_timer_zero_load_oneshot()
405 g_assert_cmpuint(timer_get_and_clr_int_sts(), ==, 0); in test_timer_zero_load_oneshot()
418 g_assert_cmpuint(timer_counter(), ==, 0); in test_timer_zero_load_periodic()
420 timer_load(0); in test_timer_zero_load_periodic()
424 g_assert_cmpuint(timer_counter(), ==, 0); in test_timer_zero_load_periodic()
429 g_assert_cmpuint(timer_counter(), ==, 0); in test_timer_zero_load_periodic()
442 g_assert_cmpuint(timer_counter(), ==, 0); in test_timer_zero_load_oneshot_to_nonzero()
445 timer_load(0); in test_timer_zero_load_oneshot_to_nonzero()
450 g_assert_cmpuint(timer_counter(), ==, 0); in test_timer_zero_load_oneshot_to_nonzero()
456 g_assert_cmpuint(timer_counter(), ==, 0); in test_timer_zero_load_oneshot_to_nonzero()
471 g_assert_cmpuint(timer_counter(), ==, 0); in test_timer_zero_load_periodic_to_nonzero()
473 timer_load(0); in test_timer_zero_load_periodic_to_nonzero()
477 g_assert_cmpuint(timer_counter(), ==, 0); in test_timer_zero_load_periodic_to_nonzero()
485 g_assert_cmpuint(timer_counter(), ==, 1999999 - i); in test_timer_zero_load_periodic_to_nonzero()
487 g_assert_cmpuint(timer_get_and_clr_int_sts(), ==, 0); in test_timer_zero_load_periodic_to_nonzero()
501 g_assert_cmpuint(timer_counter(), ==, 0); in test_timer_nonzero_load_oneshot_to_zero()
504 timer_load(0); in test_timer_nonzero_load_oneshot_to_zero()
506 TIMER_BLOCK_STEP(scaler, 100); in test_timer_nonzero_load_oneshot_to_zero()
508 g_assert_cmpuint(timer_counter(), ==, 0); in test_timer_nonzero_load_oneshot_to_zero()
521 g_assert_cmpuint(timer_counter(), ==, 0); in test_timer_nonzero_load_periodic_to_zero()
525 timer_load(0); in test_timer_nonzero_load_periodic_to_zero()
527 TIMER_BLOCK_STEP(scaler, 100); in test_timer_nonzero_load_periodic_to_zero()
529 g_assert_cmpuint(timer_counter(), ==, 0); in test_timer_nonzero_load_periodic_to_zero()
541 TIMER_BLOCK_STEP(scaler, 100); in test_timer_set_periodic_counter_on_the_fly()
543 g_assert_cmpuint(timer_counter(), ==, UINT32_MAX / 2 - 100); in test_timer_set_periodic_counter_on_the_fly()
544 g_assert_cmpuint(timer_get_and_clr_int_sts(), ==, 0); in test_timer_set_periodic_counter_on_the_fly()
548 TIMER_BLOCK_STEP(scaler, 100); in test_timer_set_periodic_counter_on_the_fly()
550 g_assert_cmpuint(timer_counter(), ==, UINT32_MAX - 100); in test_timer_set_periodic_counter_on_the_fly()
551 g_assert_cmpuint(timer_get_and_clr_int_sts(), ==, 0); in test_timer_set_periodic_counter_on_the_fly()
567 TIMER_BLOCK_STEP(scaler, 100); in test_timer_enable_and_set_counter()
569 g_assert_cmpuint(timer_counter(), ==, UINT32_MAX - 100); in test_timer_enable_and_set_counter()
570 g_assert_cmpuint(timer_get_and_clr_int_sts(), ==, 0); in test_timer_enable_and_set_counter()
581 TIMER_BLOCK_STEP(scaler, 100); in test_timer_set_counter_and_enable()
583 g_assert_cmpuint(timer_counter(), ==, UINT32_MAX - 100); in test_timer_set_counter_and_enable()
584 g_assert_cmpuint(timer_get_and_clr_int_sts(), ==, 0); in test_timer_set_counter_and_enable()
592 TIMER_BLOCK_STEP(NOSCALE, 100); in test_timer_set_counter_disabled()
595 g_assert_cmpuint(timer_get_and_clr_int_sts(), ==, 0); in test_timer_set_counter_disabled()
603 TIMER_BLOCK_STEP(NOSCALE, 100); in test_timer_load_disabled()
606 g_assert_cmpuint(timer_get_and_clr_int_sts(), ==, 0); in test_timer_load_disabled()
615 timer_set_counter(0); in test_timer_oneshot_with_counter_0_on_start()
618 TIMER_BLOCK_STEP(scaler, 100); in test_timer_oneshot_with_counter_0_on_start()
620 g_assert_cmpuint(timer_counter(), ==, 0); in test_timer_oneshot_with_counter_0_on_start()
623 TIMER_BLOCK_STEP(scaler, 100); in test_timer_oneshot_with_counter_0_on_start()
625 g_assert_cmpuint(timer_counter(), ==, 0); in test_timer_oneshot_with_counter_0_on_start()
626 g_assert_cmpuint(timer_get_and_clr_int_sts(), ==, 0); in test_timer_oneshot_with_counter_0_on_start()
636 timer_set_counter(0); in test_timer_periodic_with_counter_0_on_start()
638 g_assert_cmpuint(timer_get_and_clr_int_sts(), ==, 0); in test_timer_periodic_with_counter_0_on_start()
639 g_assert_cmpuint(timer_counter(), ==, 0); in test_timer_periodic_with_counter_0_on_start()
643 TIMER_BLOCK_STEP(scaler, 100); in test_timer_periodic_with_counter_0_on_start()
646 g_assert_cmpuint(timer_counter(), ==, UINT32_MAX + (scaler ? 1 : 0) - 100); in test_timer_periodic_with_counter_0_on_start()
648 TIMER_BLOCK_STEP(scaler, 100); in test_timer_periodic_with_counter_0_on_start()
650 g_assert_cmpuint(timer_counter(), ==, UINT32_MAX + (scaler ? 1 : 0) - 200); in test_timer_periodic_with_counter_0_on_start()
651 g_assert_cmpuint(timer_get_and_clr_int_sts(), ==, 0); in test_timer_periodic_with_counter_0_on_start()
655 timer_set_counter(0); in test_timer_periodic_with_counter_0_on_start()
657 g_assert_cmpuint(timer_counter(), ==, 0); in test_timer_periodic_with_counter_0_on_start()
658 g_assert_cmpuint(timer_get_and_clr_int_sts(), ==, 0); in test_timer_periodic_with_counter_0_on_start()
662 g_assert_cmpuint(timer_get_and_clr_int_sts(), ==, 0); in test_timer_periodic_with_counter_0_on_start()
670 for (i = 2 - (!!scaler ? 1 : 0); i < 10; i++) { in test_timer_periodic_with_counter_0_on_start()
673 g_assert_cmpuint(timer_counter(), ==, 1999999 - i); in test_timer_periodic_with_counter_0_on_start()
675 g_assert_cmpuint(timer_get_and_clr_int_sts(), ==, 0); in test_timer_periodic_with_counter_0_on_start()
691 for (test_val = 0; test_val <= test_load; test_val++) { in test_periodic_counter()
703 timer_load(0); in test_timer_set_counter_periodic_with_zero_load()
717 g_assert_cmpuint(timer_counter(), ==, 0); in test_timer_set_counter_periodic_with_zero_load()
722 g_assert_cmpuint(timer_counter(), ==, 0); in test_timer_set_counter_periodic_with_zero_load()
734 TIMER_BLOCK_STEP(scaler, 100); in test_timer_set_oneshot_load_to_0()
736 g_assert_cmpuint(timer_counter(), ==, UINT32_MAX - 100); in test_timer_set_oneshot_load_to_0()
737 g_assert_cmpuint(timer_get_and_clr_int_sts(), ==, 0); in test_timer_set_oneshot_load_to_0()
739 timer_load(0); in test_timer_set_oneshot_load_to_0()
741 TIMER_BLOCK_STEP(scaler, 100); in test_timer_set_oneshot_load_to_0()
743 g_assert_cmpuint(timer_counter(), ==, 0); in test_timer_set_oneshot_load_to_0()
746 TIMER_BLOCK_STEP(scaler, 100); in test_timer_set_oneshot_load_to_0()
748 g_assert_cmpuint(timer_counter(), ==, 0); in test_timer_set_oneshot_load_to_0()
749 g_assert_cmpuint(timer_get_and_clr_int_sts(), ==, 0); in test_timer_set_oneshot_load_to_0()
760 TIMER_BLOCK_STEP(scaler, 100); in test_timer_set_periodic_load_to_0()
762 g_assert_cmpuint(timer_counter(), ==, UINT32_MAX - 100); in test_timer_set_periodic_load_to_0()
763 g_assert_cmpuint(timer_get_and_clr_int_sts(), ==, 0); in test_timer_set_periodic_load_to_0()
765 timer_load(0); in test_timer_set_periodic_load_to_0()
767 TIMER_BLOCK_STEP(scaler, 100); in test_timer_set_periodic_load_to_0()
769 g_assert_cmpuint(timer_counter(), ==, 0); in test_timer_set_periodic_load_to_0()
772 TIMER_BLOCK_STEP(scaler, 100); in test_timer_set_periodic_load_to_0()
775 g_assert_cmpuint(timer_counter(), ==, 0); in test_timer_set_periodic_load_to_0()
786 clock_step(100); in test_deferred_trigger()
788 g_assert_cmpuint(timer_counter(), ==, 0); in test_deferred_trigger()
798 clock_step(100); in test_deferred_trigger()
800 g_assert_cmpuint(timer_get_and_clr_int_sts(), ==, 0); in test_deferred_trigger()
804 g_assert_cmpuint(timer_get_and_clr_int_sts(), ==, 0); in test_deferred_trigger()
814 clock_step(100); in test_deferred_trigger()
816 g_assert_cmpuint(timer_get_and_clr_int_sts(), ==, 0); in test_deferred_trigger()
818 timer_set_counter(0); in test_deferred_trigger()
820 clock_step(100); in test_deferred_trigger()
822 g_assert_cmpuint(timer_get_and_clr_int_sts(), ==, 0); in test_deferred_trigger()
832 clock_step(100); in test_deferred_trigger()
834 g_assert_cmpuint(timer_get_and_clr_int_sts(), ==, 0); in test_deferred_trigger()
836 timer_load(0); in test_deferred_trigger()
838 clock_step(100); in test_deferred_trigger()
840 g_assert_cmpuint(timer_get_and_clr_int_sts(), ==, 0); in test_deferred_trigger()
857 timer_load(0); in test_timer_zero_load_mode_switch()
862 g_assert_cmpuint(timer_counter(), ==, 0); in test_timer_zero_load_mode_switch()
871 g_assert_cmpuint(timer_counter(), ==, 0); in test_timer_zero_load_mode_switch()
876 g_assert_cmpuint(timer_counter(), ==, 0); in test_timer_zero_load_mode_switch()
877 g_assert_cmpuint(timer_get_and_clr_int_sts(), ==, 0); in test_timer_zero_load_mode_switch()
885 g_assert_cmpuint(timer_counter(), ==, 0); in test_timer_zero_load_mode_switch()
892 timer_load(0); in test_timer_zero_load_prescaled_periodic_to_nonscaled_oneshot()
897 g_assert_cmpuint(timer_counter(), ==, 0); in test_timer_zero_load_prescaled_periodic_to_nonscaled_oneshot()
899 g_assert_cmpuint(timer_get_and_clr_int_sts(), ==, 0); in test_timer_zero_load_prescaled_periodic_to_nonscaled_oneshot()
903 g_assert_cmpuint(timer_counter(), ==, 0); in test_timer_zero_load_prescaled_periodic_to_nonscaled_oneshot()
905 g_assert_cmpuint(timer_get_and_clr_int_sts(), ==, 0); in test_timer_zero_load_prescaled_periodic_to_nonscaled_oneshot()
913 g_assert_cmpuint(timer_counter(), ==, 0); in test_timer_zero_load_prescaled_periodic_to_nonscaled_oneshot()
915 g_assert_cmpuint(timer_get_and_clr_int_sts(), ==, 0); in test_timer_zero_load_prescaled_periodic_to_nonscaled_oneshot()
919 g_assert_cmpuint(timer_counter(), ==, 0); in test_timer_zero_load_prescaled_periodic_to_nonscaled_oneshot()
920 g_assert_cmpuint(timer_get_and_clr_int_sts(), ==, 0); in test_timer_zero_load_prescaled_periodic_to_nonscaled_oneshot()
926 timer_load(0); in test_timer_zero_load_prescaled_oneshot_to_nonscaled_periodic()
931 g_assert_cmpuint(timer_counter(), ==, 0); in test_timer_zero_load_prescaled_oneshot_to_nonscaled_periodic()
933 g_assert_cmpuint(timer_get_and_clr_int_sts(), ==, 0); in test_timer_zero_load_prescaled_oneshot_to_nonscaled_periodic()
939 g_assert_cmpuint(timer_counter(), ==, 0); in test_timer_zero_load_prescaled_oneshot_to_nonscaled_periodic()
940 g_assert_cmpuint(timer_get_and_clr_int_sts(), ==, 0); in test_timer_zero_load_prescaled_oneshot_to_nonscaled_periodic()
946 timer_load(0); in test_timer_zero_load_nonscaled_oneshot_to_prescaled_periodic()
951 g_assert_cmpuint(timer_counter(), ==, 0); in test_timer_zero_load_nonscaled_oneshot_to_prescaled_periodic()
952 g_assert_cmpuint(timer_get_and_clr_int_sts(), ==, 0); in test_timer_zero_load_nonscaled_oneshot_to_prescaled_periodic()
958 g_assert_cmpuint(timer_counter(), ==, 0); in test_timer_zero_load_nonscaled_oneshot_to_prescaled_periodic()
960 g_assert_cmpuint(timer_get_and_clr_int_sts(), ==, 0); in test_timer_zero_load_nonscaled_oneshot_to_prescaled_periodic()
964 g_assert_cmpuint(timer_counter(), ==, 0); in test_timer_zero_load_nonscaled_oneshot_to_prescaled_periodic()
966 g_assert_cmpuint(timer_get_and_clr_int_sts(), ==, 0); in test_timer_zero_load_nonscaled_oneshot_to_prescaled_periodic()
972 timer_load(0); in test_timer_zero_load_nonscaled_periodic_to_prescaled_oneshot()
977 g_assert_cmpuint(timer_counter(), ==, 0); in test_timer_zero_load_nonscaled_periodic_to_prescaled_oneshot()
978 g_assert_cmpuint(timer_get_and_clr_int_sts(), ==, 0); in test_timer_zero_load_nonscaled_periodic_to_prescaled_oneshot()
984 g_assert_cmpuint(timer_counter(), ==, 0); in test_timer_zero_load_nonscaled_periodic_to_prescaled_oneshot()
986 g_assert_cmpuint(timer_get_and_clr_int_sts(), ==, 0); in test_timer_zero_load_nonscaled_periodic_to_prescaled_oneshot()
990 g_assert_cmpuint(timer_counter(), ==, 0); in test_timer_zero_load_nonscaled_periodic_to_prescaled_oneshot()
991 g_assert_cmpuint(timer_get_and_clr_int_sts(), ==, 0); in test_timer_zero_load_nonscaled_periodic_to_prescaled_oneshot()
1030 for (scale = 0; scale < 2; scale++) { in main()
1085 qtest_start("-machine vexpress-a9"); in main()