summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-07-01 16:08:33 -0700
committerJosh Blum <josh@joshknows.com>2010-07-05 13:45:16 -0700
commit3b1473d5a3fbfb89e9ddc5575e855644707718d0 (patch)
tree7b83663b81e8c8d4882b6a9a0291c388088a6c26
parent82790f3da8afe646f255da428c5936045f0e2434 (diff)
downloaduhd-3b1473d5a3fbfb89e9ddc5575e855644707718d0.tar.gz
uhd-3b1473d5a3fbfb89e9ddc5575e855644707718d0.tar.bz2
uhd-3b1473d5a3fbfb89e9ddc5575e855644707718d0.zip
usrp2: removed usrp2.hpp header, its not needed, just use the discovery/factory system
uhd: added usrp_mimo skeleton code/header
-rw-r--r--host/include/uhd/usrp/CMakeLists.txt6
-rw-r--r--host/include/uhd/usrp/mimo_usrp.hpp69
-rw-r--r--host/include/uhd/usrp/usrp2.hpp62
-rw-r--r--host/lib/usrp/usrp2/usrp2_impl.cpp22
-rw-r--r--host/lib/usrp/usrp2/usrp2_impl.hpp2
-rw-r--r--host/utils/usrp2_addr_burner.cpp5
6 files changed, 87 insertions, 79 deletions
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 <http://www.gnu.org/licenses/>.
+//
+
+#ifndef INCLUDED_UHD_USRP_MIMO_USRP_HPP
+#define INCLUDED_UHD_USRP_MIMO_USRP_HPP
+
+#include <uhd/config.hpp>
+#include <uhd/device.hpp>
+#include <uhd/types/ranges.hpp>
+#include <uhd/types/stream_cmd.hpp>
+#include <uhd/types/clock_config.hpp>
+#include <uhd/types/tune_result.hpp>
+#include <boost/shared_ptr.hpp>
+#include <boost/utility.hpp>
+#include <vector>
+
+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<mimo_usrp> 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 <http://www.gnu.org/licenses/>.
-//
-
-#ifndef INCLUDED_UHD_USRP_USRP2_HPP
-#define INCLUDED_UHD_USRP_USRP2_HPP
-
-#include <uhd/config.hpp>
-#include <uhd/device.hpp>
-
-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<std::string> split_addrs(const std::string &addrs_str){
return addrs;
}
+template <class T> std::string num2str(T num){
+ return boost::lexical_cast<std::string>(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 <class T> std::string num2str(T num){
- return boost::lexical_cast<std::string>(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 <uhd/usrp/usrp2.hpp>
+#include <uhd/device.hpp>
#include <uhd/utils/pimpl.hpp>
#include <uhd/types/dict.hpp>
#include <uhd/types/otw_type.hpp>
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 <uhd/utils/safe_main.hpp>
-#include <uhd/usrp/usrp2.hpp>
+#include <uhd/device.hpp>
#include <uhd/usrp/device_props.hpp>
#include <boost/program_options.hpp>
#include <boost/format.hpp>
@@ -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<std::string>();
}
@@ -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;