21 #include <timer_alarm.h>
24 static u64 nanosleep_wakeup_callback(s32 alarm_id, u64 scheduled_time, u64 actual_time,
void *arg,
void *pc_value)
31 iSignalSema((s32)arg);
36 int nanosleep(
const struct timespec *req,
struct timespec *rem)
44 if ((eie & 0x10000) == 0)
50 sema.option = (u32)
"nanosleep";
52 sema_id = CreateSema(&sema);
58 timer_alarm_id = SetTimerAlarm(Sec2TimerBusClock(req->tv_sec) + NSec2TimerBusClock(req->tv_nsec), nanosleep_wakeup_callback, (
void *)sema_id);
59 if (timer_alarm_id < 0)