summaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
authorJason Abele <jason@ettus.com>2010-07-29 13:38:29 -0700
committerJason Abele <jason@ettus.com>2010-08-02 12:35:36 -0700
commit4220097f99c37632d06de436fdd20772aad46fda (patch)
tree59f2e6499a480d927eacb9eb415bb5d6f436c67b /host
parent5dca9e6315c5f827d97351316e5bdd3a786dc4f1 (diff)
downloaduhd-4220097f99c37632d06de436fdd20772aad46fda.tar.gz
uhd-4220097f99c37632d06de436fdd20772aad46fda.tar.bz2
uhd-4220097f99c37632d06de436fdd20772aad46fda.zip
Fixes gain range for rfx400 vs other rfx
Diffstat (limited to 'host')
-rw-r--r--host/lib/usrp/dboard/db_rfx.cpp26
1 files changed, 20 insertions, 6 deletions
diff --git a/host/lib/usrp/dboard/db_rfx.cpp b/host/lib/usrp/dboard/db_rfx.cpp
index 914ca5e19..664b406d9 100644
--- a/host/lib/usrp/dboard/db_rfx.cpp
+++ b/host/lib/usrp/dboard/db_rfx.cpp
@@ -43,6 +43,7 @@
#include <uhd/utils/assert.hpp>
#include <uhd/utils/static.hpp>
#include <uhd/utils/algorithm.hpp>
+#include <uhd/usrp/dboard_id.hpp>
#include <uhd/usrp/dboard_base.hpp>
#include <uhd/usrp/dboard_manager.hpp>
#include <boost/assign/list_of.hpp>
@@ -65,6 +66,10 @@ static const prop_names_t rfx_rx_antennas = list_of("TX/RX")("RX2");
static const uhd::dict<std::string, gain_range_t> rfx_tx_gain_ranges; //empty
static const uhd::dict<std::string, gain_range_t> rfx_rx_gain_ranges = map_list_of
+ ("PGA0", gain_range_t(0, 70, float(0.022)))
+;
+
+static const uhd::dict<std::string, gain_range_t> rfx400_rx_gain_ranges = map_list_of
("PGA0", gain_range_t(0, 45, float(0.022)))
;
@@ -88,6 +93,7 @@ public:
private:
freq_range_t _freq_range;
+ uhd::dict<std::string, gain_range_t> _rx_gain_ranges;
uhd::dict<dboard_iface::unit_t, bool> _div2;
double _rx_lo_freq, _tx_lo_freq;
std::string _rx_ant;
@@ -166,6 +172,14 @@ rfx_xcvr::rfx_xcvr(
_div2[dboard_iface::UNIT_RX] = rx_div2;
_div2[dboard_iface::UNIT_TX] = tx_div2;
+ if(this->get_rx_id() == 0x0024) { //RFX400
+ _rx_gain_ranges = rfx400_rx_gain_ranges;
+ }
+ else {
+ _rx_gain_ranges = rfx_rx_gain_ranges;
+ }
+
+
//enable the clocks that we need
this->get_iface()->set_clock_enabled(dboard_iface::UNIT_TX, true);
this->get_iface()->set_clock_enabled(dboard_iface::UNIT_RX, true);
@@ -193,8 +207,8 @@ rfx_xcvr::rfx_xcvr(
set_tx_lo_freq((_freq_range.min + _freq_range.max)/2.0);
set_rx_ant("RX2");
- BOOST_FOREACH(const std::string &name, rfx_rx_gain_ranges.keys()){
- set_rx_gain(rfx_rx_gain_ranges[name].min, name);
+ BOOST_FOREACH(const std::string &name, _rx_gain_ranges.keys()){
+ set_rx_gain(_rx_gain_ranges[name].min, name);
}
}
@@ -247,7 +261,7 @@ void rfx_xcvr::set_tx_gain(float, const std::string &name){
}
void rfx_xcvr::set_rx_gain(float gain, const std::string &name){
- assert_has(rfx_rx_gain_ranges.keys(), name, "rfx rx gain name");
+ assert_has(_rx_gain_ranges.keys(), name, "rfx rx gain name");
if(name == "PGA0"){
float dac_volts = rx_pga0_gain_to_dac_volts(gain);
_rx_gains[name] = gain;
@@ -402,12 +416,12 @@ void rfx_xcvr::rx_get(const wax::obj &key_, wax::obj &val){
return;
case SUBDEV_PROP_GAIN_RANGE:
- assert_has(rfx_rx_gain_ranges.keys(), name, "rfx rx gain name");
- val = rfx_rx_gain_ranges[name];
+ assert_has(_rx_gain_ranges.keys(), name, "rfx rx gain name");
+ val = _rx_gain_ranges[name];
return;
case SUBDEV_PROP_GAIN_NAMES:
- val = prop_names_t(rfx_rx_gain_ranges.keys());
+ val = prop_names_t(_rx_gain_ranges.keys());
return;
case SUBDEV_PROP_FREQ: