aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAshish Chaudhari <ashish@ettus.com>2016-02-19 17:38:08 -0800
committerAshish Chaudhari <ashish@ettus.com>2016-02-26 14:23:34 -0800
commitc03506fedd75a7fbad242d2be06123a187e66277 (patch)
tree0c24b9d015fd07ec0fa873c8d95c29716411941c
parent1c2f56bbc1ccd0bffaac8fa4da174d1ad130a3ba (diff)
downloaduhd-c03506fedd75a7fbad242d2be06123a187e66277.tar.gz
uhd-c03506fedd75a7fbad242d2be06123a187e66277.tar.bz2
uhd-c03506fedd75a7fbad242d2be06123a187e66277.zip
dboard: Made dboard class dtors virtual
- Interface and all base classes have virtual destructors - Wrapped UBX dtor in UHD_SAFE_CALL
-rw-r--r--host/include/uhd/usrp/dboard_base.hpp4
-rw-r--r--host/lib/usrp/dboard/db_basic_and_lf.cpp4
-rw-r--r--host/lib/usrp/dboard/db_dbsrx.cpp2
-rw-r--r--host/lib/usrp/dboard/db_dbsrx2.cpp2
-rw-r--r--host/lib/usrp/dboard/db_e3x0.cpp4
-rw-r--r--host/lib/usrp/dboard/db_rfx.cpp2
-rw-r--r--host/lib/usrp/dboard/db_sbx_common.hpp6
-rw-r--r--host/lib/usrp/dboard/db_tvrx.cpp2
-rw-r--r--host/lib/usrp/dboard/db_tvrx2.cpp2
-rw-r--r--host/lib/usrp/dboard/db_ubx.cpp48
-rw-r--r--host/lib/usrp/dboard/db_wbx_common.hpp6
-rw-r--r--host/lib/usrp/dboard/db_wbx_simple.cpp2
-rw-r--r--host/lib/usrp/dboard/db_xcvr2450.cpp2
13 files changed, 47 insertions, 39 deletions
diff --git a/host/include/uhd/usrp/dboard_base.hpp b/host/include/uhd/usrp/dboard_base.hpp
index 31b3643c7..5a7cdd6d2 100644
--- a/host/include/uhd/usrp/dboard_base.hpp
+++ b/host/include/uhd/usrp/dboard_base.hpp
@@ -44,6 +44,7 @@ public:
//structors
dboard_base(ctor_args_t);
+ virtual ~dboard_base() {}
protected:
std::string get_subdev_name(void);
@@ -67,6 +68,7 @@ public:
* Create a new xcvr dboard object, override in subclasses.
*/
xcvr_dboard_base(ctor_args_t);
+ virtual ~xcvr_dboard_base() {}
};
/*!
@@ -79,6 +81,7 @@ public:
* Create a new rx dboard object, override in subclasses.
*/
rx_dboard_base(ctor_args_t);
+ virtual ~rx_dboard_base() {}
};
/*!
@@ -91,6 +94,7 @@ public:
* Create a new rx dboard object, override in subclasses.
*/
tx_dboard_base(ctor_args_t);
+ virtual ~tx_dboard_base() {}
};
}} //namespace
diff --git a/host/lib/usrp/dboard/db_basic_and_lf.cpp b/host/lib/usrp/dboard/db_basic_and_lf.cpp
index 4919e39bf..941a80ea4 100644
--- a/host/lib/usrp/dboard/db_basic_and_lf.cpp
+++ b/host/lib/usrp/dboard/db_basic_and_lf.cpp
@@ -50,7 +50,7 @@ static const uhd::dict<std::string, double> subdev_bandwidth_scalar = map_list_o
class basic_rx : public rx_dboard_base{
public:
basic_rx(ctor_args_t args, double max_freq);
- ~basic_rx(void);
+ virtual ~basic_rx(void);
private:
double _max_freq;
@@ -59,7 +59,7 @@ private:
class basic_tx : public tx_dboard_base{
public:
basic_tx(ctor_args_t args, double max_freq);
- ~basic_tx(void);
+ virtual ~basic_tx(void);
private:
double _max_freq;
diff --git a/host/lib/usrp/dboard/db_dbsrx.cpp b/host/lib/usrp/dboard/db_dbsrx.cpp
index 8ef38fd9c..6e1846fb8 100644
--- a/host/lib/usrp/dboard/db_dbsrx.cpp
+++ b/host/lib/usrp/dboard/db_dbsrx.cpp
@@ -66,7 +66,7 @@ static const double usrp1_gpio_clock_rate_limit = 4e6;
class dbsrx : public rx_dboard_base{
public:
dbsrx(ctor_args_t args);
- ~dbsrx(void);
+ virtual ~dbsrx(void);
private:
double _lo_freq;
diff --git a/host/lib/usrp/dboard/db_dbsrx2.cpp b/host/lib/usrp/dboard/db_dbsrx2.cpp
index 7e5f5f617..11d706ed6 100644
--- a/host/lib/usrp/dboard/db_dbsrx2.cpp
+++ b/host/lib/usrp/dboard/db_dbsrx2.cpp
@@ -60,7 +60,7 @@ static const uhd::dict<std::string, gain_range_t> dbsrx2_gain_ranges = map_list_
class dbsrx2 : public rx_dboard_base{
public:
dbsrx2(ctor_args_t args);
- ~dbsrx2(void);
+ virtual ~dbsrx2(void);
private:
double _lo_freq;
diff --git a/host/lib/usrp/dboard/db_e3x0.cpp b/host/lib/usrp/dboard/db_e3x0.cpp
index 523927d49..c7cc52d73 100644
--- a/host/lib/usrp/dboard/db_e3x0.cpp
+++ b/host/lib/usrp/dboard/db_e3x0.cpp
@@ -29,7 +29,7 @@ class e310_dboard : public xcvr_dboard_base{
public:
e310_dboard(ctor_args_t args) : xcvr_dboard_base(args) {}
- ~e310_dboard(void) {}
+ virtual ~e310_dboard(void) {}
};
/***********************************************************************
@@ -40,7 +40,7 @@ class e300_dboard : public xcvr_dboard_base{
public:
e300_dboard(ctor_args_t args) : xcvr_dboard_base(args) {}
- ~e300_dboard(void) {}
+ virtual ~e300_dboard(void) {}
};
/***********************************************************************
diff --git a/host/lib/usrp/dboard/db_rfx.cpp b/host/lib/usrp/dboard/db_rfx.cpp
index 342540275..dbb1600ec 100644
--- a/host/lib/usrp/dboard/db_rfx.cpp
+++ b/host/lib/usrp/dboard/db_rfx.cpp
@@ -78,7 +78,7 @@ public:
const freq_range_t &freq_range,
bool rx_div2, bool tx_div2
);
- ~rfx_xcvr(void);
+ virtual ~rfx_xcvr(void);
private:
const freq_range_t _freq_range;
diff --git a/host/lib/usrp/dboard/db_sbx_common.hpp b/host/lib/usrp/dboard/db_sbx_common.hpp
index 974cee114..c0e29f263 100644
--- a/host/lib/usrp/dboard/db_sbx_common.hpp
+++ b/host/lib/usrp/dboard/db_sbx_common.hpp
@@ -191,7 +191,7 @@ protected:
class sbx_version3 : public sbx_versionx {
public:
sbx_version3(sbx_xcvr *_self_sbx_xcvr);
- ~sbx_version3(void);
+ virtual ~sbx_version3(void);
double set_lo_freq(dboard_iface::unit_t unit, double target_freq);
@@ -211,7 +211,7 @@ protected:
class sbx_version4 : public sbx_versionx {
public:
sbx_version4(sbx_xcvr *_self_sbx_xcvr);
- ~sbx_version4(void);
+ virtual ~sbx_version4(void);
double set_lo_freq(dboard_iface::unit_t unit, double target_freq);
@@ -233,7 +233,7 @@ protected:
class cbx : public sbx_versionx {
public:
cbx(sbx_xcvr *_self_sbx_xcvr);
- ~cbx(void);
+ virtual ~cbx(void);
double set_lo_freq(dboard_iface::unit_t unit, double target_freq);
diff --git a/host/lib/usrp/dboard/db_tvrx.cpp b/host/lib/usrp/dboard/db_tvrx.cpp
index 92e9d331c..0f84cd68a 100644
--- a/host/lib/usrp/dboard/db_tvrx.cpp
+++ b/host/lib/usrp/dboard/db_tvrx.cpp
@@ -134,7 +134,7 @@ static const double reference_freq = 4.0e6;
class tvrx : public rx_dboard_base{
public:
tvrx(ctor_args_t args);
- ~tvrx(void);
+ virtual ~tvrx(void);
private:
uhd::dict<std::string, double> _gains;
diff --git a/host/lib/usrp/dboard/db_tvrx2.cpp b/host/lib/usrp/dboard/db_tvrx2.cpp
index d1fdd5508..3a5bc1198 100644
--- a/host/lib/usrp/dboard/db_tvrx2.cpp
+++ b/host/lib/usrp/dboard/db_tvrx2.cpp
@@ -751,7 +751,7 @@ static const uhd::dict<std::string, gain_range_t> tvrx2_gain_ranges = map_list_o
class tvrx2 : public rx_dboard_base{
public:
tvrx2(ctor_args_t args);
- ~tvrx2(void);
+ virtual ~tvrx2(void);
private:
double _freq_scalar;
diff --git a/host/lib/usrp/dboard/db_ubx.cpp b/host/lib/usrp/dboard/db_ubx.cpp
index 91f1f51eb..88c8d93c9 100644
--- a/host/lib/usrp/dboard/db_ubx.cpp
+++ b/host/lib/usrp/dboard/db_ubx.cpp
@@ -29,6 +29,7 @@
#include <uhd/utils/log.hpp>
#include <uhd/utils/msg.hpp>
#include <uhd/utils/static.hpp>
+#include <uhd/utils/safe_call.hpp>
#include <boost/assign/list_of.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/math/special_functions/round.hpp>
@@ -477,31 +478,34 @@ public:
.set(-8);
}
- ~ubx_xcvr(void)
+ virtual ~ubx_xcvr(void)
{
- // Shutdown synthesizers
- _txlo1->shutdown();
- _txlo2->shutdown();
- _rxlo1->shutdown();
- _rxlo2->shutdown();
+ UHD_SAFE_CALL
+ (
+ // Shutdown synthesizers
+ _txlo1->shutdown();
+ _txlo2->shutdown();
+ _rxlo1->shutdown();
+ _rxlo2->shutdown();
- // Reset CPLD values
- _cpld_reg.value = 0;
- write_cpld_reg();
+ // Reset CPLD values
+ _cpld_reg.value = 0;
+ write_cpld_reg();
- // Reset GPIO values
- set_gpio_field(TX_GAIN, 0);
- set_gpio_field(CPLD_RST_N, 0);
- set_gpio_field(RX_ANT, 1);
- set_gpio_field(TX_EN_N, 1);
- set_gpio_field(RX_EN_N, 1);
- set_gpio_field(SPI_ADDR, 0x7);
- set_gpio_field(RX_GAIN, 0);
- set_gpio_field(TXLO1_SYNC, 0);
- set_gpio_field(TXLO2_SYNC, 0);
- set_gpio_field(RXLO1_SYNC, 0);
- set_gpio_field(RXLO1_SYNC, 0);
- write_gpio();
+ // Reset GPIO values
+ set_gpio_field(TX_GAIN, 0);
+ set_gpio_field(CPLD_RST_N, 0);
+ set_gpio_field(RX_ANT, 1);
+ set_gpio_field(TX_EN_N, 1);
+ set_gpio_field(RX_EN_N, 1);
+ set_gpio_field(SPI_ADDR, 0x7);
+ set_gpio_field(RX_GAIN, 0);
+ set_gpio_field(TXLO1_SYNC, 0);
+ set_gpio_field(TXLO2_SYNC, 0);
+ set_gpio_field(RXLO1_SYNC, 0);
+ set_gpio_field(RXLO1_SYNC, 0);
+ write_gpio();
+ )
}
private:
diff --git a/host/lib/usrp/dboard/db_wbx_common.hpp b/host/lib/usrp/dboard/db_wbx_common.hpp
index 8a003fc8c..0e339e4a3 100644
--- a/host/lib/usrp/dboard/db_wbx_common.hpp
+++ b/host/lib/usrp/dboard/db_wbx_common.hpp
@@ -165,7 +165,7 @@ protected:
class wbx_version2 : public wbx_versionx {
public:
wbx_version2(wbx_base *_self_wbx_base);
- ~wbx_version2(void);
+ virtual ~wbx_version2(void);
double set_tx_gain(double gain, const std::string &name);
void set_tx_enabled(bool enb);
@@ -180,7 +180,7 @@ protected:
class wbx_version3 : public wbx_versionx {
public:
wbx_version3(wbx_base *_self_wbx_base);
- ~wbx_version3(void);
+ virtual ~wbx_version3(void);
double set_tx_gain(double gain, const std::string &name);
void set_tx_enabled(bool enb);
@@ -195,7 +195,7 @@ protected:
class wbx_version4 : public wbx_versionx {
public:
wbx_version4(wbx_base *_self_wbx_base);
- ~wbx_version4(void);
+ virtual ~wbx_version4(void);
double set_tx_gain(double gain, const std::string &name);
void set_tx_enabled(bool enb);
diff --git a/host/lib/usrp/dboard/db_wbx_simple.cpp b/host/lib/usrp/dboard/db_wbx_simple.cpp
index 7a132f864..062e1294b 100644
--- a/host/lib/usrp/dboard/db_wbx_simple.cpp
+++ b/host/lib/usrp/dboard/db_wbx_simple.cpp
@@ -46,7 +46,7 @@ static const std::vector<std::string> wbx_rx_antennas = list_of("TX/RX")("RX2")(
class wbx_simple : public wbx_base{
public:
wbx_simple(ctor_args_t args);
- ~wbx_simple(void);
+ virtual ~wbx_simple(void);
private:
void set_rx_ant(const std::string &ant);
diff --git a/host/lib/usrp/dboard/db_xcvr2450.cpp b/host/lib/usrp/dboard/db_xcvr2450.cpp
index b717813cf..4a3f69f69 100644
--- a/host/lib/usrp/dboard/db_xcvr2450.cpp
+++ b/host/lib/usrp/dboard/db_xcvr2450.cpp
@@ -112,7 +112,7 @@ static const uhd::dict<std::string, gain_range_t> xcvr_rx_gain_ranges = map_list
class xcvr2450 : public xcvr_dboard_base{
public:
xcvr2450(ctor_args_t args);
- ~xcvr2450(void);
+ virtual ~xcvr2450(void);
private:
double _lo_freq;