From 53b259b9a0c0c69e7a0bda8754db3b517b52c7b8 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Sun, 5 Oct 2014 10:34:32 +0800 Subject: [PATCH] soc/runtime/dds: fix FUD sequence error detection --- soc/runtime/dds.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/soc/runtime/dds.c b/soc/runtime/dds.c index d34c5d308..091f3b980 100644 --- a/soc/runtime/dds.c +++ b/soc/runtime/dds.c @@ -28,25 +28,28 @@ static void fud_sync(void) static void fud(long long int fud_time) { int r; - static int previous_fud_time; + long long int fud_end_time; + static long long int previous_fud_end_time; r = rtio_reset_read(); if(r) - previous_fud_time = 0; + previous_fud_end_time = 0; rtio_reset_write(0); rtio_chan_sel_write(RTIO_FUD_CHANNEL); if(fud_time < 0) { rtio_counter_update_write(1); - fud_time = rtio_counter_read() + 3000; + fud_time = rtio_counter_read() + 4000; } - if(fud_time < previous_fud_time) + fud_end_time = fud_time + 3*8; + if(fud_time < previous_fud_end_time) exception_raise(EID_RTIO_SEQUENCE_ERROR); + previous_fud_end_time = fud_end_time; rtio_o_timestamp_write(fud_time); rtio_o_value_write(1); rtio_o_we_write(1); - rtio_o_timestamp_write(fud_time+3*8); + rtio_o_timestamp_write(fud_end_time); rtio_o_value_write(0); rtio_o_we_write(1); if(rtio_o_error_read())