[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r8420 - in usrp2/trunk/host: apps gr-usrp2 lib
From: |
jcorgan |
Subject: |
[Commit-gnuradio] r8420 - in usrp2/trunk/host: apps gr-usrp2 lib |
Date: |
Tue, 13 May 2008 19:27:16 -0600 (MDT) |
Author: jcorgan
Date: 2008-05-13 19:27:08 -0600 (Tue, 13 May 2008)
New Revision: 8420
Modified:
usrp2/trunk/host/apps/rx_streaming_samples.cc
usrp2/trunk/host/apps/tx_samples.cc
usrp2/trunk/host/apps/u2_burn_mac_addr.cc
usrp2/trunk/host/gr-usrp2/usrp2.i
usrp2/trunk/host/gr-usrp2/usrp2_sink_base.cc
usrp2/trunk/host/gr-usrp2/usrp2_sink_base.h
usrp2/trunk/host/gr-usrp2/usrp2_sink_c.cc
usrp2/trunk/host/gr-usrp2/usrp2_sink_c.h
usrp2/trunk/host/gr-usrp2/usrp2_source_base.cc
usrp2/trunk/host/gr-usrp2/usrp2_source_base.h
usrp2/trunk/host/gr-usrp2/usrp2_table.cc
usrp2/trunk/host/gr-usrp2/usrp2_table.h
usrp2/trunk/host/lib/usrp2_basic.cc
usrp2/trunk/host/lib/usrp2_basic.h
Log:
Merged r8411:8419 from jcorgan/u2 into usrp2/trunk. Reorganized usrp2_basic
class, starting to fill out usrp2_source/sink.
Modified: usrp2/trunk/host/apps/rx_streaming_samples.cc
===================================================================
--- usrp2/trunk/host/apps/rx_streaming_samples.cc 2008-05-14 01:22:38 UTC
(rev 8419)
+++ usrp2/trunk/host/apps/rx_streaming_samples.cc 2008-05-14 01:27:08 UTC
(rev 8420)
@@ -220,7 +220,8 @@
int ch;
double tmp;
u2_mac_addr_t mac_addr;
-
+ bool default_mac = true;
+
// setvbuf(stdout, 0, _IOFBF, 64 * 1024); // make stdout fully buffered
while ((ch = getopt(argc, argv, "he:m:o:f:d:N:F:S:g:")) != EOF){
@@ -237,6 +238,7 @@
usage(argv[0]);
exit(1);
}
+ default_mac = false;
break;
case 'o':
@@ -312,64 +314,51 @@
}
}
- usrp2_basic *u2 = new usrp2_basic();
-
- if (!u2->open(interface)){
- std::cerr << "couldn't open " << interface << std::endl;
- return 0;
+ if (default_mac == true) {
+ op_id_reply_t r;
+ if (!usrp2_basic::pick_default_usrp(interface, &r)) {
+ std::cerr << "No default USRP2 found.\n";
+ return 1;
+ }
+ mac_addr = r.addr;
}
-
- install_sig_handler(SIGINT, sig_handler);
+
+ usrp2_basic_sptr u2 = usrp2_make_basic(interface, mac_addr);
- std::vector<op_id_reply_t> r = u2->find_usrps();
-
- for (size_t i = 0; i < r.size(); i++){
- std::cerr << r[i] << std::endl;
- }
-
- if (r.size() == 0){
- std::cerr << "No USRP2 found.\n";
- return 1;
- }
-
- u2_mac_addr_t which = r[0].addr; // pick the first one
-
-
+ install_sig_handler(SIGINT, sig_handler);
gr_rt_status_t rt = gr_enable_realtime_scheduling();
if (rt != RT_OK)
std::cerr << "failed to enable realtime scheduling\n";
-
// create writer thread
class file_writer *writer = new file_writer(ofd, rb);
writer->start_undetached();
-
usrp2_tune_result tune_result;
if (gain != GAIN_NOT_SET){
- if (!u2->set_rx_gain(which, gain)){
+ if (!u2->set_rx_gain(gain)){
std::cerr << "set_rx_gain failed\n";
return 1;
}
}
- if (!u2->set_rx_freq(which, freq, &tune_result)){
+ if (!u2->set_rx_freq(freq, &tune_result)){
std::cerr << "set_rx_freq failed\n";
return 1;
}
- if (!u2->set_rx_decim(which, decim)){
+ if (!u2->set_rx_decim(decim)){
std::cerr << "set_rx_decim failed\n";
return 1;
}
- if (!u2->set_rx_scale_iq(which, scale, scale)){
+ if (!u2->set_rx_scale_iq(scale, scale)){
std::cerr << "set_rx_scale_iq failed\n";
return 1;
}
- if (!u2->start_rx_streaming(which, samples_per_frame)){
+ if (!u2->start_rx_streaming(samples_per_frame)){
std::cerr << "start_rx_streaming failed\n";
return 1;
}
@@ -383,7 +372,7 @@
u2_eth_samples_t pkt;
// read samples
- int n = u2->read_samples(which, &pkt);
+ int n = u2->read_samples(&pkt);
if (n <= 0)
break;
@@ -414,7 +403,7 @@
// smp_wmb()
rb->d_not_empty.post(); // wake up file writer
- if (!u2->stop_rx(which)){
+ if (!u2->stop_rx()){
std::cerr << "stop_rx failed\n";
return 1;
}
Modified: usrp2/trunk/host/apps/tx_samples.cc
===================================================================
--- usrp2/trunk/host/apps/tx_samples.cc 2008-05-14 01:22:38 UTC (rev 8419)
+++ usrp2/trunk/host/apps/tx_samples.cc 2008-05-14 01:27:08 UTC (rev 8420)
@@ -78,7 +78,8 @@
int ch;
double tmp;
u2_mac_addr_t mac_addr;
-
+ bool default_mac = true;
+
while ((ch = getopt(argc, argv, "he:m:I:rf:i:F:S:g:")) != EOF){
switch (ch){
@@ -93,6 +94,7 @@
usage(argv[0]);
return 1;
}
+ default_mac = false;
break;
case 'I':
@@ -160,47 +162,36 @@
return 1;
}
- usrp2_basic *u2 = new usrp2_basic();
-
- if (!u2->open(interface)){
- std::cerr << "couldn't open " << interface << std::endl;
- return 1;
+ if (default_mac == true) {
+ op_id_reply_t r;
+ if (!usrp2_basic::pick_default_usrp(interface, &r)) {
+ std::cerr << "Unable to find USRP2." << std::endl;
+ return 1;
+ }
+ mac_addr = r.addr;
}
-
- std::vector<op_id_reply_t> r = u2->find_usrps();
-
- for (size_t i = 0; i < r.size(); i++){
- std::cout << r[i] << std::endl;
- }
-
- if (r.size() == 0){
- std::cerr << "No USRP2 found.\n";
- return 1;
- }
-
- u2_mac_addr_t which = r[0].addr; // pick the first one
-
-
+
+ usrp2_basic_sptr u2 = usrp2_make_basic(interface, mac_addr);
usrp2_tune_result tune_result;
if (gain != GAIN_NOT_SET){
- if (!u2->set_tx_gain(which, gain)){
+ if (!u2->set_tx_gain(gain)){
std::cerr << "set_tx_gain failed\n";
return 1;
}
}
- if (!u2->set_tx_freq(which, freq, &tune_result)){
+ if (!u2->set_tx_freq(freq, &tune_result)){
std::cerr << "set_tx_freq failed\n";
return 1;
}
- if (!u2->set_tx_interp(which, interp)){
+ if (!u2->set_tx_interp(interp)){
std::cerr << "set_tx_interp failed\n";
return 1;
}
- if (!u2->set_tx_scale_iq(which, scale, scale)){
+ if (!u2->set_tx_scale_iq(scale, scale)){
std::cerr << "set_tx_scale_iq failed\n";
return 1;
}
@@ -225,7 +216,7 @@
// FIXME if r < 9, pad to 9 for minimum packet size constraint
- if (!u2->write_samples(which, &pkt, r))
+ if (!u2->write_samples(&pkt, r))
break;
}
Modified: usrp2/trunk/host/apps/u2_burn_mac_addr.cc
===================================================================
--- usrp2/trunk/host/apps/u2_burn_mac_addr.cc 2008-05-14 01:22:38 UTC (rev
8419)
+++ usrp2/trunk/host/apps/u2_burn_mac_addr.cc 2008-05-14 01:27:08 UTC (rev
8420)
@@ -77,22 +77,9 @@
fprintf(stderr, "invalid mac address: %s\n", new_mac_addr_str);
exit(1);
}
-
- usrp2_basic *u2 = new usrp2_basic();
-
- if (!u2->open(interface)){
- std::cerr << "couldn't open " << interface << std::endl;
- return 0;
- }
-
- if (!u2->find_usrp_by_mac(old_mac_addr, 0)){
- std::cerr << "No USRP2 with address "
- << old_mac_addr << " found.\n";
- return 1;
- }
-
- if (!u2->burn_mac_addr(old_mac_addr, new_mac_addr)){
+ usrp2_basic_sptr u2 = usrp2_make_basic(interface, old_mac_addr);
+ if (!u2->burn_mac_addr(new_mac_addr)){
std::cerr << "Failed to burn mac address\n";
return 1;
}
@@ -103,8 +90,9 @@
ts.tv_nsec = 250000000;
nanosleep(&ts, 0);
+
// Now see if we can find it using it's new address
- if (!u2->find_usrp_by_mac(new_mac_addr, 0)){
+ if (!usrp2_basic::find_usrp_by_mac(interface, new_mac_addr, 0)){
std::cerr << "Failed to find USRP2 using new address "
<< new_mac_addr << ".\n";
return 1;
Modified: usrp2/trunk/host/gr-usrp2/usrp2.i
===================================================================
--- usrp2/trunk/host/gr-usrp2/usrp2.i 2008-05-14 01:22:38 UTC (rev 8419)
+++ usrp2/trunk/host/gr-usrp2/usrp2.i 2008-05-14 01:27:08 UTC (rev 8420)
@@ -33,65 +33,62 @@
// ----------------------------------------------------------------
-class usrp2_sink_base : public gr_sync_block {
+class usrp2_source_base : public gr_sync_block {
protected:
- usrp2_sink_base(const std::string &name,
- gr_io_signature_sptr input_signature)
+ usrp2_source_base(const std::string &name, gr_io_signature_sptr
output_signature)
throw (std::runtime_error);
public:
- ~usrp2_sink_base();
+ ~usrp2_source_base();
};
// ----------------------------------------------------------------
-class usrp2_source_base : public gr_sync_block {
+GR_SWIG_BLOCK_MAGIC(usrp2,source_c)
+usrp2_source_c_sptr
+usrp2_make_source_c(const std::string &ifc="eth0", const std::string &mac="")
+ throw (std::runtime_error);
+
+class usrp2_source_c : public usrp2_source_base {
+
protected:
- usrp2_source_base(const std::string &name,
- gr_io_signature_sptr output_signature)
- throw (std::runtime_error);
+ usrp2_source_c(const std::string &ifc, const std::string &mac);
public:
- ~usrp2_source_base();
+ ~usrp2_source_c();
};
// ----------------------------------------------------------------
-GR_SWIG_BLOCK_MAGIC(usrp2,sink_c)
+class usrp2_sink_base : public gr_sync_block {
-usrp2_sink_c_sptr
-usrp2_make_sink_c() throw (std::runtime_error);
-
-class usrp2_sink_c : public usrp2_sink_base {
-
protected:
- usrp2_sink_c();
+ usrp2_sink_base(const std::string &name, gr_io_signature_sptr
input_signature)
+ throw (std::runtime_error);
public:
- ~usrp2_sink_c();
+ ~usrp2_sink_base();
};
// ----------------------------------------------------------------
-GR_SWIG_BLOCK_MAGIC(usrp2,source_c)
+GR_SWIG_BLOCK_MAGIC(usrp2,sink_c)
-usrp2_source_c_sptr
-usrp2_make_source_c(const std::string &ifc="eth0",
- const std::string &mac="")
+usrp2_sink_c_sptr
+usrp2_make_sink_c(const std::string &ifc="eth0", const std::string &mac="")
throw (std::runtime_error);
-class usrp2_source_c : public usrp2_source_base {
+class usrp2_sink_c : public usrp2_sink_base {
protected:
- usrp2_source_c(const std::string &ifc,
- const std::string &mac);
+ usrp2_sink_c(const std::string &ifc, const std::string &mac);
public:
- ~usrp2_source_c();
+ ~usrp2_sink_c();
};
Modified: usrp2/trunk/host/gr-usrp2/usrp2_sink_base.cc
===================================================================
--- usrp2/trunk/host/gr-usrp2/usrp2_sink_base.cc 2008-05-14 01:22:38 UTC
(rev 8419)
+++ usrp2/trunk/host/gr-usrp2/usrp2_sink_base.cc 2008-05-14 01:27:08 UTC
(rev 8420)
@@ -25,21 +25,68 @@
#endif
#include <usrp2_sink_base.h>
+#include <usrp2_table.h>
#include <gr_io_signature.h>
+#include <iostream>
+#define USRP2_SINK_BASE_DEBUG 1
+
usrp2_sink_base::usrp2_sink_base(const std::string &name,
- gr_io_signature_sptr input_signature)
+ gr_io_signature_sptr input_signature,
+ const std::string &ifc,
+ const std::string &mac)
throw (std::runtime_error)
: gr_sync_block(name,
input_signature,
- gr_make_io_signature(0, 0, 0))
+ gr_make_io_signature(0, 0, 0)),
+ d_u2(usrp2_basic_sptr())
{
+ op_id_reply_t id;
+
+ if (mac == "") {
+ if (!usrp2_basic::pick_default_usrp(ifc, &id))
+ throw std::runtime_error("Unable to pick default USRP2");
+ }
+ else {
+ u2_mac_addr_t addr;
+ if (!usrp2_basic::parse_mac_addr(mac, &addr))
+ throw std::runtime_error("Invalid MAC address");
+
+ if (!usrp2_basic::find_usrp(ifc, addr, &id))
+ throw std::runtime_error("Unable to find specified USRP2.");
+ }
+
+ if (USRP2_SINK_BASE_DEBUG)
+ std::cout << "usrp2_sink_base: using ifc=" << ifc
+ << " mac=" << id.addr
+ << " hw_rev=" << id.hw_rev << std::endl;
+
+ if (!(d_u2 = find_or_create_usrp2_basic(ifc, id.addr)))
+ throw std::runtime_error("Unable to create usrp2_basic!");
}
-usrp2_sink_base::~usrp2_sink_base ()
+bool
+usrp2_sink_base::start()
{
+ if (USRP2_SINK_BASE_DEBUG)
+ std::cout << "usrp2_sink_base: start" << std::endl;
+
+ return true;
}
+bool
+usrp2_sink_base::stop()
+{
+ if (USRP2_SINK_BASE_DEBUG)
+ std::cout << "usrp2_sink_base: stop" << std::endl;
+
+ return true;
+}
+
+usrp2_sink_base::~usrp2_sink_base()
+{
+}
+
int
usrp2_sink_base::work(int noutput_items,
gr_vector_const_void_star &input_items,
Modified: usrp2/trunk/host/gr-usrp2/usrp2_sink_base.h
===================================================================
--- usrp2/trunk/host/gr-usrp2/usrp2_sink_base.h 2008-05-14 01:22:38 UTC (rev
8419)
+++ usrp2/trunk/host/gr-usrp2/usrp2_sink_base.h 2008-05-14 01:27:08 UTC (rev
8420)
@@ -24,20 +24,26 @@
#define INCLUDED_USRP2_SINK_BASE_H
#include <gr_sync_block.h>
+#include <usrp2_basic.h>
#include <stdexcept>
class usrp2_sink_base : public gr_sync_block {
-private:
-
protected:
usrp2_sink_base(const std::string &name,
- gr_io_signature_sptr input_signature)
+ gr_io_signature_sptr input_signature,
+ const std::string &ifc = "eth0",
+ const std::string &mac = "")
throw (std::runtime_error);
+ usrp2_basic_sptr d_u2;
+
public:
~usrp2_sink_base();
+ virtual bool start();
+ virtual bool stop();
+
int work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
Modified: usrp2/trunk/host/gr-usrp2/usrp2_sink_c.cc
===================================================================
--- usrp2/trunk/host/gr-usrp2/usrp2_sink_c.cc 2008-05-14 01:22:38 UTC (rev
8419)
+++ usrp2/trunk/host/gr-usrp2/usrp2_sink_c.cc 2008-05-14 01:27:08 UTC (rev
8420)
@@ -26,18 +26,19 @@
#include <usrp2_sink_c.h>
#include <gr_io_signature.h>
-#include <usrp_standard.h>
-#include <usrp_bytesex.h>
usrp2_sink_c_sptr
-usrp2_make_sink_c() throw (std::runtime_error)
+usrp2_make_sink_c(const std::string &ifc, const std::string &mac)
+ throw (std::runtime_error)
{
- return usrp2_sink_c_sptr(new usrp2_sink_c());
+ return usrp2_sink_c_sptr(new usrp2_sink_c(ifc, mac));
}
-usrp2_sink_c::usrp2_sink_c() throw (std::runtime_error)
+usrp2_sink_c::usrp2_sink_c(const std::string &ifc, const std::string &mac)
+ throw (std::runtime_error)
: usrp2_sink_base("usrp2_sink_c",
- gr_make_io_signature(1, 1, sizeof(gr_complex)))
+ gr_make_io_signature(1, 1, sizeof(gr_complex)),
+ ifc, mac)
{
}
Modified: usrp2/trunk/host/gr-usrp2/usrp2_sink_c.h
===================================================================
--- usrp2/trunk/host/gr-usrp2/usrp2_sink_c.h 2008-05-14 01:22:38 UTC (rev
8419)
+++ usrp2/trunk/host/gr-usrp2/usrp2_sink_c.h 2008-05-14 01:27:08 UTC (rev
8420)
@@ -29,16 +29,19 @@
typedef boost::shared_ptr<usrp2_sink_c> usrp2_sink_c_sptr;
usrp2_sink_c_sptr
-usrp2_make_sink_c() throw (std::runtime_error);
+usrp2_make_sink_c(const std::string &ifc="eth0", const std::string &mac="")
+ throw (std::runtime_error);
class usrp2_sink_c : public usrp2_sink_base {
+
private:
-
friend usrp2_sink_c_sptr
- usrp2_make_sink_c() throw (std::runtime_error);
+ usrp2_make_sink_c(const std::string &ifc, const std::string &mac)
+ throw (std::runtime_error);
protected:
- usrp2_sink_c() throw (std::runtime_error);
+ usrp2_sink_c(const std::string &ifc="eth0", const std::string &mac="")
+ throw (std::runtime_error);
public:
~usrp2_sink_c();
Modified: usrp2/trunk/host/gr-usrp2/usrp2_source_base.cc
===================================================================
--- usrp2/trunk/host/gr-usrp2/usrp2_source_base.cc 2008-05-14 01:22:38 UTC
(rev 8419)
+++ usrp2/trunk/host/gr-usrp2/usrp2_source_base.cc 2008-05-14 01:27:08 UTC
(rev 8420)
@@ -39,7 +39,7 @@
: gr_sync_block(name,
gr_make_io_signature(0, 0, 0),
output_signature),
- d_u2(0)
+ d_u2(usrp2_basic_sptr())
{
op_id_reply_t id;
@@ -65,10 +65,26 @@
throw std::runtime_error("Unable to create usrp2_basic!");
}
+bool
+usrp2_source_base::start()
+{
+ if (USRP2_SOURCE_BASE_DEBUG)
+ std::cout << "usrp2_source_base: start" << std::endl;
+
+ return true;
+}
+
+bool
+usrp2_source_base::stop()
+{
+ if (USRP2_SOURCE_BASE_DEBUG)
+ std::cout << "usrp2_source_base: stop" << std::endl;
+
+ return true;
+}
+
usrp2_source_base::~usrp2_source_base ()
{
- if (d_u2)
- release_usrp2_basic(d_u2);
}
int
Modified: usrp2/trunk/host/gr-usrp2/usrp2_source_base.h
===================================================================
--- usrp2/trunk/host/gr-usrp2/usrp2_source_base.h 2008-05-14 01:22:38 UTC
(rev 8419)
+++ usrp2/trunk/host/gr-usrp2/usrp2_source_base.h 2008-05-14 01:27:08 UTC
(rev 8420)
@@ -36,11 +36,14 @@
const std::string &mac = "")
throw (std::runtime_error);
- usrp2_basic *d_u2;
+ usrp2_basic_sptr d_u2;
public:
~usrp2_source_base();
+ virtual bool start();
+ virtual bool stop();
+
int work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
Modified: usrp2/trunk/host/gr-usrp2/usrp2_table.cc
===================================================================
--- usrp2/trunk/host/gr-usrp2/usrp2_table.cc 2008-05-14 01:22:38 UTC (rev
8419)
+++ usrp2/trunk/host/gr-usrp2/usrp2_table.cc 2008-05-14 01:27:08 UTC (rev
8420)
@@ -26,13 +26,19 @@
#include <usrp2_table.h>
#include <omnithread.h>
+#include <boost/weak_ptr.hpp>
#include <stdexcept>
+#include <iostream>
+#define USRP2_TABLE_DEBUG 1
+
static omni_mutex lock;
+typedef boost::weak_ptr<usrp2_basic> usrp2_basic_wptr;
+
typedef struct {
u2_mac_addr_t addr;
- usrp2_basic *u2;
+ usrp2_basic_wptr u2;
} entry_t;
typedef std::vector<entry_t> entry_vector_t;
@@ -40,34 +46,35 @@
static entry_vector_t s_table;
-usrp2_basic *
+usrp2_basic_sptr
find_or_create_usrp2_basic(const std::string &ifc, const u2_mac_addr_t &addr)
{
omni_mutex_lock l(lock);
-
- for (entry_viter_t e = s_table.begin(); e != s_table.end(); e++) {
- if (e->addr == addr)
- return e->u2;
+ usrp2_basic_sptr u2;
+
+ for (entry_viter_t en = s_table.begin(); en != s_table.end(); en++) {
+ if (en->addr == addr) {
+ if (USRP2_TABLE_DEBUG)
+ std::cout << "find_or_create_usrp2_basic: found for " << addr <<
std::endl;
+ try {
+ return usrp2_basic_sptr(en->u2);
+ }
+ catch (boost::bad_weak_ptr e) { // Went out of scope
+ u2 = usrp2_make_basic(ifc, addr);
+ en->u2 = usrp2_basic_wptr(u2);
+ return u2;
+ }
+ }
}
- entry_t e;
- e.addr = addr;
- e.u2 = new usrp2_basic(); // In future will use ifc and addr
- s_table.push_back(e);
- return e.u2;
-}
+ if (USRP2_TABLE_DEBUG)
+ std::cout << "find_or_create_usrp2_basic: creating new usrp2_basic for "
+ << addr << std::endl;
-void
-release_usrp2_basic(usrp2_basic *u2)
-{
- omni_mutex_lock l(lock);
-
- for (entry_viter_t e = s_table.begin(); e != s_table.end(); e++) {
- if (e->u2 == u2) {
- s_table.erase(e);
- return;
- }
- }
-
- throw std::runtime_error("Attempt to release non-existent usrp2_basic");
+ entry_t en;
+ en.addr = addr;
+ u2 = usrp2_make_basic(ifc, addr);
+ en.u2 = usrp2_basic_wptr(u2);
+ s_table.push_back(en);
+ return u2;
}
Modified: usrp2/trunk/host/gr-usrp2/usrp2_table.h
===================================================================
--- usrp2/trunk/host/gr-usrp2/usrp2_table.h 2008-05-14 01:22:38 UTC (rev
8419)
+++ usrp2/trunk/host/gr-usrp2/usrp2_table.h 2008-05-14 01:27:08 UTC (rev
8420)
@@ -25,7 +25,6 @@
#include <usrp2_basic.h>
-usrp2_basic *find_or_create_usrp2_basic(const std::string &ifc, const
u2_mac_addr_t &addr);
-void release_usrp2_basic(usrp2_basic *u2);
+usrp2_basic_sptr find_or_create_usrp2_basic(const std::string &ifc, const
u2_mac_addr_t &addr);
#endif /* INCLUDED_USRP2_TABLE_H */
Modified: usrp2/trunk/host/lib/usrp2_basic.cc
===================================================================
--- usrp2/trunk/host/lib/usrp2_basic.cc 2008-05-14 01:22:38 UTC (rev 8419)
+++ usrp2/trunk/host/lib/usrp2_basic.cc 2008-05-14 01:27:08 UTC (rev 8420)
@@ -25,6 +25,7 @@
#include "gri_pktfilter.h"
#include <usrp2_types.h>
#include <iostream>
+#include <stdexcept>
#include <math.h>
#include <time.h> // debug
@@ -36,6 +37,7 @@
#include <unistd.h>
#endif
+#define USRP2_BASIC_DEBUG 1
/*
* Note, this should be considered a first cut at getting
@@ -52,57 +54,46 @@
#define MAX_PKTLEN 1512 // biggest thing USRP2 can swallow
// (14-byte ethernet hdr + 1500 byte payload)
+usrp2_basic_sptr
+usrp2_make_basic(const std::string &ifc, const u2_mac_addr_t &addr)
+{
+ return usrp2_basic_sptr(new usrp2_basic(ifc, addr));
+}
-usrp2_basic::usrp2_basic()
+usrp2_basic::usrp2_basic(const std::string &ifc, const u2_mac_addr_t &addr)
: d_ethernet(new GRI_ETHERNET()), d_pf(0), d_seqno(0), d_next_rid(0)
{
- assert(sizeof(u2_eth_samples_t) == (size_t) MAX_PKTLEN);
+ if (USRP2_BASIC_DEBUG)
+ std::cout << "usrp2_basic: constructor" << std::endl;
+
+ op_id_reply_t r;
+ if (!usrp2_basic::find_usrp_by_mac(ifc, addr, &r))
+ throw std::runtime_error("Unable to find specified USRP2.");
+
+ d_ethernet->open(ifc, htons(U2_ETHERTYPE));
+ d_pf = gri_pktfilter::make_ethertype_inbound(U2_ETHERTYPE,
d_ethernet->mac());
+ if (!d_ethernet->attach_pktfilter(d_pf))
+ throw std::runtime_error("Unable to attach packet filter.");
+ d_addr = addr;
}
usrp2_basic::~usrp2_basic()
{
+ if (USRP2_BASIC_DEBUG)
+ std::cout << "usrp2_basic: destructor" << std::endl;
+
delete d_pf;
+
+ d_ethernet->close();
delete d_ethernet;
}
-bool
-usrp2_basic::open(std::string ifname)
-{
- if (!d_ethernet->open(ifname, htons(U2_ETHERTYPE)))
- return false;
-
- if (d_pf)
- delete d_pf;
-
- if (1){
- d_pf = gri_pktfilter::make_ethertype_inbound(U2_ETHERTYPE,
d_ethernet->mac());
- if (!d_ethernet->attach_pktfilter(d_pf))
- return false;
- }
-
- return true;
-}
-
-bool
-usrp2_basic::close()
-{
- return d_ethernet->close();
-}
-
// ------------------------------------------------------------------------
+// static
std::vector<op_id_reply_t>
-usrp2_basic::find_usrps()
+usrp2_basic::find_usrps(const std::string &ifc)
{
- static u2_mac_addr_t broadcast_mac_addr =
- {{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }};
-
- std::vector<op_id_reply_t> result;
- int r;
-
- uint8_t pktbuf[MAX_PKTLEN];
- memset(pktbuf, 0, sizeof(pktbuf));
-
struct command {
u2_eth_packet_t h;
op_id_t op_id;
@@ -113,39 +104,64 @@
op_id_reply_t op_id_reply;
};
- command *c = (command *) pktbuf;
- init_etf_hdrs(&c->h, broadcast_mac_addr, 0, CONTROL_CHAN, -1);
+ int r, len;
+ command *c = 0;
+ std::vector<op_id_reply_t> result;
+ gri_ethernet *enet = 0;
+ gri_pktfilter *pf = 0;
+
+ enet = new GRI_ETHERNET();
+ if (!enet->open(ifc, htons(U2_ETHERTYPE)))
+ goto bail;
+ pf = gri_pktfilter::make_ethertype_inbound(U2_ETHERTYPE, enet->mac());
+ if (!enet->attach_pktfilter(pf))
+ goto bail;
+
+ static u2_mac_addr_t broadcast_mac_addr =
+ {{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }};
+
+ uint8_t pktbuf[MAX_PKTLEN];
+ memset(pktbuf, 0, sizeof(pktbuf));
+
+ c = (command *)pktbuf;
+ c->h.ehdr.ethertype = htons(U2_ETHERTYPE);
+ c->h.ehdr.dst = broadcast_mac_addr;
+ memcpy(&c->h.ehdr.src, enet->mac(), 6);
+ c->h.thdr.flags = 0;
+ c->h.thdr.seqno = 0;
+ c->h.thdr.ack = 0;
+ u2p_set_word0(&c->h.fixed, 0, CONTROL_CHAN);
+ u2p_set_timestamp(&c->h.fixed, -1);
c->op_id.opcode = OP_ID;
c->op_id.len = sizeof(op_id_t);
- int len = std::max((size_t) MIN_PKTLEN, sizeof(command));
- if (d_ethernet->write_packet(c, len) != len){
+ len = std::max((size_t) MIN_PKTLEN, sizeof(command));
+ if (enet->write_packet(c, len) != len)
goto bail;
- }
/*
* Wait no longer than 10ms and read all packets available.
*/
fd_set read_fds;
FD_ZERO(&read_fds);
- FD_SET(d_ethernet->fd(), &read_fds);
+ FD_SET(enet->fd(), &read_fds);
struct timeval timeout;
timeout.tv_sec = 0;
timeout.tv_usec = 10 * 1000; // 10 ms
- r = select(d_ethernet->fd()+1, &read_fds, 0, 0, &timeout);
+ r = select(enet->fd()+1, &read_fds, 0, 0, &timeout);
- while(1){
+ while(1) {
memset(pktbuf, 0, sizeof(pktbuf));
- int len = d_ethernet->read_packet_dont_block(pktbuf, sizeof(pktbuf));
+ len = enet->read_packet_dont_block(pktbuf, sizeof(pktbuf));
if (len < 0){
perror("usrp2_basic: read_packet_dont_block");
- return result;
+ goto bail;
}
if (len == 0)
break;
- reply *rp = (reply *) pktbuf;
+ reply *rp = (reply *)pktbuf;
if (u2p_chan(&rp->h.fixed) != CONTROL_CHAN) // ignore
continue;
if (rp->op_id_reply.opcode != OP_ID_REPLY) // ignore
@@ -154,26 +170,15 @@
result.push_back(rp->op_id_reply);
}
- bail:
+bail:
+ if (enet)
+ delete enet;
+ if (pf)
+ delete pf;
return result;
}
// static
-std::vector<op_id_reply_t>
-usrp2_basic::find_usrps(const std::string &ifc)
-{
- usrp2_basic *u2 = new usrp2_basic();
- if (!u2 || !u2->open(ifc)) {
- std::cerr << "Unable to open network interface: " << ifc << std::endl;
- return std::vector<op_id_reply_t>(0);
- }
-
- std::vector<op_id_reply_t> r = u2->find_usrps();
- delete u2;
- return r;
-}
-
-// static
bool
usrp2_basic::pick_default_usrp(const std::string &ifc, op_id_reply_t *id)
{
@@ -187,11 +192,10 @@
return true;
}
-
bool
-usrp2_basic::find_usrp_by_mac(const u2_mac_addr_t &addr, op_id_reply_t *id)
+usrp2_basic::find_usrp_by_mac(const std::string &ifc, const u2_mac_addr_t
&addr, op_id_reply_t *id)
{
- std::vector<op_id_reply_t> r = find_usrps();
+ std::vector<op_id_reply_t> r = find_usrps(ifc);
for (unsigned i = 0; i < r.size(); i++){
if (r[i].addr == addr){
if (id)
@@ -225,7 +229,7 @@
*/
bool
-usrp2_basic::set_rx_gain(const u2_mac_addr_t &which, double gain)
+usrp2_basic::set_rx_gain(double gain)
{
uint8_t pktbuf[MAX_PKTLEN];
memset(pktbuf, 0, sizeof(pktbuf));
@@ -237,7 +241,7 @@
};
command *c = (command *) pktbuf;
- init_etf_hdrs(&c->h, which, 0, CONTROL_CHAN, -1);
+ init_etf_hdrs(&c->h, d_addr, 0, CONTROL_CHAN, -1);
c->op.opcode = OP_CONFIG_RX_V2;
c->op.len = sizeof(op_config_rx_v2_t);
@@ -259,8 +263,7 @@
}
bool
-usrp2_basic::set_rx_freq(const u2_mac_addr_t &which, double freq,
- usrp2_tune_result *result)
+usrp2_basic::set_rx_freq(double freq, usrp2_tune_result *result)
{
uint8_t pktbuf[MAX_PKTLEN];
memset(pktbuf, 0, sizeof(pktbuf));
@@ -272,7 +275,7 @@
};
command *c = (command *) pktbuf;
- init_etf_hdrs(&c->h, which, 0, CONTROL_CHAN, -1);
+ init_etf_hdrs(&c->h, d_addr, 0, CONTROL_CHAN, -1);
c->op.opcode = OP_CONFIG_RX_V2;
c->op.len = sizeof(op_config_rx_v2_t);
@@ -299,7 +302,7 @@
}
bool
-usrp2_basic::set_rx_decim(const u2_mac_addr_t &which, int decimation_factor)
+usrp2_basic::set_rx_decim(int decimation_factor)
{
uint8_t pktbuf[MAX_PKTLEN];
memset(pktbuf, 0, sizeof(pktbuf));
@@ -311,7 +314,7 @@
};
command *c = (command *) pktbuf;
- init_etf_hdrs(&c->h, which, 0, CONTROL_CHAN, -1);
+ init_etf_hdrs(&c->h, d_addr, 0, CONTROL_CHAN, -1);
c->op.opcode = OP_CONFIG_RX_V2;
c->op.len = sizeof(op_config_rx_v2_t);
@@ -333,7 +336,7 @@
}
bool
-usrp2_basic::set_rx_scale_iq(const u2_mac_addr_t &which, int scale_i, int
scale_q)
+usrp2_basic::set_rx_scale_iq(int scale_i, int scale_q)
{
uint8_t pktbuf[MAX_PKTLEN];
memset(pktbuf, 0, sizeof(pktbuf));
@@ -345,7 +348,7 @@
};
command *c = (command *) pktbuf;
- init_etf_hdrs(&c->h, which, 0, CONTROL_CHAN, -1);
+ init_etf_hdrs(&c->h, d_addr, 0, CONTROL_CHAN, -1);
c->op.opcode = OP_CONFIG_RX_V2;
c->op.len = sizeof(op_config_rx_v2_t);
@@ -367,7 +370,7 @@
}
bool
-usrp2_basic::start_rx_streaming(const u2_mac_addr_t &which, unsigned int
items_per_frame)
+usrp2_basic::start_rx_streaming(unsigned int items_per_frame)
{
if (items_per_frame == 0) // provide our default
items_per_frame = 250;
@@ -382,7 +385,7 @@
};
command *c = (command *) pktbuf;
- init_etf_hdrs(&c->h, which, 0, CONTROL_CHAN, -1);
+ init_etf_hdrs(&c->h, d_addr, 0, CONTROL_CHAN, -1);
c->op.opcode = OP_START_RX_STREAMING;
c->op.len = sizeof(op_start_rx_streaming_t);
@@ -399,7 +402,7 @@
}
bool
-usrp2_basic::stop_rx(const u2_mac_addr_t &which)
+usrp2_basic::stop_rx()
{
uint8_t pktbuf[MAX_PKTLEN];
memset(pktbuf, 0, sizeof(pktbuf));
@@ -410,7 +413,7 @@
};
command *c = (command *) pktbuf;
- init_etf_hdrs(&c->h, which, 0, CONTROL_CHAN, -1);
+ init_etf_hdrs(&c->h, d_addr, 0, CONTROL_CHAN, -1);
c->op_stop_rx.opcode = OP_STOP_RX;
c->op_stop_rx.len = sizeof(op_stop_rx_t);
@@ -428,7 +431,7 @@
*/
bool
-usrp2_basic::set_tx_gain(const u2_mac_addr_t &which, double gain)
+usrp2_basic::set_tx_gain(double gain)
{
uint8_t pktbuf[MAX_PKTLEN];
memset(pktbuf, 0, sizeof(pktbuf));
@@ -440,7 +443,7 @@
};
command *c = (command *) pktbuf;
- init_etf_hdrs(&c->h, which, 0, CONTROL_CHAN, -1);
+ init_etf_hdrs(&c->h, d_addr, 0, CONTROL_CHAN, -1);
c->op.opcode = OP_CONFIG_TX_V2;
c->op.len = sizeof(op_config_tx_v2_t);
@@ -462,8 +465,7 @@
}
bool
-usrp2_basic::set_tx_freq(const u2_mac_addr_t &which, double freq,
- usrp2_tune_result *result)
+usrp2_basic::set_tx_freq(double freq, usrp2_tune_result *result)
{
uint8_t pktbuf[MAX_PKTLEN];
memset(pktbuf, 0, sizeof(pktbuf));
@@ -475,7 +477,7 @@
};
command *c = (command *) pktbuf;
- init_etf_hdrs(&c->h, which, 0, CONTROL_CHAN, -1);
+ init_etf_hdrs(&c->h, d_addr, 0, CONTROL_CHAN, -1);
c->op.opcode = OP_CONFIG_TX_V2;
c->op.len = sizeof(op_config_tx_v2_t);
@@ -502,7 +504,7 @@
}
bool
-usrp2_basic::set_tx_interp(const u2_mac_addr_t &which, int
interpolation_factor)
+usrp2_basic::set_tx_interp(int interpolation_factor)
{
uint8_t pktbuf[MAX_PKTLEN];
memset(pktbuf, 0, sizeof(pktbuf));
@@ -514,7 +516,7 @@
};
command *c = (command *) pktbuf;
- init_etf_hdrs(&c->h, which, 0, CONTROL_CHAN, -1);
+ init_etf_hdrs(&c->h, d_addr, 0, CONTROL_CHAN, -1);
c->op.opcode = OP_CONFIG_TX_V2;
c->op.len = sizeof(op_config_tx_v2_t);
@@ -536,7 +538,7 @@
}
bool
-usrp2_basic::set_tx_scale_iq(const u2_mac_addr_t &which, int scale_i, int
scale_q)
+usrp2_basic::set_tx_scale_iq(int scale_i, int scale_q)
{
uint8_t pktbuf[MAX_PKTLEN];
memset(pktbuf, 0, sizeof(pktbuf));
@@ -548,7 +550,7 @@
};
command *c = (command *) pktbuf;
- init_etf_hdrs(&c->h, which, 0, CONTROL_CHAN, -1);
+ init_etf_hdrs(&c->h, d_addr, 0, CONTROL_CHAN, -1);
c->op.opcode = OP_CONFIG_TX_V2;
c->op.len = sizeof(op_config_tx_v2_t);
@@ -580,8 +582,7 @@
}
int
-usrp2_basic::read_raw_samples(const u2_mac_addr_t &which,
- u2_eth_samples_t *pkt)
+usrp2_basic::read_raw_samples(u2_eth_samples_t *pkt)
{
int len = d_ethernet->read_packet(pkt, sizeof(*pkt));
// printf("read_packet = %d\n", len);
@@ -603,10 +604,9 @@
}
int
-usrp2_basic::read_samples(const u2_mac_addr_t &which,
- u2_eth_samples_t *pkt)
+usrp2_basic::read_samples(u2_eth_samples_t *pkt)
{
- int r = read_raw_samples(which, pkt);
+ int r = read_raw_samples(pkt);
#ifndef WORDS_BIGENDIAN
for (int i = 0; i < r; i++)
@@ -619,13 +619,12 @@
// ------------------------------------------------------------------------
bool
-usrp2_basic::write_raw_samples(const u2_mac_addr_t &which,
- u2_eth_samples_t *pkt, size_t nsamples)
+usrp2_basic::write_raw_samples(u2_eth_samples_t *pkt, size_t nsamples)
{
if (nsamples > U2_MAX_SAMPLES)
return false;
- init_et_hdrs(&pkt->hdrs, which);
+ init_et_hdrs(&pkt->hdrs, d_addr);
size_t len = sizeof(u2_eth_packet_t) + nsamples * sizeof(uint32_t);
int n = d_ethernet->write_packet(pkt, len);
@@ -639,21 +638,19 @@
}
bool
-usrp2_basic::write_samples(const u2_mac_addr_t &which,
- u2_eth_samples_t *pkt, size_t nsamples)
+usrp2_basic::write_samples(u2_eth_samples_t *pkt, size_t nsamples)
{
#ifndef WORDS_BIGENDIAN
for (size_t i = 0; i < nsamples; i++)
pkt->samples[i] = htonl(pkt->samples[i]);
#endif
- return write_raw_samples(which, pkt, nsamples);
+ return write_raw_samples(pkt, nsamples);
}
bool
-usrp2_basic::burn_mac_addr(const u2_mac_addr_t &which,
- const u2_mac_addr_t &new_addr)
+usrp2_basic::burn_mac_addr(const u2_mac_addr_t &new_addr)
{
uint8_t pktbuf[MAX_PKTLEN];
memset(pktbuf, 0, sizeof(pktbuf));
@@ -664,7 +661,7 @@
};
command *c = (command *) pktbuf;
- init_etf_hdrs(&c->h, which, 0, CONTROL_CHAN, -1);
+ init_etf_hdrs(&c->h, d_addr, 0, CONTROL_CHAN, -1);
c->op.opcode = OP_BURN_MAC_ADDR;
c->op.len = sizeof(op_burn_mac_addr_t);
@@ -732,7 +729,7 @@
bool
-usrp2_basic::read_time(const u2_mac_addr_t &which, uint32_t *time)
+usrp2_basic::read_time(uint32_t *time)
{
*time = 0;
@@ -745,7 +742,7 @@
};
command *c = (command *) pktbuf;
- init_etf_hdrs(&c->h, which, 0, CONTROL_CHAN, -1);
+ init_etf_hdrs(&c->h, d_addr, 0, CONTROL_CHAN, -1);
c->op.opcode = OP_READ_TIME;
c->op.len = sizeof(op_read_time_t);
Modified: usrp2/trunk/host/lib/usrp2_basic.h
===================================================================
--- usrp2/trunk/host/lib/usrp2_basic.h 2008-05-14 01:22:38 UTC (rev 8419)
+++ usrp2/trunk/host/lib/usrp2_basic.h 2008-05-14 01:27:08 UTC (rev 8420)
@@ -50,14 +50,23 @@
: baseband_freq(0), dxc_freq(0), residual_freq(0),
spectrum_inverted(false) {}
};
+class usrp2_basic;
+typedef boost::shared_ptr<usrp2_basic> usrp2_basic_sptr;
+usrp2_basic_sptr usrp2_make_basic(const std::string &ifc, const u2_mac_addr_t
&addr);
+
class usrp2_basic : public boost::noncopyable
{
+private:
+ friend usrp2_basic_sptr usrp2_make_basic(const std::string &ifc, const
u2_mac_addr_t &addr);
+ usrp2_basic(const std::string &ifc, const u2_mac_addr_t &addr);
+
GRI_ETHERNET *d_ethernet;
gri_pktfilter *d_pf;
int d_seqno;
int d_next_rid;
-
+ u2_mac_addr_t d_addr;
+
void init_et_hdrs(u2_eth_packet_t *p, const u2_mac_addr_t &dst);
void init_etf_hdrs(u2_eth_packet_t *p,
@@ -74,15 +83,6 @@
static std::vector<op_id_reply_t> find_usrps(const std::string &ifc);
/*!
- * \brief Find a default USRP2 on an interface
- * \param[in] ifc interface name, e.g., "eth0"
- * \param[out] id if not 0, is filled in with ID reply information if found
- *
- * \returns true iff a single USRP2 is enumerated on the bus
- */
- static bool pick_default_usrp(const std::string &ifc, op_id_reply_t *id);
-
- /*!
* \brief Find usrp by interface and mac address
*
* \param[in] ifc interface name, e.g., "eth0"
@@ -93,23 +93,7 @@
*/
static bool find_usrp(const std::string &ifc, const u2_mac_addr_t &addr,
op_id_reply_t *u);
- // ---- Instance methods ----
-
- usrp2_basic();
- ~usrp2_basic();
-
/*!
- * \param ifname interface name, e.g., "eth0"
- */
- bool open(std::string ifname = "eth0");
- bool close();
-
- /*!
- * Return a vector that describes all usrps found on already open'd interface
- */
- std::vector<op_id_reply_t> find_usrps();
-
- /*!
* \brief Find usrp by mac address
*
* \param[in] addr is the mac address of the USRP to look for
@@ -117,8 +101,16 @@
*
* \returns true iff the specified usrp was found
*/
- bool find_usrp_by_mac(const u2_mac_addr_t &addr, op_id_reply_t *u);
+ static bool find_usrp_by_mac(const std::string &ifc, const u2_mac_addr_t
&addr, op_id_reply_t *u);
+ /*!
+ * \brief Find a default USRP2 on an interface
+ * \param[in] ifc interface name, e.g., "eth0"
+ * \param[out] id if not 0, is filled in with ID reply information if found
+ *
+ * \returns true iff a single USRP2 is enumerated on the bus
+ */
+ static bool pick_default_usrp(const std::string &ifc, op_id_reply_t *id);
/*!
* \brief Parse short or long format mac address.
@@ -130,60 +122,40 @@
*/
static bool parse_mac_addr(const std::string &s, u2_mac_addr_t *p);
+ // ---- Instance methods ----
+ ~usrp2_basic();
+
/*
* Rx configuration and control
*/
- bool set_rx_gain(const u2_mac_addr_t &which, double gain);
- bool set_rx_freq(const u2_mac_addr_t &which, double frequency,
usrp2_tune_result *result);
- bool set_rx_decim(const u2_mac_addr_t &which, int decimation_factor);
- bool set_rx_scale_iq(const u2_mac_addr_t &which, int scale_i, int scale_q);
+ bool set_rx_gain(double gain);
+ bool set_rx_freq(double frequency, usrp2_tune_result *result);
+ bool set_rx_decim(int decimation_factor);
+ bool set_rx_scale_iq(int scale_i, int scale_q);
//! start streaming Rx samples
- bool start_rx_streaming(const u2_mac_addr_t &which, unsigned int
items_per_frame=0);
+ bool start_rx_streaming(unsigned int items_per_frame=0);
//! stop streaming Rx samples
- bool stop_rx(const u2_mac_addr_t &which);
+ bool stop_rx();
-
+
/*
* Tx configuration and control
*/
- bool set_tx_gain(const u2_mac_addr_t &which, double gain);
- bool set_tx_freq(const u2_mac_addr_t &which, double frequency,
usrp2_tune_result *result);
- bool set_tx_interp(const u2_mac_addr_t &which, int interpolation_factor);
- bool set_tx_scale_iq(const u2_mac_addr_t &which, int scale_i, int scale_q);
+ bool set_tx_gain(double gain);
+ bool set_tx_freq(double frequency, usrp2_tune_result *result);
+ bool set_tx_interp(int interpolation_factor);
+ bool set_tx_scale_iq(int scale_i, int scale_q);
-
-#if 0
- bool start_rx(const u2_mac_addr_t &which,
- double freq,
- unsigned int decim,
- unsigned int total_samples, // 0 to begin streaming, or [9,
2**21 - 1]
- unsigned int samples_per_frame, // [9, 372] or [9, 506] if
MTU==2034
- int scale_i, // 16.0 fixed point format
- int scale_q, // 16.0 fixed point format
- bool rx_now = true, // if true begin receiving now
- uint32_t rx_time = -1 // otherwise begin receiving at
rx_time
- );
-
-
- bool config_tx(const u2_mac_addr_t &which,
- double freq,
- unsigned int interp,
- int scale_i, // 16.0 fixed point format
- int scale_q // 16.0 fixed point format
- );
-#endif
-
/*!
* \brief Read raw samples from USRP2.
*
* \param pkt contains the raw (non-endian corrected) samples
* \returns number of valid samples in pkt.
*/
- int read_raw_samples(const u2_mac_addr_t &which,
- u2_eth_samples_t *pkt);
+ int read_raw_samples(u2_eth_samples_t *pkt);
/*!
* \brief Read native-endian samples from USRP2.
@@ -191,8 +163,7 @@
* \param pkt contains native-endian samples.
* \returns number of valid samples in pkt.
*/
- int read_samples(const u2_mac_addr_t &which,
- u2_eth_samples_t *pkt);
+ int read_samples(u2_eth_samples_t *pkt);
/*!
* \brief Write raw samples to USRP2.
@@ -205,8 +176,7 @@
*
* \returns true iff successful
*/
- bool write_raw_samples(const u2_mac_addr_t &which,
- u2_eth_samples_t *pkt, size_t nsamples);
+ bool write_raw_samples(u2_eth_samples_t *pkt, size_t nsamples);
/*!
* \brief Write native-endian samples to USRP2.
@@ -219,8 +189,7 @@
*
* \returns true iff successful
*/
- bool write_samples(const u2_mac_addr_t &which,
- u2_eth_samples_t *pkt, size_t nsamples);
+ bool write_samples(u2_eth_samples_t *pkt, size_t nsamples);
/*!
@@ -229,11 +198,10 @@
* N.B., this interface will probably change.
* We're using it now for testing only.
*/
- bool read_time(const u2_mac_addr_t &which, uint32_t *time);
+ bool read_time(uint32_t *time);
- bool burn_mac_addr(const u2_mac_addr_t &which,
- const u2_mac_addr_t &new_addr);
+ bool burn_mac_addr(const u2_mac_addr_t &new_addr);
//! Return frequency of master oscillator on USRP2.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r8420 - in usrp2/trunk/host: apps gr-usrp2 lib,
jcorgan <=