diff options
author | Martin Braun <martin.braun@ettus.com> | 2017-10-24 15:54:29 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2017-12-22 15:04:03 -0800 |
commit | f721787d8183ee3fa980fb8131e813b23f1bc5c9 (patch) | |
tree | dc0d26dc483caf1ce086af970469cf0346b3de83 /host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.cpp | |
parent | da3e5bcaaa420245b3ea1cd5c36f0c3d89f21d44 (diff) | |
download | uhd-f721787d8183ee3fa980fb8131e813b23f1bc5c9.tar.gz uhd-f721787d8183ee3fa980fb8131e813b23f1bc5c9.tar.bz2 uhd-f721787d8183ee3fa980fb8131e813b23f1bc5c9.zip |
mg: Add controls for frontpanel- and internal GPIOs
- FP-GPIOs are currently unconnected, we just create the object (pending
FPGA changes)
- One ATR/GPIO controller per radio
- Internal GPIOs (controlling DSA and AD9371 gain bits) are set to
MODE_GPIO, they don't toggle on ATR state change
Diffstat (limited to 'host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.cpp')
-rw-r--r-- | host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.cpp b/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.cpp index 54f2f64cc..2c0f82aa8 100644 --- a/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.cpp +++ b/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.cpp @@ -48,6 +48,8 @@ namespace { const size_t MAGNESIUM_NUM_TX_CHANS = 1; const size_t MAGNESIUM_NUM_RX_CHANS = 1; + const size_t FPGPIO_MASTER_RADIO = 0; + /*! Return a valid 'which' string for use with AD9371 API calls * * These strings take the form of "RX1", "TX2", ... @@ -299,6 +301,36 @@ void magnesium_radio_ctrl_impl::_init_peripherals() } else { UHD_LOG_TRACE("MAGNESIUM", "Not a master radio, no LOs."); } + + _gpio.clear(); // Following the as-if rule, this can get optimized out + for (size_t radio_idx = 0; radio_idx < _get_num_radios(); radio_idx++) { + UHD_LOG_TRACE("MAGNESIUM", + "Initializing GPIOs for channel " << radio_idx); + _gpio.emplace_back( + gpio_atr::gpio_atr_3000::make( + _get_ctrl(radio_idx), + regs::sr_addr(regs::ATR) + ) + ); + // DSA and AD9371 gain bits do *not* toggle on ATR modes. If we ever + // connect anything else to this core, we might need to set_atr_mode() + // to MODE_ATR on those bits. For now, all bits simply do what they're + // told, and don't toggle on RX/TX state changes. + _gpio.back()->set_atr_mode( + usrp::gpio_atr::MODE_GPIO, // Disable ATR mode + usrp::gpio_atr::gpio_atr_3000::MASK_SET_ALL + ); + _gpio.back()->set_gpio_ddr( + usrp::gpio_atr::DDR_OUTPUT, // Make all GPIOs outputs + usrp::gpio_atr::gpio_atr_3000::MASK_SET_ALL + ); + } + + if (get_block_id().get_block_count() == FPGPIO_MASTER_RADIO) { + UHD_LOG_TRACE(unique_id(), "Initializing front-panel GPIO control...") + _fp_gpio = gpio_atr::gpio_atr_3000::make( + _get_ctrl(0), regs::sr_addr(regs::FP_GPIO), regs::RB_FP_GPIO); + } } void magnesium_radio_ctrl_impl::_init_defaults() |