summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-06-10 15:23:24 -0700
committerJosh Blum <josh@joshknows.com>2011-06-10 15:23:24 -0700
commit09cf8eb16444b0c744b47b39b077f9d0fbb09886 (patch)
tree6f7c381b2736860378838e5bab6baeef8f602e13
parente709e4d36516f4459cc08c46ae6eea1e12feb70b (diff)
downloaduhd-09cf8eb16444b0c744b47b39b077f9d0fbb09886.tar.gz
uhd-09cf8eb16444b0c744b47b39b077f9d0fbb09886.tar.bz2
uhd-09cf8eb16444b0c744b47b39b077f9d0fbb09886.zip
uhd: added more SAFE_CALL macros to hardware wrapper dtors
And removed the calls on the sptr resets (not needed now).
-rw-r--r--host/lib/usrp/dboard_manager.cpp6
-rw-r--r--host/lib/usrp/usrp1/codec_ctrl.cpp6
-rw-r--r--host/lib/usrp/usrp1/usrp1_impl.cpp18
-rw-r--r--host/lib/usrp/usrp2/clock_ctrl.cpp5
-rw-r--r--host/lib/usrp/usrp2/codec_ctrl.cpp5
-rw-r--r--host/lib/usrp/usrp2/mboard_impl.cpp16
6 files changed, 20 insertions, 36 deletions
diff --git a/host/lib/usrp/dboard_manager.cpp b/host/lib/usrp/dboard_manager.cpp
index e624ec62f..3cc2ca3c0 100644
--- a/host/lib/usrp/dboard_manager.cpp
+++ b/host/lib/usrp/dboard_manager.cpp
@@ -351,9 +351,9 @@ void dboard_manager_impl::init(
}
}
-dboard_manager_impl::~dboard_manager_impl(void){
- UHD_SAFE_CALL(set_nice_dboard_if();)
-}
+dboard_manager_impl::~dboard_manager_impl(void){UHD_SAFE_CALL(
+ set_nice_dboard_if();
+)}
prop_names_t dboard_manager_impl::get_rx_subdev_names(void){
return _rx_dboards.keys();
diff --git a/host/lib/usrp/usrp1/codec_ctrl.cpp b/host/lib/usrp/usrp1/codec_ctrl.cpp
index 64a93ede5..448135185 100644
--- a/host/lib/usrp/usrp1/codec_ctrl.cpp
+++ b/host/lib/usrp/usrp1/codec_ctrl.cpp
@@ -20,6 +20,7 @@
#include "clock_ctrl.hpp"
#include "ad9862_regs.hpp"
#include <uhd/utils/log.hpp>
+#include <uhd/utils/safe_call.hpp>
#include <uhd/types/dict.hpp>
#include <uhd/exception.hpp>
#include <uhd/utils/algorithm.hpp>
@@ -140,8 +141,7 @@ usrp1_codec_ctrl_impl::usrp1_codec_ctrl_impl(usrp1_iface::sptr iface,
this->send_reg(34);
}
-usrp1_codec_ctrl_impl::~usrp1_codec_ctrl_impl(void)
-{
+usrp1_codec_ctrl_impl::~usrp1_codec_ctrl_impl(void){UHD_SAFE_CALL(
//set aux dacs to zero
this->write_aux_dac(AUX_DAC_A, 0);
this->write_aux_dac(AUX_DAC_B, 0);
@@ -154,7 +154,7 @@ usrp1_codec_ctrl_impl::~usrp1_codec_ctrl_impl(void)
_ad9862_regs.tx_digital_pd = 1;
_ad9862_regs.tx_analog_pd = ad9862_regs_t::TX_ANALOG_PD_BOTH;
this->send_reg(8);
-}
+)}
/***********************************************************************
* Codec Control Gain Control Methods
diff --git a/host/lib/usrp/usrp1/usrp1_impl.cpp b/host/lib/usrp/usrp1/usrp1_impl.cpp
index b1fa986d1..83ff8ebe2 100644
--- a/host/lib/usrp/usrp1/usrp1_impl.cpp
+++ b/host/lib/usrp/usrp1/usrp1_impl.cpp
@@ -208,20 +208,10 @@ usrp1_impl::usrp1_impl(uhd::transport::usb_zero_copy::sptr data_transport,
this->mboard_set(MBOARD_PROP_TX_SUBDEV_SPEC, subdev_spec_t());
}
-usrp1_impl::~usrp1_impl(void){
- UHD_SAFE_CALL(this->enable_rx(false);)
- UHD_SAFE_CALL(this->enable_tx(false);)
- //Safely destruct all RAII objects in a device.
- //This prevents the mboard deconstructor from throwing,
- //which allows the device to be safely deconstructed.
- BOOST_FOREACH(dboard_slot_t slot, _dboard_slots){
- UHD_SAFE_CALL(_dboard_managers[slot].reset();)
- UHD_SAFE_CALL(_dboard_ifaces[slot].reset();)
- UHD_SAFE_CALL(_codec_ctrls[slot].reset();)
- }
- UHD_SAFE_CALL(_clock_ctrl.reset();)
- UHD_SAFE_CALL(_io_impl.reset();)
-}
+usrp1_impl::~usrp1_impl(void){UHD_SAFE_CALL(
+ this->enable_rx(false);
+ this->enable_tx(false);
+)}
bool usrp1_impl::recv_async_msg(uhd::async_metadata_t &, double timeout){
//dummy fill-in for the recv_async_msg
diff --git a/host/lib/usrp/usrp2/clock_ctrl.cpp b/host/lib/usrp/usrp2/clock_ctrl.cpp
index f1fdfb7cf..66c7a6c28 100644
--- a/host/lib/usrp/usrp2/clock_ctrl.cpp
+++ b/host/lib/usrp/usrp2/clock_ctrl.cpp
@@ -19,6 +19,7 @@
#include "ad9510_regs.hpp"
#include "usrp2_regs.hpp" //spi slave constants
#include "usrp2_clk_regs.hpp"
+#include <uhd/utils/safe_call.hpp>
#include <uhd/utils/assert_has.hpp>
#include <boost/cstdint.hpp>
#include <boost/lexical_cast.hpp>
@@ -77,7 +78,7 @@ public:
this->enable_test_clock(enb_test_clk);
}
- ~usrp2_clock_ctrl_impl(void){
+ ~usrp2_clock_ctrl_impl(void){UHD_SAFE_CALL(
//power down clock outputs
this->enable_external_ref(false);
this->enable_rx_dboard_clock(false);
@@ -86,7 +87,7 @@ public:
this->enable_adc_clock(false);
this->enable_mimo_clock_out(false);
this->enable_test_clock(false);
- }
+ )}
void enable_mimo_clock_out(bool enb){
//calculate the low and high dividers
diff --git a/host/lib/usrp/usrp2/codec_ctrl.cpp b/host/lib/usrp/usrp2/codec_ctrl.cpp
index 047195390..ee0ef9ceb 100644
--- a/host/lib/usrp/usrp2/codec_ctrl.cpp
+++ b/host/lib/usrp/usrp2/codec_ctrl.cpp
@@ -20,6 +20,7 @@
#include "ads62p44_regs.hpp"
#include "usrp2_regs.hpp"
#include <uhd/utils/log.hpp>
+#include <uhd/utils/safe_call.hpp>
#include <uhd/exception.hpp>
#include <boost/cstdint.hpp>
#include <boost/foreach.hpp>
@@ -95,7 +96,7 @@ public:
}
}
- ~usrp2_codec_ctrl_impl(void){
+ ~usrp2_codec_ctrl_impl(void){UHD_SAFE_CALL(
//power-down dac
_ad9777_regs.power_down_mode = 1;
this->send_ad9777_reg(0);
@@ -118,7 +119,7 @@ public:
case usrp2_iface::USRP_NXXX: break;
}
- }
+ )}
void set_tx_mod_mode(int mod_mode){
//set the sign of the frequency shift
diff --git a/host/lib/usrp/usrp2/mboard_impl.cpp b/host/lib/usrp/usrp2/mboard_impl.cpp
index bf1fd5cce..4a28ea9c4 100644
--- a/host/lib/usrp/usrp2/mboard_impl.cpp
+++ b/host/lib/usrp/usrp2/mboard_impl.cpp
@@ -176,18 +176,10 @@ usrp2_mboard_impl::usrp2_mboard_impl(
//------------------------------------------------------------------
}
-usrp2_mboard_impl::~usrp2_mboard_impl(void){
- //Safely destruct all RAII objects in an mboard.
- //This prevents the mboard deconstructor from throwing,
- //which allows the device to be safely deconstructed.
- UHD_SAFE_CALL(_iface->poke32(U2_REG_TX_CTRL_CYCLES_PER_UP, 0);)
- UHD_SAFE_CALL(_iface->poke32(U2_REG_TX_CTRL_PACKETS_PER_UP, 0);)
- UHD_SAFE_CALL(_dboard_manager.reset();)
- UHD_SAFE_CALL(_dboard_iface.reset();)
- UHD_SAFE_CALL(_codec_ctrl.reset();)
- UHD_SAFE_CALL(_clock_ctrl.reset();)
- UHD_SAFE_CALL(_gps_ctrl.reset();)
-}
+usrp2_mboard_impl::~usrp2_mboard_impl(void){UHD_SAFE_CALL(
+ _iface->poke32(U2_REG_TX_CTRL_CYCLES_PER_UP, 0);
+ _iface->poke32(U2_REG_TX_CTRL_PACKETS_PER_UP, 0);
+)}
/***********************************************************************
* Helper Methods