1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-14 20:20:35 +00:00
This commit is contained in:
Carles Fernandez 2021-11-12 12:02:00 +01:00
commit 797462fd01
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
111 changed files with 12431 additions and 1043 deletions

View File

@ -185,7 +185,95 @@ CheckOptions:
- key: bugprone-too-small-loop-variable.MagnitudeBitsUpperLimit
value: '16'
- key: bugprone-unused-return-value.CheckedFunctions
value: 'std::async;std::launder;std::remove;std::remove_if;std::unique;std::unique_ptr::release;std::basic_string::empty;std::vector::empty;std::back_inserter;std::distance;std::find;std::find_if;std::inserter;std::lower_bound;std::make_pair;std::map::count;std::map::find;std::map::lower_bound;std::multimap::equal_range;std::multimap::upper_bound;std::set::count;std::set::find;std::setfill;std::setprecision;std::setw;std::upper_bound;std::vector::at;::bsearch;::ferror;::feof;::isalnum;::isalpha;::isblank;::iscntrl;::isdigit;::isgraph;::islower;::isprint;::ispunct;::isspace;::isupper;::iswalnum;::iswprint;::iswspace;::isxdigit;::memchr;::memcmp;::strcmp;::strcoll;::strncmp;::strpbrk;::strrchr;::strspn;::strstr;::wcscmp;::access;::bind;::connect;::difftime;::dlsym;::fnmatch;::getaddrinfo;::getopt;::htonl;::htons;::iconv_open;::inet_addr;::isascii;::isatty;::mmap;::newlocale;::openat;::pathconf;::pthread_equal;::pthread_getspecific;::pthread_mutex_trylock;::readdir;::readlink;::recvmsg;::regexec;::scandir;::semget;::setjmp;::shm_open;::shmget;::sigismember;::strcasecmp;::strsignal;::ttyname'
value: 'std::async;
std::launder;
std::remove;
std::remove_if;
std::unique;
std::unique_ptr::release;
std::basic_string::empty;
std::vector::empty;
std::back_inserter;
std::distance;
std::find;
std::find_if;
std::inserter;
std::lower_bound;
std::make_pair;
std::map::count;
std::map::find;
std::map::lower_bound;
std::multimap::equal_range;
std::multimap::upper_bound;
std::set::count;
std::set::find;
std::setfill;
std::setprecision;
std::setw;
std::upper_bound;
std::vector::at;
::bsearch;
::ferror;
::feof;
::isalnum;
::isalpha;
::isblank;
::iscntrl;
::isdigit;
::isgraph;
::islower;
::isprint;
::ispunct;
::isspace;
::isupper;
::iswalnum;
::iswprint;
::iswspace;
::isxdigit;
::memchr;
::memcmp;
::strcmp;
::strcoll;
::strncmp;
::strpbrk;
::strrchr;
::strspn;
::strstr;
::wcscmp;
::access;
::bind;
::connect;
::difftime;
::dlsym;
::fnmatch;
::getaddrinfo;
::getopt;
::htonl;
::htons;
::iconv_open;
::inet_addr;
::isascii;
::isatty;
::mmap;
::newlocale;
::openat;
::pathconf;
::pthread_equal;
::pthread_getspecific;
::pthread_mutex_trylock;
::readdir;
::readlink;
::recvmsg;
::regexec;
::scandir;
::semget;
::setjmp;
::shm_open;
::shmget;
::sigismember;
::strcasecmp;
::strsignal;
::ttyname'
- key: cert-dcl16-c.NewSuffixes
value: 'L;LL;LU;LLU'
- key: cert-msc51-cpp.DisallowedSeedTypes

View File

@ -70,7 +70,19 @@ jobs:
- name: install dependencies
run: sudo apt-get install python3-pip && sudo pip3 install cpplint
- name: run checks
run: find ./src/ -iname *.h -o -iname *.cc | xargs cpplint --filter=-,+build/class,+build/c++14,+build/deprecated,+build/explicit_make_pair,+build/include_what_you_use,+build/printf_format,+build/storage_class,+readability/constructors,+readability/namespace,+readability/newline,+readability/utf8,+runtime/casting,+runtime/explicit,+runtime/indentation_namespace,+runtime/init,+runtime/invalid_increment,+runtime/member_string_references,+runtime/memset,+runtime/operator,+runtime/printf,+runtime/printf_format,+whitespace/blank_line,+whitespace/comma,+whitespace/comments,+whitespace/empty_conditional_body,+whitespace/end-of-line,+whitespace/ending-newline,+whitespace/semicolon,+whitespace/tab --exclude=./src/core/interfaces/gnss_block_interface.h --exclude=./src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/hwcaps_for_testing.* --exclude=./src/utils/nav-listener/build/nav_message.pb.h
run: "find ./src/ -iname *.h -o -iname *.cc | xargs cpplint
--filter=-,+build/class,+build/c++14,+build/deprecated,+build/explicit_make_pair,\
+build/include_what_you_use,+build/printf_format,+build/storage_class,\
+readability/constructors,+readability/namespace,+readability/newline,\
+readability/utf8,+runtime/casting,+runtime/explicit,\
+runtime/indentation_namespace,+runtime/init,+runtime/invalid_increment,\
+runtime/member_string_references,+runtime/memset,+runtime/operator,\
+runtime/printf,+runtime/printf_format,+whitespace/blank_line,\
+whitespace/comma,+whitespace/comments,+whitespace/empty_conditional_body,\
+whitespace/end-of-line,+whitespace/ending-newline,+whitespace/semicolon,\
+whitespace/tab --exclude=./src/core/interfaces/gnss_block_interface.h
--exclude=./src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/hwcaps_for_testing.*
--exclude=./src/utils/nav-listener/build/nav_message.pb.h"
prettier-markdown:

View File

@ -332,8 +332,8 @@ set(GNSSSDR_GNSS_SIM_LOCAL_VERSION "master")
set(GNSSSDR_GPSTK_LOCAL_VERSION "8.0.0")
set(GNSSSDR_MATIO_LOCAL_VERSION "1.5.21")
set(GNSSSDR_PUGIXML_LOCAL_VERSION "1.11.4")
set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "3.18.0")
set(GNSSSDR_BENCHMARK_LOCAL_VERSION "1.5.6")
set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "3.19.0")
set(GNSSSDR_BENCHMARK_LOCAL_VERSION "1.6.0")
set(GNSSSDR_MATHJAX_EXTERNAL_VERSION "2.7.7")
if(CMAKE_VERSION VERSION_LESS "3.3")
@ -563,11 +563,24 @@ endif()
################################################################################
# VOLK - Vector-Optimized Library of Kernels
################################################################################
find_package(VOLK)
if(NOT VOLK_FOUND)
message(FATAL_ERROR "*** VOLK is required to build gnss-sdr")
endif()
set_package_properties(VOLK PROPERTIES
PURPOSE "Provides an abstraction of optimized math routines targeting several SIMD processors."
TYPE REQUIRED
)
################################################################################
# GNU Radio - https://www.gnuradio.org
################################################################################
set(GR_REQUIRED_COMPONENTS RUNTIME PMT BLOCKS FFT FILTER ANALOG)
find_package(UHD)
set_package_properties(UHD PROPERTIES
PURPOSE "Used for communication with front-ends of the USRP family."
@ -632,13 +645,14 @@ if(NOT (GNURADIO_VERSION VERSION_LESS 3.8) AND LOG4CPP_READY_FOR_CXX17)
if(FILESYSTEM_FOUND)
set(CMAKE_CXX_STANDARD 17)
if(CMAKE_VERSION VERSION_GREATER 3.13)
# UHD 4.0.0.0 still does not support C++20
if((NOT UHD_FOUND) OR (UHD_FOUND AND ("${UHD_VERSION}" VERSION_LESS 3.99)))
set(CMAKE_CXX_STANDARD 20)
# UHD 3.15.0.0-5 does not support C++20
# GNU Radio 3.10.0.git does not support C++20
if(((NOT UHD_FOUND) OR (UHD_FOUND AND ("${UHD_VERSION}" VERSION_LESS 3.14.99))) AND (GNURADIO_VERSION VERSION_LESS 3.9.99))
# set(CMAKE_CXX_STANDARD 20)
if(CMAKE_VERSION VERSION_GREATER 3.20.99)
if(((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "11.0.0")) OR
((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") AND NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "12.0")))
set(CMAKE_CXX_STANDARD 23)
# set(CMAKE_CXX_STANDARD 23)
endif()
endif()
endif()
@ -647,7 +661,9 @@ if(NOT (GNURADIO_VERSION VERSION_LESS 3.8) AND LOG4CPP_READY_FOR_CXX17)
endif()
endif()
endif()
if((NOT PMT_USES_BOOST_ANY) AND (CMAKE_CXX_STANDARD VERSION_LESS 17))
message(FATAL_ERROR "GNU Radio v${GNURADIO_VERSION} requires C++17. Please update your environment.")
endif()
################################################################################
@ -974,20 +990,6 @@ endif()
################################################################################
# VOLK - Vector-Optimized Library of Kernels
################################################################################
find_package(VOLK)
if(NOT VOLK_FOUND)
message(FATAL_ERROR "*** VOLK is required to build gnss-sdr")
endif()
set_package_properties(VOLK PROPERTIES
PURPOSE "Provides an abstraction of optimized math routines targeting several SIMD processors."
TYPE REQUIRED
)
################################################################################
# volk_gnsssdr module - GNSS-SDR's own VOLK library
################################################################################

View File

@ -369,9 +369,28 @@ if(GNURADIO_VERSION VERSION_GREATER 3.8.99)
INTERFACE_LINK_LIBRARIES "${GNURADIO_LIBRARY}"
)
endif()
# check templatized API
if(NOT EXISTS "${GNURADIO_IIO_INCLUDE_DIRS}/gnuradio/iio/pluto_source.h")
set(GR_IIO_TEMPLATIZED_API TRUE)
endif()
endif()
endif()
# Check if PMT uses boost::any or std::any
if(GNURADIO_PMT_INCLUDE_DIRS)
file(STRINGS ${GNURADIO_PMT_INCLUDE_DIRS}/pmt/pmt.h _pmt_content)
set(_uses_boost TRUE)
foreach(_loop_var IN LISTS _pmt_content)
string(STRIP "${_loop_var}" _file_line)
if("#include <any>" STREQUAL "${_file_line}")
set(_uses_boost FALSE)
endif()
endforeach()
if(${_uses_boost})
set(PMT_USES_BOOST_ANY TRUE)
endif()
endif()
set_package_properties(GNURADIO PROPERTIES
URL "https://www.gnuradio.org/"

View File

@ -30,9 +30,14 @@ All notable changes to GNSS-SDR will be documented in this file.
### Improvements in Maintainability:
- Rewritten Viterbi decoder for Galileo navigation messages: encapsulated in a
- Rewritten Viterbi decoder for Galileo navigation messages. Encapsulated in a
class instead of being implemented as free inline functions. This improves
memory management and source code readability.
- Prefer initialization to assignment in constructors. This improves the
readability of the code, could potentially increase performance, and allows
for easier detection of unused data members (see
https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md/#Rc-initialize).
- Non-functional change: Fixed formatting defects detected by clang-format 13.0.
- Updated GSL implementation to v0.39.0. See
https://github.com/gsl-lite/gsl-lite/releases/tag/v0.39.0
- CI - `cpplint` job on GitHub: Added the `build/include_what_you_use` filter
@ -40,7 +45,15 @@ All notable changes to GNSS-SDR will be documented in this file.
- CI - `clang-tidy` job on GitHub: More robust detection of LLVM paths installed
by homebrew.
### Improvements in Reliability
### Improvements in Portability:
- Fixed building against the new API in the gr-iio component present in GNU
Radio's `master` branch (currently v3.10.0.git).
- Fixed building against current GNU Radio's `master` branch, which does not
support the C++20 standard.
- Updated `cpu_features` library for improved processor detection.
### Improvements in Reliability:
- Fixed some potential buffer overflows.

View File

@ -566,12 +566,23 @@ The GPL implies that:
\li The licensed material may be analyzed or modified.
\li Modified material may be distributed under the same licensing terms but <b>do not</b> have to be distributed.
That means that modifications only have to be made available to the public if distribution happens. So it is perfectly fine to take the GNSS-SDR source code, modify it heavily and use it in a not distributed application / library. This is how companies like Google can run their own patched versions of Linux for example.
That means that modifications only have to be made available to the public if
distribution happens. So it is perfectly fine to take the GNSS-SDR source code,
modify it heavily and use it in a not distributed application / library. This is
how companies like Google can run their own patched versions of Linux for
example.
But what this also means is that non-GPL code cannot use GPL code. This means that you cannot modify / use GNSS-SDR, blend it with non-GPL code, and make money with the resulting software. You cannot distribute the resulting software under a non-disclosure agreement or contract. Distributors under the GPL also grant a license for any of their patents practiced by the software, to practice those patents in GPL software. You can sell a device that runs with GNSS-SDR, but if you distribute the code, it has to remain under GPL.
But what this also means is that non-GPL code cannot use GPL code. This means
that you cannot modify / use GNSS-SDR, blend it with non-GPL code, and make
money with the resulting software. You cannot distribute the resulting software
under a non-disclosure agreement or contract. Distributors under the GPL also
grant a license for any of their patents practiced by the software, to practice
those patents in GPL software. You can sell a device that runs with GNSS-SDR,
but if you distribute the code, it has to remain under GPL.
\section publications Publications and Credits
If you use GNSS-SDR to produce a research paper or Thesis, we would appreciate if you reference any of these articles to credit the GNSS-SDR project:
If you use GNSS-SDR to produce a research paper or Thesis, we would appreciate
if you reference any of these articles to credit the GNSS-SDR project:
\li \anchor Navitec2012 C. Fern&aacute;ndez-Prades, J. Arribas, L. Esteve, D. Pubill, P. Closas, <a href="http://www.cttc.es/publication/an-open-source-galileo-e1-software-receiver/" target="_blank"><i>An Open Source Galileo E1 Software Receiver</i></a>, in Proc. of the 6th ESA Workshop on Satellite Navigation Technologies (NAVITEC 2012), ESTEC, Noordwijk, The Netherlands, Dec. 2012.
\li J. Arribas, <a href="https://theses.eurasip.org/theses/449/gnss-array-based-acquisition-theory-and/" target="_blank"><i>GNSS Array-based Acquisition: Theory and Implementation</i></a>, PhD Thesis, Universitat Polit&egrave;cnica de Catalunya, Barcelona, Spain, June 2012.

View File

@ -61,13 +61,38 @@ China Satellite Navigation Office, December 2016.
\subsection sbas Satellite Based Augmentation Systems (SBAS)
\li <b>Minimum Operational Performance Standards for Global Positioning System/Wide Area Augmentation System Airborne Equipment, DO-229D</b>, RTCA, Washington, DC, Dec. 13, 2006. The 'RTCA MOPS DO229D - appendix A' is the reference standard for WAAS/EGNOS application development. RTCA is an advisory committee of the US federal government, and issues standards for civil airborne equipment, among other duties. One such standard is MOPS 229D (Minimum Operational Performance Standards for Global Positioning System/Wide Area Augmentation System Airborne Equipment version D), which describes the implementation of satellite-based augmentation services (SBAS) for receivers designed for civil aviation use. An annex to DO229D contains the specifications for the SBAS signal and message. The RTCA provides regular updates to these standards. MOPS 229D is available for a fee from the <a href="https://my.rtca.org/nc__store?search=229D" target="_blank">RTCA website</a>.
\li <b>Minimum Operational Performance Standards for Global Positioning System/Wide Area Augmentation System Airborne Equipment, DO-229D</b>, RTCA, Washington, DC, Dec. 13, 2006.
The 'RTCA MOPS DO229D - appendix A' is the reference standard for WAAS/EGNOS
application development. RTCA is an advisory committee of the US federal
government, and issues standards for civil airborne equipment, among other
duties. One such standard is MOPS 229D (Minimum Operational Performance
Standards for Global Positioning System/Wide Area Augmentation System Airborne
Equipment version D), which describes the implementation of satellite-based
augmentation services (SBAS) for receivers designed for civil aviation use. An
annex to DO229D contains the specifications for the SBAS signal and message. The
RTCA provides regular updates to these standards. MOPS 229D is available for a
fee from the <a href="https://my.rtca.org/nc__store?search=229D"
target="_blank">RTCA website</a>.
\li <a href="https://www.gps.gov/technical/ps/2008-WAAS-performance-standard.pdf" target="_blank"><b>Global Positioning System Wide Area Augmentation System (WAAS) Performance Standard, 1st Edition</b></a>, Department of Transportation and Federal Aviation Administration, Oct. 31, 2008. This document defines the levels of performance the U.S. Government makes available to users of the GPS SPS augmented by the Wide Area Augmentation System.
\li <a href="https://www.gps.gov/technical/ps/2008-WAAS-performance-standard.pdf" target="_blank"><b>Global Positioning System Wide Area Augmentation System (WAAS) Performance Standard, 1st Edition</b></a>,
Department of Transportation and Federal Aviation Administration, Oct. 31, 2008.
This document defines the levels of performance the U.S. Government makes available to users of the GPS SPS augmented by the Wide Area Augmentation System.
\li <a href="https://egnos-user-support.essp-sas.eu/new_egnos_ops/documents/egnos-sdd/egnos-data-access-service-sdd" target="_blank"><b>EGNOS Data Access Service (EDAS) Service Definition Document. Revision 2.2</b></a>, European GNSS Agency (GSA), June, 2019. This is a complementary document to the RTCA DO229D, mentioned above. It describes the scope of services provided by the EGNOS EDAS Service to be used by end-users or Application Specific Service Providers. It details the general conditions relating to the use of the EGNOS service, a technical description of the Signal-in-Space (SIS), the reference receiver, environmental conditions, the service performance achieved and aspects relating to service provision.
\li <a href="https://egnos-user-support.essp-sas.eu/new_egnos_ops/documents/egnos-sdd/egnos-data-access-service-sdd" target="_blank"><b>EGNOS Data Access Service (EDAS) Service Definition Document. Revision 2.2</b></a>, European GNSS Agency (GSA), June, 2019.
This is a complementary document to the RTCA DO229D, mentioned above. It
describes the scope of services provided by the EGNOS EDAS Service to be used by
end-users or Application Specific Service Providers. It details the general
conditions relating to the use of the EGNOS service, a technical description of
the Signal-in-Space (SIS), the reference receiver, environmental conditions, the
service performance achieved and aspects relating to service provision.
\li <a href="https://egnos-user-support.essp-sas.eu/new_egnos_ops/documents/egnos-sdd/egnos-safety-life-service-sdd" target="_blank"><b>EGNOS Safety of Life Service Definition Document. Revision 3.3</b></a>, European GNSS Agency (GSA), Mar, 2019. The EGNOS Safety of Life (SoL) Service is provided openly and is freely accessible without any direct charge and is tailored to safety-critical transport applications in various domains, in particular for aviation applications. The service is thus compliant with the aviation APV-I (Approach with Vertical Guidance) requirements, as defined by ICAO in Annex 10, but may support also applications in other SoL domains.
\li <a href="https://egnos-user-support.essp-sas.eu/new_egnos_ops/documents/egnos-sdd/egnos-safety-life-service-sdd" target="_blank"><b>EGNOS Safety of Life Service Definition Document. Revision 3.3</b></a>, European GNSS Agency (GSA), Mar, 2019.
The EGNOS Safety of Life (SoL) Service is provided openly and is freely
accessible without any direct charge and is tailored to safety-critical
transport applications in various domains, in particular for aviation
applications. The service is thus compliant with the aviation APV-I (Approach
with Vertical Guidance) requirements, as defined by ICAO in Annex 10, but may
support also applications in other SoL domains.
\li <a href="https://egnos-user-support.essp-sas.eu/new_egnos_ops/documents/egnos-sdd/egnos-open-service-sdd" target="_blank"><b>EGNOS Open Service Service Definition Document. Revision 2.3</b></a>, European GNSS Agency (GSA), Sep., 2017.
@ -75,13 +100,19 @@ More information about EGNOS can be found through the <a href="https://egnos-use
\section standards Other Standards
\subsection rinex RINEX
The final output of a navigation receiver is usually its position, speed or other related physical quantities. However, the calculation of those quantities
are based on a series of measurements from one or more satellite constellations. Although receivers calculate positions in real time, in many cases it is
interesting to store intermediate measures for later post-processing. RINEX is the standard format that allows the management and disposal of the measures
generated by a receiver, as well as their off-line processing by a multitude of applications.
The final output of a navigation receiver is usually its position, speed or
other related physical quantities. However, the calculation of those quantities
are based on a series of measurements from one or more satellite constellations.
Although receivers calculate positions in real time, in many cases it is
interesting to store intermediate measures for later post-processing. RINEX is
the standard format that allows the management and disposal of the measures
generated by a receiver, as well as their off-line processing by a multitude of
applications.
\li The most common version at present is <a href="hftp://igs.org/pub/data/format/rinex212.txt" target="_blank"><b>RINEX: The Receiver Independent Exchange Format Version 2.12</b></a>, which enables storage of measurements from pseudorange, carrier-phase and Doppler systems for GPS, GLONASS, Galileo
along with data from EGNOS and WAAS satellite based augmentation systems (SBAS).
\li The most common version at present is <a href="hftp://igs.org/pub/data/format/rinex212.txt" target="_blank"><b>RINEX: The Receiver Independent Exchange Format Version 2.12</b></a>,
which enables storage of measurements from pseudorange, carrier-phase and Doppler systems for GPS,
GLONASS, Galileo along with data from EGNOS and WAAS satellite based
augmentation systems (SBAS).
\li The most recent version is <a href="ftp://igs.org/pub/data/format/rinex303.pdf" target="_blank"><b>RINEX: The Receiver Independent Exchange Format Version 3.03</b></a> published in July, 2015.
It includes Galileo and improves the handling of multi-constellation data files.
@ -90,34 +121,80 @@ It includes Galileo and improves the handling of multi-constellation data files.
\subsection nmea NMEA
The <a href="https://www.nmea.org/" target="_blank">National Marine Electronics Association </a> released the NMEA 0183 Interface Standard, which defines electrical signal requirements, data transmission protocol and time,
and specific sentence formats for a 4800-baud serial data bus. The standard is <a href="https://www.nmea.org/content/STANDARDS/NMEA_0183_Standard" target="_blank">available for purchase</a>.
The <a href="https://www.nmea.org/" target="_blank">National Marine Electronics Association</a>
released the NMEA 0183 Interface Standard, which defines electrical signal requirements, data transmission protocol and time,
and specific sentence formats for a 4800-baud serial data bus.
The standard is <a href="https://www.nmea.org/content/STANDARDS/NMEA_0183_Standard" target="_blank">available for purchase</a>.
\subsection kml KML
KML is an XML language focused on geographic visualization, including annotation of maps and images. Geographic visualization includes not only the presentation of graphical data on the globe, but also the control of the user's navigation in the sense of where to go and where to look.
Google submitted KML (formerly Keyhole Markup Language) to the Open Geospatial Consortium (OGC) to be evolved within the OGC consensus process with the following goal: KML Version 2.2 has been adopted as an OGC implementation standard.
KML is an XML language focused on geographic visualization, including annotation
of maps and images. Geographic visualization includes not only the presentation
of graphical data on the globe, but also the control of the user's navigation in
the sense of where to go and where to look. Google submitted KML (formerly
Keyhole Markup Language) to the Open Geospatial Consortium (OGC) to be evolved
within the OGC consensus process with the following goal: KML Version 2.2 has
been adopted as an OGC implementation standard.
\li Open Geospatial Consortium, Inc., <a href="https://portal.opengeospatial.org/files/?artifact_id=27810" target="_blank"><b>OGC KML Version 2.2.0</b></a>, April 2008.
\subsection cxx C++ Standards
The C++ programming language is standardized by the International Organization for Standardization (ISO), with the latest standard version ratified and published by ISO in December 2017 as ISO/IEC 14882:2017 (informally known as C++17). The list of supported C++ standards (the highest available is automatically selected by the CMake script):
The C++ programming language is standardized by the International Organization
for Standardization (ISO), with the latest standard version ratified and
published by ISO in December 2017 as ISO/IEC 14882:2017 (informally known as
C++17). The list of supported C++ standards (the highest available is
automatically selected by the CMake script):
<ul>
<li><strong>Draft C++23</strong>: Check the <a href="https://github.com/cplusplus/draft" target="_blank">C++ standard draft sources at GitHub</a>.</li>
<li><strong>C++20</strong>: The current ISO C++ standard is officially known as <em>ISO International Standard ISO/IEC 14882:2020(E) Programming languages C++</em>. You can get it from <a href="https://www.iso.org/standard/79358.html" target="_blank">ISO</a>, <a href="https://webstore.iec.ch/publication/68285" target="_blank">IEC</a> or <a href="https://webstore.ansi.org/Standards/ISO/ISOIEC148822020" target="_blank">ANSI</a>. The closest free working document available is <a href="https://github.com/cplusplus/draft/releases/download/n4868/n4868.pdf" target="_blank">N4868</a>.</li>
<li><strong>C++17</strong>: A former ISO C++ standard was officially known as <em>ISO International Standard ISO/IEC 14882:2017 Programming languages C++</em>. You can get it from <a href="https://www.iso.org/standard/68564.html" target="_blank">ISO</a>, <a href="https://webstore.iec.ch/publication/62162" target="_blank">IEC</a> or <a href="https://webstore.ansi.org/Standards/ISO/ISOIEC148822017" target="_blank">ANSI</a>. The closest free working document available is <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/n4659.pdf" target="_blank">N4659</a>.</li>
<li><strong>C++14</strong>: A former ISO C++ standard was officially known as <em>ISO International Standard ISO/IEC 14882:2014 Programming languages C++</em>. You can get it from <a href="https://www.iso.org/standard/64029.html" target="_blank">ISO</a> or <a href="https://webstore.ansi.org/RecordDetail.aspx?sku=INCITS/ISO/IEC+14882:2014+(2016)" target="_blank">ANSI</a>. The closest free working document available is <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4296.pdf" target="_blank">N4296</a>.</li>
<li><strong>C++11</strong>: An older ISO C++ standard was ISO/IEC 14882:2011. You can get it from <a href="https://www.iso.org/standard/50372.html" target="_blank">ISO</a>. The closest free working document available is <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3337.pdf" target="_blank">N3337</a>.</li>
<li><strong>C++20</strong>: The current ISO C++ standard is officially known as <em>ISO International Standard ISO/IEC 14882:2020(E) Programming languages C++</em>.
You can get it from <a href="https://www.iso.org/standard/79358.html"
target="_blank">ISO</a>, <a
href="https://webstore.iec.ch/publication/68285" target="_blank">IEC</a>
or <a href="https://webstore.ansi.org/Standards/ISO/ISOIEC148822020"
target="_blank">ANSI</a>. The closest free working document available is
<a
href="https://github.com/cplusplus/draft/releases/download/n4868/n4868.pdf"
target="_blank">N4868</a>.</li>
<li><strong>C++17</strong>: A former ISO C++ standard was officially known as <em>ISO International Standard ISO/IEC 14882:2017 Programming languages C++</em>.
You can get it from <a href="https://www.iso.org/standard/68564.html"
target="_blank">ISO</a>, <a
href="https://webstore.iec.ch/publication/62162" target="_blank">IEC</a>
or <a href="https://webstore.ansi.org/Standards/ISO/ISOIEC148822017"
target="_blank">ANSI</a>. The closest free working document available is
<a
href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/n4659.pdf"
target="_blank">N4659</a>.</li>
<li><strong>C++14</strong>: A former ISO C++ standard was officially known as <em>ISO International Standard ISO/IEC 14882:2014 Programming languages C++</em>.
You can get it from <a href="https://www.iso.org/standard/64029.html"
target="_blank">ISO</a> or <a
href="https://webstore.ansi.org/RecordDetail.aspx?sku=INCITS/ISO/IEC+14882:2014+(2016)"
target="_blank">ANSI</a>. The closest free working document available is
<a
href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4296.pdf"
target="_blank">N4296</a>.</li>
<li><strong>C++11</strong>: An older ISO C++ standard was ISO/IEC 14882:2011.
You can get it from <a href="https://www.iso.org/standard/50372.html"
target="_blank">ISO</a>. The closest free working document available is <a
href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3337.pdf"
target="_blank">N3337</a>.</li>
</ul>
\subsection protocols Positioning protocols in wireless communication networks
Cellular industry location standards first appeared in the late 1990s, with the <a href="https://www.3gpp.org/index.php" target="_blank">3rd generation partnership project (3GPP)</a> radio resource location services protocol (RRLP) technical specification 44.031 positioning protocol for GSM networks.
Today, RRLP is the de facto standardized protocol to carry GNSS assistance data to GNSS-enabled mobile devices, and the term "3GPP specification" now covers all GSM (including GPRS and EDGE),
W-CDMA and LTE (including LTE-A) specifications. Precisely, the label "LTE-A" is applied to networks compliant with LTE Release 10 and beyond, which fulfill the requirements issued by
the <a href="https://www.itu.int/en/ITU-R/Pages/default.aspx target="_blank">International Telecommunication Union Radiocommunication Sector (ITU-R)</a> in the global standard for international mobile telecommunications (IMT Advanced, also referred to as 4G)
access technologies.
Cellular industry location standards first appeared in the late 1990s, with the
<a href="https://www.3gpp.org/index.php" target="_blank">3rd generation partnership project (3GPP)</a>
radio resource location services protocol (RRLP)
technical specification 44.031 positioning protocol for GSM networks. Today,
RRLP is the de facto standardized protocol to carry GNSS assistance data to
GNSS-enabled mobile devices, and the term "3GPP specification" now covers all
GSM (including GPRS and EDGE), W-CDMA and LTE (including LTE-A) specifications.
Precisely, the label "LTE-A" is applied to networks compliant with LTE Release
10 and beyond, which fulfill the requirements issued by the
<a href="https://www.itu.int/en/ITU-R/Pages/default.aspx target="_blank">International Telecommunication Union Radiocommunication Sector (ITU-R)</a>
in the global standard for international mobile telecommunications
(IMT Advanced, also referred to as 4G) access technologies.
Control plane protocols:
@ -132,9 +209,12 @@ User plane protocols:
LTE Release 9 introduced extension hooks in LPP messages, so that the bodies external to 3GPP could extend the LPP feature set. OMA LPP extensions (LPPe), supported in SUPL 3.0, build on top of the 3GPP LPP reusing its procedures and data types.
Check the <a href="http://openmobilealliance.org/wp/index.html" target="_blank">OMA Specifications webpage</a> for updated information about LPP Extensions (LPPe) Specification.
\li The <a href="http://member.openmobilealliance.org/ftp/Public_documents/loc/Permanent_documents/OMA-TS-MLP-V3_5-20181119-D.zip" target="_blank"><b>OMA Mobile Location Protocol (MLP) V3.5</b></a> is an application-level protocol for getting the position of mobile stations (mobile phones, wireless personal digital assistants, etc.) independent
of underlying network technology. The MLP serves as the interface between a Location Server and a Location Services (LCS) Client.
This specification defines the core set of operations that a Location Server should be able to perform.
\li The <a href="http://member.openmobilealliance.org/ftp/Public_documents/loc/Permanent_documents/OMA-TS-MLP-V3_5-20181119-D.zip" target="_blank"><b>OMA Mobile Location Protocol (MLP) V3.5</b></a>
is an application-level protocol for getting the position of mobile stations
(mobile phones, wireless personal digital assistants, etc.) independent of
underlying network technology. The MLP serves as the interface between a
Location Server and a Location Services (LCS) Client. This specification defines
the core set of operations that a Location Server should be able to perform.
*/

View File

@ -150,7 +150,7 @@ Rtklib_Pvt::Rtklib_Pvt(const ConfigurationInterface* configuration,
pvt_output_parameters.gpx_rate_ms = bc::lcm(configuration->property(role + ".gpx_rate_ms", pvt_output_parameters.gpx_rate_ms), pvt_output_parameters.output_rate_ms);
pvt_output_parameters.geojson_rate_ms = bc::lcm(configuration->property(role + ".geojson_rate_ms", pvt_output_parameters.geojson_rate_ms), pvt_output_parameters.output_rate_ms);
pvt_output_parameters.nmea_rate_ms = bc::lcm(configuration->property(role + ".nmea_rate_ms", pvt_output_parameters.nmea_rate_ms), pvt_output_parameters.output_rate_ms);
pvt_output_parameters.an_rate_ms = bc::lcm(configuration->property(role + ".an_rate_ms", pvt_output_parameters.an_rate_ms), pvt_output_parameters.output_rate_ms);
pvt_output_parameters.an_rate_ms = configuration->property(role + ".an_rate_ms", pvt_output_parameters.an_rate_ms);
// Infer the type of receiver
/*

View File

@ -58,6 +58,13 @@ else()
)
endif()
if(PMT_USES_BOOST_ANY)
target_compile_definitions(pvt_gr_blocks
PRIVATE
-DPMT_USES_BOOST_ANY=1
)
endif()
if(ENABLE_CLANG_TIDY)
if(CLANG_TIDY_EXE)
set_target_properties(pvt_gr_blocks

View File

@ -56,7 +56,6 @@
#include "rtcm_printer.h"
#include "rtklib_rtkcmn.h"
#include "rtklib_solver.h"
#include <boost/any.hpp> // for any_cast, any
#include <boost/archive/xml_iarchive.hpp> // for xml_iarchive
#include <boost/archive/xml_oarchive.hpp> // for xml_oarchive
#include <boost/exception/diagnostic_information.hpp>
@ -94,6 +93,13 @@ namespace bc = boost::math;
namespace bc = boost::integer;
#endif
#if PMT_USES_BOOST_ANY
#include <boost/any.hpp>
namespace wht = boost;
#else
#include <any>
namespace wht = std;
#endif
rtklib_pvt_gs_sptr rtklib_make_pvt_gs(uint32_t nchannels,
const Pvt_Conf& conf_,
@ -134,6 +140,7 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels,
d_galileo_has_data_sptr_type_hash_code(typeid(std::shared_ptr<Galileo_HAS_data>).hash_code()),
d_rinex_version(conf_.rinex_version),
d_rx_time(0.0),
d_local_counter_ms(0ULL),
d_rinexobs_rate_ms(conf_.rinexobs_rate_ms),
d_kml_rate_ms(conf_.kml_rate_ms),
d_gpx_rate_ms(conf_.gpx_rate_ms),
@ -1114,7 +1121,7 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg)
if (msg_type_hash_code == d_gps_ephemeris_sptr_type_hash_code)
{
// ### GPS EPHEMERIS ###
const auto gps_eph = boost::any_cast<std::shared_ptr<Gps_Ephemeris>>(pmt::any_ref(msg));
const auto gps_eph = wht::any_cast<std::shared_ptr<Gps_Ephemeris>>(pmt::any_ref(msg));
DLOG(INFO) << "Ephemeris record has arrived from SAT ID "
<< gps_eph->PRN << " (Block "
<< gps_eph->satelliteBlock[gps_eph->PRN] << ")"
@ -1164,7 +1171,7 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg)
else if (msg_type_hash_code == d_gps_iono_sptr_type_hash_code)
{
// ### GPS IONO ###
const auto gps_iono = boost::any_cast<std::shared_ptr<Gps_Iono>>(pmt::any_ref(msg));
const auto gps_iono = wht::any_cast<std::shared_ptr<Gps_Iono>>(pmt::any_ref(msg));
d_internal_pvt_solver->gps_iono = *gps_iono;
if (d_enable_rx_clock_correction == true)
{
@ -1175,7 +1182,7 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg)
else if (msg_type_hash_code == d_gps_utc_model_sptr_type_hash_code)
{
// ### GPS UTC MODEL ###
const auto gps_utc_model = boost::any_cast<std::shared_ptr<Gps_Utc_Model>>(pmt::any_ref(msg));
const auto gps_utc_model = wht::any_cast<std::shared_ptr<Gps_Utc_Model>>(pmt::any_ref(msg));
d_internal_pvt_solver->gps_utc_model = *gps_utc_model;
if (d_enable_rx_clock_correction == true)
{
@ -1186,7 +1193,7 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg)
else if (msg_type_hash_code == d_gps_cnav_ephemeris_sptr_type_hash_code)
{
// ### GPS CNAV message ###
const auto gps_cnav_ephemeris = boost::any_cast<std::shared_ptr<Gps_CNAV_Ephemeris>>(pmt::any_ref(msg));
const auto gps_cnav_ephemeris = wht::any_cast<std::shared_ptr<Gps_CNAV_Ephemeris>>(pmt::any_ref(msg));
// update/insert new ephemeris record to the global ephemeris map
if (d_rinex_output_enabled && d_rp->is_rinex_header_written()) // The header is already written, we can now log the navigation message data
{
@ -1225,7 +1232,7 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg)
else if (msg_type_hash_code == d_gps_cnav_iono_sptr_type_hash_code)
{
// ### GPS CNAV IONO ###
const auto gps_cnav_iono = boost::any_cast<std::shared_ptr<Gps_CNAV_Iono>>(pmt::any_ref(msg));
const auto gps_cnav_iono = wht::any_cast<std::shared_ptr<Gps_CNAV_Iono>>(pmt::any_ref(msg));
d_internal_pvt_solver->gps_cnav_iono = *gps_cnav_iono;
if (d_enable_rx_clock_correction == true)
{
@ -1236,7 +1243,7 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg)
else if (msg_type_hash_code == d_gps_cnav_utc_model_sptr_type_hash_code)
{
// ### GPS CNAV UTC MODEL ###
const auto gps_cnav_utc_model = boost::any_cast<std::shared_ptr<Gps_CNAV_Utc_Model>>(pmt::any_ref(msg));
const auto gps_cnav_utc_model = wht::any_cast<std::shared_ptr<Gps_CNAV_Utc_Model>>(pmt::any_ref(msg));
d_internal_pvt_solver->gps_cnav_utc_model = *gps_cnav_utc_model;
{
d_user_pvt_solver->gps_cnav_utc_model = *gps_cnav_utc_model;
@ -1247,7 +1254,7 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg)
else if (msg_type_hash_code == d_gps_almanac_sptr_type_hash_code)
{
// ### GPS ALMANAC ###
const auto gps_almanac = boost::any_cast<std::shared_ptr<Gps_Almanac>>(pmt::any_ref(msg));
const auto gps_almanac = wht::any_cast<std::shared_ptr<Gps_Almanac>>(pmt::any_ref(msg));
d_internal_pvt_solver->gps_almanac_map[gps_almanac->PRN] = *gps_almanac;
if (d_enable_rx_clock_correction == true)
{
@ -1260,7 +1267,7 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg)
else if (msg_type_hash_code == d_galileo_ephemeris_sptr_type_hash_code)
{
// ### Galileo EPHEMERIS ###
const auto galileo_eph = boost::any_cast<std::shared_ptr<Galileo_Ephemeris>>(pmt::any_ref(msg));
const auto galileo_eph = wht::any_cast<std::shared_ptr<Galileo_Ephemeris>>(pmt::any_ref(msg));
// insert new ephemeris record
DLOG(INFO) << "Galileo New Ephemeris record inserted in global map with TOW =" << galileo_eph->tow
<< ", GALILEO Week Number =" << galileo_eph->WN
@ -1310,7 +1317,7 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg)
else if (msg_type_hash_code == d_galileo_iono_sptr_type_hash_code)
{
// ### Galileo IONO ###
const auto galileo_iono = boost::any_cast<std::shared_ptr<Galileo_Iono>>(pmt::any_ref(msg));
const auto galileo_iono = wht::any_cast<std::shared_ptr<Galileo_Iono>>(pmt::any_ref(msg));
d_internal_pvt_solver->galileo_iono = *galileo_iono;
if (d_enable_rx_clock_correction == true)
{
@ -1321,7 +1328,7 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg)
else if (msg_type_hash_code == d_galileo_utc_model_sptr_type_hash_code)
{
// ### Galileo UTC MODEL ###
const auto galileo_utc_model = boost::any_cast<std::shared_ptr<Galileo_Utc_Model>>(pmt::any_ref(msg));
const auto galileo_utc_model = wht::any_cast<std::shared_ptr<Galileo_Utc_Model>>(pmt::any_ref(msg));
d_internal_pvt_solver->galileo_utc_model = *galileo_utc_model;
if (d_enable_rx_clock_correction == true)
{
@ -1332,7 +1339,7 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg)
else if (msg_type_hash_code == d_galileo_almanac_helper_sptr_type_hash_code)
{
// ### Galileo Almanac ###
const auto galileo_almanac_helper = boost::any_cast<std::shared_ptr<Galileo_Almanac_Helper>>(pmt::any_ref(msg));
const auto galileo_almanac_helper = wht::any_cast<std::shared_ptr<Galileo_Almanac_Helper>>(pmt::any_ref(msg));
const Galileo_Almanac sv1 = galileo_almanac_helper->get_almanac(1);
const Galileo_Almanac sv2 = galileo_almanac_helper->get_almanac(2);
const Galileo_Almanac sv3 = galileo_almanac_helper->get_almanac(3);
@ -1366,7 +1373,7 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg)
else if (msg_type_hash_code == d_galileo_almanac_sptr_type_hash_code)
{
// ### Galileo Almanac ###
const auto galileo_alm = boost::any_cast<std::shared_ptr<Galileo_Almanac>>(pmt::any_ref(msg));
const auto galileo_alm = wht::any_cast<std::shared_ptr<Galileo_Almanac>>(pmt::any_ref(msg));
// update/insert new almanac record to the global almanac map
d_internal_pvt_solver->galileo_almanac_map[galileo_alm->PRN] = *galileo_alm;
if (d_enable_rx_clock_correction == true)
@ -1379,7 +1386,7 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg)
else if (msg_type_hash_code == d_glonass_gnav_ephemeris_sptr_type_hash_code)
{
// ### GLONASS GNAV EPHEMERIS ###
const auto glonass_gnav_eph = boost::any_cast<std::shared_ptr<Glonass_Gnav_Ephemeris>>(pmt::any_ref(msg));
const auto glonass_gnav_eph = wht::any_cast<std::shared_ptr<Glonass_Gnav_Ephemeris>>(pmt::any_ref(msg));
// TODO Add GLONASS with gps week number and tow,
// insert new ephemeris record
DLOG(INFO) << "GLONASS GNAV New Ephemeris record inserted in global map with TOW =" << glonass_gnav_eph->d_TOW
@ -1418,7 +1425,7 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg)
else if (msg_type_hash_code == d_glonass_gnav_utc_model_sptr_type_hash_code)
{
// ### GLONASS GNAV UTC MODEL ###
const auto glonass_gnav_utc_model = boost::any_cast<std::shared_ptr<Glonass_Gnav_Utc_Model>>(pmt::any_ref(msg));
const auto glonass_gnav_utc_model = wht::any_cast<std::shared_ptr<Glonass_Gnav_Utc_Model>>(pmt::any_ref(msg));
d_internal_pvt_solver->glonass_gnav_utc_model = *glonass_gnav_utc_model;
if (d_enable_rx_clock_correction == true)
{
@ -1429,7 +1436,7 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg)
else if (msg_type_hash_code == d_glonass_gnav_almanac_sptr_type_hash_code)
{
// ### GLONASS GNAV Almanac ###
const auto glonass_gnav_almanac = boost::any_cast<std::shared_ptr<Glonass_Gnav_Almanac>>(pmt::any_ref(msg));
const auto glonass_gnav_almanac = wht::any_cast<std::shared_ptr<Glonass_Gnav_Almanac>>(pmt::any_ref(msg));
d_internal_pvt_solver->glonass_gnav_almanac = *glonass_gnav_almanac;
if (d_enable_rx_clock_correction == true)
{
@ -1443,7 +1450,7 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg)
else if (msg_type_hash_code == d_beidou_dnav_ephemeris_sptr_type_hash_code)
{
// ### Beidou EPHEMERIS ###
const auto bds_dnav_eph = boost::any_cast<std::shared_ptr<Beidou_Dnav_Ephemeris>>(pmt::any_ref(msg));
const auto bds_dnav_eph = wht::any_cast<std::shared_ptr<Beidou_Dnav_Ephemeris>>(pmt::any_ref(msg));
DLOG(INFO) << "Ephemeris record has arrived from SAT ID "
<< bds_dnav_eph->PRN << " (Block "
<< bds_dnav_eph->satelliteBlock[bds_dnav_eph->PRN] << ")"
@ -1486,7 +1493,7 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg)
else if (msg_type_hash_code == d_beidou_dnav_iono_sptr_type_hash_code)
{
// ### BeiDou IONO ###
const auto bds_dnav_iono = boost::any_cast<std::shared_ptr<Beidou_Dnav_Iono>>(pmt::any_ref(msg));
const auto bds_dnav_iono = wht::any_cast<std::shared_ptr<Beidou_Dnav_Iono>>(pmt::any_ref(msg));
d_internal_pvt_solver->beidou_dnav_iono = *bds_dnav_iono;
if (d_enable_rx_clock_correction == true)
{
@ -1497,7 +1504,7 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg)
else if (msg_type_hash_code == d_beidou_dnav_utc_model_sptr_type_hash_code)
{
// ### BeiDou UTC MODEL ###
const auto bds_dnav_utc_model = boost::any_cast<std::shared_ptr<Beidou_Dnav_Utc_Model>>(pmt::any_ref(msg));
const auto bds_dnav_utc_model = wht::any_cast<std::shared_ptr<Beidou_Dnav_Utc_Model>>(pmt::any_ref(msg));
d_internal_pvt_solver->beidou_dnav_utc_model = *bds_dnav_utc_model;
if (d_enable_rx_clock_correction == true)
{
@ -1508,7 +1515,7 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg)
else if (msg_type_hash_code == d_beidou_dnav_almanac_sptr_type_hash_code)
{
// ### BeiDou ALMANAC ###
const auto bds_dnav_almanac = boost::any_cast<std::shared_ptr<Beidou_Dnav_Almanac>>(pmt::any_ref(msg));
const auto bds_dnav_almanac = wht::any_cast<std::shared_ptr<Beidou_Dnav_Almanac>>(pmt::any_ref(msg));
d_internal_pvt_solver->beidou_dnav_almanac_map[bds_dnav_almanac->PRN] = *bds_dnav_almanac;
if (d_enable_rx_clock_correction == true)
{
@ -1521,7 +1528,7 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg)
LOG(WARNING) << "msg_handler_telemetry unknown object type!";
}
}
catch (const boost::bad_any_cast& e)
catch (const wht::bad_any_cast& e)
{
LOG(WARNING) << "msg_handler_telemetry Bad any_cast: " << e.what();
}
@ -1537,12 +1544,12 @@ void rtklib_pvt_gs::msg_handler_has_data(const pmt::pmt_t& msg) const
{
if (d_enable_has_messages)
{
const auto has_data = boost::any_cast<std::shared_ptr<Galileo_HAS_data>>(pmt::any_ref(msg));
const auto has_data = wht::any_cast<std::shared_ptr<Galileo_HAS_data>>(pmt::any_ref(msg));
d_has_simple_printer->print_message(has_data.get());
}
}
}
catch (const boost::bad_any_cast& e)
catch (const wht::bad_any_cast& e)
{
LOG(WARNING) << "msg_handler_has_data Bad any_cast: " << e.what();
}
@ -1901,6 +1908,7 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item
bool flag_write_RTCM_1045_output = false;
bool flag_write_RTCM_MSM_output = false;
bool flag_write_RINEX_obs_output = false;
d_local_counter_ms += static_cast<uint64_t>(d_observable_interval_ms);
d_gnss_observables_map.clear();
const auto** in = reinterpret_cast<const Gnss_Synchro**>(&input_items[0]); // Get the input buffer pointer
@ -2244,13 +2252,6 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item
flag_write_RTCM_1045_output,
d_enable_rx_clock_correction);
}
if (d_an_printer_enabled)
{
if (current_RX_time_ms % d_an_rate_ms == 0)
{
d_an_printer->print_packet(d_user_pvt_solver.get(), d_gnss_observables_map);
}
}
}
}
@ -2326,6 +2327,13 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item
}
}
}
if (d_an_printer_enabled)
{
if (d_local_counter_ms % static_cast<uint64_t>(d_an_rate_ms) == 0)
{
d_an_printer->print_packet(d_user_pvt_solver.get(), d_gnss_observables_map);
}
}
}
return noutput_items;

View File

@ -233,6 +233,7 @@ private:
double d_rinex_version;
double d_rx_time;
uint64_t d_local_counter_ms;
key_t d_sysv_msg_key;
int d_sysv_msqid;

View File

@ -30,8 +30,10 @@
#include <unistd.h> // for write(), read(), close()
An_Packet_Printer::An_Packet_Printer(const std::string& an_dump_devname) : d_an_devname(an_dump_devname),
d_an_dev_descriptor(init_serial(d_an_devname))
An_Packet_Printer::An_Packet_Printer(const std::string& an_dump_devname)
: d_start(std::chrono::system_clock::now()),
d_an_devname(an_dump_devname),
d_an_dev_descriptor(init_serial(d_an_devname))
{
if (d_an_dev_descriptor != -1)
{
@ -91,11 +93,12 @@ void An_Packet_Printer::close_serial() const
*/
void An_Packet_Printer::update_sdr_gnss_packet(sdr_gnss_packet_t* _packet, const Rtklib_Solver* const pvt, const std::map<int, Gnss_Synchro>& gnss_observables_map) const
{
std::chrono::time_point<std::chrono::system_clock> this_epoch;
std::map<int, Gnss_Synchro>::const_iterator gnss_observables_iter;
uint8_t num_gps_sats = 0;
uint8_t num_gal_sats = 0;
uint32_t microseconds = 0;
int index = 0;
bool fix_3d = pvt->is_valid_position();
const int max_reported_sats = *(&_packet->sats + 1) - _packet->sats;
for (gnss_observables_iter = gnss_observables_map.cbegin();
@ -128,7 +131,6 @@ void An_Packet_Printer::update_sdr_gnss_packet(sdr_gnss_packet_t* _packet, const
}
_packet->sats[index].doppler = doppler;
microseconds = static_cast<uint32_t>(static_cast<double>(gnss_observables_iter->second.Tracking_sample_counter) / static_cast<double>(gnss_observables_iter->second.fs)) * 1e6;
index++;
}
break;
@ -154,7 +156,6 @@ void An_Packet_Printer::update_sdr_gnss_packet(sdr_gnss_packet_t* _packet, const
}
_packet->sats[index].doppler = doppler;
microseconds = static_cast<uint32_t>(static_cast<double>(gnss_observables_iter->second.Tracking_sample_counter) / static_cast<double>(gnss_observables_iter->second.fs)) * 1e6;
index++;
}
break;
@ -164,10 +165,12 @@ void An_Packet_Printer::update_sdr_gnss_packet(sdr_gnss_packet_t* _packet, const
}
}
this_epoch = std::chrono::system_clock::now();
std::chrono::duration<double> elapsed_seconds = this_epoch - d_start;
_packet->nsvfix = static_cast<uint8_t>(pvt->get_num_valid_observations());
_packet->gps_satellites = num_gps_sats;
_packet->galileo_satellites = num_gal_sats;
_packet->microseconds = microseconds;
_packet->microseconds = static_cast<uint32_t>(elapsed_seconds.count() * 1.0e6);
_packet->latitude = static_cast<double>(pvt->get_latitude()) * (M_PI / 180.0);
_packet->longitude = static_cast<double>(pvt->get_longitude()) * (M_PI / 180.0);
_packet->height = static_cast<double>(pvt->get_height());
@ -176,8 +179,10 @@ void An_Packet_Printer::update_sdr_gnss_packet(sdr_gnss_packet_t* _packet, const
_packet->velocity[2] = static_cast<float>(-pvt->get_rx_vel()[2]);
uint16_t status = 0;
// Set 3D fix (bit 0 and 1) / Set Doppler velocity valid (bit 2) / Set Time valid (bit 3)
status = status & 0b00001111;
if (fix_3d)
{
status = 15; // Set 3D fix (bit 0 and 1) / Set Doppler velocity valid (bit 2) / Set Time valid (bit 3)
}
_packet->status = status;
}
@ -190,8 +195,6 @@ void An_Packet_Printer::update_sdr_gnss_packet(sdr_gnss_packet_t* _packet, const
*/
void An_Packet_Printer::encode_sdr_gnss_packet(sdr_gnss_packet_t* sdr_gnss_packet, an_packet_t* _packet) const
{
_packet->id = SDR_GNSS_PACKET_ID;
_packet->length = SDR_GNSS_PACKET_LENGTH;
uint8_t offset = 0;
LSB_bytes_to_array(reinterpret_cast<uint8_t*>(&sdr_gnss_packet->nsvfix), offset, _packet->data, sizeof(sdr_gnss_packet->nsvfix));
offset += sizeof(sdr_gnss_packet->nsvfix);
@ -236,10 +239,9 @@ void An_Packet_Printer::encode_sdr_gnss_packet(sdr_gnss_packet_t* sdr_gnss_packe
void An_Packet_Printer::an_packet_encode(an_packet_t* an_packet) const
{
uint16_t crc;
an_packet->header[1] = an_packet->id;
an_packet->header[2] = an_packet->length;
crc = calculate_crc16(an_packet->data, an_packet->length);
memcpy(&an_packet->header[3], &crc, sizeof(uint16_t));
an_packet->header[1] = SDR_GNSS_PACKET_ID;
crc = calculate_crc16(an_packet->data, SDR_GNSS_PACKET_LENGTH);
memcpy(&an_packet->header[2], &crc, sizeof(uint16_t));
an_packet->header[0] = calculate_header_lrc(&an_packet->header[1]);
}
@ -249,7 +251,7 @@ void An_Packet_Printer::an_packet_encode(an_packet_t* an_packet) const
*/
uint8_t An_Packet_Printer::calculate_header_lrc(const uint8_t* data) const
{
return ((data[0] + data[1] + data[2] + data[3]) ^ 0xFF) + 1;
return ((data[0] + data[1] + data[2]) ^ 0xFF) + 1;
}

View File

@ -23,6 +23,7 @@
#include "gnss_synchro.h"
#include <array>
#include <chrono>
#include <cstddef>
#include <cstdint>
#include <map>
@ -60,10 +61,8 @@ struct sdr_gnss_packet_t
struct an_packet_t
{
uint8_t id;
uint8_t length;
uint8_t header[5]; // AN_PACKET_HEADER_SIZE
uint8_t data[126]; // AN_MAXIMUM_PACKET_SIZE
uint8_t header[4];
uint8_t data[73]; // SDR_GNSS_PACKET_LENGTH
};
@ -121,6 +120,7 @@ private:
void encode_sdr_gnss_packet(sdr_gnss_packet_t* sdr_gnss_packet, an_packet_t* _packet) const;
void LSB_bytes_to_array(void* _in, int offset, uint8_t* _out, uint8_t var_size) const;
std::chrono::time_point<std::chrono::system_clock> d_start;
std::string d_an_devname;
int d_an_dev_descriptor; // serial device descriptor (i.e. COM port)
};

View File

@ -76,6 +76,16 @@ if(USE_BOOST_BIND_PLACEHOLDERS)
)
endif()
if(PMT_USES_BOOST_ANY)
target_compile_definitions(channel_libs
PRIVATE -DPMT_USES_BOOST_ANY=1
)
target_link_libraries(channel_libs
PRIVATE
Boost::headers
)
endif()
if(ENABLE_CLANG_TIDY)
if(CLANG_TIDY_EXE)
set_target_properties(channel_libs

View File

@ -17,13 +17,20 @@
#include "channel_msg_receiver_cc.h"
#include <boost/any.hpp>
#include <glog/logging.h>
#include <gnuradio/gr_complex.h>
#include <gnuradio/io_signature.h>
#include <cstdint>
#include <utility>
#if PMT_USES_BOOST_ANY
#include <boost/any.hpp>
namespace wht = boost;
#else
#include <any>
namespace wht = std;
#endif
#if HAS_GENERIC_LAMBDA
#else
#include <boost/bind/bind.hpp>
@ -85,7 +92,7 @@ void channel_msg_receiver_cc::msg_handler_channel_events(const pmt::pmt_t& msg)
break;
}
}
catch (const boost::bad_any_cast& e)
catch (const wht::bad_any_cast& e)
{
LOG(WARNING) << "msg_handler_channel_events Bad any cast: " << e.what();
}

View File

@ -27,10 +27,11 @@ interleaved_byte_to_complex_byte_sptr make_interleaved_byte_to_complex_byte()
}
interleaved_byte_to_complex_byte::interleaved_byte_to_complex_byte() : sync_decimator("interleaved_byte_to_complex_byte",
gr::io_signature::make(1, 1, sizeof(int8_t)),
gr::io_signature::make(1, 1, sizeof(lv_8sc_t)), // lv_8sc_t is a Volk's typedef for std::complex<signed char>
2)
interleaved_byte_to_complex_byte::interleaved_byte_to_complex_byte()
: sync_decimator("interleaved_byte_to_complex_byte",
gr::io_signature::make(1, 1, sizeof(int8_t)),
gr::io_signature::make(1, 1, sizeof(lv_8sc_t)), // lv_8sc_t is a Volk's typedef for std::complex<signed char>
2)
{
const auto alignment_multiple = static_cast<int>(volk_get_alignment() / sizeof(lv_8sc_t));
set_alignment(std::max(1, alignment_multiple));

View File

@ -27,10 +27,11 @@ interleaved_byte_to_complex_short_sptr make_interleaved_byte_to_complex_short()
}
interleaved_byte_to_complex_short::interleaved_byte_to_complex_short() : sync_decimator("interleaved_byte_to_complex_short",
gr::io_signature::make(1, 1, sizeof(int8_t)),
gr::io_signature::make(1, 1, sizeof(lv_16sc_t)), // lv_16sc_t is a Volk's typedef for std::complex<short int>
2)
interleaved_byte_to_complex_short::interleaved_byte_to_complex_short()
: sync_decimator("interleaved_byte_to_complex_short",
gr::io_signature::make(1, 1, sizeof(int8_t)),
gr::io_signature::make(1, 1, sizeof(lv_16sc_t)), // lv_16sc_t is a Volk's typedef for std::complex<short int>
2)
{
const auto alignment_multiple = static_cast<int>(volk_get_alignment() / sizeof(lv_16sc_t));
set_alignment(std::max(1, alignment_multiple));

View File

@ -27,10 +27,11 @@ interleaved_short_to_complex_short_sptr make_interleaved_short_to_complex_short(
}
interleaved_short_to_complex_short::interleaved_short_to_complex_short() : sync_decimator("interleaved_short_to_complex_short",
gr::io_signature::make(1, 1, sizeof(int16_t)),
gr::io_signature::make(1, 1, sizeof(lv_16sc_t)), // lv_16sc_t is a Volk's typedef for std::complex<short int>
2)
interleaved_short_to_complex_short::interleaved_short_to_complex_short()
: sync_decimator("interleaved_short_to_complex_short",
gr::io_signature::make(1, 1, sizeof(int16_t)),
gr::io_signature::make(1, 1, sizeof(lv_16sc_t)), // lv_16sc_t is a Volk's typedef for std::complex<short int>
2)
{
const auto alignment_multiple = static_cast<int>(volk_get_alignment() / sizeof(lv_16sc_t));
set_alignment(std::max(1, alignment_multiple));

View File

@ -23,15 +23,17 @@
BeamformerFilter::BeamformerFilter(
const ConfigurationInterface* configuration, const std::string& role,
unsigned int in_stream, unsigned int out_stream) : role_(role), in_stream_(in_stream), out_stream_(out_stream)
unsigned int in_stream, unsigned int out_stream)
: role_(role),
in_stream_(in_stream),
out_stream_(out_stream)
{
const std::string default_item_type("gr_complex");
const std::string default_dump_file("./data/input_filter.dat");
item_type_ = configuration->property(role + ".item_type", default_item_type);
dump_ = configuration->property(role + ".dump", false);
DLOG(INFO) << "dump_ is " << dump_;
dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file);
DLOG(INFO) << "role " << role_;
if (item_type_ == "gr_complex")
{
item_size_ = sizeof(gr_complex);
@ -51,7 +53,6 @@ BeamformerFilter::BeamformerFilter(
file_sink_ = gr::blocks::file_sink::make(item_size_, dump_filename_.c_str());
DLOG(INFO) << "file_sink(" << file_sink_->unique_id() << ")";
}
samples_ = 0ULL;
if (in_stream_ > 8)
{
LOG(ERROR) << "This implementation only supports eight input streams";

View File

@ -72,7 +72,6 @@ private:
std::string item_type_;
std::string dump_filename_;
size_t item_size_;
uint64_t samples_;
unsigned int in_stream_;
unsigned int out_stream_;
bool dump_;

View File

@ -23,12 +23,18 @@
#include <utility>
FirFilter::FirFilter(const ConfigurationInterface* configuration, std::string role,
unsigned int in_streams, unsigned int out_streams) : role_(std::move(role)), in_streams_(in_streams), out_streams_(out_streams)
FirFilter::FirFilter(const ConfigurationInterface* configuration,
std::string role,
unsigned int in_streams,
unsigned int out_streams)
: config_(configuration),
role_(std::move(role)),
item_size_(0),
in_streams_(in_streams),
out_streams_(out_streams)
{
config_ = configuration;
(*this).init();
item_size_ = 0;
DLOG(INFO) << "role " << role_;
if ((taps_item_type_ == "float") && (input_item_type_ == "gr_complex") && (output_item_type_ == "gr_complex"))
{
item_size_ = sizeof(gr_complex);
@ -133,23 +139,24 @@ void FirFilter::init()
const std::string default_output_item_type("gr_complex");
const std::string default_taps_item_type("float");
const std::string default_dump_filename("../data/input_filter.dat");
const int default_number_of_taps = 6;
const unsigned int default_number_of_bands = 2;
const std::string default_filter_type("bandpass");
const std::vector<double> default_bands = {0.0, 0.4, 0.6, 1.0};
const std::vector<double> default_ampl = {1.0, 1.0, 0.0, 0.0};
const std::vector<double> default_error_w = {1.0, 1.0};
const std::string default_filter_type("bandpass");
const int default_grid_density = 16;
const int default_number_of_taps = 6;
const unsigned int default_number_of_bands = 2;
DLOG(INFO) << "role " << role_;
const int number_of_taps = config_->property(role_ + ".number_of_taps", default_number_of_taps);
const unsigned int number_of_bands = config_->property(role_ + ".number_of_bands", default_number_of_bands);
const std::string filter_type = config_->property(role_ + ".filter_type", default_filter_type);
const int grid_density = config_->property(role_ + ".grid_density", default_grid_density);
input_item_type_ = config_->property(role_ + ".input_item_type", default_input_item_type);
output_item_type_ = config_->property(role_ + ".output_item_type", default_output_item_type);
taps_item_type_ = config_->property(role_ + ".taps_item_type", default_taps_item_type);
dump_ = config_->property(role_ + ".dump", false);
dump_filename_ = config_->property(role_ + ".dump_filename", default_dump_filename);
const int number_of_taps = config_->property(role_ + ".number_of_taps", default_number_of_taps);
const unsigned int number_of_bands = config_->property(role_ + ".number_of_bands", default_number_of_bands);
std::vector<double> bands;
std::vector<double> ampl;
@ -179,9 +186,6 @@ void FirFilter::init()
error_w.push_back(option_value);
}
const std::string filter_type = config_->property(role_ + ".filter_type", default_filter_type);
const int grid_density = config_->property(role_ + ".grid_density", default_grid_density);
// pm_remez implements the Parks-McClellan FIR filter design.
// It calculates the optimal (in the Chebyshev/minimax sense) FIR filter
// impulse response given a set of band edges, the desired response on

View File

@ -25,8 +25,13 @@
#include <utility>
FreqXlatingFirFilter::FreqXlatingFirFilter(const ConfigurationInterface* configuration, std::string role,
unsigned int in_streams, unsigned int out_streams) : role_(std::move(role)), in_streams_(in_streams), out_streams_(out_streams)
FreqXlatingFirFilter::FreqXlatingFirFilter(const ConfigurationInterface* configuration,
std::string role,
unsigned int in_streams,
unsigned int out_streams)
: role_(std::move(role)),
in_streams_(in_streams),
out_streams_(out_streams)
{
const std::string default_input_item_type("gr_complex");
const std::string default_output_item_type("gr_complex");
@ -43,19 +48,18 @@ FreqXlatingFirFilter::FreqXlatingFirFilter(const ConfigurationInterface* configu
const int default_grid_density = 16;
const int default_decimation_factor = 1;
DLOG(INFO) << "role " << role_;
input_item_type_ = configuration->property(role_ + ".input_item_type", default_input_item_type);
output_item_type_ = configuration->property(role_ + ".output_item_type", default_output_item_type);
taps_item_type_ = configuration->property(role_ + ".taps_item_type", default_taps_item_type);
dump_ = configuration->property(role_ + ".dump", false);
dump_filename_ = configuration->property(role_ + ".dump_filename", default_dump_filename);
intermediate_freq_ = configuration->property(role_ + ".IF", default_intermediate_freq);
sampling_freq_ = configuration->property(role_ + ".sampling_frequency", default_sampling_freq);
const int number_of_taps = configuration->property(role_ + ".number_of_taps", default_number_of_taps);
const unsigned int number_of_bands = configuration->property(role_ + ".number_of_bands", default_number_of_bands);
const std::string filter_type = configuration->property(role_ + ".filter_type", default_filter_type);
dump_filename_ = configuration->property(role_ + ".dump_filename", default_dump_filename);
input_item_type_ = configuration->property(role_ + ".input_item_type", default_input_item_type);
output_item_type_ = configuration->property(role_ + ".output_item_type", default_output_item_type);
taps_item_type_ = configuration->property(role_ + ".taps_item_type", default_taps_item_type);
intermediate_freq_ = configuration->property(role_ + ".IF", default_intermediate_freq);
sampling_freq_ = configuration->property(role_ + ".sampling_frequency", default_sampling_freq);
decimation_factor_ = configuration->property(role_ + ".decimation_factor", default_decimation_factor);
dump_ = configuration->property(role_ + ".dump", false);
if (filter_type != "lowpass")
{
@ -102,6 +106,7 @@ FreqXlatingFirFilter::FreqXlatingFirFilter(const ConfigurationInterface* configu
}
size_t item_size;
DLOG(INFO) << "role " << role_;
LOG(INFO) << "Created freq_xlating_fir_filter with " << taps_.size() << " taps";
if ((taps_item_type_ == "float") && (input_item_type_ == "gr_complex") && (output_item_type_ == "gr_complex"))
{

View File

@ -22,25 +22,33 @@
#include <glog/logging.h>
NotchFilter::NotchFilter(const ConfigurationInterface* configuration, const std::string& role,
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
NotchFilter::NotchFilter(const ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams)
: role_(role),
in_streams_(in_streams),
out_streams_(out_streams)
{
const std::string default_item_type("gr_complex");
const std::string default_dump_file("./data/input_filter.dat");
const float default_pfa = 0.001;
const float default_p_c_factor = 0.9;
const int default_length_ = 32;
const int default_n_segments_est = 12500;
const int default_n_segments_reset = 5000000;
const std::string default_item_type("gr_complex");
const std::string default_dump_file("./data/input_filter.dat");
item_type_ = configuration->property(role + ".item_type", default_item_type);
dump_ = configuration->property(role + ".dump", false);
DLOG(INFO) << "dump_ is " << dump_;
dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file);
const float pfa = configuration->property(role + ".pfa", default_pfa);
const float p_c_factor = configuration->property(role + ".p_c_factor", default_p_c_factor);
const int length_ = configuration->property(role + ".length", default_length_);
const int n_segments_est = configuration->property(role + ".segments_est", default_n_segments_est);
const int n_segments_reset = configuration->property(role + ".segments_reset", default_n_segments_reset);
dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file);
item_type_ = configuration->property(role + ".item_type", default_item_type);
dump_ = configuration->property(role + ".dump", false);
DLOG(INFO) << "role " << role_;
if (item_type_ == "gr_complex")
{
item_size_ = sizeof(gr_complex);

View File

@ -23,31 +23,39 @@
#include <algorithm> // for max
NotchFilterLite::NotchFilterLite(const ConfigurationInterface* configuration, const std::string& role,
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
NotchFilterLite::NotchFilterLite(const ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams)
: role_(role),
in_streams_(in_streams),
out_streams_(out_streams)
{
const float default_p_c_factor = 0.9;
const float default_pfa = 0.001;
const int default_length_ = 32;
const int default_n_segments_est = 12500;
const int default_n_segments_reset = 5000000;
const float default_samp_freq = 4000000;
const std::string default_item_type("gr_complex");
const std::string default_dump_file("./data/input_filter.dat");
const float default_p_c_factor = 0.9;
const float default_pfa = 0.001;
const float default_samp_freq = 4000000;
const int default_n_segments_reset = 5000000;
const int default_length_ = 32;
const int default_n_segments_est = 12500;
const float samp_freq = configuration->property("SignalSource.sampling_frequency", default_samp_freq);
const float default_coeff_rate = samp_freq * 0.1F;
item_type_ = configuration->property(role + ".item_type", default_item_type);
dump_ = configuration->property(role + ".dump", false);
DLOG(INFO) << "dump_ is " << dump_;
dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file);
const float p_c_factor = configuration->property(role + ".p_c_factor", default_p_c_factor);
const float pfa = configuration->property(role + ".pfa", default_pfa);
const float coeff_rate = configuration->property(role + ".coeff_rate", default_coeff_rate);
const int length_ = configuration->property(role + ".length", default_length_);
const int n_segments_est = configuration->property(role + ".segments_est", default_n_segments_est);
const int n_segments_reset = configuration->property(role + ".segments_reset", default_n_segments_reset);
dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file);
item_type_ = configuration->property(role + ".item_type", default_item_type);
dump_ = configuration->property(role + ".dump", false);
int n_segments_coeff = static_cast<int>((samp_freq / coeff_rate) / static_cast<float>(length_));
n_segments_coeff = std::max(1, n_segments_coeff);
DLOG(INFO) << "role " << role_;
if (item_type_ == "gr_complex")
{
item_size_ = sizeof(gr_complex);

View File

@ -26,19 +26,16 @@
#include <vector>
PulseBlankingFilter::PulseBlankingFilter(const ConfigurationInterface* configuration, std::string role,
unsigned int in_streams, unsigned int out_streams) : role_(std::move(role)), in_streams_(in_streams), out_streams_(out_streams)
PulseBlankingFilter::PulseBlankingFilter(const ConfigurationInterface* configuration,
std::string role,
unsigned int in_streams,
unsigned int out_streams)
: role_(std::move(role)),
in_streams_(in_streams),
out_streams_(out_streams)
{
size_t item_size;
xlat_ = false;
const std::string default_item_type("gr_complex");
const std::string default_dump_filename("../data/input_filter.dat");
DLOG(INFO) << "role " << role_;
item_type_ = configuration->property(role_ + ".item_type", default_item_type);
dump_ = configuration->property(role_ + ".dump", false);
dump_filename_ = configuration->property(role_ + ".dump_filename", default_dump_filename);
const float default_pfa_ = 0.04;
const float pfa = configuration->property(role_ + ".pfa", default_pfa_);
const int default_length_ = 32;
@ -47,6 +44,16 @@ PulseBlankingFilter::PulseBlankingFilter(const ConfigurationInterface* configura
const int n_segments_est = configuration->property(role_ + ".segments_est", default_n_segments_est);
const int default_n_segments_reset = 5000000;
const int n_segments_reset = configuration->property(role_ + ".segments_reset", default_n_segments_reset);
const double default_if = 0.0;
const double if_aux = configuration->property(role_ + ".if", default_if);
const double if_ = configuration->property(role_ + ".IF", if_aux);
dump_filename_ = configuration->property(role_ + ".dump_filename", default_dump_filename);
item_type_ = configuration->property(role_ + ".item_type", default_item_type);
dump_ = configuration->property(role_ + ".dump", false);
DLOG(INFO) << "role " << role_;
size_t item_size;
if (item_type_ == "gr_complex")
{
item_size = sizeof(gr_complex); // output
@ -59,9 +66,6 @@ PulseBlankingFilter::PulseBlankingFilter(const ConfigurationInterface* configura
item_size = sizeof(gr_complex); // avoids uninitialization
input_size_ = 0; // notify wrong configuration
}
const double default_if = 0.0;
const double if_aux = configuration->property(role_ + ".if", default_if);
const double if_ = configuration->property(role_ + ".IF", if_aux);
if (std::abs(if_) > 1.0)
{
xlat_ = true;
@ -74,6 +78,10 @@ PulseBlankingFilter::PulseBlankingFilter(const ConfigurationInterface* configura
const std::vector<float> taps = gr::filter::firdes::low_pass(1.0, sampling_freq_, bw_, tw_);
freq_xlating_ = gr::filter::freq_xlating_fir_filter_ccf::make(1, taps, if_, sampling_freq_);
}
else
{
xlat_ = false;
}
if (dump_)
{
DLOG(INFO) << "Dumping output into file " << dump_filename_;

View File

@ -34,28 +34,29 @@ Notch::Notch(float pfa,
float p_c_factor,
int32_t length,
int32_t n_segments_est,
int32_t n_segments_reset) : gr::block("Notch",
gr::io_signature::make(1, 1, sizeof(gr_complex)),
gr::io_signature::make(1, 1, sizeof(gr_complex)))
int32_t n_segments_reset)
: gr::block("Notch",
gr::io_signature::make(1, 1, sizeof(gr_complex)),
gr::io_signature::make(1, 1, sizeof(gr_complex))),
last_out_(gr_complex(0.0, 0.0)),
z_0_(gr_complex(0.0, 0.0)),
p_c_factor_(gr_complex(p_c_factor, 0.0)),
pfa_(pfa),
noise_pow_est_(0.0),
length_(length), // Set the number of samples per segment
n_deg_fred_(2 * length), // Number of dregrees of freedom,
n_segments_(0),
n_segments_est_(n_segments_est), // Set the number of segments for noise power estimation
n_segments_reset_(n_segments_reset), // Set the period (in segments) when the noise power is estimated
filter_state_(false)
{
const int32_t alignment_multiple = volk_get_alignment() / sizeof(gr_complex);
set_alignment(std::max(1, alignment_multiple));
pfa_ = pfa;
noise_pow_est_ = 0.0;
p_c_factor_ = gr_complex(p_c_factor, 0.0);
length_ = length; // Set the number of samples per segment
filter_state_ = false; // Initial state of the filter
n_deg_fred_ = 2 * length_; // Number of dregrees of freedom
n_segments_ = 0;
n_segments_est_ = n_segments_est; // Set the number of segments for noise power estimation
n_segments_reset_ = n_segments_reset; // Set the period (in segments) when the noise power is estimated
z_0_ = gr_complex(0.0, 0.0);
boost::math::chi_squared_distribution<float> my_dist_(n_deg_fred_);
thres_ = boost::math::quantile(boost::math::complement(my_dist_, pfa_));
c_samples_ = volk_gnsssdr::vector<gr_complex>(length_);
angle_ = volk_gnsssdr::vector<float>(length_);
power_spect_ = volk_gnsssdr::vector<float>(length_);
last_out_ = gr_complex(0.0, 0.0);
d_fft_ = gnss_fft_fwd_make_unique(length_);
}

View File

@ -35,32 +35,35 @@ NotchLite::NotchLite(float p_c_factor,
int32_t length,
int32_t n_segments_est,
int32_t n_segments_reset,
int32_t n_segments_coeff) : gr::block("NotchLite",
gr::io_signature::make(1, 1, sizeof(gr_complex)),
gr::io_signature::make(1, 1, sizeof(gr_complex)))
int32_t n_segments_coeff)
: gr::block("NotchLite",
gr::io_signature::make(1, 1, sizeof(gr_complex)),
gr::io_signature::make(1, 1, sizeof(gr_complex))),
last_out_(gr_complex(0.0, 0.0)),
z_0_(gr_complex(0.0, 0.0)),
p_c_factor_(gr_complex(p_c_factor, 0.0)),
c_samples1_(gr_complex(0.0, 0.0)),
c_samples2_(gr_complex(0.0, 0.0)),
pfa_(pfa),
noise_pow_est_(0.0),
angle1_(0.0),
angle2_(0.0),
length_(length),
n_segments_(0),
n_segments_est_(n_segments_est),
n_segments_reset_(n_segments_reset),
n_segments_coeff_reset_(n_segments_coeff),
n_segments_coeff_(0),
n_deg_fred_(2 * length),
filter_state_(false)
{
const int32_t alignment_multiple = volk_get_alignment() / sizeof(gr_complex);
set_alignment(std::max(1, alignment_multiple));
set_history(2);
p_c_factor_ = gr_complex(p_c_factor, 0.0);
n_segments_est_ = n_segments_est;
n_segments_reset_ = n_segments_reset;
n_segments_coeff_reset_ = n_segments_coeff;
n_segments_coeff_ = 0;
length_ = length;
pfa_ = pfa;
n_segments_ = 0;
n_deg_fred_ = 2 * length_;
noise_pow_est_ = 0.0;
filter_state_ = false;
z_0_ = gr_complex(0.0, 0.0);
last_out_ = gr_complex(0.0, 0.0);
boost::math::chi_squared_distribution<float> my_dist_(n_deg_fred_);
thres_ = boost::math::quantile(boost::math::complement(my_dist_, pfa_));
c_samples1_ = gr_complex(0.0, 0.0);
c_samples2_ = gr_complex(0.0, 0.0);
angle1_ = 0.0;
angle2_ = 0.0;
power_spect_ = volk_gnsssdr::vector<float>(length_);
d_fft_ = gnss_fft_fwd_make_unique(length_);
}

View File

@ -33,20 +33,21 @@ pulse_blanking_cc_sptr make_pulse_blanking_cc(float pfa, int32_t length,
pulse_blanking_cc::pulse_blanking_cc(float pfa,
int32_t length,
int32_t n_segments_est,
int32_t n_segments_reset) : gr::block("pulse_blanking_cc",
gr::io_signature::make(1, 1, sizeof(gr_complex)),
gr::io_signature::make(1, 1, sizeof(gr_complex)))
int32_t n_segments_reset)
: gr::block("pulse_blanking_cc",
gr::io_signature::make(1, 1, sizeof(gr_complex)),
gr::io_signature::make(1, 1, sizeof(gr_complex))),
noise_power_estimation_(0.0),
pfa_(pfa),
length_(length),
n_segments_(0),
n_segments_est_(n_segments_est),
n_segments_reset_(n_segments_reset),
n_deg_fred_(2 * length),
last_filtered_(false)
{
const int32_t alignment_multiple = volk_get_alignment() / sizeof(gr_complex);
set_alignment(std::max(1, alignment_multiple));
pfa_ = pfa;
length_ = length;
last_filtered_ = false;
n_segments_ = 0;
n_segments_est_ = n_segments_est;
n_segments_reset_ = n_segments_reset;
noise_power_estimation_ = 0.0;
n_deg_fred_ = 2 * length_;
boost::math::chi_squared_distribution<float> my_dist_(n_deg_fred_);
thres_ = boost::math::quantile(boost::math::complement(my_dist_, pfa_));
zeros_ = volk_gnsssdr::vector<gr_complex>(length_);

View File

@ -270,7 +270,7 @@ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)")
endif()
if(CMAKE_VERSION VERSION_GREATER 3.0 AND SUPPORTED_CPU_FEATURES_ARCH)
set(BUILD_PIC ON CACHE BOOL
set(CMAKE_POSITION_INDEPENDENT_CODE ON CACHE BOOL
"Build cpu_features with Position Independent Code (PIC)."
FORCE
)

View File

@ -8,11 +8,28 @@
.SH SYNOPSIS
\fBvolk_gnsssdr_profile\fR [OPTION]
.SH DESCRIPTION
The Vector-Optimized Library of Kernels of GNSS-SDR (VOLK_GNSSSDR) is a software library that provides developers with an interface to use Single Input - Multiple Data (SIMD) instructions, which are of special interest for operations that are in the receiver's critical path of the processing load.
The Vector-Optimized Library of Kernels of GNSS-SDR (VOLK_GNSSSDR) is a software
library that provides developers with an interface to use Single Input -
Multiple Data (SIMD) instructions, which are of special interest for operations
that are in the receiver's critical path of the processing load.
.TP
Processors providing SIMD instruction sets compute with multiple processing elements that perform the same operation on multiple data points simultaneously, thus exploiting data-level parallelism, an can be found in most modern desktop and laptop personal computers. In a nutshell, VOLK_GNSSSDR implements in assembly language optimized versions of computationally-intensive operations for different processor architectures that are commonly found in modern computers. In order to use the most optimized version for the specific processor(s) of the host machine running the software receiver (that is, the implementation than runs the fastest).
Processors providing SIMD instruction sets compute with multiple processing
elements that perform the same operation on multiple data points simultaneously,
thus exploiting data-level parallelism, an can be found in most modern desktop
and laptop personal computers. In a nutshell, VOLK_GNSSSDR implements in
assembly language optimized versions of computationally-intensive operations for
different processor architectures that are commonly found in modern computers.
In order to use the most optimized version for the specific processor(s) of the
host machine running the software receiver (that is, the implementation than
runs the fastest).
.TP
\fBvolk_gnsssdr_profile\fR is a program that tests all known VOLK_GNSSSDR kernels (that is, basic processing components like adders, multipliers, correlators, and much more) for each architecture supported by the host machine, measuring their performance. When finished, the profiler writes to $HOME/.volk_gnsssdr/volk_gnsssdr_config the best architecture for each VOLK_GSSSDR function. This file is read when using a function to know the best version to execute.
\fBvolk_gnsssdr_profile\fR is a program that tests all known VOLK_GNSSSDR
kernels (that is, basic processing components like adders, multipliers,
correlators, and much more) for each architecture supported by the host machine,
measuring their performance. When finished, the profiler writes to
$HOME/.volk_gnsssdr/volk_gnsssdr_config the best architecture for each
VOLK_GSSSDR function. This file is read when using a function to know the best
version to execute.
.SH OPTIONS
\fBvolk_gnsssdr_profile\fR takes the following options:
.TP
@ -38,7 +55,10 @@ Processors providing SIMD instruction sets compute with multiple processing elem
\.TP
Check https://gnss\-sdr.org for more information.
.SH HISTORY
This library was originally developed by Andres Cecilia Luque in the framework of the Summer of Code in Space program (SOCIS 2014) by the European Space Agency (ESA), and then integrated into \fBgnss-sdr\fR. This software is based on the VOLK library https://www.libvolk.org/
This library was originally developed by Andres Cecilia Luque in the framework
of the Summer of Code in Space program (SOCIS 2014) by the European Space Agency
(ESA), and then integrated into \fBgnss-sdr\fR. This software is based on the
VOLK library https://www.libvolk.org/
.SH BUGS
No known bugs.
.SH AUTHOR

View File

@ -32,13 +32,11 @@ option(BUILD_TESTING "Enable test (depends on googletest)." OFF)
# As a consequence it is discouraged to use cpu_features as a shared library because different compilers may interpret the code in different ways.
# Prefer static linking from source whenever possible.
option(BUILD_SHARED_LIBS "Build library as shared." OFF)
# PIC
option(BUILD_PIC "Build with Position Independant Code." OFF) # Default is off at least for GCC
# Force PIC on unix when building shared libs
# see: https://en.wikipedia.org/wiki/Position-independent_code
if(BUILD_SHARED_LIBS AND UNIX)
set(BUILD_PIC ON)
option(CMAKE_POSITION_INDEPENDENT_CODE "Build with Position Independant Code." ON)
endif()
include(CheckIncludeFile)
@ -110,7 +108,6 @@ add_library(utils OBJECT
${PROJECT_SOURCE_DIR}/src/stack_line_reader.c
${PROJECT_SOURCE_DIR}/src/string_view.c
)
set_property(TARGET utils PROPERTY POSITION_INDEPENDENT_CODE ${BUILD_PIC})
setup_include_and_definitions(utils)
#
@ -131,7 +128,6 @@ if(UNIX)
if(HAVE_STRONG_GETAUXVAL)
target_compile_definitions(unix_based_hardware_detection PRIVATE HAVE_STRONG_GETAUXVAL)
endif()
set_property(TARGET unix_based_hardware_detection PROPERTY POSITION_INDEPENDENT_CODE ${BUILD_PIC})
endif()
#
@ -148,7 +144,6 @@ add_library(cpu_features ${CPU_FEATURES_HDRS} ${CPU_FEATURES_SRCS})
set_target_properties(cpu_features PROPERTIES PUBLIC_HEADER "${CPU_FEATURES_HDRS}")
setup_include_and_definitions(cpu_features)
target_link_libraries(cpu_features PUBLIC ${CMAKE_DL_LIBS})
set_property(TARGET cpu_features PROPERTY POSITION_INDEPENDENT_CODE ${BUILD_PIC})
target_include_directories(cpu_features
PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/cpu_features>
)
@ -237,6 +232,7 @@ install(TARGETS cpu_features list_cpu_features
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR}
)
install(EXPORT CpuFeaturesTargets
NAMESPACE CpuFeatures::

View File

@ -22,6 +22,7 @@ instructions) at runtime.
- [Android NDK's drop in replacement](#ndk)
- [License](#license)
- [Build with cmake](#cmake)
- [Community Bindings](#bindings)
<a name="rationale"></a>
@ -186,8 +187,8 @@ flags : aes,avx,cx16,smx,sse4_1,sse4_2,ssse3
[cpu_features](https://github.com/google/cpu_features) is now officially
supporting Android and offers a drop in replacement of for the NDK's
[cpu-features.h](https://android.googlesource.com/platform/ndk/+/master/sources/android/cpufeatures/cpu-features.h)
, see [ndk_compat](ndk_compat) folder for details.
[cpu-features.h](https://android.googlesource.com/platform/ndk/+/master/sources/android/cpufeatures/cpu-features.h),
see [ndk_compat](ndk_compat) folder for details.
<a name="license"></a>
@ -204,20 +205,40 @@ Please check the [CMake build instructions](cmake/README.md).
<a name="quickstart"></a>
### Quickstart with `Ninja`
### Quickstart
- build `list_cpu_features`
- Run `list_cpu_features`
```sh
cmake -S. -Bbuild -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=Release
cmake --build build --config Release -j
./build/list_cpu_features --json
```
cmake -B/tmp/cpu_features -H. -GNinja -DCMAKE_BUILD_TYPE=Release
ninja -C/tmp/cpu_features
/tmp/cpu_features/list_cpu_features --json
```
_Note_: Use `--target ALL_BUILD` on the second line for `Visual Studio` and
`XCode`.
- run tests
```sh
cmake -S. -Bbuild -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Debug
cmake --build build --config Debug -j
cmake --build build --config Debug --target test
```
cmake -B/tmp/cpu_features -H. -GNinja -DBUILD_TESTING=ON
ninja -C/tmp/cpu_features
ninja -C/tmp/cpu_features test
```
_Note_: Use `--target RUN_TESTS` on the last line for `Visual Studio` and
`--target RUN_TEST` for `XCode`.
<a name="bindings"></a>
## Community bindings
Links provided here are not affiliated with Google but are kindly provided by
the OSS Community.
- .Net
- https://github.com/toor1245/cpu_features.NET
- Python
- https://github.com/Narasimha1997/py_cpu
_Send PR to showcase your wrapper here_

View File

@ -10,6 +10,11 @@
CPU_FEATURES_START_CPP_NAMESPACE
// CPUID Vendors
#define CPU_FEATURES_VENDOR_GENUINE_INTEL "GenuineIntel"
#define CPU_FEATURES_VENDOR_AUTHENTIC_AMD "AuthenticAMD"
#define CPU_FEATURES_VENDOR_HYGON_GENUINE "HygonGenuine"
// See https://en.wikipedia.org/wiki/CPUID for a list of x86 cpu features.
// The field names are based on the short name provided in the wikipedia tables.
typedef struct

View File

@ -87,7 +87,8 @@ void CpuFeatures_StringView_CopyString(const StringView src, char* dst,
// Checks if line contains the specified whitespace separated word.
bool CpuFeatures_StringView_HasWord(const StringView line,
const char* const word);
const char* const word,
const char separator);
// Get key/value from line. key and value are separated by ": ".
// key and value are cleaned up from leading and trailing whitespaces.

View File

@ -56,7 +56,7 @@ install(
#
# program : NDK compat test program
#
if(ENABLE_TESTING)
if(BUILD_TESTING)
add_executable(ndk-compat-test ndk-compat-test.c)
target_link_libraries(ndk-compat-test PRIVATE ndk_compat)
endif()

View File

@ -107,8 +107,8 @@ static bool HandleAarch64Line(const LineResult result,
{
for (size_t i = 0; i < AARCH64_LAST_; ++i)
{
kSetters[i](&info->features,
CpuFeatures_StringView_HasWord(value, kCpuInfoFlags[i]));
kSetters[i](&info->features, CpuFeatures_StringView_HasWord(
value, kCpuInfoFlags[i], ' '));
}
}
else if (CpuFeatures_StringView_IsEquals(key, str("CPU implementer")))

View File

@ -71,8 +71,8 @@ static bool HandleArmLine(const LineResult result, ArmInfo* const info,
{
for (size_t i = 0; i < ARM_LAST_; ++i)
{
kSetters[i](&info->features,
CpuFeatures_StringView_HasWord(value, kCpuInfoFlags[i]));
kSetters[i](&info->features, CpuFeatures_StringView_HasWord(
value, kCpuInfoFlags[i], ' '));
}
}
else if (CpuFeatures_StringView_IsEquals(key, str("CPU implementer")))

View File

@ -28,8 +28,8 @@ static bool HandleMipsLine(const LineResult result,
{
for (size_t i = 0; i < MIPS_LAST_; ++i)
{
kSetters[i](features,
CpuFeatures_StringView_HasWord(value, kCpuInfoFlags[i]));
kSetters[i](features, CpuFeatures_StringView_HasWord(
value, kCpuInfoFlags[i], ' '));
}
}
}

View File

@ -71,7 +71,7 @@ static bool HandlePPCLine(const LineResult result,
StringView key, value;
if (CpuFeatures_StringView_GetAttributeKeyValue(line, &key, &value))
{
if (CpuFeatures_StringView_HasWord(key, "platform"))
if (CpuFeatures_StringView_HasWord(key, "platform", ' '))
{
CpuFeatures_StringView_CopyString(value, strings->platform,
sizeof(strings->platform));

View File

@ -88,7 +88,6 @@
defined(CPU_FEATURES_OS_FREEBSD)
#include "internal/filesystem.h" // Needed to parse /proc/cpuinfo
#include "internal/stack_line_reader.h" // Needed to parse /proc/cpuinfo
#include "internal/string_view.h" // Needed to parse /proc/cpuinfo
#elif defined(CPU_FEATURES_OS_DARWIN)
#if !defined(HAVE_SYSCTLBYNAME)
#error "Darwin needs support for sysctlbyname"
@ -98,6 +97,8 @@
#error "Unsupported OS"
#endif // CPU_FEATURES_OS
#include "internal/string_view.h"
////////////////////////////////////////////////////////////////////////////////
// Definitions for CpuId and GetXCR0Eax.
////////////////////////////////////////////////////////////////////////////////
@ -267,6 +268,11 @@ static int IsVendor(const Leaf leaf, const char* const name)
return leaf.ebx == ebx && leaf.ecx == ecx && leaf.edx == edx;
}
static int IsVendorByX86Info(const X86Info* info, const char* const name)
{
return memcmp(info->vendor, name, sizeof(info->vendor)) == 0;
}
static const CacheLevelInfo kEmptyCacheLevelInfo;
static CacheLevelInfo GetCacheLevelInfo(const uint32_t reg)
@ -1129,63 +1135,77 @@ static CacheLevelInfo GetCacheLevelInfo(const uint32_t reg)
}
}
static void GetByteArrayFromRegister(uint32_t result[4], const uint32_t reg)
{
for (int i = 0; i < 4; ++i)
{
result[i] = ExtractBitRange(reg, (i + 1) * 8, i * 8);
}
}
// From https://www.felixcloutier.com/x86/cpuid#tbl-3-12
static void ParseLeaf2(const int max_cpuid_leaf, CacheInfo* info)
{
Leaf leaf = SafeCpuId(max_cpuid_leaf, 2);
uint32_t registers[] = {leaf.eax, leaf.ebx, leaf.ecx, leaf.edx};
for (int i = 0; i < 4; ++i)
// The least-significant byte in register EAX (register AL) will always return
// 01H. Software should ignore this value and not interpret it as an
// informational descriptor.
leaf.eax &= 0xFFFFFF00; // Zeroing out AL. 0 is the empty descriptor.
// The most significant bit (bit 31) of each register indicates whether the
// register contains valid information (set to 0) or is reserved (set to 1).
if (IsBitSet(leaf.eax, 31)) leaf.eax = 0;
if (IsBitSet(leaf.ebx, 31)) leaf.ebx = 0;
if (IsBitSet(leaf.ecx, 31)) leaf.ecx = 0;
if (IsBitSet(leaf.edx, 31)) leaf.edx = 0;
uint8_t data[16];
#if __STDC_VERSION__ >= 201112L
_Static_assert(sizeof(Leaf) == sizeof(data), "Leaf must be 16 bytes");
#endif
memcpy(&data, &leaf, sizeof(data));
for (size_t i = 0; i < sizeof(data); ++i)
{
if (registers[i] & (1U << 31))
{
continue; // register does not contains valid information
}
uint32_t bytes[4];
GetByteArrayFromRegister(bytes, registers[i]);
for (int j = 0; j < 4; ++j)
{
if (bytes[j] == 0xFF)
break; // leaf 4 should be used to fetch cache information
info->levels[info->size] = GetCacheLevelInfo(bytes[j]);
}
const uint8_t descriptor = data[i];
if (descriptor == 0) continue;
info->levels[info->size] = GetCacheLevelInfo(descriptor);
info->size++;
}
}
static void ParseLeaf4(const int max_cpuid_leaf, CacheInfo* info)
static const CacheInfo kEmptyCacheInfo;
// For newer Intel CPUs uses "CPUID, eax=0x00000004".
// https://www.felixcloutier.com/x86/cpuid#input-eax-=-04h--returns-deterministic-cache-parameters-for-each-level
// For newer AMD CPUs uses "CPUID, eax=0x8000001D"
static void ParseCacheInfo(const int max_cpuid_leaf, uint32_t leaf_id,
CacheInfo* old_info)
{
info->size = 0;
for (int cache_id = 0; cache_id < CPU_FEATURES_MAX_CACHE_LEVEL; cache_id++)
CacheInfo info = kEmptyCacheInfo;
for (int index = 0; info.size < CPU_FEATURES_MAX_CACHE_LEVEL; ++index)
{
const Leaf leaf = SafeCpuIdEx(max_cpuid_leaf, 4, cache_id);
CacheType cache_type = ExtractBitRange(leaf.eax, 4, 0);
if (cache_type == CPU_FEATURE_CACHE_NULL)
{
info->levels[cache_id] = kEmptyCacheLevelInfo;
continue;
}
const Leaf leaf = SafeCpuIdEx(max_cpuid_leaf, leaf_id, index);
int cache_type_field = ExtractBitRange(leaf.eax, 4, 0);
CacheType cache_type;
if (cache_type_field == 0)
break;
else if (cache_type_field == 1)
cache_type = CPU_FEATURE_CACHE_DATA;
else if (cache_type_field == 2)
cache_type = CPU_FEATURE_CACHE_INSTRUCTION;
else if (cache_type_field == 3)
cache_type = CPU_FEATURE_CACHE_UNIFIED;
else
break; // Should not occur as per documentation.
int level = ExtractBitRange(leaf.eax, 7, 5);
int line_size = ExtractBitRange(leaf.ebx, 11, 0) + 1;
int partitioning = ExtractBitRange(leaf.ebx, 21, 12) + 1;
int ways = ExtractBitRange(leaf.ebx, 31, 22) + 1;
int tlb_entries = leaf.ecx + 1;
int cache_size = (ways * partitioning * line_size * (tlb_entries));
info->levels[cache_id] = (CacheLevelInfo){.level = level,
int cache_size = ways * partitioning * line_size * tlb_entries;
info.levels[info.size] = (CacheLevelInfo){.level = level,
.cache_type = cache_type,
.cache_size = cache_size,
.ways = ways,
.line_size = line_size,
.tlb_entries = tlb_entries,
.partitioning = partitioning};
info->size++;
++info.size;
}
// Override CacheInfo if we successfully extracted Deterministic Cache
// Parameters.
if (info.size > 0) *old_info = info;
}
#if defined(CPU_FEATURES_OS_DARWIN)
@ -1371,41 +1391,33 @@ static void ParseCpuId(const uint32_t max_cpuid_leaf, X86Info* info,
{
StackLineReader reader;
StackLineReader_Initialize(&reader, fd);
for (;;)
for (bool stop = false; !stop;)
{
const LineResult result = StackLineReader_NextLine(&reader);
if (result.eof) stop = true;
const StringView line = result.line;
const bool is_feature =
CpuFeatures_StringView_StartsWith(line, str(" Features="));
const bool is_feature2 =
CpuFeatures_StringView_StartsWith(line, str(" Features2="));
if (is_feature || is_feature2)
{
// Lines of interests are of the following form:
// " Features=0x1783fbff<PSE36,MMX,FXSR,SSE,SSE2,HTT>"
// We replace '<', '>' and ',' with space so we can search by
// whitespace separated word.
// TODO: Fix CpuFeatures_StringView_HasWord to allow for different
// separators.
for (size_t i = 0; i < line.size; ++i)
{
char* c = (char*)(&(line.ptr[i]));
if (*c == '<' || *c == '>' || *c == ',') *c = ' ';
}
if (is_feature)
{
features->sse = CpuFeatures_StringView_HasWord(line, "SSE");
features->sse2 = CpuFeatures_StringView_HasWord(line, "SSE2");
}
if (is_feature2)
{
features->sse3 = CpuFeatures_StringView_HasWord(line, "SSE3");
features->ssse3 = CpuFeatures_StringView_HasWord(line, "SSSE3");
features->sse4_1 = CpuFeatures_StringView_HasWord(line, "SSE4.1");
features->sse4_2 = CpuFeatures_StringView_HasWord(line, "SSE4.2");
}
}
if (result.eof) break;
if (!CpuFeatures_StringView_StartsWith(line, str(" Features")))
continue;
// Lines of interests are of the following form:
// " Features=0x1783fbff<PSE36,MMX,FXSR,SSE,SSE2,HTT>"
// We first extract the comma separated values between angle brackets.
StringView csv = result.line;
int index = CpuFeatures_StringView_IndexOfChar(csv, '<');
if (index >= 0) csv = CpuFeatures_StringView_PopFront(csv, index + 1);
if (csv.size > 0 && CpuFeatures_StringView_Back(csv) == '>')
csv = CpuFeatures_StringView_PopBack(csv, 1);
if (CpuFeatures_StringView_HasWord(csv, "SSE", ','))
features->sse = true;
if (CpuFeatures_StringView_HasWord(csv, "SSE2", ','))
features->sse2 = true;
if (CpuFeatures_StringView_HasWord(csv, "SSE3", ','))
features->sse3 = true;
if (CpuFeatures_StringView_HasWord(csv, "SSSE3", ','))
features->ssse3 = true;
if (CpuFeatures_StringView_HasWord(csv, "SSE4.1", ','))
features->sse4_1 = true;
if (CpuFeatures_StringView_HasWord(csv, "SSE4.2", ','))
features->sse4_2 = true;
}
CpuFeatures_CloseFile(fd);
}
@ -1416,25 +1428,22 @@ static void ParseCpuId(const uint32_t max_cpuid_leaf, X86Info* info,
{
StackLineReader reader;
StackLineReader_Initialize(&reader, fd);
for (;;)
for (bool stop = false; !stop;)
{
const LineResult result = StackLineReader_NextLine(&reader);
if (result.eof) stop = true;
const StringView line = result.line;
StringView key, value;
if (CpuFeatures_StringView_GetAttributeKeyValue(line, &key, &value))
{
if (CpuFeatures_StringView_IsEquals(key, str("flags")))
{
features->sse = CpuFeatures_StringView_HasWord(value, "sse");
features->sse2 = CpuFeatures_StringView_HasWord(value, "sse2");
features->sse3 = CpuFeatures_StringView_HasWord(value, "sse3");
features->ssse3 = CpuFeatures_StringView_HasWord(value, "ssse3");
features->sse4_1 = CpuFeatures_StringView_HasWord(value, "sse4_1");
features->sse4_2 = CpuFeatures_StringView_HasWord(value, "sse4_2");
break;
}
}
if (result.eof) break;
if (!CpuFeatures_StringView_GetAttributeKeyValue(line, &key, &value))
continue;
if (!CpuFeatures_StringView_IsEquals(key, str("flags"))) continue;
features->sse = CpuFeatures_StringView_HasWord(value, "sse", ' ');
features->sse2 = CpuFeatures_StringView_HasWord(value, "sse2", ' ');
features->sse3 = CpuFeatures_StringView_HasWord(value, "sse3", ' ');
features->ssse3 = CpuFeatures_StringView_HasWord(value, "ssse3", ' ');
features->sse4_1 = CpuFeatures_StringView_HasWord(value, "sse4_1", ' ');
features->sse4_2 = CpuFeatures_StringView_HasWord(value, "sse4_2", ' ');
break;
}
CpuFeatures_CloseFile(fd);
}
@ -1450,11 +1459,15 @@ static void ParseCpuId(const uint32_t max_cpuid_leaf, X86Info* info,
// Reference
// https://en.wikipedia.org/wiki/CPUID#EAX=80000000h:_Get_Highest_Extended_Function_Implemented.
static Leaf GetLeafByIdAMD(uint32_t leaf_id)
{
uint32_t max_extended = CpuId(0x80000000).eax;
return SafeCpuId(max_extended, leaf_id);
}
static void ParseExtraAMDCpuId(X86Info* info, OsPreserves os_preserves)
{
const Leaf leaf_80000000 = CpuId(0x80000000);
const uint32_t max_extended_cpuid_leaf = leaf_80000000.eax;
const Leaf leaf_80000001 = SafeCpuId(max_extended_cpuid_leaf, 0x80000001);
const Leaf leaf_80000001 = GetLeafByIdAMD(0x80000001);
X86Features* const features = &info->features;
@ -1470,16 +1483,15 @@ static void ParseExtraAMDCpuId(X86Info* info, OsPreserves os_preserves)
}
static const X86Info kEmptyX86Info;
static const CacheInfo kEmptyCacheInfo;
static const OsPreserves kEmptyOsPreserves;
X86Info GetX86Info(void)
{
X86Info info = kEmptyX86Info;
const Leaf leaf_0 = CpuId(0);
const bool is_intel = IsVendor(leaf_0, "GenuineIntel");
const bool is_amd = IsVendor(leaf_0, "AuthenticAMD");
const bool is_hygon = IsVendor(leaf_0, "HygonGenuine");
const bool is_intel = IsVendor(leaf_0, CPU_FEATURES_VENDOR_GENUINE_INTEL);
const bool is_amd = IsVendor(leaf_0, CPU_FEATURES_VENDOR_AUTHENTIC_AMD);
const bool is_hygon = IsVendor(leaf_0, CPU_FEATURES_VENDOR_HYGON_GENUINE);
SetVendor(leaf_0, info.vendor);
if (is_intel || is_amd || is_hygon)
{
@ -1498,11 +1510,24 @@ CacheInfo GetX86CacheInfo(void)
{
CacheInfo info = kEmptyCacheInfo;
const Leaf leaf_0 = CpuId(0);
const uint32_t max_cpuid_leaf = leaf_0.eax;
if (IsVendor(leaf_0, "GenuineIntel"))
if (IsVendor(leaf_0, CPU_FEATURES_VENDOR_GENUINE_INTEL))
{
ParseLeaf2(max_cpuid_leaf, &info);
ParseLeaf4(max_cpuid_leaf, &info);
ParseLeaf2(leaf_0.eax, &info);
ParseCacheInfo(leaf_0.eax, 4, &info);
}
else if (IsVendor(leaf_0, CPU_FEATURES_VENDOR_AUTHENTIC_AMD) ||
IsVendor(leaf_0, CPU_FEATURES_VENDOR_HYGON_GENUINE))
{
const uint32_t max_ext = CpuId(0x80000000).eax;
const uint32_t cpuid_ext = SafeCpuId(max_ext, 0x80000001).ecx;
// If CPUID Fn8000_0001_ECX[TopologyExtensions]==0
// then CPUID Fn8000_0001_E[D,C,B,A]X is reserved.
// https://www.amd.com/system/files/TechDocs/25481.pdf
if (IsBitSet(cpuid_ext, 22))
{
ParseCacheInfo(max_ext, 0x8000001D, &info);
}
}
return info;
}
@ -1511,7 +1536,7 @@ CacheInfo GetX86CacheInfo(void)
X86Microarchitecture GetX86Microarchitecture(const X86Info* info)
{
if (memcmp(info->vendor, "GenuineIntel", sizeof(info->vendor)) == 0)
if (IsVendorByX86Info(info, CPU_FEATURES_VENDOR_GENUINE_INTEL))
{
switch (CPUID(info->family, info->model))
{
@ -1616,7 +1641,7 @@ X86Microarchitecture GetX86Microarchitecture(const X86Info* info)
return X86_UNKNOWN;
}
}
if (memcmp(info->vendor, "AuthenticAMD", sizeof(info->vendor)) == 0)
if (IsVendorByX86Info(info, CPU_FEATURES_VENDOR_AUTHENTIC_AMD))
{
switch (CPUID(info->family, info->model))
{
@ -1726,7 +1751,7 @@ X86Microarchitecture GetX86Microarchitecture(const X86Info* info)
return X86_UNKNOWN;
}
}
if (memcmp(info->vendor, "HygonGenuine", sizeof(info->vendor)) == 0)
if (IsVendorByX86Info(info, CPU_FEATURES_VENDOR_HYGON_GENUINE))
{
switch (CPUID(info->family, info->model))
{
@ -1737,23 +1762,20 @@ X86Microarchitecture GetX86Microarchitecture(const X86Info* info)
return X86_UNKNOWN;
}
static void SetString(const uint32_t max_cpuid_ext_leaf, const uint32_t leaf_id,
char* buffer)
{
const Leaf leaf = SafeCpuId(max_cpuid_ext_leaf, leaf_id);
// We allow calling memcpy from SetString which is only called when requesting
// X86BrandString.
memcpy(buffer, &leaf, sizeof(Leaf));
}
void FillX86BrandString(char brand_string[49])
{
const Leaf leaf_ext_0 = CpuId(0x80000000);
const uint32_t max_cpuid_leaf_ext = leaf_ext_0.eax;
SetString(max_cpuid_leaf_ext, 0x80000002, brand_string);
SetString(max_cpuid_leaf_ext, 0x80000003, brand_string + 16);
SetString(max_cpuid_leaf_ext, 0x80000004, brand_string + 32);
brand_string[48] = '\0';
const Leaf leaves[3] = {
SafeCpuId(max_cpuid_leaf_ext, 0x80000002),
SafeCpuId(max_cpuid_leaf_ext, 0x80000003),
SafeCpuId(max_cpuid_leaf_ext, 0x80000004),
};
#if __STDC_VERSION__ >= 201112L
_Static_assert(sizeof(leaves) == 48, "Leaves must be packed");
#endif
CpuFeatures_StringView_CopyString(view((const char*)leaves, sizeof(leaves)),
brand_string, 49);
}
////////////////////////////////////////////////////////////////////////////////

View File

@ -158,7 +158,8 @@ void CpuFeatures_StringView_CopyString(const StringView src, char* dst,
}
bool CpuFeatures_StringView_HasWord(const StringView line,
const char* const word_str)
const char* const word_str,
const char separator)
{
const StringView word = str(word_str);
StringView remainder = line;
@ -176,9 +177,9 @@ bool CpuFeatures_StringView_HasWord(const StringView line,
const StringView after =
CpuFeatures_StringView_PopFront(line, index_of_word + word.size);
const bool valid_before =
before.size == 0 || CpuFeatures_StringView_Back(before) == ' ';
before.size == 0 || CpuFeatures_StringView_Back(before) == separator;
const bool valid_after =
after.size == 0 || CpuFeatures_StringView_Front(after) == ' ';
after.size == 0 || CpuFeatures_StringView_Front(after) == separator;
if (valid_before && valid_after) return true;
remainder =
CpuFeatures_StringView_PopFront(remainder, index_of_word + word.size);

View File

@ -76,26 +76,32 @@ private:
uint32_t xcr0_eax_;
};
FakeCpu* g_fake_cpu = nullptr;
static FakeCpu* g_fake_cpu_instance = nullptr;
static FakeCpu& cpu()
{
assert(g_fake_cpu_instance != nullptr);
return *g_fake_cpu_instance;
}
extern "C" Leaf GetCpuidLeaf(uint32_t leaf_id, int ecx)
{
return g_fake_cpu->GetCpuidLeaf(leaf_id, ecx);
return cpu().GetCpuidLeaf(leaf_id, ecx);
}
extern "C" uint32_t GetXCR0Eax(void) { return g_fake_cpu->GetXCR0Eax(); }
extern "C" uint32_t GetXCR0Eax(void) { return cpu().GetXCR0Eax(); }
#if defined(CPU_FEATURES_OS_DARWIN)
extern "C" bool GetDarwinSysCtlByName(const char* name)
{
return g_fake_cpu->GetDarwinSysCtlByName(name);
return cpu().GetDarwinSysCtlByName(name);
}
#endif // CPU_FEATURES_OS_DARWIN
#if defined(CPU_FEATURES_OS_WINDOWS)
extern "C" bool GetWindowsIsProcessorFeaturePresent(DWORD ProcessorFeature)
{
return g_fake_cpu->GetWindowsIsProcessorFeaturePresent(ProcessorFeature);
return cpu().GetWindowsIsProcessorFeaturePresent(ProcessorFeature);
}
#endif // CPU_FEATURES_OS_WINDOWS
@ -104,14 +110,22 @@ namespace
class CpuidX86Test : public ::testing::Test
{
protected:
void SetUp() override { g_fake_cpu = new FakeCpu(); }
void TearDown() override { delete g_fake_cpu; }
void SetUp() override
{
assert(g_fake_cpu_instance == nullptr);
g_fake_cpu_instance = new FakeCpu();
}
void TearDown() override
{
delete g_fake_cpu_instance;
g_fake_cpu_instance = nullptr;
}
};
TEST_F(CpuidX86Test, SandyBridge)
{
g_fake_cpu->SetOsBackupsExtendedRegisters(true);
g_fake_cpu->SetLeaves({
cpu().SetOsBackupsExtendedRegisters(true);
cpu().SetLeaves({
{{0x00000000, 0}, Leaf{0x0000000D, 0x756E6547, 0x6C65746E, 0x49656E69}},
{{0x00000001, 0}, Leaf{0x000206A6, 0x00100800, 0x1F9AE3BF, 0xBFEBFBFF}},
{{0x00000007, 0}, Leaf{0x00000000, 0x00000000, 0x00000000, 0x00000000}},
@ -153,28 +167,29 @@ TEST_F(CpuidX86Test, SandyBridge)
EXPECT_FALSE(features.adx);
}
const int UNDEF = -1;
const int KiB = 1024;
const int MiB = 1024 * KiB;
TEST_F(CpuidX86Test, SandyBridgeTestOsSupport)
{
g_fake_cpu->SetLeaves({
cpu().SetLeaves({
{{0x00000000, 0}, Leaf{0x0000000D, 0x756E6547, 0x6C65746E, 0x49656E69}},
{{0x00000001, 0}, Leaf{0x000206A6, 0x00100800, 0x1F9AE3BF, 0xBFEBFBFF}},
{{0x00000007, 0}, Leaf{0x00000000, 0x00000000, 0x00000000, 0x00000000}},
});
// avx is disabled if os does not support backing up ymm registers.
g_fake_cpu->SetOsBackupsExtendedRegisters(false);
cpu().SetOsBackupsExtendedRegisters(false);
EXPECT_FALSE(GetX86Info().features.avx);
// avx is disabled if os does not support backing up ymm registers.
g_fake_cpu->SetOsBackupsExtendedRegisters(true);
cpu().SetOsBackupsExtendedRegisters(true);
EXPECT_TRUE(GetX86Info().features.avx);
}
TEST_F(CpuidX86Test, SkyLake)
{
g_fake_cpu->SetOsBackupsExtendedRegisters(true);
g_fake_cpu->SetLeaves({
cpu().SetOsBackupsExtendedRegisters(true);
cpu().SetLeaves({
{{0x00000000, 0}, Leaf{0x00000016, 0x756E6547, 0x6C65746E, 0x49656E69}},
{{0x00000001, 0}, Leaf{0x000406E3, 0x00100800, 0x7FFAFBBF, 0xBFEBFBFF}},
{{0x00000007, 0}, Leaf{0x00000000, 0x029C67AF, 0x00000000, 0x00000000}},
@ -189,7 +204,7 @@ TEST_F(CpuidX86Test, SkyLake)
TEST_F(CpuidX86Test, Branding)
{
g_fake_cpu->SetLeaves({
cpu().SetLeaves({
{{0x00000000, 0}, Leaf{0x00000016, 0x756E6547, 0x6C65746E, 0x49656E69}},
{{0x00000001, 0}, Leaf{0x000406E3, 0x00100800, 0x7FFAFBBF, 0xBFEBFBFF}},
{{0x00000007, 0}, Leaf{0x00000000, 0x029C67AF, 0x00000000, 0x00000000}},
@ -206,7 +221,7 @@ TEST_F(CpuidX86Test, Branding)
TEST_F(CpuidX86Test, KabyLakeCache)
{
g_fake_cpu->SetLeaves({
cpu().SetLeaves({
{{0x00000000, 0}, Leaf{0x00000016, 0x756E6547, 0x6C65746E, 0x49656E69}},
{{0x00000001, 0}, Leaf{0x000406E3, 0x00100800, 0x7FFAFBBF, 0xBFEBFBFF}},
{{0x00000004, 0}, Leaf{0x1C004121, 0x01C0003F, 0x0000003F, 0x00000000}},
@ -256,7 +271,7 @@ TEST_F(CpuidX86Test, KabyLakeCache)
TEST_F(CpuidX86Test, HSWCache)
{
g_fake_cpu->SetLeaves({
cpu().SetLeaves({
{{0x00000000, 0}, Leaf{0x00000016, 0x756E6547, 0x6C65746E, 0x49656E69}},
{{0x00000001, 0}, Leaf{0x000406E3, 0x00100800, 0x7FFAFBBF, 0xBFEBFBFF}},
{{0x00000004, 0}, Leaf{0x1C004121, 0x01C0003F, 0x0000003F, 0x00000000}},
@ -307,7 +322,7 @@ TEST_F(CpuidX86Test, HSWCache)
// http://users.atw.hu/instlatx64/AuthenticAMD/AuthenticAMD0200F30_K11_Griffin_CPUID.txt
TEST_F(CpuidX86Test, AMD_K11_GRIFFIN)
{
g_fake_cpu->SetLeaves({
cpu().SetLeaves({
{{0x00000000, 0}, Leaf{0x00000001, 0x68747541, 0x444D4163, 0x69746E65}},
{{0x00000001, 0}, Leaf{0x00200F30, 0x00020800, 0x00002001, 0x178BFBFF}},
{{0x80000000, 0}, Leaf{0x8000001A, 0x68747541, 0x444D4163, 0x69746E65}},
@ -324,7 +339,7 @@ TEST_F(CpuidX86Test, AMD_K11_GRIFFIN)
// http://users.atw.hu/instlatx64/AuthenticAMD/AuthenticAMD0300F10_K12_Llano_CPUID.txt
TEST_F(CpuidX86Test, AMD_K12_LLANO)
{
g_fake_cpu->SetLeaves({
cpu().SetLeaves({
{{0x00000000, 0}, Leaf{0x00000006, 0x68747541, 0x444D4163, 0x69746E65}},
{{0x00000001, 0}, Leaf{0x00300F10, 0x00040800, 0x00802009, 0x178BFBFF}},
{{0x80000000, 0}, Leaf{0x8000001B, 0x68747541, 0x444D4163, 0x69746E65}},
@ -341,7 +356,7 @@ TEST_F(CpuidX86Test, AMD_K12_LLANO)
// http://users.atw.hu/instlatx64/AuthenticAMD/AuthenticAMD0500F01_K14_Bobcat_CPUID.txt
TEST_F(CpuidX86Test, AMD_K14_BOBCAT_AMD0500F01)
{
g_fake_cpu->SetLeaves({
cpu().SetLeaves({
{{0x00000000, 0}, Leaf{0x00000006, 0x68747541, 0x444D4163, 0x69746E65}},
{{0x00000001, 0}, Leaf{0x00500F01, 0x00020800, 0x00802209, 0x178BFBFF}},
{{0x80000000, 0}, Leaf{0x8000001B, 0x68747541, 0x444D4163, 0x69746E65}},
@ -358,7 +373,7 @@ TEST_F(CpuidX86Test, AMD_K14_BOBCAT_AMD0500F01)
// http://users.atw.hu/instlatx64/AuthenticAMD/AuthenticAMD0500F10_K14_Bobcat_CPUID.txt
TEST_F(CpuidX86Test, AMD_K14_BOBCAT_AMD0500F10)
{
g_fake_cpu->SetLeaves({
cpu().SetLeaves({
{{0x00000000, 0}, Leaf{0x00000006, 0x68747541, 0x444D4163, 0x69746E65}},
{{0x00000001, 0}, Leaf{0x00500F10, 0x00020800, 0x00802209, 0x178BFBFF}},
{{0x00000002, 0}, Leaf{0x00000000, 0x00000000, 0x00000000, 0x00000000}},
@ -383,7 +398,7 @@ TEST_F(CpuidX86Test, AMD_K14_BOBCAT_AMD0500F10)
// http://users.atw.hu/instlatx64/AuthenticAMD/AuthenticAMD0500F20_K14_Bobcat_CPUID.txt
TEST_F(CpuidX86Test, AMD_K14_BOBCAT_AMD0500F20)
{
g_fake_cpu->SetLeaves({
cpu().SetLeaves({
{{0x00000000, 0}, Leaf{0x00000006, 0x68747541, 0x444D4163, 0x69746E65}},
{{0x00000001, 0}, Leaf{0x00500F20, 0x00020800, 0x00802209, 0x178BFBFF}},
{{0x80000000, 0}, Leaf{0x8000001B, 0x68747541, 0x444D4163, 0x69746E65}},
@ -400,7 +415,7 @@ TEST_F(CpuidX86Test, AMD_K14_BOBCAT_AMD0500F20)
// http://users.atw.hu/instlatx64/AuthenticAMD/AuthenticAMD0670F00_K15_StoneyRidge_CPUID.txt
TEST_F(CpuidX86Test, AMD_K15_EXCAVATOR_STONEY_RIDGE)
{
g_fake_cpu->SetLeaves({
cpu().SetLeaves({
{{0x00000000, 0}, Leaf{0x0000000D, 0x68747541, 0x444D4163, 0x69746E65}},
{{0x00000001, 0}, Leaf{0x00670F00, 0x00020800, 0x7ED8320B, 0x178BFBFF}},
{{0x00000007, 0}, Leaf{0x00000000, 0x000001A9, 0x00000000, 0x00000000}},
@ -426,7 +441,7 @@ TEST_F(CpuidX86Test, AMD_K15_EXCAVATOR_STONEY_RIDGE)
// http://users.atw.hu/instlatx64/AuthenticAMD/AuthenticAMD0600F20_K15_AbuDhabi_CPUID0.txt
TEST_F(CpuidX86Test, AMD_K15_PILEDRIVER_ABU_DHABI)
{
g_fake_cpu->SetLeaves({
cpu().SetLeaves({
{{0x00000000, 0}, Leaf{0x0000000D, 0x68747541, 0x444D4163, 0x69746E65}},
{{0x00000001, 0}, Leaf{0x00600F20, 0x00100800, 0x3E98320B, 0x178BFBFF}},
{{0x00000007, 0}, Leaf{0x00000000, 0x00000008, 0x00000000, 0x00000000}},
@ -449,10 +464,59 @@ TEST_F(CpuidX86Test, AMD_K15_PILEDRIVER_ABU_DHABI)
EXPECT_STREQ(brand_string, "AMD Opteron(tm) Processor 6376 ");
}
// http://users.atw.hu/instlatx64/AuthenticAMD/AuthenticAMD0600F20_K15_AbuDhabi_CPUID0.txt
TEST_F(CpuidX86Test, AMD_K15_PILEDRIVER_ABU_DHABI_CACHE_INFO)
{
cpu().SetLeaves({
{{0x00000000, 0}, Leaf{0x0000000D, 0x68747541, 0x444D4163, 0x69746E65}},
{{0x00000001, 0}, Leaf{0x00600F20, 0x00100800, 0x3E98320B, 0x178BFBFF}},
{{0x80000000, 0}, Leaf{0x8000001E, 0x68747541, 0x444D4163, 0x69746E65}},
{{0x80000001, 0}, Leaf{0x00600F20, 0x30000000, 0x01EBBFFF, 0x2FD3FBFF}},
{{0x8000001D, 0}, Leaf{0x00000121, 0x00C0003F, 0x0000003F, 0x00000000}},
{{0x8000001D, 1}, Leaf{0x00004122, 0x0040003F, 0x000001FF, 0x00000000}},
{{0x8000001D, 2}, Leaf{0x00004143, 0x03C0003F, 0x000007FF, 0x00000001}},
{{0x8000001D, 3}, Leaf{0x0001C163, 0x0BC0003F, 0x000007FF, 0x00000001}},
});
const auto info = GetX86CacheInfo();
EXPECT_EQ(info.size, 4);
EXPECT_EQ(info.levels[0].level, 1);
EXPECT_EQ(info.levels[0].cache_type, 1);
EXPECT_EQ(info.levels[0].cache_size, 16 * KiB);
EXPECT_EQ(info.levels[0].ways, 4);
EXPECT_EQ(info.levels[0].line_size, 64);
EXPECT_EQ(info.levels[0].tlb_entries, 64);
EXPECT_EQ(info.levels[0].partitioning, 1);
EXPECT_EQ(info.levels[1].level, 1);
EXPECT_EQ(info.levels[1].cache_type, 2);
EXPECT_EQ(info.levels[1].cache_size, 64 * KiB);
EXPECT_EQ(info.levels[1].ways, 2);
EXPECT_EQ(info.levels[1].line_size, 64);
EXPECT_EQ(info.levels[1].tlb_entries, 512);
EXPECT_EQ(info.levels[1].partitioning, 1);
EXPECT_EQ(info.levels[2].level, 2);
EXPECT_EQ(info.levels[2].cache_type, 3);
EXPECT_EQ(info.levels[2].cache_size, 2 * MiB);
EXPECT_EQ(info.levels[2].ways, 16);
EXPECT_EQ(info.levels[2].line_size, 64);
EXPECT_EQ(info.levels[2].tlb_entries, 2048);
EXPECT_EQ(info.levels[2].partitioning, 1);
EXPECT_EQ(info.levels[3].level, 3);
EXPECT_EQ(info.levels[3].cache_type, 3);
EXPECT_EQ(info.levels[3].cache_size, 6 * MiB);
EXPECT_EQ(info.levels[3].ways, 48);
EXPECT_EQ(info.levels[3].line_size, 64);
EXPECT_EQ(info.levels[3].tlb_entries, 2048);
EXPECT_EQ(info.levels[3].partitioning, 1);
}
// http://users.atw.hu/instlatx64/AuthenticAMD/AuthenticAMD0600F12_K15_Interlagos_CPUID3.txt
TEST_F(CpuidX86Test, AMD_K15_BULLDOZER_INTERLAGOS)
{
g_fake_cpu->SetLeaves({
cpu().SetLeaves({
{{0x00000000, 0}, Leaf{0x0000000D, 0x68747541, 0x444D4163, 0x69746E65}},
{{0x00000001, 0}, Leaf{0x00600F12, 0x000C0800, 0x1E98220B, 0x178BFBFF}},
{{0x00000007, 0}, Leaf{0x00000000, 0x00000000, 0x00000000, 0x00000000}},
@ -478,7 +542,7 @@ TEST_F(CpuidX86Test, AMD_K15_BULLDOZER_INTERLAGOS)
// http://users.atw.hu/instlatx64/AuthenticAMD0630F81_K15_Godavari_CPUID.txt
TEST_F(CpuidX86Test, AMD_K15_STREAMROLLER_GODAVARI)
{
g_fake_cpu->SetLeaves({
cpu().SetLeaves({
{{0x00000000, 0}, Leaf{0x0000000D, 0x68747541, 0x444D4163, 0x69746E65}},
{{0x00000001, 0}, Leaf{0x00630F81, 0x00040800, 0x3E98320B, 0x178BFBFF}},
{{0x00000007, 0}, Leaf{0x00000000, 0x00000000, 0x00000000, 0x00000000}},
@ -506,7 +570,7 @@ TEST_F(CpuidX86Test, AMD_K15_STREAMROLLER_GODAVARI)
// http://users.atw.hu/instlatx64/AuthenticAMD/AuthenticAMD0700F01_K16_Kabini_CPUID.txt
TEST_F(CpuidX86Test, AMD_K16_JAGUAR_KABINI)
{
g_fake_cpu->SetLeaves({
cpu().SetLeaves({
{{0x00000000, 0}, Leaf{0x0000000D, 0x68747541, 0x444D4163, 0x69746E65}},
{{0x00000001, 0}, Leaf{0x00700F01, 0x00040800, 0x3ED8220B, 0x178BFBFF}},
{{0x00000007, 0}, Leaf{0x00000000, 0x00000008, 0x00000000, 0x00000000}},
@ -531,7 +595,7 @@ TEST_F(CpuidX86Test, AMD_K16_JAGUAR_KABINI)
// http://users.atw.hu/instlatx64/AuthenticAMD/AuthenticAMD0730F01_K16_Beema_CPUID2.txt
TEST_F(CpuidX86Test, AMD_K16_PUMA_BEEMA)
{
g_fake_cpu->SetLeaves({
cpu().SetLeaves({
{{0x00000000, 0}, Leaf{0x0000000D, 0x68747541, 0x444D4163, 0x69746E65}},
{{0x00000001, 0}, Leaf{0x00730F01, 0x00040800, 0x7ED8220B, 0x178BFBFF}},
{{0x00000007, 0}, Leaf{0x00000000, 0x00000008, 0x00000000, 0x00000000}},
@ -556,7 +620,7 @@ TEST_F(CpuidX86Test, AMD_K16_PUMA_BEEMA)
// http://users.atw.hu/instlatx64/AuthenticAMD/AuthenticAMD0820F01_K17_Dali_CPUID.txt
TEST_F(CpuidX86Test, AMD_K17_ZEN_DALI)
{
g_fake_cpu->SetLeaves({
cpu().SetLeaves({
{{0x00000000, 0}, Leaf{0x0000000D, 0x68747541, 0x444D4163, 0x69746E65}},
{{0x00000001, 0}, Leaf{0x00820F01, 0x00020800, 0x7ED8320B, 0x178BFBFF}},
{{0x00000007, 0}, Leaf{0x00000000, 0x209C01A9, 0x00000000, 0x00000000}},
@ -581,7 +645,7 @@ TEST_F(CpuidX86Test, AMD_K17_ZEN_DALI)
// http://users.atw.hu/instlatx64/AuthenticAMD/AuthenticAMD0800F82_K17_ZenP_CPUID.txt
TEST_F(CpuidX86Test, AMD_K17_ZEN_PLUS_PINNACLE_RIDGE)
{
g_fake_cpu->SetLeaves({
cpu().SetLeaves({
{{0x00000000, 0}, Leaf{0x0000000D, 0x68747541, 0x444D4163, 0x69746E65}},
{{0x00000001, 0}, Leaf{0x00800F82, 0x00100800, 0x7ED8320B, 0x178BFBFF}},
{{0x00000007, 0}, Leaf{0x00000000, 0x209C01A9, 0x00000000, 0x00000000}},
@ -606,7 +670,7 @@ TEST_F(CpuidX86Test, AMD_K17_ZEN_PLUS_PINNACLE_RIDGE)
// http://users.atw.hu/instlatx64/AuthenticAMD/AuthenticAMD0840F70_K17_CPUID.txt
TEST_F(CpuidX86Test, AMD_K17_ZEN2_XBOX_SERIES_X)
{
g_fake_cpu->SetLeaves({
cpu().SetLeaves({
{{0x00000000, 0}, Leaf{0x00000010, 0x68747541, 0x444D4163, 0x69746E65}},
{{0x00000001, 0}, Leaf{0x00840F70, 0x00100800, 0x7ED8320B, 0x178BFBFF}},
{{0x00000007, 0}, Leaf{0x00000000, 0x219C91A9, 0x00400004, 0x00000000}},
@ -631,7 +695,7 @@ TEST_F(CpuidX86Test, AMD_K17_ZEN2_XBOX_SERIES_X)
// http://users.atw.hu/instlatx64/HygonGenuine/HygonGenuine0900F02_Hygon_CPUID3.txt
TEST_F(CpuidX86Test, AMD_K18_ZEN_DHYANA)
{
g_fake_cpu->SetLeaves({
cpu().SetLeaves({
{{0x00000000, 0}, Leaf{0x0000000D, 0x6F677948, 0x656E6975, 0x6E65476E}},
{{0x00000001, 0}, Leaf{0x00900F02, 0x00100800, 0x74D83209, 0x178BFBFF}},
{{0x00000007, 0}, Leaf{0x00000000, 0x009C01A9, 0x0040068C, 0x00000000}},
@ -653,10 +717,59 @@ TEST_F(CpuidX86Test, AMD_K18_ZEN_DHYANA)
EXPECT_STREQ(brand_string, "Hygon C86 3185 8-core Processor ");
}
// http://users.atw.hu/instlatx64/HygonGenuine/HygonGenuine0900F02_Hygon_CPUID.txt
TEST_F(CpuidX86Test, AMD_K18_ZEN_DHYANA_CACHE_INFO)
{
cpu().SetLeaves({
{{0x00000000, 0}, Leaf{0x0000000D, 0x6F677948, 0x656E6975, 0x6E65476E}},
{{0x00000001, 0}, Leaf{0x00900F02, 0x00100800, 0x74D83209, 0x178BFBFF}},
{{0x80000000, 0}, Leaf{0x8000001F, 0x6F677948, 0x656E6975, 0x6E65476E}},
{{0x80000001, 0}, Leaf{0x00900F02, 0x60000000, 0x35C233FF, 0x2FD3FBFF}},
{{0x8000001D, 0}, Leaf{0x00004121, 0x01C0003F, 0x0000003F, 0x00000000}},
{{0x8000001D, 1}, Leaf{0x00004122, 0x00C0003F, 0x000000FF, 0x00000000}},
{{0x8000001D, 2}, Leaf{0x00004143, 0x01C0003F, 0x000003FF, 0x00000002}},
{{0x8000001D, 3}, Leaf{0x0001C163, 0x03C0003F, 0x00001FFF, 0x00000001}},
});
const auto info = GetX86CacheInfo();
EXPECT_EQ(info.size, 4);
EXPECT_EQ(info.levels[0].level, 1);
EXPECT_EQ(info.levels[0].cache_type, 1);
EXPECT_EQ(info.levels[0].cache_size, 32 * KiB);
EXPECT_EQ(info.levels[0].ways, 8);
EXPECT_EQ(info.levels[0].line_size, 64);
EXPECT_EQ(info.levels[0].tlb_entries, 64);
EXPECT_EQ(info.levels[0].partitioning, 1);
EXPECT_EQ(info.levels[1].level, 1);
EXPECT_EQ(info.levels[1].cache_type, 2);
EXPECT_EQ(info.levels[1].cache_size, 64 * KiB);
EXPECT_EQ(info.levels[1].ways, 4);
EXPECT_EQ(info.levels[1].line_size, 64);
EXPECT_EQ(info.levels[1].tlb_entries, 256);
EXPECT_EQ(info.levels[1].partitioning, 1);
EXPECT_EQ(info.levels[2].level, 2);
EXPECT_EQ(info.levels[2].cache_type, 3);
EXPECT_EQ(info.levels[2].cache_size, 512 * KiB);
EXPECT_EQ(info.levels[2].ways, 8);
EXPECT_EQ(info.levels[2].line_size, 64);
EXPECT_EQ(info.levels[2].tlb_entries, 1024);
EXPECT_EQ(info.levels[2].partitioning, 1);
EXPECT_EQ(info.levels[3].level, 3);
EXPECT_EQ(info.levels[3].cache_type, 3);
EXPECT_EQ(info.levels[3].cache_size, 8 * MiB);
EXPECT_EQ(info.levels[3].ways, 16);
EXPECT_EQ(info.levels[3].line_size, 64);
EXPECT_EQ(info.levels[3].tlb_entries, 8192);
EXPECT_EQ(info.levels[3].partitioning, 1);
}
// http://users.atw.hu/instlatx64/AuthenticAMD/AuthenticAMD0A20F10_K19_Vermeer2_CPUID.txt
TEST_F(CpuidX86Test, AMD_K19_ZEN3_VERMEER)
{
g_fake_cpu->SetLeaves({
cpu().SetLeaves({
{{0x00000000, 0}, Leaf{0x00000010, 0x68747541, 0x444D4163, 0x69746E65}},
{{0x00000001, 0}, Leaf{0x00A20F10, 0x01180800, 0x7ED8320B, 0x178BFBFF}},
{{0x00000007, 0}, Leaf{0x00000000, 0x219C97A9, 0x0040068C, 0x00000000}},
@ -682,21 +795,18 @@ TEST_F(CpuidX86Test, AMD_K19_ZEN3_VERMEER)
TEST_F(CpuidX86Test, Nehalem)
{
// Pre AVX cpus don't have xsave
g_fake_cpu->SetOsBackupsExtendedRegisters(false);
cpu().SetOsBackupsExtendedRegisters(false);
#if defined(CPU_FEATURES_OS_WINDOWS)
g_fake_cpu->SetWindowsIsProcessorFeaturePresent(
PF_XMMI_INSTRUCTIONS_AVAILABLE);
g_fake_cpu->SetWindowsIsProcessorFeaturePresent(
PF_XMMI64_INSTRUCTIONS_AVAILABLE);
g_fake_cpu->SetWindowsIsProcessorFeaturePresent(
PF_SSE3_INSTRUCTIONS_AVAILABLE);
cpu().SetWindowsIsProcessorFeaturePresent(PF_XMMI_INSTRUCTIONS_AVAILABLE);
cpu().SetWindowsIsProcessorFeaturePresent(PF_XMMI64_INSTRUCTIONS_AVAILABLE);
cpu().SetWindowsIsProcessorFeaturePresent(PF_SSE3_INSTRUCTIONS_AVAILABLE);
#elif defined(CPU_FEATURES_OS_DARWIN)
g_fake_cpu->SetDarwinSysCtlByName("hw.optional.sse");
g_fake_cpu->SetDarwinSysCtlByName("hw.optional.sse2");
g_fake_cpu->SetDarwinSysCtlByName("hw.optional.sse3");
g_fake_cpu->SetDarwinSysCtlByName("hw.optional.supplementalsse3");
g_fake_cpu->SetDarwinSysCtlByName("hw.optional.sse4_1");
g_fake_cpu->SetDarwinSysCtlByName("hw.optional.sse4_2");
cpu().SetDarwinSysCtlByName("hw.optional.sse");
cpu().SetDarwinSysCtlByName("hw.optional.sse2");
cpu().SetDarwinSysCtlByName("hw.optional.sse3");
cpu().SetDarwinSysCtlByName("hw.optional.supplementalsse3");
cpu().SetDarwinSysCtlByName("hw.optional.sse4_1");
cpu().SetDarwinSysCtlByName("hw.optional.sse4_2");
#elif defined(CPU_FEATURES_OS_FREEBSD)
auto& fs = GetEmptyFilesystem();
fs.CreateFile("/var/run/dmesg.boot", R"(
@ -713,7 +823,7 @@ real memory = 2147418112 (2047 MB)
flags : fpu mmx sse sse2 sse3 ssse3 sse4_1 sse4_2
)");
#endif
g_fake_cpu->SetLeaves({
cpu().SetLeaves({
{{0x00000000, 0}, Leaf{0x0000000B, 0x756E6547, 0x6C65746E, 0x49656E69}},
{{0x00000001, 0}, Leaf{0x000106A2, 0x00100800, 0x00BCE3BD, 0xBFEBFBFF}},
{{0x00000002, 0}, Leaf{0x55035A01, 0x00F0B0E3, 0x00000000, 0x09CA212C}},
@ -768,21 +878,18 @@ flags : fpu mmx sse sse2 sse3 ssse3 sse4_1 sse4_2
TEST_F(CpuidX86Test, Atom)
{
// Pre AVX cpus don't have xsave
g_fake_cpu->SetOsBackupsExtendedRegisters(false);
cpu().SetOsBackupsExtendedRegisters(false);
#if defined(CPU_FEATURES_OS_WINDOWS)
g_fake_cpu->SetWindowsIsProcessorFeaturePresent(
PF_XMMI_INSTRUCTIONS_AVAILABLE);
g_fake_cpu->SetWindowsIsProcessorFeaturePresent(
PF_XMMI64_INSTRUCTIONS_AVAILABLE);
g_fake_cpu->SetWindowsIsProcessorFeaturePresent(
PF_SSE3_INSTRUCTIONS_AVAILABLE);
cpu().SetWindowsIsProcessorFeaturePresent(PF_XMMI_INSTRUCTIONS_AVAILABLE);
cpu().SetWindowsIsProcessorFeaturePresent(PF_XMMI64_INSTRUCTIONS_AVAILABLE);
cpu().SetWindowsIsProcessorFeaturePresent(PF_SSE3_INSTRUCTIONS_AVAILABLE);
#elif defined(CPU_FEATURES_OS_DARWIN)
g_fake_cpu->SetDarwinSysCtlByName("hw.optional.sse");
g_fake_cpu->SetDarwinSysCtlByName("hw.optional.sse2");
g_fake_cpu->SetDarwinSysCtlByName("hw.optional.sse3");
g_fake_cpu->SetDarwinSysCtlByName("hw.optional.supplementalsse3");
g_fake_cpu->SetDarwinSysCtlByName("hw.optional.sse4_1");
g_fake_cpu->SetDarwinSysCtlByName("hw.optional.sse4_2");
cpu().SetDarwinSysCtlByName("hw.optional.sse");
cpu().SetDarwinSysCtlByName("hw.optional.sse2");
cpu().SetDarwinSysCtlByName("hw.optional.sse3");
cpu().SetDarwinSysCtlByName("hw.optional.supplementalsse3");
cpu().SetDarwinSysCtlByName("hw.optional.sse4_1");
cpu().SetDarwinSysCtlByName("hw.optional.sse4_2");
#elif defined(CPU_FEATURES_OS_FREEBSD)
auto& fs = GetEmptyFilesystem();
fs.CreateFile("/var/run/dmesg.boot", R"(
@ -799,7 +906,7 @@ real memory = 2147418112 (2047 MB)
flags : fpu mmx sse sse2 sse3 ssse3 sse4_1 sse4_2
)");
#endif
g_fake_cpu->SetLeaves({
cpu().SetLeaves({
{{0x00000000, 0}, Leaf{0x0000000B, 0x756E6547, 0x6C65746E, 0x49656E69}},
{{0x00000001, 0}, Leaf{0x00030673, 0x00100800, 0x41D8E3BF, 0xBFEBFBFF}},
{{0x00000002, 0}, Leaf{0x61B3A001, 0x0000FFC2, 0x00000000, 0x00000000}},
@ -850,16 +957,68 @@ flags : fpu mmx sse sse2 sse3 ssse3 sse4_1 sse4_2
#endif // !defined(CPU_FEATURES_OS_WINDOWS)
}
// https://www.felixcloutier.com/x86/cpuid#example-3-1--example-of-cache-and-tlb-interpretation
TEST_F(CpuidX86Test, P4_CacheInfo)
{
cpu().SetLeaves({
{{0x00000000, 0}, Leaf{0x00000002, 0x756E6547, 0x6C65746E, 0x49656E69}},
{{0x00000001, 0}, Leaf{0x00000F0A, 0x00010808, 0x00000000, 0x3FEBFBFF}},
{{0x00000002, 0}, Leaf{0x665B5001, 0x00000000, 0x00000000, 0x007A7000}},
});
const auto info = GetX86CacheInfo();
EXPECT_EQ(info.size, 5);
EXPECT_EQ(info.levels[0].level, UNDEF);
EXPECT_EQ(info.levels[0].cache_type, CPU_FEATURE_CACHE_TLB);
EXPECT_EQ(info.levels[0].cache_size, 4 * KiB);
EXPECT_EQ(info.levels[0].ways, UNDEF);
EXPECT_EQ(info.levels[0].line_size, UNDEF);
EXPECT_EQ(info.levels[0].tlb_entries, 64);
EXPECT_EQ(info.levels[0].partitioning, 0);
EXPECT_EQ(info.levels[1].level, UNDEF);
EXPECT_EQ(info.levels[1].cache_type, CPU_FEATURE_CACHE_TLB);
EXPECT_EQ(info.levels[1].cache_size, 4 * KiB);
EXPECT_EQ(info.levels[1].ways, UNDEF);
EXPECT_EQ(info.levels[1].line_size, UNDEF);
EXPECT_EQ(info.levels[1].tlb_entries, 64);
EXPECT_EQ(info.levels[1].partitioning, 0);
EXPECT_EQ(info.levels[2].level, 1);
EXPECT_EQ(info.levels[2].cache_type, CPU_FEATURE_CACHE_DATA);
EXPECT_EQ(info.levels[2].cache_size, 8 * KiB);
EXPECT_EQ(info.levels[2].ways, 4);
EXPECT_EQ(info.levels[2].line_size, 64);
EXPECT_EQ(info.levels[2].tlb_entries, UNDEF);
EXPECT_EQ(info.levels[2].partitioning, 0);
EXPECT_EQ(info.levels[3].level, 1);
EXPECT_EQ(info.levels[3].cache_type, CPU_FEATURE_CACHE_INSTRUCTION);
EXPECT_EQ(info.levels[3].cache_size, 12 * KiB);
EXPECT_EQ(info.levels[3].ways, 8);
EXPECT_EQ(info.levels[3].line_size, UNDEF);
EXPECT_EQ(info.levels[3].tlb_entries, UNDEF);
EXPECT_EQ(info.levels[3].partitioning, 0);
EXPECT_EQ(info.levels[4].level, 2);
EXPECT_EQ(info.levels[4].cache_type, CPU_FEATURE_CACHE_DATA);
EXPECT_EQ(info.levels[4].cache_size, 256 * KiB);
EXPECT_EQ(info.levels[4].ways, 8);
EXPECT_EQ(info.levels[4].line_size, 64);
EXPECT_EQ(info.levels[4].tlb_entries, UNDEF);
EXPECT_EQ(info.levels[4].partitioning, 2);
}
// https://github.com/InstLatx64/InstLatx64/blob/master/GenuineIntel/GenuineIntel0000673_P3_KatmaiDP_CPUID.txt
TEST_F(CpuidX86Test, P3)
{
// Pre AVX cpus don't have xsave
g_fake_cpu->SetOsBackupsExtendedRegisters(false);
cpu().SetOsBackupsExtendedRegisters(false);
#if defined(CPU_FEATURES_OS_WINDOWS)
g_fake_cpu->SetWindowsIsProcessorFeaturePresent(
PF_XMMI_INSTRUCTIONS_AVAILABLE);
cpu().SetWindowsIsProcessorFeaturePresent(PF_XMMI_INSTRUCTIONS_AVAILABLE);
#elif defined(CPU_FEATURES_OS_DARWIN)
g_fake_cpu->SetDarwinSysCtlByName("hw.optional.sse");
cpu().SetDarwinSysCtlByName("hw.optional.sse");
#elif defined(CPU_FEATURES_OS_FREEBSD)
auto& fs = GetEmptyFilesystem();
fs.CreateFile("/var/run/dmesg.boot", R"(
@ -875,7 +1034,7 @@ real memory = 2147418112 (2047 MB)
flags : fpu mmx sse
)");
#endif
g_fake_cpu->SetLeaves({
cpu().SetLeaves({
{{0x00000000, 0}, Leaf{0x00000003, 0x756E6547, 0x6C65746E, 0x49656E69}},
{{0x00000001, 0}, Leaf{0x00000673, 0x00000000, 0x00000000, 0x0387FBFF}},
{{0x00000002, 0}, Leaf{0x03020101, 0x00000000, 0x00000000, 0x0C040843}},

View File

@ -167,15 +167,25 @@ TEST(StringViewTest, CpuFeatures_StringView_HasWord)
{
// Find flags at beginning, middle and end.
EXPECT_TRUE(
CpuFeatures_StringView_HasWord(str("first middle last"), "first"));
CpuFeatures_StringView_HasWord(str("first middle last"), "first", ' '));
EXPECT_TRUE(
CpuFeatures_StringView_HasWord(str("first middle last"), "middle"));
EXPECT_TRUE(CpuFeatures_StringView_HasWord(str("first middle last"), "last"));
CpuFeatures_StringView_HasWord(str("first middle last"), "middle", ' '));
EXPECT_TRUE(
CpuFeatures_StringView_HasWord(str("first middle last"), "last", ' '));
// Find flags at beginning, middle and end with a different separator
EXPECT_TRUE(
CpuFeatures_StringView_HasWord(str("first-middle-last"), "first", '-'));
EXPECT_TRUE(
CpuFeatures_StringView_HasWord(str("first-middle-last"), "middle", '-'));
EXPECT_TRUE(
CpuFeatures_StringView_HasWord(str("first-middle-last"), "last", '-'));
// Do not match partial flags
EXPECT_FALSE(
CpuFeatures_StringView_HasWord(str("first middle last"), "irst"));
EXPECT_FALSE(CpuFeatures_StringView_HasWord(str("first middle last"), "mid"));
EXPECT_FALSE(CpuFeatures_StringView_HasWord(str("first middle last"), "las"));
CpuFeatures_StringView_HasWord(str("first middle last"), "irst", ' '));
EXPECT_FALSE(
CpuFeatures_StringView_HasWord(str("first middle last"), "mid", ' '));
EXPECT_FALSE(
CpuFeatures_StringView_HasWord(str("first middle last"), "las", ' '));
}
TEST(StringViewTest, CpuFeatures_StringView_GetAttributeKeyValue)

View File

@ -40,6 +40,7 @@ HybridObservables::HybridObservables(const ConfigurationInterface* configuration
conf.nchannels_out = out_streams_;
conf.observable_interval_ms = configuration->property("GNSS-SDR.observable_interval_ms", conf.observable_interval_ms);
conf.enable_carrier_smoothing = configuration->property(role + ".enable_carrier_smoothing", conf.enable_carrier_smoothing);
conf.always_output_gs = configuration->property("PVT.an_output_enabled", conf.always_output_gs) || configuration->property(role + ".always_output_gs", conf.always_output_gs);
if (FLAGS_carrier_smoothing_factor == DEFAULT_CARRIER_SMOOTHING_FACTOR)
{

View File

@ -69,6 +69,13 @@ if(USE_BOOST_BIND_PLACEHOLDERS)
)
endif()
if(PMT_USES_BOOST_ANY)
target_compile_definitions(obs_gr_blocks
PRIVATE
-DPMT_USES_BOOST_ANY=1
)
endif()
if(ENABLE_CLANG_TIDY)
if(CLANG_TIDY_EXE)
set_target_properties(obs_gr_blocks

View File

@ -35,6 +35,14 @@
#include <limits> // for numeric_limits
#include <utility> // for move
#if PMT_USES_BOOST_ANY
#include <boost/any.hpp>
namespace wht = boost;
#else
#include <any>
namespace wht = std;
#endif
#if HAS_GENERIC_LAMBDA
#else
#include <boost/bind/bind.hpp>
@ -61,6 +69,7 @@ hybrid_observables_gs::hybrid_observables_gs(const Obs_Conf &conf_)
d_nchannels_in(conf_.nchannels_in),
d_nchannels_out(conf_.nchannels_out),
d_T_rx_TOW_set(false),
d_always_output_gs(conf_.always_output_gs),
d_dump(conf_.dump),
d_dump_mat(conf_.dump_mat && d_dump)
{
@ -194,7 +203,7 @@ void hybrid_observables_gs::msg_handler_pvt_to_observables(const pmt::pmt_t &msg
{
if (pmt::any_ref(msg).type().hash_code() == d_double_type_hash_code)
{
const auto new_rx_clock_offset_s = boost::any_cast<double>(pmt::any_ref(msg));
const auto new_rx_clock_offset_s = wht::any_cast<double>(pmt::any_ref(msg));
d_T_rx_TOW_ms = d_T_rx_TOW_ms - static_cast<int>(round(new_rx_clock_offset_s * 1000.0));
// align the receiver clock to integer multiple of d_T_rx_step_ms
if (d_T_rx_TOW_ms % d_T_rx_step_ms)
@ -210,7 +219,7 @@ void hybrid_observables_gs::msg_handler_pvt_to_observables(const pmt::pmt_t &msg
LOG(INFO) << "Corrected new RX Time offset: " << static_cast<int>(round(new_rx_clock_offset_s * 1000.0)) << "[ms]";
}
}
catch (const boost::bad_any_cast &e)
catch (const wht::bad_any_cast &e)
{
LOG(WARNING) << "msg_handler_pvt_to_observables Bad any_cast: " << e.what();
}
@ -749,5 +758,14 @@ int hybrid_observables_gs::general_work(int noutput_items __attribute__((unused)
return 1;
}
}
if (d_always_output_gs)
{
Gnss_Synchro empty_gs{};
for (uint32_t n = 0; n < d_nchannels_out; n++)
{
out[n][0] = empty_gs;
}
return 1;
}
return 0;
}

View File

@ -119,6 +119,7 @@ private:
uint32_t d_nchannels_out;
bool d_T_rx_TOW_set; // rx time follow GPST
bool d_always_output_gs;
bool d_dump;
bool d_dump_mat;
};

View File

@ -38,6 +38,7 @@ public:
uint32_t nchannels_out{0U};
uint32_t observable_interval_ms{20U};
bool enable_carrier_smoothing{false};
bool always_output_gs{false};
bool dump{false};
bool dump_mat{false};
};

View File

@ -241,6 +241,11 @@ if(ENABLE_PLUTOSDR OR ENABLE_FMCOMMS2)
Gnuradio::analog
)
endif()
if(GR_IIO_TEMPLATIZED_API)
target_compile_definitions(signal_source_adapters
PUBLIC -DGR_IIO_TEMPLATIZED_API=1
)
endif()
endif()
if(ENABLE_CLANG_TIDY)

View File

@ -185,7 +185,11 @@ Fmcomms2SignalSource::Fmcomms2SignalSource(const ConfigurationInterface *configu
{
#if GNURADIO_API_IIO
std::vector<bool> enable_channels{rx1_en_, rx2_en_};
#if GR_IIO_TEMPLATIZED_API
fmcomms2_source_f32c_ = gr::iio::fmcomms2_source<gr_complex>::make(uri_, enable_channels, buffer_size_);
#else
fmcomms2_source_f32c_ = gr::iio::fmcomms2_source::make(uri_, enable_channels, buffer_size_);
#endif
fmcomms2_source_f32c_->set_frequency(freq_);
fmcomms2_source_f32c_->set_samplerate(sample_rate_);
if (rx1_en_)
@ -261,7 +265,11 @@ Fmcomms2SignalSource::Fmcomms2SignalSource(const ConfigurationInterface *configu
{
#if GNURADIO_API_IIO
std::vector<bool> enable_channels{rx1_en_, rx2_en_};
#if GR_IIO_TEMPLATIZED_API
fmcomms2_source_f32c_ = gr::iio::fmcomms2_source<gr_complex>::make(uri_, enable_channels, buffer_size_);
#else
fmcomms2_source_f32c_ = gr::iio::fmcomms2_source::make(uri_, enable_channels, buffer_size_);
#endif
fmcomms2_source_f32c_->set_frequency(freq_);
fmcomms2_source_f32c_->set_samplerate(sample_rate_);
fmcomms2_source_f32c_->set_gain_mode(0, gain_mode_rx1_);

View File

@ -62,7 +62,11 @@ public:
private:
#if GNURADIO_API_IIO
#if GR_IIO_TEMPLATIZED_API
gr::iio::fmcomms2_source<gr_complex>::sptr fmcomms2_source_f32c_;
#else
gr::iio::fmcomms2_source::sptr fmcomms2_source_f32c_;
#endif
#else
gr::iio::fmcomms2_source_f32c::sptr fmcomms2_source_f32c_;
#endif

View File

@ -126,11 +126,17 @@ PlutosdrSignalSource::PlutosdrSignalSource(const ConfigurationInterface* configu
std::cout << "item type: " << item_type_ << '\n';
#if GNURADIO_API_IIO
#if GR_IIO_TEMPLATIZED_API
plutosdr_source_ = gr::iio::fmcomms2_source<gr_complex>::make(uri_, {true}, buffer_size_);
plutosdr_source_->set_gain_mode(0, gain_mode_);
plutosdr_source_->set_gain(0, rf_gain_);
#else
plutosdr_source_ = gr::iio::pluto_source::make(uri_, buffer_size_);
plutosdr_source_->set_frequency(freq_);
plutosdr_source_->set_samplerate(sample_rate_);
plutosdr_source_->set_gain_mode(gain_mode_);
plutosdr_source_->set_gain(rf_gain_);
#endif
plutosdr_source_->set_frequency(freq_);
plutosdr_source_->set_samplerate(sample_rate_);
plutosdr_source_->set_quadrature(quadrature_);
plutosdr_source_->set_rfdc(rf_dc_);
plutosdr_source_->set_bbdc(bb_dc_);

View File

@ -22,7 +22,11 @@
#include "signal_source_base.h"
#include <gnuradio/blocks/file_sink.h>
#if GRIIO_INCLUDE_HAS_GNURADIO
#if GR_IIO_TEMPLATIZED_API
#include <gnuradio/iio/fmcomms2_source.h>
#else
#include <gnuradio/iio/pluto_source.h>
#endif
#else
#include <iio/pluto_source.h>
#endif
@ -62,7 +66,11 @@ public:
gr::basic_block_sptr get_right_block() override;
private:
#if GR_IIO_TEMPLATIZED_API
gr::iio::fmcomms2_source<gr_complex>::sptr plutosdr_source_;
#else
gr::iio::pluto_source::sptr plutosdr_source_;
#endif
gnss_shared_ptr<gr::block> valve_;
gr::blocks::file_sink::sptr file_sink_;

View File

@ -150,6 +150,17 @@ if(has_span)
)
endif()
if(PMT_USES_BOOST_ANY)
target_compile_definitions(tracking_gr_blocks
PRIVATE
-DPMT_USES_BOOST_ANY=1
)
target_link_libraries(tracking_gr_blocks
PRIVATE
Boost::headers
)
endif()
if(ENABLE_CLANG_TIDY)
if(CLANG_TIDY_EXE)
set_target_properties(tracking_gr_blocks

View File

@ -65,6 +65,13 @@
#include <boost/bind/bind.hpp>
#endif
#if PMT_USES_BOOST_ANY
#include <boost/any.hpp>
namespace wht = boost;
#else
#include <any>
namespace wht = std;
#endif
dll_pll_veml_tracking_sptr dll_pll_veml_make_tracking(const Dll_Pll_Conf &conf_)
{
@ -605,7 +612,7 @@ void dll_pll_veml_tracking::msg_handler_telemetry_to_trk(const pmt::pmt_t &msg)
{
if (pmt::any_ref(msg).type().hash_code() == int_type_hash_code)
{
const int tlm_event = boost::any_cast<int>(pmt::any_ref(msg));
const int tlm_event = wht::any_cast<int>(pmt::any_ref(msg));
if (tlm_event == 1)
{
DLOG(INFO) << "Telemetry fault received in ch " << this->d_channel;
@ -614,7 +621,7 @@ void dll_pll_veml_tracking::msg_handler_telemetry_to_trk(const pmt::pmt_t &msg)
}
}
}
catch (const boost::bad_any_cast &e)
catch (const wht::bad_any_cast &e)
{
LOG(WARNING) << "msg_handler_telemetry_to_trk Bad any_cast: " << e.what();
}

View File

@ -54,6 +54,13 @@
#include <boost/bind/bind.hpp>
#endif
#if PMT_USES_BOOST_ANY
#include <boost/any.hpp>
namespace wht = boost;
#else
#include <any>
namespace wht = std;
#endif
dll_pll_veml_tracking_fpga_sptr dll_pll_veml_make_tracking_fpga(const Dll_Pll_Conf_Fpga &conf_)
{
@ -469,7 +476,7 @@ void dll_pll_veml_tracking_fpga::msg_handler_telemetry_to_trk(const pmt::pmt_t &
{
if (pmt::any_ref(msg).type().hash_code() == int_type_hash_code)
{
const int tlm_event = boost::any_cast<int>(pmt::any_ref(msg));
const int tlm_event = wht::any_cast<int>(pmt::any_ref(msg));
if (tlm_event == 1)
{
DLOG(INFO) << "Telemetry fault received in ch " << this->d_channel;
@ -478,7 +485,7 @@ void dll_pll_veml_tracking_fpga::msg_handler_telemetry_to_trk(const pmt::pmt_t &
}
}
}
catch (const boost::bad_any_cast &e)
catch (const wht::bad_any_cast &e)
{
LOG(WARNING) << "msg_handler_telemetry_to_trk Bad any_cast: " << e.what();
}

View File

@ -142,6 +142,13 @@ if(USE_BOOST_ASIO_IO_CONTEXT)
)
endif()
if(PMT_USES_BOOST_ANY)
target_compile_definitions(core_libs
PRIVATE
-DPMT_USES_BOOST_ANY=1
)
endif()
# Do not apply clang-tidy fixes to protobuf generated headers
get_filename_component(PROTO_INCLUDE_HEADERS_DIR ${PROTO_HDRS} DIRECTORY)
target_include_directories(core_libs

View File

@ -17,7 +17,6 @@
#include "channel_status_msg_receiver.h"
#include <boost/any.hpp>
#include <glog/logging.h>
#include <gnuradio/gr_complex.h>
#include <gnuradio/io_signature.h>
@ -31,6 +30,13 @@
#include <boost/bind/bind.hpp>
#endif
#if PMT_USES_BOOST_ANY
#include <boost/any.hpp>
namespace wht = boost;
#else
#include <any>
namespace wht = std;
#endif
channel_status_msg_receiver_sptr channel_status_msg_receiver_make()
{
@ -64,7 +70,7 @@ void channel_status_msg_receiver::msg_handler_channel_status(const pmt::pmt_t& m
// ****************** Gnss_Synchro received ************************
if (msg_type_hash_code == typeid(std::shared_ptr<Gnss_Synchro>).hash_code())
{
const auto gnss_synchro_obj = boost::any_cast<std::shared_ptr<Gnss_Synchro>>(pmt::any_ref(msg));
const auto gnss_synchro_obj = wht::any_cast<std::shared_ptr<Gnss_Synchro>>(pmt::any_ref(msg));
if (gnss_synchro_obj->Flag_valid_pseudorange == true)
{
d_channel_status_map[gnss_synchro_obj->Channel_ID] = gnss_synchro_obj;
@ -84,7 +90,7 @@ void channel_status_msg_receiver::msg_handler_channel_status(const pmt::pmt_t& m
else if (msg_type_hash_code == typeid(std::shared_ptr<Monitor_Pvt>).hash_code())
{
// ***************** Monitor_Pvt received ******************
const auto monitor_pvt_obj = boost::any_cast<std::shared_ptr<Monitor_Pvt>>(pmt::any_ref(msg));
const auto monitor_pvt_obj = wht::any_cast<std::shared_ptr<Monitor_Pvt>>(pmt::any_ref(msg));
d_pvt_status = *monitor_pvt_obj.get();
// std::cout << "-------- \n" << '\n';
@ -96,7 +102,7 @@ void channel_status_msg_receiver::msg_handler_channel_status(const pmt::pmt_t& m
LOG(WARNING) << "channel_status_msg_receiver unknown object type!";
}
}
catch (const boost::bad_any_cast& e)
catch (const wht::bad_any_cast& e)
{
LOG(WARNING) << "channel_status_msg_receiver Bad any_cast: " << e.what();
}

View File

@ -23,7 +23,6 @@
#include "galileo_has_page.h" // for Galileo_HAS_page
#include "gnss_sdr_make_unique.h" // for std::make_unique in C++11
#include "reed_solomon.h" // for ReedSolomon
#include <boost/any.hpp> // for boost::any_cast
#include <glog/logging.h> // for DLOG
#include <gnuradio/io_signature.h> // for gr::io_signature::make
#include <algorithm> // for std::find, std::count
@ -38,6 +37,13 @@
#include <boost/bind/bind.hpp>
#endif
#if PMT_USES_BOOST_ANY
#include <boost/any.hpp>
namespace wht = boost;
#else
#include <any>
namespace wht = std;
#endif
galileo_e6_has_msg_receiver_sptr galileo_e6_has_msg_receiver_make()
{
@ -106,7 +112,7 @@ void galileo_e6_has_msg_receiver::msg_handler_galileo_e6_has(const pmt::pmt_t& m
const size_t msg_type_hash_code = pmt::any_ref(msg).type().hash_code();
if (msg_type_hash_code == typeid(std::shared_ptr<Galileo_HAS_page>).hash_code())
{
const auto HAS_data_page = boost::any_cast<std::shared_ptr<Galileo_HAS_page>>(pmt::any_ref(msg));
const auto HAS_data_page = wht::any_cast<std::shared_ptr<Galileo_HAS_page>>(pmt::any_ref(msg));
DLOG(INFO) << "New HAS page received: "
<< "Status: " << static_cast<float>(HAS_data_page->has_status) << ", "
<< "MT: " << static_cast<float>(HAS_data_page->message_type) << ", "
@ -122,7 +128,7 @@ void galileo_e6_has_msg_receiver::msg_handler_galileo_e6_has(const pmt::pmt_t& m
LOG(WARNING) << "galileo_e6_has_msg_receiver received an unknown object type!";
}
}
catch (const boost::bad_any_cast& e)
catch (const wht::bad_any_cast& e)
{
LOG(WARNING) << "galileo_e6_has_msg_receiver Bad any_cast: " << e.what();
}

View File

@ -17,7 +17,6 @@
#include "nav_message_monitor.h"
#include "gnss_sdr_make_unique.h"
#include <boost/any.hpp>
#include <glog/logging.h>
#include <gnuradio/io_signature.h>
#include <cstddef> // size_t
@ -28,6 +27,13 @@
#include <boost/bind/bind.hpp>
#endif
#if PMT_USES_BOOST_ANY
#include <boost/any.hpp>
namespace wht = boost;
#else
#include <any>
namespace wht = std;
#endif
nav_message_monitor_sptr nav_message_monitor_make(const std::vector<std::string>& addresses, uint16_t port)
{
@ -62,7 +68,7 @@ void nav_message_monitor::msg_handler_nav_message(const pmt::pmt_t& msg)
const size_t msg_type_hash_code = pmt::any_ref(msg).type().hash_code();
if (msg_type_hash_code == typeid(std::shared_ptr<Nav_Message_Packet>).hash_code())
{
const auto nav_message_packet = boost::any_cast<std::shared_ptr<Nav_Message_Packet>>(pmt::any_ref(msg));
const auto nav_message_packet = wht::any_cast<std::shared_ptr<Nav_Message_Packet>>(pmt::any_ref(msg));
nav_message_udp_sink_->write_nav_message(nav_message_packet);
}
else
@ -70,7 +76,7 @@ void nav_message_monitor::msg_handler_nav_message(const pmt::pmt_t& msg)
LOG(WARNING) << "nav_message_monitor received an unknown object type!";
}
}
catch (const boost::bad_any_cast& e)
catch (const wht::bad_any_cast& e)
{
LOG(WARNING) << "nav_message_monitor Bad any_cast: " << e.what();
}

View File

@ -50,7 +50,6 @@ target_link_libraries(core_monitor
core_system_parameters
PRIVATE
Boost::serialization
Gnuradio::pmt
)
get_filename_component(PROTO_INCLUDE_HEADERS_DIR ${PROTO_HDRS} DIRECTORY)

View File

@ -187,6 +187,13 @@ else()
)
endif()
if(PMT_USES_BOOST_ANY)
target_compile_definitions(core_receiver
PRIVATE
-DPMT_USES_BOOST_ANY=1
)
endif()
# Fix for Boost Asio < 1.70
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
if((CMAKE_CXX_COMPILER_ID MATCHES "Clang") AND (Boost_VERSION_STRING VERSION_LESS 1.70.0))

View File

@ -69,6 +69,12 @@
#include <boost/chrono.hpp> // for steady_clock
#endif
#if PMT_USES_BOOST_ANY
namespace wht = boost;
#else
namespace wht = std;
#endif
extern Concurrent_Map<Gps_Acq_Assist> global_gps_acq_assist_map;
extern Concurrent_Queue<Gps_Acq_Assist> global_gps_acq_assist_queue;
@ -280,7 +286,7 @@ void ControlThread::event_dispatcher(bool &valid_event, pmt::pmt_t &msg)
{
if (receiver_on_standby_ == false)
{
const auto new_event = boost::any_cast<channel_event_sptr>(pmt::any_ref(msg));
const auto new_event = wht::any_cast<channel_event_sptr>(pmt::any_ref(msg));
DLOG(INFO) << "New channel event rx from ch id: " << new_event->channel_id
<< " what: " << new_event->event_type;
flowgraph_->apply_action(new_event->channel_id, new_event->event_type);
@ -288,7 +294,7 @@ void ControlThread::event_dispatcher(bool &valid_event, pmt::pmt_t &msg)
}
else if (msg_type_hash_code == command_event_type_hash_code_)
{
const auto new_event = boost::any_cast<command_event_sptr>(pmt::any_ref(msg));
const auto new_event = wht::any_cast<command_event_sptr>(pmt::any_ref(msg));
DLOG(INFO) << "New command event rx from ch id: " << new_event->command_id
<< " what: " << new_event->event_type;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -291,7 +291,23 @@ ReedSolomon::ReedSolomon(const std::string& gnss_signal)
{244, 120, 86, 42, 110, 203, 209, 158, 119, 115, 207, 5, 104, 140, 138, 113, 25, 153, 59, 171, 105, 67, 136, 70, 30, 10, 203, 80, 13, 200, 172, 216},
{116, 64, 52, 174, 54, 126, 16, 194, 162, 33, 33, 157, 176, 197, 225, 12, 59, 55, 253, 228, 148, 47, 179, 185, 24, 138, 253, 20, 142, 55, 172, 88}};
d_genpoly_coeff = {88, 216, 195, 23, 111, 82, 79, 81, 62, 120, 249, 250, 11, 134, 209, 116, 69, 170, 208, 45, 249, 223, 4, 19, 120, 81, 182, 217, 44, 65, 93, 34, 118, 227, 112, 28, 65, 48, 244, 165, 242, 216, 121, 50, 171, 32, 217, 166, 133, 134, 4, 120, 54, 42, 13, 24, 95, 228, 173, 247, 80, 42, 89, 68, 81, 181, 112, 51, 118, 108, 243, 223, 18, 38, 230, 1, 28, 109, 131, 14, 234, 151, 21, 108, 7, 176, 236, 147, 175, 183, 66, 35, 178, 243, 36, 115, 255, 51, 36, 6, 120, 163, 59, 9, 214, 102, 109, 253, 152, 137, 1, 144, 124, 241, 143, 71, 91, 227, 28, 174, 13, 157, 78, 20, 192, 64, 130, 45, 39, 46, 229, 171, 193, 252, 43, 165, 88, 180, 179, 183, 88, 99, 219, 52, 210, 33, 160, 146, 22, 255, 111, 159, 7, 237, 145, 194, 68, 89, 231, 201, 224, 127, 5, 27, 112, 71, 165, 204, 236, 122, 119, 49, 212, 216, 151, 149, 53, 249, 57, 136, 85, 14, 19, 128, 135, 177, 179, 189, 164, 98, 220, 99, 241, 230, 188, 170, 148, 97, 121, 31, 253, 134, 43, 199, 81, 137, 82, 54, 47, 216, 172, 169, 123, 246, 153, 169, 32, 86, 128, 83, 5, 252, 251, 1};
d_genpoly_coeff = {88, 216, 195, 23, 111, 82, 79, 81, 62, 120, 249,
250, 11, 134, 209, 116, 69, 170, 208, 45, 249, 223, 4, 19, 120,
81, 182, 217, 44, 65, 93, 34, 118, 227, 112, 28, 65, 48, 244,
165, 242, 216, 121, 50, 171, 32, 217, 166, 133, 134, 4, 120, 54,
42, 13, 24, 95, 228, 173, 247, 80, 42, 89, 68, 81, 181, 112, 51,
118, 108, 243, 223, 18, 38, 230, 1, 28, 109, 131, 14, 234, 151,
21, 108, 7, 176, 236, 147, 175, 183, 66, 35, 178, 243, 36, 115,
255, 51, 36, 6, 120, 163, 59, 9, 214, 102, 109, 253, 152, 137,
1, 144, 124, 241, 143, 71, 91, 227, 28, 174, 13, 157, 78, 20,
192, 64, 130, 45, 39, 46, 229, 171, 193, 252, 43, 165, 88, 180,
179, 183, 88, 99, 219, 52, 210, 33, 160, 146, 22, 255, 111, 159,
7, 237, 145, 194, 68, 89, 231, 201, 224, 127, 5, 27, 112, 71,
165, 204, 236, 122, 119, 49, 212, 216, 151, 149, 53, 249, 57,
136, 85, 14, 19, 128, 135, 177, 179, 189, 164, 98, 220, 99, 241,
230, 188, 170, 148, 97, 121, 31, 253, 134, 43, 199, 81, 137, 82,
54, 47, 216, 172, 169, 123, 246, 153, 169, 32, 86, 128, 83, 5,
252, 251, 1};
}
else if (gnss_signal == "E1B")
{
@ -438,7 +454,23 @@ ReedSolomon::ReedSolomon(const std::string& gnss_signal)
d_shortening = 0; // shortening parameter
d_rows_G = 0;
d_columns_G = 0;
d_genpoly_coeff = {88, 216, 195, 23, 111, 82, 79, 81, 62, 120, 249, 250, 11, 134, 209, 116, 69, 170, 208, 45, 249, 223, 4, 19, 120, 81, 182, 217, 44, 65, 93, 34, 118, 227, 112, 28, 65, 48, 244, 165, 242, 216, 121, 50, 171, 32, 217, 166, 133, 134, 4, 120, 54, 42, 13, 24, 95, 228, 173, 247, 80, 42, 89, 68, 81, 181, 112, 51, 118, 108, 243, 223, 18, 38, 230, 1, 28, 109, 131, 14, 234, 151, 21, 108, 7, 176, 236, 147, 175, 183, 66, 35, 178, 243, 36, 115, 255, 51, 36, 6, 120, 163, 59, 9, 214, 102, 109, 253, 152, 137, 1, 144, 124, 241, 143, 71, 91, 227, 28, 174, 13, 157, 78, 20, 192, 64, 130, 45, 39, 46, 229, 171, 193, 252, 43, 165, 88, 180, 179, 183, 88, 99, 219, 52, 210, 33, 160, 146, 22, 255, 111, 159, 7, 237, 145, 194, 68, 89, 231, 201, 224, 127, 5, 27, 112, 71, 165, 204, 236, 122, 119, 49, 212, 216, 151, 149, 53, 249, 57, 136, 85, 14, 19, 128, 135, 177, 179, 189, 164, 98, 220, 99, 241, 230, 188, 170, 148, 97, 121, 31, 253, 134, 43, 199, 81, 137, 82, 54, 47, 216, 172, 169, 123, 246, 153, 169, 32, 86, 128, 83, 5, 252, 251, 1};
d_genpoly_coeff = {88, 216, 195, 23, 111, 82, 79, 81, 62, 120, 249,
250, 11, 134, 209, 116, 69, 170, 208, 45, 249, 223, 4, 19, 120,
81, 182, 217, 44, 65, 93, 34, 118, 227, 112, 28, 65, 48, 244,
165, 242, 216, 121, 50, 171, 32, 217, 166, 133, 134, 4, 120, 54,
42, 13, 24, 95, 228, 173, 247, 80, 42, 89, 68, 81, 181, 112, 51,
118, 108, 243, 223, 18, 38, 230, 1, 28, 109, 131, 14, 234, 151,
21, 108, 7, 176, 236, 147, 175, 183, 66, 35, 178, 243, 36, 115,
255, 51, 36, 6, 120, 163, 59, 9, 214, 102, 109, 253, 152, 137,
1, 144, 124, 241, 143, 71, 91, 227, 28, 174, 13, 157, 78, 20,
192, 64, 130, 45, 39, 46, 229, 171, 193, 252, 43, 165, 88, 180,
179, 183, 88, 99, 219, 52, 210, 33, 160, 146, 22, 255, 111, 159,
7, 237, 145, 194, 68, 89, 231, 201, 224, 127, 5, 27, 112, 71,
165, 204, 236, 122, 119, 49, 212, 216, 151, 149, 53, 249, 57,
136, 85, 14, 19, 128, 135, 177, 179, 189, 164, 98, 220, 99, 241,
230, 188, 170, 148, 97, 121, 31, 253, 134, 43, 199, 81, 137, 82,
54, 47, 216, 172, 169, 123, 246, 153, 169, 32, 86, 128, 83, 5,
252, 251, 1};
}
d_data_in_block = d_symbols_per_block - d_nroots;

View File

@ -542,6 +542,11 @@ if(ENABLE_UNIT_TESTING)
PRIVATE -DGNURADIO_USES_STD_POINTERS=1
)
endif()
if(PMT_USES_BOOST_ANY)
target_compile_definitions(run_tests
PRIVATE -DPMT_USES_BOOST_ANY=1
)
endif()
if(ENABLE_UNIT_TESTING_EXTRA)
target_link_libraries(run_tests PRIVATE Gpstk::gpstk)
if(GPSTK_OLDER_THAN_8)
@ -642,6 +647,11 @@ if(ENABLE_FPGA)
-DUSE_BOOST_BIND_PLACEHOLDERS=1
)
endif()
if(PMT_USES_BOOST_ANY)
target_compile_definitions(gps_l1_ca_dll_pll_tracking_test_fpga
PRIVATE -DPMT_USES_BOOST_ANY=1
)
endif()
target_link_libraries(gps_l1_ca_dll_pll_tracking_test_fpga
PRIVATE
@ -1002,6 +1012,12 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA)
INTERFACE
${CMAKE_SOURCE_DIR}/src/tests/common-files
)
if(PMT_USES_BOOST_ANY)
target_compile_definitions(acq_test
PRIVATE
-DPMT_USES_BOOST_ANY=1
)
endif()
add_test(acq_test acq_test)
if(USE_GENERIC_LAMBDAS)
@ -1091,6 +1107,12 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA)
-DUSE_BOOST_BIND_PLACEHOLDERS=1
)
endif()
if(PMT_USES_BOOST_ANY)
target_compile_definitions(trk_test
PRIVATE
-DPMT_USES_BOOST_ANY=1
)
endif()
add_test(trk_test trk_test)

View File

@ -71,7 +71,8 @@ if(NOT benchmark_FOUND)
IMPORTED_LOCATION_RELEASE ${CMAKE_BINARY_DIR}/benchmark-${GNSSSDR_BENCHMARK_LOCAL_VERSION}/src/Release/${CMAKE_FIND_LIBRARY_PREFIXES}benchmark${CMAKE_STATIC_LIBRARY_SUFFIX}
IMPORTED_LOCATION_RELWITHDEBINFO ${CMAKE_BINARY_DIR}/benchmark-${GNSSSDR_BENCHMARK_LOCAL_VERSION}/src/RelWithDebInfo/${CMAKE_FIND_LIBRARY_PREFIXES}benchmark${CMAKE_STATIC_LIBRARY_SUFFIX}
IMPORTED_LOCATION_MINSIZEREL ${CMAKE_BINARY_DIR}/benchmark-${GNSSSDR_BENCHMARK_LOCAL_VERSION}/src/MinSizeRel/${CMAKE_FIND_LIBRARY_PREFIXES}benchmark${CMAKE_STATIC_LIBRARY_SUFFIX}
INTERFACE_LINK_LIBRARIES "${CMAKE_BINARY_DIR}/benchmark-${GNSSSDR_BENCHMARK_LOCAL_VERSION}/src/$<$<CONFIG:Debug>:Debug/>$<$<CONFIG:Release>:Release/>$<$<CONFIG:RelWithDebInfo>:RelWithDebInfo/>$<$<CONFIG:MinSizeRel>:MinSizeRel/>benchmark${CMAKE_STATIC_LIBRARY_SUFFIX};${CMAKE_BINARY_DIR}/benchmark-${GNSSSDR_BENCHMARK_LOCAL_VERSION}/src/$<$<CONFIG:Debug>:Debug/>$<$<CONFIG:Release>:Release/>$<$<CONFIG:RelWithDebInfo>:RelWithDebInfo/>$<$<CONFIG:MinSizeRel>:MinSizeRel/>benchmark_main${CMAKE_STATIC_LIBRARY_SUFFIX}"
INTERFACE_LINK_LIBRARIES "${CMAKE_BINARY_DIR}/benchmark-${GNSSSDR_BENCHMARK_LOCAL_VERSION}/src/$<$<CONFIG:Debug>:Debug/>$<$<CONFIG:Release>:Release/>$<$<CONFIG:RelWithDebInfo>:RelWithDebInfo/>$<$<CONFIG:MinSizeRel>:MinSizeRel/>benchmark${CMAKE_STATIC_LIBRARY_SUFFIX};
${CMAKE_BINARY_DIR}/benchmark-${GNSSSDR_BENCHMARK_LOCAL_VERSION}/src/$<$<CONFIG:Debug>:Debug/>$<$<CONFIG:Release>:Release/>$<$<CONFIG:RelWithDebInfo>:RelWithDebInfo/>$<$<CONFIG:MinSizeRel>:MinSizeRel/>benchmark_main${CMAKE_STATIC_LIBRARY_SUFFIX}"
)
endif()
set_target_properties(benchmark::benchmark PROPERTIES

View File

@ -23,7 +23,14 @@
void bm_e1b_erasurecorrection_shortened(benchmark::State& state)
{
std::vector<uint8_t> code_vector = {147, 109, 66, 23, 234, 140, 74, 234, 49, 89, 241, 253, 169, 161, 89, 93, 75, 142, 83, 102, 98, 218, 14, 197, 155, 151, 43, 181, 9, 163, 142, 111, 8, 118, 21, 47, 135, 139, 108, 215, 51, 147, 185, 52, 17, 151, 97, 102, 238, 71, 83, 114, 47, 80, 67, 199, 215, 162, 238, 77, 12, 72, 235, 21, 148, 213, 230, 54, 183, 82, 49, 104, 12, 228, 150, 157, 220, 112, 236, 187, 63, 31, 175, 47, 210, 164, 17, 104, 98, 46, 252, 165, 194, 57, 26, 213, 14, 133, 176, 148, 34, 9, 167, 43, 204, 198, 25, 164, 233, 55, 153, 31, 237, 84, 212, 76, 137, 242};
std::vector<uint8_t> code_vector = {147, 109, 66, 23, 234, 140, 74, 234, 49,
89, 241, 253, 169, 161, 89, 93, 75, 142, 83, 102, 98, 218, 14, 197, 155,
151, 43, 181, 9, 163, 142, 111, 8, 118, 21, 47, 135, 139, 108, 215, 51,
147, 185, 52, 17, 151, 97, 102, 238, 71, 83, 114, 47, 80, 67, 199, 215,
162, 238, 77, 12, 72, 235, 21, 148, 213, 230, 54, 183, 82, 49, 104, 12,
228, 150, 157, 220, 112, 236, 187, 63, 31, 175, 47, 210, 164, 17, 104,
98, 46, 252, 165, 194, 57, 26, 213, 14, 133, 176, 148, 34, 9, 167, 43,
204, 198, 25, 164, 233, 55, 153, 31, 237, 84, 212, 76, 137, 242};
auto rs = std::make_unique<ReedSolomon>(60, 29, 1, 195, 0, 137);
@ -74,7 +81,9 @@ void bm_e1b_erasurecorrection_shortened(benchmark::State& state)
// Delete g_0
for (int i = 58; i < 73; i++)
{
erasure_positions.push_back(i + 137); // erasure position refers to the unshortened code, so we add 137
// erasure position refers to the unshortened code, so we
// add 137
erasure_positions.push_back(i + 137);
}
// Delete g_2
@ -99,7 +108,20 @@ void bm_e1b_erasurecorrection_shortened(benchmark::State& state)
void bm_e1b_erasurecorrection_unshortened(benchmark::State& state)
{
std::vector<uint8_t> code_vector = {147, 109, 66, 23, 234, 140, 74, 234, 49, 89, 241, 253, 169, 161, 89, 93, 75, 142, 83, 102, 98, 218, 14, 197, 155, 151, 43, 181, 9, 163, 142, 111, 8, 118, 21, 47, 135, 139, 108, 215, 51, 147, 185, 52, 17, 151, 97, 102, 238, 71, 83, 114, 47, 80, 67, 199, 215, 162, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 238, 77, 12, 72, 235, 21, 148, 213, 230, 54, 183, 82, 49, 104, 12, 228, 150, 157, 220, 112, 236, 187, 63, 31, 175, 47, 210, 164, 17, 104, 98, 46, 252, 165, 194, 57, 26, 213, 14, 133, 176, 148, 34, 9, 167, 43, 204, 198, 25, 164, 233, 55, 153, 31, 237, 84, 212, 76, 137, 242};
std::vector<uint8_t> code_vector = {147, 109, 66, 23, 234, 140, 74, 234, 49,
89, 241, 253, 169, 161, 89, 93, 75, 142, 83, 102, 98, 218, 14, 197, 155,
151, 43, 181, 9, 163, 142, 111, 8, 118, 21, 47, 135, 139, 108, 215, 51,
147, 185, 52, 17, 151, 97, 102, 238, 71, 83, 114, 47, 80, 67, 199, 215,
162, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 238, 77, 12,
72, 235, 21, 148, 213, 230, 54, 183, 82, 49, 104, 12, 228, 150, 157,
220, 112, 236, 187, 63, 31, 175, 47, 210, 164, 17, 104, 98, 46, 252,
165, 194, 57, 26, 213, 14, 133, 176, 148, 34, 9, 167, 43, 204, 198, 25,
164, 233, 55, 153, 31, 237, 84, 212, 76, 137, 242};
auto rs = std::make_unique<ReedSolomon>(60, 29, 1, 195, 0, 137);
@ -150,7 +172,9 @@ void bm_e1b_erasurecorrection_unshortened(benchmark::State& state)
// Delete g_0
for (int i = 58; i < 73; i++)
{
erasure_positions.push_back(i + 137); // erasure position refers to the unshortened code, so we add 137
// erasure position refers to the unshortened code, so we
// add 137
erasure_positions.push_back(i + 137);
}
// Delete g_2
@ -175,10 +199,27 @@ void bm_e1b_erasurecorrection_unshortened(benchmark::State& state)
void bm_e6b_correction(benchmark::State& state)
{
const std::vector<uint8_t> expected_output = {71, 12, 25, 210, 178, 81, 243, 9, 112, 98, 196, 203, 48, 125, 114, 165, 181, 193, 71, 174, 168, 42, 31, 128, 245, 87, 150, 58, 192, 66, 130, 179};
const std::vector<uint8_t> expected_output = {71, 12, 25, 210, 178, 81, 243,
9, 112, 98, 196, 203, 48, 125, 114, 165, 181, 193, 71, 174, 168, 42, 31,
128, 245, 87, 150, 58, 192, 66, 130, 179};
std::vector<uint8_t> encoded_input = {
71, 12, 25, 210, 178, 81, 243, 9, 112, 98, 196, 203, 48, 125, 114, 165, 181, 193, 71, 174, 168, 42, 31, 128, 245, 87, 150, 58, 192, 66, 130, 179, 133, 210, 122, 224, 75, 138, 20, 205, 14, 245, 209, 187, 246, 228, 12, 39, 244, 238, 223, 217, 84, 233, 137, 168, 153, 8, 94, 26, 99, 169, 149, 203, 115, 69, 211, 43, 70, 96, 70, 38, 160, 1, 232, 153, 223, 165, 93, 205, 101, 170, 60, 188, 198, 82, 168, 79, 95, 23, 118, 215, 187, 136, 24, 99, 252, 3, 144, 166, 117, 45, 168, 239, 77, 42, 246, 33, 122, 97, 242, 236, 13, 217, 96, 186, 71, 250, 242, 177, 125, 87, 27, 13, 118, 181, 178, 12, 27, 66, 31, 74, 127, 46, 112, 127, 116, 122, 190, 71, 240, 95, 78, 194, 113, 80, 46, 126, 74, 136, 118, 133, 105, 176, 47, 230, 162, 195, 93, 157, 72, 119, 13, 232, 151, 200, 191, 143, 75, 161, 111, 29, 158, 16, 181, 165, 92, 39, 17, 218, 228, 58, 176, 233, 55, 211, 195, 73, 37, 137, 232, 241, 150, 236, 152, 153, 53, 74, 81, 91, 160, 244, 21, 95, 176, 179, 141, 39, 61, 136, 16, 58, 160, 51, 210, 31, 134, 63, 203, 96, 219, 44, 231, 61, 220, 0, 241, 220, 207, 17, 52, 150, 117, 54, 222, 128, 101, 213, 164, 234, 74, 224, 57, 246, 70, 27, 202, 229, 4, 243, 128, 211, 158, 199, 4};
std::vector<uint8_t> encoded_input = {71, 12, 25, 210, 178, 81, 243, 9, 112,
98, 196, 203, 48, 125, 114, 165, 181, 193, 71, 174, 168, 42, 31, 128,
245, 87, 150, 58, 192, 66, 130, 179, 133, 210, 122, 224, 75, 138, 20,
205, 14, 245, 209, 187, 246, 228, 12, 39, 244, 238, 223, 217, 84, 233,
137, 168, 153, 8, 94, 26, 99, 169, 149, 203, 115, 69, 211, 43, 70, 96,
70, 38, 160, 1, 232, 153, 223, 165, 93, 205, 101, 170, 60, 188, 198, 82,
168, 79, 95, 23, 118, 215, 187, 136, 24, 99, 252, 3, 144, 166, 117, 45,
168, 239, 77, 42, 246, 33, 122, 97, 242, 236, 13, 217, 96, 186, 71, 250,
242, 177, 125, 87, 27, 13, 118, 181, 178, 12, 27, 66, 31, 74, 127, 46,
112, 127, 116, 122, 190, 71, 240, 95, 78, 194, 113, 80, 46, 126, 74,
136, 118, 133, 105, 176, 47, 230, 162, 195, 93, 157, 72, 119, 13, 232,
151, 200, 191, 143, 75, 161, 111, 29, 158, 16, 181, 165, 92, 39, 17,
218, 228, 58, 176, 233, 55, 211, 195, 73, 37, 137, 232, 241, 150, 236,
152, 153, 53, 74, 81, 91, 160, 244, 21, 95, 176, 179, 141, 39, 61, 136,
16, 58, 160, 51, 210, 31, 134, 63, 203, 96, 219, 44, 231, 61, 220, 0,
241, 220, 207, 17, 52, 150, 117, 54, 222, 128, 101, 213, 164, 234, 74,
224, 57, 246, 70, 27, 202, 229, 4, 243, 128, 211, 158, 199, 4};
// Introduce t = (n-k)/2 = 111 errors:
for (int i = 0; i < 222; i += 2)
@ -205,10 +246,27 @@ void bm_e6b_correction(benchmark::State& state)
void bm_e6b_erasure(benchmark::State& state)
{
const std::vector<uint8_t> expected_output = {71, 12, 25, 210, 178, 81, 243, 9, 112, 98, 196, 203, 48, 125, 114, 165, 181, 193, 71, 174, 168, 42, 31, 128, 245, 87, 150, 58, 192, 66, 130, 179};
const std::vector<uint8_t> expected_output = {71, 12, 25, 210, 178, 81, 243,
9, 112, 98, 196, 203, 48, 125, 114, 165, 181, 193, 71, 174, 168, 42, 31,
128, 245, 87, 150, 58, 192, 66, 130, 179};
std::vector<uint8_t> encoded_input = {
71, 12, 25, 210, 178, 81, 243, 9, 112, 98, 196, 203, 48, 125, 114, 165, 181, 193, 71, 174, 168, 42, 31, 128, 245, 87, 150, 58, 192, 66, 130, 179, 133, 210, 122, 224, 75, 138, 20, 205, 14, 245, 209, 187, 246, 228, 12, 39, 244, 238, 223, 217, 84, 233, 137, 168, 153, 8, 94, 26, 99, 169, 149, 203, 115, 69, 211, 43, 70, 96, 70, 38, 160, 1, 232, 153, 223, 165, 93, 205, 101, 170, 60, 188, 198, 82, 168, 79, 95, 23, 118, 215, 187, 136, 24, 99, 252, 3, 144, 166, 117, 45, 168, 239, 77, 42, 246, 33, 122, 97, 242, 236, 13, 217, 96, 186, 71, 250, 242, 177, 125, 87, 27, 13, 118, 181, 178, 12, 27, 66, 31, 74, 127, 46, 112, 127, 116, 122, 190, 71, 240, 95, 78, 194, 113, 80, 46, 126, 74, 136, 118, 133, 105, 176, 47, 230, 162, 195, 93, 157, 72, 119, 13, 232, 151, 200, 191, 143, 75, 161, 111, 29, 158, 16, 181, 165, 92, 39, 17, 218, 228, 58, 176, 233, 55, 211, 195, 73, 37, 137, 232, 241, 150, 236, 152, 153, 53, 74, 81, 91, 160, 244, 21, 95, 176, 179, 141, 39, 61, 136, 16, 58, 160, 51, 210, 31, 134, 63, 203, 96, 219, 44, 231, 61, 220, 0, 241, 220, 207, 17, 52, 150, 117, 54, 222, 128, 101, 213, 164, 234, 74, 224, 57, 246, 70, 27, 202, 229, 4, 243, 128, 211, 158, 199, 4};
std::vector<uint8_t> encoded_input = {71, 12, 25, 210, 178, 81, 243, 9, 112,
98, 196, 203, 48, 125, 114, 165, 181, 193, 71, 174, 168, 42, 31, 128,
245, 87, 150, 58, 192, 66, 130, 179, 133, 210, 122, 224, 75, 138, 20,
205, 14, 245, 209, 187, 246, 228, 12, 39, 244, 238, 223, 217, 84, 233,
137, 168, 153, 8, 94, 26, 99, 169, 149, 203, 115, 69, 211, 43, 70, 96,
70, 38, 160, 1, 232, 153, 223, 165, 93, 205, 101, 170, 60, 188, 198, 82,
168, 79, 95, 23, 118, 215, 187, 136, 24, 99, 252, 3, 144, 166, 117, 45,
168, 239, 77, 42, 246, 33, 122, 97, 242, 236, 13, 217, 96, 186, 71, 250,
242, 177, 125, 87, 27, 13, 118, 181, 178, 12, 27, 66, 31, 74, 127, 46,
112, 127, 116, 122, 190, 71, 240, 95, 78, 194, 113, 80, 46, 126, 74,
136, 118, 133, 105, 176, 47, 230, 162, 195, 93, 157, 72, 119, 13, 232,
151, 200, 191, 143, 75, 161, 111, 29, 158, 16, 181, 165, 92, 39, 17,
218, 228, 58, 176, 233, 55, 211, 195, 73, 37, 137, 232, 241, 150, 236,
152, 153, 53, 74, 81, 91, 160, 244, 21, 95, 176, 179, 141, 39, 61, 136,
16, 58, 160, 51, 210, 31, 134, 63, 203, 96, 219, 44, 231, 61, 220, 0,
241, 220, 207, 17, 52, 150, 117, 54, 222, 128, 101, 213, 164, 234, 74,
224, 57, 246, 70, 27, 202, 229, 4, 243, 128, 211, 158, 199, 4};
// Introduce 223 erasures:
std::vector<int> erasure_positions;

File diff suppressed because one or more lines are too long

View File

@ -49,6 +49,11 @@
#include <boost/bind/bind.hpp>
#endif
#if PMT_USES_BOOST_ANY
namespace wht = boost;
#else
namespace wht = std;
#endif
DEFINE_string(config_file_ptest, std::string(""), "File containing alternative configuration parameters for the acquisition performance test.");
DEFINE_string(acq_test_input_file, std::string(""), "File containing raw signal data, must be in int8_t format. The signal generator will not be used.");
@ -119,7 +124,7 @@ void AcqPerfTest_msg_rx::msg_handler_channel_events(const pmt::pmt_t msg)
rx_message = message;
channel_internal_queue.push(rx_message);
}
catch (const boost::bad_any_cast& e)
catch (const wht::bad_any_cast& e)
{
LOG(WARNING) << "msg_handler_channel_events Bad any_cast: " << e.what();
rx_message = 0;
@ -540,7 +545,8 @@ int AcquisitionPerformanceTest::configure_receiver(double cn0, float pfa, unsign
config->set_property("Acquisition.dump", "false");
}
std::string dump_file = path_str + std::string("/acquisition_") + std::to_string(cn0) + "_" + std::to_string(iter) + "_" + std::to_string(pfa);
// std::string dump_file = path_str + std::string("/acquisition_") + std::to_string(cn0) + "_" + std::to_string(iter) + "_" + std::to_string(pfa);
std::string dump_file = path_str + std::string("/acquisition_") + std::to_string(static_cast<int>(cn0)) + "_" + std::to_string(iter) + "_" + std::to_string(static_cast<int>(pfa * 1.0e5));
config->set_property("Acquisition.dump_filename", dump_file);
config->set_property("Acquisition.dump_channel", std::to_string(dump_channel));
config->set_property("Acquisition.blocking_on_standby", "true");
@ -719,7 +725,7 @@ void AcquisitionPerformanceTest::plot_results()
for (int k = 0; k < num_thresholds; k++)
{
Pd_i.push_back(Pd[i][k]);
Pfa_i.push_back(Pfa[i][k]);
Pfa_i.push_back(pfa_vector[k]);
}
g1.plot_xy(Pfa_i, Pd_i, "CN0 = " + std::to_string(static_cast<int>(cn0_vector[i])) + " dBHz");
}
@ -755,7 +761,7 @@ void AcquisitionPerformanceTest::plot_results()
for (int k = 0; k < num_thresholds; k++)
{
Pd_i_correct.push_back(Pd_correct[i][k]);
Pfa_i.push_back(Pfa[i][k]);
Pfa_i.push_back(pfa_vector[k]);
}
g2.plot_xy(Pfa_i, Pd_i_correct, "CN0 = " + std::to_string(static_cast<int>(cn0_vector[i])) + " dBHz");
}
@ -778,6 +784,7 @@ TEST_F(AcquisitionPerformanceTest, ROC)
if (fs::exists(path_str))
{
std::cout << "Deleting old files at " << path_str << " ...\n";
fs::remove_all(path_str);
}
errorlib::error_code ec;
@ -840,7 +847,7 @@ TEST_F(AcquisitionPerformanceTest, ROC)
run_receiver();
// count executions
std::string basename = path_str + std::string("/acquisition_") + std::to_string(it) + "_" + std::to_string(iter) + "_" + std::to_string(pfa_vector[pfa_iter]) + "_" + gnss_synchro.System + "_" + signal_id;
std::string basename = path_str + std::string("/acquisition_") + std::to_string(static_cast<int>(it)) + "_" + std::to_string(iter) + "_" + std::to_string(static_cast<int>(pfa_vector[pfa_iter] * 1e-5)) + "_" + gnss_synchro.System + "_" + signal_id;
int num_executions = count_executions(basename, observed_satellite);
// Read measured data
@ -983,7 +990,7 @@ TEST_F(AcquisitionPerformanceTest, ROC)
{
meas_Pd_.push_back(0.0);
}
std::cout << TEXT_BOLD_BLACK << "Probability of detection for channel=" << ch << ", CN0=" << it << " dBHz"
std::cout << TEXT_BOLD_BLUE << "Probability of detection for channel=" << ch << ", CN0=" << it << " dBHz"
<< ": " << (num_executions > 0 ? computed_Pd : 0.0) << TEXT_RESET << '\n';
}
if (num_clean_executions > 0)
@ -1000,7 +1007,7 @@ TEST_F(AcquisitionPerformanceTest, ROC)
}
double computed_Pd_correct = correctly_detected / static_cast<double>(num_clean_executions);
meas_Pd_correct_.push_back(computed_Pd_correct);
std::cout << TEXT_BOLD_BLACK << "Probability of correct detection for channel=" << ch << ", CN0=" << it << " dBHz"
std::cout << TEXT_BOLD_BLUE << "Probability of correct detection for channel=" << ch << ", CN0=" << it << " dBHz"
<< ": " << computed_Pd_correct << TEXT_RESET << '\n';
}
else
@ -1018,7 +1025,7 @@ TEST_F(AcquisitionPerformanceTest, ROC)
{
meas_Pfa_.push_back(0.0);
}
std::cout << TEXT_BOLD_BLACK << "Probability of false alarm for channel=" << ch << ", CN0=" << it << " dBHz"
std::cout << TEXT_BOLD_BLUE << "Probability of false alarm for channel=" << ch << ", CN0=" << it << " dBHz"
<< ": " << (num_executions > 0 ? computed_Pfa : 0.0) << TEXT_RESET << '\n';
}
}

View File

@ -50,6 +50,12 @@
#include <gnuradio/analog/sig_source_c.h>
#endif
#if PMT_USES_BOOST_ANY
namespace wht = boost;
#else
namespace wht = std;
#endif
// ######## GNURADIO BLOCK MESSAGE RECEVER #########
class BeidouB1iPcpsAcquisitionTest_msg_rx;
@ -84,7 +90,7 @@ void BeidouB1iPcpsAcquisitionTest_msg_rx::msg_handler_channel_events(const pmt::
int64_t message = pmt::to_long(std::move(msg));
rx_message = message;
}
catch (const boost::bad_any_cast &e)
catch (const wht::bad_any_cast &e)
{
LOG(WARNING) << "msg_handler_channel_events Bad any_cast: " << e.what();
rx_message = 0;

View File

@ -50,6 +50,11 @@
#include <gnuradio/analog/sig_source_c.h>
#endif
#if PMT_USES_BOOST_ANY
namespace wht = boost;
#else
namespace wht = std;
#endif
// ######## GNURADIO BLOCK MESSAGE RECEVER #########
class BeidouB3iPcpsAcquisitionTest_msg_rx;
@ -84,7 +89,7 @@ void BeidouB3iPcpsAcquisitionTest_msg_rx::msg_handler_channel_events(const pmt::
int64_t message = pmt::to_long(std::move(msg));
rx_message = message;
}
catch (const boost::bad_any_cast &e)
catch (const wht::bad_any_cast &e)
{
LOG(WARNING) << "msg_handler_channel_events Bad any_cast: " << e.what();
rx_message = 0;

View File

@ -44,6 +44,11 @@
#else
#include <gnuradio/analog/sig_source_c.h>
#endif
#if PMT_USES_BOOST_ANY
namespace wht = boost;
#else
namespace wht = std;
#endif
// ######## GNURADIO BLOCK MESSAGE RECEVER #########
@ -82,7 +87,7 @@ void GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx::msg_handler_channe
rx_message = message;
channel_internal_queue.push(rx_message);
}
catch (const boost::bad_any_cast& e)
catch (const wht::bad_any_cast& e)
{
LOG(WARNING) << "msg_handler_channel_events Bad any_cast: " << e.what();
rx_message = 0;

View File

@ -42,6 +42,11 @@
#else
#include <gnuradio/analog/sig_source_c.h>
#endif
#if PMT_USES_BOOST_ANY
namespace wht = boost;
#else
namespace wht = std;
#endif
// ######## GNURADIO BLOCK MESSAGE RECEVER #########
class GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx;
@ -79,7 +84,7 @@ void GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx::msg_handler_channel_e
rx_message = message;
channel_internal_queue.push(rx_message);
}
catch (const boost::bad_any_cast& e)
catch (const wht::bad_any_cast& e)
{
LOG(WARNING) << "msg_handler_channel_events Bad any_cast: " << e.what();
rx_message = 0;

View File

@ -52,6 +52,11 @@
#else
#include <gnuradio/analog/sig_source_c.h>
#endif
#if PMT_USES_BOOST_ANY
namespace wht = boost;
#else
namespace wht = std;
#endif
// ######## GNURADIO BLOCK MESSAGE RECEVER #########
class GalileoE1PcpsAmbiguousAcquisitionGSoCTest_msg_rx;
@ -89,7 +94,7 @@ void GalileoE1PcpsAmbiguousAcquisitionGSoCTest_msg_rx::msg_handler_channel_event
rx_message = message;
channel_internal_queue.push(rx_message);
}
catch (const boost::bad_any_cast& e)
catch (const wht::bad_any_cast& e)
{
LOG(WARNING) << "msg_handler_channel_events Bad any_cast: " << e.what();
rx_message = 0;

View File

@ -52,6 +52,12 @@
#include <gnuradio/analog/sig_source_c.h>
#endif
#if PMT_USES_BOOST_ANY
namespace wht = boost;
#else
namespace wht = std;
#endif
// ######## GNURADIO BLOCK MESSAGE RECEVER #########
class GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx;
@ -86,7 +92,7 @@ void GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx::msg_handler_channel_events(co
int64_t message = pmt::to_long(std::move(msg));
rx_message = message;
}
catch (const boost::bad_any_cast& e)
catch (const wht::bad_any_cast& e)
{
LOG(WARNING) << "msg_handler_channel_events Bad any_cast: " << e.what();
rx_message = 0;

View File

@ -45,7 +45,11 @@
#else
#include <gnuradio/analog/sig_source_c.h>
#endif
#if PMT_USES_BOOST_ANY
namespace wht = boost;
#else
namespace wht = std;
#endif
// ######## GNURADIO BLOCK MESSAGE RECEVER #########
class GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx;
@ -83,7 +87,7 @@ void GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx::msg_handler_channel_eve
rx_message = message;
channel_internal_queue.push(rx_message);
}
catch (const boost::bad_any_cast& e)
catch (const wht::bad_any_cast& e)
{
LOG(WARNING) << "msg_handler_channel_events Bad any_cast: " << e.what();
rx_message = 0;

View File

@ -47,6 +47,11 @@
#else
#include <gnuradio/analog/sig_source_c.h>
#endif
#if PMT_USES_BOOST_ANY
namespace wht = boost;
#else
namespace wht = std;
#endif
DEFINE_double(e1_value_threshold, 0.3, "Value of the threshold for the acquisition");
DEFINE_int32(e1_value_CN0_dB_0, 50, "Value for the CN0_dB_0 in channel 0");
@ -88,7 +93,7 @@ void GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx::msg_handler_
rx_message = message;
channel_internal_queue.push(rx_message);
}
catch (const boost::bad_any_cast& e)
catch (const wht::bad_any_cast& e)
{
LOG(WARNING) << "msg_handler_channel_events Bad any_cast: " << e.what();
rx_message = 0;

View File

@ -46,6 +46,11 @@
#else
#include <gnuradio/analog/sig_source_c.h>
#endif
#if PMT_USES_BOOST_ANY
namespace wht = boost;
#else
namespace wht = std;
#endif
// ######## GNURADIO BLOCK MESSAGE RECEVER #########
class GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test_msg_rx;
@ -83,7 +88,7 @@ void GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test_msg_rx::msg_handler_chann
rx_message = message;
channel_internal_queue.push(rx_message);
}
catch (const boost::bad_any_cast& e)
catch (const wht::bad_any_cast& e)
{
LOG(WARNING) << "msg_handler_channel_events Bad any_cast: " << e.what();
rx_message = 0;

View File

@ -42,6 +42,11 @@
#else
#include <gnuradio/analog/sig_source_c.h>
#endif
#if PMT_USES_BOOST_ANY
namespace wht = boost;
#else
namespace wht = std;
#endif
// ######## GNURADIO BLOCK MESSAGE RECEVER #########
class GalileoE5aPcpsAcquisitionGSoC2014GensourceTest_msg_rx;
@ -79,7 +84,7 @@ void GalileoE5aPcpsAcquisitionGSoC2014GensourceTest_msg_rx::msg_handler_channel_
rx_message = message;
channel_internal_queue.push(rx_message);
}
catch (const boost::bad_any_cast& e)
catch (const wht::bad_any_cast& e)
{
LOG(WARNING) << "msg_handler_channel_events Bad any_cast: " << e.what();
rx_message = 0;

View File

@ -49,6 +49,12 @@
#include <gnuradio/analog/sig_source_c.h>
#endif
#if PMT_USES_BOOST_ANY
namespace wht = boost;
#else
namespace wht = std;
#endif
// ######## GNURADIO BLOCK MESSAGE RECEVER #########
class GalileoE5bPcpsAcquisitionTest_msg_rx;
@ -84,7 +90,7 @@ void GalileoE5bPcpsAcquisitionTest_msg_rx::msg_handler_channel_events(const pmt:
rx_message = message;
channel_internal_queue.push(rx_message);
}
catch (const boost::bad_any_cast& e)
catch (const wht::bad_any_cast& e)
{
std::cout << "msg_handler_telemetry Bad any cast!" << std::endl;
rx_message = 0;

View File

@ -49,6 +49,12 @@
#include <gnuradio/analog/sig_source_c.h>
#endif
#if PMT_USES_BOOST_ANY
namespace wht = boost;
#else
namespace wht = std;
#endif
// ######## GNURADIO BLOCK MESSAGE RECEVER #########
class GalileoE6PcpsAcquisitionTest_msg_rx;
@ -84,7 +90,7 @@ void GalileoE6PcpsAcquisitionTest_msg_rx::msg_handler_channel_events(const pmt::
rx_message = message;
channel_internal_queue.push(rx_message);
}
catch (const boost::bad_any_cast& e)
catch (const wht::bad_any_cast& e)
{
std::cout << "msg_handler_telemetry Bad any cast!" << std::endl;
rx_message = 0;

View File

@ -48,6 +48,11 @@
#else
#include <gnuradio/analog/sig_source_c.h>
#endif
#if PMT_USES_BOOST_ANY
namespace wht = boost;
#else
namespace wht = std;
#endif
// ######## GNURADIO BLOCK MESSAGE RECEVER #########
class GlonassL1CaPcpsAcquisitionGSoC2017Test_msg_rx;
@ -85,7 +90,7 @@ void GlonassL1CaPcpsAcquisitionGSoC2017Test_msg_rx::msg_handler_channel_events(c
rx_message = message;
channel_internal_queue.push(rx_message);
}
catch (const boost::bad_any_cast& e)
catch (const wht::bad_any_cast& e)
{
LOG(WARNING) << "msg_handler_channel_events Bad any_cast: " << e.what();
rx_message = 0;

View File

@ -42,7 +42,11 @@
#else
#include <gnuradio/analog/sig_source_c.h>
#endif
#if PMT_USES_BOOST_ANY
namespace wht = boost;
#else
namespace wht = std;
#endif
// ######## GNURADIO BLOCK MESSAGE RECEVER #########
class GlonassL1CaPcpsAcquisitionTest_msg_rx;
@ -77,7 +81,7 @@ void GlonassL1CaPcpsAcquisitionTest_msg_rx::msg_handler_channel_events(const pmt
int64_t message = pmt::to_long(std::move(msg));
rx_message = message;
}
catch (const boost::bad_any_cast& e)
catch (const wht::bad_any_cast& e)
{
std::cout << "msg_handler_telemetry Bad any cast!\n";
rx_message = 0;

View File

@ -46,6 +46,11 @@
#else
#include <gnuradio/analog/sig_source_c.h>
#endif
#if PMT_USES_BOOST_ANY
namespace wht = boost;
#else
namespace wht = std;
#endif
// ######## GNURADIO BLOCK MESSAGE RECEVER #########
class GlonassL2CaPcpsAcquisitionTest_msg_rx;
@ -83,7 +88,7 @@ void GlonassL2CaPcpsAcquisitionTest_msg_rx::msg_handler_channel_events(const pmt
rx_message = message;
channel_internal_queue.push(rx_message);
}
catch (const boost::bad_any_cast& e)
catch (const wht::bad_any_cast& e)
{
LOG(WARNING) << "msg_handler_channel_events Bad any_cast: " << e.what();
rx_message = 0;

View File

@ -48,7 +48,11 @@
#else
#include <gnuradio/analog/sig_source_c.h>
#endif
#if PMT_USES_BOOST_ANY
namespace wht = boost;
#else
namespace wht = std;
#endif
// ######## GNURADIO BLOCK MESSAGE RECEVER #########
class GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx;
@ -86,7 +90,7 @@ void GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx::msg_handler_channel_events(const
rx_message = message;
channel_internal_queue.push(rx_message);
}
catch (const boost::bad_any_cast& e)
catch (const wht::bad_any_cast& e)
{
LOG(WARNING) << "msg_handler_channel_events Bad any_cast: " << e.what();
rx_message = 0;

View File

@ -34,6 +34,7 @@
#include <gnuradio/blocks/null_sink.h>
#include <gnuradio/top_block.h>
#include <gtest/gtest.h>
#include <pmt/pmt.h>
#include <chrono>
#include <memory>
#include <utility>
@ -49,6 +50,11 @@
#include <gnuradio/analog/sig_source_c.h>
#endif
#if PMT_USES_BOOST_ANY
namespace wht = boost;
#else
namespace wht = std;
#endif
// ######## GNURADIO BLOCK MESSAGE RECEVER #########
class GpsL1CaPcpsAcquisitionTest_msg_rx;
@ -83,7 +89,7 @@ void GpsL1CaPcpsAcquisitionTest_msg_rx::msg_handler_channel_events(const pmt::pm
int64_t message = pmt::to_long(msg);
rx_message = message;
}
catch (const boost::bad_any_cast &e)
catch (const wht::bad_any_cast &e)
{
LOG(WARNING) << "msg_handler_channel_events Bad any_cast: " << e.what();
rx_message = 0;

View File

@ -32,6 +32,7 @@
#include <gnuradio/blocks/file_source.h>
#include <gnuradio/blocks/null_sink.h>
#include <gnuradio/top_block.h>
#include <pmt/pmt.h>
#include <chrono>
#include <memory>
#include <thread>
@ -44,6 +45,11 @@
#else
#include <gnuradio/analog/sig_source_c.h>
#endif
#if PMT_USES_BOOST_ANY
namespace wht = boost;
#else
namespace wht = std;
#endif
// ######## GNURADIO BLOCK MESSAGE RECEVER #########
class GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx;
@ -81,7 +87,7 @@ void GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx::msg_handler_channel_events
rx_message = message;
channel_internal_queue.push(rx_message);
}
catch (const boost::bad_any_cast& e)
catch (const wht::bad_any_cast& e)
{
LOG(WARNING) << "msg_handler_channel_events Bad any_cast: " << e.what();
rx_message = 0;

View File

@ -31,6 +31,7 @@
#include <gnuradio/blocks/null_sink.h>
#include <gnuradio/top_block.h>
#include <gtest/gtest.h>
#include <pmt/pmt.h>
#include <chrono>
#include <stdexcept>
#include <thread>
@ -44,6 +45,11 @@
#else
#include <gnuradio/analog/sig_source_c.h>
#endif
#if PMT_USES_BOOST_ANY
namespace wht = boost;
#else
namespace wht = std;
#endif
DEFINE_double(value_threshold, 1, "Value of the threshold for the acquisition");
DEFINE_int32(value_CN0_dB_0, 44, "Value for the CN0_dB_0 in channel 0");
@ -85,7 +91,7 @@ void GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test_msg_rx::msg_handler_channel_eve
rx_message = message;
channel_internal_queue.push(rx_message);
}
catch (const boost::bad_any_cast& e)
catch (const wht::bad_any_cast& e)
{
LOG(WARNING) << "msg_handler_channel_events Bad any_cast: " << e.what();
rx_message = 0;

View File

@ -33,6 +33,7 @@
#include <gnuradio/blocks/null_sink.h>
#include <gnuradio/top_block.h>
#include <gtest/gtest.h>
#include <pmt/pmt.h>
#include <chrono>
#include <memory>
#include <thread>
@ -46,6 +47,11 @@
#else
#include <gnuradio/analog/sig_source_c.h>
#endif
#if PMT_USES_BOOST_ANY
namespace wht = boost;
#else
namespace wht = std;
#endif
// ######## GNURADIO BLOCK MESSAGE RECEVER #########
class GpsL1CaPcpsTongAcquisitionGSoC2013Test_msg_rx;
@ -83,7 +89,7 @@ void GpsL1CaPcpsTongAcquisitionGSoC2013Test_msg_rx::msg_handler_channel_events(c
rx_message = message;
channel_internal_queue.push(rx_message);
}
catch (const boost::bad_any_cast& e)
catch (const wht::bad_any_cast& e)
{
LOG(WARNING) << "msg_handler_channel_events Bad any_cast: " << e.what();
rx_message = 0;

View File

@ -36,6 +36,7 @@
#include <gnuradio/blocks/null_sink.h>
#include <gnuradio/top_block.h>
#include <gtest/gtest.h>
#include <pmt/pmt.h>
#include <chrono>
#include <utility>
@ -50,6 +51,11 @@
#include <gnuradio/analog/sig_source_c.h>
#endif
#if PMT_USES_BOOST_ANY
namespace wht = boost;
#else
namespace wht = std;
#endif
// ######## GNURADIO BLOCK MESSAGE RECEVER #########
class GpsL2MPcpsAcquisitionTest_msg_rx;
@ -82,7 +88,7 @@ void GpsL2MPcpsAcquisitionTest_msg_rx::msg_handler_channel_events(const pmt::pmt
int64_t message = pmt::to_long(std::move(msg));
rx_message = message;
}
catch (const boost::bad_any_cast &e)
catch (const wht::bad_any_cast &e)
{
LOG(WARNING) << "msg_handler_channel_events Bad any_cast: " << e.what();
rx_message = 0;

View File

@ -39,6 +39,7 @@ target_link_libraries(signal_processing_testing_lib
Armadillo::armadillo
Gflags::gflags
Gnuradio::runtime
Gnuradio::pmt
PRIVATE
Boost::headers
Matio::matio
@ -80,6 +81,12 @@ if(GNURADIO_USES_STD_POINTERS)
)
endif()
if(PMT_USES_BOOST_ANY)
target_compile_definitions(signal_processing_testing_lib
PRIVATE
-DPMT_USES_BOOST_ANY=1
)
endif()
if(ENABLE_CLANG_TIDY)
if(CLANG_TIDY_EXE)

View File

@ -26,6 +26,14 @@
#include <boost/bind/bind.hpp>
#endif
#if PMT_USES_BOOST_ANY
#include <boost/any.hpp>
namespace wht = boost;
#else
#include <any>
namespace wht = std;
#endif
Acquisition_msg_rx_sptr Acquisition_msg_rx_make()
{
return Acquisition_msg_rx_sptr(new Acquisition_msg_rx());
@ -40,7 +48,7 @@ void Acquisition_msg_rx::msg_handler_channel_events(const pmt::pmt_t& msg)
rx_message = message;
top_block->stop(); // stop the flowgraph
}
catch (const boost::bad_any_cast& e)
catch (const wht::bad_any_cast& e)
{
LOG(WARNING) << "msg_handler_acquisition Bad cast!\n";
rx_message = 0;

View File

@ -64,21 +64,29 @@
#include <gpstk/RinexUtilities.hpp>
#include <gtest/gtest.h>
#include <matio.h>
#include <pmt/pmt.h>
#include <chrono>
#include <cmath>
#include <exception>
#include <unistd.h>
#include <utility>
#if HAS_GENERIC_LAMBDA
#else
#include <boost/bind/bind.hpp>
#endif
#ifdef GR_GREATER_38
#include <gnuradio/filter/fir_filter_blk.h>
#else
#include <gnuradio/filter/fir_filter_ccf.h>
#endif
#if PMT_USES_BOOST_ANY
namespace wht = boost;
#else
namespace wht = std;
#endif
// ######## GNURADIO BLOCK MESSAGE RECEVER FOR TRACKING MESSAGES #########
class HybridObservablesTest_msg_rx;
@ -114,7 +122,7 @@ void HybridObservablesTest_msg_rx::msg_handler_channel_events(const pmt::pmt_t m
int64_t message = pmt::to_long(std::move(msg));
rx_message = message;
}
catch (const boost::bad_any_cast& e)
catch (const wht::bad_any_cast& e)
{
LOG(WARNING) << "msg_handler_channel_events Bad any_cast: " << e.what();
rx_message = 0;
@ -180,7 +188,7 @@ void HybridObservablesTest_tlm_msg_rx::msg_handler_channel_events(const pmt::pmt
int64_t message = pmt::to_long(std::move(msg));
rx_message = message;
}
catch (const boost::bad_any_cast& e)
catch (const wht::bad_any_cast& e)
{
LOG(WARNING) << "msg_handler_channel_events Bad any_cast: " << e.what();
rx_message = 0;

View File

@ -63,22 +63,30 @@
#include <gpstk/RinexUtilities.hpp>
#include <gtest/gtest.h>
#include <matio.h>
#include <pmt/pmt.h>
#include <chrono>
#include <cmath>
#include <exception>
#include <pthread.h>
#include <unistd.h>
#include <utility>
#if HAS_GENERIC_LAMBDA
#else
#include <boost/bind/bind.hpp>
#endif
#ifdef GR_GREATER_38
#include <gnuradio/filter/fir_filter_blk.h>
#else
#include <gnuradio/filter/fir_filter_ccf.h>
#endif
#if PMT_USES_BOOST_ANY
namespace wht = boost;
#else
namespace wht = std;
#endif
class HybridObservablesTest_msg_rx_Fpga;
@ -112,7 +120,7 @@ void HybridObservablesTest_msg_rx_Fpga::msg_handler_channel_events(const pmt::pm
int64_t message = pmt::to_long(std::move(msg));
rx_message = message;
}
catch (const boost::bad_any_cast& e)
catch (const wht::bad_any_cast& e)
{
LOG(WARNING) << "msg_handler_channel_events Bad any_cast: " << e.what();
rx_message = 0;
@ -175,7 +183,7 @@ void HybridObservablesTest_tlm_msg_rx_Fpga::msg_handler_channel_events(const pmt
int64_t message = pmt::to_long(std::move(msg));
rx_message = message;
}
catch (const boost::bad_any_cast& e)
catch (const wht::bad_any_cast& e)
{
LOG(WARNING) << "msg_handler_channel_events Bad any_cast: " << e.what();
rx_message = 0;

View File

@ -46,11 +46,18 @@
#include <gnuradio/blocks/null_sink.h>
#include <gnuradio/blocks/skiphead.h>
#include <gtest/gtest.h>
#include <pmt/pmt.h>
#if HAS_GENERIC_LAMBDA
#else
#include <boost/bind/bind.hpp>
#endif
#if PMT_USES_BOOST_ANY
namespace wht = boost;
#else
namespace wht = std;
#endif
// ######## GNURADIO BLOCK MESSAGE RECEVER FOR TRACKING MESSAGES #########
class GpsL1CADllPllTelemetryDecoderTest_msg_rx;
@ -83,7 +90,7 @@ void GpsL1CADllPllTelemetryDecoderTest_msg_rx::msg_handler_channel_events(const
int64_t message = pmt::to_long(std::move(msg));
rx_message = message;
}
catch (const boost::bad_any_cast& e)
catch (const wht::bad_any_cast& e)
{
LOG(WARNING) << "msg_handler_channel_events Bad any_cast: " << e.what();
rx_message = 0;
@ -143,7 +150,7 @@ void GpsL1CADllPllTelemetryDecoderTest_tlm_msg_rx::msg_handler_channel_events(co
int64_t message = pmt::to_long(std::move(msg));
rx_message = message;
}
catch (const boost::bad_any_cast& e)
catch (const wht::bad_any_cast& e)
{
LOG(WARNING) << "msg_handler_channel_events Bad any_cast: " << e.what();
rx_message = 0;

View File

@ -29,12 +29,18 @@
#include <gnuradio/blocks/skiphead.h>
#include <gnuradio/top_block.h>
#include <gtest/gtest.h>
#include <pmt/pmt.h>
#include <chrono>
#include <utility>
#if HAS_GENERIC_LAMBDA
#else
#include <boost/bind/bind.hpp>
#endif
#if PMT_USES_BOOST_ANY
namespace wht = boost;
#else
namespace wht = std;
#endif
// ######## GNURADIO BLOCK MESSAGE RECEVER #########
class GlonassL1CaDllPllCAidTrackingTest_msg_rx;
@ -67,7 +73,7 @@ void GlonassL1CaDllPllCAidTrackingTest_msg_rx::msg_handler_channel_events(const
int64_t message = pmt::to_long(std::move(msg));
rx_message = message;
}
catch (const boost::bad_any_cast& e)
catch (const wht::bad_any_cast& e)
{
LOG(WARNING) << "msg_handler_channel_events Bad any_cast: " << e.what();
rx_message = 0;

Some files were not shown because too many files have changed in this diff Show More