summaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/dboard
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-07-18 12:56:06 -0700
committerJosh Blum <josh@joshknows.com>2011-07-18 12:56:06 -0700
commit0fb4451675947f8f965831f0a5f4e93945e93b90 (patch)
tree79f1dc97ad40bcc92bd11ee216065458d5298bd9 /host/lib/usrp/dboard
parent0e788f77514cf33b0ff178bc7e72287d9e086ba2 (diff)
parent60edbd7f59c873ce69ddb5b337e640f479a28321 (diff)
downloaduhd-0fb4451675947f8f965831f0a5f4e93945e93b90.tar.gz
uhd-0fb4451675947f8f965831f0a5f4e93945e93b90.tar.bz2
uhd-0fb4451675947f8f965831f0a5f4e93945e93b90.zip
Merge branch 'master' into next
Conflicts: host/lib/convert/convert_fc64_with_sse2.cpp
Diffstat (limited to 'host/lib/usrp/dboard')
-rw-r--r--host/lib/usrp/dboard/db_wbx_common.cpp40
-rw-r--r--host/lib/usrp/dboard/db_wbx_simple.cpp12
2 files changed, 34 insertions, 18 deletions
diff --git a/host/lib/usrp/dboard/db_wbx_common.cpp b/host/lib/usrp/dboard/db_wbx_common.cpp
index 81aba6426..1089dc7c2 100644
--- a/host/lib/usrp/dboard/db_wbx_common.cpp
+++ b/host/lib/usrp/dboard/db_wbx_common.cpp
@@ -44,7 +44,7 @@
#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
// Mixer functions
-#define TX_MIXER_ENB (TXMOD_EN|ADF4350_PDBRF)
+#define TX_MIXER_ENB (TXMOD_EN|ADF4350_PDBRF) // for v3, TXMOD_EN tied to ADF4350_PDBRF rather than separate
#define TX_MIXER_DIS 0
#define RX_MIXER_ENB (RXBB_PDB|ADF4350_PDBRF)
@@ -101,18 +101,19 @@ wbx_base::wbx_base(ctor_args_t args) : xcvr_dboard_base(args){
//v3 has different io bits for attenuator control
int v3_iobits = is_v3() ? TX_ATTN_MASK : ADF4350_CE;
+ int v3_tx_mod = is_v3() ? ADF4350_PDBRF : TXMOD_EN|ADF4350_PDBRF;
//set the gpio directions and atr controls
- this->get_iface()->set_pin_ctrl(dboard_iface::UNIT_TX, TXMOD_EN|ADF4350_PDBRF);
+ this->get_iface()->set_pin_ctrl(dboard_iface::UNIT_TX, v3_tx_mod);
this->get_iface()->set_pin_ctrl(dboard_iface::UNIT_RX, RXBB_PDB|ADF4350_PDBRF);
- this->get_iface()->set_gpio_ddr(dboard_iface::UNIT_TX, TX_PUP_5V|TX_PUP_3V|TXMOD_EN|ADF4350_PDBRF|v3_iobits);
+ this->get_iface()->set_gpio_ddr(dboard_iface::UNIT_TX, TX_PUP_5V|TX_PUP_3V|v3_tx_mod|v3_iobits);
this->get_iface()->set_gpio_ddr(dboard_iface::UNIT_RX, RX_PUP_5V|RX_PUP_3V|ADF4350_CE|RXBB_PDB|ADF4350_PDBRF|RX_ATTN_MASK);
//setup ATR for the mixer enables (always enabled to prevent phase slip between bursts)
- this->get_iface()->set_atr_reg(dboard_iface::UNIT_TX, dboard_iface::ATR_REG_IDLE, TX_MIXER_ENB, TX_MIXER_DIS | TX_MIXER_ENB);
- this->get_iface()->set_atr_reg(dboard_iface::UNIT_TX, dboard_iface::ATR_REG_RX_ONLY, TX_MIXER_ENB, TX_MIXER_DIS | TX_MIXER_ENB);
- this->get_iface()->set_atr_reg(dboard_iface::UNIT_TX, dboard_iface::ATR_REG_TX_ONLY, TX_MIXER_ENB, TX_MIXER_DIS | TX_MIXER_ENB);
- this->get_iface()->set_atr_reg(dboard_iface::UNIT_TX, dboard_iface::ATR_REG_FULL_DUPLEX, TX_MIXER_ENB, TX_MIXER_DIS | TX_MIXER_ENB);
+ this->get_iface()->set_atr_reg(dboard_iface::UNIT_TX, dboard_iface::ATR_REG_IDLE, v3_tx_mod, TX_MIXER_DIS | v3_tx_mod);
+ this->get_iface()->set_atr_reg(dboard_iface::UNIT_TX, dboard_iface::ATR_REG_RX_ONLY, v3_tx_mod, TX_MIXER_DIS | v3_tx_mod);
+ this->get_iface()->set_atr_reg(dboard_iface::UNIT_TX, dboard_iface::ATR_REG_TX_ONLY, v3_tx_mod, TX_MIXER_DIS | v3_tx_mod);
+ this->get_iface()->set_atr_reg(dboard_iface::UNIT_TX, dboard_iface::ATR_REG_FULL_DUPLEX, v3_tx_mod, TX_MIXER_DIS | v3_tx_mod);
this->get_iface()->set_atr_reg(dboard_iface::UNIT_RX, dboard_iface::ATR_REG_IDLE, RX_MIXER_ENB, RX_MIXER_DIS | RX_MIXER_ENB);
this->get_iface()->set_atr_reg(dboard_iface::UNIT_RX, dboard_iface::ATR_REG_TX_ONLY, RX_MIXER_ENB, RX_MIXER_DIS | RX_MIXER_ENB);
@@ -190,7 +191,7 @@ static int tx_pga0_gain_to_iobits(double &gain){
double attn = wbx_v3_tx_gain_ranges["PGA0"].stop() - gain;
//calculate the attenuation
- int attn_code = boost::math::iround(attn*2);
+ int attn_code = boost::math::iround(attn);
int iobits = (
(attn_code & 16 ? 0 : TX_ATTN_16) |
(attn_code & 8 ? 0 : TX_ATTN_8) |
@@ -235,11 +236,11 @@ void wbx_base::set_tx_gain(double gain, const std::string &name){
if (is_v3()) {
assert_has(wbx_v3_tx_gain_ranges.keys(), name, "wbx tx gain name");
if(name == "PGA0"){
- double dac_volts = tx_pga0_gain_to_iobits(gain);
+ boost::uint16_t io_bits = tx_pga0_gain_to_iobits(gain);
_tx_gains[name] = gain;
- //write the new voltage to the aux dac
- this->get_iface()->write_aux_dac(dboard_iface::UNIT_TX, dboard_iface::AUX_DAC_A, dac_volts);
+ //write the new gain to tx gpio outputs
+ this->get_iface()->set_gpio_out(dboard_iface::UNIT_TX, io_bits, TX_ATTN_MASK);
}
else UHD_THROW_INVALID_CODE_PATH();
}
@@ -446,7 +447,7 @@ bool wbx_base::get_locked(dboard_iface::unit_t unit){
}
bool wbx_base::is_v3(void){
- return get_rx_id() == 0x057;
+ return get_rx_id().to_uint16() == 0x057;
}
/***********************************************************************
@@ -569,12 +570,21 @@ void wbx_base::tx_get(const wax::obj &key_, wax::obj &val){
return;
case SUBDEV_PROP_GAIN_RANGE:
- assert_has(wbx_tx_gain_ranges.keys(), key.name, "wbx tx gain name");
- val = wbx_tx_gain_ranges[key.name];
+ if (is_v3()) {
+ assert_has(wbx_v3_tx_gain_ranges.keys(), key.name, "wbx tx gain name");
+ val = wbx_v3_tx_gain_ranges[key.name];
+ }
+ else {
+ assert_has(wbx_tx_gain_ranges.keys(), key.name, "wbx tx gain name");
+ val = wbx_tx_gain_ranges[key.name];
+ }
return;
case SUBDEV_PROP_GAIN_NAMES:
- val = prop_names_t(wbx_tx_gain_ranges.keys());
+ if (is_v3())
+ val = prop_names_t(wbx_v3_tx_gain_ranges.keys());
+ else
+ val = prop_names_t(wbx_tx_gain_ranges.keys());
return;
case SUBDEV_PROP_FREQ:
diff --git a/host/lib/usrp/dboard/db_wbx_simple.cpp b/host/lib/usrp/dboard/db_wbx_simple.cpp
index ae466b08a..990bacbc8 100644
--- a/host/lib/usrp/dboard/db_wbx_simple.cpp
+++ b/host/lib/usrp/dboard/db_wbx_simple.cpp
@@ -16,7 +16,7 @@
//
// Antenna constants
-#define ANTSW_IO ((1 << 5)|(1 << 15)) // on UNIT_TX, 0 = TX, 1 = RX, on UNIT_RX 0 = main ant, 1 = RX2
+#define ANTSW_IO ((1 << 15)) // on UNIT_TX, 0 = TX, 1 = RX, on UNIT_RX 0 = main ant, 1 = RX2
#define ANT_TX 0 //the tx line is transmitting
#define ANT_RX ANTSW_IO //the tx line is receiving
#define ANT_TXRX 0 //the rx line is on txrx
@@ -149,7 +149,10 @@ void wbx_simple::rx_get(const wax::obj &key_, wax::obj &val){
//handle the get request conditioned on the key
switch(key.as<subdev_prop_t>()){
case SUBDEV_PROP_NAME:
- val = std::string("WBX RX + Simple GDB");
+ if (is_v3())
+ val = std::string("WBX v3 RX + Simple GDB");
+ else
+ val = std::string("WBX RX + Simple GDB");
return;
case SUBDEV_PROP_FREQ:
@@ -203,7 +206,10 @@ void wbx_simple::tx_get(const wax::obj &key_, wax::obj &val){
//handle the get request conditioned on the key
switch(key.as<subdev_prop_t>()){
case SUBDEV_PROP_NAME:
- val = std::string("WBX TX + Simple GDB");
+ if (is_v3())
+ val = std::string("WBX v3 TX + Simple GDB");
+ else
+ val = std::string("WBX TX + Simple GDB");
return;
case SUBDEV_PROP_FREQ: