diff options
author | Josh Blum | 2010-03-02 14:43:20 -0800 |
---|---|---|
committer | Josh Blum | 2010-03-02 14:43:20 -0800 |
commit | 6d71414a0a467dc37fc903b327be22f8d0ddeade (patch) | |
tree | d74618b160f138e4b022ea549896c54a00eef6c8 /gr-uhd/lib/uhd_simple_source.cc | |
parent | c85606eaaf5a73387d4423bdeb2f63483394137e (diff) | |
download | gnuradio-6d71414a0a467dc37fc903b327be22f8d0ddeade.tar.gz gnuradio-6d71414a0a467dc37fc903b327be22f8d0ddeade.tar.bz2 gnuradio-6d71414a0a467dc37fc903b327be22f8d0ddeade.zip |
Added the uhd simple sink lib block, swig wrapper, grc wrapper.
It seems to work, but still getting the kinks out of tx->usrp2
Diffstat (limited to 'gr-uhd/lib/uhd_simple_source.cc')
-rw-r--r-- | gr-uhd/lib/uhd_simple_source.cc | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/gr-uhd/lib/uhd_simple_source.cc b/gr-uhd/lib/uhd_simple_source.cc index 360b91434..f6a783ef9 100644 --- a/gr-uhd/lib/uhd_simple_source.cc +++ b/gr-uhd/lib/uhd_simple_source.cc @@ -27,19 +27,6 @@ #include "utils.h" /*********************************************************************** - * Helper Functions - **********************************************************************/ -static size_t get_size(const std::string &type){ - if(type == "32fc"){ - return sizeof(std::complex<float>); - } - if(type == "16sc"){ - return sizeof(std::complex<short>); - } - throw std::runtime_error("unknown type"); -} - -/*********************************************************************** * Make UHD Source **********************************************************************/ boost::shared_ptr<uhd_simple_source> uhd_make_simple_source( @@ -95,9 +82,9 @@ int uhd_simple_source::work( const size_t max_samples = wax::cast<size_t>((*_dev)[uhd::DEVICE_PROP_MAX_RX_SAMPLES]); size_t total_items_read = 0; - size_t count = 0; + size_t count = 50; uhd::metadata_t metadata; - while(total_items_read == 0 or total_items_read + max_samples < size_t(noutput_items)){ + while(total_items_read < size_t(noutput_items)){ size_t items_read = _dev->recv( boost::asio::buffer( (uint8_t *)output_items[0]+(total_items_read*_sizeof_samp), @@ -116,8 +103,8 @@ int uhd_simple_source::work( //the timeout part boost::this_thread::sleep(boost::posix_time::milliseconds(1)); - if (++count > 50) break; + if (--count == 0) break; } - + return total_items_read; } |