diff options
Diffstat (limited to 'host/lib/usrp/dboard')
-rw-r--r-- | host/lib/usrp/dboard/db_rfx.cpp | 30 | ||||
-rw-r--r-- | host/lib/usrp/dboard/db_sbx_common.cpp | 41 | ||||
-rw-r--r-- | host/lib/usrp/dboard/db_sbx_common.hpp | 4 | ||||
-rw-r--r-- | host/lib/usrp/dboard/db_wbx_simple.cpp | 26 |
4 files changed, 71 insertions, 30 deletions
diff --git a/host/lib/usrp/dboard/db_rfx.cpp b/host/lib/usrp/dboard/db_rfx.cpp index 3896534cd..58382f180 100644 --- a/host/lib/usrp/dboard/db_rfx.cpp +++ b/host/lib/usrp/dboard/db_rfx.cpp @@ -56,9 +56,9 @@ using namespace boost::assign; /*********************************************************************** * The RFX Series constants **********************************************************************/ -static const std::vector<std::string> rfx_tx_antennas = list_of("TX/RX"); +static const std::vector<std::string> rfx_tx_antennas = list_of("TX/RX")("CAL"); -static const std::vector<std::string> rfx_rx_antennas = list_of("TX/RX")("RX2"); +static const std::vector<std::string> rfx_rx_antennas = list_of("TX/RX")("RX2")("CAL"); static const uhd::dict<std::string, gain_range_t> rfx_rx_gain_ranges = map_list_of ("PGA0", gain_range_t(0, 70, 0.022)) @@ -271,10 +271,17 @@ void rfx_xcvr::set_rx_ant(const std::string &ant){ assert_has(rfx_rx_antennas, ant, "rfx rx antenna name"); //set the rx atr regs that change with antenna setting - this->get_iface()->set_atr_reg( - dboard_iface::UNIT_RX, dboard_iface::ATR_REG_RX_ONLY, - _power_up | MIXER_ENB | ((ant == "TX/RX")? ANT_TXRX : ANT_RX2) - ); + if (ant == "CAL") { + this->get_iface()->set_atr_reg(dboard_iface::UNIT_RX, dboard_iface::ATR_REG_TX_ONLY, _power_up | ANT_TXRX | MIXER_DIS); + this->get_iface()->set_atr_reg(dboard_iface::UNIT_RX, dboard_iface::ATR_REG_FULL_DUPLEX, _power_up | ANT_TXRX | MIXER_ENB); + this->get_iface()->set_atr_reg(dboard_iface::UNIT_RX, dboard_iface::ATR_REG_RX_ONLY, _power_up | MIXER_ENB | ANT_TXRX ); + } + else { + this->get_iface()->set_atr_reg(dboard_iface::UNIT_RX, dboard_iface::ATR_REG_TX_ONLY, _power_up | ANT_XX | MIXER_DIS); + this->get_iface()->set_atr_reg(dboard_iface::UNIT_RX, dboard_iface::ATR_REG_FULL_DUPLEX, _power_up | ANT_RX2| MIXER_ENB); + this->get_iface()->set_atr_reg(dboard_iface::UNIT_RX, dboard_iface::ATR_REG_RX_ONLY, _power_up | MIXER_ENB | + ((ant == "TX/RX")? ANT_TXRX : ANT_RX2)); + } //shadow the setting _rx_ant = ant; @@ -282,7 +289,16 @@ void rfx_xcvr::set_rx_ant(const std::string &ant){ void rfx_xcvr::set_tx_ant(const std::string &ant){ assert_has(rfx_tx_antennas, ant, "rfx tx antenna name"); - //only one antenna option, do nothing + + //set the tx atr regs that change with antenna setting + if (ant == "CAL") { + this->get_iface()->set_atr_reg(dboard_iface::UNIT_TX, dboard_iface::ATR_REG_TX_ONLY, _power_up | ANT_RX | MIXER_ENB); + this->get_iface()->set_atr_reg(dboard_iface::UNIT_TX, dboard_iface::ATR_REG_FULL_DUPLEX, _power_up | ANT_RX | MIXER_ENB); + } + else { + this->get_iface()->set_atr_reg(dboard_iface::UNIT_TX, dboard_iface::ATR_REG_TX_ONLY, _power_up | ANT_TX | MIXER_ENB); + this->get_iface()->set_atr_reg(dboard_iface::UNIT_TX, dboard_iface::ATR_REG_FULL_DUPLEX, _power_up | ANT_TX | MIXER_ENB); + } } /*********************************************************************** diff --git a/host/lib/usrp/dboard/db_sbx_common.cpp b/host/lib/usrp/dboard/db_sbx_common.cpp index 27b930f81..32b6730d5 100644 --- a/host/lib/usrp/dboard/db_sbx_common.cpp +++ b/host/lib/usrp/dboard/db_sbx_common.cpp @@ -216,35 +216,37 @@ void sbx_xcvr::update_atr(void){ int rx_ld_led = get_locked(dboard_iface::UNIT_RX).to_bool() ? 0 : RX_LED_LD; int tx_ld_led = get_locked(dboard_iface::UNIT_TX).to_bool() ? 0 : TX_LED_LD; int rx_ant_led = _rx_ant == "TX/RX" ? RX_LED_RX1RX2 : 0; - int tx_ant_led = _rx_ant == "TX/RX" ? 0 : TX_LED_TXRX; + int tx_ant_led = _tx_ant == "TX/RX" ? 0 : TX_LED_TXRX; //setup the tx atr (this does not change with antenna) this->get_iface()->set_atr_reg(dboard_iface::UNIT_TX, dboard_iface::ATR_REG_IDLE, tx_pga0_iobits | tx_lo_lpf_en | tx_ld_led | tx_ant_led | TX_POWER_UP | ANT_XX | TX_MIXER_DIS); - this->get_iface()->set_atr_reg(dboard_iface::UNIT_TX, dboard_iface::ATR_REG_TX_ONLY, - tx_pga0_iobits | tx_lo_lpf_en | tx_ld_led | tx_ant_led | TX_POWER_UP | ANT_TX | TX_MIXER_ENB); - this->get_iface()->set_atr_reg(dboard_iface::UNIT_TX, dboard_iface::ATR_REG_FULL_DUPLEX, - tx_pga0_iobits | tx_lo_lpf_en | tx_ld_led | tx_ant_led | TX_POWER_UP | ANT_TX | TX_MIXER_ENB); //setup the rx atr (this does not change with antenna) this->get_iface()->set_atr_reg(dboard_iface::UNIT_RX, dboard_iface::ATR_REG_IDLE, rx_pga0_iobits | rx_lo_lpf_en | rx_ld_led | rx_ant_led | RX_POWER_UP | ANT_XX | RX_MIXER_DIS); + + //set the RX atr regs that change with antenna setting + this->get_iface()->set_atr_reg(dboard_iface::UNIT_RX, dboard_iface::ATR_REG_RX_ONLY, + rx_pga0_iobits | rx_lo_lpf_en | rx_ld_led | rx_ant_led | RX_POWER_UP | RX_MIXER_ENB | + ((_rx_ant != "RX2")? ANT_TXRX : ANT_RX2)); this->get_iface()->set_atr_reg(dboard_iface::UNIT_RX, dboard_iface::ATR_REG_TX_ONLY, - rx_pga0_iobits | rx_lo_lpf_en | rx_ld_led | rx_ant_led | RX_POWER_UP | ANT_RX2 | RX_MIXER_DIS); + rx_pga0_iobits | rx_lo_lpf_en | rx_ld_led | rx_ant_led | RX_POWER_UP | RX_MIXER_DIS | + ((_rx_ant == "CAL")? ANT_TXRX : ANT_RX2)); this->get_iface()->set_atr_reg(dboard_iface::UNIT_RX, dboard_iface::ATR_REG_FULL_DUPLEX, - rx_pga0_iobits | rx_lo_lpf_en | rx_ld_led | rx_ant_led | RX_POWER_UP | ANT_RX2 | RX_MIXER_ENB); + rx_pga0_iobits | rx_lo_lpf_en | rx_ld_led | rx_ant_led | RX_POWER_UP | RX_MIXER_ENB | + ((_rx_ant == "CAL")? ANT_TXRX : ANT_RX2)); - //set the atr regs that change with antenna setting + //set the TX atr regs that change with antenna setting this->get_iface()->set_atr_reg(dboard_iface::UNIT_TX, dboard_iface::ATR_REG_RX_ONLY, tx_pga0_iobits | tx_lo_lpf_en | tx_ld_led | tx_ant_led | TX_POWER_UP | TX_MIXER_DIS | - ((_rx_ant == "TX/RX")? ANT_RX : ANT_TX)); - this->get_iface()->set_atr_reg(dboard_iface::UNIT_RX, dboard_iface::ATR_REG_RX_ONLY, - rx_pga0_iobits | rx_lo_lpf_en | rx_ld_led | rx_ant_led | RX_POWER_UP | RX_MIXER_ENB | - ((_rx_ant == "TX/RX")? ANT_TXRX : ANT_RX2)); - - UHD_LOGV(often) << boost::format( - "SBX RXONLY ATR REG: 0x%08x" - ) % (rx_pga0_iobits | RX_POWER_UP | RX_MIXER_ENB | ((_rx_ant == "TX/RX")? ANT_TXRX : ANT_RX2)) << std::endl; + ((_rx_ant != "RX2")? ANT_RX : ANT_TX)); + this->get_iface()->set_atr_reg(dboard_iface::UNIT_TX, dboard_iface::ATR_REG_TX_ONLY, + tx_pga0_iobits | tx_lo_lpf_en | tx_ld_led | tx_ant_led | TX_POWER_UP | TX_MIXER_ENB | + ((_tx_ant == "CAL")? ANT_RX : ANT_TX)); + this->get_iface()->set_atr_reg(dboard_iface::UNIT_TX, dboard_iface::ATR_REG_FULL_DUPLEX, + tx_pga0_iobits | tx_lo_lpf_en | tx_ld_led | tx_ant_led | TX_POWER_UP | TX_MIXER_ENB | + ((_tx_ant == "CAL")? ANT_RX : ANT_TX)); } void sbx_xcvr::set_rx_ant(const std::string &ant){ @@ -260,7 +262,12 @@ void sbx_xcvr::set_rx_ant(const std::string &ant){ void sbx_xcvr::set_tx_ant(const std::string &ant){ assert_has(sbx_tx_antennas, ant, "sbx tx antenna name"); - //only one antenna option, do nothing + + //shadow the setting + _tx_ant = ant; + + //write the new antenna setting to atr regs + update_atr(); } /*********************************************************************** diff --git a/host/lib/usrp/dboard/db_sbx_common.hpp b/host/lib/usrp/dboard/db_sbx_common.hpp index c90cce456..8997350ae 100644 --- a/host/lib/usrp/dboard/db_sbx_common.hpp +++ b/host/lib/usrp/dboard/db_sbx_common.hpp @@ -113,9 +113,9 @@ static const freq_range_t sbx_enable_rx_lo_filter = list_of (range_t(0.4e9, 1.5e9)) ; -static const std::vector<std::string> sbx_tx_antennas = list_of("TX/RX"); +static const std::vector<std::string> sbx_tx_antennas = list_of("TX/RX")("CAL"); -static const std::vector<std::string> sbx_rx_antennas = list_of("TX/RX")("RX2"); +static const std::vector<std::string> sbx_rx_antennas = list_of("TX/RX")("RX2")("CAL"); static const uhd::dict<std::string, gain_range_t> sbx_tx_gain_ranges = map_list_of ("PGA0", gain_range_t(0, 31.5, double(0.5))) diff --git a/host/lib/usrp/dboard/db_wbx_simple.cpp b/host/lib/usrp/dboard/db_wbx_simple.cpp index f46ea70d1..3d633a672 100644 --- a/host/lib/usrp/dboard/db_wbx_simple.cpp +++ b/host/lib/usrp/dboard/db_wbx_simple.cpp @@ -36,9 +36,9 @@ using namespace boost::assign; /*********************************************************************** * The WBX Simple dboard constants **********************************************************************/ -static const std::vector<std::string> wbx_tx_antennas = list_of("TX/RX"); +static const std::vector<std::string> wbx_tx_antennas = list_of("TX/RX")("CAL"); -static const std::vector<std::string> wbx_rx_antennas = list_of("TX/RX")("RX2"); +static const std::vector<std::string> wbx_rx_antennas = list_of("TX/RX")("RX2")("CAL"); /*********************************************************************** * The WBX simple implementation @@ -132,10 +132,28 @@ void wbx_simple::set_rx_ant(const std::string &ant){ _rx_ant = ant; //write the new antenna setting to atr regs - this->get_iface()->set_atr_reg(dboard_iface::UNIT_RX, dboard_iface::ATR_REG_RX_ONLY, ((_rx_ant == "TX/RX")? ANT_TXRX : ANT_RX2), ANTSW_IO); + if (_rx_ant == "CAL") { + this->get_iface()->set_atr_reg(dboard_iface::UNIT_RX, dboard_iface::ATR_REG_TX_ONLY, ANT_TXRX, ANTSW_IO); + this->get_iface()->set_atr_reg(dboard_iface::UNIT_RX, dboard_iface::ATR_REG_FULL_DUPLEX, ANT_TXRX, ANTSW_IO); + this->get_iface()->set_atr_reg(dboard_iface::UNIT_RX, dboard_iface::ATR_REG_RX_ONLY, ANT_TXRX, ANTSW_IO); + } + else { + this->get_iface()->set_atr_reg(dboard_iface::UNIT_RX, dboard_iface::ATR_REG_TX_ONLY, ANT_RX2, ANTSW_IO); + this->get_iface()->set_atr_reg(dboard_iface::UNIT_RX, dboard_iface::ATR_REG_FULL_DUPLEX, ANT_RX2, ANTSW_IO); + this->get_iface()->set_atr_reg(dboard_iface::UNIT_RX, dboard_iface::ATR_REG_RX_ONLY, ((_rx_ant == "TX/RX")? ANT_TXRX : ANT_RX2), ANTSW_IO); + } } void wbx_simple::set_tx_ant(const std::string &ant){ assert_has(wbx_tx_antennas, ant, "wbx tx antenna name"); - //only one antenna option, do nothing + + //write the new antenna setting to atr regs + if (ant == "CAL") { + this->get_iface()->set_atr_reg(dboard_iface::UNIT_TX, dboard_iface::ATR_REG_TX_ONLY, ANT_RX, ANTSW_IO); + this->get_iface()->set_atr_reg(dboard_iface::UNIT_TX, dboard_iface::ATR_REG_FULL_DUPLEX, ANT_RX, ANTSW_IO); + } + else { + this->get_iface()->set_atr_reg(dboard_iface::UNIT_TX, dboard_iface::ATR_REG_TX_ONLY, ANT_TX, ANTSW_IO); + this->get_iface()->set_atr_reg(dboard_iface::UNIT_TX, dboard_iface::ATR_REG_FULL_DUPLEX, ANT_TX, ANTSW_IO); + } } |