From 73b85d7840a0694b9deafc75e081dd67cb935169 Mon Sep 17 00:00:00 2001 From: eb Date: Wed, 5 Sep 2007 20:18:28 +0000 Subject: [PATCH] Merged eb/usrp-la r6317:6320 into trunk. This deborks the dependency on usrp-inband that was introduced in [6307]. git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@6321 221aa14e-8319-0410-a670-987f0aec2ac5 --- Makefile.common | 9 +-- config/grc_usrp.m4 | 1 + usrp/host/Makefile.am | 4 +- usrp/host/apps-inband/Makefile.am | 64 +++++++++++++++++ .../{apps => apps-inband}/read_packets.cc | 0 .../test_usrp_inband_cs.cc | 0 .../test_usrp_inband_ping.cc | 0 .../test_usrp_inband_registers.cc | 0 .../test_usrp_inband_rx.cc | 0 .../test_usrp_inband_timestamps.cc | 0 .../test_usrp_inband_tx.cc | 0 usrp/host/apps-inband/time_stuff.c | 68 +++++++++++++++++++ usrp/host/apps-inband/time_stuff.h | 48 +++++++++++++ usrp/host/{apps => apps-inband}/ui_nco.h | 0 usrp/host/{apps => apps-inband}/ui_sincos.c | 0 usrp/host/{apps => apps-inband}/ui_sincos.h | 0 usrp/host/apps/Makefile.am | 38 +---------- usrp/host/lib/inband/Makefile.am | 9 +-- 18 files changed, 194 insertions(+), 47 deletions(-) create mode 100644 usrp/host/apps-inband/Makefile.am rename usrp/host/{apps => apps-inband}/read_packets.cc (100%) rename usrp/host/{apps => apps-inband}/test_usrp_inband_cs.cc (100%) rename usrp/host/{apps => apps-inband}/test_usrp_inband_ping.cc (100%) rename usrp/host/{apps => apps-inband}/test_usrp_inband_registers.cc (100%) rename usrp/host/{apps => apps-inband}/test_usrp_inband_rx.cc (100%) rename usrp/host/{apps => apps-inband}/test_usrp_inband_timestamps.cc (100%) rename usrp/host/{apps => apps-inband}/test_usrp_inband_tx.cc (100%) create mode 100644 usrp/host/apps-inband/time_stuff.c create mode 100644 usrp/host/apps-inband/time_stuff.h rename usrp/host/{apps => apps-inband}/ui_nco.h (100%) rename usrp/host/{apps => apps-inband}/ui_sincos.c (100%) rename usrp/host/{apps => apps-inband}/ui_sincos.h (100%) diff --git a/Makefile.common b/Makefile.common index 33a3a7c2..fd14144b 100644 --- a/Makefile.common +++ b/Makefile.common @@ -74,11 +74,12 @@ GNURADIO_I = $(top_srcdir)/gnuradio-core/src/lib/swig/gnuradio.i # How to link in the USRP library from inside the tree USRP_INCLUDES = -I$(top_srcdir)/usrp/host/lib/legacy \ - -I$(top_srcdir)/usrp/host/lib/inband \ -I$(top_srcdir)/usrp/firmware/include -USRP_LA = \ - $(top_builddir)/usrp/host/lib/legacy/libusrp.la \ - $(top_builddir)/usrp/host/lib/inband/libusrp_inband.la +USRP_LA = $(top_builddir)/usrp/host/lib/legacy/libusrp.la + +# How to link in usrp-inband library from inside the tree +USRP_INBAND_INCLUDES = -I$(top_srcdir)/usrp/host/lib/inband +USRP_INBAND_LA = $(top_builddir)/usrp/host/lib/inband/libusrp_inband.la # How to link the PMT library from inside the tree PMT_INCLUDES = -I$(top_srcdir)/pmt/src/lib diff --git a/config/grc_usrp.m4 b/config/grc_usrp.m4 index 7462c883..cc4f6a17 100644 --- a/config/grc_usrp.m4 +++ b/config/grc_usrp.m4 @@ -36,6 +36,7 @@ AC_DEFUN([GRC_USRP],[ usrp/host/lib/legacy/std_paths.h \ usrp/host/swig/Makefile \ usrp/host/apps/Makefile \ + usrp/host/apps-inband/Makefile \ usrp/firmware/Makefile \ usrp/firmware/include/Makefile \ usrp/firmware/lib/Makefile \ diff --git a/usrp/host/Makefile.am b/usrp/host/Makefile.am index 9b72209c..1716f513 100644 --- a/usrp/host/Makefile.am +++ b/usrp/host/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2001 Free Software Foundation, Inc. +# Copyright 2001,2007 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -19,5 +19,5 @@ # Boston, MA 02110-1301, USA. # -SUBDIRS = misc lib swig apps +SUBDIRS = misc lib swig apps apps-inband diff --git a/usrp/host/apps-inband/Makefile.am b/usrp/host/apps-inband/Makefile.am new file mode 100644 index 00000000..a63cb8ba --- /dev/null +++ b/usrp/host/apps-inband/Makefile.am @@ -0,0 +1,64 @@ +# +# Copyright 2003,2006 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 + +INCLUDES = \ + $(DEFINES) $(OMNITHREAD_INCLUDES) $(PMT_INCLUDES) $(MBLOCK_INCLUDES) \ + $(USRP_INCLUDES) $(USRP_INBAND_INCLUDES) $(BOOST_CFLAGS) $(CPPUNIT_INCLUDES) + + +bin_PROGRAMS = + +noinst_PROGRAMS = \ + test_usrp_inband_cs \ + test_usrp_inband_ping \ + test_usrp_inband_registers \ + test_usrp_inband_rx \ + test_usrp_inband_tx \ + test_usrp_inband_timestamps \ + read_packets + +noinst_HEADERS = \ + ui_nco.h \ + ui_sincos.h + + +test_usrp_inband_cs_SOURCES = test_usrp_inband_cs.cc ui_sincos.c +test_usrp_inband_cs_LDADD = $(USRP_LA) $(USRP_INBAND_LA) + +test_usrp_inband_ping_SOURCES = test_usrp_inband_ping.cc +test_usrp_inband_ping_LDADD = $(USRP_LA) $(USRP_INBAND_LA) + +test_usrp_inband_tx_SOURCES = test_usrp_inband_tx.cc ui_sincos.c +test_usrp_inband_tx_LDADD = $(USRP_LA) $(USRP_INBAND_LA) + +test_usrp_inband_timestamps_SOURCES = test_usrp_inband_timestamps.cc ui_sincos.c +test_usrp_inband_timestamps_LDADD = $(USRP_LA) $(USRP_INBAND_LA) + +test_usrp_inband_registers_SOURCES = test_usrp_inband_registers.cc ui_sincos.c +test_usrp_inband_registers_LDADD = $(USRP_LA) $(USRP_INBAND_LA) + +test_usrp_inband_rx_SOURCES = test_usrp_inband_rx.cc ui_sincos.c +test_usrp_inband_rx_LDADD = $(USRP_LA) $(USRP_INBAND_LA) + +read_packets_SOURCES = read_packets.cc +read_packets_LDADD = $(USRP_LA) $(USRP_INBAND_LA) diff --git a/usrp/host/apps/read_packets.cc b/usrp/host/apps-inband/read_packets.cc similarity index 100% rename from usrp/host/apps/read_packets.cc rename to usrp/host/apps-inband/read_packets.cc diff --git a/usrp/host/apps/test_usrp_inband_cs.cc b/usrp/host/apps-inband/test_usrp_inband_cs.cc similarity index 100% rename from usrp/host/apps/test_usrp_inband_cs.cc rename to usrp/host/apps-inband/test_usrp_inband_cs.cc diff --git a/usrp/host/apps/test_usrp_inband_ping.cc b/usrp/host/apps-inband/test_usrp_inband_ping.cc similarity index 100% rename from usrp/host/apps/test_usrp_inband_ping.cc rename to usrp/host/apps-inband/test_usrp_inband_ping.cc diff --git a/usrp/host/apps/test_usrp_inband_registers.cc b/usrp/host/apps-inband/test_usrp_inband_registers.cc similarity index 100% rename from usrp/host/apps/test_usrp_inband_registers.cc rename to usrp/host/apps-inband/test_usrp_inband_registers.cc diff --git a/usrp/host/apps/test_usrp_inband_rx.cc b/usrp/host/apps-inband/test_usrp_inband_rx.cc similarity index 100% rename from usrp/host/apps/test_usrp_inband_rx.cc rename to usrp/host/apps-inband/test_usrp_inband_rx.cc diff --git a/usrp/host/apps/test_usrp_inband_timestamps.cc b/usrp/host/apps-inband/test_usrp_inband_timestamps.cc similarity index 100% rename from usrp/host/apps/test_usrp_inband_timestamps.cc rename to usrp/host/apps-inband/test_usrp_inband_timestamps.cc diff --git a/usrp/host/apps/test_usrp_inband_tx.cc b/usrp/host/apps-inband/test_usrp_inband_tx.cc similarity index 100% rename from usrp/host/apps/test_usrp_inband_tx.cc rename to usrp/host/apps-inband/test_usrp_inband_tx.cc diff --git a/usrp/host/apps-inband/time_stuff.c b/usrp/host/apps-inband/time_stuff.c new file mode 100644 index 00000000..89a4a381 --- /dev/null +++ b/usrp/host/apps-inband/time_stuff.c @@ -0,0 +1,68 @@ +/* -*- c++ -*- */ +/* + * Copyright 2003 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 "time_stuff.h" + +#include +#ifdef HAVE_SYS_RESOURCE_H +#include +#endif +#include + +static double +timeval_to_secs (struct timeval *tv) +{ + return (double) tv->tv_sec + (double) tv->tv_usec * 1e-6; +} + +double +get_cpu_usage (void) +{ +#ifdef HAVE_GETRUSAGE + struct rusage ru; + + if (getrusage (RUSAGE_SELF, &ru) != 0) + return 0; + + return timeval_to_secs (&ru.ru_utime) + timeval_to_secs (&ru.ru_stime); +#else + return 0; /* FIXME */ +#endif +} + +/* + * return elapsed time (wall time) in seconds + */ +double +get_elapsed_time (void) +{ + struct timeval tv; + if (gettimeofday (&tv, 0) != 0) + return 0; + + return timeval_to_secs (&tv); +} + diff --git a/usrp/host/apps-inband/time_stuff.h b/usrp/host/apps-inband/time_stuff.h new file mode 100644 index 00000000..74b79f38 --- /dev/null +++ b/usrp/host/apps-inband/time_stuff.h @@ -0,0 +1,48 @@ +/* -*- c++ -*- */ +/* + * Copyright 2003 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. + */ + +#ifndef _TIME_STUFF_H_ +#define _TIME_STUFF_H_ + + + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * return USER + SYS cpu time in seconds + */ +double get_cpu_usage (void); + +/* + * return elapsed time in seconds + */ +double get_elapsed_time (void); + + +#ifdef __cplusplus +} +#endif + + +#endif /* _TIME_STUFF_H_ */ diff --git a/usrp/host/apps/ui_nco.h b/usrp/host/apps-inband/ui_nco.h similarity index 100% rename from usrp/host/apps/ui_nco.h rename to usrp/host/apps-inband/ui_nco.h diff --git a/usrp/host/apps/ui_sincos.c b/usrp/host/apps-inband/ui_sincos.c similarity index 100% rename from usrp/host/apps/ui_sincos.c rename to usrp/host/apps-inband/ui_sincos.c diff --git a/usrp/host/apps/ui_sincos.h b/usrp/host/apps-inband/ui_sincos.h similarity index 100% rename from usrp/host/apps/ui_sincos.h rename to usrp/host/apps-inband/ui_sincos.h diff --git a/usrp/host/apps/Makefile.am b/usrp/host/apps/Makefile.am index e0f5b8cf..97138840 100644 --- a/usrp/host/apps/Makefile.am +++ b/usrp/host/apps/Makefile.am @@ -21,9 +21,7 @@ include $(top_srcdir)/Makefile.common -INCLUDES = \ - $(DEFINES) $(OMNITHREAD_INCLUDES) $(PMT_INCLUDES) $(MBLOCK_INCLUDES) \ - $(USRP_INCLUDES) $(BOOST_CFLAGS) $(CPPUNIT_INCLUDES) +INCLUDES = $(USRP_INCLUDES) $(BOOST_CFLAGS) $(CPPUNIT_INCLUDES) bin_PROGRAMS = \ @@ -32,20 +30,11 @@ bin_PROGRAMS = \ noinst_PROGRAMS = \ check_order_quickly \ - test_usrp_inband_cs \ - test_usrp_inband_ping \ - test_usrp_inband_registers \ - test_usrp_inband_rx \ - test_usrp_inband_tx \ - test_usrp_inband_timestamps \ test_usrp_standard_rx \ - test_usrp_standard_tx \ - read_packets + test_usrp_standard_tx noinst_HEADERS = \ - time_stuff.h \ - ui_nco.h \ - ui_sincos.h + time_stuff.h noinst_PYTHON = \ burn-db-eeprom \ @@ -65,24 +54,3 @@ usrper_LDADD = $(USRP_LA) usrp_cal_dc_offset_SOURCES = usrp_cal_dc_offset.cc usrp_cal_dc_offset_LDADD = $(USRP_LA) - -test_usrp_inband_cs_SOURCES = test_usrp_inband_cs.cc time_stuff.c ui_sincos.c -test_usrp_inband_cs_LDADD = $(USRP_LA) - -test_usrp_inband_ping_SOURCES = test_usrp_inband_ping.cc time_stuff.c -test_usrp_inband_ping_LDADD = $(USRP_LA) - -test_usrp_inband_tx_SOURCES = test_usrp_inband_tx.cc time_stuff.c ui_sincos.c -test_usrp_inband_tx_LDADD = $(USRP_LA) - -test_usrp_inband_timestamps_SOURCES = test_usrp_inband_timestamps.cc time_stuff.c ui_sincos.c -test_usrp_inband_timestamps_LDADD = $(USRP_LA) - -test_usrp_inband_registers_SOURCES = test_usrp_inband_registers.cc time_stuff.c ui_sincos.c -test_usrp_inband_registers_LDADD = $(USRP_LA) - -test_usrp_inband_rx_SOURCES = test_usrp_inband_rx.cc time_stuff.c ui_sincos.c -test_usrp_inband_rx_LDADD = $(USRP_LA) - -read_packets_SOURCES = read_packets.cc -read_packets_LDADD = $(USRP_LA) diff --git a/usrp/host/lib/inband/Makefile.am b/usrp/host/lib/inband/Makefile.am index 76e769fb..d0daf45c 100644 --- a/usrp/host/lib/inband/Makefile.am +++ b/usrp/host/lib/inband/Makefile.am @@ -23,7 +23,7 @@ include $(top_srcdir)/Makefile.common INCLUDES = \ $(DEFINES) $(OMNITHREAD_INCLUDES) $(PMT_INCLUDES) $(MBLOCK_INCLUDES) \ $(USRP_INCLUDES) $(BOOST_CFLAGS) $(CPPUNIT_INCLUDES) \ - -I$(srcdir)/../../apps + -I$(srcdir)/../../apps-inband TESTS = test_inband @@ -52,7 +52,7 @@ usrp_interface_mbh.cc : usrp_interface.mbh libusrp_inband_la_SOURCES = \ $(BUILT_SOURCES) \ - ../../apps/ui_sincos.c \ + $(srcdir)/../../apps-inband/ui_sincos.c \ usrp_inband_usb_packet.cc \ usrp_rx.cc \ usrp_rx_stub.cc \ @@ -65,7 +65,7 @@ libusrp_inband_la_LDFLAGS = $(NO_UNDEFINED) -version-info 0:0:0 libusrp_inband_la_LIBADD = \ $(MBLOCK_LA) \ - ../legacy/libusrp.la \ + $(USRP_LA) \ -lstdc++ include_HEADERS = \ @@ -103,12 +103,9 @@ libusrp_inband_qa_la_SOURCES = \ # magic flags libusrp_inband_qa_la_LDFLAGS = $(NO_UNDEFINED) -avoid-version -# link against c++ standard library libusrp_inband_qa_la_LIBADD = \ libusrp_inband.la \ $(CPPUNIT_LIBS) \ - ../legacy/libusrp.la \ - libusrp_inband.la \ -lstdc++ # ------------------------------------------------------------------------ -- 2.30.2