Fix a computation error in the fix for the last computational error

This commit is contained in:
Gregory Nutt 2014-08-11 12:07:49 -06:00
parent 1cc184ec41
commit 56196ecea1
3 changed files with 4 additions and 2919 deletions

View File

@ -290,8 +290,7 @@ int sam_oneshot_start(struct sam_oneshot_s *oneshot, oneshot_handler_t handler,
regval = (usec * (uint64_t)sam_tc_divfreq(oneshot->tch)) / USEC_PER_SEC;
tcvdbg("usec=%lu regval=%08lx\n",
(unsigned long)usec, (unsigned long)regval);
tcvdbg("usec=%llu regval=%08llx\n", usec, regval);
DEBUGASSERT(regval <= UINT32_MAX);
/* Set up to receive the callback when the interrupt occurs */

File diff suppressed because it is too large Load Diff

View File

@ -314,17 +314,17 @@ static void sched_timer_start(unsigned int ticks)
/* Convert ticks to a struct timespec that up_timer_start() can
* understand.
*
* REVISIT: Calculations may not have acceptable ragne if uint64_t
* REVISIT: Calculations may not have an acceptable range if uint64_t
* is not supported(?)
*/
#ifdef CONFIG_HAVE_LONG_LONG
usecs = TICK2USEC((uint64_t)ticks);
#else
usecs = TICK2USEC((uint64_t)ticks);
usecs = TICK2USEC(ticks);
#endif
secs = usecs / USEC_PER_SEC;
nsecs = (usecs - (secs * USEC_PER_SEC)) * NSEC_PER_MSEC;
nsecs = (usecs - (secs * USEC_PER_SEC)) * NSEC_PER_USEC;
ts.tv_sec = (time_t)secs;
ts.tv_nsec = (long)nsecs;