diff options
| -rw-r--r-- | host/include/uhd/usrp/multi_usrp.hpp | 50 | ||||
| -rw-r--r-- | host/lib/usrp/multi_usrp.cpp | 8 | ||||
| -rw-r--r-- | host/lib/usrp/multi_usrp_rfnoc.cpp | 5 | 
3 files changed, 50 insertions, 13 deletions
| diff --git a/host/include/uhd/usrp/multi_usrp.hpp b/host/include/uhd/usrp/multi_usrp.hpp index 9742a8ab6..3e2cf0a47 100644 --- a/host/include/uhd/usrp/multi_usrp.hpp +++ b/host/include/uhd/usrp/multi_usrp.hpp @@ -1503,27 +1503,53 @@ public:      virtual uint32_t get_gpio_attr(          const std::string& bank, const std::string& attr, const size_t mboard = 0) = 0; -    /*! -     * Enumerate sources for a gpio bank on the specified device. Each of the pins in the -     * chosen bank can be driven from one of the returned sources. \param bank the name of -     * a GPIO bank \param mboard the motherboard index 0 to M-1 \return a list of strings -     * with each valid source for the chosen bank +    /*! Return a list of GPIO banks that can be source-controlled on this motherboard +     * +     * This is a different set of banks than those returned from get_gpio_banks(). +     * Here, we return a list of banks that can be used as arguments for +     * get_gpio_src(), get_gpio_srcs(), and set_gpio_src(). +     * +     * Some motherboards have GPIO banks that can be driven from different +     * sources, e.g., the N310 can have any radio channel drive the FP-GPIOs, +     * or the PS. +     * +     * \param mboard the motherboard index 0 to M-1 +     * \return a list of valid bank names +     */ +    virtual std::vector<std::string> get_gpio_src_banks(const size_t mboard = 0) = 0; + +    /*! Enumerate sources for a gpio bank on the specified device. +     * +     * Each of the pins in the chosen bank can be driven from one of the +     * returned sources. +     * +     * \param bank the name of a GPIO bank. Valid values can be obtained by +     *        calling get_gpio_src_banks(). +     * \param mboard the motherboard index 0 to M-1 +     * \return a list of strings with each valid source for the chosen bank       */      virtual std::vector<std::string> get_gpio_srcs(          const std::string& bank, const size_t mboard = 0) = 0; -    /*! -     * Get the current source for each pin in a GPIO bank. -     * \param bank the name of a GPIO bank +    /*! Get the current source for each pin in a GPIO bank. +     * +     * \param bank the name of a GPIO bank. Valid values can be obtained by +     *        calling get_gpio_src_banks().       * \param mboard the motherboard index 0 to M-1 -     * \return a list of strings for current source of each GPIO pin in the chosen bank +     * \return a list of strings for current source of each GPIO pin in the +     *         chosen bank. The length of the return value matches the number of +     *         programmable GPIO pins.       */      virtual std::vector<std::string> get_gpio_src(          const std::string& bank, const size_t mboard = 0) = 0; -    /*! -     * Set the current source for each pin in a GPIO bank. -     * \param bank the name of a GPIO bank +    /*! Set the current source for each pin in a GPIO bank. +     * +     * Note: The length of the vector must be identical to the number of +     * programmable GPIO pins. +     * +     * \param bank the name of a GPIO bank. Valid values can be obtained by +     *        calling get_gpio_src_banks().       * \param src a list of strings specifying the source of each pin in a GPIO bank       * \param mboard the motherboard index 0 to M-1       */ diff --git a/host/lib/usrp/multi_usrp.cpp b/host/lib/usrp/multi_usrp.cpp index db21255ae..202f8b2df 100644 --- a/host/lib/usrp/multi_usrp.cpp +++ b/host/lib/usrp/multi_usrp.cpp @@ -2249,7 +2249,13 @@ public:          ));      } -    // The next three methods are only for RFNoC devices +    // The next four methods are only for RFNoC devices +    std::vector<std::string> get_gpio_src_banks(const size_t) +    { +        throw uhd::not_implemented_error( +            "get_gpio_src_banks() not implemented for this motherboard!"); +    } +      std::vector<std::string> get_gpio_srcs(const std::string&, const size_t)      {          throw uhd::not_implemented_error( diff --git a/host/lib/usrp/multi_usrp_rfnoc.cpp b/host/lib/usrp/multi_usrp_rfnoc.cpp index 99c07dc8c..b2070c53d 100644 --- a/host/lib/usrp/multi_usrp_rfnoc.cpp +++ b/host/lib/usrp/multi_usrp_rfnoc.cpp @@ -1956,6 +1956,11 @@ public:          return radio_bank_pair.first->get_gpio_attr(radio_bank_pair.second, attr);      } +    std::vector<std::string> get_gpio_src_banks(const size_t mboard) +    { +        return get_mbc(mboard)->get_gpio_banks(); +    } +      std::vector<std::string> get_gpio_srcs(const std::string& bank, const size_t mboard)      {          return get_mbc(mboard)->get_gpio_srcs(bank); | 
