added rx_decim and tx_interp accessors
authoreb <eb@221aa14e-8319-0410-a670-987f0aec2ac5>
Wed, 22 Oct 2008 16:18:41 +0000 (16:18 +0000)
committereb <eb@221aa14e-8319-0410-a670-987f0aec2ac5>
Wed, 22 Oct 2008 16:18:41 +0000 (16:18 +0000)
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@9819 221aa14e-8319-0410-a670-987f0aec2ac5

usrp2/host/include/usrp2/usrp2.h
usrp2/host/lib/usrp2_impl.cc
usrp2/host/lib/usrp2_impl.h

index 9a1b8b549dbed3302e368b8734b28ef57b1d2c00..9fc16879110d6099f14977f5738fb82f394a2175 100644 (file)
@@ -132,6 +132,9 @@ namespace usrp2 {
      */
     bool set_rx_decim(int decimation_factor);
 
+    //! Return current decimation factor
+    int rx_decim();
+
     /*!
      * Set receiver IQ magnitude scaling
      */
@@ -214,6 +217,9 @@ namespace usrp2 {
      */
     bool set_tx_interp(int interpolation_factor);
 
+    //! Return current interpolation factor
+    int tx_interp();
+
     /*!
      * Set transmit IQ magnitude scaling
      */
index 5fd671085cb6c55717ad687b1906d98e2aec2438..956f2561eef00562dff22aa74a2e7a92ac79c2bb 100644 (file)
@@ -130,7 +130,7 @@ namespace usrp2 {
       d_rx_seqno(-1), d_tx_seqno(0), d_next_rid(0),
       d_num_rx_frames(0), d_num_rx_missing(0), d_num_rx_overruns(0), d_num_rx_bytes(0), 
       d_num_enqueued(0), d_enqueued_mutex(), d_bg_pending_cond(&d_enqueued_mutex),
-      d_channel_rings(NCHANS)
+      d_channel_rings(NCHANS), d_tx_interp(0), d_rx_decim(0)
   {
     if (!d_eth_buf->open(ifc, htons(U2_ETHERTYPE)))
       throw std::runtime_error("Unable to register USRP2 protocol");
@@ -179,6 +179,13 @@ namespace usrp2 {
     if (!set_rx_gain((rx_gain_min() + rx_gain_max()) / 2))
       std::cerr << "usrp2::ctor set_rx_gain failed\n";
 
+    // default interp and decim
+    if (!set_tx_interp(12))
+      std::cerr << "usrp2::ctor set_tx_interp failed\n";
+
+    if (!set_rx_decim(12))
+      std::cerr << "usrp2::ctor set_rx_decim failed\n";
+      
     // set workable defaults for scaling
     if (!set_rx_scale_iq(DEFAULT_RX_SCALE, DEFAULT_RX_SCALE))
       std::cerr << "usrp2::ctor set_rx_scale_iq failed\n";
@@ -524,6 +531,8 @@ namespace usrp2 {
       return false;
 
     bool success = (ntohx(reply.ok) == 1);
+    if (success)
+      d_rx_decim = decimation_factor;
     return success;
   }
   
@@ -761,6 +770,8 @@ namespace usrp2 {
       return false;
 
     bool success = (ntohx(reply.ok) == 1);
+    if (success)
+      d_tx_interp = interpolation_factor;
     return success;
   }
   
index a134c9ec1457912521b1eb84d14495c4f7b233b5..f513cf9d38f40b0fa9dedbfc51b2395ebc05afa2 100644 (file)
@@ -80,6 +80,8 @@ namespace usrp2 {
     db_info       d_tx_db_info;
     db_info       d_rx_db_info;
 
+    int                   d_tx_interp;         // shadow tx interp 
+    int                   d_rx_decim;          // shadow rx decim
 
     void inc_enqueued() {
       omni_mutex_lock l(d_enqueued_mutex);
@@ -123,6 +125,7 @@ namespace usrp2 {
     double rx_freq_min() { return d_rx_db_info.freq_min; }
     double rx_freq_max() { return d_rx_db_info.freq_max; }
     bool set_rx_decim(int decimation_factor);
+    int rx_decim() { return d_rx_decim; }
     bool set_rx_scale_iq(int scale_i, int scale_q);
     bool start_rx_streaming(unsigned int channel, unsigned int items_per_frame);
     bool rx_samples(unsigned int channel, rx_sample_handler *handler);
@@ -140,6 +143,7 @@ namespace usrp2 {
     double tx_freq_min() { return d_tx_db_info.freq_min; }
     double tx_freq_max() { return d_tx_db_info.freq_max; }
     bool set_tx_interp(int interpolation_factor);
+    int tx_interp() { return d_tx_interp; }
     bool set_tx_scale_iq(int scale_i, int scale_q);
 
     bool tx_32fc(unsigned int channel,