aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib
diff options
context:
space:
mode:
authorJulian Arnold <julian.arnold@ettus.com>2014-12-16 12:08:56 -0800
committerJulian Arnold <julian.arnold@ettus.com>2015-01-12 15:39:13 -0800
commit23729861a2020359b9c920347bd2d7c43d96ebf8 (patch)
tree5ad559dc2eb24683298e8a67396c7aded0227760 /host/lib
parent6a98b4e67c6af0e3a17135a41c3c7bfdf62f4892 (diff)
downloaduhd-23729861a2020359b9c920347bd2d7c43d96ebf8.tar.gz
uhd-23729861a2020359b9c920347bd2d7c43d96ebf8.tar.bz2
uhd-23729861a2020359b9c920347bd2d7c43d96ebf8.zip
e300: rssi sensor network support
Diffstat (limited to 'host/lib')
-rw-r--r--host/lib/usrp/e300/e300_impl.cpp5
-rw-r--r--host/lib/usrp/e300/e300_network.cpp3
-rw-r--r--host/lib/usrp/e300/e300_remote_codec_ctrl.cpp14
-rw-r--r--host/lib/usrp/e300/e300_remote_codec_ctrl.hpp2
4 files changed, 22 insertions, 2 deletions
diff --git a/host/lib/usrp/e300/e300_impl.cpp b/host/lib/usrp/e300/e300_impl.cpp
index e42ac390e..59788fbea 100644
--- a/host/lib/usrp/e300/e300_impl.cpp
+++ b/host/lib/usrp/e300/e300_impl.cpp
@@ -1097,14 +1097,15 @@ void e300_impl::_setup_radio(const size_t dspno)
_tree->create<meta_range_t>(rf_fe_path / "freq" / "range")
.publish(boost::bind(&ad9361_ctrl::get_rf_freq_range));
- //setup antenna stuff
+ //setup RX related stuff
if (key[0] == 'R') {
static const std::vector<std::string> ants = boost::assign::list_of("TX/RX")("RX2");
_tree->create<std::vector<std::string> >(rf_fe_path / "antenna" / "options").set(ants);
_tree->create<std::string>(rf_fe_path / "antenna" / "value")
.subscribe(boost::bind(&e300_impl::_update_antenna_sel, this, dspno, _1))
.set("RX2");
-
+ _tree->create<sensor_value_t>(rf_fe_path / "sensors" / "rssi")
+ .publish(boost::bind(&ad9361_ctrl::get_rssi, _codec_ctrl, key));
}
if (key[0] == 'T') {
static const std::vector<std::string> ants(1, "TX/RX");
diff --git a/host/lib/usrp/e300/e300_network.cpp b/host/lib/usrp/e300/e300_network.cpp
index 883ff0c4f..6d36d8681 100644
--- a/host/lib/usrp/e300/e300_network.cpp
+++ b/host/lib/usrp/e300/e300_network.cpp
@@ -224,6 +224,9 @@ static void e300_codec_ctrl_tunnel(
_codec_ctrl->data_port_loopback(
uhd::ntohx<boost::uint32_t>(in->bits) & 1);
break;
+ case codec_xact_t::ACTION_GET_RSSI:
+ out->rssi = _codec_ctrl->get_rssi(which_str).to_real();
+ break;
default:
UHD_MSG(status) << "Got unknown request?!" << std::endl;
//Zero out actions to fail this request on client
diff --git a/host/lib/usrp/e300/e300_remote_codec_ctrl.cpp b/host/lib/usrp/e300/e300_remote_codec_ctrl.cpp
index bcc8ee4cf..ed8131e2f 100644
--- a/host/lib/usrp/e300/e300_remote_codec_ctrl.cpp
+++ b/host/lib/usrp/e300/e300_remote_codec_ctrl.cpp
@@ -106,6 +106,20 @@ public:
_transact();
}
+ sensor_value_t get_rssi(const std::string &which)
+ {
+ _clear();
+ _args.action = uhd::htonx<boost::uint32_t>(transaction_t::ACTION_GET_RSSI);
+ if (which == "RX1") _args.which = uhd::htonx<boost::uint32_t>(transaction_t::CHAIN_RX1);
+ else if (which == "RX2") _args.which = uhd::htonx<boost::uint32_t>(transaction_t::CHAIN_RX2);
+ else throw std::runtime_error("e300_remote_codec_ctrl_impl incorrect chain string.");
+ _args.bits = uhd::htonx<boost::uint32_t>(0);
+
+ _transact();
+
+ return sensor_value_t("RSSI", _retval.rssi, "dB");
+ }
+
private:
void _transact() {
{
diff --git a/host/lib/usrp/e300/e300_remote_codec_ctrl.hpp b/host/lib/usrp/e300/e300_remote_codec_ctrl.hpp
index 015ad8323..cbc4b52d2 100644
--- a/host/lib/usrp/e300/e300_remote_codec_ctrl.hpp
+++ b/host/lib/usrp/e300/e300_remote_codec_ctrl.hpp
@@ -33,6 +33,7 @@ public:
double rate;
double gain;
double freq;
+ double rssi;
boost::uint64_t bits;
};
@@ -42,6 +43,7 @@ public:
static const boost::uint32_t ACTION_SET_ACTIVE_CHANS = 12;
static const boost::uint32_t ACTION_TUNE = 13;
static const boost::uint32_t ACTION_SET_LOOPBACK = 14;
+ static const boost::uint32_t ACTION_GET_RSSI = 15;
//Values for "which"
static const boost::uint32_t CHAIN_NONE = 0;