Browse Source

sys: xtimer: add xtimer_wakeup64

dev/timer
Kaspar Schleiser 8 years ago
parent
commit
e27ce2465f
  1. 12
      sys/include/xtimer.h
  2. 8
      sys/xtimer/xtimer.c

12
sys/include/xtimer.h

@ -215,6 +215,18 @@ void xtimer_set_msg64(xtimer_t *timer, uint64_t offset, msg_t *msg, kernel_pid_t
*/
void xtimer_set_wakeup(xtimer_t *timer, uint32_t offset, kernel_pid_t pid);
/**
* @brief Set a timer that wakes up a thread, 64bit version
*
* This function sets a timer that will wake up a thread when the timer has
* expired.
*
* @param[in] timer timer struct to work with
* @param[in] offset microseconds from now
* @param[in] pid pid of the thread that will be woken up
*/
void xtimer_set_wakeup64(xtimer_t *timer, uint64_t offset, kernel_pid_t pid);
/**
* @brief Set a timer to execute a callback at some time in the future
*

8
sys/xtimer/xtimer.c

@ -127,6 +127,14 @@ void xtimer_set_wakeup(xtimer_t *timer, uint32_t offset, kernel_pid_t pid)
xtimer_set(timer, offset);
}
void xtimer_set_wakeup64(xtimer_t *timer, uint64_t offset, kernel_pid_t pid)
{
timer->callback = _callback_wakeup;
timer->arg = (void*) ((intptr_t)pid);
_xtimer_set64(timer, offset, offset >> 32);
}
/**
* see http://www.hackersdelight.org/magic.htm.
* This is to avoid using long integer division functions

Loading…
Cancel
Save