diff options
author | Nick Foster <nick@nerdnetworks.org> | 2010-11-10 12:02:28 -0800 |
---|---|---|
committer | Nick Foster <nick@nerdnetworks.org> | 2010-11-10 12:02:28 -0800 |
commit | 8fe1e7b29aacce7f75ae36e81706bbde02749b97 (patch) | |
tree | a3f99967174c5a8b4ec6cb38118d1adc5671d7d7 /host | |
parent | 53412938fe7c851591026ef4c25233806f4f27a3 (diff) | |
download | uhd-8fe1e7b29aacce7f75ae36e81706bbde02749b97.tar.gz uhd-8fe1e7b29aacce7f75ae36e81706bbde02749b97.tar.bz2 uhd-8fe1e7b29aacce7f75ae36e81706bbde02749b97.zip |
2+: moved mboard_rev to usrp2/ in preparation for merging upstream
Diffstat (limited to 'host')
-rw-r--r-- | host/lib/usrp/CMakeLists.txt | 1 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/CMakeLists.txt | 2 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/clock_ctrl.cpp | 2 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/mboard_impl.cpp | 2 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/mboard_rev.cpp (renamed from host/lib/usrp/mboard_rev.cpp) | 8 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/mboard_rev.hpp (renamed from host/include/uhd/usrp/mboard_rev.hpp) | 12 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/usrp2_clk_regs.hpp | 4 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/usrp2_iface.cpp | 8 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/usrp2_iface.hpp | 8 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/usrp2_regs.cpp | 4 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/usrp2_regs.hpp | 6 | ||||
-rw-r--r-- | host/utils/CMakeLists.txt | 3 | ||||
-rw-r--r-- | host/utils/usrp2_burn_mb_rev.cpp | 82 |
13 files changed, 26 insertions, 116 deletions
diff --git a/host/lib/usrp/CMakeLists.txt b/host/lib/usrp/CMakeLists.txt index 6c7f6adf4..eeb181e0b 100644 --- a/host/lib/usrp/CMakeLists.txt +++ b/host/lib/usrp/CMakeLists.txt @@ -23,7 +23,6 @@ LIBUHD_APPEND_SOURCES( ${CMAKE_SOURCE_DIR}/lib/usrp/dboard_id.cpp ${CMAKE_SOURCE_DIR}/lib/usrp/dboard_manager.cpp ${CMAKE_SOURCE_DIR}/lib/usrp/dsp_utils.cpp - ${CMAKE_SOURCE_DIR}/lib/usrp/mboard_rev.cpp ${CMAKE_SOURCE_DIR}/lib/usrp/misc_utils.cpp ${CMAKE_SOURCE_DIR}/lib/usrp/multi_usrp.cpp ${CMAKE_SOURCE_DIR}/lib/usrp/single_usrp.cpp diff --git a/host/lib/usrp/usrp2/CMakeLists.txt b/host/lib/usrp/usrp2/CMakeLists.txt index f7984fce5..a09c833bd 100644 --- a/host/lib/usrp/usrp2/CMakeLists.txt +++ b/host/lib/usrp/usrp2/CMakeLists.txt @@ -48,6 +48,8 @@ IF(ENABLE_USRP2) ${CMAKE_SOURCE_DIR}/lib/usrp/usrp2/gps_ctrl.cpp ${CMAKE_SOURCE_DIR}/lib/usrp/usrp2/io_impl.cpp ${CMAKE_SOURCE_DIR}/lib/usrp/usrp2/mboard_impl.cpp + ${CMAKE_SOURCE_DIR}/lib/usrp/usrp2/mboard_rev.cpp + ${CMAKE_SOURCE_DIR}/lib/usrp/usrp2/mboard_rev.hpp ${CMAKE_SOURCE_DIR}/lib/usrp/usrp2/serdes_ctrl.cpp ${CMAKE_SOURCE_DIR}/lib/usrp/usrp2/serdes_ctrl.hpp ${CMAKE_SOURCE_DIR}/lib/usrp/usrp2/usrp2_iface.cpp diff --git a/host/lib/usrp/usrp2/clock_ctrl.cpp b/host/lib/usrp/usrp2/clock_ctrl.cpp index c652b592b..04bbd6ba3 100644 --- a/host/lib/usrp/usrp2/clock_ctrl.cpp +++ b/host/lib/usrp/usrp2/clock_ctrl.cpp @@ -17,7 +17,7 @@ #include "clock_ctrl.hpp" #include "ad9510_regs.hpp" -#include <uhd/usrp/mboard_rev.hpp> +#include "mboard_rev.hpp" #include "usrp2_regs.hpp" //spi slave constants #include "usrp2_clk_regs.hpp" #include <uhd/utils/assert.hpp> diff --git a/host/lib/usrp/usrp2/mboard_impl.cpp b/host/lib/usrp/usrp2/mboard_impl.cpp index 805fd23db..9ccf90bbb 100644 --- a/host/lib/usrp/usrp2/mboard_impl.cpp +++ b/host/lib/usrp/usrp2/mboard_impl.cpp @@ -20,7 +20,7 @@ #include <uhd/usrp/misc_utils.hpp> #include <uhd/usrp/dsp_utils.hpp> #include <uhd/usrp/mboard_props.hpp> -#include <uhd/usrp/mboard_rev.hpp> +#include "mboard_rev.hpp" #include <uhd/utils/assert.hpp> #include <uhd/utils/algorithm.hpp> #include <uhd/types/mac_addr.hpp> diff --git a/host/lib/usrp/mboard_rev.cpp b/host/lib/usrp/usrp2/mboard_rev.cpp index 41600951f..9d0ff89f5 100644 --- a/host/lib/usrp/mboard_rev.cpp +++ b/host/lib/usrp/usrp2/mboard_rev.cpp @@ -15,14 +15,12 @@ // along with this program. If not, see <http://www.gnu.org/licenses/>. // -#include <uhd/usrp/mboard_rev.hpp> +#include "mboard_rev.hpp" #include <boost/lexical_cast.hpp> #include <boost/format.hpp> #include <sstream> #include <iostream> -using namespace uhd::usrp; - static const mboard_rev_t usrp2p_first_hw_rev = mboard_rev_t(0x0A00); mboard_rev_t::mboard_rev_t(boost::uint16_t rev){ @@ -82,10 +80,10 @@ boost::uint8_t mboard_rev_t::minor(void) const{ return _rev & 0xff; } -bool uhd::usrp::operator==(const mboard_rev_t &lhs, const mboard_rev_t &rhs){ +bool operator==(const mboard_rev_t &lhs, const mboard_rev_t &rhs){ return lhs.to_uint16() == rhs.to_uint16(); } -bool uhd::usrp::operator<(const mboard_rev_t &lhs, const mboard_rev_t &rhs){ +bool operator<(const mboard_rev_t &lhs, const mboard_rev_t &rhs){ return lhs.to_uint16() < rhs.to_uint16(); } diff --git a/host/include/uhd/usrp/mboard_rev.hpp b/host/lib/usrp/usrp2/mboard_rev.hpp index be968d01d..a1b1d9605 100644 --- a/host/include/uhd/usrp/mboard_rev.hpp +++ b/host/lib/usrp/usrp2/mboard_rev.hpp @@ -15,17 +15,15 @@ // along with this program. If not, see <http://www.gnu.org/licenses/>. // -#ifndef INCLUDED_UHD_USRP_MBOARD_REV_HPP -#define INCLUDED_UHD_USRP_MBOARD_REV_HPP +#ifndef INCLUDED_MBOARD_REV_HPP +#define INCLUDED_MBOARD_REV_HPP #include <uhd/config.hpp> #include <boost/cstdint.hpp> #include <boost/operators.hpp> #include <string> -namespace uhd{ namespace usrp{ - - class UHD_API mboard_rev_t : boost::equality_comparable<mboard_rev_t>, boost::less_than_comparable<mboard_rev_t>{ +class UHD_API mboard_rev_t : boost::equality_comparable<mboard_rev_t>, boost::less_than_comparable<mboard_rev_t>{ public: /*! * Create a mboard rev from an integer. @@ -113,6 +111,4 @@ namespace uhd{ namespace usrp{ UHD_API bool operator<(const mboard_rev_t &lhs, const mboard_rev_t &rhs); -}} //namespace - -#endif /* INCLUDED_UHD_USRP_MBOARD_REV_HPP */ +#endif /* INCLUDED_MBOARD_REV_HPP */ diff --git a/host/lib/usrp/usrp2/usrp2_clk_regs.hpp b/host/lib/usrp/usrp2/usrp2_clk_regs.hpp index edbdfa15d..fcfd1e227 100644 --- a/host/lib/usrp/usrp2/usrp2_clk_regs.hpp +++ b/host/lib/usrp/usrp2/usrp2_clk_regs.hpp @@ -18,13 +18,13 @@ #ifndef INCLUDED_USRP2_CLK_REGS_HPP #define INCLUDED_USRP2_CLK_REGS_HPP -#include <uhd/usrp/mboard_rev.hpp> +#include "mboard_rev.hpp" #include "usrp2_regs.hpp" class usrp2_clk_regs_t { public: usrp2_clk_regs_t(void) { ; } - usrp2_clk_regs_t(uhd::usrp::mboard_rev_t hw_rev) { + usrp2_clk_regs_t(mboard_rev_t hw_rev) { test = 0; fpga = 1; adc = (hw_rev.is_usrp2p()) ? 2 : 4; diff --git a/host/lib/usrp/usrp2/usrp2_iface.cpp b/host/lib/usrp/usrp2/usrp2_iface.cpp index a5b39ceed..d5ac14155 100644 --- a/host/lib/usrp/usrp2/usrp2_iface.cpp +++ b/host/lib/usrp/usrp2/usrp2_iface.cpp @@ -19,7 +19,7 @@ #include "usrp2_iface.hpp" #include <uhd/utils/assert.hpp> #include <uhd/types/dict.hpp> -#include <uhd/usrp/mboard_rev.hpp> +#include "mboard_rev.hpp" #include <boost/thread.hpp> #include <boost/foreach.hpp> #include <boost/asio.hpp> //used for htonl and ntohl @@ -54,7 +54,7 @@ public: //extract the mboard rev numbers byte_vector_t rev_bytes = read_eeprom(USRP2_I2C_ADDR_MBOARD, USRP2_EE_MBOARD_REV, 2); - set_hw_rev(uhd::usrp::mboard_rev_t::from_uint16(rev_bytes.at(0) | (rev_bytes.at(1) << 8))); + set_hw_rev(mboard_rev_t::from_uint16(rev_bytes.at(0) | (rev_bytes.at(1) << 8))); //check the fpga compatibility number const boost::uint32_t fpga_compat_num = this->peek32(this->regs.compat_num_rb); @@ -265,12 +265,12 @@ public: /*********************************************************************** * Get/set hardware revision **********************************************************************/ - void set_hw_rev(uhd::usrp::mboard_rev_t rev) { + void set_hw_rev(mboard_rev_t rev) { hw_rev = rev; regs = usrp2_get_regs(rev); //might be a better place to do this } - uhd::usrp::mboard_rev_t get_hw_rev(void) { + mboard_rev_t get_hw_rev(void) { return hw_rev; } diff --git a/host/lib/usrp/usrp2/usrp2_iface.hpp b/host/lib/usrp/usrp2/usrp2_iface.hpp index 53a8e4bc8..fee3b23af 100644 --- a/host/lib/usrp/usrp2/usrp2_iface.hpp +++ b/host/lib/usrp/usrp2/usrp2_iface.hpp @@ -23,7 +23,7 @@ #include <boost/shared_ptr.hpp> #include <boost/utility.hpp> #include <boost/cstdint.hpp> -#include <uhd/usrp/mboard_rev.hpp> +#include "mboard_rev.hpp" #include <utility> #include "fw_common.h" #include "usrp2_regs.hpp" @@ -113,12 +113,12 @@ public: * Set the hardware revision number. Also selects the proper register set for the device. * \param rev the 16-bit revision */ - virtual void set_hw_rev(uhd::usrp::mboard_rev_t rev) = 0; + virtual void set_hw_rev(mboard_rev_t rev) = 0; /*! Return the hardware revision number * \return hardware revision */ - virtual uhd::usrp::mboard_rev_t get_hw_rev(void) = 0; + virtual mboard_rev_t get_hw_rev(void) = 0; /*! * Register map selected from USRP2/USRP2+. @@ -127,7 +127,7 @@ public: /*! * Hardware revision as returned by the device. */ - uhd::usrp::mboard_rev_t hw_rev; + mboard_rev_t hw_rev; }; #endif /* INCLUDED_USRP2_IFACE_HPP */ diff --git a/host/lib/usrp/usrp2/usrp2_regs.cpp b/host/lib/usrp/usrp2/usrp2_regs.cpp index f9b54b76e..0f0360c95 100644 --- a/host/lib/usrp/usrp2/usrp2_regs.cpp +++ b/host/lib/usrp/usrp2/usrp2_regs.cpp @@ -15,14 +15,14 @@ // along with this program. If not, see <http://www.gnu.org/licenses/>. // -#include <uhd/usrp/mboard_rev.hpp> +#include "mboard_rev.hpp" #include "usrp2_regs.hpp" int sr_addr(int misc_output_base, int sr) { return misc_output_base + 4 * sr; } -usrp2_regs_t usrp2_get_regs(uhd::usrp::mboard_rev_t hw_rev) { +usrp2_regs_t usrp2_get_regs(mboard_rev_t hw_rev) { //how about you just make this dependent on hw_rev instead of doing the init before main, and give up the const globals, since the application won't ever need both. const int misc_output_base = (hw_rev.is_usrp2p()) ? USRP2P_MISC_OUTPUT_BASE : USRP2_MISC_OUTPUT_BASE, diff --git a/host/lib/usrp/usrp2/usrp2_regs.hpp b/host/lib/usrp/usrp2/usrp2_regs.hpp index bb15ed496..0d68c65c2 100644 --- a/host/lib/usrp/usrp2/usrp2_regs.hpp +++ b/host/lib/usrp/usrp2/usrp2_regs.hpp @@ -18,7 +18,7 @@ #ifndef INCLUDED_USRP2_REGS_HPP #define INCLUDED_USRP2_REGS_HPP -#include <uhd/usrp/mboard_rev.hpp> +#include "mboard_rev.hpp" #define USRP2_MISC_OUTPUT_BASE 0xD400 #define USRP2_GPIO_BASE 0xC800 @@ -30,7 +30,7 @@ #define USRP2P_ATR_BASE 0x3800 #define USRP2P_BP_STATUS_BASE 0x3300 -const uhd::usrp::mboard_rev_t USRP2P_FIRST_HW_REV(0x0A00); +const mboard_rev_t USRP2P_FIRST_HW_REV(0x0A00); typedef struct { int sr_misc; @@ -103,7 +103,7 @@ typedef struct { extern const usrp2_regs_t usrp2_regs; //the register definitions, set in usrp2_regs.cpp and usrp2p_regs.cpp -usrp2_regs_t usrp2_get_regs(uhd::usrp::mboard_rev_t hw_rev); +usrp2_regs_t usrp2_get_regs(mboard_rev_t hw_rev); //////////////////////////////////////////////////// // Settings Bus, Slave #7, Not Byte Addressable! diff --git a/host/utils/CMakeLists.txt b/host/utils/CMakeLists.txt index 083c7629c..a95864ca7 100644 --- a/host/utils/CMakeLists.txt +++ b/host/utils/CMakeLists.txt @@ -45,9 +45,6 @@ TARGET_LINK_LIBRARIES(usrp1_init_eeprom uhd) ADD_EXECUTABLE(usrp1_serial_burner usrp1_serial_burner.cpp) TARGET_LINK_LIBRARIES(usrp1_serial_burner uhd) -ADD_EXECUTABLE(usrp2_burn_mb_rev usrp2_burn_mb_rev.cpp) -TARGET_LINK_LIBRARIES(usrp2_burn_mb_rev uhd) - INSTALL(TARGETS usrp2_addr_burner usrp_burn_db_eeprom diff --git a/host/utils/usrp2_burn_mb_rev.cpp b/host/utils/usrp2_burn_mb_rev.cpp deleted file mode 100644 index 59b072d17..000000000 --- a/host/utils/usrp2_burn_mb_rev.cpp +++ /dev/null @@ -1,82 +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/>. -// - - -#include <uhd/utils/safe_main.hpp> -#include <uhd/device.hpp> -#include <uhd/types/dict.hpp> -#include <uhd/utils/assert.hpp> -#include <uhd/usrp/dboard_id.hpp> -#include <uhd/usrp/device_props.hpp> -#include <uhd/usrp/mboard_props.hpp> -#include <uhd/usrp/mboard_rev.hpp> -#include <boost/program_options.hpp> -#include <boost/format.hpp> -#include <boost/assign.hpp> -#include <iostream> - -using namespace uhd; -using namespace uhd::usrp; -namespace po = boost::program_options; - -int UHD_SAFE_MAIN(int argc, char *argv[]){ - //command line variables - std::string args; - - po::options_description desc("Allowed options"); - desc.add_options() - ("help", "help message") - ("args", po::value<std::string>(&args)->default_value(""), "device address args [default = \"\"]") - ("rev", po::value<std::string>(), "mboard rev to burn, omit for readback") - ; - - po::variables_map vm; - po::store(po::parse_command_line(argc, argv, desc), vm); - po::notify(vm); - - //print the help message - if (vm.count("help")){ - std::cout << boost::format("USRP Burn MB HW revision %s") % desc << std::endl; - std::cout << boost::format( - "Omit the rev argument to perform readback,\n" - "Or specify a new rev to burn into the eeprom.\n" - ) << std::endl; - return ~0; - } - - //make the device and extract the mboard - device::sptr dev = device::make(args); - wax::obj u2_mb = (*dev)[DEVICE_PROP_MBOARD]; - - //read the current mboard rev from eeprom - if (vm.count("rev") == 0){ - std::cout << "Getting rev..." << std::endl; - uhd::usrp::mboard_rev_t rev = mboard_rev_t::from_string(u2_mb[std::string("hw-rev")].as<std::string>()); - std::cout << boost::format(" Current rev: %s") % rev.to_pp_string() << std::endl; - } - - //write a new mboard rev to eeprom - else{ - mboard_rev_t rev = mboard_rev_t::from_string(vm["rev"].as<std::string>()); - std::cout << "Setting mboard rev..." << std::endl; - std::cout << boost::format(" New rev: %s") % rev.to_pp_string() << std::endl; - u2_mb[std::string("hw-rev")] = rev.to_string(); - } - - std::cout << " Done" << std::endl << std::endl; - return 0; -} |