The double call of the timecounter get method was added to FreeBSD in
2002 without a comment.  It is not clear why this is needed.
---
 cpukit/score/src/kern_tc.c                |  2 +-
 testsuites/sptests/sptimecounter01/init.c | 12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/cpukit/score/src/kern_tc.c b/cpukit/score/src/kern_tc.c
index 082cb9f7d7..e550b22580 100644
--- a/cpukit/score/src/kern_tc.c
+++ b/cpukit/score/src/kern_tc.c
@@ -1399,9 +1399,9 @@ tc_init(struct timecounter *tc)
        if (tc->tc_quality == timecounter->tc_quality &&
            tc->tc_frequency < timecounter->tc_frequency)
                return;
-#endif /* __rtems__ */
        (void)tc->tc_get_timecount(tc);
        (void)tc->tc_get_timecount(tc);
+#endif /* __rtems__ */
        timecounter = tc;
 #ifdef __rtems__
        tc_windup(NULL);
diff --git a/testsuites/sptests/sptimecounter01/init.c 
b/testsuites/sptests/sptimecounter01/init.c
index 9fc36583c4..8928c5e051 100644
--- a/testsuites/sptests/sptimecounter01/init.c
+++ b/testsuites/sptests/sptimecounter01/init.c
@@ -126,25 +126,25 @@ void boot_card(const char *cmdline)
   tc_soft->tc_frequency = soft_freq;
   tc_soft->tc_quality = 1234;
   _Timecounter_Install(tc_soft);
-  assert(ctx->tc_soft_counter == 3);
+  assert(ctx->tc_soft_counter == 1);
 
   rtems_bsd_binuptime(&bt);
-  assert(ctx->tc_soft_counter == 4);
+  assert(ctx->tc_soft_counter == 2);
 
   assert(bt.sec == 1);
   assert(bt.frac == 18446744073708);
 
-  ctx->tc_soft_counter = 0xf0000000 | 3;
+  ctx->tc_soft_counter = 0xf0000000 | 1;
   rtems_bsd_binuptime(&bt);
-  assert(ctx->tc_soft_counter == (0xf0000000 | 4));
+  assert(ctx->tc_soft_counter == (0xf0000000 | 2));
 
   assert(bt.sec == 1);
   assert(bt.frac == 18446744073708);
 
   /* Ensure that the fraction overflows and the second remains constant */
-  ctx->tc_soft_counter = (0xf0000000 | 3) + soft_freq;
+  ctx->tc_soft_counter = (0xf0000000 | 1) + soft_freq;
   rtems_bsd_binuptime(&bt);
-  assert(ctx->tc_soft_counter == (0xf0000000 | 4) + soft_freq);
+  assert(ctx->tc_soft_counter == (0xf0000000 | 2) + soft_freq);
   assert(bt.sec == 1);
   assert(bt.frac == 18446742522092);
 
-- 
2.16.4

_______________________________________________
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Reply via email to