implement nanosleep for devkitARM r49

(cherry picked from commit fba44c189e568df13573a9e119e63dbd718424c6)
This commit is contained in:
Dave Murphy 2018-06-13 09:14:57 +01:00
parent 510504a853
commit d1ca5c4ea6
2 changed files with 8 additions and 9 deletions

View File

@ -163,12 +163,3 @@ void osSetSpeedupEnable(bool enable)
__ctru_speedup = enable;
__ctru_speedup_config();
}
int usleep(useconds_t useconds)
{
svcSleepThread(useconds * 1000ull);
return 0;
}

View File

@ -28,12 +28,20 @@ static struct _reent* __ctru_get_reent()
return tv->reent;
}
static int __libctru_nanosleep(const struct timespec *req, struct timespec *rem)
{
svcSleepThread(req->tv_sec * 1000000000ull + req->tv_nsec);
return 0;
}
void __system_initSyscalls(void)
{
// Register newlib syscalls
__syscalls.exit = __ctru_exit;
__syscalls.gettod_r = __libctru_gtod;
__syscalls.getreent = __ctru_get_reent;
__syscalls.nanosleep = __libctru_nanosleep;
// Register locking syscalls
__syscalls.lock_init = LightLock_Init;