summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Blum2010-05-18 12:25:42 -0700
committerJosh Blum2010-05-18 12:25:42 -0700
commit2c4bb0b5ea22ed73f3de6cac8a27083d950879bb (patch)
tree89b31979d1dda7392338f7d368758fbfbd0d6681
parent935b9713694359862fd5721a2cf070ac072ce283 (diff)
downloadgnuradio-2c4bb0b5ea22ed73f3de6cac8a27083d950879bb.tar.gz
gnuradio-2c4bb0b5ea22ed73f3de6cac8a27083d950879bb.tar.bz2
gnuradio-2c4bb0b5ea22ed73f3de6cac8a27083d950879bb.zip
using the send and recv full buffer modes, avoids extra loop in implementation
-rw-r--r--gr-uhd/lib/uhd_simple_sink.cc25
-rw-r--r--gr-uhd/lib/uhd_simple_source.cc31
2 files changed, 17 insertions, 39 deletions
diff --git a/gr-uhd/lib/uhd_simple_sink.cc b/gr-uhd/lib/uhd_simple_sink.cc
index 889371e91..ccec0e29c 100644
--- a/gr-uhd/lib/uhd_simple_sink.cc
+++ b/gr-uhd/lib/uhd_simple_sink.cc
@@ -91,6 +91,10 @@ public:
return _dev->get_tx_antennas();
}
+ uhd::usrp::simple_usrp::sptr get_device(void){
+ return _dev;
+ }
+
/***********************************************************************
* Work
**********************************************************************/
@@ -99,26 +103,13 @@ public:
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items
){
- size_t total_items_sent = 0;
uhd::tx_metadata_t metadata;
metadata.start_of_burst = true;
- //call until the input items are all sent
- while(total_items_sent < size_t(noutput_items)){
- size_t items_sent = _dev->get_device()->send(
- boost::asio::buffer(
- (uint8_t *)input_items[0]+(total_items_sent*_type.size),
- (noutput_items-total_items_sent)*_type.size
- ), metadata, _type
- );
- total_items_sent += items_sent;
- }
-
- return noutput_items;
- }
-
- uhd::usrp::simple_usrp::sptr get_device(void){
- return _dev;
+ return _dev->get_device()->send(
+ boost::asio::buffer(input_items[0], noutput_items*_type.size),
+ metadata, _type, uhd::device::SEND_MODE_FULL_BUFF
+ );
}
protected:
diff --git a/gr-uhd/lib/uhd_simple_source.cc b/gr-uhd/lib/uhd_simple_source.cc
index 8c3fdeef8..76179c326 100644
--- a/gr-uhd/lib/uhd_simple_source.cc
+++ b/gr-uhd/lib/uhd_simple_source.cc
@@ -92,6 +92,10 @@ public:
return _dev->get_rx_antennas();
}
+ uhd::usrp::simple_usrp::sptr get_device(void){
+ return _dev;
+ }
+
/***********************************************************************
* Work
**********************************************************************/
@@ -104,29 +108,12 @@ public:
//this prevents streaming before the runtime is ready
if (not _is_streaming) set_streaming(true);
- size_t total_items_read = 0;
- uhd::rx_metadata_t metadata;
-
- //call until the output items are all filled
- //or an exit condition below is encountered
- while(total_items_read < size_t(noutput_items)){
- size_t items_read = _dev->get_device()->recv(
- boost::asio::buffer(
- (uint8_t *)output_items[0]+(total_items_read*_type.size),
- (noutput_items-total_items_read)*_type.size
- ), metadata, _type
- );
- total_items_read += items_read;
-
- //we timed out, get out of here
- if (items_read == 0) break;
- }
-
- return total_items_read;
- }
+ uhd::rx_metadata_t metadata; //not passed out of this block
- uhd::usrp::simple_usrp::sptr get_device(void){
- return _dev;
+ return _dev->get_device()->recv(
+ boost::asio::buffer(output_items[0], noutput_items*_type.size),
+ metadata, _type, uhd::device::RECV_MODE_FULL_BUFF
+ );
}
private: