summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--firmware/microblaze/lib/u2_init.c4
-rw-r--r--host/include/uhd/usrp/mboard_rev.hpp34
-rw-r--r--host/lib/usrp/CMakeLists.txt1
-rw-r--r--host/lib/usrp/mboard_rev.cpp29
-rw-r--r--host/lib/usrp/usrp2/clock_ctrl.cpp6
-rw-r--r--host/lib/usrp/usrp2/codec_ctrl.cpp10
-rw-r--r--host/lib/usrp/usrp2/codec_impl.cpp4
-rw-r--r--host/lib/usrp/usrp2/mboard_impl.cpp18
-rw-r--r--host/lib/usrp/usrp2/usrp2_iface.cpp4
-rw-r--r--host/lib/usrp/usrp2/usrp2_iface.hpp1
-rw-r--r--host/lib/usrp/usrp2/usrp2_regs.cpp11
-rw-r--r--host/lib/usrp/usrp2/usrp2_regs.hpp6
-rw-r--r--host/utils/CMakeLists.txt3
-rw-r--r--host/utils/usrp2_burn_mb_rev.cpp82
14 files changed, 180 insertions, 33 deletions
diff --git a/firmware/microblaze/lib/u2_init.c b/firmware/microblaze/lib/u2_init.c
index 099aafe83..3c8f5f02a 100644
--- a/firmware/microblaze/lib/u2_init.c
+++ b/firmware/microblaze/lib/u2_init.c
@@ -35,8 +35,8 @@ unsigned char u2_hw_rev_minor;
static inline void
get_hw_rev(void)
{
- bool ok = eeprom_read(USRP2_I2C_ADDR_MBOARD, USRP2_EE_MBOARD_REV_LSB, &u2_hw_rev_minor, 1);
- ok &= eeprom_read(USRP2_I2C_ADDR_MBOARD, USRP2_EE_MBOARD_REV_MSB, &u2_hw_rev_major, 1);
+ bool ok = eeprom_read(USRP2_I2C_ADDR_MBOARD, USRP2_EE_MBOARD_REV, &u2_hw_rev_minor, 1);
+ ok &= eeprom_read(USRP2_I2C_ADDR_MBOARD, USRP2_EE_MBOARD_REV+1, &u2_hw_rev_major, 1);
}
/*
diff --git a/host/include/uhd/usrp/mboard_rev.hpp b/host/include/uhd/usrp/mboard_rev.hpp
index 5307d80c1..be968d01d 100644
--- a/host/include/uhd/usrp/mboard_rev.hpp
+++ b/host/include/uhd/usrp/mboard_rev.hpp
@@ -25,7 +25,7 @@
namespace uhd{ namespace usrp{
- class UHD_API mboard_rev_t : boost::equality_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.
@@ -71,6 +71,24 @@ namespace uhd{ namespace usrp{
* \return a string with the mboard name and rev number
*/
std::string to_pp_string(void) const;
+
+ /*!
+ * Tell you if you're USRP2 or USRP2+
+ * \return true if USRP2+, false if USRP2
+ */
+ bool is_usrp2p(void) const;
+
+ /*!
+ * Get the major revision number
+ * \return major revision number
+ */
+ boost::uint8_t major(void) const;
+
+ /*!
+ * Get the minor revision number
+ * \return minor revision number
+ */
+ boost::uint8_t minor(void) const;
private:
boost::uint16_t _rev; //internal representation
@@ -79,11 +97,21 @@ namespace uhd{ namespace usrp{
/*!
* Comparator operator overloaded for mboard rev.
* The boost::equality_comparable provides the !=.
- * \param lhs the dboard id to the left of the operator
- * \param rhs the dboard id to the right of the operator
+ * \param lhs the mboard rev to the left of the operator
+ * \param rhs the mboard rev to the right of the operator
* \return true when the mboard revs are equal
*/
UHD_API bool operator==(const mboard_rev_t &lhs, const mboard_rev_t &rhs);
+
+ /*!
+ * Comparator operator overloaded for mboard rev.
+ * The boost::less_than_comparable provides the >, <=, >=.
+ * \param lhs the mboard rev to the left of the operator
+ * \param rhs the mboard rev to the right of the operator
+ * \return true when lhs < rhs
+ */
+
+ UHD_API bool operator<(const mboard_rev_t &lhs, const mboard_rev_t &rhs);
}} //namespace
diff --git a/host/lib/usrp/CMakeLists.txt b/host/lib/usrp/CMakeLists.txt
index 69a190bfa..fd4eb1016 100644
--- a/host/lib/usrp/CMakeLists.txt
+++ b/host/lib/usrp/CMakeLists.txt
@@ -23,6 +23,7 @@ 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/mimo_usrp.cpp
${CMAKE_SOURCE_DIR}/lib/usrp/misc_utils.cpp
${CMAKE_SOURCE_DIR}/lib/usrp/simple_usrp.cpp
diff --git a/host/lib/usrp/mboard_rev.cpp b/host/lib/usrp/mboard_rev.cpp
index 8206d12af..41600951f 100644
--- a/host/lib/usrp/mboard_rev.cpp
+++ b/host/lib/usrp/mboard_rev.cpp
@@ -23,7 +23,9 @@
using namespace uhd::usrp;
-mboard_rev_t::mboard_rev_t(boost::uint16_t id){
+static const mboard_rev_t usrp2p_first_hw_rev = mboard_rev_t(0x0A00);
+
+mboard_rev_t::mboard_rev_t(boost::uint16_t rev){
_rev = rev;
}
@@ -60,9 +62,30 @@ std::string mboard_rev_t::to_string(void) const{
return str(boost::format("0x%04x") % this->to_uint16());
}
-//Note: to_pp_string is implemented in the dboard manager
-//because it needs access to the dboard registration table
+std::string mboard_rev_t::to_pp_string(void) const{
+ if(this->is_usrp2p()) {
+ return str(boost::format("USRP2+, major rev %i, minor rev %i") % int(this->major()) % int(this->minor()));
+ } else {
+ return str(boost::format("USRP2, major rev %i, minor rev %i") % int(this->major()) % int(this->minor()));
+ }
+}
+
+bool mboard_rev_t::is_usrp2p(void) const{
+ return _rev >= usrp2p_first_hw_rev;
+}
+
+boost::uint8_t mboard_rev_t::major(void) const{
+ return _rev >> 8;
+}
+
+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){
return lhs.to_uint16() == rhs.to_uint16();
}
+
+bool uhd::usrp::operator<(const mboard_rev_t &lhs, const mboard_rev_t &rhs){
+ return lhs.to_uint16() < rhs.to_uint16();
+}
diff --git a/host/lib/usrp/usrp2/clock_ctrl.cpp b/host/lib/usrp/usrp2/clock_ctrl.cpp
index 8887faf12..c652b592b 100644
--- a/host/lib/usrp/usrp2/clock_ctrl.cpp
+++ b/host/lib/usrp/usrp2/clock_ctrl.cpp
@@ -32,7 +32,8 @@ using namespace uhd;
class usrp2_clock_ctrl_impl : public usrp2_clock_ctrl{
public:
usrp2_clock_ctrl_impl(usrp2_iface::sptr iface){
- clk_regs = usrp2_clk_regs_t(iface->get_hw_rev());
+ _iface = iface;
+ clk_regs = usrp2_clk_regs_t(_iface->get_hw_rev());
_ad9510_regs.cp_current_setting = ad9510_regs_t::CP_CURRENT_SETTING_3_0MA;
this->write_reg(clk_regs.pll_3);
@@ -123,6 +124,7 @@ public:
break;
default:
+ break;
}
this->write_reg(clk_regs.output(clk_regs.exp));
this->write_reg(clk_regs.div_lo(clk_regs.exp));
@@ -296,6 +298,8 @@ private:
this->write_reg(clk_regs.div_hi(clk_regs.adc));
this->update_regs();
}
+
+ usrp2_iface::sptr _iface;
usrp2_clk_regs_t clk_regs;
ad9510_regs_t _ad9510_regs;
diff --git a/host/lib/usrp/usrp2/codec_ctrl.cpp b/host/lib/usrp/usrp2/codec_ctrl.cpp
index 22a892f02..533534bd0 100644
--- a/host/lib/usrp/usrp2/codec_ctrl.cpp
+++ b/host/lib/usrp/usrp2/codec_ctrl.cpp
@@ -59,7 +59,7 @@ public:
}
//power-up adc
- if(_iface->get_hw_rev() < USRP2P_FIRST_HW_REV) { //if we're on a USRP2
+ if(!_iface->get_hw_rev().is_usrp2p()) { //if we're on a USRP2
_iface->poke32(_iface->regs.misc_ctrl_adc, U2_FLAG_MISC_CTRL_ADC_ON);
} else { //we're on a USRP2+
_ads62p44_regs.reset = 1;
@@ -77,7 +77,7 @@ public:
this->send_ad9777_reg(0);
//power-down adc
- if(_iface->get_hw_rev() < USRP2P_FIRST_HW_REV) { //if we're on a USRP2
+ if(!_iface->get_hw_rev().is_usrp2p()) { //if we're on a USRP2
_iface->poke32(_iface->regs.misc_ctrl_adc, U2_FLAG_MISC_CTRL_ADC_OFF);
} else { //we're on a USRP2+
//send a global power-down to the ADC here... it will get lifted on reset
@@ -87,21 +87,21 @@ public:
}
void set_rx_digital_gain(float gain) { //fine digital gain
- if(_iface->get_hw_rev() >= USRP2P_FIRST_HW_REV) {
+ if(_iface->get_hw_rev().is_usrp2p()) {
_ads62p44_regs.fine_gain = int(gain/0.5);
this->send_ads62p44_reg(0x17);
} else UHD_THROW_INVALID_CODE_PATH(); //should never have been called for USRP2
}
void set_rx_digital_fine_gain(float gain) { //gain correction
- if(_iface->get_hw_rev() >= USRP2P_FIRST_HW_REV) {
+ if(_iface->get_hw_rev().is_usrp2p()) {
_ads62p44_regs.gain_correction = int(gain / 0.05);
this->send_ads62p44_reg(0x1A);
} else UHD_THROW_INVALID_CODE_PATH(); //should never have been called for USRP2
}
void set_rx_analog_gain(bool gain) { //turns on/off analog 3.5dB preamp
- if(_iface->get_hw_rev() >= USRP2P_FIRST_HW_REV) {
+ if(_iface->get_hw_rev().is_usrp2p()) {
_ads62p44_regs.coarse_gain = gain ? ads62p44_regs_t::COARSE_GAIN_3_5DB : ads62p44_regs_t::COARSE_GAIN_0DB;
this->send_ads62p44_reg(0x14);
} else UHD_THROW_INVALID_CODE_PATH();
diff --git a/host/lib/usrp/usrp2/codec_impl.cpp b/host/lib/usrp/usrp2/codec_impl.cpp
index 04a11d922..6065b6c28 100644
--- a/host/lib/usrp/usrp2/codec_impl.cpp
+++ b/host/lib/usrp/usrp2/codec_impl.cpp
@@ -67,7 +67,7 @@ void usrp2_mboard_impl::rx_codec_get(const wax::obj &key_, wax::obj &val){
return;
case CODEC_PROP_GAIN_NAMES:
- if(_iface->get_hw_rev().to_uint16() >= USRP2P_FIRST_HW_REV) {
+ if(_iface->get_hw_rev().is_usrp2p()) {
val = prop_names_t(codec_rx_gain_ranges.keys());
} else val = prop_names_t();
return;
@@ -94,7 +94,7 @@ void usrp2_mboard_impl::rx_codec_set(const wax::obj &key_, const wax::obj &val){
switch(key.as<codec_prop_t>()) {
case CODEC_PROP_GAIN_I:
case CODEC_PROP_GAIN_Q:
- if(_iface->get_hw_rev().to_uint16() < USRP2P_FIRST_HW_REV) UHD_THROW_PROP_SET_ERROR();//this capability is only found in USRP2P
+ if(!_iface->get_hw_rev().is_usrp2p()) UHD_THROW_PROP_SET_ERROR();//this capability is only found in USRP2P
gain = val.as<float>();
this->rx_codec_set_gain(gain, key.name);
diff --git a/host/lib/usrp/usrp2/mboard_impl.cpp b/host/lib/usrp/usrp2/mboard_impl.cpp
index 6ee6d03a1..3a7048cdd 100644
--- a/host/lib/usrp/usrp2/mboard_impl.cpp
+++ b/host/lib/usrp/usrp2/mboard_impl.cpp
@@ -51,7 +51,7 @@ usrp2_mboard_impl::usrp2_mboard_impl(
//extract the mboard rev numbers
byte_vector_t rev_bytes = _iface->read_eeprom(USRP2_I2C_ADDR_MBOARD, USRP2_EE_MBOARD_REV, 2);
- _iface->set_hw_rev(mboard_rev_t::from_uint16(rev_bytes.at(0) | (revbytes.at(1) << 8)));
+ _iface->set_hw_rev(mboard_rev_t::from_uint16(rev_bytes.at(0) | (rev_bytes.at(1) << 8)));
//contruct the interfaces to mboard perifs
_clock_ctrl = usrp2_clock_ctrl::make(_iface);
@@ -158,7 +158,7 @@ void usrp2_mboard_impl::update_clock_config(void){
_iface->poke32(_iface->regs.time64_flags, pps_flags);
//clock source ref 10mhz
- if(_iface->get_hw_rev() >= USRP2P_FIRST_HW_REV) {
+ if(_iface->get_hw_rev().is_usrp2p()) {
switch(_clock_config.ref_source){
case clock_config_t::REF_INT : _iface->poke32(_iface->regs.misc_ctrl_clock, 0x12); break;
case clock_config_t::REF_SMA : _iface->poke32(_iface->regs.misc_ctrl_clock, 0x1C); break;
@@ -176,7 +176,7 @@ void usrp2_mboard_impl::update_clock_config(void){
//clock source ref 10mhz
bool use_external = (_clock_config.ref_source != clock_config_t::REF_INT)
- || (_iface->get_hw_rev() >= USRP2P_FIRST_HW_REV); //USRP2P has an internal 10MHz TCXO
+ || (_iface->get_hw_rev().is_usrp2p()); //USRP2P has an internal 10MHz TCXO
_clock_ctrl->enable_external_ref(use_external);
}
@@ -224,10 +224,11 @@ void usrp2_mboard_impl::get(const wax::obj &key_, wax::obj &val){
}
if (key.as<std::string>() == "hw-rev"){
- //extract the mboard rev numbers
+ //extract the mboard rev number
val = _iface->get_hw_rev().to_string();
return;
}
+ }
//handle the get request conditioned on the key
switch(key.as<mboard_prop_t>()){
@@ -327,12 +328,13 @@ void usrp2_mboard_impl::set(const wax::obj &key, const wax::obj &val){
if (key.as<std::string>() == "hw-rev"){
mboard_rev_t rev = mboard_rev_t::from_string(val.as<std::string>());
- byte_vector_t revbytes(2);
- revbytes(1) = rev.to_uint16() >> 8;
- revbytes(0) = rev.to_uint16() & 0xff;
- _iface->write_eeprom(USRP2_I2C_ADDR_MBOARD, USRP2_EE_MBOARD_REV, revbytes);
+ byte_vector_t rev_bytes(2);
+ rev_bytes[1] = rev.to_uint16() >> 8;
+ rev_bytes[0] = rev.to_uint16() & 0xff;
+ _iface->write_eeprom(USRP2_I2C_ADDR_MBOARD, USRP2_EE_MBOARD_REV, rev_bytes);
_iface->set_hw_rev(rev); //so the iface knows what rev it is
return;
+ }
}
//handle the set request conditioned on the key
diff --git a/host/lib/usrp/usrp2/usrp2_iface.cpp b/host/lib/usrp/usrp2/usrp2_iface.cpp
index 7ce5cc936..bce859629 100644
--- a/host/lib/usrp/usrp2/usrp2_iface.cpp
+++ b/host/lib/usrp/usrp2/usrp2_iface.cpp
@@ -260,12 +260,12 @@ public:
/***********************************************************************
* Get/set hardware revision
**********************************************************************/
- void set_hw_rev(mboard_rev_t rev) {
+ void set_hw_rev(uhd::usrp::mboard_rev_t rev) {
hw_rev = rev;
regs = usrp2_get_regs(rev); //might be a better place to do this
}
- mboard_rev_t get_hw_rev(void) {
+ uhd::usrp::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 fe2687d02..53a8e4bc8 100644
--- a/host/lib/usrp/usrp2/usrp2_iface.hpp
+++ b/host/lib/usrp/usrp2/usrp2_iface.hpp
@@ -23,6 +23,7 @@
#include <boost/shared_ptr.hpp>
#include <boost/utility.hpp>
#include <boost/cstdint.hpp>
+#include <uhd/usrp/mboard_rev.hpp>
#include <utility>
#include "fw_common.h"
#include "usrp2_regs.hpp"
diff --git a/host/lib/usrp/usrp2/usrp2_regs.cpp b/host/lib/usrp/usrp2/usrp2_regs.cpp
index 49f077221..f9b54b76e 100644
--- a/host/lib/usrp/usrp2/usrp2_regs.cpp
+++ b/host/lib/usrp/usrp2/usrp2_regs.cpp
@@ -15,19 +15,20 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
+#include <uhd/usrp/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(int hw_rev) {
+usrp2_regs_t usrp2_get_regs(uhd::usrp::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>=USRP2P_FIRST_HW_REV) ? USRP2P_MISC_OUTPUT_BASE : USRP2_MISC_OUTPUT_BASE,
- gpio_base = (hw_rev>=USRP2P_FIRST_HW_REV) ? USRP2P_GPIO_BASE : USRP2_GPIO_BASE,
- atr_base = (hw_rev>=USRP2P_FIRST_HW_REV) ? USRP2P_ATR_BASE : USRP2_ATR_BASE,
- bp_base = (hw_rev>=USRP2P_FIRST_HW_REV) ? USRP2P_BP_STATUS_BASE : USRP2_BP_STATUS_BASE;
+ const int misc_output_base = (hw_rev.is_usrp2p()) ? USRP2P_MISC_OUTPUT_BASE : USRP2_MISC_OUTPUT_BASE,
+ gpio_base = (hw_rev.is_usrp2p()) ? USRP2P_GPIO_BASE : USRP2_GPIO_BASE,
+ atr_base = (hw_rev.is_usrp2p()) ? USRP2P_ATR_BASE : USRP2_ATR_BASE,
+ bp_base = (hw_rev.is_usrp2p()) ? USRP2P_BP_STATUS_BASE : USRP2_BP_STATUS_BASE;
usrp2_regs_t x;
x.sr_misc = 0;
diff --git a/host/lib/usrp/usrp2/usrp2_regs.hpp b/host/lib/usrp/usrp2/usrp2_regs.hpp
index 8dae843ab..bb15ed496 100644
--- a/host/lib/usrp/usrp2/usrp2_regs.hpp
+++ b/host/lib/usrp/usrp2/usrp2_regs.hpp
@@ -18,6 +18,8 @@
#ifndef INCLUDED_USRP2_REGS_HPP
#define INCLUDED_USRP2_REGS_HPP
+#include <uhd/usrp/mboard_rev.hpp>
+
#define USRP2_MISC_OUTPUT_BASE 0xD400
#define USRP2_GPIO_BASE 0xC800
#define USRP2_ATR_BASE 0xE400
@@ -28,7 +30,7 @@
#define USRP2P_ATR_BASE 0x3800
#define USRP2P_BP_STATUS_BASE 0x3300
-#define USRP2P_FIRST_HW_REV 0x0A00
+const uhd::usrp::mboard_rev_t USRP2P_FIRST_HW_REV(0x0A00);
typedef struct {
int sr_misc;
@@ -101,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(int hw_rev);
+usrp2_regs_t usrp2_get_regs(uhd::usrp::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 a95864ca7..083c7629c 100644
--- a/host/utils/CMakeLists.txt
+++ b/host/utils/CMakeLists.txt
@@ -45,6 +45,9 @@ 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
new file mode 100644
index 000000000..59b072d17
--- /dev/null
+++ b/host/utils/usrp2_burn_mb_rev.cpp
@@ -0,0 +1,82 @@
+//
+// 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;
+}