diff options
author | Jon Szymaniak <jon.szymaniak@gmail.com> | 2013-10-26 15:59:23 -0400 |
---|---|---|
committer | Dimitri Stolnikov <horiz0n@gmx.net> | 2013-10-30 18:59:54 +0100 |
commit | 44bd325a86352e5869017522e0a4990c5a22c4c3 (patch) | |
tree | 4cabecc3891e932b367b1da99646587529f847bc /lib/bladerf/bladerf_common.h | |
parent | 03c42ef3206f5667459f78781f95d7fc5c322053 (diff) |
bladerf: Moved initializations to bladerf_common.c, misc. cleanup
Common parameter handling has been moved into bladerf_common::init().
The buflen parameter is now in units of samples, not bytes. This
deviates from the other gr-osmosdr items. However, with the requirement
that buffers be in multiples of 1024 samples, this makes specifying this
parameter a bit easier. The user shouldn't need to know we're operating
on SC16Q12 values under the hood, and have to calculate accordingly.
To avoid confusion when both a bladeRF source and sink are in a flow
graph a [bladeRF source/sink] prefix has been added to output. Error
number have been replaced with bladeRF string representations of these
error values.
Firmware flashing has been removed. The bladeRF-cli or bladeRF-flash
tools are the preferred route for firmware upgrades.
Diffstat (limited to 'lib/bladerf/bladerf_common.h')
-rw-r--r-- | lib/bladerf/bladerf_common.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/bladerf/bladerf_common.h b/lib/bladerf/bladerf_common.h index 7eb7da5..41f5028 100644 --- a/lib/bladerf/bladerf_common.h +++ b/lib/bladerf/bladerf_common.h @@ -28,6 +28,9 @@ #include <boost/thread/mutex.hpp> #include <boost/thread/shared_mutex.hpp> #include <boost/thread/condition_variable.hpp> +#include <boost/assign.hpp> +#include <boost/format.hpp> +#include <boost/lexical_cast.hpp> #include <gnuradio/thread/thread.h> #include <gnuradio/gr_complex.h> @@ -35,6 +38,7 @@ #include <libbladeRF.h> #include "osmosdr/ranges.h" +#include "arg_helpers.h" /* We currently read/write 1024 samples (pairs of 16-bit signed ints) */ #define BLADERF_SAMPLE_BLOCK_SIZE (1024) @@ -48,7 +52,8 @@ public: virtual ~bladerf_common(); protected: - bladerf_sptr open(const std::string &device_name); + /* Handle initialized and parameters common to both source & sink */ + void init(dict_t &dict, const char *type); osmosdr::freq_range_t freq_range(); osmosdr::meta_range_t sample_rates(); @@ -65,13 +70,19 @@ protected: struct bladerf_stream *_stream; size_t _num_buffers; size_t _buf_index; + size_t _samples_per_buffer; + size_t _num_transfers; gr::thread::thread _thread; osmosdr::gain_range_t _vga1_range; osmosdr::gain_range_t _vga2_range; + std::string _pfx; + private: + bladerf_sptr open(const std::string &device_name); + bool _is_running; boost::shared_mutex _state_lock; |