aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/dsp_utils.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'host/lib/usrp/dsp_utils.hpp')
-rw-r--r--host/lib/usrp/dsp_utils.hpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/host/lib/usrp/dsp_utils.hpp b/host/lib/usrp/dsp_utils.hpp
index cfe5375f8..e0ec46184 100644
--- a/host/lib/usrp/dsp_utils.hpp
+++ b/host/lib/usrp/dsp_utils.hpp
@@ -32,6 +32,41 @@ namespace dsp_type1{
}
/*!
+ * Calculate the rx mux word from properties.
+ * \param is_quadrature true if the subdev is complex
+ * \param is_iq_swapped true if the i and q are reversed
+ * \param the 32-bit rx mux control word
+ */
+ static inline boost::uint32_t calc_rx_mux_word(
+ bool is_quadrature,
+ bool is_iq_swapped
+ ){
+ boost::uint32_t rx_mux = 0;
+ if (is_quadrature){
+ rx_mux = (0x01 << 2) | (0x00 << 0); //Q=ADC1, I=ADC0
+ }else{
+ rx_mux = (0x11 << 2) | (0x00 << 0); //Q=ZERO, I=ADC0
+ }
+ if (is_iq_swapped){
+ rx_mux = (rx_mux << 2) | (rx_mux >> 2);
+ }
+ return rx_mux;
+ }
+
+ /*!
+ * Calculate the tx mux word from properties.
+ * \param is_iq_swapped true if the i and q are reversed
+ * \param the 32-bit tx mux control word
+ */
+ static inline boost::uint32_t calc_tx_mux_word(bool is_iq_swapped){
+ boost::uint32_t tx_mux = 0x10;
+ if (is_iq_swapped){
+ tx_mux = (tx_mux << 4) | (tx_mux >> 4);
+ }
+ return tx_mux;
+ }
+
+ /*!
* Calculate the cordic word from the frequency and clock rate.
* The frequency will be set to the actual (possible) frequency.
*