2009-08-15 23:37:26 +02:00
|
|
|
#include "syslib.h"
|
|
|
|
|
2012-03-25 20:25:53 +02:00
|
|
|
int sys_vtimer(proc, which, newval, oldval)
|
2009-08-15 23:37:26 +02:00
|
|
|
endpoint_t proc; /* proc to retrieve/set the timer for */
|
|
|
|
int which; /* timer to retrieve/set */
|
|
|
|
clock_t *newval; /* if non-NULL, set to this new value */
|
|
|
|
clock_t *oldval; /* if non-NULL, old value is stored here */
|
|
|
|
{
|
|
|
|
message m;
|
|
|
|
int r;
|
|
|
|
|
|
|
|
m.VT_ENDPT = proc;
|
|
|
|
m.VT_WHICH = which;
|
|
|
|
if (newval != NULL) {
|
|
|
|
m.VT_SET = 1;
|
|
|
|
m.VT_VALUE = *newval;
|
|
|
|
} else {
|
|
|
|
m.VT_SET = 0;
|
|
|
|
}
|
|
|
|
|
2010-02-09 16:20:09 +01:00
|
|
|
r = _kernel_call(SYS_VTIMER, &m);
|
2009-08-15 23:37:26 +02:00
|
|
|
|
|
|
|
if (oldval != NULL) {
|
|
|
|
*oldval = m.VT_VALUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return(r);
|
|
|
|
}
|