AnsweredAssumed Answered

ad9361-iiostream streaming question

Question asked by HStoner on May 28, 2015
Latest reply on May 29, 2015 by HStoner

I have the example program ad9361-iiostream running on a ZedBoard+FMComms3 device.


I've also modified the code to do a simple memcpy of the rxbuf received data into the txbuf output data.  This appears to be working.
My question is, if I simply want to stream the input to the output (possibly at a different output frequency), can I simply take the rxbuf filled by the iio_buffer_refill(rxbuf) call, and pass this same buffer to the iio_buffer_push() function, with:

      // Refill RX buffer

      nbytes_rx = iio_buffer_refill(rxbuf);

      if (nbytes_rx < 0) { fprintf(stderr,"Error refilling buf %d\n",(int) nbytes_rx); shutdown(0); }


      // Schedule TX buffer

      nbytes_tx = iio_buffer_push(rxbuf);

      if (nbytes_tx < 0) { fprintf(stderr,"Error pushing buf %d\n", (int) nbytes_tx); shutdown(0); }



I believe there is an 'is_output' flag inside the struct iio_buffer, which might have to be set to 'true' before the input buffer could be used as an output buffer?  (although I don't see any interface function that allows this is_output flag to be changed after it's created).


Is there some additional reason why this can't be done?   Hopefully this will help me to better understand how this buffering is working.