aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_gain.cpp
diff options
context:
space:
mode:
authorBrent Stapleton <brent.stapleton@ettus.com>2019-01-14 10:35:25 -0800
committerBrent Stapleton <brent.stapleton@ettus.com>2019-01-16 11:40:23 -0800
commit967be2a4e82b1a125b26bb72a60318a4fb2b50c4 (patch)
tree8a24954b54d1546dc8049a17e485adb0a605f74f /host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_gain.cpp
parentaafe4e8b742a0e21d3818f21f34e3c8613132530 (diff)
downloaduhd-967be2a4e82b1a125b26bb72a60318a4fb2b50c4.tar.gz
uhd-967be2a4e82b1a125b26bb72a60318a4fb2b50c4.tar.bz2
uhd-967be2a4e82b1a125b26bb72a60318a4fb2b50c4.zip
uhd: mpm: apply clang-format to all files
Applying formatting changes to all .cpp and .hpp files in the following directories: ``` find host/examples/ -iname *.hpp -o -iname *.cpp | \ xargs clang-format -i -style=file find host/tests/ -iname *.hpp -o -iname *.cpp | \ xargs clang-format -i -style=file find host/lib/usrp/dboard/neon/ -iname *.hpp -o -iname *.cpp | \ xargs clang-format -i -style=file find host/lib/usrp/dboard/magnesium/ -iname *.hpp -o -iname *.cpp | \ xargs clang-format -i -style=file find host/lib/usrp/device3/ -iname *.hpp -o -iname *.cpp | \ xargs clang-format -i -style=file find host/lib/usrp/mpmd/ -iname *.hpp -o -iname *.cpp | \ xargs clang-format -i -style=file find host/lib/usrp/x300/ -iname *.hpp -o -iname *.cpp | \ xargs clang-format -i -style=file find host/utils/ -iname *.hpp -o -iname *.cpp | \ xargs clang-format -i -style=file find mpm/ -iname *.hpp -o -iname *.cpp | \ xargs clang-format -i -style=file ``` Also formatted host/include/, except Cpp03 was used as a the language standard instead of Cpp11. ``` sed -i 's/ Cpp11/ Cpp03/g' .clang-format find host/include/ -iname *.hpp -o -iname *.cpp | \ xargs clang-format -i -style=file ``` Formatting style was designated by the .clang-format file.
Diffstat (limited to 'host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_gain.cpp')
-rw-r--r--host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_gain.cpp119
1 files changed, 55 insertions, 64 deletions
diff --git a/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_gain.cpp b/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_gain.cpp
index e58e1706e..1370fde3a 100644
--- a/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_gain.cpp
+++ b/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_gain.cpp
@@ -4,9 +4,9 @@
// SPDX-License-Identifier: GPL-3.0-or-later
//
-#include "magnesium_radio_ctrl_impl.hpp"
-#include "magnesium_gain_table.hpp"
#include "magnesium_constants.hpp"
+#include "magnesium_gain_table.hpp"
+#include "magnesium_radio_ctrl_impl.hpp"
#include <uhd/utils/log.hpp>
using namespace uhd;
@@ -15,72 +15,69 @@ using namespace uhd::rfnoc;
using namespace magnesium;
double magnesium_radio_ctrl_impl::_set_all_gain(
- const double gain,
- const double freq,
- const size_t chan,
- const direction_t dir
-) {
+ const double gain, const double freq, const size_t chan, const direction_t dir)
+{
UHD_LOG_TRACE(unique_id(),
- __func__ << "(gain=" << gain << "dB, "
- "freq=" << freq << " Hz, "
- "chan=" << chan << ", "
- "dir=" << dir);
+ __func__ << "(gain=" << gain
+ << "dB, "
+ "freq="
+ << freq
+ << " Hz, "
+ "chan="
+ << chan
+ << ", "
+ "dir="
+ << dir);
const size_t ad9371_chan = chan;
- auto chan_sel = static_cast<magnesium_cpld_ctrl::chan_sel_t>(chan);
- gain_tuple_t gain_tuple = (dir == RX_DIRECTION) ?
- get_rx_gain_tuple(gain, _map_freq_to_rx_band(freq)):
- get_tx_gain_tuple(gain, _map_freq_to_tx_band(freq));
+ auto chan_sel = static_cast<magnesium_cpld_ctrl::chan_sel_t>(chan);
+ gain_tuple_t gain_tuple = (dir == RX_DIRECTION)
+ ? get_rx_gain_tuple(gain, _map_freq_to_rx_band(freq))
+ : get_tx_gain_tuple(gain, _map_freq_to_tx_band(freq));
- if (_gain_profile[dir] == "manual"){
+ if (_gain_profile[dir] == "manual") {
UHD_LOG_TRACE(unique_id(), "Manual gain mode. Getting gain from property tree.");
- gain_tuple = {
- DSA_MAX_GAIN - _dsa_att[dir],
- ((dir == RX_DIRECTION) ? AD9371_MAX_RX_GAIN : AD9371_MAX_TX_GAIN) - _ad9371_att[dir],
+ gain_tuple = {DSA_MAX_GAIN - _dsa_att[dir],
+ ((dir == RX_DIRECTION) ? AD9371_MAX_RX_GAIN : AD9371_MAX_TX_GAIN)
+ - _ad9371_att[dir],
_amp_bypass[dir]};
- }else if (_gain_profile[dir] == "default"){
+ } else if (_gain_profile[dir] == "default") {
UHD_LOG_TRACE(unique_id(), "Getting gain from gain table.");
- }else {
- UHD_LOG_ERROR(unique_id(), "Unsupported gain mode: " << _gain_profile[dir])
+ } else {
+ UHD_LOG_ERROR(unique_id(), "Unsupported gain mode: " << _gain_profile[dir])
}
const double ad9371_gain =
- ((dir == RX_DIRECTION) ? AD9371_MAX_RX_GAIN : AD9371_MAX_TX_GAIN)
+ ((dir == RX_DIRECTION) ? AD9371_MAX_RX_GAIN : AD9371_MAX_TX_GAIN)
- gain_tuple.ad9371_att;
UHD_LOG_TRACE(unique_id(),
- "AD9371 attenuation==" << gain_tuple.ad9371_att << " dB, "
- "AD9371 gain==" << ad9371_gain << " dB, "
- "DSA attenuation == " << gain_tuple.dsa_att << " dB."
- );
+ "AD9371 attenuation==" << gain_tuple.ad9371_att
+ << " dB, "
+ "AD9371 gain=="
+ << ad9371_gain
+ << " dB, "
+ "DSA attenuation == "
+ << gain_tuple.dsa_att << " dB.");
_ad9371->set_gain(ad9371_gain, ad9371_chan, dir);
_dsa_set_att(gain_tuple.dsa_att, chan, dir);
if (dir == RX_DIRECTION or dir == DX_DIRECTION) {
- _all_rx_gain = gain;
+ _all_rx_gain = gain;
_rx_bypass_lnas = gain_tuple.bypass;
- _update_rx_freq_switches(
- this->get_rx_frequency(chan),
- _rx_bypass_lnas,
- chan_sel
- );
+ _update_rx_freq_switches(this->get_rx_frequency(chan), _rx_bypass_lnas, chan_sel);
}
if (dir == TX_DIRECTION or dir == DX_DIRECTION) {
- _all_tx_gain = gain;
+ _all_tx_gain = gain;
_tx_bypass_amp = gain_tuple.bypass;
- _update_tx_freq_switches(
- this->get_tx_frequency(chan),
- _tx_bypass_amp,
- chan_sel
- );
+ _update_tx_freq_switches(this->get_tx_frequency(chan), _tx_bypass_amp, chan_sel);
}
return gain;
}
double magnesium_radio_ctrl_impl::_get_all_gain(
- const size_t /* chan */,
- const direction_t dir
-) {
+ const size_t /* chan */, const direction_t dir)
+{
UHD_LOG_TRACE(unique_id(), "Getting all gain ");
if (dir == RX_DIRECTION) {
- return _all_rx_gain;
+ return _all_rx_gain;
}
return _all_tx_gain;
}
@@ -89,14 +86,12 @@ double magnesium_radio_ctrl_impl::_get_all_gain(
* DSA Controls
*****************************************************************************/
double magnesium_radio_ctrl_impl::_dsa_set_att(
- const double att,
- const size_t chan,
- const direction_t dir
-) {
+ const double att, const size_t chan, const direction_t dir)
+{
UHD_LOG_TRACE(unique_id(),
- __func__ <<
- "(att=" << "att dB, chan=" << chan << ", dir=" << dir << ")")
- const uint32_t dsa_val = 2*att;
+ __func__ << "(att="
+ << "att dB, chan=" << chan << ", dir=" << dir << ")")
+ const uint32_t dsa_val = 2 * att;
_set_dsa_val(chan, dir, dsa_val);
if (dir == RX_DIRECTION or dir == DX_DIRECTION) {
@@ -109,33 +104,29 @@ double magnesium_radio_ctrl_impl::_dsa_set_att(
}
double magnesium_radio_ctrl_impl::_dsa_get_att(
- const size_t /*chan*/,
- const direction_t dir
-) {
+ const size_t /*chan*/, const direction_t dir)
+{
if (dir == RX_DIRECTION) {
- return _dsa_rx_att;
+ return _dsa_rx_att;
}
return _dsa_tx_att;
}
void magnesium_radio_ctrl_impl::_set_dsa_val(
- const size_t chan,
- const direction_t dir,
- const uint32_t dsa_val
-) {
+ const size_t chan, const direction_t dir, const uint32_t dsa_val)
+{
// The DSA register holds 12 bits. The lower 6 bits are for RX, the upper
// 6 bits are for TX.
- if (dir == RX_DIRECTION or dir == DX_DIRECTION){
+ if (dir == RX_DIRECTION or dir == DX_DIRECTION) {
UHD_LOG_TRACE(unique_id(),
__func__ << "(chan=" << chan << ", dir=RX"
- << ", dsa_val=" << dsa_val << ")")
+ << ", dsa_val=" << dsa_val << ")")
_gpio[chan]->set_gpio_out(dsa_val, 0x003F);
}
- if (dir == TX_DIRECTION or dir == DX_DIRECTION){
+ if (dir == TX_DIRECTION or dir == DX_DIRECTION) {
UHD_LOG_TRACE(unique_id(),
__func__ << "(chan=" << chan << ", dir=TX"
- << ", dsa_val=" << dsa_val << ")")
- _gpio[chan]->set_gpio_out(dsa_val<<6, 0x0FC0);
+ << ", dsa_val=" << dsa_val << ")")
+ _gpio[chan]->set_gpio_out(dsa_val << 6, 0x0FC0);
}
}
-