From 3b1473d5a3fbfb89e9ddc5575e855644707718d0 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Thu, 1 Jul 2010 16:08:33 -0700 Subject: usrp2: removed usrp2.hpp header, its not needed, just use the discovery/factory system uhd: added usrp_mimo skeleton code/header --- host/include/uhd/usrp/CMakeLists.txt | 6 ++-- host/include/uhd/usrp/mimo_usrp.hpp | 69 ++++++++++++++++++++++++++++++++++++ host/include/uhd/usrp/usrp2.hpp | 62 -------------------------------- host/lib/usrp/usrp2/usrp2_impl.cpp | 22 ++++++------ host/lib/usrp/usrp2/usrp2_impl.hpp | 2 +- host/utils/usrp2_addr_burner.cpp | 5 +-- 6 files changed, 87 insertions(+), 79 deletions(-) create mode 100644 host/include/uhd/usrp/mimo_usrp.hpp delete mode 100644 host/include/uhd/usrp/usrp2.hpp diff --git a/host/include/uhd/usrp/CMakeLists.txt b/host/include/uhd/usrp/CMakeLists.txt index bbd124ed8..6f8c1a2d8 100644 --- a/host/include/uhd/usrp/CMakeLists.txt +++ b/host/include/uhd/usrp/CMakeLists.txt @@ -31,12 +31,12 @@ INSTALL(FILES dboard_iface.hpp dboard_manager.hpp - ### usrp headers ### - usrp2.hpp - ### utilities ### tune_helper.hpp + + ### interfaces ### simple_usrp.hpp + mimo_usrp.hpp DESTINATION ${INCLUDE_DIR}/uhd/usrp ) diff --git a/host/include/uhd/usrp/mimo_usrp.hpp b/host/include/uhd/usrp/mimo_usrp.hpp new file mode 100644 index 000000000..2262b324e --- /dev/null +++ b/host/include/uhd/usrp/mimo_usrp.hpp @@ -0,0 +1,69 @@ +// +// Copyright 2010 Ettus Research LLC +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// + +#ifndef INCLUDED_UHD_USRP_MIMO_USRP_HPP +#define INCLUDED_UHD_USRP_MIMO_USRP_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace uhd{ namespace usrp{ + +/*! + * The MIMO USRP device class: + * A mimo usrp facilitates ease-of-use for multi-usrp scenarios. + * The wrapper provides convenience functions to control the group + * of underlying devices as if they consisted of a single device. + */ +class UHD_API mimo_usrp : boost::noncopyable{ +public: + typedef boost::shared_ptr sptr; + + /*! + * Make a new mimo usrp from the device address. + * \param dev_addr the device address + * \return a new mimo usrp object + */ + static sptr make(const device_addr_t &dev_addr); + + /*! + * Get the underlying device object. + * This is needed to get access to the streaming API and properties. + * \return the device object within this simple usrp + */ + virtual device::sptr get_device(void) = 0; + + /*! + * Get a printable name for this mimo usrp. + * \return a printable string + */ + virtual std::string get_name(void) = 0; + + //TODO + +}; + +}} + +#endif /* INCLUDED_UHD_USRP_MIMO_USRP_HPP */ diff --git a/host/include/uhd/usrp/usrp2.hpp b/host/include/uhd/usrp/usrp2.hpp deleted file mode 100644 index 7387e5dd4..000000000 --- a/host/include/uhd/usrp/usrp2.hpp +++ /dev/null @@ -1,62 +0,0 @@ -// -// Copyright 2010 Ettus Research LLC -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// - -#ifndef INCLUDED_UHD_USRP_USRP2_HPP -#define INCLUDED_UHD_USRP_USRP2_HPP - -#include -#include - -namespace uhd{ namespace usrp{ - -/*! - * The usrp2 device class. - */ -class UHD_API usrp2 : public device{ -public: - /*! - * Find usrp2 devices over the ethernet. - * - * Recommended key/value pairs for the device hint address: - * hint["addr"] = address, where address is a resolvable address - * or ip address, which may or may not be a broadcast address. - * - * Other optional device address keys: - * recv_buff_size: resizes the recv buffer on the data socket - * send_buff_size: resizes the send buffer on the data socket - * - * \param hint a device addr with the usrp2 address filled in - * \return a vector of device addresses for all usrp2s found - */ - static device_addrs_t find(const device_addr_t &hint); - - /*! - * Make a usrp2 from a device address. - * - * Required key/value pairs for the device address: - * hint["addr"] = address, where address is a resolvable address - * or ip address, which must be the specific address of a usrp2. - * - * \param addr the device address - * \return a device sptr to a new usrp2 - */ - static device::sptr make(const device_addr_t &addr); -}; - -}} //namespace - -#endif /* INCLUDED_UHD_USRP_USRP2_HPP */ diff --git a/host/lib/usrp/usrp2/usrp2_impl.cpp b/host/lib/usrp/usrp2/usrp2_impl.cpp index 436146a48..cdba19f50 100644 --- a/host/lib/usrp/usrp2/usrp2_impl.cpp +++ b/host/lib/usrp/usrp2/usrp2_impl.cpp @@ -35,10 +35,6 @@ using namespace uhd::usrp; using namespace uhd::transport; namespace asio = boost::asio; -UHD_STATIC_BLOCK(register_usrp2_device){ - device::register_device(&usrp2::find, &usrp2::make); -} - /*********************************************************************** * Helper Functions **********************************************************************/ @@ -48,10 +44,14 @@ std::vector split_addrs(const std::string &addrs_str){ return addrs; } +template std::string num2str(T num){ + return boost::lexical_cast(num); +} + /*********************************************************************** * Discovery over the udp transport **********************************************************************/ -uhd::device_addrs_t usrp2::find(const device_addr_t &hint){ +static uhd::device_addrs_t usrp2_find(const device_addr_t &hint){ device_addrs_t usrp2_addrs; //return an empty list of addresses when type is set to non-usrp2 @@ -68,7 +68,7 @@ uhd::device_addrs_t usrp2::find(const device_addr_t &hint){ new_hint["addr"] = if_addrs.bcast; //call discover with the new hint and append results - device_addrs_t new_usrp2_addrs = usrp2::find(new_hint); + device_addrs_t new_usrp2_addrs = usrp2_find(new_hint); usrp2_addrs.insert(usrp2_addrs.begin(), new_usrp2_addrs.begin(), new_usrp2_addrs.end() ); @@ -127,11 +127,7 @@ uhd::device_addrs_t usrp2::find(const device_addr_t &hint){ /*********************************************************************** * Make **********************************************************************/ -template std::string num2str(T num){ - return boost::lexical_cast(num); -} - -device::sptr usrp2::make(const device_addr_t &device_addr){ +static device::sptr usrp2_make(const device_addr_t &device_addr){ //extract the receive and send buffer sizes size_t recv_buff_size = 0, send_buff_size= 0 ; if (device_addr.has_key("recv_buff_size")){ @@ -161,6 +157,10 @@ device::sptr usrp2::make(const device_addr_t &device_addr){ ); } +UHD_STATIC_BLOCK(register_usrp2_device){ + device::register_device(&usrp2_find, &usrp2_make); +} + /*********************************************************************** * Structors **********************************************************************/ diff --git a/host/lib/usrp/usrp2/usrp2_impl.hpp b/host/lib/usrp/usrp2/usrp2_impl.hpp index df1dba663..07e29eadd 100644 --- a/host/lib/usrp/usrp2/usrp2_impl.hpp +++ b/host/lib/usrp/usrp2/usrp2_impl.hpp @@ -22,7 +22,7 @@ #include "clock_ctrl.hpp" #include "codec_ctrl.hpp" #include "serdes_ctrl.hpp" -#include +#include #include #include #include diff --git a/host/utils/usrp2_addr_burner.cpp b/host/utils/usrp2_addr_burner.cpp index 08fc1e218..f0e3434b7 100644 --- a/host/utils/usrp2_addr_burner.cpp +++ b/host/utils/usrp2_addr_burner.cpp @@ -16,7 +16,7 @@ // #include -#include +#include #include #include #include @@ -45,6 +45,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ //load the options into the address uhd::device_addr_t device_addr; + device_addr["type"] = "usrp2"; if (vm.count("addr")){ device_addr["addr"] = vm["addr"].as(); } @@ -54,7 +55,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ } //create a usrp2 device - uhd::device::sptr u2_dev = uhd::usrp::usrp2::make(device_addr); + uhd::device::sptr u2_dev = uhd::device::make(device_addr); //FIXME usees the default mboard for now (until the mimo link is supported) wax::obj u2_mb = (*u2_dev)[uhd::usrp::DEVICE_PROP_MBOARD]; std::cout << std::endl; -- cgit v1.2.3