GNU Radio 3.4.0 C++ API
db_dbs_rx.h
Go to the documentation of this file.
00001 /* -*- c++ -*- */
00002 //
00003 // Copyright 2008,2009 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 asversion 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 #ifndef DB_DBS_RX_H
00023 #define DB_DBS_RX_H
00024 
00025 #include <usrp/db_base.h>
00026 #include <vector>
00027 
00028 #if 0
00029 struct bw_t {
00030   int m;
00031   int fdac;
00032   float div;
00033 };
00034 #endif
00035 
00036 class db_dbs_rx : public db_base
00037 {
00038 private:
00039   int d_osc, d_cp, d_n, d_div2, d_r, d_r_int;
00040   int d_fdac, d_m, d_dl, d_ade, d_adl, d_gc1, d_gc2, d_diag;
00041   int d_i2c_addr;
00042   
00043   // Internal gain functions
00044   void _write_reg(int regno, int v);
00045   void _write_regs(int starting_regno, const std::vector<int> &vals);
00046   std::vector<int> _read_status();
00047   void _send_reg(int regno);
00048   void _set_m(int m);
00049   void _set_fdac(int fdac);
00050   void _set_dl(int dl);
00051   void _set_gc2(int gc2);
00052   void _set_gc1(int gc1);
00053   void _set_pga(int pga_gain);
00054 
00055   // Internal frequency function
00056   void _set_osc(int osc);
00057   void _set_cp(int cp);
00058   void _set_n(int n);
00059   void _set_div2(int div2);
00060   void _set_r(int r);
00061   void _set_ade(int ade);
00062 
00063   int _refclk_divisor();
00064 
00065 protected:
00066   void shutdown();
00067 
00068 public:
00069   db_dbs_rx(usrp_basic_sptr usrp, int which);
00070   ~db_dbs_rx();
00071 
00072   float gain_min();
00073   float gain_max();
00074   float gain_db_per_step();
00075   double freq_min();
00076   double freq_max();
00077   struct freq_result_t set_freq(double freq);
00078   bool  set_gain(float gain);
00079   bool  is_quadrature();
00080   bool  set_bw(float bw);
00081 };
00082 
00083 #endif