├── vrt ├── NEWS ├── ChangeLog ├── AUTHORS ├── m4 │ ├── .gitignore │ ├── ax_boost_regex.m4 │ ├── ax_boost_date_time.m4 │ ├── ax_boost_signals.m4 │ ├── ax_boost_program_options.m4 │ ├── ax_boost_test_exec_monitor.m4 │ ├── ax_boost_unit_test_framework.m4 │ ├── ax_boost_serialization.m4 │ ├── ax_boost_iostreams.m4 │ ├── ax_boost_filesystem.m4 │ ├── ax_boost_system.m4 │ ├── ax_boost_wserialization.m4 │ ├── Makefile.am │ ├── gr_no_undefined.m4 │ ├── lf_cc.m4 │ ├── ax_boost_thread.m4 │ ├── gr_git.m4 │ ├── lf_cxx.m4 │ ├── gr_version.m4 │ ├── gr_lib64.m4 │ ├── ax_boost_python.m4 │ ├── lf_warnings.m4 │ ├── acx_pthread.m4 │ └── ax_boost_base.m4 ├── config.guess ├── config.sub ├── include │ ├── .gitignore │ ├── vrt │ │ ├── .gitignore │ │ ├── Makefile.am │ │ ├── copiers.h │ │ ├── rx_packet_handler.h │ │ ├── rx.h │ │ ├── expanded_if_context_section.h │ │ ├── expanded_header.h │ │ ├── types.h │ │ └── bits.h │ └── Makefile.am ├── lib │ ├── .gitignore │ ├── data_handler.cc │ ├── rx_packet_handler.cc │ ├── Makefile.am │ ├── data_handler.h │ ├── header_utils.h │ ├── copiers.cc │ ├── gen_pack_switch_body.py │ ├── gen_unpack_switch_body.py │ ├── socket_rx_buffer.h │ ├── rx.cc │ ├── socket_rx_buffer.cc │ ├── expanded_header.cc │ ├── header_utils.cc │ ├── expanded_header_unpack_switch_body.h │ ├── expanded_header_pack_switch_body.h │ └── expanded_if_context_section.cc ├── apps │ ├── .gitignore │ └── Makefile.am ├── version.sh ├── README ├── vrt.pc.in ├── .gitignore ├── Makefile.am ├── bootstrap ├── Makefile.common ├── configure.ac └── INSTALL ├── .gitattributes ├── README.md └── .gitignore /vrt/NEWS: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vrt/ChangeLog: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vrt/AUTHORS: -------------------------------------------------------------------------------- 1 | Eric Blossom 2 | -------------------------------------------------------------------------------- /vrt/m4/.gitignore: -------------------------------------------------------------------------------- 1 | /Makefile 2 | /Makefile.in 3 | -------------------------------------------------------------------------------- /vrt/config.guess: -------------------------------------------------------------------------------- 1 | /usr/share/automake-1.11/config.guess -------------------------------------------------------------------------------- /vrt/config.sub: -------------------------------------------------------------------------------- 1 | /usr/share/automake-1.11/config.sub -------------------------------------------------------------------------------- /vrt/include/.gitignore: -------------------------------------------------------------------------------- 1 | /Makefile 2 | /Makefile.in 3 | -------------------------------------------------------------------------------- /vrt/include/vrt/.gitignore: -------------------------------------------------------------------------------- 1 | /Makefile 2 | /Makefile.in 3 | -------------------------------------------------------------------------------- /vrt/lib/.gitignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | Makefile.in 3 | .deps 4 | .libs 5 | -------------------------------------------------------------------------------- /vrt/apps/.gitignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | Makefile.in 3 | .deps 4 | .libs 5 | 6 | -------------------------------------------------------------------------------- /vrt/version.sh: -------------------------------------------------------------------------------- 1 | MAJOR_VERSION=1 2 | API_COMPAT=0 3 | MINOR_VERSION=git 4 | MAINT_VERSION= 5 | -------------------------------------------------------------------------------- /vrt/README: -------------------------------------------------------------------------------- 1 | This directory contains code for parsing and generating 2 | VITA-49 Virtual Radio Transport (VRT) packets. 3 | 4 | -------------------------------------------------------------------------------- /vrt/vrt.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: vrt 7 | Description: Host implementation of Virtual Radio Transport (VITA-49) 8 | Requires: 9 | Version: @LIBVER@ 10 | Libs: -L${libdir} -lvrt 11 | Cflags: -I${includedir} 12 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # 2 | # The following turn off LF->CRLF conversion for some files on Windows. 3 | # these conversions cause syntax errors on MinGW/MSYS. They should not 4 | # have any effect on non-Windows systems or on Cygwin. Any files that 5 | # required svn:eof-style=lf under subversion should be included here. 6 | # 7 | *.m4 -crlf 8 | *.ac -crlf 9 | *.scm -crlf 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Host implementation of Virtual Radio Transport (VITA-49) 2 | 3 | The vrt subdirectory builds libvrt, a library that knows how to create 4 | and parse VITA-49 packets. It also includes code that does high speed 5 | UDP input of VRT frames. 6 | 7 | This code was developed and tested with a receiver that output samples 8 | at 30MS/s, 16-bit complex baseband (120MB/s). After accounting for 9 | VRT, UDP and ethernet overhead, it ran within a few percent of the 10 | theoretical maximum for gigabit ethernet. We used jumbo frames with a 11 | UDP payload of 8192 bytes. 12 | -------------------------------------------------------------------------------- /vrt/apps/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2009,2010 Free Software Foundation, Inc. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | # 17 | 18 | include $(top_srcdir)/Makefile.common 19 | 20 | AM_CPPFLAGS = -I$(top_srcdir)/include 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # 2 | # NOTE! Don't add files that are generated in specific 3 | # subdirectories here. Add them in the ".gitignore" file 4 | # in that subdirectory instead. 5 | # 6 | # NOTE! Please use 'git ls-files -i --exclude-standard' 7 | # command after changing this file, to see if there are 8 | # any tracked files which get ignored after the change. 9 | # 10 | .* 11 | *.o 12 | *.a 13 | *.ko 14 | *.so 15 | *.la 16 | *.lo 17 | *.py[oc] 18 | *.gz 19 | *.exe 20 | *.patch 21 | *~ 22 | \#*# 23 | .deps 24 | .libs 25 | TAGS 26 | *-stamp 27 | !.gitattributes 28 | !.gitignore 29 | make.log 30 | /configure 31 | /Makefile.in 32 | /config.log 33 | /config.h 34 | /ltmain.sh 35 | /Makefile 36 | /config.status 37 | /stamp-h1 38 | /config.h.in 39 | /autom4te.cache 40 | /libtool 41 | /missing 42 | /aclocal.m4 43 | /install-sh 44 | /depcomp 45 | /py-compile 46 | /compile 47 | /build 48 | /run_tests.sh 49 | 50 | -------------------------------------------------------------------------------- /vrt/.gitignore: -------------------------------------------------------------------------------- 1 | # 2 | # NOTE! Don't add files that are generated in specific 3 | # subdirectories here. Add them in the ".gitignore" file 4 | # in that subdirectory instead. 5 | # 6 | # NOTE! Please use 'git ls-files -i --exclude-standard' 7 | # command after changing this file, to see if there are 8 | # any tracked files which get ignored after the change. 9 | # 10 | .* 11 | *.o 12 | *.a 13 | *.ko 14 | *.so 15 | *.la 16 | *.lo 17 | *.py[oc] 18 | *.gz 19 | *.exe 20 | *.patch 21 | *~ 22 | \#*# 23 | .deps 24 | .libs 25 | TAGS 26 | *-stamp 27 | !.gitattributes 28 | !.gitignore 29 | make.log 30 | /configure 31 | /Makefile.in 32 | /config.log 33 | /config.h 34 | /ltmain.sh 35 | /Makefile 36 | /config.status 37 | /stamp-h1 38 | /config.h.in 39 | /autom4te.cache 40 | /libtool 41 | /missing 42 | /aclocal.m4 43 | /install-sh 44 | /depcomp 45 | /py-compile 46 | /compile 47 | /build 48 | /run_tests.sh 49 | /vrt.pc 50 | -------------------------------------------------------------------------------- /vrt/include/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2009 Free Software Foundation, Inc. 3 | # 4 | # This file is part of GNU Radio 5 | # 6 | # GNU Radio is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 3, or (at your option) 9 | # any later version. 10 | # 11 | # GNU Radio is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program; if not, write to the Free Software Foundation, Inc., 18 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | # 20 | 21 | include $(top_srcdir)/Makefile.common 22 | 23 | SUBDIRS = vrt 24 | -------------------------------------------------------------------------------- /vrt/m4/ax_boost_regex.m4: -------------------------------------------------------------------------------- 1 | # 2 | # SYNOPSIS 3 | # 4 | # AX_BOOST_REGEX 5 | # 6 | # DESCRIPTION 7 | # 8 | # Test for Regex library from the Boost C++ libraries. The macro requires 9 | # a preceding call to AX_BOOST_BASE. 10 | # 11 | # This macro calls: 12 | # 13 | # AC_SUBST(BOOST_REGEX_LIB) 14 | # 15 | # And sets: 16 | # 17 | # HAVE_BOOST_REGEX 18 | # 19 | # COPYLEFT 20 | # 21 | # Copyright (c) 2008 Thomas Porschberg 22 | # Copyright (c) 2008 Michael Tindal 23 | # Copyright (c) 2008 Free Software Foundation, Inc. 24 | # 25 | # Copying and distribution of this file, with or without modification, are 26 | # permitted in any medium without royalty provided the copyright notice 27 | # and this notice are preserved. 28 | 29 | AC_DEFUN([AX_BOOST_REGEX], 30 | [ 31 | AC_REQUIRE([AX_BOOST_BASE]) 32 | _AX_BOOST_CHECK([boost_regex], 33 | [@%:@include ], 34 | [boost::regex r(); return 0;]) 35 | ]) 36 | -------------------------------------------------------------------------------- /vrt/m4/ax_boost_date_time.m4: -------------------------------------------------------------------------------- 1 | # 2 | # SYNOPSIS 3 | # 4 | # AX_BOOST_DATE_TIME 5 | # 6 | # DESCRIPTION 7 | # 8 | # Test for date_time library from the Boost C++ libraries. 9 | # 10 | # This macro calls: 11 | # 12 | # AC_SUBST(BOOST_DATE_TIME_LIB) 13 | # 14 | # And sets: 15 | # 16 | # HAVE_BOOST_DATE_TIME 17 | # 18 | # COPYLEFT 19 | # 20 | # Copyright (c) 2008 Thomas Porschberg 21 | # Copyright (c) 2008 Michael Tindal 22 | # Copyright (c) 2008 Free Software Foundation, Inc. 23 | # 24 | # Copying and distribution of this file, with or without modification, are 25 | # permitted in any medium without royalty provided the copyright notice 26 | # and this notice are preserved. 27 | 28 | AC_DEFUN([AX_BOOST_DATE_TIME], 29 | [ 30 | AC_REQUIRE([AX_BOOST_BASE]) 31 | _AX_BOOST_CHECK([boost_date_time], 32 | [@%:@include ], 33 | [using namespace boost::gregorian; date d(2002,Jan,10); return 0;]) 34 | ]) 35 | -------------------------------------------------------------------------------- /vrt/m4/ax_boost_signals.m4: -------------------------------------------------------------------------------- 1 | # 2 | # SYNOPSIS 3 | # 4 | # AX_BOOST_SIGNALS 5 | # 6 | # DESCRIPTION 7 | # 8 | # Test for Signals library from the Boost C++ libraries. The macro 9 | # requires a preceding call to AX_BOOST_BASE. 10 | # 11 | # This macro calls: 12 | # 13 | # AC_SUBST(BOOST_SIGNALS_LIB) 14 | # 15 | # And sets: 16 | # 17 | # HAVE_BOOST_SIGNALS 18 | # 19 | # COPYLEFT 20 | # 21 | # Copyright (c) 2008 Thomas Porschberg 22 | # Copyright (c) 2008 Michael Tindal 23 | # Copyright (c) 2008 Free Software Foundation, Inc. 24 | # 25 | # Copying and distribution of this file, with or without modification, are 26 | # permitted in any medium without royalty provided the copyright notice 27 | # and this notice are preserved. 28 | 29 | AC_DEFUN([AX_BOOST_SIGNALS], 30 | [ 31 | AC_REQUIRE([AX_BOOST_BASE]) 32 | _AX_BOOST_CHECK([boost_signals], 33 | [@%:@include ], 34 | [boost::signal sig; return 0;]) 35 | ]) 36 | -------------------------------------------------------------------------------- /vrt/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2008,2009,2010 Free Software Foundation, Inc. 3 | # 4 | # This file is part of GNU Radio 5 | # 6 | # GNU Radio is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 3, or (at your option) 9 | # any later version. 10 | # 11 | # GNU Radio is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program. If not, see . 18 | # 19 | 20 | include $(top_srcdir)/Makefile.common 21 | 22 | pkgconfigdir = $(libdir)/pkgconfig 23 | pkgconfig_DATA = vrt.pc 24 | 25 | EXTRA_DIST = \ 26 | bootstrap \ 27 | version.sh \ 28 | vrt.pc.in 29 | 30 | SUBDIRS = m4 include lib apps 31 | -------------------------------------------------------------------------------- /vrt/include/vrt/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2008,2009 Free Software Foundation, Inc. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | # 17 | 18 | include $(top_srcdir)/Makefile.common 19 | 20 | INCLUDES = 21 | 22 | vrtincludedir = $(includedir)/vrt 23 | 24 | vrtinclude_HEADERS = \ 25 | bits.h \ 26 | copiers.h \ 27 | expanded_header.h \ 28 | expanded_if_context_section.h \ 29 | rx.h \ 30 | rx_packet_handler.h \ 31 | types.h 32 | -------------------------------------------------------------------------------- /vrt/lib/data_handler.cc: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2008,2009 Free Software Foundation, Inc. 4 | * 5 | * This file is part of GNU Radio 6 | * 7 | * GNU Radio is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 3, or (at your option) 10 | * any later version. 11 | * 12 | * GNU Radio is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 20 | */ 21 | 22 | #include "data_handler.h" 23 | 24 | namespace vrt { 25 | 26 | data_handler::~data_handler() 27 | { 28 | // default nop destructor 29 | } 30 | 31 | } 32 | 33 | -------------------------------------------------------------------------------- /vrt/m4/ax_boost_program_options.m4: -------------------------------------------------------------------------------- 1 | # 2 | # SYNOPSIS 3 | # 4 | # AX_BOOST_PROGRAM_OPTIONS 5 | # 6 | # DESCRIPTION 7 | # 8 | # Test for program options library from the Boost C++ libraries. The macro 9 | # requires a preceding call to AX_BOOST_BASE. 10 | # 11 | # This macro calls: 12 | # 13 | # AC_SUBST(BOOST_PROGRAM_OPTIONS_LIB) 14 | # 15 | # And sets: 16 | # 17 | # HAVE_BOOST_PROGRAM_OPTIONS 18 | # 19 | # COPYLEFT 20 | # 21 | # Copyright (c) 2008 Thomas Porschberg 22 | # Copyright (c) 2008 Free Software Foundation, Inc. 23 | # 24 | # Copying and distribution of this file, with or without modification, are 25 | # permitted in any medium without royalty provided the copyright notice 26 | # and this notice are preserved. 27 | 28 | AC_DEFUN([AX_BOOST_PROGRAM_OPTIONS], 29 | [ 30 | AC_REQUIRE([AX_BOOST_BASE]) 31 | _AX_BOOST_CHECK([boost_program_options], 32 | [@%:@include ], 33 | [boost::program_options::options_description generic("Generic options"); 34 | return 0;]) 35 | ]) 36 | -------------------------------------------------------------------------------- /vrt/m4/ax_boost_test_exec_monitor.m4: -------------------------------------------------------------------------------- 1 | # 2 | # SYNOPSIS 3 | # 4 | # AX_BOOST_TEST_EXEC_MONITOR 5 | # 6 | # DESCRIPTION 7 | # 8 | # Test for Test_Exec_Monitor library from the Boost C++ libraries. The 9 | # macro requires a preceding call to AX_BOOST_BASE. 10 | # 11 | # This macro calls: 12 | # 13 | # AC_SUBST(BOOST_TEST_EXEC_MONITOR_LIB) 14 | # 15 | # And sets: 16 | # 17 | # HAVE_BOOST_TEST_EXEC_MONITOR 18 | # 19 | # COPYLEFT 20 | # 21 | # Copyright (c) 2008 Dodji Seketeli 22 | # Copyright (c) 2008 Thomas Porschberg 23 | # Copyright (c) 2008 Free Software Foundation, Inc. 24 | # 25 | # Copying and distribution of this file, with or without modification, are 26 | # permitted in any medium without royalty provided the copyright notice 27 | # and this notice are preserved. 28 | 29 | AC_DEFUN([AX_BOOST_TEST_EXEC_MONITOR], 30 | [ 31 | AC_REQUIRE([AX_BOOST_BASE]) 32 | _AX_BOOST_CHECK([boost_test_exec_monitor], 33 | [@%:@include ], 34 | [int i=1 ; BOOST_REQUIRE(i==1); ; return 0;]) 35 | ]) 36 | -------------------------------------------------------------------------------- /vrt/bootstrap: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Copyright 2001,2005,2008 Free Software Foundation, Inc. 4 | # 5 | # This file is part of GNU Radio 6 | # 7 | # GNU Radio is free software; you can redistribute it and/or modify 8 | # it under the terms of the GNU General Public License as published by 9 | # the Free Software Foundation; either version 3, or (at your option) 10 | # any later version. 11 | # 12 | # GNU Radio is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | # GNU General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU General Public License 18 | # along with GNU Radio; see the file COPYING. If not, write to 19 | # the Free Software Foundation, Inc., 51 Franklin Street, 20 | # Boston, MA 02110-1301, USA. 21 | 22 | 23 | rm -fr config.cache autom4te*.cache 24 | 25 | aclocal -I m4 26 | autoconf 27 | autoheader 28 | libtoolize --automake 29 | automake --add-missing -Wno-portability -Wno-override -Wnone 30 | #automake --add-missing -Wno-portability 31 | -------------------------------------------------------------------------------- /vrt/m4/ax_boost_unit_test_framework.m4: -------------------------------------------------------------------------------- 1 | # 2 | # SYNOPSIS 3 | # 4 | # AX_BOOST_UNIT_TEST_FRAMEWORK 5 | # 6 | # DESCRIPTION 7 | # 8 | # Test for Unit_Test_Framework library from the Boost C++ libraries. The 9 | # macro requires a preceding call to AX_BOOST_BASE. 10 | # 11 | # This macro calls: 12 | # 13 | # AC_SUBST(BOOST_UNIT_TEST_FRAMEWORK_LIB) 14 | # 15 | # And sets: 16 | # 17 | # HAVE_BOOST_UNIT_TEST_FRAMEWORK 18 | # 19 | # COPYLEFT 20 | # 21 | # Copyright (c) 2008 Thomas Porschberg 22 | # Copyright (c) 2008 Free Software Foundation, Inc. 23 | # 24 | # Copying and distribution of this file, with or without modification, are 25 | # permitted in any medium without royalty provided the copyright notice 26 | # and this notice are preserved. 27 | 28 | AC_DEFUN([AX_BOOST_UNIT_TEST_FRAMEWORK], 29 | [ 30 | AC_REQUIRE([AX_BOOST_BASE]) 31 | _AX_BOOST_CHECK([boost_unit_test_framework], 32 | [@%:@include ], 33 | [using boost::unit_test::test_suite; 34 | test_suite* test= BOOST_TEST_SUITE( "Unit test example 1" ); 35 | return 0;]) 36 | ]) 37 | -------------------------------------------------------------------------------- /vrt/m4/ax_boost_serialization.m4: -------------------------------------------------------------------------------- 1 | # 2 | # SYNOPSIS 3 | # 4 | # AX_BOOST_SERIALIZATION 5 | # 6 | # DESCRIPTION 7 | # 8 | # Test for Serialization library from the Boost C++ libraries. The macro 9 | # requires a preceding call to AX_BOOST_BASE. 10 | # 11 | # This macro calls: 12 | # 13 | # AC_SUBST(BOOST_SERIALIZATION_LIB) 14 | # 15 | # And sets: 16 | # 17 | # HAVE_BOOST_SERIALIZATION 18 | # 19 | # COPYLEFT 20 | # 21 | # Copyright (c) 2008 Thomas Porschberg 22 | # Copyright (c) 2008 Free Software Foundation, Inc. 23 | # 24 | # Copying and distribution of this file, with or without modification, are 25 | # permitted in any medium without royalty provided the copyright notice 26 | # and this notice are preserved. 27 | 28 | AC_DEFUN([AX_BOOST_SERIALIZATION], 29 | [ 30 | AC_REQUIRE([AX_BOOST_BASE]) 31 | _AX_BOOST_CHECK([boost_serialization], 32 | [@%:@include 33 | @%:@include 34 | @%:@include ], 35 | [std::ofstream ofs("filename"); 36 | boost::archive::text_oarchive oa(ofs); 37 | return 0;]) 38 | ]) 39 | -------------------------------------------------------------------------------- /vrt/m4/ax_boost_iostreams.m4: -------------------------------------------------------------------------------- 1 | # 2 | # SYNOPSIS 3 | # 4 | # AX_BOOST_IOSTREAMS 5 | # 6 | # DESCRIPTION 7 | # 8 | # Test for IOStreams library from the Boost C++ libraries. The macro 9 | # requires a preceding call to AX_BOOST_BASE. 10 | # 11 | # This macro calls: 12 | # 13 | # AC_SUBST(BOOST_IOSTREAMS_LIB) 14 | # 15 | # And sets: 16 | # 17 | # HAVE_BOOST_IOSTREAMS 18 | # 19 | # COPYLEFT 20 | # 21 | # Copyright (c) 2008 Thomas Porschberg 22 | # Copyright (c) 2008 Free Software Foundation, Inc. 23 | # 24 | # Copying and distribution of this file, with or without modification, are 25 | # permitted in any medium without royalty provided the copyright notice 26 | # and this notice are preserved. 27 | 28 | AC_DEFUN([AX_BOOST_IOSTREAMS], 29 | [ 30 | AC_REQUIRE([AX_BOOST_BASE]) 31 | _AX_BOOST_CHECK([boost_iostreams], 32 | [@%:@include 33 | @%:@include ], 34 | [std::string input = "Hello World!"; 35 | namespace io = boost::iostreams; 36 | io::filtering_istream in(boost::make_iterator_range(input)); 37 | return 0;]) 38 | 39 | ]) 40 | -------------------------------------------------------------------------------- /vrt/m4/ax_boost_filesystem.m4: -------------------------------------------------------------------------------- 1 | # 2 | # SYNOPSIS 3 | # 4 | # AX_BOOST_FILESYSTEM 5 | # 6 | # DESCRIPTION 7 | # 8 | # Test for Filesystem library from the Boost C++ libraries. The macro 9 | # requires a preceding call to AX_BOOST_BASE. 10 | # 11 | # This macro calls: 12 | # 13 | # AC_SUBST(BOOST_FILESYSTEM_LIB) 14 | # 15 | # And sets: 16 | # 17 | # HAVE_BOOST_FILESYSTEM 18 | # 19 | # COPYLEFT 20 | # 21 | # Copyright (c) 2008 Thomas Porschberg 22 | # Copyright (c) 2008 Michael Tindal 23 | # Copyright (c) 2008 Free Software Foundation, Inc. 24 | # 25 | # Copying and distribution of this file, with or without modification, are 26 | # permitted in any medium without royalty provided the copyright notice 27 | # and this notice are preserved. 28 | 29 | AC_DEFUN([AX_BOOST_FILESYSTEM], 30 | [ 31 | AC_REQUIRE([AX_BOOST_BASE]) 32 | 33 | dnl depends on boost_system 34 | AC_REQUIRE([AX_BOOST_SYSTEM]) 35 | axbf_LDFLAGS_SAVED=$LDFLAGS 36 | LDFLAGS="$LDFLAGS $BOOST_SYSTEM_LIB" 37 | 38 | _AX_BOOST_CHECK([boost_filesystem], 39 | [@%:@include ], 40 | [using namespace boost::filesystem; 41 | path my_path( "foo/bar/data.txt" ); 42 | return 0;]) 43 | 44 | LDFLAGS=$axbf_LDFLAGS_SAVED 45 | ]) 46 | -------------------------------------------------------------------------------- /vrt/m4/ax_boost_system.m4: -------------------------------------------------------------------------------- 1 | # =========================================================================== 2 | # started with this: http://autoconf-archive.cryp.to/ax_boost_system.html, 3 | # virtually nothing left 4 | # =========================================================================== 5 | # 6 | # SYNOPSIS 7 | # 8 | # AX_BOOST_SYSTEM 9 | # 10 | # DESCRIPTION 11 | # 12 | # Test for System library from the Boost C++ libraries. The macro requires 13 | # a preceding call to AX_BOOST_BASE. 14 | # 15 | # This macro calls: 16 | # 17 | # AC_SUBST(BOOST_SYSTEM_LIB) 18 | # 19 | # And sets: 20 | # 21 | # HAVE_BOOST_SYSTEM 22 | # 23 | # COPYLEFT 24 | # 25 | # Copyright (c) 2008 Thomas Porschberg 26 | # Copyright (c) 2008 Michael Tindal 27 | # Copyright (c) 2008 Daniel Casimiro 28 | # Copyright (c) 2008 Free Software Foundation, Inc. 29 | # 30 | # Copying and distribution of this file, with or without modification, are 31 | # permitted in any medium without royalty provided the copyright notice 32 | # and this notice are preserved. 33 | 34 | AC_DEFUN([AX_BOOST_SYSTEM], 35 | [ 36 | AC_REQUIRE([AX_BOOST_BASE]) 37 | _AX_BOOST_CHECK([boost_system], 38 | [@%:@include ], 39 | [boost::system::system_category]) 40 | ]) 41 | -------------------------------------------------------------------------------- /vrt/lib/rx_packet_handler.cc: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2009 Free Software Foundation, Inc. 4 | * 5 | * This file is part of GNU Radio 6 | * 7 | * GNU Radio is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 3, or (at your option) 10 | * any later version. 11 | * 12 | * GNU Radio is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 20 | */ 21 | 22 | #ifdef HAVE_CONFIG_H 23 | #include 24 | #endif 25 | #include 26 | 27 | namespace vrt { 28 | 29 | rx_packet_handler::~rx_packet_handler(){} 30 | 31 | // default operator is a NOP 32 | bool 33 | rx_packet_handler::operator()(const uint32_t *payload, 34 | size_t n32_bit_words, 35 | const expanded_header *hdr) 36 | { 37 | return true; 38 | } 39 | 40 | 41 | }; // vrt 42 | -------------------------------------------------------------------------------- /vrt/m4/ax_boost_wserialization.m4: -------------------------------------------------------------------------------- 1 | # 2 | # SYNOPSIS 3 | # 4 | # AX_BOOST_WSERIALIZATION 5 | # 6 | # DESCRIPTION 7 | # 8 | # Test for WSerialization library from the Boost C++ libraries. The macro 9 | # requires a preceding call to AX_BOOST_BASE. 10 | # 11 | # This macro calls: 12 | # 13 | # AC_SUBST(BOOST_WSERIALIZATION_LIB) 14 | # 15 | # And sets: 16 | # 17 | # HAVE_BOOST_WSERIALIZATION 18 | # 19 | # COPYLEFT 20 | # 21 | # Copyright (c) 2008 Thomas Porschberg 22 | # Copyright (c) 2008 Free Software Foundation, Inc. 23 | # 24 | # Copying and distribution of this file, with or without modification, are 25 | # permitted in any medium without royalty provided the copyright notice 26 | # and this notice are preserved. 27 | 28 | AC_DEFUN([AX_BOOST_WSERIALIZATION], 29 | [ 30 | AC_REQUIRE([AX_BOOST_BASE]) 31 | 32 | dnl depends on BOOST_SERIALIZATION 33 | AC_REQUIRE([AX_BOOST_SERIALIZATION]) 34 | axbws_LDFLAGS_SAVED=$LDFLAGS 35 | LDFLAGS="$LDFLAGS $BOOST_SERIALIZATION_LIB" 36 | 37 | _AX_BOOST_CHECK([boost_wserialization], 38 | [@%:@include 39 | @%:@include 40 | @%:@include ], 41 | [std::ofstream ofs("filename"); 42 | boost::archive::text_oarchive oa(ofs); 43 | return 0;]) 44 | 45 | LDFLAGS=$axbf_LDFLAGS_SAVED 46 | ]) 47 | -------------------------------------------------------------------------------- /vrt/lib/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2007,2008,2009 Free Software Foundation, Inc. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | # 17 | 18 | include $(top_srcdir)/Makefile.common 19 | 20 | AM_CPPFLAGS = -I$(top_srcdir)/include 21 | 22 | bin_PROGRAMS = 23 | 24 | lib_LTLIBRARIES = \ 25 | libvrt.la 26 | 27 | libvrt_la_SOURCES = \ 28 | copiers.cc \ 29 | data_handler.cc \ 30 | expanded_header.cc \ 31 | expanded_if_context_section.cc \ 32 | header_utils.cc \ 33 | rx.cc \ 34 | rx_packet_handler.cc \ 35 | socket_rx_buffer.cc 36 | 37 | libvrt_la_LIBADD = 38 | 39 | libvrt_la_LDFLAGS = $(LTVERSIONFLAGS) 40 | 41 | # Private headers not needed for above the API development 42 | noinst_HEADERS = \ 43 | data_handler.h \ 44 | expanded_header_unpack_switch_body.h \ 45 | expanded_header_pack_switch_body.h \ 46 | header_utils.h \ 47 | socket_rx_buffer.h 48 | 49 | EXTRA_DIST = \ 50 | gen_unpack_switch_body.py \ 51 | gen_pack_switch_body.py 52 | -------------------------------------------------------------------------------- /vrt/m4/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2010 Free Software Foundation, Inc. 3 | # 4 | # This file is part of GNU Radio 5 | # 6 | # GNU Radio is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 3, or (at your option) 9 | # any later version. 10 | # 11 | # GNU Radio is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program; if not, write to the Free Software Foundation, Inc., 18 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | # 20 | 21 | include $(top_srcdir)/Makefile.common 22 | 23 | # List your m4 macros here 24 | m4macros = \ 25 | acx_pthread.m4 \ 26 | ax_boost_base.m4 \ 27 | ax_boost_date_time.m4 \ 28 | ax_boost_filesystem.m4 \ 29 | ax_boost_iostreams.m4 \ 30 | ax_boost_program_options.m4 \ 31 | ax_boost_python.m4 \ 32 | ax_boost_regex.m4 \ 33 | ax_boost_serialization.m4 \ 34 | ax_boost_signals.m4 \ 35 | ax_boost_system.m4 \ 36 | ax_boost_test_exec_monitor.m4 \ 37 | ax_boost_thread.m4 \ 38 | ax_boost_unit_test_framework.m4 \ 39 | ax_boost_wserialization.m4 \ 40 | gr_git.m4 \ 41 | gr_lib64.m4 \ 42 | gr_no_undefined.m4 \ 43 | gr_version.m4 \ 44 | lf_cc.m4 \ 45 | lf_cxx.m4 \ 46 | lf_warnings.m4 47 | 48 | EXTRA_DIST = $(m4macros) 49 | -------------------------------------------------------------------------------- /vrt/m4/gr_no_undefined.m4: -------------------------------------------------------------------------------- 1 | dnl 2 | dnl Copyright 2005 Free Software Foundation, Inc. 3 | dnl 4 | dnl This file is part of GNU Radio 5 | dnl 6 | dnl GNU Radio is free software; you can redistribute it and/or modify 7 | dnl it under the terms of the GNU General Public License as published by 8 | dnl the Free Software Foundation; either version 3, or (at your option) 9 | dnl any later version. 10 | dnl 11 | dnl GNU Radio is distributed in the hope that it will be useful, 12 | dnl but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | dnl GNU General Public License for more details. 15 | dnl 16 | dnl You should have received a copy of the GNU General Public License 17 | dnl along with GNU Radio; see the file COPYING. If not, write to 18 | dnl the Free Software Foundation, Inc., 51 Franklin Street, 19 | dnl Boston, MA 02110-1301, USA. 20 | dnl 21 | 22 | # GR_NO_UNDEFINED() 23 | # 24 | # Detemine whether we need to use the -no-undefined linker flag 25 | # when building shared libraries. 26 | # Sets NO_UNDEFINED to "" or "-no-undefined" 27 | # 28 | # As far as I can tell, we need -no-undefined only when building 29 | # windows DLLs. This occurs when using MinGW and Cygwin. 30 | # 31 | # For now, we stub this out. 32 | 33 | AC_DEFUN([GR_NO_UNDEFINED],[ 34 | AC_REQUIRE([AC_CANONICAL_HOST]) 35 | no_undefined="" 36 | case "${host_os}" in 37 | *mingw* | *cygwin*) 38 | 39 | # on MinGW/Cygwin extra LDFLAGS are required 40 | no_undefined="-no-undefined" 41 | ;; 42 | esac 43 | AC_SUBST(NO_UNDEFINED,[$no_undefined]) 44 | ]) 45 | -------------------------------------------------------------------------------- /vrt/lib/data_handler.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2008,2009,2010 Free Software Foundation, Inc. 4 | * 5 | * This file is part of GNU Radio 6 | * 7 | * GNU Radio is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 3, or (at your option) 10 | * any later version. 11 | * 12 | * GNU Radio is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 20 | */ 21 | #ifndef INCLUDED_VRT_DATA_HANDLER_H 22 | #define INCLUDED_VRT_DATA_HANDLER_H 23 | 24 | #include 25 | #include 26 | 27 | namespace vrt { 28 | 29 | /*! 30 | * \brief Abstract function object called to handle received data blocks. 31 | */ 32 | class data_handler 33 | { 34 | public: 35 | 36 | /*! 37 | * \param base points to the beginning of the data. 38 | * \param len is the length of the data in bytes. 39 | * \returns true if it wants to be called again, else false. 40 | */ 41 | virtual bool operator()(const void *base, size_t len) = 0; 42 | virtual ~data_handler(); 43 | }; 44 | 45 | } // namespace vrt 46 | 47 | #endif /* INCLUDED_VRT_DATA_HANDLER_H */ 48 | -------------------------------------------------------------------------------- /vrt/include/vrt/copiers.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2009 Free Software Foundation, Inc. 4 | * 5 | * This file is part of GNU Radio 6 | * 7 | * GNU Radio is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 3, or (at your option) 10 | * any later version. 11 | * 12 | * GNU Radio is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 20 | */ 21 | 22 | #ifndef INCLUDED_VRT_COPIERS_H 23 | #define INCLUDED_VRT_COPIERS_H 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | namespace vrt { 30 | 31 | /*! 32 | * \brief Copy and convert from net format to host format 33 | */ 34 | void 35 | copy_net_16sc_to_host_16sc(size_t nitems, 36 | const uint32_t *items, 37 | std::complex *host_items); 38 | 39 | 40 | /*! 41 | * \brief Copy and convert from net format to host format mapping [-32768, 32767] -> [1.0, +1.0) 42 | */ 43 | void 44 | copy_net_16sc_to_host_32fc(size_t nitems, 45 | const uint32_t *items, 46 | std::complex *host_items); 47 | }; 48 | 49 | #endif /* INCLUDED_VRT_COPIERS_H */ 50 | -------------------------------------------------------------------------------- /vrt/Makefile.common: -------------------------------------------------------------------------------- 1 | # -*- Makefile -*- 2 | # 3 | # Copyright 2010 Free Software Foundation, Inc. 4 | # 5 | # This program is free software: you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation, either version 3 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program. If not, see . 17 | # 18 | 19 | AM_CFLAGS = @autoconf_default_CFLAGS@ @lf_CFLAGS@ 20 | AM_CXXFLAGS = @autoconf_default_CXXFLAGS@ @lf_CXXFLAGS@ 21 | 22 | # Sets ABI version in SONAME and appends -LIBVER to filename 23 | LTVERSIONFLAGS = -version-info 0:0:0 -release $(LIBVER) 24 | 25 | # Fix for BSD make not defining $(RM). We define it now in configure.ac 26 | # using AM_PATH_PROG, but now here have to add a -f to be like GNU make 27 | RM=$(RM_PROG) -f 28 | 29 | # Base directory for documentation (docdir undefined in autoconf < 1.60) 30 | docdir ?= $(datadir)/doc/$(PACKAGE) 31 | gr_docdir = $(docdir)-$(DOCVER) 32 | 33 | # Other common defines; use "+=" to add to these 34 | STAMPS = 35 | MOSTLYCLEANFILES = $(BUILT_SOURCES) $(STAMPS) *.pyc *.pyo *~ *.tmp *.loT 36 | 37 | # Don't distribute the files defined in the variable 'no_dist_files' 38 | dist-hook: 39 | @for file in $(no_dist_files); do \ 40 | echo $(RM) $(distdir)/$$file; \ 41 | $(RM) $(distdir)/$$file; \ 42 | done; 43 | -------------------------------------------------------------------------------- /vrt/m4/lf_cc.m4: -------------------------------------------------------------------------------- 1 | dnl Autoconf support for C++ 2 | dnl Copyright (C) 1988 Eleftherios Gkioulekas 3 | dnl 4 | dnl This program is free software; you can redistribute it and/or modify 5 | dnl it under the terms of the GNU General Public License as published by 6 | dnl the Free Software Foundation; either version 3 of the License, or 7 | dnl (at your option) any later version. 8 | dnl 9 | dnl This program is distributed in the hope that it will be useful, 10 | dnl but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | dnl GNU General Public License for more details. 13 | dnl 14 | dnl You should have received a copy of the GNU General Public License 15 | dnl along with this program; if not, write to the Free Software 16 | dnl Foundation, Inc., 51 Franklin Street, Boston, MA 02110-1301, USA. 17 | dnl 18 | dnl As a special exception to the GNU General Public License, if you 19 | dnl distribute this file as part of a program that contains a configuration 20 | dnl script generated by Autoconf, you may include it under the same 21 | dnl distribution terms that you use for the rest of that program. 22 | 23 | # ------------------------------------------------------------------------- 24 | # Use this macro to configure your C compiler 25 | # When called the macro does the following things: 26 | # 1. It finds an appropriate C compiler. 27 | # If you passed the flag --with-cc=foo then it uses that 28 | # particular compiler 29 | # 2. Check whether the compiler works. 30 | # 3. Checks whether the compiler accepts the -g 31 | # ------------------------------------------------------------------------- 32 | 33 | AC_DEFUN([LF_CONFIGURE_CC],[ 34 | dnl Sing the song 35 | AC_REQUIRE([AC_PROG_CC])dnl 36 | AC_REQUIRE([AC_PROG_CPP])dnl 37 | AC_REQUIRE([AC_AIX])dnl 38 | AC_REQUIRE([AC_ISC_POSIX])dnl 39 | AC_REQUIRE([AC_HEADER_STDC])dnl 40 | ]) 41 | 42 | -------------------------------------------------------------------------------- /vrt/lib/header_utils.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2010 Free Software Foundation, Inc. 4 | * 5 | * This file is part of GNU Radio 6 | * 7 | * GNU Radio is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 3, or (at your option) 10 | * any later version. 11 | * 12 | * GNU Radio is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 20 | */ 21 | #ifndef INCLUDED_VRT_HEADER_UTILS_H 22 | #define INCLUDED_VRT_HEADER_UTILS_H 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | namespace vrt 30 | { 31 | namespace detail { 32 | 33 | void wr_header(std::ostream &os, uint32_t x); 34 | void wr_name(std::ostream &os, const std::string &x); 35 | void wr_int_secs(std::ostream &os, uint32_t secs); 36 | void wr_uint32_hex(std::ostream &os, uint32_t x); 37 | void wr_uint32_dec(std::ostream &os, uint32_t x); 38 | void wr_hertz(std::ostream &os, vrt_hertz_t x); 39 | void wr_dbm(std::ostream &os, vrt_db_t x); 40 | void wr_db(std::ostream &os, vrt_db_t x); 41 | void wr_temp(std::ostream &os, vrt_temp_t x); 42 | void wr_angle(std::ostream &os, vrt_angle_t x); 43 | void wr_distance(std::ostream &os, vrt_distance_t x); 44 | void wr_velocity(std::ostream &os, vrt_velocity_t x); 45 | void wr_payload_fmt(std::ostream &os, vrt_payload_fmt_t f); 46 | void wr_formatted_gps(std::ostream &os, 47 | const vrt_formatted_gps_t &x); 48 | }; 49 | }; 50 | 51 | #endif /* INCLUDED_VRT_HEADER_UTILS_H */ 52 | -------------------------------------------------------------------------------- /vrt/lib/copiers.cc: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2009 Free Software Foundation, Inc. 4 | * 5 | * This file is part of GNU Radio 6 | * 7 | * GNU Radio is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 3, or (at your option) 10 | * any later version. 11 | * 12 | * GNU Radio is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 20 | */ 21 | 22 | #ifdef HAVE_CONFIG_H 23 | #include 24 | #endif 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | namespace vrt { 31 | 32 | void 33 | copy_net_16sc_to_host_16sc(size_t nitems, 34 | const uint32_t *items, 35 | std::complex *host_items) 36 | { 37 | #ifdef WORDS_BIGENDIAN 38 | 39 | assert(sizeof(items[0]) == sizeof(host_items[0])); 40 | memcpy(host_items, items, nitems * sizeof(items[0])); 41 | 42 | #else 43 | 44 | // FIXME SIMD welcome here 45 | 46 | for (size_t i = 0; i < nitems; i++){ 47 | uint32_t t = ntohl(items[i]); 48 | //printf("%9d\n", items[i]); 49 | host_items[i] = std::complex((t >> 16), t & 0xffff); 50 | } 51 | 52 | #endif 53 | } 54 | 55 | void 56 | copy_net_16sc_to_host_32fc(size_t nitems, 57 | const uint32_t *items, 58 | std::complex *host_items) 59 | { 60 | // FIXME SIMD welcome here 61 | 62 | for (size_t i = 0; i < nitems; i++){ 63 | uint32_t t = ntohl(items[i]); 64 | int16_t re = (t >> 16) & 0xffff; 65 | int16_t im = (t & 0xffff); 66 | host_items[i] = std::complex(re * 1.0/32768, im * 1.0/32768); 67 | } 68 | } 69 | 70 | }; 71 | 72 | -------------------------------------------------------------------------------- /vrt/m4/ax_boost_thread.m4: -------------------------------------------------------------------------------- 1 | # 2 | # SYNOPSIS 3 | # 4 | # AX_BOOST_THREAD 5 | # 6 | # DESCRIPTION 7 | # 8 | # Test for Thread library from the Boost C++ libraries. 9 | # 10 | # This macro calls: 11 | # 12 | # AC_SUBST(BOOST_THREAD_LIB) 13 | # AC_SUBST(BOOST_CXXFLAGS) 14 | # 15 | # And sets: 16 | # 17 | # HAVE_BOOST_THREAD 18 | # 19 | # COPYLEFT 20 | # 21 | # Copyright (c) 2008 Thomas Porschberg 22 | # Copyright (c) 2008 Michael Tindal 23 | # Copyright (c) 2008 Free Software Foundation, Inc. 24 | # 25 | # Copying and distribution of this file, with or without modification, are 26 | # permitted in any medium without royalty provided the copyright notice 27 | # and this notice are preserved. 28 | 29 | 30 | AC_DEFUN([AX_BOOST_THREAD], 31 | [ 32 | AC_REQUIRE([AX_BOOST_BASE]) 33 | AC_REQUIRE([ACX_PTHREAD]) 34 | _AX_BOOST_WITH([boost_thread]) 35 | 36 | if test "$want_boost" = "yes"; then 37 | AC_REQUIRE([AC_PROG_CC]) 38 | AC_REQUIRE([AC_PROG_CXX]) 39 | AC_REQUIRE([AC_CANONICAL_HOST]) 40 | 41 | CPPFLAGS_SAVED="$CPPFLAGS" 42 | LDFLAGS_SAVED="$LDFLAGS" 43 | CXXFLAGS_SAVED="$CXXFLAGS" 44 | 45 | CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" 46 | LDFLAGS="$LDFLAGS $BOOST_LDFLAGS $PTHREAD_LIBS" 47 | CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS" 48 | 49 | AC_CACHE_CHECK(whether the boost::thread includes are available, 50 | ax_cv_boost_thread, 51 | [AC_LANG_PUSH([C++]) 52 | AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[@%:@include ]], 53 | [[boost::thread_group thrds; 54 | return 0;]]), 55 | ax_cv_boost_thread=yes, ax_cv_boost_thread=no) 56 | AC_LANG_POP([C++]) 57 | ]) 58 | 59 | if test "$ax_cv_boost_thread" = "yes"; then 60 | BOOST_CXXFLAGS="$PTHREAD_CFLAGS" 61 | AC_SUBST(BOOST_CXXFLAGS) 62 | _AX_BOOST_CHECK_LIB([boost_thread]) 63 | if test "$link_ok" = "yes" && test -n "$PTHREAD_LIBS"; then 64 | BOOST_THREAD_LIB="$BOOST_THREAD_LIB $PTHREAD_LIBS" 65 | fi 66 | fi 67 | 68 | CPPFLAGS="$CPPFLAGS_SAVED" 69 | LDFLAGS="$LDFLAGS_SAVED" 70 | CXXFLAGS="$CXXFLAGS_SAVED" 71 | fi 72 | ]) 73 | -------------------------------------------------------------------------------- /vrt/m4/gr_git.m4: -------------------------------------------------------------------------------- 1 | dnl Copyright 2009,2010 Free Software Foundation, Inc. 2 | dnl 3 | dnl This file is part of GNU Radio 4 | dnl 5 | dnl GNU Radio is free software; you can redistribute it and/or modify 6 | dnl it under the terms of the GNU General Public License as published by 7 | dnl the Free Software Foundation; either version 3, or (at your option) 8 | dnl any later version. 9 | dnl 10 | dnl GNU Radio is distributed in the hope that it will be useful, 11 | dnl but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | dnl GNU General Public License for more details. 14 | dnl 15 | dnl You should have received a copy of the GNU General Public License 16 | dnl along with GNU Radio; see the file COPYING. If not, write to 17 | dnl the Free Software Foundation, Inc., 51 Franklin Street, 18 | dnl Boston, MA 02110-1301, USA. 19 | 20 | 21 | AC_DEFUN([GR_GIT],[ 22 | dnl Identify git binary 23 | AC_PATH_PROG([GIT],[git]) 24 | 25 | dnl If it exists, get either 'git describe' or fallback to current commit 26 | if test x$GIT != x ; then 27 | AC_MSG_CHECKING([existence of git version control directory]) 28 | if test -d $srcdir/../.git; then 29 | AC_MSG_RESULT([ok]) 30 | AC_MSG_CHECKING([git description of current commit]) 31 | if (cd $srcdir && $GIT describe >/dev/null 2>&1); then 32 | GIT_DESCRIBE=`cd $srcdir && $GIT describe --abbrev=8 --long` 33 | # Release candidate tags create an extra -rcX field 34 | case $GIT_DESCRIBE in 35 | *-*-*-*) 36 | GIT_TAG=`echo $GIT_DESCRIBE | cut -f -2 -d '-'` 37 | GIT_SEQNO=`echo $GIT_DESCRIBE | cut -f 3 -d '-'` 38 | GIT_COMMIT=`echo $GIT_DESCRIBE | cut -f 4 -d '-' | cut -f 2- -d 'g'` 39 | ;; 40 | *-*-*) 41 | GIT_TAG=`echo $GIT_DESCRIBE | cut -f 1 -d '-'` 42 | GIT_SEQNO=`echo $GIT_DESCRIBE | cut -f 2 -d '-'` 43 | GIT_COMMIT=`echo $GIT_DESCRIBE | cut -f 3 -d '-' | cut -f 2- -d 'g'` 44 | ;; 45 | esac 46 | 47 | AC_MSG_RESULT([$GIT_DESCRIBE]) 48 | else 49 | AC_MSG_RESULT([no tag in history, using current commit]) 50 | GIT_TAG='' 51 | GIT_SEQNO='' 52 | GIT_COMMIT=`cd $srcdir && $GIT describe --always --abbrev=8` 53 | fi 54 | else 55 | AC_MSG_RESULT([not found]) 56 | fi 57 | 58 | AC_SUBST([GIT_DESCRIBE]) 59 | AC_SUBST([GIT_TAG]) 60 | AC_SUBST([GIT_SEQNO]) 61 | AC_SUBST([GIT_COMMIT]) 62 | fi 63 | ]) 64 | -------------------------------------------------------------------------------- /vrt/include/vrt/rx_packet_handler.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2009 Free Software Foundation, Inc. 4 | * 5 | * This file is part of GNU Radio 6 | * 7 | * GNU Radio is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 3, or (at your option) 10 | * any later version. 11 | * 12 | * GNU Radio is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 20 | */ 21 | #ifndef INCLUDED_VRT_RX_PACKET_HANDLER_H 22 | #define INCLUDED_VRT_RX_PACKET_HANDLER_H 23 | 24 | #include 25 | #include 26 | 27 | namespace vrt { 28 | 29 | /*! 30 | * \brief Abstract function object called to handle received VRT packets. 31 | * 32 | * An object derived from this class is passed to vrt_rx_udp::rx_packets 33 | * to process the received packets. 34 | */ 35 | class rx_packet_handler { 36 | public: 37 | virtual ~rx_packet_handler(); 38 | 39 | /*! 40 | * \param payload points to the first 32-bit word of the payload field. 41 | * \param n32_bit_words is the number of 32-bit words in the payload field. 42 | * \param hdr is the expanded version of the mandatory and optional header fields (& trailer). 43 | * 44 | * \p payload points to the raw payload section of the packet received off 45 | * the wire. The data is network-endian (aka big-endian) 32-bit integers. 46 | * 47 | * This is the general purpose, low level interface and relies on other 48 | * functions to handle all required endian-swapping and format conversion 49 | * of the payload. \sa FIXME. 50 | * 51 | * \returns true if the object wants to be called again with new data; 52 | * false if no additional data is wanted. 53 | */ 54 | virtual bool operator()(const uint32_t *payload, 55 | size_t n32_bit_words, 56 | const expanded_header *hdr); 57 | }; 58 | 59 | }; // vrt 60 | 61 | 62 | #endif /* INCLUDED_VRT_RX_PACKET_HANDLER_H */ 63 | -------------------------------------------------------------------------------- /vrt/m4/lf_cxx.m4: -------------------------------------------------------------------------------- 1 | dnl Autoconf support for C++ 2 | dnl Copyright (C) 1988 Eleftherios Gkioulekas 3 | dnl 4 | dnl This program is free software; you can redistribute it and/or modify 5 | dnl it under the terms of the GNU General Public License as published by 6 | dnl the Free Software Foundation; either version 3 of the License, or 7 | dnl (at your option) any later version. 8 | dnl 9 | dnl This program is distributed in the hope that it will be useful, 10 | dnl but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | dnl GNU General Public License for more details. 13 | dnl 14 | dnl You should have received a copy of the GNU General Public License 15 | dnl along with this program; if not, write to the Free Software 16 | dnl Foundation, Inc., 51 Franklin Street, Boston, MA 02110-1301, USA. 17 | dnl 18 | dnl As a special exception to the GNU General Public License, if you 19 | dnl distribute this file as part of a program that contains a configuration 20 | dnl script generated by Autoconf, you may include it under the same 21 | dnl distribution terms that you use for the rest of that program. 22 | 23 | # ----------------------------------------------------------------- 24 | # This macro should be called to configure your C++ compiler. 25 | # When called, the macro does the following things: 26 | # 1. It finds an appropriate C++ compiler 27 | # If you passed the flag --with-cxx=foo, then it uses that 28 | # particular compiler 29 | # 2. Checks whether the compiler accepts the -g 30 | # ------------------------------------------------------------------ 31 | 32 | AC_DEFUN([LF_CONFIGURE_CXX],[ 33 | AC_REQUIRE([AC_PROG_CXX])dnl 34 | AC_REQUIRE([AC_PROG_CXXCPP])dnl 35 | LF_CXX_PORTABILITY 36 | ]) 37 | 38 | # ----------------------------------------------------------------------- 39 | # This macro tests the C++ compiler for various portability problem. 40 | # ----------------------------------------------------------------------- 41 | 42 | 43 | AC_DEFUN([LF_CXX_PORTABILITY],[ 44 | 45 | dnl 46 | dnl Check for common C++ portability problems 47 | dnl 48 | 49 | dnl AC_LANG_PUSH 50 | dnl AC_LANG_CPLUSPLUS 51 | AC_LANG_SAVE 52 | AC_LANG_CPLUSPLUS 53 | 54 | 55 | dnl Test whether C++ has std::isnan 56 | AC_MSG_CHECKING(whether C++ has std::isnan) 57 | AC_TRY_COMPILE([#include ], [ 58 | std::isnan(0); 59 | ], [ AC_MSG_RESULT(yes) 60 | AC_DEFINE(CXX_HAS_STD_ISNAN,[],[Define if has std::isnan]) ], 61 | [ AC_MSG_RESULT(no) ]) 62 | 63 | dnl Done with the portability checks 64 | dnl AC_LANG_POP([C++]) 65 | AC_LANG_RESTORE 66 | ]) 67 | 68 | -------------------------------------------------------------------------------- /vrt/lib/gen_pack_switch_body.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # Copyright 2009 Free Software Foundation, Inc. 4 | # 5 | # This file is part of GNU Radio 6 | # 7 | # GNU Radio is free software; you can redistribute it and/or modify 8 | # it under the terms of the GNU General Public License as published by 9 | # the Free Software Foundation; either version 3, or (at your option) 10 | # any later version. 11 | # 12 | # GNU Radio is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | # GNU General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU General Public License along 18 | # with this program; if not, write to the Free Software Foundation, Inc., 19 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 20 | # 21 | 22 | import sys 23 | 24 | # dispatch codeword bits 25 | HAS_STREAM_ID = 1 << 0; 26 | HAS_CLASS_ID = 1 << 1; 27 | HAS_INTEGER_SECS = 1 << 2; 28 | HAS_FRACTIONAL_SECS = 1 << 3; 29 | HAS_TRAILER = 1 << 4; 30 | 31 | def do_case(f, cw): 32 | 33 | def do32(name, mask, index): 34 | if cw & mask: 35 | f.write(" header[%d] = htonl(h->%s);\n" % (index, name)) 36 | return 1 37 | return 0 38 | 39 | def do64(name, mask, index): 40 | if cw & mask: 41 | f.write(" header[%d] = htonl((uint32_t)((h->%s >> 32) & 0xffffffff));\n" % (index, name)) 42 | f.write(" header[%d] = htonl((uint32_t)((h->%s >> 0) & 0xffffffff));\n" % (index+1, name)) 43 | return 2 44 | return 0 45 | 46 | def dolength(index): 47 | f.write(" *n32_bit_words_header = %d;\n"%index) 48 | 49 | def dotrailer(name, mask): 50 | if cw & mask: 51 | f.write(" trailer[%d] = htonl(h->%s);\n" % (0, name)) 52 | f.write(" *n32_bit_words_trailer = 1;\n") 53 | return 1 54 | else: 55 | f.write(" *n32_bit_words_trailer = 0;\n") 56 | return 0 57 | 58 | f.write(" case %d:\n" % (cw,)) 59 | 60 | index = 1 61 | index += do32("stream_id", HAS_STREAM_ID, index) 62 | index += do64("class_id", HAS_CLASS_ID, index) 63 | index += do32("integer_secs", HAS_INTEGER_SECS, index) 64 | index += do64("fractional_secs", HAS_FRACTIONAL_SECS, index) 65 | dolength(index) 66 | dotrailer("trailer", HAS_TRAILER) 67 | 68 | f.write(" break;\n\n") 69 | 70 | 71 | def main(): 72 | f = sys.stdout 73 | 74 | for cw in range(32): 75 | do_case(f, cw) 76 | 77 | 78 | if __name__ == '__main__': 79 | main() 80 | -------------------------------------------------------------------------------- /vrt/lib/gen_unpack_switch_body.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # Copyright 2009 Free Software Foundation, Inc. 4 | # 5 | # This file is part of GNU Radio 6 | # 7 | # GNU Radio is free software; you can redistribute it and/or modify 8 | # it under the terms of the GNU General Public License as published by 9 | # the Free Software Foundation; either version 3, or (at your option) 10 | # any later version. 11 | # 12 | # GNU Radio is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | # GNU General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU General Public License along 18 | # with this program; if not, write to the Free Software Foundation, Inc., 19 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 20 | # 21 | 22 | import sys 23 | 24 | # dispatch codeword bits 25 | HAS_STREAM_ID = 1 << 0; 26 | HAS_CLASS_ID = 1 << 1; 27 | HAS_INTEGER_SECS = 1 << 2; 28 | HAS_FRACTIONAL_SECS = 1 << 3; 29 | HAS_TRAILER = 1 << 4; 30 | 31 | def do_case(f, cw): 32 | 33 | def do32(name, mask, index): 34 | f.write(" ") 35 | if cw & mask: 36 | f.write("h->%s = ntohl(p[%d]);\n" % (name, index)) 37 | return 1 38 | else: 39 | f.write("h->%s = 0;\n" % (name,)) 40 | return 0 41 | 42 | def do64(name, mask, index): 43 | f.write(" ") 44 | if cw & mask: 45 | f.write("h->%s = ((uint64_t)(ntohl(p[%d])) << 32) | ntohl(p[%d]);\n" % (name, index, index+1)) 46 | return 2 47 | else: 48 | f.write("h->%s = 0;\n" % (name,)) 49 | return 0 50 | 51 | def dolength(index): 52 | f.write(" n32_bit_words_header = %d;\n"%index) 53 | 54 | def dotrailer(name, mask): 55 | if cw & mask: 56 | f.write(" h->%s = ntohl(p[len-1]);\n" % (name,)) 57 | f.write(" n32_bit_words_trailer = 1;\n") 58 | return 1 59 | else: 60 | f.write(" h->%s = 0;\n" % (name,)) 61 | f.write(" n32_bit_words_trailer = 0;\n") 62 | return 0 63 | 64 | f.write(" case %d:\n" % (cw,)) 65 | 66 | index = 1 67 | index += do32("stream_id", HAS_STREAM_ID, index) 68 | index += do64("class_id", HAS_CLASS_ID, index) 69 | index += do32("integer_secs", HAS_INTEGER_SECS, index) 70 | index += do64("fractional_secs", HAS_FRACTIONAL_SECS, index) 71 | dolength(index) 72 | dotrailer("trailer", HAS_TRAILER) 73 | 74 | f.write(" break;\n\n") 75 | 76 | 77 | def main(): 78 | f = sys.stdout 79 | 80 | for cw in range(32): 81 | do_case(f, cw) 82 | 83 | 84 | if __name__ == '__main__': 85 | main() 86 | -------------------------------------------------------------------------------- /vrt/m4/gr_version.m4: -------------------------------------------------------------------------------- 1 | dnl Copyright 2009,2010 Free Software Foundation, Inc. 2 | dnl 3 | dnl This file is part of GNU Radio 4 | dnl 5 | dnl GNU Radio is free software; you can redistribute it and/or modify 6 | dnl it under the terms of the GNU General Public License as published by 7 | dnl the Free Software Foundation; either version 3, or (at your option) 8 | dnl any later version. 9 | dnl 10 | dnl GNU Radio is distributed in the hope that it will be useful, 11 | dnl but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | dnl GNU General Public License for more details. 14 | dnl 15 | dnl You should have received a copy of the GNU General Public License 16 | dnl along with GNU Radio; see the file COPYING. If not, write to 17 | dnl the Free Software Foundation, Inc., 51 Franklin Street, 18 | dnl Boston, MA 02110-1301, USA. 19 | 20 | AC_DEFUN([GR_VERSION],[ 21 | dnl Computed version based on version.sh 22 | dnl Does not force recompile on rev change 23 | dnl 24 | dnl Source the variables describing the release version 25 | dnl 26 | dnl MAJOR_VERSION Major release generation (2.x, 3.x, etc.) 27 | dnl API_COMPAT API compatibility version (3.2.x, 3.3.x, etc.) 28 | dnl MINOR_VERSION Minor release version (3.3.0, 3.3.1, etc.) 29 | dnl MAINT_VERSION Pure bugfix additions to make maintenance release 30 | dnl 31 | dnl The last two fields can have 'git' instead of a number to indicate 32 | dnl that this branch is between versions. 33 | . $srcdir/version.sh 34 | 35 | dnl Get git version if available 36 | GR_GIT 37 | 38 | dnl Test if we should use git version 39 | if test "$MINOR_VERSION" == "git"; then 40 | dnl RELEASE: 3.3git-xxx-gxxxxxxxx 41 | dnl DOCVER: 3.3git 42 | dnl LIBVER: 3.3git 43 | RELEASE=$GIT_DESCRIBE 44 | DOCVER=$MAJOR_VERSION.$API_COMPAT$MINOR_VERSION 45 | LIBVER=$MAJOR_VERSION.$API_COMPAT$MINOR_VERSION 46 | else 47 | if test "$MAINT_VERSION" == "git" ; then 48 | dnl RELEASE: 3.3.1git-xxx-gxxxxxxxx 49 | dnl DOCVER: 3.3.1git 50 | dnl LIBVER: 3.3.1git 51 | RELEASE=$GIT_DESCRIBE 52 | DOCVER=$MAJOR_VERSION.$API_COMPAT.$MINOR_VERSION$MAINT_VERSION 53 | LIBVER=$MAJOR_VERSION.$API_COMPAT.$MINOR_VERSION$MAINT_VERSION 54 | else 55 | dnl This is a numbered release. 56 | dnl RELEASE: 3.3.1{.x} 57 | dnl DOCVER: 3.3.1{.x} 58 | dnl LIBVER: 3.3.1{.x} 59 | RELEASE=$MAJOR_VERSION.$API_COMPAT.$MINOR_VERSION 60 | if test "$MAINT_VERSION" != "0"; then 61 | RELEASE=$RELEASE.$MAINT_VERSION 62 | fi 63 | 64 | DOCVER=$RELEASE 65 | LIBVER=$RELEASE 66 | fi 67 | fi 68 | 69 | AC_MSG_NOTICE([GNU Radio Release $RELEASE]) 70 | AC_SUBST(RELEASE) 71 | AC_SUBST(DOCVER) 72 | AC_SUBST(LIBVER) 73 | ]) 74 | -------------------------------------------------------------------------------- /vrt/m4/gr_lib64.m4: -------------------------------------------------------------------------------- 1 | dnl 2 | dnl Copyright 2005,2008 Free Software Foundation, Inc. 3 | dnl 4 | dnl This file is part of GNU Radio 5 | dnl 6 | dnl GNU Radio is free software; you can redistribute it and/or modify 7 | dnl it under the terms of the GNU General Public License as published by 8 | dnl the Free Software Foundation; either version 3, or (at your option) 9 | dnl any later version. 10 | dnl 11 | dnl GNU Radio is distributed in the hope that it will be useful, 12 | dnl but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | dnl GNU General Public License for more details. 15 | dnl 16 | dnl You should have received a copy of the GNU General Public License 17 | dnl along with GNU Radio; see the file COPYING. If not, write to 18 | dnl the Free Software Foundation, Inc., 51 Franklin Street, 19 | dnl Boston, MA 02110-1301, USA. 20 | dnl 21 | 22 | dnl GR_LIB64() 23 | dnl 24 | dnl Checks to see if we're on a x86_64 or powerpc64 machine, and if so, determine 25 | dnl if libdir should end in "64" or not. 26 | dnl 27 | dnl Sets gr_libdir_suffix to "" or "64" and calls AC_SUBST(gr_libdir_suffix) 28 | dnl May append "64" to libdir. 29 | dnl 30 | dnl The current heuristic is: 31 | dnl if the host_cpu isn't x86_64 or powerpc64, then "" 32 | dnl if the host_os isn't linux, then "" 33 | dnl if we're cross-compiling, ask the linker, by way of the selected compiler 34 | dnl if we're x86_64 and there's a /lib64 and it's not a symlink, then "64", else "" 35 | dnl else ask the compiler 36 | dnl 37 | AC_DEFUN([GR_LIB64],[ 38 | AC_REQUIRE([AC_CANONICAL_HOST]) 39 | AC_REQUIRE([AC_PROG_CXX]) 40 | 41 | AC_MSG_CHECKING([gr_libdir_suffix]) 42 | gr_libdir_suffix="" 43 | AC_SUBST(gr_libdir_suffix) 44 | 45 | case "$host_os" in 46 | linux*) is_linux=yes ;; 47 | *) is_linux=no ;; 48 | esac 49 | 50 | if test "$is_linux" = no || test "$host_cpu" != "x86_64" && test "$host_cpu" != "powerpc64"; then 51 | gr_libdir_suffix="" 52 | elif test "$cross_compiling" = yes; then 53 | _GR_LIB64_ASK_COMPILER 54 | elif test "$host_cpu" = "x86_64"; then 55 | if test -d /lib64 && test ! -L /lib64; then 56 | gr_libdir_suffix=64 57 | fi 58 | else 59 | _GR_LIB64_ASK_COMPILER 60 | fi 61 | AC_MSG_RESULT([$gr_libdir_suffix]) 62 | 63 | 64 | AC_MSG_CHECKING([whether to append 64 to libdir]) 65 | t=${libdir##*/lib} 66 | if test "$t" != 64 && test "$gr_libdir_suffix" = "64"; then 67 | libdir=${libdir}64 68 | AC_MSG_RESULT([yes. Setting libdir to $libdir]) 69 | else 70 | AC_MSG_RESULT([no]) 71 | fi 72 | ]) 73 | 74 | dnl If we're using g++, extract the first SEARCH_DIR("...") entry from the linker script 75 | dnl and see if it contains a suffix after the final .../lib part of the path. 76 | dnl (This works because the linker script varies depending on whether we're generating 77 | dnl 32-bit or 64-bit executables) 78 | dnl 79 | AC_DEFUN([_GR_LIB64_ASK_COMPILER],[ 80 | if test "$ac_cv_cxx_compiler_gnu" = "yes"; 81 | then 82 | gr_libdir_suffix=`$CXX -Wl,--verbose 2>/dev/null | sed -n -e '/SEARCH_DIR/{s/;.*$//; s,^.*/,,; s/".*$//; s/^lib//; p}'` 83 | fi 84 | ]) 85 | 86 | -------------------------------------------------------------------------------- /vrt/include/vrt/rx.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2009 Free Software Foundation, Inc. 4 | * 5 | * This file is part of GNU Radio 6 | * 7 | * GNU Radio is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 3, or (at your option) 10 | * any later version. 11 | * 12 | * GNU Radio is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 20 | */ 21 | #ifndef INCLUDED_VRT_RX_H 22 | #define INCLUDED_VRT_RX_H 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | namespace vrt { 29 | 30 | class socket_rx_buffer; 31 | 32 | /*! 33 | * Relatively low-level interface to receive VRT packets over a datagram socket. 34 | * 35 | * (We'll refactor this if/when we use a non-UDP transport.) 36 | * No VRT control issues are addressed here. 37 | */ 38 | class rx : boost::noncopyable 39 | { 40 | int d_socket_fd; 41 | socket_rx_buffer *d_srb; 42 | 43 | public: 44 | /*! 45 | * Shared pointer to this class 46 | */ 47 | typedef boost::shared_ptr sptr; 48 | 49 | /*! 50 | * \brief Static function to return an instance of rx as a shared pointer. 51 | * 52 | * \param socket_fd file descriptor that data grams will be received from. 53 | * It is assumed that some higher-level control software 54 | * opened the appropriate UDP socket for us. This object 55 | * assumes management of the socket's lifetime. The 56 | * socket will be closed when our destructor fires. 57 | * 58 | * \param rx_bufsize is a hint as to the number of bytes of memory 59 | * to allocate for received ethernet frames (0 -> reasonable default) 60 | */ 61 | static sptr make(int socket_fd, size_t rx_bufsize = 0); 62 | 63 | /*! 64 | * \param socket_fd file descriptor that data grams will be received from. 65 | * It is assumed that some higher-level control software 66 | * opened the appropriate UDP socket for us. This object 67 | * assumes management of the socket's lifetime. The 68 | * socket will be closed when our destructor fires. 69 | * 70 | * \param rx_bufsize is a hint as to the number of bytes of memory 71 | * to allocate for received ethernet frames (0 -> reasonable default) 72 | */ 73 | rx(int socket_fd, size_t rx_bufsize = 0); 74 | ~rx(); 75 | 76 | /*! 77 | * \brief Receive packets from the given socket file descriptor. 78 | * 79 | * \p handler will be invoked for all available packets. 80 | * Unless \p dont_wait is true, this function blocks until at 81 | * least one packet has been processed. 82 | */ 83 | bool rx_packets(rx_packet_handler *handler, bool dont_wait = false); 84 | 85 | /* 86 | * \returns the socket_fd. Useful for select or poll. 87 | */ 88 | int socket_fd() const { return d_socket_fd; } 89 | }; 90 | 91 | } 92 | 93 | #endif /* INCLUDED_VRT_RX_H */ 94 | -------------------------------------------------------------------------------- /vrt/lib/socket_rx_buffer.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2008,2009,2010 Free Software Foundation, Inc. 4 | * 5 | * This file is part of GNU Radio 6 | * 7 | * GNU Radio is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 3, or (at your option) 10 | * any later version. 11 | * 12 | * GNU Radio is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 20 | */ 21 | #ifndef INCLUDED_VRT_SOCKET_RX_BUFFER_H 22 | #define INCLUDED_VRT_SOCKET_RX_BUFFER_H 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | namespace vrt { 30 | 31 | class data_handler; 32 | 33 | /*! 34 | * \brief high-performance interface to receive datagrams 35 | * 36 | * On many systems it should be possible to implement this on top of libpcap 37 | * 38 | * \internal 39 | */ 40 | class socket_rx_buffer : boost::noncopyable 41 | { 42 | 43 | int d_fd; // socket file descriptor 44 | 45 | bool open(size_t buflen); 46 | bool close(); 47 | 48 | public: 49 | 50 | enum result { 51 | EB_OK, //< everything's fine 52 | EB_ERROR, //< A non-recoverable error occurred 53 | EB_WOULD_BLOCK, //< A timeout of 0 was specified and nothing was ready 54 | EB_TIMED_OUT, //< The timeout expired before anything was ready 55 | }; 56 | 57 | static const unsigned int MAX_PKTLEN; 58 | 59 | /*! 60 | * \param socket_fd file descriptor that corresponds to a socket 61 | * \param rx_bufsize is a hint as to the number of bytes of memory 62 | * to allocate for received ethernet frames (0 -> reasonable default) 63 | */ 64 | socket_rx_buffer(int socket_fd, size_t rx_bufsize = 0); 65 | ~socket_rx_buffer(); 66 | 67 | /*! 68 | * \brief Call \p f for each frame in the receive buffer. 69 | * \param f is the frame data handler 70 | * \param timeout (in ms) controls behavior when there are no frames to read 71 | * 72 | * If \p timeout is 0, rx_frames will not wait for frames if none are 73 | * available, and f will not be invoked. If \p timeout is -1 (the 74 | * default), rx_frames will block indefinitely until frames are 75 | * available. If \p timeout is positive, it indicates the number of 76 | * milliseconds to wait for a frame to become available. Once the 77 | * timeout has expired, rx_frames will return, f never having been 78 | * invoked. 79 | * 80 | * \p f will be called on each frame that is available. 81 | * \p f returns a bool. If false, return from rx_frames now even 82 | * though more frames may be available; if true, continue if 83 | * more frames are ready. 84 | * 85 | * \returns EB_OK if at least one frame was received 86 | * \returns EB_WOULD_BLOCK if \p timeout is 0 and the call would have blocked 87 | * \returns EB_TIMED_OUT if timeout occurred 88 | * \returns EB_ERROR if there was an unrecoverable error. 89 | */ 90 | result rx_frames(data_handler *f, int timeout=-1); 91 | }; 92 | 93 | }; // namespace vrt 94 | 95 | #endif /* INCLUDED_VRT_SOCKET_RX_BUFFER_H */ 96 | -------------------------------------------------------------------------------- /vrt/lib/rx.cc: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2009,2010 Free Software Foundation, Inc. 4 | * 5 | * This file is part of GNU Radio 6 | * 7 | * GNU Radio is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 3, or (at your option) 10 | * any later version. 11 | * 12 | * GNU Radio is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 20 | */ 21 | #ifdef HAVE_CONFIG_H 22 | #include 23 | #endif 24 | #include 25 | #include 26 | #include "socket_rx_buffer.h" 27 | #include "data_handler.h" 28 | #include 29 | #include 30 | #include 31 | 32 | static void 33 | print_words(FILE *fp, size_t offset, const uint32_t *buf, size_t n) 34 | { 35 | size_t i; 36 | for (i = 0; i < n; i++){ 37 | if (i % 4 == 0){ 38 | fprintf(fp, "%04zx:", i); 39 | } 40 | 41 | putc(' ', fp); 42 | fprintf(fp, "%08x", buf[i]); 43 | if (i % 4 == 3) 44 | putc('\n', fp); 45 | } 46 | 47 | putc('\n', fp); 48 | } 49 | 50 | 51 | 52 | namespace vrt { 53 | 54 | rx::sptr 55 | rx::make(int socket_fd, size_t rx_bufsize) 56 | { 57 | return sptr(new rx(socket_fd, rx_bufsize)); 58 | } 59 | 60 | rx::rx(int socket_fd, size_t rx_bufsize) 61 | : d_socket_fd(socket_fd), 62 | d_srb(new socket_rx_buffer(socket_fd, rx_bufsize)) 63 | { 64 | } 65 | 66 | rx::~rx() 67 | { 68 | delete d_srb; 69 | ::close(d_socket_fd); 70 | } 71 | 72 | 73 | class vrt_data_handler : public data_handler 74 | { 75 | rx_packet_handler *d_handler; 76 | 77 | public: 78 | vrt_data_handler(rx_packet_handler *handler) 79 | : d_handler(handler){} 80 | 81 | ~vrt_data_handler(); 82 | 83 | bool operator()(const void *base, size_t len); 84 | }; 85 | 86 | vrt_data_handler::~vrt_data_handler(){} 87 | 88 | // N.B., There may be more than 1 VRT packet in a frame (usually IF-Context packets) 89 | bool 90 | vrt_data_handler::operator()(const void *base, size_t len) 91 | { 92 | const uint32_t *word_base = (const uint32_t *) base; 93 | size_t word_len = len/(sizeof(uint32_t)); 94 | 95 | bool want_more = true; 96 | while (word_len > 0 && want_more){ 97 | const uint32_t *payload; 98 | size_t n32_bit_words; 99 | expanded_header hdr; 100 | if (!expanded_header::unpack(word_base, word_len, 101 | &hdr, &payload, &n32_bit_words)){ 102 | if (1){ 103 | fprintf(stderr, "vrt_data_handler: malformed VRT packet!\n"); 104 | print_words(stderr, 0, word_base, word_len); 105 | } 106 | return true; 107 | } 108 | want_more = (*d_handler)(payload, n32_bit_words, &hdr); 109 | word_base += hdr.pkt_size(); 110 | word_len -= hdr.pkt_size(); 111 | } 112 | return want_more; 113 | } 114 | 115 | 116 | bool 117 | rx::rx_packets(rx_packet_handler *handler, bool dont_wait) 118 | { 119 | vrt_data_handler h(handler); 120 | socket_rx_buffer::result r = d_srb->rx_frames(&h, dont_wait ? 0 : -1); 121 | return r == socket_rx_buffer::EB_OK || r == socket_rx_buffer::EB_WOULD_BLOCK; 122 | } 123 | 124 | }; // vrt 125 | -------------------------------------------------------------------------------- /vrt/m4/ax_boost_python.m4: -------------------------------------------------------------------------------- 1 | # =========================================================================== 2 | # http://autoconf-archive.cryp.to/ax_boost_python.html 3 | # =========================================================================== 4 | # 5 | # SYNOPSIS 6 | # 7 | # AX_BOOST_PYTHON 8 | # 9 | # DESCRIPTION 10 | # 11 | # This macro checks to see if the Boost.Python library is installed. It 12 | # also attempts to guess the currect library name using several attempts. 13 | # It tries to build the library name using a user supplied name or suffix 14 | # and then just the raw library. 15 | # 16 | # If the library is found, HAVE_BOOST_PYTHON is defined and 17 | # BOOST_PYTHON_LIB is set to the name of the library. 18 | # 19 | # This macro calls AC_SUBST(BOOST_PYTHON_LIB). 20 | # 21 | # In order to ensure that the Python headers are specified on the include 22 | # path, this macro requires AX_PYTHON to be called. 23 | # 24 | # LAST MODIFICATION 25 | # 26 | # 2008-04-12 27 | # 28 | # COPYLEFT 29 | # 30 | # Copyright (c) 2008 Michael Tindal 31 | # 32 | # This program is free software; you can redistribute it and/or modify it 33 | # under the terms of the GNU General Public License as published by the 34 | # Free Software Foundation; either version 2 of the License, or (at your 35 | # option) any later version. 36 | # 37 | # This program is distributed in the hope that it will be useful, but 38 | # WITHOUT ANY WARRANTY; without even the implied warranty of 39 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 40 | # Public License for more details. 41 | # 42 | # You should have received a copy of the GNU General Public License along 43 | # with this program. If not, see . 44 | # 45 | # As a special exception, the respective Autoconf Macro's copyright owner 46 | # gives unlimited permission to copy, distribute and modify the configure 47 | # scripts that are the output of Autoconf when processing the Macro. You 48 | # need not follow the terms of the GNU General Public License when using 49 | # or distributing such scripts, even though portions of the text of the 50 | # Macro appear in them. The GNU General Public License (GPL) does govern 51 | # all other use of the material that constitutes the Autoconf Macro. 52 | # 53 | # This special exception to the GPL applies to versions of the Autoconf 54 | # Macro released by the Autoconf Macro Archive. When you make and 55 | # distribute a modified version of the Autoconf Macro, you may extend this 56 | # special exception to the GPL to apply to your modified version as well. 57 | 58 | AC_DEFUN([AX_BOOST_PYTHON], 59 | [AC_REQUIRE([AX_PYTHON])dnl 60 | AC_CACHE_CHECK(whether the Boost::Python library is available, 61 | ac_cv_boost_python, 62 | [AC_LANG_SAVE 63 | AC_LANG_CPLUSPLUS 64 | CPPFLAGS_SAVE=$CPPFLAGS 65 | if test x$PYTHON_INCLUDE_DIR != x; then 66 | CPPFLAGS=-I$PYTHON_INCLUDE_DIR $CPPFLAGS 67 | fi 68 | AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[ 69 | #include 70 | using namespace boost::python; 71 | BOOST_PYTHON_MODULE(test) { throw "Boost::Python test."; }]], 72 | [[return 0;]]), 73 | ac_cv_boost_python=yes, ac_cv_boost_python=no) 74 | AC_LANG_RESTORE 75 | CPPFLAGS=$CPPFLAGS_SAVE 76 | ]) 77 | if test "$ac_cv_boost_python" = "yes"; then 78 | AC_LANG_PUSH([C++]) 79 | AC_DEFINE(HAVE_BOOST_PYTHON,,[define if the Boost::Python library is available]) 80 | ax_python_lib=boost_python 81 | AC_ARG_WITH([boost-python],AS_HELP_STRING([--with-boost-python],[specify the boost python library or suffix to use]), 82 | [if test "x$with_boost_python" != "xno"; then 83 | ax_python_lib=$with_boost_python 84 | ax_boost_python_lib=boost_python-$with_boost_python 85 | fi]) 86 | for ax_lib in $ax_python_lib $ax_boost_python_lib boost_python; do 87 | AC_CHECK_LIB($ax_lib, exit, [BOOST_PYTHON_LIB=$ax_lib break]) 88 | done 89 | AC_SUBST(BOOST_PYTHON_LIB) 90 | AC_LANG_POP([C++]) 91 | fi 92 | ])dnl 93 | -------------------------------------------------------------------------------- /vrt/m4/lf_warnings.m4: -------------------------------------------------------------------------------- 1 | dnl Copyright (C) 1988 Eleftherios Gkioulekas 2 | dnl Copyright (C) 2009 Free Software Foundation, Inc. 3 | dnl 4 | dnl This program is free software; you can redistribute it and/or modify 5 | dnl it under the terms of the GNU General Public License as published by 6 | dnl the Free Software Foundation; either version 3 of the License, or 7 | dnl (at your option) any later version. 8 | dnl 9 | dnl This program is distributed in the hope that it will be useful, 10 | dnl but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | dnl GNU General Public License for more details. 13 | dnl 14 | dnl You should have received a copy of the GNU General Public License 15 | dnl along with this program; if not, write to the Free Software 16 | dnl Foundation, Inc., 51 Franklin Street, Boston, MA 02110-1301, USA. 17 | dnl 18 | dnl As a special exception to the GNU General Public License, if you 19 | dnl distribute this file as part of a program that contains a configuration 20 | dnl script generated by Autoconf, you may include it under the same 21 | dnl distribution terms that you use for the rest of that program. 22 | 23 | # -------------------------------------------------------------------------- 24 | # Check whether the C++ compiler accepts a certain flag 25 | # If it does it adds the flag to lf_CXXFLAGS 26 | # If it does not then it returns an error to lf_ok 27 | # Usage: 28 | # LF_CHECK_CXX_FLAG(-flag1 -flag2 -flag3 ...) 29 | # ------------------------------------------------------------------------- 30 | 31 | AC_DEFUN([LF_CHECK_CXX_FLAG],[ 32 | echo 'void f(){}' > conftest.cc 33 | for i in $1 34 | do 35 | AC_MSG_CHECKING([whether $CXX accepts $i]) 36 | if test -z "`${CXX} $i -c conftest.cc 2>&1`" 37 | then 38 | lf_CXXFLAGS="${lf_CXXFLAGS} $i" 39 | AC_MSG_RESULT(yes) 40 | else 41 | AC_MSG_RESULT(no) 42 | fi 43 | done 44 | rm -f conftest.cc conftest.o 45 | AC_SUBST(lf_CXXFLAGS) 46 | ]) 47 | 48 | # -------------------------------------------------------------------------- 49 | # Check whether the C compiler accepts a certain flag 50 | # If it does it adds the flag to lf_CFLAGS 51 | # If it does not then it returns an error to lf_ok 52 | # Usage: 53 | # LF_CHECK_CC_FLAG(-flag1 -flag2 -flag3 ...) 54 | # ------------------------------------------------------------------------- 55 | 56 | AC_DEFUN([LF_CHECK_CC_FLAG],[ 57 | echo 'void f(){}' > conftest.c 58 | for i in $1 59 | do 60 | AC_MSG_CHECKING([whether $CC accepts $i]) 61 | if test -z "`${CC} $i -c conftest.c 2>&1`" 62 | then 63 | lf_CFLAGS="${lf_CFLAGS} $i" 64 | AC_MSG_RESULT(yes) 65 | else 66 | AC_MSG_RESULT(no) 67 | fi 68 | done 69 | rm -f conftest.c conftest.o 70 | AC_SUBST(lf_CFLAGS) 71 | ]) 72 | 73 | # -------------------------------------------------------------------------- 74 | # Check whether the Fortran compiler accepts a certain flag 75 | # If it does it adds the flag to lf_FFLAGS 76 | # If it does not then it returns an error to lf_ok 77 | # Usage: 78 | # LF_CHECK_F77_FLAG(-flag1 -flag2 -flag3 ...) 79 | # ------------------------------------------------------------------------- 80 | 81 | AC_DEFUN([LF_CHECK_F77_FLAG],[ 82 | cat << EOF > conftest.f 83 | c....:++++++++++++++++++++++++ 84 | PROGRAM MAIN 85 | PRINT*,'Hello World!' 86 | END 87 | EOF 88 | for i in $1 89 | do 90 | AC_MSG_CHECKING([whether $F77 accepts $i]) 91 | if test -z "`${F77} $i -c conftest.f 2>&1`" 92 | then 93 | lf_FFLAGS="${lf_FFLAGS} $i" 94 | AC_MSG_RESULT(yes) 95 | else 96 | AC_MSG_RESULT(no) 97 | fi 98 | done 99 | rm -f conftest.f conftest.o 100 | AC_SUBST(lf_FFLAGS) 101 | ]) 102 | 103 | # ---------------------------------------------------------------------- 104 | # Enable compiler warnings. 105 | # Call this command AFTER you have configured ALL your compilers. 106 | # ---------------------------------------------------------------------- 107 | 108 | AC_DEFUN([LF_SET_WARNINGS],[ 109 | dnl Warnings for the two main compilers 110 | dnl add -Wextra when you're got time to fix a bunch of them ;-) 111 | cc_warning_flags="-Wall -Werror-implicit-function-declaration" 112 | cxx_warning_flags="-Wall -Woverloaded-virtual" 113 | if test -n "${CC}" 114 | then 115 | LF_CHECK_CC_FLAG($cc_warning_flags) 116 | fi 117 | if test -n "${CXX}" 118 | then 119 | LF_CHECK_CXX_FLAG($cxx_warning_flags) 120 | fi 121 | ]) 122 | -------------------------------------------------------------------------------- /vrt/include/vrt/expanded_if_context_section.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2010 Free Software Foundation, Inc. 4 | * 5 | * This file is part of GNU Radio 6 | * 7 | * GNU Radio is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 3, or (at your option) 10 | * any later version. 11 | * 12 | * GNU Radio is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 20 | */ 21 | #ifndef INCLUDED_VRT_EXPANDED_IF_CONTEXT_SECTION_H 22 | #define INCLUDED_VRT_EXPANDED_IF_CONTEXT_SECTION_H 23 | 24 | /*! 25 | * Expanded (unpacked) version of Context Section, defined in VRT section 7.1.5 26 | */ 27 | 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | 35 | 36 | namespace vrt { 37 | 38 | //! Expanded GPS ASCII field 39 | struct exp_gps_ascii { 40 | uint32_t manuf_oui; // GSP/INS Manufacturer OUI 41 | std::string ascii; 42 | }; 43 | 44 | //! Expanded Context Association Lists 45 | struct exp_context_assocs { 46 | std::vector source; // stream-ids 47 | std::vector system; // stream-ids 48 | std::vector vector_comp; // stream-ids 49 | std::vector async_channel;// stream-ids 50 | std::vector async_tag; // channel tags 51 | }; 52 | 53 | /*! 54 | * \brief Expanded (unpacked) version of the contents of an 55 | * IF-Context packet's Context Section, as defined in VRT section 7.1.5 56 | * 57 | * There are fields allocated for each possible field. Their 58 | * content may or may not be valid. Check the context_indicator 59 | * field to determinte their validity. If the associated CI_* bit 60 | * is set the corresponding field is valid. 61 | * 62 | * All values are in host-endian format. 63 | */ 64 | struct expanded_if_context_section { 65 | uint32_t context_indicator; //< 7.1.5.1 66 | // 7.1.5.2 (no field) 67 | uint32_t ref_point_id; //< 7.1.5.3 68 | vrt_hertz_t bandwidth; //< 7.1.5.4 69 | vrt_hertz_t if_ref_freq; //< 7.1.5.5 70 | vrt_hertz_t rf_ref_freq; //< 7.1.5.6 71 | vrt_hertz_t rf_ref_freq_offset; //< 7.1.5.7 72 | vrt_hertz_t if_band_offset; //< 7.1.5.8 73 | vrt_db_t ref_level; //< 7.1.5.9 (dBm) 74 | vrt_gain_t gain; //< 7.1.5.10 75 | uint32_t over_range_count; //< 7.1.5.11 76 | vrt_hertz_t sample_rate; //< 7.1.5.12 77 | int64_t timestamp_adj; //< 7.1.5.13 (picoseconds) 78 | uint32_t timestamp_cal_time; //< 7.1.5.14 (TSI seconds) 79 | vrt_temp_t temperature; //< 7.1.5.15 80 | uint32_t device_id[2]; //< 7.1.5.16 (0: OUI; 1: dev code) 81 | uint32_t state_and_event_ind; //< 7.1.5.17 82 | vrt_payload_fmt_t payload_fmt; //< 7.1.5.18 83 | vrt_formatted_gps_t formatted_gps; //< 7.1.5.19 84 | vrt_formatted_gps_t formatted_ins; //< 7.1.5.20 85 | vrt_ephemeris_t ecef_ephemeris; //< 7.1.5.21 86 | vrt_ephemeris_t rel_ephemeris; //< 7.1.5.22 87 | int32_t ephemeris_ref_id; //< 7.1.5.23 88 | exp_gps_ascii gps_ascii; //< 7.1.5.24 89 | exp_context_assocs cntx_assoc_lists;//< 7.1.5.25 90 | 91 | // Reset struct, empty all containers. 92 | void clear(); 93 | 94 | /*! 95 | * \brief Unpack IF Context section into expanded_if_context_section 96 | * 97 | * \param[in] context_section points to the context section of the raw IF Context pkt. 98 | * \param[in] n32_bit_words is the length of the context_section. 99 | * \param[out] cntx holds the result of unpacking the information found in context_section. 100 | * 101 | * \Returns true iff context_section is successfully parsed. 102 | */ 103 | static bool unpack(const uint32_t *context_section, // in 104 | size_t n32_bit_words, // in 105 | expanded_if_context_section *cntx); // out 106 | 107 | /*! 108 | * Write a written representation to the given \p port. 109 | */ 110 | void write(std::ostream &port) const; 111 | 112 | }; 113 | 114 | std::ostream& operator<<(std::ostream &os, const expanded_if_context_section &obj); 115 | 116 | }; // namespace vrt 117 | 118 | #endif /* INCLUDED_VRT_EXPANDED_IF_CONTEXT_SECTION_H */ 119 | -------------------------------------------------------------------------------- /vrt/include/vrt/expanded_header.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2009 Free Software Foundation, Inc. 4 | * 5 | * This file is part of GNU Radio 6 | * 7 | * GNU Radio is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 3, or (at your option) 10 | * any later version. 11 | * 12 | * GNU Radio is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 20 | */ 21 | #ifndef INCLUDED_VRT_EXPANDED_HEADER_H 22 | #define INCLUDED_VRT_EXPANDED_HEADER_H 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | namespace vrt { 30 | 31 | static const size_t HEADER_MAX_N32_BIT_WORDS = 7; 32 | static const size_t TRAILER_MAX_N32_BIT_WORDS = 1; 33 | 34 | /*! 35 | * \brief All headers and trailer for VRT IF-Data, Extension-Data, 36 | * IF-Context and Extension-Context packets. 37 | * 38 | * There are fields allocated for each possible header. Their content may 39 | * or may not be valid. Check the header field to confirm their validity. 40 | * All values are in host-endian format. 41 | */ 42 | struct expanded_header { 43 | uint32_t header; // first word of all packets 44 | uint32_t stream_id; // optional stream identifier 45 | uint64_t class_id; // optional class identifier 46 | uint32_t integer_secs; // optional integer seconds timestamp 47 | uint64_t fractional_secs; // optional fractional seconds timestamp 48 | uint32_t trailer; // optional trailer (only possible in data pkts) 49 | 50 | expanded_header() 51 | : header(0) /*, stream_id(0), class_id(0), 52 | integer_secs(0), fractional_secs(0), trailer(0)*/ {} 53 | 54 | 55 | int pkt_type() const { 56 | return (header & VRTH_PT_MASK) >> 28; 57 | } 58 | 59 | int pkt_cnt() const { return vrth_pkt_cnt(header); } 60 | size_t pkt_size() const { return vrth_pkt_size(header); } 61 | 62 | 63 | // packet type predicates 64 | bool if_data_p() const { return s_if_data[pkt_type()]; } 65 | bool ext_data_p() const { return s_ext_data[pkt_type()]; } 66 | bool if_context_p() const { return (header & VRTH_PT_MASK) == VRTH_PT_IF_CONTEXT; } 67 | bool ext_context_p() const { return (header & VRTH_PT_MASK) == VRTH_PT_EXT_CONTEXT; } 68 | 69 | bool data_p() const { return s_data[pkt_type()]; } // if_data_p() || ext_data_p() 70 | bool context_p() const { return s_context[pkt_type()]; } // if_context_p() || ext_context_p() 71 | 72 | // optional info predicates 73 | bool stream_id_p() const { return s_stream_id[pkt_type()]; } 74 | bool class_id_p() const { return (header & VRTH_HAS_CLASSID) != 0; } 75 | bool integer_secs_p() const { return (header & VRTH_TSI_MASK) != 0; } 76 | bool fractional_secs_p() const { return (header & VRTH_TSF_MASK) != 0; } 77 | bool trailer_p() const { return (header & VRTH_HAS_TRAILER) != 0 && data_p(); } 78 | 79 | 80 | /*! 81 | * \brief Given contents of expanded_header, fill in the words of 82 | * the corresponding vrt packet header and trailer. 83 | * 84 | * This method only fills the buffers with header and trailer 85 | * information. The actual handling of the separate header, 86 | * payload, trailer buffers is up to the caller. 87 | */ 88 | static void pack(const expanded_header *hdr, // in 89 | size_t n32_bit_words_payload, // in 90 | uint32_t *header, // out 91 | size_t *n32_bit_words_header, // out 92 | uint32_t *trailer, // out 93 | size_t *n32_bit_words_trailer);// out 94 | 95 | /*! 96 | * \brief unpack vrt packet header into expanded_header, start of 97 | * payload and len of payload 98 | */ 99 | static bool unpack(const uint32_t *packet, // in 100 | size_t n32_bit_words_packet, // in 101 | expanded_header *hdr, // out 102 | const uint32_t **payload, // out 103 | size_t *n32_bit_words_payload); // out 104 | 105 | /*! 106 | * Write a written representation to the given \p port. 107 | */ 108 | void write(std::ostream &port) const; 109 | 110 | 111 | private: 112 | static unsigned char s_if_data[16]; 113 | static unsigned char s_ext_data[16]; 114 | static unsigned char s_data[16]; 115 | static unsigned char s_context[16]; 116 | static unsigned char s_stream_id[16]; 117 | 118 | }; 119 | 120 | std::ostream& operator<<(std::ostream &os, const expanded_header &obj); 121 | 122 | }; // vrt 123 | 124 | 125 | #endif /* INCLUDED_VRT_EXPANDED_HEADER_H */ 126 | -------------------------------------------------------------------------------- /vrt/configure.ac: -------------------------------------------------------------------------------- 1 | dnl 2 | dnl Copyright 2010 Free Software Foundation, Inc. 3 | dnl 4 | dnl This program is free software: you can redistribute it and/or modify 5 | dnl it under the terms of the GNU General Public License as published by 6 | dnl the Free Software Foundation, either version 3 of the License, or 7 | dnl (at your option) any later version. 8 | dnl 9 | dnl This program is distributed in the hope that it will be useful, 10 | dnl but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | dnl GNU General Public License for more details. 13 | dnl 14 | dnl You should have received a copy of the GNU General Public License 15 | dnl along with this program. If not, see . 16 | dnl 17 | 18 | AC_INIT 19 | AC_PREREQ(2.61) 20 | AM_CONFIG_HEADER(config.h) 21 | AC_CONFIG_SRCDIR([include/vrt/expanded_if_context_section.h]) 22 | 23 | AC_CANONICAL_BUILD 24 | AC_CANONICAL_HOST 25 | AC_CANONICAL_TARGET 26 | 27 | GR_VERSION 28 | dnl ustar required to have pathnames > 99 chars 29 | _AM_SET_OPTION([tar-ustar]) 30 | dnl AM_INIT_AUTOMAKE(vrt,$RELEASE) 31 | AM_INIT_AUTOMAKE(vrt,1.0.0) 32 | 33 | dnl Remember if the user explicity set CFLAGS 34 | if test -n "${CFLAGS}"; then 35 | user_set_cflags=yes 36 | fi 37 | dnl Remember if the user explicity set CXXFLAGS 38 | if test -n "${CXXFLAGS}"; then 39 | user_set_cxxflags=yes 40 | fi 41 | 42 | 43 | LF_CONFIGURE_CC 44 | LF_CONFIGURE_CXX 45 | GR_LIB64 dnl check for lib64 suffix after choosing compilers 46 | 47 | dnl define WORDS_BIGENDIAN if needed 48 | AC_C_BIGENDIAN 49 | 50 | 51 | dnl The three macros above are known to override CFLAGS if the user 52 | dnl didn't specify them. Though I'm sure somebody thought this was 53 | dnl a good idea, it makes it hard to use other than -g -O2 when compiling 54 | dnl selected files. Thus we "undo" the damage here... 55 | dnl 56 | dnl If the user specified CFLAGS, we use them. 57 | dnl See Makefile.common for the rest of the magic. 58 | if test "$user_set_cflags" != yes; then 59 | autoconf_default_CFLAGS="$CFLAGS" 60 | CFLAGS="" 61 | fi 62 | AC_SUBST(autoconf_default_CFLAGS) 63 | 64 | 65 | dnl The three macros above are known to override CXXFLAGS if the user 66 | dnl didn't specify them. Though I'm sure somebody thought this was 67 | dnl a good idea, it makes it hard to use other than -g -O2 when compiling 68 | dnl selected files. Thus we "undo" the damage here... 69 | dnl 70 | dnl If the user specified CXXFLAGS, we use them. Otherwise when compiling 71 | dnl the output of swig use use -O1 if we're using g++. 72 | dnl See Makefile.common for the rest of the magic. 73 | if test "$user_set_cxxflags" != yes; then 74 | autoconf_default_CXXFLAGS="$CXXFLAGS" 75 | CXXFLAGS="" 76 | if test "$GXX" = yes; then 77 | case "$host_cpu" in 78 | powerpc*) 79 | dnl "-O1" is broken on the PPC for some reason 80 | dnl (at least as of g++ 4.1.1) 81 | swig_CXXFLAGS="-g1 -O2 -Wno-strict-aliasing -Wno-parentheses" 82 | ;; 83 | *) 84 | swig_CXXFLAGS="-g -O1 -Wno-strict-aliasing -Wno-parentheses" 85 | ;; 86 | esac 87 | fi 88 | fi 89 | AC_SUBST(autoconf_default_CXXFLAGS) 90 | AC_SUBST(swig_CXXFLAGS) 91 | 92 | 93 | LF_SET_WARNINGS 94 | AM_PROG_AS 95 | AC_PROG_LN_S 96 | AC_PROG_MAKE_SET 97 | AC_PROG_INSTALL 98 | AC_PROG_MKDIR_P 99 | AC_PATH_PROG([RM_PROG], [rm]) 100 | 101 | AC_LIBTOOL_WIN32_DLL 102 | m4_ifdef([LT_INIT],[LT_INIT],[AC_PROG_LIBTOOL]) 103 | 104 | GR_NO_UNDEFINED dnl do we need the -no-undefined linker flag 105 | 106 | 107 | dnl We require the boost headers, thread lib and date_time lib. 108 | dnl AX_BOOST_BASE finds the headers and the lib dir (-L) 109 | dnl 110 | dnl calls AC_SUBST(BOOST_CPPFLAGS), AC_SUBST(BOOST_LDFLAGS) and defines HAVE_BOOST 111 | dnl 112 | dnl Current Boost version requirement is >=1.35 for all platforms except Darwin, 113 | dnl which requires >=1.37 for code in usrp host library. 114 | case "$host_os" in 115 | darwin*) 116 | AX_BOOST_BASE([1.37]) 117 | ;; 118 | *) 119 | AX_BOOST_BASE([1.35]) 120 | ;; 121 | esac 122 | 123 | dnl calls AC_SUBST(BOOST_THREAD_LIB), AC_SUBST(BOOST_CXXFLAGS) and defines HAVE_BOOST_THREAD 124 | dnl AX_BOOST_THREAD 125 | dnl CXXFLAGS="$CXXFLAGS $BOOST_CXXFLAGS" dnl often picks up a -pthread or something similar 126 | dnl CFLAGS="$CFLAGS $BOOST_CXXFLAGS" dnl often picks up a -pthread or something similar 127 | 128 | dnl 129 | dnl all the rest of these call AC_SUBST(BOOST__LIB) and define HAVE_BOOST_ 130 | dnl 131 | dnl AX_BOOST_DATE_TIME 132 | dnl AX_BOOST_FILESYSTEM 133 | dnl AX_BOOST_IOSTREAMS 134 | AX_BOOST_PROGRAM_OPTIONS 135 | dnl AX_BOOST_REGEX 136 | dnl AX_BOOST_SERIALIZATION 137 | dnl AX_BOOST_SIGNALS 138 | AX_BOOST_SYSTEM 139 | dnl AX_BOOST_TEST_EXEC_MONITOR 140 | dnl AX_BOOST_UNIT_TEST_FRAMEWORK 141 | dnl AX_BOOST_WSERIALIZATION 142 | 143 | 144 | AC_CONFIG_FILES([\ 145 | Makefile 146 | m4/Makefile 147 | vrt.pc 148 | include/Makefile 149 | include/vrt/Makefile 150 | lib/Makefile 151 | apps/Makefile 152 | ]) 153 | 154 | AC_OUTPUT 155 | -------------------------------------------------------------------------------- /vrt/include/vrt/types.h: -------------------------------------------------------------------------------- 1 | /* -*- c -*- */ 2 | /* 3 | * Copyright 2009,2010 Free Software Foundation, Inc. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | #ifndef INCLUDED_VRT_TYPES_H 19 | #define INCLUDED_VRT_TYPES_H 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | #include 26 | 27 | /* macros for dealing with fixed point numbers */ 28 | #define _FXPT_C(_type, _x, _rp) ((_type)((_x)*(1LL << _rp))) 29 | #define _FXPT_TO_INT(_x, _one) (((_x) + ((_one)/2))/(_one)) 30 | #define _FXPT_TO_DOUBLE(_x, _one) ((double)(_x) * (1.0/(_one))) 31 | 32 | /* 33 | * The VRT Distance type (meters) 34 | */ 35 | typedef int32_t vrt_distance_t; 36 | #define VRT_DISTANCE_RP 5 37 | #define VRT_DISTANCE_C(_x) _FXPT_C(vrt_distance_t, _x, VRT_DISTANCE_RP) 38 | 39 | static inline vrt_distance_t 40 | double_to_vrt_distance(double num){ 41 | return VRT_DISTANCE_C(num); 42 | } 43 | 44 | static inline int32_t 45 | vrt_distance_round_to_int(vrt_distance_t fx){ 46 | return _FXPT_TO_INT(fx, VRT_DISTANCE_C(1)); 47 | } 48 | 49 | static inline double 50 | vrt_distance_to_double(vrt_distance_t fx){ 51 | return _FXPT_TO_DOUBLE(fx, VRT_DISTANCE_C(1)); 52 | } 53 | 54 | /* 55 | * The VRT Velocity type (meters/second) 56 | */ 57 | typedef int32_t vrt_velocity_t; 58 | #define VRT_VELOCITY_RP 16 59 | #define VRT_VELOCITY_C(_x) _FXPT_C(vrt_velocity_t, _x, VRT_VELOCITY_RP) 60 | 61 | static inline vrt_velocity_t 62 | double_to_vrt_velocity(double num){ 63 | return VRT_VELOCITY_C(num); 64 | } 65 | 66 | static inline int32_t 67 | vrt_velocity_round_to_int(vrt_velocity_t fx){ 68 | return _FXPT_TO_INT(fx, VRT_VELOCITY_C(1)); 69 | } 70 | 71 | static inline double 72 | vrt_velocity_to_double(vrt_velocity_t fx){ 73 | return _FXPT_TO_DOUBLE(fx, VRT_VELOCITY_C(1)); 74 | } 75 | 76 | /* 77 | * The VRT Angle type (degrees) 78 | */ 79 | typedef int32_t vrt_angle_t; 80 | #define VRT_ANGLE_RP 22 81 | #define VRT_ANGLE_C(_x) _FXPT_C(vrt_angle_t, _x, VRT_ANGLE_RP) 82 | 83 | static inline vrt_angle_t 84 | double_to_vrt_angle(double num){ 85 | return VRT_ANGLE_C(num); 86 | } 87 | 88 | static inline int16_t 89 | vrt_angle_round_to_int(vrt_angle_t fx){ 90 | return _FXPT_TO_INT(fx, VRT_ANGLE_C(1)); 91 | } 92 | 93 | static inline double 94 | vrt_angle_to_double(vrt_angle_t fx){ 95 | return _FXPT_TO_DOUBLE(fx, VRT_ANGLE_C(1)); 96 | } 97 | 98 | /* 99 | * The VRT Hertz type 100 | */ 101 | typedef int64_t vrt_hertz_t; 102 | #define VRT_HERTZ_RP 20 103 | #define VRT_HERTZ_C(_x) _FXPT_C(vrt_hertz_t, _x, VRT_HERTZ_RP) 104 | 105 | static inline vrt_hertz_t 106 | double_to_vrt_hertz(double num){ 107 | return VRT_HERTZ_C(num); 108 | } 109 | 110 | static inline int64_t 111 | vrt_hertz_round_to_int(vrt_hertz_t fx){ 112 | return _FXPT_TO_INT(fx, VRT_HERTZ_C(1)); 113 | } 114 | 115 | static inline double 116 | vrt_hertz_to_double(vrt_hertz_t fx){ 117 | return _FXPT_TO_DOUBLE(fx, VRT_HERTZ_C(1)); 118 | } 119 | 120 | /* 121 | * The VRT dB (& dBm) type 122 | */ 123 | typedef int16_t vrt_db_t; 124 | #define VRT_DB_RP 7 125 | #define VRT_DB_C(_x) _FXPT_C(vrt_db_t, _x, VRT_DB_RP) 126 | 127 | static inline vrt_db_t 128 | double_to_vrt_db(double num){ 129 | return VRT_DB_C(num); 130 | } 131 | 132 | static inline int16_t 133 | vrt_db_round_to_int(vrt_db_t fx){ 134 | return _FXPT_TO_INT(fx, VRT_DB_C(1)); 135 | } 136 | 137 | static inline double 138 | vrt_db_to_double(vrt_db_t fx){ 139 | return _FXPT_TO_DOUBLE(fx, VRT_DB_C(1)); 140 | } 141 | 142 | /* 143 | * The VRT Temperature type (Celsius) 144 | */ 145 | typedef int16_t vrt_temp_t; 146 | #define VRT_TEMP_RP 6 147 | #define VRT_TEMP_C(_x) _FXPT_C(vrt_temp_t, _x, VRT_TEMP_RP) 148 | 149 | static inline vrt_temp_t 150 | double_to_vrt_temp(double num){ 151 | return VRT_TEMP_C(num); 152 | } 153 | 154 | static inline int16_t 155 | vrt_temp_round_to_int(vrt_temp_t fx){ 156 | return _FXPT_TO_INT(fx, VRT_TEMP_C(1)); 157 | } 158 | 159 | static inline double 160 | vrt_temp_to_double(vrt_temp_t fx){ 161 | return _FXPT_TO_DOUBLE(fx, VRT_TEMP_C(1)); 162 | } 163 | 164 | /* 165 | * The VRT Gain type (7.1.5.10 Gain -- two Q10.6 dB fields) 166 | */ 167 | typedef uint32_t vrt_gain_t; 168 | 169 | static inline uint32_t 170 | vrt_make_gain(vrt_db_t stage1, vrt_db_t stage2) 171 | { 172 | return (((uint32_t) stage2) << 16) | (stage1 & 0xffff); 173 | } 174 | 175 | static inline vrt_db_t 176 | vrt_gain_stage1(uint32_t field) 177 | { 178 | return (vrt_db_t)(field & 0xffff); 179 | } 180 | 181 | static inline vrt_db_t 182 | vrt_gain_stage2(uint32_t field) 183 | { 184 | return (vrt_db_t)((field >> 16) & 0xffff); 185 | } 186 | 187 | #ifdef __cplusplus 188 | } 189 | #endif 190 | 191 | #endif /* INCLUDED_VRT_TYPES_H */ 192 | -------------------------------------------------------------------------------- /vrt/lib/socket_rx_buffer.cc: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2008,2009,2010 Free Software Foundation, Inc. 4 | * 5 | * This file is part of GNU Radio 6 | * 7 | * GNU Radio is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 3, or (at your option) 10 | * any later version. 11 | * 12 | * GNU Radio is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 20 | */ 21 | 22 | #ifdef HAVE_CONFIG_H 23 | #include 24 | #endif 25 | 26 | #include "socket_rx_buffer.h" 27 | #include "data_handler.h" 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | 37 | #define SOCKET_RX_BUFFER_DEBUG 1 // define to 0 or 1 38 | #if SOCKET_RX_BUFFER_DEBUG 39 | #define DEBUG_LOG(x) ::write(2, (x), 1) 40 | #else 41 | #define DEBUG_LOG(X) 42 | #endif 43 | 44 | #define DEFAULT_MEM_SIZE 62.5e6 // ~0.5s @ 125 MB/s 45 | #define MAX_MEM_SIZE 1000e6 // ~10.00s @ 100 MB/s. 46 | #define RX_BUF_ALIGNMENT 16 // 16-byte aligned for SIMD (must be power-of-2) 47 | 48 | namespace vrt { 49 | 50 | const unsigned int socket_rx_buffer::MAX_PKTLEN = 8192; 51 | 52 | socket_rx_buffer::socket_rx_buffer(int socket_fd, size_t rx_bufsize) 53 | : d_fd(socket_fd) 54 | { 55 | if (rx_bufsize == 0) 56 | rx_bufsize = (size_t)DEFAULT_MEM_SIZE; 57 | else 58 | rx_bufsize = std::min((size_t)MAX_MEM_SIZE, rx_bufsize); 59 | 60 | if (!open(rx_bufsize)){ 61 | throw std::runtime_error("socket_rx_buffer::open failed"); 62 | } 63 | } 64 | 65 | socket_rx_buffer::~socket_rx_buffer() 66 | { 67 | close(); 68 | } 69 | 70 | bool 71 | socket_rx_buffer::open(size_t buflen) 72 | { 73 | // Increase socket buffer if possible 74 | 75 | int rcvbuf_size = buflen; 76 | 77 | #if defined(SO_RCVBUFFORCE) 78 | // If we've got CAP_NET_ADMIN or root, this will allow the 79 | // rmem_max limit to be overridden 80 | if (setsockopt(d_fd, SOL_SOCKET, SO_RCVBUFFORCE, 81 | &rcvbuf_size, sizeof(rcvbuf_size)) == 0){ 82 | return true; 83 | } 84 | else { 85 | if (errno != EPERM) 86 | perror("setsockopt(SO_RCVBUFFORCE)"); 87 | } 88 | #endif 89 | 90 | // Try to set it. On linux trying for too large of a value 91 | // doesn't return an error... 92 | if (setsockopt(d_fd, SOL_SOCKET, SO_RCVBUF, 93 | &rcvbuf_size, sizeof(rcvbuf_size)) != 0){ 94 | perror("setsockopt(SO_RCVBUF)"); 95 | } 96 | 97 | // See how big it actually is 98 | int cursize = 0; 99 | socklen_t optlen; 100 | optlen = sizeof(cursize); 101 | if (getsockopt(d_fd, SOL_SOCKET, SO_RCVBUF, 102 | &cursize, &optlen) != 0){ 103 | perror("getsockopt"); 104 | return false; 105 | } 106 | 107 | // fprintf(stderr, "after: getsockopt(SO_RCVBUF) = %d\n", cursize); 108 | 109 | // If we don't get what we asked for, treat it as an error. 110 | // Otherwise the radio's probably not going to work reliably anyway. 111 | if (cursize < (int) buflen){ 112 | fprintf(stderr, 113 | "socket_rx_buffer: failed to allocate socket receive buffer of size %zd.\n", 114 | buflen); 115 | fprintf(stderr, 116 | "To fix this, please increase the maximum allowed using:\n\n"); 117 | fprintf(stderr, 118 | " $ sudo sysctl -w net.core.rmem_max=%zd\n\n", buflen); 119 | fprintf(stderr, 120 | "and/or edit /etc/sysctl.conf: net.core.rmem_max=%zd\n\n", buflen); 121 | return false; 122 | } 123 | 124 | return true; 125 | } 126 | 127 | bool 128 | socket_rx_buffer::close() 129 | { 130 | return true; 131 | } 132 | 133 | socket_rx_buffer::result 134 | socket_rx_buffer::rx_frames(data_handler *f, int timeout_in_ms) 135 | { 136 | unsigned char unaligned[MAX_PKTLEN + RX_BUF_ALIGNMENT]; 137 | unsigned char *buf = (unsigned char *) 138 | (((intptr_t)unaligned + RX_BUF_ALIGNMENT) & -RX_BUF_ALIGNMENT); 139 | 140 | bool dont_wait = timeout_in_ms == 0; // FIXME treating timeout as 0 or inf 141 | int flags = dont_wait ? MSG_DONTWAIT : 0; 142 | 143 | ssize_t rr = recv(d_fd, buf, MAX_PKTLEN, flags); 144 | if (rr == -1){ // error? 145 | if (errno == EAGAIN){ // non-blocking, nothing there 146 | return EB_WOULD_BLOCK; 147 | } 148 | perror("rx_frames: recv"); 149 | return EB_ERROR; 150 | } 151 | 152 | // Got first packet. Call handler 153 | 154 | bool want_more = (*f)(buf, rr); 155 | if (!want_more) 156 | return EB_OK; 157 | 158 | // Now do as many as we can without blocking 159 | 160 | while (1){ 161 | rr = recv(d_fd, buf, MAX_PKTLEN, MSG_DONTWAIT); 162 | if (rr == -1){ // error? 163 | if (errno == EAGAIN) // non-blocking, nothing there 164 | return EB_OK; // return OK; we've processed >= 1 packets 165 | perror("rx_frames: recv"); 166 | return EB_ERROR; 167 | } 168 | 169 | want_more = (*f)(buf, rr); 170 | if (!want_more) 171 | break; 172 | } 173 | return EB_OK; 174 | } 175 | 176 | } // namespace vrt 177 | -------------------------------------------------------------------------------- /vrt/lib/expanded_header.cc: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2009 Free Software Foundation, Inc. 4 | * 5 | * This file is part of GNU Radio 6 | * 7 | * GNU Radio is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 3, or (at your option) 10 | * any later version. 11 | * 12 | * GNU Radio is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 20 | */ 21 | 22 | #ifdef HAVE_CONFIG_H 23 | #include 24 | #endif 25 | #include 26 | //#include 27 | #include 28 | #include 29 | #include "header_utils.h" 30 | 31 | using boost::format; 32 | using boost::io::group; 33 | 34 | 35 | namespace vrt { 36 | 37 | using namespace detail; 38 | 39 | // lookup tables indexed by packet type 40 | unsigned char expanded_header::s_if_data[16] = { 41 | 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 42 | }; 43 | 44 | unsigned char expanded_header::s_ext_data[16] = { 45 | 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 46 | }; 47 | 48 | unsigned char expanded_header::s_data[16] = { 49 | 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 50 | }; 51 | 52 | unsigned char expanded_header::s_context[16] = { 53 | 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 54 | }; 55 | 56 | unsigned char expanded_header::s_stream_id[16] = { 57 | 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 58 | }; 59 | 60 | 61 | // dispatch codeword bits 62 | static const int HAS_STREAM_ID = 1 << 0; 63 | static const int HAS_CLASS_ID = 1 << 1; 64 | static const int HAS_INTEGER_SECS = 1 << 2; 65 | static const int HAS_FRACTIONAL_SECS = 1 << 3; 66 | static const int HAS_TRAILER = 1 << 4; 67 | 68 | static int 69 | compute_codeword(const expanded_header &h) 70 | { 71 | int cw = 0; 72 | if (h.stream_id_p()) cw |= HAS_STREAM_ID; 73 | if (h.class_id_p()) cw |= HAS_CLASS_ID; 74 | if (h.integer_secs_p()) cw |= HAS_INTEGER_SECS; 75 | if (h.fractional_secs_p()) cw |= HAS_FRACTIONAL_SECS; 76 | if (h.trailer_p()) cw |= HAS_TRAILER; 77 | return cw; 78 | } 79 | 80 | void expanded_header::pack(const expanded_header *h, // in 81 | size_t n32_bit_words_payload, // in 82 | uint32_t *header, // out 83 | size_t *n32_bit_words_header, // out 84 | uint32_t *trailer, // out 85 | size_t *n32_bit_words_trailer) // out 86 | { 87 | int cw = compute_codeword(*h); 88 | //fills in the header (except word0), header length, trailer, trailer length 89 | switch (cw & 0x1f){ 90 | #include "expanded_header_pack_switch_body.h" 91 | } 92 | //fill in the header word 0 with the calculated length 93 | size_t n32_bit_words_packet = *n32_bit_words_header + n32_bit_words_payload + *n32_bit_words_trailer; 94 | header[0] = htonl((h->header & ~VRTH_PKT_SIZE_MASK) | (n32_bit_words_packet & VRTH_PKT_SIZE_MASK)); 95 | } 96 | 97 | bool 98 | expanded_header::unpack(const uint32_t *packet, // in 99 | size_t n32_bit_words_packet, // in 100 | expanded_header *h, // out 101 | const uint32_t **payload, // out 102 | size_t *n32_bit_words_payload) // out 103 | { 104 | size_t n32_bit_words_header = 0; 105 | size_t n32_bit_words_trailer = 0; 106 | size_t len = n32_bit_words_packet; 107 | const uint32_t *p = packet; 108 | 109 | *payload = 0; 110 | *n32_bit_words_payload = 0; 111 | 112 | // printf("unpack: n32_bit_words_packet = %zd\n", n32_bit_words_packet); 113 | 114 | if (len < 1){ // must have at least the header word 115 | h->header = 0; 116 | return false; 117 | } 118 | 119 | h->header = ntohl(p[0]); 120 | 121 | if (h->pkt_size() > len) 122 | return false; // VRT header says packet is bigger than what we've got 123 | 124 | len = h->pkt_size(); // valid length of packet 125 | 126 | int cw = compute_codeword(*h); 127 | switch (cw & 0x1f){ 128 | #include "expanded_header_unpack_switch_body.h" 129 | } 130 | 131 | if (n32_bit_words_header + n32_bit_words_trailer > len) 132 | return false; // negative payload len 133 | 134 | *payload = p + n32_bit_words_header; 135 | *n32_bit_words_payload = len - (n32_bit_words_header + n32_bit_words_trailer); 136 | 137 | // printf("unpack: hdr = 0x%08x, cw = 0x%02x, n32_bit_words_header = %d, n32_bit_words_trailer = %d\n", 138 | // h->header, cw, n32_bit_words_header, n32_bit_words_trailer); 139 | 140 | return true; 141 | } 142 | 143 | std::string 144 | pkt_type_name(const vrt::expanded_header *hdr) 145 | { 146 | if (hdr->if_data_p()) 147 | return "IF-Data"; 148 | if (hdr->ext_data_p()) 149 | return "Ext-Data"; 150 | if (hdr->if_context_p()) 151 | return "IF-Context"; 152 | if (hdr->ext_context_p()) 153 | return "Ext-Context"; 154 | else 155 | return ""; 156 | } 157 | 158 | void 159 | expanded_header::write(std::ostream &port) const 160 | { 161 | port << format("%s:\n") % pkt_type_name(this); 162 | if (1){ 163 | wr_name(port, "header"); 164 | wr_header(port, header); 165 | } 166 | 167 | if (stream_id_p()){ 168 | wr_name(port, "stream_id"); 169 | wr_uint32_hex(port, stream_id); 170 | } 171 | 172 | if (class_id_p()){ 173 | wr_name(port, "class_id"); 174 | port << format("0x%016llx\n") % class_id; 175 | } 176 | 177 | if (integer_secs_p()){ 178 | wr_name(port, "int secs"); 179 | //port << format("%10d\n") % integer_secs; 180 | wr_int_secs(port, integer_secs); 181 | } 182 | 183 | if (fractional_secs_p()){ 184 | wr_name(port, "frac secs"); 185 | port << format("%10d\n") % fractional_secs; 186 | } 187 | } 188 | 189 | std::ostream& operator<<(std::ostream &os, const expanded_header &obj) 190 | { 191 | obj.write(os); 192 | return os; 193 | } 194 | 195 | }; // vrt 196 | -------------------------------------------------------------------------------- /vrt/lib/header_utils.cc: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2010 Free Software Foundation, Inc. 4 | * 5 | * This file is part of GNU Radio 6 | * 7 | * GNU Radio is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 3, or (at your option) 10 | * any later version. 11 | * 12 | * GNU Radio is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 20 | */ 21 | 22 | #include "header_utils.h" 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | using boost::format; 29 | using boost::io::group; 30 | 31 | namespace vrt 32 | { 33 | namespace detail { 34 | 35 | void wr_header(std::ostream &os, uint32_t x) 36 | { 37 | os << format("%#10x") % x; 38 | 39 | uint32_t t = (x >> 22) & 0x3; 40 | switch(t){ 41 | case 0x0: os << " TSI=NONE"; break; 42 | case 0x1: os << " TSI=UTC"; break; 43 | case 0x2: os << " TSI=GPS"; break; 44 | case 0x3: os << " TSI=OTHER"; break; 45 | } 46 | 47 | t = (x >> 20) & 0x3; 48 | switch(t){ 49 | case 0x0: os << " TSF=NONE"; break; 50 | case 0x1: os << " TSF=SAMPLE_CNT";break; 51 | case 0x2: os << " TSI=PICOSECS"; break; 52 | case 0x3: os << " TSI=FREE_RUN"; break; 53 | } 54 | 55 | uint32_t pt = x & VRTH_PT_MASK; 56 | if (pt == VRTH_PT_IF_CONTEXT || pt == VRTH_PT_EXT_CONTEXT){ 57 | if (x & VRTH_TSM) 58 | os << " TSM=GENERAL"; 59 | else 60 | os << " TSM=EXACT"; 61 | } 62 | else if (0 63 | || pt == VRTH_PT_IF_DATA_WITH_SID 64 | || pt == VRTH_PT_IF_DATA_NO_SID 65 | || pt == VRTH_PT_EXT_DATA_WITH_SID 66 | || pt == VRTH_PT_EXT_DATA_NO_SID){ 67 | if (x & VRTH_START_OF_BURST) 68 | os << " SOB"; 69 | if (x & VRTH_END_OF_BURST) 70 | os << " EOB"; 71 | } 72 | 73 | os << std::endl; 74 | } 75 | 76 | void wr_int_secs(std::ostream &os, uint32_t secs) 77 | { 78 | os << format("%10d") % secs; 79 | 80 | time_t t = secs; 81 | struct tm r; 82 | 83 | if (gmtime_r(&t, &r)){ 84 | // ISO 8601 date + time 85 | os << format(" %04d-%02d-%02d %02d:%02d:%02dZ") 86 | % (r.tm_year + 1900) % (r.tm_mon + 1) % r.tm_mday 87 | % r.tm_hour % r.tm_min % r.tm_sec; 88 | } 89 | 90 | os << std::endl; 91 | } 92 | 93 | void wr_name(std::ostream &os, const std::string &x) 94 | { 95 | os << format(" %-21s ") % (x + ":"); 96 | } 97 | 98 | void wr_uint32_hex(std::ostream &os, uint32_t x) 99 | { 100 | os << format("%#10x") % x; 101 | os << std::endl; 102 | } 103 | 104 | void wr_uint32_dec(std::ostream &os, uint32_t x) 105 | { 106 | os << format("%12d") % x; 107 | os << std::endl; 108 | } 109 | 110 | void wr_hertz(std::ostream &os, vrt_hertz_t x) 111 | { 112 | os << format("%12g Hz") % vrt_hertz_to_double(x); 113 | os << std::endl; 114 | } 115 | 116 | void wr_dbm(std::ostream &os, vrt_db_t x) 117 | { 118 | os << format("%10g dBm") % vrt_db_to_double(x); 119 | os << std::endl; 120 | } 121 | 122 | void wr_db(std::ostream &os, vrt_db_t x) 123 | { 124 | os << format("%10g dB") % vrt_db_to_double(x); 125 | os << std::endl; 126 | } 127 | 128 | void wr_temp(std::ostream &os, vrt_temp_t x) 129 | { 130 | os << format("%10g C") % vrt_temp_to_double(x); 131 | os << std::endl; 132 | } 133 | 134 | void wr_angle(std::ostream &os, vrt_angle_t x) 135 | { 136 | if (x == VRT_GPS_UNKNOWN_VALUE) 137 | os << " UNKNOWN"; 138 | else 139 | os << format("%10g deg") % vrt_angle_to_double(x); 140 | 141 | os << std::endl; 142 | } 143 | 144 | void wr_distance(std::ostream &os, vrt_distance_t x) 145 | { 146 | if (x == VRT_GPS_UNKNOWN_VALUE) 147 | os << " UNKNOWN"; 148 | else 149 | os << format("%10g m") % vrt_distance_to_double(x); 150 | 151 | os << std::endl; 152 | } 153 | 154 | void wr_velocity(std::ostream &os, vrt_velocity_t x) 155 | { 156 | if (x == VRT_GPS_UNKNOWN_VALUE) 157 | os << " UNKNOWN"; 158 | else 159 | os << format("%10g m/s") % vrt_velocity_to_double(x); 160 | 161 | os << std::endl; 162 | } 163 | 164 | void wr_payload_fmt(std::ostream &os, vrt_payload_fmt_t f) 165 | { 166 | if (f.word0 & DF0_PACKED) 167 | os << " Packed"; 168 | 169 | switch (f.word0 & DF0_REAL_CMPLX_TYPE_MASK){ 170 | case DF0_REAL_CMPLX_TYPE_REAL: os << " Real"; break; 171 | case DF0_REAL_CMPLX_TYPE_CMPLX_CART: os << " Cmplx"; break; 172 | case DF0_REAL_CMPLX_TYPE_CMPLX_POLAR: os << " Polar"; break; 173 | case DF0_REAL_CMPLX_TYPE_RESERVED: os << " Reserved"; break; 174 | } 175 | 176 | switch(f.word0 & DF0_ITEM_FMT_MASK){ 177 | case DF0_ITEM_FMT_SIGNED_FIXED_POINT: os << " S-Fixed"; break; 178 | case DF0_ITEM_FMT_UNSIGNED_FIXED_POINT: os << " U-Fixed"; break; 179 | case DF0_ITEM_FMT_IEEE_FLOAT: os << " float"; break; 180 | case DF0_ITEM_FMT_IEEE_DOUBLE: os << " double"; break; 181 | default: 182 | os << format(" ItemFmt=%#x") % ((f.word0 & DF0_ITEM_FMT_MASK) >> 24); 183 | break; 184 | } 185 | 186 | if (f.word0 & DF0_SAMPLE_COMPONENT_REPEATING) 187 | os << " SampleCompRpt"; 188 | 189 | uint32_t t = (f.word0 & DF0_EVENT_TAG_SIZE_MASK) >> DF0_EVENT_TAG_SIZE_SHIFT; 190 | if (t != 0) 191 | os << format(" EvtTagSize=%d") % t; 192 | 193 | t = (f.word0 & DF0_CHANNEL_TAG_SIZE_MASK) >> DF0_CHANNEL_TAG_SIZE_SHIFT; 194 | if (t != 0) 195 | os << format(" ChanTagSize=%d") % t; 196 | 197 | t = (f.word0 & DF0_ITEM_PACKING_FIELD_SIZE_MASK) >> DF0_ITEM_PACKING_FIELD_SIZE_SHIFT; 198 | os << format(" FieldSize=%d") % (t + 1); 199 | 200 | t = (f.word0 & DF0_DATA_ITEM_SIZE_MASK) >> DF0_DATA_ITEM_SIZE_SHIFT; 201 | os << format(" ItemSize=%d") % (t + 1); 202 | 203 | t = (f.word1 & DF1_REPEAT_COUNT_MASK) >> DF1_REPEAT_COUNT_SHIFT; 204 | os << format(" RptCnt=%d") % (t + 1); 205 | 206 | t = (f.word1 & DF1_VECTOR_SIZE_MASK) >> DF1_VECTOR_SIZE_SHIFT; 207 | os << format(" VectSize=%d") % (t + 1); 208 | 209 | os << std::endl; 210 | } 211 | 212 | void wr_formatted_gps(std::ostream &os, 213 | const vrt_formatted_gps_t &x) 214 | { 215 | uint32_t t = (x.tsi_tsf_manuf_oui >> 26) & 0x3; 216 | switch(t){ 217 | case 0x0: os << " TSI=UNDEF"; break; 218 | case 0x1: os << " TSI=UTC"; break; 219 | case 0x2: os << " TSI=GPS"; break; 220 | case 0x3: os << " TSI=OTHER"; break; 221 | } 222 | 223 | t = (x.tsi_tsf_manuf_oui >> 24) & 0x3; 224 | switch(t){ 225 | case 0x0: os << " TSF=UNDEF"; break; 226 | case 0x1: os << " TSF=SAMPLE_CNT";break; 227 | case 0x2: os << " TSI=PICOSECS"; break; 228 | case 0x3: os << " TSI=FREE_RUN"; break; 229 | } 230 | 231 | t = x.tsi_tsf_manuf_oui & 0x00ffffff; 232 | os << format(" manuf_oui=%#x\n") % t; 233 | 234 | wr_name(os, " fix int secs"); 235 | //os << format("%10d\n") % x.integer_secs; 236 | wr_int_secs(os, x.integer_secs); 237 | 238 | wr_name(os, " fix frac secs"); 239 | os << format("%10d\n") % get_frac_secs(&x.fractional_secs); 240 | 241 | wr_name(os, " latitude"); 242 | wr_angle(os, x.latitude); 243 | wr_name(os, " longitude"); 244 | wr_angle(os, x.longitude); 245 | wr_name(os, " altitude"); 246 | wr_distance(os, x.altitude); 247 | wr_name(os, " speed_over_ground"); 248 | wr_velocity(os, x.speed_over_ground); 249 | wr_name(os, " heading_angle"); 250 | wr_angle(os, x.heading_angle); 251 | wr_name(os, " track_angle"); 252 | wr_angle(os, x.track_angle); 253 | wr_name(os, " magnetic_variation"); 254 | wr_angle(os, x.magnetic_variation); 255 | 256 | os << std::endl; 257 | } 258 | 259 | }; 260 | }; 261 | -------------------------------------------------------------------------------- /vrt/include/vrt/bits.h: -------------------------------------------------------------------------------- 1 | /* -*- c -*- */ 2 | /* 3 | * Copyright 2009,2010 Free Software Foundation, Inc. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | #ifndef INCLUDED_VRT_BITS_H 19 | #define INCLUDED_VRT_BITS_H 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | /*! 26 | * \brief Definitions of bit and fields in VRT packets 27 | * 28 | * See "ANSI/VITA 49.0, VRT Standard" for details 29 | */ 30 | 31 | #include 32 | #include 33 | 34 | // ------------------------------------------------------------------------ 35 | // Common VRT header info 36 | // ------------------------------------------------------------------------ 37 | 38 | /* VRT Header bits */ 39 | 40 | #define VRTH_PT_MASK (0xf << 28) 41 | #define VRTH_PT_IF_DATA_NO_SID (0x0 << 28) // IF-Data, no stream id 42 | #define VRTH_PT_IF_DATA_WITH_SID (0x1 << 28) // IF-Data, w/ stream id 43 | #define VRTH_PT_EXT_DATA_NO_SID (0x2 << 28) 44 | #define VRTH_PT_EXT_DATA_WITH_SID (0x3 << 28) 45 | #define VRTH_PT_IF_CONTEXT (0x4 << 28) 46 | #define VRTH_PT_EXT_CONTEXT (0x5 << 28) 47 | 48 | #define VRTH_HAS_CLASSID (1 << 27) 49 | #define VRTH_HAS_TRAILER (1 << 26) // Data pkts only 50 | #define VRTH_START_OF_BURST (1 << 25) // Data (Tx) pkts only 51 | #define VRTH_END_OF_BURST (1 << 24) // Data (Tx) pkts only 52 | #define VRTH_TSM (1 << 24) // Context pkts only 53 | 54 | #define VRTH_TSI_MASK (0x3 << 22) 55 | #define VRTH_TSI_NONE (0x0 << 22) 56 | #define VRTH_TSI_UTC (0x1 << 22) 57 | #define VRTH_TSI_GPS (0x2 << 22) 58 | #define VRTH_TSI_OTHER (0x3 << 22) 59 | 60 | #define VRTH_TSF_MASK (0x3 << 20) 61 | #define VRTH_TSF_NONE (0x0 << 20) 62 | #define VRTH_TSF_SAMPLE_CNT (0x1 << 20) 63 | #define VRTH_TSF_REAL_TIME_PS (0x2 << 20) 64 | #define VRTH_TSF_FREE_RUNNING (0x3 << 20) 65 | 66 | #define VRTH_PKT_CNT_SHIFT 16 67 | #define VRTH_PKT_CNT_MASK (0xf << 16) 68 | 69 | #define VRTH_PKT_SIZE_MASK 0xffff 70 | 71 | 72 | static inline int 73 | vrth_pkt_cnt(uint32_t h) 74 | { 75 | return (h & VRTH_PKT_CNT_MASK) >> 16; 76 | } 77 | 78 | static inline int 79 | vrth_pkt_size(uint32_t h) 80 | { 81 | return h & VRTH_PKT_SIZE_MASK; 82 | } 83 | 84 | /* 85 | * Trailer bits 86 | */ 87 | #define TR_E (1 << 8) 88 | 89 | #define TR_ENABLE(x) ((x) << 20) 90 | #define TR_STATE(x) ((x) << 8) 91 | 92 | // Use these with TR_ENABLE and TR_STATE 93 | #define TR_CAL_TIME (1 << 11) 94 | #define TR_VALID_DATA (1 << 10) 95 | #define TR_REF_LOCK (1 << 9) 96 | #define TR_AGC (1 << 8) 97 | #define TR_DETECTED_SIG (1 << 7) 98 | #define TR_SPECTRAL_INVERSION (1 << 6) 99 | #define TR_OVER_RANGE (1 << 5) 100 | #define TR_SAMPLE_LOSS (1 << 4) 101 | #define TR_USER_3 (1 << 3) 102 | #define TR_USER_2 (1 << 2) 103 | #define TR_USER_1 (1 << 1) 104 | #define TR_USER_0 (1 << 0) 105 | 106 | // ------------------------------------------------------------------------ 107 | // IF-Context packets 108 | // ------------------------------------------------------------------------ 109 | 110 | // ------------------------------------------------------------------------ 111 | // Context Indicator field bits (Table 7.1.5.1-1) 112 | 113 | #define CI_CHANGE_INDICATOR (1 << 31) 114 | #define CI_REF_POINT_ID (1 << 30) 115 | #define CI_BANDWIDTH (1 << 29) 116 | #define CI_IF_REF_FREQ (1 << 28) 117 | #define CI_RF_REF_FREQ (1 << 27) 118 | #define CI_RF_REF_FREQ_OFFSET (1 << 26) 119 | #define CI_IF_BAND_OFFSET (1 << 25) 120 | #define CI_REF_LEVEL (1 << 24) 121 | #define CI_GAIN (1 << 23) 122 | #define CI_OVER_RANGE_COUNT (1 << 22) 123 | #define CI_SAMPLE_RATE (1 << 21) 124 | #define CI_TIMESTAMP_ADJ (1 << 20) 125 | #define CI_TIMESTAMP_CAL_TIME (1 << 19) 126 | #define CI_TEMPERATURE (1 << 18) 127 | #define CI_DEVICE_ID (1 << 17) 128 | #define CI_STATE_AND_EVENT_IND (1 << 16) 129 | #define CI_PAYLOAD_FMT (1 << 15) 130 | #define CI_FORMATTED_GPS (1 << 14) 131 | #define CI_FORMATTED_INS (1 << 13) 132 | #define CI_ECEF_EPHEMERIS (1 << 12) 133 | #define CI_REL_EPHEMERIS (1 << 11) 134 | #define CI_EPHEMERIS_REF_ID (1 << 10) 135 | #define CI_GPS_ASCII (1 << 9) 136 | #define CI_CNTX_ASSOC_LISTS (1 << 8) 137 | #define CI_RESERVED_7 (1 << 7) 138 | #define CI_RESERVED_6 (1 << 6) 139 | #define CI_RESERVED_5 (1 << 5) 140 | #define CI_RESERVED_4 (1 << 4) 141 | #define CI_RESERVED_3 (1 << 3) 142 | #define CI_RESERVED_2 (1 << 2) 143 | #define CI_RESERVED_1 (1 << 1) 144 | #define CI_RESERVED_0 (1 << 0) 145 | 146 | 147 | // ------------------------------------------------------------------------ 148 | // Types that may be in the Context Section 149 | 150 | 151 | typedef struct { 152 | uint32_t hi; // most significant 32-bits 153 | uint32_t lo; // least significant 32-bits 154 | } vrt_frac_secs_t; 155 | 156 | static inline uint64_t 157 | get_frac_secs(const vrt_frac_secs_t *fs) 158 | { 159 | return (((uint64_t)fs->hi) << 32) | fs->lo; 160 | } 161 | 162 | static inline void 163 | put_frac_secs(vrt_frac_secs_t *fs, uint64_t x) 164 | { 165 | fs->hi = (x >> 32); 166 | fs->lo = x; 167 | } 168 | 169 | //! See VITA-49.0 section 7.1.5.19 170 | 171 | typedef struct vrt_formatted_gps_tag { 172 | uint32_t tsi_tsf_manuf_oui; 173 | uint32_t integer_secs; // timestamp of position fix 174 | vrt_frac_secs_t fractional_secs; // timestamp of position fix 175 | vrt_angle_t latitude; // degrees Q10.22 176 | vrt_angle_t longitude; // degrees Q10.22 177 | vrt_distance_t altitude; // meters Q27.5 178 | vrt_velocity_t speed_over_ground; // meters/s Q16.16 179 | vrt_angle_t heading_angle; // degrees Q10.22 180 | vrt_angle_t track_angle; // degrees Q10.22 181 | vrt_angle_t magnetic_variation; // degrees Q10.22 182 | } vrt_formatted_gps_t; 183 | 184 | /*! 185 | * \brief GPS Unknown value indicator 186 | * 187 | * May be used in: latitude, longitude, altitude, speed_over_ground, 188 | * heading_angle, track_angle, and magnetic_variation fields. 189 | */ 190 | #define VRT_GPS_UNKNOWN_VALUE 0x7fffffff 191 | 192 | 193 | 194 | //! Data Packet Payload Format Field 7.1.5.18 195 | 196 | typedef struct { 197 | uint32_t word0; 198 | uint32_t word1; 199 | } vrt_payload_fmt_t; 200 | 201 | #define DF0_PACKED (1 << 31) 202 | #define DF0_REAL_CMPLX_TYPE_MASK (0x3 << 29) 203 | #define DF0_REAL_CMPLX_TYPE_REAL (0 << 29) 204 | #define DF0_REAL_CMPLX_TYPE_CMPLX_CART (1 << 29) 205 | #define DF0_REAL_CMPLX_TYPE_CMPLX_POLAR (2 << 29) 206 | #define DF0_REAL_CMPLX_TYPE_RESERVED (3 << 29) 207 | #define DF0_ITEM_FMT_MASK (0x1f << 24) 208 | #define DF0_ITEM_FMT_SIGNED_FIXED_POINT (0x00 << 24) 209 | // lots more we're not using 210 | #define DF0_ITEM_FMT_IEEE_FLOAT (0x0e << 24) 211 | #define DF0_ITEM_FMT_IEEE_DOUBLE (0x0f << 24) 212 | #define DF0_ITEM_FMT_UNSIGNED_FIXED_POINT (0x10 << 24) 213 | // lots more we're not using 214 | #define DF0_SAMPLE_COMPONENT_REPEATING (1 << 23) 215 | #define DF0_EVENT_TAG_SIZE_SHIFT 20 216 | #define DF0_EVENT_TAG_SIZE_MASK (0x7 << 20) 217 | #define DF0_CHANNEL_TAG_SIZE_SHIFT 16 218 | #define DF0_CHANNEL_TAG_SIZE_MASK (0xf << 16) 219 | #define DF0_RESERVED_SHIFT 12 220 | #define DF0_RESERVED_MASK (0xf << 12) 221 | #define DF0_ITEM_PACKING_FIELD_SIZE_SHIFT 6 222 | #define DF0_ITEM_PACKING_FIELD_SIZE_MASK (0x3f << 6) 223 | #define DF0_DATA_ITEM_SIZE_SHIFT 0 224 | #define DF0_DATA_ITEM_SIZE_MASK (0x3f << 0) 225 | 226 | #define DF1_REPEAT_COUNT_SHIFT 16 227 | #define DF1_REPEAT_COUNT_MASK (0xffff << 16) 228 | #define DF1_VECTOR_SIZE_SHIFT 0 229 | #define DF1_VECTOR_SIZE_MASK (0xffff << 0) 230 | 231 | 232 | // Composite values 233 | 234 | // 16-bit I & Q, no events, no channel tags 235 | #define DF0_16_BIT_IQ \ 236 | (0 \ 237 | | DF0_REAL_CMPLX_TYPE_CMPLX_CART \ 238 | | DF0_ITEM_FMT_SIGNED_FIXED_POINT \ 239 | | (15 << DF0_ITEM_PACKING_FIELD_SIZE_SHIFT) \ 240 | | (15 << DF0_DATA_ITEM_SIZE_SHIFT)) 241 | 242 | // Vector of length 1 243 | #define DF1_VECTOR_1 (0 << DF1_VECTOR_SIZE_SHIFT) 244 | 245 | // Vector of length 4 246 | #define DF1_VECTOR_4 (3 << DF1_VECTOR_SIZE_SHIFT) 247 | 248 | 249 | //! ECEF Ephemeris Field 7.1.5.21 250 | 251 | typedef struct { 252 | uint32_t tsi_tsf_manuf_oui; 253 | uint32_t integer_secs; // timestamp of position fix 254 | vrt_frac_secs_t fractional_secs; // timestamp of position fix 255 | vrt_distance_t position_x; // meters Q27.5 256 | vrt_distance_t position_y; // meters Q27.5 257 | vrt_distance_t position_z; // meters Q27.5 258 | vrt_angle_t attitude_alpha; // degrees Q10.22 259 | vrt_angle_t attitude_beta; // degrees Q10.22 260 | vrt_angle_t attitude_phi; // degrees Q10.22 261 | vrt_velocity_t velocity_dx; // meters/s Q16.16 262 | vrt_velocity_t velocity_dy; // meters/s Q16.16 263 | vrt_velocity_t velocity_dz; // meters/s Q16.16 264 | } vrt_ephemeris_t; 265 | 266 | #ifdef __cplusplus 267 | } 268 | #endif 269 | 270 | #endif /* INCLUDED_VRT_BITS_H */ 271 | -------------------------------------------------------------------------------- /vrt/lib/expanded_header_unpack_switch_body.h: -------------------------------------------------------------------------------- 1 | case 0: 2 | h->stream_id = 0; 3 | h->class_id = 0; 4 | h->integer_secs = 0; 5 | h->fractional_secs = 0; 6 | n32_bit_words_header = 1; 7 | h->trailer = 0; 8 | n32_bit_words_trailer = 0; 9 | break; 10 | 11 | case 1: 12 | h->stream_id = ntohl(p[1]); 13 | h->class_id = 0; 14 | h->integer_secs = 0; 15 | h->fractional_secs = 0; 16 | n32_bit_words_header = 2; 17 | h->trailer = 0; 18 | n32_bit_words_trailer = 0; 19 | break; 20 | 21 | case 2: 22 | h->stream_id = 0; 23 | h->class_id = ((uint64_t)(ntohl(p[1])) << 32) | ntohl(p[2]); 24 | h->integer_secs = 0; 25 | h->fractional_secs = 0; 26 | n32_bit_words_header = 3; 27 | h->trailer = 0; 28 | n32_bit_words_trailer = 0; 29 | break; 30 | 31 | case 3: 32 | h->stream_id = ntohl(p[1]); 33 | h->class_id = ((uint64_t)(ntohl(p[2])) << 32) | ntohl(p[3]); 34 | h->integer_secs = 0; 35 | h->fractional_secs = 0; 36 | n32_bit_words_header = 4; 37 | h->trailer = 0; 38 | n32_bit_words_trailer = 0; 39 | break; 40 | 41 | case 4: 42 | h->stream_id = 0; 43 | h->class_id = 0; 44 | h->integer_secs = ntohl(p[1]); 45 | h->fractional_secs = 0; 46 | n32_bit_words_header = 2; 47 | h->trailer = 0; 48 | n32_bit_words_trailer = 0; 49 | break; 50 | 51 | case 5: 52 | h->stream_id = ntohl(p[1]); 53 | h->class_id = 0; 54 | h->integer_secs = ntohl(p[2]); 55 | h->fractional_secs = 0; 56 | n32_bit_words_header = 3; 57 | h->trailer = 0; 58 | n32_bit_words_trailer = 0; 59 | break; 60 | 61 | case 6: 62 | h->stream_id = 0; 63 | h->class_id = ((uint64_t)(ntohl(p[1])) << 32) | ntohl(p[2]); 64 | h->integer_secs = ntohl(p[3]); 65 | h->fractional_secs = 0; 66 | n32_bit_words_header = 4; 67 | h->trailer = 0; 68 | n32_bit_words_trailer = 0; 69 | break; 70 | 71 | case 7: 72 | h->stream_id = ntohl(p[1]); 73 | h->class_id = ((uint64_t)(ntohl(p[2])) << 32) | ntohl(p[3]); 74 | h->integer_secs = ntohl(p[4]); 75 | h->fractional_secs = 0; 76 | n32_bit_words_header = 5; 77 | h->trailer = 0; 78 | n32_bit_words_trailer = 0; 79 | break; 80 | 81 | case 8: 82 | h->stream_id = 0; 83 | h->class_id = 0; 84 | h->integer_secs = 0; 85 | h->fractional_secs = ((uint64_t)(ntohl(p[1])) << 32) | ntohl(p[2]); 86 | n32_bit_words_header = 3; 87 | h->trailer = 0; 88 | n32_bit_words_trailer = 0; 89 | break; 90 | 91 | case 9: 92 | h->stream_id = ntohl(p[1]); 93 | h->class_id = 0; 94 | h->integer_secs = 0; 95 | h->fractional_secs = ((uint64_t)(ntohl(p[2])) << 32) | ntohl(p[3]); 96 | n32_bit_words_header = 4; 97 | h->trailer = 0; 98 | n32_bit_words_trailer = 0; 99 | break; 100 | 101 | case 10: 102 | h->stream_id = 0; 103 | h->class_id = ((uint64_t)(ntohl(p[1])) << 32) | ntohl(p[2]); 104 | h->integer_secs = 0; 105 | h->fractional_secs = ((uint64_t)(ntohl(p[3])) << 32) | ntohl(p[4]); 106 | n32_bit_words_header = 5; 107 | h->trailer = 0; 108 | n32_bit_words_trailer = 0; 109 | break; 110 | 111 | case 11: 112 | h->stream_id = ntohl(p[1]); 113 | h->class_id = ((uint64_t)(ntohl(p[2])) << 32) | ntohl(p[3]); 114 | h->integer_secs = 0; 115 | h->fractional_secs = ((uint64_t)(ntohl(p[4])) << 32) | ntohl(p[5]); 116 | n32_bit_words_header = 6; 117 | h->trailer = 0; 118 | n32_bit_words_trailer = 0; 119 | break; 120 | 121 | case 12: 122 | h->stream_id = 0; 123 | h->class_id = 0; 124 | h->integer_secs = ntohl(p[1]); 125 | h->fractional_secs = ((uint64_t)(ntohl(p[2])) << 32) | ntohl(p[3]); 126 | n32_bit_words_header = 4; 127 | h->trailer = 0; 128 | n32_bit_words_trailer = 0; 129 | break; 130 | 131 | case 13: 132 | h->stream_id = ntohl(p[1]); 133 | h->class_id = 0; 134 | h->integer_secs = ntohl(p[2]); 135 | h->fractional_secs = ((uint64_t)(ntohl(p[3])) << 32) | ntohl(p[4]); 136 | n32_bit_words_header = 5; 137 | h->trailer = 0; 138 | n32_bit_words_trailer = 0; 139 | break; 140 | 141 | case 14: 142 | h->stream_id = 0; 143 | h->class_id = ((uint64_t)(ntohl(p[1])) << 32) | ntohl(p[2]); 144 | h->integer_secs = ntohl(p[3]); 145 | h->fractional_secs = ((uint64_t)(ntohl(p[4])) << 32) | ntohl(p[5]); 146 | n32_bit_words_header = 6; 147 | h->trailer = 0; 148 | n32_bit_words_trailer = 0; 149 | break; 150 | 151 | case 15: 152 | h->stream_id = ntohl(p[1]); 153 | h->class_id = ((uint64_t)(ntohl(p[2])) << 32) | ntohl(p[3]); 154 | h->integer_secs = ntohl(p[4]); 155 | h->fractional_secs = ((uint64_t)(ntohl(p[5])) << 32) | ntohl(p[6]); 156 | n32_bit_words_header = 7; 157 | h->trailer = 0; 158 | n32_bit_words_trailer = 0; 159 | break; 160 | 161 | case 16: 162 | h->stream_id = 0; 163 | h->class_id = 0; 164 | h->integer_secs = 0; 165 | h->fractional_secs = 0; 166 | n32_bit_words_header = 1; 167 | h->trailer = ntohl(p[len-1]); 168 | n32_bit_words_trailer = 1; 169 | break; 170 | 171 | case 17: 172 | h->stream_id = ntohl(p[1]); 173 | h->class_id = 0; 174 | h->integer_secs = 0; 175 | h->fractional_secs = 0; 176 | n32_bit_words_header = 2; 177 | h->trailer = ntohl(p[len-1]); 178 | n32_bit_words_trailer = 1; 179 | break; 180 | 181 | case 18: 182 | h->stream_id = 0; 183 | h->class_id = ((uint64_t)(ntohl(p[1])) << 32) | ntohl(p[2]); 184 | h->integer_secs = 0; 185 | h->fractional_secs = 0; 186 | n32_bit_words_header = 3; 187 | h->trailer = ntohl(p[len-1]); 188 | n32_bit_words_trailer = 1; 189 | break; 190 | 191 | case 19: 192 | h->stream_id = ntohl(p[1]); 193 | h->class_id = ((uint64_t)(ntohl(p[2])) << 32) | ntohl(p[3]); 194 | h->integer_secs = 0; 195 | h->fractional_secs = 0; 196 | n32_bit_words_header = 4; 197 | h->trailer = ntohl(p[len-1]); 198 | n32_bit_words_trailer = 1; 199 | break; 200 | 201 | case 20: 202 | h->stream_id = 0; 203 | h->class_id = 0; 204 | h->integer_secs = ntohl(p[1]); 205 | h->fractional_secs = 0; 206 | n32_bit_words_header = 2; 207 | h->trailer = ntohl(p[len-1]); 208 | n32_bit_words_trailer = 1; 209 | break; 210 | 211 | case 21: 212 | h->stream_id = ntohl(p[1]); 213 | h->class_id = 0; 214 | h->integer_secs = ntohl(p[2]); 215 | h->fractional_secs = 0; 216 | n32_bit_words_header = 3; 217 | h->trailer = ntohl(p[len-1]); 218 | n32_bit_words_trailer = 1; 219 | break; 220 | 221 | case 22: 222 | h->stream_id = 0; 223 | h->class_id = ((uint64_t)(ntohl(p[1])) << 32) | ntohl(p[2]); 224 | h->integer_secs = ntohl(p[3]); 225 | h->fractional_secs = 0; 226 | n32_bit_words_header = 4; 227 | h->trailer = ntohl(p[len-1]); 228 | n32_bit_words_trailer = 1; 229 | break; 230 | 231 | case 23: 232 | h->stream_id = ntohl(p[1]); 233 | h->class_id = ((uint64_t)(ntohl(p[2])) << 32) | ntohl(p[3]); 234 | h->integer_secs = ntohl(p[4]); 235 | h->fractional_secs = 0; 236 | n32_bit_words_header = 5; 237 | h->trailer = ntohl(p[len-1]); 238 | n32_bit_words_trailer = 1; 239 | break; 240 | 241 | case 24: 242 | h->stream_id = 0; 243 | h->class_id = 0; 244 | h->integer_secs = 0; 245 | h->fractional_secs = ((uint64_t)(ntohl(p[1])) << 32) | ntohl(p[2]); 246 | n32_bit_words_header = 3; 247 | h->trailer = ntohl(p[len-1]); 248 | n32_bit_words_trailer = 1; 249 | break; 250 | 251 | case 25: 252 | h->stream_id = ntohl(p[1]); 253 | h->class_id = 0; 254 | h->integer_secs = 0; 255 | h->fractional_secs = ((uint64_t)(ntohl(p[2])) << 32) | ntohl(p[3]); 256 | n32_bit_words_header = 4; 257 | h->trailer = ntohl(p[len-1]); 258 | n32_bit_words_trailer = 1; 259 | break; 260 | 261 | case 26: 262 | h->stream_id = 0; 263 | h->class_id = ((uint64_t)(ntohl(p[1])) << 32) | ntohl(p[2]); 264 | h->integer_secs = 0; 265 | h->fractional_secs = ((uint64_t)(ntohl(p[3])) << 32) | ntohl(p[4]); 266 | n32_bit_words_header = 5; 267 | h->trailer = ntohl(p[len-1]); 268 | n32_bit_words_trailer = 1; 269 | break; 270 | 271 | case 27: 272 | h->stream_id = ntohl(p[1]); 273 | h->class_id = ((uint64_t)(ntohl(p[2])) << 32) | ntohl(p[3]); 274 | h->integer_secs = 0; 275 | h->fractional_secs = ((uint64_t)(ntohl(p[4])) << 32) | ntohl(p[5]); 276 | n32_bit_words_header = 6; 277 | h->trailer = ntohl(p[len-1]); 278 | n32_bit_words_trailer = 1; 279 | break; 280 | 281 | case 28: 282 | h->stream_id = 0; 283 | h->class_id = 0; 284 | h->integer_secs = ntohl(p[1]); 285 | h->fractional_secs = ((uint64_t)(ntohl(p[2])) << 32) | ntohl(p[3]); 286 | n32_bit_words_header = 4; 287 | h->trailer = ntohl(p[len-1]); 288 | n32_bit_words_trailer = 1; 289 | break; 290 | 291 | case 29: 292 | h->stream_id = ntohl(p[1]); 293 | h->class_id = 0; 294 | h->integer_secs = ntohl(p[2]); 295 | h->fractional_secs = ((uint64_t)(ntohl(p[3])) << 32) | ntohl(p[4]); 296 | n32_bit_words_header = 5; 297 | h->trailer = ntohl(p[len-1]); 298 | n32_bit_words_trailer = 1; 299 | break; 300 | 301 | case 30: 302 | h->stream_id = 0; 303 | h->class_id = ((uint64_t)(ntohl(p[1])) << 32) | ntohl(p[2]); 304 | h->integer_secs = ntohl(p[3]); 305 | h->fractional_secs = ((uint64_t)(ntohl(p[4])) << 32) | ntohl(p[5]); 306 | n32_bit_words_header = 6; 307 | h->trailer = ntohl(p[len-1]); 308 | n32_bit_words_trailer = 1; 309 | break; 310 | 311 | case 31: 312 | h->stream_id = ntohl(p[1]); 313 | h->class_id = ((uint64_t)(ntohl(p[2])) << 32) | ntohl(p[3]); 314 | h->integer_secs = ntohl(p[4]); 315 | h->fractional_secs = ((uint64_t)(ntohl(p[5])) << 32) | ntohl(p[6]); 316 | n32_bit_words_header = 7; 317 | h->trailer = ntohl(p[len-1]); 318 | n32_bit_words_trailer = 1; 319 | break; 320 | 321 | -------------------------------------------------------------------------------- /vrt/lib/expanded_header_pack_switch_body.h: -------------------------------------------------------------------------------- 1 | case 0: 2 | *n32_bit_words_header = 1; 3 | *n32_bit_words_trailer = 0; 4 | break; 5 | 6 | case 1: 7 | header[1] = htonl(h->stream_id); 8 | *n32_bit_words_header = 2; 9 | *n32_bit_words_trailer = 0; 10 | break; 11 | 12 | case 2: 13 | header[1] = htonl((uint32_t)((h->class_id >> 32) & 0xffffffff)); 14 | header[2] = htonl((uint32_t)((h->class_id >> 0) & 0xffffffff)); 15 | *n32_bit_words_header = 3; 16 | *n32_bit_words_trailer = 0; 17 | break; 18 | 19 | case 3: 20 | header[1] = htonl(h->stream_id); 21 | header[2] = htonl((uint32_t)((h->class_id >> 32) & 0xffffffff)); 22 | header[3] = htonl((uint32_t)((h->class_id >> 0) & 0xffffffff)); 23 | *n32_bit_words_header = 4; 24 | *n32_bit_words_trailer = 0; 25 | break; 26 | 27 | case 4: 28 | header[1] = htonl(h->integer_secs); 29 | *n32_bit_words_header = 2; 30 | *n32_bit_words_trailer = 0; 31 | break; 32 | 33 | case 5: 34 | header[1] = htonl(h->stream_id); 35 | header[2] = htonl(h->integer_secs); 36 | *n32_bit_words_header = 3; 37 | *n32_bit_words_trailer = 0; 38 | break; 39 | 40 | case 6: 41 | header[1] = htonl((uint32_t)((h->class_id >> 32) & 0xffffffff)); 42 | header[2] = htonl((uint32_t)((h->class_id >> 0) & 0xffffffff)); 43 | header[3] = htonl(h->integer_secs); 44 | *n32_bit_words_header = 4; 45 | *n32_bit_words_trailer = 0; 46 | break; 47 | 48 | case 7: 49 | header[1] = htonl(h->stream_id); 50 | header[2] = htonl((uint32_t)((h->class_id >> 32) & 0xffffffff)); 51 | header[3] = htonl((uint32_t)((h->class_id >> 0) & 0xffffffff)); 52 | header[4] = htonl(h->integer_secs); 53 | *n32_bit_words_header = 5; 54 | *n32_bit_words_trailer = 0; 55 | break; 56 | 57 | case 8: 58 | header[1] = htonl((uint32_t)((h->fractional_secs >> 32) & 0xffffffff)); 59 | header[2] = htonl((uint32_t)((h->fractional_secs >> 0) & 0xffffffff)); 60 | *n32_bit_words_header = 3; 61 | *n32_bit_words_trailer = 0; 62 | break; 63 | 64 | case 9: 65 | header[1] = htonl(h->stream_id); 66 | header[2] = htonl((uint32_t)((h->fractional_secs >> 32) & 0xffffffff)); 67 | header[3] = htonl((uint32_t)((h->fractional_secs >> 0) & 0xffffffff)); 68 | *n32_bit_words_header = 4; 69 | *n32_bit_words_trailer = 0; 70 | break; 71 | 72 | case 10: 73 | header[1] = htonl((uint32_t)((h->class_id >> 32) & 0xffffffff)); 74 | header[2] = htonl((uint32_t)((h->class_id >> 0) & 0xffffffff)); 75 | header[3] = htonl((uint32_t)((h->fractional_secs >> 32) & 0xffffffff)); 76 | header[4] = htonl((uint32_t)((h->fractional_secs >> 0) & 0xffffffff)); 77 | *n32_bit_words_header = 5; 78 | *n32_bit_words_trailer = 0; 79 | break; 80 | 81 | case 11: 82 | header[1] = htonl(h->stream_id); 83 | header[2] = htonl((uint32_t)((h->class_id >> 32) & 0xffffffff)); 84 | header[3] = htonl((uint32_t)((h->class_id >> 0) & 0xffffffff)); 85 | header[4] = htonl((uint32_t)((h->fractional_secs >> 32) & 0xffffffff)); 86 | header[5] = htonl((uint32_t)((h->fractional_secs >> 0) & 0xffffffff)); 87 | *n32_bit_words_header = 6; 88 | *n32_bit_words_trailer = 0; 89 | break; 90 | 91 | case 12: 92 | header[1] = htonl(h->integer_secs); 93 | header[2] = htonl((uint32_t)((h->fractional_secs >> 32) & 0xffffffff)); 94 | header[3] = htonl((uint32_t)((h->fractional_secs >> 0) & 0xffffffff)); 95 | *n32_bit_words_header = 4; 96 | *n32_bit_words_trailer = 0; 97 | break; 98 | 99 | case 13: 100 | header[1] = htonl(h->stream_id); 101 | header[2] = htonl(h->integer_secs); 102 | header[3] = htonl((uint32_t)((h->fractional_secs >> 32) & 0xffffffff)); 103 | header[4] = htonl((uint32_t)((h->fractional_secs >> 0) & 0xffffffff)); 104 | *n32_bit_words_header = 5; 105 | *n32_bit_words_trailer = 0; 106 | break; 107 | 108 | case 14: 109 | header[1] = htonl((uint32_t)((h->class_id >> 32) & 0xffffffff)); 110 | header[2] = htonl((uint32_t)((h->class_id >> 0) & 0xffffffff)); 111 | header[3] = htonl(h->integer_secs); 112 | header[4] = htonl((uint32_t)((h->fractional_secs >> 32) & 0xffffffff)); 113 | header[5] = htonl((uint32_t)((h->fractional_secs >> 0) & 0xffffffff)); 114 | *n32_bit_words_header = 6; 115 | *n32_bit_words_trailer = 0; 116 | break; 117 | 118 | case 15: 119 | header[1] = htonl(h->stream_id); 120 | header[2] = htonl((uint32_t)((h->class_id >> 32) & 0xffffffff)); 121 | header[3] = htonl((uint32_t)((h->class_id >> 0) & 0xffffffff)); 122 | header[4] = htonl(h->integer_secs); 123 | header[5] = htonl((uint32_t)((h->fractional_secs >> 32) & 0xffffffff)); 124 | header[6] = htonl((uint32_t)((h->fractional_secs >> 0) & 0xffffffff)); 125 | *n32_bit_words_header = 7; 126 | *n32_bit_words_trailer = 0; 127 | break; 128 | 129 | case 16: 130 | *n32_bit_words_header = 1; 131 | trailer[0] = htonl(h->trailer); 132 | *n32_bit_words_trailer = 1; 133 | break; 134 | 135 | case 17: 136 | header[1] = htonl(h->stream_id); 137 | *n32_bit_words_header = 2; 138 | trailer[0] = htonl(h->trailer); 139 | *n32_bit_words_trailer = 1; 140 | break; 141 | 142 | case 18: 143 | header[1] = htonl((uint32_t)((h->class_id >> 32) & 0xffffffff)); 144 | header[2] = htonl((uint32_t)((h->class_id >> 0) & 0xffffffff)); 145 | *n32_bit_words_header = 3; 146 | trailer[0] = htonl(h->trailer); 147 | *n32_bit_words_trailer = 1; 148 | break; 149 | 150 | case 19: 151 | header[1] = htonl(h->stream_id); 152 | header[2] = htonl((uint32_t)((h->class_id >> 32) & 0xffffffff)); 153 | header[3] = htonl((uint32_t)((h->class_id >> 0) & 0xffffffff)); 154 | *n32_bit_words_header = 4; 155 | trailer[0] = htonl(h->trailer); 156 | *n32_bit_words_trailer = 1; 157 | break; 158 | 159 | case 20: 160 | header[1] = htonl(h->integer_secs); 161 | *n32_bit_words_header = 2; 162 | trailer[0] = htonl(h->trailer); 163 | *n32_bit_words_trailer = 1; 164 | break; 165 | 166 | case 21: 167 | header[1] = htonl(h->stream_id); 168 | header[2] = htonl(h->integer_secs); 169 | *n32_bit_words_header = 3; 170 | trailer[0] = htonl(h->trailer); 171 | *n32_bit_words_trailer = 1; 172 | break; 173 | 174 | case 22: 175 | header[1] = htonl((uint32_t)((h->class_id >> 32) & 0xffffffff)); 176 | header[2] = htonl((uint32_t)((h->class_id >> 0) & 0xffffffff)); 177 | header[3] = htonl(h->integer_secs); 178 | *n32_bit_words_header = 4; 179 | trailer[0] = htonl(h->trailer); 180 | *n32_bit_words_trailer = 1; 181 | break; 182 | 183 | case 23: 184 | header[1] = htonl(h->stream_id); 185 | header[2] = htonl((uint32_t)((h->class_id >> 32) & 0xffffffff)); 186 | header[3] = htonl((uint32_t)((h->class_id >> 0) & 0xffffffff)); 187 | header[4] = htonl(h->integer_secs); 188 | *n32_bit_words_header = 5; 189 | trailer[0] = htonl(h->trailer); 190 | *n32_bit_words_trailer = 1; 191 | break; 192 | 193 | case 24: 194 | header[1] = htonl((uint32_t)((h->fractional_secs >> 32) & 0xffffffff)); 195 | header[2] = htonl((uint32_t)((h->fractional_secs >> 0) & 0xffffffff)); 196 | *n32_bit_words_header = 3; 197 | trailer[0] = htonl(h->trailer); 198 | *n32_bit_words_trailer = 1; 199 | break; 200 | 201 | case 25: 202 | header[1] = htonl(h->stream_id); 203 | header[2] = htonl((uint32_t)((h->fractional_secs >> 32) & 0xffffffff)); 204 | header[3] = htonl((uint32_t)((h->fractional_secs >> 0) & 0xffffffff)); 205 | *n32_bit_words_header = 4; 206 | trailer[0] = htonl(h->trailer); 207 | *n32_bit_words_trailer = 1; 208 | break; 209 | 210 | case 26: 211 | header[1] = htonl((uint32_t)((h->class_id >> 32) & 0xffffffff)); 212 | header[2] = htonl((uint32_t)((h->class_id >> 0) & 0xffffffff)); 213 | header[3] = htonl((uint32_t)((h->fractional_secs >> 32) & 0xffffffff)); 214 | header[4] = htonl((uint32_t)((h->fractional_secs >> 0) & 0xffffffff)); 215 | *n32_bit_words_header = 5; 216 | trailer[0] = htonl(h->trailer); 217 | *n32_bit_words_trailer = 1; 218 | break; 219 | 220 | case 27: 221 | header[1] = htonl(h->stream_id); 222 | header[2] = htonl((uint32_t)((h->class_id >> 32) & 0xffffffff)); 223 | header[3] = htonl((uint32_t)((h->class_id >> 0) & 0xffffffff)); 224 | header[4] = htonl((uint32_t)((h->fractional_secs >> 32) & 0xffffffff)); 225 | header[5] = htonl((uint32_t)((h->fractional_secs >> 0) & 0xffffffff)); 226 | *n32_bit_words_header = 6; 227 | trailer[0] = htonl(h->trailer); 228 | *n32_bit_words_trailer = 1; 229 | break; 230 | 231 | case 28: 232 | header[1] = htonl(h->integer_secs); 233 | header[2] = htonl((uint32_t)((h->fractional_secs >> 32) & 0xffffffff)); 234 | header[3] = htonl((uint32_t)((h->fractional_secs >> 0) & 0xffffffff)); 235 | *n32_bit_words_header = 4; 236 | trailer[0] = htonl(h->trailer); 237 | *n32_bit_words_trailer = 1; 238 | break; 239 | 240 | case 29: 241 | header[1] = htonl(h->stream_id); 242 | header[2] = htonl(h->integer_secs); 243 | header[3] = htonl((uint32_t)((h->fractional_secs >> 32) & 0xffffffff)); 244 | header[4] = htonl((uint32_t)((h->fractional_secs >> 0) & 0xffffffff)); 245 | *n32_bit_words_header = 5; 246 | trailer[0] = htonl(h->trailer); 247 | *n32_bit_words_trailer = 1; 248 | break; 249 | 250 | case 30: 251 | header[1] = htonl((uint32_t)((h->class_id >> 32) & 0xffffffff)); 252 | header[2] = htonl((uint32_t)((h->class_id >> 0) & 0xffffffff)); 253 | header[3] = htonl(h->integer_secs); 254 | header[4] = htonl((uint32_t)((h->fractional_secs >> 32) & 0xffffffff)); 255 | header[5] = htonl((uint32_t)((h->fractional_secs >> 0) & 0xffffffff)); 256 | *n32_bit_words_header = 6; 257 | trailer[0] = htonl(h->trailer); 258 | *n32_bit_words_trailer = 1; 259 | break; 260 | 261 | case 31: 262 | header[1] = htonl(h->stream_id); 263 | header[2] = htonl((uint32_t)((h->class_id >> 32) & 0xffffffff)); 264 | header[3] = htonl((uint32_t)((h->class_id >> 0) & 0xffffffff)); 265 | header[4] = htonl(h->integer_secs); 266 | header[5] = htonl((uint32_t)((h->fractional_secs >> 32) & 0xffffffff)); 267 | header[6] = htonl((uint32_t)((h->fractional_secs >> 0) & 0xffffffff)); 268 | *n32_bit_words_header = 7; 269 | trailer[0] = htonl(h->trailer); 270 | *n32_bit_words_trailer = 1; 271 | break; 272 | 273 | -------------------------------------------------------------------------------- /vrt/m4/acx_pthread.m4: -------------------------------------------------------------------------------- 1 | # =========================================================================== 2 | # http://autoconf-archive.cryp.to/acx_pthread.html 3 | # =========================================================================== 4 | # 5 | # SYNOPSIS 6 | # 7 | # ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) 8 | # 9 | # DESCRIPTION 10 | # 11 | # This macro figures out how to build C programs using POSIX threads. It 12 | # sets the PTHREAD_LIBS output variable to the threads library and linker 13 | # flags, and the PTHREAD_CFLAGS output variable to any special C compiler 14 | # flags that are needed. (The user can also force certain compiler 15 | # flags/libs to be tested by setting these environment variables.) 16 | # 17 | # Also sets PTHREAD_CC to any special C compiler that is needed for 18 | # multi-threaded programs (defaults to the value of CC otherwise). (This 19 | # is necessary on AIX to use the special cc_r compiler alias.) 20 | # 21 | # NOTE: You are assumed to not only compile your program with these flags, 22 | # but also link it with them as well. e.g. you should link with 23 | # $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS 24 | # 25 | # If you are only building threads programs, you may wish to use these 26 | # variables in your default LIBS, CFLAGS, and CC: 27 | # 28 | # LIBS="$PTHREAD_LIBS $LIBS" 29 | # CFLAGS="$CFLAGS $PTHREAD_CFLAGS" 30 | # CC="$PTHREAD_CC" 31 | # 32 | # In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant 33 | # has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to that name 34 | # (e.g. PTHREAD_CREATE_UNDETACHED on AIX). 35 | # 36 | # ACTION-IF-FOUND is a list of shell commands to run if a threads library 37 | # is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it 38 | # is not found. If ACTION-IF-FOUND is not specified, the default action 39 | # will define HAVE_PTHREAD. 40 | # 41 | # Please let the authors know if this macro fails on any platform, or if 42 | # you have any other suggestions or comments. This macro was based on work 43 | # by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help 44 | # from M. Frigo), as well as ac_pthread and hb_pthread macros posted by 45 | # Alejandro Forero Cuervo to the autoconf macro repository. We are also 46 | # grateful for the helpful feedback of numerous users. 47 | # 48 | # LAST MODIFICATION 49 | # 50 | # 2008-04-12 51 | # 52 | # COPYLEFT 53 | # 54 | # Copyright (c) 2008 Steven G. Johnson 55 | # 56 | # This program is free software: you can redistribute it and/or modify it 57 | # under the terms of the GNU General Public License as published by the 58 | # Free Software Foundation, either version 3 of the License, or (at your 59 | # option) any later version. 60 | # 61 | # This program is distributed in the hope that it will be useful, but 62 | # WITHOUT ANY WARRANTY; without even the implied warranty of 63 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 64 | # Public License for more details. 65 | # 66 | # You should have received a copy of the GNU General Public License along 67 | # with this program. If not, see . 68 | # 69 | # As a special exception, the respective Autoconf Macro's copyright owner 70 | # gives unlimited permission to copy, distribute and modify the configure 71 | # scripts that are the output of Autoconf when processing the Macro. You 72 | # need not follow the terms of the GNU General Public License when using 73 | # or distributing such scripts, even though portions of the text of the 74 | # Macro appear in them. The GNU General Public License (GPL) does govern 75 | # all other use of the material that constitutes the Autoconf Macro. 76 | # 77 | # This special exception to the GPL applies to versions of the Autoconf 78 | # Macro released by the Autoconf Macro Archive. When you make and 79 | # distribute a modified version of the Autoconf Macro, you may extend this 80 | # special exception to the GPL to apply to your modified version as well. 81 | 82 | AC_DEFUN([ACX_PTHREAD], [ 83 | AC_REQUIRE([AC_CANONICAL_HOST]) 84 | AC_LANG_SAVE 85 | AC_LANG_C 86 | acx_pthread_ok=no 87 | 88 | # We used to check for pthread.h first, but this fails if pthread.h 89 | # requires special compiler flags (e.g. on True64 or Sequent). 90 | # It gets checked for in the link test anyway. 91 | 92 | # First of all, check if the user has set any of the PTHREAD_LIBS, 93 | # etcetera environment variables, and if threads linking works using 94 | # them: 95 | if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then 96 | save_CFLAGS="$CFLAGS" 97 | CFLAGS="$CFLAGS $PTHREAD_CFLAGS" 98 | save_LIBS="$LIBS" 99 | LIBS="$PTHREAD_LIBS $LIBS" 100 | AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS]) 101 | AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes) 102 | AC_MSG_RESULT($acx_pthread_ok) 103 | if test x"$acx_pthread_ok" = xno; then 104 | PTHREAD_LIBS="" 105 | PTHREAD_CFLAGS="" 106 | fi 107 | LIBS="$save_LIBS" 108 | CFLAGS="$save_CFLAGS" 109 | fi 110 | 111 | # We must check for the threads library under a number of different 112 | # names; the ordering is very important because some systems 113 | # (e.g. DEC) have both -lpthread and -lpthreads, where one of the 114 | # libraries is broken (non-POSIX). 115 | 116 | # Create a list of thread flags to try. Items starting with a "-" are 117 | # C compiler flags, and other items are library names, except for "none" 118 | # which indicates that we try without any flags at all, and "pthread-config" 119 | # which is a program returning the flags for the Pth emulation library. 120 | 121 | acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" 122 | 123 | # The ordering *is* (sometimes) important. Some notes on the 124 | # individual items follow: 125 | 126 | # pthreads: AIX (must check this before -lpthread) 127 | # none: in case threads are in libc; should be tried before -Kthread and 128 | # other compiler flags to prevent continual compiler warnings 129 | # -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) 130 | # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) 131 | # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) 132 | # -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads) 133 | # -pthreads: Solaris/gcc 134 | # -mthreads: Mingw32/gcc, Lynx/gcc 135 | # -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it 136 | # doesn't hurt to check since this sometimes defines pthreads too; 137 | # also defines -D_REENTRANT) 138 | # ... -mt is also the pthreads flag for HP/aCC 139 | # pthread: Linux, etcetera 140 | # --thread-safe: KAI C++ 141 | # pthread-config: use pthread-config program (for GNU Pth library) 142 | 143 | case "${host_cpu}-${host_os}" in 144 | *solaris*) 145 | 146 | # On Solaris (at least, for some versions), libc contains stubbed 147 | # (non-functional) versions of the pthreads routines, so link-based 148 | # tests will erroneously succeed. (We need to link with -pthreads/-mt/ 149 | # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather 150 | # a function called by this macro, so we could check for that, but 151 | # who knows whether they'll stub that too in a future libc.) So, 152 | # we'll just look for -pthreads and -lpthread first: 153 | 154 | acx_pthread_flags="-pthreads pthread -mt -pthread $acx_pthread_flags" 155 | ;; 156 | esac 157 | 158 | if test x"$acx_pthread_ok" = xno; then 159 | for flag in $acx_pthread_flags; do 160 | 161 | case $flag in 162 | none) 163 | AC_MSG_CHECKING([whether pthreads work without any flags]) 164 | ;; 165 | 166 | -*) 167 | AC_MSG_CHECKING([whether pthreads work with $flag]) 168 | PTHREAD_CFLAGS="$flag" 169 | ;; 170 | 171 | pthread-config) 172 | AC_CHECK_PROG(acx_pthread_config, pthread-config, yes, no) 173 | if test x"$acx_pthread_config" = xno; then continue; fi 174 | PTHREAD_CFLAGS="`pthread-config --cflags`" 175 | PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" 176 | ;; 177 | 178 | *) 179 | AC_MSG_CHECKING([for the pthreads library -l$flag]) 180 | PTHREAD_LIBS="-l$flag" 181 | ;; 182 | esac 183 | 184 | save_LIBS="$LIBS" 185 | save_CFLAGS="$CFLAGS" 186 | LIBS="$PTHREAD_LIBS $LIBS" 187 | CFLAGS="$CFLAGS $PTHREAD_CFLAGS" 188 | 189 | # Check for various functions. We must include pthread.h, 190 | # since some functions may be macros. (On the Sequent, we 191 | # need a special flag -Kthread to make this header compile.) 192 | # We check for pthread_join because it is in -lpthread on IRIX 193 | # while pthread_create is in libc. We check for pthread_attr_init 194 | # due to DEC craziness with -lpthreads. We check for 195 | # pthread_cleanup_push because it is one of the few pthread 196 | # functions on Solaris that doesn't have a non-functional libc stub. 197 | # We try pthread_create on general principles. 198 | AC_TRY_LINK([#include ], 199 | [pthread_t th; pthread_join(th, 0); 200 | pthread_attr_init(0); pthread_cleanup_push(0, 0); 201 | pthread_create(0,0,0,0); pthread_cleanup_pop(0); ], 202 | [acx_pthread_ok=yes]) 203 | 204 | LIBS="$save_LIBS" 205 | CFLAGS="$save_CFLAGS" 206 | 207 | AC_MSG_RESULT($acx_pthread_ok) 208 | if test "x$acx_pthread_ok" = xyes; then 209 | break; 210 | fi 211 | 212 | PTHREAD_LIBS="" 213 | PTHREAD_CFLAGS="" 214 | done 215 | fi 216 | 217 | # Various other checks: 218 | if test "x$acx_pthread_ok" = xyes; then 219 | save_LIBS="$LIBS" 220 | LIBS="$PTHREAD_LIBS $LIBS" 221 | save_CFLAGS="$CFLAGS" 222 | CFLAGS="$CFLAGS $PTHREAD_CFLAGS" 223 | 224 | # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. 225 | AC_MSG_CHECKING([for joinable pthread attribute]) 226 | attr_name=unknown 227 | for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do 228 | AC_TRY_LINK([#include ], [int attr=$attr; return attr;], 229 | [attr_name=$attr; break]) 230 | done 231 | AC_MSG_RESULT($attr_name) 232 | if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then 233 | AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name, 234 | [Define to necessary symbol if this constant 235 | uses a non-standard name on your system.]) 236 | fi 237 | 238 | AC_MSG_CHECKING([if more special flags are required for pthreads]) 239 | flag=no 240 | case "${host_cpu}-${host_os}" in 241 | *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";; 242 | *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";; 243 | esac 244 | AC_MSG_RESULT(${flag}) 245 | if test "x$flag" != xno; then 246 | PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" 247 | fi 248 | 249 | LIBS="$save_LIBS" 250 | CFLAGS="$save_CFLAGS" 251 | 252 | # More AIX lossage: must compile with xlc_r or cc_r 253 | if test x"$GCC" != xyes; then 254 | AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC}) 255 | else 256 | PTHREAD_CC=$CC 257 | fi 258 | else 259 | PTHREAD_CC="$CC" 260 | fi 261 | 262 | AC_SUBST(PTHREAD_LIBS) 263 | AC_SUBST(PTHREAD_CFLAGS) 264 | AC_SUBST(PTHREAD_CC) 265 | 266 | # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: 267 | if test x"$acx_pthread_ok" = xyes; then 268 | ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1]) 269 | : 270 | else 271 | acx_pthread_ok=no 272 | $2 273 | fi 274 | AC_LANG_RESTORE 275 | ])dnl ACX_PTHREAD 276 | -------------------------------------------------------------------------------- /vrt/m4/ax_boost_base.m4: -------------------------------------------------------------------------------- 1 | # =========================================================================== 2 | # http://autoconf-archive.cryp.to/ax_boost_base.html 3 | # =========================================================================== 4 | # 5 | # SYNOPSIS 6 | # 7 | # AX_BOOST_BASE([MINIMUM-VERSION]) 8 | # 9 | # DESCRIPTION 10 | # 11 | # Test for the Boost C++ libraries of a particular version (or newer) 12 | # 13 | # If no path to the installed boost library is given the macro searchs 14 | # under /usr, /usr/local, /opt and /opt/local and evaluates the 15 | # $BOOST_ROOT environment variable. Further documentation is available at 16 | # . 17 | # 18 | # This macro calls: 19 | # 20 | # AC_SUBST(BOOST_CPPFLAGS) / AC_SUBST(BOOST_LDFLAGS) 21 | # 22 | # And sets: 23 | # 24 | # HAVE_BOOST 25 | # 26 | # LAST MODIFICATION 27 | # 28 | # 2008-04-12 29 | # 30 | # COPYLEFT 31 | # 32 | # Copyright (c) 2008 Thomas Porschberg 33 | # Copyright (c) 2008 Free Software Foundation, Inc. 34 | # 35 | # Copying and distribution of this file, with or without modification, are 36 | # permitted in any medium without royalty provided the copyright notice 37 | # and this notice are preserved. 38 | 39 | AC_DEFUN([AX_BOOST_BASE], 40 | [ 41 | AC_REQUIRE([GR_LIB64]) 42 | AC_ARG_WITH([boost], 43 | AS_HELP_STRING([--with-boost@<:@=DIR@:>@], 44 | [use boost (default is yes) - it is possible to specify the root directory for boost (optional)]), 45 | [ 46 | if test "$withval" = "no"; then 47 | want_boost="no" 48 | elif test "$withval" = "yes"; then 49 | want_boost="yes" 50 | ac_boost_path="" 51 | else 52 | want_boost="yes" 53 | ac_boost_path="$withval" 54 | fi 55 | ], 56 | [want_boost="yes"]) 57 | 58 | 59 | AC_ARG_WITH([boost-libdir], 60 | AS_HELP_STRING([--with-boost-libdir=LIB_DIR], 61 | [Force given directory for boost libraries. Note that this 62 | will overwrite library path detection, so use this parameter 63 | only if default library detection fails and you know exactly 64 | where your boost libraries are located.]), 65 | [ 66 | if test -d $withval 67 | then 68 | ac_boost_lib_path="$withval" 69 | else 70 | AC_MSG_ERROR(--with-boost-libdir expected directory name) 71 | fi 72 | ], 73 | [ac_boost_lib_path=""] 74 | ) 75 | 76 | if test "x$want_boost" = "xyes"; then 77 | boost_lib_version_req=ifelse([$1], ,1.20.0,$1) 78 | boost_lib_version_req_shorten=`expr $boost_lib_version_req : '\([[0-9]]*\.[[0-9]]*\)'` 79 | boost_lib_version_req_major=`expr $boost_lib_version_req : '\([[0-9]]*\)'` 80 | boost_lib_version_req_minor=`expr $boost_lib_version_req : '[[0-9]]*\.\([[0-9]]*\)'` 81 | boost_lib_version_req_sub_minor=`expr $boost_lib_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'` 82 | if test "x$boost_lib_version_req_sub_minor" = "x" ; then 83 | boost_lib_version_req_sub_minor="0" 84 | fi 85 | WANT_BOOST_VERSION=`expr $boost_lib_version_req_major \* 100000 \+ $boost_lib_version_req_minor \* 100 \+ $boost_lib_version_req_sub_minor` 86 | AC_MSG_CHECKING(for boost >= $boost_lib_version_req) 87 | succeeded=no 88 | 89 | dnl first we check the system location for boost libraries 90 | dnl this location ist chosen if boost libraries are installed with the --layout=system option 91 | dnl or if you install boost with RPM 92 | if test "$ac_boost_path" != ""; then 93 | dnl Look first where we think they ought to be, accounting for a possible "64" suffix on lib. 94 | dnl If that directory doesn't exist, fall back to the default behavior 95 | if test -d "$ac_boost_path/lib${gr_libdir_suffix}"; then 96 | BOOST_LDFLAGS="-L$ac_boost_path/lib${gr_libdir_suffix}" 97 | else 98 | BOOST_LDFLAGS="-L$ac_boost_path/lib" 99 | fi 100 | BOOST_CPPFLAGS="-I$ac_boost_path/include" 101 | else 102 | for ac_boost_path_tmp in /usr /usr/local /opt /opt/local ; do 103 | if test -d "$ac_boost_path_tmp/include/boost" && test -r "$ac_boost_path_tmp/include/boost"; then 104 | dnl Look first where we think they ought to be, accounting for a possible "64" suffix on lib. 105 | dnl If that directory doesn't exist, fall back to the default behavior 106 | if test -d "$ac_boost_path_tmp/lib${gr_libdir_suffix}"; then 107 | BOOST_LDFLAGS="-L$ac_boost_path_tmp/lib${gr_libdir_suffix}" 108 | else 109 | BOOST_LDFLAGS="-L$ac_boost_path_tmp/lib" 110 | fi 111 | BOOST_CPPFLAGS="-I$ac_boost_path_tmp/include" 112 | break; 113 | fi 114 | done 115 | fi 116 | 117 | dnl overwrite ld flags if we have required special directory with 118 | dnl --with-boost-libdir parameter 119 | if test "$ac_boost_lib_path" != ""; then 120 | BOOST_LDFLAGS="-L$ac_boost_lib_path" 121 | fi 122 | 123 | CPPFLAGS_SAVED="$CPPFLAGS" 124 | CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" 125 | export CPPFLAGS 126 | 127 | LDFLAGS_SAVED="$LDFLAGS" 128 | LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" 129 | export LDFLAGS 130 | 131 | AC_LANG_PUSH(C++) 132 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 133 | @%:@include 134 | ]], [[ 135 | #if BOOST_VERSION >= $WANT_BOOST_VERSION 136 | // Everything is okay 137 | #else 138 | # error Boost version is too old 139 | #endif 140 | ]])],[AC_MSG_RESULT(yes) 141 | succeeded=yes 142 | found_system=yes 143 | ], 144 | []) 145 | AC_LANG_POP([C++]) 146 | CPPFLAGS="$CPPFLAGS_SAVED" 147 | LDFLAGS="$LDFLAGS_SAVED" 148 | 149 | 150 | dnl if we found no boost with system layout we search for boost libraries 151 | dnl built and installed without the --layout=system option 152 | if test "$succeeded" != "yes"; then 153 | _version=0 154 | 155 | if test "$ac_boost_path" != ""; then 156 | path_list="$ac_boost_path" 157 | else 158 | path_list="/usr /usr/local /opt /opt/local" 159 | fi 160 | for ac_boost_path in $path_list ; do 161 | if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then 162 | for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do 163 | _version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's,/include/boost-,,; s,_,.,'` 164 | V_CHECK=`expr $_version_tmp \> $_version` 165 | if test "$V_CHECK" = "1" ; then 166 | _version=$_version_tmp 167 | best_path=$ac_boost_path 168 | fi 169 | done 170 | fi 171 | done 172 | 173 | VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'` 174 | BOOST_CPPFLAGS="-I$best_path/include/boost-$VERSION_UNDERSCORE" 175 | 176 | if test "$ac_boost_lib_path" = ""; then 177 | dnl Look first where we think they ought to be, accounting for a possible "64" suffix on lib. 178 | dnl If that directory doesn't exist, fall back to the default behavior 179 | if test -d "$best_path/lib${gr_libdir_suffix}"; then 180 | BOOST_LDFLAGS="-L$best_path/lib${gr_libdir_suffix}" 181 | else 182 | BOOST_LDFLAGS="-L$best_path/lib" 183 | fi 184 | fi 185 | 186 | CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" 187 | export CPPFLAGS 188 | LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" 189 | export LDFLAGS 190 | 191 | AC_LANG_PUSH(C++) 192 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 193 | @%:@include 194 | ]], [[ 195 | #if BOOST_VERSION >= $WANT_BOOST_VERSION 196 | // Everything is okay 197 | #else 198 | # error Boost version is too old 199 | #endif 200 | ]])],[AC_MSG_RESULT(yes) 201 | succeeded=yes 202 | found_system=yes 203 | ], 204 | []) 205 | AC_LANG_POP([C++]) 206 | CPPFLAGS="$CPPFLAGS_SAVED" 207 | LDFLAGS="$LDFLAGS_SAVED" 208 | fi 209 | 210 | if test "$succeeded" != "yes" ; then 211 | AC_MSG_RESULT([no]) 212 | if test "$_version" = "0" ; then 213 | AC_MSG_ERROR([[we could not detect the boost libraries (version $boost_lib_version_req_shorten or higher). 214 | If you are sure you have boost installed, then check your version number looking in .]]) 215 | else 216 | AC_MSG_ERROR([your boost libraries seem to old (version $_version).]) 217 | fi 218 | else 219 | AC_SUBST(BOOST_CPPFLAGS) 220 | AC_SUBST(BOOST_LDFLAGS) 221 | AC_DEFINE(HAVE_BOOST,1,[Define if the Boost headers are available]) 222 | fi 223 | fi 224 | ]) 225 | 226 | dnl 227 | dnl Macros used by the boost items that need libraries. 228 | dnl 229 | 230 | dnl $1 is unit name. E.g., boost_thread 231 | AC_DEFUN([_AX_BOOST_CHECK_LIB],[ 232 | _AX_BOOST_CHECK_LIB_($1,HAVE_[]m4_toupper($1),m4_toupper($1)_LIB) 233 | ]) 234 | 235 | dnl $1 is unit name. E.g., boost_thread 236 | dnl $2 is AC_DEFINE name. E.g., HAVE_BOOST_THREAD 237 | dnl $3 is lib var name. E.g., BOOST_THREAD_LIB 238 | AC_DEFUN([_AX_BOOST_CHECK_LIB_],[ 239 | AC_LANG_PUSH([C++]) 240 | AC_DEFINE($2,1,[Define if the $1 library is available]) 241 | BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'` 242 | 243 | dnl See if we can find a usable library 244 | link_ok="no" 245 | if test "$ax_boost_user_lib" != ""; then 246 | dnl use what the user supplied 247 | for ax_lib in $ax_boost_user_lib $1-${ax_boost_user_lib}; do 248 | AC_CHECK_LIB($ax_lib, exit, 249 | [$3="-l$ax_lib"; AC_SUBST($3) link_ok="yes"; break]) 250 | done 251 | else 252 | dnl Look in BOOSTLIBDIR for possible candidates 253 | head=$BOOSTLIBDIR/lib[]$1 254 | for f in ${head}*.so* ${head}*.a* ${head}*.dll* ${head}*.dylib; do 255 | dnl echo 1: $f 256 | case $f in 257 | *\**) continue;; 258 | esac 259 | f=`echo $f | sed -e 's,.*/,,' -e 's,^lib,,'` 260 | dnl echo 2: $f 261 | f=`echo $f | sed -e 's,\($1.*\)\.so.*$,\1,' -e 's,\($1.*\)\.a.*$,\1,' -e 's,\($1.*\)\.dll.*$,\1,' -e 's,\($1.*\)\.dylib.*$,\1,'` 262 | dnl echo 3: $f 263 | 264 | ax_lib=$f 265 | AC_CHECK_LIB($ax_lib, exit, 266 | [$3="-l$ax_lib"; AC_SUBST($3) link_ok="yes"; break]) 267 | done 268 | fi 269 | 270 | if test "$link_ok" != "yes"; then 271 | AC_MSG_ERROR([Could not link against lib[$1]!]) 272 | fi 273 | AC_LANG_POP([C++]) 274 | ]) 275 | 276 | 277 | dnl $1 is unit name. E.g., boost_thread 278 | AC_DEFUN([_AX_BOOST_WITH],[ 279 | _AX_BOOST_WITH_($1,m4_bpatsubst($1,_,-)) 280 | ]) 281 | 282 | dnl $1 is unit name. E.g., boost_thread 283 | dnl $2 is hyphenated unit name. E.g., boost-thread 284 | AC_DEFUN([_AX_BOOST_WITH_],[ 285 | AC_ARG_WITH([$2], 286 | AC_HELP_STRING([--with-$2@<:@=special-lib@:>@], 287 | [Use the m4_substr($1,6) library from boost. It is possible to specify a certain 288 | library to the linker. E.g., --with-$2=$1-gcc41-mt-1_35]), 289 | [ 290 | if test "$withval" = "no"; then 291 | want_boost="no" 292 | elif test "$withval" = "yes"; then 293 | want_boost="yes" 294 | ax_boost_user_lib="" 295 | else 296 | want_boost="yes" 297 | ax_boost_user_lib="$withval" 298 | fi 299 | ], 300 | [want_boost="yes"]) 301 | ]) 302 | 303 | dnl $1 is unit name. E.g., boost_thread 304 | dnl $2 is AC_LANG_PROGRAM argument 1 305 | dnl $3 is AC_LANG_PROGRAM argument 2 306 | dnl $4 is cv variable name. E.g., ax_cv_boost_thread 307 | AC_DEFUN([_AX_BOOST_CHECK_],[ 308 | _AX_BOOST_WITH($1) 309 | if test "$want_boost" = "yes"; then 310 | AC_REQUIRE([AC_PROG_CC]) 311 | AC_REQUIRE([AC_PROG_CXX]) 312 | CPPFLAGS_SAVED="$CPPFLAGS" 313 | CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" 314 | LDFLAGS_SAVED="$LDFLAGS" 315 | LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" 316 | AC_CACHE_CHECK([whether the boost::m4_substr([$1],6) includes are available], [$4], 317 | [AC_LANG_PUSH([C++]) 318 | AC_COMPILE_IFELSE(AC_LANG_PROGRAM([$2],[$3]),[$4]=yes,[$4]=no) 319 | AC_LANG_POP([C++]) 320 | ]) 321 | if test "$[$4]" = "yes"; then 322 | _AX_BOOST_CHECK_LIB([$1]) 323 | fi 324 | CPPFLAGS="$CPPFLAGS_SAVED" 325 | LDFLAGS="$LDFLAGS_SAVED" 326 | fi 327 | ]) 328 | 329 | dnl $1 is unit name. E.g., boost_thread 330 | dnl $2 is AC_LANG_PROGRAM argument 1 331 | dnl $3 is AC_LANG_PROGRAM argument 2 332 | AC_DEFUN([_AX_BOOST_CHECK],[ 333 | _AX_BOOST_CHECK_($1,$2,$3,ax_cv_$1) 334 | ]) 335 | -------------------------------------------------------------------------------- /vrt/lib/expanded_if_context_section.cc: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2010 Free Software Foundation, Inc. 4 | * 5 | * This file is part of GNU Radio 6 | * 7 | * GNU Radio is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 3, or (at your option) 10 | * any later version. 11 | * 12 | * GNU Radio is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 20 | */ 21 | 22 | #ifdef HAVE_CONFIG_H 23 | #include 24 | #endif 25 | #include 26 | #include 27 | //#include 28 | #include 29 | #include 30 | #include "header_utils.h" 31 | 32 | using boost::format; 33 | using boost::io::group; 34 | 35 | 36 | namespace vrt 37 | { 38 | using namespace detail; 39 | 40 | void 41 | expanded_if_context_section::clear() 42 | { 43 | context_indicator = 0; 44 | ref_point_id = 0; 45 | bandwidth = 0; 46 | if_ref_freq = 0; 47 | rf_ref_freq = 0; 48 | rf_ref_freq_offset = 0; 49 | if_band_offset = 0; 50 | ref_level = 0; 51 | gain = 0; 52 | over_range_count = 0; 53 | sample_rate = 0; 54 | timestamp_adj = 0; 55 | timestamp_cal_time = 0; 56 | temperature = 0; 57 | device_id[0] = 0; 58 | device_id[1] = 0; 59 | state_and_event_ind = 0; 60 | memset(&payload_fmt, 0, sizeof(payload_fmt)); 61 | memset(&formatted_gps, 0, sizeof(formatted_gps)); 62 | memset(&formatted_ins, 0, sizeof(formatted_ins)); 63 | memset(&ecef_ephemeris, 0, sizeof(ecef_ephemeris)); 64 | memset(&rel_ephemeris, 0, sizeof(rel_ephemeris)); 65 | ephemeris_ref_id = 0; 66 | gps_ascii.manuf_oui = 0; 67 | gps_ascii.ascii.clear(); 68 | cntx_assoc_lists.source.clear(); 69 | cntx_assoc_lists.system.clear(); 70 | cntx_assoc_lists.vector_comp.clear(); 71 | cntx_assoc_lists.async_channel.clear(); 72 | cntx_assoc_lists.async_tag.clear(); 73 | } 74 | 75 | struct unpack_info { 76 | const uint32_t *p; 77 | const size_t nwords; 78 | size_t i; 79 | 80 | unpack_info(const uint32_t *p_, size_t nwords_) 81 | : p(p_), nwords(nwords_), i(0) {} 82 | 83 | bool consumed_all() 84 | { 85 | return nwords - i == 0; 86 | } 87 | 88 | bool ensure(size_t n) 89 | { 90 | return (nwords - i) >= n; 91 | } 92 | 93 | bool get_int32(int32_t &x) 94 | { 95 | if (!ensure(1)) 96 | return false; 97 | x = ntohl(p[i++]); 98 | return true; 99 | } 100 | 101 | bool get_uint32(uint32_t &x) 102 | { 103 | if (!ensure(1)) 104 | return false; 105 | x = ntohl(p[i++]); 106 | return true; 107 | } 108 | 109 | bool get_hertz(vrt_hertz_t &x) 110 | { 111 | if (!ensure(2)) 112 | return false; 113 | 114 | uint32_t hi = ntohl(p[i++]); 115 | uint32_t lo = ntohl(p[i++]); 116 | x = ((int64_t) hi) << 32 | lo; 117 | return true; 118 | } 119 | 120 | bool get_db(vrt_db_t &x) 121 | { 122 | if (!ensure(1)) 123 | return false; 124 | x = ntohl(p[i++]); 125 | return true; 126 | } 127 | 128 | bool get_gain(vrt_gain_t &x) 129 | { 130 | if (!ensure(1)) 131 | return false; 132 | x = ntohl(p[i++]); 133 | return true; 134 | } 135 | 136 | bool get_int64(int64_t &x) 137 | { 138 | if (!ensure(2)) 139 | return false; 140 | 141 | uint32_t hi = ntohl(p[i++]); 142 | uint32_t lo = ntohl(p[i++]); 143 | x = ((int64_t) hi) << 32 | lo; 144 | return true; 145 | } 146 | 147 | bool get_temp(vrt_temp_t &x) 148 | { 149 | if (!ensure(1)) 150 | return false; 151 | x = ntohl(p[i++]) & 0xffff; 152 | return true; 153 | } 154 | 155 | bool get_nwords(uint32_t *x, unsigned int nw) 156 | { 157 | if (!ensure(nw)) 158 | return false; 159 | 160 | for (unsigned int j = 0; j < nw; j++) 161 | x[j] = ntohl(p[i++]); 162 | 163 | return true; 164 | } 165 | 166 | bool get_nwords_vector(std::vector &x, unsigned int nw) 167 | { 168 | if (!ensure(nw)) 169 | return false; 170 | x.resize(nw); 171 | return get_nwords(&x[0], nw); 172 | } 173 | 174 | bool get_formatted_gps(vrt_formatted_gps_t &x) 175 | { 176 | return get_nwords((uint32_t *) &x, 11); 177 | } 178 | 179 | bool get_ephemeris(vrt_ephemeris_t &x) 180 | { 181 | return get_nwords((uint32_t *) &x, 13); 182 | } 183 | 184 | bool get_gps_ascii(exp_gps_ascii &x) 185 | { 186 | uint32_t manuf_oui; 187 | uint32_t nw; 188 | 189 | if (!get_uint32(manuf_oui) || !get_uint32(nw)) 190 | return false; 191 | 192 | if (!ensure(nw)) 193 | return false; 194 | 195 | const char *s = (const char *)&p[i]; 196 | size_t nbytes = strnlen(s, nw * sizeof(uint32_t)); 197 | x.manuf_oui = manuf_oui; 198 | x.ascii = std::string(s, nbytes); 199 | i += nw; 200 | return true; 201 | } 202 | 203 | bool get_cntx_assoc_lists(exp_context_assocs &x) 204 | { 205 | uint32_t w0; 206 | uint32_t w1; 207 | 208 | if (!get_uint32(w0) || !get_uint32(w1)) 209 | return false; 210 | 211 | uint32_t source_list_size = (w0 >> 16) & 0x1ff; 212 | uint32_t system_list_size = w0 & 0x1ff; 213 | uint32_t vector_comp_list_size = (w1 >> 16) & 0xffff; 214 | uint32_t async_channel_list_size = w1 & 0x7fff; 215 | bool a_bit = (w1 & 0x8000) != 0; 216 | uint32_t async_tag_list_size = a_bit ? async_channel_list_size : 0; 217 | 218 | return (true 219 | && get_nwords_vector(x.source, source_list_size) 220 | && get_nwords_vector(x.system, system_list_size) 221 | && get_nwords_vector(x.vector_comp, vector_comp_list_size) 222 | && get_nwords_vector(x.async_channel, async_channel_list_size) 223 | && get_nwords_vector(x.async_tag, async_tag_list_size)); 224 | } 225 | 226 | }; 227 | 228 | bool 229 | expanded_if_context_section::unpack(const uint32_t *context_section, // in 230 | size_t n32_bit_words, // in 231 | expanded_if_context_section *e) // out 232 | { 233 | unpack_info u(context_section, n32_bit_words); 234 | e->clear(); 235 | 236 | if (!u.get_uint32(e->context_indicator)) 237 | return false; 238 | uint32_t cif = e->context_indicator; 239 | 240 | if (cif & CI_REF_POINT_ID) 241 | if (!u.get_uint32(e->ref_point_id)) 242 | return false; 243 | 244 | if (cif & CI_BANDWIDTH) 245 | if (!u.get_hertz(e->bandwidth)) 246 | return false; 247 | 248 | if (cif & CI_IF_REF_FREQ) 249 | if (!u.get_hertz(e->if_ref_freq)) 250 | return false; 251 | 252 | if (cif & CI_RF_REF_FREQ) 253 | if (!u.get_hertz(e->rf_ref_freq)) 254 | return false; 255 | 256 | if (cif & CI_RF_REF_FREQ_OFFSET) 257 | if (!u.get_hertz(e->rf_ref_freq_offset)) 258 | return false; 259 | 260 | if (cif & CI_IF_BAND_OFFSET) 261 | if (!u.get_hertz(e->if_band_offset)) 262 | return false; 263 | 264 | if (cif & CI_REF_LEVEL) 265 | if (!u.get_db(e->ref_level)) 266 | return false; 267 | 268 | if (cif & CI_GAIN) 269 | if (!u.get_gain(e->gain)) 270 | return false; 271 | 272 | if (cif & CI_OVER_RANGE_COUNT) 273 | if (!u.get_uint32(e->over_range_count)) 274 | return false; 275 | 276 | if (cif & CI_SAMPLE_RATE) 277 | if (!u.get_hertz(e->sample_rate)) 278 | return false; 279 | 280 | if (cif & CI_TIMESTAMP_ADJ) 281 | if (!u.get_int64(e->timestamp_adj)) 282 | return false; 283 | 284 | if (cif & CI_TIMESTAMP_CAL_TIME) 285 | if (!u.get_uint32(e->timestamp_cal_time)) 286 | return false; 287 | 288 | if (cif & CI_TEMPERATURE) 289 | if (!u.get_temp(e->temperature)) 290 | return false; 291 | 292 | if (cif & CI_DEVICE_ID) 293 | if (!u.get_uint32(e->device_id[0]) || !u.get_uint32(e->device_id[1])) 294 | return false; 295 | 296 | if (cif & CI_STATE_AND_EVENT_IND) 297 | if (!u.get_uint32(e->state_and_event_ind)) 298 | return false; 299 | 300 | if (cif & CI_PAYLOAD_FMT) 301 | if (!u.get_uint32(e->payload_fmt.word0) || !u.get_uint32(e->payload_fmt.word1)) 302 | return false; 303 | 304 | if (cif & CI_FORMATTED_GPS) 305 | if (!u.get_formatted_gps(e->formatted_gps)) 306 | return false; 307 | 308 | if (cif & CI_FORMATTED_INS) 309 | if (!u.get_formatted_gps(e->formatted_ins)) 310 | return false; 311 | 312 | if (cif & CI_ECEF_EPHEMERIS) 313 | if (!u.get_ephemeris(e->ecef_ephemeris)) 314 | return false; 315 | 316 | if (cif & CI_REL_EPHEMERIS) 317 | if (!u.get_ephemeris(e->rel_ephemeris)) 318 | return false; 319 | 320 | if (cif & CI_EPHEMERIS_REF_ID) 321 | if (!u.get_int32(e->ephemeris_ref_id)) 322 | return false; 323 | 324 | if (cif & CI_GPS_ASCII) 325 | if (!u.get_gps_ascii(e->gps_ascii)) 326 | return false; 327 | 328 | if (cif & CI_CNTX_ASSOC_LISTS) 329 | if (!u.get_cntx_assoc_lists(e->cntx_assoc_lists)) 330 | return false; 331 | 332 | return u.consumed_all(); 333 | } 334 | 335 | static void 336 | wr_cntx_list(std::ostream &os, const std::string &name, const std::vector &v) 337 | { 338 | if (v.empty()) 339 | return; 340 | 341 | wr_name(os, " " + name); 342 | for (size_t j = 0; j < v.size(); j++) 343 | os << format("%#x ") % v[j]; 344 | os << std::endl; 345 | } 346 | 347 | static void 348 | wr_cntx_assoc_lists(std::ostream &os, const exp_context_assocs &x) 349 | { 350 | os << std::endl; 351 | wr_cntx_list(os, "source", x.source); 352 | wr_cntx_list(os, "system", x.system); 353 | wr_cntx_list(os, "vector", x.vector_comp); 354 | wr_cntx_list(os, "async_chan", x.async_channel); 355 | wr_cntx_list(os, "async_tag", x.async_tag); 356 | } 357 | 358 | void 359 | expanded_if_context_section::write(std::ostream &os) const 360 | { 361 | uint32_t cif = context_indicator; 362 | 363 | if (cif & CI_REF_POINT_ID){ 364 | wr_name(os, "ref_point_id"); 365 | wr_uint32_hex(os, ref_point_id); 366 | } 367 | 368 | if (cif & CI_BANDWIDTH){ 369 | wr_name(os, "bandwidth"); 370 | wr_hertz(os, bandwidth); 371 | } 372 | 373 | if (cif & CI_IF_REF_FREQ){ 374 | wr_name(os, "if_ref_freq"); 375 | wr_hertz(os, if_ref_freq); 376 | } 377 | 378 | if (cif & CI_RF_REF_FREQ){ 379 | wr_name(os, "rf_ref_freq"); 380 | wr_hertz(os, rf_ref_freq); 381 | } 382 | 383 | if (cif & CI_RF_REF_FREQ_OFFSET){ 384 | wr_name(os, "rf_ref_freq_offset"); 385 | wr_hertz(os, rf_ref_freq_offset); 386 | } 387 | 388 | if (cif & CI_IF_BAND_OFFSET){ 389 | wr_name(os, "if_band_offset"); 390 | wr_hertz(os, if_band_offset); 391 | } 392 | 393 | if (cif & CI_REF_LEVEL){ 394 | wr_name(os, "ref_level"); 395 | wr_dbm(os, ref_level); 396 | } 397 | 398 | if (cif & CI_GAIN){ 399 | wr_name(os, "gain stage1"); 400 | wr_db(os, vrt_gain_stage1(gain)); 401 | wr_name(os, "gain stage2"); 402 | wr_db(os, vrt_gain_stage2(gain)); 403 | } 404 | 405 | if (cif & CI_OVER_RANGE_COUNT){ 406 | wr_name(os, "over_range_count"); 407 | wr_uint32_dec(os, over_range_count); 408 | } 409 | 410 | if (cif & CI_SAMPLE_RATE){ 411 | wr_name(os, "sample_rate"); 412 | wr_hertz(os, sample_rate); 413 | } 414 | 415 | if (cif & CI_TIMESTAMP_ADJ){ 416 | wr_name(os, "timestamp_adj"); 417 | os << format("%10d ps\n") % timestamp_adj; 418 | } 419 | 420 | if (cif & CI_TIMESTAMP_CAL_TIME){ 421 | wr_name(os, "timestamp_cal_time"); 422 | wr_int_secs(os, timestamp_cal_time); 423 | } 424 | 425 | if (cif & CI_TEMPERATURE){ 426 | wr_name(os, "temperature"); 427 | wr_temp(os, temperature); 428 | } 429 | 430 | if (cif & CI_DEVICE_ID){ 431 | wr_name(os, "manuf_oui"); 432 | wr_uint32_hex(os, device_id[0] & 0x00ffffff); 433 | wr_name(os, "device_code"); 434 | wr_uint32_hex(os, device_id[1] & 0xffff); 435 | } 436 | 437 | if (cif & CI_STATE_AND_EVENT_IND){ 438 | wr_name(os, "state_and_event_ind"); 439 | wr_uint32_hex(os, state_and_event_ind); 440 | } 441 | 442 | if (cif & CI_PAYLOAD_FMT){ 443 | wr_name(os, "payload_fmt"); 444 | wr_payload_fmt(os, payload_fmt); 445 | } 446 | 447 | if (cif & CI_FORMATTED_GPS){ 448 | wr_name(os, "formatted_gps"); 449 | wr_formatted_gps(os, formatted_gps); 450 | } 451 | 452 | if (cif & CI_FORMATTED_INS){ 453 | wr_name(os, "formatted_ins"); 454 | wr_formatted_gps(os, formatted_ins); 455 | } 456 | 457 | if (cif & CI_ECEF_EPHEMERIS){ 458 | wr_name(os, "ecef_ephemeris"); 459 | os << "\n"; 460 | // wr_ephemeris(os, ecef_ephemeris); 461 | } 462 | 463 | if (cif & CI_REL_EPHEMERIS){ 464 | wr_name(os, "rel_ephemeris"); 465 | os << "\n"; 466 | // wr_ephemeris(os, rel_ephemeris); 467 | } 468 | 469 | if (cif & CI_EPHEMERIS_REF_ID){ 470 | wr_name(os, "epemeris_ref_id"); 471 | wr_uint32_hex(os, ephemeris_ref_id); 472 | } 473 | 474 | if (cif & CI_GPS_ASCII){ 475 | wr_name(os, "gps_ascii"); 476 | os << "\n"; 477 | // wr_gps_ascii(os, gps_ascii); 478 | } 479 | 480 | if (cif & CI_CNTX_ASSOC_LISTS){ 481 | wr_name(os, "cntx_assoc_lists"); 482 | wr_cntx_assoc_lists(os, cntx_assoc_lists); 483 | } 484 | 485 | } 486 | 487 | std::ostream& operator<<(std::ostream &os, const expanded_if_context_section &obj) 488 | { 489 | obj.write(os); 490 | return os; 491 | } 492 | 493 | }; // namespace vrt 494 | -------------------------------------------------------------------------------- /vrt/INSTALL: -------------------------------------------------------------------------------- 1 | Installation Instructions 2 | ************************* 3 | 4 | Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, 5 | 2006, 2007, 2008, 2009 Free Software Foundation, Inc. 6 | 7 | Copying and distribution of this file, with or without modification, 8 | are permitted in any medium without royalty provided the copyright 9 | notice and this notice are preserved. This file is offered as-is, 10 | without warranty of any kind. 11 | 12 | Basic Installation 13 | ================== 14 | 15 | Briefly, the shell commands `./configure; make; make install' should 16 | configure, build, and install this package. The following 17 | more-detailed instructions are generic; see the `README' file for 18 | instructions specific to this package. Some packages provide this 19 | `INSTALL' file but do not implement all of the features documented 20 | below. The lack of an optional feature in a given package is not 21 | necessarily a bug. More recommendations for GNU packages can be found 22 | in *note Makefile Conventions: (standards)Makefile Conventions. 23 | 24 | The `configure' shell script attempts to guess correct values for 25 | various system-dependent variables used during compilation. It uses 26 | those values to create a `Makefile' in each directory of the package. 27 | It may also create one or more `.h' files containing system-dependent 28 | definitions. Finally, it creates a shell script `config.status' that 29 | you can run in the future to recreate the current configuration, and a 30 | file `config.log' containing compiler output (useful mainly for 31 | debugging `configure'). 32 | 33 | It can also use an optional file (typically called `config.cache' 34 | and enabled with `--cache-file=config.cache' or simply `-C') that saves 35 | the results of its tests to speed up reconfiguring. Caching is 36 | disabled by default to prevent problems with accidental use of stale 37 | cache files. 38 | 39 | If you need to do unusual things to compile the package, please try 40 | to figure out how `configure' could check whether to do them, and mail 41 | diffs or instructions to the address given in the `README' so they can 42 | be considered for the next release. If you are using the cache, and at 43 | some point `config.cache' contains results you don't want to keep, you 44 | may remove or edit it. 45 | 46 | The file `configure.ac' (or `configure.in') is used to create 47 | `configure' by a program called `autoconf'. You need `configure.ac' if 48 | you want to change it or regenerate `configure' using a newer version 49 | of `autoconf'. 50 | 51 | The simplest way to compile this package is: 52 | 53 | 1. `cd' to the directory containing the package's source code and type 54 | `./configure' to configure the package for your system. 55 | 56 | Running `configure' might take a while. While running, it prints 57 | some messages telling which features it is checking for. 58 | 59 | 2. Type `make' to compile the package. 60 | 61 | 3. Optionally, type `make check' to run any self-tests that come with 62 | the package, generally using the just-built uninstalled binaries. 63 | 64 | 4. Type `make install' to install the programs and any data files and 65 | documentation. When installing into a prefix owned by root, it is 66 | recommended that the package be configured and built as a regular 67 | user, and only the `make install' phase executed with root 68 | privileges. 69 | 70 | 5. Optionally, type `make installcheck' to repeat any self-tests, but 71 | this time using the binaries in their final installed location. 72 | This target does not install anything. Running this target as a 73 | regular user, particularly if the prior `make install' required 74 | root privileges, verifies that the installation completed 75 | correctly. 76 | 77 | 6. You can remove the program binaries and object files from the 78 | source code directory by typing `make clean'. To also remove the 79 | files that `configure' created (so you can compile the package for 80 | a different kind of computer), type `make distclean'. There is 81 | also a `make maintainer-clean' target, but that is intended mainly 82 | for the package's developers. If you use it, you may have to get 83 | all sorts of other programs in order to regenerate files that came 84 | with the distribution. 85 | 86 | 7. Often, you can also type `make uninstall' to remove the installed 87 | files again. In practice, not all packages have tested that 88 | uninstallation works correctly, even though it is required by the 89 | GNU Coding Standards. 90 | 91 | 8. Some packages, particularly those that use Automake, provide `make 92 | distcheck', which can by used by developers to test that all other 93 | targets like `make install' and `make uninstall' work correctly. 94 | This target is generally not run by end users. 95 | 96 | Compilers and Options 97 | ===================== 98 | 99 | Some systems require unusual options for compilation or linking that 100 | the `configure' script does not know about. Run `./configure --help' 101 | for details on some of the pertinent environment variables. 102 | 103 | You can give `configure' initial values for configuration parameters 104 | by setting variables in the command line or in the environment. Here 105 | is an example: 106 | 107 | ./configure CC=c99 CFLAGS=-g LIBS=-lposix 108 | 109 | *Note Defining Variables::, for more details. 110 | 111 | Compiling For Multiple Architectures 112 | ==================================== 113 | 114 | You can compile the package for more than one kind of computer at the 115 | same time, by placing the object files for each architecture in their 116 | own directory. To do this, you can use GNU `make'. `cd' to the 117 | directory where you want the object files and executables to go and run 118 | the `configure' script. `configure' automatically checks for the 119 | source code in the directory that `configure' is in and in `..'. This 120 | is known as a "VPATH" build. 121 | 122 | With a non-GNU `make', it is safer to compile the package for one 123 | architecture at a time in the source code directory. After you have 124 | installed the package for one architecture, use `make distclean' before 125 | reconfiguring for another architecture. 126 | 127 | On MacOS X 10.5 and later systems, you can create libraries and 128 | executables that work on multiple system types--known as "fat" or 129 | "universal" binaries--by specifying multiple `-arch' options to the 130 | compiler but only a single `-arch' option to the preprocessor. Like 131 | this: 132 | 133 | ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ 134 | CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ 135 | CPP="gcc -E" CXXCPP="g++ -E" 136 | 137 | This is not guaranteed to produce working output in all cases, you 138 | may have to build one architecture at a time and combine the results 139 | using the `lipo' tool if you have problems. 140 | 141 | Installation Names 142 | ================== 143 | 144 | By default, `make install' installs the package's commands under 145 | `/usr/local/bin', include files under `/usr/local/include', etc. You 146 | can specify an installation prefix other than `/usr/local' by giving 147 | `configure' the option `--prefix=PREFIX', where PREFIX must be an 148 | absolute file name. 149 | 150 | You can specify separate installation prefixes for 151 | architecture-specific files and architecture-independent files. If you 152 | pass the option `--exec-prefix=PREFIX' to `configure', the package uses 153 | PREFIX as the prefix for installing programs and libraries. 154 | Documentation and other data files still use the regular prefix. 155 | 156 | In addition, if you use an unusual directory layout you can give 157 | options like `--bindir=DIR' to specify different values for particular 158 | kinds of files. Run `configure --help' for a list of the directories 159 | you can set and what kinds of files go in them. In general, the 160 | default for these options is expressed in terms of `${prefix}', so that 161 | specifying just `--prefix' will affect all of the other directory 162 | specifications that were not explicitly provided. 163 | 164 | The most portable way to affect installation locations is to pass the 165 | correct locations to `configure'; however, many packages provide one or 166 | both of the following shortcuts of passing variable assignments to the 167 | `make install' command line to change installation locations without 168 | having to reconfigure or recompile. 169 | 170 | The first method involves providing an override variable for each 171 | affected directory. For example, `make install 172 | prefix=/alternate/directory' will choose an alternate location for all 173 | directory configuration variables that were expressed in terms of 174 | `${prefix}'. Any directories that were specified during `configure', 175 | but not in terms of `${prefix}', must each be overridden at install 176 | time for the entire installation to be relocated. The approach of 177 | makefile variable overrides for each directory variable is required by 178 | the GNU Coding Standards, and ideally causes no recompilation. 179 | However, some platforms have known limitations with the semantics of 180 | shared libraries that end up requiring recompilation when using this 181 | method, particularly noticeable in packages that use GNU Libtool. 182 | 183 | The second method involves providing the `DESTDIR' variable. For 184 | example, `make install DESTDIR=/alternate/directory' will prepend 185 | `/alternate/directory' before all installation names. The approach of 186 | `DESTDIR' overrides is not required by the GNU Coding Standards, and 187 | does not work on platforms that have drive letters. On the other hand, 188 | it does better at avoiding recompilation issues, and works well even 189 | when some directory options were not specified in terms of `${prefix}' 190 | at `configure' time. 191 | 192 | Optional Features 193 | ================= 194 | 195 | If the package supports it, you can cause programs to be installed 196 | with an extra prefix or suffix on their names by giving `configure' the 197 | option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. 198 | 199 | Some packages pay attention to `--enable-FEATURE' options to 200 | `configure', where FEATURE indicates an optional part of the package. 201 | They may also pay attention to `--with-PACKAGE' options, where PACKAGE 202 | is something like `gnu-as' or `x' (for the X Window System). The 203 | `README' should mention any `--enable-' and `--with-' options that the 204 | package recognizes. 205 | 206 | For packages that use the X Window System, `configure' can usually 207 | find the X include and library files automatically, but if it doesn't, 208 | you can use the `configure' options `--x-includes=DIR' and 209 | `--x-libraries=DIR' to specify their locations. 210 | 211 | Some packages offer the ability to configure how verbose the 212 | execution of `make' will be. For these packages, running `./configure 213 | --enable-silent-rules' sets the default to minimal output, which can be 214 | overridden with `make V=1'; while running `./configure 215 | --disable-silent-rules' sets the default to verbose, which can be 216 | overridden with `make V=0'. 217 | 218 | Particular systems 219 | ================== 220 | 221 | On HP-UX, the default C compiler is not ANSI C compatible. If GNU 222 | CC is not installed, it is recommended to use the following options in 223 | order to use an ANSI C compiler: 224 | 225 | ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" 226 | 227 | and if that doesn't work, install pre-built binaries of GCC for HP-UX. 228 | 229 | On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot 230 | parse its `' header file. The option `-nodtk' can be used as 231 | a workaround. If GNU CC is not installed, it is therefore recommended 232 | to try 233 | 234 | ./configure CC="cc" 235 | 236 | and if that doesn't work, try 237 | 238 | ./configure CC="cc -nodtk" 239 | 240 | On Solaris, don't put `/usr/ucb' early in your `PATH'. This 241 | directory contains several dysfunctional programs; working variants of 242 | these programs are available in `/usr/bin'. So, if you need `/usr/ucb' 243 | in your `PATH', put it _after_ `/usr/bin'. 244 | 245 | On Haiku, software installed for all users goes in `/boot/common', 246 | not `/usr/local'. It is recommended to use the following options: 247 | 248 | ./configure --prefix=/boot/common 249 | 250 | Specifying the System Type 251 | ========================== 252 | 253 | There may be some features `configure' cannot figure out 254 | automatically, but needs to determine by the type of machine the package 255 | will run on. Usually, assuming the package is built to be run on the 256 | _same_ architectures, `configure' can figure that out, but if it prints 257 | a message saying it cannot guess the machine type, give it the 258 | `--build=TYPE' option. TYPE can either be a short name for the system 259 | type, such as `sun4', or a canonical name which has the form: 260 | 261 | CPU-COMPANY-SYSTEM 262 | 263 | where SYSTEM can have one of these forms: 264 | 265 | OS 266 | KERNEL-OS 267 | 268 | See the file `config.sub' for the possible values of each field. If 269 | `config.sub' isn't included in this package, then this package doesn't 270 | need to know the machine type. 271 | 272 | If you are _building_ compiler tools for cross-compiling, you should 273 | use the option `--target=TYPE' to select the type of system they will 274 | produce code for. 275 | 276 | If you want to _use_ a cross compiler, that generates code for a 277 | platform different from the build platform, you should specify the 278 | "host" platform (i.e., that on which the generated programs will 279 | eventually be run) with `--host=TYPE'. 280 | 281 | Sharing Defaults 282 | ================ 283 | 284 | If you want to set default values for `configure' scripts to share, 285 | you can create a site shell script called `config.site' that gives 286 | default values for variables like `CC', `cache_file', and `prefix'. 287 | `configure' looks for `PREFIX/share/config.site' if it exists, then 288 | `PREFIX/etc/config.site' if it exists. Or, you can set the 289 | `CONFIG_SITE' environment variable to the location of the site script. 290 | A warning: not all `configure' scripts look for a site script. 291 | 292 | Defining Variables 293 | ================== 294 | 295 | Variables not defined in a site shell script can be set in the 296 | environment passed to `configure'. However, some packages may run 297 | configure again during the build, and the customized values of these 298 | variables may be lost. In order to avoid this problem, you should set 299 | them in the `configure' command line, using `VAR=value'. For example: 300 | 301 | ./configure CC=/usr/local2/bin/gcc 302 | 303 | causes the specified `gcc' to be used as the C compiler (unless it is 304 | overridden in the site shell script). 305 | 306 | Unfortunately, this technique does not work for `CONFIG_SHELL' due to 307 | an Autoconf bug. Until the bug is fixed you can use this workaround: 308 | 309 | CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash 310 | 311 | `configure' Invocation 312 | ====================== 313 | 314 | `configure' recognizes the following options to control how it 315 | operates. 316 | 317 | `--help' 318 | `-h' 319 | Print a summary of all of the options to `configure', and exit. 320 | 321 | `--help=short' 322 | `--help=recursive' 323 | Print a summary of the options unique to this package's 324 | `configure', and exit. The `short' variant lists options used 325 | only in the top level, while the `recursive' variant lists options 326 | also present in any nested packages. 327 | 328 | `--version' 329 | `-V' 330 | Print the version of Autoconf used to generate the `configure' 331 | script, and exit. 332 | 333 | `--cache-file=FILE' 334 | Enable the cache: use and save the results of the tests in FILE, 335 | traditionally `config.cache'. FILE defaults to `/dev/null' to 336 | disable caching. 337 | 338 | `--config-cache' 339 | `-C' 340 | Alias for `--cache-file=config.cache'. 341 | 342 | `--quiet' 343 | `--silent' 344 | `-q' 345 | Do not print messages saying which checks are being made. To 346 | suppress all normal output, redirect it to `/dev/null' (any error 347 | messages will still be shown). 348 | 349 | `--srcdir=DIR' 350 | Look for the package's source code in directory DIR. Usually 351 | `configure' can determine that directory automatically. 352 | 353 | `--prefix=DIR' 354 | Use DIR as the installation prefix. *note Installation Names:: 355 | for more details, including other options available for fine-tuning 356 | the installation locations. 357 | 358 | `--no-create' 359 | `-n' 360 | Run the configure checks, but stop before creating any output 361 | files. 362 | 363 | `configure' also accepts some other, not widely useful, options. Run 364 | `configure --help' for more details. 365 | 366 | --------------------------------------------------------------------------------