From d3f05e414aff3213e0be87ed1ddd7debcf2b4036 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Mon, 27 Jul 2015 10:50:25 +0800 Subject: [PATCH] runtime: account for RTIO_FINE_TS_WIDTH in time buffers --- soc/runtime/bridge.c | 8 +++++--- soc/runtime/ksupport.c | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/soc/runtime/bridge.c b/soc/runtime/bridge.c index eb16587de..78083a16f 100644 --- a/soc/runtime/bridge.c +++ b/soc/runtime/bridge.c @@ -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; } diff --git a/soc/runtime/ksupport.c b/soc/runtime/ksupport.c index 032fe88ec..eb7a784b7 100644 --- a/soc/runtime/ksupport.c +++ b/soc/runtime/ksupport.c @@ -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;