[rtems commit] score: Remove strange timecounter init step
Sebastian Huber
sebh at rtems.org
Wed Oct 2 05:02:51 UTC 2019
Module: rtems
Branch: master
Commit: 47e5c1d7cde10e0daa9c43fd183ed19b7140425d
Changeset: http://git.rtems.org/rtems/commit/?id=47e5c1d7cde10e0daa9c43fd183ed19b7140425d
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Tue Oct 1 13:04:29 2019 +0200
score: Remove strange timecounter init step
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 082cb9f..e550b22 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 9fc3658..8928c5e 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);
More information about the vc
mailing list