summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--configure.ac9
-rw-r--r--src/DabMod.cpp33
-rw-r--r--src/Makefile.am8
3 files changed, 47 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac
index 0362102..e01c409 100644
--- a/configure.ac
+++ b/configure.ac
@@ -66,6 +66,9 @@ AC_ARG_ENABLE([fft_simd],
# ZeroMQ message queue input
AC_ARG_ENABLE([input_zeromq],
AS_HELP_STRING([--enable-input-zeromq], [Enable ZeroMQ input]))
+# UHD support control
+AC_ARG_ENABLE([output_uhd],
+ AS_HELP_STRING([--enable-output-uhd], [Enable UHD output]))
AS_IF([test "x$enable_input_zeromq" = "xyes"],
[AC_DEFINE(HAVE_INPUT_ZEROMQ, [1], [Define if ZeroMQ input is enabled]) ,
@@ -86,7 +89,11 @@ AM_CONDITIONAL([HAVE_INPUT_ZEROMQ_TEST], [test "x$enable_input_zeromq" = "xyes"]
AC_SUBST([CFLAGS], ["$OPTIM $DEBUG $EXTRA"])
AC_SUBST([CXXFLAGS], ["$OPTIM $DEBUG $EXTRA"])
-AC_CHECK_LIB([uhd], [main], [], [AC_MSG_ERROR([library uhd is missing])])
+AS_IF([test "x$enable_output_uhd" = "xyes"],
+ [AC_DEFINE(HAVE_OUTPUT_UHD, [1], [Define if UHD output is enabled]) ,
+ AC_CHECK_LIB([uhd], [main], [], [AC_MSG_ERROR([library uhd is missing])])])
+
+AM_CONDITIONAL([HAVE_OUTPUT_UHD_TEST], [test "x$enable_output_uhd" = "xyes"])
AX_BOOST_BASE([1.41.0], [], AC_MSG_ERROR([BOOST 1.41 or later is required]))
AC_CHECK_LIB([boost_system], [main], [], [AC_MSG_ERROR([library boost_system is missing])])
diff --git a/src/DabMod.cpp b/src/DabMod.cpp
index 13e4904..7bf476f 100644
--- a/src/DabMod.cpp
+++ b/src/DabMod.cpp
@@ -35,7 +35,9 @@
#include "DabModulator.h"
#include "InputMemory.h"
#include "OutputFile.h"
-#include "OutputUHD.h"
+#if defined(HAVE_OUTPUT_UHD)
+# include "OutputUHD.h"
+#endif
#include "InputReader.h"
#include "PcDebug.h"
#include "TimestampDecoder.h"
@@ -165,7 +167,9 @@ int main(int argc, char* argv[])
std::string outputName;
int useFileOutput = 0;
+//#if defined(HAVE_OUTPUT_UHD)
int useUHDOutput = 0;
+//#endif
uint64_t frame = 0;
size_t outputRate = 2048000;
@@ -182,7 +186,9 @@ int main(int argc, char* argv[])
bool use_configuration_file = false;
std::string configuration_file;
+#if defined(HAVE_OUTPUT_UHD)
OutputUHDConfig outputuhd_conf;
+#endif
// To handle the timestamp offset of the modulator
struct modulator_offset_config modconf;
@@ -233,21 +239,27 @@ int main(int argc, char* argv[])
clockRate = strtol(optarg, NULL, 0);
break;
case 'f':
+#if defined(HAVE_OUTPUT_UHD)
if (useUHDOutput) {
fprintf(stderr, "Options -u and -f are mutually exclusive\n");
goto END_MAIN;
}
+#endif
outputName = optarg;
useFileOutput = 1;
break;
case 'F':
+#if defined(HAVE_OUTPUT_UHD)
outputuhd_conf.frequency = strtof(optarg, NULL);
+#endif
break;
case 'g':
gainMode = (GainMode)strtol(optarg, NULL, 0);
break;
case 'G':
+#if defined(HAVE_OUTPUT_UHD)
outputuhd_conf.txgain = (int)strtol(optarg, NULL, 10);
+#endif
break;
case 'l':
loop = true;
@@ -260,7 +272,9 @@ int main(int argc, char* argv[])
}
modconf.use_offset_fixed = true;
modconf.offset_fixed = strtod(optarg, NULL);
+#if defined(HAVE_OUTPUT_UHD)
outputuhd_conf.enableSync = true;
+#endif
break;
case 'O':
if (modconf.use_offset_fixed)
@@ -270,7 +284,9 @@ int main(int argc, char* argv[])
}
modconf.use_offset_file = true;
modconf.offset_filename = std::string(optarg);
+#if defined(HAVE_OUTPUT_UHD)
outputuhd_conf.enableSync = true;
+#endif
break;
case 'm':
dabMode = strtol(optarg, NULL, 0);
@@ -282,12 +298,14 @@ int main(int argc, char* argv[])
filterTapsFilename = optarg;
break;
case 'u':
+#if defined(HAVE_OUTPUT_UHD)
if (useFileOutput) {
fprintf(stderr, "Options -u and -f are mutually exclusive\n");
goto END_MAIN;
}
outputuhd_conf.device = optarg;
useUHDOutput = 1;
+#endif
break;
case 'V':
printVersion();
@@ -421,6 +439,7 @@ int main(int argc, char* argv[])
}
useFileOutput = 1;
}
+#if defined(HAVE_OUTPUT_UHD)
else if (output_selected == "uhd") {
outputuhd_conf.device = pt.get("uhdoutput.device", "");
outputuhd_conf.usrpType = pt.get("uhdoutput.type", "");
@@ -515,11 +534,13 @@ int main(int argc, char* argv[])
useUHDOutput = 1;
}
+#endif
else {
std::cerr << "Error: Invalid output defined.\n";
goto END_MAIN;
}
+#if defined(HAVE_OUTPUT_UHD)
outputuhd_conf.enableSync = (pt.get("delaymanagement.synchronous", 0) == 1);
if (outputuhd_conf.enableSync) {
try {
@@ -544,6 +565,7 @@ int main(int argc, char* argv[])
}
outputuhd_conf.muteNoTimestamps = (pt.get("delaymanagement.mutenotimestamps", 0) == 1);
+#endif
}
logger.level(info) << "Starting up";
@@ -600,6 +622,7 @@ int main(int argc, char* argv[])
fprintf(stderr, " Type: %s\n", inputTransport.c_str());
fprintf(stderr, " Source: %s\n", inputName.c_str());
fprintf(stderr, "Output\n");
+#if defined(HAVE_OUTPUT_UHD)
if (useUHDOutput) {
fprintf(stderr, " UHD\n"
" Device: %s\n"
@@ -610,6 +633,9 @@ int main(int argc, char* argv[])
outputuhd_conf.masterClockRate);
}
else if (useFileOutput) {
+#else
+ if (useFileOutput) {
+#endif
fprintf(stderr, " Name: %s\n", outputName.c_str());
}
fprintf(stderr, " Sampling rate: ");
@@ -656,6 +682,7 @@ int main(int argc, char* argv[])
// Opening COFDM output file
output = new OutputFile(outputName);
}
+#if defined(HAVE_OUTPUT_UHD)
else if (useUHDOutput) {
amplitude /= 32000.0f;
outputuhd_conf.sampleRate = outputRate;
@@ -668,6 +695,7 @@ int main(int argc, char* argv[])
goto END_MAIN;
}
}
+#endif
flowgraph = new Flowgraph();
data.setLength(6144);
@@ -677,9 +705,11 @@ int main(int argc, char* argv[])
flowgraph->connect(input, modulator);
flowgraph->connect(modulator, output);
+#if defined(HAVE_OUTPUT_UHD)
if (useUHDOutput) {
((OutputUHD*)output)->setETIReader(modulator->getEtiReader());
}
+#endif
inputReader->PrintInfo();
@@ -746,3 +776,4 @@ END_MAIN:
return ret;
}
+
diff --git a/src/Makefile.am b/src/Makefile.am
index 95584e7..3e851c4 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -28,6 +28,12 @@ else
ZMQ_LIBS =
endif
+if HAVE_OUTPUT_UHD_TEST
+UHD_SOURCES =OutputUHD.cpp OutputUHD.h
+else
+UHD_SOURCES =
+endif
+
FFT_DIR=$(top_builddir)/lib/kiss_fft129
FFT_INC=-I$(FFT_DIR) -I$(FFT_DIR)/tools
FFT_SRC=$(FFT_DIR)/kiss_fft.c $(FFT_DIR)/kiss_fft.h $(FFT_DIR)/tools/kiss_fftr.c $(FFT_DIR)/tools/kiss_fftr.h kiss_fftsimd.c kiss_fftsimd.h
@@ -68,7 +74,7 @@ odr_dabmod_SOURCES = DabMod.cpp \
GainControl.cpp GainControl.h \
OutputMemory.cpp OutputMemory.h \
TimestampDecoder.h TimestampDecoder.cpp \
- OutputUHD.cpp OutputUHD.h \
+ $(UHD_SOURCES) \
ModOutput.cpp ModOutput.h \
InputMemory.cpp InputMemory.h \
InputFileReader.cpp InputZeroMQReader.cpp InputReader.h \