summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJörgen Scott <jorgen.scott@gmail.com>2014-12-16 09:23:31 +0100
committerJörgen Scott <jorgen.scott@gmail.com>2014-12-16 09:23:31 +0100
commitf4e359f774eef5ec2a006a431a546e915b27f02b (patch)
tree27aad5426ae25a5abc513aec35434d80979feebb
parent855311975814891f531577f90115bfb5fa6ed252 (diff)
downloaddabmod-f4e359f774eef5ec2a006a431a546e915b27f02b.tar.gz
dabmod-f4e359f774eef5ec2a006a431a546e915b27f02b.tar.bz2
dabmod-f4e359f774eef5ec2a006a431a546e915b27f02b.zip
Added static delay via telnet control
-rw-r--r--config.h.in189
-rw-r--r--doc/.example.ini.un~bin0 -> 13605 bytes
-rw-r--r--doc/example.ini13
-rw-r--r--doc/fir-filter/.README.un~bin0 -> 519 bytes
-rwxr-xr-xdoc/fir-filter/.generate-filter.py.un~bin0 -> 3536 bytes
-rw-r--r--src/.DabMod.cpp.un~bin0 -> 30089 bytes
-rw-r--r--src/.OutputUHD.cpp.un~bin0 -> 67312 bytes
-rw-r--r--src/.OutputUHD.h.un~bin0 -> 13690 bytes
-rw-r--r--src/.TimestampDecoder.cpp.un~bin0 -> 4958 bytes
-rw-r--r--src/DabMod.cpp3
-rw-r--r--src/OutputUHD.cpp56
-rw-r--r--src/OutputUHD.h5
12 files changed, 255 insertions, 11 deletions
diff --git a/config.h.in b/config.h.in
new file mode 100644
index 0000000..cd9076d
--- /dev/null
+++ b/config.h.in
@@ -0,0 +1,189 @@
+/* config.h.in. Generated from configure.ac by autoheader. */
+
+/* define if the Boost library is available */
+#undef HAVE_BOOST
+
+/* Define to 1 if you have the `bzero' function. */
+#undef HAVE_BZERO
+
+/* Define to 1 if you have the declaration of `_mm_malloc', and to 0 if you
+ don't. */
+#undef HAVE_DECL__MM_MALLOC
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#undef HAVE_FCNTL_H
+
+/* Define to 1 if you have the `floor' function. */
+#undef HAVE_FLOOR
+
+/* Define to 1 if you have the `ftime' function. */
+#undef HAVE_FTIME
+
+/* Define to 1 if you have the `gettimeofday' function. */
+#undef HAVE_GETTIMEOFDAY
+
+/* Define if ZeroMQ input is enabled */
+#undef HAVE_INPUT_ZEROMQ
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the `boost_system' library (-lboost_system). */
+#undef HAVE_LIBBOOST_SYSTEM
+
+/* Define to 1 if you have the `boost_thread' library (-lboost_thread). */
+#undef HAVE_LIBBOOST_THREAD
+
+/* Define to 1 if you have the `duma' library (-lduma). */
+#undef HAVE_LIBDUMA
+
+/* Define to 1 if you have the `efence' library (-lefence). */
+#undef HAVE_LIBEFENCE
+
+/* Define to 1 if you have the `rt' library (-lrt). */
+#undef HAVE_LIBRT
+
+/* Define to 1 if you have the `uhd' library (-luhd). */
+#undef HAVE_LIBUHD
+
+/* Define to 1 if you have the `zmq' library (-lzmq). */
+#undef HAVE_LIBZMQ
+
+/* Define to 1 if you have the <limits.h> header file. */
+#undef HAVE_LIMITS_H
+
+/* Define to 1 if you have the <malloc.h> header file. */
+#undef HAVE_MALLOC_H
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the `memset' function. */
+#undef HAVE_MEMSET
+
+/* Define to 1 if you have the <netinet/in.h> header file. */
+#undef HAVE_NETINET_IN_H
+
+/* Define if UHD output is enabled */
+#undef HAVE_OUTPUT_UHD
+
+/* Define to 1 if you have the `sqrt' function. */
+#undef HAVE_SQRT
+
+/* Define to 1 if stdbool.h conforms to C99. */
+#undef HAVE_STDBOOL_H
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the `strchr' function. */
+#undef HAVE_STRCHR
+
+/* Define to 1 if you have the `strerror' function. */
+#undef HAVE_STRERROR
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the `strtol' function. */
+#undef HAVE_STRTOL
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/timeb.h> header file. */
+#undef HAVE_SYS_TIMEB_H
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#undef HAVE_SYS_TIME_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to 1 if the system has the type `_Bool'. */
+#undef HAVE__BOOL
+
+/* Replacing define */
+#undef M_PIl
+
+/* Name of package */
+#undef PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Define as the return type of signal handlers (`int' or `void'). */
+#undef RETSIGTYPE
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+#undef TIME_WITH_SYS_TIME
+
+/* Version number of package */
+#undef VERSION
+
+/* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,
+ <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
+ #define below would cause a syntax error. */
+#undef _UINT32_T
+
+/* Define for Solaris 2.5.1 so the uint8_t typedef from <sys/synch.h>,
+ <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
+ #define below would cause a syntax error. */
+#undef _UINT8_T
+
+/* __16BIT__, __64BIT__ */
+#undef __32BIT__
+
+/* __16BIT__, __32BIT__ */
+#undef __64BIT__
+
+/* Define to empty if `const' does not conform to ANSI C. */
+#undef const
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+ calls it, or to nothing if 'inline' is not supported under any name. */
+#ifndef __cplusplus
+#undef inline
+#endif
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+#undef size_t
+
+/* Define to the type of an unsigned integer type of width exactly 16 bits if
+ such a type exists and the standard includes do not define it. */
+#undef uint16_t
+
+/* Define to the type of an unsigned integer type of width exactly 32 bits if
+ such a type exists and the standard includes do not define it. */
+#undef uint32_t
+
+/* Define to the type of an unsigned integer type of width exactly 8 bits if
+ such a type exists and the standard includes do not define it. */
+#undef uint8_t
diff --git a/doc/.example.ini.un~ b/doc/.example.ini.un~
new file mode 100644
index 0000000..d500812
--- /dev/null
+++ b/doc/.example.ini.un~
Binary files differ
diff --git a/doc/example.ini b/doc/example.ini
index 1c25529..49f6eda 100644
--- a/doc/example.ini
+++ b/doc/example.ini
@@ -25,7 +25,7 @@ loop=0
; When recieving data using ZeroMQ, the source is the URI to be used
;transport=zeromq
-;source=zmq+tcp://localhost:8080
+;source=tcp://localhost:8080
[modulator]
; Gain mode: 0=FIX, 1=MAX, 2=VAR
@@ -59,7 +59,7 @@ gainmode=2
; and wide-band noise will be generated.
;
; Be aware that there is a dependency with resampling.
-digital_gain=1.0
+digital_gain=0.8
; Output sample rate. Values other than 2048000 enable
; resampling.
@@ -106,8 +106,8 @@ filename=/dev/stdout
; or even a higher factor.
;
; Settings for a USRP B100:
-device=master_clock_rate=32768000,type=b100
-txgain=2
+;device=master_clock_rate=32768000,type=b100
+;txgain=2
; Try first with small gain values
; Also set rate to 2048000
@@ -116,8 +116,9 @@ txgain=2
; http://opendigitalradio.org/index.php/USRP_B200_Measurements
;
; Settings:
+device=master_clock_rate=2048000,type=b200
;device=master_clock_rate=20480000,type=b200
-;txgain=40
+txgain=40
; The B200 needs larger gains (up to 89dB) but,
; "Gain settings are application specific, but it is recommended that users
; consider using at least half of the available gain to get reasonable dynamic
@@ -140,7 +141,7 @@ channel=13C
; The reference clock to use.
; possible values : internal, external, MIMO
-refclk_source=internal
+refclk_source=external
; The reference one pulse-per second to use
; possible values : none, external, MIMO
diff --git a/doc/fir-filter/.README.un~ b/doc/fir-filter/.README.un~
new file mode 100644
index 0000000..b4a2d9d
--- /dev/null
+++ b/doc/fir-filter/.README.un~
Binary files differ
diff --git a/doc/fir-filter/.generate-filter.py.un~ b/doc/fir-filter/.generate-filter.py.un~
new file mode 100755
index 0000000..573ffae
--- /dev/null
+++ b/doc/fir-filter/.generate-filter.py.un~
Binary files differ
diff --git a/src/.DabMod.cpp.un~ b/src/.DabMod.cpp.un~
new file mode 100644
index 0000000..ebbb822
--- /dev/null
+++ b/src/.DabMod.cpp.un~
Binary files differ
diff --git a/src/.OutputUHD.cpp.un~ b/src/.OutputUHD.cpp.un~
new file mode 100644
index 0000000..96f080d
--- /dev/null
+++ b/src/.OutputUHD.cpp.un~
Binary files differ
diff --git a/src/.OutputUHD.h.un~ b/src/.OutputUHD.h.un~
new file mode 100644
index 0000000..5f3e54a
--- /dev/null
+++ b/src/.OutputUHD.h.un~
Binary files differ
diff --git a/src/.TimestampDecoder.cpp.un~ b/src/.TimestampDecoder.cpp.un~
new file mode 100644
index 0000000..01d7cc7
--- /dev/null
+++ b/src/.TimestampDecoder.cpp.un~
Binary files differ
diff --git a/src/DabMod.cpp b/src/DabMod.cpp
index 14c7c4b..ee21ed4 100644
--- a/src/DabMod.cpp
+++ b/src/DabMod.cpp
@@ -363,6 +363,9 @@ int main(int argc, char* argv[])
}
}
+ //std::string zmqCtrlEndpoint = pt.get("remotecontrol.zmqctrlendpoint", "");
+ //std::cout << "ZmqCtrlEndpoint: " << zmqCtrlEndpoint << std::endl;
+
// input params:
if (pt.get("input.loop", 0) == 1) {
loop = true;
diff --git a/src/OutputUHD.cpp b/src/OutputUHD.cpp
index b44cd3f..8713042 100644
--- a/src/OutputUHD.cpp
+++ b/src/OutputUHD.cpp
@@ -53,10 +53,12 @@ OutputUHD::OutputUHD(
// Since we don't know the buffer size, we cannot initialise
// the buffers at object initialisation.
first_run(true),
- activebuffer(1)
+ activebuffer(1),
+ m_delayBuf(196608)
{
myMuting = 0; // is remote-controllable
+ myStaticDelay = 0; // is remote-controllable
std::stringstream device;
device << myConf.device;
@@ -81,7 +83,9 @@ OutputUHD::OutputUHD(
/* register the parameters that can be remote controlled */
RC_ADD_PARAMETER(txgain, "UHD analog daughterboard TX gain");
RC_ADD_PARAMETER(freq, "UHD transmission frequency");
- RC_ADD_PARAMETER(muting, "mute the output by stopping the transmitter");
+ RC_ADD_PARAMETER(muting, "Mute the output by stopping the transmitter");
+ RC_ADD_PARAMETER(staticdelay, "Set static delay (uS) between 0 and 96000");
+ RC_ADD_PARAMETER(iqbalance, "Set I/Q balance between 0 and 1.0");
uhd::set_thread_priority_safe();
@@ -229,6 +233,10 @@ OutputUHD::~OutputUHD()
{
MDEBUG("OutputUHD::~OutputUHD() @ %p\n", this);
worker.stop();
+ if (!first_run) {
+ free(uwd.frame0.buf);
+ free(uwd.frame1.buf);
+ }
}
int OutputUHD::process(Buffer* dataIn, Buffer* dataOut)
@@ -283,14 +291,35 @@ int OutputUHD::process(Buffer* dataIn, Buffer* dataOut)
uwd.sourceContainsTimestamp = myConf.enableSync &&
myEtiReader->sourceContainsTimestamp();
+ // calculate delay
+ uint32_t noSampleDelay = (myStaticDelay * 2048) / 1000;
+ uint32_t noByteDelay = noSampleDelay * sizeof(complexf);
+
+ uint8_t* pInData = (uint8_t*) dataIn->getData();
if (activebuffer == 0) {
- memcpy(uwd.frame0.buf, dataIn->getData(), uwd.bufsize);
+ uint8_t *pTmp = (uint8_t*) uwd.frame0.buf;
+ // copy remain from delaybuf
+ memcpy(pTmp, &m_delayBuf[0], noByteDelay);
+ // copy new data
+ memcpy(&pTmp[noByteDelay], pInData, uwd.bufsize - noByteDelay);
+ // copy remaining data to delay buf
+ memcpy(&m_delayBuf[0], &pInData[uwd.bufsize - noByteDelay], noByteDelay);
+
+ //memcpy(uwd.frame0.buf, dataIn->getData(), uwd.bufsize);
uwd.frame0.ts = ts;
uwd.frame0.fct = myEtiReader->getFCT();
}
else if (activebuffer == 1) {
- memcpy(uwd.frame1.buf, dataIn->getData(), uwd.bufsize);
+ uint8_t *pTmp = (uint8_t*) uwd.frame1.buf;
+ // copy remain from delaybuf
+ memcpy(pTmp, &m_delayBuf[0], noByteDelay);
+ // copy new data
+ memcpy(&pTmp[noByteDelay], pInData, uwd.bufsize - noByteDelay);
+ // copy remaining data to delay buf
+ memcpy(&m_delayBuf[0], &pInData[uwd.bufsize - noByteDelay], noByteDelay);
+
+ //memcpy(uwd.frame1.buf, dataIn->getData(), uwd.bufsize);
uwd.frame1.ts = ts;
uwd.frame1.fct = myEtiReader->getFCT();
@@ -591,6 +620,22 @@ void OutputUHD::set_parameter(const string& parameter, const string& value)
else if (parameter == "muting") {
ss >> myMuting;
}
+ else if (parameter == "staticdelay") {
+ int adjust;
+ ss >> adjust;
+ int newStaticDelay = myStaticDelay + adjust;
+ if (newStaticDelay > 96000)
+ myStaticDelay = newStaticDelay - 96000;
+ else if (newStaticDelay < 0)
+ myStaticDelay = newStaticDelay + 96000;
+ else
+ myStaticDelay = newStaticDelay;
+ }
+ else if (parameter == "iqbalance") {
+ ss >> myConf.frequency;
+ myUsrp->set_tx_freq(myConf.frequency);
+ myConf.frequency = myUsrp->get_tx_freq();
+ }
else {
stringstream ss;
ss << "Parameter '" << parameter
@@ -611,6 +656,9 @@ const string OutputUHD::get_parameter(const string& parameter) const
else if (parameter == "muting") {
ss << myMuting;
}
+ else if (parameter == "staticdelay") {
+ ss << myStaticDelay;
+ }
else {
ss << "Parameter '" << parameter <<
"' is not exported by controllable " << get_rc_name();
diff --git a/src/OutputUHD.h b/src/OutputUHD.h
index 69e5b20..f50807d 100644
--- a/src/OutputUHD.h
+++ b/src/OutputUHD.h
@@ -48,6 +48,7 @@ DESCRIPTION:
#include <boost/shared_ptr.hpp>
#include <list>
#include <string>
+#include <zmq.hpp>
#include "Log.h"
#include "ModOutput.h"
@@ -220,7 +221,9 @@ class OutputUHD: public ModOutput, public RemoteControllable {
// muting can only be changed using the remote control
bool myMuting;
-
+ int myStaticDelay;
+ std::vector<complexf> m_delayBuf;
+
size_t lastLen;
};