[Bug 1748] SPARC BSPs nanoseconds skipping back when counter wraps during get TOD or uptime call
bugzilla-daemon at rtems.org
bugzilla-daemon at rtems.org
Wed Apr 20 12:20:21 UTC 2011
https://www.rtems.org/bugzilla/show_bug.cgi?id=1748
Jorge Lopez <jorge.lopez.trescastro at esa.int> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
CC| |jorge.lopez.trescastro at esa.
| |int
Resolution|FIXED |
--- Comment #12 from Jorge Lopez <jorge.lopez.trescastro at esa.int> 2011-04-20 07:20:18 CDT ---
I think a line is missing in the current LEON2 implementation:
http://www.rtems.com/viewvc/rtems/c/src/lib/libbsp/sparc/leon2/clock/ckinit.c?view=markup
62 uint32_t bsp_clock_nanoseconds_since_last_tick(void)
63 {
64 uint32_t clicks;
65 uint32_t usecs;
66
+ clicks = LEON_REG.Timer_Counter_1;
67 if ( LEON_Is_interrupt_pending( LEON_INTERRUPT_TIMER1 ) ) {
68 clicks = LEON_REG.Timer_Counter_1;
69 usecs = (2*rtems_configuration_get_microseconds_per_tick() - clicks);
70 } else {
71 usecs = (rtems_configuration_get_microseconds_per_tick() - clicks);
72 }
73 return usecs * 1000;
74 }
Otherwise, we will not read the timer1 counter if a timer1 interrupt is not
pending.
Jorge.
--
Configure bugmail: https://www.rtems.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.
More information about the bugs
mailing list