blob: 66f6533c19a1bd640acf4ca322079bd9da4683cc (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#include <apos/timer.h>
#include <apos/uapi.h>
static ticks_t scaled_ticks(vm_t ticks, vm_t repeat)
{
#if __WORDSIZE == 64
UNUSED(repeat);
return ticks;
#else
return ((ticks_t)ticks << 32) + repeat;
#endif
}
SYSCALL_DEFINE2(req_rel_timer)(vm_t ticks, vm_t repeat)
{
return new_rel_timer(cur_tcb()->tid, scaled_ticks(ticks, repeat));
}
SYSCALL_DEFINE2(req_abs_timer)(vm_t ticks, vm_t repeat)
{
return new_abs_timer(cur_tcb()->tid, scaled_ticks(ticks, repeat));
}
SYSCALL_DEFINE1(free_timer)(vm_t cid)
{
struct timer *timer = find_timer(cid);
if (!timer)
return ERR_NF;
remove_timer(timer);
return OK;
}
|