[Bug 1748] LEON nanoseconds skipping back when called during timer tick

bugzilla-daemon at rtems.org bugzilla-daemon at rtems.org
Thu Mar 3 16:16:49 UTC 2011


https://www.rtems.org/bugzilla/show_bug.cgi?id=1748

--- Comment #5 from Joel Sherrill <joel.sherrill at oarcorp.com> 2011-03-03 10:16:48 CST ---
How about this version?

uint32_t bsp_clock_nanoseconds_since_last_tick(void)
{
  uint32_t clicks;
  uint32_t usecs;

  clicks = ERC32_MEC.Real_Time_Clock_Counter;

  if ( ERC32_Is_interrupt_pending( ERC32_INTERRUPT_REAL_TIME_CLOCK ) ) {
    clicks = ERC32_MEC.Real_Time_Clock_Counter;
    usecs = (2*rtems_configuration_get_microseconds_per_tick() - clicks);
  } else {
    usecs = (rtems_configuration_get_microseconds_per_tick() - clicks);
  }
  return usecs * 1000;
}

-- 
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