AnsweredAssumed Answered

Nonblocking iio_refill

Question asked by Sinill57 on Jun 15, 2017
Latest reply on Jun 27, 2017 by larsc



I have a few questions regarding the nonblocking usage of iio_buffer_refill function.

I know that in fmcomms2 reference design the ad9361 core constantly creates new samples that are passed to the DMA core. But this core stores them only if it first received a sot signal from PS.


I want to push a buffer to dac DMA and receive it from adc DMA with ad9361 in loopback mode. If I first call the iio_buffer_push and then iio_buffer_refill, then I lose some samples from the beginning of the transmitted buffer. If I call the functions in reverse order in blocking mode, I receive an empty buffer, because the transfer will start only after I receive the whole buffer.


This way, I came to understanding that I first should call iio_buffer_refill in non-blocking mode, and then call iio_buffer_push with the receive buffer made large enough to compensate for all the delays. Is this approach right?
If there were no transfers before, iio_buffer_refill function will return -EAGAIN, but will the receive process start? Also, how can I find out whether the buffer acquisition has finished? If I again call the iio_buffer_refill and it again returns -EAGAIN, will a new receive process be queued?


Best regards,