From 91dff1fbdd5bf7c1afd83182ddce43ed2bec63da Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Tue, 9 May 2017 10:30:31 -0700 Subject: rfnoc: Backported GPIO controls on radio blocks --- host/include/uhd/rfnoc/radio_ctrl.hpp | 49 ++++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) (limited to 'host/include') diff --git a/host/include/uhd/rfnoc/radio_ctrl.hpp b/host/include/uhd/rfnoc/radio_ctrl.hpp index 984ddf864..be22c6e5e 100644 --- a/host/include/uhd/rfnoc/radio_ctrl.hpp +++ b/host/include/uhd/rfnoc/radio_ctrl.hpp @@ -120,11 +120,13 @@ public: */ virtual double get_rx_frequency(const size_t chan) /* const */ = 0; - /*! Tune the RX LO for channel \p. + /*! Tune the RX LO for channel \p chan. * * This function will attempt to tune as close as possible, and return a * coerced value of the actual tuning result. * + * \param freq Requested LO frequency + * \param chan Channel number. * \return The actual LO frequency. */ virtual double set_rx_frequency(const double freq, const size_t chan) = 0; @@ -211,6 +213,51 @@ public: */ virtual time_spec_t get_time_last_pps() = 0; + /*! Returns the list of GPIO banks that are associated with this radio. + * + * \returns list of GPIO bank names + */ + virtual std::vector get_gpio_banks() const = 0; + + /*! + * Set a GPIO attribute on a particular GPIO bank. + * Possible attribute names: + * - CTRL - 1 for ATR mode 0 for GPIO mode + * - DDR - 1 for output 0 for input + * - OUT - GPIO output level (not ATR mode) + * - ATR_0X - ATR idle state + * - ATR_RX - ATR receive only state + * - ATR_TX - ATR transmit only state + * - ATR_XX - ATR full duplex state + * \param bank the name of a GPIO bank (e.g., FP0) + * \param attr the name of a GPIO attribute (e.g., CTRL) + * \param value the new value for this GPIO bank + * \param mask the bit mask to effect which pins are changed + */ + virtual void set_gpio_attr( + const std::string &bank, + const std::string &attr, + const uint32_t value, + const uint32_t mask + ) = 0; + + /*! + * Get a GPIO attribute on a particular GPIO bank. + * Possible attribute names: + * - CTRL - 1 for ATR mode 0 for GPIO mode + * - DDR - 1 for output 0 for input + * - OUT - GPIO output level (not ATR mode) + * - ATR_0X - ATR idle state + * - ATR_RX - ATR receive only state + * - ATR_TX - ATR transmit only state + * - ATR_XX - ATR full duplex state + * - READBACK - readback input GPIOs + * \param bank the name of a GPIO bank + * \param attr the name of a GPIO attribute + * \return the value set for this attribute + */ + virtual uint32_t get_gpio_attr(const std::string &bank, const std::string &attr) = 0; + /*! * Get a list of possible LO stage names * \param chan the channel index 0 to N-1 -- cgit v1.2.3