Statistics
| Branch: | Tag: | Revision:

root / host / lib / usrp / dboard / db_rfx.cpp @ f73a3688

History | View | Annotate | Download (19.7 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_base.hpp>
47
#include <uhd/usrp/dboard_manager.hpp>
48
#include <boost/assign/list_of.hpp>
49
#include <boost/format.hpp>
50
#include <boost/math/special_functions/round.hpp>
51

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

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

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

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

    
65
static const uhd::dict<std::string, gain_range_t> rfx_tx_gain_ranges; //empty
66

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

    
71
/***********************************************************************
72
 * The RFX series of dboards
73
 **********************************************************************/
74
class rfx_xcvr : public xcvr_dboard_base{
75
public:
76
    rfx_xcvr(
77
        ctor_args_t args,
78
        const freq_range_t &freq_range,
79
        bool rx_div2, bool tx_div2
80
    );
81
    ~rfx_xcvr(void);
82

    
83
    void rx_get(const wax::obj &key, wax::obj &val);
84
    void rx_set(const wax::obj &key, const wax::obj &val);
85

    
86
    void tx_get(const wax::obj &key, wax::obj &val);
87
    void tx_set(const wax::obj &key, const wax::obj &val);
88

    
89
private:
90
    freq_range_t _freq_range;
91
    uhd::dict<dboard_iface::unit_t, bool> _div2;
92
    double       _rx_lo_freq, _tx_lo_freq;
93
    std::string  _rx_ant;
94
    uhd::dict<std::string, float> _rx_gains;
95

    
96
    void set_rx_lo_freq(double freq);
97
    void set_tx_lo_freq(double freq);
98
    void set_rx_ant(const std::string &ant);
99
    void set_tx_ant(const std::string &ant);
100
    void set_rx_gain(float gain, const std::string &name);
101
    void set_tx_gain(float gain, const std::string &name);
102

    
103
    /*!
104
     * Set the LO frequency for the particular dboard unit.
105
     * \param unit which unit rx or tx
106
     * \param target_freq the desired frequency in Hz
107
     * \return the actual frequency in Hz
108
     */
109
    double set_lo_freq(dboard_iface::unit_t unit, double target_freq);
110

    
111
    /*!
112
     * Get the lock detect status of the LO.
113
     * \param unit which unit rx or tx
114
     * \return true for locked
115
     */
116
    bool get_locked(dboard_iface::unit_t unit){
117
        return (this->get_iface()->read_gpio(unit) & LOCKDET_MASK) != 0;
118
    }
119
};
120

    
121
/***********************************************************************
122
 * Register the RFX dboards (min freq, max freq, rx div2, tx div2)
123
 **********************************************************************/
124
static dboard_base::sptr make_rfx_flex400(dboard_base::ctor_args_t args){
125
    return dboard_base::sptr(new rfx_xcvr(args, freq_range_t(400e6, 500e6), false, true));
126
}
127

    
128
static dboard_base::sptr make_rfx_flex900(dboard_base::ctor_args_t args){
129
    return dboard_base::sptr(new rfx_xcvr(args, freq_range_t(750e6, 1050e6), true, true));
130
}
131

    
132
static dboard_base::sptr make_rfx_flex1800(dboard_base::ctor_args_t args){
133
    return dboard_base::sptr(new rfx_xcvr(args, freq_range_t(1500e6, 2100e6), false, false));
134
}
135

    
136
static dboard_base::sptr make_rfx_flex1200(dboard_base::ctor_args_t args){
137
    return dboard_base::sptr(new rfx_xcvr(args, freq_range_t(1150e6, 1450e6), true, true));
138
}
139

    
140
static dboard_base::sptr make_rfx_flex2400(dboard_base::ctor_args_t args){
141
    return dboard_base::sptr(new rfx_xcvr(args, freq_range_t(2300e6, 2900e6), false, false));
142
}
143

    
144
UHD_STATIC_BLOCK(reg_rfx_dboards){
145
    dboard_manager::register_dboard(0x0024, &make_rfx_flex400, "Flex 400 Rx MIMO B");
146
    dboard_manager::register_dboard(0x0028, &make_rfx_flex400, "Flex 400 Tx MIMO B");
147

    
148
    dboard_manager::register_dboard(0x0025, &make_rfx_flex900, "Flex 900 Rx MIMO B");
149
    dboard_manager::register_dboard(0x0029, &make_rfx_flex900, "Flex 900 Tx MIMO B");
150

    
151
    dboard_manager::register_dboard(0x0034, &make_rfx_flex1800, "Flex 1800 Rx MIMO B");
152
    dboard_manager::register_dboard(0x0035, &make_rfx_flex1800, "Flex 1800 Tx MIMO B");
153

    
154
    dboard_manager::register_dboard(0x0026, &make_rfx_flex1200, "Flex 1200 Rx MIMO B");
155
    dboard_manager::register_dboard(0x002a, &make_rfx_flex1200, "Flex 1200 Tx MIMO B");
156

    
157
    dboard_manager::register_dboard(0x0027, &make_rfx_flex2400, "Flex 2400 Rx MIMO B");
158
    dboard_manager::register_dboard(0x002b, &make_rfx_flex2400, "Flex 2400 Tx MIMO B");
159
}
160

    
161
/***********************************************************************
162
 * Structors
163
 **********************************************************************/
164
rfx_xcvr::rfx_xcvr(
165
    ctor_args_t args,
166
    const freq_range_t &freq_range,
167
    bool rx_div2, bool tx_div2
168
) : xcvr_dboard_base(args){
169
    _freq_range = freq_range;
170
    _div2[dboard_iface::UNIT_RX] = rx_div2;
171
    _div2[dboard_iface::UNIT_TX] = tx_div2;
172

    
173
    //enable the clocks that we need
174
    this->get_iface()->set_clock_enabled(dboard_iface::UNIT_TX, true);
175
    this->get_iface()->set_clock_enabled(dboard_iface::UNIT_RX, true);
176

    
177
    //set the gpio directions and atr controls (identically)
178
    boost::uint16_t output_enables = POWER_IO | ANTSW_IO | MIXER_IO;
179
    this->get_iface()->set_pin_ctrl(dboard_iface::UNIT_TX, output_enables);
180
    this->get_iface()->set_pin_ctrl(dboard_iface::UNIT_RX, output_enables);
181
    this->get_iface()->set_gpio_ddr(dboard_iface::UNIT_TX, output_enables);
182
    this->get_iface()->set_gpio_ddr(dboard_iface::UNIT_RX, output_enables);
183

    
184
    //setup the tx atr (this does not change with antenna)
185
    this->get_iface()->set_atr_reg(dboard_iface::UNIT_TX, dboard_iface::ATR_REG_IDLE,        POWER_UP | ANT_XX | MIXER_DIS);
186
    this->get_iface()->set_atr_reg(dboard_iface::UNIT_TX, dboard_iface::ATR_REG_RX_ONLY,     POWER_UP | ANT_RX | MIXER_DIS);
187
    this->get_iface()->set_atr_reg(dboard_iface::UNIT_TX, dboard_iface::ATR_REG_TX_ONLY,     POWER_UP | ANT_TX | MIXER_ENB);
188
    this->get_iface()->set_atr_reg(dboard_iface::UNIT_TX, dboard_iface::ATR_REG_FULL_DUPLEX, POWER_UP | ANT_TX | MIXER_ENB);
189

    
190
    //setup the rx atr (this does not change with antenna)
191
    this->get_iface()->set_atr_reg(dboard_iface::UNIT_RX, dboard_iface::ATR_REG_IDLE,        POWER_UP | ANT_XX | MIXER_DIS);
192
    this->get_iface()->set_atr_reg(dboard_iface::UNIT_RX, dboard_iface::ATR_REG_TX_ONLY,     POWER_UP | ANT_XX | MIXER_DIS);
193
    this->get_iface()->set_atr_reg(dboard_iface::UNIT_RX, dboard_iface::ATR_REG_FULL_DUPLEX, POWER_UP | ANT_RX2| MIXER_ENB);
194

    
195
    //set some default values
196
    set_rx_lo_freq((_freq_range.min + _freq_range.max)/2.0);
197
    set_tx_lo_freq((_freq_range.min + _freq_range.max)/2.0);
198
    set_rx_ant("RX2");
199

    
200
    BOOST_FOREACH(const std::string &name, rfx_rx_gain_ranges.keys()){
201
        set_rx_gain(rfx_rx_gain_ranges[name].min, name);
202
    }
203
}
204

    
205
rfx_xcvr::~rfx_xcvr(void){
206
    /* NOP */
207
}
208

    
209
/***********************************************************************
210
 * Antenna Handling
211
 **********************************************************************/
212
void rfx_xcvr::set_rx_ant(const std::string &ant){
213
    //validate input
214
    assert_has(rfx_rx_antennas, ant, "rfx rx antenna name");
215

    
216
    //set the rx atr regs that change with antenna setting
217
    this->get_iface()->set_atr_reg(
218
        dboard_iface::UNIT_RX, dboard_iface::ATR_REG_RX_ONLY,
219
        POWER_UP | MIXER_ENB | ((ant == "TX/RX")? ANT_TXRX : ANT_RX2)
220
    );
221

    
222
    //shadow the setting
223
    _rx_ant = ant;
224
}
225

    
226
void rfx_xcvr::set_tx_ant(const std::string &ant){
227
    assert_has(rfx_tx_antennas, ant, "rfx tx antenna name");
228
    //only one antenna option, do nothing
229
}
230

    
231
/***********************************************************************
232
 * Gain Handling
233
 **********************************************************************/
234
static float rx_pga0_gain_to_dac_volts(float &gain){
235
    //voltage level constants (negative slope)
236
    static const float max_volts = float(.2), min_volts = float(1.2);
237
    static const float slope = (max_volts-min_volts)/45;
238

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

    
242
    //the actual gain setting
243
    gain = (dac_volts - min_volts)/slope;
244

    
245
    return dac_volts;
246
}
247

    
248
void rfx_xcvr::set_tx_gain(float, const std::string &name){
249
    assert_has(rfx_tx_gain_ranges.keys(), name, "rfx tx gain name");
250
    UHD_THROW_INVALID_CODE_PATH(); //no gains to set
251
}
252

    
253
void rfx_xcvr::set_rx_gain(float gain, const std::string &name){
254
    assert_has(rfx_rx_gain_ranges.keys(), name, "rfx rx gain name");
255
    if(name == "PGA0"){
256
        float dac_volts = rx_pga0_gain_to_dac_volts(gain);
257
        _rx_gains[name] = gain;
258

    
259
        //write the new voltage to the aux dac
260
        this->get_iface()->write_aux_dac(dboard_iface::UNIT_RX, 0, dac_volts);
261
    }
262
    else UHD_THROW_INVALID_CODE_PATH();
263
}
264

    
265
/***********************************************************************
266
 * Tuning
267
 **********************************************************************/
268
void rfx_xcvr::set_rx_lo_freq(double freq){
269
    _rx_lo_freq = set_lo_freq(dboard_iface::UNIT_RX, freq);
270
}
271

    
272
void rfx_xcvr::set_tx_lo_freq(double freq){
273
    _tx_lo_freq = set_lo_freq(dboard_iface::UNIT_TX, freq);
274
}
275

    
276
double rfx_xcvr::set_lo_freq(
277
    dboard_iface::unit_t unit,
278
    double target_freq
279
){
280
    if (rfx_debug) std::cerr << boost::format(
281
        "RFX tune: target frequency %f Mhz"
282
    ) % (target_freq/1e6) << std::endl;
283

    
284
    //clip the input
285
    target_freq = std::clip(target_freq, _freq_range.min, _freq_range.max);
286
    if (_div2[unit]) target_freq *= 2;
287

    
288
    //map prescalers to the register enums
289
    static const uhd::dict<int, adf4360_regs_t::prescaler_value_t> prescaler_to_enum = map_list_of
290
        (8,  adf4360_regs_t::PRESCALER_VALUE_8_9)
291
        (16, adf4360_regs_t::PRESCALER_VALUE_16_17)
292
        (32, adf4360_regs_t::PRESCALER_VALUE_32_33)
293
    ;
294

    
295
    //map band select clock dividers to enums
296
    static const uhd::dict<int, adf4360_regs_t::band_select_clock_div_t> bandsel_to_enum = map_list_of
297
        (1, adf4360_regs_t::BAND_SELECT_CLOCK_DIV_1)
298
        (2, adf4360_regs_t::BAND_SELECT_CLOCK_DIV_2)
299
        (4, adf4360_regs_t::BAND_SELECT_CLOCK_DIV_4)
300
        (8, adf4360_regs_t::BAND_SELECT_CLOCK_DIV_8)
301
    ;
302

    
303
    double actual_freq=0, ref_freq = this->get_iface()->get_clock_rate(unit);
304
    int R=0, BS=0, P=0, B=0, A=0;
305

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

    
334
    if (rfx_debug) std::cerr << boost::format(
335
        "RFX tune: R=%d, BS=%d, P=%d, B=%d, A=%d"
336
    ) % R % BS % P % B % A << std::endl;
337

    
338
    //load the register values
339
    adf4360_regs_t regs;
340
    regs.core_power_level        = adf4360_regs_t::CORE_POWER_LEVEL_10MA;
341
    regs.counter_operation       = adf4360_regs_t::COUNTER_OPERATION_NORMAL;
342
    regs.muxout_control          = adf4360_regs_t::MUXOUT_CONTROL_DLD;
343
    regs.phase_detector_polarity = adf4360_regs_t::PHASE_DETECTOR_POLARITY_POS;
344
    regs.charge_pump_output      = adf4360_regs_t::CHARGE_PUMP_OUTPUT_NORMAL;
345
    regs.cp_gain_0               = adf4360_regs_t::CP_GAIN_0_SET1;
346
    regs.mute_till_ld            = adf4360_regs_t::MUTE_TILL_LD_ENB;
347
    regs.output_power_level      = adf4360_regs_t::OUTPUT_POWER_LEVEL_3_5MA;
348
    regs.current_setting1        = adf4360_regs_t::CURRENT_SETTING1_0_31MA;
349
    regs.current_setting2        = adf4360_regs_t::CURRENT_SETTING2_0_31MA;
350
    regs.power_down              = adf4360_regs_t::POWER_DOWN_NORMAL_OP;
351
    regs.prescaler_value         = prescaler_to_enum[P];
352
    regs.a_counter               = A;
353
    regs.b_counter               = B;
354
    regs.cp_gain_1               = adf4360_regs_t::CP_GAIN_1_SET1;
355
    regs.divide_by_2_output      = (_div2[unit])?
356
                                    adf4360_regs_t::DIVIDE_BY_2_OUTPUT_DIV2 :
357
                                    adf4360_regs_t::DIVIDE_BY_2_OUTPUT_FUND ;
358
    regs.divide_by_2_prescaler   = adf4360_regs_t::DIVIDE_BY_2_PRESCALER_FUND;
359
    regs.r_counter               = R;
360
    regs.ablpw                   = adf4360_regs_t::ABLPW_3_0NS;
361
    regs.lock_detect_precision   = adf4360_regs_t::LOCK_DETECT_PRECISION_5CYCLES;
362
    regs.test_mode_bit           = 0;
363
    regs.band_select_clock_div   = bandsel_to_enum[BS];
364

    
365
    //write the registers
366
    std::vector<adf4360_regs_t::addr_t> addrs = list_of //correct power-up sequence to write registers (R, C, N)
367
        (adf4360_regs_t::ADDR_RCOUNTER)
368
        (adf4360_regs_t::ADDR_CONTROL)
369
        (adf4360_regs_t::ADDR_NCOUNTER)
370
    ;
371
    BOOST_FOREACH(adf4360_regs_t::addr_t addr, addrs){
372
        this->get_iface()->write_spi(
373
            unit, spi_config_t::EDGE_RISE,
374
            regs.get_reg(addr), 24
375
        );
376
    }
377

    
378
    //return the actual frequency
379
    if (_div2[unit]) actual_freq /= 2;
380
    if (rfx_debug) std::cerr << boost::format(
381
        "RFX tune: actual frequency %f Mhz"
382
    ) % (actual_freq/1e6) << std::endl;
383
    return actual_freq;
384
}
385

    
386
/***********************************************************************
387
 * RX Get and Set
388
 **********************************************************************/
389
void rfx_xcvr::rx_get(const wax::obj &key_, wax::obj &val){
390
    wax::obj key; std::string name;
391
    boost::tie(key, name) = extract_named_prop(key_);
392

    
393
    //handle the get request conditioned on the key
394
    switch(key.as<subdev_prop_t>()){
395
    case SUBDEV_PROP_NAME:
396
        val = get_rx_id().to_pp_string();
397
        return;
398

    
399
    case SUBDEV_PROP_OTHERS:
400
        val = prop_names_t(); //empty
401
        return;
402

    
403
    case SUBDEV_PROP_GAIN:
404
        assert_has(_rx_gains.keys(), name, "rfx rx gain name");
405
        val = _rx_gains[name];
406
        return;
407

    
408
    case SUBDEV_PROP_GAIN_RANGE:
409
        assert_has(rfx_rx_gain_ranges.keys(), name, "rfx rx gain name");
410
        val = rfx_rx_gain_ranges[name];
411
        return;
412

    
413
    case SUBDEV_PROP_GAIN_NAMES:
414
        val = prop_names_t(rfx_rx_gain_ranges.keys());
415
        return;
416

    
417
    case SUBDEV_PROP_FREQ:
418
        val = _rx_lo_freq;
419
        return;
420

    
421
    case SUBDEV_PROP_FREQ_RANGE:
422
        val = _freq_range;
423
        return;
424

    
425
    case SUBDEV_PROP_ANTENNA:
426
        val = _rx_ant;
427
        return;
428

    
429
    case SUBDEV_PROP_ANTENNA_NAMES:
430
        val = rfx_rx_antennas;
431
        return;
432

    
433
    case SUBDEV_PROP_QUADRATURE:
434
        val = true;
435
        return;
436

    
437
    case SUBDEV_PROP_IQ_SWAPPED:
438
        val = true;
439
        return;
440

    
441
    case SUBDEV_PROP_SPECTRUM_INVERTED:
442
        val = false;
443
        return;
444

    
445
    case SUBDEV_PROP_USE_LO_OFFSET:
446
        val = false;
447
        return;
448

    
449
    case SUBDEV_PROP_LO_LOCKED:
450
        val = this->get_locked(dboard_iface::UNIT_RX);
451
        return;
452

    
453
    default: UHD_THROW_PROP_GET_ERROR();
454
    }
455
}
456

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

    
461
    //handle the get request conditioned on the key
462
    switch(key.as<subdev_prop_t>()){
463

    
464
    case SUBDEV_PROP_FREQ:
465
        this->set_rx_lo_freq(val.as<double>());
466
        return;
467

    
468
    case SUBDEV_PROP_GAIN:
469
        this->set_rx_gain(val.as<float>(), name);
470
        return;
471

    
472
    case SUBDEV_PROP_ANTENNA:
473
        this->set_rx_ant(val.as<std::string>());
474
        return;
475

    
476
    default: UHD_THROW_PROP_SET_ERROR();
477
    }
478
}
479

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

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

    
493
    case SUBDEV_PROP_OTHERS:
494
        val = prop_names_t(); //empty
495
        return;
496

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

    
503
    case SUBDEV_PROP_GAIN_NAMES:
504
        val = prop_names_t(rfx_tx_gain_ranges.keys());
505
        return;
506

    
507
    case SUBDEV_PROP_FREQ:
508
        val = _tx_lo_freq;
509
        return;
510

    
511
    case SUBDEV_PROP_FREQ_RANGE:
512
        val = _freq_range;
513
        return;
514

    
515
    case SUBDEV_PROP_ANTENNA:
516
        val = std::string("TX/RX");
517
        return;
518

    
519
    case SUBDEV_PROP_ANTENNA_NAMES:
520
        val = rfx_tx_antennas;
521
        return;
522

    
523
    case SUBDEV_PROP_QUADRATURE:
524
        val = true;
525
        return;
526

    
527
    case SUBDEV_PROP_IQ_SWAPPED:
528
        val = false;
529
        return;
530

    
531
    case SUBDEV_PROP_SPECTRUM_INVERTED:
532
        val = false;
533
        return;
534

    
535
    case SUBDEV_PROP_USE_LO_OFFSET:
536
        val = true;
537
        return;
538

    
539
    case SUBDEV_PROP_LO_LOCKED:
540
        val = this->get_locked(dboard_iface::UNIT_TX);
541
        return;
542

    
543
    default: UHD_THROW_PROP_GET_ERROR();
544
    }
545
}
546

    
547
void rfx_xcvr::tx_set(const wax::obj &key_, const wax::obj &val){
548
    wax::obj key; std::string name;
549
    boost::tie(key, name) = extract_named_prop(key_);
550

    
551
    //handle the get request conditioned on the key
552
    switch(key.as<subdev_prop_t>()){
553

    
554
    case SUBDEV_PROP_FREQ:
555
        this->set_tx_lo_freq(val.as<double>());
556
        return;
557

    
558
    case SUBDEV_PROP_GAIN:
559
        this->set_tx_gain(val.as<float>(), name);
560
        return;
561

    
562
    case SUBDEV_PROP_ANTENNA:
563
        this->set_tx_ant(val.as<std::string>());
564
        return;
565

    
566
    default: UHD_THROW_PROP_SET_ERROR();
567
    }
568
}