From cf959252c0813729ca4db68dc1467319b15dae0c Mon Sep 17 00:00:00 2001 From: Nicholas Corgan Date: Wed, 4 Apr 2012 17:03:35 -0700 Subject: lib: multi_usrp can now output motherboard and daughterboard data in a dictionary form --- host/lib/usrp/multi_usrp.cpp | 52 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 47 insertions(+), 5 deletions(-) (limited to 'host/lib') 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 #include #include +#include +#include +#include +#include #include #include #include @@ -214,6 +218,44 @@ public: return _dev; } + dict get_usrp_rx_info(size_t chan){ + mboard_chan_pair mcp = rx_chan_to_mcp(chan); + dict usrp_info; + + mboard_eeprom_t mb_eeprom = _tree->access(mb_root(mcp.mboard) / "eeprom").get(); + dboard_eeprom_t db_eeprom = _tree->access(rx_rf_fe_root(mcp.chan).branch_path().branch_path() / "rx_eeprom").get(); + + usrp_info["mboard_id"] = _tree->access(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(rx_rf_fe_root(chan) / "name").get(); + usrp_info["rx_serial"] = db_eeprom.serial; + + return usrp_info; + } + + dict get_usrp_tx_info(size_t chan){ + mboard_chan_pair mcp = tx_chan_to_mcp(chan); + dict usrp_info; + + mboard_eeprom_t mb_eeprom = _tree->access(mb_root(mcp.mboard) / "eeprom").get(); + dboard_eeprom_t gdb_eeprom = _tree->access(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(tx_rf_fe_root(mcp.chan).branch_path().branch_path() / "tx_eeprom").get(); + + usrp_info["mboard_id"] = _tree->access(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(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(mb_root(mboard) / "tx_subdev_spec").get(); } - std::string get_tx_subdev_name(size_t chan){ - return _tree->access(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(tx_rf_fe_root(chan) / "name").get(); + } + void set_tx_rate(double rate, size_t chan){ if (chan != ALL_CHANS){ _tree->access(tx_dsp_root(chan) / "rate" / "value").set(rate); -- cgit v1.2.3