GNU Radio 3.4.0 C++ API
|
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 bool d_should_wait; 00041 usrp2::fpga_timestamp d_tx_time; 00042 00043 public: 00044 ~usrp2_sink_base(); 00045 00046 /*! 00047 * \brief Set antenna 00048 */ 00049 bool set_antenna(int ant); 00050 00051 /*! 00052 * \brief Set transmitter gain 00053 */ 00054 bool set_gain(double gain); 00055 00056 /*! 00057 * \brief Set transmitter LO offset frequency 00058 */ 00059 bool set_lo_offset(double frequency); 00060 00061 /*! 00062 * \brief Set transmitter center frequency 00063 */ 00064 bool set_center_freq(double frequency, usrp2::tune_result *tr); 00065 00066 /*! 00067 * \brief Set transmit interpolation rate 00068 */ 00069 bool set_interp(int interp_factor); 00070 00071 /*! 00072 * \brief Calculate default scale_iq for given interpolation factor 00073 */ 00074 void default_scale_iq(int interpolation_factor, int *scale_i, int *scale_q); 00075 00076 /*! 00077 * \brief Set transmit IQ scale factors 00078 */ 00079 bool set_scale_iq(int scale_i, int scale_q); 00080 00081 /*! 00082 * \brief Get transmit interpolation rate 00083 */ 00084 int interp(); 00085 00086 /*! 00087 * \brief Get DAC sample rate in Hz 00088 */ 00089 bool dac_rate(long *rate); 00090 00091 /*! 00092 * \brief Returns minimum Tx gain 00093 */ 00094 double gain_min(); 00095 00096 /*! 00097 * \brief Returns maximum Tx gain 00098 */ 00099 double gain_max(); 00100 00101 /*! 00102 * \brief Returns Tx gain db_per_step 00103 */ 00104 double gain_db_per_step(); 00105 00106 /*! 00107 * \brief Returns minimum Tx center frequency 00108 */ 00109 double freq_min(); 00110 00111 /*! 00112 * \brief Returns maximum Tx center frequency 00113 */ 00114 double freq_max(); 00115 00116 /*! 00117 * \brief Get Tx daughterboard ID 00118 * 00119 * \param[out] dbid returns the daughterboard id. 00120 * 00121 * daughterboard id >= 0 if successful, -1 if no daugherboard installed, 00122 * -2 if invalid EEPROM on daughterboard. 00123 */ 00124 bool daughterboard_id(int *dbid); 00125 00126 /*! 00127 * \brief Set daughterboard GPIO data direction register. 00128 */ 00129 bool set_gpio_ddr(uint16_t value, uint16_t mask); 00130 00131 /*! 00132 * \brief Set daughterboard GPIO output selection register. 00133 */ 00134 bool set_gpio_sels(std::string sels); 00135 00136 /*! 00137 * \brief Set daughterboard GPIO pin values. 00138 */ 00139 bool write_gpio(uint16_t value, uint16_t mask); 00140 00141 /*! 00142 * \brief Read daughterboard GPIO pin values 00143 */ 00144 bool read_gpio(uint16_t *value); 00145 00146 /*! 00147 * \brief First samples begin streaming to USRP2 at given time 00148 */ 00149 bool start_streaming_at(usrp2::fpga_timestamp time); 00150 }; 00151 00152 #endif /* INCLUDED_USRP2_SINK_BASE_H */