-
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.
Merge pull request #22 from JuliaTelecom/sjk/readbuf1
Large buffers
- Loading branch information
Showing
3 changed files
with
180 additions
and
74 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
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