diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2018-04-16 10:15:25 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2018-04-16 10:15:25 +0200 |
commit | 5e08ec5d0d71857b21536221f6fda9c936afa7e0 (patch) | |
tree | 6492bc3d1315aa285ad0424e0f71a8de7bee5f4c | |
parent | a878abd2aa41f530a558ee83639832d907a24029 (diff) | |
download | dabmod-5e08ec5d0d71857b21536221f6fda9c936afa7e0.tar.gz dabmod-5e08ec5d0d71857b21536221f6fda9c936afa7e0.tar.bz2 dabmod-5e08ec5d0d71857b21536221f6fda9c936afa7e0.zip |
Do not compile useless files for easydabv3
-rw-r--r-- | Makefile.am | 82 | ||||
-rw-r--r-- | configure.ac | 13 | ||||
-rw-r--r-- | doc/easydabv3.ini | 37 | ||||
-rw-r--r-- | doc/example.ini | 2 | ||||
-rw-r--r-- | src/DabMod.cpp | 30 | ||||
-rw-r--r-- | src/Utils.cpp | 36 |
6 files changed, 129 insertions, 71 deletions
diff --git a/Makefile.am b/Makefile.am index 71b0ef2..a64ddf1 100644 --- a/Makefile.am +++ b/Makefile.am @@ -60,10 +60,6 @@ odr_dabmod_SOURCES = src/DabMod.cpp \ src/Eti.h \ src/FicSource.cpp \ src/FicSource.h \ - src/FIRFilter.cpp \ - src/FIRFilter.h \ - src/MemlessPoly.cpp \ - src/MemlessPoly.h \ src/PuncturingRule.cpp \ src/PuncturingRule.h \ src/PuncturingEncoder.cpp \ @@ -72,25 +68,12 @@ odr_dabmod_SOURCES = src/DabMod.cpp \ src/SubchannelSource.h \ src/Flowgraph.cpp \ src/Flowgraph.h \ - src/GainControl.cpp \ - src/GainControl.h \ src/OutputMemory.cpp \ src/OutputMemory.h \ src/OutputZeroMQ.cpp \ src/OutputZeroMQ.h \ src/TimestampDecoder.h \ src/TimestampDecoder.cpp \ - src/output/Feedback.cpp \ - src/output/Feedback.h \ - src/output/SDR.cpp \ - src/output/SDR.h \ - src/output/SDRDevice.h \ - src/output/Soapy.cpp \ - src/output/Soapy.h \ - src/output/UHD.cpp \ - src/output/UHD.h \ - src/output/USRPTime.cpp \ - src/output/USRPTime.h \ src/InputFileReader.cpp \ src/InputMemory.cpp \ src/InputMemory.h \ @@ -105,26 +88,8 @@ odr_dabmod_SOURCES = src/DabMod.cpp \ src/PrbsGenerator.h \ src/BlockPartitioner.cpp \ src/BlockPartitioner.h \ - src/QpskSymbolMapper.cpp \ - src/QpskSymbolMapper.h \ - src/FrequencyInterleaver.cpp \ - src/FrequencyInterleaver.h \ - src/PhaseReference.cpp \ - src/PhaseReference.h \ - src/DifferentialModulator.cpp \ - src/DifferentialModulator.h \ - src/NullSymbol.cpp \ - src/NullSymbol.h \ src/SignalMultiplexer.cpp \ src/SignalMultiplexer.h \ - src/CicEqualizer.cpp \ - src/CicEqualizer.h \ - src/OfdmGenerator.cpp \ - src/OfdmGenerator.h \ - src/GuardIntervalInserter.cpp \ - src/GuardIntervalInserter.h \ - src/Resampler.cpp \ - src/Resampler.h \ src/ConvEncoder.cpp \ src/ConvEncoder.h \ src/TimeInterleaver.cpp \ @@ -138,10 +103,6 @@ odr_dabmod_SOURCES = src/DabMod.cpp \ src/FormatConverter.h \ src/Utils.cpp \ src/Utils.h \ - src/TII.cpp \ - src/TII.h \ - src/PAPRStats.cpp \ - src/PAPRStats.h \ src/zmq.hpp \ lib/INIReader.h \ lib/crc.h \ @@ -156,6 +117,49 @@ odr_dabmod_SOURCES = src/DabMod.cpp \ lib/fec/init_rs.h \ lib/fec/rs-common.h +if !COMPILE_FOR_EASYDABV3 +odr_dabmod_SOURCES += \ + src/FIRFilter.cpp \ + src/FIRFilter.h \ + src/MemlessPoly.cpp \ + src/MemlessPoly.h \ + src/GainControl.cpp \ + src/GainControl.h \ + src/output/Feedback.cpp \ + src/output/Feedback.h \ + src/output/SDR.cpp \ + src/output/SDR.h \ + src/output/SDRDevice.h \ + src/output/Soapy.cpp \ + src/output/Soapy.h \ + src/output/UHD.cpp \ + src/output/UHD.h \ + src/output/USRPTime.cpp \ + src/output/USRPTime.h \ + src/PhaseReference.cpp \ + src/PhaseReference.h \ + src/QpskSymbolMapper.cpp \ + src/QpskSymbolMapper.h \ + src/FrequencyInterleaver.cpp \ + src/FrequencyInterleaver.h \ + src/DifferentialModulator.cpp \ + src/DifferentialModulator.h \ + src/NullSymbol.cpp \ + src/NullSymbol.h \ + src/CicEqualizer.cpp \ + src/CicEqualizer.h \ + src/OfdmGenerator.cpp \ + src/OfdmGenerator.h \ + src/GuardIntervalInserter.cpp \ + src/GuardIntervalInserter.h \ + src/Resampler.cpp \ + src/Resampler.h \ + src/PAPRStats.cpp \ + src/PAPRStats.h \ + src/TII.cpp \ + src/TII.h +endif + if COMPILE_EDI odr_dabmod_SOURCES += lib/edi/buffer_unpack.hpp \ lib/edi/eti.hpp \ diff --git a/configure.ac b/configure.ac index 1d5cf4e..da26c64 100644 --- a/configure.ac +++ b/configure.ac @@ -97,16 +97,21 @@ AS_IF([test "x$enable_trace" != "xno"], # Define conditionals for Makefile.am AM_CONDITIONAL([IS_GIT_REPO], [test -d '.git']) +AM_CONDITIONAL([COMPILE_FOR_EASYDABV3], [test "x$enable_easydabv3" = "xyes"]) # Defines for config.h AX_PTHREAD([], AC_MSG_ERROR([requires pthread])) -PKG_CHECK_MODULES([SOAPYSDR], [SoapySDR], enable_soapysdr=yes, enable_soapysdr=no) +AS_IF([test "x$enable_easydabv3" = "xno"], + [PKG_CHECK_MODULES([SOAPYSDR], [SoapySDR], enable_soapysdr=yes, enable_soapysdr=no)]) AC_SUBST([CFLAGS], ["$CFLAGS $EXTRA $FFTW_CFLAGS $SOAPYSDR_CFLAGS $PTHREAD_CFLAGS"]) AC_SUBST([CXXFLAGS], ["$CXXFLAGS $EXTRA $FFTW_CFLAGS $SOAPYSDR_CFLAGS $PTHREAD_CFLAGS"]) AC_SUBST([LIBS], ["$FFTW_LIBS $SOAPYSDR_LIBS $PTHREAD_LIBS $ZMQ_LIBS"]) +AS_IF([test "x$enable_easydabv3" = "xyes" && test "x$enable_output_uhd" == "xyes"], + AC_MSG_ERROR([Cannot enable both EasyDABv3 and UHD output])) + # Checks for UHD. AS_IF([test "x$enable_output_uhd" = "xyes"], [ AC_CHECK_LIB([uhd], [main], [], [AC_MSG_ERROR([library uhd is missing])]) @@ -128,8 +133,10 @@ AS_IF([test "x$enable_easydabv3" = "xno"], AX_BOOST_SYSTEM AX_BOOST_ASIO ]) -AC_DEFINE(HAVE_BOOST, [test "x$enable_easydabv3" = "xno"], [Define if boost is available]) -AC_DEFINE(BUILD_FOR_EASYDABV3, [test "x$enable_easydabv3" = "xyes"], [Define if we are building for EasyDABv3]) +AS_IF([test "x$enable_easydabv3" = "xno"], + AC_DEFINE(HAVE_BOOST, [1], [Define if boost is available])) +AS_IF([test "x$enable_easydabv3" = "xyes"], + AC_DEFINE(BUILD_FOR_EASYDABV3, [1], [Define if we are building for EasyDABv3])) # Checks for header files. diff --git a/doc/easydabv3.ini b/doc/easydabv3.ini new file mode 100644 index 0000000..5f0103f --- /dev/null +++ b/doc/easydabv3.ini @@ -0,0 +1,37 @@ +; This sample configuration is useful if ODR-DabMod is compiled +; with --enable-easydabv3 + +[remotecontrol] +zmqctrl=1 +zmqctrlendpoint=tcp://127.0.0.1:9400 +; There is no telnet RC available in this build + + +[log] +syslog=0 +filelog=0 +filename=odr-dabmod.log + +[input] +transport=zeromq +source=tcp://localhost:9100 +max_frames_queued=400 + +; There are no [modulator], [cfr], [firfilter], [poly] nor [tii] sections + +[output] +output=file + +[fileoutput] +; to be confirmed +format=complexf + +filename=/dev/csdiof1 + +show_metadata=0 +; TODO add option for writing out timestamps to csdiof1 + +[delaymanagement] +synchronous=0 +mutenotimestamps=0 +offset=1.002 diff --git a/doc/example.ini b/doc/example.ini index 4f8115e..ae5ed46 100644 --- a/doc/example.ini +++ b/doc/example.ini @@ -33,7 +33,7 @@ loop=0 ; When recieving data using ZeroMQ, the source is the URI to be used ;transport=zeromq -;source=tcp://localhost:8080 +;source=tcp://localhost:9100 ; The option max_frames_queued defines the maximum number of ETI frames ; (frame duration: 24ms) that can be in the input queue ;max_frames_queued=100 diff --git a/src/DabMod.cpp b/src/DabMod.cpp index 0d4a180..bc32b9d 100644 --- a/src/DabMod.cpp +++ b/src/DabMod.cpp @@ -29,6 +29,22 @@ # include "config.h" #endif +#include <memory> +#include <complex> +#include <string> +#include <iostream> +#include <iomanip> +#include <cstdlib> +#include <stdexcept> +#include <cstdio> +#include <cstddef> +#include <sys/stat.h> +#include <signal.h> + +#if HAVE_NETINET_IN_H +# include <netinet/in.h> +#endif + #include "Utils.h" #include "Log.h" #include "DabModulator.h" @@ -47,20 +63,6 @@ #include "RemoteControl.h" #include "ConfigParser.h" -#include <memory> -#include <complex> -#include <string> -#include <stdlib.h> -#include <stdio.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <stdexcept> -#include <signal.h> - -#if HAVE_NETINET_IN_H -# include <netinet/in.h> -#endif - /* UHD requires the input I and Q samples to be in the interval * [-1.0,1.0], otherwise they get truncated, which creates very * wide-spectrum spikes. Depending on the Transmission Mode, the diff --git a/src/Utils.cpp b/src/Utils.cpp index 4d97359..50af4fb 100644 --- a/src/Utils.cpp +++ b/src/Utils.cpp @@ -62,12 +62,14 @@ static void printHeader() "SSE " << #endif "\n"; + +#if defined(BUILD_FOR_EASYDABV3) + std::cerr << " This is a build for the EasyDABv3 board" << std::endl; +#endif } void printUsage(const char* progName) { - printHeader(); - FILE* out = stderr; fprintf(out, "Usage with configuration file:\n"); fprintf(out, "\t%s config_file.ini\n\n", progName); @@ -75,19 +77,25 @@ void printUsage(const char* progName) fprintf(out, "Usage with command line options:\n"); fprintf(out, "\t%s" " input" +#if defined(BUILD_FOR_EASYDABV3) + " -f filename -F format" +#else " (-f filename -F format | -u uhddevice -F frequency)" +#endif + " [-o offset]" +#if !defined(BUILD_FOR_EASYDABV3) "\n\t" " [-G txgain]" - " [-o offset]" " [-T filter_taps_file]" " [-a gain]" " [-c clockrate]" "\n\t" " [-g gainMode]" - " [-h]" - " [-l]" " [-m dabMode]" " [-r samplingRate]" +#endif + " [-l]" + " [-h]" "\n", progName); fprintf(out, "Where:\n"); fprintf(out, "input: ETI input filename (default: stdin), or\n"); @@ -96,35 +104,35 @@ void printUsage(const char* progName) fprintf(out, " udp://:port for EDI input.\n"); fprintf(out, "-f name: Use file output with given filename. (use /dev/stdout for standard output)\n"); fprintf(out, "-F format: Set the output format (see doc/example.ini for formats) for the file output.\n"); - fprintf(out, "-u device: Use UHD output with given device string. (use "" for default device)\n"); - fprintf(out, "-F frequency: Set the transmit frequency when using UHD output. (mandatory option when using UHD)\n"); - fprintf(out, "-G txgain: Set the transmit gain for the UHD driver (default: 0)\n"); - fprintf(out, "-o: (UHD only) Set the timestamp offset added to the timestamp in the ETI. The offset is a double.\n"); + fprintf(out, "-o: Set the timestamp offset added to the timestamp in the ETI. The offset is a double.\n"); fprintf(out, " Specifying this option has two implications: It enables synchronous transmission,\n" " requiring an external REFCLK and PPS signal and frames that do not contain a valid timestamp\n" " get muted.\n\n"); +#if !defined(BUILD_FOR_EASYDABV3) + fprintf(out, "-u device: Use UHD output with given device string. (use "" for default device)\n"); + fprintf(out, "-F frequency: Set the transmit frequency when using UHD output. (mandatory option when using UHD)\n"); + fprintf(out, "-G txgain: Set the transmit gain for the UHD driver (default: 0)\n"); fprintf(out, "-T taps_file: Enable filtering before the output, using the specified file containing the filter taps.\n"); fprintf(out, " Use 'default' as taps_file to use the internal taps.\n"); fprintf(out, "-a gain: Apply digital amplitude gain.\n"); fprintf(out, "-c rate: Set the DAC clock rate and enable Cic Equalisation.\n"); fprintf(out, "-g gainmode: Set computation gain mode: fix, max or var\n"); - fprintf(out, "-h: Print this help.\n"); - fprintf(out, "-l: Loop file when reach end of file.\n"); fprintf(out, "-m mode: Set DAB mode: (0: auto, 1-4: force).\n"); fprintf(out, "-r rate: Set output sampling rate (default: 2048000).\n\n"); +#endif + fprintf(out, "-l: Loop file when reach end of file.\n"); + fprintf(out, "-h: Print this help.\n"); } void printVersion(void) { - printHeader(); - FILE *out = stderr; fprintf(out, " ODR-DabMod is copyright (C) Her Majesty the Queen in Right of Canada,\n" " 2005 -- 2012 Communications Research Centre (CRC),\n" " and\n" - " Copyright (C) 2017 Matthias P. Braendli, matthias.braendli@mpb.li\n" + " Copyright (C) 2018 Matthias P. Braendli, matthias.braendli@mpb.li\n" "\n" " http://opendigitalradio.org\n" "\n" |