Fix receive path hangs if another thread closes down the hackrf
receive whilst this buffer receive function is waiting to be
woken up.
Now:
* Sleep for up to 100ms each time waiting for the cond to be kicked;
* Check whether streaming is still enabled each time rather than
only when the function is entered.
This fixes hangs where consumers like gqrx via gnuradio
will do a stop_rx/start_rx very quickly to change something, and
the buffer receive path is waiting for a buffer.
Signed-off-by: Eric Wild <ewild@sysmocom.de>
The LUT changes in 2e7d343fed inadvertently started interpreting samples
as unsigned. This change puts it back to signed (and fixes an outdated
comment).
Signed-off-by: Eric Wild <ewild@sysmocom.de>
Similar to commit 33a8d1c for RTL-SDR, this uses two lookups in a
256-element LUT instead of one lookup in a 65536-element LUT, which
saves a bit of CPU cache. It also eliminates a dependency on the
host's byte ordering.
Signed-off-by: Eric Wild <ewild@sysmocom.de>
This change removes all usage of boost::mutex,
boost::mutex::scoped_lock, boost::unique_lock, and
boost::condition_variable. It also removes usage of boost::shared_ptr
and boost::weak_ptr outside of block definitions (which must continue to
use Boost until GNU Radio 3.9).
Signed-off-by: Eric Wild <ewild@sysmocom.de>
Since GNU Radio is gradually replacing Boost with C++11, it seemed worth
doing that for the HackRF blocks I was working on. This change removes
all usage of boost::assign.
From: Clayton Smith <argilo@gmail.com>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
To allow switching between transmit and receive mode within a single
flow graph, I've followed the model used by the BladeRF: I factored
common code into hackrf_common.cc and hackrf_common.h, and created a
"_devs" map there to keep track of which devices have been previously
opened. Shared pointers are used to track how many source & sink blocks
are using a particular device.
Because some properties (center frequency, sample rate, bandwidth, RF
amplifier state, bias tee) are shared between receive and transmit, the
blocks defer setting these until receiving or transmitting is started.
That way a source and sink can safely use different values for these
properties, and the correct values are set during T/R switching.
Because the HackRF driver and/or hardware does not seem to fully
transmit all samples sent to it, the code adds some silence to the end
of transmissions to ensure all samples are transmitted.
I've also replaced boost with C++11 code where possible.
From: Clayton Smith <argilo@gmail.com>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
... to support antenna/phantom power via a new device argument "bias"
(to match Airspy's existing bias power syntax). 0=disable and 1=enable.
I also added a device argument to control bias power at transmit time. I
named this option differently - "bias_tx" - to avoid accidentally
enabling bias power in transmit mode when an LNA may be attached in an
input amplifier configuration.
Original patch provided by Brad Hein
folowing rtl-sdr commit 89f73b183f2dac9c0dd75beca4cf2f77f20c4a36
So far we had 32 * 256KB which was a bit overkill, 15 are more than
enough.
15 was chosen instead of 16 because at least on Linux there seems to be
a system-wide limit of 63 transfers (when they are 256KB large), so 4
dongles can be used on a single machine without lowering the default
transfer number.
Unfortunately libhackrf still doesn't offer a way to enumerate devices
*or* to open a specific device by index or it's serial number. Thus we
have implemented a rather hack-ish way to detect the presence of a
device by trying to open it and closing right after that.
This allows a block to enable an associated driver to begin
transfering data just before we start to execute the scheduler.
The end result is that this reduces latency in the pipeline
when dealing with audio devices, usrps, etc.
the following named gain stages are available:
RF: MGA-81563, switchable 0 or 14dB
IF: MAX2837 LNA, 0 to 40dB in 8dB steps
BB: MAX2837 VGA, 0 to 62dB in 2dB steps