diff options
author | Martin Braun <martin.braun@ettus.com> | 2016-11-08 11:38:19 -0800 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2018-03-16 10:48:46 -0700 |
commit | 60a911cd460ca1e29d838ee0039d67bf7c8fe7f3 (patch) | |
tree | 05182107d71ca74cb380c4081230b1130c797ec8 /host/lib | |
parent | 86dbaee5b80f203d1a9f28ced0307035d18368fa (diff) | |
download | uhd-60a911cd460ca1e29d838ee0039d67bf7c8fe7f3.tar.gz uhd-60a911cd460ca1e29d838ee0039d67bf7c8fe7f3.tar.bz2 uhd-60a911cd460ca1e29d838ee0039d67bf7c8fe7f3.zip |
rfnoc/x300: Make sure peek32() and peek64() are called with actual addresses
Before, we were calling peeks with the number of the readback register.
Diffstat (limited to 'host/lib')
-rw-r--r-- | host/lib/include/uhdlib/rfnoc/radio_ctrl_impl.hpp | 6 | ||||
-rw-r--r-- | host/lib/rfnoc/radio_ctrl_impl.cpp | 10 | ||||
-rw-r--r-- | host/lib/rfnoc/wb_iface_adapter.cpp | 4 | ||||
-rw-r--r-- | host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_init.cpp | 12 | ||||
-rw-r--r-- | host/lib/usrp/x300/x300_radio_ctrl_impl.cpp | 14 | ||||
-rw-r--r-- | host/lib/usrp/x300/x300_radio_ctrl_impl.hpp | 2 |
6 files changed, 26 insertions, 22 deletions
diff --git a/host/lib/include/uhdlib/rfnoc/radio_ctrl_impl.hpp b/host/lib/include/uhdlib/rfnoc/radio_ctrl_impl.hpp index a5876584e..62a268335 100644 --- a/host/lib/include/uhdlib/rfnoc/radio_ctrl_impl.hpp +++ b/host/lib/include/uhdlib/rfnoc/radio_ctrl_impl.hpp @@ -134,10 +134,8 @@ protected: // TODO see what's protected and what's private * Registers **********************************************************************/ struct regs { - static inline uint32_t sr_addr(const uint32_t offset) - { - return offset * 4; - } + static inline uint32_t sr_addr(const uint32_t offset) { return offset * 4; } + static inline uint32_t rb_addr(const uint32_t offset) { return offset * 8; } static const uint32_t BASE = 128; diff --git a/host/lib/rfnoc/radio_ctrl_impl.cpp b/host/lib/rfnoc/radio_ctrl_impl.cpp index 1de854266..fe8d51468 100644 --- a/host/lib/rfnoc/radio_ctrl_impl.cpp +++ b/host/lib/rfnoc/radio_ctrl_impl.cpp @@ -72,13 +72,9 @@ radio_ctrl_impl::radio_ctrl_impl() : if (i == 0) { time_core_3000::readback_bases_type time64_rb_bases; - time64_rb_bases.rb_now = regs::RB_TIME_NOW; - time64_rb_bases.rb_pps = regs::RB_TIME_PPS; - _time64 = time_core_3000::make( - _perifs[i].ctrl, - regs::sr_addr(regs::TIME), - time64_rb_bases - ); + time64_rb_bases.rb_now = regs::rb_addr(regs::RB_TIME_NOW); + time64_rb_bases.rb_pps = regs::rb_addr(regs::RB_TIME_PPS); + _time64 = time_core_3000::make(_perifs[i].ctrl, regs::sr_addr(regs::TIME), time64_rb_bases); this->set_time_now(0.0); } diff --git a/host/lib/rfnoc/wb_iface_adapter.cpp b/host/lib/rfnoc/wb_iface_adapter.cpp index 00e2b466a..3b9202661 100644 --- a/host/lib/rfnoc/wb_iface_adapter.cpp +++ b/host/lib/rfnoc/wb_iface_adapter.cpp @@ -42,12 +42,12 @@ void wb_iface_adapter::poke32(const wb_addr_type addr, const uint32_t data) uint32_t wb_iface_adapter::peek32(const wb_addr_type addr) { - return peek32_functor(addr); + return peek32_functor(addr / 8); } uint64_t wb_iface_adapter::peek64(const wb_addr_type addr) { - return peek64_functor(addr); + return peek64_functor(addr / 8); } uhd::time_spec_t wb_iface_adapter::get_time(void) diff --git a/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_init.cpp b/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_init.cpp index a95343574..4023a06c8 100644 --- a/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_init.cpp +++ b/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_init.cpp @@ -122,8 +122,9 @@ void magnesium_radio_ctrl_impl::_init_peripherals() / "tx_lo"; UHD_LOG_TRACE(unique_id(), "Initializing SPI core..."); _spi = spi_core_3000::make(_get_ctrl(0), - radio_ctrl_impl::regs::sr_addr(radio_ctrl_impl::regs::SPI), - radio_ctrl_impl::regs::RB_SPI); + regs::sr_addr(regs::SPI), + regs::rb_addr(regs::RB_SPI) + ); UHD_LOG_TRACE(unique_id(), "Initializing CPLD..."); UHD_LOG_TRACE(unique_id(), "CPLD path: " << cpld_path); @@ -199,7 +200,7 @@ void magnesium_radio_ctrl_impl::_init_peripherals() usrp::gpio_atr::gpio_atr_3000::make( _get_ctrl(radio_idx), regs::sr_addr(regs::GPIO), - regs::RB_DB_GPIO + regs::rb_addr(regs::RB_DB_GPIO) ) ); // DSA and AD9371 gain bits do *not* toggle on ATR modes. If we ever @@ -217,7 +218,10 @@ void magnesium_radio_ctrl_impl::_init_peripherals() } UHD_LOG_TRACE(unique_id(), "Initializing front-panel GPIO control...") _fp_gpio = usrp::gpio_atr::gpio_atr_3000::make( - _get_ctrl(0), regs::sr_addr(regs::FP_GPIO), regs::RB_FP_GPIO); + _get_ctrl(0), + regs::sr_addr(regs::FP_GPIO), + regs::rb_addr(regs::RB_FP_GPIO) + ); } void magnesium_radio_ctrl_impl::_init_frontend_subtree( diff --git a/host/lib/usrp/x300/x300_radio_ctrl_impl.cpp b/host/lib/usrp/x300/x300_radio_ctrl_impl.cpp index d7c206aec..af91fd1ad 100644 --- a/host/lib/usrp/x300/x300_radio_ctrl_impl.cpp +++ b/host/lib/usrp/x300/x300_radio_ctrl_impl.cpp @@ -64,13 +64,17 @@ UHD_RFNOC_RADIO_BLOCK_CONSTRUCTOR(x300_radio_ctrl) // Setup peripherals //////////////////////////////////////////////////////////////// _spi = spi_core_3000::make(ctrl, - radio_ctrl_impl::regs::sr_addr(radio_ctrl_impl::regs::SPI), - radio_ctrl_impl::regs::RB_SPI); + regs::sr_addr(radio_ctrl_impl::regs::SPI), + regs::rb_addr(radio_ctrl_impl::regs::RB_SPI) + ); _adc = x300_adc_ctrl::make(_spi, DB_ADC_SEN); _dac = x300_dac_ctrl::make(_spi, DB_DAC_SEN, _radio_clk_rate); if (_radio_type==PRIMARY) { - _fp_gpio = gpio_atr::gpio_atr_3000::make(ctrl, regs::sr_addr(regs::FP_GPIO), regs::RB_FP_GPIO); + _fp_gpio = gpio_atr::gpio_atr_3000::make(ctrl, + regs::sr_addr(regs::FP_GPIO), + regs::rb_addr(regs::RB_FP_GPIO) + ); for(const gpio_atr::gpio_attr_map_t::value_type attr: gpio_atr::gpio_attr_map) { switch (attr.first){ case usrp::gpio_atr::GPIO_SRC: @@ -641,7 +645,9 @@ void x300_radio_ctrl_impl::setup_radio( //create a new dboard interface x300_dboard_iface_config_t db_config; db_config.gpio = gpio_atr::db_gpio_atr_3000::make(_get_ctrl(IO_MASTER_RADIO), - radio_ctrl_impl::regs::sr_addr(radio_ctrl_impl::regs::GPIO), radio_ctrl_impl::regs::RB_DB_GPIO); + radio_ctrl_impl::regs::sr_addr(radio_ctrl_impl::regs::GPIO), + radio_ctrl_impl::regs::rb_addr(radio_ctrl_impl::regs::RB_DB_GPIO) + ); db_config.spi = _spi; db_config.rx_spi_slaveno = DB_RX_SEN; db_config.tx_spi_slaveno = DB_TX_SEN; diff --git a/host/lib/usrp/x300/x300_radio_ctrl_impl.hpp b/host/lib/usrp/x300/x300_radio_ctrl_impl.hpp index ead546a63..967ed5772 100644 --- a/host/lib/usrp/x300/x300_radio_ctrl_impl.hpp +++ b/host/lib/usrp/x300/x300_radio_ctrl_impl.hpp @@ -145,7 +145,7 @@ private: UHD_DEFINE_SOFT_REG_FIELD(ADC_CHECKER1_Q_ERROR, /*width*/ 1, /*shift*/ 38); //[6] UHD_DEFINE_SOFT_REG_FIELD(ADC_CHECKER1_I_ERROR, /*width*/ 1, /*shift*/ 39); //[7] - misc_ins_reg_t(): uhd::soft_reg64_ro_t(regs::RB_MISC_IO) { } + misc_ins_reg_t(): uhd::soft_reg64_ro_t(regs::rb_addr(regs::RB_MISC_IO)) { } } misc_ins_reg; radio_regmap_t(int radio_num) : soft_regmap_t("radio" + std::to_string(radio_num) + "_regmap") { |