summaryrefslogtreecommitdiff
path: root/usrp2/host/lib
diff options
context:
space:
mode:
Diffstat (limited to 'usrp2/host/lib')
-rw-r--r--usrp2/host/lib/usrp2.cc10
-rw-r--r--usrp2/host/lib/usrp2_impl.cc42
-rw-r--r--usrp2/host/lib/usrp2_impl.h2
3 files changed, 54 insertions, 0 deletions
diff --git a/usrp2/host/lib/usrp2.cc b/usrp2/host/lib/usrp2.cc
index 801a436a3..f0ee564be 100644
--- a/usrp2/host/lib/usrp2.cc
+++ b/usrp2/host/lib/usrp2.cc
@@ -170,6 +170,11 @@ namespace usrp2 {
// Receive
bool
+ usrp2::set_rx_antenna(int ant){
+ return d_impl->set_rx_antenna(ant);
+ }
+
+ bool
usrp2::set_rx_gain(double gain)
{
return d_impl->set_rx_gain(gain);
@@ -280,6 +285,11 @@ namespace usrp2 {
// Transmit
bool
+ usrp2::set_tx_antenna(int ant){
+ return d_impl->set_tx_antenna(ant);
+ }
+
+ bool
usrp2::set_tx_gain(double gain)
{
return d_impl->set_tx_gain(gain);
diff --git a/usrp2/host/lib/usrp2_impl.cc b/usrp2/host/lib/usrp2_impl.cc
index b19c6ecf1..34477b746 100644
--- a/usrp2/host/lib/usrp2_impl.cc
+++ b/usrp2/host/lib/usrp2_impl.cc
@@ -492,6 +492,27 @@ namespace usrp2 {
// ----------------------------------------------------------------
bool
+ usrp2::impl::set_rx_antenna(int ant){
+ op_config_mimo_cmd cmd;
+ op_generic_t reply;
+
+ memset(&cmd, 0, sizeof(cmd));
+ init_etf_hdrs(&cmd.h, d_addr, 0, CONTROL_CHAN, -1);
+ cmd.op.opcode = OP_TX_ANTENNA;
+ cmd.op.len = sizeof(cmd.op);
+ cmd.op.rid = d_next_rid++;
+ cmd.op.flags = ant;
+ cmd.eop.opcode = OP_EOP;
+ cmd.eop.len = sizeof(cmd.eop);
+
+ pending_reply p(cmd.op.rid, &reply, sizeof(reply));
+ if (!transmit_cmd_and_wait(&cmd, sizeof(cmd), &p, DEF_CMD_TIMEOUT))
+ return false;
+
+ return true;//ntohx(reply.ok) == 1;
+ }
+
+ bool
usrp2::impl::set_rx_gain(double gain)
{
op_config_rx_v2_cmd cmd;
@@ -902,6 +923,27 @@ namespace usrp2 {
// ----------------------------------------------------------------
bool
+ usrp2::impl::set_tx_antenna(int ant){
+ op_config_mimo_cmd cmd;
+ op_generic_t reply;
+
+ memset(&cmd, 0, sizeof(cmd));
+ init_etf_hdrs(&cmd.h, d_addr, 0, CONTROL_CHAN, -1);
+ cmd.op.opcode = OP_RX_ANTENNA;
+ cmd.op.len = sizeof(cmd.op);
+ cmd.op.rid = d_next_rid++;
+ cmd.op.flags = ant;
+ cmd.eop.opcode = OP_EOP;
+ cmd.eop.len = sizeof(cmd.eop);
+
+ pending_reply p(cmd.op.rid, &reply, sizeof(reply));
+ if (!transmit_cmd_and_wait(&cmd, sizeof(cmd), &p, DEF_CMD_TIMEOUT))
+ return false;
+
+ return true;//ntohx(reply.ok) == 1;
+ }
+
+ bool
usrp2::impl::set_tx_gain(double gain)
{
op_config_tx_v2_cmd cmd;
diff --git a/usrp2/host/lib/usrp2_impl.h b/usrp2/host/lib/usrp2_impl.h
index d78a00db4..a75947922 100644
--- a/usrp2/host/lib/usrp2_impl.h
+++ b/usrp2/host/lib/usrp2_impl.h
@@ -126,6 +126,7 @@ namespace usrp2 {
// Rx
+ bool set_rx_antenna(int ant);
bool set_rx_gain(double gain);
double rx_gain_min() { return d_rx_db_info.gain_min; }
double rx_gain_max() { return d_rx_db_info.gain_max; }
@@ -153,6 +154,7 @@ namespace usrp2 {
// Tx
+ bool set_tx_antenna(int ant);
bool set_tx_gain(double gain);
double tx_gain_min() { return d_tx_db_info.gain_min; }
double tx_gain_max() { return d_tx_db_info.gain_max; }