diff options
Diffstat (limited to 'gr-uhd')
18 files changed, 79 insertions, 71 deletions
diff --git a/gr-uhd/CMakeLists.txt b/gr-uhd/CMakeLists.txt index 41926a446c..a83bcce600 100644 --- a/gr-uhd/CMakeLists.txt +++ b/gr-uhd/CMakeLists.txt @@ -92,7 +92,7 @@ CPACK_COMPONENT("uhd_swig" ######################################################################## # Add subdirectories ######################################################################## -add_subdirectory(include/uhd) +add_subdirectory(include/gnuradio/uhd) add_subdirectory(lib) add_subdirectory(doc) add_subdirectory(examples/c++) diff --git a/gr-uhd/examples/c++/tag_sink_demo.h b/gr-uhd/examples/c++/tag_sink_demo.h index 676005e06c..e96cd9ec3c 100644 --- a/gr-uhd/examples/c++/tag_sink_demo.h +++ b/gr-uhd/examples/c++/tag_sink_demo.h @@ -19,21 +19,22 @@ * Boston, MA 02110-1301, USA. */ -#include <gr_sync_block.h> -#include <gr_io_signature.h> +#include <gnuradio/sync_block.h> +#include <gnuradio/io_signature.h> #include <boost/foreach.hpp> #include <boost/format.hpp> #include <iostream> #include <complex> -class tag_sink_demo : public gr_sync_block{ +class tag_sink_demo : public gr::sync_block +{ public: tag_sink_demo(void): - gr_sync_block( + sync_block( "uhd tag sink demo", - gr_make_io_signature(1, 1, sizeof(std::complex<float>)), - gr_make_io_signature(0, 0, 0) + gr::io_signature::make(1, 1, sizeof(std::complex<float>)), + gr::io_signature::make(0, 0, 0) ) { //NOP @@ -46,11 +47,11 @@ public: ){ //grab all "rx time" tags in this work call const uint64_t samp0_count = this->nitems_read(0); - std::vector<gr_tag_t> rx_time_tags; + std::vector<gr::tag_t> rx_time_tags; get_tags_in_range(rx_time_tags, 0, samp0_count, samp0_count + ninput_items, pmt::string_to_symbol("rx_time")); //print all tags - BOOST_FOREACH(const gr_tag_t &rx_time_tag, rx_time_tags){ + BOOST_FOREACH(const gr::tag_t &rx_time_tag, rx_time_tags){ const uint64_t offset = rx_time_tag.offset; const pmt::pmt_t &value = rx_time_tag.value; diff --git a/gr-uhd/examples/c++/tag_source_demo.h b/gr-uhd/examples/c++/tag_source_demo.h index 6efe4667e5..71fb94482a 100644 --- a/gr-uhd/examples/c++/tag_source_demo.h +++ b/gr-uhd/examples/c++/tag_source_demo.h @@ -19,14 +19,15 @@ * Boston, MA 02110-1301, USA. */ -#include <gr_sync_block.h> -#include <gr_io_signature.h> +#include <gnuradio/sync_block.h> +#include <gnuradio/io_signature.h> #include <boost/foreach.hpp> #include <boost/format.hpp> #include <iostream> #include <complex> -class tag_source_demo : public gr_sync_block{ +class tag_source_demo : public gr::sync_block +{ public: tag_source_demo( @@ -36,10 +37,10 @@ public: const double idle_duration, const double burst_duration ): - gr_sync_block( + sync_block( "uhd tag source demo", - gr_make_io_signature(0, 0, 0), - gr_make_io_signature(1, 1, sizeof(std::complex<float>)) + gr::io_signature::make(0, 0, 0), + gr::io_signature::make(1, 1, sizeof(std::complex<float>)) ), _time_secs(start_secs), _time_fracs(start_fracs), @@ -52,7 +53,8 @@ public: //NOP } - void make_time_tag(const uint64_t tag_count){; + void make_time_tag(const uint64_t tag_count) + { const pmt::pmt_t key = pmt::string_to_symbol("tx_time"); const pmt::pmt_t value = pmt::make_tuple( pmt::from_uint64(_time_secs), @@ -62,14 +64,16 @@ public: this->add_item_tag(0/*chan0*/, tag_count, key, value, srcid); } - void make_sob_tag(const uint64_t tag_count){ + void make_sob_tag(const uint64_t tag_count) + { const pmt::pmt_t key = pmt::string_to_symbol("tx_sob"); const pmt::pmt_t value = pmt::PMT_T; const pmt::pmt_t srcid = pmt::string_to_symbol(this->name()); this->add_item_tag(0/*chan0*/, tag_count, key, value, srcid); } - void make_eob_tag(const uint64_t tag_count){; + void make_eob_tag(const uint64_t tag_count) + { const pmt::pmt_t key = pmt::string_to_symbol("tx_eob"); const pmt::pmt_t value = pmt::PMT_T; const pmt::pmt_t srcid = pmt::string_to_symbol(this->name()); @@ -79,8 +83,8 @@ public: int work( int noutput_items, gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items - ){ + gr_vector_void_star &output_items) + { //load the output with a constant std::complex<float> *output = reinterpret_cast<std::complex<float> *>(output_items[0]); for (size_t i = 0; i < size_t(noutput_items); i++){ diff --git a/gr-uhd/examples/c++/tags_demo.cc b/gr-uhd/examples/c++/tags_demo.cc index 890cc12dea..0f87109109 100644 --- a/gr-uhd/examples/c++/tags_demo.cc +++ b/gr-uhd/examples/c++/tags_demo.cc @@ -19,9 +19,9 @@ * Boston, MA 02110-1301, USA. */ -#include <gr_top_block.h> -#include <uhd/usrp_source.h> -#include <uhd/usrp_sink.h> +#include <gnuradio/top_block.h> +#include <gnuradio/uhd/usrp_source.h> +#include <gnuradio/uhd/usrp_sink.h> #include <tag_source_demo.h> #include <tag_sink_demo.h> #include <boost/make_shared.hpp> @@ -74,7 +74,7 @@ int main(int argc, char *argv[]){ //------------------------------------------------------------------ //-- make a top block //------------------------------------------------------------------ - gr_top_block_sptr tb = gr_make_top_block("tags_demo"); + gr::top_block_sptr tb = gr::make_top_block("tags_demo"); //------------------------------------------------------------------ //-- make the usrp source test blocks diff --git a/gr-uhd/include/uhd/CMakeLists.txt b/gr-uhd/include/gnuradio/uhd/CMakeLists.txt index 71c17b89cd..71c17b89cd 100644 --- a/gr-uhd/include/uhd/CMakeLists.txt +++ b/gr-uhd/include/gnuradio/uhd/CMakeLists.txt diff --git a/gr-uhd/include/uhd/amsg_source.h b/gr-uhd/include/gnuradio/uhd/amsg_source.h index 819f6edad2..4ef7027f13 100644 --- a/gr-uhd/include/uhd/amsg_source.h +++ b/gr-uhd/include/gnuradio/uhd/amsg_source.h @@ -23,9 +23,9 @@ #ifndef INCLUDED_GR_UHD_AMSG_SOURCE_H #define INCLUDED_GR_UHD_AMSG_SOURCE_H -#include <uhd/api.h> #include <uhd/usrp/multi_usrp.hpp> -#include <gr_msg_queue.h> +#include <gnuradio/uhd/api.h> +#include <gnuradio/msg_queue.h> namespace gr { namespace uhd { @@ -43,14 +43,14 @@ namespace gr { * \ingroup uhd_blk */ static sptr make(const ::uhd::device_addr_t &device_addr, - gr_msg_queue_sptr msgq); + msg_queue::sptr msgq); /*! * Convert a raw asynchronous message to an asynchronous metatdata object. * \return The asynchronous metadata object. */ static ::uhd::async_metadata_t - msg_to_async_metadata_t(const gr_message_sptr msg); + msg_to_async_metadata_t(const message::sptr msg); }; } /* namespace uhd */ diff --git a/gr-uhd/include/uhd/api.h b/gr-uhd/include/gnuradio/uhd/api.h index 106acd8c76..106acd8c76 100644 --- a/gr-uhd/include/uhd/api.h +++ b/gr-uhd/include/gnuradio/uhd/api.h diff --git a/gr-uhd/include/uhd/usrp_sink.h b/gr-uhd/include/gnuradio/uhd/usrp_sink.h index 242bc0bde6..6d21bbccdd 100644 --- a/gr-uhd/include/uhd/usrp_sink.h +++ b/gr-uhd/include/gnuradio/uhd/usrp_sink.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_UHD_USRP_SINK_H #define INCLUDED_GR_UHD_USRP_SINK_H -#include <uhd/api.h> -#include <gr_sync_block.h> +#include <gnuradio/uhd/api.h> +#include <gnuradio/sync_block.h> #include <uhd/usrp/multi_usrp.hpp> #ifndef INCLUDED_UHD_STREAM_HPP @@ -53,7 +53,7 @@ namespace gr { class uhd_usrp_sink; - class GR_UHD_API usrp_sink : virtual public gr_sync_block + class GR_UHD_API usrp_sink : virtual public sync_block { public: // gr::uhd::usrp_sink::sptr diff --git a/gr-uhd/include/uhd/usrp_source.h b/gr-uhd/include/gnuradio/uhd/usrp_source.h index 7eb0b3111d..f330ee0901 100644 --- a/gr-uhd/include/uhd/usrp_source.h +++ b/gr-uhd/include/gnuradio/uhd/usrp_source.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_GR_UHD_USRP_SOURCE_H #define INCLUDED_GR_UHD_USRP_SOURCE_H -#include <uhd/api.h> -#include <gr_sync_block.h> +#include <gnuradio/uhd/api.h> +#include <gnuradio/sync_block.h> #include <uhd/usrp/multi_usrp.hpp> #ifndef INCLUDED_UHD_STREAM_HPP @@ -53,7 +53,7 @@ namespace gr { class uhd_usrp_source; - class GR_UHD_API usrp_source : virtual public gr_sync_block + class GR_UHD_API usrp_source : virtual public sync_block { public: // gr::uhd::usrp_source::sptr diff --git a/gr-uhd/lib/amsg_source_impl.cc b/gr-uhd/lib/amsg_source_impl.cc index cf344db202..deaff232d1 100644 --- a/gr-uhd/lib/amsg_source_impl.cc +++ b/gr-uhd/lib/amsg_source_impl.cc @@ -29,7 +29,7 @@ namespace gr { amsg_source::sptr amsg_source::make(const ::uhd::device_addr_t &device_addr, - gr_msg_queue_sptr msgq) + msg_queue::sptr msgq) { check_abi(); return amsg_source::sptr @@ -37,13 +37,13 @@ namespace gr { } ::uhd::async_metadata_t - amsg_source::msg_to_async_metadata_t(const gr_message_sptr msg) + amsg_source::msg_to_async_metadata_t(const message::sptr msg) { return *(::uhd::async_metadata_t *)msg->msg(); } amsg_source_impl::amsg_source_impl(const ::uhd::device_addr_t &device_addr, - gr_msg_queue_sptr msgq) + msg_queue::sptr msgq) : _msgq(msgq), _running(true) { _dev = ::uhd::usrp::multi_usrp::make(device_addr); @@ -60,11 +60,11 @@ namespace gr { void amsg_source_impl::recv_loop() { - gr_message_sptr msg; + message::sptr msg; ::uhd::async_metadata_t *md; while(_running) { - msg = gr_make_message(0, 0.0, 0.0, sizeof(::uhd::async_metadata_t)); + msg = message::make(0, 0.0, 0.0, sizeof(::uhd::async_metadata_t)); md = (::uhd::async_metadata_t*) msg->msg(); while(!_dev->get_device()->recv_async_msg(*md, 0.1)) { @@ -77,7 +77,7 @@ namespace gr { } void - amsg_source_impl::post(gr_message_sptr msg) + amsg_source_impl::post(message::sptr msg) { _msgq->insert_tail(msg); } diff --git a/gr-uhd/lib/amsg_source_impl.h b/gr-uhd/lib/amsg_source_impl.h index f0f3d4bfb1..5bba3627f7 100644 --- a/gr-uhd/lib/amsg_source_impl.h +++ b/gr-uhd/lib/amsg_source_impl.h @@ -20,8 +20,8 @@ * Boston, MA 02110-1301, USA. */ -#include <uhd/amsg_source.h> -#include <thread/thread.h> +#include <gnuradio/uhd/amsg_source.h> +#include <gnuradio/thread/thread.h> namespace gr { namespace uhd { @@ -30,16 +30,16 @@ namespace gr { { public: amsg_source_impl(const ::uhd::device_addr_t &device_addr, - gr_msg_queue_sptr msgq); + msg_queue::sptr msgq); ~amsg_source_impl(); void recv_loop(); - void post(gr_message_sptr msg); + void post(message::sptr msg); protected: ::uhd::usrp::multi_usrp::sptr _dev; gr::thread::thread _amsg_thread; - gr_msg_queue_sptr _msgq; + msg_queue::sptr _msgq; bool _running; }; diff --git a/gr-uhd/lib/usrp_sink_impl.cc b/gr-uhd/lib/usrp_sink_impl.cc index 8a315a2e40..d38ffc344d 100644 --- a/gr-uhd/lib/usrp_sink_impl.cc +++ b/gr-uhd/lib/usrp_sink_impl.cc @@ -22,7 +22,7 @@ #include "usrp_sink_impl.h" #include "gr_uhd_common.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <boost/make_shared.hpp> #include <stdexcept> @@ -60,9 +60,9 @@ namespace gr { usrp_sink_impl::usrp_sink_impl(const ::uhd::device_addr_t &device_addr, const ::uhd::stream_args_t &stream_args) - : gr_sync_block("gr uhd usrp sink", + : sync_block("gr uhd usrp sink", args_to_io_sig(stream_args), - gr_make_io_signature(0, 0, 0)), + io_signature::make(0, 0, 0)), _stream_args(stream_args), _nchan(std::max<size_t>(1, stream_args.channels.size())), _stream_now(_nchan == 1), @@ -473,10 +473,10 @@ namespace gr { usrp_sink_impl::tag_work(int &ninput_items) { //the for loop below assumes tags sorted by count low -> high - std::sort(_tags.begin(), _tags.end(), gr_tag_t::offset_compare); + std::sort(_tags.begin(), _tags.end(), tag_t::offset_compare); //extract absolute sample counts - const gr_tag_t &tag0 = _tags.front(); + const tag_t &tag0 = _tags.front(); const uint64_t tag0_count = tag0.offset; const uint64_t samp0_count = this->nitems_read(0); @@ -491,7 +491,7 @@ namespace gr { _metadata.has_time_spec = false; //process all of the tags found with the same count as tag0 - BOOST_FOREACH(const gr_tag_t &my_tag, _tags) { + BOOST_FOREACH(const tag_t &my_tag, _tags) { const uint64_t my_tag_count = my_tag.offset; const pmt::pmt_t &key = my_tag.key; const pmt::pmt_t &value = my_tag.value; diff --git a/gr-uhd/lib/usrp_sink_impl.h b/gr-uhd/lib/usrp_sink_impl.h index b75dc1dc6d..c714eb53eb 100644 --- a/gr-uhd/lib/usrp_sink_impl.h +++ b/gr-uhd/lib/usrp_sink_impl.h @@ -20,7 +20,7 @@ * Boston, MA 02110-1301, USA. */ -#include <uhd/usrp_sink.h> +#include <gnuradio/uhd/usrp_sink.h> #include <uhd/convert.hpp> static const pmt::pmt_t SOB_KEY = pmt::string_to_symbol("tx_sob"); @@ -30,7 +30,7 @@ static const pmt::pmt_t TIME_KEY = pmt::string_to_symbol("tx_time"); namespace gr { namespace uhd { - inline gr_io_signature_sptr + inline io_signature::sptr args_to_io_sig(const ::uhd::stream_args_t &args) { const size_t nchan = std::max<size_t>(args.channels.size(), 1); @@ -43,7 +43,7 @@ namespace gr { if(args.cpu_format == "sc16") size = 4; #endif - return gr_make_io_signature(nchan, nchan, size); + return io_signature::make(nchan, nchan, size); } /*********************************************************************** @@ -134,7 +134,7 @@ namespace gr { bool _start_time_set; //stream tags related stuff - std::vector<gr_tag_t> _tags; + std::vector<tag_t> _tags; }; } /* namespace uhd */ diff --git a/gr-uhd/lib/usrp_source_impl.cc b/gr-uhd/lib/usrp_source_impl.cc index 50c144fb86..c5df60222a 100644 --- a/gr-uhd/lib/usrp_source_impl.cc +++ b/gr-uhd/lib/usrp_source_impl.cc @@ -22,7 +22,7 @@ #include "usrp_source_impl.h" #include "gr_uhd_common.h" -#include <gr_io_signature.h> +#include <gnuradio/io_signature.h> #include <boost/format.hpp> #include <boost/thread/thread.hpp> #include <boost/make_shared.hpp> @@ -63,8 +63,8 @@ namespace gr { usrp_source_impl::usrp_source_impl(const ::uhd::device_addr_t &device_addr, const ::uhd::stream_args_t &stream_args): - gr_sync_block("gr uhd usrp source", - gr_make_io_signature(0, 0, 0), + sync_block("gr uhd usrp source", + io_signature::make(0, 0, 0), args_to_io_sig(stream_args)), _stream_args(stream_args), _nchan(std::max<size_t>(1, stream_args.channels.size())), diff --git a/gr-uhd/lib/usrp_source_impl.h b/gr-uhd/lib/usrp_source_impl.h index 218cc9b6e3..58bb21551c 100644 --- a/gr-uhd/lib/usrp_source_impl.h +++ b/gr-uhd/lib/usrp_source_impl.h @@ -20,7 +20,7 @@ * Boston, MA 02110-1301, USA. */ -#include <uhd/usrp_source.h> +#include <gnuradio/uhd/usrp_source.h> #include <uhd/convert.hpp> static const pmt::pmt_t TIME_KEY = pmt::string_to_symbol("rx_time"); @@ -30,7 +30,7 @@ static const pmt::pmt_t FREQ_KEY = pmt::string_to_symbol("rx_freq"); namespace gr { namespace uhd { - inline gr_io_signature_sptr + inline io_signature::sptr args_to_io_sig(const ::uhd::stream_args_t &args) { const size_t nchan = std::max<size_t>(args.channels.size(), 1); @@ -43,7 +43,7 @@ namespace gr { if(args.cpu_format == "sc16") size = 4; #endif - return gr_make_io_signature(nchan, nchan, size); + return io_signature::make(nchan, nchan, size); } /*********************************************************************** diff --git a/gr-uhd/python/__init__.py b/gr-uhd/python/__init__.py index a07397334e..53c0f9ac14 100644 --- a/gr-uhd/python/__init__.py +++ b/gr-uhd/python/__init__.py @@ -20,9 +20,9 @@ # ''' -This is the GNU Radio UHD package. It is the interface to the UHD -library to connect to and send and receive data between the Ettus -Research, LLC product line. +Provides source and sink blocks to interface with the UHD library. +Used to send and receive data between the Ettus Research, LLC product +line. ''' ######################################################################## diff --git a/gr-uhd/swig/CMakeLists.txt b/gr-uhd/swig/CMakeLists.txt index 94d84a64bc..4084bc07e9 100644 --- a/gr-uhd/swig/CMakeLists.txt +++ b/gr-uhd/swig/CMakeLists.txt @@ -38,7 +38,7 @@ if(ENABLE_GR_CTRLPORT) endif(ENABLE_GR_CTRLPORT) set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/uhd_swig_doc.i) -set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/uhd) +set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/gnuradio/uhd) set(GR_SWIG_DOCS_TARGET_DEPS runtime_swig_swig_doc) link_directories(${UHD_LIBRARY_DIRS}) diff --git a/gr-uhd/swig/uhd_swig.i b/gr-uhd/swig/uhd_swig.i index 3df3c885b6..56f7b5eadd 100644 --- a/gr-uhd/swig/uhd_swig.i +++ b/gr-uhd/swig/uhd_swig.i @@ -41,9 +41,9 @@ // block headers //////////////////////////////////////////////////////////////////////// %{ -#include <uhd/usrp_source.h> -#include <uhd/usrp_sink.h> -#include <uhd/amsg_source.h> +#include <gnuradio/uhd/usrp_source.h> +#include <gnuradio/uhd/usrp_sink.h> +#include <gnuradio/uhd/amsg_source.h> %} //////////////////////////////////////////////////////////////////////// @@ -83,6 +83,9 @@ %include <uhd/types/sensors.hpp> +// Prevents issue with vector<size_t> redef on 32-bit systems +%import <uhd/stream.hpp> + //////////////////////////////////////////////////////////////////////// // swig dboard_iface for python access //////////////////////////////////////////////////////////////////////// @@ -95,9 +98,9 @@ //////////////////////////////////////////////////////////////////////// // block magic //////////////////////////////////////////////////////////////////////// -%include <uhd/usrp_source.h> -%include <uhd/usrp_sink.h> -%include <uhd/amsg_source.h> +%include <gnuradio/uhd/usrp_source.h> +%include <gnuradio/uhd/usrp_sink.h> +%include <gnuradio/uhd/amsg_source.h> GR_SWIG_BLOCK_MAGIC2(uhd, usrp_source) GR_SWIG_BLOCK_MAGIC2(uhd, usrp_sink) |