GNU Radio 3.3.0 C++ API
|
00001 /* -*- c++ -*- */ 00002 /* 00003 * Copyright 2008,2009,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_SOURCE_BASE_H 00024 #define INCLUDED_USRP2_SOURCE_BASE_H 00025 00026 #include <usrp2_base.h> 00027 00028 /*! 00029 * Base class for all USRP2 source blocks 00030 */ 00031 class usrp2_source_base : public usrp2_base 00032 { 00033 protected: 00034 usrp2_source_base(const char *name, 00035 gr_io_signature_sptr output_signature, 00036 const std::string &ifc, 00037 const std::string &mac) 00038 throw (std::runtime_error); 00039 00040 public: 00041 ~usrp2_source_base(); 00042 00043 /*! 00044 * \brief Set antenna 00045 */ 00046 bool set_antenna(int ant); 00047 00048 /*! 00049 * \brief Set receiver gain 00050 */ 00051 bool set_gain(double gain); 00052 00053 /*! 00054 * \brief Set receive LO offset frequency 00055 */ 00056 bool set_lo_offset(double frequency); 00057 00058 /*! 00059 * \brief Set receiver center frequency 00060 */ 00061 bool set_center_freq(double frequency, usrp2::tune_result *tr); 00062 00063 /*! 00064 * \brief Set receive decimation rate 00065 */ 00066 bool set_decim(int decimation_factor); 00067 00068 /*! 00069 * \brief Set receive IQ scale factors 00070 */ 00071 bool set_scale_iq(int scale_i, int scale_q); 00072 00073 /*! 00074 * \brief Get receive decimation rate 00075 */ 00076 int decim(); 00077 00078 /*! 00079 * \brief Get the ADC sample rate 00080 */ 00081 bool adc_rate(long *rate); 00082 00083 /*! 00084 * \brief Returns minimum Rx gain 00085 */ 00086 double gain_min(); 00087 00088 /*! 00089 * \brief Returns maximum Rx gain 00090 */ 00091 double gain_max(); 00092 00093 /*! 00094 * \brief Returns Rx gain db_per_step 00095 */ 00096 double gain_db_per_step(); 00097 00098 /*! 00099 * \brief Returns minimum Rx center frequency 00100 */ 00101 double freq_min(); 00102 00103 /*! 00104 * \brief Returns maximum Rx center frequency 00105 */ 00106 double freq_max(); 00107 00108 /*! 00109 * \brief Get Rx daughterboard ID 00110 * 00111 * \param[out] dbid returns the daughterboard id. 00112 * 00113 * daughterboard id >= 0 if successful, -1 if no daugherboard installed, 00114 * -2 if invalid EEPROM on daughterboard. 00115 */ 00116 bool daughterboard_id(int *dbid); 00117 00118 /*! 00119 * \brief Returns number of receiver overruns 00120 */ 00121 unsigned int overruns(); 00122 00123 /*! 00124 * \brief Returns number of missing sequence numbers 00125 */ 00126 unsigned int missing(); 00127 00128 /*! 00129 * \brief Called by scheduler when starting flowgraph 00130 */ 00131 virtual bool start(); 00132 00133 /*! 00134 * \brief Called by scheduler when stopping flowgraph 00135 */ 00136 virtual bool stop(); 00137 00138 /*! 00139 * \brief Set daughterboard GPIO data direction register. 00140 */ 00141 bool set_gpio_ddr(uint16_t value, uint16_t mask); 00142 00143 /*! 00144 * \brief Set daughterboard GPIO output selection register. 00145 */ 00146 bool set_gpio_sels(std::string sels); 00147 00148 /*! 00149 * \brief Set daughterboard GPIO pin values. 00150 */ 00151 bool write_gpio(uint16_t value, uint16_t mask); 00152 00153 /*! 00154 * \brief Read daughterboard GPIO pin values 00155 */ 00156 bool read_gpio(uint16_t *value); 00157 00158 /*! 00159 * \brief Enable streaming GPIO in sample LSBs 00160 */ 00161 bool enable_gpio_streaming(int enable); 00162 }; 00163 00164 #endif /* INCLUDED_USRP2_SOURCE_BASE_H */