aboutsummaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2017-11-03 16:29:22 -0700
committerMartin Braun <martin.braun@ettus.com>2017-12-22 15:05:05 -0800
commitf700f5a43afa8840262fadf15c4d6fd2648b298b (patch)
tree1cef654c8c6080b37b1057fbd9960a2f31db53a3 /host
parent70b0cc263cae1fa71848e72db5eafe1cb4fac967 (diff)
downloaduhd-f700f5a43afa8840262fadf15c4d6fd2648b298b.tar.gz
uhd-f700f5a43afa8840262fadf15c4d6fd2648b298b.tar.bz2
uhd-f700f5a43afa8840262fadf15c4d6fd2648b298b.zip
mg: Add defer_commit argument to CPLD controls
This will set you call setters on the CPLD control object without immediately triggering a SPI transaction.
Diffstat (limited to 'host')
-rw-r--r--host/lib/usrp/dboard/magnesium/magnesium_cpld_ctrl.cpp33
-rw-r--r--host/lib/usrp/dboard/magnesium/magnesium_cpld_ctrl.hpp14
2 files changed, 32 insertions, 15 deletions
diff --git a/host/lib/usrp/dboard/magnesium/magnesium_cpld_ctrl.cpp b/host/lib/usrp/dboard/magnesium/magnesium_cpld_ctrl.cpp
index 18402e764..66fa02360 100644
--- a/host/lib/usrp/dboard/magnesium/magnesium_cpld_ctrl.cpp
+++ b/host/lib/usrp/dboard/magnesium/magnesium_cpld_ctrl.cpp
@@ -22,7 +22,7 @@ magnesium_cpld_ctrl::magnesium_cpld_ctrl(
{
_write_fn = [write_fn](const uint8_t addr, const uint32_t data){
UHD_LOG_TRACE("MG_CPLD",
- str(boost::format("Writing to CPLD: 0x%X -> 0x%4X")
+ str(boost::format("Writing to CPLD: 0x%02X -> 0x%04X")
% uint32_t(addr) % data));
const uint32_t spi_transaction = 0
| ((addr & 0x7F) << 16)
@@ -31,9 +31,8 @@ magnesium_cpld_ctrl::magnesium_cpld_ctrl(
write_fn(spi_transaction);
};
_read_fn = [read_fn](const uint8_t addr){
- UHD_LOG_TRACE("MG_CPLD", "Reading from addr " << addr);
UHD_LOG_TRACE("MG_CPLD",
- str(boost::format("Reading from CPLD address 0x%X")
+ str(boost::format("Reading from CPLD address 0x%02X")
% uint32_t(addr)));
const uint32_t spi_transaction = (1<<23)
| ((addr & 0x7F) << 16)
@@ -88,7 +87,8 @@ void magnesium_cpld_ctrl::set_tx_switches(
const tx_sw3_t tx_sw3,
const lowband_mixer_path_sel_t select_lowband_mixer_path,
const bool enb_lowband_mixer,
- const atr_state_t atr_state
+ const atr_state_t atr_state,
+ const bool defer_commit
) {
std::lock_guard<std::mutex> l(_set_mutex);
if (chan == CHAN1 or chan == BOTH) {
@@ -128,7 +128,9 @@ void magnesium_cpld_ctrl::set_tx_switches(
}
}
- commit();
+ if (not defer_commit) {
+ commit();
+ }
}
void magnesium_cpld_ctrl::set_rx_switches(
@@ -140,7 +142,8 @@ void magnesium_cpld_ctrl::set_rx_switches(
const rx_sw6_t rx_sw6,
const lowband_mixer_path_sel_t select_lowband_mixer_path,
const bool enb_lowband_mixer,
- const atr_state_t atr_state
+ const atr_state_t atr_state,
+ const bool defer_commit
) {
std::lock_guard<std::mutex> l(_set_mutex);
if (chan == CHAN1 or chan == BOTH) {
@@ -184,7 +187,9 @@ void magnesium_cpld_ctrl::set_rx_switches(
_regs.ch2_on_rx_mixer_en = enb_lowband_mixer;
}
}
- commit();
+ if (not defer_commit) {
+ commit();
+ }
}
void magnesium_cpld_ctrl::set_tx_atr_bits(
@@ -194,7 +199,8 @@ void magnesium_cpld_ctrl::set_tx_atr_bits(
const sw_trx_t trx_sw,
const bool tx_pa_enb,
const bool tx_amp_enb,
- const bool tx_myk_en
+ const bool tx_myk_en,
+ const bool defer_commit
) {
std::lock_guard<std::mutex> l(_set_mutex);
if (chan == CHAN1 or chan == BOTH) {
@@ -229,7 +235,9 @@ void magnesium_cpld_ctrl::set_tx_atr_bits(
_regs.ch2_on_tx_myk_en = tx_myk_en;
}
}
- commit();
+ if (not defer_commit) {
+ commit();
+ }
}
void magnesium_cpld_ctrl::set_rx_atr_bits(
@@ -241,7 +249,8 @@ void magnesium_cpld_ctrl::set_rx_atr_bits(
const bool rx_lna1_enb,
const bool rx_lna2_enb,
const bool rx_amp_enb,
- const bool rx_myk_en
+ const bool rx_myk_en,
+ const bool defer_commit
) {
std::lock_guard<std::mutex> l(_set_mutex);
if (chan == CHAN1 or chan == BOTH) {
@@ -285,7 +294,9 @@ void magnesium_cpld_ctrl::set_rx_atr_bits(
}
}
- commit();
+ if (not defer_commit) {
+ commit();
+ }
}
diff --git a/host/lib/usrp/dboard/magnesium/magnesium_cpld_ctrl.hpp b/host/lib/usrp/dboard/magnesium/magnesium_cpld_ctrl.hpp
index d9000401e..ad369df99 100644
--- a/host/lib/usrp/dboard/magnesium/magnesium_cpld_ctrl.hpp
+++ b/host/lib/usrp/dboard/magnesium/magnesium_cpld_ctrl.hpp
@@ -179,7 +179,8 @@ public:
const tx_sw3_t tx_sw3,
const lowband_mixer_path_sel_t select_lowband_mixer_path,
const bool enb_lowband_mixer,
- const atr_state_t atr_state = ANY
+ const atr_state_t atr_state = ANY,
+ const bool defer_commit = false
);
/*! Frequency-related settings, receive side
@@ -207,7 +208,8 @@ public:
const rx_sw6_t rx_sw6,
const lowband_mixer_path_sel_t select_lowband_mixer_path,
const bool enb_lowband_mixer,
- const atr_state_t atr_state = ANY
+ const atr_state_t atr_state = ANY,
+ const bool defer_commit = false
);
/*! ATR settings: LEDs, PAs, LNAs, ... for TX side
@@ -232,7 +234,8 @@ public:
const sw_trx_t trx_sw,
const bool tx_pa_enb,
const bool tx_amp_enb,
- const bool tx_myk_enb
+ const bool tx_myk_enb,
+ const bool defer_commit = false
);
/*! ATR settings: LEDs, PAs, LNAs, ... for RX side
@@ -250,7 +253,9 @@ public:
* \param rx2_led State of the RX LED for this ATR state (on or off). This
* is the LED on the RX2 port.
* \param rx_lna1_enb State of RX LNA 1 for this ATR state (on or off).
+ * This is the high-band LNA.
* \param rx_lna2_enb State of RX LNA 2 for this ATR state (on or off).
+ * This is the low-band LNA.
* \param rx_amp_enb State of RX amp for this ATR state (on or off).
* \param rx_myk_enb State of the AD9371 RX enable pin for this ATR state
*/
@@ -263,7 +268,8 @@ public:
const bool rx_lna1_enb,
const bool rx_lna2_enb,
const bool rx_amp_enb,
- const bool rx_myk_en
+ const bool rx_myk_en,
+ const bool defer_commit = false
);
private: