diff options
| author | Martin Braun <martin.braun@ettus.com> | 2020-03-02 15:25:13 -0800 | 
|---|---|---|
| committer | atrnati <54334261+atrnati@users.noreply.github.com> | 2020-03-03 08:51:32 -0600 | 
| commit | 876d4150aa3da531ddd687b48afada6e43f79146 (patch) | |
| tree | fd72a71419f4cd800d4e500cfcaded4dfc8dc367 /host/lib/usrp/dboard/e3xx | |
| parent | 1393553d623bdf4ba40d5435c9719b6ce990d9ac (diff) | |
| download | uhd-876d4150aa3da531ddd687b48afada6e43f79146.tar.gz uhd-876d4150aa3da531ddd687b48afada6e43f79146.tar.bz2 uhd-876d4150aa3da531ddd687b48afada6e43f79146.zip  | |
uhd: Apply clang-format against all .cpp and .hpp files in host/
Note: template_lvbitx.{cpp,hpp} need to be excluded from the list of
files that clang-format gets applied against.
Diffstat (limited to 'host/lib/usrp/dboard/e3xx')
| -rw-r--r-- | host/lib/usrp/dboard/e3xx/e31x_radio_control_impl.cpp | 227 | ||||
| -rw-r--r-- | host/lib/usrp/dboard/e3xx/e31x_radio_control_impl.hpp | 50 | ||||
| -rw-r--r-- | host/lib/usrp/dboard/e3xx/e31x_regs.hpp | 21 | ||||
| -rw-r--r-- | host/lib/usrp/dboard/e3xx/e3xx_ad9361_iface.cpp | 6 | ||||
| -rw-r--r-- | host/lib/usrp/dboard/e3xx/e3xx_ad9361_iface.hpp | 5 | ||||
| -rw-r--r-- | host/lib/usrp/dboard/e3xx/e3xx_bands.cpp | 38 | ||||
| -rw-r--r-- | host/lib/usrp/dboard/e3xx/e3xx_radio_control_impl.cpp | 39 | ||||
| -rw-r--r-- | host/lib/usrp/dboard/e3xx/e3xx_radio_control_impl.hpp | 34 | ||||
| -rw-r--r-- | host/lib/usrp/dboard/e3xx/e3xx_radio_control_init.cpp | 19 | 
9 files changed, 223 insertions, 216 deletions
diff --git a/host/lib/usrp/dboard/e3xx/e31x_radio_control_impl.cpp b/host/lib/usrp/dboard/e3xx/e31x_radio_control_impl.cpp index 8b8daa681..a0d0eeb22 100644 --- a/host/lib/usrp/dboard/e3xx/e31x_radio_control_impl.cpp +++ b/host/lib/usrp/dboard/e3xx/e31x_radio_control_impl.cpp @@ -28,162 +28,147 @@ e31x_radio_control_impl::~e31x_radio_control_impl()  /******************************************************************************   * API Calls   *****************************************************************************/ -uint32_t e31x_radio_control_impl::get_tx_switches( -    const size_t chan, -    const double freq -) { -    RFNOC_LOG_TRACE( -        "Update all TX freq related switches. f=" << freq << " Hz, " -    ); +uint32_t e31x_radio_control_impl::get_tx_switches(const size_t chan, const double freq) +{ +    RFNOC_LOG_TRACE("Update all TX freq related switches. f=" << freq << " Hz, "); -    size_t fe_chan = _fe_swap ? (chan ? 0 : 1): chan; +    size_t fe_chan = _fe_swap ? (chan ? 0 : 1) : chan; -    auto tx_sw1 = TX_SW1_LB_2750;  // SW1 = 0 +    auto tx_sw1    = TX_SW1_LB_2750; // SW1 = 0      auto vctxrx_sw = VCTXRX_SW_OFF; -    auto tx_bias = (fe_chan == 0) ? TX1_BIAS_LB_ON: TX2_BIAS_LB_ON; +    auto tx_bias   = (fe_chan == 0) ? TX1_BIAS_LB_ON : TX2_BIAS_LB_ON;      const auto band = e3xx_radio_control_impl::map_freq_to_tx_band(freq); -    switch(band) { -    case tx_band::LB_80: -        tx_sw1 = TX_SW1_LB_80; -        vctxrx_sw = (fe_chan == 0) ? VCTXRX1_SW_TX_LB: VCTXRX2_SW_TX_LB; -        break; -    case tx_band::LB_160: -        tx_sw1 = TX_SW1_LB_160; -        vctxrx_sw = (fe_chan == 0) ? VCTXRX1_SW_TX_LB: VCTXRX2_SW_TX_LB; -        break; -    case tx_band::LB_225: -        tx_sw1 = TX_SW1_LB_225; -        vctxrx_sw = (fe_chan == 0) ? VCTXRX1_SW_TX_LB: VCTXRX2_SW_TX_LB; -        break; -    case tx_band::LB_400: -        tx_sw1 = TX_SW1_LB_400; -        vctxrx_sw = (fe_chan == 0) ? VCTXRX1_SW_TX_LB: VCTXRX2_SW_TX_LB; -        break; -    case tx_band::LB_575: -        tx_sw1 = TX_SW1_LB_575; -        vctxrx_sw = (fe_chan == 0) ? VCTXRX1_SW_TX_LB: VCTXRX2_SW_TX_LB; -        break; -    case tx_band::LB_1000: -        tx_sw1 = TX_SW1_LB_1000; -        vctxrx_sw = (fe_chan == 0) ? VCTXRX1_SW_TX_LB: VCTXRX2_SW_TX_LB; -        break; -    case tx_band::LB_1700: -        tx_sw1 = TX_SW1_LB_1700; -        vctxrx_sw = (fe_chan == 0) ? VCTXRX1_SW_TX_LB: VCTXRX2_SW_TX_LB; -        break; -    case tx_band::LB_2750: -        tx_sw1 = TX_SW1_LB_2750; -        vctxrx_sw = (fe_chan == 0) ? VCTXRX1_SW_TX_LB: VCTXRX2_SW_TX_LB; -        break; -    case tx_band::HB: -        tx_sw1 = TX_SW1_LB_80; -        vctxrx_sw = VCTXRX_SW_TX_HB; -        tx_bias = (fe_chan == 0) ? TX1_BIAS_HB_ON: TX2_BIAS_HB_ON; -        break; -    case tx_band::INVALID_BAND: -        RFNOC_LOG_ERROR( -            "Cannot map TX frequency to band: " << freq); -        UHD_THROW_INVALID_CODE_PATH(); -        break; +    switch (band) { +        case tx_band::LB_80: +            tx_sw1    = TX_SW1_LB_80; +            vctxrx_sw = (fe_chan == 0) ? VCTXRX1_SW_TX_LB : VCTXRX2_SW_TX_LB; +            break; +        case tx_band::LB_160: +            tx_sw1    = TX_SW1_LB_160; +            vctxrx_sw = (fe_chan == 0) ? VCTXRX1_SW_TX_LB : VCTXRX2_SW_TX_LB; +            break; +        case tx_band::LB_225: +            tx_sw1    = TX_SW1_LB_225; +            vctxrx_sw = (fe_chan == 0) ? VCTXRX1_SW_TX_LB : VCTXRX2_SW_TX_LB; +            break; +        case tx_band::LB_400: +            tx_sw1    = TX_SW1_LB_400; +            vctxrx_sw = (fe_chan == 0) ? VCTXRX1_SW_TX_LB : VCTXRX2_SW_TX_LB; +            break; +        case tx_band::LB_575: +            tx_sw1    = TX_SW1_LB_575; +            vctxrx_sw = (fe_chan == 0) ? VCTXRX1_SW_TX_LB : VCTXRX2_SW_TX_LB; +            break; +        case tx_band::LB_1000: +            tx_sw1    = TX_SW1_LB_1000; +            vctxrx_sw = (fe_chan == 0) ? VCTXRX1_SW_TX_LB : VCTXRX2_SW_TX_LB; +            break; +        case tx_band::LB_1700: +            tx_sw1    = TX_SW1_LB_1700; +            vctxrx_sw = (fe_chan == 0) ? VCTXRX1_SW_TX_LB : VCTXRX2_SW_TX_LB; +            break; +        case tx_band::LB_2750: +            tx_sw1    = TX_SW1_LB_2750; +            vctxrx_sw = (fe_chan == 0) ? VCTXRX1_SW_TX_LB : VCTXRX2_SW_TX_LB; +            break; +        case tx_band::HB: +            tx_sw1    = TX_SW1_LB_80; +            vctxrx_sw = VCTXRX_SW_TX_HB; +            tx_bias   = (fe_chan == 0) ? TX1_BIAS_HB_ON : TX2_BIAS_HB_ON; +            break; +        case tx_band::INVALID_BAND: +            RFNOC_LOG_ERROR("Cannot map TX frequency to band: " << freq); +            UHD_THROW_INVALID_CODE_PATH(); +            break;      }      RFNOC_LOG_TRACE("TX band = " << int(band) << "TX SW1 = " << tx_sw1                                   << "TX VCTXRX_SW = " << vctxrx_sw                                   << "TX_BIAS = " << tx_bias); -    auto tx_regs = 0 | -             vctxrx_sw << VCTXRX_SW_SHIFT | -             tx_bias << TX_BIAS_SHIFT | -             tx_sw1 << TX_SW1_SHIFT; +    auto tx_regs = 0 | vctxrx_sw << VCTXRX_SW_SHIFT | tx_bias << TX_BIAS_SHIFT +                   | tx_sw1 << TX_SW1_SHIFT;      return tx_regs;  }  uint32_t e31x_radio_control_impl::get_rx_switches( -    const size_t chan, -    const double freq, -    const std::string &ant -){ +    const size_t chan, const double freq, const std::string& ant) +{      RFNOC_LOG_TRACE("Update all E310 RX freq related switches. f=" << freq << " Hz, "); -    size_t fe_chan = _fe_swap ? (chan ? 0 : 1): chan; +    size_t fe_chan = _fe_swap ? (chan ? 0 : 1) : chan;      // Default to OFF -    auto rx_sw1 = RX_SW1_OFF; -    auto rx_swc = RX_SWC_OFF; -    auto rx_swb = RX_SWB_OFF; +    auto rx_sw1    = RX_SW1_OFF; +    auto rx_swc    = RX_SWC_OFF; +    auto rx_swb    = RX_SWB_OFF;      auto vctxrx_sw = VCTXRX_SW_OFF; -    auto vcrx_sw = (ant == "TX/RX") ? VCRX_TXRX_SW_LB: VCRX_RX_SW_LB; +    auto vcrx_sw   = (ant == "TX/RX") ? VCRX_TXRX_SW_LB : VCRX_RX_SW_LB;      if (ant == "TX/RX") { -        vctxrx_sw = (fe_chan == 0) ? VCTXRX1_SW_RX: VCTXRX2_SW_RX; +        vctxrx_sw = (fe_chan == 0) ? VCTXRX1_SW_RX : VCTXRX2_SW_RX;      }      const auto band = e3xx_radio_control_impl::map_freq_to_rx_band(freq); -    switch(band) { -    case rx_band::LB_B2: -        rx_sw1 = (fe_chan == 0) ? RX1_SW1_LB_B2: RX2_SW1_LB_B2; -        rx_swc = (fe_chan == 0) ? RX1_SWC_LB_B2: RX2_SWC_LB_B2; -        rx_swb = RX_SWB_OFF; -        break; -    case rx_band::LB_B3: -        rx_sw1 = (fe_chan == 0) ? RX1_SW1_LB_B3: RX2_SW1_LB_B3; -        rx_swc = (fe_chan == 0) ? RX1_SWC_LB_B3: RX2_SWC_LB_B3; -        rx_swb = RX_SWB_OFF; -        break; -    case rx_band::LB_B4: -        rx_sw1 = (fe_chan == 0) ? RX1_SW1_LB_B4: RX2_SW1_LB_B4; -        rx_swc = (fe_chan == 0) ? RX1_SWC_LB_B4: RX2_SWC_LB_B4; -        rx_swb = RX_SWB_OFF; -        break; -    case rx_band::LB_B5: -        rx_sw1 = (fe_chan == 0) ? RX1_SW1_LB_B5: RX2_SW1_LB_B5; -        rx_swc = RX_SWC_OFF; -        rx_swb = (fe_chan == 0) ? RX1_SWB_LB_B5: RX2_SWB_LB_B5; -        break; -    case rx_band::LB_B6: -        rx_sw1 = (fe_chan == 0) ? RX1_SW1_LB_B6: RX2_SW1_LB_B6; -        rx_swc = RX_SWC_OFF; -        rx_swb = (fe_chan == 0) ? RX1_SWB_LB_B6: RX2_SWB_LB_B6; -        break; -    case rx_band::LB_B7: -        rx_sw1 = (fe_chan == 0) ? RX1_SW1_LB_B7: RX2_SW1_LB_B7; -        rx_swc = RX_SWC_OFF; -        rx_swb = (fe_chan == 0) ? RX1_SWB_LB_B7: RX2_SWB_LB_B7; -        break; -    case rx_band::HB: -        rx_sw1 = RX_SW1_OFF; -        rx_swc = RX_SWC_OFF; -        rx_swb = RX_SWB_OFF; -        vcrx_sw = (ant == "TX/RX") ? VCRX_TXRX_SW_HB: VCRX_RX_SW_HB; -        break; -    case rx_band::INVALID_BAND: -        RFNOC_LOG_ERROR("Cannot map RX frequency to band: " << freq); -        UHD_THROW_INVALID_CODE_PATH(); -        break; +    switch (band) { +        case rx_band::LB_B2: +            rx_sw1 = (fe_chan == 0) ? RX1_SW1_LB_B2 : RX2_SW1_LB_B2; +            rx_swc = (fe_chan == 0) ? RX1_SWC_LB_B2 : RX2_SWC_LB_B2; +            rx_swb = RX_SWB_OFF; +            break; +        case rx_band::LB_B3: +            rx_sw1 = (fe_chan == 0) ? RX1_SW1_LB_B3 : RX2_SW1_LB_B3; +            rx_swc = (fe_chan == 0) ? RX1_SWC_LB_B3 : RX2_SWC_LB_B3; +            rx_swb = RX_SWB_OFF; +            break; +        case rx_band::LB_B4: +            rx_sw1 = (fe_chan == 0) ? RX1_SW1_LB_B4 : RX2_SW1_LB_B4; +            rx_swc = (fe_chan == 0) ? RX1_SWC_LB_B4 : RX2_SWC_LB_B4; +            rx_swb = RX_SWB_OFF; +            break; +        case rx_band::LB_B5: +            rx_sw1 = (fe_chan == 0) ? RX1_SW1_LB_B5 : RX2_SW1_LB_B5; +            rx_swc = RX_SWC_OFF; +            rx_swb = (fe_chan == 0) ? RX1_SWB_LB_B5 : RX2_SWB_LB_B5; +            break; +        case rx_band::LB_B6: +            rx_sw1 = (fe_chan == 0) ? RX1_SW1_LB_B6 : RX2_SW1_LB_B6; +            rx_swc = RX_SWC_OFF; +            rx_swb = (fe_chan == 0) ? RX1_SWB_LB_B6 : RX2_SWB_LB_B6; +            break; +        case rx_band::LB_B7: +            rx_sw1 = (fe_chan == 0) ? RX1_SW1_LB_B7 : RX2_SW1_LB_B7; +            rx_swc = RX_SWC_OFF; +            rx_swb = (fe_chan == 0) ? RX1_SWB_LB_B7 : RX2_SWB_LB_B7; +            break; +        case rx_band::HB: +            rx_sw1  = RX_SW1_OFF; +            rx_swc  = RX_SWC_OFF; +            rx_swb  = RX_SWB_OFF; +            vcrx_sw = (ant == "TX/RX") ? VCRX_TXRX_SW_HB : VCRX_RX_SW_HB; +            break; +        case rx_band::INVALID_BAND: +            RFNOC_LOG_ERROR("Cannot map RX frequency to band: " << freq); +            UHD_THROW_INVALID_CODE_PATH(); +            break;      }      RFNOC_LOG_TRACE("RX SW1=" << rx_sw1 << " RX SWC=" << rx_swc << " RX SWB=" << rx_swb                                << " RX VCRX_SW=" << vcrx_sw                                << " RX VCTXRX_SW=" << vctxrx_sw); -    auto rx_regs = 0 | -             vcrx_sw << VCRX_SW_SHIFT | -             vctxrx_sw << VCTXRX_SW_SHIFT | -             rx_swc << RX_SWC_SHIFT | -             rx_swb << RX_SWB_SHIFT | -             rx_sw1 << RX_SW1_SHIFT; +    auto rx_regs = 0 | vcrx_sw << VCRX_SW_SHIFT | vctxrx_sw << VCTXRX_SW_SHIFT +                   | rx_swc << RX_SWC_SHIFT | rx_swb << RX_SWB_SHIFT +                   | rx_sw1 << RX_SW1_SHIFT;      return rx_regs;  }  uint32_t e31x_radio_control_impl::get_idle_switches()  { -    uint32_t idle_regs = VCRX_SW_OFF << VCRX_SW_SHIFT | -                        VCTXRX_SW_OFF << VCTXRX_SW_SHIFT | -                        TX_BIAS_OFF << TX_BIAS_SHIFT | -                        RX_SWC_OFF << RX_SWC_SHIFT | -                        RX_SWB_OFF << RX_SWB_SHIFT | -                        RX_SW1_OFF << RX_SW1_SHIFT | -                        TX_SW1_LB_2750 << TX_SW1_SHIFT; +    uint32_t idle_regs = VCRX_SW_OFF << VCRX_SW_SHIFT | VCTXRX_SW_OFF << VCTXRX_SW_SHIFT +                         | TX_BIAS_OFF << TX_BIAS_SHIFT | RX_SWC_OFF << RX_SWC_SHIFT +                         | RX_SWB_OFF << RX_SWB_SHIFT | RX_SW1_OFF << RX_SW1_SHIFT +                         | TX_SW1_LB_2750 << TX_SW1_SHIFT;      return idle_regs;  } diff --git a/host/lib/usrp/dboard/e3xx/e31x_radio_control_impl.hpp b/host/lib/usrp/dboard/e3xx/e31x_radio_control_impl.hpp index 1c37f4077..04fa800e2 100644 --- a/host/lib/usrp/dboard/e3xx/e31x_radio_control_impl.hpp +++ b/host/lib/usrp/dboard/e3xx/e31x_radio_control_impl.hpp @@ -6,10 +6,10 @@  //  #ifndef INCLUDED_LIBUHD_RFNOC_E31X_RADIO_CTRL_IMPL_HPP -#define INCLUDED_LIBUHD_RFNOC_E31X_RADIO_CTRL_IMPL_HPP +#    define INCLUDED_LIBUHD_RFNOC_E31X_RADIO_CTRL_IMPL_HPP -#include "e3xx_constants.hpp" -#include "e3xx_radio_control_impl.hpp" +#    include "e3xx_constants.hpp" +#    include "e3xx_radio_control_impl.hpp"  namespace {  static constexpr char E31x_GPIO_BANK[] = "INT0"; @@ -41,11 +41,11 @@ private:       * ATR/ Switches Types       *************************************************************************/      enum tx_sw1_t { -        TX_SW1_LB_80 = 7, -        TX_SW1_LB_160 = 6, -        TX_SW1_LB_225 = 5, -        TX_SW1_LB_400 = 4, -        TX_SW1_LB_575 = 3, +        TX_SW1_LB_80   = 7, +        TX_SW1_LB_160  = 6, +        TX_SW1_LB_225  = 5, +        TX_SW1_LB_400  = 4, +        TX_SW1_LB_575  = 3,          TX_SW1_LB_1000 = 2,          TX_SW1_LB_1700 = 1,          TX_SW1_LB_2750 = 0, @@ -53,12 +53,12 @@ private:      };      enum vctxrx_sw_t { -        VCTXRX_SW_TX_HB = 3, +        VCTXRX_SW_TX_HB  = 3,          VCTXRX1_SW_TX_LB = 1, -        VCTXRX1_SW_RX = 2, +        VCTXRX1_SW_RX    = 2,          VCTXRX2_SW_TX_LB = 2, -        VCTXRX2_SW_RX = 1, -        VCTXRX_SW_OFF = 0, +        VCTXRX2_SW_RX    = 1, +        VCTXRX_SW_OFF    = 0,      };      enum rx_sw1_t { @@ -74,7 +74,7 @@ private:          RX1_SW1_LB_B5 = 1,          RX1_SW1_LB_B6 = 3,          RX1_SW1_LB_B7 = 5, -        RX_SW1_OFF = 7 +        RX_SW1_OFF    = 7      };      enum rx_swc_t { @@ -84,7 +84,7 @@ private:          RX1_SWC_LB_B2 = 2,          RX1_SWC_LB_B3 = 3,          RX1_SWC_LB_B4 = 1, -        RX_SWC_OFF = 0 +        RX_SWC_OFF    = 0      };      enum rx_swb_t { @@ -94,15 +94,15 @@ private:          RX1_SWB_LB_B5 = 2,          RX1_SWB_LB_B6 = 3,          RX1_SWB_LB_B7 = 1, -        RX_SWB_OFF = 0 +        RX_SWB_OFF    = 0      };      enum vcrx_sw_t { -        VCRX_RX_SW_LB = 1, -        VCRX_RX_SW_HB = 2, +        VCRX_RX_SW_LB   = 1, +        VCRX_RX_SW_HB   = 2,          VCRX_TXRX_SW_LB = 2,          VCRX_TXRX_SW_HB = 1, -        VCRX_SW_OFF = 0 //or 3 +        VCRX_SW_OFF     = 0 // or 3      };      // (TX_ENABLEB, TX_ENABLEA) @@ -111,7 +111,7 @@ private:          TX1_BIAS_LB_ON = 2,          TX2_BIAS_HB_ON = 1,          TX2_BIAS_LB_ON = 2, -        TX_BIAS_OFF = 0 +        TX_BIAS_OFF    = 0      };      /************************************************************************ @@ -123,15 +123,9 @@ private:      };      uint32_t get_rx_switches( -        const size_t chan, -        const double freq, -        const std::string &ant -    ); - -    uint32_t get_tx_switches( -        const size_t chan, -        const double freq -    ); +        const size_t chan, const double freq, const std::string& ant); + +    uint32_t get_tx_switches(const size_t chan, const double freq);      uint32_t get_idle_switches(); diff --git a/host/lib/usrp/dboard/e3xx/e31x_regs.hpp b/host/lib/usrp/dboard/e3xx/e31x_regs.hpp index 15ce90743..11d92b953 100644 --- a/host/lib/usrp/dboard/e3xx/e31x_regs.hpp +++ b/host/lib/usrp/dboard/e3xx/e31x_regs.hpp @@ -10,17 +10,16 @@  #include <uhd/config.hpp>  #include <cstdint> -static const uint32_t VCRX_SW_SHIFT = 14; -static const uint32_t VCTXRX_SW_SHIFT  = 12; -static const uint32_t TX_BIAS_SHIFT  = 10; -static const uint32_t RX_SWC_SHIFT  = 8; -static const uint32_t RX_SWB_SHIFT  = 6; -static const uint32_t RX_SW1_SHIFT  = 3; -static const uint32_t TX_SW1_SHIFT  = 0; +static const uint32_t VCRX_SW_SHIFT   = 14; +static const uint32_t VCTXRX_SW_SHIFT = 12; +static const uint32_t TX_BIAS_SHIFT   = 10; +static const uint32_t RX_SWC_SHIFT    = 8; +static const uint32_t RX_SWB_SHIFT    = 6; +static const uint32_t RX_SW1_SHIFT    = 3; +static const uint32_t TX_SW1_SHIFT    = 0; -static const uint32_t LED_RX_RX_SHIFT  = 2; -static const uint32_t LED_TXRX_TX_SHIFT  = 1; -static const uint32_t LED_TXRX_RX_SHIFT  = 0; +static const uint32_t LED_RX_RX_SHIFT   = 2; +static const uint32_t LED_TXRX_TX_SHIFT = 1; +static const uint32_t LED_TXRX_RX_SHIFT = 0;  #endif /* INCLUDED_E31X_REGS_HPP */ - diff --git a/host/lib/usrp/dboard/e3xx/e3xx_ad9361_iface.cpp b/host/lib/usrp/dboard/e3xx/e3xx_ad9361_iface.cpp index d9cadc86f..acd0be211 100644 --- a/host/lib/usrp/dboard/e3xx/e3xx_ad9361_iface.cpp +++ b/host/lib/usrp/dboard/e3xx/e3xx_ad9361_iface.cpp @@ -147,10 +147,12 @@ ad9361_ctrl::sptr make_rpc(rpc_client::sptr rpcc)  /*! Helper function to convert direction and channel to the 'which' required by most     Catalina driver functions */ -std::string get_which_ad9361_chain(const direction_t dir, const size_t chan, const bool fe_swap) +std::string get_which_ad9361_chain( +    const direction_t dir, const size_t chan, const bool fe_swap)  {      UHD_ASSERT_THROW(dir == RX_DIRECTION or dir == TX_DIRECTION);      UHD_ASSERT_THROW(chan == 0 or chan == 1);      size_t ad9361_chan = fe_swap ? (chan ? 0 : 1) : chan; -    return str(boost::format("%s%d") % (dir == RX_DIRECTION ? "RX" : "TX") % (ad9361_chan + 1)); +    return str( +        boost::format("%s%d") % (dir == RX_DIRECTION ? "RX" : "TX") % (ad9361_chan + 1));  } diff --git a/host/lib/usrp/dboard/e3xx/e3xx_ad9361_iface.hpp b/host/lib/usrp/dboard/e3xx/e3xx_ad9361_iface.hpp index 129015420..fe694b05c 100644 --- a/host/lib/usrp/dboard/e3xx/e3xx_ad9361_iface.hpp +++ b/host/lib/usrp/dboard/e3xx/e3xx_ad9361_iface.hpp @@ -5,7 +5,7 @@  //  #ifndef INCLUDED_LIBUHD_RFNOC_E3XX_AD9361_IFACE_HPP -#define INCLUDED_LIBUHD_RFNOC_E3XX_AD9361_IFACE_HPP +#    define INCLUDED_LIBUHD_RFNOC_E3XX_AD9361_IFACE_HPP  #    include <uhd/types/direction.hpp>  #    include <uhd/types/filters.hpp> @@ -22,7 +22,8 @@ using namespace uhd::usrp;  static constexpr size_t E3XX_TUNE_TIMEOUT = 60000;  static constexpr size_t E3XX_RATE_TIMEOUT = 60000;  ad9361_ctrl::sptr make_rpc(rpc_client::sptr rpcc); -std::string get_which_ad9361_chain(const direction_t dir, const size_t chan, const bool fe_swap=false); +std::string get_which_ad9361_chain( +    const direction_t dir, const size_t chan, const bool fe_swap = false);  #endif /* INCLUDED_LIBUHD_RFNOC_E3XX_AD9361_IFACE_HPP */  // vim: sw=4 et: diff --git a/host/lib/usrp/dboard/e3xx/e3xx_bands.cpp b/host/lib/usrp/dboard/e3xx/e3xx_bands.cpp index d3dc99fec..e28acf3b9 100644 --- a/host/lib/usrp/dboard/e3xx/e3xx_bands.cpp +++ b/host/lib/usrp/dboard/e3xx/e3xx_bands.cpp @@ -49,17 +49,27 @@   * E31x frequency bands:   *   * For RX: (chan here is fe_chan - swapped) - *     Band   Freq         RX_BSEL-210       RXC_BSEL-10   RXB_BSEL-10         RX2                TX/RX - *                                                                          VCRX_V1_V2        VCTXRX_V1_V2 - *                         chan1 | chan2   chan1 | chan2  chan1 | chan2  RX ant | TXRX ant   chan2 | chan1 - *     ---------------------------------------------------------------------------------------------------- - *     LB_B2: < 450       RF5 100  RF6 101  J2 10   J1 01   -- 00  -- 00    01    10         J2 10    J1 01 - *     LB_B3: 450-700     RF3 010  RF4 011  J3 11   J3 11   -- 00  -- 00    01    10         J2 10    J1 01 - *     LB_B4: 700-1200    RF1 000  RF2 001  J1 01   J2 10   -- 00  -- 00    01    10         J2 10    J1 01 - *     LB_B5: 1200-1800   RF2 001  RF1 000  -- 00   -- 00   J2 10  J1 01    01    10         J2 10    J1 01 - *     LB_B6: 1800-2350   RF4 011  RF3 010  -- 00   -- 00   J3 11  J3 11    01    10         J2 10    J1 01 - *     LB_B7: 2350-2600   RF6 101  RF5 100  -- 00   -- 00   J1 01  J2 10    01    10         J2 10    J1 01 - *     HB:    2600+       --- 111  --- 111  -- 00   -- 00   -- 00  -- 00    10    01         J2 10    J1 01 + *     Band   Freq         RX_BSEL-210       RXC_BSEL-10   RXB_BSEL-10         RX2 TX/RX + *                                                                          VCRX_V1_V2 + VCTXRX_V1_V2 + *                         chan1 | chan2   chan1 | chan2  chan1 | chan2  RX ant | TXRX ant + chan2 | chan1 + * + ---------------------------------------------------------------------------------------------------- + *     LB_B2: < 450       RF5 100  RF6 101  J2 10   J1 01   -- 00  -- 00    01    10 J2 10 + J1 01 + *     LB_B3: 450-700     RF3 010  RF4 011  J3 11   J3 11   -- 00  -- 00    01    10 J2 10 + J1 01 + *     LB_B4: 700-1200    RF1 000  RF2 001  J1 01   J2 10   -- 00  -- 00    01    10 J2 10 + J1 01 + *     LB_B5: 1200-1800   RF2 001  RF1 000  -- 00   -- 00   J2 10  J1 01    01    10 J2 10 + J1 01 + *     LB_B6: 1800-2350   RF4 011  RF3 010  -- 00   -- 00   J3 11  J3 11    01    10 J2 10 + J1 01 + *     LB_B7: 2350-2600   RF6 101  RF5 100  -- 00   -- 00   J1 01  J2 10    01    10 J2 10 + J1 01 + *     HB:    2600+       --- 111  --- 111  -- 00   -- 00   -- 00  -- 00    10    01 J2 10 + J1 01   *   *   * For TX: @@ -131,7 +141,8 @@ constexpr double E3XX_TX_LB_2750_MIN_FREQ = 1842.6e6;  constexpr double E3XX_TX_HB_MIN_FREQ      = 2940.0e6;  } // namespace -e3xx_radio_control_impl::rx_band e3xx_radio_control_impl::map_freq_to_rx_band(const double freq) +e3xx_radio_control_impl::rx_band e3xx_radio_control_impl::map_freq_to_rx_band( +    const double freq)  {      e3xx_radio_control_impl::rx_band band; @@ -158,7 +169,8 @@ e3xx_radio_control_impl::rx_band e3xx_radio_control_impl::map_freq_to_rx_band(co      return band;  } -e3xx_radio_control_impl::tx_band e3xx_radio_control_impl::map_freq_to_tx_band(const double freq) +e3xx_radio_control_impl::tx_band e3xx_radio_control_impl::map_freq_to_tx_band( +    const double freq)  {      e3xx_radio_control_impl::tx_band band; diff --git a/host/lib/usrp/dboard/e3xx/e3xx_radio_control_impl.cpp b/host/lib/usrp/dboard/e3xx/e3xx_radio_control_impl.cpp index bc9ed9169..49a9a9bda 100644 --- a/host/lib/usrp/dboard/e3xx/e3xx_radio_control_impl.cpp +++ b/host/lib/usrp/dboard/e3xx/e3xx_radio_control_impl.cpp @@ -75,7 +75,7 @@ void e3xx_radio_control_impl::deinit()   * API Calls   *****************************************************************************/  bool e3xx_radio_control_impl::check_topology(const std::vector<size_t>& connected_inputs, -        const std::vector<size_t>& connected_outputs) +    const std::vector<size_t>& connected_outputs)  {      if (!node_t::check_topology(connected_inputs, connected_outputs)) {          return false; @@ -112,7 +112,7 @@ bool e3xx_radio_control_impl::check_topology(const std::vector<size_t>& connecte      RFNOC_LOG_TRACE("RX FE0 Active: " << rx_fe0_active);      RFNOC_LOG_TRACE("RX FE1 Active: " << rx_fe1_active); -    //setup the active chains in the codec +    // setup the active chains in the codec      if (connected_inputs.size() + connected_outputs.size() == 0) {          // Ensure at least one RX chain is enabled so AD9361 outputs a sample clock          this->set_streaming_mode(true, false, true, false); @@ -252,19 +252,21 @@ void e3xx_radio_control_impl::set_rx_agc(const bool enb, const size_t chan)      _ad9361->set_agc(rx_fe, enb);  } -double e3xx_radio_control_impl::set_rx_bandwidth(const double bandwidth, const size_t chan) +double e3xx_radio_control_impl::set_rx_bandwidth( +    const double bandwidth, const size_t chan)  {      std::lock_guard<std::mutex> l(_set_lock); -    double clipped_bw = -        _ad9361->set_bw_filter(get_which_ad9361_chain(RX_DIRECTION, chan, _fe_swap), bandwidth); +    double clipped_bw = _ad9361->set_bw_filter( +        get_which_ad9361_chain(RX_DIRECTION, chan, _fe_swap), bandwidth);      return radio_control_impl::set_rx_bandwidth(clipped_bw, chan);  } -double e3xx_radio_control_impl::set_tx_bandwidth(const double bandwidth, const size_t chan) +double e3xx_radio_control_impl::set_tx_bandwidth( +    const double bandwidth, const size_t chan)  {      std::lock_guard<std::mutex> l(_set_lock); -    double clipped_bw = -        _ad9361->set_bw_filter(get_which_ad9361_chain(TX_DIRECTION, chan, _fe_swap), bandwidth); +    double clipped_bw = _ad9361->set_bw_filter( +        get_which_ad9361_chain(TX_DIRECTION, chan, _fe_swap), bandwidth);      return radio_control_impl::set_tx_bandwidth(clipped_bw, chan);  } @@ -429,7 +431,7 @@ void e3xx_radio_control_impl::loopback_self_test(const size_t chan)      // Set 2R2T mode, stream on all channels      this->set_streaming_mode(true, true, true, true);      // This was in there in the E320 code, but the comments didn't make sense: -    //this->set_streaming_mode(true, true, true, true); +    // this->set_streaming_mode(true, true, true, true);      // Set maximum rate for 2R2T mode      /* FIXME       * We're directly setting the master clock rate here because we want to @@ -457,29 +459,34 @@ void e3xx_radio_control_impl::loopback_self_test(const size_t chan)          boost::hash_combine(hash, i);          const uint32_t word32 = uint32_t(hash) & 0xfff0fff0;          // Write test word to codec_idle idle register (on TX side) -        regs().poke32( -            regmap::RADIO_BASE_ADDR + chan * regmap::REG_CHAN_OFFSET + regmap::REG_TX_IDLE_VALUE, word32); +        regs().poke32(regmap::RADIO_BASE_ADDR + chan * regmap::REG_CHAN_OFFSET +                          + regmap::REG_TX_IDLE_VALUE, +            word32);          // Read back values - TX is lower 32-bits and RX is upper 32-bits          const uint32_t rb_tx = -            regs().peek32(regmap::RADIO_BASE_ADDR + chan * regmap::REG_CHAN_OFFSET + regmap::REG_TX_IDLE_VALUE); +            regs().peek32(regmap::RADIO_BASE_ADDR + chan * regmap::REG_CHAN_OFFSET +                          + regmap::REG_TX_IDLE_VALUE);          const uint32_t rb_rx = -            regs().peek32(regmap::RADIO_BASE_ADDR + chan * regmap::REG_CHAN_OFFSET + regmap::REG_RX_DATA); +            regs().peek32(regmap::RADIO_BASE_ADDR + chan * regmap::REG_CHAN_OFFSET +                          + regmap::REG_RX_DATA);          // Compare TX and RX values to test word          bool test_fail = word32 != rb_tx or word32 != rb_rx;          if (test_fail) {              RFNOC_LOG_WARNING(                  "CODEC loopback test failed! " -                    << boost::format("Expected: 0x%08X Received (TX/RX): 0x%08X/0x%08X") -                           % word32 % rb_tx % rb_rx); +                << boost::format("Expected: 0x%08X Received (TX/RX): 0x%08X/0x%08X") +                       % word32 % rb_tx % rb_rx);              throw uhd::runtime_error("CODEC loopback test failed.");          }      }      RFNOC_LOG_INFO("CODEC loopback test passed");      // Zero out the idle data. -    regs().poke32(regmap::RADIO_BASE_ADDR + chan * regmap::REG_CHAN_OFFSET + regmap::REG_TX_IDLE_VALUE, 0); +    regs().poke32(regmap::RADIO_BASE_ADDR + chan * regmap::REG_CHAN_OFFSET +                      + regmap::REG_TX_IDLE_VALUE, +        0);      // Take AD936x out of loopback mode      _ad9361->data_port_loopback(false); diff --git a/host/lib/usrp/dboard/e3xx/e3xx_radio_control_impl.hpp b/host/lib/usrp/dboard/e3xx/e3xx_radio_control_impl.hpp index f49cde64a..d5714634c 100644 --- a/host/lib/usrp/dboard/e3xx/e3xx_radio_control_impl.hpp +++ b/host/lib/usrp/dboard/e3xx/e3xx_radio_control_impl.hpp @@ -9,11 +9,11 @@  #define INCLUDED_LIBUHD_RFNOC_E3XX_RADIO_CTRL_IMPL_HPP  #include "e3xx_ad9361_iface.hpp" +#include <uhd/rfnoc/filter_node.hpp>  #include <uhd/types/eeprom.hpp>  #include <uhd/types/serial.hpp>  #include <uhd/usrp/dboard_manager.hpp>  #include <uhd/usrp/gpio_defs.hpp> -#include <uhd/rfnoc/filter_node.hpp>  #include <uhdlib/rfnoc/radio_control_impl.hpp>  #include <uhdlib/usrp/common/mpmd_mb_controller.hpp>  #include <uhdlib/usrp/cores/gpio_atr_3000.hpp> @@ -22,22 +22,23 @@  namespace uhd { namespace rfnoc {  namespace e3xx_regs { -    constexpr uint32_t PERIPH_BASE            = 0x80000; -    constexpr uint32_t PERIPH_REG_OFFSET      = 8; -    constexpr uint32_t PERIPH_REG_CHAN_OFFSET = 0x800; -    constexpr uint32_t SR_LEDS                = PERIPH_BASE + 176 * PERIPH_REG_OFFSET; -    constexpr uint32_t SR_FP_GPIO             = PERIPH_BASE + 184 * PERIPH_REG_OFFSET; -    constexpr uint32_t SR_DB_GPIO             = PERIPH_BASE + 192 * PERIPH_REG_OFFSET; +constexpr uint32_t PERIPH_BASE            = 0x80000; +constexpr uint32_t PERIPH_REG_OFFSET      = 8; +constexpr uint32_t PERIPH_REG_CHAN_OFFSET = 0x800; +constexpr uint32_t SR_LEDS                = PERIPH_BASE + 176 * PERIPH_REG_OFFSET; +constexpr uint32_t SR_FP_GPIO             = PERIPH_BASE + 184 * PERIPH_REG_OFFSET; +constexpr uint32_t SR_DB_GPIO             = PERIPH_BASE + 192 * PERIPH_REG_OFFSET; -    constexpr uint32_t RB_DB_GPIO = PERIPH_BASE + 19 * PERIPH_REG_OFFSET; -    constexpr uint32_t RB_FP_GPIO = PERIPH_BASE + 20 * PERIPH_REG_OFFSET; +constexpr uint32_t RB_DB_GPIO = PERIPH_BASE + 19 * PERIPH_REG_OFFSET; +constexpr uint32_t RB_FP_GPIO = PERIPH_BASE + 20 * PERIPH_REG_OFFSET; -} +} // namespace e3xx_regs  /*! \brief Provide access to an E3xx radio.   */ -class e3xx_radio_control_impl : public radio_control_impl, public uhd::rfnoc::detail::filter_node +class e3xx_radio_control_impl : public radio_control_impl, +                                public uhd::rfnoc::detail::filter_node  {  public:      //! Frequency bands for RX. Bands are a function of the analog filter banks @@ -78,7 +79,7 @@ public:      void deinit();      bool check_topology(const std::vector<size_t>& connected_inputs, -            const std::vector<size_t>& connected_outputs); +        const std::vector<size_t>& connected_outputs);      /************************************************************************       * radio_control API calls @@ -87,8 +88,8 @@ public:      uhd::meta_range_t get_rate_range() const;      // Setters -    void set_tx_antenna(const std::string &ant, const size_t chan); -    void set_rx_antenna(const std::string &ant, const size_t chan); +    void set_tx_antenna(const std::string& ant, const size_t chan); +    void set_rx_antenna(const std::string& ant, const size_t chan);      double set_tx_frequency(const double freq, const size_t chan);      double set_rx_frequency(const double freq, const size_t chan);      double set_tx_gain(const double gain, const size_t chan); @@ -144,7 +145,10 @@ public:      /**************************************************************************       * Radio Identification API Calls       *************************************************************************/ -    std::string get_slot_name() const { return "A"; } +    std::string get_slot_name() const +    { +        return "A"; +    }      virtual size_t get_chan_from_dboard_fe(          const std::string& fe, const uhd::direction_t direction) const;      virtual std::string get_dboard_fe_from_chan( diff --git a/host/lib/usrp/dboard/e3xx/e3xx_radio_control_init.cpp b/host/lib/usrp/dboard/e3xx/e3xx_radio_control_init.cpp index 6ecf4ff2a..f44bdaeb7 100644 --- a/host/lib/usrp/dboard/e3xx/e3xx_radio_control_init.cpp +++ b/host/lib/usrp/dboard/e3xx/e3xx_radio_control_init.cpp @@ -103,8 +103,10 @@ void e3xx_radio_control_impl::_init_peripherals()              usrp::gpio_atr::MODE_ATR, usrp::gpio_atr::gpio_atr_3000::MASK_SET_ALL);      }      RFNOC_LOG_TRACE("Initializing front-panel GPIO control...") -    _fp_gpio = usrp::gpio_atr::gpio_atr_3000::make( -        _wb_ifaces.at(0), e3xx_regs::SR_FP_GPIO, e3xx_regs::RB_FP_GPIO, e3xx_regs::PERIPH_REG_OFFSET); +    _fp_gpio = usrp::gpio_atr::gpio_atr_3000::make(_wb_ifaces.at(0), +        e3xx_regs::SR_FP_GPIO, +        e3xx_regs::RB_FP_GPIO, +        e3xx_regs::PERIPH_REG_OFFSET);      auto block_args = get_block_args(); @@ -123,9 +125,9 @@ void e3xx_radio_control_impl::_init_frontend_subtree(  {      const fs_path tx_fe_path = fs_path("tx_frontends") / chan_idx;      const fs_path rx_fe_path = fs_path("rx_frontends") / chan_idx; -    RFNOC_LOG_TRACE( -        "Adding non-RFNoC block properties for channel " -            << chan_idx << " to prop tree path " << tx_fe_path << " and " << rx_fe_path); +    RFNOC_LOG_TRACE("Adding non-RFNoC block properties for channel " +                    << chan_idx << " to prop tree path " << tx_fe_path << " and " +                    << rx_fe_path);      // TX Standard attributes      subtree->create<std::string>(tx_fe_path / "name").set("E3xx");      subtree->create<std::string>(tx_fe_path / "connection").set("IQ"); @@ -242,7 +244,8 @@ void e3xx_radio_control_impl::_init_frontend_subtree(      auto rx_sensor_names = get_rx_sensor_names(chan_idx);      for (const auto& rx_sensor_name : rx_sensor_names) {          RFNOC_LOG_TRACE("Adding RX sensor " << rx_sensor_name); -        get_tree()->create<sensor_value_t>(rx_fe_path / "sensors" / rx_sensor_name) +        get_tree() +            ->create<sensor_value_t>(rx_fe_path / "sensors" / rx_sensor_name)              .add_coerced_subscriber([](const sensor_value_t&) {                  throw uhd::runtime_error("Attempting to write to sensor!");              }) @@ -253,7 +256,8 @@ void e3xx_radio_control_impl::_init_frontend_subtree(      auto tx_sensor_names = get_tx_sensor_names(chan_idx);      for (const auto& tx_sensor_name : tx_sensor_names) {          RFNOC_LOG_TRACE("Adding TX sensor " << tx_sensor_name); -        get_tree()->create<sensor_value_t>(tx_fe_path / "sensors" / tx_sensor_name) +        get_tree() +            ->create<sensor_value_t>(tx_fe_path / "sensors" / tx_sensor_name)              .add_coerced_subscriber([](const sensor_value_t&) {                  throw uhd::runtime_error("Attempting to write to sensor!");              }) @@ -301,4 +305,3 @@ void e3xx_radio_control_impl::_init_codec()          this->set_tx_bandwidth(E3XX_DEFAULT_BANDWIDTH, chan);      }  } -  | 
