diff options
author | Alex Williams <alex.williams@ni.com> | 2017-10-27 15:55:56 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2017-10-30 09:49:31 -0700 |
commit | 7fe9973f7629ed120f8c44d4660d132b36c61491 (patch) | |
tree | a45bba92ed6fe36cfd927a174b2e4aa8337e2ebe | |
parent | c6ad0f908d8d7269b301fea02996173faf3e87c4 (diff) | |
download | uhd-7fe9973f7629ed120f8c44d4660d132b36c61491.tar.gz uhd-7fe9973f7629ed120f8c44d4660d132b36c61491.tar.bz2 uhd-7fe9973f7629ed120f8c44d4660d132b36c61491.zip |
adf435x: Add APIs for cp current and aux level
-rwxr-xr-x | host/lib/ic_reg_maps/gen_adf4351_regs.py | 2 | ||||
-rw-r--r-- | host/lib/usrp/common/adf435x.hpp | 83 |
2 files changed, 76 insertions, 9 deletions
diff --git a/host/lib/ic_reg_maps/gen_adf4351_regs.py b/host/lib/ic_reg_maps/gen_adf4351_regs.py index 28f782995..a4936e7f5 100755 --- a/host/lib/ic_reg_maps/gen_adf4351_regs.py +++ b/host/lib/ic_reg_maps/gen_adf4351_regs.py @@ -72,7 +72,7 @@ output_power 4[3:4] 3 m4dbm, m1dbm, 2dbm, 5dbm rf_output_enable 4[5] 1 disabled, enabled aux_output_power 4[6:7] 0 m4dbm, m1dbm, 2dbm, 5dbm aux_output_enable 4[8] 0 disabled, enabled -aux_output_select 4[9] 1 divided, fundamental +aux_output_select 4[9] 0 divided, fundamental mute_till_lock_detect 4[10] 0 mute_disabled, mute_enabled vco_power_down 4[11] 0 vco_powered_up, vco_powered_down band_select_clock_div 4[12:19] 0 diff --git a/host/lib/usrp/common/adf435x.hpp b/host/lib/usrp/common/adf435x.hpp index 18d5b70ba..9c2eb2958 100644 --- a/host/lib/usrp/common/adf435x.hpp +++ b/host/lib/usrp/common/adf435x.hpp @@ -50,18 +50,47 @@ public: enum muxout_t { MUXOUT_3STATE, MUXOUT_DVDD, MUXOUT_DGND, MUXOUT_RDIV, MUXOUT_NDIV, MUXOUT_ALD, MUXOUT_DLD }; + /** + * Charge Pump Currents + */ + enum charge_pump_current_t { + CHARGE_PUMP_CURRENT_0_31MA = 0, + CHARGE_PUMP_CURRENT_0_63MA = 1, + CHARGE_PUMP_CURRENT_0_94MA = 2, + CHARGE_PUMP_CURRENT_1_25MA = 3, + CHARGE_PUMP_CURRENT_1_56MA = 4, + CHARGE_PUMP_CURRENT_1_88MA = 5, + CHARGE_PUMP_CURRENT_2_19MA = 6, + CHARGE_PUMP_CURRENT_2_50MA = 7, + CHARGE_PUMP_CURRENT_2_81MA = 8, + CHARGE_PUMP_CURRENT_3_13MA = 9, + CHARGE_PUMP_CURRENT_3_44MA = 10, + CHARGE_PUMP_CURRENT_3_75MA = 11, + CHARGE_PUMP_CURRENT_4_07MA = 12, + CHARGE_PUMP_CURRENT_4_38MA = 13, + CHARGE_PUMP_CURRENT_4_69MA = 14, + CHARGE_PUMP_CURRENT_5_00MA = 15 + }; + + virtual void set_reference_freq(double fref) = 0; virtual void set_prescaler(prescaler_t prescaler) = 0; virtual void set_feedback_select(feedback_sel_t fb_sel) = 0; - virtual void set_output_power(output_power_t power) = 0; + virtual void set_output_power(output_t output, output_power_t power) = 0; + + void set_output_power(output_power_t power) { + set_output_power(RF_OUTPUT_A, power); + } virtual void set_output_enable(output_t output, bool enable) = 0; virtual void set_muxout_mode(muxout_t mode) = 0; + virtual void set_charge_pump_current(charge_pump_current_t cp_current) = 0; + virtual uhd::range_t get_int_range() = 0; virtual double set_frequency(double target_freq, bool int_n_mode, bool flush = false) = 0; @@ -104,14 +133,29 @@ public: } } - void set_output_power(output_power_t power) + void set_output_power(output_t output, output_power_t power) { - switch (power) { - case OUTPUT_POWER_M4DBM: _regs.output_power = adf435x_regs_t::OUTPUT_POWER_M4DBM; break; - case OUTPUT_POWER_M1DBM: _regs.output_power = adf435x_regs_t::OUTPUT_POWER_M1DBM; break; - case OUTPUT_POWER_2DBM: _regs.output_power = adf435x_regs_t::OUTPUT_POWER_2DBM; break; - case OUTPUT_POWER_5DBM: _regs.output_power = adf435x_regs_t::OUTPUT_POWER_5DBM; break; - default: UHD_THROW_INVALID_CODE_PATH(); + switch (output) { + case RF_OUTPUT_A: + switch (power) { + case OUTPUT_POWER_M4DBM: _regs.output_power = adf435x_regs_t::OUTPUT_POWER_M4DBM; break; + case OUTPUT_POWER_M1DBM: _regs.output_power = adf435x_regs_t::OUTPUT_POWER_M1DBM; break; + case OUTPUT_POWER_2DBM: _regs.output_power = adf435x_regs_t::OUTPUT_POWER_2DBM; break; + case OUTPUT_POWER_5DBM: _regs.output_power = adf435x_regs_t::OUTPUT_POWER_5DBM; break; + default: UHD_THROW_INVALID_CODE_PATH(); + } + break; + case RF_OUTPUT_B: + switch (power) { + case OUTPUT_POWER_M4DBM: _regs.aux_output_power = adf435x_regs_t::AUX_OUTPUT_POWER_M4DBM; break; + case OUTPUT_POWER_M1DBM: _regs.aux_output_power = adf435x_regs_t::AUX_OUTPUT_POWER_M1DBM; break; + case OUTPUT_POWER_2DBM: _regs.aux_output_power = adf435x_regs_t::AUX_OUTPUT_POWER_2DBM; break; + case OUTPUT_POWER_5DBM: _regs.aux_output_power = adf435x_regs_t::AUX_OUTPUT_POWER_5DBM; break; + default: UHD_THROW_INVALID_CODE_PATH(); + } + break; + default: + UHD_THROW_INVALID_CODE_PATH(); } } @@ -141,6 +185,29 @@ public: } } + void set_charge_pump_current(charge_pump_current_t cp_current) + { + switch (cp_current) { + case CHARGE_PUMP_CURRENT_0_31MA : _regs.charge_pump_current = adf435x_regs_t::CHARGE_PUMP_CURRENT_0_31MA; break; + case CHARGE_PUMP_CURRENT_0_63MA : _regs.charge_pump_current = adf435x_regs_t::CHARGE_PUMP_CURRENT_0_63MA; break; + case CHARGE_PUMP_CURRENT_0_94MA : _regs.charge_pump_current = adf435x_regs_t::CHARGE_PUMP_CURRENT_0_94MA; break; + case CHARGE_PUMP_CURRENT_1_25MA : _regs.charge_pump_current = adf435x_regs_t::CHARGE_PUMP_CURRENT_1_25MA; break; + case CHARGE_PUMP_CURRENT_1_56MA : _regs.charge_pump_current = adf435x_regs_t::CHARGE_PUMP_CURRENT_1_56MA; break; + case CHARGE_PUMP_CURRENT_1_88MA : _regs.charge_pump_current = adf435x_regs_t::CHARGE_PUMP_CURRENT_1_88MA; break; + case CHARGE_PUMP_CURRENT_2_19MA : _regs.charge_pump_current = adf435x_regs_t::CHARGE_PUMP_CURRENT_2_19MA; break; + case CHARGE_PUMP_CURRENT_2_50MA : _regs.charge_pump_current = adf435x_regs_t::CHARGE_PUMP_CURRENT_2_50MA; break; + case CHARGE_PUMP_CURRENT_2_81MA : _regs.charge_pump_current = adf435x_regs_t::CHARGE_PUMP_CURRENT_2_81MA; break; + case CHARGE_PUMP_CURRENT_3_13MA : _regs.charge_pump_current = adf435x_regs_t::CHARGE_PUMP_CURRENT_3_13MA; break; + case CHARGE_PUMP_CURRENT_3_44MA : _regs.charge_pump_current = adf435x_regs_t::CHARGE_PUMP_CURRENT_3_44MA; break; + case CHARGE_PUMP_CURRENT_3_75MA : _regs.charge_pump_current = adf435x_regs_t::CHARGE_PUMP_CURRENT_3_75MA; break; + case CHARGE_PUMP_CURRENT_4_07MA : _regs.charge_pump_current = adf435x_regs_t::CHARGE_PUMP_CURRENT_4_07MA; break; + case CHARGE_PUMP_CURRENT_4_38MA : _regs.charge_pump_current = adf435x_regs_t::CHARGE_PUMP_CURRENT_4_38MA; break; + case CHARGE_PUMP_CURRENT_4_69MA : _regs.charge_pump_current = adf435x_regs_t::CHARGE_PUMP_CURRENT_4_69MA; break; + case CHARGE_PUMP_CURRENT_5_00MA : _regs.charge_pump_current = adf435x_regs_t::CHARGE_PUMP_CURRENT_5_00MA; break; + default: UHD_THROW_INVALID_CODE_PATH(); + } + } + uhd::range_t get_int_range() { if (_N_min < 0) throw uhd::runtime_error("set_prescaler must be called before get_int_range"); |