Merged r9834:9855 from jcorgan/u2-wip into trunk. Catches up gr-usrp2 with the lates...
[debian/gnuradio] / gr-usrp2 / src / usrp2_source_base.h
index 34d9fea0b60ad3b130e74d88d9994982fbc6b203..998a022dadc034a786b60f5fcdec0c157737ce8c 100644 (file)
 #ifndef INCLUDED_USRP2_SOURCE_BASE_H
 #define INCLUDED_USRP2_SOURCE_BASE_H
 
-#include <gr_sync_block.h>
-#include <usrp2/usrp2.h>
-#include <stdexcept>
+#include <usrp2_base.h>
 
-// BIG ASS FIXME: get from lower layer MTU calculation
-#define USRP2_MIN_RX_SAMPLES 371
-
-class usrp2_source_base : public gr_sync_block {
-  
+/*!
+ * Base class for all USRP2 source blocks
+ */
+class usrp2_source_base : public usrp2_base 
+{
 protected:
   usrp2_source_base(const char *name,
                    gr_io_signature_sptr output_signature,
@@ -39,8 +37,6 @@ protected:
                    const std::string &mac)
     throw (std::runtime_error);
 
-  usrp2::usrp2::sptr d_u2;
-
 public:
   ~usrp2_source_base();
 
@@ -60,26 +56,74 @@ public:
   bool set_decim(int decimation_factor);
 
   /*!
-   * \brief Get USRP2 hardware MAC address
+   * \brief Set receive IQ scale factors
+   */
+  bool set_scale_iq(int scale_i, int scale_q);
+
+  /*!
+   * \brief Get receive decimation rate
+   */
+  int decim();
+
+  /*!
+   * \brief Get the ADC sample rate
    */
-  std::string mac_addr();
+  bool adc_rate(long *rate);
+
+  /*!
+   * \brief Returns minimum Rx gain 
+   */
+  double gain_min();
+
+  /*!
+   * \brief Returns maximum Rx gain 
+   */
+  double gain_max();
   
   /*!
-   * \brief Called by scheduler when starting flowgraph
+   * \brief Returns Rx gain db_per_step
    */
-  bool start();
+  double gain_db_per_step();
   
   /*!
-   * \brief Called by scheduler when stopping flowgraph
+   * \brief Returns minimum Rx center frequency
    */
-  bool stop();
+  double freq_min();
 
   /*!
-   * \brief Derived class must override this
+   * \brief Returns maximum Rx center frequency
+   */
+  double freq_max();
+  
+  /*!
+   * \brief Get Rx daughterboard ID
+   *
+   * \param[out] dbid returns the daughterboard id.
+   *
+   * daughterboard id >= 0 if successful, -1 if no daugherboard installed,
+   * -2 if invalid EEPROM on daughterboard.
+   */
+  bool daughterboard_id(int *dbid);
+
+  /*!
+   * \brief Returns number of receiver overruns
+   */
+  unsigned int overruns();
+
+  /*!
+   * \brief Returns number of missing sequence numbers
+   */
+  unsigned int missing();
+
+  /*!
+   * \brief Called by scheduler when starting flowgraph
+   */
+  virtual bool start();
+  
+  /*!
+   * \brief Called by scheduler when stopping flowgraph
    */
-  virtual int work(int noutput_items,
-                  gr_vector_const_void_star &input_items,
-                  gr_vector_void_star &output_items) = 0;
+  virtual bool stop();
 };
 
 #endif /* INCLUDED_USRP2_SOURCE_BASE_H */