summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnathan Corgan2011-08-13 15:17:10 -0700
committerJohnathan Corgan2011-08-13 15:17:10 -0700
commit1d24c91fcd2e0da6e14c3d45def0329c99a6c39f (patch)
treeda9be4c9e711809ae39674e5219bb7ce782907f3
parent6ae0e7c152e83e9156725984f9b0305a240427c9 (diff)
parent25b1550dba377b6dc86bee3e6f269a721efee655 (diff)
downloadgnuradio-1d24c91fcd2e0da6e14c3d45def0329c99a6c39f.tar.gz
gnuradio-1d24c91fcd2e0da6e14c3d45def0329c99a6c39f.tar.bz2
gnuradio-1d24c91fcd2e0da6e14c3d45def0329c99a6c39f.zip
Merge branch 'master' into next
-rw-r--r--gr-uhd/include/gr_uhd_usrp_source.h4
-rw-r--r--gr-uhd/lib/gr_uhd_usrp_source.cc22
2 files changed, 21 insertions, 5 deletions
diff --git a/gr-uhd/include/gr_uhd_usrp_source.h b/gr-uhd/include/gr_uhd_usrp_source.h
index 6e51a1423..ea45ef101 100644
--- a/gr-uhd/include/gr_uhd_usrp_source.h
+++ b/gr-uhd/include/gr_uhd_usrp_source.h
@@ -24,6 +24,7 @@
#include <gr_uhd_api.h>
#include <gr_sync_block.h>
+#include <gr_msg_queue.h>
#include <uhd/usrp/multi_usrp.hpp>
class uhd_usrp_source;
@@ -31,7 +32,8 @@ class uhd_usrp_source;
GR_UHD_API boost::shared_ptr<uhd_usrp_source> uhd_make_usrp_source(
const uhd::device_addr_t &device_addr,
const uhd::io_type_t &io_type,
- size_t num_channels
+ size_t num_channels,
+ gr_msg_queue_sptr async_queue = gr_msg_queue_sptr()
);
class GR_UHD_API uhd_usrp_source : virtual public gr_sync_block{
diff --git a/gr-uhd/lib/gr_uhd_usrp_source.cc b/gr-uhd/lib/gr_uhd_usrp_source.cc
index 669f890ea..2987d528c 100644
--- a/gr-uhd/lib/gr_uhd_usrp_source.cc
+++ b/gr-uhd/lib/gr_uhd_usrp_source.cc
@@ -33,7 +33,8 @@ public:
uhd_usrp_source_impl(
const uhd::device_addr_t &device_addr,
const uhd::io_type_t &io_type,
- size_t num_channels
+ size_t num_channels,
+ gr_msg_queue_sptr async_queue
):
gr_sync_block(
"gr uhd usrp source",
@@ -43,7 +44,8 @@ public:
_type(io_type),
_nchan(num_channels),
_stream_now(_nchan == 1),
- _tmp_buffs(_nchan)
+ _tmp_buffs(_nchan),
+ _async_queue(async_queue)
{
_dev = uhd::usrp::multi_usrp::make(device_addr);
}
@@ -222,6 +224,15 @@ public:
return num_samps;
}
+ // Scan queue and post async events
+ while (_dev->get_device()->recv_async_msg(_asyncdata, 0.0)) {
+ if (_async_queue) {
+ gr_message_sptr m = gr_make_message(0, 0.0, 0.0, sizeof(_asyncdata));
+ memcpy(m->msg(), &_asyncdata, sizeof(_asyncdata));
+ _async_queue->insert_tail(m);
+ }
+ }
+
return num_samps;
}
@@ -247,6 +258,8 @@ private:
bool _stream_now;
gr_vector_void_star _tmp_buffs;
uhd::rx_metadata_t _metadata;
+ uhd::async_metadata_t _asyncdata;
+ gr_msg_queue_sptr _async_queue;
};
@@ -256,9 +269,10 @@ private:
boost::shared_ptr<uhd_usrp_source> uhd_make_usrp_source(
const uhd::device_addr_t &device_addr,
const uhd::io_type_t &io_type,
- size_t num_channels
+ size_t num_channels,
+ gr_msg_queue_sptr async_queue
){
return boost::shared_ptr<uhd_usrp_source>(
- new uhd_usrp_source_impl(device_addr, io_type, num_channels)
+ new uhd_usrp_source_impl(device_addr, io_type, num_channels, async_queue)
);
}