Page 1 of 1

Flushing data in fifo

PostPosted:
by Guest
Hi,

I am dealing with the fifo where I need to flush the data. If I use the read function to empty the pipe, since I do not know how many bytes in the fifo, my program will stuck in read function and will never return.

I tried to open the device in non-blocking mode - but it not supported.
I tried to use poll and select but it's not detecting if there's a data in the fifo.

I looked at the fifo.c example in demoapps but the way it works is that it holds the information (different threads) on how many bytes are being sent/read/delete.

Is there any other way around that I can use to clear my data?.

Thanks,

John

Re: Flushing data in fifo

PostPosted:
by support
Hello,

The first question that comes to mind is why non-blocking mode isn't supported. You didn't mention which OS you're using. If it's Windows, it's indeed not supported.

However if you're using Linux, non-blocking read is supported for asynchronous streams. All streams except mem_8 in the demo bundle are asynchronous, so if you've running on your own custom IP core, make the relevant stream asynchronous (possibly by defining its use as data acquisition).

Non-blocking read doesn't make sense on a synchronous stream, because the whole point of a synchronous stream is that the data is fetched from its source only on demand.

The Xillybus host application programming guides in the documentation part of the website explain synchronous vs. asynchronous streams in section 2.

Regards,
Eli