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 From 5a6788525488e747cb0453282d8b0ebb533204bc Mon Sep 17 00:00:00 2001 From: Nicholas Corgan Date: Thu, 5 Apr 2012 10:40:07 -0700 Subject: multi_usrp: added subdev spec and antenna to get_usrp_info functions --- host/lib/usrp/multi_usrp.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'host/lib') diff --git a/host/lib/usrp/multi_usrp.cpp b/host/lib/usrp/multi_usrp.cpp index 37479573a..05dc8b4bb 100644 --- a/host/lib/usrp/multi_usrp.cpp +++ b/host/lib/usrp/multi_usrp.cpp @@ -229,8 +229,10 @@ public: 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_subdev_name"] = _tree->access(rx_rf_fe_root(mcp.chan) / "name").get(); + usrp_info["rx_subdev_spec"] = _tree->access(mb_root(mcp.mboard) / "rx_subdev_spec").get().to_string(); usrp_info["rx_serial"] = db_eeprom.serial; + usrp_info["rx_antenna"] = _tree->access(rx_rf_fe_root(mcp.chan) / "antenna" / "value").get(); return usrp_info; } @@ -251,7 +253,9 @@ public: 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_subdev_spec"] = _tree->access(mb_root(mcp.mboard) / "tx_subdev_spec").get().to_string(); usrp_info["tx_serial"] = db_eeprom.serial; + usrp_infi["tx_antenna"] = _tree->access(tx_rf_fe_root(mcp.chan) / "antenna" / "value").get(); return usrp_info; } -- cgit v1.2.3 From e59bad03bb12887d1719508709de218525f132fe Mon Sep 17 00:00:00 2001 From: Nicholas Corgan Date: Thu, 5 Apr 2012 11:18:23 -0700 Subject: multi_usrp: added subdev spec and antenna to get_usrp_info functions --- host/lib/usrp/multi_usrp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'host/lib') diff --git a/host/lib/usrp/multi_usrp.cpp b/host/lib/usrp/multi_usrp.cpp index 05dc8b4bb..c6ff9d437 100644 --- a/host/lib/usrp/multi_usrp.cpp +++ b/host/lib/usrp/multi_usrp.cpp @@ -255,7 +255,7 @@ public: usrp_info["tx_subdev_name"] = _tree->access(tx_rf_fe_root(mcp.chan) / "name").get(); usrp_info["tx_subdev_spec"] = _tree->access(mb_root(mcp.mboard) / "tx_subdev_spec").get().to_string(); usrp_info["tx_serial"] = db_eeprom.serial; - usrp_infi["tx_antenna"] = _tree->access(tx_rf_fe_root(mcp.chan) / "antenna" / "value").get(); + usrp_info["tx_antenna"] = _tree->access(tx_rf_fe_root(mcp.chan) / "antenna" / "value").get(); return usrp_info; } -- cgit v1.2.3 From c8a2e4881f06212be7e10227220ebac33987143b Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Fri, 6 Apr 2012 12:07:15 -0700 Subject: usrp: fix set_clock_config typo for external and mimo clock ref This is a typo in the set_clock_config implementation. However, the enum values are the same, so this would not cause a bug. Fixed although set_clock_config is a deprecated interface. --- host/lib/usrp/multi_usrp.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'host/lib') diff --git a/host/lib/usrp/multi_usrp.cpp b/host/lib/usrp/multi_usrp.cpp index 42c654e6b..93c0eada6 100644 --- a/host/lib/usrp/multi_usrp.cpp +++ b/host/lib/usrp/multi_usrp.cpp @@ -379,8 +379,8 @@ public: std::string clock_source; switch(clock_config.ref_source){ case clock_config_t::REF_INT: clock_source = "internal"; break; - case clock_config_t::PPS_SMA: clock_source = "external"; break; - case clock_config_t::PPS_MIMO: clock_source = "mimo"; break; + case clock_config_t::REF_SMA: clock_source = "external"; break; + case clock_config_t::REF_MIMO: clock_source = "mimo"; break; default: clock_source = "unknown"; } this->set_clock_source(clock_source, mboard); -- cgit v1.2.3 From 00c241844a62c22cac538316d507c524acc1c393 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 9 Apr 2012 14:28:25 -0700 Subject: dsp: clear register now overlaps with numchan register. This fixes the bug of unwanted clearing when setting format. --- host/lib/usrp/cores/rx_dsp_core_200.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'host/lib') diff --git a/host/lib/usrp/cores/rx_dsp_core_200.cpp b/host/lib/usrp/cores/rx_dsp_core_200.cpp index 4b60f111c..cf8db1927 100644 --- a/host/lib/usrp/cores/rx_dsp_core_200.cpp +++ b/host/lib/usrp/cores/rx_dsp_core_200.cpp @@ -38,13 +38,12 @@ #define REG_RX_CTRL_STREAM_CMD _ctrl_base + 0 #define REG_RX_CTRL_TIME_HI _ctrl_base + 4 #define REG_RX_CTRL_TIME_LO _ctrl_base + 8 -#define REG_RX_CTRL_CLEAR _ctrl_base + 12 +#define REG_RX_CTRL_FORMAT _ctrl_base + 12 #define REG_RX_CTRL_VRT_HDR _ctrl_base + 16 #define REG_RX_CTRL_VRT_SID _ctrl_base + 20 #define REG_RX_CTRL_VRT_TLR _ctrl_base + 24 #define REG_RX_CTRL_NSAMPS_PP _ctrl_base + 28 #define REG_RX_CTRL_NCHANNELS _ctrl_base + 32 -#define REG_RX_CTRL_FORMAT REG_RX_CTRL_CLEAR //re-use clear address template T ceil_log2(T num){ return std::ceil(std::log(num)/std::log(T(2))); @@ -78,8 +77,7 @@ public: } void clear(void){ - _iface->poke32(REG_RX_CTRL_CLEAR, 1); //reset - _iface->poke32(REG_RX_CTRL_NCHANNELS, 1); + _iface->poke32(REG_RX_CTRL_NCHANNELS, 1); //also reset _iface->poke32(REG_RX_CTRL_VRT_HDR, 0 | (0x1 << 28) //if data with stream id | (0x1 << 26) //has trailer -- cgit v1.2.3