1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-29 03:34:07 +00:00
oot/src/libc64/sleep.c

29 lines
559 B
C
Raw Normal View History

#include "global.h"
2020-04-08 16:45:50 +00:00
void Sleep_Cycles(OSTime cycles) {
OSMesgQueue mq;
OSMesg msg;
OSTimer timer;
osCreateMesgQueue(&mq, &msg, 1);
osSetTimer(&timer, cycles, 0, &mq, NULL);
osRecvMesg(&mq, NULL, OS_MESG_BLOCK);
}
2020-04-08 16:45:50 +00:00
void Sleep_Nsec(u32 nsec) {
Sleep_Cycles(OS_NSEC_TO_CYCLES(nsec));
}
2020-04-08 16:45:50 +00:00
void Sleep_Usec(u32 usec) {
Sleep_Cycles(OS_USEC_TO_CYCLES(usec));
}
// originally "msleep"
2020-04-08 16:45:50 +00:00
void Sleep_Msec(u32 ms) {
Sleep_Cycles((ms * OS_CPU_COUNTER) / 1000ull);
}
2020-04-08 16:45:50 +00:00
void Sleep_Sec(u32 sec) {
2020-04-08 18:24:46 +00:00
Sleep_Cycles(sec * OS_CPU_COUNTER);
}