diff options
author | Josh Blum | 2009-10-22 18:43:11 -0700 |
---|---|---|
committer | Josh Blum | 2009-10-22 18:43:11 -0700 |
commit | 096dbe5c4bbab53e05d23fd632eeb2013fdfb660 (patch) | |
tree | 3540d0bba58beca9741e80d28818cb29b7be2c70 /gr-vrt/src | |
parent | 5782401afaa2e3ea9607abc9bd69ae54854dd633 (diff) | |
download | gnuradio-096dbe5c4bbab53e05d23fd632eeb2013fdfb660.tar.gz gnuradio-096dbe5c4bbab53e05d23fd632eeb2013fdfb660.tar.bz2 gnuradio-096dbe5c4bbab53e05d23fd632eeb2013fdfb660.zip |
removed MOST of the quadradio specific stuff
Diffstat (limited to 'gr-vrt/src')
-rw-r--r-- | gr-vrt/src/Makefile.am | 26 | ||||
-rw-r--r-- | gr-vrt/src/vrt.i | 64 | ||||
-rw-r--r-- | gr-vrt/src/vrt_quadradio_source_32fc.cc | 226 | ||||
-rw-r--r-- | gr-vrt/src/vrt_quadradio_source_32fc.h | 136 |
4 files changed, 12 insertions, 440 deletions
diff --git a/gr-vrt/src/Makefile.am b/gr-vrt/src/Makefile.am index 4b5fe9b8b..ecd24516e 100644 --- a/gr-vrt/src/Makefile.am +++ b/gr-vrt/src/Makefile.am @@ -54,8 +54,7 @@ lib_LTLIBRARIES = libgnuradio-vrt.la libgnuradio_vrt_la_SOURCES = \ missing_pkt_checker.cc \ vrt_source_base.cc \ - vrt_source_32fc.cc \ - vrt_quadradio_source_32fc.cc + vrt_source_32fc.cc #libgnuradio_vrt_la_SOURCES = \ @@ -77,7 +76,6 @@ libgnuradio_vrt_la_LIBADD = \ grinclude_HEADERS = \ vrt_source_base.h \ vrt_source_32fc.h \ - vrt_quadradio_source_32fc.h \ missing_pkt_checker.h # vrt_source_16sc.h \ @@ -95,28 +93,28 @@ noinst_HEADERS = # _vrt.so # ---------------------------------------------------------------------- -TOP_SWIG_IFILES = \ - vrt.i +#TOP_SWIG_IFILES = \ +# vrt.i # Install so that they end up available as: # import gnuradio.vrt # This ends up at: # ${prefix}/lib/python${python_version}/site-packages/gnuradio -vrt_pythondir_category = \ - gnuradio +#vrt_pythondir_category = \ +# gnuradio # additional arguments to the SWIG command -vrt_swig_args = \ - $(VRT_INCLUDES) +#vrt_swig_args = \ +# $(VRT_INCLUDES) # additional libraries for linking with the SWIG-generated library -vrt_la_swig_libadd = \ - libgnuradio-vrt.la +#vrt_la_swig_libadd = \ +# libgnuradio-vrt.la -include $(top_srcdir)/Makefile.swig +#include $(top_srcdir)/Makefile.swig # add some of the variables generated inside the Makefile.swig.gen -BUILT_SOURCES = $(swig_built_sources) +#BUILT_SOURCES = $(swig_built_sources) # Do not distribute the output of SWIG -no_dist_files = $(swig_built_sources) +#no_dist_files = $(swig_built_sources) diff --git a/gr-vrt/src/vrt.i b/gr-vrt/src/vrt.i deleted file mode 100644 index 9016dc33e..000000000 --- a/gr-vrt/src/vrt.i +++ /dev/null @@ -1,64 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2009 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -%include "gnuradio.i" // the common stuff -%import <stdint.i> - -%{ -#include "vrt_quadradio_source_32fc.h" -#include <vrt/quadradio.h> -//#include "vrt_quadradio_source_16sc.h" -//#include "vrt_sink_32fc.h" -//#include "vrt_sink_16sc.h" -%} - -%template(uint32_t_vector) std::vector<uint32_t>; - -// ---------------------------------------------------------------- - -class vrt_source_base : public gr_sync_block -{ -protected: - vrt_source_base() throw (std::runtime_error); - -public: - ~vrt_source_base(); - -}; - -class vrt_source_32fc : public vrt_source_base -{ -protected: - vrt_source_32fc() throw (std::runtime_error); - -public: - ~vrt_source_32fc(); - void reset(); -}; - -// ---------------------------------------------------------------- - -GR_SWIG_BLOCK_MAGIC(vrt,quadradio_source_32fc) - -%include "vrt_quadradio_source_32fc.h" - -%include <vrt/quadradio.h> diff --git a/gr-vrt/src/vrt_quadradio_source_32fc.cc b/gr-vrt/src/vrt_quadradio_source_32fc.cc deleted file mode 100644 index cd779bdf5..000000000 --- a/gr-vrt/src/vrt_quadradio_source_32fc.cc +++ /dev/null @@ -1,226 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <vrt_quadradio_source_32fc.h> -#include <vrt/quadradio.h> -#include <vrt/rx_packet_handler.h> -#include <cstdio> - -vrt_quadradio_source_32fc_sptr -vrt_make_quadradio_source_32fc(const std::string &ip, - size_t rx_bufsize, - size_t samples_per_pkt, - int rxdspno) -{ - return gnuradio::get_initial_sptr(new vrt_quadradio_source_32fc(ip, - rx_bufsize, - samples_per_pkt, - rxdspno)); -} - -vrt_quadradio_source_32fc::vrt_quadradio_source_32fc(const std::string &ip, - size_t rx_bufsize, - size_t samples_per_pkt, - int rxdspno) - : vrt_source_32fc("quadradio_source_32fc"), - d_samples_per_pkt(samples_per_pkt == 0 ? (rxdspno == 0 ? 800 : 200) : samples_per_pkt), - d_qr(vrt::quadradio::sptr(new vrt::quadradio(ip, rx_bufsize))), - d_rxdspno(rxdspno) -{ -} - -vrt_quadradio_source_32fc::~vrt_quadradio_source_32fc() -{ - d_qr->stop_streaming(d_rxdspno); -} - -vrt::rx::sptr -vrt_quadradio_source_32fc::vrt_rx() const -{ - return d_qr->vrt_rx(); -} - -bool -vrt_quadradio_source_32fc::start() -{ - // throw away any stale packets before starting - vrt::rx_packet_handler nop; - vrt_rx()->rx_packets(&nop, true); - d_checker.resync(); - - return d_qr->start_streaming(d_rxdspno, d_samples_per_pkt); -} - -bool -vrt_quadradio_source_32fc::stop() -{ - return d_qr->stop_streaming(d_rxdspno); -} - -bool -vrt_quadradio_source_32fc::set_dboard_pins(int which_dboard, int v) -{ - return d_qr->set_dboard_pins(which_dboard, v); -} - -bool -vrt_quadradio_source_32fc::set_center_freq(double target_freq) -{ - return d_qr->set_center_freq(target_freq); -} - -bool -vrt_quadradio_source_32fc::set_band_select(int band) -{ - return d_qr->set_band_select(static_cast<vrt_band_sel_t>(band)); -} - -int -vrt_quadradio_source_32fc::get_band_select(void) -{ - return static_cast<int>(d_qr->get_band_select()); -} - -//void -//vrt_quadradio_source_32fc::set_10dB_atten(bool on) -//{ -// return d_qr->set_10dB_atten(on); -//} - -bool -vrt_quadradio_source_32fc::select_rx_antenna(const std::string &ant) -{ - return d_qr->select_rx_antenna(ant); -} - -bool -vrt_quadradio_source_32fc::set_attenuation0(int attenuation) -{ - return d_qr->set_attenuation0(attenuation); -} - -bool -vrt_quadradio_source_32fc::set_attenuation1(int attenuation) -{ - return d_qr->set_attenuation1(attenuation); -} - -void -vrt_quadradio_source_32fc::set_adc_gain(bool on){ - d_qr->set_adc_gain(on); -} - -void -vrt_quadradio_source_32fc::set_dc_offset_comp(bool on){ - d_qr->set_dc_offset_comp(on); -} - -void -vrt_quadradio_source_32fc::set_digital_gain(float gain){ - d_qr->set_digital_gain(gain); -} - -void -vrt_quadradio_source_32fc::set_test_signal(int type){ - d_qr->set_test_signal(static_cast<vrt_test_sig_t>(type)); -} - -bool -vrt_quadradio_source_32fc::set_setting_reg(int regno, int value) -{ - return d_qr->set_setting_reg(regno, value); -} - -bool -vrt_quadradio_source_32fc::set_hsadc_conf(int which_dboard, int regno, int value) -{ - return d_qr->set_hsadc_conf(which_dboard, regno, value); -} - -bool -vrt_quadradio_source_32fc::set_lsdac(int which_dboard, int which_dac, int value) -{ - return d_qr->set_lsdac(which_dboard, which_dac, value); -} - -bool -vrt_quadradio_source_32fc::set_mem32(int addr, int value) -{ - return d_qr->set_mem32(addr, value); -} - -bool -vrt_quadradio_source_32fc::set_lo_freq(double freq) -{ - return d_qr->set_lo_freq(freq); -} - -bool -vrt_quadradio_source_32fc::set_cal_freq(double freq) -{ - return d_qr->set_cal_freq(freq); -} - -/*--------------------------------------------------------------------*/ -#define IQ_IMBAL_NUM_TAPS 30 -#define IQ_IMBAL_REG_NO 162 - -//helper function to set the iq imbalance register with a tap -static int get_iq_imbal_reg(bool real, bool init, float tap){ - int val = int(round(tap)); - val &= 0x1ffffff; //lower 25 bits for tap - val |= (real?0:1) << 30; //30th bit for filter type - val |= (init?1:0) << 31; //31st bit for initialization - printf("Reg %d Val %x\n", IQ_IMBAL_REG_NO, val); - return val; -} - -void -vrt_quadradio_source_32fc::set_iq_imbal_taps(const std::vector<gr_complex> taps){ - int i = 0; - /* set the real part of the taps */ - get_iq_imbal_reg(true, true, 0); - for (i = 0; i < IQ_IMBAL_NUM_TAPS; i++){ - set_setting_reg(IQ_IMBAL_REG_NO, get_iq_imbal_reg(true, false, taps[IQ_IMBAL_NUM_TAPS-i-1].real())); - } - get_iq_imbal_reg(false, true, 0); - /* set the imaginary part of the taps */ - for (i = 0; i < IQ_IMBAL_NUM_TAPS; i++){ - set_setting_reg(IQ_IMBAL_REG_NO, get_iq_imbal_reg(false, false, taps[IQ_IMBAL_NUM_TAPS-i-1].imag())); - } -} - -bool -vrt_quadradio_source_32fc::set_beamforming(std::vector<gr_complex> gains){ - int32_t gains_ints[8]; - for (int i = 0; i < 4; i++){ - gains_ints[2*i] = int32_t(gains[i].real()); - gains_ints[2*i+1] = int32_t(gains[i].imag()); - } - return d_qr->set_beamforming(gains_ints); -} - -bool -vrt_quadradio_source_32fc::set_cal_enb(bool enb){ - return d_qr->set_cal_enb(enb); -} diff --git a/gr-vrt/src/vrt_quadradio_source_32fc.h b/gr-vrt/src/vrt_quadradio_source_32fc.h deleted file mode 100644 index bb3935c46..000000000 --- a/gr-vrt/src/vrt_quadradio_source_32fc.h +++ /dev/null @@ -1,136 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ -#ifndef INCLUDED_VRT_QUADRADIO_SOURCE_32FC_H -#define INCLUDED_VRT_QUADRADIO_SOURCE_32FC_H - -#include <vrt_source_32fc.h> - -namespace vrt { - class quadradio; -}; - -class vrt_quadradio_source_32fc; -typedef boost::shared_ptr<vrt_quadradio_source_32fc> vrt_quadradio_source_32fc_sptr; - -vrt_quadradio_source_32fc_sptr -vrt_make_quadradio_source_32fc(const std::string &ip, - size_t rx_bufsize = 0, - size_t samples_per_pkt = 0, - int rxdspno = 0); - -class vrt_quadradio_source_32fc : public vrt_source_32fc -{ - size_t d_samples_per_pkt; - boost::shared_ptr<vrt::quadradio> d_qr; - int d_rxdspno; - - vrt_quadradio_source_32fc(const std::string &ip, size_t rx_bufsize, - size_t samples_per_pkt, int rxdspno); - - friend vrt_quadradio_source_32fc_sptr - vrt_make_quadradio_source_32fc(const std::string &ip, size_t rx_bufsize, - size_t samples_per_pkt, int rxdspno); - -public: - virtual ~vrt_quadradio_source_32fc(); - virtual vrt::rx::sptr vrt_rx() const; - - /*! - * \brief Called by scheduler when starting flowgraph - */ - virtual bool start(); - - /*! - * \brief Called by scheduler when stopping flowgraph - */ - virtual bool stop(); - - /*! - * \brief Set the LO frequency (actually just sets the band select for now). - */ - bool set_center_freq(double target_freq); - - /*! - * \brief Set the band select dboard bits. - */ - bool set_band_select(int band); - int get_band_select(void); - - /*! - * \brief Turn the 10 dB attenuation on/off. - */ - //void set_10dB_atten(bool on); - - /*! - * \brief Set the antenna type to the main rf or calibrator. - * \param ant "rf" or "cal" - */ - bool select_rx_antenna(const std::string &ant); - - /*! - * \brief Set the attenuation. - * \param attenuation 0 to 31 in dB - */ - bool set_attenuation0(int attenuation); - bool set_attenuation1(int attenuation); - - void set_iq_imbal_taps(const std::vector<gr_complex> taps); - - void set_adc_gain(bool on); - void set_dc_offset_comp(bool on); - void set_digital_gain(float gain); - void set_test_signal(int type); - - bool set_setting_reg(int regno, int value); - - /*! - * \brief write \p v to daugherboard control setting register - */ - bool set_dboard_pins(int which_dboard, int v); - bool set_hsadc_conf(int which_dboard, int regno, int value); - bool set_lsdac(int which_dboard, int which_dac, int value); - bool set_mem32(int addr, int value); - bool set_lo_freq(double freq); - bool set_cal_freq(double freq); - bool set_beamforming(std::vector<gr_complex> gains); - bool set_cal_enb(bool enb); - - //caldiv public access methods - double get_cal_freq(void){return d_cal_freq;} - bool get_cal_locked(void){return d_cal_locked;} - bool get_cal_enabled(void){return d_cal_enabled;} - double get_lo_freq(void){return d_lo_freq;} - bool get_lo_locked(void){return d_lo_locked;} - double get_caldiv_temp(void){return d_caldiv_temp;} - int get_caldiv_revision(void){return d_caldiv_rev;} - int get_caldiv_serial(void){return d_caldiv_ser;} - int get_caldiv_model(void){return d_caldiv_mod;} - - //gps public access methods - int get_utc_time(void){return d_utc_time;} - double get_altitude(void){return d_altitude;} - double get_longitude(void){return d_longitude;} - double get_latitude(void){return d_latitude;} -}; - - - -#endif /* INCLUDED_VRT_QUADRADIO_SOURCE_32FC_H */ |