GNU Radio 3.3.0 C++ API
usrp2_sink_base.h
Go to the documentation of this file.
00001 /* -*- c++ -*- */
00002 /*
00003  * Copyright 2008,2010 Free Software Foundation, Inc.
00004  * 
00005  * This file is part of GNU Radio
00006  * 
00007  * GNU Radio is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 3, or (at your option)
00010  * any later version.
00011  * 
00012  * GNU Radio is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  * 
00017  * You should have received a copy of the GNU General Public License
00018  * along with GNU Radio; see the file COPYING.  If not, write to
00019  * the Free Software Foundation, Inc., 51 Franklin Street,
00020  * Boston, MA 02110-1301, USA.
00021  */
00022 
00023 #ifndef INCLUDED_USRP2_SINK_BASE_H
00024 #define INCLUDED_USRP2_SINK_BASE_H
00025 
00026 #include <usrp2_base.h>
00027 
00028 /*!
00029  * Base class for all USRP2 transmit blocks
00030  */
00031 class usrp2_sink_base : public usrp2_base 
00032 {
00033 protected:
00034   usrp2_sink_base(const char *name,
00035                   gr_io_signature_sptr input_signature,
00036                   const std::string &ifc,
00037                   const std::string &mac)
00038     throw (std::runtime_error);
00039 
00040 public:
00041   ~usrp2_sink_base();
00042 
00043   /*!
00044    * \brief Set antenna
00045    */
00046   bool set_antenna(int ant);
00047 
00048   /*!
00049    * \brief Set transmitter gain
00050    */
00051   bool set_gain(double gain);
00052 
00053   /*!
00054    * \brief Set transmitter LO offset frequency
00055    */
00056   bool set_lo_offset(double frequency);
00057 
00058   /*!
00059    * \brief Set transmitter center frequency
00060    */
00061   bool set_center_freq(double frequency, usrp2::tune_result *tr);
00062    
00063   /*!
00064    * \brief Set transmit interpolation rate
00065    */
00066   bool set_interp(int interp_factor);
00067 
00068   /*!
00069    * \brief Calculate default scale_iq for given interpolation factor
00070    */
00071   void default_scale_iq(int interpolation_factor, int *scale_i, int *scale_q);
00072 
00073   /*!
00074    * \brief Set transmit IQ scale factors
00075    */
00076   bool set_scale_iq(int scale_i, int scale_q);
00077 
00078   /*!
00079    * \brief Get transmit interpolation rate
00080    */
00081   int interp();
00082 
00083   /*!
00084    * \brief Get DAC sample rate in Hz 
00085    */
00086   bool dac_rate(long *rate);
00087 
00088   /*!
00089    * \brief Returns minimum Tx gain 
00090    */
00091   double gain_min();
00092 
00093   /*!
00094    * \brief Returns maximum Tx gain 
00095    */
00096   double gain_max();
00097   
00098   /*!
00099    * \brief Returns Tx gain db_per_step
00100    */
00101   double gain_db_per_step();
00102 
00103   /*!
00104    * \brief Returns minimum Tx center frequency
00105    */
00106   double freq_min();
00107 
00108   /*!
00109    * \brief Returns maximum Tx center frequency
00110    */
00111   double freq_max();
00112 
00113   /*!
00114    * \brief Get Tx daughterboard ID
00115    *
00116    * \param[out] dbid returns the daughterboard id.
00117    *
00118    * daughterboard id >= 0 if successful, -1 if no daugherboard installed,
00119    * -2 if invalid EEPROM on daughterboard.
00120    */
00121   bool daughterboard_id(int *dbid);
00122 
00123   /*!
00124    * \brief Set daughterboard GPIO data direction register.
00125    */
00126   bool set_gpio_ddr(uint16_t value, uint16_t mask);
00127 
00128   /*!
00129    * \brief Set daughterboard GPIO output selection register.
00130    */
00131   bool set_gpio_sels(std::string sels);
00132 
00133   /*!
00134    * \brief Set daughterboard GPIO pin values.
00135    */
00136   bool write_gpio(uint16_t value, uint16_t mask);
00137 
00138   /*!
00139    * \brief Read daughterboard GPIO pin values
00140    */
00141   bool read_gpio(uint16_t *value);
00142 };
00143 
00144 #endif /* INCLUDED_USRP2_SINK_BASE_H */