summaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-08-23 19:06:35 -0700
committerJosh Blum <josh@joshknows.com>2010-08-23 19:06:35 -0700
commit48ad3b734314bdec2128dacb20b09fd4cf1f5979 (patch)
treef97d7028b7f0ec14353e4f5e75cf7df16aa7bb11 /host
parent4ecc24d09415d7c0a1c3f2383b6adec08105c571 (diff)
downloaduhd-48ad3b734314bdec2128dacb20b09fd4cf1f5979.tar.gz
uhd-48ad3b734314bdec2128dacb20b09fd4cf1f5979.tar.bz2
uhd-48ad3b734314bdec2128dacb20b09fd4cf1f5979.zip
usrp: added get dboard iface to simple wrapper, and set gpio debug to dboard iface
Diffstat (limited to 'host')
-rw-r--r--host/include/uhd/usrp/dboard_iface.hpp8
-rw-r--r--host/include/uhd/usrp/simple_usrp.hpp5
-rw-r--r--host/lib/usrp/simple_usrp.cpp8
-rw-r--r--host/lib/usrp/usrp2/dboard_iface.cpp20
4 files changed, 41 insertions, 0 deletions
diff --git a/host/include/uhd/usrp/dboard_iface.hpp b/host/include/uhd/usrp/dboard_iface.hpp
index e776ecc42..c7db244f2 100644
--- a/host/include/uhd/usrp/dboard_iface.hpp
+++ b/host/include/uhd/usrp/dboard_iface.hpp
@@ -148,6 +148,14 @@ public:
virtual void write_gpio(unit_t unit, boost::uint16_t value) = 0;
/*!
+ * Setup the GPIO debug mux.
+ *
+ * \param unit which unit rx or tx
+ * \param which which debug: 0, 1
+ */
+ virtual void set_gpio_debug(unit_t unit, int which) = 0;
+
+ /*!
* Read daughterboard GPIO pin values.
*
* \param unit which unit rx or tx
diff --git a/host/include/uhd/usrp/simple_usrp.hpp b/host/include/uhd/usrp/simple_usrp.hpp
index 4da63c929..08b9c01ea 100644
--- a/host/include/uhd/usrp/simple_usrp.hpp
+++ b/host/include/uhd/usrp/simple_usrp.hpp
@@ -25,6 +25,7 @@
#include <uhd/types/clock_config.hpp>
#include <uhd/types/tune_result.hpp>
#include <uhd/usrp/subdev_spec.hpp>
+#include <uhd/usrp/dboard_iface.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/utility.hpp>
#include <vector>
@@ -136,6 +137,8 @@ public:
*/
virtual float read_rssi(void) = 0;
+ virtual dboard_iface::sptr get_rx_dboard_iface(void) = 0;
+
/*******************************************************************
* TX methods
******************************************************************/
@@ -159,6 +162,8 @@ public:
virtual std::vector<std::string> get_tx_antennas(void) = 0;
virtual bool get_tx_lo_locked(void) = 0;
+
+ virtual dboard_iface::sptr get_tx_dboard_iface(void) = 0;
};
}}
diff --git a/host/lib/usrp/simple_usrp.cpp b/host/lib/usrp/simple_usrp.cpp
index 60b25a647..e573d0fc0 100644
--- a/host/lib/usrp/simple_usrp.cpp
+++ b/host/lib/usrp/simple_usrp.cpp
@@ -168,6 +168,10 @@ public:
return _rx_subdev()[SUBDEV_PROP_RSSI].as<float>();
}
+ dboard_iface::sptr get_rx_dboard_iface(void){
+ return _rx_dboard()[DBOARD_PROP_DBOARD_IFACE].as<dboard_iface::sptr>();
+ }
+
/*******************************************************************
* TX methods
******************************************************************/
@@ -232,6 +236,10 @@ public:
return _tx_subdev()[SUBDEV_PROP_LO_LOCKED].as<bool>();
}
+ dboard_iface::sptr get_tx_dboard_iface(void){
+ return _tx_dboard()[DBOARD_PROP_DBOARD_IFACE].as<dboard_iface::sptr>();
+ }
+
private:
device::sptr _dev;
wax::obj _mboard(void){
diff --git a/host/lib/usrp/usrp2/dboard_iface.cpp b/host/lib/usrp/usrp2/dboard_iface.cpp
index 8bded1ea3..f6d2b718a 100644
--- a/host/lib/usrp/usrp2/dboard_iface.cpp
+++ b/host/lib/usrp/usrp2/dboard_iface.cpp
@@ -51,6 +51,7 @@ public:
void set_atr_reg(unit_t, atr_reg_t, boost::uint16_t);
void set_gpio_ddr(unit_t, boost::uint16_t);
void write_gpio(unit_t, boost::uint16_t);
+ void set_gpio_debug(unit_t, int);
boost::uint16_t read_gpio(unit_t);
void write_i2c(boost::uint8_t, const byte_vector_t &);
@@ -219,6 +220,25 @@ void usrp2_dboard_iface::set_atr_reg(unit_t unit, atr_reg_t atr, boost::uint16_t
_iface->poke16(unit_to_atr_to_addr[unit][atr], value);
}
+void usrp2_dboard_iface::set_gpio_debug(unit_t unit, int which){
+ this->set_gpio_ddr(unit, 0xffff); //all outputs
+
+ //calculate the new selection mux setting
+ boost::uint32_t new_sels = 0x0;
+ int sel = (which == 0)?
+ U2_FLAG_GPIO_SEL_DEBUG_0:
+ U2_FLAG_GPIO_SEL_DEBUG_1;
+ for(size_t i = 0; i < 16; i++){
+ new_sels |= sel << (i*2);
+ }
+
+ //write the selection mux value to register
+ switch(unit){
+ case UNIT_RX: _iface->poke32(U2_REG_GPIO_RX_SEL, new_sels); return;
+ case UNIT_TX: _iface->poke32(U2_REG_GPIO_TX_SEL, new_sels); return;
+ }
+}
+
/***********************************************************************
* SPI
**********************************************************************/