From a607397ab52b1ae9ae82d9e4460fc6325987344c Mon Sep 17 00:00:00 2001 From: hadeshyp Date: Tue, 14 Jul 2009 13:30:10 +0000 Subject: [PATCH] *** empty log message *** --- libtrbnet/trbnet.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/libtrbnet/trbnet.c b/libtrbnet/trbnet.c index 8247c3f..5c02b31 100644 --- a/libtrbnet/trbnet.c +++ b/libtrbnet/trbnet.c @@ -352,7 +352,7 @@ static int trb_fifo_read(uint8_t channel, unsigned int dataCtr = 0; int packageCtr = -1; unsigned int endPointCtr = 0; - + unsigned int timeout = 0; /* Determin FIFO-Address */ @@ -379,8 +379,8 @@ static int trb_fifo_read(uint8_t channel, } if (timeout >= MAX_TIME_OUT) { - trb_errno = TRB_FIFO_TIMEOUT; trb_fifo_flush(channel); + trb_errno = TRB_FIFO_TIMEOUT; return -1; } @@ -714,22 +714,26 @@ static int trb_fifo_read(uint8_t channel, } /* Read Next Word */ + if (headerType == HEADER_TRM) { + break; + } if (trb_dma == 1) { tmp++; } else { - timeout = 0; - do { - read32_from_FPGA(fifoBuffer, tmp); - } while (((*tmp & MASK_FIFO_VALID) == 0) && (++timeout < MAX_TIME_OUT)); + timeout = 0; + do { + read32_from_FPGA(fifoBuffer, tmp); + } while (((*tmp & MASK_FIFO_VALID) == 0) && (++timeout < MAX_TIME_OUT)); + if (timeout >= MAX_TIME_OUT) { - trb_errno = TRB_FIFO_TIMEOUT; - trb_fifo_flush(channel); - return -1; - } + trb_fifo_flush(channel); + trb_errno = TRB_FIFO_TIMEOUT; + fprintf(stderr,"timeout\n"); + return -1; + } } } - - + /* Copy StatusBits and Sequenze of TerminationPackage */ trb_term.status_common = package.F2; trb_term.status_channel = package.F1; -- 2.43.0