runtime: account for RTIO_FINE_TS_WIDTH in time buffers

This commit is contained in:
Sebastien Bourdeauducq 2015-07-27 10:50:25 +08:00
parent f68d5cbd73
commit d3f05e414a
2 changed files with 6 additions and 4 deletions

View File

@ -5,12 +5,14 @@
#include "dds.h"
#include "bridge.h"
#define TIME_BUFFER (8000 << RTIO_FINE_TS_WIDTH)
static void dds_write(int addr, int data)
{
rtio_chan_sel_write(RTIO_DDS_CHANNEL);
rtio_o_address_write(addr);
rtio_o_data_write(data);
rtio_o_timestamp_write(rtio_get_counter() + 8000);
rtio_o_timestamp_write(rtio_get_counter() + TIME_BUFFER);
rtio_o_we_write(1);
}
@ -46,7 +48,7 @@ void bridge_main(void)
struct msg_brg_ttl_out *msg;
msg = (struct msg_brg_ttl_out *)umsg;
ttl_set_oe(rtio_get_counter() + 8000, msg->channel, msg->value);
ttl_set_oe(rtio_get_counter() + TIME_BUFFER, msg->channel, msg->value);
mailbox_acknowledge();
break;
}
@ -54,7 +56,7 @@ void bridge_main(void)
struct msg_brg_ttl_out *msg;
msg = (struct msg_brg_ttl_out *)umsg;
ttl_set_o(rtio_get_counter() + 8000, msg->channel, msg->value);
ttl_set_o(rtio_get_counter() + TIME_BUFFER, msg->channel, msg->value);
mailbox_acknowledge();
break;
}

View File

@ -79,7 +79,7 @@ long long int now_init(void)
if(now < 0) {
rtio_init();
now = rtio_get_counter() + 125000;
now = rtio_get_counter() + (125000 << RTIO_FINE_TS_WIDTH);
}
return now;