aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib
diff options
context:
space:
mode:
authorNicholas Corgan <nick.corgan@ettus.com>2012-04-04 17:03:35 -0700
committerJosh Blum <josh@joshknows.com>2012-04-04 17:12:12 -0700
commitcf959252c0813729ca4db68dc1467319b15dae0c (patch)
treebe3b73bb2b3fdc3eeec32d507ec44616072c3e2b /host/lib
parent51c81a39cc15ac221376e5acc4eceb572e0467f9 (diff)
downloaduhd-cf959252c0813729ca4db68dc1467319b15dae0c.tar.gz
uhd-cf959252c0813729ca4db68dc1467319b15dae0c.tar.bz2
uhd-cf959252c0813729ca4db68dc1467319b15dae0c.zip
lib: multi_usrp can now output motherboard and daughterboard data in a dictionary form
Diffstat (limited to 'host/lib')
-rw-r--r--host/lib/usrp/multi_usrp.cpp52
1 files changed, 47 insertions, 5 deletions
diff --git a/host/lib/usrp/multi_usrp.cpp b/host/lib/usrp/multi_usrp.cpp
index 42c654e6b..37479573a 100644
--- a/host/lib/usrp/multi_usrp.cpp
+++ b/host/lib/usrp/multi_usrp.cpp
@@ -1,5 +1,5 @@
//
-// Copyright 2010-2011 Ettus Research LLC
+// Copyright 2010-2012 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
@@ -21,6 +21,10 @@
#include <uhd/exception.hpp>
#include <uhd/utils/msg.hpp>
#include <uhd/utils/gain_group.hpp>
+#include <uhd/usrp/dboard_id.hpp>
+#include <uhd/usrp/mboard_eeprom.hpp>
+#include <uhd/usrp/dboard_eeprom.hpp>
+#include <boost/assign/list_of.hpp>
#include <boost/thread.hpp>
#include <boost/foreach.hpp>
#include <boost/format.hpp>
@@ -214,6 +218,44 @@ public:
return _dev;
}
+ dict<std::string, std::string> get_usrp_rx_info(size_t chan){
+ mboard_chan_pair mcp = rx_chan_to_mcp(chan);
+ dict<std::string, std::string> usrp_info;
+
+ mboard_eeprom_t mb_eeprom = _tree->access<mboard_eeprom_t>(mb_root(mcp.mboard) / "eeprom").get();
+ dboard_eeprom_t db_eeprom = _tree->access<dboard_eeprom_t>(rx_rf_fe_root(mcp.chan).branch_path().branch_path() / "rx_eeprom").get();
+
+ usrp_info["mboard_id"] = _tree->access<std::string>(mb_root(mcp.mboard) / "name").get();
+ usrp_info["mboard_name"] = mb_eeprom["name"];
+ usrp_info["mboard_serial"] = mb_eeprom["serial"];
+ usrp_info["rx_id"] = db_eeprom.id.to_pp_string();
+ usrp_info["rx_subdev_name"] = _tree->access<std::string>(rx_rf_fe_root(chan) / "name").get();
+ usrp_info["rx_serial"] = db_eeprom.serial;
+
+ return usrp_info;
+ }
+
+ dict<std::string, std::string> get_usrp_tx_info(size_t chan){
+ mboard_chan_pair mcp = tx_chan_to_mcp(chan);
+ dict<std::string, std::string> usrp_info;
+
+ mboard_eeprom_t mb_eeprom = _tree->access<mboard_eeprom_t>(mb_root(mcp.mboard) / "eeprom").get();
+ dboard_eeprom_t gdb_eeprom = _tree->access<dboard_eeprom_t>(tx_rf_fe_root(mcp.chan).branch_path().branch_path() / "gdb_eeprom").get();
+ dboard_eeprom_t db_eeprom;
+
+ if(gdb_eeprom.id != dboard_id_t::none()) db_eeprom = gdb_eeprom;
+ else db_eeprom = _tree->access<dboard_eeprom_t>(tx_rf_fe_root(mcp.chan).branch_path().branch_path() / "tx_eeprom").get();
+
+ usrp_info["mboard_id"] = _tree->access<std::string>(mb_root(mcp.mboard) / "name").get();
+ usrp_info["mboard_name"] = mb_eeprom["name"];
+ usrp_info["mboard_serial"] = mb_eeprom["serial"];
+ usrp_info["tx_id"] = db_eeprom.id.to_pp_string();
+ usrp_info["tx_subdev_name"] = _tree->access<std::string>(tx_rf_fe_root(mcp.chan) / "name").get();
+ usrp_info["tx_serial"] = db_eeprom.serial;
+
+ return usrp_info;
+ }
+
/*******************************************************************
* Mboard methods
******************************************************************/
@@ -621,10 +663,6 @@ public:
return _tree->access<subdev_spec_t>(mb_root(mboard) / "tx_subdev_spec").get();
}
- std::string get_tx_subdev_name(size_t chan){
- return _tree->access<std::string>(tx_rf_fe_root(chan) / "name").get();
- }
-
size_t get_tx_num_channels(void){
size_t sum = 0;
for (size_t m = 0; m < get_num_mboards(); m++){
@@ -633,6 +671,10 @@ public:
return sum;
}
+ std::string get_tx_subdev_name(size_t chan){
+ return _tree->access<std::string>(tx_rf_fe_root(chan) / "name").get();
+ }
+
void set_tx_rate(double rate, size_t chan){
if (chan != ALL_CHANS){
_tree->access<double>(tx_dsp_root(chan) / "rate" / "value").set(rate);