mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
parent
cdd65cef1c
commit
3e965f926a
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* virtual timer
|
* virtual timer
|
||||||
*
|
*
|
||||||
* Copyright (C) 2013 Freie Universität Berlin
|
* Copyright (C) 2013, 2014 Freie Universität Berlin
|
||||||
*
|
*
|
||||||
* This file is subject to the terms and conditions of the GNU Lesser General
|
* This file is subject to the terms and conditions of the GNU Lesser General
|
||||||
* Public License. See the file LICENSE in the top level directory for more
|
* Public License. See the file LICENSE in the top level directory for more
|
||||||
@ -323,6 +323,19 @@ int vtimer_usleep(uint32_t usecs)
|
|||||||
|
|
||||||
int vtimer_sleep(timex_t time)
|
int vtimer_sleep(timex_t time)
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Use spin lock for short periods.
|
||||||
|
* Assumes that hardware timer ticks are shorter than a second.
|
||||||
|
* Decision based on hwtimer_wait implementation.
|
||||||
|
*/
|
||||||
|
if (time.seconds == 0) {
|
||||||
|
unsigned long ticks = HWTIMER_TICKS(time.microseconds);
|
||||||
|
if (ticks <= 6) {
|
||||||
|
hwtimer_spin(ticks);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int ret;
|
int ret;
|
||||||
vtimer_t t;
|
vtimer_t t;
|
||||||
mutex_t mutex;
|
mutex_t mutex;
|
||||||
|
Loading…
Reference in New Issue
Block a user