mirror of
https://github.com/apache/nuttx.git
synced 2026-05-27 11:26:12 +08:00
Fix a computation error in the fix for the last computational error
This commit is contained in:
@@ -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;
|
regval = (usec * (uint64_t)sam_tc_divfreq(oneshot->tch)) / USEC_PER_SEC;
|
||||||
|
|
||||||
tcvdbg("usec=%lu regval=%08lx\n",
|
tcvdbg("usec=%llu regval=%08llx\n", usec, regval);
|
||||||
(unsigned long)usec, (unsigned long)regval);
|
|
||||||
DEBUGASSERT(regval <= UINT32_MAX);
|
DEBUGASSERT(regval <= UINT32_MAX);
|
||||||
|
|
||||||
/* Set up to receive the callback when the interrupt occurs */
|
/* Set up to receive the callback when the interrupt occurs */
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -314,17 +314,17 @@ static void sched_timer_start(unsigned int ticks)
|
|||||||
/* Convert ticks to a struct timespec that up_timer_start() can
|
/* Convert ticks to a struct timespec that up_timer_start() can
|
||||||
* understand.
|
* 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(?)
|
* is not supported(?)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_HAVE_LONG_LONG
|
#ifdef CONFIG_HAVE_LONG_LONG
|
||||||
usecs = TICK2USEC((uint64_t)ticks);
|
usecs = TICK2USEC((uint64_t)ticks);
|
||||||
#else
|
#else
|
||||||
usecs = TICK2USEC((uint64_t)ticks);
|
usecs = TICK2USEC(ticks);
|
||||||
#endif
|
#endif
|
||||||
secs = usecs / USEC_PER_SEC;
|
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_sec = (time_t)secs;
|
||||||
ts.tv_nsec = (long)nsecs;
|
ts.tv_nsec = (long)nsecs;
|
||||||
|
|||||||
Reference in New Issue
Block a user