aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--host/lib/usrp/common/adf435x.hpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/host/lib/usrp/common/adf435x.hpp b/host/lib/usrp/common/adf435x.hpp
index 16557b514..d08c6b9dd 100644
--- a/host/lib/usrp/common/adf435x.hpp
+++ b/host/lib/usrp/common/adf435x.hpp
@@ -40,12 +40,16 @@ public:
virtual ~adf435x_iface() = 0;
+ enum output_t { RF_OUTPUT_A, RF_OUTPUT_B };
+
enum prescaler_t { PRESCALER_4_5, PRESCALER_8_9 };
enum feedback_sel_t { FB_SEL_FUNDAMENTAL, FB_SEL_DIVIDED };
enum output_power_t { OUTPUT_POWER_M4DBM, OUTPUT_POWER_M1DBM, OUTPUT_POWER_2DBM, OUTPUT_POWER_5DBM };
+ enum muxout_t { MUXOUT_3STATE, MUXOUT_DVDD, MUXOUT_DGND, MUXOUT_RDIV, MUXOUT_NDIV, MUXOUT_ALD, MUXOUT_DLD };
+
virtual void set_reference_freq(double fref) = 0;
virtual void set_prescaler(prescaler_t prescaler) = 0;
@@ -54,6 +58,10 @@ public:
virtual void set_output_power(output_power_t power) = 0;
+ virtual void set_output_enable(output_t output, bool enable) = 0;
+
+ virtual void set_muxout_mode(muxout_t mode) = 0;
+
virtual uhd::range_t get_int_range() = 0;
virtual double set_frequency(double target_freq, bool int_n_mode, bool flush = false) = 0;
@@ -107,6 +115,32 @@ public:
}
}
+ void set_output_enable(output_t output, bool enable)
+ {
+ switch (output) {
+ case RF_OUTPUT_A: _regs.rf_output_enable = enable ? adf435x_regs_t::RF_OUTPUT_ENABLE_ENABLED:
+ adf435x_regs_t::RF_OUTPUT_ENABLE_DISABLED;
+ break;
+ case RF_OUTPUT_B: _regs.aux_output_enable = enable ? adf435x_regs_t::AUX_OUTPUT_ENABLE_ENABLED:
+ adf435x_regs_t::AUX_OUTPUT_ENABLE_DISABLED;
+ break;
+ }
+ }
+
+ void set_muxout_mode(muxout_t mode)
+ {
+ switch (mode) {
+ case MUXOUT_3STATE: _regs.muxout = adf435x_regs_t::MUXOUT_3STATE; break;
+ case MUXOUT_DVDD: _regs.muxout = adf435x_regs_t::MUXOUT_DVDD; break;
+ case MUXOUT_DGND: _regs.muxout = adf435x_regs_t::MUXOUT_DGND; break;
+ case MUXOUT_RDIV: _regs.muxout = adf435x_regs_t::MUXOUT_RDIV; break;
+ case MUXOUT_NDIV: _regs.muxout = adf435x_regs_t::MUXOUT_NDIV; break;
+ case MUXOUT_ALD: _regs.muxout = adf435x_regs_t::MUXOUT_ANALOG_LD; break;
+ case MUXOUT_DLD: _regs.muxout = adf435x_regs_t::MUXOUT_DLD; 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");