diff options
author | Brian Padalino <bpadalino@gmail.com> | 2014-02-16 17:42:32 -0500 |
---|---|---|
committer | Dimitri Stolnikov <horiz0n@gmx.net> | 2014-03-10 15:34:19 +0100 |
commit | 4e0a2c28e3399ad7a67b7a4baff5f59f4d633fca (patch) | |
tree | ee35fef472342ac1900b4841b1f5ab921fb46d5a /lib/bladerf/bladerf_common.h | |
parent | 1adf936c9422ec75f29d9f76f091138c557a970e (diff) |
bladerf: Updated source/sink to use libbladeRF's sync interface
Diffstat (limited to 'lib/bladerf/bladerf_common.h')
-rw-r--r-- | lib/bladerf/bladerf_common.h | 33 |
1 files changed, 12 insertions, 21 deletions
diff --git a/lib/bladerf/bladerf_common.h b/lib/bladerf/bladerf_common.h index 21aa587..b13a6cf 100644 --- a/lib/bladerf/bladerf_common.h +++ b/lib/bladerf/bladerf_common.h @@ -40,9 +40,6 @@ #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) - typedef boost::shared_ptr<struct bladerf> bladerf_sptr; class bladerf_common @@ -53,7 +50,10 @@ public: protected: /* Handle initialized and parameters common to both source & sink */ - void init(dict_t &dict, const char *type); + void init(dict_t &dict, bladerf_module module); + + bool start(bladerf_module module); + bool stop(bladerf_module module); double set_sample_rate(bladerf_module module, double rate); double get_sample_rate(bladerf_module module); @@ -67,45 +67,36 @@ protected: static std::vector< std::string > devices(); - bool is_running(); - void set_running(bool is_running); - bladerf_sptr _dev; - void **_buffers; - struct bladerf_stream *_stream; size_t _num_buffers; - size_t _buf_index; size_t _samples_per_buffer; size_t _num_transfers; + unsigned int _stream_timeout_ms; - gr::thread::thread _thread; + int16_t *_conv_buf; + int _conv_buf_size; /* In units of samples */ osmosdr::gain_range_t _vga1_range; osmosdr::gain_range_t _vga2_range; std::string _pfx; -/* - * BladeRF IQ correction parameters - */ + /* BladeRF IQ correction parameters */ static const int16_t DCOFF_SCALE = 2048; static const int16_t GAIN_SCALE = 4096; static const int16_t PHASE_SCALE = 4096; private: - void set_verbosity(const std::string &verbosity); - void set_loopback_mode(const std::string &loopback); bladerf_sptr open(const std::string &device_name); + static void close(void *dev); /* called by shared_ptr */ + static bladerf_sptr get_cached_device(struct bladerf_devinfo devinfo); - bool _is_running; - boost::shared_mutex _state_lock; + void set_verbosity(const std::string &verbosity); + void set_loopback_mode(const std::string &loopback); static boost::mutex _devs_mutex; static std::list<boost::weak_ptr<struct bladerf> > _devs; - - static bladerf_sptr get_cached_device(struct bladerf_devinfo devinfo); - static void close(void *dev); /* called by shared_ptr */ }; #endif |