-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rework StreamBuffer and make it the core transaction primitive
This reworks StreamBuffer, and makes it the core primitive for transacting via read and write. It is now aware of the Device MTU, and will align to the MTU. It also reworks the time stamps to align to each transaction, supporting multiple time stamps per buffer for latency analysis. We also allow the full vector type to be a Parameter, to support other array types.
- Loading branch information
Showing
2 changed files
with
130 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using SoapySDR, SoapyRTLSDR_jll | ||
|
||
# Here we want to test the behavior in a loop, to ensure | ||
# that we can block on buffer overflow conditions, and | ||
# handle partial reads, measure latnecy, etc | ||
|
||
function rapid_read() | ||
dev = Devices()[1] | ||
rx_chan = dev.rx | ||
rx_stream = SoapySDR.Stream(rx_chan) | ||
@show SoapySDR.mtu(rx_stream) | ||
SoapySDR.activate!(rx_stream) | ||
bufs = [SoapySDR.SampleBuffer(rx_stream, 10^6) for i = 1:2] | ||
@show bufs[1].packet_count | ||
@show bufs[2].packet_count | ||
flip = true | ||
while true | ||
# double buffer | ||
flip = !flip | ||
current_buff = bufs[Int(flip)+1] | ||
prev_buff = bufs[Int(!flip)+1] | ||
@assert length(current_buff.bufs[1])%rx_stream.mtu == 0 | ||
|
||
read!(rx_stream, current_buff) | ||
|
||
# sanity checks? | ||
#nequal = 0 | ||
#for i in eachindex(current_buff.bufs) | ||
# nequal += Int(current_buff.bufs[1][i] == prev_buff.bufs[1][i]) | ||
#end | ||
#@show current_buff.timens | ||
#@show nequal, current_buff.timens, delta_t | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters