From 126444c564d30d65116be5f772bdf47594d62884 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Thu, 10 Jun 2010 10:10:05 -0700 Subject: Moved mux calculations into dsp type1 utils. Fixed error in db basic freq range switcheroo. --- host/lib/usrp/dsp_utils.hpp | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'host/lib/usrp/dsp_utils.hpp') 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 @@ -31,6 +31,41 @@ namespace dsp_type1{ return std::ceil(std::log(num)/std::log(T(2))); } + /*! + * 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. -- cgit v1.2.3