| 1 | /**************************************************************************** |
|---|
| 2 | |
|---|
| 3 | Copyright 2005,2006 Virginia Polytechnic Institute and State University |
|---|
| 4 | |
|---|
| 5 | This file is part of the OSSIE USRP Device. |
|---|
| 6 | |
|---|
| 7 | OSSIE USRP Device is free software; you can redistribute it and/or modify |
|---|
| 8 | it under the terms of the GNU General Public License as published by |
|---|
| 9 | the Free Software Foundation; either version 2 of the License, or |
|---|
| 10 | (at your option) any later version. |
|---|
| 11 | |
|---|
| 12 | OSSIE USRP Device is distributed in the hope that it will be useful, |
|---|
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 15 | GNU General Public License for more details. |
|---|
| 16 | |
|---|
| 17 | You should have received a copy of the GNU General Public License |
|---|
| 18 | along with OSSIE USRP Device; if not, write to the Free Software |
|---|
| 19 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 20 | |
|---|
| 21 | |
|---|
| 22 | ****************************************************************************/ |
|---|
| 23 | |
|---|
| 24 | #ifndef DBSRX_H |
|---|
| 25 | #define DBSRX_H |
|---|
| 26 | |
|---|
| 27 | #include "usrp_spi_defs.h" |
|---|
| 28 | |
|---|
| 29 | #include "db_base.h" |
|---|
| 30 | |
|---|
| 31 | class dbsrx : public db_base { |
|---|
| 32 | |
|---|
| 33 | public: |
|---|
| 34 | dbsrx(usrp_standard_rx *_urx, unsigned int _w); |
|---|
| 35 | ~dbsrx(); |
|---|
| 36 | |
|---|
| 37 | bool set_db_freq(float lo_freq, float &actual_freq); |
|---|
| 38 | void set_gain(float gain); |
|---|
| 39 | void set_bw(float bw); |
|---|
| 40 | |
|---|
| 41 | void freq_range(float &min, float &max, float &step); |
|---|
| 42 | void gain_range(float &min, float &max, float &step); |
|---|
| 43 | |
|---|
| 44 | bool is_quadrature() {return true;}; |
|---|
| 45 | bool db_has_lo() {return true;}; //OSSIE specific? ->Yup! |
|---|
| 46 | |
|---|
| 47 | private: |
|---|
| 48 | dbsrx(); |
|---|
| 49 | |
|---|
| 50 | int n = 950; |
|---|
| 51 | int div2 = 0; |
|---|
| 52 | int osc = 5; |
|---|
| 53 | int cp = 3; |
|---|
| 54 | int r = 4; |
|---|
| 55 | int r_int = 1; |
|---|
| 56 | int fdac = 127; |
|---|
| 57 | int m = 2; |
|---|
| 58 | int dl = 0; |
|---|
| 59 | int ade = 0; |
|---|
| 60 | int adl = 0; |
|---|
| 61 | int gc2 = 31; |
|---|
| 62 | int diag = 0; |
|---|
| 63 | int refclk_divisor = 16; |
|---|
| 64 | |
|---|
| 65 | //Helper functions |
|---|
| 66 | void write_reg(int regno, int value); |
|---|
| 67 | void write_regs(int start_regno, int *values); |
|---|
| 68 | void read_status(int &status_byte1, int &status_byte2); |
|---|
| 69 | void send_reg(int regno); |
|---|
| 70 | |
|---|
| 71 | //BW setting helper functions |
|---|
| 72 | void set_m(int m_in); |
|---|
| 73 | void set_fdac(int fdac_in); |
|---|
| 74 | |
|---|
| 75 | //Gain setting helper functions |
|---|
| 76 | void set_dl(int dl_in); |
|---|
| 77 | void set_gc2(int gc2_in); |
|---|
| 78 | void set_gc1(int gc1_in); |
|---|
| 79 | void set_pga(int pga_gain_in); |
|---|
| 80 | |
|---|
| 81 | //Freq setting helper functions |
|---|
| 82 | void set_osc(int osc_in); |
|---|
| 83 | void set_cp(int cp_in); |
|---|
| 84 | void set_n(int n_in); |
|---|
| 85 | void set_div2(int div2_in); |
|---|
| 86 | void set_r(int r_in); |
|---|
| 87 | void set_ade(int ade_in); |
|---|
| 88 | int refclk_divisor() {return 16;}; |
|---|
| 89 | |
|---|
| 90 | }; |
|---|
| 91 | |
|---|
| 92 | #endif |
|---|