-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add TX Burst Functionality #5
Conversation
I would like to also add support for the functionality of the
That "UHDSoapy" file adapts a UHD API caller to use a Soapy device and is not the other way around. So the presence of that loop implies that the Soapy API can't be relied on to transmit the entire buffer in one call. The code that would be used to drive a USRP from this library is "SoapyUHD". As this is a convenience function, I think it would be reasonable to have a loop to ensure the entire buffer is written. |
|
src/device.rs
Outdated
); | ||
|
||
// configure the flags for burst mode | ||
self.flags = SOAPY_SDR_TX as i32 + SOAPY_SDR_HAS_TIME as i32 + SOAPY_SDR_END_BURST as i32; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These flags will be applied to any subsequent write
-- this should use a local variable.
My plan for this flags
field in the struct is that we could avoid adding a ton of arguments to write
by providing methods to set things like time that would apply to the next write
. Not sure if that's a good idea or if this field should be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't seen SOAPY_SDR_TX
used as a writeStream
parameter before. It's defined as zero, so it won't do anything, but I think it's intended for the Device
methods to determine whether you're configuring the TX or RX chain, not for writeStream
where it already knows the direction.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding SOAPY_SDR_TX, I chucked it on there for good measure not for any deeper reason :-).
I could add a type alias or something that indicates what they are to be used for.
Yeah the whole flag situation is rather untidy...
From what i can tell SoapyUHD resets the flags after each call to writeStream and readStream, so that would not be that much of a issue, but other wrappers might not do it that way...
The only place the flags are actually used to convey anything (at least in SoapyUHD) is readStreamStatus (exclusive to TX streams and looks rather costly), where they are used to retrieve Error codes from async metadata (i.e. burst late etc).
If this applies to all/most wrappers we might be fine just parsing them as additional error codes if they are something other than 0 after the call.
src/device.rs
Outdated
pub fn write_burst( | ||
&mut self, | ||
buffers: &[&[E]], | ||
at_ns: i64, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense for this to be Option<i64>
? It looks like HackRF supports burst, but not HAS_TIME, and users may want to quickly transmit a burst but not care about precise timing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good, I'll add that.
Summing up for now TODOs
Did I miss anything? |
Not sure what you mean by the error handling part. The error codes are in the return value, not the flags param. None of the flags are documented as being returned by a write, though some drivers clear flags under various conditions. Other than that, sounds good to me. Thanks!
I added some notes on the rest of the flags and RX bursts on a new issue #6. |
Updates and rebased onto the new master. Any thoughts? update: tested with x310 |
Looks good. I'll test with a LimeSDR and HackRF tomorrow to see how those assumptions hold. |
|
Merged, but I redesigned the API with #6 in mind to separate the flags from the loop behavior:
Your Thanks! |
Not what I had in mind but definitely cleaner, considering it could be used for things other than burst. |
This adds TxStream::write_burst as a convenience function.
I reckon this requires some discussion since it is just a wrapper for setting the stream flags on the TxStream object for burst transmission and then calling writeStream and not a function included in the Soapy API in itself.
This also assumes the blocking behaviour of SoapyUHD (line 722 onward) also applies to all other drivers/plugins.
Unfortunately I only have access to UHD devices and not enough time to go source diving in the other plugins right now to verify this.