aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVidush <vidush.vishwanath@ettus.com>2018-04-20 15:56:17 -0700
committerMartin Braun <martin.braun@ettus.com>2018-04-30 16:09:16 -0700
commit8922095b2c3a8dd1c764d7b80d3128c44721597b (patch)
treee09e20a233fe35c54fffd8cdadcd0cf47796166e
parent02493f86ad1cecf389dd5abfd97488027b2b9ab0 (diff)
downloaduhd-8922095b2c3a8dd1c764d7b80d3128c44721597b.tar.gz
uhd-8922095b2c3a8dd1c764d7b80d3128c44721597b.tar.bz2
uhd-8922095b2c3a8dd1c764d7b80d3128c44721597b.zip
lib: Change check_radio_config() to iterate over channels, not radios.
-rw-r--r--host/lib/include/uhdlib/rfnoc/radio_ctrl_impl.hpp13
-rw-r--r--host/lib/usrp/x300/x300_radio_ctrl_impl.cpp4
2 files changed, 10 insertions, 7 deletions
diff --git a/host/lib/include/uhdlib/rfnoc/radio_ctrl_impl.hpp b/host/lib/include/uhdlib/rfnoc/radio_ctrl_impl.hpp
index 62a268335..3858b6d84 100644
--- a/host/lib/include/uhdlib/rfnoc/radio_ctrl_impl.hpp
+++ b/host/lib/include/uhdlib/rfnoc/radio_ctrl_impl.hpp
@@ -194,11 +194,12 @@ protected: // TODO see what's protected and what's private
inline bool _is_streamer_active(uhd::direction_t dir, const size_t chan) const {
switch (dir) {
case uhd::TX_DIRECTION:
- return _tx_streamer_active.at(chan);
+ return chan < _tx_streamer_active.size() ? _tx_streamer_active.at(chan) : false;
case uhd::RX_DIRECTION:
- return _rx_streamer_active.at(chan);
+ return chan < _rx_streamer_active.size() ? _rx_streamer_active.at(chan) : false;
case uhd::DX_DIRECTION:
- return _rx_streamer_active.at(chan) and _tx_streamer_active.at(chan);
+ return (chan < _rx_streamer_active.size() and chan < _tx_streamer_active.size()) ?
+ _rx_streamer_active.at(chan) and _tx_streamer_active.at(chan) : false;
default:
return false;
}
@@ -211,6 +212,9 @@ protected: // TODO see what's protected and what's private
std::mutex _mutex;
+ size_t _num_tx_channels;
+ size_t _num_rx_channels;
+
private:
/************************************************************************
* Peripherals
@@ -222,8 +226,7 @@ private:
};
std::map<size_t, radio_perifs_t> _perifs;
- size_t _num_tx_channels;
- size_t _num_rx_channels;
+
// Cached values
double _tick_rate;
diff --git a/host/lib/usrp/x300/x300_radio_ctrl_impl.cpp b/host/lib/usrp/x300/x300_radio_ctrl_impl.cpp
index 524480dc6..6208de231 100644
--- a/host/lib/usrp/x300/x300_radio_ctrl_impl.cpp
+++ b/host/lib/usrp/x300/x300_radio_ctrl_impl.cpp
@@ -1227,7 +1227,7 @@ bool x300_radio_ctrl_impl::check_radio_config()
{
UHD_RFNOC_BLOCK_TRACE() << "x300_radio_ctrl_impl::check_radio_config() " ;
const fs_path rx_fe_path = fs_path("dboards" / _radio_slot / "rx_frontends");
- for (size_t chan = 0; chan < _get_num_radios(); chan++) {
+ for (size_t chan = 0; chan < _num_rx_channels; chan++) {
if (_tree->exists(rx_fe_path / _rx_fe_map.at(chan).db_fe_name / "enabled")) {
const bool chan_active = _is_streamer_active(uhd::RX_DIRECTION, chan);
if (chan_active) {
@@ -1239,7 +1239,7 @@ bool x300_radio_ctrl_impl::check_radio_config()
}
const fs_path tx_fe_path = fs_path("dboards" / _radio_slot / "tx_frontends");
- for (size_t chan = 0; chan < _get_num_radios(); chan++) {
+ for (size_t chan = 0; chan < _num_tx_channels; chan++) {
if (_tree->exists(tx_fe_path / _tx_fe_map.at(chan).db_fe_name / "enabled")) {
const bool chan_active = _is_streamer_active(uhd::TX_DIRECTION, chan);
if (chan_active) {