summaryrefslogtreecommitdiffstats
path: root/host/lib/usrp
diff options
context:
space:
mode:
authorNick Foster <nick@nerdnetworks.org>2010-08-25 19:02:26 -0700
committerNick Foster <nick@nerdnetworks.org>2010-08-25 19:02:26 -0700
commit60fc0f04a2b8499afa960653d793b782aef2bb6d (patch)
treebe44de1534c628944c4599757657af774632a636 /host/lib/usrp
parent0019bb05437702a6727d3632c6efc6a600bb4aa2 (diff)
parent48ad3b734314bdec2128dacb20b09fd4cf1f5979 (diff)
downloaduhd-60fc0f04a2b8499afa960653d793b782aef2bb6d.tar.gz
uhd-60fc0f04a2b8499afa960653d793b782aef2bb6d.tar.bz2
uhd-60fc0f04a2b8499afa960653d793b782aef2bb6d.zip
Merge branch 'master' of ettus.sourcerepo.com:ettus/uhdpriv into usrp2p
Conflicts: host/include/uhd/usrp/simple_usrp.hpp host/lib/usrp/simple_usrp.cpp
Diffstat (limited to 'host/lib/usrp')
-rw-r--r--host/lib/usrp/dboard/db_basic_and_lf.cpp8
-rw-r--r--host/lib/usrp/simple_usrp.cpp16
-rw-r--r--host/lib/usrp/usrp2/dboard_iface.cpp20
3 files changed, 30 insertions, 14 deletions
diff --git a/host/lib/usrp/dboard/db_basic_and_lf.cpp b/host/lib/usrp/dboard/db_basic_and_lf.cpp
index f8236d598..0b6e4a75a 100644
--- a/host/lib/usrp/dboard/db_basic_and_lf.cpp
+++ b/host/lib/usrp/dboard/db_basic_and_lf.cpp
@@ -170,8 +170,8 @@ void basic_rx::rx_set(const wax::obj &key_, const wax::obj &val){
return;
case SUBDEV_PROP_ANTENNA:
- UHD_ASSERT_THROW(val.as<std::string>() == std::string(""));
- return;
+ if (val.as<std::string>().empty()) return;
+ throw std::runtime_error("no selectable antennas on this board");
case SUBDEV_PROP_FREQ:
return; // it wont do you much good, but you can set it
@@ -259,8 +259,8 @@ void basic_tx::tx_set(const wax::obj &key_, const wax::obj &val){
return;
case SUBDEV_PROP_ANTENNA:
- UHD_ASSERT_THROW(val.as<std::string>() == std::string(""));
- return;
+ if (val.as<std::string>().empty()) return;
+ throw std::runtime_error("no selectable antennas on this board");
case SUBDEV_PROP_FREQ:
return; // it wont do you much good, but you can set it
diff --git a/host/lib/usrp/simple_usrp.cpp b/host/lib/usrp/simple_usrp.cpp
index 5b4a58805..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,16 +236,8 @@ public:
return _tx_subdev()[SUBDEV_PROP_LO_LOCKED].as<bool>();
}
- /*******************************************************************
- * Interface access methods
- ******************************************************************/
-
- wax::obj get_rx_dboard_iface(void) {
- return _rx_dboard();
- }
-
- wax::obj get_tx_dboard_iface(void) {
- return _tx_dboard();
+ dboard_iface::sptr get_tx_dboard_iface(void){
+ return _tx_dboard()[DBOARD_PROP_DBOARD_IFACE].as<dboard_iface::sptr>();
}
private:
diff --git a/host/lib/usrp/usrp2/dboard_iface.cpp b/host/lib/usrp/usrp2/dboard_iface.cpp
index cff13292b..c79044bce 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(_iface->regs.gpio_rx_sel, new_sels); return;
+ case UNIT_TX: _iface->poke32(_iface->regs.gpio_tx_sel, new_sels); return;
+ }
+}
+
/***********************************************************************
* SPI
**********************************************************************/