Revision 4220097f host/lib/usrp/dboard/db_rfx.cpp

b/host/lib/usrp/dboard/db_rfx.cpp
43 43
#include <uhd/utils/assert.hpp>
44 44
#include <uhd/utils/static.hpp>
45 45
#include <uhd/utils/algorithm.hpp>
46
#include <uhd/usrp/dboard_id.hpp>
46 47
#include <uhd/usrp/dboard_base.hpp>
47 48
#include <uhd/usrp/dboard_manager.hpp>
48 49
#include <boost/assign/list_of.hpp>
......
65 66
static const uhd::dict<std::string, gain_range_t> rfx_tx_gain_ranges; //empty
66 67

  
67 68
static const uhd::dict<std::string, gain_range_t> rfx_rx_gain_ranges = map_list_of
69
    ("PGA0", gain_range_t(0, 70, float(0.022)))
70
;
71

  
72
static const uhd::dict<std::string, gain_range_t> rfx400_rx_gain_ranges = map_list_of
68 73
    ("PGA0", gain_range_t(0, 45, float(0.022)))
69 74
;
70 75

  
......
88 93

  
89 94
private:
90 95
    freq_range_t _freq_range;
96
    uhd::dict<std::string, gain_range_t> _rx_gain_ranges;
91 97
    uhd::dict<dboard_iface::unit_t, bool> _div2;
92 98
    double       _rx_lo_freq, _tx_lo_freq;
93 99
    std::string  _rx_ant;
......
166 172
    _div2[dboard_iface::UNIT_RX] = rx_div2;
167 173
    _div2[dboard_iface::UNIT_TX] = tx_div2;
168 174

  
175
    if(this->get_rx_id() == 0x0024) { //RFX400
176
        _rx_gain_ranges = rfx400_rx_gain_ranges;
177
    }
178
    else {
179
        _rx_gain_ranges = rfx_rx_gain_ranges;
180
    }
181

  
182

  
169 183
    //enable the clocks that we need
170 184
    this->get_iface()->set_clock_enabled(dboard_iface::UNIT_TX, true);
171 185
    this->get_iface()->set_clock_enabled(dboard_iface::UNIT_RX, true);
......
193 207
    set_tx_lo_freq((_freq_range.min + _freq_range.max)/2.0);
194 208
    set_rx_ant("RX2");
195 209

  
196
    BOOST_FOREACH(const std::string &name, rfx_rx_gain_ranges.keys()){
197
        set_rx_gain(rfx_rx_gain_ranges[name].min, name);
210
    BOOST_FOREACH(const std::string &name, _rx_gain_ranges.keys()){
211
        set_rx_gain(_rx_gain_ranges[name].min, name);
198 212
    }
199 213
}
200 214

  
......
247 261
}
248 262

  
249 263
void rfx_xcvr::set_rx_gain(float gain, const std::string &name){
250
    assert_has(rfx_rx_gain_ranges.keys(), name, "rfx rx gain name");
264
    assert_has(_rx_gain_ranges.keys(), name, "rfx rx gain name");
251 265
    if(name == "PGA0"){
252 266
        float dac_volts = rx_pga0_gain_to_dac_volts(gain);
253 267
        _rx_gains[name] = gain;
......
402 416
        return;
403 417

  
404 418
    case SUBDEV_PROP_GAIN_RANGE:
405
        assert_has(rfx_rx_gain_ranges.keys(), name, "rfx rx gain name");
406
        val = rfx_rx_gain_ranges[name];
419
        assert_has(_rx_gain_ranges.keys(), name, "rfx rx gain name");
420
        val = _rx_gain_ranges[name];
407 421
        return;
408 422

  
409 423
    case SUBDEV_PROP_GAIN_NAMES:
410
        val = prop_names_t(rfx_rx_gain_ranges.keys());
424
        val = prop_names_t(_rx_gain_ranges.keys());
411 425
        return;
412 426

  
413 427
    case SUBDEV_PROP_FREQ:

Also available in: Unified diff