aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/x300/x300_mb_controller.hpp
diff options
context:
space:
mode:
authoreklai <eric@skysafe.io>2020-01-23 18:47:28 -0800
committeratrnati <54334261+atrnati@users.noreply.github.com>2020-02-18 07:21:24 -0600
commitd7304cc724de43b0d61d5b9d61a528d58898f004 (patch)
tree05304ad4d65c507c6d43fcbc407c566c351053c3 /host/lib/usrp/x300/x300_mb_controller.hpp
parentc0a6bb1720a3db8ac9a40bdd5ca19de8be40d500 (diff)
downloaduhd-d7304cc724de43b0d61d5b9d61a528d58898f004.tar.gz
uhd-d7304cc724de43b0d61d5b9d61a528d58898f004.tar.bz2
uhd-d7304cc724de43b0d61d5b9d61a528d58898f004.zip
x300: add front-panel GPIO source control
Adds a ZPU register to control the FP GPIO source. These are 2bits per GPIO pin, totalling 24 bits. 0 corresponds to RF-A, 1 corresponds to RF-B. The following Python code will control the upper 6 bits of the front-panel GPIO from the B-side radio on an X300: >>> import uhd >>> U = uhd.usrp.MultiUSRP("type=x300") >>> U.get_gpio_src_banks() ['FP0'] >>> U.get_gpio_src("FP0") ['RFA', 'RFA', 'RFA', 'RFA', 'RFA', 'RFA', 'RFA', 'RFA', 'RFA', 'RFA', 'RFA', 'RFA'] >>> U.set_gpio_src("FP0", ['RFA', 'RFA', 'RFA', 'RFA', 'RFA', 'RFA', 'RFB', 'RFB', 'RFB', 'RFB', 'RFB', 'RFB']) >>> U.get_gpio_src("FP0") ['RFA', 'RFA', 'RFA', 'RFA', 'RFA', 'RFA', 'RFB', 'RFB', 'RFB', 'RFB', 'RFB', 'RFB'] >>> # Make all GPIOs outputs: >>> U.set_gpio_attr("FP0A", "DDR", 0xFFF) >>> U.set_gpio_attr("FP0B", "DDR", 0xFFF) >>> # Control all GPIOs from software (not ATR): >>> U.set_gpio_attr("FP0A", "CTRL", 0x000) >>> U.set_gpio_attr("FP0B", "CTRL", 0x000) >>> # Bottom 3 pins go high from radio A >>> U.set_gpio_attr("FP0A", "OUT", 0x007) >>> # Top 3 pins go high from radio B >>> U.set_gpio_attr("FP0B", "OUT", 0xE00) Amends the gpio.cpp example to allow switching the source. Co-authored-by: Brent Stapleton <brent.stapleton@ettus.com>
Diffstat (limited to 'host/lib/usrp/x300/x300_mb_controller.hpp')
-rw-r--r--host/lib/usrp/x300/x300_mb_controller.hpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/host/lib/usrp/x300/x300_mb_controller.hpp b/host/lib/usrp/x300/x300_mb_controller.hpp
index 53f166a0e..92844f1b9 100644
--- a/host/lib/usrp/x300/x300_mb_controller.hpp
+++ b/host/lib/usrp/x300/x300_mb_controller.hpp
@@ -120,6 +120,10 @@ public:
bool synchronize(std::vector<mb_controller::sptr>& mb_controllers,
const uhd::time_spec_t& time_spec = uhd::time_spec_t(0.0),
const bool quiet = false);
+ std::vector<std::string> get_gpio_banks() const;
+ std::vector<std::string> get_gpio_srcs(const std::string&) const;
+ std::vector<std::string> get_gpio_src(const std::string&);
+ void set_gpio_src(const std::string&, const std::vector<std::string>&);
private:
//! Return a string X300::MB_CTRL#N