b200: Fix invalid RF switch positions

In some situations, the RF switches on the frontend would be placed in
undefined states.  This does not cause physical harm, but could distort
signals or introduce noise.  This fix ensures the RF switches are always
in a defined state.

Signed-off-by: michael-west <michael.west@ettus.com>
This commit is contained in:
michael-west 2023-04-07 10:37:42 -07:00 committed by Aki Tomita
parent 8e54b58d89
commit 4a77791cf5
2 changed files with 13 additions and 11 deletions

View file

@ -1400,9 +1400,9 @@ void b200_impl::update_atrs(void)
const bool enb_tx = bool(perif.tx_streamer.lock());
const bool is_rx2 = perif.ant_rx2;
const uint32_t rxonly = (enb_rx) ? ((is_rx2) ? STATE_RX1_RX2 : STATE_RX1_TXRX)
: STATE_OFF;
const uint32_t txonly = (enb_tx) ? (STATE_TX1_TXRX) : STATE_OFF;
uint32_t fd = STATE_OFF;
: STATE_RX1_OFF;
const uint32_t txonly = (enb_tx) ? (STATE_TX1_TXRX) : STATE_RX1_OFF;
uint32_t fd = STATE_RX1_OFF;
if (enb_rx and enb_tx)
fd = STATE_FDX1_TXRX;
if (enb_rx and not enb_tx)
@ -1410,7 +1410,7 @@ void b200_impl::update_atrs(void)
if (not enb_rx and enb_tx)
fd = txonly;
gpio_atr_3000::sptr atr = perif.atr;
atr->set_atr_reg(ATR_REG_IDLE, STATE_OFF);
atr->set_atr_reg(ATR_REG_IDLE, STATE_RX1_OFF);
atr->set_atr_reg(ATR_REG_RX_ONLY, rxonly);
atr->set_atr_reg(ATR_REG_TX_ONLY, txonly);
atr->set_atr_reg(ATR_REG_FULL_DUPLEX, fd);
@ -1421,9 +1421,9 @@ void b200_impl::update_atrs(void)
const bool enb_tx = bool(perif.tx_streamer.lock());
const bool is_rx2 = perif.ant_rx2;
const uint32_t rxonly = (enb_rx) ? ((is_rx2) ? STATE_RX2_RX2 : STATE_RX2_TXRX)
: STATE_OFF;
const uint32_t txonly = (enb_tx) ? (STATE_TX2_TXRX) : STATE_OFF;
uint32_t fd = STATE_OFF;
: STATE_RX2_OFF;
const uint32_t txonly = (enb_tx) ? (STATE_TX2_TXRX) : STATE_RX2_OFF;
uint32_t fd = STATE_RX2_OFF;
if (enb_rx and enb_tx)
fd = STATE_FDX2_TXRX;
if (enb_rx and not enb_tx)
@ -1431,7 +1431,7 @@ void b200_impl::update_atrs(void)
if (not enb_rx and enb_tx)
fd = txonly;
gpio_atr_3000::sptr atr = perif.atr;
atr->set_atr_reg(ATR_REG_IDLE, STATE_OFF);
atr->set_atr_reg(ATR_REG_IDLE, STATE_RX2_OFF);
atr->set_atr_reg(ATR_REG_RX_ONLY, rxonly);
atr->set_atr_reg(ATR_REG_TX_ONLY, txonly);
atr->set_atr_reg(ATR_REG_FULL_DUPLEX, fd);

View file

@ -73,10 +73,10 @@ static const uint32_t LED_TXRX_TX2 = (1 << 0);
/* ATR State Definitions. */
static const uint32_t STATE_OFF = 0x00;
///////////////////////// side 1 ///////////////////////////////////
static const uint32_t STATE_RX1_RX2 = (SFDX1_RX | SFDX1_TX | LED_RX1);
static const uint32_t STATE_RX1_OFF = (SFDX1_RX | SRX1_TX);
static const uint32_t STATE_RX1_RX2 = (SFDX1_RX | SRX1_TX | LED_RX1);
static const uint32_t STATE_RX1_TXRX = (SRX1_RX | SRX1_TX | LED_TXRX_RX1);
@ -86,6 +86,8 @@ static const uint32_t STATE_FDX1_TXRX =
static const uint32_t STATE_TX1_TXRX = (TX_ENABLE1 | SFDX1_RX | SFDX1_TX | LED_TXRX_TX1);
///////////////////////// side 2 ///////////////////////////////////
static const uint32_t STATE_RX2_OFF = (SFDX2_RX | SRX2_TX);
static const uint32_t STATE_RX2_RX2 = (SFDX2_RX | SRX2_TX | LED_RX2);
static const uint32_t STATE_RX2_TXRX = (SRX2_TX | SRX2_RX | LED_TXRX_RX2);