aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/mboard_rev.cpp
diff options
context:
space:
mode:
authorNick Foster <nick@nerdnetworks.org>2010-10-12 16:26:19 -0700
committerNick Foster <nick@nerdnetworks.org>2010-10-12 16:26:19 -0700
commit5b4cbfe4616492d96ad1b48578cf2d94e1216bf4 (patch)
tree67d843278ead59b2e85725b3dbc3de80562d9ccd /host/lib/usrp/mboard_rev.cpp
parent5982ec4ee2c6f9efca1c5068e42dc38b822df7dc (diff)
downloaduhd-5b4cbfe4616492d96ad1b48578cf2d94e1216bf4.tar.gz
uhd-5b4cbfe4616492d96ad1b48578cf2d94e1216bf4.tar.bz2
uhd-5b4cbfe4616492d96ad1b48578cf2d94e1216bf4.zip
USRP2P: mboard rev works through props interface.
Added usrp2_burn_mb_rev.cpp to utils. It is not installed to the utils install dir. Not all happy with the mboard_rev setup -- is_usrp2p() is too specific for a generalized mboard_rev concept. I'm not sure where else to put it so for now it stays.
Diffstat (limited to 'host/lib/usrp/mboard_rev.cpp')
-rw-r--r--host/lib/usrp/mboard_rev.cpp29
1 files changed, 26 insertions, 3 deletions
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();
+}