aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp
diff options
context:
space:
mode:
authorJon Kiser <jon.kiser@ettus.com>2015-02-02 11:49:09 -0800
committerMartin Braun <martin.braun@ettus.com>2015-02-11 17:59:42 +0100
commitac958d47e8c7c4e0ee6a010d3e5a592d392e9206 (patch)
tree73ae7b5f2e3fa33b12a70ba42bcf471de875fd7f /host/lib/usrp
parent064634b05c9e94ef11b9a8779d389b97e46fb3de (diff)
downloaduhd-ac958d47e8c7c4e0ee6a010d3e5a592d392e9206.tar.gz
uhd-ac958d47e8c7c4e0ee6a010d3e5a592d392e9206.tar.bz2
uhd-ac958d47e8c7c4e0ee6a010d3e5a592d392e9206.zip
ad936x: removing gain_offset from rx set_gain
Diffstat (limited to 'host/lib/usrp')
-rw-r--r--host/lib/usrp/common/ad9361_ctrl.hpp2
-rw-r--r--host/lib/usrp/common/ad9361_driver/ad9361_device.cpp25
2 files changed, 6 insertions, 21 deletions
diff --git a/host/lib/usrp/common/ad9361_ctrl.hpp b/host/lib/usrp/common/ad9361_ctrl.hpp
index 16e1d23eb..c5718302f 100644
--- a/host/lib/usrp/common/ad9361_ctrl.hpp
+++ b/host/lib/usrp/common/ad9361_ctrl.hpp
@@ -52,7 +52,7 @@ public:
static uhd::meta_range_t get_gain_range(const std::string &which)
{
if(which[0] == 'R') {
- return uhd::meta_range_t(0.0, 73.0, 1.0);
+ return uhd::meta_range_t(0.0, 76.0, 1.0);
} else {
return uhd::meta_range_t(0.0, 89.75, 0.25);
}
diff --git a/host/lib/usrp/common/ad9361_driver/ad9361_device.cpp b/host/lib/usrp/common/ad9361_driver/ad9361_device.cpp
index 97b214d7d..d3e53c80f 100644
--- a/host/lib/usrp/common/ad9361_driver/ad9361_device.cpp
+++ b/host/lib/usrp/common/ad9361_driver/ad9361_device.cpp
@@ -1854,31 +1854,16 @@ double ad9361_device_t::tune(direction_t direction, const double value)
/* Set the gain of RX1, RX2, TX1, or TX2.
*
- * Note that the 'value' passed to this function is the actual gain value,
- * _not_ the gain index. This is the opposite of the eval software's GUI!
- * Also note that the RX chains are done in terms of gain, and the TX chains
- * are done in terms of attenuation. */
+ * Note that the 'value' passed to this function is the gain index
+ * for RX. Also note that the RX chains are done in terms of gain, and
+ * the TX chains are done in terms of attenuation. */
double ad9361_device_t::set_gain(direction_t direction, chain_t chain, const double value)
{
boost::lock_guard<boost::recursive_mutex> lock(_mutex);
if (direction == RX) {
- /* Indexing the gain tables requires an offset from the requested
- * amount of total gain in dB:
- * < 1300MHz: dB + 5
- * >= 1300MHz and < 4000MHz: dB + 3
- * >= 4000MHz and <= 6000MHz: dB + 14
- */
- int gain_offset = 0;
- if (_rx_freq < 1300e6) {
- gain_offset = 5;
- } else if (_rx_freq < 4000e6) {
- gain_offset = 3;
- } else {
- gain_offset = 14;
- }
- int gain_index = static_cast<int>(value + gain_offset);
+ int gain_index = static_cast<int>(value);
/* Clip the gain values to the proper min/max gain values. */
if (gain_index > 76)
@@ -1894,7 +1879,7 @@ double ad9361_device_t::set_gain(direction_t direction, chain_t chain, const dou
_io_iface->poke8(0x10c, gain_index);
}
- return gain_index - gain_offset;
+ return gain_index;
} else {
/* Setting the below bits causes a change in the TX attenuation word
* to immediately take effect. */