rtio: add timestamp function

This commit is contained in:
Sebastien Bourdeauducq 2014-10-14 15:54:10 +08:00
parent 754a06c623
commit d22c30650d
2 changed files with 11 additions and 1 deletions

View File

@ -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))

View File

@ -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;
}