From dec7c1438fd95e270eddd0d49d3f14771b9104db Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Tue, 22 Jul 2014 11:36:54 -0600 Subject: [PATCH] runtime: implement rtio_sync syscall --- artiq/devices/runtime.py | 3 ++- soc/runtime/main.c | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/artiq/devices/runtime.py b/artiq/devices/runtime.py index ca197fd6c..9aee65d54 100644 --- a/artiq/devices/runtime.py +++ b/artiq/devices/runtime.py @@ -6,7 +6,8 @@ lt.initialize_all() _syscalls = [ ("rpc", "i+:i"), ("gpio_set", "ii:v"), - ("rtio_set", "iii:v") + ("rtio_set", "iii:v"), + ("rtio_sync", "i:v"), ] def _str_to_functype(s): diff --git a/soc/runtime/main.c b/soc/runtime/main.c index d7e2b1e98..fe046fe88 100644 --- a/soc/runtime/main.c +++ b/soc/runtime/main.c @@ -139,10 +139,17 @@ static void rtio_set(int timestamp, int channel, int value) rtio_o_we_write(1); } +static void rtio_sync(int channel) +{ + rtio_chan_sel_write(channel); + while(rtio_o_level_read() != 0); +} + static const struct symbol syscalls[] = { {"__syscall_rpc", rpc}, {"__syscall_gpio_set", gpio_set}, {"__syscall_rtio_set", rtio_set}, + {"__syscall_rtio_sync", rtio_sync}, {NULL, NULL} };