summaryrefslogtreecommitdiff
path: root/gr-usrp2/src
diff options
context:
space:
mode:
Diffstat (limited to 'gr-usrp2/src')
-rwxr-xr-xgr-usrp2/src/qa_usrp2.py6
-rw-r--r--gr-usrp2/src/usrp2.i2
-rw-r--r--gr-usrp2/src/usrp2_sink_16sc.cc16
-rw-r--r--gr-usrp2/src/usrp2_sink_32fc.cc16
-rw-r--r--gr-usrp2/src/usrp2_sink_base.cc11
-rw-r--r--gr-usrp2/src/usrp2_sink_base.h8
6 files changed, 47 insertions, 12 deletions
diff --git a/gr-usrp2/src/qa_usrp2.py b/gr-usrp2/src/qa_usrp2.py
index bc6664a1b..cc994b1e9 100755
--- a/gr-usrp2/src/qa_usrp2.py
+++ b/gr-usrp2/src/qa_usrp2.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2005,2008 Free Software Foundation, Inc.
+# Copyright 2005,2008,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -23,7 +23,7 @@
from gnuradio import gr, gr_unittest
import usrp2
-class qa_usrp2(gr_unittest.TestCase):
+class test_usrp2(gr_unittest.TestCase):
def setUp(self):
self.tb = gr.top_block()
@@ -37,4 +37,4 @@ class qa_usrp2(gr_unittest.TestCase):
pass
if __name__ == '__main__':
- gr_unittest.main ()
+ gr_unittest.run(test_usrp2, "test_usrp2.xml")
diff --git a/gr-usrp2/src/usrp2.i b/gr-usrp2/src/usrp2.i
index d1fa091f7..2a79fad44 100644
--- a/gr-usrp2/src/usrp2.i
+++ b/gr-usrp2/src/usrp2.i
@@ -32,6 +32,7 @@
%include <usrp2/tune_result.h>
%include <usrp2/mimo_config.h>
+%include <usrp2/metadata.h>
%template(uint32_t_vector) std::vector<uint32_t>;
@@ -163,6 +164,7 @@ public:
bool write_gpio(uint16_t value, uint16_t mask);
%rename(_real_read_gpio) read_gpio;
bool read_gpio(uint16_t *value);
+ bool start_streaming_at(usrp2::fpga_timestamp time);
};
// ----------------------------------------------------------------
diff --git a/gr-usrp2/src/usrp2_sink_16sc.cc b/gr-usrp2/src/usrp2_sink_16sc.cc
index 1e7c54dcd..75cc1f4a6 100644
--- a/gr-usrp2/src/usrp2_sink_16sc.cc
+++ b/gr-usrp2/src/usrp2_sink_16sc.cc
@@ -67,12 +67,20 @@ usrp2_sink_16sc::work(int noutput_items,
return 0;
usrp2::tx_metadata metadata;
- metadata.timestamp = -1;
- metadata.send_now = 1;
+
+ // Set TX metadata to either start time or now
+ if (d_should_wait == true) {
+ metadata.timestamp = d_tx_time;
+ metadata.send_now = 0;
+ d_should_wait = false;
+ }
+ else {
+ metadata.timestamp = -1;
+ metadata.send_now = 1;
+ }
metadata.start_of_burst = 1;
- bool ok = d_u2->tx_16sc(0, // FIXME: someday, streams will have channel numbers
- in, noutput_items, &metadata);
+ bool ok = d_u2->tx_16sc(0, in, noutput_items, &metadata);
if (!ok){
std::cerr << "usrp2_sink_16sc: tx_16sc failed" << std::endl;
return -1; // say we're done
diff --git a/gr-usrp2/src/usrp2_sink_32fc.cc b/gr-usrp2/src/usrp2_sink_32fc.cc
index b1e28a829..fa75b3805 100644
--- a/gr-usrp2/src/usrp2_sink_32fc.cc
+++ b/gr-usrp2/src/usrp2_sink_32fc.cc
@@ -67,12 +67,20 @@ usrp2_sink_32fc::work(int noutput_items,
return 0;
usrp2::tx_metadata metadata;
- metadata.timestamp = -1;
- metadata.send_now = 1;
+
+ // Set TX metadata to either start time or now
+ if (d_should_wait == true) {
+ metadata.timestamp = d_tx_time;
+ metadata.send_now = 0;
+ d_should_wait = false;
+ }
+ else {
+ metadata.timestamp = -1;
+ metadata.send_now = 1;
+ }
metadata.start_of_burst = 1;
- bool ok = d_u2->tx_32fc(0, // FIXME: someday, streams will have channel numbers
- in, noutput_items, &metadata);
+ bool ok = d_u2->tx_32fc(0, in, noutput_items, &metadata);
if (!ok){
std::cerr << "usrp2_sink_32fc: tx_32fc failed" << std::endl;
return -1; // say we're done
diff --git a/gr-usrp2/src/usrp2_sink_base.cc b/gr-usrp2/src/usrp2_sink_base.cc
index ce473f236..c9b34a54a 100644
--- a/gr-usrp2/src/usrp2_sink_base.cc
+++ b/gr-usrp2/src/usrp2_sink_base.cc
@@ -36,7 +36,9 @@ usrp2_sink_base::usrp2_sink_base(const char *name,
: usrp2_base(name,
input_signature,
gr_make_io_signature(0, 0, 0),
- ifc, mac)
+ ifc, mac),
+ d_should_wait(false),
+ d_tx_time(0)
{
// NOP
}
@@ -155,3 +157,10 @@ bool usrp2_sink_base::read_gpio(uint16_t *value)
{
return d_u2->read_gpio(usrp2::GPIO_TX_BANK, value);
}
+
+bool usrp2_sink_base::start_streaming_at(usrp2::fpga_timestamp time)
+{
+ d_should_wait = true;
+ d_tx_time = time;
+ return true;
+}
diff --git a/gr-usrp2/src/usrp2_sink_base.h b/gr-usrp2/src/usrp2_sink_base.h
index 38dc4f236..d831d4df6 100644
--- a/gr-usrp2/src/usrp2_sink_base.h
+++ b/gr-usrp2/src/usrp2_sink_base.h
@@ -37,6 +37,9 @@ protected:
const std::string &mac)
throw (std::runtime_error);
+ bool d_should_wait;
+ usrp2::fpga_timestamp d_tx_time;
+
public:
~usrp2_sink_base();
@@ -139,6 +142,11 @@ public:
* \brief Read daughterboard GPIO pin values
*/
bool read_gpio(uint16_t *value);
+
+ /*!
+ * \brief First samples begin streaming to USRP2 at given time
+ */
+ bool start_streaming_at(usrp2::fpga_timestamp time);
};
#endif /* INCLUDED_USRP2_SINK_BASE_H */