1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-25 06:23:53 +01:00

Merge pull request #3979 from gebart/pr/xtimer-fixups

sys/xtimer: Small fixes
This commit is contained in:
Kaspar Schleiser 2015-09-28 15:21:30 +02:00
commit 8da80ee878
3 changed files with 5 additions and 5 deletions

View File

@ -434,7 +434,7 @@ static inline void xtimer_spin_until(uint32_t value);
/**
* @brief ignore some bits when comparing timer values
*
* (only relevant when XTIMER_MASK != 0, e.g., timers < 16bit.)
* (only relevant when XTIMER_MASK != 0, e.g., timers < 32bit.)
*
* When combining _xtimer_now() and _high_cnt, we have to get the same value in
* order to work around a race between overflowing _xtimer_now() and OR'ing the

View File

@ -155,16 +155,16 @@ void xtimer_set_wakeup64(xtimer_t *timer, uint64_t offset, kernel_pid_t pid)
* This is to avoid using long integer division functions
* the compiler otherwise links in.
*/
static inline uint64_t _ms_to_sec(uint64_t ms)
static inline uint64_t _us_to_sec(uint64_t us)
{
return (unsigned long long)(ms * 0x431bde83) >> (0x12 + 32);
return (unsigned long long)(us * 0x431bde83) >> (0x12 + 32);
}
void xtimer_now_timex(timex_t *out)
{
uint64_t now = xtimer_now64();
out->seconds = _ms_to_sec(now);
out->seconds = _us_to_sec(now);
out->microseconds = now - (out->seconds * SEC_IN_USEC);
}

View File

@ -120,13 +120,13 @@ void xtimer_set(xtimer_t *timer, uint32_t offset)
}
xtimer_remove(timer);
uint32_t target = xtimer_now() + offset;
if (offset < XTIMER_BACKOFF) {
xtimer_spin(offset);
_shoot(timer);
}
else {
uint32_t target = xtimer_now() + offset;
_xtimer_set_absolute(timer, target);
}
}