Statistics
| Branch: | Tag: | Revision:

root / host / lib / usrp / dboard / db_rfx.cpp @ 94e7cec6

History | View | Annotate | Download (19.8 kB)

1
//
2
// Copyright 2010 Ettus Research LLC
3
//
4
// This program is free software: you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation, either version 3 of the License, or
7
// (at your option) any later version.
8
//
9
// This program is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
// GNU General Public License for more details.
13
//
14
// You should have received a copy of the GNU General Public License
15
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
//
17

    
18
// IO Pin functions
19
#define POWER_IO     (1 << 7)   // Low enables power supply
20
#define ANTSW_IO     (1 << 6)   // On TX DB, 0 = TX, 1 = RX, on RX DB 0 = main ant, 1 = RX2
21
#define MIXER_IO     (1 << 5)   // Enable appropriate mixer
22
#define LOCKDET_MASK (1 << 2)   // Input pin
23

    
24
// Mixer constants
25
#define MIXER_ENB    MIXER_IO
26
#define MIXER_DIS    0
27

    
28
// Power constants
29
#define POWER_UP     0
30
#define POWER_DOWN   POWER_IO
31

    
32
// Antenna constants
33
#define ANT_TX       0          //the tx line is transmitting
34
#define ANT_RX       ANTSW_IO   //the tx line is receiving
35
#define ANT_TXRX     0          //the rx line is on txrx
36
#define ANT_RX2      ANTSW_IO   //the rx line in on rx2
37
#define ANT_XX       0          //dont care how the antenna is set
38

    
39
#include "adf4360_regs.hpp"
40
#include <uhd/types/dict.hpp>
41
#include <uhd/usrp/subdev_props.hpp>
42
#include <uhd/types/ranges.hpp>
43
#include <uhd/utils/assert.hpp>
44
#include <uhd/utils/static.hpp>
45
#include <uhd/utils/algorithm.hpp>
46
#include <uhd/usrp/dboard_id.hpp>
47
#include <uhd/usrp/dboard_base.hpp>
48
#include <uhd/usrp/dboard_manager.hpp>
49
#include <boost/assign/list_of.hpp>
50
#include <boost/format.hpp>
51
#include <boost/math/special_functions/round.hpp>
52

    
53
using namespace uhd;
54
using namespace uhd::usrp;
55
using namespace boost::assign;
56

    
57
/***********************************************************************
58
 * The RFX Series constants
59
 **********************************************************************/
60
static const bool rfx_debug = false;
61

    
62
static const prop_names_t rfx_tx_antennas = list_of("TX/RX");
63

    
64
static const prop_names_t rfx_rx_antennas = list_of("TX/RX")("RX2");
65

    
66
static const uhd::dict<std::string, gain_range_t> rfx_tx_gain_ranges; //empty
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
73
    ("PGA0", gain_range_t(0, 45, float(0.022)))
74
;
75

    
76
/***********************************************************************
77
 * The RFX series of dboards
78
 **********************************************************************/
79
class rfx_xcvr : public xcvr_dboard_base{
80
public:
81
    rfx_xcvr(
82
        ctor_args_t args,
83
        const freq_range_t &freq_range,
84
        bool rx_div2, bool tx_div2
85
    );
86
    ~rfx_xcvr(void);
87

    
88
    void rx_get(const wax::obj &key, wax::obj &val);
89
    void rx_set(const wax::obj &key, const wax::obj &val);
90

    
91
    void tx_get(const wax::obj &key, wax::obj &val);
92
    void tx_set(const wax::obj &key, const wax::obj &val);
93

    
94
private:
95
    freq_range_t _freq_range;
96
    uhd::dict<std::string, gain_range_t> _rx_gain_ranges;
97
    uhd::dict<dboard_iface::unit_t, bool> _div2;
98
    double       _rx_lo_freq, _tx_lo_freq;
99
    std::string  _rx_ant;
100
    uhd::dict<std::string, float> _rx_gains;
101

    
102
    void set_rx_lo_freq(double freq);
103
    void set_tx_lo_freq(double freq);
104
    void set_rx_ant(const std::string &ant);
105
    void set_tx_ant(const std::string &ant);
106
    void set_rx_gain(float gain, const std::string &name);
107
    void set_tx_gain(float gain, const std::string &name);
108

    
109
    /*!
110
     * Set the LO frequency for the particular dboard unit.
111
     * \param unit which unit rx or tx
112
     * \param target_freq the desired frequency in Hz
113
     * \return the actual frequency in Hz
114
     */
115
    double set_lo_freq(dboard_iface::unit_t unit, double target_freq);
116

    
117
    /*!
118
     * Get the lock detect status of the LO.
119
     * \param unit which unit rx or tx
120
     * \return true for locked
121
     */
122
    bool get_locked(dboard_iface::unit_t unit){
123
        return (this->get_iface()->read_gpio(unit) & LOCKDET_MASK) != 0;
124
    }
125
};
126

    
127
/***********************************************************************
128
 * Register the RFX dboards (min freq, max freq, rx div2, tx div2)
129
 **********************************************************************/
130
static dboard_base::sptr make_rfx_flex400(dboard_base::ctor_args_t args){
131
    return dboard_base::sptr(new rfx_xcvr(args, freq_range_t(400e6, 500e6), false, true));
132
}
133

    
134
static dboard_base::sptr make_rfx_flex900(dboard_base::ctor_args_t args){
135
    return dboard_base::sptr(new rfx_xcvr(args, freq_range_t(750e6, 1050e6), true, true));
136
}
137

    
138
static dboard_base::sptr make_rfx_flex1800(dboard_base::ctor_args_t args){
139
    return dboard_base::sptr(new rfx_xcvr(args, freq_range_t(1500e6, 2100e6), false, false));
140
}
141

    
142
static dboard_base::sptr make_rfx_flex1200(dboard_base::ctor_args_t args){
143
    return dboard_base::sptr(new rfx_xcvr(args, freq_range_t(1150e6, 1450e6), true, true));
144
}
145

    
146
static dboard_base::sptr make_rfx_flex2200(dboard_base::ctor_args_t args){
147
    return dboard_base::sptr(new rfx_xcvr(args, freq_range_t(2000e6, 2400e6), false, false));
148
}
149

    
150
static dboard_base::sptr make_rfx_flex2400(dboard_base::ctor_args_t args){
151
    return dboard_base::sptr(new rfx_xcvr(args, freq_range_t(2300e6, 2900e6), false, false));
152
}
153

    
154
UHD_STATIC_BLOCK(reg_rfx_dboards){
155
    dboard_manager::register_dboard(0x0024, 0x0028, &make_rfx_flex400,  "Flex 400 MIMO B");
156
    dboard_manager::register_dboard(0x0025, 0x0029, &make_rfx_flex900,  "Flex 900 MIMO B");
157
    dboard_manager::register_dboard(0x0034, 0x0035, &make_rfx_flex1800, "Flex 1800 MIMO B");
158
    dboard_manager::register_dboard(0x0026, 0x002a, &make_rfx_flex1200, "Flex 1200 MIMO B");
159
    dboard_manager::register_dboard(0x002c, 0x002d, &make_rfx_flex2200, "Flex 2200 MIMO B");
160
    dboard_manager::register_dboard(0x0027, 0x002b, &make_rfx_flex2400, "Flex 2400 MIMO B");
161
}
162

    
163
/***********************************************************************
164
 * Structors
165
 **********************************************************************/
166
rfx_xcvr::rfx_xcvr(
167
    ctor_args_t args,
168
    const freq_range_t &freq_range,
169
    bool rx_div2, bool tx_div2
170
) : xcvr_dboard_base(args){
171
    _freq_range = freq_range;
172
    _div2[dboard_iface::UNIT_RX] = rx_div2;
173
    _div2[dboard_iface::UNIT_TX] = tx_div2;
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

    
183
    //enable the clocks that we need
184
    this->get_iface()->set_clock_enabled(dboard_iface::UNIT_TX, true);
185
    this->get_iface()->set_clock_enabled(dboard_iface::UNIT_RX, true);
186

    
187
    //set the gpio directions and atr controls (identically)
188
    boost::uint16_t output_enables = POWER_IO | ANTSW_IO | MIXER_IO;
189
    this->get_iface()->set_pin_ctrl(dboard_iface::UNIT_TX, output_enables);
190
    this->get_iface()->set_pin_ctrl(dboard_iface::UNIT_RX, output_enables);
191
    this->get_iface()->set_gpio_ddr(dboard_iface::UNIT_TX, output_enables);
192
    this->get_iface()->set_gpio_ddr(dboard_iface::UNIT_RX, output_enables);
193

    
194
    //setup the tx atr (this does not change with antenna)
195
    this->get_iface()->set_atr_reg(dboard_iface::UNIT_TX, dboard_iface::ATR_REG_IDLE,        POWER_UP | ANT_XX | MIXER_DIS);
196
    this->get_iface()->set_atr_reg(dboard_iface::UNIT_TX, dboard_iface::ATR_REG_RX_ONLY,     POWER_UP | ANT_RX | MIXER_DIS);
197
    this->get_iface()->set_atr_reg(dboard_iface::UNIT_TX, dboard_iface::ATR_REG_TX_ONLY,     POWER_UP | ANT_TX | MIXER_ENB);
198
    this->get_iface()->set_atr_reg(dboard_iface::UNIT_TX, dboard_iface::ATR_REG_FULL_DUPLEX, POWER_UP | ANT_TX | MIXER_ENB);
199

    
200
    //setup the rx atr (this does not change with antenna)
201
    this->get_iface()->set_atr_reg(dboard_iface::UNIT_RX, dboard_iface::ATR_REG_IDLE,        POWER_UP | ANT_XX | MIXER_DIS);
202
    this->get_iface()->set_atr_reg(dboard_iface::UNIT_RX, dboard_iface::ATR_REG_TX_ONLY,     POWER_UP | ANT_XX | MIXER_DIS);
203
    this->get_iface()->set_atr_reg(dboard_iface::UNIT_RX, dboard_iface::ATR_REG_FULL_DUPLEX, POWER_UP | ANT_RX2| MIXER_ENB);
204

    
205
    //set some default values
206
    set_rx_lo_freq((_freq_range.min + _freq_range.max)/2.0);
207
    set_tx_lo_freq((_freq_range.min + _freq_range.max)/2.0);
208
    set_rx_ant("RX2");
209

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

    
215
rfx_xcvr::~rfx_xcvr(void){
216
    /* NOP */
217
}
218

    
219
/***********************************************************************
220
 * Antenna Handling
221
 **********************************************************************/
222
void rfx_xcvr::set_rx_ant(const std::string &ant){
223
    //validate input
224
    assert_has(rfx_rx_antennas, ant, "rfx rx antenna name");
225

    
226
    //set the rx atr regs that change with antenna setting
227
    this->get_iface()->set_atr_reg(
228
        dboard_iface::UNIT_RX, dboard_iface::ATR_REG_RX_ONLY,
229
        POWER_UP | MIXER_ENB | ((ant == "TX/RX")? ANT_TXRX : ANT_RX2)
230
    );
231

    
232
    //shadow the setting
233
    _rx_ant = ant;
234
}
235

    
236
void rfx_xcvr::set_tx_ant(const std::string &ant){
237
    assert_has(rfx_tx_antennas, ant, "rfx tx antenna name");
238
    //only one antenna option, do nothing
239
}
240

    
241
/***********************************************************************
242
 * Gain Handling
243
 **********************************************************************/
244
static float rx_pga0_gain_to_dac_volts(float &gain, float range){
245
    //voltage level constants (negative slope)
246
    static const float max_volts = float(.2), min_volts = float(1.2);
247
    static const float slope = (max_volts-min_volts)/(range);
248

    
249
    //calculate the voltage for the aux dac
250
    float dac_volts = std::clip<float>(gain*slope + min_volts, max_volts, min_volts);
251

    
252
    //the actual gain setting
253
    gain = (dac_volts - min_volts)/slope;
254

    
255
    return dac_volts;
256
}
257

    
258
void rfx_xcvr::set_tx_gain(float, const std::string &name){
259
    assert_has(rfx_tx_gain_ranges.keys(), name, "rfx tx gain name");
260
    UHD_THROW_INVALID_CODE_PATH(); //no gains to set
261
}
262

    
263
void rfx_xcvr::set_rx_gain(float gain, const std::string &name){
264
    assert_has(_rx_gain_ranges.keys(), name, "rfx rx gain name");
265
    if(name == "PGA0"){
266
        float dac_volts = rx_pga0_gain_to_dac_volts(gain, 
267
                              (_rx_gain_ranges["PGA0"].max - _rx_gain_ranges["PGA0"].min));
268
        _rx_gains[name] = gain;
269

    
270
        //write the new voltage to the aux dac
271
        this->get_iface()->write_aux_dac(dboard_iface::UNIT_RX, dboard_iface::AUX_DAC_A, dac_volts);
272
    }
273
    else UHD_THROW_INVALID_CODE_PATH();
274
}
275

    
276
/***********************************************************************
277
 * Tuning
278
 **********************************************************************/
279
void rfx_xcvr::set_rx_lo_freq(double freq){
280
    _rx_lo_freq = set_lo_freq(dboard_iface::UNIT_RX, freq);
281
}
282

    
283
void rfx_xcvr::set_tx_lo_freq(double freq){
284
    _tx_lo_freq = set_lo_freq(dboard_iface::UNIT_TX, freq);
285
}
286

    
287
double rfx_xcvr::set_lo_freq(
288
    dboard_iface::unit_t unit,
289
    double target_freq
290
){
291
    if (rfx_debug) std::cerr << boost::format(
292
        "RFX tune: target frequency %f Mhz"
293
    ) % (target_freq/1e6) << std::endl;
294

    
295
    //clip the input
296
    target_freq = std::clip(target_freq, _freq_range.min, _freq_range.max);
297
    if (_div2[unit]) target_freq *= 2;
298

    
299
    //map prescalers to the register enums
300
    static const uhd::dict<int, adf4360_regs_t::prescaler_value_t> prescaler_to_enum = map_list_of
301
        (8,  adf4360_regs_t::PRESCALER_VALUE_8_9)
302
        (16, adf4360_regs_t::PRESCALER_VALUE_16_17)
303
        (32, adf4360_regs_t::PRESCALER_VALUE_32_33)
304
    ;
305

    
306
    //map band select clock dividers to enums
307
    static const uhd::dict<int, adf4360_regs_t::band_select_clock_div_t> bandsel_to_enum = map_list_of
308
        (1, adf4360_regs_t::BAND_SELECT_CLOCK_DIV_1)
309
        (2, adf4360_regs_t::BAND_SELECT_CLOCK_DIV_2)
310
        (4, adf4360_regs_t::BAND_SELECT_CLOCK_DIV_4)
311
        (8, adf4360_regs_t::BAND_SELECT_CLOCK_DIV_8)
312
    ;
313

    
314
    double actual_freq=0, ref_freq = this->get_iface()->get_clock_rate(unit);
315
    int R=0, BS=0, P=0, B=0, A=0;
316

    
317
    /*
318
     * The goal here to to loop though possible R dividers,
319
     * band select clock dividers, and prescaler values.
320
     * Calculate the A and B counters for each set of values.
321
     * The loop exists when it meets all of the constraints.
322
     * The resulting loop values are loaded into the registers.
323
     *
324
     * fvco = [P*B + A] * fref/R
325
     * fvco*R/fref = P*B + A = N
326
     */
327
    for(R = 2; R <= 32; R+=2){
328
        BOOST_FOREACH(BS, bandsel_to_enum.keys()){
329
            if (ref_freq/R/BS > 1e6) continue; //constraint on band select clock
330
            BOOST_FOREACH(P, prescaler_to_enum.keys()){
331
                //calculate B and A from N
332
                double N = target_freq*R/ref_freq;
333
                B = int(std::floor(N/P));
334
                A = boost::math::iround(N - P*B);
335
                if (B < A or B > 8191 or B < 3 or A > 31) continue; //constraints on A, B
336
                //calculate the actual frequency
337
                actual_freq = double(P*B + A)*ref_freq/R;
338
                if (actual_freq/P > 300e6) continue; //constraint on prescaler output
339
                //constraints met: exit loop
340
                goto done_loop;
341
            }
342
        }
343
    } done_loop:
344

    
345
    if (rfx_debug) std::cerr << boost::format(
346
        "RFX tune: R=%d, BS=%d, P=%d, B=%d, A=%d"
347
    ) % R % BS % P % B % A << std::endl;
348

    
349
    //load the register values
350
    adf4360_regs_t regs;
351
    regs.core_power_level        = adf4360_regs_t::CORE_POWER_LEVEL_10MA;
352
    regs.counter_operation       = adf4360_regs_t::COUNTER_OPERATION_NORMAL;
353
    regs.muxout_control          = adf4360_regs_t::MUXOUT_CONTROL_DLD;
354
    regs.phase_detector_polarity = adf4360_regs_t::PHASE_DETECTOR_POLARITY_POS;
355
    regs.charge_pump_output      = adf4360_regs_t::CHARGE_PUMP_OUTPUT_NORMAL;
356
    regs.cp_gain_0               = adf4360_regs_t::CP_GAIN_0_SET1;
357
    regs.mute_till_ld            = adf4360_regs_t::MUTE_TILL_LD_ENB;
358
    regs.output_power_level      = adf4360_regs_t::OUTPUT_POWER_LEVEL_3_5MA;
359
    regs.current_setting1        = adf4360_regs_t::CURRENT_SETTING1_0_31MA;
360
    regs.current_setting2        = adf4360_regs_t::CURRENT_SETTING2_0_31MA;
361
    regs.power_down              = adf4360_regs_t::POWER_DOWN_NORMAL_OP;
362
    regs.prescaler_value         = prescaler_to_enum[P];
363
    regs.a_counter               = A;
364
    regs.b_counter               = B;
365
    regs.cp_gain_1               = adf4360_regs_t::CP_GAIN_1_SET1;
366
    regs.divide_by_2_output      = (_div2[unit])?
367
                                    adf4360_regs_t::DIVIDE_BY_2_OUTPUT_DIV2 :
368
                                    adf4360_regs_t::DIVIDE_BY_2_OUTPUT_FUND ;
369
    regs.divide_by_2_prescaler   = adf4360_regs_t::DIVIDE_BY_2_PRESCALER_FUND;
370
    regs.r_counter               = R;
371
    regs.ablpw                   = adf4360_regs_t::ABLPW_3_0NS;
372
    regs.lock_detect_precision   = adf4360_regs_t::LOCK_DETECT_PRECISION_5CYCLES;
373
    regs.test_mode_bit           = 0;
374
    regs.band_select_clock_div   = bandsel_to_enum[BS];
375

    
376
    //write the registers
377
    std::vector<adf4360_regs_t::addr_t> addrs = list_of //correct power-up sequence to write registers (R, C, N)
378
        (adf4360_regs_t::ADDR_RCOUNTER)
379
        (adf4360_regs_t::ADDR_CONTROL)
380
        (adf4360_regs_t::ADDR_NCOUNTER)
381
    ;
382
    BOOST_FOREACH(adf4360_regs_t::addr_t addr, addrs){
383
        this->get_iface()->write_spi(
384
            unit, spi_config_t::EDGE_RISE,
385
            regs.get_reg(addr), 24
386
        );
387
    }
388

    
389
    //return the actual frequency
390
    if (_div2[unit]) actual_freq /= 2;
391
    if (rfx_debug) std::cerr << boost::format(
392
        "RFX tune: actual frequency %f Mhz"
393
    ) % (actual_freq/1e6) << std::endl;
394
    return actual_freq;
395
}
396

    
397
/***********************************************************************
398
 * RX Get and Set
399
 **********************************************************************/
400
void rfx_xcvr::rx_get(const wax::obj &key_, wax::obj &val){
401
    wax::obj key; std::string name;
402
    boost::tie(key, name) = extract_named_prop(key_);
403

    
404
    //handle the get request conditioned on the key
405
    switch(key.as<subdev_prop_t>()){
406
    case SUBDEV_PROP_NAME:
407
        val = get_rx_id().to_pp_string();
408
        return;
409

    
410
    case SUBDEV_PROP_OTHERS:
411
        val = prop_names_t(); //empty
412
        return;
413

    
414
    case SUBDEV_PROP_GAIN:
415
        assert_has(_rx_gains.keys(), name, "rfx rx gain name");
416
        val = _rx_gains[name];
417
        return;
418

    
419
    case SUBDEV_PROP_GAIN_RANGE:
420
        assert_has(_rx_gain_ranges.keys(), name, "rfx rx gain name");
421
        val = _rx_gain_ranges[name];
422
        return;
423

    
424
    case SUBDEV_PROP_GAIN_NAMES:
425
        val = prop_names_t(_rx_gain_ranges.keys());
426
        return;
427

    
428
    case SUBDEV_PROP_FREQ:
429
        val = _rx_lo_freq;
430
        return;
431

    
432
    case SUBDEV_PROP_FREQ_RANGE:
433
        val = _freq_range;
434
        return;
435

    
436
    case SUBDEV_PROP_ANTENNA:
437
        val = _rx_ant;
438
        return;
439

    
440
    case SUBDEV_PROP_ANTENNA_NAMES:
441
        val = rfx_rx_antennas;
442
        return;
443

    
444
    case SUBDEV_PROP_CONNECTION:
445
        val = SUBDEV_CONN_COMPLEX_QI;
446
        return;
447

    
448
    case SUBDEV_PROP_USE_LO_OFFSET:
449
        val = false;
450
        return;
451

    
452
    case SUBDEV_PROP_LO_LOCKED:
453
        val = this->get_locked(dboard_iface::UNIT_RX);
454
        return;
455

    
456
    default: UHD_THROW_PROP_GET_ERROR();
457
    }
458
}
459

    
460
void rfx_xcvr::rx_set(const wax::obj &key_, const wax::obj &val){
461
    wax::obj key; std::string name;
462
    boost::tie(key, name) = extract_named_prop(key_);
463

    
464
    //handle the get request conditioned on the key
465
    switch(key.as<subdev_prop_t>()){
466

    
467
    case SUBDEV_PROP_FREQ:
468
        this->set_rx_lo_freq(val.as<double>());
469
        return;
470

    
471
    case SUBDEV_PROP_GAIN:
472
        this->set_rx_gain(val.as<float>(), name);
473
        return;
474

    
475
    case SUBDEV_PROP_ANTENNA:
476
        this->set_rx_ant(val.as<std::string>());
477
        return;
478

    
479
    default: UHD_THROW_PROP_SET_ERROR();
480
    }
481
}
482

    
483
/***********************************************************************
484
 * TX Get and Set
485
 **********************************************************************/
486
void rfx_xcvr::tx_get(const wax::obj &key_, wax::obj &val){
487
    wax::obj key; std::string name;
488
    boost::tie(key, name) = extract_named_prop(key_);
489

    
490
    //handle the get request conditioned on the key
491
    switch(key.as<subdev_prop_t>()){
492
    case SUBDEV_PROP_NAME:
493
        val = get_tx_id().to_pp_string();
494
        return;
495

    
496
    case SUBDEV_PROP_OTHERS:
497
        val = prop_names_t(); //empty
498
        return;
499

    
500
    case SUBDEV_PROP_GAIN:
501
    case SUBDEV_PROP_GAIN_RANGE:
502
        assert_has(rfx_tx_gain_ranges.keys(), name, "rfx tx gain name");
503
        //no controllable tx gains, will not get here
504
        return;
505

    
506
    case SUBDEV_PROP_GAIN_NAMES:
507
        val = prop_names_t(rfx_tx_gain_ranges.keys());
508
        return;
509

    
510
    case SUBDEV_PROP_FREQ:
511
        val = _tx_lo_freq;
512
        return;
513

    
514
    case SUBDEV_PROP_FREQ_RANGE:
515
        val = _freq_range;
516
        return;
517

    
518
    case SUBDEV_PROP_ANTENNA:
519
        val = std::string("TX/RX");
520
        return;
521

    
522
    case SUBDEV_PROP_ANTENNA_NAMES:
523
        val = rfx_tx_antennas;
524
        return;
525

    
526
    case SUBDEV_PROP_CONNECTION:
527
        val = SUBDEV_CONN_COMPLEX_IQ;
528
        return;
529

    
530
    case SUBDEV_PROP_USE_LO_OFFSET:
531
        val = true;
532
        return;
533

    
534
    case SUBDEV_PROP_LO_LOCKED:
535
        val = this->get_locked(dboard_iface::UNIT_TX);
536
        return;
537

    
538
    default: UHD_THROW_PROP_GET_ERROR();
539
    }
540
}
541

    
542
void rfx_xcvr::tx_set(const wax::obj &key_, const wax::obj &val){
543
    wax::obj key; std::string name;
544
    boost::tie(key, name) = extract_named_prop(key_);
545

    
546
    //handle the get request conditioned on the key
547
    switch(key.as<subdev_prop_t>()){
548

    
549
    case SUBDEV_PROP_FREQ:
550
        this->set_tx_lo_freq(val.as<double>());
551
        return;
552

    
553
    case SUBDEV_PROP_GAIN:
554
        this->set_tx_gain(val.as<float>(), name);
555
        return;
556

    
557
    case SUBDEV_PROP_ANTENNA:
558
        this->set_tx_ant(val.as<std::string>());
559
        return;
560

    
561
    default: UHD_THROW_PROP_SET_ERROR();
562
    }
563
}