Closed zuckschwerdt closed 5 years ago
If it helps limesdr for example works with fixed sized usb transfers. Each call to writeStream fills the outgoing USB buffer until its full, then it starts writing to the next buffer. The only exception to this if the flag SOAPY_SDR_END_BURST is specified, the buffer is zero padded and flushed out -- if this call to writeStream() consumed all of the samples passed in.
I'll add SOAPY_SDR_END_BURST
, thanks!
I've now added SOAPY_SDR_END_BURST flag to control buffer flush on writeStream.
Oh, yes. That makes more sense. I'll have to test if SoapyRemote passes the flag on every call or only the last though. I.e. the app says e.g. "write 6k and SOAPY_SDR_END_BURST" then SoapyRemote will chunk that into pieces that always fit in the buffer. Native the 6k would result in 4k with numElems!=items and then 2k and END_BURST. I also should zero out the remaining buffer before flush, don't merge yet.
Yea, so the server for example clears HAS_TIME flags &= ~(SOAPY_SDR_HAS_TIME); //clear time for subsequent writes
in the write loop so its only set once on the first write, but other flags like END_BURST will show up again for subsequent calls. Other similar loops in this ecosystem do the same thing. Clear head flags like time, but keep tail flags like end burst.
Well thought out. I justed checked and SoapyRemote indeed only passes that flag on the last chunk as expected. Thanks for all the suggestions and help!
The iio channel always transfers a full buffer (4k), but SoapyRemote with a default MTU of 1500 will only supply 357 elements per call to
writeStream()
. This change incrementally fills the TX channels and writes the buffer to hardware (push in iio lingo) only when it's full. The channels are also flushed oncloseStream()
anddeactivateStream()
. Also removes the intermediate type conversion buffer (buffer
) which isn't needed as we useiio_channel_convert_inverse()
to copy element-wise anyway.Fixes the root cause for pothosware/SoapyRemote#56.