aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias (think) <matthias@mpb.li>2012-07-11 12:00:56 +0200
committerMatthias (think) <matthias@mpb.li>2012-07-11 12:00:56 +0200
commit4b814d92fe9787bf72ed3a9632e0866f4cedd27f (patch)
treefeb407e9f2c0658dda896c332864fe6d265aaece
parente92f9c408634810828e75d4ad6da408e1c142195 (diff)
downloaddabmod-4b814d92fe9787bf72ed3a9632e0866f4cedd27f.tar.gz
dabmod-4b814d92fe9787bf72ed3a9632e0866f4cedd27f.tar.bz2
dabmod-4b814d92fe9787bf72ed3a9632e0866f4cedd27f.zip
added crc-dabmod patch
-rw-r--r--aclocal.m44
-rw-r--r--config.h.in9
-rwxr-xr-xconfigure747
-rw-r--r--configure.ac6
-rw-r--r--doc/README-SFN111
-rw-r--r--src/BlockPartitioner.cpp12
-rw-r--r--src/BlockPartitioner.h4
-rw-r--r--src/CicEqualizer.cpp19
-rw-r--r--src/DabMod.cpp156
-rw-r--r--src/DabModulator.cpp62
-rw-r--r--src/DabModulator.h14
-rw-r--r--src/Eti.h40
-rw-r--r--src/EtiReader.cpp48
-rw-r--r--src/EtiReader.h26
-rw-r--r--src/FIRFilter.cpp311
-rw-r--r--src/FIRFilter.h157
-rw-r--r--src/Makefile.am3
-rw-r--r--src/Makefile.in54
-rw-r--r--src/OutputUHD.cpp466
-rw-r--r--src/OutputUHD.h167
-rw-r--r--src/PcDebug.h4
-rw-r--r--src/TimestampDecoder.cpp210
-rw-r--r--src/TimestampDecoder.h154
23 files changed, 2420 insertions, 364 deletions
diff --git a/aclocal.m4 b/aclocal.m4
index 40af876..abe9f6f 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -13,8 +13,8 @@
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
-m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.65],,
-[m4_warning([this file was generated for autoconf 2.65.
+m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
+[m4_warning([this file was generated for autoconf 2.68.
You have another version of autoconf. It may work, but is not guaranteed to.
If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically `autoreconf'.])])
diff --git a/config.h.in b/config.h.in
index 94b2931..0bdccbd 100644
--- a/config.h.in
+++ b/config.h.in
@@ -22,12 +22,21 @@
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
+/* 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 <limits.h> header file. */
#undef HAVE_LIMITS_H
diff --git a/configure b/configure
index 7589f40..bb1763c 100755
--- a/configure
+++ b/configure
@@ -1,13 +1,13 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.65 for CRC-DabMod 0.3.3.
+# Generated by GNU Autoconf 2.68 for CRC-DabMod 0.3.3-sfn.
#
# Report bugs to <pascal.charest@crc.ca>.
#
#
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
-# Inc.
+# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
+# Foundation, Inc.
#
#
# This configure script is free software; the Free Software Foundation
@@ -91,6 +91,7 @@ fi
IFS=" "" $as_nl"
# Find who we are. Look in the path if we contain no directory separator.
+as_myself=
case $0 in #((
*[\\/]* ) as_myself=$0 ;;
*) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -216,11 +217,18 @@ IFS=$as_save_IFS
# We cannot yet assume a decent shell, so we have to provide a
# neutralization value for shells without unset; and this also
# works around shells that cannot unset nonexistent variables.
+ # Preserve -v and -x to the replacement shell.
BASH_ENV=/dev/null
ENV=/dev/null
(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
export CONFIG_SHELL
- exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
+ case $- in # ((((
+ *v*x* | *x*v* ) as_opts=-vx ;;
+ *v* ) as_opts=-v ;;
+ *x* ) as_opts=-x ;;
+ * ) as_opts= ;;
+ esac
+ exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"}
fi
if test x$as_have_required = xno; then :
@@ -319,7 +327,7 @@ $as_echo X"$as_dir" |
test -d "$as_dir" && break
done
test -z "$as_dirs" || eval "mkdir $as_dirs"
- } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir"
+ } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
} # as_fn_mkdir_p
@@ -359,19 +367,19 @@ else
fi # as_fn_arith
-# as_fn_error ERROR [LINENO LOG_FD]
-# ---------------------------------
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
-# script with status $?, using 1 if that was 0.
+# script with STATUS, using 1 if that was 0.
as_fn_error ()
{
- as_status=$?; test $as_status -eq 0 && as_status=1
- if test "$3"; then
- as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3
+ as_status=$1; test $as_status -eq 0 && as_status=1
+ if test "$4"; then
+ as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
fi
- $as_echo "$as_me: error: $1" >&2
+ $as_echo "$as_me: error: $2" >&2
as_fn_exit $as_status
} # as_fn_error
@@ -533,7 +541,7 @@ test -n "$DJDIR" || exec 7<&0 </dev/null
exec 6>&1
# Name of the host.
-# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
+# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status,
# so uname gets run too.
ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
@@ -552,8 +560,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='CRC-DabMod'
PACKAGE_TARNAME='crc-dabmod'
-PACKAGE_VERSION='0.3.3'
-PACKAGE_STRING='CRC-DabMod 0.3.3'
+PACKAGE_VERSION='0.3.3-sfn'
+PACKAGE_STRING='CRC-DabMod 0.3.3-sfn'
PACKAGE_BUGREPORT='pascal.charest@crc.ca'
PACKAGE_URL=''
@@ -717,7 +725,11 @@ CPPFLAGS
CCC
CC
CFLAGS
-CPP'
+LDFLAGS
+LIBS
+CPPFLAGS
+CPP
+CPPFLAGS'
# Initialize some variables set by options.
@@ -780,8 +792,9 @@ do
fi
case $ac_option in
- *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
- *) ac_optarg=yes ;;
+ *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+ *=) ac_optarg= ;;
+ *) ac_optarg=yes ;;
esac
# Accept the important Cygnus configure options, so we can diagnose typos.
@@ -826,7 +839,7 @@ do
ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
- as_fn_error "invalid feature name: $ac_useropt"
+ as_fn_error $? "invalid feature name: $ac_useropt"
ac_useropt_orig=$ac_useropt
ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
case $ac_user_opts in
@@ -852,7 +865,7 @@ do
ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
- as_fn_error "invalid feature name: $ac_useropt"
+ as_fn_error $? "invalid feature name: $ac_useropt"
ac_useropt_orig=$ac_useropt
ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
case $ac_user_opts in
@@ -1056,7 +1069,7 @@ do
ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
- as_fn_error "invalid package name: $ac_useropt"
+ as_fn_error $? "invalid package name: $ac_useropt"
ac_useropt_orig=$ac_useropt
ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
case $ac_user_opts in
@@ -1072,7 +1085,7 @@ do
ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
- as_fn_error "invalid package name: $ac_useropt"
+ as_fn_error $? "invalid package name: $ac_useropt"
ac_useropt_orig=$ac_useropt
ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
case $ac_user_opts in
@@ -1102,8 +1115,8 @@ do
| --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
x_libraries=$ac_optarg ;;
- -*) as_fn_error "unrecognized option: \`$ac_option'
-Try \`$0 --help' for more information."
+ -*) as_fn_error $? "unrecognized option: \`$ac_option'
+Try \`$0 --help' for more information"
;;
*=*)
@@ -1111,7 +1124,7 @@ Try \`$0 --help' for more information."
# Reject names that are not valid shell variable names.
case $ac_envvar in #(
'' | [0-9]* | *[!_$as_cr_alnum]* )
- as_fn_error "invalid variable name: \`$ac_envvar'" ;;
+ as_fn_error $? "invalid variable name: \`$ac_envvar'" ;;
esac
eval $ac_envvar=\$ac_optarg
export $ac_envvar ;;
@@ -1121,7 +1134,7 @@ Try \`$0 --help' for more information."
$as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
$as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
- : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
+ : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"
;;
esac
@@ -1129,13 +1142,13 @@ done
if test -n "$ac_prev"; then
ac_option=--`echo $ac_prev | sed 's/_/-/g'`
- as_fn_error "missing argument to $ac_option"
+ as_fn_error $? "missing argument to $ac_option"
fi
if test -n "$ac_unrecognized_opts"; then
case $enable_option_checking in
no) ;;
- fatal) as_fn_error "unrecognized options: $ac_unrecognized_opts" ;;
+ fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
*) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
esac
fi
@@ -1158,7 +1171,7 @@ do
[\\/$]* | ?:[\\/]* ) continue;;
NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
esac
- as_fn_error "expected an absolute directory name for --$ac_var: $ac_val"
+ as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
done
# There might be people who depend on the old broken behavior: `$host'
@@ -1172,8 +1185,8 @@ target=$target_alias
if test "x$host_alias" != x; then
if test "x$build_alias" = x; then
cross_compiling=maybe
- $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
- If a cross compiler is detected then cross compile mode will be used." >&2
+ $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host.
+ If a cross compiler is detected then cross compile mode will be used" >&2
elif test "x$build_alias" != "x$host_alias"; then
cross_compiling=yes
fi
@@ -1188,9 +1201,9 @@ test "$silent" = yes && exec 6>/dev/null
ac_pwd=`pwd` && test -n "$ac_pwd" &&
ac_ls_di=`ls -di .` &&
ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
- as_fn_error "working directory cannot be determined"
+ as_fn_error $? "working directory cannot be determined"
test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
- as_fn_error "pwd does not report name of working directory"
+ as_fn_error $? "pwd does not report name of working directory"
# Find the source files, if location was not specified.
@@ -1229,11 +1242,11 @@ else
fi
if test ! -r "$srcdir/$ac_unique_file"; then
test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
- as_fn_error "cannot find sources ($ac_unique_file) in $srcdir"
+ as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"
fi
ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
ac_abs_confdir=`(
- cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error "$ac_msg"
+ cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"
pwd)`
# When building in place, set srcdir=.
if test "$ac_abs_confdir" = "$ac_pwd"; then
@@ -1259,7 +1272,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures CRC-DabMod 0.3.3 to adapt to many kinds of systems.
+\`configure' configures CRC-DabMod 0.3.3-sfn to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1273,7 +1286,7 @@ Configuration:
--help=short display options specific to this package
--help=recursive display the short help of all the included packages
-V, --version display version information and exit
- -q, --quiet, --silent do not print \`checking...' messages
+ -q, --quiet, --silent do not print \`checking ...' messages
--cache-file=FILE cache test results in FILE [disabled]
-C, --config-cache alias for \`--cache-file=config.cache'
-n, --no-create do not create output files
@@ -1330,7 +1343,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of CRC-DabMod 0.3.3:";;
+ short | recursive ) echo "Configuration of CRC-DabMod 0.3.3-sfn:";;
esac
cat <<\_ACEOF
@@ -1429,10 +1442,10 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-CRC-DabMod configure 0.3.3
-generated by GNU Autoconf 2.65
+CRC-DabMod configure 0.3.3-sfn
+generated by GNU Autoconf 2.68
-Copyright (C) 2009 Free Software Foundation, Inc.
+Copyright (C) 2010 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it.
_ACEOF
@@ -1476,7 +1489,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=1
fi
- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
} # ac_fn_cxx_try_compile
@@ -1514,7 +1527,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=1
fi
- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
} # ac_fn_c_try_compile
@@ -1540,7 +1553,7 @@ $as_echo "$ac_try_echo"; } >&5
mv -f conftest.er1 conftest.err
fi
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; } >/dev/null && {
+ test $ac_status = 0; } > conftest.i && {
test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
test ! -s conftest.err
}; then :
@@ -1551,7 +1564,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=1
fi
- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
} # ac_fn_c_try_cpp
@@ -1597,7 +1610,7 @@ fi
# interfere with the next link command; also delete a directory that is
# left behind by Apple's compiler. We do this before executing the actions.
rm -rf conftest.dSYM conftest_ipa8_conftest.oo
- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
} # ac_fn_c_try_link
@@ -1610,10 +1623,10 @@ fi
ac_fn_c_check_header_mongrel ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+ if eval \${$3+:} false; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
-if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
fi
eval ac_res=\$$3
@@ -1649,7 +1662,7 @@ if ac_fn_c_try_cpp "$LINENO"; then :
else
ac_header_preproc=no
fi
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
$as_echo "$ac_header_preproc" >&6; }
@@ -1672,17 +1685,15 @@ $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
-( cat <<\_ASBOX
-## ------------------------------------ ##
+( $as_echo "## ------------------------------------ ##
## Report this to pascal.charest@crc.ca ##
-## ------------------------------------ ##
-_ASBOX
+## ------------------------------------ ##"
) | sed "s/^/$as_me: WARNING: /" >&2
;;
esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
-if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
else
eval "$3=\$ac_header_compiler"
@@ -1691,7 +1702,7 @@ eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
fi
- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_header_mongrel
@@ -1732,7 +1743,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=$ac_status
fi
rm -rf conftest.dSYM conftest_ipa8_conftest.oo
- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
} # ac_fn_c_try_run
@@ -1746,7 +1757,7 @@ ac_fn_c_check_header_compile ()
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
-if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -1764,19 +1775,22 @@ fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_header_compile
-# ac_fn_c_check_decl LINENO SYMBOL VAR
-# ------------------------------------
-# Tests whether SYMBOL is declared, setting cache variable VAR accordingly.
+# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES
+# ---------------------------------------------
+# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR
+# accordingly.
ac_fn_c_check_decl ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $2 is declared" >&5
-$as_echo_n "checking whether $2 is declared... " >&6; }
-if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+ as_decl_name=`echo $2|sed 's/ *(.*//'`
+ as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5
+$as_echo_n "checking whether $as_decl_name is declared... " >&6; }
+if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -1785,8 +1799,12 @@ $4
int
main ()
{
-#ifndef $2
- (void) $2;
+#ifndef $as_decl_name
+#ifdef __cplusplus
+ (void) $as_decl_use;
+#else
+ (void) $as_decl_name;
+#endif
#endif
;
@@ -1803,7 +1821,7 @@ fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_decl
@@ -1816,7 +1834,7 @@ ac_fn_c_check_type ()
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
-if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
else
eval "$3=no"
@@ -1857,7 +1875,7 @@ fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_type
@@ -1870,7 +1888,7 @@ ac_fn_c_find_uintX_t ()
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5
$as_echo_n "checking for uint$2_t... " >&6; }
-if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
else
eval "$3=no"
@@ -1900,8 +1918,7 @@ if ac_fn_c_try_compile "$LINENO"; then :
esac
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- eval as_val=\$$3
- if test "x$as_val" = x""no; then :
+ if eval test \"x\$"$3"\" = x"no"; then :
else
break
@@ -1911,7 +1928,7 @@ fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_find_uintX_t
@@ -1923,7 +1940,7 @@ ac_fn_c_check_func ()
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
-if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -1978,15 +1995,15 @@ fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_func
cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by CRC-DabMod $as_me 0.3.3, which was
-generated by GNU Autoconf 2.65. Invocation command line was
+It was created by CRC-DabMod $as_me 0.3.3-sfn, which was
+generated by GNU Autoconf 2.68. Invocation command line was
$ $0 $@
@@ -2096,11 +2113,9 @@ trap 'exit_status=$?
{
echo
- cat <<\_ASBOX
-## ---------------- ##
+ $as_echo "## ---------------- ##
## Cache variables. ##
-## ---------------- ##
-_ASBOX
+## ---------------- ##"
echo
# The following way of writing the cache mishandles newlines in values,
(
@@ -2134,11 +2149,9 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
)
echo
- cat <<\_ASBOX
-## ----------------- ##
+ $as_echo "## ----------------- ##
## Output variables. ##
-## ----------------- ##
-_ASBOX
+## ----------------- ##"
echo
for ac_var in $ac_subst_vars
do
@@ -2151,11 +2164,9 @@ _ASBOX
echo
if test -n "$ac_subst_files"; then
- cat <<\_ASBOX
-## ------------------- ##
+ $as_echo "## ------------------- ##
## File substitutions. ##
-## ------------------- ##
-_ASBOX
+## ------------------- ##"
echo
for ac_var in $ac_subst_files
do
@@ -2169,11 +2180,9 @@ _ASBOX
fi
if test -s confdefs.h; then
- cat <<\_ASBOX
-## ----------- ##
+ $as_echo "## ----------- ##
## confdefs.h. ##
-## ----------- ##
-_ASBOX
+## ----------- ##"
echo
cat confdefs.h
echo
@@ -2228,7 +2237,12 @@ _ACEOF
ac_site_file1=NONE
ac_site_file2=NONE
if test -n "$CONFIG_SITE"; then
- ac_site_file1=$CONFIG_SITE
+ # We do not want a PATH search for config.site.
+ case $CONFIG_SITE in #((
+ -*) ac_site_file1=./$CONFIG_SITE;;
+ */*) ac_site_file1=$CONFIG_SITE;;
+ *) ac_site_file1=./$CONFIG_SITE;;
+ esac
elif test "x$prefix" != xNONE; then
ac_site_file1=$prefix/share/config.site
ac_site_file2=$prefix/etc/config.site
@@ -2243,7 +2257,11 @@ do
{ $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
$as_echo "$as_me: loading site script $ac_site_file" >&6;}
sed 's/^/| /' "$ac_site_file" >&5
- . "$ac_site_file"
+ . "$ac_site_file" \
+ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "failed to load site script $ac_site_file
+See \`config.log' for more details" "$LINENO" 5; }
fi
done
@@ -2319,7 +2337,7 @@ if $ac_cache_corrupted; then
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
- as_fn_error "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
+ as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
fi
## -------------------- ##
## Main body of script. ##
@@ -2334,16 +2352,22 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
ac_aux_dir=
for ac_dir in build-aux "$srcdir"/build-aux; do
- for ac_t in install-sh install.sh shtool; do
- if test -f "$ac_dir/$ac_t"; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/$ac_t -c"
- break 2
- fi
- done
+ if test -f "$ac_dir/install-sh"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install-sh -c"
+ break
+ elif test -f "$ac_dir/install.sh"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install.sh -c"
+ break
+ elif test -f "$ac_dir/shtool"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/shtool install -c"
+ break
+ fi
done
if test -z "$ac_aux_dir"; then
- as_fn_error "cannot find install-sh, install.sh, or shtool in build-aux \"$srcdir\"/build-aux" "$LINENO" 5
+ as_fn_error $? "cannot find install-sh, install.sh, or shtool in build-aux \"$srcdir\"/build-aux" "$LINENO" 5
fi
# These three variables are undocumented and unsupported,
@@ -2357,27 +2381,27 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
# Make sure we can run config.sub.
$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
- as_fn_error "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
+ as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
$as_echo_n "checking build system type... " >&6; }
-if test "${ac_cv_build+set}" = set; then :
+if ${ac_cv_build+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_build_alias=$build_alias
test "x$ac_build_alias" = x &&
ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
test "x$ac_build_alias" = x &&
- as_fn_error "cannot guess build type; you must specify one" "$LINENO" 5
+ as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5
ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
- as_fn_error "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
+ as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
$as_echo "$ac_cv_build" >&6; }
case $ac_cv_build in
*-*-*) ;;
-*) as_fn_error "invalid value of canonical build" "$LINENO" 5;;
+*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;;
esac
build=$ac_cv_build
ac_save_IFS=$IFS; IFS='-'
@@ -2395,14 +2419,14 @@ case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
$as_echo_n "checking host system type... " >&6; }
-if test "${ac_cv_host+set}" = set; then :
+if ${ac_cv_host+:} false; then :
$as_echo_n "(cached) " >&6
else
if test "x$host_alias" = x; then
ac_cv_host=$ac_cv_build
else
ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
- as_fn_error "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
+ as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
fi
fi
@@ -2410,7 +2434,7 @@ fi
$as_echo "$ac_cv_host" >&6; }
case $ac_cv_host in
*-*-*) ;;
-*) as_fn_error "invalid value of canonical host" "$LINENO" 5;;
+*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;
esac
host=$ac_cv_host
ac_save_IFS=$IFS; IFS='-'
@@ -2428,14 +2452,14 @@ case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5
$as_echo_n "checking target system type... " >&6; }
-if test "${ac_cv_target+set}" = set; then :
+if ${ac_cv_target+:} false; then :
$as_echo_n "(cached) " >&6
else
if test "x$target_alias" = x; then
ac_cv_target=$ac_cv_host
else
ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` ||
- as_fn_error "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5
+ as_fn_error $? "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5
fi
fi
@@ -2443,7 +2467,7 @@ fi
$as_echo "$ac_cv_target" >&6; }
case $ac_cv_target in
*-*-*) ;;
-*) as_fn_error "invalid value of canonical target" "$LINENO" 5;;
+*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;;
esac
target=$ac_cv_target
ac_save_IFS=$IFS; IFS='-'
@@ -2485,7 +2509,7 @@ am__api_version='1.11'
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
$as_echo_n "checking for a BSD-compatible install... " >&6; }
if test -z "$INSTALL"; then
-if test "${ac_cv_path_install+set}" = set; then :
+if ${ac_cv_path_install+:} false; then :
$as_echo_n "(cached) " >&6
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -2572,11 +2596,11 @@ am_lf='
'
case `pwd` in
*[\\\"\#\$\&\'\`$am_lf]*)
- as_fn_error "unsafe absolute working directory name" "$LINENO" 5;;
+ as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;;
esac
case $srcdir in
*[\\\"\#\$\&\'\`$am_lf\ \ ]*)
- as_fn_error "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;;
+ as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;;
esac
# Do `set' in a subshell so we don't clobber the current shell's
@@ -2598,7 +2622,7 @@ if (
# if, for instance, CONFIG_SHELL is bash and it inherits a
# broken ls alias from the environment. This has actually
# happened. Such a system could not be considered "sane".
- as_fn_error "ls -t appears to fail. Make sure there is not a broken
+ as_fn_error $? "ls -t appears to fail. Make sure there is not a broken
alias in your environment" "$LINENO" 5
fi
@@ -2608,7 +2632,7 @@ then
# Ok.
:
else
- as_fn_error "newly created file is older than distributed files!
+ as_fn_error $? "newly created file is older than distributed files!
Check your system clock" "$LINENO" 5
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
@@ -2662,7 +2686,7 @@ if test "$cross_compiling" != no; then
set dummy ${ac_tool_prefix}strip; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_STRIP+set}" = set; then :
+if ${ac_cv_prog_STRIP+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$STRIP"; then
@@ -2702,7 +2726,7 @@ if test -z "$ac_cv_prog_STRIP"; then
set dummy strip; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then :
+if ${ac_cv_prog_ac_ct_STRIP+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_STRIP"; then
@@ -2755,7 +2779,7 @@ INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5
$as_echo_n "checking for a thread-safe mkdir -p... " >&6; }
if test -z "$MKDIR_P"; then
- if test "${ac_cv_path_mkdir+set}" = set; then :
+ if ${ac_cv_path_mkdir+:} false; then :
$as_echo_n "(cached) " >&6
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -2806,7 +2830,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_AWK+set}" = set; then :
+if ${ac_cv_prog_AWK+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$AWK"; then
@@ -2846,7 +2870,7 @@ done
$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
set x ${MAKE-make}
ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
-if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then :
$as_echo_n "(cached) " >&6
else
cat >conftest.make <<\_ACEOF
@@ -2854,7 +2878,7 @@ SHELL = /bin/sh
all:
@echo '@@@%%%=$(MAKE)=@@@%%%'
_ACEOF
-# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+# GNU make sometimes prints "make[1]: Entering ...", which would confuse us.
case `${MAKE-make} -f conftest.make 2>/dev/null` in
*@@@%%%=?*=@@@%%%*)
eval ac_cv_prog_make_${ac_make}_set=yes;;
@@ -2888,7 +2912,7 @@ if test "`cd $srcdir && pwd`" != "`pwd`"; then
am__isrc=' -I$(srcdir)'
# test to see if srcdir already configured
if test -f $srcdir/config.status; then
- as_fn_error "source directory already configured; run \"make distclean\" there first" "$LINENO" 5
+ as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5
fi
fi
@@ -2904,7 +2928,7 @@ fi
# Define the identity of the package.
PACKAGE='crc-dabmod'
- VERSION='0.3.3'
+ VERSION='0.3.3-sfn'
cat >>confdefs.h <<_ACEOF
@@ -2978,7 +3002,7 @@ if test -z "$CXX"; then
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CXX+set}" = set; then :
+if ${ac_cv_prog_CXX+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$CXX"; then
@@ -3022,7 +3046,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then :
+if ${ac_cv_prog_ac_ct_CXX+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_CXX"; then
@@ -3185,9 +3209,8 @@ sed 's/^/| /' conftest.$ac_ext >&5
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ as_fn_set_status 77
-as_fn_error "C++ compiler cannot create executables
-See \`config.log' for more details." "$LINENO" 5; }; }
+as_fn_error 77 "C++ compiler cannot create executables
+See \`config.log' for more details" "$LINENO" 5; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
@@ -3229,8 +3252,8 @@ done
else
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error "cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details." "$LINENO" 5; }
+as_fn_error $? "cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details" "$LINENO" 5; }
fi
rm -f conftest conftest$ac_cv_exeext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
@@ -3287,9 +3310,9 @@ $as_echo "$ac_try_echo"; } >&5
else
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error "cannot run C++ compiled programs.
+as_fn_error $? "cannot run C++ compiled programs.
If you meant to cross compile, use \`--host'.
-See \`config.log' for more details." "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5; }
fi
fi
fi
@@ -3300,7 +3323,7 @@ rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
ac_clean_files=$ac_clean_files_save
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
$as_echo_n "checking for suffix of object files... " >&6; }
-if test "${ac_cv_objext+set}" = set; then :
+if ${ac_cv_objext+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -3340,8 +3363,8 @@ sed 's/^/| /' conftest.$ac_ext >&5
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error "cannot compute suffix of object files: cannot compile
-See \`config.log' for more details." "$LINENO" 5; }
+as_fn_error $? "cannot compute suffix of object files: cannot compile
+See \`config.log' for more details" "$LINENO" 5; }
fi
rm -f conftest.$ac_cv_objext conftest.$ac_ext
fi
@@ -3351,7 +3374,7 @@ OBJEXT=$ac_cv_objext
ac_objext=$OBJEXT
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5
$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; }
-if test "${ac_cv_cxx_compiler_gnu+set}" = set; then :
+if ${ac_cv_cxx_compiler_gnu+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -3388,7 +3411,7 @@ ac_test_CXXFLAGS=${CXXFLAGS+set}
ac_save_CXXFLAGS=$CXXFLAGS
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5
$as_echo_n "checking whether $CXX accepts -g... " >&6; }
-if test "${ac_cv_prog_cxx_g+set}" = set; then :
+if ${ac_cv_prog_cxx_g+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_save_cxx_werror_flag=$ac_cxx_werror_flag
@@ -3536,7 +3559,7 @@ depcc="$CXX" am_compiler_list=
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
$as_echo_n "checking dependency style of $depcc... " >&6; }
-if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then :
+if ${am_cv_CXX_dependencies_compiler_type+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
@@ -3669,7 +3692,7 @@ if test -n "$ac_tool_prefix"; then
set dummy ${ac_tool_prefix}gcc; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then :
+if ${ac_cv_prog_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$CC"; then
@@ -3709,7 +3732,7 @@ if test -z "$ac_cv_prog_CC"; then
set dummy gcc; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_CC"; then
@@ -3762,7 +3785,7 @@ if test -z "$CC"; then
set dummy ${ac_tool_prefix}cc; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then :
+if ${ac_cv_prog_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$CC"; then
@@ -3802,7 +3825,7 @@ if test -z "$CC"; then
set dummy cc; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then :
+if ${ac_cv_prog_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$CC"; then
@@ -3861,7 +3884,7 @@ if test -z "$CC"; then
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then :
+if ${ac_cv_prog_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$CC"; then
@@ -3905,7 +3928,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_CC"; then
@@ -3959,8 +3982,8 @@ fi
test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error "no acceptable C compiler found in \$PATH
-See \`config.log' for more details." "$LINENO" 5; }
+as_fn_error $? "no acceptable C compiler found in \$PATH
+See \`config.log' for more details" "$LINENO" 5; }
# Provide some information about the compiler.
$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
@@ -3989,7 +4012,7 @@ done
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
-if test "${ac_cv_c_compiler_gnu+set}" = set; then :
+if ${ac_cv_c_compiler_gnu+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -4026,7 +4049,7 @@ ac_test_CFLAGS=${CFLAGS+set}
ac_save_CFLAGS=$CFLAGS
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
$as_echo_n "checking whether $CC accepts -g... " >&6; }
-if test "${ac_cv_prog_cc_g+set}" = set; then :
+if ${ac_cv_prog_cc_g+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_save_c_werror_flag=$ac_c_werror_flag
@@ -4104,7 +4127,7 @@ else
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
-if test "${ac_cv_prog_cc_c89+set}" = set; then :
+if ${ac_cv_prog_cc_c89+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_cv_prog_cc_c89=no
@@ -4203,7 +4226,7 @@ depcc="$CC" am_compiler_list=
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
$as_echo_n "checking dependency style of $depcc... " >&6; }
-if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then :
+if ${am_cv_CC_dependencies_compiler_type+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
@@ -4335,7 +4358,7 @@ $as_echo_n "checking whether cc understands -c and -o together... " >&6; }
fi
set dummy $CC; ac_cc=`$as_echo "$2" |
sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'`
-if { as_var=ac_cv_prog_cc_${ac_cc}_c_o; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${ac_cv_prog_cc_${ac_cc}_c_o+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -4465,7 +4488,7 @@ if test -n "$CPP" && test -d "$CPP"; then
CPP=
fi
if test -z "$CPP"; then
- if test "${ac_cv_prog_CPP+set}" = set; then :
+ if ${ac_cv_prog_CPP+:} false; then :
$as_echo_n "(cached) " >&6
else
# Double quotes because CPP needs to be expanded
@@ -4495,7 +4518,7 @@ else
# Broken: fails on valid input.
continue
fi
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
# OK, works on sane cases. Now check whether nonexistent headers
# can be detected and how.
@@ -4511,11 +4534,11 @@ else
ac_preproc_ok=:
break
fi
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
done
# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.i conftest.err conftest.$ac_ext
if $ac_preproc_ok; then :
break
fi
@@ -4554,7 +4577,7 @@ else
# Broken: fails on valid input.
continue
fi
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
# OK, works on sane cases. Now check whether nonexistent headers
# can be detected and how.
@@ -4570,18 +4593,18 @@ else
ac_preproc_ok=:
break
fi
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
done
# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.i conftest.err conftest.$ac_ext
if $ac_preproc_ok; then :
else
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error "C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details." "$LINENO" 5; }
+as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details" "$LINENO" 5; }
fi
ac_ext=c
@@ -4650,14 +4673,144 @@ CXXFLAGS="$OPTIM $DEBUG $EXTRA"
-# Checks for libraries.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -luhd" >&5
+$as_echo_n "checking for main in -luhd... " >&6; }
+if ${ac_cv_lib_uhd_main+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-luhd $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+return main ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_uhd_main=yes
+else
+ ac_cv_lib_uhd_main=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_uhd_main" >&5
+$as_echo "$ac_cv_lib_uhd_main" >&6; }
+if test "x$ac_cv_lib_uhd_main" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBUHD 1
+_ACEOF
+
+ LIBS="-luhd $LIBS"
+
+else
+ as_fn_error $? "library uhd is missing" "$LINENO" 5
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lboost_thread" >&5
+$as_echo_n "checking for main in -lboost_thread... " >&6; }
+if ${ac_cv_lib_boost_thread_main+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lboost_thread $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+
+int
+main ()
+{
+return main ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_boost_thread_main=yes
+else
+ ac_cv_lib_boost_thread_main=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_boost_thread_main" >&5
+$as_echo "$ac_cv_lib_boost_thread_main" >&6; }
+if test "x$ac_cv_lib_boost_thread_main" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBBOOST_THREAD 1
+_ACEOF
+
+ LIBS="-lboost_thread $LIBS"
+
+else
+ as_fn_error $? "library boost_thread is missing" "$LINENO" 5
+fi
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for clock_gettime in -lrt" >&5
+$as_echo_n "checking for clock_gettime in -lrt... " >&6; }
+if ${ac_cv_lib_rt_clock_gettime+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lrt $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char clock_gettime ();
+int
+main ()
+{
+return clock_gettime ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_rt_clock_gettime=yes
+else
+ ac_cv_lib_rt_clock_gettime=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rt_clock_gettime" >&5
+$as_echo "$ac_cv_lib_rt_clock_gettime" >&6; }
+if test "x$ac_cv_lib_rt_clock_gettime" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBRT 1
+_ACEOF
+
+ LIBS="-lrt $LIBS"
+
+else
+ as_fn_error $? "library rt is missing" "$LINENO" 5
+fi
+
+
+# Checks for libraries.
if test "x$enable_debug" != "xno"; then :
if test "x$with_debug_malloc" != "xno"; then :
if test "x$with_debug_malloc" = "xyes"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for malloc in -lduma" >&5
$as_echo_n "checking for malloc in -lduma... " >&6; }
-if test "${ac_cv_lib_duma_malloc+set}" = set; then :
+if ${ac_cv_lib_duma_malloc+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -4691,7 +4844,7 @@ LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_duma_malloc" >&5
$as_echo "$ac_cv_lib_duma_malloc" >&6; }
-if test "x$ac_cv_lib_duma_malloc" = x""yes; then :
+if test "x$ac_cv_lib_duma_malloc" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBDUMA 1
_ACEOF
@@ -4701,7 +4854,7 @@ _ACEOF
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for malloc in -lefence" >&5
$as_echo_n "checking for malloc in -lefence... " >&6; }
-if test "${ac_cv_lib_efence_malloc+set}" = set; then :
+if ${ac_cv_lib_efence_malloc+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -4735,7 +4888,7 @@ LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_efence_malloc" >&5
$as_echo "$ac_cv_lib_efence_malloc" >&6; }
-if test "x$ac_cv_lib_efence_malloc" = x""yes; then :
+if test "x$ac_cv_lib_efence_malloc" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBEFENCE 1
_ACEOF
@@ -4750,7 +4903,7 @@ else
as_ac_Lib=`$as_echo "ac_cv_lib_$with_debug_malloc''_malloc" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for malloc in -l$with_debug_malloc" >&5
$as_echo_n "checking for malloc in -l$with_debug_malloc... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -4785,8 +4938,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_LIB$with_debug_malloc" | $as_tr_cpp` 1
_ACEOF
@@ -4804,7 +4956,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
-if test "${ac_cv_path_GREP+set}" = set; then :
+if ${ac_cv_path_GREP+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -z "$GREP"; then
@@ -4853,7 +5005,7 @@ esac
done
IFS=$as_save_IFS
if test -z "$ac_cv_path_GREP"; then
- as_fn_error "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
fi
else
ac_cv_path_GREP=$GREP
@@ -4867,7 +5019,7 @@ $as_echo "$ac_cv_path_GREP" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
$as_echo_n "checking for egrep... " >&6; }
-if test "${ac_cv_path_EGREP+set}" = set; then :
+if ${ac_cv_path_EGREP+:} false; then :
$as_echo_n "(cached) " >&6
else
if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
@@ -4919,7 +5071,7 @@ esac
done
IFS=$as_save_IFS
if test -z "$ac_cv_path_EGREP"; then
- as_fn_error "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
fi
else
ac_cv_path_EGREP=$EGREP
@@ -4934,7 +5086,7 @@ $as_echo "$ac_cv_path_EGREP" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
$as_echo_n "checking for ANSI C header files... " >&6; }
-if test "${ac_cv_header_stdc+set}" = set; then :
+if ${ac_cv_header_stdc+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -5051,8 +5203,7 @@ do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
"
-eval as_val=\$$as_ac_Header
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
@@ -5066,8 +5217,7 @@ for ac_header in fcntl.h limits.h malloc.h memory.h netinet/in.h stdint.h stdlib
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
-eval as_val=\$$as_ac_Header
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
@@ -5078,7 +5228,7 @@ done
ac_fn_c_check_decl "$LINENO" "_mm_malloc" "ac_cv_have_decl__mm_malloc" "#include <mm_malloc.h>
"
-if test "x$ac_cv_have_decl__mm_malloc" = x""yes; then :
+if test "x$ac_cv_have_decl__mm_malloc" = xyes; then :
ac_have_decl=1
else
ac_have_decl=0
@@ -5090,7 +5240,7 @@ _ACEOF
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
$as_echo_n "checking for ANSI C header files... " >&6; }
-if test "${ac_cv_header_stdc+set}" = set; then :
+if ${ac_cv_header_stdc+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -5204,7 +5354,7 @@ fi
# Checks for typedefs, structures, and compiler characteristics.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5
$as_echo_n "checking for stdbool.h that conforms to C99... " >&6; }
-if test "${ac_cv_header_stdbool_h+set}" = set; then :
+if ${ac_cv_header_stdbool_h+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -5236,7 +5386,7 @@ else
char b[false == 0 ? 1 : -1];
char c[__bool_true_false_are_defined == 1 ? 1 : -1];
char d[(bool) 0.5 == true ? 1 : -1];
- bool e = &s;
+ /* See body of main program for 'e'. */
char f[(_Bool) 0.0 == false ? 1 : -1];
char g[true];
char h[sizeof (_Bool)];
@@ -5247,25 +5397,6 @@ else
_Bool n[m];
char o[sizeof n == m * sizeof n[0] ? 1 : -1];
char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
-# if defined __xlc__ || defined __GNUC__
- /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0
- reported by James Lemley on 2005-10-05; see
- http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html
- This test is not quite right, since xlc is allowed to
- reject this program, as the initializer for xlcbug is
- not one of the forms that C requires support for.
- However, doing the test right would require a runtime
- test, and that would make cross-compilation harder.
- Let us hope that IBM fixes the xlc bug, and also adds
- support for this kind of constant expression. In the
- meantime, this test will reject xlc, which is OK, since
- our stdbool.h substitute should suffice. We also test
- this with GCC, where it should work, to detect more
- quickly whether someone messes up the test in the
- future. */
- char digs[] = "0123456789";
- int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1);
-# endif
/* Catch a bug in an HP-UX C compiler. See
http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
@@ -5277,6 +5408,7 @@ int
main ()
{
+ bool e = &s;
*pq |= q;
*pq |= ! q;
/* Refer to every declared value, to avoid compiler optimizations. */
@@ -5297,7 +5429,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdbool_h" >&5
$as_echo "$ac_cv_header_stdbool_h" >&6; }
ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default"
-if test "x$ac_cv_type__Bool" = x""yes; then :
+if test "x$ac_cv_type__Bool" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE__BOOL 1
@@ -5314,7 +5446,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5
$as_echo_n "checking for an ANSI C-conforming const... " >&6; }
-if test "${ac_cv_c_const+set}" = set; then :
+if ${ac_cv_c_const+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -5394,7 +5526,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5
$as_echo_n "checking for inline... " >&6; }
-if test "${ac_cv_c_inline+set}" = set; then :
+if ${ac_cv_c_inline+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_cv_c_inline=no
@@ -5435,7 +5567,7 @@ _ACEOF
esac
ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default"
-if test "x$ac_cv_type_size_t" = x""yes; then :
+if test "x$ac_cv_type_size_t" = xyes; then :
else
@@ -5447,7 +5579,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5
$as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; }
-if test "${ac_cv_header_time+set}" = set; then :
+if ${ac_cv_header_time+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -5522,7 +5654,7 @@ _ACEOF
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5
$as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; }
-if test "${ac_cv_header_time+set}" = set; then :
+if ${ac_cv_header_time+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -5597,7 +5729,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
#AC_FUNC_MALLOC
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working memcmp" >&5
$as_echo_n "checking for working memcmp... " >&6; }
-if test "${ac_cv_func_memcmp_working+set}" = set; then :
+if ${ac_cv_func_memcmp_working+:} false; then :
$as_echo_n "(cached) " >&6
else
if test "$cross_compiling" = yes; then :
@@ -5660,7 +5792,7 @@ esac
for ac_header in stdlib.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default"
-if test "x$ac_cv_header_stdlib_h" = x""yes; then :
+if test "x$ac_cv_header_stdlib_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_STDLIB_H 1
_ACEOF
@@ -5671,7 +5803,7 @@ done
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible realloc" >&5
$as_echo_n "checking for GNU libc compatible realloc... " >&6; }
-if test "${ac_cv_func_realloc_0_nonnull+set}" = set; then :
+if ${ac_cv_func_realloc_0_nonnull+:} false; then :
$as_echo_n "(cached) " >&6
else
if test "$cross_compiling" = yes; then :
@@ -5726,7 +5858,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of signal handlers" >&5
$as_echo_n "checking return type of signal handlers... " >&6; }
-if test "${ac_cv_type_signal+set}" = set; then :
+if ${ac_cv_type_signal+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -5761,8 +5893,7 @@ for ac_func in bzero floor ftime gettimeofday memset sqrt strchr strerror strtol
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
-eval as_val=\$$as_ac_var
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
@@ -5837,10 +5968,21 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
:end' >>confcache
if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
if test -w "$cache_file"; then
- test "x$cache_file" != "x/dev/null" &&
+ if test "x$cache_file" != "x/dev/null"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
$as_echo "$as_me: updating cache $cache_file" >&6;}
- cat confcache >$cache_file
+ if test ! -f "$cache_file" || test -h "$cache_file"; then
+ cat confcache >"$cache_file"
+ else
+ case $cache_file in #(
+ */* | ?:*)
+ mv -f confcache "$cache_file"$$ &&
+ mv -f "$cache_file"$$ "$cache_file" ;; #(
+ *)
+ mv -f confcache "$cache_file" ;;
+ esac
+ fi
+ fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
@@ -5856,6 +5998,7 @@ DEFS=-DHAVE_CONFIG_H
ac_libobjs=
ac_ltlibobjs=
+U=
for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
# 1. Remove the extension, and $U if already installed.
ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
@@ -5879,19 +6022,19 @@ else
fi
if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
- as_fn_error "conditional \"AMDEP\" was never defined.
+ as_fn_error $? "conditional \"AMDEP\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then
- as_fn_error "conditional \"am__fastdepCXX\" was never defined.
+ as_fn_error $? "conditional \"am__fastdepCXX\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
- as_fn_error "conditional \"am__fastdepCC\" was never defined.
+ as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
-: ${CONFIG_STATUS=./config.status}
+: "${CONFIG_STATUS=./config.status}"
ac_write_fail=0
ac_clean_files_save=$ac_clean_files
ac_clean_files="$ac_clean_files $CONFIG_STATUS"
@@ -5992,6 +6135,7 @@ fi
IFS=" "" $as_nl"
# Find who we are. Look in the path if we contain no directory separator.
+as_myself=
case $0 in #((
*[\\/]* ) as_myself=$0 ;;
*) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -6037,19 +6181,19 @@ export LANGUAGE
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
-# as_fn_error ERROR [LINENO LOG_FD]
-# ---------------------------------
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
-# script with status $?, using 1 if that was 0.
+# script with STATUS, using 1 if that was 0.
as_fn_error ()
{
- as_status=$?; test $as_status -eq 0 && as_status=1
- if test "$3"; then
- as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3
+ as_status=$1; test $as_status -eq 0 && as_status=1
+ if test "$4"; then
+ as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
fi
- $as_echo "$as_me: error: $1" >&2
+ $as_echo "$as_me: error: $2" >&2
as_fn_exit $as_status
} # as_fn_error
@@ -6245,7 +6389,7 @@ $as_echo X"$as_dir" |
test -d "$as_dir" && break
done
test -z "$as_dirs" || eval "mkdir $as_dirs"
- } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir"
+ } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
} # as_fn_mkdir_p
@@ -6298,8 +6442,8 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by CRC-DabMod $as_me 0.3.3, which was
-generated by GNU Autoconf 2.65. Invocation command line was
+This file was extended by CRC-DabMod $as_me 0.3.3-sfn, which was
+generated by GNU Autoconf 2.68. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
CONFIG_HEADERS = $CONFIG_HEADERS
@@ -6364,11 +6508,11 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-CRC-DabMod config.status 0.3.3
-configured by $0, generated by GNU Autoconf 2.65,
+CRC-DabMod config.status 0.3.3-sfn
+configured by $0, generated by GNU Autoconf 2.68,
with options \\"\$ac_cs_config\\"
-Copyright (C) 2009 Free Software Foundation, Inc.
+Copyright (C) 2010 Free Software Foundation, Inc.
This config.status script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it."
@@ -6386,11 +6530,16 @@ ac_need_defaults=:
while test $# != 0
do
case $1 in
- --*=*)
+ --*=?*)
ac_option=`expr "X$1" : 'X\([^=]*\)='`
ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
ac_shift=:
;;
+ --*=)
+ ac_option=`expr "X$1" : 'X\([^=]*\)='`
+ ac_optarg=
+ ac_shift=:
+ ;;
*)
ac_option=$1
ac_optarg=$2
@@ -6412,6 +6561,7 @@ do
$ac_shift
case $ac_optarg in
*\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ '') as_fn_error $? "missing file argument" ;;
esac
as_fn_append CONFIG_FILES " '$ac_optarg'"
ac_need_defaults=false;;
@@ -6424,7 +6574,7 @@ do
ac_need_defaults=false;;
--he | --h)
# Conflict between --help and --header
- as_fn_error "ambiguous option: \`$1'
+ as_fn_error $? "ambiguous option: \`$1'
Try \`$0 --help' for more information.";;
--help | --hel | -h )
$as_echo "$ac_cs_usage"; exit ;;
@@ -6433,7 +6583,7 @@ Try \`$0 --help' for more information.";;
ac_cs_silent=: ;;
# This is an error.
- -*) as_fn_error "unrecognized option: \`$1'
+ -*) as_fn_error $? "unrecognized option: \`$1'
Try \`$0 --help' for more information." ;;
*) as_fn_append ac_config_targets " $1"
@@ -6493,7 +6643,7 @@ do
"lib/Makefile") CONFIG_FILES="$CONFIG_FILES lib/Makefile" ;;
"src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
- *) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
+ *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
esac
done
@@ -6516,9 +6666,10 @@ fi
# after its creation but before its name has been assigned to `$tmp'.
$debug ||
{
- tmp=
+ tmp= ac_tmp=
trap 'exit_status=$?
- { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
+ : "${ac_tmp:=$tmp}"
+ { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status
' 0
trap 'as_fn_exit 1' 1 2 13 15
}
@@ -6526,12 +6677,13 @@ $debug ||
{
tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
- test -n "$tmp" && test -d "$tmp"
+ test -d "$tmp"
} ||
{
tmp=./conf$$-$RANDOM
(umask 077 && mkdir "$tmp")
-} || as_fn_error "cannot create a temporary directory in ." "$LINENO" 5
+} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
+ac_tmp=$tmp
# Set up the scripts for CONFIG_FILES section.
# No need to generate them if there are no CONFIG_FILES.
@@ -6548,12 +6700,12 @@ if test "x$ac_cr" = x; then
fi
ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
- ac_cs_awk_cr='\r'
+ ac_cs_awk_cr='\\r'
else
ac_cs_awk_cr=$ac_cr
fi
-echo 'BEGIN {' >"$tmp/subs1.awk" &&
+echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
_ACEOF
@@ -6562,18 +6714,18 @@ _ACEOF
echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
echo "_ACEOF"
} >conf$$subs.sh ||
- as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5
-ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'`
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`
ac_delim='%!_!# '
for ac_last_try in false false false false false :; do
. ./conf$$subs.sh ||
- as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
if test $ac_delim_n = $ac_delim_num; then
break
elif $ac_last_try; then
- as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
else
ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
fi
@@ -6581,7 +6733,7 @@ done
rm -f conf$$subs.sh
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-cat >>"\$tmp/subs1.awk" <<\\_ACAWK &&
+cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&
_ACEOF
sed -n '
h
@@ -6629,7 +6781,7 @@ t delim
rm -f conf$$subs.awk
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
_ACAWK
-cat >>"\$tmp/subs1.awk" <<_ACAWK &&
+cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
for (key in S) S_is_set[key] = 1
FS = ""
@@ -6661,21 +6813,29 @@ if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
else
cat
-fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \
- || as_fn_error "could not setup config files machinery" "$LINENO" 5
+fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \
+ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5
_ACEOF
-# VPATH may cause trouble with some makes, so we remove $(srcdir),
-# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# VPATH may cause trouble with some makes, so we remove sole $(srcdir),
+# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and
# trailing colons and then remove the whole line if VPATH becomes empty
# (actually we leave an empty line to preserve line numbers).
if test "x$srcdir" = x.; then
- ac_vpsub='/^[ ]*VPATH[ ]*=/{
-s/:*\$(srcdir):*/:/
-s/:*\${srcdir}:*/:/
-s/:*@srcdir@:*/:/
-s/^\([^=]*=[ ]*\):*/\1/
+ ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{
+h
+s///
+s/^/:/
+s/[ ]*$/:/
+s/:\$(srcdir):/:/g
+s/:\${srcdir}:/:/g
+s/:@srcdir@:/:/g
+s/^:*//
s/:*$//
+x
+s/\(=[ ]*\).*/\1/
+G
+s/\n//
s/^[^=]*=[ ]*$//
}'
fi
@@ -6687,7 +6847,7 @@ fi # test -n "$CONFIG_FILES"
# No need to generate them if there are no CONFIG_HEADERS.
# This happens for instance with `./config.status Makefile'.
if test -n "$CONFIG_HEADERS"; then
-cat >"$tmp/defines.awk" <<\_ACAWK ||
+cat >"$ac_tmp/defines.awk" <<\_ACAWK ||
BEGIN {
_ACEOF
@@ -6699,11 +6859,11 @@ _ACEOF
# handling of long lines.
ac_delim='%!_!# '
for ac_last_try in false false :; do
- ac_t=`sed -n "/$ac_delim/p" confdefs.h`
- if test -z "$ac_t"; then
+ ac_tt=`sed -n "/$ac_delim/p" confdefs.h`
+ if test -z "$ac_tt"; then
break
elif $ac_last_try; then
- as_fn_error "could not make $CONFIG_HEADERS" "$LINENO" 5
+ as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5
else
ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
fi
@@ -6788,7 +6948,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
_ACAWK
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
- as_fn_error "could not setup config headers machinery" "$LINENO" 5
+ as_fn_error $? "could not setup config headers machinery" "$LINENO" 5
fi # test -n "$CONFIG_HEADERS"
@@ -6801,7 +6961,7 @@ do
esac
case $ac_mode$ac_tag in
:[FHL]*:*);;
- :L* | :C*:*) as_fn_error "invalid tag \`$ac_tag'" "$LINENO" 5;;
+ :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;
:[FH]-) ac_tag=-:-;;
:[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
esac
@@ -6820,7 +6980,7 @@ do
for ac_f
do
case $ac_f in
- -) ac_f="$tmp/stdin";;
+ -) ac_f="$ac_tmp/stdin";;
*) # Look for the file first in the build tree, then in the source tree
# (if the path is not absolute). The absolute path cannot be DOS-style,
# because $ac_f cannot contain `:'.
@@ -6829,7 +6989,7 @@ do
[\\/$]*) false;;
*) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
esac ||
- as_fn_error "cannot find input file: \`$ac_f'" "$LINENO" 5;;
+ as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;
esac
case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
as_fn_append ac_file_inputs " '$ac_f'"
@@ -6855,8 +7015,8 @@ $as_echo "$as_me: creating $ac_file" >&6;}
esac
case $ac_tag in
- *:-:* | *:-) cat >"$tmp/stdin" \
- || as_fn_error "could not create $ac_file" "$LINENO" 5 ;;
+ *:-:* | *:-) cat >"$ac_tmp/stdin" \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
esac
;;
esac
@@ -6992,23 +7152,24 @@ s&@INSTALL@&$ac_INSTALL&;t t
s&@MKDIR_P@&$ac_MKDIR_P&;t t
$ac_datarootdir_hack
"
-eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \
- || as_fn_error "could not create $ac_file" "$LINENO" 5
+eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \
+ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5
test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
- { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
- { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
+ { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&
+ { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \
+ "$ac_tmp/out"`; test -z "$ac_out"; } &&
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
-which seems to be undefined. Please make sure it is defined." >&5
+which seems to be undefined. Please make sure it is defined" >&5
$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
-which seems to be undefined. Please make sure it is defined." >&2;}
+which seems to be undefined. Please make sure it is defined" >&2;}
- rm -f "$tmp/stdin"
+ rm -f "$ac_tmp/stdin"
case $ac_file in
- -) cat "$tmp/out" && rm -f "$tmp/out";;
- *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";;
+ -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;
+ *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;
esac \
- || as_fn_error "could not create $ac_file" "$LINENO" 5
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5
;;
:H)
#
@@ -7017,21 +7178,21 @@ which seems to be undefined. Please make sure it is defined." >&2;}
if test x"$ac_file" != x-; then
{
$as_echo "/* $configure_input */" \
- && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs"
- } >"$tmp/config.h" \
- || as_fn_error "could not create $ac_file" "$LINENO" 5
- if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then
+ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs"
+ } >"$ac_tmp/config.h" \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+ if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
$as_echo "$as_me: $ac_file is unchanged" >&6;}
else
rm -f "$ac_file"
- mv "$tmp/config.h" "$ac_file" \
- || as_fn_error "could not create $ac_file" "$LINENO" 5
+ mv "$ac_tmp/config.h" "$ac_file" \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5
fi
else
$as_echo "/* $configure_input */" \
- && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \
- || as_fn_error "could not create -" "$LINENO" 5
+ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \
+ || as_fn_error $? "could not create -" "$LINENO" 5
fi
# Compute "$ac_file"'s index in $config_headers.
_am_arg="$ac_file"
@@ -7181,7 +7342,7 @@ _ACEOF
ac_clean_files=$ac_clean_files_save
test $ac_write_fail = 0 ||
- as_fn_error "write failure creating $CONFIG_STATUS" "$LINENO" 5
+ as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5
# configure is writing to config.log, and then calls config.status.
@@ -7202,7 +7363,7 @@ if test "$no_create" != yes; then
exec 5>>config.log
# Use ||, not &&, to avoid exiting from the if with $? = 1, which
# would make configure fail if this is the last instruction.
- $ac_cs_success || as_fn_exit $?
+ $ac_cs_success || as_fn_exit 1
fi
if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
diff --git a/configure.ac b/configure.ac
index 6b46a4c..bccfee4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -17,7 +17,7 @@
# along with CRC-DADMOD. If not, see <http://www.gnu.org/licenses/>.
AC_PREREQ(2.59)
-AC_INIT([CRC-DabMod], [0.3.3], [pascal.charest@crc.ca])
+AC_INIT([CRC-DabMod], [0.3.3-sfn], [pascal.charest@crc.ca])
AC_CONFIG_AUX_DIR([build-aux])
AC_CANONICAL_SYSTEM
AM_INIT_AUTOMAKE([-Wall])
@@ -71,6 +71,10 @@ AS_IF([test "x$enable_fft_simd" != "xno"],
AC_SUBST([CFLAGS], ["$OPTIM $DEBUG $EXTRA"])
AC_SUBST([CXXFLAGS], ["$OPTIM $DEBUG $EXTRA"])
+AC_CHECK_LIB([uhd], [main], [], [AC_MSG_ERROR([library uhd is missing])])
+AC_CHECK_LIB([boost_thread], [main], [], [AC_MSG_ERROR([library boost_thread is missing])])
+
+AC_CHECK_LIB([rt], [clock_gettime], [], [AC_MSG_ERROR([library rt is missing])])
# Checks for libraries.
AS_IF([test "x$enable_debug" != "xno"],
diff --git a/doc/README-SFN b/doc/README-SFN
new file mode 100644
index 0000000..d0c75f9
--- /dev/null
+++ b/doc/README-SFN
@@ -0,0 +1,111 @@
+README About the Usage of CRC-DABMOD for
+Synchronous Transmissions
+========================================
+
+Summary
+-------
+CRC-DABMUX and CRC-DABMOD have a basic support for timestamped transmission,
+when the UHD output is used. This README explains how this functionality
+works, and how to set it up.
+
+This feature is a prerequisite for the creation of a single-frequency
+network.
+
+
+Concept
+-------
+The goal of this functionality is to synchronise the transmission for
+several transmitters. This has been tested with the USRP B100 and the
+USRP2, that both have the necessary REFCLK and 1PPS inputs. Both are
+required to synchronise two USRPs:
+- The REFCLK is used in the USRP for timekeeping. If we want two
+ USRPs to stay synchronised, they both must have a precise 10MHz
+ source at the REFCLK, otherwise their internal clocks will drift
+ off.
+- The 1PPS signal is used to set the time inside the USRPs. The rising
+ edge of the 1PPS signal has happen synchronously for all transmitters.
+ Usually, GPS is used to drive this 1PPS.
+
+For such a system, there will be one multiplexer, which will send the ETI
+stream to several modulators. The ETI stream, in this case, is transported
+over a TCP/IP.
+
+Each modulator receives ETI frames that contain absolute timestamps, defining
+the exact point in time when the frame has to be transmitted. These in-band
+timestamps are composed of two parts:
+- The TIST field as defined in the ETI standard, giving an offset after the
+ pulse per second signal;
+- A time information transmitted using the MNSC, representing the precise time
+ when the frame must be transmitted, with one-second resolution.
+
+When CRC-DABMUX is called with -s, the TIST is defined in each frame. The
+Time is always encoded in the MNSC.
+
+When the ETI stream is sent to several modulators using non-blocking I/O, it
+is not possible to rely on a modulator to back-pressure the Ensemble multiplexer.
+It is therefore necessary to throttle multiplexer output. CRC-DABMUX takes an
+additional parameter -r to output one ETI frame every 24ms.
+
+The tool eti_tcp.py can be used to send the ETI stream over TCP.
+An example invocation is:
+crc-dabmux <lots of options> | ./eti_tcp/eti_tcp.py 54540
+
+Each modulator then receives the ETI stream through a TCP connection. Each frame
+contains the complete timestamp, to which an per-modulator offset is added.
+The sum is then given to the USRP. The offset can be specified in two ways:
+
+using -o delay:
+Adds a constant delay specified on the command line (see example 1 below).
+
+using -O delayfile
+Adds the delay specified in the given file. The file must contains a single
+line containing a floating point number. This file is read each 50 frames, and
+the modulator delay is updated.
+
+In both cases, the units are seconds.
+
+Example modulator invocation (for a B100 USRP supporting 2048Msps and with a
+fixed delay of 2.3 seconds)
+nc localhost 54001 | crc-dabmod /dev/stdin -g2 \
+ -o 2.3 -l -u "master_clock_rate=32768000,type=b100" -F 234208000
+
+Example modulator invocation (for an USRP2 requiring resampling and with a delay
+specified in a separate file "moddelay")
+nc localhost 54001 | crc-dabmod /dev/stdin -g2 \
+ -O moddelay -l -r 4000000 -u "type=usrp2" -F 234208000
+
+CRC-DABMOD uses the UHD library to output modulated samples to the USRP device.
+When started, it defines the USRP time using the local time and the PPS signal.
+It is therefore important to synchronise computer time using NTP.
+
+When a frame arrives with a timestamp that is in the past, the frame is dropped.
+If the timestamp is too far in the future, the output module waits a short
+delay.
+
+Synchonisation can be verified by using an oscilloscope and a receiver. It is
+very easy to see if the null symbols align.
+
+
+Hardware requirements
+---------------------
+The following hardware is required to test the SFN patch to the CRC mmbTools:
+- Two USRPs ;
+- One or two computers with the mmbTools installed ;
+- A network connection between the two computers ;
+- A 10MHz refclk source ;
+- A 1PPS source synchronised to the 10MHz ;
+- An oscilloscope to check synchronisation.
+
+When more than one USRP is plugged to one computer, the device string for the
+-u option for CRC-DABMOD must specify the device. (e.g. -u "type=b100",
+-u "type=usrp2" or -u "serial=ABC123")
+
+It is possible to use signal generators as REFCLK source and 1PPS, if there is
+no GPS-disciplined oscillator available. It is necessary to synchronise the
+1PPS source to the 10MHz source.
+
+The UHD Output module (C++) has to be modified if the USRP internal GPSDO option
+is used.
+
+###########
+june 2012, Matthias P. Braendli
diff --git a/src/BlockPartitioner.cpp b/src/BlockPartitioner.cpp
index bb16ae2..2ae2e7a 100644
--- a/src/BlockPartitioner.cpp
+++ b/src/BlockPartitioner.cpp
@@ -29,7 +29,7 @@
#include <assert.h>
-BlockPartitioner::BlockPartitioner(unsigned mode, unsigned fct) :
+BlockPartitioner::BlockPartitioner(unsigned mode, unsigned phase) :
ModMux(ModFormat(0), ModFormat(0)),
d_mode(mode)
{
@@ -67,7 +67,7 @@ BlockPartitioner::BlockPartitioner(unsigned mode, unsigned fct) :
}
d_cifNb = 0;
// For Synchronisation purpose, count nb of CIF to drop
- d_cifInit = fct % d_cifCount;
+ d_cifPhase = phase % d_cifCount;
d_cifSize = 864 * 8;
myInputFormat.size(d_cifSize);
@@ -110,10 +110,10 @@ int BlockPartitioner::process(std::vector<Buffer*> dataIn, Buffer* dataOut)
"BlockPartitioner::process input size not valid!");
}
- // Synchronize first CIF
- if (d_cifInit != 0) {
- if (++d_cifInit == d_cifCount) {
- d_cifInit = 0;
+ // Synchronize CIF phase
+ if (d_cifPhase != 0) {
+ if (++d_cifPhase == d_cifCount) {
+ d_cifPhase = 0;
}
// Drop CIF
return 0;
diff --git a/src/BlockPartitioner.h b/src/BlockPartitioner.h
index ec788bf..021a1a6 100644
--- a/src/BlockPartitioner.h
+++ b/src/BlockPartitioner.h
@@ -35,7 +35,7 @@
class BlockPartitioner : public ModMux
{
public:
- BlockPartitioner(unsigned mode, unsigned fct);
+ BlockPartitioner(unsigned mode, unsigned phase);
virtual ~BlockPartitioner();
BlockPartitioner(const BlockPartitioner&);
BlockPartitioner& operator=(const BlockPartitioner&);
@@ -48,7 +48,7 @@ protected:
size_t d_ficSize;
size_t d_cifCount;
size_t d_cifNb;
- size_t d_cifInit;
+ size_t d_cifPhase;
size_t d_cifSize;
size_t d_outputFramesize;
size_t d_outputFramecount;
diff --git a/src/CicEqualizer.cpp b/src/CicEqualizer.cpp
index 06f4550..52da55e 100644
--- a/src/CicEqualizer.cpp
+++ b/src/CicEqualizer.cpp
@@ -36,22 +36,21 @@ CicEqualizer::CicEqualizer(size_t nbCarriers, size_t spacing, int R) :
nbCarriers, spacing, R, this);
myFilter = new float[nbCarriers];
- int M = 1;
- int N = 4;
- float pi = 4.0f * atanf(1.0f);
+ const int M = 1;
+ const int N = 4;
+ const float pi = 4.0f * atanf(1.0f);
for (size_t i = 0; i < nbCarriers; ++i) {
int k = i < (nbCarriers + 1) / 2
? i + ((nbCarriers & 1) ^ 1)
: i - (int)nbCarriers;
float angle = pi * k / spacing;
if (k == 0) {
- myFilter[i] = R;
- } else {
- myFilter[i] = sinf(angle / R) / sinf(angle * M);
- }
- myFilter[i] = fabsf(myFilter[i]) * R;
- myFilter[i] = powf(myFilter[i], N);
- myFilter[i] *= 0.5f;
+ myFilter[i] = 1.0f;
+ } else {
+ myFilter[i] = sinf(angle / R) / sinf(angle * M);
+ myFilter[i] = fabsf(myFilter[i]) * R * M;
+ myFilter[i] = powf(myFilter[i], N);
+ }
PDEBUG("HCic[%zu -> %i] = %f (%f dB) -> angle: %f\n",
i, k,myFilter[i], 20.0 * log10(myFilter[i]), angle);
}
diff --git a/src/DabMod.cpp b/src/DabMod.cpp
index db0c712..f9bc3c9 100644
--- a/src/DabMod.cpp
+++ b/src/DabMod.cpp
@@ -2,6 +2,9 @@
Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
Her Majesty the Queen in Right of Canada (Communications Research
Center Canada)
+
+ Includes modifications for which no copyright is claimed
+ 2012, Matthias P. Braendli, matthias.braendli@mpb.li
*/
/*
This file is part of CRC-DADMOD.
@@ -29,7 +32,9 @@
#include "DabModulator.h"
#include "InputMemory.h"
#include "OutputFile.h"
+#include "OutputUHD.h"
#include "PcDebug.h"
+#include "TimestampDecoder.h"
#include <complex>
#include <stdlib.h>
@@ -69,10 +74,14 @@ void printUsage(char* progName, FILE* out = stderr)
{
fprintf(out, "Usage:\n");
fprintf(out, "\t%s"
- " [input [output]]"
+ " [input]"
+ " (-f filename | -u uhddevice -F frequency) "
+ " [-G txgain]"
+ " [-o offset]"
+ " [-O offsetfile]"
+ " [-T filter_taps_file]"
" [-a amplitude]"
" [-c clockrate]"
- " [-f]"
" [-g gainMode]"
" [-h]"
" [-l]"
@@ -80,17 +89,23 @@ void printUsage(char* progName, FILE* out = stderr)
" [-r samplingRate]"
"\n", progName);
fprintf(out, "Where:\n");
- fprintf(out, "input: ETI input filename (default: stdin).\n");
- fprintf(out, "output: COFDM output filename (default: stdout).\n");
- fprintf(out, "-a: Apply amplitude gain.\n");
- fprintf(out, "-c: Set the DAC clock rate.\n");
- fprintf(out, "-f: (deprecated) Set fifo input.\n");
- fprintf(out, "-g: Set computation gain mode: "
+ fprintf(out, "input: ETI input filename (default: stdin).\n");
+ fprintf(out, "-f name: Use file output with given filename. (use /dev/stdout for standard 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: (UHD only) Set the file containing the timestamp offset added to the timestamp in the ETI. The file is read every six seconds, and must contain a double value.\n");
+ fprintf(out, " Specifying either -o or -O make DABMOD mute frames that do not contain a valid timestamp.\n");
+ fprintf(out, "-T taps_file: Enable filtering before the output, using the specified file containing the filter 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: Set computation gain mode: "
"%u FIX, %u MAX, %u VAR\n", GAIN_FIX, GAIN_MAX, GAIN_VAR);
- fprintf(out, "-h: Print this help.\n");
- fprintf(out, "-l: Loop file when reach end of file.\n");
- fprintf(out, "-m: Set DAB mode: (0: auto, 1-4: force).\n");
- fprintf(out, "-r: Set output sampling rate (default: 2048000).\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");
}
@@ -124,7 +139,15 @@ int main(int argc, char* argv[])
int ret = 0;
bool loop = false;
char* inputName;
+
char* outputName;
+ char* outputDevice;
+ int useFileOutput = 0;
+ int useUHDOutput = 0;
+ double uhdFrequency = 0.0;
+ int uhdTxGain = 0;
+ bool uhd_mute_no_timestamps = false;
+
FILE* inputFile = NULL;
uint32_t sync = 0;
uint32_t nbFrames = 0;
@@ -137,15 +160,26 @@ int main(int argc, char* argv[])
GainMode gainMode = GAIN_VAR;
Buffer data;
+ char* filterTapsFilename = NULL;
+
+ // To handle the timestamp offset of the modulator
+ struct modulator_offset_config modconf;
+ modconf.use_offset_file = false;
+ modconf.use_offset_fixed = false;
+
Flowgraph* flowgraph = NULL;
DabModulator* modulator = NULL;
InputMemory* input = NULL;
- OutputFile* output = NULL;
+ ModOutput* output = NULL;
signal(SIGINT, signalHandler);
+ // Set timezone to UTC
+ setenv("TZ", "", 1);
+ tzset();
+
while (true) {
- int c = getopt(argc, argv, "a:c:fg:hlm:r:V");
+ int c = getopt(argc, argv, "a:c:f:F:g:G:hlm:o:O:r:T:u:V");
if (c == -1) {
break;
}
@@ -157,20 +191,60 @@ int main(int argc, char* argv[])
clockRate = strtol(optarg, NULL, 0);
break;
case 'f':
- fprintf(stderr, "Option -f deprecated!\n");
+ if (useUHDOutput) {
+ fprintf(stderr, "Options -u and -f are mutually exclusive\n");
+ goto END_MAIN;
+ }
+ outputName = optarg;
+ useFileOutput = 1;
+ break;
+ case 'F':
+ uhdFrequency = strtof(optarg, NULL);
break;
case 'g':
gainMode = (GainMode)strtol(optarg, NULL, 0);
break;
+ case 'G':
+ uhdTxGain = (int)strtol(optarg, NULL, 10);
+ break;
case 'l':
loop = true;
break;
+ case 'o':
+ if (modconf.use_offset_file)
+ {
+ fprintf(stderr, "Options -o and -O are mutually exclusive\n");
+ goto END_MAIN;
+ }
+ modconf.use_offset_fixed = true;
+ modconf.offset_fixed = strtod(optarg, NULL);
+ break;
+ case 'O':
+ if (modconf.use_offset_fixed)
+ {
+ fprintf(stderr, "Options -o and -O are mutually exclusive\n");
+ goto END_MAIN;
+ }
+ modconf.use_offset_file = true;
+ modconf.offset_filename = optarg;
+ break;
case 'm':
dabMode = strtol(optarg, NULL, 0);
break;
case 'r':
outputRate = strtol(optarg, NULL, 0);
break;
+ case 'T':
+ filterTapsFilename = optarg;
+ break;
+ case 'u':
+ if (useFileOutput) {
+ fprintf(stderr, "Options -u and -f are mutually exclusive\n");
+ goto END_MAIN;
+ }
+ outputDevice = optarg;
+ useUHDOutput = 1;
+ break;
case 'V':
printVersion();
goto END_MAIN;
@@ -186,18 +260,22 @@ int main(int argc, char* argv[])
goto END_MAIN;
}
}
+
+ // When using offset, enable frame muting
+ uhd_mute_no_timestamps = (modconf.use_offset_file || modconf.use_offset_fixed);
+
+ if (!(modconf.use_offset_file || modconf.use_offset_fixed)) {
+ fprintf(stderr, "No Modulator offset defined, setting to 0\n");
+ modconf.use_offset_fixed = true;
+ modconf.offset_fixed = 0;
+ }
+
// Setting ETI input filename
if (optind < argc) {
inputName = argv[optind++];
} else {
inputName = (char*)"/dev/stdin";
}
- // Setting COFDM output filename
- if (optind < argc) {
- outputName = argv[optind++];
- } else {
- outputName = (char*)"/dev/stdout";
- }
// Checking unused arguments
if (optind != argc) {
fprintf(stderr, "Invalid arguments:");
@@ -210,15 +288,25 @@ int main(int argc, char* argv[])
goto END_MAIN;
}
+ if (!useFileOutput && !useUHDOutput) {
+ fprintf(stderr, "Must specify output !");
+ goto END_MAIN;
+ }
+
// Print settings
fprintf(stderr, "Input\n");
fprintf(stderr, " Name: %s\n", inputName);
fprintf(stderr, "Output\n");
- fprintf(stderr, " Name: %s\n", outputName);
+ if (useUHDOutput) {
+ fprintf(stderr, " UHD, Device: %s\n", outputDevice);
+ }
+ else if (useFileOutput) {
+ fprintf(stderr, " Name: %s\n", outputName);
+ }
fprintf(stderr, " Sampling rate: ");
if (outputRate > 1000) {
if (outputRate > 1000000) {
- fprintf(stderr, "%.3g mHz\n", outputRate / 1000000.0f);
+ fprintf(stderr, "%.3g MHz\n", outputRate / 1000000.0f);
} else {
fprintf(stderr, "%.3g kHz\n", outputRate / 1000.0f);
}
@@ -234,18 +322,32 @@ int main(int argc, char* argv[])
ret = -1;
goto END_MAIN;
}
- // Opening COFDM output file
- if (outputName != NULL) {
- output = new OutputFile(outputName);
+
+ if (useFileOutput) {
+ // Opening COFDM output file
+ if (outputName != NULL) {
+ fprintf(stderr, "Using file output\n");
+ output = new OutputFile(outputName);
+ }
+ }
+ else if (useUHDOutput) {
+ fprintf(stderr, "Using UHD output\n");
+ amplitude /= 32000.0f;
+ output = new OutputUHD(outputDevice, outputRate, uhdFrequency, uhdTxGain, uhd_mute_no_timestamps);
}
flowgraph = new Flowgraph();
data.setLength(6144);
input = new InputMemory(&data);
- modulator = new DabModulator(outputRate, clockRate, dabMode, gainMode, amplitude);
+ modulator = new DabModulator(modconf, outputRate, clockRate,
+ dabMode, gainMode, amplitude, filterTapsFilename);
flowgraph->connect(input, modulator);
flowgraph->connect(modulator, output);
+ if (useUHDOutput) {
+ ((OutputUHD*)output)->setETIReader(modulator->getEtiReader());
+ }
+
try {
while (running) {
enum EtiStreamType {
diff --git a/src/DabModulator.cpp b/src/DabModulator.cpp
index 6396a4d..e186fd3 100644
--- a/src/DabModulator.cpp
+++ b/src/DabModulator.cpp
@@ -2,6 +2,9 @@
Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012
Her Majesty the Queen in Right of Canada (Communications Research
Center Canada)
+
+ Includes modifications for which no copyright is claimed
+ 2012, Matthias P. Braendli, matthias.braendli@mpb.li
*/
/*
This file is part of CRC-DADMOD.
@@ -38,19 +41,27 @@
#include "GuardIntervalInserter.h"
#include "Resampler.h"
#include "ConvEncoder.h"
+#include "FIRFilter.h"
#include "PuncturingEncoder.h"
#include "TimeInterleaver.h"
+#include "TimestampDecoder.h"
-DabModulator::DabModulator(unsigned outputRate, unsigned clockRate,
- unsigned dabMode, GainMode gainMode, float factor) :
+DabModulator::DabModulator(
+ struct modulator_offset_config& modconf,
+ unsigned outputRate, unsigned clockRate,
+ unsigned dabMode, GainMode gainMode, float factor,
+ char* filterTapsFilename
+ ) :
ModCodec(ModFormat(1), ModFormat(0)),
myOutputRate(outputRate),
myClockRate(clockRate),
myDabMode(dabMode),
myGainMode(gainMode),
myFactor(factor),
- myFlowgraph(NULL)
+ myEtiReader(EtiReader(modconf)),
+ myFlowgraph(NULL),
+ myFilterTapsFilename(filterTapsFilename)
{
PDEBUG("DabModulator::DabModulator(%u, %u, %u, %u) @ %p\n",
outputRate, clockRate, dabMode, gainMode, this);
@@ -147,12 +158,13 @@ int DabModulator::process(Buffer* const dataIn, Buffer* dataOut)
OfdmGenerator* cifOfdm = NULL;
GainControl* cifGain = NULL;
GuardIntervalInserter* cifGuard = NULL;
+ FIRFilter* cifFilter = NULL;
Resampler* cifRes = NULL;
cifPrbs = new PrbsGenerator(864 * 8, 0x110);
cifMux = new FrameMultiplexer(myFicSizeOut + 864 * 8,
&myEtiReader.getSubchannels());
- cifPart = new BlockPartitioner(mode, myEtiReader.getFct());
+ cifPart = new BlockPartitioner(mode, myEtiReader.getFp());
cifMap = new QpskSymbolMapper(myNbCarriers);
cifRef = new PhaseReference(mode);
cifFreq = new FrequencyInterleaver(mode);
@@ -162,15 +174,28 @@ int DabModulator::process(Buffer* const dataIn, Buffer* dataOut)
(1 + myNbSymbols) * myNbCarriers * sizeof(complexf));
if (myClockRate) {
- cifCicEq = new CicEqualizer(myNbCarriers,
- (float)mySpacing * (float)myOutputRate / 2048000.0f,
- myClockRate / myOutputRate);
+ unsigned ratio = myClockRate / myOutputRate;
+ ratio /= 4; // FPGA DUC
+ if (myClockRate == 400000000) { // USRP2
+ if (ratio & 1) { // odd
+ cifCicEq = new CicEqualizer(myNbCarriers,
+ (float)mySpacing * (float)myOutputRate / 2048000.0f,
+ ratio);
+ } // even, no filter
+ } else {
+ cifCicEq = new CicEqualizer(myNbCarriers,
+ (float)mySpacing * (float)myOutputRate / 2048000.0f,
+ ratio);
+ }
}
cifOfdm = new OfdmGenerator((1 + myNbSymbols), myNbCarriers, mySpacing);
cifGain = new GainControl(mySpacing, myGainMode, myFactor);
cifGuard = new GuardIntervalInserter(myNbSymbols, mySpacing,
myNullSize, mySymSize);
+ if (myFilterTapsFilename != NULL) {
+ cifFilter = new FIRFilter(myFilterTapsFilename);
+ }
myOutput = new OutputMemory();
if (myOutputRate != 2048000) {
@@ -312,11 +337,24 @@ int DabModulator::process(Buffer* const dataIn, Buffer* dataOut)
}
myFlowgraph->connect(cifOfdm, cifGain);
myFlowgraph->connect(cifGain, cifGuard);
- if (cifRes != NULL) {
- myFlowgraph->connect(cifGuard, cifRes);
- myFlowgraph->connect(cifRes, myOutput);
- } else {
- myFlowgraph->connect(cifGuard, myOutput);
+
+ if (myFilterTapsFilename != NULL) {
+ myFlowgraph->connect(cifGuard, cifFilter);
+ if (cifRes != NULL) {
+ myFlowgraph->connect(cifFilter, cifRes);
+ myFlowgraph->connect(cifRes, myOutput);
+ } else {
+ myFlowgraph->connect(cifFilter, myOutput);
+ }
+ }
+ else { //no filtering
+ if (cifRes != NULL) {
+ myFlowgraph->connect(cifGuard, cifRes);
+ myFlowgraph->connect(cifRes, myOutput);
+ } else {
+ myFlowgraph->connect(cifGuard, myOutput);
+ }
+
}
}
diff --git a/src/DabModulator.h b/src/DabModulator.h
index 9112960..0eecfa4 100644
--- a/src/DabModulator.h
+++ b/src/DabModulator.h
@@ -2,6 +2,9 @@
Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012
Her Majesty the Queen in Right of Canada (Communications Research
Center Canada)
+
+ Includes modifications for which no copyright is claimed
+ 2012, Matthias P. Braendli, matthias.braendli@mpb.li
*/
/*
This file is part of CRC-DADMOD.
@@ -39,14 +42,20 @@
class DabModulator : public ModCodec
{
public:
- DabModulator(unsigned outputRate = 2048000, unsigned clockRate = 0,
- unsigned dabMode = 0, GainMode gainMode = GAIN_VAR, float factor = 1.0);
+ DabModulator(
+ struct modulator_offset_config& modconf,
+ unsigned outputRate = 2048000, unsigned clockRate = 0,
+ unsigned dabMode = 0, GainMode gainMode = GAIN_VAR,
+ float factor = 1.0, char* filterTapsFilename = NULL);
DabModulator(const DabModulator& copy);
virtual ~DabModulator();
int process(Buffer* const dataIn, Buffer* dataOut);
const char* name() { return "DabModulator"; }
+ /* Required to get the timestamp */
+ EtiReader* getEtiReader() { return &myEtiReader; }
+
protected:
void setMode(unsigned mode);
@@ -58,6 +67,7 @@ protected:
EtiReader myEtiReader;
Flowgraph* myFlowgraph;
OutputMemory* myOutput;
+ char* myFilterTapsFilename;
size_t myNbSymbols;
size_t myNbCarriers;
diff --git a/src/Eti.h b/src/Eti.h
index fd5fc88..698f9cb 100644
--- a/src/Eti.h
+++ b/src/Eti.h
@@ -1,6 +1,9 @@
/*
Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Her Majesty the
Queen in Right of Canada (Communications Research Center Canada)
+
+ Includes modifications for which no copyright is claimed
+ 2012, Matthias P. Braendli, matthias.braendli@mpb.li
*/
/*
This file is part of CRC-DADMOD.
@@ -39,6 +42,7 @@ typedef DWORD32 uint32_t;
# define PACKED __attribute__ ((packed))
#endif
+#include <time.h>
//definitions des structures des champs du ETI(NI, G703)
@@ -92,5 +96,41 @@ struct eti_TIST {
uint32_t TIST;
} PACKED;
+struct eti_MNSC_TIME_0 {
+ uint32_t type:4;
+ uint32_t identifier:4;
+ uint32_t rfa:8;
+} PACKED;
+
+struct eti_MNSC_TIME_1 {
+ uint32_t second_unit:4;
+ uint32_t second_tens:3;
+ uint32_t accuracy:1;
+
+ uint32_t minute_unit:4;
+ uint32_t minute_tens:3;
+ uint32_t sync_to_frame:1;
+} PACKED;
+
+struct eti_MNSC_TIME_2 {
+ uint32_t hour_unit:4;
+ uint32_t hour_tens:4;
+
+ uint32_t day_unit:4;
+ uint32_t day_tens:4;
+} PACKED;
+
+struct eti_MNSC_TIME_3 {
+ uint32_t month_unit:4;
+ uint32_t month_tens:4;
+
+ uint32_t year_unit:4;
+ uint32_t year_tens:4;
+} PACKED;
+
+struct eti_extension_TIME {
+ uint32_t TIME_SECONDS;
+} PACKED;
+
#endif // ETI_H
diff --git a/src/EtiReader.cpp b/src/EtiReader.cpp
index d65dbe0..7e7d4af 100644
--- a/src/EtiReader.cpp
+++ b/src/EtiReader.cpp
@@ -1,6 +1,9 @@
/*
Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011 Her Majesty
the Queen in Right of Canada (Communications Research Center Canada)
+
+ Includes modifications for which no copyright is claimed
+ 2012, Matthias P. Braendli, matthias.braendli@mpb.li
*/
/*
This file is part of CRC-DADMOD.
@@ -21,10 +24,12 @@
#include "EtiReader.h"
#include "PcDebug.h"
+#include "TimestampDecoder.h"
#include <stdexcept>
#include <sys/types.h>
#include <string.h>
+#include <arpa/inet.h>
enum ETI_READER_STATE {
@@ -42,15 +47,15 @@ enum ETI_READER_STATE {
};
-EtiReader::EtiReader() : state(EtiReaderStateSync),
- myFicSource(NULL)
+EtiReader::EtiReader(struct modulator_offset_config& modconf) :
+ state(EtiReaderStateSync), myFicSource(NULL)
{
PDEBUG("EtiReader::EtiReader()\n");
myCurrentFrame = 0;
+ myTimestampDecoder = new TimestampDecoder(modconf);
}
-
EtiReader::~EtiReader()
{
PDEBUG("EtiReader::~EtiReader()\n");
@@ -76,9 +81,9 @@ unsigned EtiReader::getMode()
}
-unsigned EtiReader::getFct()
+unsigned EtiReader::getFp()
{
- return eti_fc.FCT;
+ return eti_fc.FP;
}
@@ -266,5 +271,38 @@ int EtiReader::process(Buffer* dataIn)
}
}
+ // Update timestamps
+ myTimestampDecoder->updateTimestampEti(eti_fc.FP & 0x3,
+ eti_eoh.MNSC,
+ getPPSOffset());
+
+ if (getFCT() % 125 == 0) //every 3 seconds is fine enough
+ {
+ myTimestampDecoder->updateModulatorOffset();
+ }
+
return dataIn->getLength() - input_size;
}
+
+bool EtiReader::sourceContainsTimestamp()
+{
+ return (ntohl(eti_tist.TIST) & 0xFFFFFF) != 0xFFFFFF;
+ /* See ETS 300 799, Annex C.2.2 */
+}
+
+double EtiReader::getPPSOffset()
+{
+ if (!sourceContainsTimestamp())
+ return 0.0;
+
+ uint32_t timestamp = ntohl(eti_tist.TIST) & 0xFFFFFF;
+ //fprintf(stderr, "TIST 0x%x\n", timestamp);
+ double pps = timestamp / 16384000.0; // seconds
+
+ return pps;
+}
+
+uint32_t EtiReader::getFCT()
+{
+ return eti_fc.FCT;
+}
diff --git a/src/EtiReader.h b/src/EtiReader.h
index 7e172db..5f4897b 100644
--- a/src/EtiReader.h
+++ b/src/EtiReader.h
@@ -1,6 +1,9 @@
/*
Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011 Her Majesty
the Queen in Right of Canada (Communications Research Center Canada)
+
+ Includes modifications for which no copyright is claimed
+ 2012, Matthias P. Braendli, matthias.braendli@mpb.li
*/
/*
This file is part of CRC-DADMOD.
@@ -30,6 +33,7 @@
#include "Eti.h"
#include "FicSource.h"
#include "SubchannelSource.h"
+#include "TimestampDecoder.h"
#include <vector>
#include <stdint.h>
@@ -51,21 +55,39 @@ protected:
eti_TIST eti_tist;
FicSource* myFicSource;
std::vector<SubchannelSource*> mySources;
+ TimestampDecoder* myTimestampDecoder;
public:
- EtiReader();
+ EtiReader(struct modulator_offset_config& modconf);
virtual ~EtiReader();
EtiReader(const EtiReader&);
EtiReader& operator=(const EtiReader&);
FicSource* getFic();
unsigned getMode();
- unsigned getFct();
+ unsigned getFp();
const std::vector<SubchannelSource*>& getSubchannels();
int process(Buffer* dataIn);
+ void calculateTimestamp(struct frame_timestamp& ts)
+ {
+ myTimestampDecoder->calculateTimestamp(ts);
+ }
+
+ /* Return the frame counter */
+ uint32_t getFCT();
+
+ /* Returns true if we have valid time stamps in the ETI*/
+ bool sourceContainsTimestamp();
+
+protected:
+ /* Transform the ETI TIST to a PPS offset in ms */
+ double getPPSOffset();
+
private:
size_t myCurrentFrame;
+ bool time_ext_enabled;
+ unsigned long timestamp_seconds;
};
diff --git a/src/FIRFilter.cpp b/src/FIRFilter.cpp
new file mode 100644
index 0000000..2ba4294
--- /dev/null
+++ b/src/FIRFilter.cpp
@@ -0,0 +1,311 @@
+/*
+ Copyright (C) 2007, 2008, 2009, 2010, 2011 Her Majesty the Queen in
+ Right of Canada (Communications Research Center Canada)
+
+ Written by
+ 2012, Matthias P. Braendli, matthias.braendli@mpb.li
+
+ This block implements a FIR filter. The real filter taps are given
+ as floats, and the block can take advantage of SSE.
+ For better performance, filtering is done in another thread, leading
+ to a pipeline delay of two calls to FIRFilter::process
+ */
+/*
+ This file is part of CRC-DADMOD.
+
+ CRC-DADMOD 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 of the
+ License, or (at your option) any later version.
+
+ CRC-DADMOD 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 CRC-DADMOD. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "FIRFilter.h"
+#include "PcDebug.h"
+
+#include <stdio.h>
+#include <stdexcept>
+
+#include <iostream>
+#include <fstream>
+
+#ifdef __SSE__
+# include <xmmintrin.h>
+#endif
+
+
+#include <sys/time.h>
+
+void FIRFilterWorker::process(struct FIRFilterWorkerData *fwd)
+{
+ size_t i;
+ struct timespec time_start;
+ struct timespec time_end;
+
+ // This thread creates the dataOut buffer, and deletes
+ // the incoming buffer
+
+ while(running) {
+ Buffer* dataIn;
+ fwd->input_queue.wait_and_pop(dataIn);
+
+ Buffer* dataOut;
+ dataOut = new Buffer();
+ dataOut->setLength(dataIn->getLength());
+
+ PDEBUG("FIRFilterWorker: dataIn->getLength() %d\n", dataIn->getLength());
+
+#if __SSE__
+ // The SSE accelerated version cannot work on the complex values,
+ // it is necessary to do the convolution on the real and imaginary
+ // parts separately. Thankfully, the taps are real, simplifying the
+ // procedure.
+
+ const float* in = reinterpret_cast<const float*>(dataIn->getData());
+ float* out = reinterpret_cast<float*>(dataOut->getData());
+ size_t sizeIn = dataIn->getLength() / sizeof(float);
+
+ if ((uintptr_t)(&out[0]) % 16 != 0) {
+ fprintf(stderr, "FIRFilterWorker: out not aligned %p ", out);
+ throw std::runtime_error("FIRFilterWorker: out not aligned");
+ }
+
+ clock_gettime(CLOCK_THREAD_CPUTIME_ID, &time_start);
+
+ __m128 SSEout;
+ __m128 SSEtaps;
+ __m128 SSEin;
+ for (i = 0; i < sizeIn - 2*fwd->n_taps; i += 4) {
+ SSEout = _mm_setr_ps(0,0,0,0);
+
+ for (int j = 0; j < fwd->n_taps; j++) {
+ if ((uintptr_t)(&in[i+2*j]) % 16 == 0) {
+ SSEin = _mm_load_ps(&in[i+2*j]); //faster when aligned
+ }
+ else {
+ SSEin = _mm_loadu_ps(&in[i+2*j]);
+ }
+
+ SSEtaps = _mm_load1_ps(&fwd->taps[j]);
+
+ SSEout = _mm_add_ps(SSEout, _mm_mul_ps(SSEin, SSEtaps));
+ }
+ _mm_store_ps(&out[i], SSEout);
+ }
+
+ for (; i < sizeIn; i++) {
+ out[i] = 0.0;
+ for (int j = 0; i+2*j < sizeIn; j++) {
+ out[i] += in[i+2*j] * fwd->taps[j];
+ }
+ }
+ clock_gettime(CLOCK_THREAD_CPUTIME_ID, &time_end);
+
+#else
+ // No SSE ? Loop unrolling should make this faster. As for the SSE,
+ // the real and imaginary parts are calculated separately.
+ const float* in = reinterpret_cast<const float*>(dataIn->getData());
+ float* out = reinterpret_cast<float*>(dataOut->getData());
+ size_t sizeIn = dataIn->getLength() / sizeof(float);
+
+ clock_gettime(CLOCK_THREAD_CPUTIME_ID, &time_start);
+
+ // Convolve by aligning both frame and taps at zero.
+ for (i = 0; i < sizeIn - 2*fwd->n_taps; i += 4) {
+ out[i] = 0.0;
+ out[i+1] = 0.0;
+ out[i+2] = 0.0;
+ out[i+3] = 0.0;
+
+ for (int j = 0; j < fwd->n_taps; j++) {
+ out[i] += in[i + 2*j] * fwd->taps[j];
+ out[i+1] += in[i+1 + 2*j] * fwd->taps[j];
+ out[i+2] += in[i+2 + 2*j] * fwd->taps[j];
+ out[i+3] += in[i+3 + 2*j] * fwd->taps[j];
+ }
+ }
+
+ // At the end of the frame, we cut the convolution off.
+ // The beginning of the next frame starts with a NULL symbol
+ // anyway.
+ for (; i < sizeIn; i++) {
+ out[i] = 0.0;
+ for (int j = 0; i+2*j < sizeIn; j++) {
+ out[i] += in[i+2*j] * fwd->taps[j];
+ }
+ }
+
+ clock_gettime(CLOCK_THREAD_CPUTIME_ID, &time_end);
+
+
+#endif
+
+ // The following implementations are for debugging only.
+#if 0
+ // Same thing as above, without loop unrolling. For debugging.
+ const float* in = reinterpret_cast<const float*>(dataIn->getData());
+ float* out = reinterpret_cast<float*>(dataOut->getData());
+ size_t sizeIn = dataIn->getLength() / sizeof(float);
+
+ for (i = 0; i < sizeIn - 2*fwd->n_taps; i += 1) {
+ out[i] = 0.0;
+
+ for (int j = 0; j < fwd->n_taps; j++) {
+ out[i] += in[i+2*j] * fwd->taps[j];
+ }
+ }
+
+ for (; i < sizeIn; i++) {
+ out[i] = 0.0;
+ for (int j = 0; i+2*j < sizeIn; j++) {
+ out[i] += in[i+2*j] * fwd->taps[j];
+ }
+ }
+
+#elif 0
+ // An unrolled loop, but this time, the input data is cast to complex float.
+ // Makes indices more natural. For debugging.
+ const complexf* in = reinterpret_cast<const complexf*>(dataIn->getData());
+ complexf* out = reinterpret_cast<complexf*>(dataOut->getData());
+ size_t sizeIn = dataIn->getLength() / sizeof(complexf);
+
+ for (i = 0; i < sizeIn - fwd->n_taps; i += 4) {
+ out[i] = 0.0;
+ out[i+1] = 0.0;
+ out[i+2] = 0.0;
+ out[i+3] = 0.0;
+
+ for (int j = 0; j < fwd->n_taps; j++) {
+ out[i] += in[i+j ] * fwd->taps[j];
+ out[i+1] += in[i+1+j] * fwd->taps[j];
+ out[i+2] += in[i+2+j] * fwd->taps[j];
+ out[i+3] += in[i+3+j] * fwd->taps[j];
+ }
+ }
+
+ for (; i < sizeIn; i++) {
+ out[i] = 0.0;
+ for (int j = 0; j+i < sizeIn; j++) {
+ out[i] += in[i+j] * fwd->taps[j];
+ }
+ }
+
+#elif 0
+ // Simple implementation. Slow. For debugging.
+ const complexf* in = reinterpret_cast<const complexf*>(dataIn->getData());
+ complexf* out = reinterpret_cast<complexf*>(dataOut->getData());
+ size_t sizeIn = dataIn->getLength() / sizeof(complexf);
+
+ for (i = 0; i < sizeIn - fwd->n_taps; i += 1) {
+ out[i] = 0.0;
+
+ for (int j = 0; j < fwd->n_taps; j++) {
+ out[i] += in[i+j ] * fwd->taps[j];
+ }
+ }
+
+ for (; i < sizeIn; i++) {
+ out[i] = 0.0;
+ for (int j = 0; j+i < sizeIn; j++) {
+ out[i] += in[i+j] * fwd->taps[j];
+ }
+ }
+#endif
+
+ calculationTime += (time_end.tv_sec - time_start.tv_sec) * 1000000000L +
+ time_end.tv_nsec - time_start.tv_nsec;
+ fwd->output_queue.push(dataOut);
+ delete dataIn;
+ }
+}
+
+
+FIRFilter::FIRFilter(char* taps_file) :
+ ModCodec(ModFormat(sizeof(complexf)), ModFormat(sizeof(complexf)))
+{
+ PDEBUG("FIRFilter::FIRFilter(%s) @ %p\n",
+ taps_file, this);
+
+ number_of_runs = 0;
+
+ std::ifstream taps_fstream(taps_file);
+ if(!taps_fstream) {
+ fprintf(stderr, "FIRFilter: file %s could not be opened !\n", taps_file);
+ throw std::runtime_error("FIRFilter: Could not open file with taps! ");
+ }
+ int n_taps;
+ taps_fstream >> n_taps;
+
+ my_Ntaps = n_taps;
+
+ fprintf(stderr, "FIRFilter: Reading %d taps...\n", my_Ntaps);
+
+ myFilter = new float[my_Ntaps];
+
+ int n;
+ for (n = 0; n < n_taps; n++) {
+ taps_fstream >> myFilter[n];
+ PDEBUG("FIRFilter: tap: %f\n", myFilter[n] );
+ if (taps_fstream.eof()) {
+ fprintf(stderr, "FIRFilter: file %s should contains %d taps, but EOF reached "\
+ "after %d taps !\n", taps_file, n_taps, n);
+ throw std::runtime_error("FIRFilter: filtertaps file invalid ! ");
+ }
+ }
+
+ firwd.taps = myFilter;
+ firwd.n_taps = my_Ntaps;
+
+ PDEBUG("FIRFilter: Starting worker\n" );
+ worker.start(&firwd);
+}
+
+
+FIRFilter::~FIRFilter()
+{
+ PDEBUG("FIRFilter::~FIRFilter() @ %p\n", this);
+
+ worker.stop();
+
+ if (myFilter != NULL) {
+ delete[] myFilter;
+ }
+}
+
+
+int FIRFilter::process(Buffer* const dataIn, Buffer* dataOut)
+{
+ PDEBUG("FIRFilter::process(dataIn: %p, dataOut: %p)\n",
+ dataIn, dataOut);
+
+ // This thread creates the dataIn buffer, and deletes
+ // the outgoing buffer
+
+ Buffer* inbuffer = new Buffer(dataIn->getLength(), dataIn->getData());
+
+ firwd.input_queue.push(inbuffer);
+
+ if (number_of_runs > 2) {
+ Buffer* outbuffer;
+ firwd.output_queue.wait_and_pop(outbuffer);
+
+ dataOut->setData(outbuffer->getData(), outbuffer->getLength());
+
+ delete outbuffer;
+ }
+ else {
+ dataOut->setLength(dataIn->getLength());
+ memset(dataOut->getData(), 0, dataOut->getLength());
+ number_of_runs++;
+ }
+
+ return dataOut->getLength();
+
+}
diff --git a/src/FIRFilter.h b/src/FIRFilter.h
new file mode 100644
index 0000000..397301d
--- /dev/null
+++ b/src/FIRFilter.h
@@ -0,0 +1,157 @@
+/*
+ Copyright (C) 2007, 2008, 2009, 2010, 2011 Her Majesty the Queen in
+ Right of Canada (Communications Research Center Canada)
+
+ Written by
+ 2012, Matthias P. Braendli, matthias.braendli@mpb.li
+ */
+/*
+ This file is part of CRC-DADMOD.
+
+ CRC-DADMOD 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 of the
+ License, or (at your option) any later version.
+
+ CRC-DADMOD 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 CRC-DADMOD. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef FIRFILTER_H
+#define FIRFILTER_H
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <boost/thread.hpp>
+#include <queue>
+
+#include "ModCodec.h"
+
+#include <sys/types.h>
+#include <complex>
+
+#include <time.h>
+#include <cstdio>
+
+//#define MDEBUG(fmt, args...) fprintf (stderr, fmt , ## args)
+#define MDEBUG(fmt, args...)
+
+typedef std::complex<float> complexf;
+
+template<typename T>
+class ThreadsafeQueue
+{
+private:
+ std::queue<T> the_queue;
+ mutable boost::mutex the_mutex;
+ boost::condition_variable the_condition_variable;
+public:
+ void push(T const& val)
+ {
+ boost::mutex::scoped_lock lock(the_mutex);
+ the_queue.push(val);
+ lock.unlock();
+ the_condition_variable.notify_one();
+ }
+
+ bool empty() const
+ {
+ boost::mutex::scoped_lock lock(the_mutex);
+ return the_queue.empty();
+ }
+
+ bool try_pop(T& popped_value)
+ {
+ boost::mutex::scoped_lock lock(the_mutex);
+ if(the_queue.empty())
+ {
+ return false;
+ }
+
+ popped_value = the_queue.front();
+ the_queue.pop();
+ return true;
+ }
+
+ void wait_and_pop(T& popped_value)
+ {
+ boost::mutex::scoped_lock lock(the_mutex);
+ while(the_queue.empty())
+ {
+ the_condition_variable.wait(lock);
+ }
+
+ popped_value = the_queue.front();
+ the_queue.pop();
+ }
+};
+
+struct FIRFilterWorkerData {
+ ThreadsafeQueue<Buffer*> input_queue;
+ ThreadsafeQueue<Buffer*> output_queue;
+ float* taps;
+ int n_taps;
+};
+
+class FIRFilterWorker {
+ public:
+ FIRFilterWorker () {
+ running = false;
+ calculationTime = 0;
+ }
+
+ ~FIRFilterWorker() {
+ MDEBUG("~FIRFilterWorker: Total elapsed thread time filtering: %zu\n", calculationTime);
+ }
+
+ void start(struct FIRFilterWorkerData *firworkerdata) {
+ running = true;
+ fir_thread = boost::thread(&FIRFilterWorker::process, this, firworkerdata);
+ }
+
+ void stop() {
+ running = false;
+ fir_thread.interrupt();
+ fir_thread.join();
+ }
+
+ void process(struct FIRFilterWorkerData *fwd);
+
+
+ private:
+ time_t calculationTime;
+ struct FIRFilterWorkerData *workerdata;
+ bool running;
+ boost::thread fir_thread;
+};
+
+
+class FIRFilter : public ModCodec
+{
+public:
+ FIRFilter(char* taps_file);
+ virtual ~FIRFilter();
+ FIRFilter(const FIRFilter&);
+ FIRFilter& operator=(const FIRFilter&);
+
+ int process(Buffer* const dataIn, Buffer* dataOut);
+ const char* name() { return "FIRFilter"; }
+
+protected:
+ int my_Ntaps;
+ float* myFilter;
+
+ FIRFilterWorker worker;
+ int number_of_runs;
+ struct FIRFilterWorkerData firwd;
+};
+
+
+#endif //FIRFILTER_H
diff --git a/src/Makefile.am b/src/Makefile.am
index a46bec5..c82842c 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -47,6 +47,7 @@ crc_dabmod_SOURCES = DabMod.cpp \
EtiReader.cpp EtiReader.h \
Eti.cpp Eti.h \
FicSource.cpp FicSource.h \
+ FIRFilter.cpp FIRFilter.h \
ModInput.cpp ModInput.h \
PuncturingRule.cpp PuncturingRule.h \
PuncturingEncoder.cpp PuncturingEncoder.h \
@@ -54,6 +55,8 @@ crc_dabmod_SOURCES = DabMod.cpp \
Flowgraph.cpp Flowgraph.h \
GainControl.cpp GainControl.h \
OutputMemory.cpp OutputMemory.h \
+ TimestampDecoder.h TimestampDecoder.cpp \
+ OutputUHD.cpp OutputUHD.h \
ModOutput.cpp ModOutput.h \
InputMemory.cpp InputMemory.h \
OutputFile.cpp OutputFile.h \
diff --git a/src/Makefile.in b/src/Makefile.in
index 5a95e45..6620494 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -73,14 +73,16 @@ am_crc_dabmod_OBJECTS = crc_dabmod-DabMod.$(OBJEXT) \
crc_dabmod-Buffer.$(OBJEXT) crc_dabmod-ModCodec.$(OBJEXT) \
crc_dabmod-ModPlugin.$(OBJEXT) crc_dabmod-ModFormat.$(OBJEXT) \
crc_dabmod-EtiReader.$(OBJEXT) crc_dabmod-Eti.$(OBJEXT) \
- crc_dabmod-FicSource.$(OBJEXT) crc_dabmod-ModInput.$(OBJEXT) \
+ crc_dabmod-FicSource.$(OBJEXT) crc_dabmod-FIRFilter.$(OBJEXT) \
+ crc_dabmod-ModInput.$(OBJEXT) \
crc_dabmod-PuncturingRule.$(OBJEXT) \
crc_dabmod-PuncturingEncoder.$(OBJEXT) \
crc_dabmod-SubchannelSource.$(OBJEXT) \
crc_dabmod-Flowgraph.$(OBJEXT) \
crc_dabmod-GainControl.$(OBJEXT) \
crc_dabmod-OutputMemory.$(OBJEXT) \
- crc_dabmod-ModOutput.$(OBJEXT) \
+ crc_dabmod-TimestampDecoder.$(OBJEXT) \
+ crc_dabmod-OutputUHD.$(OBJEXT) crc_dabmod-ModOutput.$(OBJEXT) \
crc_dabmod-InputMemory.$(OBJEXT) \
crc_dabmod-OutputFile.$(OBJEXT) \
crc_dabmod-FrameMultiplexer.$(OBJEXT) \
@@ -263,6 +265,7 @@ crc_dabmod_SOURCES = DabMod.cpp \
EtiReader.cpp EtiReader.h \
Eti.cpp Eti.h \
FicSource.cpp FicSource.h \
+ FIRFilter.cpp FIRFilter.h \
ModInput.cpp ModInput.h \
PuncturingRule.cpp PuncturingRule.h \
PuncturingEncoder.cpp PuncturingEncoder.h \
@@ -270,6 +273,8 @@ crc_dabmod_SOURCES = DabMod.cpp \
Flowgraph.cpp Flowgraph.h \
GainControl.cpp GainControl.h \
OutputMemory.cpp OutputMemory.h \
+ TimestampDecoder.h TimestampDecoder.cpp \
+ OutputUHD.cpp OutputUHD.h \
ModOutput.cpp ModOutput.h \
InputMemory.cpp InputMemory.h \
OutputFile.cpp OutputFile.h \
@@ -417,6 +422,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/crc_dabmod-DifferentialModulator.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/crc_dabmod-Eti.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/crc_dabmod-EtiReader.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/crc_dabmod-FIRFilter.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/crc_dabmod-FicSource.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/crc_dabmod-Flowgraph.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/crc_dabmod-FrameMultiplexer.Po@am__quote@
@@ -434,6 +440,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/crc_dabmod-OfdmGenerator.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/crc_dabmod-OutputFile.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/crc_dabmod-OutputMemory.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/crc_dabmod-OutputUHD.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/crc_dabmod-PhaseReference.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/crc_dabmod-PrbsGenerator.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/crc_dabmod-PuncturingEncoder.Po@am__quote@
@@ -443,6 +450,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/crc_dabmod-SignalMultiplexer.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/crc_dabmod-SubchannelSource.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/crc_dabmod-TimeInterleaver.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/crc_dabmod-TimestampDecoder.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/crc_dabmod-kiss_fft.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/crc_dabmod-kiss_fftr.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/crc_dabmod-kiss_fftsimd.Po@am__quote@
@@ -658,6 +666,20 @@ crc_dabmod-FicSource.obj: FicSource.cpp
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(crc_dabmod_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o crc_dabmod-FicSource.obj `if test -f 'FicSource.cpp'; then $(CYGPATH_W) 'FicSource.cpp'; else $(CYGPATH_W) '$(srcdir)/FicSource.cpp'; fi`
+crc_dabmod-FIRFilter.o: FIRFilter.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(crc_dabmod_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT crc_dabmod-FIRFilter.o -MD -MP -MF $(DEPDIR)/crc_dabmod-FIRFilter.Tpo -c -o crc_dabmod-FIRFilter.o `test -f 'FIRFilter.cpp' || echo '$(srcdir)/'`FIRFilter.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/crc_dabmod-FIRFilter.Tpo $(DEPDIR)/crc_dabmod-FIRFilter.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='FIRFilter.cpp' object='crc_dabmod-FIRFilter.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(crc_dabmod_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o crc_dabmod-FIRFilter.o `test -f 'FIRFilter.cpp' || echo '$(srcdir)/'`FIRFilter.cpp
+
+crc_dabmod-FIRFilter.obj: FIRFilter.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(crc_dabmod_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT crc_dabmod-FIRFilter.obj -MD -MP -MF $(DEPDIR)/crc_dabmod-FIRFilter.Tpo -c -o crc_dabmod-FIRFilter.obj `if test -f 'FIRFilter.cpp'; then $(CYGPATH_W) 'FIRFilter.cpp'; else $(CYGPATH_W) '$(srcdir)/FIRFilter.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/crc_dabmod-FIRFilter.Tpo $(DEPDIR)/crc_dabmod-FIRFilter.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='FIRFilter.cpp' object='crc_dabmod-FIRFilter.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(crc_dabmod_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o crc_dabmod-FIRFilter.obj `if test -f 'FIRFilter.cpp'; then $(CYGPATH_W) 'FIRFilter.cpp'; else $(CYGPATH_W) '$(srcdir)/FIRFilter.cpp'; fi`
+
crc_dabmod-ModInput.o: ModInput.cpp
@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(crc_dabmod_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT crc_dabmod-ModInput.o -MD -MP -MF $(DEPDIR)/crc_dabmod-ModInput.Tpo -c -o crc_dabmod-ModInput.o `test -f 'ModInput.cpp' || echo '$(srcdir)/'`ModInput.cpp
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/crc_dabmod-ModInput.Tpo $(DEPDIR)/crc_dabmod-ModInput.Po
@@ -756,6 +778,34 @@ crc_dabmod-OutputMemory.obj: OutputMemory.cpp
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(crc_dabmod_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o crc_dabmod-OutputMemory.obj `if test -f 'OutputMemory.cpp'; then $(CYGPATH_W) 'OutputMemory.cpp'; else $(CYGPATH_W) '$(srcdir)/OutputMemory.cpp'; fi`
+crc_dabmod-TimestampDecoder.o: TimestampDecoder.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(crc_dabmod_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT crc_dabmod-TimestampDecoder.o -MD -MP -MF $(DEPDIR)/crc_dabmod-TimestampDecoder.Tpo -c -o crc_dabmod-TimestampDecoder.o `test -f 'TimestampDecoder.cpp' || echo '$(srcdir)/'`TimestampDecoder.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/crc_dabmod-TimestampDecoder.Tpo $(DEPDIR)/crc_dabmod-TimestampDecoder.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='TimestampDecoder.cpp' object='crc_dabmod-TimestampDecoder.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(crc_dabmod_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o crc_dabmod-TimestampDecoder.o `test -f 'TimestampDecoder.cpp' || echo '$(srcdir)/'`TimestampDecoder.cpp
+
+crc_dabmod-TimestampDecoder.obj: TimestampDecoder.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(crc_dabmod_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT crc_dabmod-TimestampDecoder.obj -MD -MP -MF $(DEPDIR)/crc_dabmod-TimestampDecoder.Tpo -c -o crc_dabmod-TimestampDecoder.obj `if test -f 'TimestampDecoder.cpp'; then $(CYGPATH_W) 'TimestampDecoder.cpp'; else $(CYGPATH_W) '$(srcdir)/TimestampDecoder.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/crc_dabmod-TimestampDecoder.Tpo $(DEPDIR)/crc_dabmod-TimestampDecoder.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='TimestampDecoder.cpp' object='crc_dabmod-TimestampDecoder.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(crc_dabmod_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o crc_dabmod-TimestampDecoder.obj `if test -f 'TimestampDecoder.cpp'; then $(CYGPATH_W) 'TimestampDecoder.cpp'; else $(CYGPATH_W) '$(srcdir)/TimestampDecoder.cpp'; fi`
+
+crc_dabmod-OutputUHD.o: OutputUHD.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(crc_dabmod_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT crc_dabmod-OutputUHD.o -MD -MP -MF $(DEPDIR)/crc_dabmod-OutputUHD.Tpo -c -o crc_dabmod-OutputUHD.o `test -f 'OutputUHD.cpp' || echo '$(srcdir)/'`OutputUHD.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/crc_dabmod-OutputUHD.Tpo $(DEPDIR)/crc_dabmod-OutputUHD.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='OutputUHD.cpp' object='crc_dabmod-OutputUHD.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(crc_dabmod_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o crc_dabmod-OutputUHD.o `test -f 'OutputUHD.cpp' || echo '$(srcdir)/'`OutputUHD.cpp
+
+crc_dabmod-OutputUHD.obj: OutputUHD.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(crc_dabmod_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT crc_dabmod-OutputUHD.obj -MD -MP -MF $(DEPDIR)/crc_dabmod-OutputUHD.Tpo -c -o crc_dabmod-OutputUHD.obj `if test -f 'OutputUHD.cpp'; then $(CYGPATH_W) 'OutputUHD.cpp'; else $(CYGPATH_W) '$(srcdir)/OutputUHD.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/crc_dabmod-OutputUHD.Tpo $(DEPDIR)/crc_dabmod-OutputUHD.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='OutputUHD.cpp' object='crc_dabmod-OutputUHD.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(crc_dabmod_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o crc_dabmod-OutputUHD.obj `if test -f 'OutputUHD.cpp'; then $(CYGPATH_W) 'OutputUHD.cpp'; else $(CYGPATH_W) '$(srcdir)/OutputUHD.cpp'; fi`
+
crc_dabmod-ModOutput.o: ModOutput.cpp
@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(crc_dabmod_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT crc_dabmod-ModOutput.o -MD -MP -MF $(DEPDIR)/crc_dabmod-ModOutput.Tpo -c -o crc_dabmod-ModOutput.o `test -f 'ModOutput.cpp' || echo '$(srcdir)/'`ModOutput.cpp
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/crc_dabmod-ModOutput.Tpo $(DEPDIR)/crc_dabmod-ModOutput.Po
diff --git a/src/OutputUHD.cpp b/src/OutputUHD.cpp
new file mode 100644
index 0000000..9e14a4f
--- /dev/null
+++ b/src/OutputUHD.cpp
@@ -0,0 +1,466 @@
+/*
+ Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Her Majesty the
+ Queen in Right of Canada (Communications Research Center Canada)
+
+ Includes modifications for which no copyright is claimed
+ 2012, Matthias P. Braendli, matthias.braendli@mpb.li
+ */
+/*
+ This file is part of CRC-DADMOD.
+
+ CRC-DADMOD 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 of the
+ License, or (at your option) any later version.
+
+ CRC-DADMOD 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 CRC-DADMOD. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define ENABLE_UHD 1
+
+#include "OutputUHD.h"
+#include "PcDebug.h"
+
+#include <iostream>
+#include <assert.h>
+#include <stdexcept>
+#include <stdio.h>
+#include <time.h>
+#include <errno.h>
+#include <unistd.h>
+
+typedef std::complex<float> complexf;
+
+OutputUHD::OutputUHD(char* device, unsigned sampleRate,
+ double frequency, int txgain, bool muteNoTimestamps) :
+ ModOutput(ModFormat(1), ModFormat(0)),
+ mySampleRate(sampleRate), myTxGain(txgain),
+ myFrequency(frequency), mute_no_timestamps(muteNoTimestamps)
+{
+ MDEBUG("OutputUHD::OutputUHD(device: %s) @ %p\n",
+ device, this);
+
+ myDevice = device;
+
+#if ENABLE_UHD
+ uhd::set_thread_priority_safe();
+
+ //create a usrp device
+ MDEBUG("OutputUHD:Creating the usrp device with: %s...\n",
+ myDevice.c_str());
+ myUsrp = uhd::usrp::multi_usrp::make(myDevice);
+ MDEBUG("OutputUHD:Using device: %s...\n", myUsrp->get_pp_string().c_str());
+
+ MDEBUG("OutputUHD:Setting REFCLK and PPS input...\n");
+ uhd::clock_config_t clock_config;
+ clock_config.ref_source = uhd::clock_config_t::REF_SMA;
+ clock_config.pps_source = uhd::clock_config_t::PPS_SMA;
+ clock_config.pps_polarity = uhd::clock_config_t::PPS_POS;
+ myUsrp->set_clock_config(clock_config, uhd::usrp::multi_usrp::ALL_MBOARDS);
+
+ std::cerr << "UHD clock source is " <<
+ myUsrp->get_clock_source(0) << std::endl;
+
+ std::cerr << "UHD time source is " <<
+ myUsrp->get_time_source(0) << std::endl;
+
+ //set the tx sample rate
+ MDEBUG("OutputUHD:Setting rate to %d...\n", mySampleRate);
+ myUsrp->set_tx_rate(mySampleRate);
+ MDEBUG("OutputUHD:Actual TX Rate: %f Msps...\n", myUsrp->get_tx_rate());
+
+ //set the centre frequency
+ MDEBUG("OutputUHD:Setting freq to %f...\n", myFrequency);
+ myUsrp->set_tx_freq(myFrequency);
+ MDEBUG("OutputUHD:Actual frequency: %f\n", myUsrp->get_tx_freq());
+
+ myUsrp->set_tx_gain(myTxGain);
+ MDEBUG("OutputUHD:Actual TX Gain: %f ...\n", myUsrp->get_tx_gain());
+
+
+ /* handling time for synchronisation: wait until the next full
+ * second, and set the USRP time at next PPS */
+ struct timespec now;
+ time_t seconds;
+ if (clock_gettime(CLOCK_REALTIME, &now)) {
+ fprintf(stderr, "errno: %d\n", errno);
+ perror("OutputUHD:Error: could not get time: ");
+ }
+ else {
+ seconds = now.tv_sec;
+
+ MDEBUG("OutputUHD:sec+1: %ld ; now: %ld ...\n", seconds+1, now.tv_sec);
+ while (seconds + 1 > now.tv_sec) {
+ usleep(1);
+ if (clock_gettime(CLOCK_REALTIME, &now)) {
+ fprintf(stderr, "errno: %d\n", errno);
+ perror("OutputUHD:Error: could not get time: ");
+ break;
+ }
+ }
+ MDEBUG("OutputUHD:sec+1: %ld ; now: %ld ...\n", seconds+1, now.tv_sec);
+ /* We are now shortly after the second change. */
+
+#warning "TODO usleep for USRP time setting !"
+ //usleep(200000); // 200ms, we want the PPS to be later
+ myUsrp->set_time_unknown_pps(uhd::time_spec_t(seconds + 2));
+ fprintf(stderr, "OutputUHD: Setting USRP time next pps to %f\n",
+ uhd::time_spec_t(seconds + 2).get_real_secs());
+ }
+
+ usleep(1e6);
+ fprintf(stderr, "OutputUHD: USRP time %f\n",
+ myUsrp->get_time_now().get_real_secs());
+
+
+ // preparing output thread worker data
+ uwd.myUsrp = myUsrp;
+#else
+ fprintf(stderr, "OutputUHD: UHD initialisation disabled at compile-time\n");
+#endif
+
+ uwd.frame0.ts.timestamp_valid = false;
+ uwd.frame1.ts.timestamp_valid = false;
+ uwd.sampleRate = mySampleRate;
+ uwd.sourceContainsTimestamp = false;
+ uwd.muteNoTimestamps = mute_no_timestamps;
+
+ // Since we don't know the buffer size, we cannot initialise
+ // the buffers here
+ first_run = true;
+
+ shared_ptr<barrier> b(new barrier(2));
+ my_sync_barrier = b;
+ uwd.sync_barrier = b;
+
+ worker.start(&uwd);
+
+ MDEBUG("OutputUHD:UHD ready.\n");
+}
+
+
+OutputUHD::~OutputUHD()
+{
+ MDEBUG("OutputUHD::~OutputUHD() @ %p\n", this);
+ worker.stop();
+}
+
+int OutputUHD::process(Buffer* dataIn, Buffer* dataOut)
+{
+ struct frame_timestamp ts;
+
+ // On the first call, we must do some allocation and we must fill
+ // the first buffer
+ // We will only wait on the barrier on the subsequent calls to
+ // OutputUHD::process
+ if (first_run) {
+ fprintf(stderr, "OutUHD.process:Initialising...\n");
+
+ uwd.bufsize = dataIn->getLength();
+ uwd.frame0.buf = malloc(uwd.bufsize);
+ uwd.frame1.buf = malloc(uwd.bufsize);
+
+ uwd.sourceContainsTimestamp = myEtiReader->sourceContainsTimestamp();
+
+ // The worker begins by transmitting buf0
+ memcpy(uwd.frame0.buf, dataIn->getData(), uwd.bufsize);
+
+ myEtiReader->calculateTimestamp(ts);
+ uwd.frame0.ts = ts;
+ uwd.frame0.fct = myEtiReader->getFCT();
+
+ activebuffer = 1;
+
+ lastLen = uwd.bufsize;
+ first_run = false;
+ fprintf(stderr, "OutUHD.process:Initialising complete.\n");
+ }
+ else {
+
+ if (lastLen != dataIn->getLength()) {
+ // I expect that this never happens.
+ fprintf(stderr,
+ "OutUHD.process:AAAAH PANIC input length changed from %zu to %zu !\n",
+ lastLen, dataIn->getLength());
+ throw std::runtime_error("Non-constant input length!");
+ }
+ //fprintf(stderr, "OutUHD.process:Waiting for barrier\n");
+ my_sync_barrier.get()->wait();
+
+ // write into the our buffer while
+ // the worker sends the other.
+
+ myEtiReader->calculateTimestamp(ts);
+ uwd.sourceContainsTimestamp = myEtiReader->sourceContainsTimestamp();
+
+ if (activebuffer == 0) {
+ 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);
+
+ uwd.frame1.ts = ts;
+ uwd.frame1.fct = myEtiReader->getFCT();
+ }
+
+ activebuffer = (activebuffer + 1) % 2;
+ }
+
+ return uwd.bufsize;
+
+}
+
+void UHDWorker::process(struct UHDWorkerData *uwd)
+{
+ int workerbuffer = 0;
+ time_t tx_second = 0;
+ double pps_offset = 0;
+ double last_pps = 2.0;
+ double usrp_time;
+
+ //const struct timespec hundred_nano = {0, 100};
+
+ size_t sizeIn;
+ struct UHDWorkerFrameData* frame;
+
+ size_t num_acc_samps; //number of accumulated samples
+ int write_fail_count;
+
+#if ENABLE_UHD
+ // Transmit timeout
+ const double timeout = 0.2;
+
+ uhd::stream_args_t stream_args("fc32"); //complex floats
+ uhd::tx_streamer::sptr myTxStream = uwd->myUsrp->get_tx_stream(stream_args);
+ size_t bufsize = myTxStream->get_max_num_samps();
+#endif
+
+ const complexf* in;
+
+ uhd::tx_metadata_t md;
+ md.start_of_burst = false;
+ md.end_of_burst = false;
+
+ while (running) {
+ md.has_time_spec = false;
+ md.time_spec = uhd::time_spec_t(0.0);
+ num_acc_samps = 0;
+ write_fail_count = 0;
+
+ /* Wait for barrier */
+ // this wait will hopefully always be the second one
+ // because modulation should be quicker than transmission
+ //fprintf(stderr, "Worker:Waiting for barrier\n");
+ uwd->sync_barrier.get()->wait();
+
+ if (workerbuffer == 0) {
+ frame = &(uwd->frame0);
+ }
+ else if (workerbuffer == 1) {
+ frame = &(uwd->frame1);
+ }
+ else {
+ fprintf(stderr, "UHDWorker.process: workerbuffer: %d\n", workerbuffer);
+ perror("UHDWorker.process: workerbuffer is neither 0 nor 1!\n");
+ }
+
+ in = reinterpret_cast<const complexf*>(frame->buf);
+ pps_offset = frame->ts.timestamp_pps_offset;
+ //
+ // Tx second from MNSC
+ tx_second = frame->ts.timestamp_sec;
+
+ sizeIn = uwd->bufsize / sizeof(complexf);
+
+#if ENABLE_UHD
+ // Check for ref_lock
+ if (! uwd->myUsrp->get_mboard_sensor("ref_locked", 0).to_bool()) {
+ fprintf(stderr, "UHDWorker: RefLock lost !\n");
+ }
+
+ usrp_time = uwd->myUsrp->get_time_now().get_real_secs();
+#else
+ usrp_time = 0;
+#endif
+
+ if (uwd->sourceContainsTimestamp) {
+ if (!frame->ts.timestamp_valid) {
+ /* We have not received a full timestamp through
+ * MNSC. We sleep through the frame.
+ */
+ fprintf(stderr, "UHDOut: Throwing sample %d away: incomplete timestamp %zu + %f\n",
+ frame->fct, tx_second, pps_offset);
+ usleep(20000);
+ goto loopend;
+ }
+
+ md.has_time_spec = true;
+ md.time_spec = uhd::time_spec_t(tx_second, pps_offset);
+
+ // md is defined, let's do some checks
+ if (md.time_spec.get_real_secs() + 0.2 < usrp_time) {
+ fprintf(stderr,
+ "* Timestamp in the past! offset: %f"
+ " (%f) frame %d tx_second %zu; pps %f\n",
+ md.time_spec.get_real_secs() - usrp_time,
+ usrp_time, frame->fct, tx_second, pps_offset);
+ goto loopend; //skip the frame
+ }
+
+#if ENABLE_UHD
+ if (md.time_spec.get_real_secs() > usrp_time + TIMESTAMP_MARGIN_FUTURE) {
+ fprintf(stderr,
+ "* Timestamp too far in the future! offset: %f\n",
+ md.time_spec.get_real_secs() - usrp_time);
+ usleep(20000); //sleep so as to fill buffers
+ }
+
+ if (md.time_spec.get_real_secs() > usrp_time + TIMESTAMP_ABORT_FUTURE) {
+ fprintf(stderr,
+ "* Timestamp way too far in the future! offset: %f\n",
+ md.time_spec.get_real_secs() - usrp_time);
+ fprintf(stderr, "* Aborting\n");
+ throw std::runtime_error("Timestamp error. Aborted.");
+ }
+#endif
+
+ if (frame->fct % 50 < 4) {
+ fprintf(stderr, "UHDOut (%f): frame %d tx_second %zu; pps %.9f\n",
+ usrp_time,
+ frame->fct, tx_second, pps_offset);
+ }
+
+ }
+ else { // !uwd->sourceContainsTimestamp
+ if (uwd->muteNoTimestamps) {
+ /* There was some error decoding the timestamp
+ */
+ fprintf(stderr, "UHDOut: Muting sample %d : no timestamp\n",
+ frame->fct);
+ usleep(20000);
+ goto loopend;
+ }
+ }
+
+#if ENABLE_UHD
+ PDEBUG("UHDWorker::process:max_num_samps: %zu.\n",
+ myTxStream->get_max_num_samps());
+
+ /*
+ size_t num_tx_samps = myTxStream->send(
+ dataIn, sizeIn, md, timeout);
+
+ MDEBUG("UHDWorker::process:num_tx_samps: %zu.\n", num_tx_samps);
+ */
+ while (running && (num_acc_samps < sizeIn)) {
+ size_t samps_to_send = std::min(sizeIn - num_acc_samps, bufsize);
+
+ //ensure the the last packet has EOB set if the timestamps has been refreshed
+ //and needs to be reconsidered.
+ md.end_of_burst = (frame->ts.timestamp_refresh && (samps_to_send <= bufsize));
+
+ //send a single packet
+ size_t num_tx_samps = myTxStream->send(
+ &in[num_acc_samps],
+ samps_to_send, md, timeout);
+
+ num_acc_samps += num_tx_samps;
+
+ md.time_spec = uhd::time_spec_t(tx_second, pps_offset)
+ + uhd::time_spec_t(0, num_acc_samps/uwd->sampleRate);
+
+ /*
+ fprintf(stderr, "*** pps_offset %f, md.time_spec %f, usrp->now %f\n",
+ pps_offset,
+ md.time_spec.get_real_secs(),
+ uwd->myUsrp->get_time_now().get_real_secs());
+ // */
+
+
+ if (num_tx_samps == 0) {
+#if 1
+ fprintf(stderr,
+ "UHDWorker::process() unable to write to device, skipping frame!\n");
+ break;
+#else
+ // This has been disabled, because if there is a write failure,
+ // we'd better not insist and try to go on transmitting future
+ // frames.
+ // The goal is not to try to send by all means possible. It's
+ // more important to make sure the SFN is not disturbed.
+
+ fprintf(stderr, "F");
+ nanosleep(&hundred_nano, NULL);
+ write_fail_count++;
+ if (write_fail_count >= 3) {
+ double ts = md.time_spec.get_real_secs();
+ double t_usrp = uwd->myUsrp->get_time_now().get_real_secs();
+
+ fprintf(stderr, "*** USRP write fail count %d\n", write_fail_count);
+ fprintf(stderr, "*** delta %f, md.time_spec %f, usrp->now %f\n",
+ ts - t_usrp,
+ ts, t_usrp);
+
+ fprintf(stderr, "UHDWorker::process() unable to write to device, skipping frame!\n");
+ break;
+ }
+#endif
+ }
+
+ //std::cerr << std::endl << "Waiting for async burst ACK... " << std::flush;
+ uhd::async_metadata_t async_md;
+ if (uwd->myUsrp->get_device()->recv_async_msg(async_md, 0)) {
+ std::string PREFIX = "### asyncronous UHD message : ";
+ switch (async_md.event_code) {
+ case uhd::async_metadata_t::EVENT_CODE_BURST_ACK:
+ break;
+ case uhd::async_metadata_t::EVENT_CODE_UNDERFLOW:
+ std::cerr << PREFIX << "Underflow" << std::endl;
+ break;
+ case uhd::async_metadata_t::EVENT_CODE_SEQ_ERROR:
+ std::cerr << PREFIX << "Packet loss between host and device." << std::endl;
+ break;
+ case uhd::async_metadata_t::EVENT_CODE_TIME_ERROR:
+ std::cerr << PREFIX << "Packet had time that was late." << std::endl;
+ break;
+ case uhd::async_metadata_t::EVENT_CODE_UNDERFLOW_IN_PACKET:
+ std::cerr << PREFIX << "Underflow occurred inside a packet." << std::endl;
+ break;
+ case uhd::async_metadata_t::EVENT_CODE_SEQ_ERROR_IN_BURST:
+ std::cerr << PREFIX << "Packet loss within a burst." << std::endl;
+ break;
+ default:
+ std::cerr << PREFIX << "unknown event code" << std::endl;
+ break;
+ }
+ }
+
+ /*
+ bool got_async_burst_ack = false;
+ //loop through all messages for the ACK packet (may have underflow messages in queue)
+ while (not got_async_burst_ack and uwd->myUsrp->get_device()->recv_async_msg(async_md, 0.2)){
+ got_async_burst_ack = (async_md.event_code == uhd::async_metadata_t::EVENT_CODE_BURST_ACK);
+ }
+ //std::cerr << (got_async_burst_ack? "success" : "fail") << std::endl;
+ // */
+
+
+ }
+#endif
+
+ last_pps = pps_offset;
+
+loopend:
+ // swap buffers
+ workerbuffer = (workerbuffer + 1) % 2;
+ }
+}
diff --git a/src/OutputUHD.h b/src/OutputUHD.h
new file mode 100644
index 0000000..eea594f
--- /dev/null
+++ b/src/OutputUHD.h
@@ -0,0 +1,167 @@
+/*
+ Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Her Majesty the
+ Queen in Right of Canada (Communications Research Center Canada)
+
+ Includes modifications for which no copyright is claimed
+ 2012, Matthias P. Braendli, matthias.braendli@mpb.li
+
+DESCRIPTION:
+ It is an output driver for the USRP family of devices, and uses
+ the UHD library. This version is multi-threaded. One thread runs
+ the whole modulator, and the second threads sends the data to the
+ device. The two threads are synchronised using a barrier. Communication
+ between the two threads is implemented using double buffering. At the
+ barrier, they exchange the buffers.
+*/
+
+/*
+ This file is part of CRC-DADMOD.
+
+ CRC-DADMOD 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 of the
+ License, or (at your option) any later version.
+
+ CRC-DADMOD 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 CRC-DADMOD. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef OUTPUT_UHD_H
+#define OUTPUT_UHD_H
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <uhd/utils/thread_priority.hpp>
+#include <uhd/utils/safe_main.hpp>
+#include <uhd/usrp/multi_usrp.hpp>
+#include <boost/thread/thread.hpp>
+#include <boost/thread/barrier.hpp>
+#include <boost/shared_ptr.hpp>
+
+#include "ModOutput.h"
+#include "EtiReader.h"
+#include "TimestampDecoder.h"
+
+#include <stdio.h>
+#include <sys/types.h>
+
+#define MDEBUG(fmt, args...) fprintf (LOG, fmt , ## args)
+//#define MDEBUG(fmt, args...)
+
+// If the timestamp is further in the future than
+// 100 seconds, abort
+#define TIMESTAMP_ABORT_FUTURE 100
+
+// Add a delay to increase buffers when
+// frames are too far in the future
+#define TIMESTAMP_MARGIN_FUTURE 0.5
+
+typedef std::complex<float> complexf;
+
+using namespace boost;
+
+struct UHDWorkerFrameData {
+ // Buffer holding frame data
+ void* buf;
+
+ // Full timestamp
+ struct frame_timestamp ts;
+
+ // Frame counter
+ uint32_t fct;
+};
+
+
+struct UHDWorkerData {
+ uhd::usrp::multi_usrp::sptr myUsrp;
+ unsigned sampleRate;
+
+ // Double buffering between the two threads
+ // Each buffer contains one OFDM frame, and it's
+ // associated timestamp
+ // A full timestamp contains a TIST according to standard
+ // and time information within MNSC with tx_second.
+ bool sourceContainsTimestamp;
+
+ // When working with timestamps, mute the frames that
+ // do not have a timestamp
+ bool muteNoTimestamps;
+
+ struct UHDWorkerFrameData frame0;
+ struct UHDWorkerFrameData frame1;
+ size_t bufsize; // in bytes
+
+ // A barrier to synchronise the two threads
+ shared_ptr<barrier> sync_barrier;
+};
+
+
+class UHDWorker {
+ public:
+ UHDWorker () {
+ running = false;
+ }
+
+ void start(struct UHDWorkerData *uhdworkerdata) {
+ running = true;
+ uhd_thread = boost::thread(&UHDWorker::process, this, uhdworkerdata);
+ }
+
+ void stop() {
+ running = false;
+ uhd_thread.interrupt();
+ uhd_thread.join();
+ }
+
+ void process(struct UHDWorkerData *uhdworkerdata);
+
+
+ private:
+ struct UHDWorkerData *workerdata;
+ bool running;
+ boost::thread uhd_thread;
+
+ uhd::tx_streamer::sptr myTxStream;
+};
+
+
+class OutputUHD: public ModOutput {
+ public:
+ OutputUHD(char* device, unsigned sampleRate, double frequency, int txgain,
+ bool muteNoTimestamps);
+ ~OutputUHD();
+
+ int process(Buffer* dataIn, Buffer* dataOut);
+
+ const char* name() { return "OutputUHD"; }
+
+ void setETIReader(EtiReader *etiReader) {
+ myEtiReader = etiReader;
+ }
+
+ protected:
+ EtiReader *myEtiReader;
+ std::string myDevice;
+ unsigned mySampleRate;
+ int myTxGain;
+ double myFrequency;
+ uhd::usrp::multi_usrp::sptr myUsrp;
+ shared_ptr<barrier> my_sync_barrier;
+ UHDWorker worker;
+ bool first_run;
+ struct UHDWorkerData uwd;
+ int activebuffer;
+ bool mute_no_timestamps;
+
+ size_t lastLen;
+};
+
+
+#endif // OUTPUT_UHD_H
diff --git a/src/PcDebug.h b/src/PcDebug.h
index 6c6d30c..e4bfba3 100644
--- a/src/PcDebug.h
+++ b/src/PcDebug.h
@@ -74,4 +74,8 @@
# endif
#endif
+void mpbdebugopen();
+void mpbdebug(const char* message, int val);
+
+
#endif // PC_DEBUG_H
diff --git a/src/TimestampDecoder.cpp b/src/TimestampDecoder.cpp
new file mode 100644
index 0000000..3dd64bf
--- /dev/null
+++ b/src/TimestampDecoder.cpp
@@ -0,0 +1,210 @@
+/*
+ Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Her Majesty the
+ Queen in Right of Canada (Communications Research Center Canada)
+
+ Includes modifications for which no copyright is claimed
+ 2012, Matthias P. Braendli, matthias.braendli@mpb.li
+ */
+/*
+ This file is part of CRC-DADMOD.
+
+ CRC-DADMOD 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 of the
+ License, or (at your option) any later version.
+
+ CRC-DADMOD 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 CRC-DADMOD. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "TimestampDecoder.h"
+#include "Eti.h"
+#include <sys/types.h>
+#include "PcDebug.h"
+#include <iostream>
+#include <fstream>
+#include <string>
+#include <boost/lexical_cast.hpp>
+
+//#define MDEBUG(fmt, args...) fprintf (LOG, fmt , ## args)
+#define MDEBUG(fmt, args...) PDEBUG(fmt, ## args)
+
+
+void TimestampDecoder::calculateTimestamp(struct frame_timestamp& ts)
+{
+ ts.timestamp_valid = full_timestamp_received_mnsc;
+ ts.timestamp_sec = time_secs;
+ ts.timestamp_pps_offset = time_pps;
+
+ ts.timestamp_refresh = offset_changed;
+ offset_changed = false;
+
+ ts += timestamp_offset;
+ //ts.print("calc2 ");
+}
+
+void TimestampDecoder::pushMNSCData(int framephase, uint16_t mnsc)
+{
+ struct eti_MNSC_TIME_0 *mnsc0;
+ struct eti_MNSC_TIME_1 *mnsc1;
+ struct eti_MNSC_TIME_2 *mnsc2;
+ struct eti_MNSC_TIME_3 *mnsc3;
+
+ switch (framephase)
+ {
+ case 0:
+ mnsc0 = (struct eti_MNSC_TIME_0*)&mnsc;
+ enableDecode = (mnsc0->type == 0) &&
+ (mnsc0->identifier == 0);
+ gmtime_r(0, &temp_time);
+ break;
+
+ case 1:
+ mnsc1 = (struct eti_MNSC_TIME_1*)&mnsc;
+ temp_time.tm_sec = mnsc1->second_tens * 10 + mnsc1->second_unit;
+ temp_time.tm_min = mnsc1->minute_tens * 10 + mnsc1->minute_unit;
+
+ if (!mnsc1->sync_to_frame)
+ {
+ enableDecode = false;
+ PDEBUG("TimestampDecoder: MNSC time info is not synchronised to frame\n");
+ }
+
+ break;
+
+ case 2:
+ mnsc2 = (struct eti_MNSC_TIME_2*)&mnsc;
+ temp_time.tm_hour = mnsc2->hour_tens * 10 + mnsc2->hour_unit;
+ temp_time.tm_mday = mnsc2->day_tens * 10 + mnsc2->day_unit;
+ break;
+
+ case 3:
+ mnsc3 = (struct eti_MNSC_TIME_3*)&mnsc;
+ temp_time.tm_mon = (mnsc3->month_tens * 10 + mnsc3->month_unit) - 1;
+ temp_time.tm_year = (mnsc3->year_tens * 10 + mnsc3->year_unit) + 100;
+
+ if (enableDecode)
+ {
+ full_timestamp_received_mnsc = true;
+ updateTimestampSeconds(mktime(&temp_time));
+ }
+ break;
+ }
+
+ MDEBUG("TimestampDecoder::pushMNSCData(%d, 0x%x)\n", framephase, mnsc);
+ MDEBUG(" -> %s\n", asctime(&temp_time));
+ MDEBUG(" -> %zu\n", mktime(&temp_time));
+}
+
+void TimestampDecoder::updateTimestampSeconds(uint32_t secs)
+{
+ MDEBUG("TimestampDecoder::updateTimestampSeconds(%d)\n", secs);
+ if (inhibit_second_update > 0)
+ {
+ inhibit_second_update--;
+ }
+ else
+ {
+ time_secs = secs;
+ }
+}
+
+void TimestampDecoder::updateTimestampPPS(double pps)
+{
+ MDEBUG("TimestampDecoder::updateTimestampPPS(%f)\n", pps);
+
+ if (time_pps > pps) // Second boundary crossed
+ {
+ MDEBUG("TimestampDecoder::updateTimestampPPS crossed second\n", pps);
+
+ // The second for the next eight frames will not
+ // be defined by the MNSC
+ inhibit_second_update = 2;
+ time_secs += 1;
+ }
+
+ time_pps = pps;
+
+}
+
+void TimestampDecoder::updateTimestampEti(int framephase, uint16_t mnsc, double pps)
+{
+ updateTimestampPPS(pps);
+ pushMNSCData(framephase, mnsc);
+}
+
+
+bool TimestampDecoder::updateModulatorOffset()
+{
+ using namespace std;
+ using boost::lexical_cast;
+ using boost::bad_lexical_cast;
+
+ if (modconfig.use_offset_fixed)
+ {
+ timestamp_offset = modconfig.offset_fixed;
+ PDEBUG("Setting timestamp offset to %f\n", timestamp_offset);
+ return true;
+ }
+ else if (modconfig.use_offset_file)
+ {
+ bool r = false;
+ double newoffset;
+
+ std::string filedata;
+ ifstream filestream;
+
+ try
+ {
+ filestream.open(modconfig.offset_filename);
+ if (!filestream.eof())
+ {
+ getline(filestream, filedata);
+ try
+ {
+ newoffset = lexical_cast<double>(filedata);
+ r = true;
+ }
+ catch (bad_lexical_cast& e)
+ {
+ fprintf(stderr, "Error parsing timestamp offset from file\n");
+ r = false;
+ }
+ }
+ else
+ {
+ fprintf(stderr, "Error reading from timestamp offset file: eof reached\n");
+ r = false;
+ }
+ filestream.close();
+ }
+ catch (exception& e)
+ {
+ fprintf(stderr, "Error opening timestamp offset file\n");
+ r = false;
+ }
+
+
+ if (r)
+ {
+ if (timestamp_offset != newoffset)
+ {
+ timestamp_offset = newoffset;
+ fprintf(stderr, "TimestampDecoder::updateTimestampOffset:" \
+ "new offset is %f\n", timestamp_offset);
+ offset_changed = true;
+ }
+
+ }
+
+ return r;
+ }
+ else {
+ return false;
+ }
+}
diff --git a/src/TimestampDecoder.h b/src/TimestampDecoder.h
new file mode 100644
index 0000000..3a1fb1b
--- /dev/null
+++ b/src/TimestampDecoder.h
@@ -0,0 +1,154 @@
+/*
+ Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Her Majesty the
+ Queen in Right of Canada (Communications Research Center Canada)
+
+ Includes modifications for which no copyright is claimed
+ 2012, Matthias P. Braendli, matthias.braendli@mpb.li
+ */
+/*
+ This file is part of CRC-DADMOD.
+
+ CRC-DADMOD 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 of the
+ License, or (at your option) any later version.
+
+ CRC-DADMOD 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 CRC-DADMOD. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef TIMESTAMP_DECODER_H
+#define TIMESTAMP_DECODER_H
+
+#include "Eti.h"
+#include <time.h>
+#include <math.h>
+#include <stdio.h>
+
+struct modulator_offset_config
+{
+ bool use_offset_fixed;
+ double offset_fixed;
+
+ bool use_offset_file;
+ char* offset_filename;
+};
+
+struct frame_timestamp
+{
+ uint32_t timestamp_sec;
+ double timestamp_pps_offset;
+ bool timestamp_valid;
+ bool timestamp_refresh;
+
+ struct frame_timestamp operator=(const struct frame_timestamp &rhs)
+ {
+ if (this != &rhs) {
+ this->timestamp_sec = rhs.timestamp_sec;
+ this->timestamp_pps_offset = rhs.timestamp_pps_offset;
+ this->timestamp_valid = rhs.timestamp_valid;
+ this->timestamp_refresh = rhs.timestamp_refresh;
+ }
+
+ return *this;
+ }
+
+ struct frame_timestamp& operator+=(const double& diff)
+ {
+ double offset_pps, offset_secs;
+ offset_pps = modf(diff, &offset_secs);
+
+ this->timestamp_sec += lrintf(offset_secs);
+ this->timestamp_pps_offset += offset_pps;
+
+ while (this->timestamp_pps_offset > 1)
+ {
+ this->timestamp_pps_offset -= 1.0;
+ this->timestamp_sec += 1;
+ };
+ return *this;
+ }
+
+ const struct frame_timestamp operator+(const double diff)
+ {
+ struct frame_timestamp ts = *this;
+ ts += diff;
+ return ts;
+ }
+
+ void print(const char* t)
+ {
+ fprintf(stderr,
+ "%s <struct frame_timestamp(%s, %d, %.9f)>\n",
+ t, this->timestamp_valid ? "valid" : "invalid",
+ this->timestamp_sec, this->timestamp_pps_offset);
+ }
+};
+
+/* This module decodes MNSC time information */
+class TimestampDecoder
+{
+ public:
+ TimestampDecoder(struct modulator_offset_config& config):
+ modconfig(config)
+ {
+ inhibit_second_update = 0;
+ time_pps = 0.0;
+ time_secs = 0;
+ enableDecode = false;
+ full_timestamp_received_mnsc = false;
+ gmtime_r(0, &temp_time);
+ offset_changed = false;
+ };
+
+ /* Calculate the timestamp for the current frame. */
+ void calculateTimestamp(struct frame_timestamp& ts);
+
+ /* Update timestamp data from data in ETI */
+ void updateTimestampEti(int framephase, uint16_t mnsc, double pps);
+
+ /* Update the modulator timestamp offset according to the modconf
+ */
+ bool updateModulatorOffset();
+
+ protected:
+ /* Push a new MNSC field into the decoder */
+ void pushMNSCData(int framephase, uint16_t mnsc);
+
+ /* Each frame contains the TIST field with the PPS offset.
+ * For each frame, this function must be called to update
+ * the timestamp
+ */
+ void updateTimestampPPS(double pps);
+
+ /* Update the timestamp when a full set of MNSC data is
+ * known. This function can be called at most every four
+ * frames when the data is transferred using the MNSC.
+ */
+ void updateTimestampSeconds(uint32_t secs);
+
+ struct tm temp_time;
+ uint32_t time_secs;
+ double time_pps;
+ double timestamp_offset;
+ int inhibit_second_update;
+ bool offset_changed;
+
+ /* configuration for the offset management */
+ struct modulator_offset_config& modconfig;
+
+ /* When the type or identifier don't match, the decoder must
+ * be disabled
+ */
+ bool enableDecode;
+
+ /* Disable timstamps until full time has been received in mnsc */
+ bool full_timestamp_received_mnsc;
+};
+
+#endif