aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/dboard_manager.cpp
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-02-25 17:44:12 +0000
committerJosh Blum <josh@joshknows.com>2010-02-25 17:44:12 +0000
commitc95a158548e93d1ea37061e0b937e78ab0486b57 (patch)
tree50531279c454f3b2d07e52dd8eb2562b7fabbbc7 /host/lib/usrp/dboard_manager.cpp
parent3cd7bc9be6420623eb7803e490b39ecc75d83ed9 (diff)
parent5715b2c4937ca094ca8f1d9d9b55c4edcc959981 (diff)
downloaduhd-c95a158548e93d1ea37061e0b937e78ab0486b57.tar.gz
uhd-c95a158548e93d1ea37061e0b937e78ab0486b57.tar.bz2
uhd-c95a158548e93d1ea37061e0b937e78ab0486b57.zip
Merge branch 'master' into u1e_uhd
Diffstat (limited to 'host/lib/usrp/dboard_manager.cpp')
-rw-r--r--host/lib/usrp/dboard_manager.cpp27
1 files changed, 18 insertions, 9 deletions
diff --git a/host/lib/usrp/dboard_manager.cpp b/host/lib/usrp/dboard_manager.cpp
index f0846db25..cce239f3e 100644
--- a/host/lib/usrp/dboard_manager.cpp
+++ b/host/lib/usrp/dboard_manager.cpp
@@ -91,6 +91,8 @@ private:
//the subdevice proxy is internal to the cpp file
uhd::dict<std::string, wax::obj> _rx_dboards;
uhd::dict<std::string, wax::obj> _tx_dboards;
+ dboard_interface::sptr _interface;
+ void set_nice_gpio_pins(void);
};
/***********************************************************************
@@ -184,6 +186,7 @@ dboard_manager_impl::dboard_manager_impl(
dboard_interface::sptr interface
){
register_internal_dboards(); //always call first
+ _interface = interface;
dboard_ctor_t rx_dboard_ctor; prop_names_t rx_subdevs;
boost::tie(rx_dboard_ctor, rx_subdevs) = get_dboard_args(rx_dboard_id, "rx");
@@ -192,14 +195,7 @@ dboard_manager_impl::dboard_manager_impl(
boost::tie(tx_dboard_ctor, tx_subdevs) = get_dboard_args(tx_dboard_id, "tx");
//initialize the gpio pins before creating subdevs
- interface->set_gpio_ddr(dboard_interface::GPIO_RX_BANK, 0x0000, 0xffff); //all inputs
- interface->set_gpio_ddr(dboard_interface::GPIO_TX_BANK, 0x0000, 0xffff);
-
- interface->write_gpio(dboard_interface::GPIO_RX_BANK, 0x0000, 0xffff); //all zeros
- interface->write_gpio(dboard_interface::GPIO_TX_BANK, 0x0000, 0xffff);
-
- interface->set_atr_reg(dboard_interface::GPIO_RX_BANK, 0x0000, 0x0000, 0x0000); //software controlled
- interface->set_atr_reg(dboard_interface::GPIO_TX_BANK, 0x0000, 0x0000, 0x0000);
+ set_nice_gpio_pins();
//make xcvr subdevs (make one subdev for both rx and tx dboards)
if (rx_dboard_ctor == tx_dboard_ctor){
@@ -245,7 +241,7 @@ dboard_manager_impl::dboard_manager_impl(
}
dboard_manager_impl::~dboard_manager_impl(void){
- /* NOP */
+ set_nice_gpio_pins();
}
prop_names_t dboard_manager_impl::get_rx_subdev_names(void){
@@ -271,3 +267,16 @@ wax::obj dboard_manager_impl::get_tx_subdev(const std::string &subdev_name){
//get a link to the tx subdev proxy
return wax::cast<subdev_proxy::sptr>(_tx_dboards[subdev_name])->get_link();
}
+
+void dboard_manager_impl::set_nice_gpio_pins(void){
+ //std::cout << "Set nice GPIO pins" << std::endl;
+
+ _interface->set_gpio_ddr(dboard_interface::GPIO_RX_BANK, 0x0000, 0xffff); //all inputs
+ _interface->set_gpio_ddr(dboard_interface::GPIO_TX_BANK, 0x0000, 0xffff);
+
+ _interface->write_gpio(dboard_interface::GPIO_RX_BANK, 0x0000, 0xffff); //all zeros
+ _interface->write_gpio(dboard_interface::GPIO_TX_BANK, 0x0000, 0xffff);
+
+ _interface->set_atr_reg(dboard_interface::GPIO_RX_BANK, 0x0000, 0x0000, 0x0000); //software controlled
+ _interface->set_atr_reg(dboard_interface::GPIO_TX_BANK, 0x0000, 0x0000, 0x0000);
+}