aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2017-11-08 17:34:35 -0800
committerMartin Braun <martin.braun@ettus.com>2017-12-22 15:05:05 -0800
commit34dbd5e60090cf9138ff51988c4460df1888fb2c (patch)
tree3357fef4f5e58ba46192289387629fba462483f0 /host/lib
parente88169017333f590ef6980652a8054a41f729568 (diff)
downloaduhd-34dbd5e60090cf9138ff51988c4460df1888fb2c.tar.gz
uhd-34dbd5e60090cf9138ff51988c4460df1888fb2c.tar.bz2
uhd-34dbd5e60090cf9138ff51988c4460df1888fb2c.zip
mg: Enable CAL and LO-CAL "antenna" inputs
For consistency, the LO-CAL antenna name is actually "LOCAL" (without the dash).
Diffstat (limited to 'host/lib')
-rw-r--r--host/lib/usrp/dboard/magnesium/magnesium_constants.hpp2
-rw-r--r--host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_cpld.cpp38
-rw-r--r--host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.cpp8
3 files changed, 33 insertions, 15 deletions
diff --git a/host/lib/usrp/dboard/magnesium/magnesium_constants.hpp b/host/lib/usrp/dboard/magnesium/magnesium_constants.hpp
index ec7595d98..886270dc0 100644
--- a/host/lib/usrp/dboard/magnesium/magnesium_constants.hpp
+++ b/host/lib/usrp/dboard/magnesium/magnesium_constants.hpp
@@ -49,7 +49,7 @@ static const double ALL_TX_MAX_GAIN = 65.0;
static const double ALL_TX_GAIN_STEP = 0.5;
static const double MAGNESIUM_CENTER_FREQ = 2.5e9; // Hz
static const std::vector<std::string> MAGNESIUM_RX_ANTENNAS = {
- "TX/RX", "RX2"
+ "TX/RX", "RX2", "CAL", "LOCAL"
};
static const char* MAGNESIUM_DEFAULT_RX_ANTENNA = "RX2";
static const char* MAGNESIUM_DEFAULT_TX_ANTENNA = "TX/RX";
diff --git a/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_cpld.cpp b/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_cpld.cpp
index 8ab88a5b2..562fecc30 100644
--- a/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_cpld.cpp
+++ b/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_cpld.cpp
@@ -46,20 +46,38 @@ void magnesium_radio_ctrl_impl::_update_atr_switches(
const std::string &ant
){
UHD_ASSERT_THROW(dir == RX_DIRECTION or dir == TX_DIRECTION);
- magnesium_cpld_ctrl::rx_sw1_t rx_sw1 = magnesium_cpld_ctrl::RX_SW1_RX2INPUT;
- magnesium_cpld_ctrl::sw_trx_t sw_trx = _sw_trx[chan];
- bool trx_led = false, rx2_led = true;
- //bool tx_pa_enb = true, tx_amp_enb = true, tx_myk_en=true;
- if (ant == "TX/RX" and dir == RX_DIRECTION) {
- rx_sw1 = magnesium_cpld_ctrl::RX_SW1_TRXSWITCHOUTPUT;
- sw_trx = magnesium_cpld_ctrl::SW_TRX_RXCHANNELPATH;
- trx_led = true;
- rx2_led = false;
- }
if (dir == RX_DIRECTION) {
+ // These default values work for RX2
+ bool trx_led = false;
+ bool rx2_led = true;
+ auto rx_sw1 = magnesium_cpld_ctrl::RX_SW1_RX2INPUT;
+ // The TRX switch in TX-idle mode defaults to TX-on mode. When TX is
+ // off, and we're receiving on TX/RX however, we need to point TRX to
+ // RX SW1. In all other cases, a TX state toggle (on to idle or vice
+ // versa) won't trigger a change of the TRX switch.
+ auto sw_trx = _sw_trx[chan];
UHD_LOG_TRACE(unique_id(),
"Updating all RX-ATR related switches for antenna==" << ant);
+ if (ant == "TX/RX") {
+ rx_sw1 = magnesium_cpld_ctrl::RX_SW1_TRXSWITCHOUTPUT;
+ sw_trx = magnesium_cpld_ctrl::SW_TRX_RXCHANNELPATH;
+ trx_led = true;
+ rx2_led = false;
+ }
+ else if (ant == "CAL") {
+ // It makes intuitive sense to illuminate the green TX/RX LED when
+ // receiving on CAL (because it goes over to the TX/RX port), but
+ // the problem is that CAL is only useful when we're both TXing and
+ // RXing, and then both green and red would be on the same LED.
+ // So, for CAL, we light up the green RX2 LED.
+ trx_led = false;
+ rx2_led = true;
+ rx_sw1 = magnesium_cpld_ctrl::RX_SW1_TXRXINPUT;
+ }
+ else if (ant == "LOCAL") {
+ rx_sw1 = magnesium_cpld_ctrl::RX_SW1_RXLOCALINPUT;
+ }
_cpld->set_rx_input_atr_bits(
chan,
magnesium_cpld_ctrl::ON,
diff --git a/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.cpp b/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.cpp
index e2fe1e51b..93f9a25b9 100644
--- a/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.cpp
+++ b/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.cpp
@@ -143,12 +143,12 @@ void magnesium_radio_ctrl_impl::set_rx_antenna(
const size_t chan
) {
UHD_ASSERT_THROW(chan <= MAGNESIUM_NUM_CHANS);
- // TODO can we please not hardcode the antenna names here?
- // We need a map somewhere, anyway, to store the available options in the
- // prop tree.
- if (ant != "RX2" and ant != "TX/RX") {
+ if (std::find(MAGNESIUM_RX_ANTENNAS.begin(),
+ MAGNESIUM_RX_ANTENNAS.end(),
+ ant) == MAGNESIUM_RX_ANTENNAS.end()) {
throw uhd::value_error(str(
boost::format("[%s] Requesting invalid RX antenna value: %s")
+ % unique_id()
% ant
));
}