diff options
author | Martin Braun <martin.braun@ettus.com> | 2017-03-01 16:39:08 -0800 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2017-03-01 16:39:08 -0800 |
commit | da26a3e34ece4a68ddc3542644308c406a162683 (patch) | |
tree | c390929a21b8ccaeb4d79dc75b59a57c300c2865 /host/lib/usrp | |
parent | 79a797d5b376fbfa51ffcd42d57956e83b4903c9 (diff) | |
parent | 5ca309a86e8d99f3431bfd0116579e7d57bf64a7 (diff) | |
download | uhd-da26a3e34ece4a68ddc3542644308c406a162683.tar.gz uhd-da26a3e34ece4a68ddc3542644308c406a162683.tar.bz2 uhd-da26a3e34ece4a68ddc3542644308c406a162683.zip |
Merge branch 'maint'
Diffstat (limited to 'host/lib/usrp')
-rw-r--r-- | host/lib/usrp/common/adf5355.cpp | 13 | ||||
-rw-r--r-- | host/lib/usrp/cores/gpio_atr_3000.cpp | 4 | ||||
-rw-r--r-- | host/lib/usrp/usrp_c.cpp | 22 |
3 files changed, 26 insertions, 13 deletions
diff --git a/host/lib/usrp/common/adf5355.cpp b/host/lib/usrp/common/adf5355.cpp index e3fd66bc2..36d41a5c3 100644 --- a/host/lib/usrp/common/adf5355.cpp +++ b/host/lib/usrp/common/adf5355.cpp @@ -47,7 +47,8 @@ static const double ADF5355_MIN_OUT_FREQ = (3.4e9 / 64); static const double ADF5355_PHASE_RESYNC_TIME = 400e-6; static const uint32_t ADF5355_MOD1 = 16777216; -static const uint32_t ADF5355_MAX_MOD2 = 16384; +static const uint32_t ADF5355_MAX_MOD2 = 16383; +static const uint32_t ADF5355_MAX_FRAC2 = 16383; //static const uint16_t ADF5355_MIN_INT_PRESCALER_89 = 75; class adf5355_impl : public adf5355_iface @@ -261,15 +262,11 @@ public: double N = prescaler_input_freq / _pfd_freq; uint16_t INT = static_cast<uint16_t>(floor(N)); uint32_t FRAC1 = static_cast<uint32_t>(floor((N - INT) * ADF5355_MOD1)); - double residue = ADF5355_MOD1 * (N - (INT + FRAC1 / ADF5355_MOD1)); + double residue = (N - INT) * ADF5355_MOD1 - FRAC1; double gcd = boost::math::gcd(static_cast<int>(_pfd_freq), static_cast<int>(freq_resolution)); - uint16_t MOD2 = static_cast<uint16_t>(floor(_pfd_freq / gcd)); - - if (MOD2 > ADF5355_MAX_MOD2) { - MOD2 = ADF5355_MAX_MOD2; - } - uint16_t FRAC2 = ceil(residue * MOD2); + uint16_t MOD2 = static_cast<uint16_t>(std::min(floor(_pfd_freq / gcd), static_cast<double>(ADF5355_MAX_MOD2))); + uint16_t FRAC2 = static_cast<uint16_t>(std::min(ceil(residue * MOD2), static_cast<double>(ADF5355_MAX_FRAC2))); double coerced_vco_freq = _pfd_freq * ( todbl(INT) + ( diff --git a/host/lib/usrp/cores/gpio_atr_3000.cpp b/host/lib/usrp/cores/gpio_atr_3000.cpp index 6df592e1b..4b141e2ab 100644 --- a/host/lib/usrp/cores/gpio_atr_3000.cpp +++ b/host/lib/usrp/cores/gpio_atr_3000.cpp @@ -271,6 +271,7 @@ public: return (~_atr_disable_reg.get()) >> compute_shift(unit); } + using gpio_atr_3000_impl::set_gpio_ddr; inline void set_gpio_ddr(const db_unit_t unit, const uint32_t value, const uint32_t mask) { gpio_atr_3000_impl::set_gpio_ddr(DDR_OUTPUT, compute_mask(unit, value&mask)); @@ -282,6 +283,7 @@ public: return _ddr_reg.get() >> compute_shift(unit); } + using gpio_atr_3000_impl::set_atr_reg; inline void set_atr_reg(const db_unit_t unit, const gpio_atr_reg_t atr, const uint32_t value, const uint32_t mask) { gpio_atr_3000_impl::set_atr_reg(atr, value << compute_shift(unit), compute_mask(unit, mask)); @@ -300,6 +302,7 @@ public: return (reg->get() & compute_mask(unit, MASK_SET_ALL)) >> compute_shift(unit); } + using gpio_atr_3000_impl::set_gpio_out; inline void set_gpio_out(const db_unit_t unit, const uint32_t value, const uint32_t mask) { gpio_atr_3000_impl::set_gpio_out( @@ -312,6 +315,7 @@ public: return (_atr_idle_reg.get_gpio_out() & compute_mask(unit, MASK_SET_ALL)) >> compute_shift(unit); } + using gpio_atr_3000_impl::read_gpio; inline uint32_t read_gpio(const db_unit_t unit) { return (gpio_atr_3000_impl::read_gpio() & compute_mask(unit, MASK_SET_ALL)) >> compute_shift(unit); diff --git a/host/lib/usrp/usrp_c.cpp b/host/lib/usrp/usrp_c.cpp index 4d144fcaa..3d50bd8be 100644 --- a/host/lib/usrp/usrp_c.cpp +++ b/host/lib/usrp/usrp_c.cpp @@ -377,6 +377,7 @@ uhd_error uhd_usrp_get_rx_info( uhd::dict<std::string, std::string> rx_info = USRP(h)->get_usrp_rx_info(chan); COPY_INFO_FIELD(info_out, rx_info, mboard_id); + COPY_INFO_FIELD(info_out, rx_info, mboard_name); COPY_INFO_FIELD(info_out, rx_info, mboard_serial); COPY_INFO_FIELD(info_out, rx_info, rx_id); COPY_INFO_FIELD(info_out, rx_info, rx_subdev_name); @@ -395,6 +396,7 @@ uhd_error uhd_usrp_get_tx_info( uhd::dict<std::string, std::string> tx_info = USRP(h)->get_usrp_tx_info(chan); COPY_INFO_FIELD(info_out, tx_info, mboard_id); + COPY_INFO_FIELD(info_out, tx_info, mboard_name); COPY_INFO_FIELD(info_out, tx_info, mboard_serial); COPY_INFO_FIELD(info_out, tx_info, tx_id); COPY_INFO_FIELD(info_out, tx_info, tx_subdev_name); @@ -612,6 +614,16 @@ uhd_error uhd_usrp_set_clock_source_out( ) } +uhd_error uhd_usrp_set_time_source_out( + uhd_usrp_handle h, + bool enb, + size_t mboard +){ + UHD_SAFE_C_SAVE_ERROR(h, + USRP(h)->set_time_source_out(enb, mboard); + ) +} + uhd_error uhd_usrp_get_num_mboards( uhd_usrp_handle h, size_t *num_mboards_out @@ -839,10 +851,10 @@ uhd_error uhd_usrp_get_fe_rx_freq_range( UHD_API uhd_error uhd_usrp_get_rx_lo_names( uhd_usrp_handle h, size_t chan, - uhd_string_vector_handle rx_lo_names_out + uhd_string_vector_handle *rx_lo_names_out ){ UHD_SAFE_C_SAVE_ERROR(h, - rx_lo_names_out->string_vector_cpp = USRP(h)->get_rx_lo_names(chan); + (*rx_lo_names_out)->string_vector_cpp = USRP(h)->get_rx_lo_names(chan); ) } @@ -873,10 +885,10 @@ UHD_API uhd_error uhd_usrp_get_rx_lo_sources( uhd_usrp_handle h, const char* name, size_t chan, - uhd_string_vector_handle rx_lo_sources_out + uhd_string_vector_handle *rx_lo_sources_out ){ UHD_SAFE_C_SAVE_ERROR(h, - rx_lo_sources_out->string_vector_cpp = USRP(h)->get_rx_lo_sources(name, chan); + (*rx_lo_sources_out)->string_vector_cpp = USRP(h)->get_rx_lo_sources(name, chan); ) } @@ -1488,7 +1500,7 @@ uhd_error uhd_usrp_write_register( ) } -uhd_error uhd_usrp_write_register( +uhd_error uhd_usrp_read_register( uhd_usrp_handle h, const char* path, uint32_t field, |