diff options
3 files changed, 48 insertions, 1 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 0e3768499..e67d0b1fe 100644 --- a/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.cpp +++ b/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.cpp @@ -409,6 +409,26 @@ void magnesium_radio_ctrl_impl::set_rpc_client(              );          })      ; + +    // Sensors +    for (const auto &dir : std::vector<direction_t>{RX_DIRECTION, TX_DIRECTION}) { +        for (size_t chan_idx = 0; chan_idx < 1 /* num channels FIXME */; chan_idx++) { +            const fs_path fe_path = +                fs_path("dboards") / +                _radio_slot / +                (dir == RX_DIRECTION ? "rx_frontends" : "tx_frontends") / +                chan_idx; +            UHD_LOG_TRACE(unique_id(), +                "Stubbed out adding sensors for fe path " << fe_path); +            // FIXME add sensors here +        } +    } +} + +bool magnesium_radio_ctrl_impl::get_lo_lock_status( +    const direction_t /*dir*/ +) { +    return bool(_rpcc); // FIXME  }  UHD_RFNOC_BLOCK_REGISTER(magnesium_radio_ctrl, "MagnesiumRadio"); diff --git a/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.hpp b/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.hpp index 7d67a7263..433ab9a94 100644 --- a/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.hpp +++ b/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.hpp @@ -120,6 +120,15 @@ private:      void _init_prop_tree();      /************************************************************************** +     * Sensors +     *************************************************************************/ +    //! Return LO lock status. Factors in current band (low/high) and +    // direction (TX/RX) +    bool get_lo_lock_status( +            const direction_t dir +    ); + +    /**************************************************************************       * Gain Controls (implemented in magnesium_radio_ctrl_gain.cpp)       *************************************************************************/      //! Set the attenuation of the DSA 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 c35a15418..355671a5f 100644 --- a/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_init.cpp +++ b/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_init.cpp @@ -331,7 +331,7 @@ void magnesium_radio_ctrl_impl::_init_frontend_subtree(          })      ;      // FIXME separate DSA and Myk gains -    // TX LO lock sensor +    // TX LO lock sensor //////////////////////////////////////////////////////      // Note: The lowband and AD9371 LO lock sensors are generated      // programmatically in set_rpc_client(). The actual lo_locked publisher is      // also set there. @@ -341,10 +341,28 @@ void magnesium_radio_ctrl_impl::_init_frontend_subtree(              throw uhd::runtime_error(                  "Attempting to write to sensor!");          }) +        .set_publisher([this](){ +            return sensor_value_t( +                "all_los", +                this->get_lo_lock_status(TX_DIRECTION), +                "locked", "unlocked" +            ); +        })      ;      // RX LO lock sensor (see not on TX LO lock sensor)      subtree->create<sensor_value_t>(rx_fe_path / "sensors" / "lo_locked")          .set(sensor_value_t("all_los", false,  "locked", "unlocked")) +        .add_coerced_subscriber([](const sensor_value_t &){ +            throw uhd::runtime_error( +                "Attempting to write to sensor!"); +        }) +        .set_publisher([this](){ +            return sensor_value_t( +                "all_los", +                this->get_lo_lock_status(RX_DIRECTION), +                "locked", "unlocked" +            ); +        })      ;  } | 
