[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r9343 - in gnuradio/branches/developers/trondeau/dbs/g
From: |
trondeau |
Subject: |
[Commit-gnuradio] r9343 - in gnuradio/branches/developers/trondeau/dbs/gnuradio-examples/c++: . usrp_test |
Date: |
Tue, 19 Aug 2008 20:28:36 -0600 (MDT) |
Author: trondeau
Date: 2008-08-19 20:28:36 -0600 (Tue, 19 Aug 2008)
New Revision: 9343
Added:
gnuradio/branches/developers/trondeau/dbs/gnuradio-examples/c++/usrp_test/
gnuradio/branches/developers/trondeau/dbs/gnuradio-examples/c++/usrp_test/Makefile.am
gnuradio/branches/developers/trondeau/dbs/gnuradio-examples/c++/usrp_test/main.cc
gnuradio/branches/developers/trondeau/dbs/gnuradio-examples/c++/usrp_test/usrp_test.cc
gnuradio/branches/developers/trondeau/dbs/gnuradio-examples/c++/usrp_test/usrp_test.h
Modified:
gnuradio/branches/developers/trondeau/dbs/gnuradio-examples/c++/Makefile.am
Log:
adding a C++ USRP example
Modified:
gnuradio/branches/developers/trondeau/dbs/gnuradio-examples/c++/Makefile.am
===================================================================
--- gnuradio/branches/developers/trondeau/dbs/gnuradio-examples/c++/Makefile.am
2008-08-20 02:25:00 UTC (rev 9342)
+++ gnuradio/branches/developers/trondeau/dbs/gnuradio-examples/c++/Makefile.am
2008-08-20 02:28:36 UTC (rev 9343)
@@ -1,5 +1,5 @@
#
-# Copyright 2006 Free Software Foundation, Inc.
+# Copyright 2006,2008 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -20,4 +20,4 @@
#
include $(top_srcdir)/Makefile.common
-# SUBDIRS = dial_tone
+SUBDIRS = dial_tone usrp_test
Added:
gnuradio/branches/developers/trondeau/dbs/gnuradio-examples/c++/usrp_test/Makefile.am
===================================================================
---
gnuradio/branches/developers/trondeau/dbs/gnuradio-examples/c++/usrp_test/Makefile.am
(rev 0)
+++
gnuradio/branches/developers/trondeau/dbs/gnuradio-examples/c++/usrp_test/Makefile.am
2008-08-20 02:28:36 UTC (rev 9343)
@@ -0,0 +1,50 @@
+#
+# 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.
+#
+
+include $(top_srcdir)/Makefile.common
+
+# For compiling within the GNU Radio build tree
+AM_CPPFLAGS=$(STD_DEFINES_AND_INCLUDES) \
+ -I$(top_srcdir)/gr-usrp/src \
+ -I$(top_srcdir)/usrp/host/lib/legacy \
+ -I$(top_srcdir)/usrp/firmware/include \
+ $(WITH_INCLUDES)
+
+GR_USRP_LA=$(top_builddir)/gr-usrp/src/libusrp1.la \
+ $(top_builddir)/usrp/host/lib/legacy/libusrp.la
+
+# For compiling outside the tree, these will get fished out by pkgconfig
+
+noinst_PROGRAMS = \
+ usrp_test
+
+noinst_HEADERS = \
+ usrp_test.h
+
+usrp_test_SOURCES = \
+ usrp_test.cc \
+ main.cc
+
+usrp_test_LDADD = \
+ $(GNURADIO_CORE_LA) \
+ $(GR_USRP_LA)
+
+MOSTLYCLEANFILES = *~
Added:
gnuradio/branches/developers/trondeau/dbs/gnuradio-examples/c++/usrp_test/main.cc
===================================================================
---
gnuradio/branches/developers/trondeau/dbs/gnuradio-examples/c++/usrp_test/main.cc
(rev 0)
+++
gnuradio/branches/developers/trondeau/dbs/gnuradio-examples/c++/usrp_test/main.cc
2008-08-20 02:28:36 UTC (rev 9343)
@@ -0,0 +1,38 @@
+/*
+ * 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.
+ */
+
+#include <usrp_test.h>
+
+int main()
+{
+ usrp_test_sptr top_block = make_usrp_test();
+ top_block->run();
+
+ std::vector<gr_complex> data = top_block->sink->data();
+
+ printf("data size: %d\n", data.size());
+ for(int i=0; i < data.size(); i++) {
+ printf("%f + j%f, ", data[i].real(), data[i].imag());
+ }
+ printf("\n");
+
+ return 0;
+}
Added:
gnuradio/branches/developers/trondeau/dbs/gnuradio-examples/c++/usrp_test/usrp_test.cc
===================================================================
---
gnuradio/branches/developers/trondeau/dbs/gnuradio-examples/c++/usrp_test/usrp_test.cc
(rev 0)
+++
gnuradio/branches/developers/trondeau/dbs/gnuradio-examples/c++/usrp_test/usrp_test.cc
2008-08-20 02:28:36 UTC (rev 9343)
@@ -0,0 +1,72 @@
+/*
+ * 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.
+ */
+
+#include <usrp_test.h>
+#include <gr_io_signature.h>
+#include <usrp1_source_c.h>
+#include <gr_head.h>
+
+// Shared pointer constructor
+usrp_test_sptr make_usrp_test()
+{
+ return usrp_test_sptr(new usrp_test());
+}
+
+// Hierarchical block constructor, with no inputs or outputs
+usrp_test::usrp_test() :
+ gr_top_block("usrp_test")
+{
+ int decim = 64;
+ usrp1_source_c_sptr usrp = usrp1_make_source_c(0, decim);
+
+ std::vector<int> spec(2,0);
+ db_base_sptr subdev = usrp->selected_subdev(spec);
+ printf("Subdevice name is %s\n", subdev->name().c_str());
+ printf("Subdevice freq range: (%f, %f)\n", subdev->freq_min(),
subdev->freq_max());
+
+ unsigned int mux = usrp->determine_rx_mux_value(spec);
+ printf("mux: %x\n", mux);
+ usrp->set_mux(mux);
+
+ float input_rate = usrp->adc_freq() / usrp->decim_rate();
+ printf("input_rate: %f\n", input_rate);
+
+ float gain_min = subdev->gain_min();
+ float gain_max = subdev->gain_max();
+ printf("gain: (%f, %f)\n", gain_min, gain_max);
+
+ subdev->set_gain((gain_min + gain_max)/2.0);
+
+ float target_freq = 101.3e6;
+ tune_result r = subdev->tune(0, target_freq);
+ printf("r.ok: %d\n", r.ok);
+ printf("r.baseband_freq: %f\n", r.baseband_freq);
+ printf("r.dxc_freq: %f\n", r.dxc_freq);
+ printf("r.residual_freq: %f\n", r.residual_freq);
+ printf("r.inverted: %d\n", r.inverted);
+
+ /* The rest */
+ gr_block_sptr head = gr_make_head(sizeof(gr_complex), 100);
+ sink = gr_make_vector_sink_c();
+
+ connect(usrp, 0, head, 0);
+ connect(head, 0, sink, 0);
+}
Added:
gnuradio/branches/developers/trondeau/dbs/gnuradio-examples/c++/usrp_test/usrp_test.h
===================================================================
---
gnuradio/branches/developers/trondeau/dbs/gnuradio-examples/c++/usrp_test/usrp_test.h
(rev 0)
+++
gnuradio/branches/developers/trondeau/dbs/gnuradio-examples/c++/usrp_test/usrp_test.h
2008-08-20 02:28:36 UTC (rev 9343)
@@ -0,0 +1,37 @@
+/*
+ * 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.
+ */
+
+#include <gr_top_block.h>
+#include <gr_vector_sink_c.h>
+
+class usrp_test;
+typedef boost::shared_ptr<usrp_test> usrp_test_sptr;
+usrp_test_sptr make_usrp_test();
+
+class usrp_test : public gr_top_block
+{
+private:
+ usrp_test();
+ friend usrp_test_sptr make_usrp_test();
+
+ public:
+ gr_vector_sink_c_sptr sink;
+};
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r9343 - in gnuradio/branches/developers/trondeau/dbs/gnuradio-examples/c++: . usrp_test,
trondeau <=