2
0
mirror of https://github.com/m-labs/artiq.git synced 2024-12-12 21:26:37 +08:00
artiq/soc/runtime/rtio.c

33 lines
663 B
C
Raw Normal View History

2014-08-28 16:56:48 +08:00
#include <generated/csr.h>
#include "rtio.h"
void rtio_init(void)
{
2014-09-05 12:03:22 +08:00
rtio_reset_write(1);
2014-08-28 16:56:48 +08:00
}
void rtio_set(long long int timestamp, int channel, int value)
{
2014-09-05 12:03:22 +08:00
rtio_reset_write(0);
rtio_chan_sel_write(channel);
rtio_o_timestamp_write(timestamp);
rtio_o_value_write(value);
while(!rtio_o_writable_read());
rtio_o_we_write(1);
2014-08-28 16:56:48 +08:00
}
2014-09-11 23:14:45 +08:00
void rtio_replace(long long int timestamp, int channel, int value)
{
rtio_chan_sel_write(channel);
rtio_o_timestamp_write(timestamp);
rtio_o_value_write(value);
rtio_o_replace_write(1);
}
2014-08-28 16:56:48 +08:00
void rtio_sync(int channel)
{
2014-09-05 12:03:22 +08:00
rtio_chan_sel_write(channel);
while(rtio_o_level_read() != 0);
2014-08-28 16:56:48 +08:00
}