diff options
Diffstat (limited to 'tools/iso/kernel.soso/sleep.c')
-rw-r--r-- | tools/iso/kernel.soso/sleep.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tools/iso/kernel.soso/sleep.c b/tools/iso/kernel.soso/sleep.c new file mode 100644 index 00000000..bc769698 --- /dev/null +++ b/tools/iso/kernel.soso/sleep.c @@ -0,0 +1,16 @@ +#include "sleep.h" +#include "timer.h" + +void sleepMilliseconds(Thread* thread, uint32 ms) { + uint32 uptime = getUptimeMilliseconds(); + + //target uptime to wakeup + uint32 target = uptime + ms; + + thread->state = TS_SLEEP; + thread->state_privateData = (void*)target; + + enableInterrupts(); + + halt(); +} |