forked from M-Labs/artiq
1
0
Fork 0

runtime: support 64-bit RTIO timestamps

This commit is contained in:
Sebastien Bourdeauducq 2014-08-18 23:41:54 +08:00
parent f8e9f1f7ac
commit 7d8dc4ef30
2 changed files with 14 additions and 10 deletions

View File

@ -8,16 +8,24 @@ lt.initialize_all()
_syscalls = { _syscalls = {
"rpc": "i+:i", "rpc": "i+:i",
"gpio_set": "ii:n", "gpio_set": "ii:n",
"rtio_set": "iii:n", "rtio_set": "Iii:n",
"rtio_sync": "i:n", "rtio_sync": "i:n",
"dds_program": "ii:n", "dds_program": "ii:n",
} }
def _str_to_functype(s):
_chr_to_type = { _chr_to_type = {
"n": lc.Type.void, "n": lambda: lc.Type.void(),
"i": lc.Type.int "i": lambda: lc.Type.int(32),
"I": lambda: lc.Type.int(64)
} }
_chr_to_value = {
"n": lambda: ir_values.VNone(),
"i": lambda: ir_values.VInt(),
"I": lambda: ir_values.VInt(64)
}
def _str_to_functype(s):
assert(s[-2] == ":") assert(s[-2] == ":")
type_ret = _chr_to_type[s[-1]]() type_ret = _chr_to_type[s[-1]]()
@ -42,10 +50,6 @@ class LinkInterface:
self.module.add_function(func_type, "__syscall_"+func_name) self.module.add_function(func_type, "__syscall_"+func_name)
def syscall(self, syscall_name, args, builder): def syscall(self, syscall_name, args, builder):
_chr_to_value = {
"n": ir_values.VNone,
"i": ir_values.VInt
}
r = _chr_to_value[_syscalls[syscall_name][-1]]() r = _chr_to_value[_syscalls[syscall_name][-1]]()
if builder is not None: if builder is not None:
args = [arg.llvm_value for arg in args] args = [arg.llvm_value for arg in args]

View File

@ -140,7 +140,7 @@ static void gpio_set(int channel, int value)
leds_out_write(csr_value); leds_out_write(csr_value);
} }
static void rtio_set(int timestamp, int channel, int value) static void rtio_set(long long int timestamp, int channel, int value)
{ {
rtio_chan_sel_write(channel); rtio_chan_sel_write(channel);
rtio_o_timestamp_write(timestamp); rtio_o_timestamp_write(timestamp);