aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-06-14 15:32:11 -0700
committerJosh Blum <josh@joshknows.com>2011-06-14 15:32:11 -0700
commitbe74968870fcf7288c0ccab9dc27231140cfa665 (patch)
treedcc2fd0f61ca74a5417697d0ab4c4a798f3b03ed
parent9abe8aed3170390c8ab7b855d1d4d322129a7b34 (diff)
downloaduhd-be74968870fcf7288c0ccab9dc27231140cfa665.tar.gz
uhd-be74968870fcf7288c0ccab9dc27231140cfa665.tar.bz2
uhd-be74968870fcf7288c0ccab9dc27231140cfa665.zip
usrp1: moved fx2 control into its own directory
-rw-r--r--host/lib/usrp/CMakeLists.txt1
-rw-r--r--host/lib/usrp/fx2/CMakeLists.txt27
-rw-r--r--host/lib/usrp/fx2/fx2_ctrl.cpp (renamed from host/lib/usrp/usrp1/usrp1_ctrl.cpp)13
-rw-r--r--host/lib/usrp/fx2/fx2_ctrl.hpp (renamed from host/lib/usrp/usrp1/usrp1_ctrl.hpp)8
-rw-r--r--host/lib/usrp/usrp1/CMakeLists.txt4
-rw-r--r--host/lib/usrp/usrp1/usrp1_iface.cpp6
-rw-r--r--host/lib/usrp/usrp1/usrp1_iface.hpp4
-rw-r--r--host/lib/usrp/usrp1/usrp1_impl.cpp9
-rw-r--r--host/lib/usrp/usrp1/usrp1_impl.hpp5
9 files changed, 52 insertions, 25 deletions
diff --git a/host/lib/usrp/CMakeLists.txt b/host/lib/usrp/CMakeLists.txt
index 018beb417..281910735 100644
--- a/host/lib/usrp/CMakeLists.txt
+++ b/host/lib/usrp/CMakeLists.txt
@@ -34,6 +34,7 @@ LIBUHD_APPEND_SOURCES(
)
INCLUDE_SUBDIRECTORY(dboard)
+INCLUDE_SUBDIRECTORY(fx2)
INCLUDE_SUBDIRECTORY(usrp1)
INCLUDE_SUBDIRECTORY(usrp2)
INCLUDE_SUBDIRECTORY(usrp_e100)
diff --git a/host/lib/usrp/fx2/CMakeLists.txt b/host/lib/usrp/fx2/CMakeLists.txt
new file mode 100644
index 000000000..109eea6b7
--- /dev/null
+++ b/host/lib/usrp/fx2/CMakeLists.txt
@@ -0,0 +1,27 @@
+#
+# Copyright 2011 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/>.
+#
+
+########################################################################
+IF(ENABLE_USRP1)
+ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/../firmware/fx2/common)
+ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
+
+ LIBUHD_APPEND_SOURCES(
+ ${CMAKE_CURRENT_SOURCE_DIR}/fx2_ctrl.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/fx2_ctrl.hpp
+ )
+ENDIF(ENABLE_USRP1)
diff --git a/host/lib/usrp/usrp1/usrp1_ctrl.cpp b/host/lib/usrp/fx2/fx2_ctrl.cpp
index b29e779c1..06ca51c25 100644
--- a/host/lib/usrp/usrp1/usrp1_ctrl.cpp
+++ b/host/lib/usrp/fx2/fx2_ctrl.cpp
@@ -15,7 +15,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
-#include "usrp1_ctrl.hpp"
+#include "fx2_ctrl.hpp"
#include "usrp_commands.h"
#include <uhd/utils/msg.hpp>
#include <uhd/exception.hpp>
@@ -29,6 +29,7 @@
#include <cstring>
using namespace uhd;
+using namespace uhd::usrp;
#define FX2_FIRMWARE_LOAD 0xa0
@@ -128,9 +129,9 @@ bool parse_record(std::string *record, unsigned int &len,
/*!
* USRP control implementation for device discovery and configuration
*/
-class usrp_ctrl_impl : public usrp_ctrl {
+class fx2_ctrl_impl : public fx2_ctrl {
public:
- usrp_ctrl_impl(uhd::transport::usb_control::sptr ctrl_transport)
+ fx2_ctrl_impl(uhd::transport::usb_control::sptr ctrl_transport)
{
_ctrl_transport = ctrl_transport;
}
@@ -415,9 +416,9 @@ private:
};
/***********************************************************************
- * Public make function for usrp_ctrl interface
+ * Public make function for fx2_ctrl interface
**********************************************************************/
-usrp_ctrl::sptr usrp_ctrl::make(uhd::transport::usb_control::sptr ctrl_transport){
- return sptr(new usrp_ctrl_impl(ctrl_transport));
+fx2_ctrl::sptr fx2_ctrl::make(uhd::transport::usb_control::sptr ctrl_transport){
+ return sptr(new fx2_ctrl_impl(ctrl_transport));
}
diff --git a/host/lib/usrp/usrp1/usrp1_ctrl.hpp b/host/lib/usrp/fx2/fx2_ctrl.hpp
index a6e4ffba7..98c98bb8c 100644
--- a/host/lib/usrp/usrp1/usrp1_ctrl.hpp
+++ b/host/lib/usrp/fx2/fx2_ctrl.hpp
@@ -22,9 +22,11 @@
#include <boost/shared_ptr.hpp>
#include <boost/utility.hpp>
-class usrp_ctrl : boost::noncopyable{
+namespace uhd{ namespace usrp{
+
+class fx2_ctrl : boost::noncopyable{
public:
- typedef boost::shared_ptr<usrp_ctrl> sptr;
+ typedef boost::shared_ptr<fx2_ctrl> sptr;
/*!
* Make a usrp control object from a control transport
@@ -115,4 +117,6 @@ public:
virtual void usrp_tx_enable(bool on) = 0;
};
+}} //namespace uhd::usrp
+
#endif /* INCLUDED_USRP_CTRL_HPP */
diff --git a/host/lib/usrp/usrp1/CMakeLists.txt b/host/lib/usrp/usrp1/CMakeLists.txt
index 9e50f5728..c208cfe8c 100644
--- a/host/lib/usrp/usrp1/CMakeLists.txt
+++ b/host/lib/usrp/usrp1/CMakeLists.txt
@@ -25,8 +25,6 @@
LIBUHD_REGISTER_COMPONENT("USRP1" ENABLE_USRP1 ON "ENABLE_LIBUHD;ENABLE_USB" OFF)
IF(ENABLE_USRP1)
- INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/../firmware/fx2/common)
-
LIBUHD_APPEND_SOURCES(
${CMAKE_CURRENT_SOURCE_DIR}/clock_ctrl.cpp
${CMAKE_CURRENT_SOURCE_DIR}/clock_ctrl.hpp
@@ -43,7 +41,5 @@ IF(ENABLE_USRP1)
${CMAKE_CURRENT_SOURCE_DIR}/usrp1_iface.hpp
${CMAKE_CURRENT_SOURCE_DIR}/usrp1_impl.cpp
${CMAKE_CURRENT_SOURCE_DIR}/usrp1_impl.hpp
- ${CMAKE_CURRENT_SOURCE_DIR}/usrp1_ctrl.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/usrp1_ctrl.hpp
)
ENDIF(ENABLE_USRP1)
diff --git a/host/lib/usrp/usrp1/usrp1_iface.cpp b/host/lib/usrp/usrp1/usrp1_iface.cpp
index 0942e2613..8877f19db 100644
--- a/host/lib/usrp/usrp1/usrp1_iface.cpp
+++ b/host/lib/usrp/usrp1/usrp1_iface.cpp
@@ -33,7 +33,7 @@ public:
/*******************************************************************
* Structors
******************************************************************/
- usrp1_iface_impl(usrp_ctrl::sptr ctrl_transport)
+ usrp1_iface_impl(uhd::usrp::fx2_ctrl::sptr ctrl_transport)
{
_ctrl_transport = ctrl_transport;
mb_eeprom = mboard_eeprom_t(*this, mboard_eeprom_t::MAP_B000);
@@ -287,13 +287,13 @@ public:
}
private:
- usrp_ctrl::sptr _ctrl_transport;
+ uhd::usrp::fx2_ctrl::sptr _ctrl_transport;
};
/***********************************************************************
* Public Make Function
**********************************************************************/
-usrp1_iface::sptr usrp1_iface::make(usrp_ctrl::sptr ctrl_transport)
+usrp1_iface::sptr usrp1_iface::make(uhd::usrp::fx2_ctrl::sptr ctrl_transport)
{
return sptr(new usrp1_iface_impl(ctrl_transport));
}
diff --git a/host/lib/usrp/usrp1/usrp1_iface.hpp b/host/lib/usrp/usrp1/usrp1_iface.hpp
index 2ebcdbacc..c374149fa 100644
--- a/host/lib/usrp/usrp1/usrp1_iface.hpp
+++ b/host/lib/usrp/usrp1/usrp1_iface.hpp
@@ -21,7 +21,7 @@
#include <uhd/usrp/mboard_iface.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/utility.hpp>
-#include "usrp1_ctrl.hpp"
+#include "fx2_ctrl.hpp"
/*!
* The usrp1 interface class:
@@ -40,7 +40,7 @@ public:
* \param ctrl_transport the usrp controller object
* \return a new usrp1 interface object
*/
- static sptr make(usrp_ctrl::sptr ctrl_transport);
+ static sptr make(uhd::usrp::fx2_ctrl::sptr ctrl_transport);
/*!
* Perform a general USB firmware OUT operation
diff --git a/host/lib/usrp/usrp1/usrp1_impl.cpp b/host/lib/usrp/usrp1/usrp1_impl.cpp
index 83ff8ebe2..37955d628 100644
--- a/host/lib/usrp/usrp1/usrp1_impl.cpp
+++ b/host/lib/usrp/usrp1/usrp1_impl.cpp
@@ -16,7 +16,6 @@
//
#include "usrp1_impl.hpp"
-#include "usrp1_ctrl.hpp"
#include "fpga_regs_standard.h"
#include "usrp_spi_defs.h"
#include <uhd/utils/log.hpp>
@@ -90,7 +89,7 @@ static device_addrs_t usrp1_find(const device_addr_t &hint)
try{control = usb_control::make(handle);}
catch(const uhd::exception &){continue;} //ignore claimed
- usrp_ctrl::make(control)->usrp_load_firmware(usrp1_fw_image);
+ fx2_ctrl::make(control)->usrp_load_firmware(usrp1_fw_image);
}
//get descriptors again with serial number, but using the initialized VID/PID now since we have firmware
@@ -102,7 +101,7 @@ static device_addrs_t usrp1_find(const device_addr_t &hint)
try{control = usb_control::make(handle);}
catch(const uhd::exception &){continue;} //ignore claimed
- usrp1_iface::sptr iface = usrp1_iface::make(usrp_ctrl::make(control));
+ usrp1_iface::sptr iface = usrp1_iface::make(fx2_ctrl::make(control));
device_addr_t new_addr;
new_addr["type"] = "usrp1";
new_addr["name"] = iface->mb_eeprom["name"];
@@ -147,7 +146,7 @@ static device::sptr usrp1_make(const device_addr_t &device_addr){
//create control objects and a data transport
usb_control::sptr ctrl_transport = usb_control::make(handle);
- usrp_ctrl::sptr usrp_ctrl = usrp_ctrl::make(ctrl_transport);
+ fx2_ctrl::sptr usrp_ctrl = fx2_ctrl::make(ctrl_transport);
usrp_ctrl->usrp_load_fpga(usrp1_fpga_image);
usrp_ctrl->usrp_init();
usb_zero_copy::sptr data_transport = usb_zero_copy::make(
@@ -169,7 +168,7 @@ UHD_STATIC_BLOCK(register_usrp1_device){
* Structors
**********************************************************************/
usrp1_impl::usrp1_impl(uhd::transport::usb_zero_copy::sptr data_transport,
- usrp_ctrl::sptr ctrl_transport)
+ uhd::usrp::fx2_ctrl::sptr ctrl_transport)
: _data_transport(data_transport), _ctrl_transport(ctrl_transport)
{
_iface = usrp1_iface::make(ctrl_transport);
diff --git a/host/lib/usrp/usrp1/usrp1_impl.hpp b/host/lib/usrp/usrp1/usrp1_impl.hpp
index a4d40a54d..fbae2a3b9 100644
--- a/host/lib/usrp/usrp1/usrp1_impl.hpp
+++ b/host/lib/usrp/usrp1/usrp1_impl.hpp
@@ -16,7 +16,6 @@
//
#include "usrp1_iface.hpp"
-#include "usrp1_ctrl.hpp"
#include "clock_ctrl.hpp"
#include "codec_ctrl.hpp"
#include "soft_time_ctrl.hpp"
@@ -75,7 +74,7 @@ public:
//structors
usrp1_impl(uhd::transport::usb_zero_copy::sptr data_transport,
- usrp_ctrl::sptr ctrl_transport);
+ uhd::usrp::fx2_ctrl::sptr ctrl_transport);
~usrp1_impl(void);
@@ -197,7 +196,7 @@ private:
//transports
uhd::transport::usb_zero_copy::sptr _data_transport;
- usrp_ctrl::sptr _ctrl_transport;
+ uhd::usrp::fx2_ctrl::sptr _ctrl_transport;
//capabilities
size_t get_num_ducs(void);