summaryrefslogtreecommitdiff
path: root/gr-vrt/src/vrt_quadradio_source_32fc.h
blob: 799b07e86b929af119957db63754a36eaff8a823 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/* -*- 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_ser_no(void){return d_caldiv_rev;}
  int get_caldiv_rev_no(void){return d_caldiv_ser;}
};



#endif /* INCLUDED_VRT_QUADRADIO_SOURCE_32FC_H */