mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2026-01-01 01:41:18 +01:00
xtimer: Rename _xtimer_now() -> _lltimer_now()
This matches _lltimer_set() and _lltimer_mask()
This commit is contained in:
parent
d432bb42b0
commit
d1b4e7a70b
@ -401,7 +401,7 @@ extern volatile uint32_t _high_cnt;
|
||||
/**
|
||||
* @brief returns the (masked) low-level timer counter value.
|
||||
*/
|
||||
static inline uint32_t _xtimer_now(void)
|
||||
static inline uint32_t _lltimer_now(void)
|
||||
{
|
||||
#if XTIMER_SHIFT
|
||||
return ((uint32_t)timer_read(XTIMER)) << XTIMER_SHIFT;
|
||||
@ -436,8 +436,8 @@ static inline void xtimer_spin_until(uint32_t value);
|
||||
*
|
||||
* (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
|
||||
* When combining _lltimer_now() and _high_cnt, we have to get the same value in
|
||||
* order to work around a race between overflowing _lltimer_now() and OR'ing the
|
||||
* resulting values.
|
||||
* But some platforms are too slow to get the same timer
|
||||
* value twice, so we use this define to ignore some of the bits.
|
||||
@ -460,12 +460,12 @@ static inline uint32_t xtimer_now(void)
|
||||
#if XTIMER_MASK
|
||||
uint32_t a, b;
|
||||
do {
|
||||
a = _xtimer_now() | _high_cnt;
|
||||
b = _xtimer_now() | _high_cnt;
|
||||
a = _lltimer_now() | _high_cnt;
|
||||
b = _lltimer_now() | _high_cnt;
|
||||
} while ((a >> XTIMER_SHIFT_ON_COMPARE) != (b >> XTIMER_SHIFT_ON_COMPARE));
|
||||
return b;
|
||||
#else
|
||||
return _xtimer_now();
|
||||
return _lltimer_now();
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -473,13 +473,13 @@ static inline void xtimer_spin_until(uint32_t target) {
|
||||
#if XTIMER_MASK
|
||||
target = _lltimer_mask(target);
|
||||
#endif
|
||||
while (_xtimer_now() > target);
|
||||
while (_xtimer_now() < target);
|
||||
while (_lltimer_now() > target);
|
||||
while (_lltimer_now() < target);
|
||||
}
|
||||
|
||||
static inline void xtimer_spin(uint32_t offset) {
|
||||
uint32_t start = _xtimer_now();
|
||||
while ((_xtimer_now() - start) < offset);
|
||||
uint32_t start = _lltimer_now();
|
||||
while ((_lltimer_now() - start) < offset);
|
||||
}
|
||||
|
||||
static inline void xtimer_usleep(uint32_t microseconds)
|
||||
|
||||
@ -113,7 +113,7 @@ void _xtimer_set64(xtimer_t *timer, uint32_t offset, uint32_t long_offset)
|
||||
|
||||
void xtimer_set(xtimer_t *timer, uint32_t offset)
|
||||
{
|
||||
DEBUG("timer_set(): offset=%" PRIu32 " now=%" PRIu32 " (%" PRIu32 ")\n", offset, xtimer_now(), _xtimer_now());
|
||||
DEBUG("timer_set(): offset=%" PRIu32 " now=%" PRIu32 " (%" PRIu32 ")\n", offset, xtimer_now(), _lltimer_now());
|
||||
if (!timer->callback) {
|
||||
DEBUG("timer_set(): timer has no callback.\n");
|
||||
return;
|
||||
@ -275,7 +275,7 @@ int xtimer_remove(xtimer_t *timer)
|
||||
|
||||
static uint32_t _time_left(uint32_t target, uint32_t reference)
|
||||
{
|
||||
uint32_t now = _xtimer_now();
|
||||
uint32_t now = _lltimer_now();
|
||||
|
||||
if (now < reference) {
|
||||
return 0;
|
||||
@ -438,14 +438,14 @@ static void _timer_callback(void)
|
||||
|
||||
/* make sure the timer counter also arrived
|
||||
* in the next timer period */
|
||||
while (_xtimer_now() == _lltimer_mask(0xFFFFFFFF));
|
||||
while (_lltimer_now() == _lltimer_mask(0xFFFFFFFF));
|
||||
}
|
||||
else {
|
||||
/* we ended up in _timer_callback and there is
|
||||
* a timer waiting.
|
||||
*/
|
||||
/* set our period reference to the current time. */
|
||||
reference = _xtimer_now();
|
||||
reference = _lltimer_now();
|
||||
}
|
||||
|
||||
overflow:
|
||||
@ -472,7 +472,7 @@ overflow:
|
||||
* time to overflow. In that case we advance to
|
||||
* next timer period and check again for expired
|
||||
* timers.*/
|
||||
if (reference > _xtimer_now()) {
|
||||
if (reference > _lltimer_now()) {
|
||||
DEBUG("_timer_callback: overflowed while executing callbacks. %i\n", timer_list_head != 0);
|
||||
_next_period();
|
||||
reference = 0;
|
||||
@ -484,7 +484,7 @@ overflow:
|
||||
next_target = timer_list_head->target - XTIMER_OVERHEAD;
|
||||
|
||||
/* make sure we're not setting a time in the past */
|
||||
if (next_target < (_xtimer_now() + XTIMER_ISR_BACKOFF)) {
|
||||
if (next_target < (_lltimer_now() + XTIMER_ISR_BACKOFF)) {
|
||||
goto overflow;
|
||||
}
|
||||
}
|
||||
@ -492,7 +492,7 @@ overflow:
|
||||
/* there's no timer planned for this timer period */
|
||||
/* schedule callback on next overflow */
|
||||
next_target = _lltimer_mask(0xFFFFFFFF);
|
||||
uint32_t now = _xtimer_now();
|
||||
uint32_t now = _lltimer_now();
|
||||
|
||||
/* check for overflow again */
|
||||
if (now < reference) {
|
||||
@ -504,7 +504,7 @@ overflow:
|
||||
/* check if the end of this period is very soon */
|
||||
if (_lltimer_mask(now + XTIMER_ISR_BACKOFF) < now) {
|
||||
/* spin until next period, then advance */
|
||||
while (_xtimer_now() >= now);
|
||||
while (_lltimer_now() >= now);
|
||||
_next_period();
|
||||
reference = 0;
|
||||
goto overflow;
|
||||
|
||||
@ -55,8 +55,8 @@ int main(void)
|
||||
else {
|
||||
}
|
||||
|
||||
a = _xtimer_now() | _high_cnt;
|
||||
b = _xtimer_now() | _high_cnt;
|
||||
a = _lltimer_now() | _high_cnt;
|
||||
b = _lltimer_now() | _high_cnt;
|
||||
} while ((a>>shift) != (b>>shift));
|
||||
|
||||
min[shift] = i < min[shift] ? i : min[shift];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user