<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <title>Universal Software Radio Peripheral: usrp_basic.h Source File</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body> <!-- Generated by Doxygen 1.6.3 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <div class="tabs"> <ul> <li><a href="files.html"><span>File List</span></a></li> <li><a href="globals.html"><span>File Members</span></a></li> </ul> </div> <h1>usrp_basic.h</h1><a href="usrp__basic_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* -*- c++ -*- */</span> <a name="l00002"></a>00002 <span class="comment">/*</span> <a name="l00003"></a>00003 <span class="comment"> * Copyright 2005,2009 Free Software Foundation, Inc.</span> <a name="l00004"></a>00004 <span class="comment"> *</span> <a name="l00005"></a>00005 <span class="comment"> * This file is part of GNU Radio</span> <a name="l00006"></a>00006 <span class="comment"> *</span> <a name="l00007"></a>00007 <span class="comment"> * GNU Radio is free software; you can redistribute it and/or modify</span> <a name="l00008"></a>00008 <span class="comment"> * it under the terms of the GNU General Public License as published by</span> <a name="l00009"></a>00009 <span class="comment"> * the Free Software Foundation; either version 3, or (at your option)</span> <a name="l00010"></a>00010 <span class="comment"> * any later version.</span> <a name="l00011"></a>00011 <span class="comment"> *</span> <a name="l00012"></a>00012 <span class="comment"> * GNU Radio is distributed in the hope that it will be useful,</span> <a name="l00013"></a>00013 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span> <a name="l00014"></a>00014 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span> <a name="l00015"></a>00015 <span class="comment"> * GNU General Public License for more details.</span> <a name="l00016"></a>00016 <span class="comment"> *</span> <a name="l00017"></a>00017 <span class="comment"> * You should have received a copy of the GNU General Public License</span> <a name="l00018"></a>00018 <span class="comment"> * along with GNU Radio; see the file COPYING. If not, write to</span> <a name="l00019"></a>00019 <span class="comment"> * the Free Software Foundation, Inc., 51 Franklin Street,</span> <a name="l00020"></a>00020 <span class="comment"> * Boston, MA 02110-1301, USA.</span> <a name="l00021"></a>00021 <span class="comment"> */</span> <a name="l00022"></a>00022 <a name="l00023"></a>00023 <span class="preprocessor">#ifndef INCLUDED_USRP_BASIC_H</span> <a name="l00024"></a>00024 <span class="preprocessor"></span><span class="preprocessor">#define INCLUDED_USRP_BASIC_H</span> <a name="l00025"></a>00025 <span class="preprocessor"></span> <a name="l00026"></a>00026 <span class="preprocessor">#include <<a class="code" href="db__base_8h.html">usrp/db_base.h</a>></span> <a name="l00027"></a>00027 <span class="preprocessor">#include <<a class="code" href="usrp__slots_8h.html">usrp/usrp_slots.h</a>></span> <a name="l00028"></a>00028 <span class="preprocessor">#include <<a class="code" href="usrp__subdev__spec_8h.html">usrp/usrp_subdev_spec.h</a>></span> <a name="l00029"></a>00029 <span class="preprocessor">#include <<a class="code" href="libusb__types_8h.html">usrp/libusb_types.h</a>></span> <a name="l00030"></a>00030 <span class="preprocessor">#include <string></span> <a name="l00031"></a>00031 <span class="preprocessor">#include <vector></span> <a name="l00032"></a>00032 <span class="preprocessor">#include <boost/utility.hpp></span> <a name="l00033"></a>00033 <a name="l00034"></a>00034 <span class="keyword">class </span><a class="code" href="classfusb__devhandle.html" title="abstract usb device handle">fusb_devhandle</a>; <a name="l00035"></a>00035 <span class="keyword">class </span><a class="code" href="classfusb__ephandle.html" title="abstract usb end point handle">fusb_ephandle</a>; <a name="l00036"></a>00036 <a name="l00037"></a><a class="code" href="usrp__basic_8h.html#a62f19b5a3751ce085242fa46f8761f71">00037</a> <span class="keyword">enum</span> <a class="code" href="usrp__basic_8h.html#a62f19b5a3751ce085242fa46f8761f71">txrx_t</a> { <a name="l00038"></a><a class="code" href="usrp__basic_8h.html#a62f19b5a3751ce085242fa46f8761f71a29836aad5b486173ae3f31b3cb59f6b9">00038</a> <a class="code" href="usrp__basic_8h.html#a62f19b5a3751ce085242fa46f8761f71a29836aad5b486173ae3f31b3cb59f6b9">C_RX</a> = 0, <a name="l00039"></a><a class="code" href="usrp__basic_8h.html#a62f19b5a3751ce085242fa46f8761f71a9228bc40e4bcfb1b7363f686515e1846">00039</a> <a class="code" href="usrp__basic_8h.html#a62f19b5a3751ce085242fa46f8761f71a9228bc40e4bcfb1b7363f686515e1846">C_TX</a> = 1 <a name="l00040"></a>00040 }; <a name="l00041"></a>00041 <a name="l00042"></a>00042 <span class="comment">/*</span> <a name="l00043"></a>00043 <span class="comment"> * ----------------------------------------------------------------------</span> <a name="l00044"></a>00044 <span class="comment"> * Mid level interface to the Universal Software Radio Peripheral (Rev 1)</span> <a name="l00045"></a>00045 <span class="comment"> *</span> <a name="l00046"></a>00046 <span class="comment"> * These classes implement the basic functionality for talking to the</span> <a name="l00047"></a>00047 <span class="comment"> * USRP. They try to be as independent of the signal processing code</span> <a name="l00048"></a>00048 <span class="comment"> * in FPGA as possible. They implement access to the low level</span> <a name="l00049"></a>00049 <span class="comment"> * peripherals on the board, provide a common way for reading and</span> <a name="l00050"></a>00050 <span class="comment"> * writing registers in the FPGA, and provide the high speed interface</span> <a name="l00051"></a>00051 <span class="comment"> * to streaming data across the USB.</span> <a name="l00052"></a>00052 <span class="comment"> *</span> <a name="l00053"></a>00053 <span class="comment"> * It is expected that subclasses will be derived that provide</span> <a name="l00054"></a>00054 <span class="comment"> * access to the functionality to a particular FPGA configuration.</span> <a name="l00055"></a>00055 <span class="comment"> * ----------------------------------------------------------------------</span> <a name="l00056"></a>00056 <span class="comment"> */</span> <a name="l00057"></a>00057 <a name="l00058"></a>00058 <a name="l00063"></a><a class="code" href="classusrp__basic.html">00063</a> <span class="keyword">class </span><a class="code" href="classusrp__basic.html" title="abstract base class for usrp operations">usrp_basic</a> : boost::noncopyable <a name="l00064"></a>00064 { <a name="l00065"></a>00065 <span class="keyword">protected</span>: <a name="l00066"></a>00066 <span class="keywordtype">void</span> <a class="code" href="classusrp__basic.html#afaae41796f1468062d4ad237322baf9e">shutdown_daughterboards</a>(); <a name="l00067"></a>00067 <a name="l00068"></a>00068 <span class="keyword">protected</span>: <a name="l00069"></a><a class="code" href="classusrp__basic.html#aad5f6f17a9fde484c67e7dbdd0491f74">00069</a> <a class="code" href="structusb__dev__handle.html">libusb_device_handle</a> *<a class="code" href="classusrp__basic.html#aad5f6f17a9fde484c67e7dbdd0491f74">d_udh</a>; <a name="l00070"></a><a class="code" href="classusrp__basic.html#a747a3cfca6d00b8d2960b4692ae36bc2">00070</a> <span class="keyword">struct </span>libusb_context *<a class="code" href="classusrp__basic.html#a747a3cfca6d00b8d2960b4692ae36bc2">d_ctx</a>; <a name="l00071"></a><a class="code" href="classusrp__basic.html#a4e5297f0010c8f39cfe4fff838b113a4">00071</a> <span class="keywordtype">int</span> <a class="code" href="classusrp__basic.html#a4e5297f0010c8f39cfe4fff838b113a4">d_usb_data_rate</a>; <span class="comment">// bytes/sec</span> <a name="l00072"></a><a class="code" href="classusrp__basic.html#a1d6b6839b9ba385d93684c3497c3fb16">00072</a> <span class="keywordtype">int</span> <a class="code" href="classusrp__basic.html#a1d6b6839b9ba385d93684c3497c3fb16">d_bytes_per_poll</a>; <span class="comment">// how often to poll for overruns</span> <a name="l00073"></a><a class="code" href="classusrp__basic.html#a6d0fecbe64f35fef20293c27dc33a0b0">00073</a> <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic.html#a6d0fecbe64f35fef20293c27dc33a0b0">d_verbose</a>; <a name="l00074"></a><a class="code" href="classusrp__basic.html#afa81d2ee842dd6eef04c422276f52d1d">00074</a> <span class="keywordtype">long</span> <a class="code" href="classusrp__basic.html#afa81d2ee842dd6eef04c422276f52d1d">d_fpga_master_clock_freq</a>; <a name="l00075"></a>00075 <a name="l00076"></a><a class="code" href="classusrp__basic.html#ae9277f41b745b1c96c422804fafd058a">00076</a> <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code" href="classusrp__basic.html#ae9277f41b745b1c96c422804fafd058a">MAX_REGS</a> = 128; <a name="l00077"></a><a class="code" href="classusrp__basic.html#af3d08c8bcdd0ed116e76ffa5449004f2">00077</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classusrp__basic.html#af3d08c8bcdd0ed116e76ffa5449004f2">d_fpga_shadows</a>[<a class="code" href="classusrp__basic.html#ae9277f41b745b1c96c422804fafd058a">MAX_REGS</a>]; <a name="l00078"></a>00078 <a name="l00079"></a><a class="code" href="classusrp__basic.html#a686ea66e3f43c9ab6df60bd80f41ac3b">00079</a> <span class="keywordtype">int</span> <a class="code" href="classusrp__basic.html#a686ea66e3f43c9ab6df60bd80f41ac3b">d_dbid</a>[2]; <span class="comment">// daughterboard ID's (side A, side B)</span> <a name="l00080"></a>00080 <a name="l00089"></a><a class="code" href="classusrp__basic.html#aa45df525ed16ee0c885a4972ac7908b4">00089</a> std::vector< std::vector<db_base_sptr> > <a class="code" href="classusrp__basic.html#aa45df525ed16ee0c885a4972ac7908b4">d_db</a>; <a name="l00090"></a>00090 <a name="l00092"></a>00092 <span class="keywordtype">void</span> <a class="code" href="classusrp__basic.html#a9d4d1ef184ad622c7f84a6f940614b9b" title="One time call, made only only from usrp_standard_*make after shared_ptr is created...">init_db</a>(<a class="code" href="db__base_8h.html#a4847231f7e2f85d0a0f4a5ed78b25ee7">usrp_basic_sptr</a> u); <a name="l00093"></a>00093 <a name="l00094"></a>00094 <a name="l00095"></a>00095 <a class="code" href="classusrp__basic.html#ac72f072eb9220e798019b60b3fe48af6">usrp_basic</a> (<span class="keywordtype">int</span> which_board, <a name="l00096"></a>00096 <a class="code" href="structusb__dev__handle.html">libusb_device_handle</a> *open_interface (<a class="code" href="libusb__types_8h.html#a6a41e56fed0168fbd7abd9359c805bf1">libusb_device</a> *dev), <a name="l00097"></a>00097 <span class="keyword">const</span> std::string fpga_filename = <span class="stringliteral">""</span>, <a name="l00098"></a>00098 <span class="keyword">const</span> std::string firmware_filename = <span class="stringliteral">""</span>); <a name="l00099"></a>00099 <a name="l00109"></a>00109 <span class="keywordtype">void</span> <a class="code" href="classusrp__basic.html#a77535750946e7d8443a76941a9611cae" title="advise usrp_basic of usb data rate (bytes/sec)">set_usb_data_rate</a> (<span class="keywordtype">int</span> <a class="code" href="classusrp__basic.html#a530c23ff633c630530ec491c368a755d">usb_data_rate</a>); <a name="l00110"></a>00110 <a name="l00121"></a>00121 <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic.html#ab8870a35e0bdc63ee6655b5264a6d142" title="Write auxiliary digital to analog converter.">_write_aux_dac</a> (<span class="keywordtype">int</span> slot, <span class="keywordtype">int</span> which_dac, <span class="keywordtype">int</span> value); <a name="l00122"></a>00122 <a name="l00131"></a>00131 <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic.html#a8f92d2e9630ec614eedc61858756cce1" title="Read auxiliary analog to digital converter.">_read_aux_adc</a> (<span class="keywordtype">int</span> slot, <span class="keywordtype">int</span> which_adc, <span class="keywordtype">int</span> *value); <a name="l00132"></a>00132 <a name="l00140"></a>00140 <span class="keywordtype">int</span> <a class="code" href="classusrp__basic.html#a8f92d2e9630ec614eedc61858756cce1" title="Read auxiliary analog to digital converter.">_read_aux_adc</a> (<span class="keywordtype">int</span> slot, <span class="keywordtype">int</span> which_adc); <a name="l00141"></a>00141 <a name="l00142"></a>00142 <a name="l00143"></a>00143 <span class="keyword">public</span>: <a name="l00144"></a>00144 <span class="keyword">virtual</span> <a class="code" href="classusrp__basic.html#a01313a5f1c8e0eea1a1ff26388e25f78">~usrp_basic</a> (); <a name="l00145"></a>00145 <a name="l00146"></a>00146 <a name="l00154"></a><a class="code" href="classusrp__basic.html#a8eb1f58ca819437d7f43ad87574bd6da">00154</a> std::vector<std::vector<db_base_sptr> > <a class="code" href="classusrp__basic.html#a8eb1f58ca819437d7f43ad87574bd6da">db</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classusrp__basic.html#aa45df525ed16ee0c885a4972ac7908b4">d_db</a>; } <a name="l00155"></a>00155 <a name="l00165"></a>00165 std::vector<db_base_sptr> <a class="code" href="classusrp__basic.html#a8eb1f58ca819437d7f43ad87574bd6da">db</a>(<span class="keywordtype">int</span> which_side); <a name="l00166"></a>00166 <a name="l00170"></a>00170 <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic.html#a61af504df443a9d846ecf909871f1481" title="is the subdev_spec valid?">is_valid</a>(<span class="keyword">const</span> <a class="code" href="structusrp__subdev__spec.html" title="specify a daughterboard and subdevice on a daughterboard.">usrp_subdev_spec</a> &ss); <a name="l00171"></a>00171 <a name="l00178"></a>00178 <a class="code" href="db__base_8h.html#a61ead10400f658a22128a321e14ae0ac">db_base_sptr</a> <a class="code" href="classusrp__basic.html#a648de1479d7632b59bf2732f231ddbe0" title="given a subdev_spec, return the corresponding daughterboard object.">selected_subdev</a>(<span class="keyword">const</span> <a class="code" href="structusrp__subdev__spec.html" title="specify a daughterboard and subdevice on a daughterboard.">usrp_subdev_spec</a> &ss); <a name="l00179"></a>00179 <a name="l00183"></a><a class="code" href="classusrp__basic.html#a244d4aa01bb6a054cd5bd0998ce2a09a">00183</a> <span class="keywordtype">long</span> <a class="code" href="classusrp__basic.html#a244d4aa01bb6a054cd5bd0998ce2a09a" title="return frequency of master oscillator on USRP">fpga_master_clock_freq</a> ()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classusrp__basic.html#afa81d2ee842dd6eef04c422276f52d1d">d_fpga_master_clock_freq</a>; } <a name="l00184"></a>00184 <a name="l00192"></a><a class="code" href="classusrp__basic.html#a825640d1de15253b5bae18762a0e403e">00192</a> <span class="keywordtype">void</span> <a class="code" href="classusrp__basic.html#a825640d1de15253b5bae18762a0e403e">set_fpga_master_clock_freq</a> (<span class="keywordtype">long</span> master_clock) { <a class="code" href="classusrp__basic.html#afa81d2ee842dd6eef04c422276f52d1d">d_fpga_master_clock_freq</a> = master_clock; } <a name="l00193"></a>00193 <a name="l00197"></a><a class="code" href="classusrp__basic.html#a530c23ff633c630530ec491c368a755d">00197</a> <span class="keywordtype">int</span> <a class="code" href="classusrp__basic.html#a530c23ff633c630530ec491c368a755d">usb_data_rate</a> ()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classusrp__basic.html#a4e5297f0010c8f39cfe4fff838b113a4">d_usb_data_rate</a>; } <a name="l00198"></a>00198 <a name="l00199"></a><a class="code" href="classusrp__basic.html#ae200e6eb7dbbaf81a3c1353a401f97d3">00199</a> <span class="keywordtype">void</span> <a class="code" href="classusrp__basic.html#ae200e6eb7dbbaf81a3c1353a401f97d3">set_verbose</a> (<span class="keywordtype">bool</span> on) { <a class="code" href="classusrp__basic.html#a6d0fecbe64f35fef20293c27dc33a0b0">d_verbose</a> = on; } <a name="l00200"></a>00200 <a name="l00202"></a><a class="code" href="classusrp__basic.html#a364d3e56a0749a90cc5de2ac378e6863">00202</a> <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code" href="classusrp__basic.html#a364d3e56a0749a90cc5de2ac378e6863" title="magic value used on alternate register read interfaces">READ_FAILED</a> = -99999; <a name="l00203"></a>00203 <a name="l00211"></a>00211 <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic.html#a3900d37e951b83c938669f5fa0255866" title="Write EEPROM on motherboard or any daughterboard.">write_eeprom</a> (<span class="keywordtype">int</span> i2c_addr, <span class="keywordtype">int</span> eeprom_offset, <span class="keyword">const</span> std::string buf); <a name="l00212"></a>00212 <a name="l00220"></a>00220 std::string <a class="code" href="classusrp__basic.html#aefe7a2f10626831304091babff21dc0d" title="Read EEPROM on motherboard or any daughterboard.">read_eeprom</a> (<span class="keywordtype">int</span> i2c_addr, <span class="keywordtype">int</span> eeprom_offset, <span class="keywordtype">int</span> len); <a name="l00221"></a>00221 <a name="l00229"></a>00229 <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic.html#a664e5aa3a3fb8a4c50b752906fcb79a0" title="Write to I2C peripheral.">write_i2c</a> (<span class="keywordtype">int</span> i2c_addr, <span class="keyword">const</span> std::string buf); <a name="l00230"></a>00230 <a name="l00238"></a>00238 std::string <a class="code" href="classusrp__basic.html#ab284caa2e15464f62aa80ad1f540ecc5" title="Read from I2C peripheral.">read_i2c</a> (<span class="keywordtype">int</span> i2c_addr, <span class="keywordtype">int</span> len); <a name="l00239"></a>00239 <a name="l00245"></a>00245 <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic.html#ad0e07c8d85aa220aaf150e27dd8b545f" title="Set ADC offset correction.">set_adc_offset</a> (<span class="keywordtype">int</span> which_adc, <span class="keywordtype">int</span> offset); <a name="l00246"></a>00246 <a name="l00254"></a>00254 <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic.html#ab18f4a02c0efcac10f8e9406ca7a57a7" title="Set DAC offset correction.">set_dac_offset</a> (<span class="keywordtype">int</span> which_dac, <span class="keywordtype">int</span> offset, <span class="keywordtype">int</span> offset_pin); <a name="l00255"></a>00255 <a name="l00262"></a>00262 <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic.html#a97fc801cbafa85040a3d39be03d27a62" title="Control ADC input buffer.">set_adc_buffer_bypass</a> (<span class="keywordtype">int</span> which_adc, <span class="keywordtype">bool</span> bypass); <a name="l00263"></a>00263 <a name="l00284"></a>00284 <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic.html#af20cc324fca8d089226d5a6dfc3d3668" title="Enable/disable automatic DC offset removal control loop in FPGA.">set_dc_offset_cl_enable</a>(<span class="keywordtype">int</span> bits, <span class="keywordtype">int</span> mask); <a name="l00285"></a>00285 <a name="l00291"></a>00291 std::string <a class="code" href="classusrp__basic.html#a70a71308412a67eaf825c13399faa078" title="return the usrp&#39;s serial number.">serial_number</a>(); <a name="l00292"></a>00292 <a name="l00302"></a>00302 <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="classusrp__basic.html#a6d639e50633c165b23e0c4770b26bec2" title="Return daughterboard ID for given side [0,1].">daughterboard_id</a> (<span class="keywordtype">int</span> which_side) <span class="keyword">const</span> = 0; <a name="l00303"></a>00303 <a name="l00308"></a>00308 <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic.html#a70f4070830b0db3fd0c3addb97ce966e" title="Clock ticks to delay rising of T/R signal.">write_atr_tx_delay</a>(<span class="keywordtype">int</span> value); <a name="l00309"></a>00309 <a name="l00314"></a>00314 <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic.html#ad9b95b1ca0e2616c1b3808892fdda1b0" title="Clock ticks to delay falling edge of T/R signal.">write_atr_rx_delay</a>(<span class="keywordtype">int</span> value); <a name="l00315"></a>00315 <a name="l00316"></a>00316 <a name="l00317"></a>00317 <span class="comment">// ================================================================</span> <a name="l00318"></a>00318 <span class="comment">// Routines to access and control daughterboard specific i/o</span> <a name="l00319"></a>00319 <span class="comment">//</span> <a name="l00320"></a>00320 <span class="comment">// Those with a common_ prefix access either the Tx or Rx side depending</span> <a name="l00321"></a>00321 <span class="comment">// on the txrx parameter. Those without the common_ prefix are virtual</span> <a name="l00322"></a>00322 <span class="comment">// and are overriden in usrp_basic_rx and usrp_basic_tx to access the</span> <a name="l00323"></a>00323 <span class="comment">// the Rx or Tx sides automatically. We provide the common_ versions</span> <a name="l00324"></a>00324 <span class="comment">// for those daughterboards such as the WBX and XCVR2450 that share</span> <a name="l00325"></a>00325 <span class="comment">// h/w resources (such as the LO) between the Tx and Rx sides.</span> <a name="l00326"></a>00326 <a name="l00327"></a>00327 <span class="comment">// ----------------------------------------------------------------</span> <a name="l00328"></a>00328 <span class="comment">// BEGIN common_ daughterboard control functions</span> <a name="l00329"></a>00329 <a name="l00343"></a>00343 <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic.html#a52f96a90c91ed6e74bfc6a91691a7fa2" title="Set Programmable Gain Amplifier(PGA).">common_set_pga</a>(<a class="code" href="usrp__basic_8h.html#a62f19b5a3751ce085242fa46f8761f71">txrx_t</a> txrx, <span class="keywordtype">int</span> which_amp, <span class="keywordtype">double</span> gain_in_db); <a name="l00344"></a>00344 <a name="l00351"></a>00351 <span class="keywordtype">double</span> <a class="code" href="classusrp__basic.html#ac25d56e74572309a87397f0fce1a102b" title="Return programmable gain amplifier gain setting in dB.">common_pga</a>(<a class="code" href="usrp__basic_8h.html#a62f19b5a3751ce085242fa46f8761f71">txrx_t</a> txrx, <span class="keywordtype">int</span> which_amp) <span class="keyword">const</span>; <a name="l00352"></a>00352 <a name="l00357"></a>00357 <span class="keywordtype">double</span> <a class="code" href="classusrp__basic.html#a95453e5bb4d0ed4c05b1ea64c880170a" title="Return minimum legal PGA gain in dB.">common_pga_min</a>(<a class="code" href="usrp__basic_8h.html#a62f19b5a3751ce085242fa46f8761f71">txrx_t</a> txrx) <span class="keyword">const</span>; <a name="l00358"></a>00358 <a name="l00363"></a>00363 <span class="keywordtype">double</span> <a class="code" href="classusrp__basic.html#a7dd5c384b9d2cd4e412939c3b7b7ac79" title="Return maximum legal PGA gain in dB.">common_pga_max</a>(<a class="code" href="usrp__basic_8h.html#a62f19b5a3751ce085242fa46f8761f71">txrx_t</a> txrx) <span class="keyword">const</span>; <a name="l00364"></a>00364 <a name="l00369"></a>00369 <span class="keywordtype">double</span> <a class="code" href="classusrp__basic.html#a06cfd0e5675618f773c5466bd235a369" title="Return hardware step size of PGA(linear in dB).">common_pga_db_per_step</a>(<a class="code" href="usrp__basic_8h.html#a62f19b5a3751ce085242fa46f8761f71">txrx_t</a> txrx) <span class="keyword">const</span>; <a name="l00370"></a>00370 <a name="l00387"></a>00387 <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic.html#a09ce78134eea035e42464123356096e4" title="Write direction register(output enables) for pins that go to daughterboard.">_common_write_oe</a>(<a class="code" href="usrp__basic_8h.html#a62f19b5a3751ce085242fa46f8761f71">txrx_t</a> txrx, <span class="keywordtype">int</span> which_side, <span class="keywordtype">int</span> value, <span class="keywordtype">int</span> mask); <a name="l00388"></a>00388 <a name="l00397"></a>00397 <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic.html#acf3120592af4df79d38d253c98c633ae" title="Write daughterboard i/o pin value.">common_write_io</a>(<a class="code" href="usrp__basic_8h.html#a62f19b5a3751ce085242fa46f8761f71">txrx_t</a> txrx, <span class="keywordtype">int</span> which_side, <span class="keywordtype">int</span> value, <span class="keywordtype">int</span> mask); <a name="l00398"></a>00398 <a name="l00406"></a>00406 <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic.html#af7e33b5762cd9c80a714806fa6fa2244" title="Read daughterboard i/o pin value.">common_read_io</a>(<a class="code" href="usrp__basic_8h.html#a62f19b5a3751ce085242fa46f8761f71">txrx_t</a> txrx, <span class="keywordtype">int</span> which_side, <span class="keywordtype">int</span> *value); <a name="l00407"></a>00407 <a name="l00415"></a>00415 <span class="keywordtype">int</span> <a class="code" href="classusrp__basic.html#af7e33b5762cd9c80a714806fa6fa2244" title="Read daughterboard i/o pin value.">common_read_io</a>(<a class="code" href="usrp__basic_8h.html#a62f19b5a3751ce085242fa46f8761f71">txrx_t</a> txrx, <span class="keywordtype">int</span> which_side); <a name="l00416"></a>00416 <a name="l00438"></a>00438 <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic.html#ad673bc49b311e29ab01727c5933ea028" title="Write daughterboard refclk config register.">common_write_refclk</a>(<a class="code" href="usrp__basic_8h.html#a62f19b5a3751ce085242fa46f8761f71">txrx_t</a> txrx, <span class="keywordtype">int</span> which_side, <span class="keywordtype">int</span> value); <a name="l00439"></a>00439 <a name="l00468"></a>00468 <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic.html#a0997e93568c71e5432c2445b1ebcc991" title="Automatic Transmit/Receive switching.">common_write_atr_mask</a>(<a class="code" href="usrp__basic_8h.html#a62f19b5a3751ce085242fa46f8761f71">txrx_t</a> txrx, <span class="keywordtype">int</span> which_side, <span class="keywordtype">int</span> value); <a name="l00469"></a>00469 <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic.html#a26e38a0f9f98390b712709812e3387af">common_write_atr_txval</a>(<a class="code" href="usrp__basic_8h.html#a62f19b5a3751ce085242fa46f8761f71">txrx_t</a> txrx, <span class="keywordtype">int</span> which_side, <span class="keywordtype">int</span> value); <a name="l00470"></a>00470 <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic.html#a89eda6a96bc7f4d2d634da793eccbc20">common_write_atr_rxval</a>(<a class="code" href="usrp__basic_8h.html#a62f19b5a3751ce085242fa46f8761f71">txrx_t</a> txrx, <span class="keywordtype">int</span> which_side, <span class="keywordtype">int</span> value); <a name="l00471"></a>00471 <a name="l00483"></a>00483 <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic.html#ac7354a9c4f7e961cb1b541c970a8d009" title="Write auxiliary digital to analog converter.">common_write_aux_dac</a>(<a class="code" href="usrp__basic_8h.html#a62f19b5a3751ce085242fa46f8761f71">txrx_t</a> txrx, <span class="keywordtype">int</span> which_side, <span class="keywordtype">int</span> which_dac, <span class="keywordtype">int</span> value); <a name="l00484"></a>00484 <a name="l00494"></a>00494 <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic.html#a37bd03473a98cf3776f1988914c1a5ce" title="Read auxiliary analog to digital converter.">common_read_aux_adc</a>(<a class="code" href="usrp__basic_8h.html#a62f19b5a3751ce085242fa46f8761f71">txrx_t</a> txrx, <span class="keywordtype">int</span> which_side, <span class="keywordtype">int</span> which_adc, <span class="keywordtype">int</span> *value); <a name="l00495"></a>00495 <a name="l00504"></a>00504 <span class="keywordtype">int</span> <a class="code" href="classusrp__basic.html#a37bd03473a98cf3776f1988914c1a5ce" title="Read auxiliary analog to digital converter.">common_read_aux_adc</a>(<a class="code" href="usrp__basic_8h.html#a62f19b5a3751ce085242fa46f8761f71">txrx_t</a> txrx, <span class="keywordtype">int</span> which_side, <span class="keywordtype">int</span> which_adc); <a name="l00505"></a>00505 <a name="l00506"></a>00506 <span class="comment">// END common_ daughterboard control functions</span> <a name="l00507"></a>00507 <span class="comment">// ----------------------------------------------------------------</span> <a name="l00508"></a>00508 <span class="comment">// BEGIN virtual daughterboard control functions</span> <a name="l00509"></a>00509 <a name="l00522"></a>00522 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic.html#afdcf0497f2554589b36a57806e239a07" title="Set Programmable Gain Amplifier (PGA).">set_pga</a> (<span class="keywordtype">int</span> which_amp, <span class="keywordtype">double</span> gain_in_db) = 0; <a name="l00523"></a>00523 <a name="l00529"></a>00529 <span class="keyword">virtual</span> <span class="keywordtype">double</span> <a class="code" href="classusrp__basic.html#a731389d216c7232020041f7cecd3d581" title="Return programmable gain amplifier gain setting in dB.">pga</a> (<span class="keywordtype">int</span> which_amp) <span class="keyword">const</span> = 0; <a name="l00530"></a>00530 <a name="l00534"></a>00534 <span class="keyword">virtual</span> <span class="keywordtype">double</span> <a class="code" href="classusrp__basic.html#afcab635a411c57f16820e44a83bfe259" title="Return minimum legal PGA gain in dB.">pga_min</a> () <span class="keyword">const</span> = 0; <a name="l00535"></a>00535 <a name="l00539"></a>00539 <span class="keyword">virtual</span> <span class="keywordtype">double</span> <a class="code" href="classusrp__basic.html#ae6a0027c59862dcc2d4da73d50b6a598" title="Return maximum legal PGA gain in dB.">pga_max</a> () <span class="keyword">const</span> = 0; <a name="l00540"></a>00540 <a name="l00544"></a>00544 <span class="keyword">virtual</span> <span class="keywordtype">double</span> <a class="code" href="classusrp__basic.html#ae67abb570f10f1216c001f2409fe3331" title="Return hardware step size of PGA (linear in dB).">pga_db_per_step</a> () <span class="keyword">const</span> = 0; <a name="l00545"></a>00545 <a name="l00561"></a>00561 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic.html#ac540c04b719f1ce30426ecb2214107ef" title="Write direction register (output enables) for pins that go to daughterboard.">_write_oe</a> (<span class="keywordtype">int</span> which_side, <span class="keywordtype">int</span> value, <span class="keywordtype">int</span> mask) = 0; <a name="l00562"></a>00562 <a name="l00570"></a>00570 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic.html#a75aca6cca672ac2deedf14fb2c04ab0e" title="Write daughterboard i/o pin value.">write_io</a> (<span class="keywordtype">int</span> which_side, <span class="keywordtype">int</span> value, <span class="keywordtype">int</span> mask) = 0; <a name="l00571"></a>00571 <a name="l00578"></a>00578 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic.html#ad443caee9815e7c69a8b39a29cf8846a" title="Read daughterboard i/o pin value.">read_io</a> (<span class="keywordtype">int</span> which_side, <span class="keywordtype">int</span> *value) = 0; <a name="l00579"></a>00579 <a name="l00586"></a>00586 <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="classusrp__basic.html#ad443caee9815e7c69a8b39a29cf8846a" title="Read daughterboard i/o pin value.">read_io</a> (<span class="keywordtype">int</span> which_side) = 0; <a name="l00587"></a>00587 <a name="l00608"></a>00608 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic.html#a80a4f8800742b6b06ec6f1908a448fc8" title="Write daughterboard refclk config register.">write_refclk</a>(<span class="keywordtype">int</span> which_side, <span class="keywordtype">int</span> value) = 0; <a name="l00609"></a>00609 <a name="l00610"></a>00610 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic.html#a49074783b3757b6af17ddf8e8f56be6c">write_atr_mask</a>(<span class="keywordtype">int</span> which_side, <span class="keywordtype">int</span> value) = 0; <a name="l00611"></a>00611 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic.html#a504bf45d241c56ddf00ee07fc946207e">write_atr_txval</a>(<span class="keywordtype">int</span> which_side, <span class="keywordtype">int</span> value) = 0; <a name="l00612"></a>00612 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic.html#ae5466590dd7ec5646fefbb82d92ad899">write_atr_rxval</a>(<span class="keywordtype">int</span> which_side, <span class="keywordtype">int</span> value) = 0; <a name="l00613"></a>00613 <a name="l00624"></a>00624 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic.html#a332790fa84b6b64f82de8983b45b611a" title="Write auxiliary digital to analog converter.">write_aux_dac</a> (<span class="keywordtype">int</span> which_side, <span class="keywordtype">int</span> which_dac, <span class="keywordtype">int</span> value) = 0; <a name="l00625"></a>00625 <a name="l00634"></a>00634 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic.html#a7e90fb51366e9d6a8f2c844dbca2798a" title="Read auxiliary analog to digital converter.">read_aux_adc</a> (<span class="keywordtype">int</span> which_side, <span class="keywordtype">int</span> which_adc, <span class="keywordtype">int</span> *value) = 0; <a name="l00635"></a>00635 <a name="l00643"></a>00643 <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="classusrp__basic.html#a7e90fb51366e9d6a8f2c844dbca2798a" title="Read auxiliary analog to digital converter.">read_aux_adc</a> (<span class="keywordtype">int</span> which_side, <span class="keywordtype">int</span> which_adc) = 0; <a name="l00644"></a>00644 <a name="l00648"></a>00648 <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="classusrp__basic.html#a1f769dc9ea28d701fa2f7da2be82325d" title="returns current fusb block size">block_size</a>() <span class="keyword">const</span> = 0; <a name="l00649"></a>00649 <a name="l00653"></a>00653 <span class="keyword">virtual</span> <span class="keywordtype">long</span> <a class="code" href="classusrp__basic.html#a551a0912d265427e595ba826858cf3d0" title="returns A/D or D/A converter rate in Hz">converter_rate</a>() <span class="keyword">const</span> = 0; <a name="l00654"></a>00654 <a name="l00655"></a>00655 <span class="comment">// END virtual daughterboard control functions</span> <a name="l00656"></a>00656 <a name="l00657"></a>00657 <span class="comment">// ----------------------------------------------------------------</span> <a name="l00658"></a>00658 <span class="comment">// Low level implementation routines.</span> <a name="l00659"></a>00659 <span class="comment">// You probably shouldn't be using these...</span> <a name="l00660"></a>00660 <span class="comment">//</span> <a name="l00661"></a>00661 <a name="l00662"></a>00662 <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic.html#a4585f9c7df7084a6acb29bd6d7950892">_set_led</a> (<span class="keywordtype">int</span> which_led, <span class="keywordtype">bool</span> on); <a name="l00663"></a>00663 <a name="l00670"></a>00670 <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic.html#ac5bdb9be69f27eb3a0530cba9536d0f4" title="Write FPGA register.">_write_fpga_reg</a> (<span class="keywordtype">int</span> regno, <span class="keywordtype">int</span> value); <span class="comment">//< 7-bit regno, 32-bit value</span> <a name="l00671"></a>00671 <a name="l00678"></a>00678 <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic.html#a4fa26bd8164bd5782adf7fbe00b3d411" title="Read FPGA register.">_read_fpga_reg</a> (<span class="keywordtype">int</span> regno, <span class="keywordtype">int</span> *value); <span class="comment">//< 7-bit regno, 32-bit value</span> <a name="l00679"></a>00679 <a name="l00685"></a>00685 <span class="keywordtype">int</span> <a class="code" href="classusrp__basic.html#a4fa26bd8164bd5782adf7fbe00b3d411" title="Read FPGA register.">_read_fpga_reg</a> (<span class="keywordtype">int</span> regno); <a name="l00686"></a>00686 <a name="l00695"></a>00695 <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic.html#a0c200dc2d39d68d7a77e92859c5228a0" title="Write FPGA register with mask.">_write_fpga_reg_masked</a> (<span class="keywordtype">int</span> regno, <span class="keywordtype">int</span> value, <span class="keywordtype">int</span> mask); <a name="l00696"></a>00696 <a name="l00704"></a>00704 <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic.html#a8a25444c83f59f7517d0ff687d2ff053" title="Write AD9862 register.">_write_9862</a> (<span class="keywordtype">int</span> which_codec, <span class="keywordtype">int</span> regno, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> value); <a name="l00705"></a>00705 <a name="l00713"></a>00713 <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic.html#a3814dc28edce07e3b5cb48bb3ebdf244" title="Read AD9862 register.">_read_9862</a> (<span class="keywordtype">int</span> which_codec, <span class="keywordtype">int</span> regno, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *value) <span class="keyword">const</span>; <a name="l00714"></a>00714 <a name="l00721"></a>00721 <span class="keywordtype">int</span> <a class="code" href="classusrp__basic.html#a3814dc28edce07e3b5cb48bb3ebdf244" title="Read AD9862 register.">_read_9862</a> (<span class="keywordtype">int</span> which_codec, <span class="keywordtype">int</span> regno) <span class="keyword">const</span>; <a name="l00722"></a>00722 <a name="l00736"></a>00736 <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic.html#aaf100fafc406ef75faafcf3e38df7849" title="Write data to SPI bus peripheral.">_write_spi</a> (<span class="keywordtype">int</span> optional_header, <span class="keywordtype">int</span> enables, <span class="keywordtype">int</span> format, std::string buf); <a name="l00737"></a>00737 <a name="l00738"></a>00738 <span class="comment">/*</span> <a name="l00739"></a>00739 <span class="comment"> * \brief Read data from SPI bus peripheral.</span> <a name="l00740"></a>00740 <span class="comment"> *</span> <a name="l00741"></a>00741 <span class="comment"> * \param optional_header 0,1 or 2 bytes to write before buf.</span> <a name="l00742"></a>00742 <span class="comment"> * \param enables bitmask of peripheral to read. See usrp_spi_defs.h</span> <a name="l00743"></a>00743 <span class="comment"> * \param format transaction format. See usrp_spi_defs.h SPI_FMT_*</span> <a name="l00744"></a>00744 <span class="comment"> * \param len number of bytes to read. Must be in [0,64].</span> <a name="l00745"></a>00745 <span class="comment"> * \returns the data read if sucessful, else a zero length string.</span> <a name="l00746"></a>00746 <span class="comment"> *</span> <a name="l00747"></a>00747 <span class="comment"> * Reads are limited to a maximum of 64 bytes.</span> <a name="l00748"></a>00748 <span class="comment"> *</span> <a name="l00749"></a>00749 <span class="comment"> * If \p format specifies that optional_header bytes are present, they</span> <a name="l00750"></a>00750 <span class="comment"> * are written to the peripheral first. Then \p len bytes are read from</span> <a name="l00751"></a>00751 <span class="comment"> * the peripheral and returned.</span> <a name="l00752"></a>00752 <span class="comment"> */</span> <a name="l00753"></a>00753 std::string <a class="code" href="classusrp__basic.html#a9b54622fec87c2ed9c7808078931371f">_read_spi</a> (<span class="keywordtype">int</span> optional_header, <span class="keywordtype">int</span> enables, <span class="keywordtype">int</span> format, <span class="keywordtype">int</span> len); <a name="l00754"></a>00754 <a name="l00759"></a>00759 <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic.html#a4291ecf3cc0870baaa12644143182db4" title="Start data transfers. Called in base class to derived class order.">start</a> (); <a name="l00760"></a>00760 <a name="l00765"></a>00765 <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic.html#a69292bbc3b47b5ca85d4c0404dc4a58a" title="Stop data transfers. Called in base class to derived class order.">stop</a> (); <a name="l00766"></a>00766 }; <a name="l00767"></a>00767 <a name="l00768"></a>00768 <a name="l00772"></a><a class="code" href="classusrp__basic__rx.html">00772</a> <span class="keyword">class </span><a class="code" href="classusrp__basic__rx.html" title="class for accessing the receive side of the USRP">usrp_basic_rx</a> : <span class="keyword">public</span> <a class="code" href="classusrp__basic.html" title="abstract base class for usrp operations">usrp_basic</a> <a name="l00773"></a>00773 { <a name="l00774"></a>00774 <span class="keyword">private</span>: <a name="l00775"></a>00775 <a class="code" href="classfusb__devhandle.html" title="abstract usb device handle">fusb_devhandle</a> *d_devhandle; <a name="l00776"></a>00776 <a class="code" href="classfusb__ephandle.html" title="abstract usb end point handle">fusb_ephandle</a> *d_ephandle; <a name="l00777"></a>00777 <span class="keywordtype">int</span> d_bytes_seen; <span class="comment">// how many bytes we've seen</span> <a name="l00778"></a>00778 <span class="keywordtype">bool</span> d_first_read; <a name="l00779"></a>00779 <span class="keywordtype">bool</span> d_rx_enable; <a name="l00780"></a>00780 <a name="l00781"></a>00781 <span class="keyword">protected</span>: <a name="l00790"></a>00790 <a class="code" href="classusrp__basic__rx.html#acbda9587edf161df5aa2c504e42096ff">usrp_basic_rx</a> (<span class="keywordtype">int</span> which_board, <a name="l00791"></a>00791 <span class="keywordtype">int</span> fusb_block_size=0, <a name="l00792"></a>00792 <span class="keywordtype">int</span> fusb_nblocks=0, <a name="l00793"></a>00793 <span class="keyword">const</span> std::string fpga_filename = <span class="stringliteral">""</span>, <a name="l00794"></a>00794 <span class="keyword">const</span> std::string firmware_filename = <span class="stringliteral">""</span> <a name="l00795"></a>00795 ); <span class="comment">// throws if trouble</span> <a name="l00796"></a>00796 <a name="l00797"></a>00797 <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic__rx.html#a14fa02bdeea1bc11d5611b879dae5405">set_rx_enable</a> (<span class="keywordtype">bool</span> on); <a name="l00798"></a><a class="code" href="classusrp__basic__rx.html#aa25e7e0e84ec50bd8689889401480f84">00798</a> <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic__rx.html#aa25e7e0e84ec50bd8689889401480f84">rx_enable</a> ()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> d_rx_enable; } <a name="l00799"></a>00799 <a name="l00800"></a>00800 <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic__rx.html#aec8c94d230440bb38951e9718755b994">disable_rx</a> (); <span class="comment">// conditional disable, return prev state</span> <a name="l00801"></a>00801 <span class="keywordtype">void</span> <a class="code" href="classusrp__basic__rx.html#a15a44f86a1a019e94d18f3c19b4cd34a">restore_rx</a> (<span class="keywordtype">bool</span> on); <span class="comment">// conditional set</span> <a name="l00802"></a>00802 <a name="l00803"></a>00803 <span class="keywordtype">void</span> <a class="code" href="classusrp__basic__rx.html#a9edf0c0a2aeab58f7f12483a02dd14ee">probe_rx_slots</a> (<span class="keywordtype">bool</span> verbose); <a name="l00804"></a>00804 <a name="l00805"></a>00805 <span class="keyword">public</span>: <a name="l00806"></a>00806 <a class="code" href="classusrp__basic__rx.html#ae50eef2481209ecaa7eb73bfd0cb513d">~usrp_basic_rx</a> (); <a name="l00807"></a>00807 <a name="l00818"></a>00818 <span class="keyword">static</span> <a class="code" href="classusrp__basic__rx.html" title="class for accessing the receive side of the USRP">usrp_basic_rx</a> *<a class="code" href="classusrp__basic__rx.html#a81f51a370ce934e853969e487e2214df" title="invokes constructor, returns instance or 0 if trouble">make</a> (<span class="keywordtype">int</span> which_board, <a name="l00819"></a>00819 <span class="keywordtype">int</span> fusb_block_size=0, <a name="l00820"></a>00820 <span class="keywordtype">int</span> fusb_nblocks=0, <a name="l00821"></a>00821 <span class="keyword">const</span> std::string fpga_filename = <span class="stringliteral">""</span>, <a name="l00822"></a>00822 <span class="keyword">const</span> std::string firmware_filename = <span class="stringliteral">""</span> <a name="l00823"></a>00823 ); <a name="l00824"></a>00824 <a name="l00834"></a>00834 <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic__rx.html#aba133cd0d5c853a51beb96776e7030fc" title="tell the fpga the rate rx samples are coming from the A/D&#39;s">set_fpga_rx_sample_rate_divisor</a> (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> div); <a name="l00835"></a>00835 <a name="l00844"></a>00844 <span class="keywordtype">int</span> <a class="code" href="classusrp__basic__rx.html#ac339662f98db1292b636baf9f2db3d0a" title="read data from the D/A&#39;s via the FPGA. len must be a multiple of 512 bytes.">read</a> (<span class="keywordtype">void</span> *buf, <span class="keywordtype">int</span> len, <span class="keywordtype">bool</span> *overrun); <a name="l00845"></a>00845 <a name="l00846"></a>00846 <a name="l00848"></a><a class="code" href="classusrp__basic__rx.html#afd14b376f2449cfb71865c9980ea2358">00848</a> <span class="keyword">virtual</span> <span class="keywordtype">long</span> <a class="code" href="classusrp__basic__rx.html#afd14b376f2449cfb71865c9980ea2358" title="sampling rate of A/D converter">converter_rate</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classusrp__basic.html#a244d4aa01bb6a054cd5bd0998ce2a09a" title="return frequency of master oscillator on USRP">fpga_master_clock_freq</a>(); } <span class="comment">// 64M</span> <a name="l00849"></a><a class="code" href="classusrp__basic__rx.html#ace4aa6537246ecf948ec0ae35e1d6e48">00849</a> <span class="keywordtype">long</span> <a class="code" href="classusrp__basic__rx.html#ace4aa6537246ecf948ec0ae35e1d6e48">adc_rate</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classusrp__basic__rx.html#afd14b376f2449cfb71865c9980ea2358" title="sampling rate of A/D converter">converter_rate</a>(); } <a name="l00850"></a><a class="code" href="classusrp__basic__rx.html#a34128f4864ece7fafc011786c42b9994">00850</a> <span class="keywordtype">int</span> <a class="code" href="classusrp__basic__rx.html#a34128f4864ece7fafc011786c42b9994" title="Return daughterboard ID for given side [0,1].">daughterboard_id</a> (<span class="keywordtype">int</span> which_side)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classusrp__basic.html#a686ea66e3f43c9ab6df60bd80f41ac3b">d_dbid</a>[which_side & 0x1]; } <a name="l00851"></a>00851 <a name="l00852"></a>00852 <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic__rx.html#a85804ff6612a34c800a7181ea90de6b4" title="Set Programmable Gain Amplifier (PGA).">set_pga</a> (<span class="keywordtype">int</span> which_amp, <span class="keywordtype">double</span> gain_in_db); <a name="l00853"></a>00853 <span class="keywordtype">double</span> <a class="code" href="classusrp__basic__rx.html#a982d36d1f8d64a5bb2604cf04caa22d4" title="Return programmable gain amplifier gain setting in dB.">pga</a> (<span class="keywordtype">int</span> which_amp) <span class="keyword">const</span>; <a name="l00854"></a>00854 <span class="keywordtype">double</span> <a class="code" href="classusrp__basic__rx.html#a984a57196c26958e2927667ab3abe4cf" title="Return minimum legal PGA gain in dB.">pga_min</a> () <span class="keyword">const</span>; <a name="l00855"></a>00855 <span class="keywordtype">double</span> <a class="code" href="classusrp__basic__rx.html#a2089bd929d76f28a620fc66726b525f4" title="Return maximum legal PGA gain in dB.">pga_max</a> () <span class="keyword">const</span>; <a name="l00856"></a>00856 <span class="keywordtype">double</span> <a class="code" href="classusrp__basic__rx.html#a7c570ad5c2cb879f1b9f2073117ecf51" title="Return hardware step size of PGA (linear in dB).">pga_db_per_step</a> () <span class="keyword">const</span>; <a name="l00857"></a>00857 <a name="l00858"></a>00858 <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic__rx.html#a83f39a101787d86a0850e72499286c00" title="Write direction register (output enables) for pins that go to daughterboard.">_write_oe</a> (<span class="keywordtype">int</span> which_side, <span class="keywordtype">int</span> value, <span class="keywordtype">int</span> mask); <a name="l00859"></a>00859 <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic__rx.html#a5ab1edec410f1d5399c187cb243905a5" title="Write daughterboard i/o pin value.">write_io</a> (<span class="keywordtype">int</span> which_side, <span class="keywordtype">int</span> value, <span class="keywordtype">int</span> mask); <a name="l00860"></a>00860 <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic__rx.html#a275d14df1506faa570fd5cc231a14ee9" title="Read daughterboard i/o pin value.">read_io</a> (<span class="keywordtype">int</span> which_side, <span class="keywordtype">int</span> *value); <a name="l00861"></a>00861 <span class="keywordtype">int</span> <a class="code" href="classusrp__basic__rx.html#a275d14df1506faa570fd5cc231a14ee9" title="Read daughterboard i/o pin value.">read_io</a> (<span class="keywordtype">int</span> which_side); <a name="l00862"></a>00862 <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic__rx.html#ac6c7387f1bf488ee22c79be22e3f48dd" title="Write daughterboard refclk config register.">write_refclk</a>(<span class="keywordtype">int</span> which_side, <span class="keywordtype">int</span> value); <a name="l00863"></a>00863 <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic__rx.html#a0974bedf9b0406709e83e839f40e2b36">write_atr_mask</a>(<span class="keywordtype">int</span> which_side, <span class="keywordtype">int</span> value); <a name="l00864"></a>00864 <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic__rx.html#a914e9b61a4b1441dc955b1dc9cd17742">write_atr_txval</a>(<span class="keywordtype">int</span> which_side, <span class="keywordtype">int</span> value); <a name="l00865"></a>00865 <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic__rx.html#a7cb8b45ce6815d3ee3c97a064a63e9ee">write_atr_rxval</a>(<span class="keywordtype">int</span> which_side, <span class="keywordtype">int</span> value); <a name="l00866"></a>00866 <a name="l00867"></a>00867 <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic__rx.html#ae5cbeedfd6df52cdc4b13c87e2521b97" title="Write auxiliary digital to analog converter.">write_aux_dac</a> (<span class="keywordtype">int</span> which_side, <span class="keywordtype">int</span> which_dac, <span class="keywordtype">int</span> value); <a name="l00868"></a>00868 <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic__rx.html#acffe1b022ad3ba669ab2131896ebafbf" title="Read auxiliary analog to digital converter.">read_aux_adc</a> (<span class="keywordtype">int</span> which_side, <span class="keywordtype">int</span> which_adc, <span class="keywordtype">int</span> *value); <a name="l00869"></a>00869 <span class="keywordtype">int</span> <a class="code" href="classusrp__basic__rx.html#acffe1b022ad3ba669ab2131896ebafbf" title="Read auxiliary analog to digital converter.">read_aux_adc</a> (<span class="keywordtype">int</span> which_side, <span class="keywordtype">int</span> which_adc); <a name="l00870"></a>00870 <a name="l00871"></a>00871 <span class="keywordtype">int</span> <a class="code" href="classusrp__basic__rx.html#ab42bca6a45be1e18e074b494905db7db" title="returns current fusb block size">block_size</a>() <span class="keyword">const</span>; <a name="l00872"></a>00872 <a name="l00873"></a>00873 <span class="comment">// called in base class to derived class order</span> <a name="l00874"></a>00874 <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic__rx.html#a6097b0d8b2cac9a67237368d1a81b7f4" title="Start data transfers. Called in base class to derived class order.">start</a> (); <a name="l00875"></a>00875 <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic__rx.html#a094cb05d34da15711c6ca5c4b24defe9" title="Stop data transfers. Called in base class to derived class order.">stop</a> (); <a name="l00876"></a>00876 }; <a name="l00877"></a>00877 <a name="l00878"></a>00878 <a name="l00882"></a><a class="code" href="classusrp__basic__tx.html">00882</a> <span class="keyword">class </span><a class="code" href="classusrp__basic__tx.html" title="class for accessing the transmit side of the USRP">usrp_basic_tx</a> : <span class="keyword">public</span> <a class="code" href="classusrp__basic.html" title="abstract base class for usrp operations">usrp_basic</a> <a name="l00883"></a>00883 { <a name="l00884"></a>00884 <span class="keyword">private</span>: <a name="l00885"></a>00885 <a class="code" href="classfusb__devhandle.html" title="abstract usb device handle">fusb_devhandle</a> *d_devhandle; <a name="l00886"></a>00886 <a class="code" href="classfusb__ephandle.html" title="abstract usb end point handle">fusb_ephandle</a> *d_ephandle; <a name="l00887"></a>00887 <span class="keywordtype">int</span> d_bytes_seen; <span class="comment">// how many bytes we've seen</span> <a name="l00888"></a>00888 <span class="keywordtype">bool</span> d_first_write; <a name="l00889"></a>00889 <span class="keywordtype">bool</span> d_tx_enable; <a name="l00890"></a>00890 <a name="l00891"></a>00891 <span class="keyword">protected</span>: <a name="l00900"></a>00900 <a class="code" href="classusrp__basic__tx.html#ab8bb942f1c956624553ac18b0a838bd6">usrp_basic_tx</a> (<span class="keywordtype">int</span> which_board, <a name="l00901"></a>00901 <span class="keywordtype">int</span> fusb_block_size=0, <a name="l00902"></a>00902 <span class="keywordtype">int</span> fusb_nblocks=0, <a name="l00903"></a>00903 <span class="keyword">const</span> std::string fpga_filename = <span class="stringliteral">""</span>, <a name="l00904"></a>00904 <span class="keyword">const</span> std::string firmware_filename = <span class="stringliteral">""</span> <a name="l00905"></a>00905 ); <span class="comment">// throws if trouble</span> <a name="l00906"></a>00906 <a name="l00907"></a>00907 <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic__tx.html#a13148a03a6d6df2be95679bc2bbea896">set_tx_enable</a> (<span class="keywordtype">bool</span> on); <a name="l00908"></a><a class="code" href="classusrp__basic__tx.html#ada7b24a807ade928dc5e57e823002f6d">00908</a> <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic__tx.html#ada7b24a807ade928dc5e57e823002f6d">tx_enable</a> ()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> d_tx_enable; } <a name="l00909"></a>00909 <a name="l00910"></a>00910 <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic__tx.html#a2298762ed6e3f39c000a141a4964e181">disable_tx</a> (); <span class="comment">// conditional disable, return prev state</span> <a name="l00911"></a>00911 <span class="keywordtype">void</span> <a class="code" href="classusrp__basic__tx.html#a7dd7dc05a7767f38ce25b407a705c2d5">restore_tx</a> (<span class="keywordtype">bool</span> on); <span class="comment">// conditional set</span> <a name="l00912"></a>00912 <a name="l00913"></a>00913 <span class="keywordtype">void</span> <a class="code" href="classusrp__basic__tx.html#ac9e8934cb2136fd9c1f0bb2677991df0">probe_tx_slots</a> (<span class="keywordtype">bool</span> verbose); <a name="l00914"></a>00914 <a name="l00915"></a>00915 <span class="keyword">public</span>: <a name="l00916"></a>00916 <a name="l00917"></a>00917 <a class="code" href="classusrp__basic__tx.html#a1742407fda891ebf3eea8f297310e455">~usrp_basic_tx</a> (); <a name="l00918"></a>00918 <a name="l00929"></a>00929 <span class="keyword">static</span> <a class="code" href="classusrp__basic__tx.html" title="class for accessing the transmit side of the USRP">usrp_basic_tx</a> *<a class="code" href="classusrp__basic__tx.html#aee3b2b573a324ca3d8374566543f28ce" title="invokes constructor, returns instance or 0 if trouble">make</a> (<span class="keywordtype">int</span> which_board, <span class="keywordtype">int</span> fusb_block_size=0, <span class="keywordtype">int</span> fusb_nblocks=0, <a name="l00930"></a>00930 <span class="keyword">const</span> std::string fpga_filename = <span class="stringliteral">""</span>, <a name="l00931"></a>00931 <span class="keyword">const</span> std::string firmware_filename = <span class="stringliteral">""</span> <a name="l00932"></a>00932 ); <a name="l00933"></a>00933 <a name="l00943"></a>00943 <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic__tx.html#a51d29f5416c2db61e74e1938aa22af72" title="tell the fpga the rate tx samples are going to the D/A&#39;s">set_fpga_tx_sample_rate_divisor</a> (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> div); <a name="l00944"></a>00944 <a name="l00954"></a>00954 <span class="keywordtype">int</span> <a class="code" href="classusrp__basic__tx.html#a0dd15899a23869336f455fa948b725af" title="Write data to the A/D&#39;s via the FPGA.">write</a> (<span class="keyword">const</span> <span class="keywordtype">void</span> *buf, <span class="keywordtype">int</span> len, <span class="keywordtype">bool</span> *underrun); <a name="l00955"></a>00955 <a name="l00956"></a>00956 <span class="comment">/*</span> <a name="l00957"></a>00957 <span class="comment"> * Block until all outstanding writes have completed.</span> <a name="l00958"></a>00958 <span class="comment"> * This is typically used to assist with benchmarking</span> <a name="l00959"></a>00959 <span class="comment"> */</span> <a name="l00960"></a>00960 <span class="keywordtype">void</span> <a class="code" href="classusrp__basic__tx.html#ad6486f2bff896af6109a338d7d954d50">wait_for_completion</a> (); <a name="l00961"></a>00961 <a name="l00963"></a><a class="code" href="classusrp__basic__tx.html#a4eefc136417ea3a75a296c1b6dbbd470">00963</a> <span class="keyword">virtual</span> <span class="keywordtype">long</span> <a class="code" href="classusrp__basic__tx.html#a4eefc136417ea3a75a296c1b6dbbd470" title="sampling rate of D/A converter">converter_rate</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classusrp__basic.html#a244d4aa01bb6a054cd5bd0998ce2a09a" title="return frequency of master oscillator on USRP">fpga_master_clock_freq</a> () * 2; } <span class="comment">// 128M</span> <a name="l00964"></a><a class="code" href="classusrp__basic__tx.html#a618be27f79f9ab769f33ead42c9283a7">00964</a> <span class="keywordtype">long</span> <a class="code" href="classusrp__basic__tx.html#a618be27f79f9ab769f33ead42c9283a7">dac_rate</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classusrp__basic__tx.html#a4eefc136417ea3a75a296c1b6dbbd470" title="sampling rate of D/A converter">converter_rate</a>(); } <a name="l00965"></a><a class="code" href="classusrp__basic__tx.html#a25ef6153080bcd83637c87df6ea1d478">00965</a> <span class="keywordtype">int</span> <a class="code" href="classusrp__basic__tx.html#a25ef6153080bcd83637c87df6ea1d478" title="Return daughterboard ID for given side [0,1].">daughterboard_id</a> (<span class="keywordtype">int</span> which_side)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classusrp__basic.html#a686ea66e3f43c9ab6df60bd80f41ac3b">d_dbid</a>[which_side & 0x1]; } <a name="l00966"></a>00966 <a name="l00967"></a>00967 <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic__tx.html#a5d950d5f8a8969e17525cee918d9bd06" title="Set Programmable Gain Amplifier (PGA).">set_pga</a> (<span class="keywordtype">int</span> which_amp, <span class="keywordtype">double</span> gain_in_db); <a name="l00968"></a>00968 <span class="keywordtype">double</span> <a class="code" href="classusrp__basic__tx.html#aa7764a14b980820287ebe3d50a303fbd" title="Return programmable gain amplifier gain setting in dB.">pga</a> (<span class="keywordtype">int</span> which_amp) <span class="keyword">const</span>; <a name="l00969"></a>00969 <span class="keywordtype">double</span> <a class="code" href="classusrp__basic__tx.html#a7cae37094ad8d1a0095fc058649829d0" title="Return minimum legal PGA gain in dB.">pga_min</a> () <span class="keyword">const</span>; <a name="l00970"></a>00970 <span class="keywordtype">double</span> <a class="code" href="classusrp__basic__tx.html#ac451445ef6cffdffb9e7817c3885f367" title="Return maximum legal PGA gain in dB.">pga_max</a> () <span class="keyword">const</span>; <a name="l00971"></a>00971 <span class="keywordtype">double</span> <a class="code" href="classusrp__basic__tx.html#ac8f1b5ab8940fba58fe01d64727deb40" title="Return hardware step size of PGA (linear in dB).">pga_db_per_step</a> () <span class="keyword">const</span>; <a name="l00972"></a>00972 <a name="l00973"></a>00973 <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic__tx.html#a0ecdfcb63c28d66b2f036156e33f20d8" title="Write direction register (output enables) for pins that go to daughterboard.">_write_oe</a> (<span class="keywordtype">int</span> which_side, <span class="keywordtype">int</span> value, <span class="keywordtype">int</span> mask); <a name="l00974"></a>00974 <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic__tx.html#a19a1a1db062ac7d3d4625c95770353ff" title="Write daughterboard i/o pin value.">write_io</a> (<span class="keywordtype">int</span> which_side, <span class="keywordtype">int</span> value, <span class="keywordtype">int</span> mask); <a name="l00975"></a>00975 <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic__tx.html#ad5b21bcc2798026f5a1555e9ca4c899f" title="Read daughterboard i/o pin value.">read_io</a> (<span class="keywordtype">int</span> which_side, <span class="keywordtype">int</span> *value); <a name="l00976"></a>00976 <span class="keywordtype">int</span> <a class="code" href="classusrp__basic__tx.html#ad5b21bcc2798026f5a1555e9ca4c899f" title="Read daughterboard i/o pin value.">read_io</a> (<span class="keywordtype">int</span> which_side); <a name="l00977"></a>00977 <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic__tx.html#a6076561547b3912ea535334e6e6d4c2f" title="Write daughterboard refclk config register.">write_refclk</a>(<span class="keywordtype">int</span> which_side, <span class="keywordtype">int</span> value); <a name="l00978"></a>00978 <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic__tx.html#a8cfd094ce093e5d46fcad5531ee20570">write_atr_mask</a>(<span class="keywordtype">int</span> which_side, <span class="keywordtype">int</span> value); <a name="l00979"></a>00979 <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic__tx.html#af4c224f2e92a07ded29fc6dedba8c2d7">write_atr_txval</a>(<span class="keywordtype">int</span> which_side, <span class="keywordtype">int</span> value); <a name="l00980"></a>00980 <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic__tx.html#a01b222b0ba0a365db87ab74731325d5b">write_atr_rxval</a>(<span class="keywordtype">int</span> which_side, <span class="keywordtype">int</span> value); <a name="l00981"></a>00981 <a name="l00982"></a>00982 <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic__tx.html#a2d3f6eda1859921bb7c0f26d2dd1163d" title="Write auxiliary digital to analog converter.">write_aux_dac</a> (<span class="keywordtype">int</span> which_side, <span class="keywordtype">int</span> which_dac, <span class="keywordtype">int</span> value); <a name="l00983"></a>00983 <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic__tx.html#a237f04837e77f428551b6b66217f8d9b" title="Read auxiliary analog to digital converter.">read_aux_adc</a> (<span class="keywordtype">int</span> which_side, <span class="keywordtype">int</span> which_adc, <span class="keywordtype">int</span> *value); <a name="l00984"></a>00984 <span class="keywordtype">int</span> <a class="code" href="classusrp__basic__tx.html#a237f04837e77f428551b6b66217f8d9b" title="Read auxiliary analog to digital converter.">read_aux_adc</a> (<span class="keywordtype">int</span> which_side, <span class="keywordtype">int</span> which_adc); <a name="l00985"></a>00985 <a name="l00986"></a>00986 <span class="keywordtype">int</span> <a class="code" href="classusrp__basic__tx.html#a3d88f6bddfb24f2ad375b65b935ac6e9" title="returns current fusb block size">block_size</a>() <span class="keyword">const</span>; <a name="l00987"></a>00987 <a name="l00988"></a>00988 <span class="comment">// called in base class to derived class order</span> <a name="l00989"></a>00989 <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic__tx.html#a3d16b0d8e96d5124b6392bc44014124d" title="Start data transfers. Called in base class to derived class order.">start</a> (); <a name="l00990"></a>00990 <span class="keywordtype">bool</span> <a class="code" href="classusrp__basic__tx.html#ab1c5851e72e29e86af914da5c7f62cf8" title="Stop data transfers. Called in base class to derived class order.">stop</a> (); <a name="l00991"></a>00991 }; <a name="l00992"></a>00992 <a name="l00993"></a>00993 <span class="preprocessor">#endif </span><span class="comment">/* INCLUDED_USRP_BASIC_H */</span> </pre></div></div> <hr class="footer"/><address style="text-align: right;"><small>Generated on Wed Dec 29 19:44:19 2010 for Universal Software Radio Peripheral by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address> </body> </html>