aboutsummaryrefslogtreecommitdiffstats
path: root/lib/hackrf/hackrf_source_c.cc
AgeCommit message (Collapse)AuthorFilesLines
2020-12-18Fix hackrf receive hangs by checking before each lock waitv0.2.3Adrian Chadd1-2/+10
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>
2020-08-09HackRF: fix hackrf_source signednessv0.2.2Mike Walters1-1/+1
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>
2020-08-03HackRF: convert _lut to float[] to reduce size by a factor of 256Wim Lewis1-16/+9
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>
2020-08-02A lot of Boost functionality is available in C++11. Since GNU Radio is ↵Clayton Smith1-2/+2
moving away from Boost, it probably makes sense to do so in gr-osmosdr as well. 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>
2020-02-16hackrf: replace boost::assign with C++11Clayton Smith1-10/+1
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>
2020-02-16hackrf: allow transmit/receive switchingClayton Smith1-360/+45
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>
2017-02-27hackrf: correct gcc6 warningsDimitri Stolnikov1-10/+17
2016-01-10do not check for NULL before calling freeJiří Pinkava1-2/+1
2015-12-07hackrf: change hackrf i/o from default char to explicit int8_tDimitri Stolnikov1-4/+4
original patch provided via github by Dirk Grunwald
2015-12-07hackrf: since devicecount is signed, make comparisons signed as wellDimitri Stolnikov1-4/+4
2015-06-01hackrf: use #ifdef just like in hackrf_sink_cDimitri Stolnikov1-1/+1
2015-06-01hackrf: Add cmake magic to figure out if multiple devices support is ↵Heikki Hannikainen1-1/+3
available in libhackrf, so that backwards compatibility with old libhackrf is maintained. Signed-off-by: Heikki Hannikainen <hessu@hes.iki.fi>
2015-06-01hackrf_source: adjust error messageHeikki Hannikainen1-1/+1
Signed-off-by: Heikki Hannikainen <hessu@hes.iki.fi>
2015-06-01hackrf_source: Support selecting device with index number (hackrf=0)Heikki Hannikainen1-7/+28
Signed-off-by: Heikki Hannikainen <hessu@hes.iki.fi>
2015-06-01hackrf device enumeration: Use only 6 characters of serial (should be unique ↵Heikki Hannikainen1-5/+6
per user?) and append it in device name Signed-off-by: Heikki Hannikainen <hessu@hes.iki.fi>
2015-06-01hackrf_source: Truncate serial numbers to 16 chars when enumerating, parse ↵Heikki Hannikainen1-5/+8
USB board IDs correctly Signed-off-by: Heikki Hannikainen <hessu@hes.iki.fi>
2015-06-01hackrf_source: attempt device enumeration with hackrf_device_listHeikki Hannikainen1-15/+24
Signed-off-by: Heikki Hannikainen <hessu@hes.iki.fi>
2015-06-01style update to match surroundingsHeikki Hannikainen1-2/+2
Signed-off-by: Heikki Hannikainen <hessu@hes.iki.fi>
2015-06-01Require hackrf argument to have a non-zero-length value to trigger serial ↵Heikki Hannikainen1-1/+1
number search Signed-off-by: Heikki Hannikainen <hessu@hes.iki.fi>
2015-06-01hackrf: support for hackrf_open_by_serial in hackrf sourceHeikki Hannikainen1-1/+8
Signed-off-by: Heikki Hannikainen <hessu@hes.iki.fi>
2015-05-27hackrf: introduce bias=0|1 and bias_tx=0|1 parametersDimitri Stolnikov1-0/+18
... 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
2014-10-21hackrf: disable AMP gain stage by default to protect it from damageDimitri Stolnikov1-1/+1
patch proivided by Paul Connolly
2014-08-25hackrf: extend frequency range down to BW/2Dimitri Stolnikov1-1/+1
2014-08-14hackrf: extend frequency range down to 10MHzDimitri Stolnikov1-1/+1
2014-02-20hackrf: signed samples, following commit fd77cfe8a6Hoernchen1-4/+4
2014-02-11osmosdr/rtl/miri/hackrf: use 15 buffers by defaultDimitri Stolnikov1-1/+1
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.
2013-10-25hackrf: implement device discoveryDimitri Stolnikov1-5/+49
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.
2013-09-28hackrf: enable AMP gain stage by defaultDimitri Stolnikov1-1/+1
2013-09-28hackrf: don't set automatic bandwidth on samplerate changeDimitri Stolnikov1-4/+5
automatic bandwidth selection may be triggered by calling set_bandwidth(0) after changing the sample rate
2013-06-09hackrf: select narrower filters in auto bw mode to prevent aliasingDimitri Stolnikov1-2/+2
2013-06-09hackrf: use new sample rate function introduced in libhackrf b892bc34adDimitri Stolnikov1-5/+4
2013-06-07hackrf: add fractional sample rate support introduced in libhackrfDimitri Stolnikov1-2/+7
d9c46cbdac
2013-06-07hackrf: add human readable error prints for all libhackrf funcsDimitri Stolnikov1-23/+40
2013-06-05hackrf: set the default sample rate to 10MDimitri Stolnikov1-1/+2
this prevents a regression with early firmware who did not have 8M rate but 5M instead. they both had 10M, so we use this as default.
2013-06-03hackrf: change out-of-spec rate 5e6 to 8e6 defaultDimitri Stolnikov1-2/+2
2013-06-02hackrf: disable start/stop as it has caused lock-upsDimitri Stolnikov1-4/+13
2013-06-02hackrf: migrate to gain API introduced in libhackrf b5f275abc5Dimitri Stolnikov1-71/+9
2013-05-30introduce osmosdr namespace, remove _c suffixDimitri Stolnikov1-1/+1
- the namespace conversion adopts the common gnuradio coding guidelines - suffix removal is a preparation to support 8/16 bit complex data types
2013-05-29convert to gnuradio 3.7 interfaceDimitri Stolnikov1-7/+7
2013-05-26hackrf: enable buffers argument for the source blockDimitri Stolnikov1-3/+3
2013-05-08hackrf: update to libhackrf 6f0ae9bc99 APIDimitri Stolnikov1-12/+4
2013-05-02hackrf: replace non-portable usleep with boost sleepDimitri Stolnikov1-1/+3
2013-04-30source/sink: rename antennas to express their functionDimitri Stolnikov1-1/+1
2013-04-30source/sink: return freq_range_t in get_bandwidth_range()Dimitri Stolnikov1-3/+3
it was meta_range_t (which is binary compatible) before.
2013-04-28hackrf: updated source commentsDimitri Stolnikov1-1/+4
2013-04-26hackf: implement start & stop methodsDimitri Stolnikov1-7/+32
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.
2013-04-26hackrf: don't skip first samples when streamingDimitri Stolnikov1-8/+1
2013-04-26hackrf: make failures more verboseDimitri Stolnikov1-4/+4
2013-04-15hackrf: implement BB lowpass filter controlDimitri Stolnikov1-3/+5
To use the default (automatic) bandwidth filter selection, this should be set to 0.
2013-04-13hackrf: implement full control for RF/IF/BB gain stagesDimitri Stolnikov1-47/+101
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