diff options
-rw-r--r-- | usrp2/firmware/apps/app_common_v2.c | 4 | ||||
-rw-r--r-- | usrp2/firmware/lib/db_xcvr2450.c | 25 | ||||
-rw-r--r-- | usrp2/host/lib/usrp2_impl.cc | 8 |
3 files changed, 31 insertions, 6 deletions
diff --git a/usrp2/firmware/apps/app_common_v2.c b/usrp2/firmware/apps/app_common_v2.c index 2d767b5a5..7716ed992 100644 --- a/usrp2/firmware/apps/app_common_v2.c +++ b/usrp2/firmware/apps/app_common_v2.c @@ -495,11 +495,11 @@ handle_control_chan_frame(u2_eth_packet_t *pkt, size_t len) goto generic_reply; case OP_RX_ANTENNA: - db_set_antenna(rx_dboard, ((op_config_mimo_t *)payload)->flags); + ok = db_set_antenna(rx_dboard, ((op_config_mimo_t *)payload)->flags); goto generic_reply; case OP_TX_ANTENNA: - db_set_antenna(tx_dboard, ((op_config_mimo_t *)payload)->flags); + ok = db_set_antenna(tx_dboard, ((op_config_mimo_t *)payload)->flags); goto generic_reply; case OP_BURN_MAC_ADDR: diff --git a/usrp2/firmware/lib/db_xcvr2450.c b/usrp2/firmware/lib/db_xcvr2450.c index a48af9035..4cdcf031e 100644 --- a/usrp2/firmware/lib/db_xcvr2450.c +++ b/usrp2/firmware/lib/db_xcvr2450.c @@ -64,6 +64,8 @@ bool xcvr2450_set_freq(struct db_base *db, u2_fxpt_freq_t freq, u2_fxpt_freq_t * bool xcvr2450_set_gain_rx(struct db_base *db, u2_fxpt_gain_t gain); bool xcvr2450_set_gain_tx(struct db_base *db, u2_fxpt_gain_t gain); bool xcvr2450_set_tx_enable(struct db_base *db, bool on); +bool xcvr2450_set_rx_antenna(struct db_base *db, int ant); +bool xcvr2450_set_tx_antenna(struct db_base *db, int ant); struct db_xcvr2450_common { int d_mimo, d_int_div, d_frac_div, d_highband, d_five_gig; @@ -154,6 +156,7 @@ struct db_xcvr2450_rx db_xcvr2450_rx = { .base.atr_mask = RX_ATR_MASK, .base.atr_txval = 0x0, .base.atr_rxval = 0x0, + .base.set_antenna = xcvr2450_set_rx_antenna, .common = &db_xcvr2450_common, }; @@ -178,6 +181,7 @@ struct db_xcvr2450_tx db_xcvr2450_tx = { .base.atr_mask = TX_ATR_MASK, .base.atr_txval = 0x0, .base.atr_rxval = 0x0, + .base.set_antenna = xcvr2450_set_tx_antenna, .common = &db_xcvr2450_common, }; @@ -494,3 +498,24 @@ xcvr2450_set_tx_enable(struct db_base *dbb, bool on){ set_gpio(db); return true; } + +/************************************************** + * Set Antennas + **************************************************/ +bool xcvr2450_set_rx_antenna(struct db_base *dbb, int ant){ + printf("xcvr set rx ant %d\n", ant); + if (ant > 1) return false; + struct db_xcvr2450_dummy *db = (struct db_xcvr2450_dummy *) dbb; + db->common->d_rx_ant = ant; + set_gpio(db); + return true; +} + +bool xcvr2450_set_tx_antenna(struct db_base *dbb, int ant){ + printf("xcvr set tx ant %d\n", ant); + if (ant > 1) return false; + struct db_xcvr2450_dummy *db = (struct db_xcvr2450_dummy *) dbb; + db->common->d_tx_ant = ant; + set_gpio(db); + return true; +} diff --git a/usrp2/host/lib/usrp2_impl.cc b/usrp2/host/lib/usrp2_impl.cc index 34477b746..d4f29baf0 100644 --- a/usrp2/host/lib/usrp2_impl.cc +++ b/usrp2/host/lib/usrp2_impl.cc @@ -498,7 +498,7 @@ namespace usrp2 { memset(&cmd, 0, sizeof(cmd)); init_etf_hdrs(&cmd.h, d_addr, 0, CONTROL_CHAN, -1); - cmd.op.opcode = OP_TX_ANTENNA; + cmd.op.opcode = OP_RX_ANTENNA; cmd.op.len = sizeof(cmd.op); cmd.op.rid = d_next_rid++; cmd.op.flags = ant; @@ -509,7 +509,7 @@ namespace usrp2 { if (!transmit_cmd_and_wait(&cmd, sizeof(cmd), &p, DEF_CMD_TIMEOUT)) return false; - return true;//ntohx(reply.ok) == 1; + return ntohx(reply.ok) == 1; } bool @@ -929,7 +929,7 @@ namespace usrp2 { memset(&cmd, 0, sizeof(cmd)); init_etf_hdrs(&cmd.h, d_addr, 0, CONTROL_CHAN, -1); - cmd.op.opcode = OP_RX_ANTENNA; + cmd.op.opcode = OP_TX_ANTENNA; cmd.op.len = sizeof(cmd.op); cmd.op.rid = d_next_rid++; cmd.op.flags = ant; @@ -940,7 +940,7 @@ namespace usrp2 { if (!transmit_cmd_and_wait(&cmd, sizeof(cmd), &p, DEF_CMD_TIMEOUT)) return false; - return true;//ntohx(reply.ok) == 1; + return ntohx(reply.ok) == 1; } bool |