00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef INCLUDED_USRP_STANDARD_H
00024 #define INCLUDED_USRP_STANDARD_H
00025
00026 #include <usrp_basic.h>
00027
00028 class usrp_standard_common
00029 {
00030 int d_fpga_caps;
00031
00032 protected:
00033 usrp_standard_common(usrp_basic *parent);
00034
00035 public:
00041 bool has_rx_halfband() const;
00042
00047 int nddcs() const;
00048
00052 bool has_tx_halfband() const;
00053
00058 int nducs() const;
00059 };
00060
00066 class usrp_standard_rx : public usrp_basic_rx, usrp_standard_common
00067 {
00068 private:
00069 static const int MAX_CHAN = 4;
00070 unsigned int d_decim_rate;
00071 int d_nchan;
00072 int d_sw_mux;
00073 int d_hw_mux;
00074 double d_rx_freq[MAX_CHAN];
00075
00076 protected:
00077 usrp_standard_rx (int which_board,
00078 unsigned int decim_rate,
00079 int nchan = 1,
00080 int mux = -1,
00081 int mode = 0,
00082 int fusb_block_size = 0,
00083 int fusb_nblocks = 0,
00084 const std::string fpga_filename = "",
00085 const std::string firmware_filename = ""
00086 );
00087
00088 bool write_hw_mux_reg ();
00089
00090 public:
00091
00092 enum {
00093 FPGA_MODE_NORMAL = 0x00,
00094 FPGA_MODE_LOOPBACK = 0x01,
00095 FPGA_MODE_COUNTING = 0x02,
00096 FPGA_MODE_COUNTING_32BIT = 0x04
00097 };
00098
00099 ~usrp_standard_rx ();
00100
00109 static usrp_standard_rx *make (int which_board,
00110 unsigned int decim_rate,
00111 int nchan = 1,
00112 int mux = -1,
00113 int mode = 0,
00114 int fusb_block_size = 0,
00115 int fusb_nblocks = 0,
00116 const std::string fpga_filename = "",
00117 const std::string firmware_filename = ""
00118 );
00125 bool set_decim_rate (unsigned int rate);
00126
00133 bool set_nchannels (int nchannels);
00134
00155 bool set_mux (int mux);
00156
00165 bool set_rx_freq (int channel, double freq);
00166
00170 bool set_fpga_mode (int mode);
00171
00178 bool set_ddc_phase(int channel, int phase);
00179
00208 bool set_format(unsigned int format);
00209
00210 static unsigned int make_format(int width=16, int shift=0,
00211 bool want_q=true, bool bypass_halfband=false);
00212 static int format_width(unsigned int format);
00213 static int format_shift(unsigned int format);
00214 static bool format_want_q(unsigned int format);
00215 static bool format_bypass_halfband(unsigned int format);
00216
00217
00218 unsigned int decim_rate () const;
00219 double rx_freq (int channel) const;
00220 int nchannels () const;
00221 int mux () const;
00222 unsigned int format () const;
00223
00224
00225 bool start ();
00226 bool stop ();
00227 };
00228
00229
00230
00236 class usrp_standard_tx : public usrp_basic_tx, usrp_standard_common
00237 {
00238 public:
00239 enum coarse_mod_t {
00240 CM_NEG_FDAC_OVER_4,
00241 CM_NEG_FDAC_OVER_8,
00242 CM_OFF,
00243 CM_POS_FDAC_OVER_8,
00244 CM_POS_FDAC_OVER_4
00245 };
00246
00247 protected:
00248 static const int MAX_CHAN = 2;
00249 unsigned int d_interp_rate;
00250 int d_nchan;
00251 int d_sw_mux;
00252 int d_hw_mux;
00253 double d_tx_freq[MAX_CHAN];
00254 coarse_mod_t d_coarse_mod[MAX_CHAN];
00255 unsigned char d_tx_modulator_shadow[MAX_CHAN];
00256
00257 virtual bool set_coarse_modulator (int channel, coarse_mod_t cm);
00258 usrp_standard_tx::coarse_mod_t coarse_modulator (int channel) const;
00259
00260 protected:
00261 usrp_standard_tx (int which_board,
00262 unsigned int interp_rate,
00263 int nchan = 1,
00264 int mux = -1,
00265 int fusb_block_size = 0,
00266 int fusb_nblocks = 0,
00267 const std::string fpga_filename = "",
00268 const std::string firmware_filename = ""
00269 );
00270
00271 bool write_hw_mux_reg ();
00272
00273 public:
00274 ~usrp_standard_tx ();
00275
00284 static usrp_standard_tx *make (int which_board,
00285 unsigned int interp_rate,
00286 int nchan = 1,
00287 int mux = -1,
00288 int fusb_block_size = 0,
00289 int fusb_nblocks = 0,
00290 const std::string fpga_filename = "",
00291 const std::string firmware_filename = ""
00292 );
00293
00300 virtual bool set_interp_rate (unsigned int rate);
00301
00308 bool set_nchannels (int nchannels);
00309
00343 bool set_mux (int mux);
00344
00353 virtual bool set_tx_freq (int channel, double freq);
00354
00355
00356 unsigned int interp_rate () const;
00357 double tx_freq (int channel) const;
00358 int nchannels () const;
00359 int mux () const;
00360
00361
00362 bool start ();
00363 bool stop ();
00364 };
00365
00366 #endif