forked from M-Labs/artiq
runtime: use i64 for watchdog timeout, not i32.
This commit is contained in:
parent
a8c017bfcc
commit
7618907cad
|
@ -821,7 +821,7 @@ class ARTIQIRGenerator(algorithm.Visitor):
|
||||||
timeout = self.visit(context_expr_node.args[0])
|
timeout = self.visit(context_expr_node.args[0])
|
||||||
timeout_ms = self.append(ir.Arith(ast.Mult(loc=None), timeout,
|
timeout_ms = self.append(ir.Arith(ast.Mult(loc=None), timeout,
|
||||||
ir.Constant(1000, builtins.TFloat())))
|
ir.Constant(1000, builtins.TFloat())))
|
||||||
timeout_ms_int = self.append(ir.Coerce(timeout_ms, builtins.TInt32()))
|
timeout_ms_int = self.append(ir.Coerce(timeout_ms, builtins.TInt64()))
|
||||||
|
|
||||||
watchdog_id = self.append(ir.Builtin("watchdog_set", [timeout_ms_int],
|
watchdog_id = self.append(ir.Builtin("watchdog_set", [timeout_ms_int],
|
||||||
builtins.TInt32()))
|
builtins.TInt32()))
|
||||||
|
|
|
@ -356,7 +356,7 @@ class LLVMIRGenerator:
|
||||||
elif name == "now":
|
elif name == "now":
|
||||||
llty = lli64
|
llty = lli64
|
||||||
elif name == "watchdog_set":
|
elif name == "watchdog_set":
|
||||||
llty = ll.FunctionType(lli32, [lli32])
|
llty = ll.FunctionType(lli32, [lli64])
|
||||||
elif name == "watchdog_clear":
|
elif name == "watchdog_clear":
|
||||||
llty = ll.FunctionType(llvoid, [lli32])
|
llty = ll.FunctionType(llvoid, [lli32])
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
[root]
|
[root]
|
||||||
name = "ksupport"
|
name = "ksupport"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
|
|
||||||
|
|
|
@ -142,8 +142,11 @@ pub extern fn __artiq_terminate(exception: *const kernel_proto::Exception,
|
||||||
loop {}
|
loop {}
|
||||||
}
|
}
|
||||||
|
|
||||||
extern fn watchdog_set(ms: i32) -> usize {
|
extern fn watchdog_set(ms: i64) -> usize {
|
||||||
// FIXME: fix ms
|
if ms < 0 {
|
||||||
|
artiq_raise!("ValueError", "cannot set a watchdog with a negative timeout")
|
||||||
|
}
|
||||||
|
|
||||||
send(&WatchdogSetRequest { ms: ms as u64 });
|
send(&WatchdogSetRequest { ms: ms as u64 });
|
||||||
recv!(&WatchdogSetReply { id } => id)
|
recv!(&WatchdogSetReply { id } => id)
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
int64_t now = 0;
|
int64_t now = 0;
|
||||||
|
|
||||||
int watchdog_set(int ms)
|
int watchdog_set(long long ms)
|
||||||
{
|
{
|
||||||
printf("watchdog_set %d\n", ms);
|
printf("watchdog_set %d\n", ms);
|
||||||
return ms;
|
return ms;
|
||||||
|
|
Loading…
Reference in New Issue