[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r9183 - in usrp2/branches/developers/jcorgan/gr-usrp2/
From: |
jcorgan |
Subject: |
[Commit-gnuradio] r9183 - in usrp2/branches/developers/jcorgan/gr-usrp2/host-ng: apps gr-usrp2 include/usrp2 lib |
Date: |
Tue, 5 Aug 2008 23:23:49 -0600 (MDT) |
Author: jcorgan
Date: 2008-08-05 23:23:48 -0600 (Tue, 05 Aug 2008)
New Revision: 9183
Added:
usrp2/branches/developers/jcorgan/gr-usrp2/host-ng/gr-usrp2/test_gr_usrp2.cc
Modified:
usrp2/branches/developers/jcorgan/gr-usrp2/host-ng/apps/test.sh
usrp2/branches/developers/jcorgan/gr-usrp2/host-ng/apps/test2_usrp2.cc
usrp2/branches/developers/jcorgan/gr-usrp2/host-ng/gr-usrp2/
usrp2/branches/developers/jcorgan/gr-usrp2/host-ng/gr-usrp2/Makefile.am
usrp2/branches/developers/jcorgan/gr-usrp2/host-ng/gr-usrp2/usrp2_source_base.cc
usrp2/branches/developers/jcorgan/gr-usrp2/host-ng/gr-usrp2/usrp2_source_base.h
usrp2/branches/developers/jcorgan/gr-usrp2/host-ng/gr-usrp2/usrp2_source_c.cc
usrp2/branches/developers/jcorgan/gr-usrp2/host-ng/include/usrp2/usrp2.h
usrp2/branches/developers/jcorgan/gr-usrp2/host-ng/lib/usrp2.cc
usrp2/branches/developers/jcorgan/gr-usrp2/host-ng/lib/usrp2_impl.h
Log:
wip
Modified: usrp2/branches/developers/jcorgan/gr-usrp2/host-ng/apps/test.sh
===================================================================
--- usrp2/branches/developers/jcorgan/gr-usrp2/host-ng/apps/test.sh
2008-08-06 03:47:32 UTC (rev 9182)
+++ usrp2/branches/developers/jcorgan/gr-usrp2/host-ng/apps/test.sh
2008-08-06 05:23:48 UTC (rev 9183)
@@ -1,5 +1,5 @@
#!/bin/sh
-sudo ./test_usrp2 -d 4
+sudo ./test2_usrp2 -d 4 -v
Modified: usrp2/branches/developers/jcorgan/gr-usrp2/host-ng/apps/test2_usrp2.cc
===================================================================
--- usrp2/branches/developers/jcorgan/gr-usrp2/host-ng/apps/test2_usrp2.cc
2008-08-06 03:47:32 UTC (rev 9182)
+++ usrp2/branches/developers/jcorgan/gr-usrp2/host-ng/apps/test2_usrp2.cc
2008-08-06 05:23:48 UTC (rev 9183)
@@ -340,7 +340,8 @@
std::cerr << "Failed to enable realtime scheduling" << std::endl;
usrp2::usrp2::sptr u2 = usrp2::usrp2::make(interface, mac_addr_str);
-
+ fprintf(stderr, "Using USRP2 at %s\n\n", u2->mac_addr().c_str());
+
// FIXME in case it was left running...
if (!u2->stop_rx_streaming()){
fprintf(stderr, "stop_rx_streaming failed\n");
Property changes on: usrp2/branches/developers/jcorgan/gr-usrp2/host-ng/gr-usrp2
___________________________________________________________________
Name: svn:ignore
- .libs
.deps
Makefile
Makefile.in
*.pyc
usrp2.cc
usrp2.py
+ .libs
.deps
Makefile
Makefile.in
*.pyc
usrp2.cc
usrp2.py
test_gr_usrp2
Modified:
usrp2/branches/developers/jcorgan/gr-usrp2/host-ng/gr-usrp2/Makefile.am
===================================================================
--- usrp2/branches/developers/jcorgan/gr-usrp2/host-ng/gr-usrp2/Makefile.am
2008-08-06 03:47:32 UTC (rev 9182)
+++ usrp2/branches/developers/jcorgan/gr-usrp2/host-ng/gr-usrp2/Makefile.am
2008-08-06 05:23:48 UTC (rev 9183)
@@ -17,68 +17,78 @@
include $(top_srcdir)/Makefile.common
-INCLUDES = $(STD_DEFINES_AND_INCLUDES) $(CPPUNIT_INCLUDES)
+AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES)
lib_LTLIBRARIES = \
libgr_usrp2.la
+bin_PROGRAMS = \
+ test_gr_usrp2
+
+test_gr_usrp2_SOURCES = test_gr_usrp2.cc
+test_gr_usrp2_LDADD = \
+ libgr_usrp2.la \
+ $(top_builddir)/lib/libusrp2ng.la
+
libgr_usrp2_la_SOURCES = \
- usrp2_sink_base.cc \
- usrp2_sink_c.cc \
usrp2_source_base.cc \
usrp2_source_c.cc
+# usrp2_sink_base.cc
+# usrp2_sink_c.cc
libgr_usrp2_la_LIBADD = \
- ../lib/libusrp2.la
+ $(top_builddir)/lib/libusrp2ng.la \
+ $(GNURADIO_CORE_LIBS)
-include_HEADERS = \
- usrp2_sink_base.h \
- usrp2_sink_c.h \
- usrp2_source_base.h \
- usrp2_source_c.h
+# These will get installed once this moves into GNU Radio trunk
+#include_HEADERS = \
+# usrp2_sink_base.h \
+# usrp2_sink_c.h \
+# usrp2_source_base.h \
+# usrp2_source_c.h
# Export C++ GNU Radio driver to Python via SWIG
-ourpythondir = $(grpythondir)
-ourlibdir = $(grpyexecdir)
+#ourpythondir = $(grpythondir)
+#ourlibdir = $(grpyexecdir)
-SWIGPYTHONARGS = $(SWIGPYTHONFLAGS) $(SWIGGRFLAGS) $(WITH_SWIG_INCLUDES) \
- $(WITH_INCLUDES)
+#SWIGPYTHONARGS = $(SWIGPYTHONFLAGS) $(SWIGGRFLAGS) $(WITH_SWIG_INCLUDES) \
+# $(WITH_INCLUDES)
-LOCAL_IFILES = \
- usrp2.i
+#LOCAL_IFILES = \
+# usrp2.i
-BUILT_SOURCES = \
- usrp2.cc \
- usrp2.py
+#BUILT_SOURCES = \
+# usrp2.cc \
+# usrp2.py
-ourpython_PYTHON = \
- usrp2.py
+#ourpython_PYTHON = \
+# usrp2.py
-ourlib_LTLIBRARIES = \
- _usrp2.la
+#ourlib_LTLIBRARIES = \
+# _usrp2.la
-_usrp2_la_SOURCES = \
- usrp2.cc
+#_usrp2_la_SOURCES = \
+# usrp2.cc
-_usrp2_la_LDFLAGS = $(NO_UNDEFINED) -module -avoid-version
+#_usrp2_la_LDFLAGS = $(NO_UNDEFINED) -module -avoid-version
-_usrp2_la_LIBADD = \
- $(PYTHON_LDFLAGS) \
- libgr_usrp2.la \
- $(GNURADIO_CORE_LIBS) \
- -lstdc++
+#_usrp2_la_LIBADD = \
+# $(PYTHON_LDFLAGS) \
+# libgr_usrp2.la \
+# $(GNURADIO_CORE_LIBS) \
+# -lstdc++
-_usrp2_la_CPPFLAGS = $(PYTHON_CPPFLAGS)
+#_usrp2_la_CPPFLAGS = $(PYTHON_CPPFLAGS)
-usrp2.cc usrp2.py: $(LOCAL_IFILES)
- $(SWIG) $(SWIGPYTHONARGS) -module usrp2 -o usrp2.cc $(LOCAL_IFILES)
+#usrp2.cc usrp2.py: $(LOCAL_IFILES)
+# $(SWIG) $(SWIGPYTHONARGS) -module usrp2 -o usrp2.cc $(LOCAL_IFILES)
-swiginclude_HEADERS = \
- $(LOCAL_IFILES)
+#swiginclude_HEADERS = \
+# $(LOCAL_IFILES)
# Don't distribute output of swig
-dist-hook:
- @for file in $(BUILT_SOURCES); do echo $(RM) $(distdir)/$$file; done
- @for file in $(BUILT_SOURCES); do $(RM) $(distdir)/$$file; done
+#dist-hook:
+# @for file in $(BUILT_SOURCES); do echo $(RM) $(distdir)/$$file; done
+# @for file in $(BUILT_SOURCES); do $(RM) $(distdir)/$$file; done
MOSTLYCLEANFILES += $(BUILT_SOURCES) *.pyc *~
Added:
usrp2/branches/developers/jcorgan/gr-usrp2/host-ng/gr-usrp2/test_gr_usrp2.cc
===================================================================
---
usrp2/branches/developers/jcorgan/gr-usrp2/host-ng/gr-usrp2/test_gr_usrp2.cc
(rev 0)
+++
usrp2/branches/developers/jcorgan/gr-usrp2/host-ng/gr-usrp2/test_gr_usrp2.cc
2008-08-06 05:23:48 UTC (rev 9183)
@@ -0,0 +1,34 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "usrp2_source_c.h"
+
+int
+main(char *argc, char **argv)
+{
+ usrp2_source_c_sptr u2 = usrp2_make_source_c();
+ printf("Using USRP2 at %s\n", u2->mac_addr().c_str());
+}
Modified:
usrp2/branches/developers/jcorgan/gr-usrp2/host-ng/gr-usrp2/usrp2_source_base.cc
===================================================================
---
usrp2/branches/developers/jcorgan/gr-usrp2/host-ng/gr-usrp2/usrp2_source_base.cc
2008-08-06 03:47:32 UTC (rev 9182)
+++
usrp2/branches/developers/jcorgan/gr-usrp2/host-ng/gr-usrp2/usrp2_source_base.cc
2008-08-06 05:23:48 UTC (rev 9183)
@@ -28,53 +28,25 @@
#include <gr_io_signature.h>
#include <iostream>
-#define USRP2_SOURCE_BASE_DEBUG 1
+#define USRP2_SOURCE_BASE_DEBUG 0
usrp2_source_base::usrp2_source_base(const std::string &name,
gr_io_signature_sptr output_signature,
- const std::string &ifc,
+ const std::string &interface,
const std::string &mac)
throw (std::runtime_error)
: gr_sync_block(name,
gr_make_io_signature(0, 0, 0),
output_signature),
- d_u2(0), d_addr()
+ d_u2(usrp2::usrp2::sptr())
{
- std::vector<op_id_reply_t> r = usrp2_basic::find_usrps(ifc);
- if (r.size() == 0)
- throw std::runtime_error("No USRP2s found on interface.");
-
- if (mac == "") {
- if (r.size() > 1)
- throw std::runtime_error("Must supply USRP2 MAC address when multiple
devices are present");
- d_addr = r[0].addr;
- }
- else {
- u2_mac_addr_t addr;
- if (!usrp2_basic::parse_mac_addr(mac, &addr))
- throw std::runtime_error("Invalid MAC address");
-
- unsigned int i;
- for (i = 0; i < r.size(); i++)
- if (r[i].addr == addr) {
- d_addr = addr;
- break;
- }
-
- if (i == r.size())
- throw std::runtime_error("Unable to find specified USRP2.");
- }
-
- if (USRP2_SOURCE_BASE_DEBUG)
- std::cout << "usrp2_source_base: using ifc=" << ifc << " mac=" << d_addr
<< std::endl;
-
- // Now retrieve or make and return usrp2_basic object for MAC address in
d_addr
+ d_u2 = usrp2::usrp2::make(interface, mac);
+ if (!d_u2)
+ throw std::runtime_error("Unable to initialize USRP2!");
}
usrp2_source_base::~usrp2_source_base ()
{
- if (d_u2)
- delete d_u2;
}
int
Modified:
usrp2/branches/developers/jcorgan/gr-usrp2/host-ng/gr-usrp2/usrp2_source_base.h
===================================================================
---
usrp2/branches/developers/jcorgan/gr-usrp2/host-ng/gr-usrp2/usrp2_source_base.h
2008-08-06 03:47:32 UTC (rev 9182)
+++
usrp2/branches/developers/jcorgan/gr-usrp2/host-ng/gr-usrp2/usrp2_source_base.h
2008-08-06 05:23:48 UTC (rev 9183)
@@ -24,7 +24,7 @@
#define INCLUDED_USRP2_SOURCE_BASE_H
#include <gr_sync_block.h>
-#include <usrp2_basic.h>
+#include <usrp2/usrp2.h>
#include <stdexcept>
class usrp2_source_base : public gr_sync_block {
@@ -36,11 +36,12 @@
const std::string &mac = "")
throw (std::runtime_error);
- usrp2_basic *d_u2;
- u2_mac_addr_t d_addr;
+ usrp2::usrp2::sptr d_u2;
public:
~usrp2_source_base();
+
+ const std::string &mac_addr() const { return d_u2->mac_addr(); }
int work(int noutput_items,
gr_vector_const_void_star &input_items,
Modified:
usrp2/branches/developers/jcorgan/gr-usrp2/host-ng/gr-usrp2/usrp2_source_c.cc
===================================================================
---
usrp2/branches/developers/jcorgan/gr-usrp2/host-ng/gr-usrp2/usrp2_source_c.cc
2008-08-06 03:47:32 UTC (rev 9182)
+++
usrp2/branches/developers/jcorgan/gr-usrp2/host-ng/gr-usrp2/usrp2_source_c.cc
2008-08-06 05:23:48 UTC (rev 9183)
@@ -28,19 +28,19 @@
#include <gr_io_signature.h>
usrp2_source_c_sptr
-usrp2_make_source_c(const std::string &ifc,
- const std::string &mac)
+usrp2_make_source_c(const std::string &interface,
+ const std::string &mac_addr)
throw (std::runtime_error)
{
- return usrp2_source_c_sptr(new usrp2_source_c(ifc, mac));
+ return usrp2_source_c_sptr(new usrp2_source_c(interface, mac_addr));
}
-usrp2_source_c::usrp2_source_c(const std::string &ifc,
- const std::string &mac)
+usrp2_source_c::usrp2_source_c(const std::string &interface,
+ const std::string &mac_addr)
throw (std::runtime_error)
: usrp2_source_base("usrp2_source_c",
gr_make_io_signature(1, 1, sizeof(gr_complex)),
- ifc, mac)
+ interface, mac_addr)
{
}
Modified:
usrp2/branches/developers/jcorgan/gr-usrp2/host-ng/include/usrp2/usrp2.h
===================================================================
--- usrp2/branches/developers/jcorgan/gr-usrp2/host-ng/include/usrp2/usrp2.h
2008-08-06 03:47:32 UTC (rev 9182)
+++ usrp2/branches/developers/jcorgan/gr-usrp2/host-ng/include/usrp2/usrp2.h
2008-08-06 05:23:48 UTC (rev 9183)
@@ -83,6 +83,11 @@
*/
~usrp2();
+ /*!
+ * Returns the MAC address associated with this USRP
+ */
+ const std::string &mac_addr();
+
/*
* ----------------------------------------------------------------
* Rx configuration and control
Modified: usrp2/branches/developers/jcorgan/gr-usrp2/host-ng/lib/usrp2.cc
===================================================================
--- usrp2/branches/developers/jcorgan/gr-usrp2/host-ng/lib/usrp2.cc
2008-08-06 03:47:32 UTC (rev 9182)
+++ usrp2/branches/developers/jcorgan/gr-usrp2/host-ng/lib/usrp2.cc
2008-08-06 05:23:48 UTC (rev 9183)
@@ -45,6 +45,12 @@
// NOP
}
+ const std::string &
+ usrp2::mac_addr()
+ {
+ return d_impl->mac_addr();
+ }
+
// Receive
bool
Modified: usrp2/branches/developers/jcorgan/gr-usrp2/host-ng/lib/usrp2_impl.h
===================================================================
--- usrp2/branches/developers/jcorgan/gr-usrp2/host-ng/lib/usrp2_impl.h
2008-08-06 03:47:32 UTC (rev 9182)
+++ usrp2/branches/developers/jcorgan/gr-usrp2/host-ng/lib/usrp2_impl.h
2008-08-06 05:23:48 UTC (rev 9183)
@@ -43,7 +43,7 @@
eth_buffer *d_eth_buf;
pktfilter *d_pf;
- std::string d_addr;
+ std::string d_addr; // FIXME: use u2_mac_addr_t instead
usrp2_thread *d_bg_thread;
volatile bool d_bg_running; // TODO: multistate if needed
@@ -94,6 +94,7 @@
void bg_loop();
+ const std::string &mac_addr() const { return d_addr; } // FIXME: convert
from u2_mac_addr_t
bool set_rx_gain(double gain);
bool set_rx_center_freq(double frequency, tune_result *result);
bool set_rx_decim(int decimation_factor);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r9183 - in usrp2/branches/developers/jcorgan/gr-usrp2/host-ng: apps gr-usrp2 include/usrp2 lib,
jcorgan <=