diff --git a/artiq/devices/rtio_core.py b/artiq/devices/rtio_core.py index 4c95cc4fa..02eabe634 100644 --- a/artiq/devices/rtio_core.py +++ b/artiq/devices/rtio_core.py @@ -137,3 +137,13 @@ class RTIOIn(_RTIOBase): while syscall("rtio_get", self.channel) >= 0: count += 1 return count + + @kernel + def timestamp(self): + """Poll the RTIO input and returns an event timestamp, according to + the gating. + + If the gate is permanently closed, returns a negative value. + + """ + return cycles_to_time(syscall("rtio_get", self.channel)) diff --git a/soc/runtime/rtio.c b/soc/runtime/rtio.c index 2b172d890..0033a6ccd 100644 --- a/soc/runtime/rtio.c +++ b/soc/runtime/rtio.c @@ -60,7 +60,7 @@ long long int rtio_get(int channel) rtio_chan_sel_write(channel); while(rtio_i_readable_read() || (rtio_o_level_read() != 0)) { if(rtio_i_readable_read()) { - r = rtio_i_value_read(); + r = rtio_i_timestamp_read(); rtio_i_re_write(1); return r; }