summaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-02-11 18:43:20 -0800
committerJosh Blum <josh@joshknows.com>2011-02-11 18:43:20 -0800
commit9de6f36bc5d9f5d9d602547166c92b53b278b428 (patch)
tree6ad2101b5c5e1051188067318dcd045fbd37834a /host
parente4b45cca1b99d92baab061d36b6c0ceaebdfe5b7 (diff)
downloaduhd-9de6f36bc5d9f5d9d602547166c92b53b278b428.tar.gz
uhd-9de6f36bc5d9f5d9d602547166c92b53b278b428.tar.bz2
uhd-9de6f36bc5d9f5d9d602547166c92b53b278b428.zip
usrp: implement sensors in all the dboards, deprecated read rssi and get lo locked
Diffstat (limited to 'host')
-rw-r--r--host/examples/rx_samples_to_file.cpp1
-rw-r--r--host/examples/rx_samples_to_udp.cpp1
-rw-r--r--host/include/uhd/usrp/multi_usrp.hpp13
-rw-r--r--host/include/uhd/usrp/subdev_props.hpp2
-rw-r--r--host/lib/usrp/dboard/db_basic_and_lf.cpp8
-rw-r--r--host/lib/usrp/dboard/db_dbsrx.cpp10
-rw-r--r--host/lib/usrp/dboard/db_dbsrx2.cpp10
-rw-r--r--host/lib/usrp/dboard/db_rfx.cpp19
-rw-r--r--host/lib/usrp/dboard/db_tvrx.cpp5
-rw-r--r--host/lib/usrp/dboard/db_unknown.cpp8
-rw-r--r--host/lib/usrp/dboard/db_wbx.cpp19
-rw-r--r--host/lib/usrp/dboard/db_xcvr2450.cpp25
-rw-r--r--host/lib/usrp/multi_usrp.cpp12
13 files changed, 76 insertions, 57 deletions
diff --git a/host/examples/rx_samples_to_file.cpp b/host/examples/rx_samples_to_file.cpp
index 296f480b0..e202fcb1c 100644
--- a/host/examples/rx_samples_to_file.cpp
+++ b/host/examples/rx_samples_to_file.cpp
@@ -78,7 +78,6 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
std::cout << boost::format("Actual RX Gain: %f dB...") % usrp->get_rx_gain() << std::endl << std::endl;
boost::this_thread::sleep(boost::posix_time::seconds(1)); //allow for some setup time
- std::cout << "LO Locked = " << usrp->get_rx_lo_locked() << std::endl;
//setup streaming
uhd::stream_cmd_t stream_cmd(uhd::stream_cmd_t::STREAM_MODE_NUM_SAMPS_AND_DONE);
diff --git a/host/examples/rx_samples_to_udp.cpp b/host/examples/rx_samples_to_udp.cpp
index 801d8e361..7ea775764 100644
--- a/host/examples/rx_samples_to_udp.cpp
+++ b/host/examples/rx_samples_to_udp.cpp
@@ -80,7 +80,6 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
std::cout << boost::format("Actual RX Gain: %f dB...") % usrp->get_rx_gain() << std::endl << std::endl;
boost::this_thread::sleep(boost::posix_time::seconds(1)); //allow for some setup time
- std::cout << "LO Locked = " << usrp->get_rx_lo_locked() << std::endl;
//setup streaming
uhd::stream_cmd_t stream_cmd(uhd::stream_cmd_t::STREAM_MODE_NUM_SAMPS_AND_DONE);
diff --git a/host/include/uhd/usrp/multi_usrp.hpp b/host/include/uhd/usrp/multi_usrp.hpp
index 28c1860d6..da52e6dce 100644
--- a/host/include/uhd/usrp/multi_usrp.hpp
+++ b/host/include/uhd/usrp/multi_usrp.hpp
@@ -28,6 +28,7 @@
#include <uhd/types/sensors.hpp>
#include <uhd/usrp/subdev_spec.hpp>
#include <uhd/usrp/dboard_iface.hpp>
+#include <boost/lexical_cast.hpp> //needed until deprecated routines removed
#include <boost/shared_ptr.hpp>
#include <boost/utility.hpp>
#include <vector>
@@ -393,7 +394,9 @@ public:
* \param chan the channel index 0 to N-1
* \return true for locked
*/
- virtual bool get_rx_lo_locked(size_t chan = 0) = 0;
+ UHD_DEPRECATED bool get_rx_lo_locked(size_t chan = 0){
+ return this->get_rx_sensor("lo_locked", chan).value == "true";
+ }
/*!
* Set the RX bandwidth on the subdevice.
@@ -415,7 +418,9 @@ public:
* \return the rssi in dB
* \throw exception if RSSI readback not supported
*/
- virtual double read_rssi(size_t chan = 0) = 0;
+ UHD_DEPRECATED double read_rssi(size_t chan = 0){
+ return boost::lexical_cast<double>(this->get_rx_sensor("rssi", chan).value);
+ }
/*!
* Get the dboard interface object for the RX subdevice.
@@ -587,7 +592,9 @@ public:
* \param chan the channel index 0 to N-1
* \return true for locked
*/
- virtual bool get_tx_lo_locked(size_t chan = 0) = 0;
+ UHD_DEPRECATED bool get_tx_lo_locked(size_t chan = 0){
+ return this->get_tx_sensor("lo_locked", chan).value == "true";
+ }
/*!
* Set the TX bandwidth on the subdevice.
diff --git a/host/include/uhd/usrp/subdev_props.hpp b/host/include/uhd/usrp/subdev_props.hpp
index 87628fadc..40b339703 100644
--- a/host/include/uhd/usrp/subdev_props.hpp
+++ b/host/include/uhd/usrp/subdev_props.hpp
@@ -53,11 +53,9 @@ namespace uhd{ namespace usrp{
SUBDEV_PROP_FREQ_RANGE, //ro, freq_range_t
SUBDEV_PROP_ANTENNA, //rw, std::string
SUBDEV_PROP_ANTENNA_NAMES, //ro, prop_names_t
- SUBDEV_PROP_LO_LOCKED, //ro, bool //TODO deprecate for sensors
SUBDEV_PROP_CONNECTION, //ro, subdev_conn_t
SUBDEV_PROP_ENABLED, //rw, bool
SUBDEV_PROP_USE_LO_OFFSET, //ro, bool
- SUBDEV_PROP_RSSI, //ro, double //TODO deprecate for sensors
SUBDEV_PROP_BANDWIDTH //rw, double
};
diff --git a/host/lib/usrp/dboard/db_basic_and_lf.cpp b/host/lib/usrp/dboard/db_basic_and_lf.cpp
index b311576d2..b319289db 100644
--- a/host/lib/usrp/dboard/db_basic_and_lf.cpp
+++ b/host/lib/usrp/dboard/db_basic_and_lf.cpp
@@ -173,10 +173,6 @@ void basic_rx::rx_get(const wax::obj &key_, wax::obj &val){
val = false;
return;
- case SUBDEV_PROP_LO_LOCKED:
- val = true; //there is no LO, so it must be true!
- return;
-
case SUBDEV_PROP_BANDWIDTH:
val = subdev_bandwidth_scalar[get_subdev_name()]*_max_freq;
return;
@@ -284,10 +280,6 @@ void basic_tx::tx_get(const wax::obj &key_, wax::obj &val){
val = false;
return;
- case SUBDEV_PROP_LO_LOCKED:
- val = true; //there is no LO, so it must be true!
- return;
-
case SUBDEV_PROP_BANDWIDTH:
val = subdev_bandwidth_scalar[get_subdev_name()]*_max_freq;
return;
diff --git a/host/lib/usrp/dboard/db_dbsrx.cpp b/host/lib/usrp/dboard/db_dbsrx.cpp
index 3ea9cea80..98d9479fc 100644
--- a/host/lib/usrp/dboard/db_dbsrx.cpp
+++ b/host/lib/usrp/dboard/db_dbsrx.cpp
@@ -25,6 +25,7 @@
#include <uhd/utils/algorithm.hpp>
#include <uhd/utils/warning.hpp>
#include <uhd/types/ranges.hpp>
+#include <uhd/types/sensors.hpp>
#include <uhd/types/dict.hpp>
#include <uhd/usrp/subdev_props.hpp>
#include <uhd/usrp/dboard_base.hpp>
@@ -561,8 +562,13 @@ void dbsrx::rx_get(const wax::obj &key_, wax::obj &val){
val = false;
return;
- case SUBDEV_PROP_LO_LOCKED:
- val = this->get_locked();
+ case SUBDEV_PROP_SENSOR:
+ UHD_ASSERT_THROW(key.name == "lo_locked");
+ val = sensor_value_t("LO", this->get_locked(), "locked", "unlocked");
+ return;
+
+ case SUBDEV_PROP_SENSOR_NAMES:
+ val = prop_names_t(1, "lo_locked");
return;
case SUBDEV_PROP_BANDWIDTH:
diff --git a/host/lib/usrp/dboard/db_dbsrx2.cpp b/host/lib/usrp/dboard/db_dbsrx2.cpp
index defb70ff5..f4b797995 100644
--- a/host/lib/usrp/dboard/db_dbsrx2.cpp
+++ b/host/lib/usrp/dboard/db_dbsrx2.cpp
@@ -22,6 +22,7 @@
#include <uhd/utils/assert.hpp>
#include <uhd/utils/algorithm.hpp>
#include <uhd/types/ranges.hpp>
+#include <uhd/types/sensors.hpp>
#include <uhd/types/dict.hpp>
#include <uhd/usrp/subdev_props.hpp>
#include <uhd/usrp/dboard_base.hpp>
@@ -400,8 +401,13 @@ void dbsrx2::rx_get(const wax::obj &key_, wax::obj &val){
val = false;
return;
- case SUBDEV_PROP_LO_LOCKED:
- val = this->get_locked();
+ case SUBDEV_PROP_SENSOR:
+ UHD_ASSERT_THROW(key.name == "lo_locked");
+ val = sensor_value_t("LO", this->get_locked(), "locked", "unlocked");
+ return;
+
+ case SUBDEV_PROP_SENSOR_NAMES:
+ val = prop_names_t(1, "lo_locked");
return;
case SUBDEV_PROP_BANDWIDTH:
diff --git a/host/lib/usrp/dboard/db_rfx.cpp b/host/lib/usrp/dboard/db_rfx.cpp
index cd25ee9b7..3b0c562ee 100644
--- a/host/lib/usrp/dboard/db_rfx.cpp
+++ b/host/lib/usrp/dboard/db_rfx.cpp
@@ -40,6 +40,7 @@
#include <uhd/types/dict.hpp>
#include <uhd/usrp/subdev_props.hpp>
#include <uhd/types/ranges.hpp>
+#include <uhd/types/sensors.hpp>
#include <uhd/utils/assert.hpp>
#include <uhd/utils/static.hpp>
#include <uhd/utils/algorithm.hpp>
@@ -451,8 +452,13 @@ void rfx_xcvr::rx_get(const wax::obj &key_, wax::obj &val){
val = false;
return;
- case SUBDEV_PROP_LO_LOCKED:
- val = this->get_locked(dboard_iface::UNIT_RX);
+ case SUBDEV_PROP_SENSOR:
+ UHD_ASSERT_THROW(key.name == "lo_locked");
+ val = sensor_value_t("LO", this->get_locked(dboard_iface::UNIT_RX), "locked", "unlocked");
+ return;
+
+ case SUBDEV_PROP_SENSOR_NAMES:
+ val = prop_names_t(1, "lo_locked");
return;
case SUBDEV_PROP_BANDWIDTH:
@@ -548,8 +554,13 @@ void rfx_xcvr::tx_get(const wax::obj &key_, wax::obj &val){
val = true;
return;
- case SUBDEV_PROP_LO_LOCKED:
- val = this->get_locked(dboard_iface::UNIT_TX);
+ case SUBDEV_PROP_SENSOR:
+ UHD_ASSERT_THROW(key.name == "lo_locked");
+ val = sensor_value_t("LO", this->get_locked(dboard_iface::UNIT_TX), "locked", "unlocked");
+ return;
+
+ case SUBDEV_PROP_SENSOR_NAMES:
+ val = prop_names_t(1, "lo_locked");
return;
case SUBDEV_PROP_BANDWIDTH:
diff --git a/host/lib/usrp/dboard/db_tvrx.cpp b/host/lib/usrp/dboard/db_tvrx.cpp
index a9ce38000..578999432 100644
--- a/host/lib/usrp/dboard/db_tvrx.cpp
+++ b/host/lib/usrp/dboard/db_tvrx.cpp
@@ -32,6 +32,7 @@
#include <uhd/utils/algorithm.hpp>
#include <uhd/utils/warning.hpp>
#include <uhd/types/ranges.hpp>
+#include <uhd/types/sensors.hpp>
#include <uhd/types/dict.hpp>
#include <uhd/usrp/subdev_props.hpp>
#include <uhd/usrp/dboard_base.hpp>
@@ -463,10 +464,6 @@ void tvrx::rx_get(const wax::obj &key_, wax::obj &val){
val = false;
return;
- case SUBDEV_PROP_LO_LOCKED:
- val = true;
- return;
-
case SUBDEV_PROP_BANDWIDTH:
val = 6.0e6;
return;
diff --git a/host/lib/usrp/dboard/db_unknown.cpp b/host/lib/usrp/dboard/db_unknown.cpp
index d91d58409..f0a4c000e 100644
--- a/host/lib/usrp/dboard/db_unknown.cpp
+++ b/host/lib/usrp/dboard/db_unknown.cpp
@@ -154,10 +154,6 @@ void unknown_rx::rx_get(const wax::obj &key_, wax::obj &val){
val = false;
return;
- case SUBDEV_PROP_LO_LOCKED:
- val = true; //there is no LO, so it must be true!
- return;
-
case SUBDEV_PROP_BANDWIDTH:
val = 0.0;
return;
@@ -256,10 +252,6 @@ void unknown_tx::tx_get(const wax::obj &key_, wax::obj &val){
val = false;
return;
- case SUBDEV_PROP_LO_LOCKED:
- val = true; //there is no LO, so it must be true!
- return;
-
case SUBDEV_PROP_BANDWIDTH:
val = 0.0;
return;
diff --git a/host/lib/usrp/dboard/db_wbx.cpp b/host/lib/usrp/dboard/db_wbx.cpp
index 135997789..0bc2d0ca1 100644
--- a/host/lib/usrp/dboard/db_wbx.cpp
+++ b/host/lib/usrp/dboard/db_wbx.cpp
@@ -68,6 +68,7 @@
#include <uhd/types/dict.hpp>
#include <uhd/usrp/subdev_props.hpp>
#include <uhd/types/ranges.hpp>
+#include <uhd/types/sensors.hpp>
#include <uhd/utils/assert.hpp>
#include <uhd/utils/static.hpp>
#include <uhd/utils/algorithm.hpp>
@@ -521,8 +522,13 @@ void wbx_xcvr::rx_get(const wax::obj &key_, wax::obj &val){
val = false;
return;
- case SUBDEV_PROP_LO_LOCKED:
- val = this->get_locked(dboard_iface::UNIT_RX);
+ case SUBDEV_PROP_SENSOR:
+ UHD_ASSERT_THROW(key.name == "lo_locked");
+ val = sensor_value_t("LO", this->get_locked(dboard_iface::UNIT_RX), "locked", "unlocked");
+ return;
+
+ case SUBDEV_PROP_SENSOR_NAMES:
+ val = prop_names_t(1, "lo_locked");
return;
case SUBDEV_PROP_BANDWIDTH:
@@ -622,8 +628,13 @@ void wbx_xcvr::tx_get(const wax::obj &key_, wax::obj &val){
val = false;
return;
- case SUBDEV_PROP_LO_LOCKED:
- val = this->get_locked(dboard_iface::UNIT_TX);
+ case SUBDEV_PROP_SENSOR:
+ UHD_ASSERT_THROW(key.name == "lo_locked");
+ val = sensor_value_t("LO", this->get_locked(dboard_iface::UNIT_TX), "locked", "unlocked");
+ return;
+
+ case SUBDEV_PROP_SENSOR_NAMES:
+ val = prop_names_t(1, "lo_locked");
return;
case SUBDEV_PROP_BANDWIDTH:
diff --git a/host/lib/usrp/dboard/db_xcvr2450.cpp b/host/lib/usrp/dboard/db_xcvr2450.cpp
index 6fb5a26a8..f4f74eb86 100644
--- a/host/lib/usrp/dboard/db_xcvr2450.cpp
+++ b/host/lib/usrp/dboard/db_xcvr2450.cpp
@@ -53,6 +53,7 @@
#include <uhd/utils/algorithm.hpp>
#include <uhd/utils/warning.hpp>
#include <uhd/types/ranges.hpp>
+#include <uhd/types/sensors.hpp>
#include <uhd/types/dict.hpp>
#include <uhd/usrp/subdev_props.hpp>
#include <uhd/usrp/dboard_base.hpp>
@@ -616,12 +617,19 @@ void xcvr2450::rx_get(const wax::obj &key_, wax::obj &val){
val = false;
return;
- case SUBDEV_PROP_LO_LOCKED:
- val = this->get_locked();
+ case SUBDEV_PROP_SENSOR:
+ if (key.name == "lo_locked")
+ val = sensor_value_t("LO", this->get_locked(), "locked", "unlocked");
+ else if (key.name == "rssi")
+ val = sensor_value_t("RSSI", this->get_rssi(), "dB");
+ else
+ UHD_THROW_INVALID_CODE_PATH();
return;
- case SUBDEV_PROP_RSSI:
- val = this->get_rssi();
+ case SUBDEV_PROP_SENSOR_NAMES:{
+ prop_names_t names = list_of("lo_locked")("rssi");
+ val = names;
+ }
return;
case SUBDEV_PROP_BANDWIDTH:
@@ -719,8 +727,13 @@ void xcvr2450::tx_get(const wax::obj &key_, wax::obj &val){
val = false;
return;
- case SUBDEV_PROP_LO_LOCKED:
- val = this->get_locked();
+ case SUBDEV_PROP_SENSOR:
+ UHD_ASSERT_THROW(key.name == "lo_locked");
+ val = sensor_value_t("LO", this->get_locked(), "locked", "unlocked");
+ return;
+
+ case SUBDEV_PROP_SENSOR_NAMES:
+ val = prop_names_t(1, "lo_locked");
return;
case SUBDEV_PROP_BANDWIDTH:
diff --git a/host/lib/usrp/multi_usrp.cpp b/host/lib/usrp/multi_usrp.cpp
index e4e70b594..73bac029d 100644
--- a/host/lib/usrp/multi_usrp.cpp
+++ b/host/lib/usrp/multi_usrp.cpp
@@ -300,10 +300,6 @@ public:
return _rx_subdev(chan)[SUBDEV_PROP_ANTENNA_NAMES].as<prop_names_t>();
}
- bool get_rx_lo_locked(size_t chan){
- return _rx_subdev(chan)[SUBDEV_PROP_LO_LOCKED].as<bool>();
- }
-
void set_rx_bandwidth(double bandwidth, size_t chan){
_rx_subdev(chan)[SUBDEV_PROP_BANDWIDTH] = bandwidth;
}
@@ -312,10 +308,6 @@ public:
return _rx_subdev(chan)[SUBDEV_PROP_BANDWIDTH].as<double>();
}
- double read_rssi(size_t chan){
- return _rx_subdev(chan)[SUBDEV_PROP_RSSI].as<double>();
- }
-
dboard_iface::sptr get_rx_dboard_iface(size_t chan){
return _rx_dboard(chan)[DBOARD_PROP_DBOARD_IFACE].as<dboard_iface::sptr>();
}
@@ -406,10 +398,6 @@ public:
return _tx_subdev(chan)[SUBDEV_PROP_ANTENNA_NAMES].as<prop_names_t>();
}
- bool get_tx_lo_locked(size_t chan){
- return _tx_subdev(chan)[SUBDEV_PROP_LO_LOCKED].as<bool>();
- }
-
void set_tx_bandwidth(double bandwidth, size_t chan){
_tx_subdev(chan)[SUBDEV_PROP_BANDWIDTH] = bandwidth;
}