forked from M-Labs/artiq
rtio: add timestamp function
This commit is contained in:
parent
754a06c623
commit
d22c30650d
|
@ -137,3 +137,13 @@ class RTIOIn(_RTIOBase):
|
||||||
while syscall("rtio_get", self.channel) >= 0:
|
while syscall("rtio_get", self.channel) >= 0:
|
||||||
count += 1
|
count += 1
|
||||||
return count
|
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))
|
||||||
|
|
|
@ -60,7 +60,7 @@ long long int rtio_get(int channel)
|
||||||
rtio_chan_sel_write(channel);
|
rtio_chan_sel_write(channel);
|
||||||
while(rtio_i_readable_read() || (rtio_o_level_read() != 0)) {
|
while(rtio_i_readable_read() || (rtio_o_level_read() != 0)) {
|
||||||
if(rtio_i_readable_read()) {
|
if(rtio_i_readable_read()) {
|
||||||
r = rtio_i_value_read();
|
r = rtio_i_timestamp_read();
|
||||||
rtio_i_re_write(1);
|
rtio_i_re_write(1);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue