summaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-02-22 14:36:48 -0800
committerJosh Blum <josh@joshknows.com>2010-02-22 14:36:48 -0800
commit5200303517f4941fa60e2db713411f36116634a7 (patch)
treec20c4d186dfce0c55a59a665a6df627c65256c47 /host
parentd42e588d76efc41d18dabc75027347fe123904d1 (diff)
downloaduhd-5200303517f4941fa60e2db713411f36116634a7.tar.gz
uhd-5200303517f4941fa60e2db713411f36116634a7.tar.bz2
uhd-5200303517f4941fa60e2db713411f36116634a7.zip
added set nice gpio pins to manager on init and deconstruct
Diffstat (limited to 'host')
-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);
+}