aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/dboard/db_wbx_common.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'host/lib/usrp/dboard/db_wbx_common.hpp')
-rw-r--r--host/lib/usrp/dboard/db_wbx_common.hpp133
1 files changed, 68 insertions, 65 deletions
diff --git a/host/lib/usrp/dboard/db_wbx_common.hpp b/host/lib/usrp/dboard/db_wbx_common.hpp
index 9425b041c..e7beabd8b 100644
--- a/host/lib/usrp/dboard/db_wbx_common.hpp
+++ b/host/lib/usrp/dboard/db_wbx_common.hpp
@@ -12,96 +12,93 @@
#include <uhdlib/usrp/common/adf435x.hpp>
// LO Related
-#define ADF435X_CE (1 << 3)
-#define ADF435X_PDBRF (1 << 2)
-#define ADF435X_MUXOUT (1 << 1) // INPUT!!!
-#define LOCKDET_MASK (1 << 0) // INPUT!!!
+#define ADF435X_CE (1 << 3)
+#define ADF435X_PDBRF (1 << 2)
+#define ADF435X_MUXOUT (1 << 1) // INPUT!!!
+#define LOCKDET_MASK (1 << 0) // INPUT!!!
// TX IO Pins
-#define TX_PUP_5V (1 << 7) // enables 5.0V power supply
-#define TX_PUP_3V (1 << 6) // enables 3.3V supply
-#define TXMOD_EN (1 << 4) // on UNIT_TX, 1 enables TX Modulator
+#define TX_PUP_5V (1 << 7) // enables 5.0V power supply
+#define TX_PUP_3V (1 << 6) // enables 3.3V supply
+#define TXMOD_EN (1 << 4) // on UNIT_TX, 1 enables TX Modulator
// RX IO Pins
-#define RX_PUP_5V (1 << 7) // enables 5.0V power supply
-#define RX_PUP_3V (1 << 6) // enables 3.3V supply
-#define RXBB_PDB (1 << 4) // on UNIT_RX, 1 powers up RX baseband
+#define RX_PUP_5V (1 << 7) // enables 5.0V power supply
+#define RX_PUP_3V (1 << 6) // enables 3.3V supply
+#define RXBB_PDB (1 << 4) // on UNIT_RX, 1 powers up RX baseband
// TX Attenuator Pins (v3 only)
-#define TX_ATTN_16 (1 << 14)
-#define TX_ATTN_8 (1 << 5)
-#define TX_ATTN_4 (1 << 4)
-#define TX_ATTN_2 (1 << 3)
-#define TX_ATTN_1 (1 << 1)
-#define TX_ATTN_MASK (TX_ATTN_16|TX_ATTN_8|TX_ATTN_4|TX_ATTN_2|TX_ATTN_1) // valid bits of TX Attenuator Control
-
-#define RX_ATTN_SHIFT 8 //lsb of RX Attenuator Control
-#define RX_ATTN_MASK (63 << RX_ATTN_SHIFT) //valid bits of RX Attenuator Control
+#define TX_ATTN_16 (1 << 14)
+#define TX_ATTN_8 (1 << 5)
+#define TX_ATTN_4 (1 << 4)
+#define TX_ATTN_2 (1 << 3)
+#define TX_ATTN_1 (1 << 1)
+#define TX_ATTN_MASK \
+ (TX_ATTN_16 | TX_ATTN_8 | TX_ATTN_4 | TX_ATTN_2 \
+ | TX_ATTN_1) // valid bits of TX Attenuator Control
+
+#define RX_ATTN_SHIFT 8 // lsb of RX Attenuator Control
+#define RX_ATTN_MASK (63 << RX_ATTN_SHIFT) // valid bits of RX Attenuator Control
// Mixer functions
-#define TX_MIXER_ENB (TXMOD_EN|ADF435X_PDBRF) // for v3, TXMOD_EN tied to ADF435X_PDBRF rather than separate
-#define TX_MIXER_DIS 0
+#define TX_MIXER_ENB \
+ (TXMOD_EN \
+ | ADF435X_PDBRF) // for v3, TXMOD_EN tied to ADF435X_PDBRF rather than separate
+#define TX_MIXER_DIS 0
-#define RX_MIXER_ENB (RXBB_PDB|ADF435X_PDBRF)
-#define RX_MIXER_DIS 0
+#define RX_MIXER_ENB (RXBB_PDB | ADF435X_PDBRF)
+#define RX_MIXER_DIS 0
// Power functions
-#define TX_POWER_UP (TX_PUP_5V|TX_PUP_3V) // high enables power supply
-#define TX_POWER_DOWN 0
+#define TX_POWER_UP (TX_PUP_5V | TX_PUP_3V) // high enables power supply
+#define TX_POWER_DOWN 0
-#define RX_POWER_UP (RX_PUP_5V|RX_PUP_3V|ADF435X_CE) // high enables power supply
-#define RX_POWER_DOWN 0
+#define RX_POWER_UP (RX_PUP_5V | RX_PUP_3V | ADF435X_CE) // high enables power supply
+#define RX_POWER_DOWN 0
#include <uhd/types/dict.hpp>
#include <uhd/types/ranges.hpp>
#include <uhd/types/sensors.hpp>
+#include <uhd/usrp/dboard_base.hpp>
#include <uhd/utils/log.hpp>
#include <uhd/utils/static.hpp>
-#include <uhd/usrp/dboard_base.hpp>
#include <boost/assign/list_of.hpp>
#include <boost/format.hpp>
-#include <memory>
#include <boost/math/special_functions/round.hpp>
#include <functional>
+#include <memory>
-namespace uhd{ namespace usrp{
+namespace uhd { namespace usrp {
/***********************************************************************
* The WBX Common dboard constants
**********************************************************************/
-static const uhd::dict<std::string, gain_range_t> wbx_rx_gain_ranges = boost::assign::map_list_of
- ("PGA0", gain_range_t(0, 31.5, 0.5));
+static const uhd::dict<std::string, gain_range_t> wbx_rx_gain_ranges =
+ boost::assign::map_list_of("PGA0", gain_range_t(0, 31.5, 0.5));
-static const freq_range_t wbx_tx_lo_5dbm = boost::assign::list_of
- (range_t(0.05e9, 1.7e9))
- (range_t(1.9e9, 2.2e9))
-;
+static const freq_range_t wbx_tx_lo_5dbm =
+ boost::assign::list_of(range_t(0.05e9, 1.7e9))(range_t(1.9e9, 2.2e9));
-static const freq_range_t wbx_tx_lo_m1dbm = boost::assign::list_of
- (range_t(1.7e9, 1.9e9))
-;
+static const freq_range_t wbx_tx_lo_m1dbm = boost::assign::list_of(range_t(1.7e9, 1.9e9));
-static const freq_range_t wbx_rx_lo_5dbm = boost::assign::list_of
- (range_t(0.05e9, 1.4e9))
-;
+static const freq_range_t wbx_rx_lo_5dbm = boost::assign::list_of(range_t(0.05e9, 1.4e9));
-static const freq_range_t wbx_rx_lo_2dbm = boost::assign::list_of
- (range_t(1.4e9, 2.2e9))
-;
+static const freq_range_t wbx_rx_lo_2dbm = boost::assign::list_of(range_t(1.4e9, 2.2e9));
/***********************************************************************
* The WBX dboard base class
**********************************************************************/
-class wbx_base : public xcvr_dboard_base{
+class wbx_base : public xcvr_dboard_base
+{
public:
wbx_base(ctor_args_t args);
virtual ~wbx_base(void);
protected:
- virtual double set_rx_gain(double gain, const std::string &name);
+ virtual double set_rx_gain(double gain, const std::string& name);
virtual void set_rx_enabled(bool enb);
@@ -121,29 +118,32 @@ protected:
* This class is an abstract base class, and thus is impossible to
* instantiate.
*/
- class wbx_versionx {
+ class wbx_versionx
+ {
public:
- wbx_versionx():self_base(NULL) {}
+ wbx_versionx() : self_base(NULL) {}
virtual ~wbx_versionx(void) {}
- virtual double set_tx_gain(double gain, const std::string &name) = 0;
- virtual void set_tx_enabled(bool enb) = 0;
+ virtual double set_tx_gain(double gain, const std::string& name) = 0;
+ virtual void set_tx_enabled(bool enb) = 0;
virtual double set_lo_freq(dboard_iface::unit_t unit, double target_freq) = 0;
/*! This is the registered instance of the wrapper class, wbx_base. */
- wbx_base *self_base;
+ wbx_base* self_base;
- property_tree::sptr get_rx_subtree(void){
+ property_tree::sptr get_rx_subtree(void)
+ {
return self_base->get_rx_subtree();
}
- property_tree::sptr get_tx_subtree(void){
+ property_tree::sptr get_tx_subtree(void)
+ {
return self_base->get_tx_subtree();
}
adf435x_iface::sptr _txlo;
adf435x_iface::sptr _rxlo;
- void write_lo_regs(dboard_iface::unit_t unit, const std::vector<uint32_t> &regs);
+ void write_lo_regs(dboard_iface::unit_t unit, const std::vector<uint32_t>& regs);
};
@@ -152,12 +152,13 @@ protected:
*
* Basically the original release of the DB.
*/
- class wbx_version2 : public wbx_versionx {
+ class wbx_version2 : public wbx_versionx
+ {
public:
- wbx_version2(wbx_base *_self_wbx_base);
+ wbx_version2(wbx_base* _self_wbx_base);
virtual ~wbx_version2(void);
- double set_tx_gain(double gain, const std::string &name);
+ double set_tx_gain(double gain, const std::string& name);
void set_tx_enabled(bool enb);
double set_lo_freq(dboard_iface::unit_t unit, double target_freq);
};
@@ -167,12 +168,13 @@ protected:
*
* Fixed a problem with the AGC from Version 2.
*/
- class wbx_version3 : public wbx_versionx {
+ class wbx_version3 : public wbx_versionx
+ {
public:
- wbx_version3(wbx_base *_self_wbx_base);
+ wbx_version3(wbx_base* _self_wbx_base);
virtual ~wbx_version3(void);
- double set_tx_gain(double gain, const std::string &name);
+ double set_tx_gain(double gain, const std::string& name);
void set_tx_enabled(bool enb);
double set_lo_freq(dboard_iface::unit_t unit, double target_freq);
};
@@ -182,12 +184,13 @@ protected:
*
* Upgrades the Frequnecy Synthensizer from ADF4350 to ADF4351.
*/
- class wbx_version4 : public wbx_versionx {
+ class wbx_version4 : public wbx_versionx
+ {
public:
- wbx_version4(wbx_base *_self_wbx_base);
+ wbx_version4(wbx_base* _self_wbx_base);
virtual ~wbx_version4(void);
- double set_tx_gain(double gain, const std::string &name);
+ double set_tx_gain(double gain, const std::string& name);
void set_tx_enabled(bool enb);
double set_lo_freq(dboard_iface::unit_t unit, double target_freq);
};
@@ -208,6 +211,6 @@ protected:
};
-}} //namespace uhd::usrp
+}} // namespace uhd::usrp
#endif /* INCLUDED_LIBUHD_USRP_DBOARD_DB_WBX_COMMON_HPP */