aboutsummaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-07-04 07:21:53 -0700
committerJosh Blum <josh@joshknows.com>2011-07-04 07:21:53 -0700
commit729b284f628f3326d774262570b68540d7de9baa (patch)
tree85bd79634c50fd32423fd4c29f15e18744aff97f /host
parent34265334d18589a377ab42df211eb33054340ae6 (diff)
downloaduhd-729b284f628f3326d774262570b68540d7de9baa.tar.gz
uhd-729b284f628f3326d774262570b68540d7de9baa.tar.bz2
uhd-729b284f628f3326d774262570b68540d7de9baa.zip
usrp: handle frontend swapping if the first subdev is QI or Q
Diffstat (limited to 'host')
-rw-r--r--host/lib/usrp/b100/io_impl.cpp6
-rw-r--r--host/lib/usrp/cores/rx_dsp_core_200.cpp4
-rw-r--r--host/lib/usrp/cores/rx_dsp_core_200.hpp2
-rw-r--r--host/lib/usrp/e100/io_impl.cpp6
-rw-r--r--host/lib/usrp/usrp1/io_impl.cpp4
-rw-r--r--host/lib/usrp/usrp1/soft_time_ctrl.cpp10
-rw-r--r--host/lib/usrp/usrp1/soft_time_ctrl.hpp2
-rw-r--r--host/lib/usrp/usrp2/io_impl.cpp6
8 files changed, 22 insertions, 18 deletions
diff --git a/host/lib/usrp/b100/io_impl.cpp b/host/lib/usrp/b100/io_impl.cpp
index fbf341c7f..d4515bbb5 100644
--- a/host/lib/usrp/b100/io_impl.cpp
+++ b/host/lib/usrp/b100/io_impl.cpp
@@ -144,11 +144,13 @@ void b100_impl::update_rx_subdev_spec(const uhd::usrp::subdev_spec_t &spec){
validate_subdev_spec(_tree, spec, "rx");
//setup mux for this spec
+ bool fe_swapped = false;
for (size_t i = 0; i < spec.size(); i++){
- //ASSUME that we dont swap the rx fe mux...
const std::string conn = _tree->access<std::string>(root / spec[i].db_name / "rx_frontends" / spec[i].sd_name / "connection").get();
- _rx_dsps[i]->set_mux(conn);
+ if (i == 0 and (conn == "QI" or conn == "Q")) fe_swapped = true;
+ _rx_dsps[i]->set_mux(conn, fe_swapped);
}
+ _rx_fe->set_mux(fe_swapped);
//resize for the new occupancy
_io_impl->recv_handler.resize(spec.size());
diff --git a/host/lib/usrp/cores/rx_dsp_core_200.cpp b/host/lib/usrp/cores/rx_dsp_core_200.cpp
index 8fcf4df96..0c065e228 100644
--- a/host/lib/usrp/cores/rx_dsp_core_200.cpp
+++ b/host/lib/usrp/cores/rx_dsp_core_200.cpp
@@ -108,14 +108,14 @@ public:
_iface->poke32(REG_RX_CTRL_TIME_TICKS, stream_cmd.time_spec.get_tick_count(_tick_rate)); //latches the command
}
- void set_mux(const std::string &mode){
+ void set_mux(const std::string &mode, const bool fe_swapped){
static const uhd::dict<std::string, boost::uint32_t> mode_to_mux = boost::assign::map_list_of
("IQ", 0)
("QI", FLAG_DSP_RX_MUX_SWAP_IQ)
("I", FLAG_DSP_RX_MUX_REAL_MODE)
("Q", FLAG_DSP_RX_MUX_SWAP_IQ | FLAG_DSP_RX_MUX_REAL_MODE)
;
- _iface->poke32(REG_DSP_RX_MUX, mode_to_mux[mode]);
+ _iface->poke32(REG_DSP_RX_MUX, mode_to_mux[mode] ^ (fe_swapped? FLAG_DSP_RX_MUX_SWAP_IQ : 0));
}
void set_tick_rate(const double rate){
diff --git a/host/lib/usrp/cores/rx_dsp_core_200.hpp b/host/lib/usrp/cores/rx_dsp_core_200.hpp
index e0b6e18e4..72ed07230 100644
--- a/host/lib/usrp/cores/rx_dsp_core_200.hpp
+++ b/host/lib/usrp/cores/rx_dsp_core_200.hpp
@@ -40,7 +40,7 @@ public:
virtual void issue_stream_command(const uhd::stream_cmd_t &stream_cmd) = 0;
- virtual void set_mux(const std::string &mode) = 0;
+ virtual void set_mux(const std::string &mode, const bool fe_swapped = false) = 0;
virtual void set_tick_rate(const double rate) = 0;
diff --git a/host/lib/usrp/e100/io_impl.cpp b/host/lib/usrp/e100/io_impl.cpp
index 6e1bc3245..9f7dc9921 100644
--- a/host/lib/usrp/e100/io_impl.cpp
+++ b/host/lib/usrp/e100/io_impl.cpp
@@ -232,11 +232,13 @@ void e100_impl::update_rx_subdev_spec(const uhd::usrp::subdev_spec_t &spec){
validate_subdev_spec(_tree, spec, "rx");
//setup mux for this spec
+ bool fe_swapped = false;
for (size_t i = 0; i < spec.size(); i++){
- //ASSUME that we dont swap the rx fe mux...
const std::string conn = _tree->access<std::string>(root / spec[i].db_name / "rx_frontends" / spec[i].sd_name / "connection").get();
- _rx_dsps[i]->set_mux(conn);
+ if (i == 0 and (conn == "QI" or conn == "Q")) fe_swapped = true;
+ _rx_dsps[i]->set_mux(conn, fe_swapped);
}
+ _rx_fe->set_mux(fe_swapped);
//resize for the new occupancy
_io_impl->recv_handler.resize(spec.size());
diff --git a/host/lib/usrp/usrp1/io_impl.cpp b/host/lib/usrp/usrp1/io_impl.cpp
index 461529ae2..bf34fde4f 100644
--- a/host/lib/usrp/usrp1/io_impl.cpp
+++ b/host/lib/usrp/usrp1/io_impl.cpp
@@ -511,7 +511,5 @@ size_t usrp1_impl::recv(
recv_mode, timeout
);
- _soft_time_ctrl->recv_post(metadata, num_samps_recvd);
-
- return num_samps_recvd;
+ return _soft_time_ctrl->recv_post(metadata, num_samps_recvd);
}
diff --git a/host/lib/usrp/usrp1/soft_time_ctrl.cpp b/host/lib/usrp/usrp1/soft_time_ctrl.cpp
index 2728ff755..ac0899e28 100644
--- a/host/lib/usrp/usrp1/soft_time_ctrl.cpp
+++ b/host/lib/usrp/usrp1/soft_time_ctrl.cpp
@@ -90,13 +90,13 @@ public:
/*******************************************************************
* Receive control
******************************************************************/
- void recv_post(rx_metadata_t &md, size_t &nsamps){
+ size_t recv_post(rx_metadata_t &md, const size_t nsamps){
boost::mutex::scoped_lock lock(_update_mutex);
//Since it timed out on the receive, check for inline messages...
//Must do a post check because recv() will not wake up for a message.
if (md.error_code == rx_metadata_t::ERROR_CODE_TIMEOUT){
- if (_inline_msg_queue.pop_with_haste(md)) return;
+ if (_inline_msg_queue.pop_with_haste(md)) return 0;
}
//load the metadata with the expected time
@@ -104,7 +104,7 @@ public:
md.time_spec = time_now();
//none of the stuff below matters in continuous streaming mode
- if (_stream_mode == stream_cmd_t::STREAM_MODE_START_CONTINUOUS) return;
+ if (_stream_mode == stream_cmd_t::STREAM_MODE_START_CONTINUOUS) return nsamps;
//When to stop streaming:
//The samples have been received and the stream mode is non-continuous.
@@ -118,15 +118,15 @@ public:
_inline_msg_queue.push_with_pop_on_full(metadata);
} //continue to next case...
case stream_cmd_t::STREAM_MODE_NUM_SAMPS_AND_DONE:
- nsamps = _nsamps_remaining; //set nsamps, then stop
md.end_of_burst = true;
this->issue_stream_cmd(stream_cmd_t::STREAM_MODE_STOP_CONTINUOUS);
- return;
+ return _nsamps_remaining;
default: break;
}
//update the consumed samples
_nsamps_remaining -= nsamps;
+ return nsamps;
}
void issue_stream_cmd(const stream_cmd_t &cmd){
diff --git a/host/lib/usrp/usrp1/soft_time_ctrl.hpp b/host/lib/usrp/usrp1/soft_time_ctrl.hpp
index b2bf6c6f9..e91aaf6a2 100644
--- a/host/lib/usrp/usrp1/soft_time_ctrl.hpp
+++ b/host/lib/usrp/usrp1/soft_time_ctrl.hpp
@@ -54,7 +54,7 @@ public:
virtual time_spec_t get_time(void) = 0;
//! Call after the internal recv function
- virtual void recv_post(rx_metadata_t &md, size_t &nsamps) = 0;
+ virtual size_t recv_post(rx_metadata_t &md, const size_t nsamps) = 0;
//! Call before the internal send function
virtual bool send_pre(const tx_metadata_t &md, double &timeout) = 0;
diff --git a/host/lib/usrp/usrp2/io_impl.cpp b/host/lib/usrp/usrp2/io_impl.cpp
index ed9a6320e..eda2267bc 100644
--- a/host/lib/usrp/usrp2/io_impl.cpp
+++ b/host/lib/usrp/usrp2/io_impl.cpp
@@ -331,11 +331,13 @@ subdev_spec_t usrp2_impl::update_rx_subdev_spec(const std::string &which_mb, con
validate_subdev_spec(_tree, spec, "rx", which_mb);
//setup mux for this spec
+ bool fe_swapped = false;
for (size_t i = 0; i < spec.size(); i++){
- //ASSUME that we dont swap the rx fe mux...
const std::string conn = _tree->access<std::string>(root / spec[i].db_name / "rx_frontends" / spec[i].sd_name / "connection").get();
- _mbc[which_mb].rx_dsps[i]->set_mux(conn);
+ if (i == 0 and (conn == "QI" or conn == "Q")) fe_swapped = true;
+ _mbc[which_mb].rx_dsps[i]->set_mux(conn, fe_swapped);
}
+ _mbc[which_mb].rx_fe->set_mux(fe_swapped);
//compute the new occupancy and resize
_mbc[which_mb].rx_chan_occ = spec.size();