From b6c7e4a6f1d782a710b26483cb4956c55df76ce0 Mon Sep 17 00:00:00 2001 From: Jeff Melville Date: Tue, 20 Sep 2022 10:16:02 -0400 Subject: [PATCH 01/59] Fix register unpacking for Labsat3W files This change fixes a bug in the unpacking of Labsat 3 Wideband files when using the Labsat_Signal_Source. The original endian conversion loop includes a cast from char->uint64_t that (surprisingly) incurs a sign extension when the MSB of the char is set. ORing the unmasked uint64_t into the register can set undesired bits. The changes replace the old endian conversion loop with a ``boost`` utility function. Signed-off-by: Jeff Melville --- .../gnuradio_blocks/labsat23_source.cc | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/algorithms/signal_source/gnuradio_blocks/labsat23_source.cc b/src/algorithms/signal_source/gnuradio_blocks/labsat23_source.cc index ea92274f3..2c88841fc 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/labsat23_source.cc +++ b/src/algorithms/signal_source/gnuradio_blocks/labsat23_source.cc @@ -21,6 +21,7 @@ #include "INIReader.h" #include "command_event.h" #include "gnss_sdr_make_unique.h" +#include #include #include #include @@ -737,7 +738,8 @@ void labsat23_source::decode_ls3w_register(uint64_t input, std::vector bs(input); - // Reverse, since register are written to file as 64-bit little endian words + // Earlier samples are written in the MSBs of the register. Bit-reverse the register + // for easier indexing. Note this bit-reverses individual samples as well for quant > 1 bit for (std::size_t i = 0; i < 32; ++i) { bool t = bs[i]; @@ -1074,14 +1076,10 @@ int labsat23_source::general_work(int noutput_items, std::size_t output_pointer = 0; for (int i = 0; i < registers_to_read; i++) { - std::array memory_block{}; - binary_input_file.read(memory_block.data(), 8); uint64_t read_register = 0ULL; - for (int k = 7; k >= 0; --k) - { - read_register <<= 8; - read_register |= uint64_t(memory_block[k]); - } + // Labsat3W writes its 64-bit shift register to files in little endian. Read and convert to host endianness. + binary_input_file.read(reinterpret_cast(&read_register), sizeof(read_register)); + boost::endian::little_to_native_inplace(read_register); if (binary_input_file.gcount() == 8) { From de165e2a51f1c4d34d30e95fbc1c1ec34d276919 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 25 Oct 2022 14:50:16 +0200 Subject: [PATCH 02/59] Update local version of gnsstk to 13.7.0 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index deb09a97e..1d4094faf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -343,7 +343,7 @@ else() set(GNSSSDR_GTEST_LOCAL_VERSION "1.12.1") endif() set(GNSSSDR_GNSS_SIM_LOCAL_VERSION "master") -set(GNSSSDR_GNSSTK_LOCAL_VERSION "13.4.0") +set(GNSSSDR_GNSSTK_LOCAL_VERSION "13.7.0") set(GNSSSDR_MATIO_LOCAL_VERSION "1.5.23") set(GNSSSDR_PUGIXML_LOCAL_VERSION "1.12") set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "21.5") From f2c56a1766aa6f8fc45764695524880a9142f377 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 25 Oct 2022 14:53:37 +0200 Subject: [PATCH 03/59] Make CMake modules work for Windows --- cmake/Modules/FindGNSSTK.cmake | 2 ++ cmake/Modules/FindMATIO.cmake | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/cmake/Modules/FindGNSSTK.cmake b/cmake/Modules/FindGNSSTK.cmake index 3826f30a0..e810ebee7 100644 --- a/cmake/Modules/FindGNSSTK.cmake +++ b/cmake/Modules/FindGNSSTK.cmake @@ -127,6 +127,7 @@ if(GNSSTK_FOUND AND NOT ENABLE_OWN_GNSSTK AND NOT TARGET Gnsstk::gnsstk) IMPORTED_LOCATION "${GNSSTK_LIBRARY}" INTERFACE_INCLUDE_DIRECTORIES "${GNSSTK_INCLUDE_DIR};${GNSSTK_INCLUDE_DIR}/gpstk" INTERFACE_LINK_LIBRARIES "${GNSSTK_LIBRARY}" + IMPORTED_IMPLIB "${GNSSTK_LIBRARY}" ) else() set_target_properties(Gnsstk::gnsstk PROPERTIES @@ -134,6 +135,7 @@ if(GNSSTK_FOUND AND NOT ENABLE_OWN_GNSSTK AND NOT TARGET Gnsstk::gnsstk) IMPORTED_LOCATION "${GNSSTK_LIBRARY}" INTERFACE_INCLUDE_DIRECTORIES "${GNSSTK_INCLUDE_DIR};${GNSSTK_INCLUDE_DIR}/gnsstk" INTERFACE_LINK_LIBRARIES "${GNSSTK_LIBRARY}" + IMPORTED_IMPLIB "${GNSSTK_LIBRARY}" ) endif() endif() diff --git a/cmake/Modules/FindMATIO.cmake b/cmake/Modules/FindMATIO.cmake index 712995d7b..49e0bf8cd 100644 --- a/cmake/Modules/FindMATIO.cmake +++ b/cmake/Modules/FindMATIO.cmake @@ -75,12 +75,13 @@ find_path(MATIO_INCLUDE_DIR /usr/include /usr/local/include /opt/local/include + ${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include DOC "The MATIO include directory" ) # Look for the library. find_library(MATIO_LIBRARY - NAMES matio + NAMES matio libmatio PATHS ${MATIO_ROOT_USER_DEFINED}/lib ${MATIO_ROOT_USER_DEFINED}/lib64 @@ -110,6 +111,7 @@ find_library(MATIO_LIBRARY /usr/local/lib /usr/local/lib64 /opt/local/lib + ${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib DOC "The MATIO library" ) @@ -182,5 +184,6 @@ if(MATIO_FOUND AND NOT TARGET Matio::matio) IMPORTED_LOCATION "${MATIO_LIBRARY}" INTERFACE_INCLUDE_DIRECTORIES "${MATIO_INCLUDE_DIR}" INTERFACE_LINK_LIBRARIES "${MATIO_LIBRARY}" + IMPORTED_IMPLIB "${MATIO_LIBRARY}" ) endif() From de8640aa1d7edc4014f8674ecd1c226e0c5222f8 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 26 Oct 2022 21:57:59 +0200 Subject: [PATCH 04/59] Bump local version of ProtocolBuffers to 21.8 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1d4094faf..f9b767919 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -346,7 +346,7 @@ set(GNSSSDR_GNSS_SIM_LOCAL_VERSION "master") set(GNSSSDR_GNSSTK_LOCAL_VERSION "13.7.0") set(GNSSSDR_MATIO_LOCAL_VERSION "1.5.23") set(GNSSSDR_PUGIXML_LOCAL_VERSION "1.12") -set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "21.5") +set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "21.8") set(GNSSSDR_BENCHMARK_LOCAL_VERSION "1.7.0") set(GNSSSDR_MATHJAX_EXTERNAL_VERSION "2.7.7") From 0133d7be941f2b6e17d642edba04103ec7c37b7f Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 11 Nov 2022 21:36:34 +0100 Subject: [PATCH 05/59] Update benchmark to 1.7.1 --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f9b767919..4fd3fb1d3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -346,8 +346,8 @@ set(GNSSSDR_GNSS_SIM_LOCAL_VERSION "master") set(GNSSSDR_GNSSTK_LOCAL_VERSION "13.7.0") set(GNSSSDR_MATIO_LOCAL_VERSION "1.5.23") set(GNSSSDR_PUGIXML_LOCAL_VERSION "1.12") -set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "21.8") -set(GNSSSDR_BENCHMARK_LOCAL_VERSION "1.7.0") +set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "21.9") +set(GNSSSDR_BENCHMARK_LOCAL_VERSION "1.7.1") set(GNSSSDR_MATHJAX_EXTERNAL_VERSION "2.7.7") if(CMAKE_VERSION VERSION_LESS "3.16") From 16f0b4c862bf63012e240dd1a0b7aa3908924fcd Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 12 Nov 2022 09:45:08 +0100 Subject: [PATCH 06/59] Update local version of Pugixml to 1.13 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4fd3fb1d3..2a03bb7fe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -345,7 +345,7 @@ endif() set(GNSSSDR_GNSS_SIM_LOCAL_VERSION "master") set(GNSSSDR_GNSSTK_LOCAL_VERSION "13.7.0") set(GNSSSDR_MATIO_LOCAL_VERSION "1.5.23") -set(GNSSSDR_PUGIXML_LOCAL_VERSION "1.12") +set(GNSSSDR_PUGIXML_LOCAL_VERSION "1.13") set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "21.9") set(GNSSSDR_BENCHMARK_LOCAL_VERSION "1.7.1") set(GNSSSDR_MATHJAX_EXTERNAL_VERSION "2.7.7") From 20f4b539a44f561cf9ecb252b13ff7bb94b8cc63 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 12 Nov 2022 09:53:36 +0100 Subject: [PATCH 07/59] Improve Table of Contents --- README.md | 327 +++++++++++++++++++++++++++--------------------------- 1 file changed, 166 insertions(+), 161 deletions(-) diff --git a/README.md b/README.md index 59742d294..d4c3485b0 100644 --- a/README.md +++ b/README.md @@ -59,58 +59,60 @@ information about this open-source, software-defined GNSS receiver. (click to expand) -1. [How to build GNSS-SDR](#how-to-build-gnss-sdr) +1. [Table of Contents](#table-of-contents) +2. [How to build GNSS-SDR](#how-to-build-gnss-sdr) 1. [GNU/Linux](#gnulinux) 1. [Alternative 1: Install dependencies using software packages](#alternative-1-install-dependencies-using-software-packages) - - [Debian / Ubuntu](#debian--ubuntu) - - [Arch Linux](#arch-linux) - - [CentOS](#centos) - - [Fedora](#fedora) - - [OpenSUSE](#opensuse) - - [Rocky Linux](#rocky-linux) - 1. [Alternative 2: Install dependencies using PyBOMBS](#alternative-2-install-dependencies-using-pybombs) - - [Manual installation of other required dependencies](#manual-installation-of-other-required-dependencies) - - [Armadillo](#install-armadillo-a-c-linear-algebra-library) - - [gflags](#install-gflags-a-commandline-flags-processing-module-for-c) - - [google-glog](#install-glog-a-library-that-implements-application-level-logging) - - [googletest](#download-the-google-c-testing-framework-also-known-as-google-test) - - [GnuTLS or OpenSSL](#install-the-gnutls-or-openssl-libraries) - - [matio](#install-matio-matlab-mat-file-io-library) - - [Protocol Buffers](#install-protocol-buffers-a-portable-mechanism-for-serialization-of-structured-data) - - [pugixml](#install-pugixml-a-light-weight-c-xml-processing-library) - 1. [Clone GNSS-SDR's Git repository](#clone-gnss-sdrs-git-repository) - 1. [Build and install GNSS-SDR](#build-and-install-gnss-sdr) - - [Build OsmoSDR support (optional)](#build-osmosdr-support-optional) - - [Build IIO support (optional)](#build-fmcomms2-based-sdr-hardware-support-optional) - - [Build OpenCL support (optional)](#build-opencl-support-optional) - - [Build CUDA support (optional)](#build-cuda-support-optional) - - [Build a portable binary](#build-a-portable-binary) - 1. [macOS](#macos) + 1. [Debian / Ubuntu](#debian--ubuntu) + 2. [Arch Linux](#arch-linux) + 3. [CentOS](#centos) + 4. [Fedora](#fedora) + 5. [openSUSE](#opensuse) + 6. [Rocky Linux](#rocky-linux) + 2. [Alternative 2: Install dependencies using PyBOMBS](#alternative-2-install-dependencies-using-pybombs) + 3. [Manual installation of other required dependencies](#manual-installation-of-other-required-dependencies) + 1. [Install Armadillo, a C++ linear algebra library](#install-armadillo-a-c-linear-algebra-library) + 2. [Install Gflags, a commandline flags processing module for C++](#install-gflags-a-commandline-flags-processing-module-for-c) + 3. [Install Glog, a library that implements application-level logging](#install-glog-a-library-that-implements-application-level-logging) + 4. [Install the GnuTLS or OpenSSL libraries](#install-the-gnutls-or-openssl-libraries) + 5. [Install Matio, MATLAB MAT file I/O library](#install-matio-matlab-mat-file-io-library) + 6. [Install Protocol Buffers, a portable mechanism for serialization of structured data](#install-protocol-buffers-a-portable-mechanism-for-serialization-of-structured-data) + 7. [Install Pugixml, a light-weight C++ XML processing library](#install-pugixml-a-light-weight-c-xml-processing-library) + 8. [Download GoogleTest](#download-googletest) + 4. [Clone GNSS-SDR's Git repository](#clone-gnss-sdrs-git-repository) + 5. [Build and install GNSS-SDR](#build-and-install-gnss-sdr) + 1. [Build OSMOSDR support (OPTIONAL)](#build-osmosdr-support-optional) + 2. [Build FMCOMMS2 based SDR Hardware support (OPTIONAL)](#build-fmcomms2-based-sdr-hardware-support-optional) + 3. [Build OpenCL support (OPTIONAL)](#build-opencl-support-optional) + 4. [Build CUDA support (OPTIONAL)](#build-cuda-support-optional) + 5. [Build a portable binary](#build-a-portable-binary) + 2. [macOS](#macos) 1. [Macports](#macports) - 1. [Homebrew](#homebrew) - 1. [Build GNSS-SDR](#build-gnss-sdr) - 1. [Other builds](#other-builds) -1. [Updating GNSS-SDR](#updating-gnss-sdr) -1. [Getting started](#getting-started) -1. [Using GNSS-SDR](#using-gnss-sdr) - 1. [Control Plane](#control-plane) + 2. [Homebrew](#homebrew) + 3. [Other package managers](#other-package-managers) + 4. [Build GNSS-SDR](#build-gnss-sdr) + 3. [Other builds](#other-builds) +3. [Updating GNSS-SDR](#updating-gnss-sdr) +4. [Getting started](#getting-started) +5. [Using GNSS-SDR](#using-gnss-sdr) + 1. [Control plane](#control-plane) 1. [Configuration](#configuration) - 1. [GNSS block factory](#gnss-block-factory) - 1. [Signal Processing Plane](#signal-processing-plane) + 2. [GNSS block factory](#gnss-block-factory) + 2. [Signal Processing plane](#signal-processing-plane) 1. [Signal Source](#signal-source) - 1. [Signal Conditioner](#signal-conditioner) - - [Data type adapter](#data-type-adapter) - - [Input filter](#input-filter) - - [Resampler](#resampler) - 1. [Channel](#channel) - - [Acquisition](#acquisition) - - [Tracking](#tracking) - - [Decoding of the navigation message](#decoding-of-the-navigation-message) - 1. [Observables](#observables) - 1. [Computation of Position, Velocity and Time](#computation-of-position-velocity-and-time) -1. [About the software license](#about-the-software-license) -1. [Publications and Credits](#publications-and-credits) -1. [Ok, now what?](#ok-now-what) + 2. [Signal Conditioner](#signal-conditioner) + 1. [Data type adapter](#data-type-adapter) + 2. [Input filter](#input-filter) + 3. [Resampler](#resampler) + 3. [Channel](#channel) + 1. [Acquisition](#acquisition) + 2. [Tracking](#tracking) + 3. [Decoding of the navigation message](#decoding-of-the-navigation-message) + 4. [Observables](#observables) + 5. [Computation of Position, Velocity and Time](#computation-of-position-velocity-and-time) +6. [About the software license](#about-the-software-license) +7. [Publications and Credits](#publications-and-credits) +8. [Ok, now what?](#ok-now-what) @@ -118,7 +120,7 @@ information about this open-source, software-defined GNSS receiver. # How to build GNSS-SDR This section describes how to set up the compilation environment in GNU/Linux or -[macOS / Mac OS X](#macosx), and to build GNSS-SDR. See also our +[macOS / Mac OS X](#macos), and to build GNSS-SDR. See also our [build and install page](https://gnss-sdr.org/build-and-install/ "GNSS-SDR's Build and Install"). ## GNU/Linux @@ -197,7 +199,7 @@ above. Install `libtool`, `automake` and `libhdf5-dev` instead. You will also need `python-six`. Once you have installed these packages, you can jump directly to -[download the source code and build GNSS-SDR](#download-and-build-linux). +[download the source code and build GNSS-SDR](#clone-gnss-sdrs-git-repository). #### Arch Linux @@ -210,7 +212,7 @@ $ pacman -S gcc make cmake pkgconf git boost boost-libs log4cpp libvolk gnuradio ``` Once you have installed these packages, you can jump directly to -[download the source code and build GNSS-SDR](#download-and-build-linux). +[download the source code and build GNSS-SDR](#clone-gnss-sdrs-git-repository). #### CentOS @@ -229,7 +231,7 @@ $ sudo yum install make automake gcc gcc-c++ kernel-devel libtool \ ``` Once you have installed these packages, you can jump directly to -[download the source code and build GNSS-SDR](#download-and-build-linux). +[download the source code and build GNSS-SDR](#clone-gnss-sdrs-git-repository). #### Fedora @@ -275,7 +277,7 @@ $ zypper install cmake git gcc-c++ boost-devel libboost_atomic-devel \ ``` Once you have installed these packages, you can jump directly to -[download the source code and build GNSS-SDR](#download-and-build-linux). +[download the source code and build GNSS-SDR](#clone-gnss-sdrs-git-repository). #### Rocky Linux @@ -293,7 +295,7 @@ $ yum install -y make gcc gcc-c++ kernel-devel cmake git boost-devel \ ``` Once you have installed these packages, you can jump directly to -[download the source code and build GNSS-SDR](#download-and-build-linux). +[download the source code and build GNSS-SDR](#clone-gnss-sdrs-git-repository). ### Alternative 2: Install dependencies using PyBOMBS @@ -374,11 +376,11 @@ $ pybombs install armadillo gflags glog gnutls matio ``` or manually as explained below, and then please follow instructions on how to -[download the source code and build GNSS-SDR](#download-and-build-linux). +[download the source code and build GNSS-SDR](#clone-gnss-sdrs-git-repository). ### Manual installation of other required dependencies -#### Install [Armadillo](http://arma.sourceforge.net/ "Armadillo's Homepage"), a C++ linear algebra library: +#### Install [Armadillo](http://arma.sourceforge.net/ "Armadillo's Homepage"), a C++ linear algebra library ``` $ sudo apt-get install libblas-dev liblapack-dev # For Debian/Ubuntu/LinuxMint @@ -400,7 +402,7 @@ correspondingly. CMake will also generate a run-time armadillo library, which is a combined alias for all the relevant libraries present on your system (e.g., BLAS, LAPACK, and ATLAS). -#### Install [Gflags](https://github.com/gflags/gflags "Gflags' Homepage"), a commandline flags processing module for C++: +#### Install [Gflags](https://github.com/gflags/gflags "Gflags' Homepage"), a commandline flags processing module for C++ ``` $ wget https://github.com/gflags/gflags/archive/v2.2.2.tar.gz @@ -412,7 +414,7 @@ $ sudo make install $ sudo ldconfig ``` -#### Install [Glog](https://github.com/google/glog "Glog's Homepage"), a library that implements application-level logging: +#### Install [Glog](https://github.com/google/glog "Glog's Homepage"), a library that implements application-level logging ``` $ wget https://github.com/google/glog/archive/v0.6.0.tar.gz @@ -425,7 +427,73 @@ $ sudo make install $ sudo ldconfig ``` -#### Download the [Google C++ Testing Framework](https://github.com/google/googletest "Googletest Homepage"), also known as Google Test: +#### Install the GnuTLS or OpenSSL libraries + +``` +$ sudo apt-get install libgnutls-openssl-dev # For Debian/Ubuntu/LinuxMint +$ sudo yum install openssl-devel # For Fedora/CentOS/RHEL +$ sudo zypper install openssl-devel # For OpenSUSE +$ sudo pacman -S openssl # For Arch Linux +``` + +In case the [GnuTLS](https://www.gnutls.org/ "GnuTLS's Homepage") library with +openssl extensions package is not available in your GNU/Linux distribution, +GNSS-SDR can also work well with +[OpenSSL](https://www.openssl.org/ "OpenSSL's Homepage"). + +#### Install [Matio](https://github.com/tbeu/matio "Matio's Homepage"), MATLAB MAT file I/O library + +``` +$ wget https://github.com/tbeu/matio/releases/download/v1.5.23/matio-1.5.23.tar.gz +$ tar xvfz matio-1.5.23.tar.gz +$ cd matio-1.5.23 +$ ./configure +$ make +$ sudo make install +$ sudo ldconfig +``` + +#### Install [Protocol Buffers](https://developers.google.com/protocol-buffers/ "Protocol Buffers' Homepage"), a portable mechanism for serialization of structured data + +GNSS-SDR requires Protocol Buffers v3.0.0 or later. If the packages that come +with your distribution are older than that (_e.g._, Ubuntu 16.04 Xenial and +Debian 8 Jessie came with older versions), then you will need to install it +manually. First, install the dependencies: + +``` +$ sudo apt-get install autoconf automake libtool curl make g++ unzip +``` + +and then: + +``` +$ git clone https://github.com/protocolbuffers/protobuf.git +$ cd protobuf +$ git submodule update --init --recursive +$ ./autogen.sh +$ /configure +$ make -j$(nproc) +$ sudo make install +$ sudo ldconfig +``` + +For more options, please check the +[Protocol Buffers' installation instructions](https://github.com/protocolbuffers/protobuf/blob/main/src/README.md/). + +#### Install [Pugixml](https://pugixml.org/ "Pugixml's Homepage"), a light-weight C++ XML processing library + +``` +$ wget https://github.com/zeux/pugixml/releases/download/v1.13/pugixml-1.13.tar.gz +$ tar xvfz pugixml-1.13.tar.gz +$ cd pugixml-1.13 +$ mkdir build && cd build +$ cmake .. +$ make +$ sudo make install +$ sudo ldconfig +``` + +#### Download [GoogleTest](https://github.com/google/googletest "Googletest Homepage") ``` $ wget https://github.com/google/googletest/archive/release-1.12.1.zip @@ -462,71 +530,9 @@ environment variable is not defined, or the source code is not installed by a package, then it will download a fresh copy of the Google Test source code and will compile and link it for you. -#### Install the [GnuTLS](https://www.gnutls.org/ "GnuTLS's Homepage") or [OpenSSL](https://www.openssl.org/ "OpenSSL's Homepage") libraries: + -``` -$ sudo apt-get install libgnutls-openssl-dev # For Debian/Ubuntu/LinuxMint -$ sudo yum install openssl-devel # For Fedora/CentOS/RHEL -$ sudo zypper install openssl-devel # For OpenSUSE -$ sudo pacman -S openssl # For Arch Linux -``` - -In case the GnuTLS library with openssl extensions package is not available in -your GNU/Linux distribution, GNSS-SDR can also work well with OpenSSL. - -#### Install [Matio](https://github.com/tbeu/matio "Matio's Homepage"), MATLAB MAT file I/O library: - -``` -$ wget https://github.com/tbeu/matio/releases/download/v1.5.23/matio-1.5.23.tar.gz -$ tar xvfz matio-1.5.23.tar.gz -$ cd matio-1.5.23 -$ ./configure -$ make -$ sudo make install -$ sudo ldconfig -``` - -#### Install [Protocol Buffers](https://developers.google.com/protocol-buffers/ "Protocol Buffers' Homepage"), a portable mechanism for serialization of structured data: - -GNSS-SDR requires Protocol Buffers v3.0.0 or later. If the packages that come -with your distribution are older than that (_e.g._, Ubuntu 16.04 Xenial and -Debian 8 Jessie came with older versions), then you will need to install it -manually. First, install the dependencies: - -``` -$ sudo apt-get install autoconf automake libtool curl make g++ unzip -``` - -and then: - -``` -$ git clone https://github.com/protocolbuffers/protobuf.git -$ cd protobuf -$ git submodule update --init --recursive -$ ./autogen.sh -$ /configure -$ make -j$(nproc) -$ sudo make install -$ sudo ldconfig -``` - -For more options, please check the -[Protocol Buffers' installation instructions](https://github.com/protocolbuffers/protobuf/blob/main/src/README.md/). - -#### Install [Pugixml](https://pugixml.org/ "Pugixml's Homepage"), a light-weight C++ XML processing library: - -``` -$ wget https://github.com/zeux/pugixml/releases/download/v1.12/pugixml-1.12.tar.gz -$ tar xvfz pugixml-1.12.tar.gz -$ cd pugixml-1.12 -$ mkdir build && cd build -$ cmake .. -$ make -$ sudo make install -$ sudo ldconfig -``` - -### Clone GNSS-SDR's Git repository: +### Clone GNSS-SDR's Git repository ``` $ git clone https://github.com/gnss-sdr/gnss-sdr @@ -665,7 +671,7 @@ and then import the created project into Eclipse: After building the project, you will find the generated binaries at `eclipse/install`. -###### Build OSMOSDR support (OPTIONAL): +#### Build OSMOSDR support (OPTIONAL) Install the [OsmoSDR](https://osmocom.org/projects/sdr "OsmoSDR's Homepage") library and GNU Radio's source block: @@ -701,7 +707,7 @@ $ sudo make install (in order to disable the `Osmosdr_Signal_Source` compilation, you can pass `-DENABLE_OSMOSDR=OFF` to cmake and build GNSS-SDR again). -###### Build FMCOMMS2 based SDR Hardware support (OPTIONAL): +#### Build FMCOMMS2 based SDR Hardware support (OPTIONAL) Install the [libiio](https://github.com/analogdevicesinc/libiio.git) (>=v0.11), [libad9361](https://github.com/analogdevicesinc/libad9361-iio.git) (>=v0.1-1) @@ -757,7 +763,7 @@ The `Plutosdr_Signal_Source` offers a simpler manner to use the ADALM-PLUTO because implements only a subset of FMCOMMS2's parameters valid for those devices. -###### Build OpenCL support (OPTIONAL): +#### Build OpenCL support (OPTIONAL) In order to enable the building of blocks that use OpenCL, type: @@ -767,7 +773,7 @@ $ make $ sudo make install ``` -###### Build CUDA support (OPTIONAL): +#### Build CUDA support (OPTIONAL) In order to enable the building of blocks that use CUDA, NVIDIA's parallel programming model that enables graphics processing unit (GPU) acceleration for @@ -784,7 +790,7 @@ $ sudo make install Of course, you will also need a GPU that [supports CUDA](https://developer.nvidia.com/cuda-gpus "CUDA GPUs"). -###### Build a portable binary +#### Build a portable binary In order to build an executable that not depends on the specific SIMD instruction set that is present in the processor of the compiling machine, so @@ -804,7 +810,7 @@ substitutes a generic, non-SIMD implementation. More details can be found in our tutorial about [GNSS-SDR configuration options at building time](https://gnss-sdr.org/docs/tutorials/using-git/ "Configuration options at building time"). -## macOS +## macOS GNSS-SDR can be built on macOS (or the former Mac OS X), starting from 10.9 (Mavericks) and including 11 (Big Sur). If you still have not installed @@ -827,7 +833,7 @@ $ sudo xcodebuild -license Software pre-requisites can be installed using either [Macports](#macports) or [Homebrew](#homebrew). -#### Macports +### Macports First, [install Macports](https://www.macports.org/install.php). If you are upgrading from a previous installation, please follow the @@ -857,7 +863,7 @@ and you can activate a certain version by typing: $ sudo port select --set python python37 ``` -#### Homebrew +### Homebrew First, install [Homebrew](https://brew.sh/). Paste this in a terminal prompt: @@ -886,7 +892,32 @@ $ brew install --cask mactex # when completed, restart Terminal $ brew install graphviz doxygen ``` -#### Build GNSS-SDR +### Other package managers + +GNU Radio and other dependencies can also be installed using other package +managers than Macports, such as [Fink](http://www.finkproject.org/ "Fink"). +Since the version of Python that ships with OS X is great for learning but it is +not good for development, you could have another Python executable in a +non-standard location. If that is the case, you need to inform GNSS-SDR's +configuration system by defining the `PYTHON_EXECUTABLE` variable as: + +``` +$ cmake -DPYTHON_EXECUTABLE=/path/to/bin/python3 .. +``` + +In case you have installed Macports in a non-standard location, you can use: + +``` +$ cmake -DCMAKE_PREFIX_PATH=/opt/local -DUSE_MACPORTS_PYTHON=/opt/local/bin/python .. +``` + +changing `/opt/local` by the base directory in which your software is installed. + +The CMake script will create Makefiles that download, build and link Armadillo, +Gflags, Glog, Matio, Protocol Buffers, PugiXML and Google Test on the fly at +compile time if they are not detected in your machine. + +### Build GNSS-SDR Finally, you are ready to clone the GNSS-SDR repository, configure and build the software: @@ -933,32 +964,6 @@ the function to execute. It mimics GNU Radio's [VOLK](https://www.libvolk.org/) library, so if you still have not run `volk_profile`, this is a good moment to do so. -###### Other package managers - -GNU Radio and other dependencies can also be installed using other package -managers than Macports, such as [Fink](http://www.finkproject.org/ "Fink") or -[Homebrew](https://brew.sh/ "Homebrew"). Since the version of Python that ships -with OS X is great for learning but it is not good for development, you could -have another Python executable in a non-standard location. If that is the case, -you need to inform GNSS-SDR's configuration system by defining the -`PYTHON_EXECUTABLE` variable as: - -``` -cmake -DPYTHON_EXECUTABLE=/path/to/bin/python3 .. -``` - -In case you have installed Macports in a non-standard location, you can use: - -``` -$ cmake -DCMAKE_PREFIX_PATH=/opt/local -DUSE_MACPORTS_PYTHON=/opt/local/bin/python .. -``` - -changing `/opt/local` by the base directory in which your software is installed. - -The CMake script will create Makefiles that download, build and link Armadillo, -Gflags, Glog, Matio, Protocol Buffers, PugiXML and Google Test on the fly at -compile time if they are not detected in your machine. - ## Other builds - **Docker image**: A technology providing operating-system-level virtualization @@ -982,10 +987,10 @@ compile time if they are not detected in your machine. - **GNSS-SDR in embedded platforms**: we provide a Software Development Kit (SDK) based on [OpenEmbedded](http://www.openembedded.org/wiki/Main_Page) for cross-compiling GNSS-SDR in your desktop computer and for producing - executables that can run in embedded platforms, such as a Zedboard or a - Raspberry Pi 3. Visit - [Cross-compiling GNSS-SDR](https://gnss-sdr.org/docs/tutorials/cross-compiling/) - for instructions. + executables that can run in embedded platforms, such as Xilinx's Zynq and + ZynqMP architectures, Raspberry Pi, and many others. Please check + [yocto-geniux](https://github.com/carlesfernandez/yocto-geniux) for + instructions on how to build bootable images. # Updating GNSS-SDR From c7eeeb034299e4ba90c6674d96eee66d6de9dba7 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 12 Nov 2022 10:27:04 +0100 Subject: [PATCH 08/59] Improve indentation --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index d4c3485b0..9fa4c0ecd 100644 --- a/README.md +++ b/README.md @@ -108,8 +108,8 @@ information about this open-source, software-defined GNSS receiver. 1. [Acquisition](#acquisition) 2. [Tracking](#tracking) 3. [Decoding of the navigation message](#decoding-of-the-navigation-message) - 4. [Observables](#observables) - 5. [Computation of Position, Velocity and Time](#computation-of-position-velocity-and-time) + 4. [Observables](#observables) + 5. [Computation of Position, Velocity, and Time](#computation-of-position-velocity-and-time) 6. [About the software license](#about-the-software-license) 7. [Publications and Credits](#publications-and-credits) 8. [Ok, now what?](#ok-now-what) @@ -1926,7 +1926,7 @@ TelemetryDecoder_1B.dump=false More documentation at the [Telemetry Decoder Blocks page](https://gnss-sdr.org/docs/sp-blocks/telemetry-decoder/). -#### Observables +### Observables GNSS systems provide different kinds of observations. The most commonly used are the code observations, also called pseudoranges. The _pseudo_ comes from the @@ -1954,7 +1954,7 @@ Observables.dump_filename=./observables.dat More documentation at the [Observables Blocks page](https://gnss-sdr.org/docs/sp-blocks/observables/). -#### Computation of Position, Velocity and Time +### Computation of Position, Velocity, and Time Although data processing for obtaining high-accuracy PVT solutions is out of the scope of GNSS-SDR, we provide a module that can compute position fixes (stored From 0db9c2c442566a5d65a37f33b8b19218b49e60b1 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 23 Nov 2022 10:04:03 +0100 Subject: [PATCH 09/59] Bump minimum CMake version for benchmarks --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2a03bb7fe..259c92410 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -132,7 +132,7 @@ if(ENABLE_FPGA) endif() option(ENABLE_BENCHMARKS "Build code snippets benchmarks" OFF) -if(CMAKE_VERSION VERSION_LESS 3.5.1) +if(CMAKE_VERSION VERSION_LESS 3.16.3) set(ENABLE_BENCHMARKS OFF) endif() From a8e7392f4a2896401f87ba0f8ab37f01ddda8a83 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 24 Nov 2022 09:12:33 +0100 Subject: [PATCH 10/59] Make clang-format happy --- src/algorithms/libs/opencl/cl.hpp | 116 +++++++++--------- ...glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc | 4 +- .../gps_l1_ca_gaussian_tracking_cc.cc | 4 +- src/utils/front-end-cal/front_end_cal.cc | 2 +- 4 files changed, 63 insertions(+), 63 deletions(-) diff --git a/src/algorithms/libs/opencl/cl.hpp b/src/algorithms/libs/opencl/cl.hpp index 12cc7ded7..5b07e0091 100644 --- a/src/algorithms/libs/opencl/cl.hpp +++ b/src/algorithms/libs/opencl/cl.hpp @@ -187,7 +187,7 @@ #if !defined(CL_CALLBACK) #define CL_CALLBACK -#endif //CL_CALLBACK +#endif // CL_CALLBACK #include #include @@ -1070,8 +1070,8 @@ namespace detail #define __DEFAULT_INITIALIZED 4 /* - * Compare and exchange primitives are needed for handling of defaults - */ + * Compare and exchange primitives are needed for handling of defaults + */ #ifdef CL_HPP_CPP11_ATOMICS_SUPPORTED inline int compare_exchange(std::atomic* dest, int exchange, int comparand) @@ -3460,9 +3460,9 @@ public: bool readOnly, bool useHostPtr = false, cl_int* err = nullptr); /*! - * \brief Construct a Buffer from a host container via iterators using a specified queue. - * If useHostPtr is specified iterators must represent contiguous data. - */ + * \brief Construct a Buffer from a host container via iterators using a specified queue. + * If useHostPtr is specified iterators must represent contiguous data. + */ template Buffer(const CommandQueue& queue, IteratorType startIterator, IteratorType endIterator, bool readOnly, bool useHostPtr = false, cl_int* err = nullptr); @@ -3626,13 +3626,13 @@ public: } /*! \brief Copy constructor to forward copy to the superclass correctly. - * Required for MSVC. - */ + * Required for MSVC. + */ BufferD3D10(const BufferD3D10& buf) : Buffer(buf) {} /*! \brief Copy assignment to forward copy to the superclass correctly. - * Required for MSVC. - */ + * Required for MSVC. + */ BufferD3D10& operator=(const BufferD3D10& buf) { Buffer::operator=(buf); @@ -3641,13 +3641,13 @@ public: #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED) /*! \brief Move constructor to forward move to the superclass correctly. - * Required for MSVC. - */ + * Required for MSVC. + */ BufferD3D10(BufferD3D10&& buf) CL_HPP_NOEXCEPT : Buffer(std::move(buf)) {} /*! \brief Move assignment to forward move to the superclass correctly. - * Required for MSVC. - */ + * Required for MSVC. + */ BufferD3D10& operator=(BufferD3D10&& buf) { Buffer::operator=(std::move(buf)); @@ -3713,13 +3713,13 @@ public: } /*! \brief Copy constructor to forward copy to the superclass correctly. - * Required for MSVC. - */ + * Required for MSVC. + */ BufferGL(const BufferGL& buf) : Buffer(buf) {} /*! \brief Copy assignment to forward copy to the superclass correctly. - * Required for MSVC. - */ + * Required for MSVC. + */ BufferGL& operator=(const BufferGL& buf) { Buffer::operator=(buf); @@ -3728,13 +3728,13 @@ public: #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED) /*! \brief Move constructor to forward move to the superclass correctly. - * Required for MSVC. - */ + * Required for MSVC. + */ BufferGL(BufferGL&& buf) CL_HPP_NOEXCEPT : Buffer(std::move(buf)) {} /*! \brief Move assignment to forward move to the superclass correctly. - * Required for MSVC. - */ + * Required for MSVC. + */ BufferGL& operator=(BufferGL&& buf) { Buffer::operator=(std::move(buf)); @@ -4703,26 +4703,26 @@ public: #endif // #if defined(CL_VERSION_1_2) /*! \brief Class interface for GL Render Buffer Memory Objects. -* -* This is provided to facilitate interoperability with OpenGL. -* -* See Memory for details about copy semantics, etc. -* -* \see Memory -*/ + * + * This is provided to facilitate interoperability with OpenGL. + * + * See Memory for details about copy semantics, etc. + * + * \see Memory + */ class BufferRenderGL : #if defined(CL_VERSION_1_2) public ImageGL #else // #if defined(CL_VERSION_1_2) public Image2DGL -#endif //#if defined(CL_VERSION_1_2) +#endif // #if defined(CL_VERSION_1_2) { public: /*! \brief Constructs a BufferRenderGL in a specified context, from a given - * GL Renderbuffer. - * - * Wraps clCreateFromGLRenderbuffer(). - */ + * GL Renderbuffer. + * + * Wraps clCreateFromGLRenderbuffer(). + */ BufferRenderGL( const Context& context, cl_mem_flags flags, @@ -4748,12 +4748,12 @@ public: BufferRenderGL() : ImageGL(){}; #else // #if defined(CL_VERSION_1_2) BufferRenderGL() : Image2DGL(){}; -#endif //#if defined(CL_VERSION_1_2) +#endif // #if defined(CL_VERSION_1_2) /*! \brief Constructor from cl_mem - takes ownership. - * - * See Memory for further details. - */ + * + * See Memory for further details. + */ #if defined(CL_VERSION_1_2) __CL_EXPLICIT_CONSTRUCTORS BufferRenderGL(const cl_mem& buffer) : ImageGL(buffer) { @@ -4762,27 +4762,27 @@ public: __CL_EXPLICIT_CONSTRUCTORS BufferRenderGL(const cl_mem& buffer) : Image2DGL(buffer) { } -#endif //#if defined(CL_VERSION_1_2) +#endif // #if defined(CL_VERSION_1_2) /*! \brief Assignment from cl_mem - performs shallow copy. - * - * See Memory for further details. - */ + * + * See Memory for further details. + */ BufferRenderGL& operator=(const cl_mem& rhs) { #if defined(CL_VERSION_1_2) ImageGL::operator=(rhs); #else // #if defined(CL_VERSION_1_2) Image2DGL::operator=(rhs); -#endif //#if defined(CL_VERSION_1_2) +#endif // #if defined(CL_VERSION_1_2) return *this; } /*! \brief Copy constructor to forward copy to the superclass correctly. - * Required for MSVC. - */ + * Required for MSVC. + */ #if defined(CL_VERSION_1_2) BufferRenderGL(const BufferRenderGL& buf) : ImageGL(buf) { @@ -4791,25 +4791,25 @@ public: BufferRenderGL(const BufferRenderGL& buf) : Image2DGL(buf) { } -#endif //#if defined(CL_VERSION_1_2) +#endif // #if defined(CL_VERSION_1_2) /*! \brief Copy assignment to forward copy to the superclass correctly. - * Required for MSVC. - */ + * Required for MSVC. + */ BufferRenderGL& operator=(const BufferRenderGL& rhs) { #if defined(CL_VERSION_1_2) ImageGL::operator=(rhs); #else // #if defined(CL_VERSION_1_2) Image2DGL::operator=(rhs); -#endif //#if defined(CL_VERSION_1_2) +#endif // #if defined(CL_VERSION_1_2) return *this; } #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED) /*! \brief Move constructor to forward move to the superclass correctly. - * Required for MSVC. - */ + * Required for MSVC. + */ #if defined(CL_VERSION_1_2) BufferRenderGL(BufferRenderGL&& buf) CL_HPP_NOEXCEPT : ImageGL(std::move(buf)) { @@ -4818,19 +4818,19 @@ public: BufferRenderGL(BufferRenderGL&& buf) CL_HPP_NOEXCEPT : Image2DGL(std::move(buf)) { } -#endif //#if defined(CL_VERSION_1_2) +#endif // #if defined(CL_VERSION_1_2) /*! \brief Move assignment to forward move to the superclass correctly. - * Required for MSVC. - */ + * Required for MSVC. + */ BufferRenderGL& operator=(BufferRenderGL&& buf) { #if defined(CL_VERSION_1_2) ImageGL::operator=(std::move(buf)); #else // #if defined(CL_VERSION_1_2) Image2DGL::operator=(std::move(buf)); -#endif //#if defined(CL_VERSION_1_2) +#endif // #if defined(CL_VERSION_1_2) return *this; } @@ -5066,7 +5066,7 @@ Local(::size_t size) return ret; } -//class KernelFunctor; +// class KernelFunctor; /*! \brief Class interface for cl_kernel. * @@ -5780,8 +5780,8 @@ public: } } /*! - * \brief Constructs a CommandQueue for an implementation defined device in the given context - */ + * \brief Constructs a CommandQueue for an implementation defined device in the given context + */ explicit CommandQueue( const Context& context, cl_command_queue_properties properties = 0, diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc index 74bc090ff..e1bd7b419 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc @@ -713,7 +713,7 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at d_correlation_length_samples = K_prn_samples + d_rem_code_phase_integer_samples; d_rem_code_phase_samples = d_rem_code_phase_samples - d_rem_code_phase_integer_samples; - //################### PLL COMMANDS ################################################# + // ################### PLL COMMANDS ################################################# // carrier phase step (NCO phase increment per sample) [rads/sample] d_carrier_phase_step_rad = TWO_PI * d_carrier_frequency_hz / static_cast(d_fs_in); d_acc_carrier_phase_cycles -= d_carrier_phase_step_rad * d_correlation_length_samples / TWO_PI; @@ -722,7 +722,7 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at // remnant carrier phase [rad] d_rem_carrier_phase_rad = fmod(d_rem_carrier_phase_rad + TWO_PI * d_carrier_frequency_hz * CORRECTED_INTEGRATION_TIME_S, TWO_PI); - //################### DLL COMMANDS ################################################# + // ################### DLL COMMANDS ################################################# // code phase step (Code resampler phase increment per sample) [chips/sample] d_code_phase_step_chips = d_code_freq_chips / static_cast(d_fs_in); // remnant code phase [chips] diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_gaussian_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_gaussian_tracking_cc.cc index af432dec8..47870fba2 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_gaussian_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_gaussian_tracking_cc.cc @@ -728,13 +728,13 @@ int Gps_L1_Ca_Gaussian_Tracking_cc::general_work(int noutput_items __attribute__ double K_blk_samples = T_prn_samples + d_rem_code_phase_samples + code_error_filt_secs * static_cast(d_fs_in); d_current_prn_length_samples = static_cast(round(K_blk_samples)); // round to a discrete number of samples - //################### NCO COMMANDS ################################################# + // ################### NCO COMMANDS ################################################# // carrier phase step (NCO phase increment per sample) [rads/sample] d_carrier_phase_step_rad = TWO_PI * d_carrier_doppler_hz / static_cast(d_fs_in); // carrier phase accumulator d_acc_carrier_phase_rad -= d_carrier_phase_step_rad * static_cast(d_current_prn_length_samples); - //################### DLL COMMANDS ################################################# + // ################### DLL COMMANDS ################################################# // code phase step (Code resampler phase increment per sample) [chips/sample] d_code_phase_step_chips = d_code_freq_chips / static_cast(d_fs_in); // remnant code phase [chips] diff --git a/src/utils/front-end-cal/front_end_cal.cc b/src/utils/front-end-cal/front_end_cal.cc index 573262d4f..8150fcfce 100644 --- a/src/utils/front-end-cal/front_end_cal.cc +++ b/src/utils/front-end-cal/front_end_cal.cc @@ -69,7 +69,7 @@ bool FrontEndCal::read_assistance_from_XML() int FrontEndCal::Get_SUPL_Assist() { - //######### GNSS Assistance ################################# + // ######### GNSS Assistance ################################# Gnss_Sdr_Supl_Client supl_client_acquisition_; Gnss_Sdr_Supl_Client supl_client_ephemeris_; int supl_mcc; // Current network MCC (Mobile country code), 3 digits. From 57afa6bdbbb6968ebc823bbe90fdfe57de5c3bf4 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 24 Nov 2022 19:13:14 +0100 Subject: [PATCH 11/59] Bump max CMake version to 3.25 --- CMakeLists.txt | 2 +- .../libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 259c92410..e80dade62 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,7 +16,7 @@ endif() # Build type can still be overridden by setting -DCMAKE_BUILD_TYPE= set(CMAKE_BUILD_TYPE "Release" CACHE STRING "") -cmake_minimum_required(VERSION 2.8.12...3.24) +cmake_minimum_required(VERSION 2.8.12...3.25) project(gnss-sdr CXX C) set(GNSSSDR_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) # Allows to be a sub-project diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt index e40ea69e8..8aa84429c 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt @@ -8,7 +8,7 @@ ######################################################################## # Project setup ######################################################################## -cmake_minimum_required(VERSION 2.8.12...3.24) +cmake_minimum_required(VERSION 2.8.12...3.25) if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Release") endif() From d1713af02789b1bcb2fce39e482f8f8141f8c05e Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 25 Nov 2022 08:03:29 +0100 Subject: [PATCH 12/59] Make clang-format happy --- .../tracking/adapters/gps_l1_ca_dll_pll_tracking_gpu.cc | 2 +- .../tracking/adapters/gps_l1_ca_tcp_connector_tracking.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_gpu.cc b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_gpu.cc index 0060b2ee1..5477511d6 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_gpu.cc +++ b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_gpu.cc @@ -33,7 +33,7 @@ GpsL1CaDllPllTrackingGPU::GpsL1CaDllPllTrackingGPU( unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) { DLOG(INFO) << "role " << role; - //################# CONFIGURATION PARAMETERS ######################## + // ################# CONFIGURATION PARAMETERS ######################## int fs_in; int vector_length; bool dump; diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_tcp_connector_tracking.cc b/src/algorithms/tracking/adapters/gps_l1_ca_tcp_connector_tracking.cc index eb1ee936e..c7fe6e52c 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_tcp_connector_tracking.cc +++ b/src/algorithms/tracking/adapters/gps_l1_ca_tcp_connector_tracking.cc @@ -33,7 +33,7 @@ GpsL1CaTcpConnectorTracking::GpsL1CaTcpConnectorTracking( unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) { DLOG(INFO) << "role " << role; - //################# CONFIGURATION PARAMETERS ######################## + // ################# CONFIGURATION PARAMETERS ######################## const std::string default_item_type("gr_complex"); std::string item_type = configuration->property(role + ".item_type", default_item_type); // vector_length = configuration->property(role + ".vector_length", 2048); From 4e533deb16da65adbf360734ff18d5f83fd97d60 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 25 Nov 2022 10:18:29 +0100 Subject: [PATCH 13/59] Update checkout action for macos-latest --- .github/workflows/main.yml | 252 ++++++++++++++++++------------------- 1 file changed, 120 insertions(+), 132 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0b747318d..7889554e7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -5,105 +5,99 @@ name: Simple CI on: pull_request: paths-ignore: - - '**/CITATION.cff' + - "**/CITATION.cff" push: paths-ignore: - - '**/CITATION.cff' + - "**/CITATION.cff" jobs: build-ubuntu: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - name: install dependencies - run: sudo apt-get update && sudo apt-get install ninja-build libboost-dev libboost-date-time-dev libboost-system-dev libboost-filesystem-dev libboost-thread-dev libboost-chrono-dev libboost-serialization-dev liblog4cpp5-dev gnuradio-dev gr-osmosdr libpugixml-dev libpcap-dev libblas-dev liblapack-dev libarmadillo-dev libgflags-dev libgoogle-glog-dev libgnutls-openssl-dev libmatio-dev googletest protobuf-compiler libprotobuf-dev python3-mako liborc-0.4-dev - - name: configure - run: cd build && cmake -GNinja .. - - name: build - run: cd build && ninja - - name: check - run: cd build && ninja check && ../install/volk_gnsssdr_profile && ../install/run_tests - - name: default position_test - run: cd build && cmake -DENABLE_SYSTEM_TESTING_EXTRA=ON .. && ninja && ../install/position_test - + - uses: actions/checkout@v1 + - name: install dependencies + run: sudo apt-get update && sudo apt-get install ninja-build libboost-dev libboost-date-time-dev libboost-system-dev libboost-filesystem-dev libboost-thread-dev libboost-chrono-dev libboost-serialization-dev liblog4cpp5-dev gnuradio-dev gr-osmosdr libpugixml-dev libpcap-dev libblas-dev liblapack-dev libarmadillo-dev libgflags-dev libgoogle-glog-dev libgnutls-openssl-dev libmatio-dev googletest protobuf-compiler libprotobuf-dev python3-mako liborc-0.4-dev + - name: configure + run: cd build && cmake -GNinja .. + - name: build + run: cd build && ninja + - name: check + run: cd build && ninja check && ../install/volk_gnsssdr_profile && ../install/run_tests + - name: default position_test + run: cd build && cmake -DENABLE_SYSTEM_TESTING_EXTRA=ON .. && ninja && ../install/position_test build-macos: runs-on: macos-latest steps: - - uses: actions/checkout@v1 - - name: install dependencies - run: brew update && brew install ninja pkg-config hdf5 automake armadillo lapack gflags glog gnuradio log4cpp openssl pugixml protobuf && pip3 install mako - - name: configure - run: cd build && cmake -GNinja .. - - name: build - run: cd build && ninja - - name: check - run: cd build && ninja check && ../install/volk_gnsssdr_profile && ../install/run_tests - - name: default position_test - run: cd build && cmake -DENABLE_SYSTEM_TESTING_EXTRA=ON .. && ninja && ../install/position_test - + - uses: actions/checkout@v3.0.2 + - name: install dependencies + run: brew update && brew install ninja pkg-config hdf5 automake armadillo lapack gflags glog gnuradio log4cpp openssl pugixml protobuf && pip3 install mako + - name: configure + run: cd build && cmake -GNinja .. + - name: build + run: cd build && ninja + - name: check + run: cd build && ninja check && ../install/volk_gnsssdr_profile && ../install/run_tests + - name: default position_test + run: cd build && cmake -DENABLE_SYSTEM_TESTING_EXTRA=ON .. && ninja && ../install/position_test clang-format: runs-on: macos-latest steps: - - uses: actions/checkout@v1 - - name: install dependencies - run: brew install clang-format - - name: run clang-format - run: find . -iname \*.h -o -iname \*.c -o -iname \*.cc | xargs clang-format -style=file -i - - name: check - run: git diff > clang_format.patch && echo -e "if \n [ -s clang_format.patch ] \nthen \n echo "clang-format not applied:"; echo ""; more clang_format.patch; exit 1 \nfi \n" > detect && chmod +x ./detect && ./detect - + - uses: actions/checkout@v3.0.2 + - name: install dependencies + run: brew install clang-format + - name: run clang-format + run: find . -iname \*.h -o -iname \*.c -o -iname \*.cc | xargs clang-format -style=file -i + - name: check + run: git diff > clang_format.patch && echo -e "if \n [ -s clang_format.patch ] \nthen \n echo "clang-format not applied:"; echo ""; more clang_format.patch; exit 1 \nfi \n" > detect && chmod +x ./detect && ./detect clang-tidy: runs-on: macos-latest steps: - - uses: actions/checkout@v1 - - name: install dependencies - run: brew update && brew install llvm pkg-config hdf5 armadillo lapack gflags glog gnuradio libmatio log4cpp openssl pugixml protobuf && ln -s $(brew --prefix llvm)/bin/clang-tidy /usr/local/bin && ln -s $(brew --prefix llvm)/bin/clang-apply-replacements /usr/local/bin && ln -s $(brew --prefix llvm)/bin/run-clang-tidy /usr/local/bin && pip3 install mako - - name: Prepare run - run: cd build && cmake .. && make volk_gnsssdr_module gtest-1.12.1 core_monitor core_libs pvt_libs - - name: run clang-tidy - run: cd build && run-clang-tidy -fix - - name: check - run: git diff > clang_tidy.patch && echo -e "if \n [ -s clang_tidy.patch ] \nthen \n echo "clang_tidy not applied:"; echo ""; more clang_tidy.patch; exit 1 \nfi \n" > detect && chmod +x ./detect && ./detect - + - uses: actions/checkout@v1 + - name: install dependencies + run: brew update && brew install llvm pkg-config hdf5 armadillo lapack gflags glog gnuradio libmatio log4cpp openssl pugixml protobuf && ln -s $(brew --prefix llvm)/bin/clang-tidy /usr/local/bin && ln -s $(brew --prefix llvm)/bin/clang-apply-replacements /usr/local/bin && ln -s $(brew --prefix llvm)/bin/run-clang-tidy /usr/local/bin && pip3 install mako + - name: Prepare run + run: cd build && cmake .. && make volk_gnsssdr_module gtest-1.12.1 core_monitor core_libs pvt_libs + - name: run clang-tidy + run: cd build && run-clang-tidy -fix + - name: check + run: git diff > clang_tidy.patch && echo -e "if \n [ -s clang_tidy.patch ] \nthen \n echo "clang_tidy not applied:"; echo ""; more clang_tidy.patch; exit 1 \nfi \n" > detect && chmod +x ./detect && ./detect cpplint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - 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" - + - uses: actions/checkout@v1 + - 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" prettier-markdown: - runs-on: ubuntu-latest - steps: + runs-on: ubuntu-latest + steps: - uses: actions/checkout@v1 - name: install dependencies run: sudo npm install --global prettier - name: check markdown run: find . -iname "*.md" | xargs prettier --parser markdown --print-width 80 --prose-wrap always --list-different - cmakelint: - runs-on: ubuntu-latest - steps: + runs-on: ubuntu-latest + steps: - uses: actions/checkout@v1 - name: install dependencies run: | @@ -112,91 +106,85 @@ jobs: - name: check CMake scripts run: find . -iname "CMakeLists.txt" -o -iname "*.cmake" | xargs cmakelint --filter=-linelength,-readability/wonkycase - volk-gnsssdr-windows: runs-on: windows-latest steps: - - uses: actions/checkout@v1 - - uses: actions/setup-python@v1 - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install mako - - name: configure - shell: powershell - run: cd build; cmake -G "Visual Studio 17 2022" ..\src\algorithms\libs\volk_gnsssdr_module\volk_gnsssdr - - name: build - run: cmake --build build --config Release - - name: test - shell: powershell - run: cd build; ctest -C Release - - name: install - run: cmake --install build - - name: run profile - run: cd 'C:\Program Files (x86)\volk_gnsssdr\bin'; .\volk_gnsssdr_profile.exe - + - uses: actions/checkout@v1 + - uses: actions/setup-python@v1 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install mako + - name: configure + shell: powershell + run: cd build; cmake -G "Visual Studio 17 2022" ..\src\algorithms\libs\volk_gnsssdr_module\volk_gnsssdr + - name: build + run: cmake --build build --config Release + - name: test + shell: powershell + run: cd build; ctest -C Release + - name: install + run: cmake --install build + - name: run profile + run: cd 'C:\Program Files (x86)\volk_gnsssdr\bin'; .\volk_gnsssdr_profile.exe volk-gnsssdr-ubuntu: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - name: install dependencies - run: sudo apt install python3-mako liborc-dev - - name: configure - run: cd build && cmake ../src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr - - name: build - run: cd build && make -j2 - - name: install - run: cd build && sudo make install && sudo ldconfig - - name: test - run: volk_gnsssdr_profile - + - uses: actions/checkout@v1 + - name: install dependencies + run: sudo apt install python3-mako liborc-dev + - name: configure + run: cd build && cmake ../src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr + - name: build + run: cd build && make -j2 + - name: install + run: cd build && sudo make install && sudo ldconfig + - name: test + run: volk_gnsssdr_profile volk-gnsssdr-macos: runs-on: macos-latest steps: - - uses: actions/checkout@v1 - - name: install dependencies - run: pip3 install mako - - name: configure - run: cd build && cmake ../src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr - - name: build - run: cd build && make -j2 && sudo make install - - name: test - run: cd build && ctest -C Release --exclude-regex volk_gnsssdr_32fc_32f_rotator_dotprodxnpuppet_32fc - + - uses: actions/checkout@v3.0.2 + - name: install dependencies + run: pip3 install mako + - name: configure + run: cd build && cmake ../src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr + - name: build + run: cd build && make -j2 && sudo make install + - name: test + run: cd build && ctest -C Release --exclude-regex volk_gnsssdr_32fc_32f_rotator_dotprodxnpuppet_32fc volk-gnsssdr-macos-xcode: runs-on: macos-latest steps: - - uses: actions/checkout@v1 - - name: install dependencies - run: pip3 install mako - - name: configure - run: cd build && cmake -GXcode ../src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr - - name: build - run: cd build && xcodebuild -configuration Release - - name: install - run: cd build && sudo xcodebuild -configuration Release -target install - - name: test - run: cd build && ctest -C Release --exclude-regex volk_gnsssdr_32fc_32f_rotator_dotprodxnpuppet_32fc - + - uses: actions/checkout@v3.0.2 + - name: install dependencies + run: pip3 install mako + - name: configure + run: cd build && cmake -GXcode ../src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr + - name: build + run: cd build && xcodebuild -configuration Release + - name: install + run: cd build && sudo xcodebuild -configuration Release -target install + - name: test + run: cd build && ctest -C Release --exclude-regex volk_gnsssdr_32fc_32f_rotator_dotprodxnpuppet_32fc shellcheck: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - name: install dependencies - run: sudo apt install shellcheck - - name: check scripts - run: shellcheck src/utils/scripts/* - + - uses: actions/checkout@v1 + - name: install dependencies + run: sudo apt install shellcheck + - name: check scripts + run: shellcheck src/utils/scripts/* REUSE-compliance: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - name: Check REUSE compliance - uses: docker://fsfe/reuse - with: - args: lint + - uses: actions/checkout@v1 + - name: Check REUSE compliance + uses: docker://fsfe/reuse + with: + args: lint From be8a0a2a5ab9533f55e65bd35b48460887500a4d Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 25 Nov 2022 10:47:06 +0100 Subject: [PATCH 14/59] Workaround for breaking change in clang-format 15 --- src/core/libs/supl/asn-supl/PositionEstimate.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/core/libs/supl/asn-supl/PositionEstimate.h b/src/core/libs/supl/asn-supl/PositionEstimate.h index cc846de93..a3c6dde24 100644 --- a/src/core/libs/supl/asn-supl/PositionEstimate.h +++ b/src/core/libs/supl/asn-supl/PositionEstimate.h @@ -37,6 +37,7 @@ extern "C" ENUMERATED_t latitudeSign; long latitude; long longitude; + // clang-format off struct uncertainty { long uncertaintySemiMajor; @@ -46,6 +47,7 @@ extern "C" /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } * uncertainty; + // clang-format on long *confidence /* OPTIONAL */; struct AltitudeInfo *altitudeInfo /* OPTIONAL */; /* From c3e163d83934b5bc282618cab42410a5203596c9 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 25 Nov 2022 13:58:00 +0100 Subject: [PATCH 15/59] Update CI files --- .github/workflows/main.yml | 20 ++++++------- .github/workflows/volk_android.yml | 46 +++++++++++++++--------------- 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7889554e7..a38595b0d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -16,7 +16,7 @@ jobs: steps: - uses: actions/checkout@v1 - name: install dependencies - run: sudo apt-get update && sudo apt-get install ninja-build libboost-dev libboost-date-time-dev libboost-system-dev libboost-filesystem-dev libboost-thread-dev libboost-chrono-dev libboost-serialization-dev liblog4cpp5-dev gnuradio-dev gr-osmosdr libpugixml-dev libpcap-dev libblas-dev liblapack-dev libarmadillo-dev libgflags-dev libgoogle-glog-dev libgnutls-openssl-dev libmatio-dev googletest protobuf-compiler libprotobuf-dev python3-mako liborc-0.4-dev + run: sudo apt-get update && sudo apt-get install -y ninja-build cmake libboost-dev libboost-date-time-dev libboost-system-dev libboost-filesystem-dev libboost-thread-dev libboost-chrono-dev libboost-serialization-dev liblog4cpp5-dev gnuradio-dev gr-osmosdr libpugixml-dev libpcap-dev libblas-dev liblapack-dev libarmadillo-dev libgflags-dev libgoogle-glog-dev libgnutls-openssl-dev libmatio-dev googletest protobuf-compiler libprotobuf-dev python3-mako liborc-0.4-dev - name: configure run: cd build && cmake -GNinja .. - name: build @@ -29,7 +29,7 @@ jobs: build-macos: runs-on: macos-latest steps: - - uses: actions/checkout@v3.0.2 + - uses: actions/checkout@v3 - name: install dependencies run: brew update && brew install ninja pkg-config hdf5 automake armadillo lapack gflags glog gnuradio log4cpp openssl pugixml protobuf && pip3 install mako - name: configure @@ -44,7 +44,7 @@ jobs: clang-format: runs-on: macos-latest steps: - - uses: actions/checkout@v3.0.2 + - uses: actions/checkout@v3 - name: install dependencies run: brew install clang-format - name: run clang-format @@ -55,7 +55,7 @@ jobs: clang-tidy: runs-on: macos-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v3 - name: install dependencies run: brew update && brew install llvm pkg-config hdf5 armadillo lapack gflags glog gnuradio libmatio log4cpp openssl pugixml protobuf && ln -s $(brew --prefix llvm)/bin/clang-tidy /usr/local/bin && ln -s $(brew --prefix llvm)/bin/clang-apply-replacements /usr/local/bin && ln -s $(brew --prefix llvm)/bin/run-clang-tidy /usr/local/bin && pip3 install mako - name: Prepare run @@ -68,7 +68,7 @@ jobs: cpplint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v3 - name: install dependencies run: sudo apt-get install python3-pip && sudo pip3 install cpplint - name: run checks @@ -89,7 +89,7 @@ jobs: prettier-markdown: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v3 - name: install dependencies run: sudo npm install --global prettier - name: check markdown @@ -98,7 +98,7 @@ jobs: cmakelint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v3 - name: install dependencies run: | sudo python -m pip install --upgrade pip @@ -131,7 +131,7 @@ jobs: volk-gnsssdr-ubuntu: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v3 - name: install dependencies run: sudo apt install python3-mako liborc-dev - name: configure @@ -146,7 +146,7 @@ jobs: volk-gnsssdr-macos: runs-on: macos-latest steps: - - uses: actions/checkout@v3.0.2 + - uses: actions/checkout@v3 - name: install dependencies run: pip3 install mako - name: configure @@ -159,7 +159,7 @@ jobs: volk-gnsssdr-macos-xcode: runs-on: macos-latest steps: - - uses: actions/checkout@v3.0.2 + - uses: actions/checkout@v3 - name: install dependencies run: pip3 install mako - name: configure diff --git a/.github/workflows/volk_android.yml b/.github/workflows/volk_android.yml index ebdf9fc9d..c03187a3f 100644 --- a/.github/workflows/volk_android.yml +++ b/.github/workflows/volk_android.yml @@ -3,11 +3,11 @@ on: push: paths: - - 'src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/**' + - "src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/**" workflow_dispatch: pull_request: paths: - - 'src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/**' + - "src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/**" workflow_dispatch: name: Build volk-gnssdr on Android NDK @@ -27,30 +27,30 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3.0.0 + - uses: actions/checkout@v3.0.0 - - name: Update repositories - run: sudo apt update + - name: Update repositories + run: sudo apt update - # All dependencies - - name: Install dependencies - run: sudo apt install -y cmake openjdk-11-jre-headless wget unzip make python3-mako + # All dependencies + - name: Install dependencies + run: sudo apt install -y cmake openjdk-11-jre-headless wget unzip make python3-mako - # Setup Android SDK, and auto-accept licenses - - name: Install Android SDK - run: wget --quiet --output-document=android-sdk.zip https://dl.google.com/android/repository/commandlinetools-linux-8512546_latest.zip && mkdir android-sdk-linux && unzip -qq android-sdk.zip -d android-sdk-linux && export ANDROID_HOME=./android-sdk-linux && echo y | $ANDROID_HOME/cmdline-tools/bin/sdkmanager --sdk_root=android-sdk-linux --update && (echo y; echo y; echo y; echo y; echo y; echo y; echo y; echo y) | $ANDROID_HOME/cmdline-tools/bin/sdkmanager --sdk_root=android-sdk-linux --licenses + # Setup Android SDK, and auto-accept licenses + - name: Install Android SDK + run: wget --quiet --output-document=android-sdk.zip https://dl.google.com/android/repository/commandlinetools-linux-8512546_latest.zip && mkdir android-sdk-linux && unzip -qq android-sdk.zip -d android-sdk-linux && export ANDROID_HOME=./android-sdk-linux && echo y | $ANDROID_HOME/cmdline-tools/bin/sdkmanager --sdk_root=android-sdk-linux --update && (echo y; echo y; echo y; echo y; echo y; echo y; echo y; echo y) | $ANDROID_HOME/cmdline-tools/bin/sdkmanager --sdk_root=android-sdk-linux --licenses - # Call SDKManager to install the Android NDK - - name: Install Android NDK - run: $GITHUB_WORKSPACE/android-sdk-linux/cmdline-tools/bin/sdkmanager --sdk_root=$GITHUB_WORKSPACE/android-sdk-linux --install "ndk;24.0.8215888" --channel=3 + # Call SDKManager to install the Android NDK + - name: Install Android NDK + run: $GITHUB_WORKSPACE/android-sdk-linux/cmdline-tools/bin/sdkmanager --sdk_root=$GITHUB_WORKSPACE/android-sdk-linux --install "ndk;24.0.8215888" --channel=3 - # Setup build directory - - name: Setup ${{ matrix.arch.name }} - shell: bash - run: cd $GITHUB_WORKSPACE/ && cd build && cmake -DCMAKE_TOOLCHAIN_FILE=$GITHUB_WORKSPACE/android-sdk-linux/ndk/24.0.8215888/build/cmake/android.toolchain.cmake -DANDROID_ABI=${{ matrix.arch.name }} -DANDROID_PLATFORM=android-24 ../src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr + # Setup build directory + - name: Setup ${{ matrix.arch.name }} + shell: bash + run: cd $GITHUB_WORKSPACE/ && cd build && cmake -DCMAKE_TOOLCHAIN_FILE=$GITHUB_WORKSPACE/android-sdk-linux/ndk/24.0.8215888/build/cmake/android.toolchain.cmake -DANDROID_ABI=${{ matrix.arch.name }} -DANDROID_PLATFORM=android-24 ../src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr - # Build - - name: Build ${{ matrix.arch.name }} - shell: bash - run: cd $GITHUB_WORKSPACE/build && make - continue-on-error: ${{ matrix.arch.allow_fail }} + # Build + - name: Build ${{ matrix.arch.name }} + shell: bash + run: cd $GITHUB_WORKSPACE/build && make + continue-on-error: ${{ matrix.arch.allow_fail }} From 5a05c8c7e787aa6c1371243c0cc928f9dfb148f9 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 25 Nov 2022 14:12:42 +0100 Subject: [PATCH 16/59] Tru to fix build-ubuntu job --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a38595b0d..8b23b8eea 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -16,7 +16,7 @@ jobs: steps: - uses: actions/checkout@v1 - name: install dependencies - run: sudo apt-get update && sudo apt-get install -y ninja-build cmake libboost-dev libboost-date-time-dev libboost-system-dev libboost-filesystem-dev libboost-thread-dev libboost-chrono-dev libboost-serialization-dev liblog4cpp5-dev gnuradio-dev gr-osmosdr libpugixml-dev libpcap-dev libblas-dev liblapack-dev libarmadillo-dev libgflags-dev libgoogle-glog-dev libgnutls-openssl-dev libmatio-dev googletest protobuf-compiler libprotobuf-dev python3-mako liborc-0.4-dev + run: sudo apt-get update && sudo apt-get install -y ninja-build cmake libboost-dev libboost-date-time-dev libboost-system-dev libboost-filesystem-dev libboost-thread-dev libboost-chrono-dev libboost-serialization-dev liblog4cpp5-dev gnuradio-dev gr-osmosdr libpugixml-dev libpcap-dev libblas-dev liblapack-dev libarmadillo-dev libgflags-dev libgoogle-glog-dev libgnutls-openssl-dev libmatio-dev googletest protobuf-compiler libprotobuf-dev python3-mako liborc-0.4-dev libcpu-features-dev - name: configure run: cd build && cmake -GNinja .. - name: build From f71b7c9a67794ec688e46d0e4730cc90799eeadd Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 26 Nov 2022 08:49:31 +0100 Subject: [PATCH 17/59] Try to fix build-ubuntu job --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8b23b8eea..a38595b0d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -16,7 +16,7 @@ jobs: steps: - uses: actions/checkout@v1 - name: install dependencies - run: sudo apt-get update && sudo apt-get install -y ninja-build cmake libboost-dev libboost-date-time-dev libboost-system-dev libboost-filesystem-dev libboost-thread-dev libboost-chrono-dev libboost-serialization-dev liblog4cpp5-dev gnuradio-dev gr-osmosdr libpugixml-dev libpcap-dev libblas-dev liblapack-dev libarmadillo-dev libgflags-dev libgoogle-glog-dev libgnutls-openssl-dev libmatio-dev googletest protobuf-compiler libprotobuf-dev python3-mako liborc-0.4-dev libcpu-features-dev + run: sudo apt-get update && sudo apt-get install -y ninja-build cmake libboost-dev libboost-date-time-dev libboost-system-dev libboost-filesystem-dev libboost-thread-dev libboost-chrono-dev libboost-serialization-dev liblog4cpp5-dev gnuradio-dev gr-osmosdr libpugixml-dev libpcap-dev libblas-dev liblapack-dev libarmadillo-dev libgflags-dev libgoogle-glog-dev libgnutls-openssl-dev libmatio-dev googletest protobuf-compiler libprotobuf-dev python3-mako liborc-0.4-dev - name: configure run: cd build && cmake -GNinja .. - name: build From e48389e306bec09529eef964ad6f184f22b88d2a Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 26 Nov 2022 11:37:35 +0100 Subject: [PATCH 18/59] Fix installation of volk_gnsssdr python files if Python >= 3.10 --- .../volk_gnsssdr/cmake/Modules/VolkPython.cmake | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/VolkPython.cmake b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/VolkPython.cmake index 977b6b95e..fcaabe4ff 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/VolkPython.cmake +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/VolkPython.cmake @@ -112,7 +112,18 @@ endif() # Sets the python installation directory VOLK_PYTHON_DIR ######################################################################## if(NOT DEFINED VOLK_PYTHON_DIR) -execute_process(COMMAND ${PYTHON_EXECUTABLE} -c " + if(PYTHON_VERSION_STRING VERSION_GREATER "3.9.99") + execute_process(COMMAND ${PYTHON_EXECUTABLE} -c " +import os +import sys +if os.name == 'posix': + print(os.path.join('lib', 'python' + sys.version[:4], 'dist-packages')) +if os.name == 'nt': + print(os.path.join('Lib', 'site-packages')) +" OUTPUT_VARIABLE VOLK_PYTHON_DIR OUTPUT_STRIP_TRAILING_WHITESPACE + ) + else() + execute_process(COMMAND ${PYTHON_EXECUTABLE} -c " import os import sys if os.name == 'posix': @@ -120,7 +131,8 @@ if os.name == 'posix': if os.name == 'nt': print(os.path.join('Lib', 'site-packages')) " OUTPUT_VARIABLE VOLK_PYTHON_DIR OUTPUT_STRIP_TRAILING_WHITESPACE -) + ) + endif() endif() file(TO_CMAKE_PATH ${VOLK_PYTHON_DIR} VOLK_PYTHON_DIR) From 5c617d2169e307409c7f1621a8751dedc5391d18 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 26 Nov 2022 13:42:12 +0100 Subject: [PATCH 19/59] Force building of list_cpu_features --- .../libs/volk_gnsssdr_module/volk_gnsssdr/lib/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/CMakeLists.txt b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/CMakeLists.txt index 3e3b709f1..b9da1426d 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/CMakeLists.txt +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/CMakeLists.txt @@ -544,6 +544,7 @@ if(NOT (CMAKE_GENERATOR STREQUAL Xcode)) PRIVATE $ ) + add_dependencies(volk_gnsssdr_obj list_cpu_features) endif() endif() # Configure object target properties From 59b358463d4198de0d799b877560faeead86eb40 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 26 Nov 2022 17:03:28 +0100 Subject: [PATCH 20/59] Force building of shared library --- .../libs/volk_gnsssdr_module/volk_gnsssdr/apps/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/apps/CMakeLists.txt b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/apps/CMakeLists.txt index 4ffdaff9f..56f672e80 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/apps/CMakeLists.txt +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/apps/CMakeLists.txt @@ -35,6 +35,8 @@ add_executable(volk_gnsssdr_profile ${CMAKE_CURRENT_SOURCE_DIR}/volk_gnsssdr_option_helpers.cc ) +add_dependencies(volk_gnsssdr_profile volk_gnsssdr) + if(MSVC) target_include_directories(volk_gnsssdr_profile PRIVATE $ From cfc216ac32b83e612bd89313aff1b3e9f57d459b Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 26 Nov 2022 17:52:46 +0100 Subject: [PATCH 21/59] Improve volk_gnsssdr build command --- CMakeLists.txt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e80dade62..a35b31551 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1204,7 +1204,7 @@ if(NOT VOLKGNSSSDR_FOUND) DOWNLOAD_COMMAND "" UPDATE_COMMAND "" PATCH_COMMAND "" - BUILD_COMMAND ${VOLK_GNSSSDR_BUILD_COMMAND} volk_gnsssdr_profile + BUILD_COMMAND ${VOLK_GNSSSDR_BUILD_COMMAND} volk_gnsssdr_profile volk_gnsssdr-config-info INSTALL_DIR ${GNSSSDR_BINARY_DIR}/volk_gnsssdr_module/install ) else() @@ -1255,7 +1255,7 @@ if(NOT VOLKGNSSSDR_FOUND) DOWNLOAD_COMMAND "" UPDATE_COMMAND "" PATCH_COMMAND "" - BUILD_COMMAND ${VOLK_GNSSSDR_BUILD_COMMAND} volk_gnsssdr_profile + BUILD_COMMAND ${VOLK_GNSSSDR_BUILD_COMMAND} volk_gnsssdr_profile volk_gnsssdr-config-info BUILD_BYPRODUCTS ${VOLK_GNSSSDR_BUILD_BYPRODUCTS} INSTALL_DIR ${GNSSSDR_BINARY_DIR}/volk_gnsssdr_module/install ) @@ -1274,9 +1274,10 @@ if(NOT VOLKGNSSSDR_FOUND) DOWNLOAD_COMMAND "" UPDATE_COMMAND "" PATCH_COMMAND "" - BUILD_COMMAND ${VOLK_GNSSSDR_BUILD_COMMAND} volk_gnsssdr_profile + BUILD_COMMAND ${VOLK_GNSSSDR_BUILD_COMMAND} volk_gnsssdr_profile volk_gnsssdr-config-info BUILD_BYPRODUCTS ${GNSSSDR_BINARY_DIR}/volk_gnsssdr_module/install/lib${VOLK_GNSSSDR_LIB_SUFFIX}/${CMAKE_FIND_LIBRARY_PREFIXES}volk_gnsssdr${CMAKE_STATIC_LIBRARY_SUFFIX} ${GNSSSDR_BINARY_DIR}/volk_gnsssdr_module/install/bin/volk_gnsssdr_profile + ${GNSSSDR_BINARY_DIR}/volk_gnsssdr_module/install/bin/volk_gnsssdr-config-info INSTALL_DIR ${GNSSSDR_BINARY_DIR}/volk_gnsssdr_module/install ) endif() From 9b692375d149df390c3cf704663273f7bf8925b8 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 27 Nov 2022 08:18:07 +0100 Subject: [PATCH 22/59] Build all targets of volk_gnsssdr --- CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a35b31551..1fb98188c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1119,7 +1119,7 @@ if(NOT VOLKGNSSSDR_FOUND) if(CMAKE_GENERATOR STREQUAL Xcode) set(VOLK_GNSSSDR_BUILD_COMMAND "xcodebuild" "-configuration" $<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel> - "-target" + "-alltargets" ) endif() endif() @@ -1204,7 +1204,7 @@ if(NOT VOLKGNSSSDR_FOUND) DOWNLOAD_COMMAND "" UPDATE_COMMAND "" PATCH_COMMAND "" - BUILD_COMMAND ${VOLK_GNSSSDR_BUILD_COMMAND} volk_gnsssdr_profile volk_gnsssdr-config-info + BUILD_COMMAND ${VOLK_GNSSSDR_BUILD_COMMAND} INSTALL_DIR ${GNSSSDR_BINARY_DIR}/volk_gnsssdr_module/install ) else() @@ -1255,7 +1255,7 @@ if(NOT VOLKGNSSSDR_FOUND) DOWNLOAD_COMMAND "" UPDATE_COMMAND "" PATCH_COMMAND "" - BUILD_COMMAND ${VOLK_GNSSSDR_BUILD_COMMAND} volk_gnsssdr_profile volk_gnsssdr-config-info + BUILD_COMMAND ${VOLK_GNSSSDR_BUILD_COMMAND} BUILD_BYPRODUCTS ${VOLK_GNSSSDR_BUILD_BYPRODUCTS} INSTALL_DIR ${GNSSSDR_BINARY_DIR}/volk_gnsssdr_module/install ) @@ -1274,7 +1274,7 @@ if(NOT VOLKGNSSSDR_FOUND) DOWNLOAD_COMMAND "" UPDATE_COMMAND "" PATCH_COMMAND "" - BUILD_COMMAND ${VOLK_GNSSSDR_BUILD_COMMAND} volk_gnsssdr_profile volk_gnsssdr-config-info + BUILD_COMMAND ${VOLK_GNSSSDR_BUILD_COMMAND} BUILD_BYPRODUCTS ${GNSSSDR_BINARY_DIR}/volk_gnsssdr_module/install/lib${VOLK_GNSSSDR_LIB_SUFFIX}/${CMAKE_FIND_LIBRARY_PREFIXES}volk_gnsssdr${CMAKE_STATIC_LIBRARY_SUFFIX} ${GNSSSDR_BINARY_DIR}/volk_gnsssdr_module/install/bin/volk_gnsssdr_profile ${GNSSSDR_BINARY_DIR}/volk_gnsssdr_module/install/bin/volk_gnsssdr-config-info From 51869b04854c23b1fb721e1f33c23d54fcb5ecde Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 27 Nov 2022 10:23:23 +0100 Subject: [PATCH 23/59] Add support for s390x arch in cpu_features. Update to 4e191a4 --- CMakeLists.txt | 2 +- .../volk_gnsssdr/CMakeLists.txt | 2 +- .../volk_gnsssdr/cpu_features/CMakeLists.txt | 16 +- .../volk_gnsssdr/cpu_features/README.md | 24 +- .../include/cpu_features_macros.h | 4 + .../cpu_features/include/cpuinfo_s390x.h | 102 +++ .../cpu_features/include/cpuinfo_x86.h | 128 ++-- .../cpu_features/include/internal/hwcaps.h | 28 + .../include/internal/windows_utils.h | 5 + .../cpu_features/src/impl_ppc_linux.c | 1 + .../cpu_features/src/impl_s390x_linux.c | 119 ++++ .../src/impl_x86__base_implementation.inl | 184 +++++- .../src/utils/list_cpu_features.c | 14 +- .../cpu_features/test/CMakeLists.txt | 7 + .../cpu_features/test/cpuinfo_s390x_test.cc | 79 +++ .../cpu_features/test/cpuinfo_x86_test.cc | 621 ++++++++++++++++-- 16 files changed, 1202 insertions(+), 134 deletions(-) create mode 100644 src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpuinfo_s390x.h create mode 100644 src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/impl_s390x_linux.c create mode 100644 src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/cpuinfo_s390x_test.cc diff --git a/CMakeLists.txt b/CMakeLists.txt index 1fb98188c..4b3aeb7e8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1187,7 +1187,7 @@ if(NOT VOLKGNSSSDR_FOUND) include(GNUInstallDirs) set(SUPPORTED_CPU_FEATURES_ARCH FALSE) if(CMAKE_SYSTEM_PROCESSOR MATCHES - "(^mips)|(^arm)|(^aarch64)|(x86_64)|(AMD64|amd64)|(^i.86$)|(^powerpc)|(^ppc)") + "(^mips)|(^arm)|(^aarch64)|(x86_64)|(AMD64|amd64)|(^i.86$)|(^powerpc)|(^ppc)|(^s390x)") set(SUPPORTED_CPU_FEATURES_ARCH TRUE) endif() if(${CMAKE_INSTALL_LIBDIR} MATCHES lib64) diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt index 8aa84429c..8a8f2e76e 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt @@ -257,7 +257,7 @@ endif() # cpu_features - sensible defaults, user settable option if(CMAKE_SYSTEM_PROCESSOR MATCHES - "(^mips)|(^arm)|(^aarch64)|(x86_64)|(AMD64|amd64)|(^i.86$)|(^powerpc)|(^ppc)") + "(^mips)|(^arm)|(^aarch64)|(x86_64)|(AMD64|amd64)|(^i.86$)|(^powerpc)|(^ppc)|(^s390x)") option(VOLK_CPU_FEATURES "volk-gnsssdr uses cpu_features" ON) else() option(VOLK_CPU_FEATURES "volk-gnsssdr uses cpu_features" OFF) diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/CMakeLists.txt b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/CMakeLists.txt index acb748a3c..cde0a4668 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/CMakeLists.txt +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/CMakeLists.txt @@ -16,12 +16,13 @@ if(CMAKE_VERSION LESS "3.1") add_compile_options("$<$,C>:-std=gnu99>") endif() +# Default Build Type to be Release # Default Build Type to be Release if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE) -endif() +endif(NOT CMAKE_BUILD_TYPE) # BUILD_SHARED_LIBS is a standard CMake variable, but we declare it here to make # it prominent in the GUI. @@ -55,6 +56,7 @@ set(PROCESSOR_IS_ARM FALSE) set(PROCESSOR_IS_AARCH64 FALSE) set(PROCESSOR_IS_X86 FALSE) set(PROCESSOR_IS_POWER FALSE) +set(PROCESSOR_IS_S390X FALSE) if(CMAKE_SYSTEM_PROCESSOR MATCHES "^mips") set(PROCESSOR_IS_MIPS TRUE) @@ -66,6 +68,8 @@ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "(x86_64)|(AMD64|amd64)|(^i.86$)") set(PROCESSOR_IS_X86 TRUE) elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)") set(PROCESSOR_IS_POWER TRUE) +elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(s390x)") + set(PROCESSOR_IS_S390X TRUE) endif() macro(add_cpu_features_headers_and_sources HDRS_LIST_NAME SRCS_LIST_NAME) @@ -85,6 +89,8 @@ macro(add_cpu_features_headers_and_sources HDRS_LIST_NAME SRCS_LIST_NAME) list(APPEND ${SRCS_LIST_NAME} ${PROJECT_SOURCE_DIR}/include/internal/windows_utils.h) elseif(PROCESSOR_IS_POWER) list(APPEND ${HDRS_LIST_NAME} ${PROJECT_SOURCE_DIR}/include/cpuinfo_ppc.h) + elseif(PROCESSOR_IS_S390X) + list(APPEND ${HDRS_LIST_NAME} ${PROJECT_SOURCE_DIR}/include/cpuinfo_s390x.h) else() message(FATAL_ERROR "Unsupported architectures ${CMAKE_SYSTEM_PROCESSOR}") endif() @@ -128,8 +134,8 @@ endif() # # library : cpu_features # -set(CPU_FEATURES_HDRS) -set(CPU_FEATURES_SRCS) +set (CPU_FEATURES_HDRS) +set (CPU_FEATURES_SRCS) add_cpu_features_headers_and_sources(CPU_FEATURES_HDRS CPU_FEATURES_SRCS) list(APPEND CPU_FEATURES_SRCS $) if(NOT PROCESSOR_IS_X86 AND UNIX) @@ -211,8 +217,8 @@ if(BUILD_TESTING) # Add googletest directly to our build. This defines the gtest and # gtest_main targets. add_subdirectory(${CMAKE_BINARY_DIR}/googletest-src - ${CMAKE_BINARY_DIR}/googletest-build - EXCLUDE_FROM_ALL) + ${CMAKE_BINARY_DIR}/googletest-build + EXCLUDE_FROM_ALL) endif() add_subdirectory(test) diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/README.md b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/README.md index ce13d72e6..3421040c5 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/README.md +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/README.md @@ -158,21 +158,21 @@ flags : aes,avx,cx16,smx,sse4_1,sse4_2,ssse3 ## What's supported -| | x86³ | ARM | AArch64 | MIPS⁴ | POWER | -| ------- | :--: | :-----: | :-----: | :-----: | :-----: | -| Android | yes² | yes¹ | yes¹ | yes¹ | N/A | -| iOS | N/A | not yet | not yet | N/A | N/A | -| Linux | yes² | yes¹ | yes¹ | yes¹ | yes¹ | -| MacOS | yes² | N/A | yes² | N/A | no | -| Windows | yes² | not yet | not yet | N/A | N/A | -| FreeBSD | yes² | not yet | not yet | not yet | not yet | +| | x86³ | AArch64 | ARM | MIPS⁴ | s390x | POWER | +| ------- | :---: | :-----: | :-----: | :-----: | :-----: | :-----: | +| Linux | yes² | yes¹ | yes¹ | yes¹ | yes¹ | yes¹ | +| FreeBSD | yes² | not yet | not yet | not yet | not yet | not yet | +| MacOs | yes² | not yet | N/A | N/A | no | no | +| Windows | yes² | not yet | not yet | N/A | N/A | N/A | +| Android | yes² | yes¹ | yes¹ | yes¹ | N/A | N/A | +| iOS | N/A | not yet | not yet | N/A | N/A | N/A | 1. **Features revealed from Linux.** We gather data from several sources depending on availability: - - from glibc's - [getauxval](https://www.gnu.org/software/libc/manual/html_node/Auxiliary-Vector.html) - - by parsing `/proc/self/auxv` - - by parsing `/proc/cpuinfo` + + from glibc's + [getauxval](https://www.gnu.org/software/libc/manual/html_node/Auxiliary-Vector.html) + + by parsing `/proc/self/auxv` + + by parsing `/proc/cpuinfo` 2. **Features revealed from CPU.** features are retrieved by using the `cpuid` instruction. 3. **Microarchitecture detection.** On x86 some features are not always diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpu_features_macros.h b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpu_features_macros.h index 2eb11e264..ace763248 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpu_features_macros.h +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpu_features_macros.h @@ -56,6 +56,10 @@ #define CPU_FEATURES_ARCH_RISCV #endif +#if defined(__s390x__) +#define CPU_FEATURES_ARCH_S390X +#endif + #if defined(__riscv) && defined(__riscv_xlen) && __riscv_xlen == 32 #define CPU_FEATURES_ARCH_RISCV32 #endif diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpuinfo_s390x.h b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpuinfo_s390x.h new file mode 100644 index 000000000..aad885e50 --- /dev/null +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpuinfo_s390x.h @@ -0,0 +1,102 @@ +// SPDX-FileCopyrightText: 2022 IBM +// SPDX-License-Identifier: Apache-2.0 + +#ifndef CPU_FEATURES_INCLUDE_CPUINFO_S390X_H_ +#define CPU_FEATURES_INCLUDE_CPUINFO_S390X_H_ + +#include "cpu_features_cache_info.h" +#include "cpu_features_macros.h" + +CPU_FEATURES_START_CPP_NAMESPACE + +typedef struct +{ + int esan3 : 1; // instructions named N3, "backported" to esa-mode + int zarch : 1; // z/Architecture mode active + int stfle : 1; // store-facility-list-extended + int msa : 1; // message-security assist + int ldisp : 1; // long-displacement + int eimm : 1; // extended-immediate + int dfp : 1; // decimal floating point & perform floating point operation + int edat : 1; // huge page support + int etf3eh : 1; // extended-translation facility 3 enhancement + int highgprs : 1; // 64-bit register support for 31-bit processes + int te : 1; // transactional execution + int vx : 1; // vector extension facility + int vxd : 1; // vector-packed-decimal facility + int vxe : 1; // vector-enhancement facility 1 + int gs : 1; // guarded-storage facility + int vxe2 : 1; // vector-enhancements facility 2 + int vxp : 1; // vector-packed-decimal-enhancement facility + int sort : 1; // enhanced-sort facility + int dflt : 1; // deflate-conversion facility + int vxp2 : 1; // vector-packed-decimal-enhancement facility 2 + int nnpa : 1; // neural network processing assist facility + int pcimio : 1; // PCI mio facility + int sie : 1; // virtualization support + + // Make sure to update S390XFeaturesEnum below if you add a field here. +} S390XFeatures; + +typedef struct +{ + S390XFeatures features; +} S390XInfo; + +S390XInfo GetS390XInfo(void); + +typedef struct +{ + char platform[64]; // 0 terminated string +} S390XPlatformTypeStrings; + +typedef struct +{ + int num_processors; // -1 if N/A + S390XPlatformTypeStrings type; +} S390XPlatformStrings; + +S390XPlatformStrings GetS390XPlatformStrings(void); + +//////////////////////////////////////////////////////////////////////////////// +// Introspection functions + +typedef enum +{ + S390_ESAN3, + S390_ZARCH, + S390_STFLE, + S390_MSA, + S390_LDISP, + S390_EIMM, + S390_DFP, + S390_EDAT, + S390_ETF3EH, + S390_HIGHGPRS, + S390_TE, + S390_VX, + S390_VXD, + S390_VXE, + S390_GS, + S390_VXE2, + S390_VXP, + S390_SORT, + S390_DFLT, + S390_VXP2, + S390_NNPA, + S390_PCIMIO, + S390_SIE, + S390X_LAST_, +} S390XFeaturesEnum; + +int GetS390XFeaturesEnumValue(const S390XFeatures* features, S390XFeaturesEnum value); + +const char* GetS390XFeaturesEnumName(S390XFeaturesEnum); + +CPU_FEATURES_END_CPP_NAMESPACE + +#if !defined(CPU_FEATURES_ARCH_S390X) +#error "Including cpuinfo_s390x.h from a non-s390x target." +#endif + +#endif // CPU_FEATURES_INCLUDE_CPUINFO_S390X_H_ \ No newline at end of file diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpuinfo_x86.h b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpuinfo_x86.h index 3a968a862..4db5efa4c 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpuinfo_x86.h +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpuinfo_x86.h @@ -49,6 +49,7 @@ typedef struct int sse4a : 1; int avx : 1; + int avx_vnni : 1; int avx2 : 1; int avx512f : 1; @@ -70,6 +71,7 @@ typedef struct int avx512_4fmaps : 1; int avx512_bf16 : 1; int avx512_vp2intersect : 1; + int avx512_fp16 : 1; int amx_bf16 : 1; int amx_tile : 1; int amx_int8 : 1; @@ -86,7 +88,15 @@ typedef struct int dca : 1; int ss : 1; int adx : 1; - // Make sure to update X86FeaturesEnum below if you add a field here. + int lzcnt : 1; // Note: this flag is called ABM for AMD, LZCNT for Intel. + int gfni : 1; + int movdiri : 1; + int movdir64b : 1; + int fs_rep_mov : 1; // Fast short REP MOV + int fz_rep_movsb : 1; // Fast zero-length REP MOVSB + int fs_rep_stosb : 1; // Fast short REP STOSB + int fs_rep_cmpsb_scasb : 1; // Fast short REP CMPSB/SCASB + // Make sure to update X86FeaturesEnum below if you add a field here. } X86Features; typedef struct @@ -110,56 +120,60 @@ CacheInfo GetX86CacheInfo(void); typedef enum { X86_UNKNOWN, - ZHAOXIN_ZHANGJIANG, // ZhangJiang - ZHAOXIN_WUDAOKOU, // WuDaoKou - ZHAOXIN_LUJIAZUI, // LuJiaZui - ZHAOXIN_YONGFENG, // YongFeng - INTEL_80486, // 80486 - INTEL_P5, // P5 - INTEL_LAKEMONT, // LAKEMONT - INTEL_CORE, // CORE - INTEL_PNR, // PENRYN - INTEL_NHM, // NEHALEM - INTEL_ATOM_BNL, // BONNELL - INTEL_WSM, // WESTMERE - INTEL_SNB, // SANDYBRIDGE - INTEL_IVB, // IVYBRIDGE - INTEL_ATOM_SMT, // SILVERMONT - INTEL_HSW, // HASWELL - INTEL_BDW, // BROADWELL - INTEL_SKL, // SKYLAKE - INTEL_ATOM_GMT, // GOLDMONT - INTEL_KBL, // KABY LAKE - INTEL_CFL, // COFFEE LAKE - INTEL_WHL, // WHISKEY LAKE - INTEL_CML, // COMET LAKE - INTEL_CNL, // CANNON LAKE - INTEL_ICL, // ICE LAKE - INTEL_TGL, // TIGER LAKE - INTEL_SPR, // SAPPHIRE RAPIDS - INTEL_ADL, // ALDER LAKE - INTEL_RCL, // ROCKET LAKE - INTEL_KNIGHTS_M, // KNIGHTS MILL - INTEL_KNIGHTS_L, // KNIGHTS LANDING - INTEL_KNIGHTS_F, // KNIGHTS FERRY - INTEL_KNIGHTS_C, // KNIGHTS CORNER - INTEL_NETBURST, // NETBURST - AMD_HAMMER, // K8 HAMMER - AMD_K10, // K10 - AMD_K11, // K11 - AMD_K12, // K12 - AMD_BOBCAT, // K14 BOBCAT - AMD_PILEDRIVER, // K15 PILEDRIVER - AMD_STREAMROLLER, // K15 STREAMROLLER - AMD_EXCAVATOR, // K15 EXCAVATOR - AMD_BULLDOZER, // K15 BULLDOZER - AMD_JAGUAR, // K16 JAGUAR - AMD_PUMA, // K16 PUMA - AMD_ZEN, // K17 ZEN - AMD_ZEN_PLUS, // K17 ZEN+ - AMD_ZEN2, // K17 ZEN 2 - AMD_ZEN3, // K19 ZEN 3 - AMD_ZEN4, // K19 ZEN 4 + ZHAOXIN_ZHANGJIANG, // ZhangJiang + ZHAOXIN_WUDAOKOU, // WuDaoKou + ZHAOXIN_LUJIAZUI, // LuJiaZui + ZHAOXIN_YONGFENG, // YongFeng + INTEL_80486, // 80486 + INTEL_P5, // P5 + INTEL_LAKEMONT, // LAKEMONT + INTEL_CORE, // CORE + INTEL_PNR, // PENRYN + INTEL_NHM, // NEHALEM + INTEL_ATOM_BNL, // BONNELL + INTEL_WSM, // WESTMERE + INTEL_SNB, // SANDYBRIDGE + INTEL_IVB, // IVYBRIDGE + INTEL_ATOM_SMT, // SILVERMONT + INTEL_HSW, // HASWELL + INTEL_BDW, // BROADWELL + INTEL_SKL, // SKYLAKE + INTEL_CCL, // CASCADELAKE + INTEL_ATOM_GMT, // GOLDMONT + INTEL_ATOM_GMT_PLUS, // GOLDMONT+ + INTEL_ATOM_TMT, // TREMONT + INTEL_KBL, // KABY LAKE + INTEL_CFL, // COFFEE LAKE + INTEL_WHL, // WHISKEY LAKE + INTEL_CML, // COMET LAKE + INTEL_CNL, // CANNON LAKE + INTEL_ICL, // ICE LAKE + INTEL_TGL, // TIGER LAKE + INTEL_SPR, // SAPPHIRE RAPIDS + INTEL_ADL, // ALDER LAKE + INTEL_RCL, // ROCKET LAKE + INTEL_RPL, // RAPTOR LAKE + INTEL_KNIGHTS_M, // KNIGHTS MILL + INTEL_KNIGHTS_L, // KNIGHTS LANDING + INTEL_KNIGHTS_F, // KNIGHTS FERRY + INTEL_KNIGHTS_C, // KNIGHTS CORNER + INTEL_NETBURST, // NETBURST + AMD_HAMMER, // K8 HAMMER + AMD_K10, // K10 + AMD_K11, // K11 + AMD_K12, // K12 LLANO + AMD_BOBCAT, // K14 BOBCAT + AMD_PILEDRIVER, // K15 PILEDRIVER + AMD_STREAMROLLER, // K15 STREAMROLLER + AMD_EXCAVATOR, // K15 EXCAVATOR + AMD_BULLDOZER, // K15 BULLDOZER + AMD_JAGUAR, // K16 JAGUAR + AMD_PUMA, // K16 PUMA + AMD_ZEN, // K17 ZEN + AMD_ZEN_PLUS, // K17 ZEN+ + AMD_ZEN2, // K17 ZEN 2 + AMD_ZEN3, // K19 ZEN 3 + AMD_ZEN4, // K19 ZEN 4 X86_MICROARCHITECTURE_LAST_, } X86Microarchitecture; @@ -205,6 +219,7 @@ typedef enum X86_SSE4_2, X86_SSE4A, X86_AVX, + X86_AVX_VNNI, X86_AVX2, X86_AVX512F, X86_AVX512CD, @@ -225,6 +240,7 @@ typedef enum X86_AVX512_4FMAPS, X86_AVX512_BF16, X86_AVX512_VP2INTERSECT, + X86_AVX512_FP16, X86_AMX_BF16, X86_AMX_TILE, X86_AMX_INT8, @@ -239,6 +255,14 @@ typedef enum X86_DCA, X86_SS, X86_ADX, + X86_LZCNT, + X86_GFNI, + X86_MOVDIRI, + X86_MOVDIR64B, + X86_FS_REP_MOV, + X86_FZ_REP_MOVSB, + X86_FS_REP_STOSB, + X86_FS_REP_CMPSB_SCASB, X86_LAST_, } X86FeaturesEnum; @@ -254,4 +278,4 @@ CPU_FEATURES_END_CPP_NAMESPACE #error "Including cpuinfo_x86.h from a non-x86 target." #endif -#endif // CPU_FEATURES_INCLUDE_CPUINFO_X86_H_ +#endif // CPU_FEATURES_INCLUDE_CPUINFO_X86_H_ \ No newline at end of file diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/internal/hwcaps.h b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/internal/hwcaps.h index 94f5f43e2..29da4837a 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/internal/hwcaps.h +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/internal/hwcaps.h @@ -164,6 +164,34 @@ CPU_FEATURES_START_CPP_NAMESPACE #define PPC_FEATURE2_HTM_NO_SUSPEND 0x00080000 #endif +// https://elixir.bootlin.com/linux/v6.0-rc6/source/arch/s390/include/asm/elf.h +#define HWCAP_S390_ESAN3 1 +#define HWCAP_S390_ZARCH 2 +#define HWCAP_S390_STFLE 4 +#define HWCAP_S390_MSA 8 +#define HWCAP_S390_LDISP 16 +#define HWCAP_S390_EIMM 32 +#define HWCAP_S390_DFP 64 +#define HWCAP_S390_HPAGE 128 +#define HWCAP_S390_ETF3EH 256 +#define HWCAP_S390_HIGH_GPRS 512 +#define HWCAP_S390_TE 1024 +#define HWCAP_S390_VX 2048 +#define HWCAP_S390_VXRS HWCAP_S390_VX +#define HWCAP_S390_VXD 4096 +#define HWCAP_S390_VXRS_BCD HWCAP_S390_VXD +#define HWCAP_S390_VXE 8192 +#define HWCAP_S390_VXRS_EXT HWCAP_S390_VXE +#define HWCAP_S390_GS 16384 +#define HWCAP_S390_VXRS_EXT2 32768 +#define HWCAP_S390_VXRS_PDE 65536 +#define HWCAP_S390_SORT 131072 +#define HWCAP_S390_DFLT 262144 +#define HWCAP_S390_VXRS_PDE2 524288 +#define HWCAP_S390_NNPA 1048576 +#define HWCAP_S390_PCI_MIO 2097152 +#define HWCAP_S390_SIE 4194304 + // https://elixir.bootlin.com/linux/latest/source/arch/riscv/include/uapi/asm/hwcap.h #define RISCV_HWCAP_A (1UL << ('A' - 'A')) #define RISCV_HWCAP_C (1UL << ('C' - 'A')) diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/internal/windows_utils.h b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/internal/windows_utils.h index 246bb20c9..1790adc9c 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/internal/windows_utils.h +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/internal/windows_utils.h @@ -3,6 +3,10 @@ #ifndef CPU_FEATURES_INCLUDE_INTERNAL_WINDOWS_UTILS_H_ #define CPU_FEATURES_INCLUDE_INTERNAL_WINDOWS_UTILS_H_ +#include "cpu_features_macros.h" + +#ifdef CPU_FEATURES_OS_WINDOWS + #include // IsProcessorFeaturePresent // modern WinSDK winnt.h contains newer features detection definitions @@ -18,4 +22,5 @@ #define PF_SSE4_2_INSTRUCTIONS_AVAILABLE 38 #endif +#endif // CPU_FEATURES_OS_WINDOWS #endif // CPU_FEATURES_INCLUDE_INTERNAL_WINDOWS_UTILS_H_ diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/impl_ppc_linux.c b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/impl_ppc_linux.c index 3303be405..9f9b3eef5 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/impl_ppc_linux.c +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/impl_ppc_linux.c @@ -58,6 +58,7 @@ LINE(PPC_SCV, scv, "scv", 0, PPC_FEATURE2_SCV) \ LINE(PPC_HTM_NO_SUSPEND, htm_no_suspend, "htm-no-suspend", 0, \ PPC_FEATURE2_HTM_NO_SUSPEND) +#undef PPC // Remove conflict with compiler generated preprocessor #define INTROSPECTION_PREFIX PPC #define INTROSPECTION_ENUM_PREFIX PPC #include "define_introspection_and_hwcaps.inl" diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/impl_s390x_linux.c b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/impl_s390x_linux.c new file mode 100644 index 000000000..f161009dd --- /dev/null +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/impl_s390x_linux.c @@ -0,0 +1,119 @@ +// SPDX-FileCopyrightText: 2022 IBM +// SPDX-License-Identifier: Apache-2.0 + +#include "cpu_features_macros.h" + +#ifdef CPU_FEATURES_ARCH_S390X +#ifdef CPU_FEATURES_OS_LINUX + +#include "cpuinfo_s390x.h" + +//////////////////////////////////////////////////////////////////////////////// +// Definitions for introspection. +//////////////////////////////////////////////////////////////////////////////// +#define INTROSPECTION_TABLE \ + LINE(S390_ESAN3, esan3, "esan3", HWCAP_S390_ESAN3, 0) \ + LINE(S390_ZARCH, zarch, "zarch", HWCAP_S390_ZARCH, 0) \ + LINE(S390_STFLE, stfle, "stfle", HWCAP_S390_STFLE, 0) \ + LINE(S390_MSA, msa, "msa", HWCAP_S390_MSA, 0) \ + LINE(S390_LDISP, ldisp, "ldisp", HWCAP_S390_LDISP, 0) \ + LINE(S390_EIMM, eimm, "eimm", HWCAP_S390_EIMM, 0) \ + LINE(S390_DFP, dfp, "dfp", HWCAP_S390_DFP, 0) \ + LINE(S390_EDAT, edat, "edat", HWCAP_S390_HPAGE, 0) \ + LINE(S390_ETF3EH, etf3eh, "etf3eh", HWCAP_S390_ETF3EH, 0) \ + LINE(S390_HIGHGPRS, highgprs, "highgprs", HWCAP_S390_HIGH_GPRS, 0) \ + LINE(S390_TE, te, "te", HWCAP_S390_TE, 0) \ + LINE(S390_VX, vx, "vx", HWCAP_S390_VXRS, 0) \ + LINE(S390_VXD, vxd, "vxd", HWCAP_S390_VXRS_BCD, 0) \ + LINE(S390_VXE, vxe, "vxe", HWCAP_S390_VXRS_EXT, 0) \ + LINE(S390_GS, gs, "gs", HWCAP_S390_GS, 0) \ + LINE(S390_VXE2, vxe2, "vxe2", HWCAP_S390_VXRS_EXT2, 0) \ + LINE(S390_VXP, vxp, "vxp", HWCAP_S390_VXRS_PDE, 0) \ + LINE(S390_SORT, sort, "sort", HWCAP_S390_SORT, 0) \ + LINE(S390_DFLT, dflt, "dflt", HWCAP_S390_DFLT, 0) \ + LINE(S390_VXP2, vxp2, "vxp2", HWCAP_S390_VXRS_PDE2, 0) \ + LINE(S390_NNPA, nnpa, "nnpa", HWCAP_S390_NNPA, 0) \ + LINE(S390_PCIMIO, pcimio, "pcimio", HWCAP_S390_PCI_MIO, 0) \ + LINE(S390_SIE, sie, "sie", HWCAP_S390_SIE, 0) +#define INTROSPECTION_PREFIX S390X +#define INTROSPECTION_ENUM_PREFIX S390X +#include "define_introspection_and_hwcaps.inl" + +//////////////////////////////////////////////////////////////////////////////// +// Implementation. +//////////////////////////////////////////////////////////////////////////////// + +#include "internal/bit_utils.h" +#include "internal/filesystem.h" +#include "internal/hwcaps.h" +#include "internal/stack_line_reader.h" +#include "internal/string_view.h" +#include + +static bool HandleS390XLine(const LineResult result, + S390XPlatformStrings* const strings) +{ + StringView line = result.line; + StringView key, value; + if (CpuFeatures_StringView_GetAttributeKeyValue(line, &key, &value)) + { + if (CpuFeatures_StringView_IsEquals(key, str("# processors"))) + { + strings->num_processors = CpuFeatures_StringView_ParsePositiveNumber(value); + } + } + return !result.eof; +} + +static void FillProcCpuInfoData(S390XPlatformStrings* const strings) +{ + const int fd = CpuFeatures_OpenFile("/proc/cpuinfo"); + if (fd >= 0) + { + StackLineReader reader; + StackLineReader_Initialize(&reader, fd); + for (;;) + { + if (!HandleS390XLine(StackLineReader_NextLine(&reader), strings)) + { + break; + } + } + CpuFeatures_CloseFile(fd); + } +} + +static const S390XInfo kEmptyS390XInfo; + +S390XInfo GetS390XInfo(void) +{ + S390XInfo info = kEmptyS390XInfo; + const HardwareCapabilities hwcaps = CpuFeatures_GetHardwareCapabilities(); + for (size_t i = 0; i < S390X_LAST_; ++i) + { + if (CpuFeatures_IsHwCapsSet(kHardwareCapabilities[i], hwcaps)) + { + kSetters[i](&info.features, true); + } + } + return info; +} + +static const S390XPlatformStrings kEmptyS390XPlatformStrings; + +S390XPlatformStrings GetS390XPlatformStrings(void) +{ + S390XPlatformStrings strings = kEmptyS390XPlatformStrings; + const char* platform = CpuFeatures_GetPlatformPointer(); + + FillProcCpuInfoData(&strings); + + if (platform != NULL) + CpuFeatures_StringView_CopyString(str(platform), strings.type.platform, + sizeof(strings.type.platform)); + + return strings; +} + +#endif // CPU_FEATURES_OS_LINUX +#endif // CPU_FEATURES_ARCH_S390X \ No newline at end of file diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/impl_x86__base_implementation.inl b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/impl_x86__base_implementation.inl index 29ad4b76c..e18b7cbba 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/impl_x86__base_implementation.inl +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/impl_x86__base_implementation.inl @@ -266,6 +266,7 @@ static void ParseCpuId(const Leaves* leaves, X86Info* info, const Leaf leaf_1 = leaves->leaf_1; const Leaf leaf_7 = leaves->leaf_7; const Leaf leaf_7_1 = leaves->leaf_7_1; + const Leaf leaf_80000001 = leaves->leaf_80000001; const bool have_xsave = IsBitSet(leaf_1.ecx, 26); const bool have_osxsave = IsBitSet(leaf_1.ecx, 27); @@ -321,9 +322,17 @@ static void ParseCpuId(const Leaves* leaves, X86Info* info, features->clflushopt = IsBitSet(leaf_7.ebx, 23); features->clwb = IsBitSet(leaf_7.ebx, 24); features->sha = IsBitSet(leaf_7.ebx, 29); + features->gfni = IsBitSet(leaf_7.ecx, 8); features->vaes = IsBitSet(leaf_7.ecx, 9); features->vpclmulqdq = IsBitSet(leaf_7.ecx, 10); + features->movdiri = IsBitSet(leaf_7.ecx, 27); + features->movdir64b = IsBitSet(leaf_7.ecx, 28); + features->fs_rep_mov = IsBitSet(leaf_7.edx, 4); + features->fz_rep_movsb = IsBitSet(leaf_7_1.eax, 10); + features->fs_rep_stosb = IsBitSet(leaf_7_1.eax, 11); + features->fs_rep_cmpsb_scasb = IsBitSet(leaf_7_1.eax, 12); features->adx = IsBitSet(leaf_7.ebx, 19); + features->lzcnt = IsBitSet(leaf_80000001.ecx, 5); ///////////////////////////////////////////////////////////////////////////// // The following section is devoted to Vector Extensions. @@ -355,6 +364,7 @@ static void ParseCpuId(const Leaves* leaves, X86Info* info, { features->fma3 = IsBitSet(leaf_1.ecx, 12); features->avx = IsBitSet(leaf_1.ecx, 28); + features->avx_vnni = IsBitSet(leaf_7_1.eax, 4); features->avx2 = IsBitSet(leaf_7.ebx, 5); } if (os_preserves->avx512_registers) @@ -378,6 +388,7 @@ static void ParseCpuId(const Leaves* leaves, X86Info* info, features->avx512_4fmaps = IsBitSet(leaf_7.edx, 3); features->avx512_bf16 = IsBitSet(leaf_7_1.eax, 5); features->avx512_vp2intersect = IsBitSet(leaf_7.edx, 8); + features->avx512_fp16 = IsBitSet(leaf_7.edx, 23); } if (os_preserves->amx_registers) { @@ -491,6 +502,15 @@ X86Microarchitecture GetX86Microarchitecture(const X86Info* info) case CPUID(0x06, 0x5C): // https://en.wikipedia.org/wiki/Goldmont return INTEL_ATOM_GMT; + case CPUID(0x06, 0x7A): + // https://en.wikichip.org/wiki/intel/microarchitectures/goldmont_plus + return INTEL_ATOM_GMT_PLUS; + case CPUID(0x06, 0x8A): + case CPUID(0x06, 0x96): + case CPUID(0x06, 0x9C): + // https://en.wikichip.org/wiki/intel/microarchitectures/tremont + return INTEL_ATOM_TMT; + case CPUID(0x06, 0x0E): case CPUID(0x06, 0x0F): case CPUID(0x06, 0x16): // https://en.wikipedia.org/wiki/Intel_Core_(microarchitecture) @@ -531,10 +551,16 @@ X86Microarchitecture GetX86Microarchitecture(const X86Info* info) // https://en.wikipedia.org/wiki/Broadwell_(microarchitecture) return INTEL_BDW; case CPUID(0x06, 0x4E): - case CPUID(0x06, 0x55): case CPUID(0x06, 0x5E): // https://en.wikipedia.org/wiki/Skylake_(microarchitecture) return INTEL_SKL; + case CPUID(0x06, 0x55): + if (info->stepping >= 6 && info->stepping <= 7) + { + // https://en.wikipedia.org/wiki/Cascade_Lake_(microprocessor) + return INTEL_CCL; + } + return INTEL_SKL; case CPUID(0x06, 0x66): // https://en.wikipedia.org/wiki/Cannon_Lake_(microarchitecture) return INTEL_CNL; @@ -582,11 +608,15 @@ X86Microarchitecture GetX86Microarchitecture(const X86Info* info) // https://en.wikichip.org/wiki/intel/microarchitectures/alder_lake return INTEL_ADL; case CPUID(0x06, 0xA5): + case CPUID(0x06, 0xA6): // https://en.wikichip.org/wiki/intel/microarchitectures/comet_lake return INTEL_CML; case CPUID(0x06, 0xA7): // https://en.wikichip.org/wiki/intel/microarchitectures/rocket_lake return INTEL_RCL; + case CPUID(0x06, 0xB7): + // https://en.wikichip.org/wiki/intel/microarchitectures/raptor_lake + return INTEL_RPL; case CPUID(0x06, 0x85): // https://en.wikichip.org/wiki/intel/microarchitectures/knights_mill return INTEL_KNIGHTS_M; @@ -702,6 +732,7 @@ X86Microarchitecture GetX86Microarchitecture(const X86Info* info) case CPUID(0x11, 0x03): // http://developer.amd.com/wordpress/media/2012/10/41788.pdf return AMD_K11; + case CPUID(0x12, 0x00): case CPUID(0x12, 0x01): // https://www.amd.com/system/files/TechDocs/44739_12h_Rev_Gd.pdf return AMD_K12; @@ -714,9 +745,11 @@ X86Microarchitecture GetX86Microarchitecture(const X86Info* info) // https://en.wikichip.org/wiki/amd/microarchitectures/bulldozer return AMD_BULLDOZER; case CPUID(0x15, 0x02): + case CPUID(0x15, 0x10): case CPUID(0x15, 0x11): case CPUID(0x15, 0x13): // https://en.wikichip.org/wiki/amd/microarchitectures/piledriver + // https://www.amd.com/system/files/TechDocs/48931_15h_Mod_10h-1Fh_Rev_Guide.pdf return AMD_PILEDRIVER; case CPUID(0x15, 0x30): case CPUID(0x15, 0x38): @@ -728,6 +761,7 @@ X86Microarchitecture GetX86Microarchitecture(const X86Info* info) // https://en.wikichip.org/wiki/amd/microarchitectures/excavator return AMD_EXCAVATOR; case CPUID(0x16, 0x00): + case CPUID(0x16, 0x26): return AMD_JAGUAR; case CPUID(0x16, 0x30): return AMD_PUMA; @@ -760,6 +794,7 @@ X86Microarchitecture GetX86Microarchitecture(const X86Info* info) // https://en.wikichip.org/wiki/amd/microarchitectures/zen_3 return AMD_ZEN3; case CPUID(0x19, 0x10): + case CPUID(0x19, 0x61): // https://en.wikichip.org/wiki/amd/microarchitectures/zen_4 return AMD_ZEN4; default: @@ -1687,16 +1722,18 @@ static void ParseCacheInfo(const int max_cpuid_leaf, uint32_t leaf_id, 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) + 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. + // Intel Processor Identification and the CPUID Instruction Application + // Note 485 page 37 Table 5-10. Deterministic Cache Parameters. + // We skip cache parsing in case null of cache type or cache type in the + // range of 4-31 according to documentation. + break; int level = ExtractBitRange(leaf.eax, 7, 5); int line_size = ExtractBitRange(leaf.ebx, 11, 0) + 1; int partitioning = ExtractBitRange(leaf.ebx, 21, 12) + 1; @@ -1717,6 +1754,123 @@ static void ParseCacheInfo(const int max_cpuid_leaf, uint32_t leaf_id, if (info.size > 0) *old_info = info; } +typedef struct +{ + int level; + int cache_id; + CacheType cache_type; +} CacheLevelInfoLegacyAMD; + +static int GetWaysLegacyAMD(int cache_level, const uint32_t cache_id) +{ + // https://www.amd.com/system/files/TechDocs/25481.pdf page 23 + // CPUID.8000_0005_ECX[23:16] L1 data cache associativity. + // CPUID.8000_0005_EDX[23:16] L1 instruction cache associativity. + if (cache_level == 1) + { + return ExtractBitRange(cache_id, 23, 16); + } + // https://www.amd.com/system/files/TechDocs/25481.pdf page 24 + // See Table 4: L2/L3 Cache and TLB Associativity Field Definition. + // CPUID.8000_0006_ECX[15:12] L2 cache associativity. + // CPUID.8000_0006_EDX[15:12] L3 cache associativity. + const int ways = ExtractBitRange(cache_id, 15, 12); + switch (ways) + { + case 0x0: + case 0x1: + case 0x2: + case 0x4: + return ways; + case 0x6: + return 8; + case 0x8: + return 16; + case 0xA: + return 32; + case 0xB: + return 48; + case 0xC: + return 64; + case 0xD: + return 96; + case 0xE: + return 128; + case 0xF: + return 255; + default: + return -1; // Reserved + } +} + +static int GetCacheSizeLegacyAMD(int cache_level, const uint32_t cache_id) +{ + switch (cache_level) + { + case 1: + // https://www.amd.com/system/files/TechDocs/25481.pdf page 23 + // CPUID.8000_0005_ECX[31:24] L1 data cache size in KB. + // CPUID.8000_0005_EDX[31:24] L1 instruction cache size KB. + return ExtractBitRange(cache_id, 31, 24); + case 2: + // https://www.amd.com/system/files/TechDocs/25481.pdf page 25 + // CPUID.8000_0006_ECX[31:16] L2 cache size in KB. + return ExtractBitRange(cache_id, 31, 16); + case 3: + // https://www.amd.com/system/files/TechDocs/25481.pdf page 25 + // CPUID.8000_0006_EDX[31:18] L3 cache size. + // Specifies the L3 cache size is within the following range: + // (L3Size[31:18] * 512KB) <= L3 cache size < ((L3Size[31:18]+1) * 512KB). + return ExtractBitRange(cache_id, 31, 18) * 512; + default: + return 0; + } +} + +#define LEGACY_AMD_MAX_CACHE_LEVEL 4 + +// https://www.amd.com/system/files/TechDocs/25481.pdf +// CPUID Fn8000_0005_E[A,B,C,D]X, Fn8000_0006_E[A,B,C,D]X - TLB and Cache info +static void ParseCacheInfoLegacyAMD(const uint32_t max_ext, CacheInfo* info) +{ + const Leaf cache_tlb_leaf1 = SafeCpuIdEx(max_ext, 0x80000005, 0); + const Leaf cache_tlb_leaf2 = SafeCpuIdEx(max_ext, 0x80000006, 0); + + const CacheLevelInfoLegacyAMD legacy_cache_info[LEGACY_AMD_MAX_CACHE_LEVEL] = + {(CacheLevelInfoLegacyAMD){.cache_id = cache_tlb_leaf1.ecx, + .cache_type = CPU_FEATURE_CACHE_DATA, + .level = 1}, + (CacheLevelInfoLegacyAMD){.cache_id = cache_tlb_leaf1.edx, + .cache_type = CPU_FEATURE_CACHE_INSTRUCTION, + .level = 1}, + (CacheLevelInfoLegacyAMD){.cache_id = cache_tlb_leaf2.ecx, + .cache_type = CPU_FEATURE_CACHE_UNIFIED, + .level = 2}, + (CacheLevelInfoLegacyAMD){.cache_id = cache_tlb_leaf2.edx, + .cache_type = CPU_FEATURE_CACHE_UNIFIED, + .level = 3}}; + + const int KiB = 1024; + const int UNDEF = -1; + for (int i = 0; i < LEGACY_AMD_MAX_CACHE_LEVEL; ++i) + { + const int level = legacy_cache_info[i].level; + const int cache_id = legacy_cache_info[i].cache_id; + const CacheType cache_type = legacy_cache_info[i].cache_type; + const int cache_size = GetCacheSizeLegacyAMD(level, cache_id); + if (cache_size == 0) break; + info->levels[i] = + (CacheLevelInfo){.level = level, + .cache_type = cache_type, + .cache_size = cache_size * KiB, + .ways = GetWaysLegacyAMD(level, cache_id), + .line_size = ExtractBitRange(cache_id, 7, 0), + .tlb_entries = UNDEF, + .partitioning = UNDEF}; + ++info->size; + } +} + CacheInfo GetX86CacheInfo(void) { CacheInfo info = kEmptyCacheInfo; @@ -1738,6 +1892,10 @@ CacheInfo GetX86CacheInfo(void) { ParseCacheInfo(leaves.max_cpuid_leaf_ext, 0x8000001D, &info); } + else + { + ParseCacheInfoLegacyAMD(leaves.max_cpuid_leaf_ext, &info); + } } return info; } @@ -1773,6 +1931,7 @@ CacheInfo GetX86CacheInfo(void) LINE(X86_SSE4_2, sse4_2, , , ) \ LINE(X86_SSE4A, sse4a, , , ) \ LINE(X86_AVX, avx, , , ) \ + LINE(X86_AVX_VNNI, avx_vnni, , , ) \ LINE(X86_AVX2, avx2, , , ) \ LINE(X86_AVX512F, avx512f, , , ) \ LINE(X86_AVX512CD, avx512cd, , , ) \ @@ -1793,6 +1952,7 @@ CacheInfo GetX86CacheInfo(void) LINE(X86_AVX512_4FMAPS, avx512_4fmaps, , , ) \ LINE(X86_AVX512_BF16, avx512_bf16, , , ) \ LINE(X86_AVX512_VP2INTERSECT, avx512_vp2intersect, , , ) \ + LINE(X86_AVX512_FP16, avx512_fp16, , , ) \ LINE(X86_AMX_BF16, amx_bf16, , , ) \ LINE(X86_AMX_TILE, amx_tile, , , ) \ LINE(X86_AMX_INT8, amx_int8, , , ) \ @@ -1806,7 +1966,15 @@ CacheInfo GetX86CacheInfo(void) LINE(X86_RDRND, rdrnd, , , ) \ LINE(X86_DCA, dca, , , ) \ LINE(X86_SS, ss, , , ) \ - LINE(X86_ADX, adx, , , ) + LINE(X86_ADX, adx, , , ) \ + LINE(X86_LZCNT, lzcnt, , , ) \ + LINE(X86_GFNI, gfni, , , ) \ + LINE(X86_MOVDIRI, movdiri, , , ) \ + LINE(X86_MOVDIR64B, movdir64b, , , ) \ + LINE(X86_FS_REP_MOV, fs_rep_mov, , , ) \ + LINE(X86_FZ_REP_MOVSB, fz_rep_movsb, , , ) \ + LINE(X86_FS_REP_STOSB, fs_rep_stosb, , , ) \ + LINE(X86_FS_REP_CMPSB_SCASB, fs_rep_cmpsb_scasb, , , ) #define INTROSPECTION_PREFIX X86 #define INTROSPECTION_ENUM_PREFIX X86 #include "define_introspection.inl" @@ -1831,7 +1999,10 @@ CacheInfo GetX86CacheInfo(void) LINE(INTEL_HSW) \ LINE(INTEL_BDW) \ LINE(INTEL_SKL) \ + LINE(INTEL_CCL) \ LINE(INTEL_ATOM_GMT) \ + LINE(INTEL_ATOM_GMT_PLUS) \ + LINE(INTEL_ATOM_TMT) \ LINE(INTEL_KBL) \ LINE(INTEL_CFL) \ LINE(INTEL_WHL) \ @@ -1842,6 +2013,7 @@ CacheInfo GetX86CacheInfo(void) LINE(INTEL_SPR) \ LINE(INTEL_ADL) \ LINE(INTEL_RCL) \ + LINE(INTEL_RPL) \ LINE(INTEL_KNIGHTS_M) \ LINE(INTEL_KNIGHTS_L) \ LINE(INTEL_KNIGHTS_F) \ diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/utils/list_cpu_features.c b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/utils/list_cpu_features.c index 859ef6954..38489640c 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/utils/list_cpu_features.c +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/utils/list_cpu_features.c @@ -23,6 +23,8 @@ #include "cpuinfo_mips.h" #elif defined(CPU_FEATURES_ARCH_PPC) #include "cpuinfo_ppc.h" +#elif defined(CPU_FEATURES_ARCH_S390X) +#include "cpuinfo_s390x.h" #endif // Design principles @@ -212,6 +214,9 @@ DEFINE_ADD_FLAGS(GetMipsFeaturesEnumValue, GetMipsFeaturesEnumName, #elif defined(CPU_FEATURES_ARCH_PPC) DEFINE_ADD_FLAGS(GetPPCFeaturesEnumValue, GetPPCFeaturesEnumName, PPCFeatures, PPC_LAST_) +#elif defined(CPU_FEATURES_ARCH_S390X) +DEFINE_ADD_FLAGS(GetS390XFeaturesEnumValue, GetS390XFeaturesEnumName, S390XFeatures, + S390X_LAST_) #endif // Prints a json string with characters escaping. @@ -389,7 +394,6 @@ static Node* CreateTree(void) { Node* root = CreateMap(); #if defined(CPU_FEATURES_ARCH_X86) - char brand_string[49]; const X86Info info = GetX86Info(); const CacheInfo cache_info = GetX86CacheInfo(); AddMapEntry(root, "arch", CreateString("x86")); @@ -435,6 +439,14 @@ static Node* CreateTree(void) AddMapEntry(root, "microarchitecture", CreateString(strings.type.base_platform)); AddFlags(root, &info.features); +#elif defined(CPU_FEATURES_ARCH_S390X) + const S390XInfo info = GetS390XInfo(); + const S390XPlatformStrings strings = GetS390XPlatformStrings(); + AddMapEntry(root, "arch", CreateString("s390x")); + AddMapEntry(root, "platform", CreateString("zSeries")); + AddMapEntry(root, "model", CreateString(strings.type.platform)); + AddMapEntry(root, "# processors", CreateInt(strings.num_processors)); + AddFlags(root, &info.features); #endif return root; } diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/CMakeLists.txt b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/CMakeLists.txt index f5330653c..e887cbb55 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/CMakeLists.txt +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/CMakeLists.txt @@ -92,3 +92,10 @@ if(PROCESSOR_IS_POWER) target_link_libraries(cpuinfo_ppc_test all_libraries) add_test(NAME cpuinfo_ppc_test COMMAND cpuinfo_ppc_test) endif() +##------------------------------------------------------------------------------ +## cpuinfo_s390x_test +if(PROCESSOR_IS_S390X) + add_executable(cpuinfo_s390x_test cpuinfo_s390x_test.cc ../src/impl_s390x_linux.c) + target_link_libraries(cpuinfo_s390x_test all_libraries) + add_test(NAME cpuinfo_s390x_test COMMAND cpuinfo_s390x_test) +endif() diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/cpuinfo_s390x_test.cc b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/cpuinfo_s390x_test.cc new file mode 100644 index 000000000..44a50cb4b --- /dev/null +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/cpuinfo_s390x_test.cc @@ -0,0 +1,79 @@ +// SPDX-FileCopyrightText: 2022 IBM +// SPDX-License-Identifier: Apache-2.0 + +#include "cpuinfo_s390x.h" +#include "filesystem_for_testing.h" +#include "gtest/gtest.h" +#include "hwcaps_for_testing.h" + +namespace cpu_features +{ +namespace +{ + +TEST(CpustringsS390XTest, S390XFeaturesEnum) +{ + const char* last_name = GetS390XFeaturesEnumName(S390X_LAST_); + EXPECT_STREQ(last_name, "unknown_feature"); + for (int i = static_cast(S390_ZARCH); i != static_cast(S390X_LAST_); ++i) + { + const auto feature = static_cast(i); + const char* name = GetS390XFeaturesEnumName(feature); + ASSERT_FALSE(name == nullptr); + EXPECT_STRNE(name, ""); + EXPECT_STRNE(name, last_name); + } +} + +TEST(CpustringsS390XTest, FromHardwareCap) +{ + ResetHwcaps(); + SetHardwareCapabilities(HWCAP_S390_ESAN3 | HWCAP_S390_HPAGE | + HWCAP_S390_NNPA | HWCAP_S390_SIE, + 0); + GetEmptyFilesystem(); // disabling /proc/cpuinfo + const auto info = GetS390XInfo(); + EXPECT_TRUE(info.features.esan3); + EXPECT_TRUE(info.features.edat); + EXPECT_TRUE(info.features.nnpa); + EXPECT_TRUE(info.features.sie); + EXPECT_FALSE(info.features.msa); + EXPECT_FALSE(info.features.stfle); + EXPECT_FALSE(info.features.vxp2); + EXPECT_FALSE(info.features.pcimio); +} + +TEST(CpustringsS390XTest, z16) +{ + ResetHwcaps(); + auto& fs = GetEmptyFilesystem(); + fs.CreateFile("/proc/cpuinfo", + R"(vendor_id : IBM/S390 +# processors : 24 +bogomips per cpu: 26315.00 +max thread id : 1 +features : esan3 zarch stfle msa ldisp eimm dfp edat etf3eh highgprs te vx vxd vxe gs vxe2 vxp sort dflt vxp2 nnpa pcimio sie )"); + SetPlatformPointer("z16"); + const auto strings = GetS390XPlatformStrings(); + EXPECT_EQ(strings.num_processors, 24); + ASSERT_STREQ(strings.type.platform, "z16"); +} + +TEST(CpustringsS390XTest, z15) +{ + ResetHwcaps(); + auto& fs = GetEmptyFilesystem(); + fs.CreateFile("/proc/cpuinfo", + R"(vendor_id : IBM/S390 +# processors : 2 +bogomips per cpu: 24038.00 +max thread id : 1 +features : esan3 zarch stfle msa ldisp eimm dfp edat etf3eh highgprs te vx vxd vxe gs vxe2 vxp sort dflt sie)"); + SetPlatformPointer("z15"); + const auto strings = GetS390XPlatformStrings(); + EXPECT_EQ(strings.num_processors, 2); + ASSERT_STREQ(strings.type.platform, "z15"); +} + +} // namespace +} // namespace cpu_features \ No newline at end of file diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/cpuinfo_x86_test.cc b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/cpuinfo_x86_test.cc index 15f2e3217..f83df2efa 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/cpuinfo_x86_test.cc +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/cpuinfo_x86_test.cc @@ -7,8 +7,8 @@ #include #include #if defined(CPU_FEATURES_OS_WINDOWS) -#include // IsProcessorFeaturePresent -#endif // CPU_FEATURES_OS_WINDOWS +#include "internal/windows_utils.h" +#endif // CPU_FEATURES_OS_WINDOWS #include "filesystem_for_testing.h" #include "gtest/gtest.h" @@ -161,7 +161,7 @@ TEST_F(CpuidX86Test, SandyBridge) {{0x00000007, 0}, Leaf{0x00000000, 0x00000000, 0x00000000, 0x00000000}}, }); const auto info = GetX86Info(); - EXPECT_STREQ(info.vendor, "GenuineIntel"); + EXPECT_STREQ(info.vendor, CPU_FEATURES_VENDOR_GENUINE_INTEL); EXPECT_EQ(info.family, 0x06); EXPECT_EQ(info.model, 0x02A); EXPECT_EQ(info.stepping, 0x06); @@ -225,13 +225,39 @@ TEST_F(CpuidX86Test, SkyLake) {{0x00000007, 0}, Leaf{0x00000000, 0x029C67AF, 0x00000000, 0x00000000}}, }); const auto info = GetX86Info(); - EXPECT_STREQ(info.vendor, "GenuineIntel"); + EXPECT_STREQ(info.vendor, CPU_FEATURES_VENDOR_GENUINE_INTEL); EXPECT_EQ(info.family, 0x06); EXPECT_EQ(info.model, 0x04E); EXPECT_EQ(info.stepping, 0x03); EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::INTEL_SKL); } +// http://users.atw.hu/instlatx64/GenuineIntel/GenuineIntel0050654_SkylakeXeon_CPUID8.txt +TEST_F(CpuidX86Test, SkyLakeXeon) +{ + cpu().SetLeaves({{{0x00000000, 0}, Leaf{0x00000016, 0x756E6547, 0x6C65746E, 0x49656E69}}, + {{0x00000001, 0}, Leaf{0x00050654, 0x00100800, 0x7FFEFBFF, 0xBFEBFBFF}}}); + const auto info = GetX86Info(); + EXPECT_STREQ(info.vendor, CPU_FEATURES_VENDOR_GENUINE_INTEL); + EXPECT_EQ(info.family, 0x06); + EXPECT_EQ(info.model, 0x055); + EXPECT_EQ(info.stepping, 0x04); + EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::INTEL_SKL); +} + +// http://users.atw.hu/instlatx64/GenuineIntel/GenuineIntel0050657_CascadeLakeXeon_CPUID.txt +TEST_F(CpuidX86Test, CascadeLake) +{ + cpu().SetLeaves({{{0x00000000, 0}, Leaf{0x00000016, 0x756E6547, 0x6C65746E, 0x49656E69}}, + {{0x00000001, 0}, Leaf{0x00050657, 0x00400800, 0x7FFEFBFF, 0xBFEBFBFF}}}); + const auto info = GetX86Info(); + EXPECT_STREQ(info.vendor, CPU_FEATURES_VENDOR_GENUINE_INTEL); + EXPECT_EQ(info.family, 0x06); + EXPECT_EQ(info.model, 0x055); + EXPECT_EQ(info.stepping, 0x07); + EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::INTEL_CCL); +} + TEST_F(CpuidX86Test, Branding) { cpu().SetLeaves({ @@ -266,7 +292,7 @@ TEST_F(CpuidX86Test, KabyLakeCache) 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_type, CacheType::CPU_FEATURE_CACHE_DATA); EXPECT_EQ(info.levels[0].cache_size, 32 * KiB); EXPECT_EQ(info.levels[0].ways, 8); EXPECT_EQ(info.levels[0].line_size, 64); @@ -274,7 +300,8 @@ TEST_F(CpuidX86Test, KabyLakeCache) 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_type, + CacheType::CPU_FEATURE_CACHE_INSTRUCTION); EXPECT_EQ(info.levels[1].cache_size, 32 * KiB); EXPECT_EQ(info.levels[1].ways, 8); EXPECT_EQ(info.levels[1].line_size, 64); @@ -282,7 +309,7 @@ TEST_F(CpuidX86Test, KabyLakeCache) 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_type, CacheType::CPU_FEATURE_CACHE_UNIFIED); EXPECT_EQ(info.levels[2].cache_size, 256 * KiB); EXPECT_EQ(info.levels[2].ways, 4); EXPECT_EQ(info.levels[2].line_size, 64); @@ -290,7 +317,7 @@ TEST_F(CpuidX86Test, KabyLakeCache) 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_type, CacheType::CPU_FEATURE_CACHE_UNIFIED); EXPECT_EQ(info.levels[3].cache_size, 6 * MiB); EXPECT_EQ(info.levels[3].ways, 12); EXPECT_EQ(info.levels[3].line_size, 64); @@ -316,7 +343,7 @@ TEST_F(CpuidX86Test, HSWCache) 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_type, CacheType::CPU_FEATURE_CACHE_DATA); EXPECT_EQ(info.levels[0].cache_size, 32 * KiB); EXPECT_EQ(info.levels[0].ways, 8); EXPECT_EQ(info.levels[0].line_size, 64); @@ -324,7 +351,8 @@ TEST_F(CpuidX86Test, HSWCache) 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_type, + CacheType::CPU_FEATURE_CACHE_INSTRUCTION); EXPECT_EQ(info.levels[1].cache_size, 32 * KiB); EXPECT_EQ(info.levels[1].ways, 8); EXPECT_EQ(info.levels[1].line_size, 64); @@ -332,7 +360,7 @@ TEST_F(CpuidX86Test, HSWCache) 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_type, CacheType::CPU_FEATURE_CACHE_UNIFIED); EXPECT_EQ(info.levels[2].cache_size, 256 * KiB); EXPECT_EQ(info.levels[2].ways, 8); EXPECT_EQ(info.levels[2].line_size, 64); @@ -340,7 +368,7 @@ TEST_F(CpuidX86Test, HSWCache) 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_type, CacheType::CPU_FEATURE_CACHE_UNIFIED); EXPECT_EQ(info.levels[3].cache_size, 6 * MiB); EXPECT_EQ(info.levels[3].ways, 12); EXPECT_EQ(info.levels[3].line_size, 64); @@ -359,7 +387,7 @@ TEST_F(CpuidX86Test, AMD_K11_GRIFFIN) }); const auto info = GetX86Info(); - EXPECT_STREQ(info.vendor, "AuthenticAMD"); + EXPECT_STREQ(info.vendor, CPU_FEATURES_VENDOR_AUTHENTIC_AMD); EXPECT_EQ(info.family, 0x11); EXPECT_EQ(info.model, 0x03); EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::AMD_K11); @@ -376,7 +404,7 @@ TEST_F(CpuidX86Test, AMD_K12_LLANO) }); const auto info = GetX86Info(); - EXPECT_STREQ(info.vendor, "AuthenticAMD"); + EXPECT_STREQ(info.vendor, CPU_FEATURES_VENDOR_AUTHENTIC_AMD); EXPECT_EQ(info.family, 0x12); EXPECT_EQ(info.model, 0x01); EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::AMD_K12); @@ -393,7 +421,7 @@ TEST_F(CpuidX86Test, AMD_K14_BOBCAT_AMD0500F01) }); const auto info = GetX86Info(); - EXPECT_STREQ(info.vendor, "AuthenticAMD"); + EXPECT_STREQ(info.vendor, CPU_FEATURES_VENDOR_AUTHENTIC_AMD); EXPECT_EQ(info.family, 0x14); EXPECT_EQ(info.model, 0x00); EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::AMD_BOBCAT); @@ -418,7 +446,7 @@ TEST_F(CpuidX86Test, AMD_K14_BOBCAT_AMD0500F10) }); const auto info = GetX86Info(); - EXPECT_STREQ(info.vendor, "AuthenticAMD"); + EXPECT_STREQ(info.vendor, CPU_FEATURES_VENDOR_AUTHENTIC_AMD); EXPECT_EQ(info.family, 0x14); EXPECT_EQ(info.model, 0x01); EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::AMD_BOBCAT); @@ -435,7 +463,7 @@ TEST_F(CpuidX86Test, AMD_K14_BOBCAT_AMD0500F20) }); const auto info = GetX86Info(); - EXPECT_STREQ(info.vendor, "AuthenticAMD"); + EXPECT_STREQ(info.vendor, CPU_FEATURES_VENDOR_AUTHENTIC_AMD); EXPECT_EQ(info.family, 0x14); EXPECT_EQ(info.model, 0x02); EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::AMD_BOBCAT); @@ -456,7 +484,7 @@ TEST_F(CpuidX86Test, AMD_K15_EXCAVATOR_STONEY_RIDGE) }); const auto info = GetX86Info(); - EXPECT_STREQ(info.vendor, "AuthenticAMD"); + EXPECT_STREQ(info.vendor, CPU_FEATURES_VENDOR_AUTHENTIC_AMD); EXPECT_EQ(info.family, 0x15); EXPECT_EQ(info.model, 0x70); EXPECT_STREQ(info.brand_string, @@ -480,7 +508,7 @@ TEST_F(CpuidX86Test, AMD_K15_PILEDRIVER_ABU_DHABI) }); const auto info = GetX86Info(); - EXPECT_STREQ(info.vendor, "AuthenticAMD"); + EXPECT_STREQ(info.vendor, CPU_FEATURES_VENDOR_AUTHENTIC_AMD); EXPECT_EQ(info.family, 0x15); EXPECT_EQ(info.model, 0x02); EXPECT_STREQ(info.brand_string, @@ -508,7 +536,7 @@ TEST_F(CpuidX86Test, AMD_K15_PILEDRIVER_ABU_DHABI_CACHE_INFO) 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_type, CacheType::CPU_FEATURE_CACHE_DATA); EXPECT_EQ(info.levels[0].cache_size, 16 * KiB); EXPECT_EQ(info.levels[0].ways, 4); EXPECT_EQ(info.levels[0].line_size, 64); @@ -516,7 +544,8 @@ TEST_F(CpuidX86Test, AMD_K15_PILEDRIVER_ABU_DHABI_CACHE_INFO) 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_type, + CacheType::CPU_FEATURE_CACHE_INSTRUCTION); EXPECT_EQ(info.levels[1].cache_size, 64 * KiB); EXPECT_EQ(info.levels[1].ways, 2); EXPECT_EQ(info.levels[1].line_size, 64); @@ -524,7 +553,7 @@ TEST_F(CpuidX86Test, AMD_K15_PILEDRIVER_ABU_DHABI_CACHE_INFO) 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_type, CacheType::CPU_FEATURE_CACHE_UNIFIED); EXPECT_EQ(info.levels[2].cache_size, 2 * MiB); EXPECT_EQ(info.levels[2].ways, 16); EXPECT_EQ(info.levels[2].line_size, 64); @@ -532,7 +561,7 @@ TEST_F(CpuidX86Test, AMD_K15_PILEDRIVER_ABU_DHABI_CACHE_INFO) 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_type, CacheType::CPU_FEATURE_CACHE_UNIFIED); EXPECT_EQ(info.levels[3].cache_size, 6 * MiB); EXPECT_EQ(info.levels[3].ways, 48); EXPECT_EQ(info.levels[3].line_size, 64); @@ -540,6 +569,30 @@ TEST_F(CpuidX86Test, AMD_K15_PILEDRIVER_ABU_DHABI_CACHE_INFO) EXPECT_EQ(info.levels[3].partitioning, 1); } +// https://github.com/InstLatx64/InstLatx64/blob/master/AuthenticAMD/AuthenticAMD0610F01_K15_Piledriver_CPUID.txt +TEST_F(CpuidX86Test, AMD_K15_PILEDRIVER_A10) +{ + cpu().SetLeaves({ + {{0x00000000, 0}, Leaf{0x0000000D, 0x68747541, 0x444D4163, 0x69746E65}}, + {{0x00000001, 0}, Leaf{0x00610F01, 0x00040800, 0x3E98320B, 0x178BFBFF}}, + {{0x00000007, 0}, Leaf{0x00000000, 0x00000008, 0x00000000, 0x00000000}}, + {{0x80000000, 0}, Leaf{0x8000001E, 0x68747541, 0x444D4163, 0x69746E65}}, + {{0x80000001, 0}, Leaf{0x00610F01, 0x20000000, 0x01EBBFFF, 0x2FD3FBFF}}, + {{0x80000002, 0}, Leaf{0x20444D41, 0x2D303141, 0x30303835, 0x5041204B}}, + {{0x80000003, 0}, Leaf{0x69772055, 0x52206874, 0x6F656461, 0x6D74286E}}, + {{0x80000004, 0}, Leaf{0x44482029, 0x61724720, 0x63696870, 0x00202073}}, + }); + const auto info = GetX86Info(); + + EXPECT_STREQ(info.vendor, CPU_FEATURES_VENDOR_AUTHENTIC_AMD); + EXPECT_EQ(info.family, 0x15); + EXPECT_EQ(info.model, 0x10); + EXPECT_STREQ(info.brand_string, + "AMD A10-5800K APU with Radeon(tm) HD Graphics "); + EXPECT_EQ(GetX86Microarchitecture(&info), + X86Microarchitecture::AMD_PILEDRIVER); +} + // http://users.atw.hu/instlatx64/AuthenticAMD/AuthenticAMD0600F12_K15_Interlagos_CPUID3.txt TEST_F(CpuidX86Test, AMD_K15_BULLDOZER_INTERLAGOS) { @@ -555,7 +608,7 @@ TEST_F(CpuidX86Test, AMD_K15_BULLDOZER_INTERLAGOS) }); const auto info = GetX86Info(); - EXPECT_STREQ(info.vendor, "AuthenticAMD"); + EXPECT_STREQ(info.vendor, CPU_FEATURES_VENDOR_AUTHENTIC_AMD); EXPECT_EQ(info.family, 0x15); EXPECT_EQ(info.model, 0x01); EXPECT_STREQ(info.brand_string, @@ -580,7 +633,7 @@ TEST_F(CpuidX86Test, AMD_K15_STREAMROLLER_GODAVARI) }); const auto info = GetX86Info(); - EXPECT_STREQ(info.vendor, "AuthenticAMD"); + EXPECT_STREQ(info.vendor, CPU_FEATURES_VENDOR_AUTHENTIC_AMD); EXPECT_EQ(info.family, 0x15); EXPECT_EQ(info.model, 0x38); EXPECT_EQ(info.stepping, 0x01); @@ -590,6 +643,28 @@ TEST_F(CpuidX86Test, AMD_K15_STREAMROLLER_GODAVARI) X86Microarchitecture::AMD_STREAMROLLER); } +// http://users.atw.hu/instlatx64/AuthenticAMD/AuthenticAMD0600F12_K15_Zambezi8C_CPUID.txt +TEST_F(CpuidX86Test, AMD_K15_BULLDOZER_ZAMBEZI_ABM) +{ + cpu().SetLeaves({ + {{0x00000000, 0}, Leaf{0x0000000D, 0x68747541, 0x444D4163, 0x69746E65}}, + {{0x00000001, 0}, Leaf{0x00600F12, 0x00080800, 0x1E98220B, 0x178BFBFF}}, + {{0x00000007, 0}, Leaf{0x00000000, 0x00000000, 0x00000000, 0x00000000}}, + {{0x80000000, 0}, Leaf{0x8000001E, 0x68747541, 0x444D4163, 0x69746E65}}, + {{0x80000001, 0}, Leaf{0x00600F12, 0x10000000, 0x01C9BFFF, 0x2FD3FBFF}}, + }); + const auto info = GetX86Info(); + + EXPECT_STREQ(info.vendor, CPU_FEATURES_VENDOR_AUTHENTIC_AMD); + EXPECT_EQ(info.family, 0x15); + EXPECT_EQ(info.model, 0x01); + + EXPECT_EQ(GetX86Microarchitecture(&info), + X86Microarchitecture::AMD_BULLDOZER); + + EXPECT_TRUE(info.features.lzcnt); +} + // http://users.atw.hu/instlatx64/AuthenticAMD/AuthenticAMD0700F01_K16_Kabini_CPUID.txt TEST_F(CpuidX86Test, AMD_K16_JAGUAR_KABINI) { @@ -605,7 +680,7 @@ TEST_F(CpuidX86Test, AMD_K16_JAGUAR_KABINI) }); const auto info = GetX86Info(); - EXPECT_STREQ(info.vendor, "AuthenticAMD"); + EXPECT_STREQ(info.vendor, CPU_FEATURES_VENDOR_AUTHENTIC_AMD); EXPECT_EQ(info.family, 0x16); EXPECT_EQ(info.model, 0x00); EXPECT_STREQ(info.brand_string, @@ -628,7 +703,7 @@ TEST_F(CpuidX86Test, AMD_K16_PUMA_BEEMA) }); const auto info = GetX86Info(); - EXPECT_STREQ(info.vendor, "AuthenticAMD"); + EXPECT_STREQ(info.vendor, CPU_FEATURES_VENDOR_AUTHENTIC_AMD); EXPECT_EQ(info.family, 0x16); EXPECT_EQ(info.model, 0x30); EXPECT_STREQ(info.brand_string, @@ -636,6 +711,29 @@ TEST_F(CpuidX86Test, AMD_K16_PUMA_BEEMA) EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::AMD_PUMA); } +// https://github.com/InstLatx64/InstLatx64/blob/master/AuthenticAMD/AuthenticAMD0720F61_K16_Cato_CPUID.txt +TEST_F(CpuidX86Test, AMD_K16_CATO) +{ + cpu().SetLeaves({ + {{0x00000000, 0}, Leaf{0x0000000D, 0x68747541, 0x444D4163, 0x69746E65}}, + {{0x00000001, 0}, Leaf{0x00720F61, 0x00080800, 0x3ED8220B, 0x178BFBFF}}, + {{0x00000007, 0}, Leaf{0x00000000, 0x00000008, 0x00000000, 0x00000000}}, + {{0x80000000, 0}, Leaf{0x8000001E, 0x68747541, 0x444D4163, 0x69746E65}}, + {{0x80000001, 0}, Leaf{0x00720F61, 0x00000000, 0x154837FF, 0x2FD3FBFF}}, + {{0x80000002, 0}, Leaf{0x20444D41, 0x392D3941, 0x20303238, 0x636F7250}}, + {{0x80000003, 0}, Leaf{0x6F737365, 0x00000072, 0x00000000, 0x00000000}}, + {{0x80000004, 0}, Leaf{0x00000000, 0x00000000, 0x00000000, 0x00000000}}, + }); + const auto info = GetX86Info(); + + EXPECT_STREQ(info.vendor, CPU_FEATURES_VENDOR_AUTHENTIC_AMD); + EXPECT_EQ(info.family, 0x16); + EXPECT_EQ(info.model, 0x26); + EXPECT_STREQ(info.brand_string, + "AMD A9-9820 Processor"); + EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::AMD_JAGUAR); +} + // http://users.atw.hu/instlatx64/AuthenticAMD/AuthenticAMD0820F01_K17_Dali_CPUID.txt TEST_F(CpuidX86Test, AMD_K17_ZEN_DALI) { @@ -651,7 +749,7 @@ TEST_F(CpuidX86Test, AMD_K17_ZEN_DALI) }); const auto info = GetX86Info(); - EXPECT_STREQ(info.vendor, "AuthenticAMD"); + EXPECT_STREQ(info.vendor, CPU_FEATURES_VENDOR_AUTHENTIC_AMD); EXPECT_EQ(info.family, 0x17); EXPECT_EQ(info.model, 0x20); EXPECT_STREQ(info.brand_string, @@ -674,7 +772,7 @@ TEST_F(CpuidX86Test, AMD_K17_ZEN_PLUS_PINNACLE_RIDGE) }); const auto info = GetX86Info(); - EXPECT_STREQ(info.vendor, "AuthenticAMD"); + EXPECT_STREQ(info.vendor, CPU_FEATURES_VENDOR_AUTHENTIC_AMD); EXPECT_EQ(info.family, 0x17); EXPECT_EQ(info.model, 0x08); EXPECT_STREQ(info.brand_string, @@ -697,7 +795,7 @@ TEST_F(CpuidX86Test, AMD_K17_ZEN2_XBOX_SERIES_X) }); const auto info = GetX86Info(); - EXPECT_STREQ(info.vendor, "AuthenticAMD"); + EXPECT_STREQ(info.vendor, CPU_FEATURES_VENDOR_AUTHENTIC_AMD); EXPECT_EQ(info.family, 0x17); EXPECT_EQ(info.model, 0x47); EXPECT_STREQ(info.brand_string, "AMD 4700S 8-Core Processor Desktop Kit"); @@ -719,7 +817,7 @@ TEST_F(CpuidX86Test, AMD_K18_ZEN_DHYANA) }); const auto info = GetX86Info(); - EXPECT_STREQ(info.vendor, "HygonGenuine"); + EXPECT_STREQ(info.vendor, CPU_FEATURES_VENDOR_HYGON_GENUINE); EXPECT_EQ(info.family, 0x18); EXPECT_EQ(info.model, 0x00); EXPECT_STREQ(info.brand_string, @@ -744,7 +842,7 @@ TEST_F(CpuidX86Test, AMD_K18_ZEN_DHYANA_CACHE_INFO) 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_type, CacheType::CPU_FEATURE_CACHE_DATA); EXPECT_EQ(info.levels[0].cache_size, 32 * KiB); EXPECT_EQ(info.levels[0].ways, 8); EXPECT_EQ(info.levels[0].line_size, 64); @@ -752,7 +850,8 @@ TEST_F(CpuidX86Test, AMD_K18_ZEN_DHYANA_CACHE_INFO) 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_type, + CacheType::CPU_FEATURE_CACHE_INSTRUCTION); EXPECT_EQ(info.levels[1].cache_size, 64 * KiB); EXPECT_EQ(info.levels[1].ways, 4); EXPECT_EQ(info.levels[1].line_size, 64); @@ -760,7 +859,7 @@ TEST_F(CpuidX86Test, AMD_K18_ZEN_DHYANA_CACHE_INFO) 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_type, CacheType::CPU_FEATURE_CACHE_UNIFIED); EXPECT_EQ(info.levels[2].cache_size, 512 * KiB); EXPECT_EQ(info.levels[2].ways, 8); EXPECT_EQ(info.levels[2].line_size, 64); @@ -768,7 +867,7 @@ TEST_F(CpuidX86Test, AMD_K18_ZEN_DHYANA_CACHE_INFO) 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_type, CacheType::CPU_FEATURE_CACHE_UNIFIED); EXPECT_EQ(info.levels[3].cache_size, 8 * MiB); EXPECT_EQ(info.levels[3].ways, 16); EXPECT_EQ(info.levels[3].line_size, 64); @@ -791,7 +890,7 @@ TEST_F(CpuidX86Test, AMD_K19_ZEN3_VERMEER) }); const auto info = GetX86Info(); - EXPECT_STREQ(info.vendor, "AuthenticAMD"); + EXPECT_STREQ(info.vendor, CPU_FEATURES_VENDOR_AUTHENTIC_AMD); EXPECT_EQ(info.family, 0x19); EXPECT_EQ(info.model, 0x21); EXPECT_STREQ(info.brand_string, @@ -813,7 +912,7 @@ TEST_F(CpuidX86Test, AMD_K19_ZEN3) }); const auto info = GetX86Info(); - EXPECT_STREQ(info.vendor, "AuthenticAMD"); + EXPECT_STREQ(info.vendor, CPU_FEATURES_VENDOR_AUTHENTIC_AMD); EXPECT_EQ(info.family, 0x19); EXPECT_EQ(info.model, 0x44); EXPECT_STREQ(info.brand_string, @@ -821,6 +920,28 @@ TEST_F(CpuidX86Test, AMD_K19_ZEN3) EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::AMD_ZEN3); } +// http://users.atw.hu/instlatx64/AuthenticAMD/AuthenticAMD0A60F12_K19_Raphael_01_CPUID.txt +TEST_F(CpuidX86Test, AMD_K19_ZEN4_RAPHAEL) +{ + cpu().SetLeaves({ + {{0x00000000, 0}, Leaf{0x00000010, 0x68747541, 0x444D4163, 0x69746E65}}, + {{0x00000001, 0}, Leaf{0x00A60F12, 0x000C0800, 0x7EF8320B, 0x178BFBFF}}, + {{0x80000000, 0}, Leaf{0x80000028, 0x68747541, 0x444D4163, 0x69746E65}}, + {{0x80000001, 0}, Leaf{0x00A60F12, 0x00000000, 0x75C237FF, 0x2FD3FBFF}}, + {{0x80000002, 0}, Leaf{0x20444D41, 0x657A7952, 0x2035206E, 0x30303637}}, + {{0x80000003, 0}, Leaf{0x2D362058, 0x65726F43, 0x6F725020, 0x73736563}}, + {{0x80000004, 0}, Leaf{0x2020726F, 0x20202020, 0x20202020, 0x00202020}}, + }); + const auto info = GetX86Info(); + + EXPECT_STREQ(info.vendor, CPU_FEATURES_VENDOR_AUTHENTIC_AMD); + EXPECT_EQ(info.family, 0x19); + EXPECT_EQ(info.model, 0x61); + EXPECT_STREQ(info.brand_string, + "AMD Ryzen 5 7600X 6-Core Processor "); + EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::AMD_ZEN4); +} + // http://users.atw.hu/instlatx64/HygonGenuine/HygonGenuine0900F11_Hygon_01_CPUID.txt TEST_F(CpuidX86Test, AMD_K18_ZEN_DHYANA_OCTAL_CORE_C86_3250) { @@ -837,12 +958,274 @@ TEST_F(CpuidX86Test, AMD_K18_ZEN_DHYANA_OCTAL_CORE_C86_3250) EXPECT_EQ(info.model, 0x01); EXPECT_EQ(info.family, 0x18); - EXPECT_STREQ(info.vendor, "HygonGenuine"); + EXPECT_STREQ(info.vendor, CPU_FEATURES_VENDOR_HYGON_GENUINE); EXPECT_STREQ(info.brand_string, "Hygon C86 3250 8-core Processor "); EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::AMD_ZEN); } +// http://users.atw.hu/instlatx64/GenuineIntel/GenuineIntel00906A4_AlderLakeP_00_CPUID.txt +TEST_F(CpuidX86Test, INTEL_ALDER_LAKE_AVX_VNNI) +{ + cpu().SetOsBackupsExtendedRegisters(true); + cpu().SetLeaves({ + {{0x00000000, 0}, Leaf{0x00000020, 0x756E6547, 0x6C65746E, 0x49656E69}}, + {{0x00000001, 0}, Leaf{0x000906A4, 0x00400800, 0x7FFAFBBF, 0xBFEBFBFF}}, + {{0x00000007, 0}, Leaf{0x00000001, 0x239CA7EB, 0x984007AC, 0xFC18C410}}, + {{0x00000007, 1}, Leaf{0x00400810, 0x00000000, 0x00000000, 0x00000000}}, + }); + const auto info = GetX86Info(); + + EXPECT_STREQ(info.vendor, CPU_FEATURES_VENDOR_GENUINE_INTEL); + EXPECT_EQ(info.family, 0x06); + EXPECT_EQ(info.model, 0x9A); + EXPECT_TRUE(info.features.avx_vnni); + EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::INTEL_ADL); +} + +// https://github.com/InstLatx64/InstLatx64/blob/master/GenuineIntel/GenuineIntel0090672_AlderLake_BC_AVX512_CPUID01.txt +TEST_F(CpuidX86Test, INTEL_ALDER_LAKE_AVX512) +{ + cpu().SetOsBackupsExtendedRegisters(true); +#if defined(CPU_FEATURES_OS_MACOS) + cpu().SetDarwinSysCtlByName("hw.optional.avx512f"); +#endif + cpu().SetLeaves({ + {{0x00000000, 0}, Leaf{0x00000020, 0x756E6547, 0x6C65746E, 0x49656E69}}, + {{0x00000001, 0}, Leaf{0x000906A4, 0x00400800, 0x7FFAFBBF, 0xBFEBFBFF}}, + {{0x00000007, 0}, Leaf{0x00000001, 0xF3BFA7EB, 0x98C07FEE, 0xFC9CC510}}, + {{0x00000007, 1}, Leaf{0x00401C30, 0x00000000, 0x00000000, 0x00000000}}, + }); + + const auto info = GetX86Info(); + + EXPECT_STREQ(info.vendor, CPU_FEATURES_VENDOR_GENUINE_INTEL); + EXPECT_EQ(info.family, 0x06); + EXPECT_EQ(info.model, 0x9A); + EXPECT_TRUE(info.features.avx512f); + EXPECT_TRUE(info.features.avx512bw); + EXPECT_TRUE(info.features.avx512dq); + EXPECT_TRUE(info.features.avx512cd); + EXPECT_TRUE(info.features.avx512vl); + EXPECT_TRUE(info.features.avx512_vp2intersect); + EXPECT_TRUE(info.features.avx512vbmi); + EXPECT_TRUE(info.features.avx512vbmi2); + EXPECT_TRUE(info.features.avx512bitalg); + EXPECT_TRUE(info.features.avx512vpopcntdq); + EXPECT_TRUE(info.features.avx512ifma); + EXPECT_TRUE(info.features.avx512_bf16); + EXPECT_TRUE(info.features.avx512_fp16); + + EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::INTEL_ADL); +} + +// https://github.com/InstLatx64/InstLatx64/blob/master/GenuineIntel/GenuineIntel00806C1_TigerLake_CPUID3.txt +TEST_F(CpuidX86Test, INTEL_TIGER_LAKE_AVX512) +{ + cpu().SetOsBackupsExtendedRegisters(true); +#if defined(CPU_FEATURES_OS_MACOS) + cpu().SetDarwinSysCtlByName("hw.optional.avx512f"); +#endif + cpu().SetLeaves({ + {{0x00000000, 0}, Leaf{0x0000001B, 0x756E6547, 0x6C65746E, 0x49656E69}}, + {{0x00000001, 0}, Leaf{0x000806C1, 0x00100800, 0x7FFAFBBF, 0xBFEBFBFF}}, + {{0x00000007, 0}, Leaf{0x00000000, 0xF3BFA7EB, 0x18C05FCE, 0xFC100510}}, + }); + + const auto info = GetX86Info(); + + EXPECT_STREQ(info.vendor, CPU_FEATURES_VENDOR_GENUINE_INTEL); + EXPECT_EQ(info.family, 0x06); + EXPECT_EQ(info.model, 0x8C); + EXPECT_TRUE(info.features.avx512f); + EXPECT_TRUE(info.features.avx512bw); + EXPECT_TRUE(info.features.avx512dq); + EXPECT_TRUE(info.features.avx512cd); + EXPECT_TRUE(info.features.avx512vl); + EXPECT_TRUE(info.features.avx512_vp2intersect); + EXPECT_TRUE(info.features.avx512vbmi); + EXPECT_TRUE(info.features.avx512vbmi2); + EXPECT_TRUE(info.features.avx512bitalg); + EXPECT_TRUE(info.features.avx512vpopcntdq); + EXPECT_TRUE(info.features.avx512ifma); + + EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::INTEL_TGL); +} + +// http://users.atw.hu/instlatx64/GenuineIntel/GenuineIntel00706E5_IceLakeY_CPUID.txt +TEST_F(CpuidX86Test, INTEL_ICE_LAKE_GFNI) +{ + cpu().SetLeaves({ + {{0x00000000, 0}, Leaf{0x0000001B, 0x756E6547, 0x6C65746E, 0x49656E69}}, + {{0x00000001, 0}, Leaf{0x000706E5, 0x00100800, 0x7FFAFBBF, 0xBFEBFBFF}}, + {{0x00000007, 0}, Leaf{0x00000000, 0xF2BF27EF, 0x40405F4E, 0xBC000410}}, + }); + + const auto info = GetX86Info(); + + EXPECT_STREQ(info.vendor, CPU_FEATURES_VENDOR_GENUINE_INTEL); + EXPECT_EQ(info.family, 0x06); + EXPECT_EQ(info.model, 0x7E); + EXPECT_TRUE(info.features.gfni); + + EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::INTEL_ICL); +} + +// http://users.atw.hu/instlatx64/GenuineIntel/GenuineIntel00906C0_JasperLake_CPUID01.txt +TEST_F(CpuidX86Test, INTEL_TREMONT_JASPER_LAKE_MOVDR) +{ + cpu().SetLeaves({ + {{0x00000000, 0}, Leaf{0x0000001B, 0x756E6547, 0x6C65746E, 0x49656E69}}, + {{0x00000001, 0}, Leaf{0x00090661, 0x00800800, 0x4FF8EBBF, 0xBFEBFBFF}}, + {{0x00000007, 0}, Leaf{0x00000000, 0x2394A2C3, 0x18400124, 0xFC000400}}, + }); + + const auto info = GetX86Info(); + + EXPECT_STREQ(info.vendor, CPU_FEATURES_VENDOR_GENUINE_INTEL); + EXPECT_EQ(info.family, 0x06); + EXPECT_EQ(info.model, 0x96); + EXPECT_TRUE(info.features.movdiri); + EXPECT_TRUE(info.features.movdir64b); + + EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::INTEL_ATOM_TMT); +} + +// http://users.atw.hu/instlatx64/GenuineIntel/GenuineIntel0090672_AlderLake_LC_BC_CPUID01.txt +TEST_F(CpuidX86Test, INTEL_ALDER_LAKE_REP) +{ + cpu().SetLeaves({ + {{0x00000000, 0}, Leaf{0x00000020, 0x756E6547, 0x6C65746E, 0x49656E69}}, + {{0x00000001, 0}, Leaf{0x00090672, 0x00800800, 0x7FFAFBFF, 0xBFEBFBFF}}, + {{0x00000007, 0}, Leaf{0x00000001, 0x239CA7EB, 0x98C027AC, 0xFC1CC410}}, + {{0x00000007, 1}, Leaf{0x00400810, 0x00000000, 0x00000000, 0x00000000}}, + }); + + const auto info = GetX86Info(); + + EXPECT_STREQ(info.vendor, CPU_FEATURES_VENDOR_GENUINE_INTEL); + EXPECT_EQ(info.family, 0x06); + EXPECT_EQ(info.model, 0x97); + EXPECT_TRUE(info.features.erms); + EXPECT_TRUE(info.features.fs_rep_mov); + EXPECT_FALSE(info.features.fz_rep_movsb); + EXPECT_TRUE(info.features.fs_rep_stosb); + EXPECT_FALSE(info.features.fs_rep_cmpsb_scasb); + + EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::INTEL_ADL); +} + +// http://users.atw.hu/instlatx64/AuthenticAMD/AuthenticAMD0100FA0_K10_Thuban_CPUID.txt +TEST_F(CpuidX86Test, AMD_THUBAN_CACHE_INFO) +{ + cpu().SetLeaves({ + {{0x00000000, 0}, Leaf{0x00000006, 0x68747541, 0x444D4163, 0x69746E65}}, + {{0x80000000, 0}, Leaf{0x8000001B, 0x68747541, 0x444D4163, 0x69746E65}}, + {{0x80000001, 0}, Leaf{0x00100FA0, 0x10000050, 0x000037FF, 0xEFD3FBFF}}, + {{0x80000005, 0}, Leaf{0xFF30FF10, 0xFF30FF20, 0x40020140, 0x40020140}}, + {{0x80000006, 0}, Leaf{0x20800000, 0x42004200, 0x02008140, 0x0030B140}}, + }); + const auto info = GetX86CacheInfo(); + + EXPECT_EQ(info.size, 4); + EXPECT_EQ(info.levels[0].level, 1); + EXPECT_EQ(info.levels[0].cache_type, CacheType::CPU_FEATURE_CACHE_DATA); + EXPECT_EQ(info.levels[0].cache_size, 64 * KiB); + EXPECT_EQ(info.levels[0].ways, 2); + EXPECT_EQ(info.levels[0].line_size, 64); + + EXPECT_EQ(info.levels[1].level, 1); + EXPECT_EQ(info.levels[1].cache_type, + CacheType::CPU_FEATURE_CACHE_INSTRUCTION); + 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[2].level, 2); + EXPECT_EQ(info.levels[2].cache_type, CacheType::CPU_FEATURE_CACHE_UNIFIED); + EXPECT_EQ(info.levels[2].cache_size, 512 * KiB); + EXPECT_EQ(info.levels[2].ways, 16); + EXPECT_EQ(info.levels[2].line_size, 64); + + EXPECT_EQ(info.levels[3].level, 3); + EXPECT_EQ(info.levels[3].cache_type, CacheType::CPU_FEATURE_CACHE_UNIFIED); + EXPECT_EQ(info.levels[3].cache_size, 6 * MiB); + EXPECT_EQ(info.levels[3].ways, 48); + EXPECT_EQ(info.levels[3].line_size, 64); +} + +// http://users.atw.hu/instlatx64/AuthenticAMD/AuthenticAMD0020FB1_K8_Manchester_CPUID.txt +TEST_F(CpuidX86Test, AMD_MANCHESTER_CACHE_INFO) +{ + cpu().SetLeaves({ + {{0x00000000, 0}, Leaf{0x00000001, 0x68747541, 0x444D4163, 0x69746E65}}, + {{0x80000000, 0}, Leaf{0x80000018, 0x68747541, 0x444D4163, 0x69746E65}}, + {{0x80000001, 0}, Leaf{0x00020FB1, 0x00000150, 0x00000003, 0xE3D3FBFF}}, + {{0x80000005, 0}, Leaf{0xFF08FF08, 0xFF20FF20, 0x40020140, 0x40020140}}, + {{0x80000006, 0}, Leaf{0x00000000, 0x42004200, 0x02008140, 0x00000000}}, + }); + const auto info = GetX86CacheInfo(); + + EXPECT_EQ(info.size, 3); + EXPECT_EQ(info.levels[0].level, 1); + EXPECT_EQ(info.levels[0].cache_type, CacheType::CPU_FEATURE_CACHE_DATA); + EXPECT_EQ(info.levels[0].cache_size, 64 * KiB); + EXPECT_EQ(info.levels[0].ways, 2); + EXPECT_EQ(info.levels[0].line_size, 64); + + EXPECT_EQ(info.levels[1].level, 1); + EXPECT_EQ(info.levels[1].cache_type, + CacheType::CPU_FEATURE_CACHE_INSTRUCTION); + 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[2].level, 2); + EXPECT_EQ(info.levels[2].cache_type, CacheType::CPU_FEATURE_CACHE_UNIFIED); + EXPECT_EQ(info.levels[2].cache_size, 512 * KiB); + EXPECT_EQ(info.levels[2].ways, 16); + EXPECT_EQ(info.levels[2].line_size, 64); +} + +// http://users.atw.hu/instlatx64/AuthenticAMD/AuthenticAMD0100F22_K10_Agena_CPUID.txt +TEST_F(CpuidX86Test, AMD_AGENA_CACHE_INFO) +{ + cpu().SetLeaves({ + {{0x00000000, 0}, Leaf{0x00000005, 0x68747541, 0x444D4163, 0x69746E65}}, + {{0x80000000, 0}, Leaf{0x8000001A, 0x68747541, 0x444D4163, 0x69746E65}}, + {{0x80000001, 0}, Leaf{0x00100F22, 0x10000000, 0x000007FF, 0xEFD3FBFF}}, + {{0x80000005, 0}, Leaf{0xFF30FF10, 0xFF30FF20, 0x40020140, 0x40020140}}, + {{0x80000006, 0}, Leaf{0x20800000, 0x42004200, 0x02008140, 0x0010A140}}, + }); + const auto info = GetX86CacheInfo(); + + EXPECT_EQ(info.size, 4); + EXPECT_EQ(info.levels[0].level, 1); + EXPECT_EQ(info.levels[0].cache_type, CacheType::CPU_FEATURE_CACHE_DATA); + EXPECT_EQ(info.levels[0].cache_size, 64 * KiB); + EXPECT_EQ(info.levels[0].ways, 2); + EXPECT_EQ(info.levels[0].line_size, 64); + + EXPECT_EQ(info.levels[1].level, 1); + EXPECT_EQ(info.levels[1].cache_type, + CacheType::CPU_FEATURE_CACHE_INSTRUCTION); + 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[2].level, 2); + EXPECT_EQ(info.levels[2].cache_type, CacheType::CPU_FEATURE_CACHE_UNIFIED); + EXPECT_EQ(info.levels[2].cache_size, 512 * KiB); + EXPECT_EQ(info.levels[2].ways, 16); + EXPECT_EQ(info.levels[2].line_size, 64); + + EXPECT_EQ(info.levels[3].level, 3); + EXPECT_EQ(info.levels[3].cache_type, CacheType::CPU_FEATURE_CACHE_UNIFIED); + EXPECT_EQ(info.levels[3].cache_size, 2 * MiB); + EXPECT_EQ(info.levels[3].ways, 32); + EXPECT_EQ(info.levels[3].line_size, 64); +} + // https://github.com/InstLatx64/InstLatx64/blob/master/GenuineIntel/GenuineIntel00106A1_Nehalem_CPUID.txt TEST_F(CpuidX86Test, Nehalem) { @@ -907,7 +1290,7 @@ flags : fpu mmx sse sse2 pni ssse3 sse4_1 sse4_2 }); const auto info = GetX86Info(); - EXPECT_STREQ(info.vendor, "GenuineIntel"); + EXPECT_STREQ(info.vendor, CPU_FEATURES_VENDOR_GENUINE_INTEL); EXPECT_EQ(info.family, 0x06); EXPECT_EQ(info.model, 0x1A); EXPECT_EQ(info.stepping, 0x02); @@ -986,7 +1369,7 @@ flags : fpu mmx sse sse2 pni ssse3 sse4_1 sse4_2 }); const auto info = GetX86Info(); - EXPECT_STREQ(info.vendor, "GenuineIntel"); + EXPECT_STREQ(info.vendor, CPU_FEATURES_VENDOR_GENUINE_INTEL); EXPECT_EQ(info.family, 0x06); EXPECT_EQ(info.model, 0x37); EXPECT_EQ(info.stepping, 0x03); @@ -1016,7 +1399,7 @@ TEST_F(CpuidX86Test, P4_CacheInfo) 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_type, CacheType::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); @@ -1024,7 +1407,7 @@ TEST_F(CpuidX86Test, P4_CacheInfo) 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_type, CacheType::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); @@ -1032,7 +1415,7 @@ TEST_F(CpuidX86Test, P4_CacheInfo) 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_type, CacheType::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); @@ -1040,7 +1423,8 @@ TEST_F(CpuidX86Test, P4_CacheInfo) 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_type, + CacheType::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); @@ -1048,7 +1432,7 @@ TEST_F(CpuidX86Test, P4_CacheInfo) 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_type, CacheType::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); @@ -1088,7 +1472,7 @@ flags : fpu mmx sse }); const auto info = GetX86Info(); - EXPECT_STREQ(info.vendor, "GenuineIntel"); + EXPECT_STREQ(info.vendor, CPU_FEATURES_VENDOR_GENUINE_INTEL); EXPECT_EQ(info.family, 0x06); EXPECT_EQ(info.model, 0x07); EXPECT_EQ(info.stepping, 0x03); @@ -1113,7 +1497,7 @@ TEST_F(CpuidX86Test, INTEL_80486) }); const auto info = GetX86Info(); - EXPECT_STREQ(info.vendor, "GenuineIntel"); + EXPECT_STREQ(info.vendor, CPU_FEATURES_VENDOR_GENUINE_INTEL); EXPECT_EQ(info.family, 0x04); EXPECT_EQ(info.model, 0x08); EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::INTEL_80486); @@ -1128,7 +1512,7 @@ TEST_F(CpuidX86Test, INTEL_P54C) }); const auto info = GetX86Info(); - EXPECT_STREQ(info.vendor, "GenuineIntel"); + EXPECT_STREQ(info.vendor, CPU_FEATURES_VENDOR_GENUINE_INTEL); EXPECT_EQ(info.family, 0x05); EXPECT_EQ(info.model, 0x02); EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::INTEL_P5); @@ -1143,13 +1527,44 @@ TEST_F(CpuidX86Test, INTEL_LAKEMONT) }); const auto info = GetX86Info(); - EXPECT_STREQ(info.vendor, "GenuineIntel"); + EXPECT_STREQ(info.vendor, CPU_FEATURES_VENDOR_GENUINE_INTEL); EXPECT_EQ(info.family, 0x05); EXPECT_EQ(info.model, 0x09); EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::INTEL_LAKEMONT); } +// https://github.com/InstLatx64/InstLatx64/blob/master/GenuineIntel/GenuineIntel00006E8_PM_Yonah_CPUID.txt +TEST_F(CpuidX86Test, INTEL_CORE_YONAH) +{ + cpu().SetLeaves({ + {{0x00000000, 0}, Leaf{0x0000000A, 0x756E6547, 0x6C65746E, 0x49656E69}}, + {{0x00000001, 0}, Leaf{0x000006E8, 0x00010800, 0x0000C109, 0xAFE9FBFF}}, + }); + const auto info = GetX86Info(); + + EXPECT_STREQ(info.vendor, CPU_FEATURES_VENDOR_GENUINE_INTEL); + EXPECT_EQ(info.family, 0x06); + EXPECT_EQ(info.model, 0x0E); + EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::INTEL_CORE); +} + +// https://github.com/InstLatx64/InstLatx64/blob/master/GenuineIntel/GenuineIntel00706A8_GoldmontPlus_CPUID.txt +TEST_F(CpuidX86Test, INTEL_GOLDMONT_PLUS) +{ + cpu().SetLeaves({ + {{0x00000000, 0}, Leaf{0x00000018, 0x756E6547, 0x6c65746E, 0x49656E69}}, + {{0x00000001, 0}, Leaf{0x000706A8, 0x00400800, 0x4FF8EBBF, 0xBFEBFBFF}}, + }); + const auto info = GetX86Info(); + + EXPECT_STREQ(info.vendor, CPU_FEATURES_VENDOR_GENUINE_INTEL); + EXPECT_EQ(info.family, 0x06); + EXPECT_EQ(info.model, 0x7A); + EXPECT_EQ(GetX86Microarchitecture(&info), + X86Microarchitecture::INTEL_ATOM_GMT_PLUS); +} + // https://github.com/InstLatx64/InstLatx64/blob/master/GenuineIntel/GenuineIntel0050670_KnightsLanding_CPUID.txt TEST_F(CpuidX86Test, INTEL_KNIGHTS_LANDING) { @@ -1159,7 +1574,7 @@ TEST_F(CpuidX86Test, INTEL_KNIGHTS_LANDING) }); const auto info = GetX86Info(); - EXPECT_STREQ(info.vendor, "GenuineIntel"); + EXPECT_STREQ(info.vendor, CPU_FEATURES_VENDOR_GENUINE_INTEL); EXPECT_EQ(info.family, 0x06); EXPECT_EQ(info.model, 0x57); EXPECT_EQ(GetX86Microarchitecture(&info), @@ -1175,12 +1590,11 @@ TEST_F(CpuidX86Test, INTEL_CML_U) }); const auto info = GetX86Info(); - EXPECT_STREQ(info.vendor, "GenuineIntel"); + EXPECT_STREQ(info.vendor, CPU_FEATURES_VENDOR_GENUINE_INTEL); EXPECT_EQ(info.family, 0x06); EXPECT_EQ(info.model, 0x8E); EXPECT_EQ(info.stepping, 0x0C); - EXPECT_EQ(GetX86Microarchitecture(&info), - X86Microarchitecture::INTEL_CML); + EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::INTEL_CML); } // http://users.atw.hu/instlatx64/GenuineIntel/GenuineIntel00A0652_CometLake_CPUID1.txt @@ -1192,11 +1606,106 @@ TEST_F(CpuidX86Test, INTEL_CML_H) }); const auto info = GetX86Info(); - EXPECT_STREQ(info.vendor, "GenuineIntel"); + EXPECT_STREQ(info.vendor, CPU_FEATURES_VENDOR_GENUINE_INTEL); EXPECT_EQ(info.family, 0x06); EXPECT_EQ(info.model, 0xA5); - EXPECT_EQ(GetX86Microarchitecture(&info), - X86Microarchitecture::INTEL_CML); + EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::INTEL_CML); +} + +// https://github.com/InstLatx64/InstLatx64/blob/master/GenuineIntel/GenuineIntel00A0660_CometLake_CPUID1.txt +TEST_F(CpuidX86Test, INTEL_CML_U2) +{ + cpu().SetLeaves({ + {{0x00000000, 0}, Leaf{0x00000016, 0x756E6547, 0x6C65746E, 0x49656E69}}, + {{0x00000001, 0}, Leaf{0x000A0660, 0x00100800, 0x7FFAFBBF, 0xBFEBFBFF}}, + }); + const auto info = GetX86Info(); + + EXPECT_STREQ(info.vendor, CPU_FEATURES_VENDOR_GENUINE_INTEL); + EXPECT_EQ(info.family, 0x06); + EXPECT_EQ(info.model, 0xA6); + EXPECT_EQ(info.stepping, 0x00); + EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::INTEL_CML); +} + +// http://users.atw.hu/instlatx64/GenuineIntel/GenuineIntel00806A1_Lakefield_CPUID.txt +TEST_F(CpuidX86Test, INTEL_ATOM_TMT_LAKEFIELD) +{ + cpu().SetLeaves({ + {{0x00000000, 0}, Leaf{0x0000001B, 0x756E6547, 0x6C65746E, 0x49656E69}}, + {{0x00000001, 0}, Leaf{0x000806A1, 0x00100800, 0x4FD8EBBF, 0xBFEBFBFF}}, + }); + const auto info = GetX86Info(); + + EXPECT_STREQ(info.vendor, CPU_FEATURES_VENDOR_GENUINE_INTEL); + EXPECT_EQ(info.family, 0x06); + EXPECT_EQ(info.model, 0x8A); + EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::INTEL_ATOM_TMT); +} + +// https://github.com/InstLatx64/InstLatx64/blob/master/GenuineIntel/GenuineIntel0090661_ElkhartLake_CPUID01.txt +TEST_F(CpuidX86Test, INTEL_ATOM_TMT_ELKHART_LAKE) +{ + cpu().SetLeaves({ + {{0x00000000, 0}, Leaf{0x0000001B, 0x756E6547, 0x6C65746E, 0x49656E69}}, + {{0x00000001, 0}, Leaf{0x00090661, 0x00800800, 0x4FF8EBBF, 0xBFEBFBFF}}, + }); + const auto info = GetX86Info(); + + EXPECT_STREQ(info.vendor, CPU_FEATURES_VENDOR_GENUINE_INTEL); + EXPECT_EQ(info.family, 0x06); + EXPECT_EQ(info.model, 0x96); + EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::INTEL_ATOM_TMT); +} + +// https://github.com/InstLatx64/InstLatx64/blob/master/GenuineIntel/GenuineIntel00906C0_JasperLake_01_CPUID.txt +TEST_F(CpuidX86Test, INTEL_ATOM_TMT_JASPER_LAKE) +{ + cpu().SetLeaves({ + {{0x00000000, 0}, Leaf{0x0000001B, 0x756E6547, 0x6C65746E, 0x49656E69}}, + {{0x00000001, 0}, Leaf{0x000906C0, 0x00800800, 0x4FF8EBBF, 0xBFEBFBFF}}, + }); + const auto info = GetX86Info(); + + EXPECT_STREQ(info.vendor, CPU_FEATURES_VENDOR_GENUINE_INTEL); + EXPECT_EQ(info.family, 0x06); + EXPECT_EQ(info.model, 0x9C); + EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::INTEL_ATOM_TMT); +} + +// http://users.atw.hu/instlatx64/GenuineIntel/GenuineIntel00B0671_RaptorLake_02_CPUID.txt +TEST_F(CpuidX86Test, INTEL_RAPTOR_LAKE) +{ + cpu().SetLeaves({ + {{0x00000000, 0}, Leaf{0x00000020, 0x756E6547, 0x6C65746E, 0x49656E69}}, + {{0x00000001, 0}, Leaf{0x000B0671, 0x00800800, 0x7FFAFBBF, 0xBFEBFBFF}}, + }); + const auto info = GetX86Info(); + + EXPECT_STREQ(info.vendor, CPU_FEATURES_VENDOR_GENUINE_INTEL); + EXPECT_EQ(info.family, 0x06); + EXPECT_EQ(info.model, 0xB7); + EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::INTEL_RPL); +} + +// http://users.atw.hu/instlatx64/GenuineIntel/GenuineIntel00306F2_HaswellEP2_CPUID.txt +TEST_F(CpuidX86Test, INTEL_HASWELL_LZCNT) +{ + cpu().SetLeaves({ + {{0x00000000, 0}, Leaf{0x0000000F, 0x756E6547, 0x6C65746E, 0x49656E69}}, + {{0x00000001, 0}, Leaf{0x000306F2, 0x00200800, 0x7FFEFBFF, 0xBFEBFBFF}}, + {{0x00000007, 0}, Leaf{0x00000000, 0x000037AB, 0x00000000, 0x00000000}}, + {{0x80000000, 0}, Leaf{0x80000008, 0x00000000, 0x00000000, 0x00000000}}, + {{0x80000001, 0}, Leaf{0x00000000, 0x00000000, 0x00000021, 0x2C100000}}, + }); + const auto info = GetX86Info(); + + EXPECT_STREQ(info.vendor, CPU_FEATURES_VENDOR_GENUINE_INTEL); + EXPECT_EQ(info.family, 0x06); + EXPECT_EQ(info.model, 0x3F); + EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::INTEL_HSW); + + EXPECT_TRUE(info.features.lzcnt); } // https://github.com/google/cpu_features/issues/200 From bed01b000b5633a5b57cbb5b5cad03e07f8009ca Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 27 Nov 2022 10:34:53 +0100 Subject: [PATCH 24/59] Fix ci jobs --- .../volk_gnsssdr/cpu_features/CMakeLists.txt | 11 ++++----- .../volk_gnsssdr/cpu_features/README.md | 24 +++++++++---------- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/CMakeLists.txt b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/CMakeLists.txt index cde0a4668..d02de9ee7 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/CMakeLists.txt +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/CMakeLists.txt @@ -16,13 +16,12 @@ if(CMAKE_VERSION LESS "3.1") add_compile_options("$<$,C>:-std=gnu99>") endif() -# Default Build Type to be Release # Default Build Type to be Release if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE) -endif(NOT CMAKE_BUILD_TYPE) +endif() # BUILD_SHARED_LIBS is a standard CMake variable, but we declare it here to make # it prominent in the GUI. @@ -134,8 +133,8 @@ endif() # # library : cpu_features # -set (CPU_FEATURES_HDRS) -set (CPU_FEATURES_SRCS) +set(CPU_FEATURES_HDRS) +set(CPU_FEATURES_SRCS) add_cpu_features_headers_and_sources(CPU_FEATURES_HDRS CPU_FEATURES_SRCS) list(APPEND CPU_FEATURES_SRCS $) if(NOT PROCESSOR_IS_X86 AND UNIX) @@ -217,8 +216,8 @@ if(BUILD_TESTING) # Add googletest directly to our build. This defines the gtest and # gtest_main targets. add_subdirectory(${CMAKE_BINARY_DIR}/googletest-src - ${CMAKE_BINARY_DIR}/googletest-build - EXCLUDE_FROM_ALL) + ${CMAKE_BINARY_DIR}/googletest-build + EXCLUDE_FROM_ALL) endif() add_subdirectory(test) diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/README.md b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/README.md index 3421040c5..972e56814 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/README.md +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/README.md @@ -158,21 +158,21 @@ flags : aes,avx,cx16,smx,sse4_1,sse4_2,ssse3 ## What's supported -| | x86³ | AArch64 | ARM | MIPS⁴ | s390x | POWER | -| ------- | :---: | :-----: | :-----: | :-----: | :-----: | :-----: | -| Linux | yes² | yes¹ | yes¹ | yes¹ | yes¹ | yes¹ | -| FreeBSD | yes² | not yet | not yet | not yet | not yet | not yet | -| MacOs | yes² | not yet | N/A | N/A | no | no | -| Windows | yes² | not yet | not yet | N/A | N/A | N/A | -| Android | yes² | yes¹ | yes¹ | yes¹ | N/A | N/A | -| iOS | N/A | not yet | not yet | N/A | N/A | N/A | +| | x86³ | AArch64 | ARM | MIPS⁴ | s390x | POWER | +| ------- | :--: | :-----: | :-----: | :-----: | :-----: | :-----: | +| Linux | yes² | yes¹ | yes¹ | yes¹ | yes¹ | yes¹ | +| FreeBSD | yes² | not yet | not yet | not yet | not yet | not yet | +| MacOs | yes² | not yet | N/A | N/A | no | no | +| Windows | yes² | not yet | not yet | N/A | N/A | N/A | +| Android | yes² | yes¹ | yes¹ | yes¹ | N/A | N/A | +| iOS | N/A | not yet | not yet | N/A | N/A | N/A | 1. **Features revealed from Linux.** We gather data from several sources depending on availability: - + from glibc's - [getauxval](https://www.gnu.org/software/libc/manual/html_node/Auxiliary-Vector.html) - + by parsing `/proc/self/auxv` - + by parsing `/proc/cpuinfo` + - from glibc's + [getauxval](https://www.gnu.org/software/libc/manual/html_node/Auxiliary-Vector.html) + - by parsing `/proc/self/auxv` + - by parsing `/proc/cpuinfo` 2. **Features revealed from CPU.** features are retrieved by using the `cpuid` instruction. 3. **Microarchitecture detection.** On x86 some features are not always From 037e3ef45f7cd472dfbd656e04d8f6007fe5bd5e Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 27 Nov 2022 16:32:19 +0100 Subject: [PATCH 25/59] CI: Update citation.yml file --- .github/workflows/citation.yml | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/.github/workflows/citation.yml b/.github/workflows/citation.yml index dbec9dd9d..fdab6859e 100644 --- a/.github/workflows/citation.yml +++ b/.github/workflows/citation.yml @@ -4,11 +4,10 @@ on: push: paths: - CITATION.cff - workflow_dispatch: pull_request: paths: - CITATION.cff - workflow_dispatch: + workflow_dispatch: name: CITATION.cff jobs: @@ -17,23 +16,15 @@ jobs: name: Validate CITATION.cff env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} - RSPM: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest" steps: - name: Checkout - uses: actions/checkout@v2 - - # This is needed for workflows running on - # ubuntu-20.04 or later - - name: Install V8 - if: runner.os == 'Linux' - run: | - sudo apt-get install -y libv8-dev + uses: actions/checkout@v3 - name: Validate CITATION.cff uses: dieghernan/cff-validator@main - - # Upload artifact - - uses: actions/upload-artifact@v2 + # Upload artifact in case of failure + - name: Update artifact + uses: actions/upload-artifact@v3 if: failure() with: name: citation-cff-errors From 7df4e73485f2c6f050ce6fd352363b84ef0d0cdc Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 27 Nov 2022 16:35:48 +0100 Subject: [PATCH 26/59] =?UTF-8?q?Add=20Into=20P=C3=A4=C3=A4kk=C3=B6nen=20a?= =?UTF-8?q?s=20author,=20remove=20conflicting=20refs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CITATION.cff | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/CITATION.cff b/CITATION.cff index 3b5f2f4f8..49f6673b3 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -82,6 +82,11 @@ authors: email: cillian.odriscoll@gmail.com family-names: "O'Driscoll" given-names: Cillian + - affiliation: "Finnish Geospatial Research Institute" + alias: IntoPa + email: into.paakkonen@aalto.fi + family-names: "Pääkkönen" + given-names: Into - affiliation: "Centre Tecnològic de Telecomunicacions de Catalunya (CTTC)" email: david.pubill@cttc.cat family-names: Pubill @@ -309,22 +314,6 @@ references: title: "Design patterns for GNSS software receivers" type: conference-paper year: 2010 - - authors: - - name: "The GNU Radio Project team" - doi: 10.5281/zenodo.2704343 - repository-code: "https://github.com/gnuradio/gnuradio" - scope: "Software dependency: the SDR framework." - title: "GNU Radio: The Free & Open Software Radio Ecosystem" - type: software - url: "https://www.gnuradio.org" - - authors: - - name: "The VOLK Project team" - doi: 10.5281/zenodo.3360942 - repository-code: "https://github.com/gnuradio/volk" - scope: "Software dependency: the portable SIMD library." - title: "VOLK: The Vector-Optimized Library of Kernels" - type: software - url: "https://www.libvolk.org" repository-code: "https://github.com/gnss-sdr/gnss-sdr" title: GNSS-SDR type: software From bb03d421777427f32f282889df8496ed162143ab Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 27 Nov 2022 16:49:41 +0100 Subject: [PATCH 27/59] CI: fixes in yml files --- .github/workflows/main.yml | 10 +++++----- .github/workflows/volk_android.yml | 3 +-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a38595b0d..9f86d3192 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,7 +14,7 @@ jobs: build-ubuntu: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v3 - name: install dependencies run: sudo apt-get update && sudo apt-get install -y ninja-build cmake libboost-dev libboost-date-time-dev libboost-system-dev libboost-filesystem-dev libboost-thread-dev libboost-chrono-dev libboost-serialization-dev liblog4cpp5-dev gnuradio-dev gr-osmosdr libpugixml-dev libpcap-dev libblas-dev liblapack-dev libarmadillo-dev libgflags-dev libgoogle-glog-dev libgnutls-openssl-dev libmatio-dev googletest protobuf-compiler libprotobuf-dev python3-mako liborc-0.4-dev - name: configure @@ -109,8 +109,8 @@ jobs: volk-gnsssdr-windows: runs-on: windows-latest steps: - - uses: actions/checkout@v1 - - uses: actions/setup-python@v1 + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 - name: Install dependencies run: | python -m pip install --upgrade pip @@ -174,7 +174,7 @@ jobs: shellcheck: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v3 - name: install dependencies run: sudo apt install shellcheck - name: check scripts @@ -183,7 +183,7 @@ jobs: REUSE-compliance: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v3 - name: Check REUSE compliance uses: docker://fsfe/reuse with: diff --git a/.github/workflows/volk_android.yml b/.github/workflows/volk_android.yml index c03187a3f..a45564b3a 100644 --- a/.github/workflows/volk_android.yml +++ b/.github/workflows/volk_android.yml @@ -4,11 +4,10 @@ on: push: paths: - "src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/**" - workflow_dispatch: pull_request: paths: - "src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/**" - workflow_dispatch: + workflow_dispatch: name: Build volk-gnssdr on Android NDK jobs: From a975e33dabf5bc8bb20cd940d8365b9a76e571ab Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 29 Nov 2022 23:38:27 +0100 Subject: [PATCH 28/59] Fix for Xcode new build system CI: add new build-macos-xcode job --- .github/workflows/main.yml | 15 +++ CMakeLists.txt | 18 +-- .../volk_gnsssdr/apps/CMakeLists.txt | 10 -- .../volk_gnsssdr/lib/CMakeLists.txt | 113 +++++++++--------- 4 files changed, 80 insertions(+), 76 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9f86d3192..b8dff7302 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -41,6 +41,21 @@ jobs: - name: default position_test run: cd build && cmake -DENABLE_SYSTEM_TESTING_EXTRA=ON .. && ninja && ../install/position_test + build-macos-xcode: + runs-on: macos-latest + steps: + - uses: actions/checkout@v3 + - name: install dependencies + run: brew update && brew install ninja pkg-config hdf5 automake armadillo lapack gflags glog gnuradio log4cpp openssl pugixml protobuf && pip3 install mako + - name: configure + run: cd build && cmake -GXcode .. + - name: build + run: cd build && xcodebuild -configuration Release + - name: check + run: cd build && xcodebuild -configuration Release -target check && ../install/volk_gnsssdr_profile && ../install/run_tests + - name: default position_test + run: cd build && cmake -DENABLE_SYSTEM_TESTING_EXTRA=ON .. && xcodebuild -configuration Release -target position_test && ../install/position_test + clang-format: runs-on: macos-latest steps: diff --git a/CMakeLists.txt b/CMakeLists.txt index 4b3aeb7e8..8662fe08f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1115,13 +1115,11 @@ if(NOT VOLKGNSSSDR_FOUND) if(PYTHON_EXECUTABLE) set(USE_THIS_PYTHON "-DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}") endif() - if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - if(CMAKE_GENERATOR STREQUAL Xcode) - set(VOLK_GNSSSDR_BUILD_COMMAND "xcodebuild" - "-configuration" $<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel> - "-alltargets" - ) - endif() + + if(CMAKE_GENERATOR STREQUAL Xcode) + set(VOLK_GNSSSDR_BUILD_COMMAND "xcodebuild" + "-configuration" $<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel> + ) endif() if(CMAKE_TOOLCHAIN_FILE) @@ -1155,11 +1153,7 @@ if(NOT VOLKGNSSSDR_FOUND) ${STRIP_VOLK_GNSSSDR_PROFILE} ${USE_THIS_PYTHON} ) - if(CMAKE_VERSION VERSION_GREATER 3.18.99 AND CMAKE_GENERATOR STREQUAL Xcode) - if(XCODE_VERSION VERSION_GREATER 11) - set(VOLK_GNSSSDR_CMAKE_ARGS ${VOLK_GNSSSDR_CMAKE_ARGS} -T buildsystem=1) - endif() - endif() + if(DEFINED ENV{OECORE_TARGET_SYSROOT}) set(VOLK_GNSSSDR_CMAKE_ARGS ${VOLK_GNSSSDR_CMAKE_ARGS} -DCROSSCOMPILE_MULTILIB=TRUE diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/apps/CMakeLists.txt b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/apps/CMakeLists.txt index 56f672e80..3ed4dafd6 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/apps/CMakeLists.txt +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/apps/CMakeLists.txt @@ -35,8 +35,6 @@ add_executable(volk_gnsssdr_profile ${CMAKE_CURRENT_SOURCE_DIR}/volk_gnsssdr_option_helpers.cc ) -add_dependencies(volk_gnsssdr_profile volk_gnsssdr) - if(MSVC) target_include_directories(volk_gnsssdr_profile PRIVATE $ @@ -59,7 +57,6 @@ if(NOT FILESYSTEM_FOUND) target_link_libraries(volk_gnsssdr_profile PRIVATE ${Boost_LIBRARIES}) endif() - if(FILESYSTEM_FOUND) add_definitions(-DHAS_STD_FILESYSTEM=1) if(${find_experimental}) @@ -72,10 +69,8 @@ if(ENABLE_STATIC_LIBS) target_link_libraries(volk_gnsssdr_profile PRIVATE volk_gnsssdr_static ${orc_lib}) else() target_link_libraries(volk_gnsssdr_profile PRIVATE volk_gnsssdr ${orc_lib}) - add_dependencies(volk_gnsssdr_profile volk_gnsssdr) endif() - if(ENABLE_STRIP) if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND NOT WIN32) set_target_properties(volk_gnsssdr_profile @@ -84,23 +79,19 @@ if(ENABLE_STRIP) endif() endif() - install( TARGETS volk_gnsssdr_profile DESTINATION bin COMPONENT "volk_gnsssdr" ) - # MAKE volk_gnsssdr-config-info add_executable(volk_gnsssdr-config-info volk_gnsssdr-config-info.cc ${CMAKE_CURRENT_SOURCE_DIR}/volk_gnsssdr_option_helpers.cc) - if(ENABLE_STATIC_LIBS) target_link_libraries(volk_gnsssdr-config-info volk_gnsssdr_static ${orc_lib}) else() target_link_libraries(volk_gnsssdr-config-info volk_gnsssdr ${orc_lib}) - add_dependencies(volk_gnsssdr-config-info volk_gnsssdr) endif() if(ENABLE_STRIP) @@ -117,7 +108,6 @@ install( COMPONENT "volk_gnsssdr" ) - # Launch volk_gnsssdr_profile if requested to do so if(ENABLE_PROFILING) if(DEFINED VOLK_CONFIGPATH) diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/CMakeLists.txt b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/CMakeLists.txt index b9da1426d..ae570c455 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/CMakeLists.txt +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/CMakeLists.txt @@ -558,65 +558,70 @@ else() endif() # Add dynamic library -if(CMAKE_GENERATOR STREQUAL Xcode) - add_library(volk_gnsssdr SHARED ${volk_gnsssdr_sources}) -else() - add_library(volk_gnsssdr SHARED $) -endif() -if(USE_CPU_FEATURES) - if(CPUFEATURES_FOUND) - target_link_libraries(volk_gnsssdr - PUBLIC ${volk_gnsssdr_libraries} - PRIVATE CpuFeature::cpu_features - ) +# Note: new Xcode buildsystem does not allow building both static and dynamic libraries +# so we only build dynamic if ENABLE_STATIC_LIBS is not enabled in that generator. +# For other generators than XCode, the dynamic library is always built. +if(NOT (ENABLE_STATIC_LIBS AND (CMAKE_GENERATOR STREQUAL Xcode))) + if(CMAKE_GENERATOR STREQUAL Xcode) + add_library(volk_gnsssdr SHARED ${volk_gnsssdr_sources}) else() - target_link_libraries(volk_gnsssdr - PUBLIC ${volk_gnsssdr_libraries} - PRIVATE cpu_features - ) + add_library(volk_gnsssdr SHARED $) endif() -else() - target_link_libraries(volk_gnsssdr PUBLIC ${volk_gnsssdr_libraries}) -endif() -target_include_directories(volk_gnsssdr - PUBLIC $ - PUBLIC $ - PUBLIC $ - PRIVATE ${CMAKE_CURRENT_BINARY_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PUBLIC $ -) -if(USE_CPU_FEATURES) - if(CPUFEATURES_FOUND) - target_include_directories(volk_gnsssdr - PRIVATE - $ - ) + if(USE_CPU_FEATURES) + if(CPUFEATURES_FOUND) + target_link_libraries(volk_gnsssdr + PUBLIC ${volk_gnsssdr_libraries} + PRIVATE CpuFeature::cpu_features + ) + else() + target_link_libraries(volk_gnsssdr + PUBLIC ${volk_gnsssdr_libraries} + PRIVATE cpu_features + ) + endif() else() - target_include_directories(volk_gnsssdr - PRIVATE - $ - ) + target_link_libraries(volk_gnsssdr PUBLIC ${volk_gnsssdr_libraries}) endif() -endif() -# Configure target properties -if(ORC_FOUND) - target_link_libraries(volk_gnsssdr PRIVATE ${ORC_LIBRARIES}) -endif() -if(NOT MSVC) - target_link_libraries(volk_gnsssdr PUBLIC m) -endif() -set_target_properties(volk_gnsssdr PROPERTIES VERSION ${VERSION}) -set_target_properties(volk_gnsssdr PROPERTIES SOVERSION ${SOVERSION}) -set_target_properties(volk_gnsssdr PROPERTIES DEFINE_SYMBOL "volk_gnsssdr_EXPORTS") + target_include_directories(volk_gnsssdr + PUBLIC $ + PUBLIC $ + PUBLIC $ + PRIVATE ${CMAKE_CURRENT_BINARY_DIR} + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} + PUBLIC $ + ) + if(USE_CPU_FEATURES) + if(CPUFEATURES_FOUND) + target_include_directories(volk_gnsssdr + PRIVATE + $ + ) + else() + target_include_directories(volk_gnsssdr + PRIVATE + $ + ) + endif() + endif() + # Configure target properties + if(ORC_FOUND) + target_link_libraries(volk_gnsssdr PRIVATE ${ORC_LIBRARIES}) + endif() + if(NOT MSVC) + target_link_libraries(volk_gnsssdr PUBLIC m) + endif() + set_target_properties(volk_gnsssdr PROPERTIES VERSION ${VERSION}) + set_target_properties(volk_gnsssdr PROPERTIES SOVERSION ${SOVERSION}) + set_target_properties(volk_gnsssdr PROPERTIES DEFINE_SYMBOL "volk_gnsssdr_EXPORTS") -# Install locations -install(TARGETS volk_gnsssdr - EXPORT VOLK_GNSSSDR-export - LIBRARY DESTINATION lib${LIB_SUFFIX} COMPONENT "volk_gnsssdr_runtime" # .so file - ARCHIVE DESTINATION lib${LIB_SUFFIX} COMPONENT "volk_gnsssdr_devel" # .lib file - RUNTIME DESTINATION bin COMPONENT "volk_gnsssdr_runtime" # .dll file -) + # Install locations + install(TARGETS volk_gnsssdr + EXPORT VOLK_GNSSSDR-export + LIBRARY DESTINATION lib${LIB_SUFFIX} COMPONENT "volk_gnsssdr_runtime" # .so file + ARCHIVE DESTINATION lib${LIB_SUFFIX} COMPONENT "volk_gnsssdr_devel" # .lib file + RUNTIME DESTINATION bin COMPONENT "volk_gnsssdr_runtime" # .dll file + ) +endif() # Configure static library if(ENABLE_STATIC_LIBS) From 72ffa2f7f5adebc35181b3ca1ef142659aae3122 Mon Sep 17 00:00:00 2001 From: Wojciech Kazubski Date: Thu, 1 Dec 2022 14:43:18 +0100 Subject: [PATCH 29/59] Remove not working throttle control (sample rate determined by hardware) --- conf/gnss-sdr_GPS_L1_2ch_fmcomms2_realtime.conf | 1 - conf/gnss-sdr_GPS_L1_USRP_X300_realtime.conf | 1 - conf/gnss-sdr_GPS_L1_USRP_realtime.conf | 1 - conf/gnss-sdr_GPS_L1_bladeRF.conf | 1 - conf/gnss-sdr_GPS_L1_fmcomms2_realtime.conf | 1 - conf/gnss-sdr_GPS_L1_plutosdr_realtime.conf | 1 - conf/gnss-sdr_GPS_L1_rtl_tcp_realtime.conf | 1 - conf/gnss-sdr_GPS_L1_rtlsdr_realtime.conf | 1 - conf/gnss-sdr_GPS_L2C_USRP1_realtime.conf | 1 - conf/gnss-sdr_GPS_L2C_USRP_X300_realtime.conf | 1 - conf/gnss-sdr_Galileo_E1_USRP_X300_realtime.conf | 1 - 11 files changed, 11 deletions(-) diff --git a/conf/gnss-sdr_GPS_L1_2ch_fmcomms2_realtime.conf b/conf/gnss-sdr_GPS_L1_2ch_fmcomms2_realtime.conf index b541eda5a..3fc5c22d2 100644 --- a/conf/gnss-sdr_GPS_L1_2ch_fmcomms2_realtime.conf +++ b/conf/gnss-sdr_GPS_L1_2ch_fmcomms2_realtime.conf @@ -32,7 +32,6 @@ SignalSource.samples=0 SignalSource.repeat=false SignalSource.dump=false SignalSource.dump_filename=../data/signal_source.dat -SignalSource.enable_throttle_control=false SignalSource.enable_dds_lo=false SignalSource.freq_rf_tx_hz=1260000000 SignalSource.freq_dds_tx_hz=1000 diff --git a/conf/gnss-sdr_GPS_L1_USRP_X300_realtime.conf b/conf/gnss-sdr_GPS_L1_USRP_X300_realtime.conf index 8d65537f7..f0ab33656 100644 --- a/conf/gnss-sdr_GPS_L1_USRP_X300_realtime.conf +++ b/conf/gnss-sdr_GPS_L1_USRP_X300_realtime.conf @@ -42,7 +42,6 @@ SignalSource.samples=0 SignalSource.repeat=false SignalSource.dump=false SignalSource.dump_filename=../data/signal_source.dat -SignalSource.enable_throttle_control=false ;######### SIGNAL_CONDITIONER CONFIG ############ diff --git a/conf/gnss-sdr_GPS_L1_USRP_realtime.conf b/conf/gnss-sdr_GPS_L1_USRP_realtime.conf index 0441a2649..04afb9a6c 100644 --- a/conf/gnss-sdr_GPS_L1_USRP_realtime.conf +++ b/conf/gnss-sdr_GPS_L1_USRP_realtime.conf @@ -41,7 +41,6 @@ SignalSource.samples=0 SignalSource.repeat=false SignalSource.dump=false SignalSource.dump_filename=../data/signal_source.dat -SignalSource.enable_throttle_control=false ;######### SIGNAL_CONDITIONER CONFIG ############ diff --git a/conf/gnss-sdr_GPS_L1_bladeRF.conf b/conf/gnss-sdr_GPS_L1_bladeRF.conf index 30935841c..e751730de 100644 --- a/conf/gnss-sdr_GPS_L1_bladeRF.conf +++ b/conf/gnss-sdr_GPS_L1_bladeRF.conf @@ -23,7 +23,6 @@ SignalSource.AGC_enabled=false SignalSource.samples=0 SignalSource.repeat=false SignalSource.osmosdr_args=bladerf=0 ; This line enables the bladeRF -SignalSource.enable_throttle_control=false SignalSource.dump=false SignalSource.dump_filename=./signal_source.dat diff --git a/conf/gnss-sdr_GPS_L1_fmcomms2_realtime.conf b/conf/gnss-sdr_GPS_L1_fmcomms2_realtime.conf index 2dd1efca2..df763f64e 100644 --- a/conf/gnss-sdr_GPS_L1_fmcomms2_realtime.conf +++ b/conf/gnss-sdr_GPS_L1_fmcomms2_realtime.conf @@ -42,7 +42,6 @@ SignalSource.samples=0 SignalSource.repeat=false SignalSource.dump=false SignalSource.dump_filename=../data/signal_source.dat -SignalSource.enable_throttle_control=false ;######### SIGNAL_CONDITIONER CONFIG ############ SignalConditioner.implementation=Signal_Conditioner diff --git a/conf/gnss-sdr_GPS_L1_plutosdr_realtime.conf b/conf/gnss-sdr_GPS_L1_plutosdr_realtime.conf index 6b0de3745..e140810d2 100644 --- a/conf/gnss-sdr_GPS_L1_plutosdr_realtime.conf +++ b/conf/gnss-sdr_GPS_L1_plutosdr_realtime.conf @@ -44,7 +44,6 @@ SignalSource.buffer_size=65000 SignalSource.repeat=false SignalSource.dump=false SignalSource.dump_filename=./capture.dat -SignalSource.enable_throttle_control=false ;######### SIGNAL_CONDITIONER CONFIG ############ SignalConditioner.implementation=Pass_Through diff --git a/conf/gnss-sdr_GPS_L1_rtl_tcp_realtime.conf b/conf/gnss-sdr_GPS_L1_rtl_tcp_realtime.conf index 6266ea924..370931cca 100644 --- a/conf/gnss-sdr_GPS_L1_rtl_tcp_realtime.conf +++ b/conf/gnss-sdr_GPS_L1_rtl_tcp_realtime.conf @@ -44,7 +44,6 @@ SignalSource.samples=0 SignalSource.repeat=false SignalSource.dump=false SignalSource.dump_filename=../data/signal_source.dat -SignalSource.enable_throttle_control=false SignalSource.address=127.0.0.1 SignalSource.port=1234 SignalSource.swap_iq=false diff --git a/conf/gnss-sdr_GPS_L1_rtlsdr_realtime.conf b/conf/gnss-sdr_GPS_L1_rtlsdr_realtime.conf index 3b51d2532..8994bb3f3 100644 --- a/conf/gnss-sdr_GPS_L1_rtlsdr_realtime.conf +++ b/conf/gnss-sdr_GPS_L1_rtlsdr_realtime.conf @@ -45,7 +45,6 @@ SignalSource.samples=0 SignalSource.repeat=false SignalSource.dump=false SignalSource.dump_filename=../data/signal_source.dat -SignalSource.enable_throttle_control=false ;# Please note that the new RTL-SDR Blog V3 dongles ship a < 1 PPM ;# temperature compensated oscillator (TCXO), which is well suited for GNSS diff --git a/conf/gnss-sdr_GPS_L2C_USRP1_realtime.conf b/conf/gnss-sdr_GPS_L2C_USRP1_realtime.conf index 76763c4f4..cffb6f9b0 100644 --- a/conf/gnss-sdr_GPS_L2C_USRP1_realtime.conf +++ b/conf/gnss-sdr_GPS_L2C_USRP1_realtime.conf @@ -40,7 +40,6 @@ SignalSource.samples=0 SignalSource.repeat=false SignalSource.dump=false SignalSource.dump_filename=../data/signal_source.dat -SignalSource.enable_throttle_control=false ;######### SIGNAL_CONDITIONER CONFIG ############ diff --git a/conf/gnss-sdr_GPS_L2C_USRP_X300_realtime.conf b/conf/gnss-sdr_GPS_L2C_USRP_X300_realtime.conf index 42a2edb3c..a221b7169 100644 --- a/conf/gnss-sdr_GPS_L2C_USRP_X300_realtime.conf +++ b/conf/gnss-sdr_GPS_L2C_USRP_X300_realtime.conf @@ -43,7 +43,6 @@ SignalSource.samples=0 SignalSource.repeat=false SignalSource.dump=false SignalSource.dump_filename=../data/signal_source.dat -SignalSource.enable_throttle_control=false ;######### SIGNAL_CONDITIONER CONFIG ############ diff --git a/conf/gnss-sdr_Galileo_E1_USRP_X300_realtime.conf b/conf/gnss-sdr_Galileo_E1_USRP_X300_realtime.conf index eb93eb43d..b49801d10 100644 --- a/conf/gnss-sdr_Galileo_E1_USRP_X300_realtime.conf +++ b/conf/gnss-sdr_Galileo_E1_USRP_X300_realtime.conf @@ -28,7 +28,6 @@ SignalSource.subdevice=A:0 SignalSource.samples=0 SignalSource.dump=false SignalSource.dump_filename=../data/signal_source.dat -SignalSource.enable_throttle_control=false ;######### SIGNAL_CONDITIONER CONFIG ############ From be14f1c4b4ab14360c31d35b2ec5febdaed7032c Mon Sep 17 00:00:00 2001 From: Wojciech Kazubski Date: Thu, 1 Dec 2022 14:45:33 +0100 Subject: [PATCH 30/59] Replace cshort with gr_complex --- conf/gnss-sdr_GPS_L1_ishort.conf | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/conf/gnss-sdr_GPS_L1_ishort.conf b/conf/gnss-sdr_GPS_L1_ishort.conf index 9908ada1b..1d76c2a2f 100644 --- a/conf/gnss-sdr_GPS_L1_ishort.conf +++ b/conf/gnss-sdr_GPS_L1_ishort.conf @@ -31,13 +31,20 @@ SignalSource.enable_throttle_control=false ;######### SIGNAL_CONDITIONER CONFIG ############ SignalConditioner.implementation=Signal_Conditioner -DataTypeAdapter.implementation=Ishort_To_Cshort +;######### DATA_TYPE_ADAPTER CONFIG ############ +DataTypeAdapter.implementation=Ishort_To_Complex + +;######### INPUT_FILTER CONFIG ############ InputFilter.implementation=Pass_Through -InputFilter.item_type=cshort +InputFilter.input_item_type=gr_complex +InputFilter.output_item_type=gr_complex + +;######### RESAMPLER CONFIG ############ Resampler.implementation=Direct_Resampler Resampler.sample_freq_in=4000000 Resampler.sample_freq_out=2000000 -Resampler.item_type=cshort +Resampler.item_type=gr_complex + ;######### CHANNELS GLOBAL CONFIG ############ Channels_1C.count=8 @@ -47,7 +54,7 @@ Channel.signal=1C ;######### ACQUISITION GLOBAL CONFIG ############ Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=cshort +Acquisition_1C.item_type=gr_complex Acquisition_1C.coherent_integration_time_ms=1 Acquisition_1C.pfa=0.01 ;Acquisition_1C.pfa=0.000001 @@ -59,7 +66,7 @@ Acquisition_1C.blocking=false; ;######### TRACKING GLOBAL CONFIG ############ Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=cshort +Tracking_1C.item_type=gr_complex Tracking_1C.pll_bw_hz=40.0; Tracking_1C.dll_bw_hz=4.0; Tracking_1C.order=3; From 2cde7c0fe8830efb53222e6e1eae5e3637c44dee Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 3 Dec 2022 23:55:12 +0100 Subject: [PATCH 31/59] CMake improvements: Move _FORTIFY_SOURCE=2 definition to targets, do not apply in Debug mode. Make use of add_compile_definitions() instead of add_definitions() when available --- CMakeLists.txt | 24 ++-- .../volk_gnsssdr/CMakeLists.txt | 25 ++-- .../volk_gnsssdr/apps/CMakeLists.txt | 10 -- .../volk_gnsssdr/lib/CMakeLists.txt | 124 ++++++++++-------- 4 files changed, 95 insertions(+), 88 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4b3aeb7e8..0e3ec93fe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -274,7 +274,11 @@ endif() # allow 'large' files in 32 bit builds if(UNIX) - add_definitions(-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES) + if(CMAKE_VERSION VERSION_GREATER 3.12.0) + add_compile_definitions(_LARGEFILE_SOURCE _FILE_OFFSET_BITS=64 _LARGE_FILES) + else() + add_definitions(-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES) + endif() endif() # If this is an out-of-tree build, do not pollute the original source directory @@ -1115,13 +1119,11 @@ if(NOT VOLKGNSSSDR_FOUND) if(PYTHON_EXECUTABLE) set(USE_THIS_PYTHON "-DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}") endif() - if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - if(CMAKE_GENERATOR STREQUAL Xcode) - set(VOLK_GNSSSDR_BUILD_COMMAND "xcodebuild" - "-configuration" $<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel> - "-alltargets" - ) - endif() + + if(CMAKE_GENERATOR STREQUAL Xcode) + set(VOLK_GNSSSDR_BUILD_COMMAND "xcodebuild" + "-configuration" $<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel> + ) endif() if(CMAKE_TOOLCHAIN_FILE) @@ -1155,11 +1157,7 @@ if(NOT VOLKGNSSSDR_FOUND) ${STRIP_VOLK_GNSSSDR_PROFILE} ${USE_THIS_PYTHON} ) - if(CMAKE_VERSION VERSION_GREATER 3.18.99 AND CMAKE_GENERATOR STREQUAL Xcode) - if(XCODE_VERSION VERSION_GREATER 11) - set(VOLK_GNSSSDR_CMAKE_ARGS ${VOLK_GNSSSDR_CMAKE_ARGS} -T buildsystem=1) - endif() - endif() + if(DEFINED ENV{OECORE_TARGET_SYSROOT}) set(VOLK_GNSSSDR_CMAKE_ARGS ${VOLK_GNSSSDR_CMAKE_ARGS} -DCROSSCOMPILE_MULTILIB=TRUE diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt index 8a8f2e76e..3ca3f822f 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt @@ -9,9 +9,6 @@ # Project setup ######################################################################## cmake_minimum_required(VERSION 2.8.12...3.25) -if(NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE "Release") -endif() set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "Choose build type: None Debug Release RelWithDebInfo MinSizeRel") project(volk_gnsssdr) enable_language(CXX) @@ -227,7 +224,11 @@ endif() set(CROSSCOMPILE_MULTILIB ${CROSSCOMPILE_MULTILIB} CACHE STRING "Define \"true\" if you have and want to use multiple C development libs installed for cross compile") if(MSVC) - add_definitions(-D_USE_MATH_DEFINES) # enables math constants on all supported versions of MSVC + if(CMAKE_VERSION VERSION_GREATER 3.12.0) + add_compile_definitions(_USE_MATH_DEFINES) # enables math constants on all supported versions of MSVC + else() + add_definitions(-D_USE_MATH_DEFINES) # enables math constants on all supported versions of MSVC + endif() add_compile_options(/W1) # reduce warnings add_compile_options(/wo4309) add_compile_options(/wd4752) @@ -237,11 +238,11 @@ endif() # allow 'large' files in 32 bit builds if(UNIX) - add_definitions(-D_LARGEFILE_SOURCE - -D_FILE_OFFSET_BITS=64 - -D_LARGE_FILES - -D_FORTIFY_SOURCE=2 - ) + if(CMAKE_VERSION VERSION_GREATER 3.12.0) + add_compile_definitions(_LARGEFILE_SOURCE _FILE_OFFSET_BITS=64 _LARGE_FILES) + else() + add_definitions(-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES) + endif() endif() @@ -319,7 +320,11 @@ if(MSVC) endif() set(BOOST_ALL_DYN_LINK "${BOOST_ALL_DYN_LINK}" CACHE BOOL "boost enable dynamic linking") if(BOOST_ALL_DYN_LINK) - add_definitions(-DBOOST_ALL_DYN_LINK) # setup boost auto-linking in msvc + if(CMAKE_VERSION VERSION_GREATER 3.12.0) + add_compile_definitions(BOOST_ALL_DYN_LINK) # enables math constants on all supported versions of MSVC + else() + add_definitions(-DBOOST_ALL_DYN_LINK) # setup boost auto-linking in msvc + endif() else() unset(BOOST_REQUIRED_COMPONENTS) # empty components list for static link endif() diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/apps/CMakeLists.txt b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/apps/CMakeLists.txt index 56f672e80..3ed4dafd6 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/apps/CMakeLists.txt +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/apps/CMakeLists.txt @@ -35,8 +35,6 @@ add_executable(volk_gnsssdr_profile ${CMAKE_CURRENT_SOURCE_DIR}/volk_gnsssdr_option_helpers.cc ) -add_dependencies(volk_gnsssdr_profile volk_gnsssdr) - if(MSVC) target_include_directories(volk_gnsssdr_profile PRIVATE $ @@ -59,7 +57,6 @@ if(NOT FILESYSTEM_FOUND) target_link_libraries(volk_gnsssdr_profile PRIVATE ${Boost_LIBRARIES}) endif() - if(FILESYSTEM_FOUND) add_definitions(-DHAS_STD_FILESYSTEM=1) if(${find_experimental}) @@ -72,10 +69,8 @@ if(ENABLE_STATIC_LIBS) target_link_libraries(volk_gnsssdr_profile PRIVATE volk_gnsssdr_static ${orc_lib}) else() target_link_libraries(volk_gnsssdr_profile PRIVATE volk_gnsssdr ${orc_lib}) - add_dependencies(volk_gnsssdr_profile volk_gnsssdr) endif() - if(ENABLE_STRIP) if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND NOT WIN32) set_target_properties(volk_gnsssdr_profile @@ -84,23 +79,19 @@ if(ENABLE_STRIP) endif() endif() - install( TARGETS volk_gnsssdr_profile DESTINATION bin COMPONENT "volk_gnsssdr" ) - # MAKE volk_gnsssdr-config-info add_executable(volk_gnsssdr-config-info volk_gnsssdr-config-info.cc ${CMAKE_CURRENT_SOURCE_DIR}/volk_gnsssdr_option_helpers.cc) - if(ENABLE_STATIC_LIBS) target_link_libraries(volk_gnsssdr-config-info volk_gnsssdr_static ${orc_lib}) else() target_link_libraries(volk_gnsssdr-config-info volk_gnsssdr ${orc_lib}) - add_dependencies(volk_gnsssdr-config-info volk_gnsssdr) endif() if(ENABLE_STRIP) @@ -117,7 +108,6 @@ install( COMPONENT "volk_gnsssdr" ) - # Launch volk_gnsssdr_profile if requested to do so if(ENABLE_PROFILING) if(DEFINED VOLK_CONFIGPATH) diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/CMakeLists.txt b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/CMakeLists.txt index b9da1426d..f7f14395a 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/CMakeLists.txt +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/CMakeLists.txt @@ -558,65 +558,75 @@ else() endif() # Add dynamic library -if(CMAKE_GENERATOR STREQUAL Xcode) - add_library(volk_gnsssdr SHARED ${volk_gnsssdr_sources}) -else() - add_library(volk_gnsssdr SHARED $) -endif() -if(USE_CPU_FEATURES) - if(CPUFEATURES_FOUND) - target_link_libraries(volk_gnsssdr - PUBLIC ${volk_gnsssdr_libraries} - PRIVATE CpuFeature::cpu_features - ) +# Note: new Xcode buildsystem does not allow building both static and dynamic libraries +# so we only build dynamic if ENABLE_STATIC_LIBS is not enabled in that generator. +# For other generators than XCode, the dynamic library is always built. +if(NOT (ENABLE_STATIC_LIBS AND (CMAKE_GENERATOR STREQUAL Xcode))) + if(CMAKE_GENERATOR STREQUAL Xcode) + add_library(volk_gnsssdr SHARED ${volk_gnsssdr_sources}) else() - target_link_libraries(volk_gnsssdr - PUBLIC ${volk_gnsssdr_libraries} - PRIVATE cpu_features + add_library(volk_gnsssdr SHARED $) + endif() + if(USE_CPU_FEATURES) + if(CPUFEATURES_FOUND) + target_link_libraries(volk_gnsssdr + PUBLIC ${volk_gnsssdr_libraries} + PRIVATE CpuFeature::cpu_features + ) + else() + target_link_libraries(volk_gnsssdr + PUBLIC ${volk_gnsssdr_libraries} + PRIVATE cpu_features + ) + endif() + else() + target_link_libraries(volk_gnsssdr PUBLIC ${volk_gnsssdr_libraries}) + endif() + target_include_directories(volk_gnsssdr + PUBLIC $ + PUBLIC $ + PUBLIC $ + PRIVATE ${CMAKE_CURRENT_BINARY_DIR} + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} + PUBLIC $ + ) + if(UNIX) + target_compile_definitions(volk_gnsssdr + PUBLIC $<$:_FORTIFY_SOURCE=2>$<$:_FORTIFY_SOURCE=2> ) endif() -else() - target_link_libraries(volk_gnsssdr PUBLIC ${volk_gnsssdr_libraries}) -endif() -target_include_directories(volk_gnsssdr - PUBLIC $ - PUBLIC $ - PUBLIC $ - PRIVATE ${CMAKE_CURRENT_BINARY_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PUBLIC $ -) -if(USE_CPU_FEATURES) - if(CPUFEATURES_FOUND) - target_include_directories(volk_gnsssdr - PRIVATE - $ - ) - else() - target_include_directories(volk_gnsssdr - PRIVATE - $ - ) + if(USE_CPU_FEATURES) + if(CPUFEATURES_FOUND) + target_include_directories(volk_gnsssdr + PRIVATE + $ + ) + else() + target_include_directories(volk_gnsssdr + PRIVATE + $ + ) + endif() endif() -endif() -# Configure target properties -if(ORC_FOUND) - target_link_libraries(volk_gnsssdr PRIVATE ${ORC_LIBRARIES}) -endif() -if(NOT MSVC) - target_link_libraries(volk_gnsssdr PUBLIC m) -endif() -set_target_properties(volk_gnsssdr PROPERTIES VERSION ${VERSION}) -set_target_properties(volk_gnsssdr PROPERTIES SOVERSION ${SOVERSION}) -set_target_properties(volk_gnsssdr PROPERTIES DEFINE_SYMBOL "volk_gnsssdr_EXPORTS") + # Configure target properties + if(ORC_FOUND) + target_link_libraries(volk_gnsssdr PRIVATE ${ORC_LIBRARIES}) + endif() + if(NOT MSVC) + target_link_libraries(volk_gnsssdr PUBLIC m) + endif() + set_target_properties(volk_gnsssdr PROPERTIES VERSION ${VERSION}) + set_target_properties(volk_gnsssdr PROPERTIES SOVERSION ${SOVERSION}) + set_target_properties(volk_gnsssdr PROPERTIES DEFINE_SYMBOL "volk_gnsssdr_EXPORTS") -# Install locations -install(TARGETS volk_gnsssdr - EXPORT VOLK_GNSSSDR-export - LIBRARY DESTINATION lib${LIB_SUFFIX} COMPONENT "volk_gnsssdr_runtime" # .so file - ARCHIVE DESTINATION lib${LIB_SUFFIX} COMPONENT "volk_gnsssdr_devel" # .lib file - RUNTIME DESTINATION bin COMPONENT "volk_gnsssdr_runtime" # .dll file -) + # Install locations + install(TARGETS volk_gnsssdr + EXPORT VOLK_GNSSSDR-export + LIBRARY DESTINATION lib${LIB_SUFFIX} COMPONENT "volk_gnsssdr_runtime" # .so file + ARCHIVE DESTINATION lib${LIB_SUFFIX} COMPONENT "volk_gnsssdr_devel" # .lib file + RUNTIME DESTINATION bin COMPONENT "volk_gnsssdr_runtime" # .dll file + ) +endif() # Configure static library if(ENABLE_STATIC_LIBS) @@ -654,7 +664,11 @@ if(ENABLE_STATIC_LIBS) PRIVATE ${CMAKE_CURRENT_BINARY_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ) - + if(UNIX) + target_compile_definitions(volk_gnsssdr_static + PUBLIC $<$:_FORTIFY_SOURCE=2>$<$:_FORTIFY_SOURCE=2> + ) + endif() set_target_properties(volk_gnsssdr_static PROPERTIES OUTPUT_NAME volk_gnsssdr) install(TARGETS volk_gnsssdr_static From 6a2ac9eac6445ae0052362e4d8504a0974627f49 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 4 Dec 2022 00:11:42 +0100 Subject: [PATCH 32/59] Fix runtime error if GNU Radio was built with -D_GLIBCXX_ASSERTIONS. Fixes #677 --- src/algorithms/tracking/gnuradio_blocks/CMakeLists.txt | 7 +++++++ .../tracking/gnuradio_blocks/dll_pll_veml_tracking.cc | 6 +++++- .../tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.cc | 6 +++++- .../galileo_e1_tcp_connector_tracking_cc.cc | 6 +++++- .../glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc | 7 +++++-- .../glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc | 6 +++++- .../gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.cc | 7 +++++-- .../glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc | 6 +++++- .../glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc | 6 +++++- .../gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.cc | 6 +++++- .../gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.cc | 6 +++++- .../gnuradio_blocks/gps_l1_ca_gaussian_tracking_cc.cc | 6 +++++- src/algorithms/tracking/gnuradio_blocks/kf_tracking.cc | 6 +++++- 13 files changed, 67 insertions(+), 14 deletions(-) diff --git a/src/algorithms/tracking/gnuradio_blocks/CMakeLists.txt b/src/algorithms/tracking/gnuradio_blocks/CMakeLists.txt index 213774a31..cad24584d 100644 --- a/src/algorithms/tracking/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/tracking/gnuradio_blocks/CMakeLists.txt @@ -163,6 +163,13 @@ if(PMT_USES_BOOST_ANY) ) endif() +if(GNURADIO_IS_38_OR_GREATER) + target_compile_definitions(tracking_gr_blocks + PRIVATE + -DGNURADIO_GREATER_THAN_38=1 + ) +endif() + if(ENABLE_CLANG_TIDY) if(CLANG_TIDY_EXE) set_target_properties(tracking_gr_blocks diff --git a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc index 346369dc1..beb9c11b6 100644 --- a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc +++ b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc @@ -126,12 +126,16 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_) d_acc_carrier_phase_initialized(false), d_Flag_PLL_180_deg_phase_locked(false) { +#if GNURADIO_GREATER_THAN_38 + this->set_relative_rate(1, static_cast(d_trk_parameters.vector_length)); +#else + this->set_relative_rate(1.0 / static_cast(d_trk_parameters.vector_length)); +#endif // prevent telemetry symbols accumulation in output buffers this->set_max_noutput_items(1); // Telemetry bit synchronization message port input this->message_port_register_out(pmt::mp("events")); - this->set_relative_rate(1.0 / static_cast(d_trk_parameters.vector_length)); // Telemetry message port input this->message_port_register_in(pmt::mp("telemetry_to_trk")); diff --git a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.cc b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.cc index 5dfe72fe4..3c30b5fe2 100644 --- a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.cc +++ b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.cc @@ -126,12 +126,16 @@ dll_pll_veml_tracking_fpga::dll_pll_veml_tracking_fpga(const Dll_Pll_Conf_Fpga & d_sc_demodulate_enabled(false), d_Flag_PLL_180_deg_phase_locked(false) { +#if GNURADIO_GREATER_THAN_38 + this->set_relative_rate(1, static_cast(d_trk_parameters.vector_length)); +#else + this->set_relative_rate(1.0 / static_cast(d_trk_parameters.vector_length)); +#endif // prevent telemetry symbols accumulation in output buffers this->set_max_noutput_items(1); // Telemetry bit synchronization message port input this->message_port_register_out(pmt::mp("events")); - this->set_relative_rate(1.0 / static_cast(d_trk_parameters.vector_length)); // Telemetry message port input this->message_port_register_in(pmt::mp("telemetry_to_trk")); diff --git a/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc index 16c554fc4..9f2a4bbef 100644 --- a/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc @@ -117,8 +117,12 @@ Galileo_E1_Tcp_Connector_Tracking_cc::Galileo_E1_Tcp_Connector_Tracking_cc( d_pull_in(false), d_dump_filename(dump_filename) { +#if GNURADIO_GREATER_THAN_38 + this->set_relative_rate(1, static_cast(vector_length)); +#else + this->set_relative_rate(1.0 / static_cast(vector_length)); +#endif this->message_port_register_out(pmt::mp("events")); - this->set_relative_rate(1.0 / vector_length); // Telemetry message port input this->message_port_register_in(pmt::mp("telemetry_to_trk")); diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc index 05b8eb578..a0a7948c2 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc @@ -192,8 +192,11 @@ glonass_l1_ca_dll_pll_c_aid_tracking_cc::glonass_l1_ca_dll_pll_c_aid_tracking_cc d_Prompt_buffer = volk_gnsssdr::vector(FLAGS_cn0_samples); systemName["R"] = std::string("Glonass"); - - set_relative_rate(1.0 / static_cast(d_vector_length)); +#if GNURADIO_GREATER_THAN_38 + this->set_relative_rate(1, static_cast(d_vector_length)); +#else + this->set_relative_rate(1.0 / static_cast(d_vector_length)); +#endif // set_min_output_buffer((int64_t)300); } diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc index 0c3884cf3..f106df5af 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc @@ -190,7 +190,11 @@ glonass_l1_ca_dll_pll_c_aid_tracking_sc::glonass_l1_ca_dll_pll_c_aid_tracking_sc systemName["R"] = std::string("Glonass"); - set_relative_rate(1.0 / static_cast(d_vector_length)); +#if GNURADIO_GREATER_THAN_38 + this->set_relative_rate(1, static_cast(d_vector_length)); +#else + this->set_relative_rate(1.0 / static_cast(d_vector_length)); +#endif // set_min_output_buffer((int64_t)300); } diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.cc index 06f5914cd..a2755d6d4 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.cc @@ -137,8 +137,11 @@ Glonass_L1_Ca_Dll_Pll_Tracking_cc::Glonass_L1_Ca_Dll_Pll_Tracking_cc( d_Prompt_buffer = volk_gnsssdr::vector(FLAGS_cn0_samples); systemName["R"] = std::string("Glonass"); - - set_relative_rate(1.0 / static_cast(d_vector_length)); +#if GNURADIO_GREATER_THAN_38 + this->set_relative_rate(1, static_cast(d_vector_length)); +#else + this->set_relative_rate(1.0 / static_cast(d_vector_length)); +#endif } diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc index e1bd7b419..d59e9ecd3 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc @@ -189,7 +189,11 @@ glonass_l2_ca_dll_pll_c_aid_tracking_cc::glonass_l2_ca_dll_pll_c_aid_tracking_cc systemName["R"] = std::string("Glonass"); - set_relative_rate(1.0 / static_cast(d_vector_length)); +#if GNURADIO_GREATER_THAN_38 + this->set_relative_rate(1, static_cast(d_vector_length)); +#else + this->set_relative_rate(1.0 / static_cast(d_vector_length)); +#endif // set_min_output_buffer((int64_t)300); } diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc index ad99f53cd..f3c9d1f53 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc @@ -187,7 +187,11 @@ glonass_l2_ca_dll_pll_c_aid_tracking_sc::glonass_l2_ca_dll_pll_c_aid_tracking_sc systemName["R"] = std::string("Glonass"); - set_relative_rate(1.0 / static_cast(d_vector_length)); +#if GNURADIO_GREATER_THAN_38 + this->set_relative_rate(1, static_cast(d_vector_length)); +#else + this->set_relative_rate(1.0 / static_cast(d_vector_length)); +#endif // set_min_output_buffer((int64_t)300); } diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.cc index 42041eec1..58295fe21 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.cc @@ -139,7 +139,11 @@ Glonass_L2_Ca_Dll_Pll_Tracking_cc::Glonass_L2_Ca_Dll_Pll_Tracking_cc( systemName["R"] = std::string("Glonass"); - set_relative_rate(1.0 / static_cast(d_vector_length)); +#if GNURADIO_GREATER_THAN_38 + this->set_relative_rate(1, static_cast(d_vector_length)); +#else + this->set_relative_rate(1.0 / static_cast(d_vector_length)); +#endif } diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.cc index 3714f072e..41cf605ae 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.cc @@ -135,7 +135,11 @@ Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc( systemName["G"] = std::string("GPS"); systemName["S"] = std::string("SBAS"); - set_relative_rate(1.0 / (static_cast(d_vector_length) * 2.0)); +#if GNURADIO_GREATER_THAN_38 + this->set_relative_rate(1, static_cast(d_vector_length * 2)); +#else + this->set_relative_rate(1.0 / static_cast(d_vector_length * 2)); +#endif d_acquisition_gnss_synchro = 0; d_channel = 0; diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_gaussian_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_gaussian_tracking_cc.cc index 47870fba2..1092ed3a6 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_gaussian_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_gaussian_tracking_cc.cc @@ -159,7 +159,11 @@ Gps_L1_Ca_Gaussian_Tracking_cc::Gps_L1_Ca_Gaussian_Tracking_cc( systemName["G"] = std::string("GPS"); systemName["S"] = std::string("SBAS"); - set_relative_rate(1.0 / static_cast(d_vector_length)); +#if GNURADIO_GREATER_THAN_38 + this->set_relative_rate(1, static_cast(d_vector_length)); +#else + this->set_relative_rate(1.0 / static_cast(d_vector_length)); +#endif // Kalman filter initialization (receiver initialization) diff --git a/src/algorithms/tracking/gnuradio_blocks/kf_tracking.cc b/src/algorithms/tracking/gnuradio_blocks/kf_tracking.cc index 53856bb4a..7b53a6f0f 100644 --- a/src/algorithms/tracking/gnuradio_blocks/kf_tracking.cc +++ b/src/algorithms/tracking/gnuradio_blocks/kf_tracking.cc @@ -131,12 +131,16 @@ kf_tracking::kf_tracking(const Kf_Conf &conf_) d_dump_mat(d_trk_parameters.dump_mat && d_dump), d_acc_carrier_phase_initialized(false) { +#if GNURADIO_GREATER_THAN_38 + this->set_relative_rate(1, static_cast(d_trk_parameters.vector_length)); +#else + this->set_relative_rate(1.0 / static_cast(d_trk_parameters.vector_length)); +#endif // prevent telemetry symbols accumulation in output buffers this->set_max_noutput_items(1); // Telemetry bit synchronization message port input this->message_port_register_out(pmt::mp("events")); - this->set_relative_rate(1.0 / static_cast(d_trk_parameters.vector_length)); // Telemetry message port input this->message_port_register_in(pmt::mp("telemetry_to_trk")); From cecf7e5e434daff37d7cdd60f6571a7503df0c93 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 5 Dec 2022 15:02:35 +0100 Subject: [PATCH 33/59] Fix building if boost::endian is not available --- .../signal_source/adapters/CMakeLists.txt | 49 +++++++------------ .../gnuradio_blocks/labsat23_source.cc | 15 +++++- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/algorithms/signal_source/adapters/CMakeLists.txt b/src/algorithms/signal_source/adapters/CMakeLists.txt index ab24d5fc1..717b8ac00 100644 --- a/src/algorithms/signal_source/adapters/CMakeLists.txt +++ b/src/algorithms/signal_source/adapters/CMakeLists.txt @@ -6,48 +6,41 @@ # Optional drivers -set(OPT_DRIVER_SOURCES "") -set(OPT_DRIVER_HEADERS "") if(ENABLE_RAW_UDP AND PCAP_FOUND) - set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} custom_udp_signal_source.cc) - set(OPT_DRIVER_HEADERS ${OPT_DRIVER_HEADERS} custom_udp_signal_source.h) + list(APPEND OPT_DRIVER_SOURCES custom_udp_signal_source.cc) + list(APPEND OPT_DRIVER_HEADERS custom_udp_signal_source.h) endif() - if(ENABLE_PLUTOSDR) ############################################## # ADALM-PLUTO (Analog Devices Inc.) ############################################## - set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} plutosdr_signal_source.cc) - set(OPT_DRIVER_HEADERS ${OPT_DRIVER_HEADERS} plutosdr_signal_source.h) + list(APPEND OPT_DRIVER_SOURCES plutosdr_signal_source.cc) + list(APPEND OPT_DRIVER_HEADERS plutosdr_signal_source.h) endif() - if(ENABLE_FMCOMMS2) ############################################### # FMCOMMS2 based SDR Hardware ############################################### - set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} fmcomms2_signal_source.cc) - set(OPT_DRIVER_HEADERS ${OPT_DRIVER_HEADERS} fmcomms2_signal_source.h) + list(APPEND OPT_DRIVER_SOURCES fmcomms2_signal_source.cc) + list(APPEND OPT_DRIVER_HEADERS fmcomms2_signal_source.h) endif() - if(ENABLE_AD9361) ############################################### # AD9361 DIRECT TO FPGA Hardware ############################################### - set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} ad9361_fpga_signal_source.cc) - set(OPT_DRIVER_HEADERS ${OPT_DRIVER_HEADERS} ad9361_fpga_signal_source.h) + list(APPEND OPT_DRIVER_SOURCES ad9361_fpga_signal_source.cc) + list(APPEND OPT_DRIVER_HEADERS ad9361_fpga_signal_source.h) endif() - if(ENABLE_FLEXIBAND AND TELEORBIT_FOUND) - set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} flexiband_signal_source.cc) - set(OPT_DRIVER_HEADERS ${OPT_DRIVER_HEADERS} flexiband_signal_source.h) + list(APPEND OPT_DRIVER_SOURCES flexiband_signal_source.cc) + list(APPEND OPT_DRIVER_HEADERS flexiband_signal_source.h) endif() - if(ENABLE_ARRAY) ############################################## # DBFCTTC GNSS EXPERIMENTAL ARRAY PROTOTYPE @@ -56,32 +49,30 @@ if(ENABLE_ARRAY) message(" gr-dbfcttc not found, install it from https://github.com/gnss-sdr/gr-dbfcttc") message(FATAL_ERROR "gr-dbfcttc required for building gnss-sdr with this option enabled") endif() - set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} raw_array_signal_source.cc) - set(OPT_DRIVER_HEADERS ${OPT_DRIVER_HEADERS} raw_array_signal_source.h) + list(APPEND OPT_DRIVER_SOURCES raw_array_signal_source.cc) + list(APPEND OPT_DRIVER_HEADERS raw_array_signal_source.h) endif() - if(ENABLE_OSMOSDR) ################################################################################ # OsmoSDR - https://osmocom.org/projects/gr-osmosdr/ ################################################################################ if(GROSMOSDR_FOUND) - set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} osmosdr_signal_source.cc) - set(OPT_DRIVER_HEADERS ${OPT_DRIVER_HEADERS} osmosdr_signal_source.h) + list(APPEND OPT_DRIVER_SOURCES osmosdr_signal_source.cc) + list(APPEND OPT_DRIVER_HEADERS osmosdr_signal_source.h) endif() endif() if(ENABLE_LIMESDR) if(GRLIMESDR_FOUND) - set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} limesdr_signal_source.cc) - set(OPT_DRIVER_HEADERS ${OPT_DRIVER_HEADERS} limesdr_signal_source.h) + list(APPEND OPT_DRIVER_SOURCES limesdr_signal_source.cc) + list(APPEND OPT_DRIVER_HEADERS limesdr_signal_source.h) endif() endif() - if(ENABLE_UHD) - set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} uhd_signal_source.cc) - set(OPT_DRIVER_HEADERS ${OPT_DRIVER_HEADERS} uhd_signal_source.h) + list(APPEND OPT_DRIVER_SOURCES uhd_signal_source.cc) + list(APPEND OPT_DRIVER_HEADERS uhd_signal_source.h) endif() if(ENABLE_ZMQ) @@ -89,7 +80,6 @@ if(ENABLE_ZMQ) list(APPEND OPT_DRIVER_HEADERS zmq_signal_source.h) endif() - set(SIGNAL_SOURCE_ADAPTER_SOURCES signal_source_base.cc file_source_base.cc @@ -218,7 +208,6 @@ if(ENABLE_LIMESDR AND GRLIMESDR_FOUND) ) endif() - if(ENABLE_AD9361 AND LIBIIO_FOUND) target_link_libraries(signal_source_adapters PRIVATE @@ -302,8 +291,6 @@ target_compile_definitions(signal_source_adapters PRIVATE -DGNSSSDR_INSTALL_DIR="${CMAKE_INSTALL_PREFIX}" ) - - set_property(TARGET signal_source_adapters APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES $ diff --git a/src/algorithms/signal_source/gnuradio_blocks/labsat23_source.cc b/src/algorithms/signal_source/gnuradio_blocks/labsat23_source.cc index 2c88841fc..dafa79e37 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/labsat23_source.cc +++ b/src/algorithms/signal_source/gnuradio_blocks/labsat23_source.cc @@ -21,7 +21,6 @@ #include "INIReader.h" #include "command_event.h" #include "gnss_sdr_make_unique.h" -#include #include #include #include @@ -33,6 +32,10 @@ #include #include +#if HAS_BOOST_ENDIAN +#include +#endif + labsat23_source_sptr labsat23_make_source_sptr(const char *signal_file_basename, const std::vector &channel_selector, Concurrent_Queue *queue, bool digital_io_enabled) { @@ -1078,8 +1081,18 @@ int labsat23_source::general_work(int noutput_items, { uint64_t read_register = 0ULL; // Labsat3W writes its 64-bit shift register to files in little endian. Read and convert to host endianness. +#if HAS_BOOST_ENDIAN binary_input_file.read(reinterpret_cast(&read_register), sizeof(read_register)); boost::endian::little_to_native_inplace(read_register); +#else + std::array memory_block{}; + binary_input_file.read(memory_block.data(), 8); + for (int k = 7; k >= 0; --k) + { + read_register <<= 8; + read_register |= uint64_t(memory_block[k]); // This is buggy if the MSB of the char is set. + } +#endif if (binary_input_file.gcount() == 8) { From c9a845ab3dfe8b9b3a45c4182733c386acdf4f94 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 5 Dec 2022 16:17:54 +0100 Subject: [PATCH 34/59] Activate usage of boost::endian if available --- .../gnuradio_blocks/CMakeLists.txt | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/algorithms/signal_source/gnuradio_blocks/CMakeLists.txt b/src/algorithms/signal_source/gnuradio_blocks/CMakeLists.txt index 7b550b2d6..d06dc866f 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/signal_source/gnuradio_blocks/CMakeLists.txt @@ -5,14 +5,11 @@ # SPDX-License-Identifier: BSD-3-Clause -set(OPT_DRIVER_SOURCES "") -set(OPT_DRIVER_HEADERS "") if(ENABLE_RAW_UDP AND PCAP_FOUND) - set(OPT_DRIVER_SOURCES gr_complex_ip_packet_source.cc) - set(OPT_DRIVER_HEADERS gr_complex_ip_packet_source.h) + list(APPEND OPT_DRIVER_SOURCES gr_complex_ip_packet_source.cc) + list(APPEND OPT_DRIVER_HEADERS gr_complex_ip_packet_source.h) endif() - set(SIGNAL_SOURCE_GR_BLOCKS_SOURCES fifo_reader.cc unpack_byte_2bit_samples.cc @@ -26,7 +23,6 @@ set(SIGNAL_SOURCE_GR_BLOCKS_SOURCES ${OPT_DRIVER_SOURCES} ) - set(SIGNAL_SOURCE_GR_BLOCKS_HEADERS fifo_reader.h unpack_byte_2bit_samples.h @@ -134,6 +130,17 @@ else() ) endif() +if(Boost_VERSION_STRING VERSION_GREATER "1.57.99") + target_compile_definitions(signal_source_gr_blocks + PRIVATE + -DHAS_BOOST_ENDIAN=1 + ) + target_link_libraries(signal_source_gr_blocks + PRIVATE + Boost::headers + ) +endif() + if(ENABLE_CLANG_TIDY) if(CLANG_TIDY_EXE) set_target_properties(signal_source_gr_blocks From f78579ce7eda952b06c664c098357934368193e1 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 5 Dec 2022 16:22:01 +0100 Subject: [PATCH 35/59] Remove unused variable --- .../adapters/spir_gss6450_file_signal_source.cc | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/algorithms/signal_source/adapters/spir_gss6450_file_signal_source.cc b/src/algorithms/signal_source/adapters/spir_gss6450_file_signal_source.cc index 17dcc9205..7b4da0e88 100644 --- a/src/algorithms/signal_source/adapters/spir_gss6450_file_signal_source.cc +++ b/src/algorithms/signal_source/adapters/spir_gss6450_file_signal_source.cc @@ -190,7 +190,6 @@ void SpirGSS6450FileSignalSource::connect(gr::top_block_sptr top_block) if (n_channels_ > 1) { - uint32_t aux = 0; for (int32_t i = 0; i < n_channels_; i++) { if (i != (sel_ch_ - 1)) @@ -204,8 +203,6 @@ void SpirGSS6450FileSignalSource::connect(gr::top_block_sptr top_block) { top_block->connect(deint_, i, unpack_spir_vec_.at(i), 0); } - - aux++; } } } @@ -251,7 +248,6 @@ void SpirGSS6450FileSignalSource::disconnect(gr::top_block_sptr top_block) } if (n_channels_ > 1) { - uint32_t aux = 0; for (int32_t i = 0; i < n_channels_; i++) { if (i != (sel_ch_ - 1)) @@ -265,8 +261,6 @@ void SpirGSS6450FileSignalSource::disconnect(gr::top_block_sptr top_block) { top_block->disconnect(deint_, i, unpack_spir_vec_.at(i), 0); } - - aux++; } } } From 31be8fb83139a8c5d325b19c3daebf8c52c0b41f Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 5 Dec 2022 17:39:33 +0100 Subject: [PATCH 36/59] Remove unused commit --- src/algorithms/input_filter/gnuradio_blocks/CMakeLists.txt | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/algorithms/input_filter/gnuradio_blocks/CMakeLists.txt b/src/algorithms/input_filter/gnuradio_blocks/CMakeLists.txt index 51113a267..c65727296 100644 --- a/src/algorithms/input_filter/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/input_filter/gnuradio_blocks/CMakeLists.txt @@ -53,13 +53,6 @@ target_include_directories(input_filter_gr_blocks ${GNSSSDR_SOURCE_DIR}/src/core/interfaces ) -if(LOG4CPP_WITH_OLD_CMAKE) - target_link_libraries(input_filter_gr_blocks - PRIVATE - Log4cpp::log4cpp - ) -endif() - if(GNURADIO_USES_STD_POINTERS) target_compile_definitions(input_filter_gr_blocks PUBLIC -DGNURADIO_USES_STD_POINTERS=1 From 44aa398ea1b44dbb17a5132d6e6e16b69317384b Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 5 Dec 2022 13:11:48 +0100 Subject: [PATCH 37/59] Remove set but not used warning --- src/algorithms/libs/glonass_l1_signal_replica.cc | 14 +++----------- src/algorithms/libs/glonass_l2_signal_replica.cc | 14 +++----------- 2 files changed, 6 insertions(+), 22 deletions(-) diff --git a/src/algorithms/libs/glonass_l1_signal_replica.cc b/src/algorithms/libs/glonass_l1_signal_replica.cc index 48efc82e6..4895182bf 100644 --- a/src/algorithms/libs/glonass_l1_signal_replica.cc +++ b/src/algorithms/libs/glonass_l1_signal_replica.cc @@ -27,18 +27,17 @@ void glonass_l1_ca_code_gen_complex(own::span> dest, uint32_ const uint32_t code_length = 511; std::bitset G1{}; auto G1_register = std::bitset<9>{}.set(); // All true - bool feedback1; - bool aux; - uint32_t delay; uint32_t lcv; uint32_t lcv2; + bool feedback1; + bool aux; /* Generate G1 Register */ for (lcv = 0; lcv < code_length; lcv++) { G1[lcv] = G1_register[2]; - feedback1 = G1_register[4] xor G1_register[0]; + feedback1 = G1_register[4] ^ G1_register[0]; for (lcv2 = 0; lcv2 < 8; lcv2++) { @@ -62,11 +61,6 @@ void glonass_l1_ca_code_gen_complex(own::span> dest, uint32_ } } - /* Set the delay */ - delay = code_length; - delay += chip_shift; - delay %= code_length; - /* Generate PRN from G1 and G2 Registers */ for (lcv = 0; lcv < code_length; lcv++) { @@ -79,8 +73,6 @@ void glonass_l1_ca_code_gen_complex(own::span> dest, uint32_ { dest[lcv] = std::complex(-1, 0); } - delay++; - delay %= code_length; } } diff --git a/src/algorithms/libs/glonass_l2_signal_replica.cc b/src/algorithms/libs/glonass_l2_signal_replica.cc index 879adc414..a7edb55df 100644 --- a/src/algorithms/libs/glonass_l2_signal_replica.cc +++ b/src/algorithms/libs/glonass_l2_signal_replica.cc @@ -27,18 +27,17 @@ void glonass_l2_ca_code_gen_complex(own::span> dest, uint32_ const uint32_t code_length = 511; std::bitset G1{}; auto G1_register = std::bitset<9>{}.set(); // All true - bool feedback1; - bool aux; - uint32_t delay; uint32_t lcv; uint32_t lcv2; + bool feedback1; + bool aux; /* Generate G1 Register */ for (lcv = 0; lcv < code_length; lcv++) { G1[lcv] = G1_register[2]; - feedback1 = G1_register[4] xor G1_register[0]; + feedback1 = G1_register[4] ^ G1_register[0]; for (lcv2 = 0; lcv2 < 8; lcv2++) { @@ -62,11 +61,6 @@ void glonass_l2_ca_code_gen_complex(own::span> dest, uint32_ } } - /* Set the delay */ - delay = code_length; - delay += chip_shift; - delay %= code_length; - /* Generate PRN from G1 and G2 Registers */ for (lcv = 0; lcv < code_length; lcv++) { @@ -79,8 +73,6 @@ void glonass_l2_ca_code_gen_complex(own::span> dest, uint32_ { dest[lcv] = std::complex(-1, 0); } - delay++; - delay %= code_length; } } From 4ce4682ea85d2374a11988ece0f09851c3b10b7a Mon Sep 17 00:00:00 2001 From: Marc Majoral Date: Mon, 5 Dec 2022 19:18:31 +0100 Subject: [PATCH 38/59] use separate files for the Xilinx DMA-proxy and the ezdma drivers --- .../adapters/ad9361_fpga_signal_source.cc | 14 ++-- .../adapters/ad9361_fpga_signal_source.h | 6 +- .../signal_source/libs/CMakeLists.txt | 9 ++- .../libs/{fpga_dma.cc => fpga_dma-proxy.cc} | 56 ++------------ .../libs/{fpga_dma.h => fpga_dma-proxy.h} | 74 ++++++++----------- .../signal_source/libs/fpga_ezdma.cc | 68 +++++++++++++++++ .../signal_source/libs/fpga_ezdma.h | 64 ++++++++++++++++ 7 files changed, 187 insertions(+), 104 deletions(-) rename src/algorithms/signal_source/libs/{fpga_dma.cc => fpga_dma-proxy.cc} (56%) rename src/algorithms/signal_source/libs/{fpga_dma.h => fpga_dma-proxy.h} (51%) create mode 100644 src/algorithms/signal_source/libs/fpga_ezdma.cc create mode 100644 src/algorithms/signal_source/libs/fpga_ezdma.h diff --git a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc b/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc index 4138c038d..065838450 100644 --- a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc +++ b/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc @@ -610,7 +610,7 @@ void Ad9361FpgaSignalSource::run_DMA_process(const std::string &filename0_, cons // rx signal vectors std::vector input_samples(sample_block_size * 2); // complex samples // pointer to DMA buffer - std::array *dma_buffer; + int8_t *dma_buffer; int nread_elements = 0; // num bytes read from the file corresponding to frequency band 1 bool run_DMA = true; @@ -631,8 +631,8 @@ void Ad9361FpgaSignalSource::run_DMA_process(const std::string &filename0_, cons // if only one file is enabled then clear the samples corresponding to the frequency band that is not used. for (int index0 = 0; index0 < (nread_elements); index0 += 2) { - (*dma_buffer)[dma_index + (2 - dma_buff_offset_pos)] = 0; - (*dma_buffer)[dma_index + 1 + (2 - dma_buff_offset_pos)] = 0; + dma_buffer[dma_index + (2 - dma_buff_offset_pos)] = 0; + dma_buffer[dma_index + 1 + (2 - dma_buff_offset_pos)] = 0; dma_index += 4; } } @@ -673,8 +673,8 @@ void Ad9361FpgaSignalSource::run_DMA_process(const std::string &filename0_, cons for (int index0 = 0; index0 < (nread_elements); index0 += 2) { // dma_buff_offset_pos is 1 for the L1 band and 0 for the other bands - (*dma_buffer)[dma_index + dma_buff_offset_pos] = input_samples[index0]; - (*dma_buffer)[dma_index + 1 + dma_buff_offset_pos] = input_samples[index0 + 1]; + dma_buffer[dma_index + dma_buff_offset_pos] = input_samples[index0]; + dma_buffer[dma_index + 1 + dma_buff_offset_pos] = input_samples[index0 + 1]; dma_index += 4; } @@ -704,8 +704,8 @@ void Ad9361FpgaSignalSource::run_DMA_process(const std::string &filename0_, cons for (int index0 = 0; index0 < (nread_elements); index0 += 2) { // filename2 is never the L1 band - (*dma_buffer)[dma_index] = input_samples[index0]; - (*dma_buffer)[dma_index + 1] = input_samples[index0 + 1]; + dma_buffer[dma_index] = input_samples[index0]; + dma_buffer[dma_index + 1] = input_samples[index0 + 1]; dma_index += 4; } } diff --git a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.h b/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.h index c2feb998d..f16f6f274 100644 --- a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.h +++ b/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.h @@ -23,7 +23,11 @@ #include "concurrent_queue.h" #include "fpga_buffer_monitor.h" -#include "fpga_dma.h" +#if INTPTR_MAX == INT64_MAX // 64-bit processor architecture +#include "fpga_dma-proxy.h" +#else +#include "fpga_ezdma.h" +#endif #include "fpga_dynamic_bit_selection.h" #include "fpga_switch.h" #include "gnss_block_interface.h" diff --git a/src/algorithms/signal_source/libs/CMakeLists.txt b/src/algorithms/signal_source/libs/CMakeLists.txt index 2823283b7..64dfe3a60 100644 --- a/src/algorithms/signal_source/libs/CMakeLists.txt +++ b/src/algorithms/signal_source/libs/CMakeLists.txt @@ -19,8 +19,13 @@ if(ENABLE_FPGA OR ENABLE_AD9361) set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} fpga_dynamic_bit_selection.h) set(OPT_SIGNAL_SOURCE_LIB_SOURCES ${OPT_SIGNAL_SOURCE_LIB_SOURCES} fpga_buffer_monitor.cc) set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} fpga_buffer_monitor.h) - set(OPT_SIGNAL_SOURCE_LIB_SOURCES ${OPT_SIGNAL_SOURCE_LIB_SOURCES} fpga_dma.cc) - set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} fpga_dma.h) + if(ARCH_64BITS) + set(OPT_SIGNAL_SOURCE_LIB_SOURCES ${OPT_SIGNAL_SOURCE_LIB_SOURCES} fpga_dma-proxy.cc) + set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} fpga_dma-proxy.h) + else() + set(OPT_SIGNAL_SOURCE_LIB_SOURCES ${OPT_SIGNAL_SOURCE_LIB_SOURCES} fpga_ezdma.cc) + set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} fpga_ezdma.h) + endif() endif() set(SIGNAL_SOURCE_LIB_SOURCES diff --git a/src/algorithms/signal_source/libs/fpga_dma.cc b/src/algorithms/signal_source/libs/fpga_dma-proxy.cc similarity index 56% rename from src/algorithms/signal_source/libs/fpga_dma.cc rename to src/algorithms/signal_source/libs/fpga_dma-proxy.cc index 286ef9324..1e8881300 100644 --- a/src/algorithms/signal_source/libs/fpga_dma.cc +++ b/src/algorithms/signal_source/libs/fpga_dma-proxy.cc @@ -1,5 +1,5 @@ /*! - * \file fpga_dma.cc + * \file fpga_dma-proxy.cc * \brief FPGA DMA control. This code is based in the Xilinx DMA proxy test application: * https://github.com/Xilinx-Wiki-Projects/software-prototypes/tree/master/linux-user-space-dma/Software * \author Marc Majoral, mmajoral(at)cttc.es @@ -15,7 +15,7 @@ * ----------------------------------------------------------------------------- */ -#include "fpga_dma.h" +#include "fpga_dma-proxy.h" #include #include // for std::cerr #include // for ioctl() @@ -24,7 +24,6 @@ int Fpga_DMA::DMA_open() { -#if INTPTR_MAX == INT64_MAX // 64-bit processor architecture tx_channel.fd = open("/dev/dma_proxy_tx", O_RDWR); if (tx_channel.fd < 1) { @@ -40,61 +39,29 @@ int Fpga_DMA::DMA_open() return -1; } -#else // 32-bit processor architecture - tx_fd = open("/dev/loop_tx", O_WRONLY); - if (tx_fd < 1) - { - return tx_fd; - } - // note: a problem was identified with the DMA: when switching from tx to rx or rx to tx mode - // the DMA transmission may hang. This problem will be fixed soon. - // for the moment this problem can be avoided by closing and opening the DMA a second time - if (close(tx_fd) < 0) - { - std::cerr << "Error closing loop device " << '\n'; - return -1; - } - // open the DMA a second time - tx_fd = open("/dev/loop_tx", O_WRONLY); - if (tx_fd < 1) - { - std::cerr << "Cannot open loop device\n"; - // stop the receiver - return tx_fd; - } -#endif - return 0; } - -std::array *Fpga_DMA::get_buffer_address() // NOLINT(readability-make-member-function-const) +int8_t *Fpga_DMA::get_buffer_address() // NOLINT(readability-make-member-function-const) { -#if INTPTR_MAX == INT64_MAX // 64-bit processor architecture - return &tx_channel.buf_ptr[0].buffer; -#else // 32-bit processor architecture - return &buffer; -#endif + return tx_channel.buf_ptr[0].buffer; } - int Fpga_DMA::DMA_write(int nbytes) const { -#if INTPTR_MAX == INT64_MAX // 64-bit processor architecture - int buffer_id = 0; tx_channel.buf_ptr[0].length = nbytes; // start DMA transfer - if (ioctl(tx_channel.fd, START_XFER, &buffer_id)) + if (ioctl(tx_channel.fd, _IOW('a', 'b', int32_t *), &buffer_id)) // start transfer { std::cerr << "Error starting tx DMA transfer " << '\n'; return -1; } // wait for completion of DMA transfer - if (ioctl(tx_channel.fd, FINISH_XFER, &buffer_id)) + if (ioctl(tx_channel.fd, _IOW('a', 'a', int32_t *), &buffer_id)) // finish transfer { std::cerr << "Error detecting end of DMA transfer " << '\n'; return -1; @@ -105,27 +72,16 @@ int Fpga_DMA::DMA_write(int nbytes) const std::cerr << "Proxy DMA Tx transfer error " << '\n'; return -1; } -#else // 32-bit processor architecture - const int num_bytes_sent = write(tx_fd, buffer.data(), nbytes); - if (num_bytes_sent != nbytes) - { - return -1; - } -#endif return 0; } int Fpga_DMA::DMA_close() const { -#if INTPTR_MAX == INT64_MAX // 64-bit processor architecture if (munmap(tx_channel.buf_ptr, sizeof(struct channel_buffer))) { std::cerr << "Failed to unmap DMA tx channel " << '\n'; return -1; } return close(tx_channel.fd); -#else // 32-bit processor architecture - return close(tx_fd); -#endif } diff --git a/src/algorithms/signal_source/libs/fpga_dma.h b/src/algorithms/signal_source/libs/fpga_dma-proxy.h similarity index 51% rename from src/algorithms/signal_source/libs/fpga_dma.h rename to src/algorithms/signal_source/libs/fpga_dma-proxy.h index 183500159..899b0177b 100644 --- a/src/algorithms/signal_source/libs/fpga_dma.h +++ b/src/algorithms/signal_source/libs/fpga_dma-proxy.h @@ -1,5 +1,5 @@ /*! - * \file fpga_dma.h + * \file fpga_dma-proxy.h * \brief FPGA DMA control. This code is based in the Xilinx DMA proxy test application: * https://github.com/Xilinx-Wiki-Projects/software-prototypes/tree/master/linux-user-space-dma/Software * \author Marc Majoral, mmajoral(at)cttc.es @@ -15,45 +15,11 @@ * ----------------------------------------------------------------------------- */ +#ifndef GNSS_SDR_FPGA_DMA_PROXY_H +#define GNSS_SDR_FPGA_DMA_PROXY_H -#ifndef GNSS_SDR_FPGA_DMA_H -#define GNSS_SDR_FPGA_DMA_H - -#include // for std::array #include // for std::int8_t -#define BUFFER_SIZE (128 * 1024) /* must match driver exactly */ - -#if INTPTR_MAX == INT64_MAX // 64-bit processor architecture - -#define TX_BUFFER_COUNT 1 /* app only, must be <= to the number in the driver */ - -#define FINISH_XFER _IOW('a', 'a', int32_t *) -#define START_XFER _IOW('a', 'b', int32_t *) - -// channel buffer structure -struct channel_buffer -{ - std::array buffer; - enum proxy_status - { - PROXY_NO_ERROR = 0, - PROXY_BUSY = 1, - PROXY_TIMEOUT = 2, - PROXY_ERROR = 3 - } status; - unsigned int length; -} __attribute__((aligned(1024))); /* 64 byte alignment required for DMA, but 1024 handy for viewing memory */ - -// internal DMA channel data structure -struct channel -{ - struct channel_buffer *buf_ptr; - int fd; -}; - -#endif - /*! * \brief Class that controls the switch DMA in the FPGA */ @@ -78,7 +44,7 @@ public: /*! * \brief Obtain DMA buffer address. */ - std::array *get_buffer_address(void); // NOLINT(readability-make-member-function-const) + int8_t *get_buffer_address(void); // NOLINT(readability-make-member-function-const) /*! * \brief Transfer DMA data @@ -91,11 +57,31 @@ public: int DMA_close(void) const; private: -#if INTPTR_MAX == INT64_MAX // 64-bit processor architecture + static const uint32_t DMA_MAX_BUFFER_SIZE = (128 * 1024); /* must match driver exactly */ + static const uint32_t TX_BUFFER_COUNT = 1; + + // channel buffer structure + struct channel_buffer + { + //std::array buffer; + int8_t buffer[DMA_MAX_BUFFER_SIZE]; + enum proxy_status + { + PROXY_NO_ERROR = 0, + PROXY_BUSY = 1, + PROXY_TIMEOUT = 2, + PROXY_ERROR = 3 + } status; + unsigned int length; + } __attribute__((aligned(1024))); /* 64 byte alignment required for DMA, but 1024 handy for viewing memory */ + + // internal DMA channel data structure + struct channel + { + struct channel_buffer *buf_ptr; + int fd; + }; + channel tx_channel; -#else // 32-bit processor architecture - std::array buffer; - int tx_fd; -#endif }; -#endif // GNSS_SDR_FPGA_DMA_H +#endif // GNSS_SDR_FPGA_DMA_PROXY_H diff --git a/src/algorithms/signal_source/libs/fpga_ezdma.cc b/src/algorithms/signal_source/libs/fpga_ezdma.cc new file mode 100644 index 000000000..cb8f5497e --- /dev/null +++ b/src/algorithms/signal_source/libs/fpga_ezdma.cc @@ -0,0 +1,68 @@ +/*! + * \file fpga_edma.cc + * \brief FPGA DMA control using the ezdma (See https://github.com/jeremytrimble/ezdma). + * \author Marc Majoral, mmajoral(at)cttc.es + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2022 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ +#include "fpga_ezdma.h" +#include +#include // for std::cerr +#include + +int Fpga_DMA::DMA_open() +{ + tx_fd = open("/dev/loop_tx", O_WRONLY); + if (tx_fd < 1) + { + return tx_fd; + } + // note: a problem was identified with the DMA: when switching from tx to rx or rx to tx mode + // the DMA transmission may hang. This problem will be fixed soon. + // for the moment this problem can be avoided by closing and opening the DMA a second time + if (close(tx_fd) < 0) + { + std::cerr << "Error closing loop device " << '\n'; + return -1; + } + // open the DMA a second time + tx_fd = open("/dev/loop_tx", O_WRONLY); + if (tx_fd < 1) + { + std::cerr << "Cannot open loop device\n"; + // stop the receiver + return tx_fd; + } + return 0; +} + + +int8_t *Fpga_DMA::get_buffer_address() +{ + return buffer; +} + + +int Fpga_DMA::DMA_write(int nbytes) const +{ + const int num_bytes_sent = write(tx_fd, buffer, nbytes); + if (num_bytes_sent != nbytes) + { + return -1; + } + return 0; +} + + +int Fpga_DMA::DMA_close() const +{ + return close(tx_fd); +} diff --git a/src/algorithms/signal_source/libs/fpga_ezdma.h b/src/algorithms/signal_source/libs/fpga_ezdma.h new file mode 100644 index 000000000..801d2a6b7 --- /dev/null +++ b/src/algorithms/signal_source/libs/fpga_ezdma.h @@ -0,0 +1,64 @@ +/*! + * \file fpga_ezdma.h + * \brief FPGA DMA control using the ezdma (See https://github.com/jeremytrimble/ezdma). + * \author Marc Majoral, mmajoral(at)cttc.es + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2022 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + + +#ifndef GNSS_SDR_FPGA_EDMA_H +#define GNSS_SDR_FPGA_EDMA_H + +#include // for std::int8_t + +/*! + * \brief Class that controls the switch DMA in the FPGA + */ +class Fpga_DMA +{ +public: + /*! + * \brief Default constructor. + */ + Fpga_DMA() = default; + + /*! + * \brief Default destructor. + */ + ~Fpga_DMA() = default; + + /*! + * \brief Open the DMA device driver. + */ + int DMA_open(void); + + /*! + * \brief Obtain DMA buffer address. + */ + int8_t *get_buffer_address(void); // NOLINT(readability-make-member-function-const) + + /*! + * \brief Transfer DMA data + */ + int DMA_write(int nbytes) const; + + /*! + * \brief Close the DMA device driver + */ + int DMA_close(void) const; + +private: + static const uint32_t DMA_MAX_BUFFER_SIZE = 4 * 16384; // 4-channel 16384-sample buffers + int8_t buffer[DMA_MAX_BUFFER_SIZE]; + int tx_fd; +}; +#endif // GNSS_SDR_FPGA_EDMA_H From 5ac57eff385f8138d9785e182f4c38d27bba8f12 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 5 Dec 2022 20:42:42 +0100 Subject: [PATCH 39/59] Fix formatting --- src/algorithms/signal_source/libs/CMakeLists.txt | 4 ++-- src/algorithms/signal_source/libs/fpga_dma-proxy.h | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/algorithms/signal_source/libs/CMakeLists.txt b/src/algorithms/signal_source/libs/CMakeLists.txt index 64dfe3a60..b4db8353c 100644 --- a/src/algorithms/signal_source/libs/CMakeLists.txt +++ b/src/algorithms/signal_source/libs/CMakeLists.txt @@ -21,10 +21,10 @@ if(ENABLE_FPGA OR ENABLE_AD9361) set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} fpga_buffer_monitor.h) if(ARCH_64BITS) set(OPT_SIGNAL_SOURCE_LIB_SOURCES ${OPT_SIGNAL_SOURCE_LIB_SOURCES} fpga_dma-proxy.cc) - set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} fpga_dma-proxy.h) + set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} fpga_dma-proxy.h) else() set(OPT_SIGNAL_SOURCE_LIB_SOURCES ${OPT_SIGNAL_SOURCE_LIB_SOURCES} fpga_ezdma.cc) - set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} fpga_ezdma.h) + set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} fpga_ezdma.h) endif() endif() diff --git a/src/algorithms/signal_source/libs/fpga_dma-proxy.h b/src/algorithms/signal_source/libs/fpga_dma-proxy.h index 899b0177b..eb84aa682 100644 --- a/src/algorithms/signal_source/libs/fpga_dma-proxy.h +++ b/src/algorithms/signal_source/libs/fpga_dma-proxy.h @@ -63,7 +63,6 @@ private: // channel buffer structure struct channel_buffer { - //std::array buffer; int8_t buffer[DMA_MAX_BUFFER_SIZE]; enum proxy_status { From 843fb7a58a45b67fd218f0e1a44962d104e54685 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 5 Dec 2022 20:44:52 +0100 Subject: [PATCH 40/59] Remove unused private member --- .../adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.h | 1 - .../acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.h | 1 - .../acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.h | 1 - .../acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.h | 1 - .../acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc | 1 - .../acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.h | 3 +-- .../acquisition/adapters/gps_l5i_pcps_acquisition_fpga.h | 1 - src/algorithms/acquisition/libs/acq_conf_fpga.cc | 1 - 8 files changed, 1 insertion(+), 9 deletions(-) diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.h b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.h index e28fdd087..209ba88d7 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.h +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.h @@ -197,7 +197,6 @@ private: volk_gnsssdr::vector d_all_fft_codes_; // memory that contains all the code ffts std::weak_ptr channel_fsm_; Gnss_Synchro* gnss_synchro_; - const ConfigurationInterface* configuration_; Acq_Conf_Fpga acq_parameters_; std::string role_; int64_t fs_in_; diff --git a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.h b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.h index 9968ccd72..9f9170c40 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.h +++ b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.h @@ -204,7 +204,6 @@ private: std::weak_ptr channel_fsm_; volk_gnsssdr::vector d_all_fft_codes_; // memory that contains all the code ffts Gnss_Synchro* gnss_synchro_; - const ConfigurationInterface* configuration_; Acq_Conf_Fpga acq_parameters_; std::string role_; int64_t fs_in_; diff --git a/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.h b/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.h index 6e7403906..e3c43aeea 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.h +++ b/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.h @@ -204,7 +204,6 @@ private: std::weak_ptr channel_fsm_; Gnss_Synchro* gnss_synchro_; - const ConfigurationInterface* configuration_; Acq_Conf_Fpga acq_parameters_; std::string role_; int64_t fs_in_; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.h b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.h index 5cb8728d6..addbdd5ec 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.h +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.h @@ -202,7 +202,6 @@ private: std::weak_ptr channel_fsm_; volk_gnsssdr::vector d_all_fft_codes_; // memory that contains all the code ffts Gnss_Synchro* gnss_synchro_; - const ConfigurationInterface* configuration_; Acq_Conf_Fpga acq_parameters_; std::string role_; int64_t fs_in_; diff --git a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc index 771607f88..30680e011 100644 --- a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc @@ -22,7 +22,6 @@ #include "configuration_interface.h" #include "gnss_sdr_fft.h" #include "gnss_sdr_flags.h" -#include "gnss_synchro.h" #include "gps_l2c_signal_replica.h" #include #include // for gr_complex diff --git a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.h b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.h index 7fb6bbc9f..67f8f621a 100644 --- a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.h +++ b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.h @@ -22,6 +22,7 @@ #include "acq_conf_fpga.h" #include "channel_fsm.h" +#include "gnss_synchro.h" #include "pcps_acquisition_fpga.h" #include // for basic_block_sptr, top_block_sptr #include @@ -35,7 +36,6 @@ * \{ */ -class Gnss_Synchro; class ConfigurationInterface; /*! @@ -164,7 +164,6 @@ private: volk_gnsssdr::vector d_all_fft_codes_; // memory that contains all the code ffts std::weak_ptr channel_fsm_; Gnss_Synchro* gnss_synchro_; - const ConfigurationInterface* configuration_; Acq_Conf_Fpga acq_parameters_; std::string role_; int64_t fs_in_; diff --git a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.h b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.h index 5a700d34f..a2e69c3df 100644 --- a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.h +++ b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.h @@ -204,7 +204,6 @@ private: std::weak_ptr channel_fsm_; volk_gnsssdr::vector d_all_fft_codes_; // memory that contains all the code ffts Gnss_Synchro* gnss_synchro_; - const ConfigurationInterface* configuration_; Acq_Conf_Fpga acq_parameters_; std::string role_; int64_t fs_in_; diff --git a/src/algorithms/acquisition/libs/acq_conf_fpga.cc b/src/algorithms/acquisition/libs/acq_conf_fpga.cc index 93cf6dc28..94d9a321f 100644 --- a/src/algorithms/acquisition/libs/acq_conf_fpga.cc +++ b/src/algorithms/acquisition/libs/acq_conf_fpga.cc @@ -34,7 +34,6 @@ void Acq_Conf_Fpga::SetFromConfiguration(const ConfigurationInterface *configura // downsampling factor uint32_t downsampling_factor = configuration->property(role + ".downsampling_factor", downs_factor); - downsampling_factor = downsampling_factor; fs_in = fs_in / downsampling_factor; // code length in samples From 41c0bce51499403342ea8ad97ef8ffc8c90218f4 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 5 Dec 2022 21:44:39 +0100 Subject: [PATCH 41/59] Apply clang-tidy fix cppcoreguidelines-prefer-member-initializer --- .../galileo_e1_pcps_8ms_ambiguous_acquisition.cc | 8 ++++---- .../galileo_e1_pcps_cccwsr_ambiguous_acquisition.cc | 8 ++++---- .../galileo_e1_pcps_quicksync_ambiguous_acquisition.cc | 8 ++++---- .../galileo_e1_pcps_tong_ambiguous_acquisition.cc | 8 ++++---- .../galileo_e5a_noncoherent_iq_acquisition_caf.cc | 9 +++++---- .../adapters/gps_l1_ca_pcps_acquisition_fine_doppler.cc | 8 ++++---- .../adapters/gps_l1_ca_pcps_assisted_acquisition.cc | 9 +++++---- .../adapters/gps_l1_ca_pcps_quicksync_acquisition.cc | 9 +++++---- .../adapters/gps_l1_ca_pcps_tong_acquisition.cc | 9 +++++---- 9 files changed, 40 insertions(+), 36 deletions(-) diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.cc index a4e884c6f..1e409aa80 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.cc @@ -42,9 +42,11 @@ GalileoE1Pcps8msAmbiguousAcquisition::GalileoE1Pcps8msAmbiguousAcquisition( role_(role), threshold_(0.0), channel_(0), + doppler_max_(configuration_->property(role + ".doppler_max", 5000)), doppler_step_(0), in_streams_(in_streams), - out_streams_(out_streams) + out_streams_(out_streams), + dump_(configuration_->property(role + ".dump", false)) { const std::string default_item_type("gr_complex"); const std::string default_dump_filename("../data/acquisition.dat"); @@ -54,10 +56,8 @@ GalileoE1Pcps8msAmbiguousAcquisition::GalileoE1Pcps8msAmbiguousAcquisition( item_type_ = configuration_->property(role + ".item_type", default_item_type); - int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 4000000); + int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 4000000LL); fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - dump_ = configuration_->property(role + ".dump", false); - doppler_max_ = configuration_->property(role + ".doppler_max", 5000); if (FLAGS_doppler_max != 0) { diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.cc index 747cc57e5..206ad338b 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.cc @@ -34,9 +34,11 @@ GalileoE1PcpsCccwsrAmbiguousAcquisition::GalileoE1PcpsCccwsrAmbiguousAcquisition gnss_synchro_(nullptr), threshold_(0.0), channel_(0), + doppler_max_(configuration_->property(role + ".doppler_max", 5000)), doppler_step_(0), in_streams_(in_streams), - out_streams_(out_streams) + out_streams_(out_streams), + dump_(configuration_->property(role + ".dump", false)) { const std::string default_item_type("gr_complex"); const std::string default_dump_filename("../data/acquisition.dat"); @@ -45,10 +47,8 @@ GalileoE1PcpsCccwsrAmbiguousAcquisition::GalileoE1PcpsCccwsrAmbiguousAcquisition item_type_ = configuration_->property(role + ".item_type", default_item_type); - int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 4000000); + int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 4000000LL); fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - dump_ = configuration_->property(role + ".dump", false); - doppler_max_ = configuration_->property(role + ".doppler_max", 5000); if (FLAGS_doppler_max != 0) { diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.cc index 2ea421377..647f9e1c3 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.cc @@ -42,9 +42,11 @@ GalileoE1PcpsQuickSyncAmbiguousAcquisition::GalileoE1PcpsQuickSyncAmbiguousAcqui gnss_synchro_(nullptr), threshold_(0.0), channel_(0), + doppler_max_(configuration_->property(role + ".doppler_max", 5000)), doppler_step_(0), in_streams_(in_streams), - out_streams_(out_streams) + out_streams_(out_streams), + dump_(configuration_->property(role + ".dump", false)) { const std::string default_item_type("gr_complex"); const std::string default_dump_filename("../data/acquisition.dat"); @@ -54,10 +56,8 @@ GalileoE1PcpsQuickSyncAmbiguousAcquisition::GalileoE1PcpsQuickSyncAmbiguousAcqui item_type_ = configuration_->property(role + ".item_type", default_item_type); - int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 4000000); + int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 4000000LL); fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - dump_ = configuration_->property(role + ".dump", false); - doppler_max_ = configuration_->property(role + ".doppler_max", 5000); if (FLAGS_doppler_max != 0) { diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.cc index 006159c74..6621bb18d 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.cc @@ -42,9 +42,9 @@ GalileoE1PcpsTongAmbiguousAcquisition::GalileoE1PcpsTongAmbiguousAcquisition( role_(role), threshold_(0.0), channel_(0), - doppler_step_(0), + doppler_max_(configuration_->property(role + ".doppler_max", 5000)), doppler_step_(0), in_streams_(in_streams), - out_streams_(out_streams) + out_streams_(out_streams), dump_(configuration_->property(role + ".dump", false)) { const std::string default_item_type("gr_complex"); const std::string default_dump_filename("../data/acquisition.dat"); @@ -56,8 +56,8 @@ GalileoE1PcpsTongAmbiguousAcquisition::GalileoE1PcpsTongAmbiguousAcquisition( int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 4000000); fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - dump_ = configuration_->property(role + ".dump", false); - doppler_max_ = configuration_->property(role + ".doppler_max", 5000); + + if (FLAGS_doppler_max != 0) { doppler_max_ = FLAGS_doppler_max; diff --git a/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.cc b/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.cc index 2873c43c6..9baa1ac76 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.cc +++ b/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.cc @@ -48,9 +48,11 @@ GalileoE5aNoncoherentIQAcquisitionCaf::GalileoE5aNoncoherentIQAcquisitionCaf( gnss_synchro_(nullptr), threshold_(0.0), channel_(0), + doppler_max_(configuration_->property(role + ".doppler_max", 5000)), doppler_step_(0), in_streams_(in_streams), - out_streams_(out_streams) + out_streams_(out_streams), + dump_(configuration_->property(role + ".dump", false)) { const std::string default_item_type("gr_complex"); const std::string default_dump_filename("../data/acquisition.dat"); @@ -59,10 +61,9 @@ GalileoE5aNoncoherentIQAcquisitionCaf::GalileoE5aNoncoherentIQAcquisitionCaf( item_type_ = configuration_->property(role + ".item_type", default_item_type); - int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 32000000); + int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 32000000LL); fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - dump_ = configuration_->property(role + ".dump", false); - doppler_max_ = configuration_->property(role + ".doppler_max", 5000); + if (FLAGS_doppler_max != 0) { doppler_max_ = FLAGS_doppler_max; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fine_doppler.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fine_doppler.cc index 01fdbb1b8..efa367446 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fine_doppler.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fine_doppler.cc @@ -32,8 +32,10 @@ GpsL1CaPcpsAcquisitionFineDoppler::GpsL1CaPcpsAcquisitionFineDoppler( const std::string& role, unsigned int in_streams, unsigned int out_streams) : role_(role), + doppler_max_(configuration->property(role + ".doppler_max", 5000)), in_streams_(in_streams), - out_streams_(out_streams) + out_streams_(out_streams), + dump_(configuration->property(role + ".dump", false)) { const std::string default_item_type("gr_complex"); std::string default_dump_filename = "./acquisition.mat"; @@ -42,15 +44,13 @@ GpsL1CaPcpsAcquisitionFineDoppler::GpsL1CaPcpsAcquisitionFineDoppler( Acq_Conf acq_parameters = Acq_Conf(); item_type_ = configuration->property(role + ".item_type", default_item_type); - int64_t fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); + int64_t fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000LL); fs_in_ = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); acq_parameters.fs_in = fs_in_; acq_parameters.samples_per_chip = static_cast(ceil(GPS_L1_CA_CHIP_PERIOD_S * static_cast(acq_parameters.fs_in))); - dump_ = configuration->property(role + ".dump", false); acq_parameters.dump = dump_; dump_filename_ = configuration->property(role + ".dump_filename", default_dump_filename); acq_parameters.dump_filename = dump_filename_; - doppler_max_ = configuration->property(role + ".doppler_max", 5000); if (FLAGS_doppler_max != 0) { doppler_max_ = FLAGS_doppler_max; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.cc index da6b57597..5d6e7664d 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.cc @@ -31,8 +31,10 @@ GpsL1CaPcpsAssistedAcquisition::GpsL1CaPcpsAssistedAcquisition( const std::string& role, unsigned int in_streams, unsigned int out_streams) : role_(role), + doppler_max_(configuration->property(role + ".doppler_max", 5000)), in_streams_(in_streams), - out_streams_(out_streams) + out_streams_(out_streams), + dump_(configuration->property(role + ".dump", false)) { const std::string default_item_type("gr_complex"); std::string default_dump_filename = "./data/acquisition.dat"; @@ -40,10 +42,9 @@ GpsL1CaPcpsAssistedAcquisition::GpsL1CaPcpsAssistedAcquisition( DLOG(INFO) << "role " << role; item_type_ = configuration->property(role + ".item_type", default_item_type); - int64_t fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); + int64_t fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000LL); fs_in_ = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - dump_ = configuration->property(role + ".dump", false); - doppler_max_ = configuration->property(role + ".doppler_max", 5000); + if (FLAGS_doppler_max != 0) { doppler_max_ = FLAGS_doppler_max; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_quicksync_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_quicksync_acquisition.cc index 56f544d86..5ed2be823 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_quicksync_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_quicksync_acquisition.cc @@ -43,9 +43,11 @@ GpsL1CaPcpsQuickSyncAcquisition::GpsL1CaPcpsQuickSyncAcquisition( gnss_synchro_(nullptr), threshold_(0.0), channel_(0), + doppler_max_(configuration->property(role + ".doppler_max", 5000)), doppler_step_(0), in_streams_(in_streams), - out_streams_(out_streams) + out_streams_(out_streams), + dump_(configuration_->property(role + ".dump", false)) { const std::string default_item_type("gr_complex"); std::string default_dump_filename = "./data/acquisition.dat"; @@ -53,10 +55,9 @@ GpsL1CaPcpsQuickSyncAcquisition::GpsL1CaPcpsQuickSyncAcquisition( DLOG(INFO) << "role " << role; item_type_ = configuration_->property(role + ".item_type", default_item_type); - int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000); + int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000LL); fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - dump_ = configuration_->property(role + ".dump", false); - doppler_max_ = configuration->property(role + ".doppler_max", 5000); + if (FLAGS_doppler_max != 0) { doppler_max_ = FLAGS_doppler_max; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.cc index d7b71ef97..2243760c5 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.cc @@ -42,9 +42,11 @@ GpsL1CaPcpsTongAcquisition::GpsL1CaPcpsTongAcquisition( role_(role), threshold_(0.0), channel_(0), + doppler_max_(configuration->property(role + ".doppler_max", 5000)), doppler_step_(0), in_streams_(in_streams), - out_streams_(out_streams) + out_streams_(out_streams), + dump_(configuration_->property(role + ".dump", false)) { const std::string default_item_type("gr_complex"); std::string default_dump_filename = "./data/acquisition.dat"; @@ -53,10 +55,9 @@ GpsL1CaPcpsTongAcquisition::GpsL1CaPcpsTongAcquisition( item_type_ = configuration_->property(role + ".item_type", default_item_type); - int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000); + int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000LL); fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - dump_ = configuration_->property(role + ".dump", false); - doppler_max_ = configuration->property(role + ".doppler_max", 5000); + if (FLAGS_doppler_max != 0) { doppler_max_ = FLAGS_doppler_max; From 6b614958ca6ffd109ba733654cf9de1d20cbe109 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 5 Dec 2022 21:51:55 +0100 Subject: [PATCH 42/59] Fix formatting --- .../galileo_e1_pcps_tong_ambiguous_acquisition.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.cc index 6621bb18d..de020762e 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.cc @@ -42,9 +42,11 @@ GalileoE1PcpsTongAmbiguousAcquisition::GalileoE1PcpsTongAmbiguousAcquisition( role_(role), threshold_(0.0), channel_(0), - doppler_max_(configuration_->property(role + ".doppler_max", 5000)), doppler_step_(0), + doppler_max_(configuration_->property(role + ".doppler_max", 5000)), + doppler_step_(0), in_streams_(in_streams), - out_streams_(out_streams), dump_(configuration_->property(role + ".dump", false)) + out_streams_(out_streams), + dump_(configuration_->property(role + ".dump", false)) { const std::string default_item_type("gr_complex"); const std::string default_dump_filename("../data/acquisition.dat"); @@ -54,10 +56,9 @@ GalileoE1PcpsTongAmbiguousAcquisition::GalileoE1PcpsTongAmbiguousAcquisition( item_type_ = configuration_->property(role + ".item_type", default_item_type); - int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 4000000); + int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 4000000LL); fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - - + if (FLAGS_doppler_max != 0) { doppler_max_ = FLAGS_doppler_max; From dde0667c6b12a9d7ca4cd3aa0ddb11d36e0db523 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 5 Dec 2022 22:37:49 +0100 Subject: [PATCH 43/59] Fix building --- .../galileo_e1_pcps_8ms_ambiguous_acquisition.cc | 2 +- ...lileo_e1_pcps_cccwsr_ambiguous_acquisition.cc | 2 +- ...eo_e1_pcps_quicksync_ambiguous_acquisition.cc | 2 +- ...galileo_e1_pcps_tong_ambiguous_acquisition.cc | 2 +- .../data_type_adapter/adapters/byte_to_short.cc | 14 ++++++++------ .../data_type_adapter/adapters/ibyte_to_cbyte.cc | 16 +++++++++------- .../adapters/ibyte_to_complex.cc | 13 +++++++------ .../adapters/ibyte_to_cshort.cc | 16 +++++++++------- .../adapters/ishort_to_complex.cc | 16 +++++++++------- .../adapters/ishort_to_cshort.cc | 16 +++++++++------- .../input_filter/adapters/beamformer_filter.cc | 4 ++-- .../input_filter/adapters/notch_filter.cc | 4 ++-- .../input_filter/adapters/notch_filter_lite.cc | 5 ++--- .../adapters/signal_generator.cc | 6 ++++-- 14 files changed, 65 insertions(+), 53 deletions(-) diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.cc index 1e409aa80..08884bdbc 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.cc @@ -56,7 +56,7 @@ GalileoE1Pcps8msAmbiguousAcquisition::GalileoE1Pcps8msAmbiguousAcquisition( item_type_ = configuration_->property(role + ".item_type", default_item_type); - int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 4000000LL); + int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 4000000); fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); if (FLAGS_doppler_max != 0) diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.cc index 206ad338b..0f58f5d90 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.cc @@ -47,7 +47,7 @@ GalileoE1PcpsCccwsrAmbiguousAcquisition::GalileoE1PcpsCccwsrAmbiguousAcquisition item_type_ = configuration_->property(role + ".item_type", default_item_type); - int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 4000000LL); + int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 4000000); fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); if (FLAGS_doppler_max != 0) diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.cc index 647f9e1c3..7c0da8f0a 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.cc @@ -56,7 +56,7 @@ GalileoE1PcpsQuickSyncAmbiguousAcquisition::GalileoE1PcpsQuickSyncAmbiguousAcqui item_type_ = configuration_->property(role + ".item_type", default_item_type); - int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 4000000LL); + int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 4000000); fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); if (FLAGS_doppler_max != 0) diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.cc index de020762e..79b2433d6 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.cc @@ -56,7 +56,7 @@ GalileoE1PcpsTongAmbiguousAcquisition::GalileoE1PcpsTongAmbiguousAcquisition( item_type_ = configuration_->property(role + ".item_type", default_item_type); - int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 4000000LL); + int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 4000000); fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); if (FLAGS_doppler_max != 0) diff --git a/src/algorithms/data_type_adapter/adapters/byte_to_short.cc b/src/algorithms/data_type_adapter/adapters/byte_to_short.cc index 6e1f6cde6..7bb206bc3 100644 --- a/src/algorithms/data_type_adapter/adapters/byte_to_short.cc +++ b/src/algorithms/data_type_adapter/adapters/byte_to_short.cc @@ -20,8 +20,13 @@ #include -ByteToShort::ByteToShort(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) +ByteToShort::ByteToShort(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), + dump_(configuration->property(role + ".dump", false)) { const std::string default_input_item_type("byte"); const std::string default_output_item_type("short"); @@ -30,12 +35,8 @@ ByteToShort::ByteToShort(const ConfigurationInterface* configuration, std::strin DLOG(INFO) << "role " << role_; input_item_type_ = configuration->property(role_ + ".input_item_type", default_input_item_type); - - dump_ = configuration->property(role_ + ".dump", false); dump_filename_ = configuration->property(role_ + ".dump_filename", default_dump_filename); - const size_t item_size = sizeof(int16_t); - gr_char_to_short_ = gr::blocks::char_to_short::make(); DLOG(INFO) << "data_type_adapter_(" << gr_char_to_short_->unique_id() << ")"; @@ -43,6 +44,7 @@ ByteToShort::ByteToShort(const ConfigurationInterface* configuration, std::strin if (dump_) { DLOG(INFO) << "Dumping output into file " << dump_filename_; + const size_t item_size = sizeof(int16_t); file_sink_ = gr::blocks::file_sink::make(item_size, dump_filename_.c_str()); } if (in_streams_ > 1) diff --git a/src/algorithms/data_type_adapter/adapters/ibyte_to_cbyte.cc b/src/algorithms/data_type_adapter/adapters/ibyte_to_cbyte.cc index 703a95e8b..dc825015d 100644 --- a/src/algorithms/data_type_adapter/adapters/ibyte_to_cbyte.cc +++ b/src/algorithms/data_type_adapter/adapters/ibyte_to_cbyte.cc @@ -21,8 +21,14 @@ #include -IbyteToCbyte::IbyteToCbyte(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) +IbyteToCbyte::IbyteToCbyte(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), + inverted_spectrum(configuration->property(role + ".inverted_spectrum", false)), + dump_(configuration->property(role + ".dump", false)) { const std::string default_input_item_type("byte"); const std::string default_output_item_type("lv_8sc_t"); @@ -31,12 +37,7 @@ IbyteToCbyte::IbyteToCbyte(const ConfigurationInterface* configuration, const st DLOG(INFO) << "role " << role_; input_item_type_ = configuration->property(role_ + ".input_item_type", default_input_item_type); - - dump_ = configuration->property(role_ + ".dump", false); dump_filename_ = configuration->property(role_ + ".dump_filename", default_dump_filename); - inverted_spectrum = configuration->property(role + ".inverted_spectrum", false); - - const size_t item_size = sizeof(lv_8sc_t); ibyte_to_cbyte_ = make_interleaved_byte_to_complex_byte(); @@ -45,6 +46,7 @@ IbyteToCbyte::IbyteToCbyte(const ConfigurationInterface* configuration, const st if (dump_) { DLOG(INFO) << "Dumping output into file " << dump_filename_; + const size_t item_size = sizeof(lv_8sc_t); file_sink_ = gr::blocks::file_sink::make(item_size, dump_filename_.c_str()); } if (inverted_spectrum) diff --git a/src/algorithms/data_type_adapter/adapters/ibyte_to_complex.cc b/src/algorithms/data_type_adapter/adapters/ibyte_to_complex.cc index af511b2d1..13be7798c 100644 --- a/src/algorithms/data_type_adapter/adapters/ibyte_to_complex.cc +++ b/src/algorithms/data_type_adapter/adapters/ibyte_to_complex.cc @@ -20,7 +20,12 @@ IbyteToComplex::IbyteToComplex(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) + unsigned int in_streams, + unsigned int out_streams) : role_(role), + in_streams_(in_streams), + out_streams_(out_streams), + inverted_spectrum(configuration->property(role + ".inverted_spectrum", false)), + dump_(configuration->property(role + ".dump", false)) { const std::string default_input_item_type("byte"); const std::string default_output_item_type("gr_complex"); @@ -29,12 +34,7 @@ IbyteToComplex::IbyteToComplex(const ConfigurationInterface* configuration, cons DLOG(INFO) << "role " << role_; input_item_type_ = configuration->property(role_ + ".input_item_type", default_input_item_type); - - dump_ = configuration->property(role_ + ".dump", false); dump_filename_ = configuration->property(role_ + ".dump_filename", default_dump_filename); - inverted_spectrum = configuration->property(role + ".inverted_spectrum", false); - - const size_t item_size = sizeof(gr_complex); gr_interleaved_char_to_complex_ = gr::blocks::interleaved_char_to_complex::make(); @@ -47,6 +47,7 @@ IbyteToComplex::IbyteToComplex(const ConfigurationInterface* configuration, cons if (dump_) { DLOG(INFO) << "Dumping output into file " << dump_filename_; + const size_t item_size = sizeof(gr_complex); file_sink_ = gr::blocks::file_sink::make(item_size, dump_filename_.c_str()); } if (in_streams_ > 1) diff --git a/src/algorithms/data_type_adapter/adapters/ibyte_to_cshort.cc b/src/algorithms/data_type_adapter/adapters/ibyte_to_cshort.cc index 9ff7652ac..a146ef474 100644 --- a/src/algorithms/data_type_adapter/adapters/ibyte_to_cshort.cc +++ b/src/algorithms/data_type_adapter/adapters/ibyte_to_cshort.cc @@ -21,8 +21,14 @@ #include -IbyteToCshort::IbyteToCshort(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) +IbyteToCshort::IbyteToCshort(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), + inverted_spectrum(configuration->property(role + ".inverted_spectrum", false)), + dump_(configuration->property(role + ".dump", false)) { const std::string default_input_item_type("byte"); const std::string default_output_item_type("cshort"); @@ -31,12 +37,7 @@ IbyteToCshort::IbyteToCshort(const ConfigurationInterface* configuration, const DLOG(INFO) << "role " << role_; input_item_type_ = configuration->property(role_ + ".input_item_type", default_input_item_type); - - dump_ = configuration->property(role_ + ".dump", false); dump_filename_ = configuration->property(role_ + ".dump_filename", default_dump_filename); - inverted_spectrum = configuration->property(role + ".inverted_spectrum", false); - - const size_t item_size = sizeof(lv_16sc_t); interleaved_byte_to_complex_short_ = make_interleaved_byte_to_complex_short(); @@ -45,6 +46,7 @@ IbyteToCshort::IbyteToCshort(const ConfigurationInterface* configuration, const if (dump_) { DLOG(INFO) << "Dumping output into file " << dump_filename_; + const size_t item_size = sizeof(lv_16sc_t); file_sink_ = gr::blocks::file_sink::make(item_size, dump_filename_.c_str()); } if (inverted_spectrum) diff --git a/src/algorithms/data_type_adapter/adapters/ishort_to_complex.cc b/src/algorithms/data_type_adapter/adapters/ishort_to_complex.cc index 19c619216..0e67db072 100644 --- a/src/algorithms/data_type_adapter/adapters/ishort_to_complex.cc +++ b/src/algorithms/data_type_adapter/adapters/ishort_to_complex.cc @@ -19,8 +19,14 @@ #include -IshortToComplex::IshortToComplex(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) +IshortToComplex::IshortToComplex(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), + inverted_spectrum(configuration->property(role + ".inverted_spectrum", false)), + dump_(configuration->property(role + ".dump", false)) { const std::string default_input_item_type("short"); const std::string default_output_item_type("gr_complex"); @@ -29,12 +35,7 @@ IshortToComplex::IshortToComplex(const ConfigurationInterface* configuration, co DLOG(INFO) << "role " << role_; input_item_type_ = configuration->property(role_ + ".input_item_type", default_input_item_type); - - dump_ = configuration->property(role_ + ".dump", false); dump_filename_ = configuration->property(role_ + ".dump_filename", default_dump_filename); - inverted_spectrum = configuration->property(role + ".inverted_spectrum", false); - - const size_t item_size = sizeof(gr_complex); gr_interleaved_short_to_complex_ = gr::blocks::interleaved_short_to_complex::make(); @@ -47,6 +48,7 @@ IshortToComplex::IshortToComplex(const ConfigurationInterface* configuration, co if (dump_) { DLOG(INFO) << "Dumping output into file " << dump_filename_; + const size_t item_size = sizeof(gr_complex); file_sink_ = gr::blocks::file_sink::make(item_size, dump_filename_.c_str()); } if (in_streams_ > 1) diff --git a/src/algorithms/data_type_adapter/adapters/ishort_to_cshort.cc b/src/algorithms/data_type_adapter/adapters/ishort_to_cshort.cc index 09e15616e..b51232869 100644 --- a/src/algorithms/data_type_adapter/adapters/ishort_to_cshort.cc +++ b/src/algorithms/data_type_adapter/adapters/ishort_to_cshort.cc @@ -21,8 +21,14 @@ #include -IshortToCshort::IshortToCshort(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) +IshortToCshort::IshortToCshort(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), + inverted_spectrum(configuration->property(role + ".inverted_spectrum", false)), + dump_(configuration->property(role + ".dump", false)) { const std::string default_input_item_type("short"); const std::string default_output_item_type("cshort"); @@ -31,12 +37,7 @@ IshortToCshort::IshortToCshort(const ConfigurationInterface* configuration, cons DLOG(INFO) << "role " << role_; input_item_type_ = configuration->property(role_ + ".input_item_type", default_input_item_type); - - dump_ = configuration->property(role_ + ".dump", false); dump_filename_ = configuration->property(role_ + ".dump_filename", default_dump_filename); - inverted_spectrum = configuration->property(role + ".inverted_spectrum", false); - - const size_t item_size = sizeof(lv_16sc_t); interleaved_short_to_complex_short_ = make_interleaved_short_to_complex_short(); @@ -45,6 +46,7 @@ IshortToCshort::IshortToCshort(const ConfigurationInterface* configuration, cons if (dump_) { DLOG(INFO) << "Dumping output into file " << dump_filename_; + const size_t item_size = sizeof(lv_16sc_t); file_sink_ = gr::blocks::file_sink::make(item_size, dump_filename_.c_str()); } if (inverted_spectrum) diff --git a/src/algorithms/input_filter/adapters/beamformer_filter.cc b/src/algorithms/input_filter/adapters/beamformer_filter.cc index d410251b2..4a96bf85b 100644 --- a/src/algorithms/input_filter/adapters/beamformer_filter.cc +++ b/src/algorithms/input_filter/adapters/beamformer_filter.cc @@ -26,12 +26,12 @@ BeamformerFilter::BeamformerFilter( unsigned int in_stream, unsigned int out_stream) : role_(role), in_stream_(in_stream), - out_stream_(out_stream) + out_stream_(out_stream), + dump_(configuration->property(role + ".dump", false)) { 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); dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file); DLOG(INFO) << "role " << role_; if (item_type_ == "gr_complex") diff --git a/src/algorithms/input_filter/adapters/notch_filter.cc b/src/algorithms/input_filter/adapters/notch_filter.cc index 0f4c1ca82..1ca31c5f3 100644 --- a/src/algorithms/input_filter/adapters/notch_filter.cc +++ b/src/algorithms/input_filter/adapters/notch_filter.cc @@ -28,7 +28,8 @@ NotchFilter::NotchFilter(const ConfigurationInterface* configuration, unsigned int out_streams) : role_(role), in_streams_(in_streams), - out_streams_(out_streams) + out_streams_(out_streams), + dump_(configuration->property(role + ".dump", false)) { const std::string default_item_type("gr_complex"); const std::string default_dump_file("./data/input_filter.dat"); @@ -46,7 +47,6 @@ NotchFilter::NotchFilter(const ConfigurationInterface* configuration, 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") diff --git a/src/algorithms/input_filter/adapters/notch_filter_lite.cc b/src/algorithms/input_filter/adapters/notch_filter_lite.cc index 470a6881e..8dc161688 100644 --- a/src/algorithms/input_filter/adapters/notch_filter_lite.cc +++ b/src/algorithms/input_filter/adapters/notch_filter_lite.cc @@ -29,7 +29,8 @@ NotchFilterLite::NotchFilterLite(const ConfigurationInterface* configuration, unsigned int out_streams) : role_(role), in_streams_(in_streams), - out_streams_(out_streams) + out_streams_(out_streams), + dump_(configuration->property(role + ".dump", false)) { const std::string default_item_type("gr_complex"); const std::string default_dump_file("./data/input_filter.dat"); @@ -39,7 +40,6 @@ NotchFilterLite::NotchFilterLite(const ConfigurationInterface* configuration, 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; const float p_c_factor = configuration->property(role + ".p_c_factor", default_p_c_factor); @@ -51,7 +51,6 @@ NotchFilterLite::NotchFilterLite(const ConfigurationInterface* configuration, 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((samp_freq / coeff_rate) / static_cast(length_)); n_segments_coeff = std::max(1, n_segments_coeff); diff --git a/src/algorithms/signal_generator/adapters/signal_generator.cc b/src/algorithms/signal_generator/adapters/signal_generator.cc index d47db1b17..841cbfe3f 100644 --- a/src/algorithms/signal_generator/adapters/signal_generator.cc +++ b/src/algorithms/signal_generator/adapters/signal_generator.cc @@ -33,7 +33,10 @@ SignalGenerator::SignalGenerator(const ConfigurationInterface* configuration, const std::string& role, unsigned int in_stream, unsigned int out_stream, - Concurrent_Queue* queue __attribute__((unused))) : role_(role), in_stream_(in_stream), out_stream_(out_stream) + Concurrent_Queue* queue __attribute__((unused))) : role_(role), + in_stream_(in_stream), + out_stream_(out_stream), + dump_(configuration->property(role + ".dump", false)) { const std::string default_item_type("gr_complex"); const std::string default_dump_file("./data/gen_source.dat"); @@ -41,7 +44,6 @@ SignalGenerator::SignalGenerator(const ConfigurationInterface* configuration, const std::string default_signal("1C"); 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_file); const unsigned int fs_in = configuration->property("SignalSource.fs_hz", static_cast(4e6)); From 82f1d8b991427e19b5557a5d9bc75b5e3e47570a Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 5 Dec 2022 22:50:01 +0100 Subject: [PATCH 44/59] Fix building --- .../galileo_e5a_noncoherent_iq_acquisition_caf.cc | 2 +- .../adapters/custom_udp_signal_source.cc | 15 ++++++++------- .../adapters/custom_udp_signal_source.h | 3 +-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.cc b/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.cc index 9baa1ac76..4bf6d2080 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.cc +++ b/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.cc @@ -61,7 +61,7 @@ GalileoE5aNoncoherentIQAcquisitionCaf::GalileoE5aNoncoherentIQAcquisitionCaf( item_type_ = configuration_->property(role + ".item_type", default_item_type); - int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 32000000LL); + int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 32000000); fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); if (FLAGS_doppler_max != 0) diff --git a/src/algorithms/signal_source/adapters/custom_udp_signal_source.cc b/src/algorithms/signal_source/adapters/custom_udp_signal_source.cc index 2e0b240a5..85299cc27 100644 --- a/src/algorithms/signal_source/adapters/custom_udp_signal_source.cc +++ b/src/algorithms/signal_source/adapters/custom_udp_signal_source.cc @@ -25,17 +25,22 @@ using namespace std::string_literals; CustomUDPSignalSource::CustomUDPSignalSource(const ConfigurationInterface* configuration, - const std::string& role, unsigned int in_stream, unsigned int out_stream, + const std::string& role, + unsigned int in_stream, + unsigned int out_stream, Concurrent_Queue* queue __attribute__((unused))) : SignalSourceBase(configuration, role, "Custom_UDP_Signal_Source"s), item_size_(sizeof(gr_complex)), + RF_channels_(configuration->property(role + ".RF_channels", 1)), + channels_in_udp_(configuration->property(role + ".channels_in_udp", 1)), in_stream_(in_stream), - out_stream_(out_stream) + out_stream_(out_stream), + IQ_swap_(configuration->property(role + ".IQ_swap", false)), + dump_(configuration->property(role + ".dump", false)) { // DUMP PARAMETERS const std::string default_dump_file("./data/signal_source.dat"); const std::string default_item_type("gr_complex"); - dump_ = configuration->property(role + ".dump", false); dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file); // network PARAMETERS @@ -47,10 +52,6 @@ CustomUDPSignalSource::CustomUDPSignalSource(const ConfigurationInterface* confi int port = configuration->property(role + ".port", default_port); int payload_bytes = configuration->property(role + ".payload_bytes", 1024); - RF_channels_ = configuration->property(role + ".RF_channels", 1); - channels_in_udp_ = configuration->property(role + ".channels_in_udp", 1); - IQ_swap_ = configuration->property(role + ".IQ_swap", false); - const std::string default_sample_type("cbyte"); const std::string sample_type = configuration->property(role + ".sample_type", default_sample_type); item_type_ = configuration->property(role + ".item_type", default_item_type); diff --git a/src/algorithms/signal_source/adapters/custom_udp_signal_source.h b/src/algorithms/signal_source/adapters/custom_udp_signal_source.h index 3dfc35ebd..2d04d15b7 100644 --- a/src/algorithms/signal_source/adapters/custom_udp_signal_source.h +++ b/src/algorithms/signal_source/adapters/custom_udp_signal_source.h @@ -74,9 +74,8 @@ private: int channels_in_udp_; unsigned int in_stream_; unsigned int out_stream_; - - bool dump_; bool IQ_swap_; + bool dump_; }; From 1aeaddaeab52da0cf1338fdd780c6f21b7ebcc1b Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 5 Dec 2022 23:03:16 +0100 Subject: [PATCH 45/59] Fix building --- ...gps_l1_ca_pcps_acquisition_fine_doppler.cc | 2 +- .../gps_l1_ca_pcps_assisted_acquisition.cc | 2 +- .../adapters/labsat_signal_source.cc | 14 ++++++---- .../spir_gss6450_file_signal_source.cc | 26 ++++++++++--------- 4 files changed, 25 insertions(+), 19 deletions(-) diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fine_doppler.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fine_doppler.cc index efa367446..c96e41c1c 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fine_doppler.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fine_doppler.cc @@ -44,7 +44,7 @@ GpsL1CaPcpsAcquisitionFineDoppler::GpsL1CaPcpsAcquisitionFineDoppler( Acq_Conf acq_parameters = Acq_Conf(); item_type_ = configuration->property(role + ".item_type", default_item_type); - int64_t fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000LL); + int64_t fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); fs_in_ = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); acq_parameters.fs_in = fs_in_; acq_parameters.samples_per_chip = static_cast(ceil(GPS_L1_CA_CHIP_PERIOD_S * static_cast(acq_parameters.fs_in))); diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.cc index 5d6e7664d..a9175fcb8 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.cc @@ -42,7 +42,7 @@ GpsL1CaPcpsAssistedAcquisition::GpsL1CaPcpsAssistedAcquisition( DLOG(INFO) << "role " << role; item_type_ = configuration->property(role + ".item_type", default_item_type); - int64_t fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000LL); + int64_t fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); fs_in_ = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); if (FLAGS_doppler_max != 0) diff --git a/src/algorithms/signal_source/adapters/labsat_signal_source.cc b/src/algorithms/signal_source/adapters/labsat_signal_source.cc index 66f2b435f..30760ce97 100644 --- a/src/algorithms/signal_source/adapters/labsat_signal_source.cc +++ b/src/algorithms/signal_source/adapters/labsat_signal_source.cc @@ -25,17 +25,21 @@ using namespace std::string_literals; LabsatSignalSource::LabsatSignalSource(const ConfigurationInterface* configuration, - const std::string& role, unsigned int in_stream, unsigned int out_stream, Concurrent_Queue* queue) - : SignalSourceBase(configuration, role, "Labsat_Signal_Source"s), in_stream_(in_stream), out_stream_(out_stream) + const std::string& role, + unsigned int in_stream, + unsigned int out_stream, + Concurrent_Queue* queue) + : SignalSourceBase(configuration, role, "Labsat_Signal_Source"s), + in_stream_(in_stream), + out_stream_(out_stream), + enable_throttle_control_(configuration->property(role + ".enable_throttle_control", false)), + dump_(configuration->property(role + ".dump", false)) { const std::string default_item_type("gr_complex"); const std::string default_dump_file("./labsat_output.dat"); 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_file); - enable_throttle_control_ = configuration->property(role + ".enable_throttle_control", false); - const int64_t sampling_frequency_deprecated = configuration->property(role + ".sampling_frequency", static_cast(16368000)); const int64_t throttle_frequency_sps = configuration->property(role + ".throttle_frequency_sps", static_cast(sampling_frequency_deprecated)); diff --git a/src/algorithms/signal_source/adapters/spir_gss6450_file_signal_source.cc b/src/algorithms/signal_source/adapters/spir_gss6450_file_signal_source.cc index 7b4da0e88..dead525be 100644 --- a/src/algorithms/signal_source/adapters/spir_gss6450_file_signal_source.cc +++ b/src/algorithms/signal_source/adapters/spir_gss6450_file_signal_source.cc @@ -29,27 +29,29 @@ using namespace std::string_literals; SpirGSS6450FileSignalSource::SpirGSS6450FileSignalSource(const ConfigurationInterface* configuration, - const std::string& role, uint32_t in_streams, uint32_t out_streams, Concurrent_Queue* queue) + const std::string& role, + uint32_t in_streams, + uint32_t out_streams, + Concurrent_Queue* queue) : SignalSourceBase(configuration, role, "Spir_GSS6450_File_Signal_Source"s), item_type_("int"), + samples_(configuration->property(role + ".samples", static_cast(0))), + sampling_frequency_(configuration->property(role + ".sampling_frequency", static_cast(0))), item_size_(sizeof(int32_t)), in_streams_(in_streams), - out_streams_(out_streams) + out_streams_(out_streams), + adc_bits_(configuration->property(role + ".adc_bits", 4)), + n_channels_(configuration->property(role + ".total_channels", 1)), + sel_ch_(configuration->property(role + ".sel_ch", 1)), + repeat_(configuration->property(role + ".repeat", false)), + dump_(configuration->property(role + ".dump", false)), + enable_throttle_control_(configuration->property(role + ".enable_throttle_control", false)), + endian_swap_(configuration->property(role + ".endian", false)) { const std::string default_filename("../data/my_capture.dat"); const std::string default_dump_filename("../data/my_capture_dump.dat"); - - samples_ = configuration->property(role + ".samples", static_cast(0)); - sampling_frequency_ = configuration->property(role + ".sampling_frequency", static_cast(0)); filename_ = configuration->property(role + ".filename", default_filename); - repeat_ = configuration->property(role + ".repeat", false); - dump_ = configuration->property(role + ".dump", false); - endian_swap_ = configuration->property(role + ".endian", false); dump_filename_ = configuration->property(role + ".dump_filename", default_dump_filename); - enable_throttle_control_ = configuration->property(role + ".enable_throttle_control", false); - adc_bits_ = configuration->property(role + ".adc_bits", 4); - n_channels_ = configuration->property(role + ".total_channels", 1); - sel_ch_ = configuration->property(role + ".sel_ch", 1); const int64_t bytes_seek = configuration->property(role + ".bytes_to_skip", static_cast(65536)); const double sample_size_byte = static_cast(adc_bits_) / 4.0; From 31b7a01c51b53535c6062fae43f370f120b0d25a Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 5 Dec 2022 23:18:33 +0100 Subject: [PATCH 46/59] Fix building --- .../gps_l1_ca_pcps_quicksync_acquisition.cc | 2 +- .../gps_l1_ca_pcps_tong_acquisition.cc | 2 +- .../adapters/rtl_tcp_signal_source.cc | 25 ++++++++++--------- .../adapters/rtl_tcp_signal_source.h | 2 +- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_quicksync_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_quicksync_acquisition.cc index 5ed2be823..a65d5b5ec 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_quicksync_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_quicksync_acquisition.cc @@ -55,7 +55,7 @@ GpsL1CaPcpsQuickSyncAcquisition::GpsL1CaPcpsQuickSyncAcquisition( DLOG(INFO) << "role " << role; item_type_ = configuration_->property(role + ".item_type", default_item_type); - int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000LL); + int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000); fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); if (FLAGS_doppler_max != 0) diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.cc index 2243760c5..db90a4a94 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.cc @@ -55,7 +55,7 @@ GpsL1CaPcpsTongAcquisition::GpsL1CaPcpsTongAcquisition( item_type_ = configuration_->property(role + ".item_type", default_item_type); - int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000LL); + int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000); fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); if (FLAGS_doppler_max != 0) diff --git a/src/algorithms/signal_source/adapters/rtl_tcp_signal_source.cc b/src/algorithms/signal_source/adapters/rtl_tcp_signal_source.cc index 0c80eaaf7..86da2608d 100644 --- a/src/algorithms/signal_source/adapters/rtl_tcp_signal_source.cc +++ b/src/algorithms/signal_source/adapters/rtl_tcp_signal_source.cc @@ -34,29 +34,30 @@ RtlTcpSignalSource::RtlTcpSignalSource(const ConfigurationInterface* configurati unsigned int in_stream, unsigned int out_stream, Concurrent_Queue* queue) - : SignalSourceBase(configuration, role, "RtlTcp_Signal_Source"s), in_stream_(in_stream), out_stream_(out_stream) + : SignalSourceBase(configuration, role, "RtlTcp_Signal_Source"s), + samples_(configuration->property(role + ".samples", static_cast(0))), + rf_gain_(configuration->property(role + ".rf_gain", 40.0)), + sample_rate_(configuration->property(role + ".sampling_frequency", 2000000)), + freq_(configuration->property(role + ".freq", static_cast(GPS_L1_FREQ_HZ))), + gain_(configuration->property(role + ".gain", 40)), + if_gain_(configuration->property(role + ".if_gain", 40)), + in_stream_(in_stream), + out_stream_(out_stream), + AGC_enabled_(configuration->property(role + ".AGC_enabled", true)), + flip_iq_(configuration->property(role + ".flip_iq", false)), + dump_(configuration->property(role + ".dump", false)) { // DUMP PARAMETERS const std::string default_dump_file("./data/signal_source.dat"); const std::string default_item_type("gr_complex"); - samples_ = configuration->property(role + ".samples", static_cast(0)); - dump_ = configuration->property(role + ".dump", false); - dump_filename_ = configuration->property(role + ".dump_filename", - default_dump_file); + dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file); // rtl_tcp PARAMETERS const std::string default_address("127.0.0.1"); const int16_t default_port = 1234; - AGC_enabled_ = configuration->property(role + ".AGC_enabled", true); - freq_ = configuration->property(role + ".freq", static_cast(GPS_L1_FREQ_HZ)); - gain_ = configuration->property(role + ".gain", 40); - rf_gain_ = configuration->property(role + ".rf_gain", 40.0); - if_gain_ = configuration->property(role + ".if_gain", 40); - sample_rate_ = configuration->property(role + ".sampling_frequency", 2000000); item_type_ = configuration->property(role + ".item_type", default_item_type); address_ = configuration->property(role + ".address", default_address); port_ = configuration->property(role + ".port", default_port); - flip_iq_ = configuration->property(role + ".flip_iq", false); if (item_type_ == "short") { diff --git a/src/algorithms/signal_source/adapters/rtl_tcp_signal_source.h b/src/algorithms/signal_source/adapters/rtl_tcp_signal_source.h index 6f88765e3..dbfeb9d53 100644 --- a/src/algorithms/signal_source/adapters/rtl_tcp_signal_source.h +++ b/src/algorithms/signal_source/adapters/rtl_tcp_signal_source.h @@ -78,11 +78,11 @@ private: std::string address_; size_t item_size_; uint64_t samples_; + double rf_gain_; int sample_rate_; int freq_; int gain_; int if_gain_; - double rf_gain_; unsigned int in_stream_; unsigned int out_stream_; int16_t port_; From 6a1eec93b68116dcd4f1dccfb52d584365585f47 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 6 Dec 2022 12:54:21 +0100 Subject: [PATCH 47/59] Apply changes suggested by clang-tidy --- src/algorithms/channel/adapters/channel.cc | 8 ++++---- src/algorithms/channel/adapters/channel.h | 2 +- .../adapters/freq_xlating_fir_filter.cc | 4 ++-- src/algorithms/libs/pass_through.cc | 12 +++++++----- .../observables/adapters/hybrid_observables.cc | 14 ++++++++------ .../adapters/sbas_l1_telemetry_decoder.cc | 7 +++---- src/algorithms/tracking/libs/lock_detectors.cc | 2 +- src/algorithms/tracking/libs/lock_detectors.h | 2 +- .../system_parameters/gps_navigation_message.cc | 8 ++++---- .../system_parameters/gps_navigation_message.h | 2 +- .../gps_l1_ca_dll_pll_tracking_test_fpga.cc | 5 ++--- 11 files changed, 34 insertions(+), 32 deletions(-) diff --git a/src/algorithms/channel/adapters/channel.cc b/src/algorithms/channel/adapters/channel.cc index 18590afca..cf3f5c0e4 100644 --- a/src/algorithms/channel/adapters/channel.cc +++ b/src/algorithms/channel/adapters/channel.cc @@ -38,13 +38,13 @@ Channel::Channel(const ConfigurationInterface* configuration, trk_(std::move(trk)), nav_(std::move(nav)), role_(role), - channel_(channel) + channel_(channel), flag_enable_fpga_(configuration->property("GNSS-SDR.enable_FPGA", false)), glonass_extend_correlation_ms_(configuration->property("Tracking_1G.extend_correlation_ms", 0) + configuration->property("Tracking_2G.extend_correlation_ms", 0)) { - glonass_extend_correlation_ms_ = configuration->property("Tracking_1G.extend_correlation_ms", 0) + configuration->property("Tracking_2G.extend_correlation_ms", 0); + channel_fsm_ = std::make_shared(); - flag_enable_fpga_ = configuration->property("GNSS-SDR.enable_FPGA", false); + acq_->set_channel(channel_); acq_->set_channel_fsm(channel_fsm_); @@ -273,7 +273,7 @@ void Channel::start_acquisition() DLOG(INFO) << "Channel start_acquisition()"; } -bool Channel::glonass_dll_pll_c_aid_tracking_check() +bool Channel::glonass_dll_pll_c_aid_tracking_check() const { if (glonass_extend_correlation_ms_) { diff --git a/src/algorithms/channel/adapters/channel.h b/src/algorithms/channel/adapters/channel.h index 519f6babd..a8e80123a 100644 --- a/src/algorithms/channel/adapters/channel.h +++ b/src/algorithms/channel/adapters/channel.h @@ -96,7 +96,7 @@ public: inline std::shared_ptr telemetry() const { return nav_; } private: - bool glonass_dll_pll_c_aid_tracking_check(); + bool glonass_dll_pll_c_aid_tracking_check() const; std::shared_ptr channel_fsm_; std::shared_ptr acq_; std::shared_ptr trk_; diff --git a/src/algorithms/input_filter/adapters/freq_xlating_fir_filter.cc b/src/algorithms/input_filter/adapters/freq_xlating_fir_filter.cc index 1b7fb828c..eb1c8affd 100644 --- a/src/algorithms/input_filter/adapters/freq_xlating_fir_filter.cc +++ b/src/algorithms/input_filter/adapters/freq_xlating_fir_filter.cc @@ -31,7 +31,8 @@ FreqXlatingFirFilter::FreqXlatingFirFilter(const ConfigurationInterface* configu unsigned int out_streams) : role_(std::move(role)), in_streams_(in_streams), - out_streams_(out_streams) + out_streams_(out_streams), + dump_(configuration->property(role + ".dump", false)) { const std::string default_input_item_type("gr_complex"); const std::string default_output_item_type("gr_complex"); @@ -59,7 +60,6 @@ FreqXlatingFirFilter::FreqXlatingFirFilter(const ConfigurationInterface* configu 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") { diff --git a/src/algorithms/libs/pass_through.cc b/src/algorithms/libs/pass_through.cc index dbc96f32e..bc54ae61a 100644 --- a/src/algorithms/libs/pass_through.cc +++ b/src/algorithms/libs/pass_through.cc @@ -25,15 +25,17 @@ #include // for operator<< -Pass_Through::Pass_Through(const ConfigurationInterface* configuration, const std::string& role, +Pass_Through::Pass_Through(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) + unsigned int out_streams) + : role_(role), + in_streams_(in_streams), + out_streams_(out_streams), + inverted_spectrum(configuration->property(role + ".inverted_spectrum", false)) { const std::string default_item_type("gr_complex"); item_type_ = configuration->property(role + ".item_type", default_item_type); - inverted_spectrum = configuration->property(role + ".inverted_spectrum", false); if (item_type_ == "float") { diff --git a/src/algorithms/observables/adapters/hybrid_observables.cc b/src/algorithms/observables/adapters/hybrid_observables.cc index a07882481..6413d48a7 100644 --- a/src/algorithms/observables/adapters/hybrid_observables.cc +++ b/src/algorithms/observables/adapters/hybrid_observables.cc @@ -23,16 +23,18 @@ #include // for operator<< HybridObservables::HybridObservables(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& role, + unsigned int in_streams, + unsigned int out_streams) : role_(role), + in_streams_(in_streams), + out_streams_(out_streams), + dump_(configuration->property(role + ".dump", false)), + dump_mat_(configuration->property(role + ".dump_mat", true)) { const std::string default_dump_filename("./observables.dat"); - DLOG(INFO) << "role " << role; - dump_ = configuration->property(role + ".dump", false); - dump_mat_ = configuration->property(role + ".dump_mat", true); dump_filename_ = configuration->property(role + ".dump_filename", default_dump_filename); Obs_Conf conf{}; - conf.dump = dump_; conf.dump_mat = dump_mat_; conf.dump_filename = dump_filename_; @@ -46,7 +48,7 @@ HybridObservables::HybridObservables(const ConfigurationInterface* configuration { conf.smoothing_factor = configuration->property(role + ".smoothing_factor", conf.smoothing_factor); } - + DLOG(INFO) << "role " << role; if (conf.enable_carrier_smoothing == true) { LOG(INFO) << "Observables carrier smoothing enabled with smoothing factor " << conf.smoothing_factor; diff --git a/src/algorithms/telemetry_decoder/adapters/sbas_l1_telemetry_decoder.cc b/src/algorithms/telemetry_decoder/adapters/sbas_l1_telemetry_decoder.cc index 6444bfc61..82b639f70 100644 --- a/src/algorithms/telemetry_decoder/adapters/sbas_l1_telemetry_decoder.cc +++ b/src/algorithms/telemetry_decoder/adapters/sbas_l1_telemetry_decoder.cc @@ -27,15 +27,14 @@ SbasL1TelemetryDecoder::SbasL1TelemetryDecoder( unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), - out_streams_(out_streams) + out_streams_(out_streams), + dump_(configuration->property(role + ".dump", false)) { const std::string default_dump_filename("./navigation.dat"); - DLOG(INFO) << "role " << role; - dump_ = configuration->property(role + ".dump", false); dump_filename_ = configuration->property(role + ".dump_filename", default_dump_filename); // make telemetry decoder object telemetry_decoder_ = sbas_l1_make_telemetry_decoder_gs(satellite_, dump_); // TODO fix me - + DLOG(INFO) << "role " << role; DLOG(INFO) << "telemetry_decoder(" << telemetry_decoder_->unique_id() << ")"; if (in_streams_ > 1) { diff --git a/src/algorithms/tracking/libs/lock_detectors.cc b/src/algorithms/tracking/libs/lock_detectors.cc index 0d9a716dd..7fa08690b 100644 --- a/src/algorithms/tracking/libs/lock_detectors.cc +++ b/src/algorithms/tracking/libs/lock_detectors.cc @@ -131,7 +131,7 @@ float cn0_m2m4_estimator(const gr_complex* Prompt_buffer, int length, float coh_ * \f$NBP=(\sum^{N-1}_{i=0}Im(Pc(i)))^2+(\sum^{N-1}_{i=0}Re(Pc(i)))^2\f$, and * \f$Pc(i)\f$ is the prompt correlator output for the sample index i. */ -float carrier_lock_detector(gr_complex* Prompt_buffer, int length) +float carrier_lock_detector(const gr_complex* Prompt_buffer, int length) { float tmp_sum_I = 0.0; float tmp_sum_Q = 0.0; diff --git a/src/algorithms/tracking/libs/lock_detectors.h b/src/algorithms/tracking/libs/lock_detectors.h index eb0eb93ef..c4f73a082 100644 --- a/src/algorithms/tracking/libs/lock_detectors.h +++ b/src/algorithms/tracking/libs/lock_detectors.h @@ -106,7 +106,7 @@ float cn0_m2m4_estimator(const gr_complex* Prompt_buffer, int length, float coh_ * Volume I, Chapter 8: GPS Receivers, AJ Systems, Los Altos, CA 94024. * Inc.: 329-407. */ -float carrier_lock_detector(gr_complex* Prompt_buffer, int length); +float carrier_lock_detector(const gr_complex* Prompt_buffer, int length); /** \} */ diff --git a/src/core/system_parameters/gps_navigation_message.cc b/src/core/system_parameters/gps_navigation_message.cc index 1ea1a6f22..b9a007a3f 100644 --- a/src/core/system_parameters/gps_navigation_message.cc +++ b/src/core/system_parameters/gps_navigation_message.cc @@ -46,7 +46,7 @@ void Gps_Navigation_Message::print_gps_word_bytes(uint32_t GPS_word) const } -bool Gps_Navigation_Message::read_navigation_bool(const std::bitset& bits, const std::vector>& parameter) const +bool Gps_Navigation_Message::read_navigation_bool(const std::bitset& bits, const std::vector /*unused*/>& parameter) const { bool value; @@ -62,7 +62,7 @@ bool Gps_Navigation_Message::read_navigation_bool(const std::bitset& bits, const std::vector>& parameter) const +uint64_t Gps_Navigation_Message::read_navigation_unsigned(const std::bitset& bits, const std::vector /*unused*/>& parameter) const { uint64_t value = 0ULL; const int32_t num_of_slices = parameter.size(); @@ -81,7 +81,7 @@ uint64_t Gps_Navigation_Message::read_navigation_unsigned(const std::bitset& bits, const std::vector>& parameter) const +int64_t Gps_Navigation_Message::read_navigation_signed(const std::bitset& bits, const std::vector /*unused*/>& parameter) const { int64_t value = 0LL; const int32_t num_of_slices = parameter.size(); @@ -112,7 +112,7 @@ int64_t Gps_Navigation_Message::read_navigation_signed(const std::bitsetmessage_port_register_in(pmt::mp("events")); this->set_msg_handler(pmt::mp("events"), From 3e9648c4eb3a03b0921fd0033d2c1a2b7d82186b Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 6 Dec 2022 14:06:01 +0100 Subject: [PATCH 48/59] Apply changes suggested by clang-tidy --- src/algorithms/channel/adapters/channel.cc | 26 ++++++++++------------ 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/algorithms/channel/adapters/channel.cc b/src/algorithms/channel/adapters/channel.cc index cf3f5c0e4..69b84ca0c 100644 --- a/src/algorithms/channel/adapters/channel.cc +++ b/src/algorithms/channel/adapters/channel.cc @@ -34,18 +34,19 @@ Channel::Channel(const ConfigurationInterface* configuration, std::shared_ptr nav, const std::string& role, const std::string& signal_str, - Concurrent_Queue* queue) : acq_(std::move(acq)), - trk_(std::move(trk)), - nav_(std::move(nav)), - role_(role), - channel_(channel), flag_enable_fpga_(configuration->property("GNSS-SDR.enable_FPGA", false)), glonass_extend_correlation_ms_(configuration->property("Tracking_1G.extend_correlation_ms", 0) + configuration->property("Tracking_2G.extend_correlation_ms", 0)) + Concurrent_Queue* queue) + : acq_(std::move(acq)), + trk_(std::move(trk)), + nav_(std::move(nav)), + role_(role), + channel_(channel), + glonass_extend_correlation_ms_(configuration->property("Tracking_1G.extend_correlation_ms", 0) + configuration->property("Tracking_2G.extend_correlation_ms", 0)), + connected_(false), + repeat_(configuration->property("Acquisition_" + signal_str + ".repeat_satellite", false)), + flag_enable_fpga_(configuration->property("GNSS-SDR.enable_FPGA", false)) { - - channel_fsm_ = std::make_shared(); - - acq_->set_channel(channel_); acq_->set_channel_fsm(channel_fsm_); trk_->set_channel(channel_); @@ -56,6 +57,8 @@ Channel::Channel(const ConfigurationInterface* configuration, acq_->set_gnss_synchro(&gnss_synchro_); trk_->set_gnss_synchro(&gnss_synchro_); + repeat_ = configuration->property("Acquisition_" + signal_str + std::to_string(channel_) + ".repeat_satellite", repeat_); + // Provide a warning to the user about the change of parameter name if (channel_ == 0) { @@ -91,9 +94,6 @@ Channel::Channel(const ConfigurationInterface* configuration, acq_->set_threshold(threshold); acq_->init(); - repeat_ = configuration->property("Acquisition_" + signal_str + ".repeat_satellite", false); - repeat_ = configuration->property("Acquisition_" + signal_str + std::to_string(channel_) + ".repeat_satellite", repeat_); - DLOG(INFO) << "Channel " << channel_ << " satellite repeat = " << repeat_; channel_fsm_->set_acquisition(acq_); channel_fsm_->set_tracking(trk_); @@ -101,8 +101,6 @@ Channel::Channel(const ConfigurationInterface* configuration, channel_fsm_->set_channel(channel_); channel_fsm_->set_queue(queue); - connected_ = false; - gnss_signal_ = Gnss_Signal(signal_str); channel_msg_rx_ = channel_msg_receiver_make_cc(channel_fsm_, repeat_); From ca11e5d2151bd51f7c1da26db28dfe83cd3b534c Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 6 Dec 2022 14:17:06 +0100 Subject: [PATCH 49/59] Relax error for CI jobs --- src/tests/system-tests/libs/position_test_flags.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tests/system-tests/libs/position_test_flags.h b/src/tests/system-tests/libs/position_test_flags.h index 3d04b0b62..57cc1e5dd 100644 --- a/src/tests/system-tests/libs/position_test_flags.h +++ b/src/tests/system-tests/libs/position_test_flags.h @@ -30,7 +30,7 @@ DEFINE_string(ref_motion_filename, std::string("motion.csv"), "Path and filename DEFINE_string(pvt_solver_dump_filename, std::string("PVT.dat"), "Path and filename for the PVT solver binary dump file"); DEFINE_double(static_2D_error_m, 2.0, "Static scenario 2D (East, North) positioning error threshold [meters]"); DEFINE_double(static_3D_error_m, 5.0, "Static scenario 3D (East, North, Up) positioning error threshold [meters]"); -DEFINE_double(accuracy_CEP, 2.0, "Static scenario 2D (East, North) accuracy Circular Error Position (CEP) threshold [meters]"); +DEFINE_double(accuracy_CEP, 3.0, "Static scenario 2D (East, North) accuracy Circular Error Position (CEP) threshold [meters]"); DEFINE_double(precision_SEP, 15.0, "Static scenario 3D (East, North, Up) precision Spherical Error Position (SEP) threshold [meters]"); DEFINE_double(dynamic_3D_position_RMSE, 10.0, "Dynamic scenario 3D (ECEF) accuracy RMSE threshold [meters]"); DEFINE_double(dynamic_3D_velocity_RMSE, 5.0, "Dynamic scenario 3D (ECEF) velocity accuracy RMSE threshold [meters/second]"); From 3d3d76362b264735a378d501dc58f4520ccdfd38 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 8 Dec 2022 11:16:40 +0100 Subject: [PATCH 50/59] Use newer signature for set_relative_rate(), improve member initialization --- .../adapters/direct_resampler_conditioner.cc | 17 +++++++++----- .../adapters/mmse_resampler_conditioner.cc | 17 +++++++++----- .../resampler/gnuradio_blocks/CMakeLists.txt | 5 +++++ .../direct_resampler_conditioner_cb.cc | 22 +++++++++++-------- .../direct_resampler_conditioner_cc.cc | 20 +++++++++++------ .../direct_resampler_conditioner_cs.cc | 22 +++++++++++-------- 6 files changed, 66 insertions(+), 37 deletions(-) diff --git a/src/algorithms/resampler/adapters/direct_resampler_conditioner.cc b/src/algorithms/resampler/adapters/direct_resampler_conditioner.cc index ab8b24f31..bffa67680 100644 --- a/src/algorithms/resampler/adapters/direct_resampler_conditioner.cc +++ b/src/algorithms/resampler/adapters/direct_resampler_conditioner.cc @@ -29,25 +29,30 @@ DirectResamplerConditioner::DirectResamplerConditioner( - 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) + 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), + dump_(configuration->property(role + ".dump", false)) { const std::string default_item_type("short"); const std::string default_dump_file("./data/signal_conditioner.dat"); const double fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000.0); const double fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); + item_type_ = configuration->property(role + ".item_type", default_item_type); + dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file); sample_freq_in_ = configuration->property(role_ + ".sample_freq_in", 4000000.0); sample_freq_out_ = configuration->property(role_ + ".sample_freq_out", fs_in); + if (std::fabs(fs_in - sample_freq_out_) > std::numeric_limits::epsilon()) { std::string aux_warn = "CONFIGURATION WARNING: Parameters GNSS-SDR.internal_fs_sps and " + role_ + ".sample_freq_out are not set to the same value!"; LOG(WARNING) << aux_warn; std::cout << aux_warn << '\n'; } - 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); if (item_type_ == "gr_complex") { diff --git a/src/algorithms/resampler/adapters/mmse_resampler_conditioner.cc b/src/algorithms/resampler/adapters/mmse_resampler_conditioner.cc index c40f4450c..7ee86662f 100644 --- a/src/algorithms/resampler/adapters/mmse_resampler_conditioner.cc +++ b/src/algorithms/resampler/adapters/mmse_resampler_conditioner.cc @@ -24,25 +24,30 @@ #include MmseResamplerConditioner::MmseResamplerConditioner( - 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) + 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), + dump_(configuration->property(role + ".dump", false)) { const std::string default_item_type("gr_complex"); const std::string default_dump_file("./data/signal_conditioner.dat"); const double fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000.0); const double fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); + item_type_ = configuration->property(role + ".item_type", default_item_type); + dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file); sample_freq_in_ = configuration->property(role_ + ".sample_freq_in", 4000000.0); sample_freq_out_ = configuration->property(role_ + ".sample_freq_out", fs_in); + if (std::fabs(fs_in - sample_freq_out_) > std::numeric_limits::epsilon()) { std::string aux_warn = "CONFIGURATION WARNING: Parameters GNSS-SDR.internal_fs_sps and " + role_ + ".sample_freq_out are not set to the same value!"; LOG(WARNING) << aux_warn; std::cout << aux_warn << '\n'; } - 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); if (item_type_ == "gr_complex") { diff --git a/src/algorithms/resampler/gnuradio_blocks/CMakeLists.txt b/src/algorithms/resampler/gnuradio_blocks/CMakeLists.txt index 9a7ea4e5d..cd30cb41d 100644 --- a/src/algorithms/resampler/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/resampler/gnuradio_blocks/CMakeLists.txt @@ -50,6 +50,11 @@ if(GNURADIO_USES_STD_POINTERS) ) endif() +if(GNURADIO_IS_38_OR_GREATER) + target_compile_definitions(resampler_gr_blocks + PUBLIC -DGR_GREATER_38=1) +endif() + target_include_directories(resampler_gr_blocks PUBLIC ${GNSSSDR_SOURCE_DIR}/src/core/interfaces diff --git a/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cb.cc b/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cb.cc index a243cc957..ba08c7817 100644 --- a/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cb.cc +++ b/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cb.cc @@ -34,12 +34,14 @@ direct_resampler_conditioner_cb_sptr direct_resampler_make_conditioner_cb( direct_resampler_conditioner_cb::direct_resampler_conditioner_cb( double sample_freq_in, - double sample_freq_out) : gr::block("direct_resampler_make_conditioner_cb", gr::io_signature::make(1, 1, sizeof(lv_8sc_t)), gr::io_signature::make(1, 1, sizeof(lv_8sc_t))), - d_sample_freq_in(sample_freq_in), - d_sample_freq_out( - sample_freq_out), - d_phase(0), - d_lphase(0) + double sample_freq_out) + : gr::block("direct_resampler_make_conditioner_cb", + gr::io_signature::make(1, 1, sizeof(lv_8sc_t)), + gr::io_signature::make(1, 1, sizeof(lv_8sc_t))), + d_sample_freq_in(sample_freq_in), + d_sample_freq_out(sample_freq_out), + d_phase(0), + d_lphase(0) { const double two_32 = 4294967296.0; // Computes the phase step multiplying the resampling ratio by 2^32 = 4294967296 @@ -51,9 +53,11 @@ direct_resampler_conditioner_cb::direct_resampler_conditioner_cb( { d_phase_step = static_cast(floor(two_32 * sample_freq_in / sample_freq_out)); } - - set_relative_rate(1.0 * sample_freq_out / sample_freq_in); - set_output_multiple(1); +#ifdef GR_GREATER_38 + this->set_relative_rate(static_cast(sample_freq_out), static_cast(sample_freq_in)); +#else + this->set_relative_rate(sample_freq_out / sample_freq_in); +#endif } diff --git a/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cc.cc b/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cc.cc index 3a063f81c..f6f46b711 100644 --- a/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cc.cc +++ b/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cc.cc @@ -33,11 +33,14 @@ direct_resampler_conditioner_cc_sptr direct_resampler_make_conditioner_cc( direct_resampler_conditioner_cc::direct_resampler_conditioner_cc( double sample_freq_in, - double sample_freq_out) : gr::block("direct_resampler_conditioner_cc", gr::io_signature::make(1, 1, sizeof(gr_complex)), gr::io_signature::make(1, 1, sizeof(gr_complex))), - d_sample_freq_in(sample_freq_in), - d_sample_freq_out(sample_freq_out), - d_phase(0), - d_lphase(0) + double sample_freq_out) + : gr::block("direct_resampler_conditioner_cc", + gr::io_signature::make(1, 1, sizeof(gr_complex)), + gr::io_signature::make(1, 1, sizeof(gr_complex))), + d_sample_freq_in(sample_freq_in), + d_sample_freq_out(sample_freq_out), + d_phase(0), + d_lphase(0) { // Computes the phase step multiplying the resampling ratio by 2^32 = 4294967296 const double two_32 = 4294967296.0; @@ -49,8 +52,11 @@ direct_resampler_conditioner_cc::direct_resampler_conditioner_cc( { d_phase_step = static_cast(floor(two_32 * sample_freq_in / sample_freq_out)); } - set_relative_rate(1.0 * sample_freq_out / sample_freq_in); - set_output_multiple(1); +#ifdef GR_GREATER_38 + this->set_relative_rate(static_cast(sample_freq_out), static_cast(sample_freq_in)); +#else + this->set_relative_rate(sample_freq_out / sample_freq_in); +#endif } diff --git a/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cs.cc b/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cs.cc index a8b83e6d4..365728b01 100644 --- a/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cs.cc +++ b/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cs.cc @@ -34,13 +34,14 @@ direct_resampler_conditioner_cs_sptr direct_resampler_make_conditioner_cs( direct_resampler_conditioner_cs::direct_resampler_conditioner_cs( double sample_freq_in, - double sample_freq_out) : gr::block("direct_resampler_make_conditioner_cs", - gr::io_signature::make(1, 1, sizeof(lv_16sc_t)), - gr::io_signature::make(1, 1, sizeof(lv_16sc_t))), - d_sample_freq_in(sample_freq_in), - d_sample_freq_out(sample_freq_out), - d_phase(0), - d_lphase(0) + double sample_freq_out) + : gr::block("direct_resampler_make_conditioner_cs", + gr::io_signature::make(1, 1, sizeof(lv_16sc_t)), + gr::io_signature::make(1, 1, sizeof(lv_16sc_t))), + d_sample_freq_in(sample_freq_in), + d_sample_freq_out(sample_freq_out), + d_phase(0), + d_lphase(0) { const double two_32 = 4294967296.0; // Computes the phase step multiplying the resampling ratio by 2^32 = 4294967296 @@ -53,8 +54,11 @@ direct_resampler_conditioner_cs::direct_resampler_conditioner_cs( d_phase_step = static_cast(floor(two_32 * sample_freq_in / sample_freq_out)); } - set_relative_rate(1.0 * sample_freq_out / sample_freq_in); - set_output_multiple(1); +#ifdef GR_GREATER_38 + this->set_relative_rate(static_cast(sample_freq_out), static_cast(sample_freq_in)); +#else + this->set_relative_rate(sample_freq_out / sample_freq_in); +#endif } From 8bd0292b1a9731ebd51b632b2895b2895f99cef5 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 8 Dec 2022 17:39:16 +0100 Subject: [PATCH 51/59] Improve tracking adapters constructors: prefer member initializers of the constructor instead of in the constructor body. Improve consistency of private members name --- .../adapters/beidou_b1i_dll_pll_tracking.cc | 42 +++++----- .../adapters/beidou_b1i_dll_pll_tracking.h | 4 +- .../adapters/beidou_b3i_dll_pll_tracking.cc | 41 ++++++---- .../adapters/beidou_b3i_dll_pll_tracking.h | 4 +- .../galileo_e1_dll_pll_veml_tracking.cc | 38 +++++---- .../galileo_e1_dll_pll_veml_tracking.h | 4 +- .../galileo_e1_dll_pll_veml_tracking_fpga.cc | 73 ++++++++++-------- .../galileo_e1_dll_pll_veml_tracking_fpga.h | 15 ++-- .../galileo_e1_tcp_connector_tracking.cc | 47 ++++++----- .../galileo_e1_tcp_connector_tracking.h | 4 +- .../adapters/galileo_e5a_dll_pll_tracking.cc | 39 ++++++---- .../adapters/galileo_e5a_dll_pll_tracking.h | 4 +- .../galileo_e5a_dll_pll_tracking_fpga.cc | 73 +++++++++--------- .../galileo_e5a_dll_pll_tracking_fpga.h | 15 ++-- .../adapters/galileo_e5b_dll_pll_tracking.cc | 39 ++++++---- .../adapters/galileo_e5b_dll_pll_tracking.h | 4 +- .../adapters/galileo_e6_dll_pll_tracking.cc | 39 ++++++---- .../adapters/galileo_e6_dll_pll_tracking.h | 4 +- .../glonass_l1_ca_dll_pll_c_aid_tracking.cc | 66 +++++++++------- .../glonass_l1_ca_dll_pll_c_aid_tracking.h | 10 +-- .../glonass_l1_ca_dll_pll_tracking.cc | 43 ++++++----- .../adapters/glonass_l1_ca_dll_pll_tracking.h | 4 +- .../glonass_l2_ca_dll_pll_c_aid_tracking.cc | 66 +++++++++------- .../glonass_l2_ca_dll_pll_c_aid_tracking.h | 10 +-- .../glonass_l2_ca_dll_pll_tracking.cc | 43 ++++++----- .../adapters/glonass_l2_ca_dll_pll_tracking.h | 4 +- .../adapters/gps_l1_ca_dll_pll_tracking.cc | 40 ++++++---- .../adapters/gps_l1_ca_dll_pll_tracking.h | 4 +- .../gps_l1_ca_dll_pll_tracking_fpga.cc | 66 ++++++++-------- .../gps_l1_ca_dll_pll_tracking_fpga.h | 11 ++- .../adapters/gps_l1_ca_gaussian_tracking.cc | 53 +++++++------ .../adapters/gps_l1_ca_gaussian_tracking.h | 4 +- .../adapters/gps_l1_ca_kf_tracking.cc | 43 ++++++----- .../tracking/adapters/gps_l1_ca_kf_tracking.h | 4 +- .../gps_l1_ca_tcp_connector_tracking.cc | 41 +++++----- .../gps_l1_ca_tcp_connector_tracking.h | 4 +- .../adapters/gps_l2_m_dll_pll_tracking.cc | 41 ++++++---- .../adapters/gps_l2_m_dll_pll_tracking.h | 4 +- .../gps_l2_m_dll_pll_tracking_fpga.cc | 58 +++++++------- .../adapters/gps_l2_m_dll_pll_tracking_fpga.h | 13 ++-- .../adapters/gps_l5_dll_pll_tracking.cc | 39 ++++++---- .../adapters/gps_l5_dll_pll_tracking.h | 4 +- .../adapters/gps_l5_dll_pll_tracking_fpga.cc | 77 ++++++++++--------- .../adapters/gps_l5_dll_pll_tracking_fpga.h | 17 ++-- 44 files changed, 696 insertions(+), 562 deletions(-) diff --git a/src/algorithms/tracking/adapters/beidou_b1i_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/beidou_b1i_dll_pll_tracking.cc index 8c87751dc..31ffb9fe8 100644 --- a/src/algorithms/tracking/adapters/beidou_b1i_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/beidou_b1i_dll_pll_tracking.cc @@ -32,12 +32,17 @@ BeidouB1iDllPllTracking::BeidouB1iDllPllTracking( - 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 ConfigurationInterface* configuration, + const std::string& role, + unsigned int in_streams, unsigned int out_streams) + : role_(role), + item_size_(sizeof(gr_complex)), + channel_(0), + in_streams_(in_streams), + out_streams_(out_streams) { Dll_Pll_Conf trk_params = Dll_Pll_Conf(); - DLOG(INFO) << "role " << role; - trk_params.SetFromConfiguration(configuration, role); + trk_params.SetFromConfiguration(configuration, role_); const auto vector_length = static_cast(std::round(trk_params.fs_in / (BEIDOU_B1I_CODE_RATE_CPS / BEIDOU_B1I_CODE_LENGTH_CHIPS))); trk_params.vector_length = vector_length; @@ -51,33 +56,34 @@ BeidouB1iDllPllTracking::BeidouB1iDllPllTracking( trk_params.extend_correlation_symbols = 20; std::cout << TEXT_RED << "WARNING: BEIDOU B1I. extend_correlation_symbols must be lower than 21. Coherent integration has been set to 20 symbols (20 ms)" << TEXT_RESET << '\n'; } - trk_params.track_pilot = configuration->property(role + ".track_pilot", false); + trk_params.track_pilot = configuration->property(role_ + ".track_pilot", false); if (trk_params.track_pilot) { std::cout << TEXT_RED << "WARNING: BEIDOU B1I does not have pilot signal. Data tracking has been enabled" << TEXT_RESET << '\n'; trk_params.track_pilot = false; } - if ((trk_params.extend_correlation_symbols > 1) and (trk_params.pll_bw_narrow_hz > trk_params.pll_bw_hz or trk_params.dll_bw_narrow_hz > trk_params.dll_bw_hz)) + if ((trk_params.extend_correlation_symbols > 1) && (trk_params.pll_bw_narrow_hz > trk_params.pll_bw_hz or trk_params.dll_bw_narrow_hz > trk_params.dll_bw_hz)) { std::cout << TEXT_RED << "WARNING: BEIDOU B1I. PLL or DLL narrow tracking bandwidth is higher than wide tracking one" << TEXT_RESET << '\n'; } trk_params.system = 'C'; - const std::array sig_{'B', '1', '\0'}; - std::copy_n(sig_.data(), 3, trk_params.signal); + const std::array sig{'B', '1', '\0'}; + std::copy_n(sig.data(), 3, trk_params.signal); // ################# Make a GNU Radio Tracking block object ################ + DLOG(INFO) << "role " << role_; if (trk_params.item_type == "gr_complex") { - item_size_ = sizeof(gr_complex); - tracking_ = dll_pll_veml_make_tracking(trk_params); + tracking_sptr_ = dll_pll_veml_make_tracking(trk_params); + DLOG(INFO) << "tracking(" << tracking_sptr_->unique_id() << ")"; } else { item_size_ = 0; + tracking_sptr_ = nullptr; LOG(WARNING) << trk_params.item_type << " unknown tracking item type."; } - channel_ = 0; - DLOG(INFO) << "tracking(" << tracking_->unique_id() << ")"; + if (in_streams_ > 1) { LOG(ERROR) << "This implementation only supports one input stream"; @@ -91,13 +97,13 @@ BeidouB1iDllPllTracking::BeidouB1iDllPllTracking( void BeidouB1iDllPllTracking::start_tracking() { - tracking_->start_tracking(); + tracking_sptr_->start_tracking(); } void BeidouB1iDllPllTracking::stop_tracking() { - tracking_->stop_tracking(); + tracking_sptr_->stop_tracking(); } @@ -107,13 +113,13 @@ void BeidouB1iDllPllTracking::stop_tracking() void BeidouB1iDllPllTracking::set_channel(unsigned int channel) { channel_ = channel; - tracking_->set_channel(channel); + tracking_sptr_->set_channel(channel); } void BeidouB1iDllPllTracking::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) { - tracking_->set_gnss_synchro(p_gnss_synchro); + tracking_sptr_->set_gnss_synchro(p_gnss_synchro); } @@ -137,11 +143,11 @@ void BeidouB1iDllPllTracking::disconnect(gr::top_block_sptr top_block) gr::basic_block_sptr BeidouB1iDllPllTracking::get_left_block() { - return tracking_; + return tracking_sptr_; } gr::basic_block_sptr BeidouB1iDllPllTracking::get_right_block() { - return tracking_; + return tracking_sptr_; } diff --git a/src/algorithms/tracking/adapters/beidou_b1i_dll_pll_tracking.h b/src/algorithms/tracking/adapters/beidou_b1i_dll_pll_tracking.h index d1d72078b..6ccb956f3 100644 --- a/src/algorithms/tracking/adapters/beidou_b1i_dll_pll_tracking.h +++ b/src/algorithms/tracking/adapters/beidou_b1i_dll_pll_tracking.h @@ -88,10 +88,10 @@ public: void stop_tracking() override; private: - dll_pll_veml_tracking_sptr tracking_; + dll_pll_veml_tracking_sptr tracking_sptr_; + std::string role_; size_t item_size_; unsigned int channel_; - std::string role_; unsigned int in_streams_; unsigned int out_streams_; }; diff --git a/src/algorithms/tracking/adapters/beidou_b3i_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/beidou_b3i_dll_pll_tracking.cc index 09bfd34f5..633b87689 100644 --- a/src/algorithms/tracking/adapters/beidou_b3i_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/beidou_b3i_dll_pll_tracking.cc @@ -31,16 +31,22 @@ #include BeidouB3iDllPllTracking::BeidouB3iDllPllTracking( - 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 ConfigurationInterface* configuration, + const std::string& role, + unsigned int in_streams, + unsigned int out_streams) + : role_(role), + item_size_(sizeof(gr_complex)), + channel_(0), + in_streams_(in_streams), + out_streams_(out_streams) { Dll_Pll_Conf trk_params = Dll_Pll_Conf(); - DLOG(INFO) << "role " << role; - trk_params.SetFromConfiguration(configuration, role); + trk_params.SetFromConfiguration(configuration, role_); const auto vector_length = static_cast(std::round(static_cast(trk_params.fs_in) / (BEIDOU_B3I_CODE_RATE_CPS / BEIDOU_B3I_CODE_LENGTH_CHIPS))); trk_params.vector_length = vector_length; - trk_params.track_pilot = configuration->property(role + ".track_pilot", false); + trk_params.track_pilot = configuration->property(role_ + ".track_pilot", false); if (trk_params.extend_correlation_symbols < 1) { trk_params.extend_correlation_symbols = 1; @@ -52,22 +58,23 @@ BeidouB3iDllPllTracking::BeidouB3iDllPllTracking( std::cout << TEXT_RED << "WARNING: BEIDOU B3I. extend_correlation_symbols must be lower than 21. Coherent integration has been set to 20 symbols (20 ms)" << TEXT_RESET << '\n'; } trk_params.system = 'C'; - const std::array sig_{'B', '3', '\0'}; - std::copy_n(sig_.data(), 3, trk_params.signal); + const std::array sig{'B', '3', '\0'}; + std::copy_n(sig.data(), 3, trk_params.signal); // ################# Make a GNU Radio Tracking block object ################ + DLOG(INFO) << "role " << role_; if (trk_params.item_type == "gr_complex") { - item_size_ = sizeof(gr_complex); - tracking_ = dll_pll_veml_make_tracking(trk_params); + tracking_sptr_ = dll_pll_veml_make_tracking(trk_params); + DLOG(INFO) << "tracking(" << tracking_sptr_->unique_id() << ")"; } else { item_size_ = 0; + tracking_sptr_ = nullptr; LOG(WARNING) << trk_params.item_type << " unknown tracking item type."; } - channel_ = 0; - DLOG(INFO) << "tracking(" << tracking_->unique_id() << ")"; + if (in_streams_ > 1) { LOG(ERROR) << "This implementation only supports one input stream"; @@ -81,13 +88,13 @@ BeidouB3iDllPllTracking::BeidouB3iDllPllTracking( void BeidouB3iDllPllTracking::start_tracking() { - tracking_->start_tracking(); + tracking_sptr_->start_tracking(); } void BeidouB3iDllPllTracking::stop_tracking() { - tracking_->stop_tracking(); + tracking_sptr_->stop_tracking(); } @@ -97,13 +104,13 @@ void BeidouB3iDllPllTracking::stop_tracking() void BeidouB3iDllPllTracking::set_channel(unsigned int channel) { channel_ = channel; - tracking_->set_channel(channel); + tracking_sptr_->set_channel(channel); } void BeidouB3iDllPllTracking::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) { - tracking_->set_gnss_synchro(p_gnss_synchro); + tracking_sptr_->set_gnss_synchro(p_gnss_synchro); } @@ -127,11 +134,11 @@ void BeidouB3iDllPllTracking::disconnect(gr::top_block_sptr top_block) gr::basic_block_sptr BeidouB3iDllPllTracking::get_left_block() { - return tracking_; + return tracking_sptr_; } gr::basic_block_sptr BeidouB3iDllPllTracking::get_right_block() { - return tracking_; + return tracking_sptr_; } diff --git a/src/algorithms/tracking/adapters/beidou_b3i_dll_pll_tracking.h b/src/algorithms/tracking/adapters/beidou_b3i_dll_pll_tracking.h index 484a00932..26ff95de4 100644 --- a/src/algorithms/tracking/adapters/beidou_b3i_dll_pll_tracking.h +++ b/src/algorithms/tracking/adapters/beidou_b3i_dll_pll_tracking.h @@ -88,10 +88,10 @@ public: void stop_tracking() override; private: - dll_pll_veml_tracking_sptr tracking_; + dll_pll_veml_tracking_sptr tracking_sptr_; + std::string role_; size_t item_size_; unsigned int channel_; - std::string role_; unsigned int in_streams_; unsigned int out_streams_; }; diff --git a/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking.cc b/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking.cc index 9c104f9ad..4483afa1b 100644 --- a/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking.cc +++ b/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking.cc @@ -31,12 +31,18 @@ #include GalileoE1DllPllVemlTracking::GalileoE1DllPllVemlTracking( - 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 ConfigurationInterface* configuration, + const std::string& role, + unsigned int in_streams, + unsigned int out_streams) + : role_(role), + item_size_(sizeof(gr_complex)), + channel_(0), + in_streams_(in_streams), + out_streams_(out_streams) { Dll_Pll_Conf trk_params = Dll_Pll_Conf(); - DLOG(INFO) << "role " << role; - trk_params.SetFromConfiguration(configuration, role); + trk_params.SetFromConfiguration(configuration, role_); if (trk_params.extend_correlation_symbols < 1) { @@ -55,23 +61,23 @@ GalileoE1DllPllVemlTracking::GalileoE1DllPllVemlTracking( const auto vector_length = static_cast(std::round(trk_params.fs_in / (GALILEO_E1_CODE_CHIP_RATE_CPS / GALILEO_E1_B_CODE_LENGTH_CHIPS))); trk_params.vector_length = vector_length; trk_params.system = 'E'; - const std::array sig_{'1', 'B', '\0'}; - std::copy_n(sig_.data(), 3, trk_params.signal); + const std::array sig{'1', 'B', '\0'}; + std::copy_n(sig.data(), 3, trk_params.signal); // ################# Make a GNU Radio Tracking block object ################ + DLOG(INFO) << "role " << role_; if (trk_params.item_type == "gr_complex") { - item_size_ = sizeof(gr_complex); - tracking_ = dll_pll_veml_make_tracking(trk_params); + tracking_sptr_ = dll_pll_veml_make_tracking(trk_params); + DLOG(INFO) << "tracking(" << tracking_sptr_->unique_id() << ")"; } else { item_size_ = 0; + tracking_sptr_ = nullptr; LOG(WARNING) << trk_params.item_type << " unknown tracking item type."; } - channel_ = 0; - DLOG(INFO) << "tracking(" << tracking_->unique_id() << ")"; if (in_streams_ > 1) { LOG(ERROR) << "This implementation only supports one input stream"; @@ -85,13 +91,13 @@ GalileoE1DllPllVemlTracking::GalileoE1DllPllVemlTracking( void GalileoE1DllPllVemlTracking::stop_tracking() { - tracking_->stop_tracking(); + tracking_sptr_->stop_tracking(); } void GalileoE1DllPllVemlTracking::start_tracking() { - tracking_->start_tracking(); + tracking_sptr_->start_tracking(); } @@ -101,13 +107,13 @@ void GalileoE1DllPllVemlTracking::start_tracking() void GalileoE1DllPllVemlTracking::set_channel(unsigned int channel) { channel_ = channel; - tracking_->set_channel(channel); + tracking_sptr_->set_channel(channel); } void GalileoE1DllPllVemlTracking::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) { - tracking_->set_gnss_synchro(p_gnss_synchro); + tracking_sptr_->set_gnss_synchro(p_gnss_synchro); } @@ -131,11 +137,11 @@ void GalileoE1DllPllVemlTracking::disconnect(gr::top_block_sptr top_block) gr::basic_block_sptr GalileoE1DllPllVemlTracking::get_left_block() { - return tracking_; + return tracking_sptr_; } gr::basic_block_sptr GalileoE1DllPllVemlTracking::get_right_block() { - return tracking_; + return tracking_sptr_; } diff --git a/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking.h b/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking.h index 574f8434f..4f117b8fb 100644 --- a/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking.h +++ b/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking.h @@ -91,10 +91,10 @@ public: void stop_tracking() override; private: - dll_pll_veml_tracking_sptr tracking_; + dll_pll_veml_tracking_sptr tracking_sptr_; + std::string role_; size_t item_size_; unsigned int channel_; - std::string role_; unsigned int in_streams_; unsigned int out_streams_; }; diff --git a/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.cc b/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.cc index d718ad50d..b0571c13d 100644 --- a/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.cc @@ -34,12 +34,18 @@ #include GalileoE1DllPllVemlTrackingFpga::GalileoE1DllPllVemlTrackingFpga( - 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 ConfigurationInterface* configuration, + const std::string& role, + unsigned int in_streams, + unsigned int out_streams) + : role_(role), + data_codes_ptr_(nullptr), + channel_(0), + in_streams_(in_streams), + out_streams_(out_streams) { Dll_Pll_Conf_Fpga trk_params_fpga = Dll_Pll_Conf_Fpga(); - DLOG(INFO) << "role " << role; - trk_params_fpga.SetFromConfiguration(configuration, role); + trk_params_fpga.SetFromConfiguration(configuration, role_); if (trk_params_fpga.extend_correlation_symbols < 1) { @@ -55,15 +61,15 @@ GalileoE1DllPllVemlTrackingFpga::GalileoE1DllPllVemlTrackingFpga( { std::cout << TEXT_RED << "WARNING: Galileo E1. PLL or DLL narrow tracking bandwidth is higher than wide tracking one" << TEXT_RESET << '\n'; } - d_track_pilot = trk_params_fpga.track_pilot; + track_pilot_ = trk_params_fpga.track_pilot; const auto vector_length = static_cast(std::round(trk_params_fpga.fs_in / (GALILEO_E1_CODE_CHIP_RATE_CPS / GALILEO_E1_B_CODE_LENGTH_CHIPS))); trk_params_fpga.vector_length = vector_length; trk_params_fpga.system = 'E'; - const std::array sig_{'1', 'B', '\0'}; - std::copy_n(sig_.data(), 3, trk_params_fpga.signal); + const std::array sig{'1', 'B', '\0'}; + std::copy_n(sig.data(), 3, trk_params_fpga.signal); // UIO device file - device_name = configuration->property(role + ".devicename", default_device_name_Galileo_E1); + device_name_ = configuration->property(role_ + ".devicename", default_device_name_Galileo_E1); // compute the number of tracking channels that have already been instantiated. The order in which // GNSS-SDR instantiates the tracking channels i L1, L2, L5, E1, E5a @@ -83,7 +89,7 @@ GalileoE1DllPllVemlTrackingFpga::GalileoE1DllPllVemlTrackingFpga( } else { - if (configuration->property("Tracking_1C.devicename", std::string("")) != device_name) + if (configuration->property("Tracking_1C.devicename", std::string("")) != device_name_) { num_prev_assigned_ch_1C = configuration->property("Channels_1C.count", 0); } @@ -91,25 +97,24 @@ GalileoE1DllPllVemlTrackingFpga::GalileoE1DllPllVemlTrackingFpga( uint32_t num_prev_assigned_ch_2S = configuration->property("Channels_2S.count", 0); uint32_t num_prev_assigned_ch_L5 = configuration->property("Channels_L5.count", 0); - num_prev_assigned_ch = num_prev_assigned_ch_1C + num_prev_assigned_ch_2S + num_prev_assigned_ch_L5; + num_prev_assigned_ch_ = num_prev_assigned_ch_1C + num_prev_assigned_ch_2S + num_prev_assigned_ch_L5; // ################# PRE-COMPUTE ALL THE CODES ################# uint32_t code_samples_per_chip = 2; - d_ca_codes = static_cast(volk_gnsssdr_malloc(static_cast(GALILEO_E1_B_CODE_LENGTH_CHIPS) * code_samples_per_chip * GALILEO_E1_NUMBER_OF_CODES * sizeof(int32_t), volk_gnsssdr_get_alignment())); + prn_codes_ptr_ = static_cast(volk_gnsssdr_malloc(static_cast(GALILEO_E1_B_CODE_LENGTH_CHIPS) * code_samples_per_chip * GALILEO_E1_NUMBER_OF_CODES * sizeof(int32_t), volk_gnsssdr_get_alignment())); volk_gnsssdr::vector ca_codes_f(static_cast(GALILEO_E1_B_CODE_LENGTH_CHIPS) * code_samples_per_chip); volk_gnsssdr::vector data_codes_f; - d_data_codes = nullptr; - if (d_track_pilot) + if (track_pilot_) { - d_data_codes = static_cast(volk_gnsssdr_malloc((static_cast(GALILEO_E1_B_CODE_LENGTH_CHIPS)) * code_samples_per_chip * GALILEO_E1_NUMBER_OF_CODES * sizeof(int32_t), volk_gnsssdr_get_alignment())); + data_codes_ptr_ = static_cast(volk_gnsssdr_malloc((static_cast(GALILEO_E1_B_CODE_LENGTH_CHIPS)) * code_samples_per_chip * GALILEO_E1_NUMBER_OF_CODES * sizeof(int32_t), volk_gnsssdr_get_alignment())); data_codes_f.resize(static_cast(GALILEO_E1_B_CODE_LENGTH_CHIPS) * code_samples_per_chip, 0.0); } for (uint32_t PRN = 1; PRN <= GALILEO_E1_NUMBER_OF_CODES; PRN++) { std::array data_signal = {'1', 'B', '\0'}; - if (d_track_pilot) + if (track_pilot_) { std::array pilot_signal = {'1', 'C', '\0'}; galileo_e1_code_gen_sinboc11_float(ca_codes_f, pilot_signal, PRN); @@ -124,14 +129,14 @@ GalileoE1DllPllVemlTrackingFpga::GalileoE1DllPllVemlTrackingFpga( tmp_value = 0; } tmp_value = tmp_value | LOCAL_CODE_FPGA_ENABLE_WRITE_MEMORY; - d_ca_codes[static_cast(GALILEO_E1_B_CODE_LENGTH_CHIPS) * 2 * (PRN - 1) + s] = tmp_value; + prn_codes_ptr_[static_cast(GALILEO_E1_B_CODE_LENGTH_CHIPS) * 2 * (PRN - 1) + s] = tmp_value; tmp_value = static_cast(data_codes_f[s]); if (tmp_value < 0) { tmp_value = 0; } tmp_value = tmp_value | LOCAL_CODE_FPGA_ENABLE_WRITE_MEMORY | LOCAL_CODE_FPGA_CORRELATOR_SELECT_COUNT; - d_data_codes[static_cast(GALILEO_E1_B_CODE_LENGTH_CHIPS) * 2 * (PRN - 1) + s] = tmp_value; + data_codes_ptr_[static_cast(GALILEO_E1_B_CODE_LENGTH_CHIPS) * 2 * (PRN - 1) + s] = tmp_value; } } else @@ -147,13 +152,13 @@ GalileoE1DllPllVemlTrackingFpga::GalileoE1DllPllVemlTrackingFpga( tmp_value = 0; } tmp_value = tmp_value | LOCAL_CODE_FPGA_ENABLE_WRITE_MEMORY; - d_ca_codes[static_cast(GALILEO_E1_B_CODE_LENGTH_CHIPS) * 2 * (PRN - 1) + s] = tmp_value; + prn_codes_ptr_[static_cast(GALILEO_E1_B_CODE_LENGTH_CHIPS) * 2 * (PRN - 1) + s] = tmp_value; } } } - trk_params_fpga.ca_codes = d_ca_codes; - trk_params_fpga.data_codes = d_data_codes; + trk_params_fpga.ca_codes = prn_codes_ptr_; + trk_params_fpga.data_codes = data_codes_ptr_; trk_params_fpga.code_length_chips = GALILEO_E1_B_CODE_LENGTH_CHIPS; trk_params_fpga.code_samples_per_chip = code_samples_per_chip; // 2 sample per chip trk_params_fpga.extended_correlation_in_fpga = false; @@ -161,9 +166,9 @@ GalileoE1DllPllVemlTrackingFpga::GalileoE1DllPllVemlTrackingFpga( trk_params_fpga.fpga_integration_period = 1; // (number of symbols that are effectively integrated in the FPGA) // ################# MAKE TRACKING GNU Radio object ################### - tracking_fpga_sc = dll_pll_veml_make_tracking_fpga(trk_params_fpga); - channel_ = 0; - DLOG(INFO) << "tracking(" << tracking_fpga_sc->unique_id() << ")"; + DLOG(INFO) << "role " << role_; + tracking_fpga_sc_sptr_ = dll_pll_veml_make_tracking_fpga(trk_params_fpga); + DLOG(INFO) << "tracking(" << tracking_fpga_sc_sptr_->unique_id() << ")"; if (in_streams_ > 1) { @@ -178,23 +183,23 @@ GalileoE1DllPllVemlTrackingFpga::GalileoE1DllPllVemlTrackingFpga( GalileoE1DllPllVemlTrackingFpga::~GalileoE1DllPllVemlTrackingFpga() { - volk_gnsssdr_free(d_ca_codes); - if (d_track_pilot) + volk_gnsssdr_free(prn_codes_ptr_); + if (track_pilot_) { - volk_gnsssdr_free(d_data_codes); + volk_gnsssdr_free(data_codes_ptr_); } } void GalileoE1DllPllVemlTrackingFpga::stop_tracking() { - tracking_fpga_sc->stop_tracking(); + tracking_fpga_sc_sptr_->stop_tracking(); } void GalileoE1DllPllVemlTrackingFpga::start_tracking() { - tracking_fpga_sc->start_tracking(); + tracking_fpga_sc_sptr_->start_tracking(); } @@ -208,18 +213,18 @@ void GalileoE1DllPllVemlTrackingFpga::set_channel(unsigned int channel) // UIO device file std::string device_io_name; // find the uio device file corresponding to the tracking multicorrelator - if (find_uio_dev_file_name(device_io_name, device_name, channel - num_prev_assigned_ch) < 0) + if (find_uio_dev_file_name(device_io_name, device_name_, channel_ - num_prev_assigned_ch_) < 0) { - std::cout << "Cannot find the FPGA uio device file corresponding to device name " << device_name << std::endl; + std::cout << "Cannot find the FPGA uio device file corresponding to device name " << device_name_ << std::endl; throw std::exception(); } - tracking_fpga_sc->set_channel(channel, device_io_name); + tracking_fpga_sc_sptr_->set_channel(channel_, device_io_name); } void GalileoE1DllPllVemlTrackingFpga::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) { - tracking_fpga_sc->set_gnss_synchro(p_gnss_synchro); + tracking_fpga_sc_sptr_->set_gnss_synchro(p_gnss_synchro); } @@ -243,11 +248,11 @@ void GalileoE1DllPllVemlTrackingFpga::disconnect(gr::top_block_sptr top_block) gr::basic_block_sptr GalileoE1DllPllVemlTrackingFpga::get_left_block() { - return tracking_fpga_sc; + return tracking_fpga_sc_sptr_; } gr::basic_block_sptr GalileoE1DllPllVemlTrackingFpga::get_right_block() { - return tracking_fpga_sc; + return tracking_fpga_sc_sptr_; } diff --git a/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.h b/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.h index 4fc3de9dc..722440f32 100644 --- a/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.h +++ b/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.h @@ -131,17 +131,16 @@ private: static const int32_t LOCAL_CODE_FPGA_ENABLE_WRITE_MEMORY = 0x0C000000; // flag that enables WE (Write Enable) of the local code FPGA static const int32_t LOCAL_CODE_FPGA_CORRELATOR_SELECT_COUNT = 0x20000000; // flag that selects the writing of the pilot code in the FPGA (as opposed to the data code) - std::string device_name; - uint32_t num_prev_assigned_ch; - - dll_pll_veml_tracking_fpga_sptr tracking_fpga_sc; - uint32_t channel_; + dll_pll_veml_tracking_fpga_sptr tracking_fpga_sc_sptr_; std::string role_; + std::string device_name_; + int32_t* prn_codes_ptr_; + int32_t* data_codes_ptr_; + uint32_t num_prev_assigned_ch_; + uint32_t channel_; uint32_t in_streams_; uint32_t out_streams_; - int32_t* d_ca_codes; - int32_t* d_data_codes; - bool d_track_pilot; + bool track_pilot_; }; diff --git a/src/algorithms/tracking/adapters/galileo_e1_tcp_connector_tracking.cc b/src/algorithms/tracking/adapters/galileo_e1_tcp_connector_tracking.cc index d4c4c8340..9236e0862 100644 --- a/src/algorithms/tracking/adapters/galileo_e1_tcp_connector_tracking.cc +++ b/src/algorithms/tracking/adapters/galileo_e1_tcp_connector_tracking.cc @@ -30,38 +30,44 @@ GalileoE1TcpConnectorTracking::GalileoE1TcpConnectorTracking( - 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 ConfigurationInterface* configuration, + const std::string& role, + unsigned int in_streams, + unsigned int out_streams) + : role_(role), + item_size_(sizeof(gr_complex)), + channel_(0), + in_streams_(in_streams), + out_streams_(out_streams) { - DLOG(INFO) << "role " << role; // ################# CONFIGURATION PARAMETERS ######################## const std::string default_item_type("gr_complex"); - std::string item_type = configuration->property(role + ".item_type", default_item_type); + std::string item_type = configuration->property(role_ + ".item_type", default_item_type); int fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); int fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - bool dump = configuration->property(role + ".dump", false); - float pll_bw_hz = configuration->property(role + ".pll_bw_hz", static_cast(50.0)); + bool dump = configuration->property(role_ + ".dump", false); + float pll_bw_hz = configuration->property(role_ + ".pll_bw_hz", static_cast(50.0)); if (FLAGS_pll_bw_hz != 0.0) { pll_bw_hz = static_cast(FLAGS_pll_bw_hz); } - float dll_bw_hz = configuration->property(role + ".dll_bw_hz", static_cast(2.0)); + float dll_bw_hz = configuration->property(role_ + ".dll_bw_hz", static_cast(2.0)); if (FLAGS_dll_bw_hz != 0.0) { dll_bw_hz = static_cast(FLAGS_dll_bw_hz); } - float early_late_space_chips = configuration->property(role + ".early_late_space_chips", static_cast(0.15)); - float very_early_late_space_chips = configuration->property(role + ".very_early_late_space_chips", static_cast(0.5)); - size_t port_ch0 = configuration->property(role + ".port_ch0", 2060); + float early_late_space_chips = configuration->property(role_ + ".early_late_space_chips", static_cast(0.15)); + float very_early_late_space_chips = configuration->property(role_ + ".very_early_late_space_chips", static_cast(0.5)); + size_t port_ch0 = configuration->property(role_ + ".port_ch0", 2060); const std::string default_dump_filename("./track_ch"); - std::string dump_filename = configuration->property(role + ".dump_filename", default_dump_filename); + std::string dump_filename = configuration->property(role_ + ".dump_filename", default_dump_filename); const auto vector_length = static_cast(std::round(fs_in / (GALILEO_E1_CODE_CHIP_RATE_CPS / GALILEO_E1_B_CODE_LENGTH_CHIPS))); // ################# MAKE TRACKING GNURadio object ################### + DLOG(INFO) << "role " << role_; if (item_type == "gr_complex") { - item_size_ = sizeof(gr_complex); - tracking_ = galileo_e1_tcp_connector_make_tracking_cc( + tracking_sptr_ = galileo_e1_tcp_connector_make_tracking_cc( fs_in, vector_length, dump, @@ -71,14 +77,15 @@ GalileoE1TcpConnectorTracking::GalileoE1TcpConnectorTracking( early_late_space_chips, very_early_late_space_chips, port_ch0); + DLOG(INFO) << "tracking(" << tracking_sptr_->unique_id() << ")"; } else { item_size_ = 0; + tracking_sptr_ = nullptr; LOG(WARNING) << item_type << " unknown tracking item type."; } - channel_ = 0; - DLOG(INFO) << "tracking(" << tracking_->unique_id() << ")"; + if (in_streams_ > 1) { LOG(ERROR) << "This implementation only supports one input stream"; @@ -97,7 +104,7 @@ void GalileoE1TcpConnectorTracking::stop_tracking() void GalileoE1TcpConnectorTracking::start_tracking() { - tracking_->start_tracking(); + tracking_sptr_->start_tracking(); } /* @@ -106,13 +113,13 @@ void GalileoE1TcpConnectorTracking::start_tracking() void GalileoE1TcpConnectorTracking::set_channel(unsigned int channel) { channel_ = channel; - tracking_->set_channel(channel); + tracking_sptr_->set_channel(channel); } void GalileoE1TcpConnectorTracking::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) { - tracking_->set_gnss_synchro(p_gnss_synchro); + tracking_sptr_->set_gnss_synchro(p_gnss_synchro); } @@ -136,11 +143,11 @@ void GalileoE1TcpConnectorTracking::disconnect(gr::top_block_sptr top_block) gr::basic_block_sptr GalileoE1TcpConnectorTracking::get_left_block() { - return tracking_; + return tracking_sptr_; } gr::basic_block_sptr GalileoE1TcpConnectorTracking::get_right_block() { - return tracking_; + return tracking_sptr_; } diff --git a/src/algorithms/tracking/adapters/galileo_e1_tcp_connector_tracking.h b/src/algorithms/tracking/adapters/galileo_e1_tcp_connector_tracking.h index 3dd9aa9e8..ee53afccb 100644 --- a/src/algorithms/tracking/adapters/galileo_e1_tcp_connector_tracking.h +++ b/src/algorithms/tracking/adapters/galileo_e1_tcp_connector_tracking.h @@ -91,10 +91,10 @@ public: void stop_tracking() override; private: - galileo_e1_tcp_connector_tracking_cc_sptr tracking_; + galileo_e1_tcp_connector_tracking_cc_sptr tracking_sptr_; + std::string role_; size_t item_size_; unsigned int channel_; - std::string role_; unsigned int in_streams_; unsigned int out_streams_; }; diff --git a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking.cc index 5a9efcc7b..f54f904e6 100644 --- a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking.cc @@ -31,12 +31,18 @@ #include GalileoE5aDllPllTracking::GalileoE5aDllPllTracking( - 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 ConfigurationInterface* configuration, + const std::string& role, + unsigned int in_streams, + unsigned int out_streams) + : role_(role), + item_size_(sizeof(gr_complex)), + channel_(0), + in_streams_(in_streams), + out_streams_(out_streams) { Dll_Pll_Conf trk_params = Dll_Pll_Conf(); - DLOG(INFO) << "role " << role; - trk_params.SetFromConfiguration(configuration, role); + trk_params.SetFromConfiguration(configuration, role_); const auto vector_length = static_cast(std::round(trk_params.fs_in / (GALILEO_E5A_CODE_CHIP_RATE_CPS / GALILEO_E5A_CODE_LENGTH_CHIPS))); trk_params.vector_length = vector_length; @@ -55,22 +61,23 @@ GalileoE5aDllPllTracking::GalileoE5aDllPllTracking( std::cout << TEXT_RED << "WARNING: Galileo E5a. PLL or DLL narrow tracking bandwidth is higher than wide tracking one" << TEXT_RESET << '\n'; } trk_params.system = 'E'; - const std::array sig_{'5', 'X', '\0'}; - std::copy_n(sig_.data(), 3, trk_params.signal); + const std::array sig{'5', 'X', '\0'}; + std::copy_n(sig.data(), 3, trk_params.signal); // ################# Make a GNU Radio Tracking block object ################ + DLOG(INFO) << "role " << role; if (trk_params.item_type == "gr_complex") { - item_size_ = sizeof(gr_complex); - tracking_ = dll_pll_veml_make_tracking(trk_params); + tracking_sptr_ = dll_pll_veml_make_tracking(trk_params); + DLOG(INFO) << "tracking(" << tracking_sptr_->unique_id() << ")"; } else { item_size_ = 0; + tracking_sptr_ = nullptr; LOG(WARNING) << trk_params.item_type << " unknown tracking item type."; } - channel_ = 0; - DLOG(INFO) << "tracking(" << tracking_->unique_id() << ")"; + if (in_streams_ > 1) { LOG(ERROR) << "This implementation only supports one input stream"; @@ -84,13 +91,13 @@ GalileoE5aDllPllTracking::GalileoE5aDllPllTracking( void GalileoE5aDllPllTracking::stop_tracking() { - tracking_->stop_tracking(); + tracking_sptr_->stop_tracking(); } void GalileoE5aDllPllTracking::start_tracking() { - tracking_->start_tracking(); + tracking_sptr_->start_tracking(); } @@ -100,13 +107,13 @@ void GalileoE5aDllPllTracking::start_tracking() void GalileoE5aDllPllTracking::set_channel(unsigned int channel) { channel_ = channel; - tracking_->set_channel(channel); + tracking_sptr_->set_channel(channel); } void GalileoE5aDllPllTracking::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) { - tracking_->set_gnss_synchro(p_gnss_synchro); + tracking_sptr_->set_gnss_synchro(p_gnss_synchro); } @@ -130,11 +137,11 @@ void GalileoE5aDllPllTracking::disconnect(gr::top_block_sptr top_block) gr::basic_block_sptr GalileoE5aDllPllTracking::get_left_block() { - return tracking_; + return tracking_sptr_; } gr::basic_block_sptr GalileoE5aDllPllTracking::get_right_block() { - return tracking_; + return tracking_sptr_; } diff --git a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking.h b/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking.h index 5cc1d2fc8..c739b5c47 100644 --- a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking.h +++ b/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking.h @@ -89,10 +89,10 @@ public: void stop_tracking() override; private: - dll_pll_veml_tracking_sptr tracking_; + dll_pll_veml_tracking_sptr tracking_sptr_; + std::string role_; size_t item_size_; unsigned int channel_; - std::string role_; unsigned int in_streams_; unsigned int out_streams_; }; diff --git a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.cc b/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.cc index 1f5c26140..e6dcca1ac 100644 --- a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.cc @@ -29,16 +29,22 @@ #include GalileoE5aDllPllTrackingFpga::GalileoE5aDllPllTrackingFpga( - 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 ConfigurationInterface *configuration, + const std::string &role, + unsigned int in_streams, + unsigned int out_streams) + : role_(role), + data_codes_ptr_(nullptr), + channel_(0), + in_streams_(in_streams), + out_streams_(out_streams) { Dll_Pll_Conf_Fpga trk_params_fpga = Dll_Pll_Conf_Fpga(); - DLOG(INFO) << "role " << role; - trk_params_fpga.SetFromConfiguration(configuration, role); + trk_params_fpga.SetFromConfiguration(configuration, role_); const auto vector_length = static_cast(std::round(trk_params_fpga.fs_in / (GALILEO_E5A_CODE_CHIP_RATE_CPS / GALILEO_E5A_CODE_LENGTH_CHIPS))); trk_params_fpga.vector_length = vector_length; - d_track_pilot = trk_params_fpga.track_pilot; + track_pilot_ = trk_params_fpga.track_pilot; if (trk_params_fpga.extend_correlation_symbols < 1) { trk_params_fpga.extend_correlation_symbols = 1; @@ -54,13 +60,11 @@ GalileoE5aDllPllTrackingFpga::GalileoE5aDllPllTrackingFpga( std::cout << TEXT_RED << "WARNING: Galileo E5a. PLL or DLL narrow tracking bandwidth is higher than wide tracking one" << TEXT_RESET << '\n'; } trk_params_fpga.system = 'E'; - const std::array sig_{'5', 'X', '\0'}; - std::copy_n(sig_.data(), 3, trk_params_fpga.signal); - - d_data_codes = nullptr; + const std::array sig{'5', 'X', '\0'}; + std::copy_n(sig.data(), 3, trk_params_fpga.signal); // UIO device file - device_name = configuration->property(role + ".devicename", default_device_name_Galileo_E5a); + device_name_ = configuration->property(role_ + ".devicename", default_device_name_Galileo_E5a); // compute the number of tracking channels that have already been instantiated. The order in which // GNSS-SDR instantiates the tracking channels i L1, L2, L5, E1, E5a @@ -71,12 +75,12 @@ GalileoE5aDllPllTrackingFpga::GalileoE5aDllPllTrackingFpga( uint32_t num_prev_assigned_ch_1C = configuration->property("Channels_1C.count", 0); uint32_t num_prev_assigned_ch_2S = 0; - if (configuration->property("Tracking_2S.devicename", std::string("")) != device_name) + if (configuration->property("Tracking_2S.devicename", std::string("")) != device_name_) { num_prev_assigned_ch_2S = configuration->property("Channels_2S.count", 0); } uint32_t num_prev_assigned_ch_1B = configuration->property("Channels_1B.count", 0); - num_prev_assigned_ch = num_prev_assigned_ch_1C + num_prev_assigned_ch_2S + num_prev_assigned_ch_1B; + num_prev_assigned_ch_ = num_prev_assigned_ch_1C + num_prev_assigned_ch_2S + num_prev_assigned_ch_1B; // ################# PRE-COMPUTE ALL THE CODES ################# uint32_t code_samples_per_chip = 1; @@ -84,11 +88,11 @@ GalileoE5aDllPllTrackingFpga::GalileoE5aDllPllTrackingFpga( volk_gnsssdr::vector aux_code(code_length_chips * code_samples_per_chip, gr_complex(0.0, 0.0)); - d_ca_codes = static_cast(volk_gnsssdr_malloc(static_cast(code_length_chips) * code_samples_per_chip * GALILEO_E5A_NUMBER_OF_CODES * sizeof(int32_t), volk_gnsssdr_get_alignment())); + prn_codes_ptr_ = static_cast(volk_gnsssdr_malloc(static_cast(code_length_chips) * code_samples_per_chip * GALILEO_E5A_NUMBER_OF_CODES * sizeof(int32_t), volk_gnsssdr_get_alignment())); if (trk_params_fpga.track_pilot) { - d_data_codes = static_cast(volk_gnsssdr_malloc((static_cast(code_length_chips)) * code_samples_per_chip * GALILEO_E5A_NUMBER_OF_CODES * sizeof(int32_t), volk_gnsssdr_get_alignment())); + data_codes_ptr_ = static_cast(volk_gnsssdr_malloc((static_cast(code_length_chips)) * code_samples_per_chip * GALILEO_E5A_NUMBER_OF_CODES * sizeof(int32_t), volk_gnsssdr_get_alignment())); } for (uint32_t PRN = 1; PRN <= GALILEO_E5A_NUMBER_OF_CODES; PRN++) @@ -107,7 +111,7 @@ GalileoE5aDllPllTrackingFpga::GalileoE5aDllPllTrackingFpga( tmp_value = 0; } tmp_value = tmp_value | LOCAL_CODE_FPGA_ENABLE_WRITE_MEMORY; - d_ca_codes[static_cast(code_length_chips) * (PRN - 1) + s] = tmp_value; + prn_codes_ptr_[static_cast(code_length_chips) * (PRN - 1) + s] = tmp_value; tmp_value = static_cast(aux_code[s].real()); if (tmp_value < 0) @@ -115,7 +119,7 @@ GalileoE5aDllPllTrackingFpga::GalileoE5aDllPllTrackingFpga( tmp_value = 0; } tmp_value = tmp_value | LOCAL_CODE_FPGA_ENABLE_WRITE_MEMORY | LOCAL_CODE_FPGA_CORRELATOR_SELECT_COUNT; - d_data_codes[static_cast(code_length_chips) * (PRN - 1) + s] = tmp_value; + data_codes_ptr_[static_cast(code_length_chips) * (PRN - 1) + s] = tmp_value; } } else @@ -129,20 +133,20 @@ GalileoE5aDllPllTrackingFpga::GalileoE5aDllPllTrackingFpga( tmp_value = 0; } tmp_value = tmp_value | LOCAL_CODE_FPGA_ENABLE_WRITE_MEMORY; - d_ca_codes[static_cast(code_length_chips) * (PRN - 1) + s] = tmp_value; + prn_codes_ptr_[static_cast(code_length_chips) * (PRN - 1) + s] = tmp_value; } } } - trk_params_fpga.ca_codes = d_ca_codes; - trk_params_fpga.data_codes = d_data_codes; + trk_params_fpga.ca_codes = prn_codes_ptr_; + trk_params_fpga.data_codes = data_codes_ptr_; trk_params_fpga.code_length_chips = code_length_chips; trk_params_fpga.code_samples_per_chip = code_samples_per_chip; // 2 sample per chip trk_params_fpga.extended_correlation_in_fpga = false; // by default trk_params_fpga.extend_fpga_integration_periods = 1; // (number of FPGA integrations that are combined in the SW) trk_params_fpga.fpga_integration_period = 1; // (number of symbols that are effectively integrated in the FPGA) - if (d_track_pilot) + if (track_pilot_) { if (trk_params_fpga.extend_correlation_symbols > 1) { @@ -167,10 +171,9 @@ GalileoE5aDllPllTrackingFpga::GalileoE5aDllPllTrackingFpga( } // ################# MAKE TRACKING GNURadio object ################### - tracking_fpga_sc = dll_pll_veml_make_tracking_fpga(trk_params_fpga); - channel_ = 0; - - DLOG(INFO) << "tracking(" << tracking_fpga_sc->unique_id() << ")"; + DLOG(INFO) << "role " << role_; + tracking_fpga_sc_sptr_ = dll_pll_veml_make_tracking_fpga(trk_params_fpga); + DLOG(INFO) << "tracking(" << tracking_fpga_sc_sptr_->unique_id() << ")"; if (in_streams_ > 1) { @@ -185,23 +188,23 @@ GalileoE5aDllPllTrackingFpga::GalileoE5aDllPllTrackingFpga( GalileoE5aDllPllTrackingFpga::~GalileoE5aDllPllTrackingFpga() { - volk_gnsssdr_free(d_ca_codes); - if (d_track_pilot) + volk_gnsssdr_free(prn_codes_ptr_); + if (track_pilot_) { - volk_gnsssdr_free(d_data_codes); + volk_gnsssdr_free(data_codes_ptr_); } } void GalileoE5aDllPllTrackingFpga::start_tracking() { - tracking_fpga_sc->start_tracking(); + tracking_fpga_sc_sptr_->start_tracking(); } void GalileoE5aDllPllTrackingFpga::stop_tracking() { - tracking_fpga_sc->stop_tracking(); + tracking_fpga_sc_sptr_->stop_tracking(); } @@ -215,18 +218,18 @@ void GalileoE5aDllPllTrackingFpga::set_channel(unsigned int channel) // UIO device file std::string device_io_name; // find the uio device file corresponding to the tracking multicorrelator - if (find_uio_dev_file_name(device_io_name, device_name, channel - num_prev_assigned_ch) < 0) + if (find_uio_dev_file_name(device_io_name, device_name_, channel_ - num_prev_assigned_ch_) < 0) { - std::cout << "Cannot find the FPGA uio device file corresponding to device name " << device_name << std::endl; + std::cout << "Cannot find the FPGA uio device file corresponding to device name " << device_name_ << std::endl; throw std::exception(); } - tracking_fpga_sc->set_channel(channel, device_io_name); + tracking_fpga_sc_sptr_->set_channel(channel_, device_io_name); } void GalileoE5aDllPllTrackingFpga::set_gnss_synchro(Gnss_Synchro *p_gnss_synchro) { - tracking_fpga_sc->set_gnss_synchro(p_gnss_synchro); + tracking_fpga_sc_sptr_->set_gnss_synchro(p_gnss_synchro); } @@ -250,11 +253,11 @@ void GalileoE5aDllPllTrackingFpga::disconnect(gr::top_block_sptr top_block) gr::basic_block_sptr GalileoE5aDllPllTrackingFpga::get_left_block() { - return tracking_fpga_sc; + return tracking_fpga_sc_sptr_; } gr::basic_block_sptr GalileoE5aDllPllTrackingFpga::get_right_block() { - return tracking_fpga_sc; + return tracking_fpga_sc_sptr_; } diff --git a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.h b/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.h index f87d1274a..510df45ea 100644 --- a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.h +++ b/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.h @@ -123,17 +123,16 @@ private: static const int32_t LOCAL_CODE_FPGA_ENABLE_WRITE_MEMORY = 0x0C000000; // flag that enables WE (Write Enable) of the local code FPGA static const int32_t LOCAL_CODE_FPGA_CORRELATOR_SELECT_COUNT = 0x20000000; // flag that selects the writing of the pilot code in the FPGA (as opposed to the data code) - std::string device_name; - uint32_t num_prev_assigned_ch; - - dll_pll_veml_tracking_fpga_sptr tracking_fpga_sc; - uint32_t channel_; + dll_pll_veml_tracking_fpga_sptr tracking_fpga_sc_sptr_; std::string role_; + std::string device_name_; + int32_t* prn_codes_ptr_; + int32_t* data_codes_ptr_; + uint32_t num_prev_assigned_ch_; + uint32_t channel_; uint32_t in_streams_; uint32_t out_streams_; - int32_t* d_ca_codes; - int32_t* d_data_codes; - bool d_track_pilot; + bool track_pilot_; }; diff --git a/src/algorithms/tracking/adapters/galileo_e5b_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/galileo_e5b_dll_pll_tracking.cc index 1d4e53be8..61df5df98 100644 --- a/src/algorithms/tracking/adapters/galileo_e5b_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/galileo_e5b_dll_pll_tracking.cc @@ -32,12 +32,18 @@ #include GalileoE5bDllPllTracking::GalileoE5bDllPllTracking( - 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 ConfigurationInterface* configuration, + const std::string& role, + unsigned int in_streams, + unsigned int out_streams) + : role_(role), + item_size_(sizeof(gr_complex)), + channel_(0), + in_streams_(in_streams), + out_streams_(out_streams) { Dll_Pll_Conf trk_params = Dll_Pll_Conf(); - DLOG(INFO) << "role " << role; - trk_params.SetFromConfiguration(configuration, role); + trk_params.SetFromConfiguration(configuration, role_); const auto vector_length = static_cast(std::round(trk_params.fs_in / (GALILEO_E5B_CODE_CHIP_RATE_CPS / GALILEO_E5B_CODE_LENGTH_CHIPS))); trk_params.vector_length = vector_length; @@ -56,22 +62,23 @@ GalileoE5bDllPllTracking::GalileoE5bDllPllTracking( std::cout << TEXT_RED << "WARNING: Galileo E5b. PLL or DLL narrow tracking bandwidth is higher than wide tracking one" << TEXT_RESET << '\n'; } trk_params.system = 'E'; - const std::array sig_{'7', 'X', '\0'}; - std::copy_n(sig_.data(), 3, trk_params.signal); + const std::array sig{'7', 'X', '\0'}; + std::copy_n(sig.data(), 3, trk_params.signal); // ################# Make a GNU Radio Tracking block object ################ + DLOG(INFO) << "role " << role_; if (trk_params.item_type == "gr_complex") { - item_size_ = sizeof(gr_complex); - tracking_ = dll_pll_veml_make_tracking(trk_params); + tracking_sptr_ = dll_pll_veml_make_tracking(trk_params); + DLOG(INFO) << "tracking(" << tracking_sptr_->unique_id() << ")"; } else { item_size_ = 0; + tracking_sptr_ = nullptr; LOG(WARNING) << trk_params.item_type << " unknown tracking item type."; } - channel_ = 0; - DLOG(INFO) << "tracking(" << tracking_->unique_id() << ")"; + if (in_streams_ > 1) { LOG(ERROR) << "This implementation only supports one input stream"; @@ -85,13 +92,13 @@ GalileoE5bDllPllTracking::GalileoE5bDllPllTracking( void GalileoE5bDllPllTracking::stop_tracking() { - tracking_->stop_tracking(); + tracking_sptr_->stop_tracking(); } void GalileoE5bDllPllTracking::start_tracking() { - tracking_->start_tracking(); + tracking_sptr_->start_tracking(); } @@ -101,13 +108,13 @@ void GalileoE5bDllPllTracking::start_tracking() void GalileoE5bDllPllTracking::set_channel(unsigned int channel) { channel_ = channel; - tracking_->set_channel(channel); + tracking_sptr_->set_channel(channel); } void GalileoE5bDllPllTracking::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) { - tracking_->set_gnss_synchro(p_gnss_synchro); + tracking_sptr_->set_gnss_synchro(p_gnss_synchro); } @@ -133,11 +140,11 @@ void GalileoE5bDllPllTracking::disconnect(gr::top_block_sptr top_block) gr::basic_block_sptr GalileoE5bDllPllTracking::get_left_block() { - return tracking_; + return tracking_sptr_; } gr::basic_block_sptr GalileoE5bDllPllTracking::get_right_block() { - return tracking_; + return tracking_sptr_; } diff --git a/src/algorithms/tracking/adapters/galileo_e5b_dll_pll_tracking.h b/src/algorithms/tracking/adapters/galileo_e5b_dll_pll_tracking.h index bda52e3de..dad64de44 100644 --- a/src/algorithms/tracking/adapters/galileo_e5b_dll_pll_tracking.h +++ b/src/algorithms/tracking/adapters/galileo_e5b_dll_pll_tracking.h @@ -105,10 +105,10 @@ public: void stop_tracking() override; private: - dll_pll_veml_tracking_sptr tracking_; + dll_pll_veml_tracking_sptr tracking_sptr_; + std::string role_; size_t item_size_; unsigned int channel_; - std::string role_; unsigned int in_streams_; unsigned int out_streams_; }; diff --git a/src/algorithms/tracking/adapters/galileo_e6_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/galileo_e6_dll_pll_tracking.cc index 267a33ce4..ca01034d4 100644 --- a/src/algorithms/tracking/adapters/galileo_e6_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/galileo_e6_dll_pll_tracking.cc @@ -27,12 +27,18 @@ #include GalileoE6DllPllTracking::GalileoE6DllPllTracking( - 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 ConfigurationInterface* configuration, + const std::string& role, + unsigned int in_streams, + unsigned int out_streams) + : role_(role), + item_size_(sizeof(gr_complex)), + channel_(0), + in_streams_(in_streams), + out_streams_(out_streams) { Dll_Pll_Conf trk_params = Dll_Pll_Conf(); - DLOG(INFO) << "role " << role; - trk_params.SetFromConfiguration(configuration, role); + trk_params.SetFromConfiguration(configuration, role_); const auto vector_length = static_cast(std::round(trk_params.fs_in / (GALILEO_E6_B_CODE_CHIP_RATE_CPS / GALILEO_E6_B_CODE_LENGTH_CHIPS))); trk_params.vector_length = vector_length; @@ -51,22 +57,23 @@ GalileoE6DllPllTracking::GalileoE6DllPllTracking( std::cout << TEXT_RED << "WARNING: Galileo E5b. PLL or DLL narrow tracking bandwidth is higher than wide tracking one" << TEXT_RESET << '\n'; } trk_params.system = 'E'; - const std::array sig_{'E', '6', '\0'}; - std::copy_n(sig_.data(), 3, trk_params.signal); + const std::array sig{'E', '6', '\0'}; + std::copy_n(sig.data(), 3, trk_params.signal); // ################# Make a GNU Radio Tracking block object ################ + DLOG(INFO) << "role " << role_; if (trk_params.item_type == "gr_complex") { - item_size_ = sizeof(gr_complex); - tracking_ = dll_pll_veml_make_tracking(trk_params); + tracking_sptr_ = dll_pll_veml_make_tracking(trk_params); + DLOG(INFO) << "tracking(" << tracking_sptr_->unique_id() << ")"; } else { item_size_ = 0; + tracking_sptr_ = nullptr; LOG(WARNING) << trk_params.item_type << " unknown tracking item type."; } - channel_ = 0; - DLOG(INFO) << "tracking(" << tracking_->unique_id() << ")"; + if (in_streams_ > 1) { LOG(ERROR) << "This implementation only supports one input stream"; @@ -80,13 +87,13 @@ GalileoE6DllPllTracking::GalileoE6DllPllTracking( void GalileoE6DllPllTracking::stop_tracking() { - tracking_->stop_tracking(); + tracking_sptr_->stop_tracking(); } void GalileoE6DllPllTracking::start_tracking() { - tracking_->start_tracking(); + tracking_sptr_->start_tracking(); } @@ -96,13 +103,13 @@ void GalileoE6DllPllTracking::start_tracking() void GalileoE6DllPllTracking::set_channel(unsigned int channel) { channel_ = channel; - tracking_->set_channel(channel); + tracking_sptr_->set_channel(channel); } void GalileoE6DllPllTracking::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) { - tracking_->set_gnss_synchro(p_gnss_synchro); + tracking_sptr_->set_gnss_synchro(p_gnss_synchro); } @@ -128,11 +135,11 @@ void GalileoE6DllPllTracking::disconnect(gr::top_block_sptr top_block) gr::basic_block_sptr GalileoE6DllPllTracking::get_left_block() { - return tracking_; + return tracking_sptr_; } gr::basic_block_sptr GalileoE6DllPllTracking::get_right_block() { - return tracking_; + return tracking_sptr_; } diff --git a/src/algorithms/tracking/adapters/galileo_e6_dll_pll_tracking.h b/src/algorithms/tracking/adapters/galileo_e6_dll_pll_tracking.h index d4a66c50f..381711d5a 100644 --- a/src/algorithms/tracking/adapters/galileo_e6_dll_pll_tracking.h +++ b/src/algorithms/tracking/adapters/galileo_e6_dll_pll_tracking.h @@ -100,10 +100,10 @@ public: void stop_tracking() override; private: - dll_pll_veml_tracking_sptr tracking_; + dll_pll_veml_tracking_sptr tracking_sptr_; + std::string role_; size_t item_size_; unsigned int channel_; - std::string role_; unsigned int in_streams_; unsigned int out_streams_; }; diff --git a/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_c_aid_tracking.cc b/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_c_aid_tracking.cc index 3cb81f43c..460a6f2df 100644 --- a/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_c_aid_tracking.cc +++ b/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_c_aid_tracking.cc @@ -31,40 +31,46 @@ GlonassL1CaDllPllCAidTracking::GlonassL1CaDllPllCAidTracking( - 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 ConfigurationInterface* configuration, + const std::string& role, + unsigned int in_streams, + unsigned int out_streams) + : role_(role), + item_size_(sizeof(gr_complex)), + channel_(0), + in_streams_(in_streams), + out_streams_(out_streams) { - DLOG(INFO) << "role " << role; // ################# CONFIGURATION PARAMETERS ######################## const std::string default_item_type("gr_complex"); - item_type_ = configuration->property(role + ".item_type", default_item_type); + item_type_ = configuration->property(role_ + ".item_type", default_item_type); int fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); int fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - bool dump = configuration->property(role + ".dump", false); - float pll_bw_hz = configuration->property(role + ".pll_bw_hz", static_cast(50.0)); + bool dump = configuration->property(role_ + ".dump", false); + float pll_bw_hz = configuration->property(role_ + ".pll_bw_hz", static_cast(50.0)); if (FLAGS_pll_bw_hz != 0.0) { pll_bw_hz = static_cast(FLAGS_pll_bw_hz); } - float dll_bw_hz = configuration->property(role + ".dll_bw_hz", static_cast(2.0)); + float dll_bw_hz = configuration->property(role_ + ".dll_bw_hz", static_cast(2.0)); if (FLAGS_dll_bw_hz != 0.0) { dll_bw_hz = static_cast(FLAGS_dll_bw_hz); } - float pll_bw_narrow_hz = configuration->property(role + ".pll_bw_narrow_hz", static_cast(20.0)); - float dll_bw_narrow_hz = configuration->property(role + ".dll_bw_narrow_hz", static_cast(2.0)); - int extend_correlation_ms = configuration->property(role + ".extend_correlation_ms", 1); + float pll_bw_narrow_hz = configuration->property(role_ + ".pll_bw_narrow_hz", static_cast(20.0)); + float dll_bw_narrow_hz = configuration->property(role_ + ".dll_bw_narrow_hz", static_cast(2.0)); + int extend_correlation_ms = configuration->property(role_ + ".extend_correlation_ms", 1); - float early_late_space_chips = configuration->property(role + ".early_late_space_chips", static_cast(0.5)); + float early_late_space_chips = configuration->property(role_ + ".early_late_space_chips", static_cast(0.5)); const std::string default_dump_filename("./track_ch"); - std::string dump_filename = configuration->property(role + ".dump_filename", default_dump_filename); + std::string dump_filename = configuration->property(role_ + ".dump_filename", default_dump_filename); const auto vector_length = static_cast(std::round(fs_in / (GLONASS_L1_CA_CODE_RATE_CPS / GLONASS_L1_CA_CODE_LENGTH_CHIPS))); // ################# MAKE TRACKING GNURadio object ################### + DLOG(INFO) << "role " << role_; if (item_type_ == "gr_complex") { - item_size_ = sizeof(gr_complex); - tracking_cc = glonass_l1_ca_dll_pll_c_aid_make_tracking_cc( + tracking_cc_sptr_ = glonass_l1_ca_dll_pll_c_aid_make_tracking_cc( fs_in, vector_length, dump, @@ -75,12 +81,13 @@ GlonassL1CaDllPllCAidTracking::GlonassL1CaDllPllCAidTracking( dll_bw_narrow_hz, extend_correlation_ms, early_late_space_chips); - DLOG(INFO) << "tracking(" << tracking_cc->unique_id() << ")"; + tracking_sc_sptr_ = nullptr; + DLOG(INFO) << "tracking(" << tracking_cc_sptr_->unique_id() << ")"; } else if (item_type_ == "cshort") { item_size_ = sizeof(lv_16sc_t); - tracking_sc = glonass_l1_ca_dll_pll_c_aid_make_tracking_sc( + tracking_sc_sptr_ = glonass_l1_ca_dll_pll_c_aid_make_tracking_sc( fs_in, vector_length, dump, @@ -91,14 +98,17 @@ GlonassL1CaDllPllCAidTracking::GlonassL1CaDllPllCAidTracking( dll_bw_narrow_hz, extend_correlation_ms, early_late_space_chips); - DLOG(INFO) << "tracking(" << tracking_sc->unique_id() << ")"; + tracking_cc_sptr_ = nullptr; + DLOG(INFO) << "tracking(" << tracking_sc_sptr_->unique_id() << ")"; } else { item_size_ = 0; + tracking_sc_sptr_ = nullptr; + tracking_cc_sptr_ = nullptr; LOG(WARNING) << item_type_ << " unknown tracking item type."; } - channel_ = 0; + if (in_streams_ > 1) { LOG(ERROR) << "This implementation only supports one input stream"; @@ -119,11 +129,11 @@ void GlonassL1CaDllPllCAidTracking::start_tracking() { if (item_type_ == "gr_complex") { - tracking_cc->start_tracking(); + tracking_cc_sptr_->start_tracking(); } else if (item_type_ == "cshort") { - tracking_sc->start_tracking(); + tracking_sc_sptr_->start_tracking(); } else { @@ -141,11 +151,11 @@ void GlonassL1CaDllPllCAidTracking::set_channel(unsigned int channel) if (item_type_ == "gr_complex") { - tracking_cc->set_channel(channel); + tracking_cc_sptr_->set_channel(channel); } else if (item_type_ == "cshort") { - tracking_sc->set_channel(channel); + tracking_sc_sptr_->set_channel(channel); } else { @@ -158,11 +168,11 @@ void GlonassL1CaDllPllCAidTracking::set_gnss_synchro(Gnss_Synchro* p_gnss_synchr { if (item_type_ == "gr_complex") { - tracking_cc->set_gnss_synchro(p_gnss_synchro); + tracking_cc_sptr_->set_gnss_synchro(p_gnss_synchro); } else if (item_type_ == "cshort") { - tracking_sc->set_gnss_synchro(p_gnss_synchro); + tracking_sc_sptr_->set_gnss_synchro(p_gnss_synchro); } else { @@ -193,11 +203,11 @@ gr::basic_block_sptr GlonassL1CaDllPllCAidTracking::get_left_block() { if (item_type_ == "gr_complex") { - return tracking_cc; + return tracking_cc_sptr_; } if (item_type_ == "cshort") { - return tracking_sc; + return tracking_sc_sptr_; } LOG(WARNING) << item_type_ << " unknown tracking item type"; return nullptr; @@ -208,11 +218,11 @@ gr::basic_block_sptr GlonassL1CaDllPllCAidTracking::get_right_block() { if (item_type_ == "gr_complex") { - return tracking_cc; + return tracking_cc_sptr_; } if (item_type_ == "cshort") { - return tracking_sc; + return tracking_sc_sptr_; } diff --git a/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_c_aid_tracking.h b/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_c_aid_tracking.h index ff535bb97..303396eef 100644 --- a/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_c_aid_tracking.h +++ b/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_c_aid_tracking.h @@ -92,12 +92,12 @@ public: void stop_tracking() override; private: - glonass_l1_ca_dll_pll_c_aid_tracking_cc_sptr tracking_cc; - glonass_l1_ca_dll_pll_c_aid_tracking_sc_sptr tracking_sc; - size_t item_size_; - std::string item_type_; - unsigned int channel_; + glonass_l1_ca_dll_pll_c_aid_tracking_cc_sptr tracking_cc_sptr_; + glonass_l1_ca_dll_pll_c_aid_tracking_sc_sptr tracking_sc_sptr_; std::string role_; + std::string item_type_; + size_t item_size_; + unsigned int channel_; unsigned int in_streams_; unsigned int out_streams_; }; diff --git a/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_tracking.cc index 253f82774..769c15dd0 100644 --- a/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_tracking.cc @@ -30,36 +30,42 @@ GlonassL1CaDllPllTracking::GlonassL1CaDllPllTracking( - 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 ConfigurationInterface* configuration, + const std::string& role, + unsigned int in_streams, + unsigned int out_streams) + : role_(role), + item_size_(sizeof(gr_complex)), + channel_(0), + in_streams_(in_streams), + out_streams_(out_streams) { - DLOG(INFO) << "role " << role; // ################# CONFIGURATION PARAMETERS ######################## const std::string default_item_type("gr_complex"); - std::string item_type = configuration->property(role + ".item_type", default_item_type); + std::string item_type = configuration->property(role_ + ".item_type", default_item_type); int fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); int fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - bool dump = configuration->property(role + ".dump", false); - float pll_bw_hz = configuration->property(role + ".pll_bw_hz", static_cast(50.0)); + bool dump = configuration->property(role_ + ".dump", false); + float pll_bw_hz = configuration->property(role_ + ".pll_bw_hz", static_cast(50.0)); if (FLAGS_pll_bw_hz != 0.0) { pll_bw_hz = static_cast(FLAGS_pll_bw_hz); } - float dll_bw_hz = configuration->property(role + ".dll_bw_hz", static_cast(2.0)); + float dll_bw_hz = configuration->property(role_ + ".dll_bw_hz", static_cast(2.0)); if (FLAGS_dll_bw_hz != 0.0) { dll_bw_hz = static_cast(FLAGS_dll_bw_hz); } - float early_late_space_chips = configuration->property(role + ".early_late_space_chips", static_cast(0.5)); + float early_late_space_chips = configuration->property(role_ + ".early_late_space_chips", static_cast(0.5)); const std::string default_dump_filename("./track_ch"); - std::string dump_filename = configuration->property(role + ".dump_filename", default_dump_filename); + std::string dump_filename = configuration->property(role_ + ".dump_filename", default_dump_filename); const auto vector_length = static_cast(std::round(fs_in / (GLONASS_L1_CA_CODE_RATE_CPS / GLONASS_L1_CA_CODE_LENGTH_CHIPS))); // ################# MAKE TRACKING GNURadio object ################### + DLOG(INFO) << "role " << role_; if (item_type == "gr_complex") { - item_size_ = sizeof(gr_complex); - tracking_ = glonass_l1_ca_dll_pll_make_tracking_cc( + tracking_sptr_ = glonass_l1_ca_dll_pll_make_tracking_cc( fs_in, vector_length, dump, @@ -67,14 +73,15 @@ GlonassL1CaDllPllTracking::GlonassL1CaDllPllTracking( pll_bw_hz, dll_bw_hz, early_late_space_chips); + DLOG(INFO) << "tracking(" << tracking_sptr_->unique_id() << ")"; } else { item_size_ = 0; + tracking_sptr_ = nullptr; LOG(WARNING) << item_type << " unknown tracking item type."; } - channel_ = 0; - DLOG(INFO) << "tracking(" << tracking_->unique_id() << ")"; + if (in_streams_ > 1) { LOG(ERROR) << "This implementation only supports one input stream"; @@ -93,7 +100,7 @@ void GlonassL1CaDllPllTracking::stop_tracking() void GlonassL1CaDllPllTracking::start_tracking() { - tracking_->start_tracking(); + tracking_sptr_->start_tracking(); } @@ -103,13 +110,13 @@ void GlonassL1CaDllPllTracking::start_tracking() void GlonassL1CaDllPllTracking::set_channel(unsigned int channel) { channel_ = channel; - tracking_->set_channel(channel); + tracking_sptr_->set_channel(channel); } void GlonassL1CaDllPllTracking::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) { - tracking_->set_gnss_synchro(p_gnss_synchro); + tracking_sptr_->set_gnss_synchro(p_gnss_synchro); } @@ -133,11 +140,11 @@ void GlonassL1CaDllPllTracking::disconnect(gr::top_block_sptr top_block) gr::basic_block_sptr GlonassL1CaDllPllTracking::get_left_block() { - return tracking_; + return tracking_sptr_; } gr::basic_block_sptr GlonassL1CaDllPllTracking::get_right_block() { - return tracking_; + return tracking_sptr_; } diff --git a/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_tracking.h b/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_tracking.h index dae9bbf58..5d37da327 100644 --- a/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_tracking.h +++ b/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_tracking.h @@ -91,10 +91,10 @@ public: void stop_tracking() override; private: - glonass_l1_ca_dll_pll_tracking_cc_sptr tracking_; + glonass_l1_ca_dll_pll_tracking_cc_sptr tracking_sptr_; + std::string role_; size_t item_size_; unsigned int channel_; - std::string role_; unsigned int in_streams_; unsigned int out_streams_; }; diff --git a/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_c_aid_tracking.cc b/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_c_aid_tracking.cc index 1cd2f6cf1..3da79c423 100644 --- a/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_c_aid_tracking.cc +++ b/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_c_aid_tracking.cc @@ -29,40 +29,46 @@ GlonassL2CaDllPllCAidTracking::GlonassL2CaDllPllCAidTracking( - 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 ConfigurationInterface* configuration, + const std::string& role, + unsigned int in_streams, + unsigned int out_streams) + : role_(role), + item_size_(sizeof(gr_complex)), + channel_(0), + in_streams_(in_streams), + out_streams_(out_streams) { - DLOG(INFO) << "role " << role; // ################# CONFIGURATION PARAMETERS ######################## const std::string default_item_type("gr_complex"); - item_type_ = configuration->property(role + ".item_type", default_item_type); + item_type_ = configuration->property(role_ + ".item_type", default_item_type); int fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); int fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - bool dump = configuration->property(role + ".dump", false); - float pll_bw_hz = configuration->property(role + ".pll_bw_hz", static_cast(50.0)); + bool dump = configuration->property(role_ + ".dump", false); + float pll_bw_hz = configuration->property(role_ + ".pll_bw_hz", static_cast(50.0)); if (FLAGS_pll_bw_hz != 0.0) { pll_bw_hz = static_cast(FLAGS_pll_bw_hz); } - float dll_bw_hz = configuration->property(role + ".dll_bw_hz", static_cast(2.0)); + float dll_bw_hz = configuration->property(role_ + ".dll_bw_hz", static_cast(2.0)); if (FLAGS_dll_bw_hz != 0.0) { dll_bw_hz = static_cast(FLAGS_dll_bw_hz); } - float pll_bw_narrow_hz = configuration->property(role + ".pll_bw_narrow_hz", static_cast(20.0)); - float dll_bw_narrow_hz = configuration->property(role + ".dll_bw_narrow_hz", static_cast(2.0)); - int extend_correlation_ms = configuration->property(role + ".extend_correlation_ms", 1); + float pll_bw_narrow_hz = configuration->property(role_ + ".pll_bw_narrow_hz", static_cast(20.0)); + float dll_bw_narrow_hz = configuration->property(role_ + ".dll_bw_narrow_hz", static_cast(2.0)); + int extend_correlation_ms = configuration->property(role_ + ".extend_correlation_ms", 1); - float early_late_space_chips = configuration->property(role + ".early_late_space_chips", static_cast(0.5)); + float early_late_space_chips = configuration->property(role_ + ".early_late_space_chips", static_cast(0.5)); const std::string default_dump_filename("./track_ch"); - std::string dump_filename = configuration->property(role + ".dump_filename", default_dump_filename); + std::string dump_filename = configuration->property(role_ + ".dump_filename", default_dump_filename); const auto vector_length = static_cast(std::round(fs_in / (GLONASS_L2_CA_CODE_RATE_CPS / GLONASS_L2_CA_CODE_LENGTH_CHIPS))); // ################# MAKE TRACKING GNURadio object ################### + DLOG(INFO) << "role " << role_; if (item_type_ == "gr_complex") { - item_size_ = sizeof(gr_complex); - tracking_cc = glonass_l2_ca_dll_pll_c_aid_make_tracking_cc( + tracking_cc_sptr_ = glonass_l2_ca_dll_pll_c_aid_make_tracking_cc( fs_in, vector_length, dump, @@ -73,12 +79,13 @@ GlonassL2CaDllPllCAidTracking::GlonassL2CaDllPllCAidTracking( dll_bw_narrow_hz, extend_correlation_ms, early_late_space_chips); - DLOG(INFO) << "tracking(" << tracking_cc->unique_id() << ")"; + tracking_sc_sptr_ = nullptr; + DLOG(INFO) << "tracking(" << tracking_cc_sptr_->unique_id() << ")"; } else if (item_type_ == "cshort") { item_size_ = sizeof(lv_16sc_t); - tracking_sc = glonass_l2_ca_dll_pll_c_aid_make_tracking_sc( + tracking_sc_sptr_ = glonass_l2_ca_dll_pll_c_aid_make_tracking_sc( fs_in, vector_length, dump, @@ -89,14 +96,17 @@ GlonassL2CaDllPllCAidTracking::GlonassL2CaDllPllCAidTracking( dll_bw_narrow_hz, extend_correlation_ms, early_late_space_chips); - DLOG(INFO) << "tracking(" << tracking_sc->unique_id() << ")"; + tracking_cc_sptr_ = nullptr; + DLOG(INFO) << "tracking(" << tracking_sc_sptr_->unique_id() << ")"; } else { item_size_ = 0; + tracking_sc_sptr_ = nullptr; + tracking_cc_sptr_ = nullptr; LOG(WARNING) << item_type_ << " unknown tracking item type."; } - channel_ = 0; + if (in_streams_ > 1) { LOG(ERROR) << "This implementation only supports one input stream"; @@ -117,11 +127,11 @@ void GlonassL2CaDllPllCAidTracking::start_tracking() { if (item_type_ == "gr_complex") { - tracking_cc->start_tracking(); + tracking_cc_sptr_->start_tracking(); } else if (item_type_ == "cshort") { - tracking_sc->start_tracking(); + tracking_sc_sptr_->start_tracking(); } else { @@ -139,11 +149,11 @@ void GlonassL2CaDllPllCAidTracking::set_channel(unsigned int channel) if (item_type_ == "gr_complex") { - tracking_cc->set_channel(channel); + tracking_cc_sptr_->set_channel(channel); } else if (item_type_ == "cshort") { - tracking_sc->set_channel(channel); + tracking_sc_sptr_->set_channel(channel); } else { @@ -156,11 +166,11 @@ void GlonassL2CaDllPllCAidTracking::set_gnss_synchro(Gnss_Synchro* p_gnss_synchr { if (item_type_ == "gr_complex") { - tracking_cc->set_gnss_synchro(p_gnss_synchro); + tracking_cc_sptr_->set_gnss_synchro(p_gnss_synchro); } else if (item_type_ == "cshort") { - tracking_sc->set_gnss_synchro(p_gnss_synchro); + tracking_sc_sptr_->set_gnss_synchro(p_gnss_synchro); } else { @@ -191,11 +201,11 @@ gr::basic_block_sptr GlonassL2CaDllPllCAidTracking::get_left_block() { if (item_type_ == "gr_complex") { - return tracking_cc; + return tracking_cc_sptr_; } if (item_type_ == "cshort") { - return tracking_sc; + return tracking_sc_sptr_; } LOG(WARNING) << item_type_ << " unknown tracking item type"; return nullptr; @@ -206,11 +216,11 @@ gr::basic_block_sptr GlonassL2CaDllPllCAidTracking::get_right_block() { if (item_type_ == "gr_complex") { - return tracking_cc; + return tracking_cc_sptr_; } if (item_type_ == "cshort") { - return tracking_sc; + return tracking_sc_sptr_; } LOG(WARNING) << item_type_ << " unknown tracking item type"; return nullptr; diff --git a/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_c_aid_tracking.h b/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_c_aid_tracking.h index 65a2754ea..d24febe93 100644 --- a/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_c_aid_tracking.h +++ b/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_c_aid_tracking.h @@ -91,12 +91,12 @@ public: void stop_tracking() override; private: - glonass_l2_ca_dll_pll_c_aid_tracking_cc_sptr tracking_cc; - glonass_l2_ca_dll_pll_c_aid_tracking_sc_sptr tracking_sc; - size_t item_size_; - std::string item_type_; - unsigned int channel_; + glonass_l2_ca_dll_pll_c_aid_tracking_cc_sptr tracking_cc_sptr_; + glonass_l2_ca_dll_pll_c_aid_tracking_sc_sptr tracking_sc_sptr_; std::string role_; + std::string item_type_; + size_t item_size_; + unsigned int channel_; unsigned int in_streams_; unsigned int out_streams_; }; diff --git a/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_tracking.cc index 0ce3c1291..283f10ed1 100644 --- a/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_tracking.cc @@ -28,36 +28,42 @@ GlonassL2CaDllPllTracking::GlonassL2CaDllPllTracking( - 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 ConfigurationInterface* configuration, + const std::string& role, + unsigned int in_streams, + unsigned int out_streams) + : role_(role), + item_size_(sizeof(gr_complex)), + channel_(0), + in_streams_(in_streams), + out_streams_(out_streams) { - DLOG(INFO) << "role " << role; // ################# CONFIGURATION PARAMETERS ######################## const std::string default_item_type("gr_complex"); - std::string item_type = configuration->property(role + ".item_type", default_item_type); + std::string item_type = configuration->property(role_ + ".item_type", default_item_type); int fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); int fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - bool dump = configuration->property(role + ".dump", false); - float pll_bw_hz = configuration->property(role + ".pll_bw_hz", static_cast(50.0)); + bool dump = configuration->property(role_ + ".dump", false); + float pll_bw_hz = configuration->property(role_ + ".pll_bw_hz", static_cast(50.0)); if (FLAGS_pll_bw_hz != 0.0) { pll_bw_hz = static_cast(FLAGS_pll_bw_hz); } - float dll_bw_hz = configuration->property(role + ".dll_bw_hz", static_cast(2.0)); + float dll_bw_hz = configuration->property(role_ + ".dll_bw_hz", static_cast(2.0)); if (FLAGS_dll_bw_hz != 0.0) { dll_bw_hz = static_cast(FLAGS_dll_bw_hz); } - float early_late_space_chips = configuration->property(role + ".early_late_space_chips", static_cast(0.5)); + float early_late_space_chips = configuration->property(role_ + ".early_late_space_chips", static_cast(0.5)); const std::string default_dump_filename("./track_ch"); - std::string dump_filename = configuration->property(role + ".dump_filename", default_dump_filename); + std::string dump_filename = configuration->property(role_ + ".dump_filename", default_dump_filename); const auto vector_length = static_cast(std::round(fs_in / (GLONASS_L2_CA_CODE_RATE_CPS / GLONASS_L2_CA_CODE_LENGTH_CHIPS))); // ################# MAKE TRACKING GNURadio object ################### + DLOG(INFO) << "role " << role_; if (item_type == "gr_complex") { - item_size_ = sizeof(gr_complex); - tracking_ = glonass_l2_ca_dll_pll_make_tracking_cc( + tracking_sptr_ = glonass_l2_ca_dll_pll_make_tracking_cc( fs_in, vector_length, dump, @@ -65,14 +71,15 @@ GlonassL2CaDllPllTracking::GlonassL2CaDllPllTracking( pll_bw_hz, dll_bw_hz, early_late_space_chips); + DLOG(INFO) << "tracking(" << tracking_sptr_->unique_id() << ")"; } else { item_size_ = 0; + tracking_sptr_ = nullptr; LOG(WARNING) << item_type << " unknown tracking item type."; } - channel_ = 0; - DLOG(INFO) << "tracking(" << tracking_->unique_id() << ")"; + if (in_streams_ > 1) { LOG(ERROR) << "This implementation only supports one input stream"; @@ -91,7 +98,7 @@ void GlonassL2CaDllPllTracking::stop_tracking() void GlonassL2CaDllPllTracking::start_tracking() { - tracking_->start_tracking(); + tracking_sptr_->start_tracking(); } @@ -101,13 +108,13 @@ void GlonassL2CaDllPllTracking::start_tracking() void GlonassL2CaDllPllTracking::set_channel(unsigned int channel) { channel_ = channel; - tracking_->set_channel(channel); + tracking_sptr_->set_channel(channel); } void GlonassL2CaDllPllTracking::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) { - tracking_->set_gnss_synchro(p_gnss_synchro); + tracking_sptr_->set_gnss_synchro(p_gnss_synchro); } @@ -131,11 +138,11 @@ void GlonassL2CaDllPllTracking::disconnect(gr::top_block_sptr top_block) gr::basic_block_sptr GlonassL2CaDllPllTracking::get_left_block() { - return tracking_; + return tracking_sptr_; } gr::basic_block_sptr GlonassL2CaDllPllTracking::get_right_block() { - return tracking_; + return tracking_sptr_; } diff --git a/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_tracking.h b/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_tracking.h index 1bc541c3a..69b035703 100644 --- a/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_tracking.h +++ b/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_tracking.h @@ -90,10 +90,10 @@ public: void stop_tracking() override; private: - glonass_l2_ca_dll_pll_tracking_cc_sptr tracking_; + glonass_l2_ca_dll_pll_tracking_cc_sptr tracking_sptr_; + std::string role_; size_t item_size_; unsigned int channel_; - std::string role_; unsigned int in_streams_; unsigned int out_streams_; }; diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking.cc index bb901f9d5..00cccbe97 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking.cc @@ -32,12 +32,17 @@ #include GpsL1CaDllPllTracking::GpsL1CaDllPllTracking( - 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 ConfigurationInterface* configuration, + const std::string& role, + unsigned int in_streams, unsigned int out_streams) + : role_(role), + item_size_(sizeof(gr_complex)), + channel_(0), + in_streams_(in_streams), + out_streams_(out_streams) { Dll_Pll_Conf trk_params = Dll_Pll_Conf(); - DLOG(INFO) << "role " << role; - trk_params.SetFromConfiguration(configuration, role); + trk_params.SetFromConfiguration(configuration, role_); const auto vector_length = static_cast(std::round(trk_params.fs_in / (GPS_L1_CA_CODE_RATE_CPS / GPS_L1_CA_CODE_LENGTH_CHIPS))); trk_params.vector_length = vector_length; @@ -51,7 +56,7 @@ GpsL1CaDllPllTracking::GpsL1CaDllPllTracking( trk_params.extend_correlation_symbols = 20; std::cout << TEXT_RED << "WARNING: GPS L1 C/A. extend_correlation_symbols must be lower than 21. Coherent integration has been set to 20 symbols (20 ms)" << TEXT_RESET << '\n'; } - trk_params.track_pilot = configuration->property(role + ".track_pilot", false); + trk_params.track_pilot = configuration->property(role_ + ".track_pilot", false); if (trk_params.track_pilot) { trk_params.track_pilot = false; @@ -63,22 +68,23 @@ GpsL1CaDllPllTracking::GpsL1CaDllPllTracking( } trk_params.system = 'G'; - const std::array sig_{'1', 'C', '\0'}; - std::copy_n(sig_.data(), 3, trk_params.signal); + const std::array sig{'1', 'C', '\0'}; + std::copy_n(sig.data(), 3, trk_params.signal); // ################# Make a GNU Radio Tracking block object ################ + DLOG(INFO) << "role " << role_; if (trk_params.item_type == "gr_complex") { - item_size_ = sizeof(gr_complex); - tracking_ = dll_pll_veml_make_tracking(trk_params); + tracking_sptr_ = dll_pll_veml_make_tracking(trk_params); + DLOG(INFO) << "tracking(" << tracking_sptr_->unique_id() << ")"; } else { item_size_ = 0; + tracking_sptr_ = nullptr; LOG(WARNING) << trk_params.item_type << " unknown tracking item type."; } - channel_ = 0; - DLOG(INFO) << "tracking(" << tracking_->unique_id() << ")"; + if (in_streams_ > 1) { LOG(ERROR) << "This implementation only supports one input stream"; @@ -92,13 +98,13 @@ GpsL1CaDllPllTracking::GpsL1CaDllPllTracking( void GpsL1CaDllPllTracking::stop_tracking() { - tracking_->stop_tracking(); + tracking_sptr_->stop_tracking(); } void GpsL1CaDllPllTracking::start_tracking() { - tracking_->start_tracking(); + tracking_sptr_->start_tracking(); } @@ -108,13 +114,13 @@ void GpsL1CaDllPllTracking::start_tracking() void GpsL1CaDllPllTracking::set_channel(unsigned int channel) { channel_ = channel; - tracking_->set_channel(channel); + tracking_sptr_->set_channel(channel); } void GpsL1CaDllPllTracking::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) { - tracking_->set_gnss_synchro(p_gnss_synchro); + tracking_sptr_->set_gnss_synchro(p_gnss_synchro); } @@ -138,11 +144,11 @@ void GpsL1CaDllPllTracking::disconnect(gr::top_block_sptr top_block) gr::basic_block_sptr GpsL1CaDllPllTracking::get_left_block() { - return tracking_; + return tracking_sptr_; } gr::basic_block_sptr GpsL1CaDllPllTracking::get_right_block() { - return tracking_; + return tracking_sptr_; } diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking.h b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking.h index 53c1b7cc0..2e7cbce0f 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking.h +++ b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking.h @@ -92,10 +92,10 @@ public: void stop_tracking() override; private: - dll_pll_veml_tracking_sptr tracking_; + dll_pll_veml_tracking_sptr tracking_sptr_; + std::string role_; size_t item_size_; unsigned int channel_; - std::string role_; unsigned int in_streams_; unsigned int out_streams_; }; diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.cc b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.cc index 105bbe482..c0db6265d 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.cc @@ -34,12 +34,18 @@ #include GpsL1CaDllPllTrackingFpga::GpsL1CaDllPllTrackingFpga( - 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 ConfigurationInterface* configuration, + const std::string& role, + unsigned int in_streams, + unsigned int out_streams) + : role_(role), + num_prev_assigned_ch_(0), + channel_(0), + in_streams_(in_streams), + out_streams_(out_streams) { Dll_Pll_Conf_Fpga trk_params_fpga = Dll_Pll_Conf_Fpga(); - DLOG(INFO) << "role " << role; - trk_params_fpga.SetFromConfiguration(configuration, role); + trk_params_fpga.SetFromConfiguration(configuration, role_); const auto vector_length = static_cast(std::round(trk_params_fpga.fs_in / (GPS_L1_CA_CODE_RATE_CPS / GPS_L1_CA_CODE_LENGTH_CHIPS))); trk_params_fpga.vector_length = vector_length; @@ -53,7 +59,7 @@ GpsL1CaDllPllTrackingFpga::GpsL1CaDllPllTrackingFpga( trk_params_fpga.extend_correlation_symbols = GPS_CA_BIT_DURATION_MS; std::cout << TEXT_RED << "WARNING: GPS L1 C/A. extend_correlation_symbols must be lower than 21. Coherent integration has been set to 20 symbols (20 ms)" << TEXT_RESET << '\n'; } - trk_params_fpga.track_pilot = configuration->property(role + ".track_pilot", false); + trk_params_fpga.track_pilot = configuration->property(role_ + ".track_pilot", false); if (trk_params_fpga.track_pilot) { trk_params_fpga.track_pilot = false; @@ -64,35 +70,31 @@ GpsL1CaDllPllTrackingFpga::GpsL1CaDllPllTrackingFpga( std::cout << TEXT_RED << "WARNING: GPS L1 C/A. PLL or DLL narrow tracking bandwidth is higher than wide tracking one" << TEXT_RESET << '\n'; } trk_params_fpga.system = 'G'; - const std::array sig_{'1', 'C', '\0'}; - std::copy_n(sig_.data(), 3, trk_params_fpga.signal); + const std::array sig{'1', 'C', '\0'}; + std::copy_n(sig.data(), 3, trk_params_fpga.signal); // UIO device file - device_name = configuration->property(role + ".devicename", default_device_name_GPS_L1); - - // compute the number of tracking channels that have already been instantiated. The order in which - // GNSS-SDR instantiates the tracking channels i L1, l2, L5, E1, E5a - num_prev_assigned_ch = 0; + device_name_ = configuration->property(role_ + ".devicename", default_device_name_GPS_L1); // ################# PRE-COMPUTE ALL THE CODES ################# - d_ca_codes = static_cast(volk_gnsssdr_malloc(static_cast(GPS_L1_CA_CODE_LENGTH_CHIPS * NUM_PRNs) * sizeof(int32_t), volk_gnsssdr_get_alignment())); + ca_codes_ptr_ = static_cast(volk_gnsssdr_malloc(static_cast(GPS_L1_CA_CODE_LENGTH_CHIPS * NUM_PRNs) * sizeof(int32_t), volk_gnsssdr_get_alignment())); for (uint32_t PRN = 1; PRN <= NUM_PRNs; PRN++) { - gps_l1_ca_code_gen_int(own::span(&d_ca_codes[static_cast(GPS_L1_CA_CODE_LENGTH_CHIPS) * (PRN - 1)], &d_ca_codes[static_cast(GPS_L1_CA_CODE_LENGTH_CHIPS) * (PRN)]), PRN, 0); + gps_l1_ca_code_gen_int(own::span(&ca_codes_ptr_[static_cast(GPS_L1_CA_CODE_LENGTH_CHIPS) * (PRN - 1)], &ca_codes_ptr_[static_cast(GPS_L1_CA_CODE_LENGTH_CHIPS) * (PRN)]), PRN, 0); // The code is generated as a series of 1s and -1s. In order to store the values using only one bit, a -1 is stored as a 0 in the FPGA for (uint32_t k = 0; k < GPS_L1_CA_CODE_LENGTH_CHIPS; k++) { - int32_t tmp_value = d_ca_codes[(int32_t(GPS_L1_CA_CODE_LENGTH_CHIPS)) * (PRN - 1) + k]; + int32_t tmp_value = ca_codes_ptr_[(int32_t(GPS_L1_CA_CODE_LENGTH_CHIPS)) * (PRN - 1) + k]; if (tmp_value < 0) { tmp_value = 0; } tmp_value = tmp_value | LOCAL_CODE_FPGA_ENABLE_WRITE_MEMORY; - d_ca_codes[(int32_t(GPS_L1_CA_CODE_LENGTH_CHIPS)) * (PRN - 1) + k] = tmp_value; + ca_codes_ptr_[(int32_t(GPS_L1_CA_CODE_LENGTH_CHIPS)) * (PRN - 1) + k] = tmp_value; } } - trk_params_fpga.ca_codes = d_ca_codes; + trk_params_fpga.ca_codes = ca_codes_ptr_; trk_params_fpga.code_length_chips = GPS_L1_CA_CODE_LENGTH_CHIPS; trk_params_fpga.code_samples_per_chip = 1; // 1 sample per chip @@ -112,9 +114,9 @@ GpsL1CaDllPllTrackingFpga::GpsL1CaDllPllTrackingFpga( } // ################# MAKE TRACKING GNU Radio object ################### - tracking_fpga_sc = dll_pll_veml_make_tracking_fpga(trk_params_fpga); - channel_ = 0; - DLOG(INFO) << "tracking(" << tracking_fpga_sc->unique_id() << ")"; + DLOG(INFO) << "role " << role_; + tracking_fpga_sc_sptr_ = dll_pll_veml_make_tracking_fpga(trk_params_fpga); + DLOG(INFO) << "tracking(" << tracking_fpga_sc_sptr_->unique_id() << ")"; if (in_streams_ > 1) { @@ -129,19 +131,19 @@ GpsL1CaDllPllTrackingFpga::GpsL1CaDllPllTrackingFpga( GpsL1CaDllPllTrackingFpga::~GpsL1CaDllPllTrackingFpga() { - volk_gnsssdr_free(d_ca_codes); + volk_gnsssdr_free(ca_codes_ptr_); } void GpsL1CaDllPllTrackingFpga::start_tracking() { - tracking_fpga_sc->start_tracking(); + tracking_fpga_sc_sptr_->start_tracking(); } void GpsL1CaDllPllTrackingFpga::stop_tracking() { - tracking_fpga_sc->stop_tracking(); + tracking_fpga_sc_sptr_->stop_tracking(); } @@ -156,16 +158,16 @@ void GpsL1CaDllPllTrackingFpga::set_channel(unsigned int channel) std::string device_io_name; // find the uio device file corresponding to the tracking multicorrelator - if (find_uio_dev_file_name(device_io_name, device_name, channel - num_prev_assigned_ch) < 0) + if (find_uio_dev_file_name(device_io_name, device_name_, channel_ - num_prev_assigned_ch_) < 0) { bool alt_device_found = false; // alternative compatible HW accelerator device not found by default // If the HW accelerator is the default one in the L1 band then look for an alternative hardware accelerator - if (device_name == default_device_name_GPS_L1) + if (device_name_ == default_device_name_GPS_L1) { - if (find_uio_dev_file_name(device_io_name, default_device_name_Galileo_E1, channel - num_prev_assigned_ch) < 0) + if (find_uio_dev_file_name(device_io_name, default_device_name_Galileo_E1, channel_ - num_prev_assigned_ch_) < 0) { - std::cout << "Cannot find the FPGA uio device file corresponding to device names " << device_name << " or " << default_device_name_Galileo_E1 << std::endl; + std::cout << "Cannot find the FPGA uio device file corresponding to device names " << device_name_ << " or " << default_device_name_Galileo_E1 << std::endl; throw std::exception(); } else @@ -176,18 +178,18 @@ void GpsL1CaDllPllTrackingFpga::set_channel(unsigned int channel) if (!alt_device_found) { - std::cout << "Cannot find the FPGA uio device file corresponding to device name " << device_name << std::endl; + std::cout << "Cannot find the FPGA uio device file corresponding to device name " << device_name_ << std::endl; throw std::exception(); } } - tracking_fpga_sc->set_channel(channel, device_io_name); + tracking_fpga_sc_sptr_->set_channel(channel_, device_io_name); } void GpsL1CaDllPllTrackingFpga::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) { - tracking_fpga_sc->set_gnss_synchro(p_gnss_synchro); + tracking_fpga_sc_sptr_->set_gnss_synchro(p_gnss_synchro); } @@ -211,11 +213,11 @@ void GpsL1CaDllPllTrackingFpga::disconnect(gr::top_block_sptr top_block) gr::basic_block_sptr GpsL1CaDllPllTrackingFpga::get_left_block() { - return tracking_fpga_sc; + return tracking_fpga_sc_sptr_; } gr::basic_block_sptr GpsL1CaDllPllTrackingFpga::get_right_block() { - return tracking_fpga_sc; + return tracking_fpga_sc_sptr_; } diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.h b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.h index 63454751c..dedefd7c5 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.h +++ b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.h @@ -130,15 +130,14 @@ private: // expects. This arrangement is done in the initialisation to avoid consuming unnecessary clock cycles during tracking. static const int32_t LOCAL_CODE_FPGA_ENABLE_WRITE_MEMORY = 0x0C000000; // flag that enables WE (Write Enable) of the local code FPGA - std::string device_name; - uint32_t num_prev_assigned_ch; - - dll_pll_veml_tracking_fpga_sptr tracking_fpga_sc; - uint32_t channel_; + dll_pll_veml_tracking_fpga_sptr tracking_fpga_sc_sptr_; std::string role_; + std::string device_name_; + int32_t* ca_codes_ptr_; + uint32_t num_prev_assigned_ch_; + uint32_t channel_; uint32_t in_streams_; uint32_t out_streams_; - int32_t* d_ca_codes; }; diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_gaussian_tracking.cc b/src/algorithms/tracking/adapters/gps_l1_ca_gaussian_tracking.cc index bedab47b4..b5439d319 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_gaussian_tracking.cc +++ b/src/algorithms/tracking/adapters/gps_l1_ca_gaussian_tracking.cc @@ -32,38 +32,44 @@ GpsL1CaGaussianTracking::GpsL1CaGaussianTracking( - 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 ConfigurationInterface* configuration, + const std::string& role, + unsigned int in_streams, + unsigned int out_streams) + : role_(role), + item_size_(sizeof(gr_complex)), + channel_(0), + in_streams_(in_streams), + out_streams_(out_streams) { - DLOG(INFO) << "role " << role; // ################# CONFIGURATION PARAMETERS ######################## const std::string default_item_type("gr_complex"); - std::string item_type = configuration->property(role + ".item_type", default_item_type); - int order = configuration->property(role + ".order", 2); + std::string item_type = configuration->property(role_ + ".item_type", default_item_type); + int order = configuration->property(role_ + ".order", 2); int fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); int fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - bool dump = configuration->property(role + ".dump", false); - float dll_bw_hz = configuration->property(role + ".dll_bw_hz", static_cast(2.0)); + bool dump = configuration->property(role_ + ".dump", false); + float dll_bw_hz = configuration->property(role_ + ".dll_bw_hz", static_cast(2.0)); if (FLAGS_dll_bw_hz != 0.0) { dll_bw_hz = static_cast(FLAGS_dll_bw_hz); } - float early_late_space_chips = configuration->property(role + ".early_late_space_chips", static_cast(0.5)); + float early_late_space_chips = configuration->property(role_ + ".early_late_space_chips", static_cast(0.5)); const std::string default_dump_filename("./track_ch"); - std::string dump_filename = configuration->property(role + ".dump_filename", default_dump_filename); + std::string dump_filename = configuration->property(role_ + ".dump_filename", default_dump_filename); const auto vector_length = static_cast(std::round(fs_in / (GPS_L1_CA_CODE_RATE_CPS / GPS_L1_CA_CODE_LENGTH_CHIPS))); - bool bce_run = configuration->property(role + ".bce_run", false); - unsigned int bce_ptrans = configuration->property(role + ".p_transient", 0); - unsigned int bce_strans = configuration->property(role + ".s_transient", 0); - int bce_nu = configuration->property(role + ".bce_nu", 0); - int bce_kappa = configuration->property(role + ".bce_kappa", 0); + bool bce_run = configuration->property(role_ + ".bce_run", false); + unsigned int bce_ptrans = configuration->property(role_ + ".p_transient", 0); + unsigned int bce_strans = configuration->property(role_ + ".s_transient", 0); + int bce_nu = configuration->property(role_ + ".bce_nu", 0); + int bce_kappa = configuration->property(role_ + ".bce_kappa", 0); // ################# MAKE TRACKING GNURadio object ################### + DLOG(INFO) << "role " << role_; if (item_type == "gr_complex") { - item_size_ = sizeof(gr_complex); - tracking_ = gps_l1_ca_gaussian_make_tracking_cc( + tracking_sptr_ = gps_l1_ca_gaussian_make_tracking_cc( order, fs_in, vector_length, @@ -76,14 +82,15 @@ GpsL1CaGaussianTracking::GpsL1CaGaussianTracking( bce_strans, bce_nu, bce_kappa); + DLOG(INFO) << "tracking(" << tracking_sptr_->unique_id() << ")"; } else { item_size_ = 0; + tracking_sptr_ = nullptr; LOG(WARNING) << item_type << " unknown tracking item type."; } - channel_ = 0; - DLOG(INFO) << "tracking(" << tracking_->unique_id() << ")"; + if (in_streams_ == 0) { in_streams_ = 1; @@ -104,7 +111,7 @@ void GpsL1CaGaussianTracking::stop_tracking() void GpsL1CaGaussianTracking::start_tracking() { - tracking_->start_tracking(); + tracking_sptr_->start_tracking(); } @@ -114,13 +121,13 @@ void GpsL1CaGaussianTracking::start_tracking() void GpsL1CaGaussianTracking::set_channel(unsigned int channel) { channel_ = channel; - tracking_->set_channel(channel); + tracking_sptr_->set_channel(channel); } void GpsL1CaGaussianTracking::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) { - tracking_->set_gnss_synchro(p_gnss_synchro); + tracking_sptr_->set_gnss_synchro(p_gnss_synchro); } @@ -144,11 +151,11 @@ void GpsL1CaGaussianTracking::disconnect(gr::top_block_sptr top_block) gr::basic_block_sptr GpsL1CaGaussianTracking::get_left_block() { - return tracking_; + return tracking_sptr_; } gr::basic_block_sptr GpsL1CaGaussianTracking::get_right_block() { - return tracking_; + return tracking_sptr_; } diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_gaussian_tracking.h b/src/algorithms/tracking/adapters/gps_l1_ca_gaussian_tracking.h index 2b04fa6b5..615047fb6 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_gaussian_tracking.h +++ b/src/algorithms/tracking/adapters/gps_l1_ca_gaussian_tracking.h @@ -92,10 +92,10 @@ public: void stop_tracking() override; private: - gps_l1_ca_gaussian_tracking_cc_sptr tracking_; + gps_l1_ca_gaussian_tracking_cc_sptr tracking_sptr_; + std::string role_; size_t item_size_; unsigned int channel_; - std::string role_; unsigned int in_streams_; unsigned int out_streams_; }; diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_kf_tracking.cc b/src/algorithms/tracking/adapters/gps_l1_ca_kf_tracking.cc index 9cf7dc1b4..d1fbae84d 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_kf_tracking.cc +++ b/src/algorithms/tracking/adapters/gps_l1_ca_kf_tracking.cc @@ -32,12 +32,18 @@ #include GpsL1CaKfTracking::GpsL1CaKfTracking( - 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 ConfigurationInterface* configuration, + const std::string& role, + unsigned int in_streams, + unsigned int out_streams) + : role_(role), + item_size_(sizeof(gr_complex)), + channel_(0), + in_streams_(in_streams), + out_streams_(out_streams) { Kf_Conf trk_params = Kf_Conf(); - DLOG(INFO) << "role " << role; - trk_params.SetFromConfiguration(configuration, role); + trk_params.SetFromConfiguration(configuration, role_); const auto vector_length = static_cast(std::round(trk_params.fs_in / (GPS_L1_CA_CODE_RATE_CPS / GPS_L1_CA_CODE_LENGTH_CHIPS))); trk_params.vector_length = vector_length; @@ -51,7 +57,7 @@ GpsL1CaKfTracking::GpsL1CaKfTracking( trk_params.extend_correlation_symbols = 20; std::cout << TEXT_RED << "WARNING: GPS L1 C/A. extend_correlation_symbols must be lower than 21. Coherent integration has been set to 20 symbols (20 ms)" << TEXT_RESET << '\n'; } - trk_params.track_pilot = configuration->property(role + ".track_pilot", false); + trk_params.track_pilot = configuration->property(role_ + ".track_pilot", false); if (trk_params.track_pilot) { trk_params.track_pilot = false; @@ -59,22 +65,23 @@ GpsL1CaKfTracking::GpsL1CaKfTracking( } trk_params.system = 'G'; - const std::array sig_{'1', 'C', '\0'}; - std::copy_n(sig_.data(), 3, trk_params.signal); + const std::array sig{'1', 'C', '\0'}; + std::copy_n(sig.data(), 3, trk_params.signal); // ################# Make a GNU Radio Tracking block object ################ + DLOG(INFO) << "role " << role_; if (trk_params.item_type == "gr_complex") { - item_size_ = sizeof(gr_complex); - tracking_ = kf_make_tracking(trk_params); + tracking_sptr_ = kf_make_tracking(trk_params); + DLOG(INFO) << "tracking(" << tracking_sptr_->unique_id() << ")"; } else { - item_size_ = sizeof(gr_complex); + item_size_ = 0; + tracking_sptr_ = nullptr; LOG(WARNING) << trk_params.item_type << " unknown tracking item type."; } - channel_ = 0; - DLOG(INFO) << "tracking(" << tracking_->unique_id() << ")"; + if (in_streams_ > 1) { LOG(ERROR) << "This implementation only supports one input stream"; @@ -88,13 +95,13 @@ GpsL1CaKfTracking::GpsL1CaKfTracking( void GpsL1CaKfTracking::stop_tracking() { - tracking_->stop_tracking(); + tracking_sptr_->stop_tracking(); } void GpsL1CaKfTracking::start_tracking() { - tracking_->start_tracking(); + tracking_sptr_->start_tracking(); } @@ -104,13 +111,13 @@ void GpsL1CaKfTracking::start_tracking() void GpsL1CaKfTracking::set_channel(unsigned int channel) { channel_ = channel; - tracking_->set_channel(channel); + tracking_sptr_->set_channel(channel); } void GpsL1CaKfTracking::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) { - tracking_->set_gnss_synchro(p_gnss_synchro); + tracking_sptr_->set_gnss_synchro(p_gnss_synchro); } @@ -134,11 +141,11 @@ void GpsL1CaKfTracking::disconnect(gr::top_block_sptr top_block) gr::basic_block_sptr GpsL1CaKfTracking::get_left_block() { - return tracking_; + return tracking_sptr_; } gr::basic_block_sptr GpsL1CaKfTracking::get_right_block() { - return tracking_; + return tracking_sptr_; } diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_kf_tracking.h b/src/algorithms/tracking/adapters/gps_l1_ca_kf_tracking.h index 7e2daaea8..982378a58 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_kf_tracking.h +++ b/src/algorithms/tracking/adapters/gps_l1_ca_kf_tracking.h @@ -85,10 +85,10 @@ public: void stop_tracking() override; private: - kf_tracking_sptr tracking_; + kf_tracking_sptr tracking_sptr_; + std::string role_; size_t item_size_; unsigned int channel_; - std::string role_; unsigned int in_streams_; unsigned int out_streams_; }; diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_tcp_connector_tracking.cc b/src/algorithms/tracking/adapters/gps_l1_ca_tcp_connector_tracking.cc index c7fe6e52c..fa09c8dcb 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_tcp_connector_tracking.cc +++ b/src/algorithms/tracking/adapters/gps_l1_ca_tcp_connector_tracking.cc @@ -29,43 +29,48 @@ GpsL1CaTcpConnectorTracking::GpsL1CaTcpConnectorTracking( - 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 ConfigurationInterface* configuration, + const std::string& role, + unsigned int in_streams, + unsigned int out_streams) + : role_(role), + item_size_(sizeof(gr_complex)), + channel_(0), + in_streams_(in_streams), + out_streams_(out_streams) { - DLOG(INFO) << "role " << role; // ################# CONFIGURATION PARAMETERS ######################## const std::string default_item_type("gr_complex"); - std::string item_type = configuration->property(role + ".item_type", default_item_type); - // vector_length = configuration->property(role + ".vector_length", 2048); + std::string item_type = configuration->property(role_ + ".item_type", default_item_type); int fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); int fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - bool dump = configuration->property(role + ".dump", false); - float early_late_space_chips = configuration->property(role + ".early_late_space_chips", static_cast(0.5)); - size_t port_ch0 = configuration->property(role + ".port_ch0", 2060); + bool dump = configuration->property(role_ + ".dump", false); + float early_late_space_chips = configuration->property(role_ + ".early_late_space_chips", static_cast(0.5)); + size_t port_ch0 = configuration->property(role_ + ".port_ch0", 2060); const std::string default_dump_filename("./track_ch"); - std::string dump_filename = configuration->property(role + ".dump_filename", default_dump_filename); + std::string dump_filename = configuration->property(role_ + ".dump_filename", default_dump_filename); const auto vector_length = static_cast(std::round(fs_in / (GPS_L1_CA_CODE_RATE_CPS / GPS_L1_CA_CODE_LENGTH_CHIPS))); // ################# MAKE TRACKING GNURadio object ################### + DLOG(INFO) << "role " << role_; if (item_type == "gr_complex") { - item_size_ = sizeof(gr_complex); - tracking_ = gps_l1_ca_tcp_connector_make_tracking_cc( + tracking_sptr_ = gps_l1_ca_tcp_connector_make_tracking_cc( fs_in, vector_length, dump, dump_filename, early_late_space_chips, port_ch0); + DLOG(INFO) << "tracking(" << tracking_sptr_->unique_id() << ")"; } else { item_size_ = 0; + tracking_sptr_ = nullptr; LOG(WARNING) << item_type << " unknown tracking item type."; } - channel_ = 0; - DLOG(INFO) << "tracking(" << tracking_->unique_id() << ")"; if (in_streams_ > 1) { LOG(ERROR) << "This implementation only supports one input stream"; @@ -84,7 +89,7 @@ void GpsL1CaTcpConnectorTracking::stop_tracking() void GpsL1CaTcpConnectorTracking::start_tracking() { - tracking_->start_tracking(); + tracking_sptr_->start_tracking(); } /* @@ -93,13 +98,13 @@ void GpsL1CaTcpConnectorTracking::start_tracking() void GpsL1CaTcpConnectorTracking::set_channel(unsigned int channel) { channel_ = channel; - tracking_->set_channel(channel); + tracking_sptr_->set_channel(channel); } void GpsL1CaTcpConnectorTracking::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) { - tracking_->set_gnss_synchro(p_gnss_synchro); + tracking_sptr_->set_gnss_synchro(p_gnss_synchro); } @@ -123,11 +128,11 @@ void GpsL1CaTcpConnectorTracking::disconnect(gr::top_block_sptr top_block) gr::basic_block_sptr GpsL1CaTcpConnectorTracking::get_left_block() { - return tracking_; + return tracking_sptr_; } gr::basic_block_sptr GpsL1CaTcpConnectorTracking::get_right_block() { - return tracking_; + return tracking_sptr_; } diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_tcp_connector_tracking.h b/src/algorithms/tracking/adapters/gps_l1_ca_tcp_connector_tracking.h index ded02212c..a0da32dd3 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_tcp_connector_tracking.h +++ b/src/algorithms/tracking/adapters/gps_l1_ca_tcp_connector_tracking.h @@ -90,10 +90,10 @@ public: void stop_tracking() override; private: - gps_l1_ca_tcp_connector_tracking_cc_sptr tracking_; + gps_l1_ca_tcp_connector_tracking_cc_sptr tracking_sptr_; + std::string role_; size_t item_size_; unsigned int channel_; - std::string role_; unsigned int in_streams_; unsigned int out_streams_; }; diff --git a/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking.cc index 1df69625b..98692f544 100644 --- a/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking.cc @@ -31,12 +31,18 @@ #include GpsL2MDllPllTracking::GpsL2MDllPllTracking( - 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 ConfigurationInterface* configuration, + const std::string& role, + unsigned int in_streams, + unsigned int out_streams) + : role_(role), + item_size_(sizeof(gr_complex)), + channel_(0), + in_streams_(in_streams), + out_streams_(out_streams) { Dll_Pll_Conf trk_params = Dll_Pll_Conf(); - DLOG(INFO) << "role " << role; - trk_params.SetFromConfiguration(configuration, role); + trk_params.SetFromConfiguration(configuration, role_); const auto vector_length = static_cast(std::round(static_cast(trk_params.fs_in) / (static_cast(GPS_L2_M_CODE_RATE_CPS) / static_cast(GPS_L2_M_CODE_LENGTH_CHIPS)))); trk_params.vector_length = vector_length; @@ -45,29 +51,30 @@ GpsL2MDllPllTracking::GpsL2MDllPllTracking( trk_params.extend_correlation_symbols = 1; std::cout << TEXT_RED << "WARNING: Extended coherent integration is not allowed in GPS L2. Coherent integration has been set to 20 ms (1 symbol)" << TEXT_RESET << '\n'; } - trk_params.track_pilot = configuration->property(role + ".track_pilot", false); + trk_params.track_pilot = configuration->property(role_ + ".track_pilot", false); if (trk_params.track_pilot) { trk_params.track_pilot = false; std::cout << TEXT_RED << "WARNING: GPS L2 does not have pilot signal. Data tracking has been enabled" << TEXT_RESET << '\n'; } trk_params.system = 'G'; - const std::array sig_{'2', 'S', '\0'}; - std::copy_n(sig_.data(), 3, trk_params.signal); + const std::array sig{'2', 'S', '\0'}; + std::copy_n(sig.data(), 3, trk_params.signal); // ################# Make a GNU Radio Tracking block object ################ + DLOG(INFO) << "role " << role_; if (trk_params.item_type == "gr_complex") { - item_size_ = sizeof(gr_complex); - tracking_ = dll_pll_veml_make_tracking(trk_params); + tracking_sptr_ = dll_pll_veml_make_tracking(trk_params); + DLOG(INFO) << "tracking(" << tracking_sptr_->unique_id() << ")"; } else { item_size_ = 0; + tracking_sptr_ = nullptr; LOG(WARNING) << trk_params.item_type << " unknown tracking item type."; } - channel_ = 0; - DLOG(INFO) << "tracking(" << tracking_->unique_id() << ")"; + if (in_streams_ > 1) { LOG(ERROR) << "This implementation only supports one input stream"; @@ -81,13 +88,13 @@ GpsL2MDllPllTracking::GpsL2MDllPllTracking( void GpsL2MDllPllTracking::stop_tracking() { - tracking_->stop_tracking(); + tracking_sptr_->stop_tracking(); } void GpsL2MDllPllTracking::start_tracking() { - tracking_->start_tracking(); + tracking_sptr_->start_tracking(); } @@ -97,13 +104,13 @@ void GpsL2MDllPllTracking::start_tracking() void GpsL2MDllPllTracking::set_channel(unsigned int channel) { channel_ = channel; - tracking_->set_channel(channel); + tracking_sptr_->set_channel(channel); } void GpsL2MDllPllTracking::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) { - tracking_->set_gnss_synchro(p_gnss_synchro); + tracking_sptr_->set_gnss_synchro(p_gnss_synchro); } @@ -127,11 +134,11 @@ void GpsL2MDllPllTracking::disconnect(gr::top_block_sptr top_block) gr::basic_block_sptr GpsL2MDllPllTracking::get_left_block() { - return tracking_; + return tracking_sptr_; } gr::basic_block_sptr GpsL2MDllPllTracking::get_right_block() { - return tracking_; + return tracking_sptr_; } diff --git a/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking.h b/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking.h index 874e74eba..9edf23fd0 100644 --- a/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking.h +++ b/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking.h @@ -90,10 +90,10 @@ public: void stop_tracking() override; private: - dll_pll_veml_tracking_sptr tracking_; + dll_pll_veml_tracking_sptr tracking_sptr_; + std::string role_; size_t item_size_; unsigned int channel_; - std::string role_; unsigned int in_streams_; unsigned int out_streams_; }; diff --git a/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.cc b/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.cc index b252e44de..da652be87 100644 --- a/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.cc @@ -38,60 +38,64 @@ #include GpsL2MDllPllTrackingFpga::GpsL2MDllPllTrackingFpga( - 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 ConfigurationInterface* configuration, + const std::string& role, + unsigned int in_streams, + unsigned int out_streams) + : role_(role), + channel_(0), + in_streams_(in_streams), + out_streams_(out_streams) { Dll_Pll_Conf_Fpga trk_params_fpga = Dll_Pll_Conf_Fpga(); - DLOG(INFO) << "role " << role; - trk_params_fpga.SetFromConfiguration(configuration, role); + trk_params_fpga.SetFromConfiguration(configuration, role_); const auto vector_length = static_cast(std::round(static_cast(trk_params_fpga.fs_in) / (static_cast(GPS_L2_M_CODE_RATE_CPS) / static_cast(GPS_L2_M_CODE_LENGTH_CHIPS)))); trk_params_fpga.vector_length = vector_length; - trk_params_fpga.extend_correlation_symbols = configuration->property(role + ".extend_correlation_symbols", 1); + trk_params_fpga.extend_correlation_symbols = configuration->property(role_ + ".extend_correlation_symbols", 1); if (trk_params_fpga.extend_correlation_symbols != 1) { trk_params_fpga.extend_correlation_symbols = 1; std::cout << TEXT_RED << "WARNING: Extended coherent integration is not allowed in GPS L2. Coherent integration has been set to 20 ms (1 symbol)" << TEXT_RESET << '\n'; } - trk_params_fpga.track_pilot = configuration->property(role + ".track_pilot", false); + trk_params_fpga.track_pilot = configuration->property(role_ + ".track_pilot", false); if (trk_params_fpga.track_pilot) { trk_params_fpga.track_pilot = false; std::cout << TEXT_RED << "WARNING: GPS L2 does not have pilot signal. Data tracking has been enabled" << TEXT_RESET << '\n'; } trk_params_fpga.system = 'G'; - const std::array sig_{'2', 'S', '\0'}; - std::copy_n(sig_.data(), 3, trk_params_fpga.signal); + const std::array sig{'2', 'S', '\0'}; + std::copy_n(sig.data(), 3, trk_params_fpga.signal); // UIO device file - device_name = configuration->property(role + ".devicename", default_device_name_GPS_L2); + device_name_ = configuration->property(role_ + ".devicename", default_device_name_GPS_L2); // compute the number of tracking channels that have already been instantiated. The order in which // GNSS-SDR instantiates the tracking channels i L1, L2, L5, E1, E5a - num_prev_assigned_ch = configuration->property("Channels_1C.count", 0); + num_prev_assigned_ch_ = configuration->property("Channels_1C.count", 0); - volk_gnsssdr::vector ca_codes_f(static_cast(GPS_L2_M_CODE_LENGTH_CHIPS), 0.0); // ################# PRE-COMPUTE ALL THE CODES ################# - d_ca_codes = static_cast(volk_gnsssdr_malloc(static_cast(GPS_L2_M_CODE_LENGTH_CHIPS * NUM_PRNs) * sizeof(int), volk_gnsssdr_get_alignment())); + volk_gnsssdr::vector ca_codes_f(static_cast(GPS_L2_M_CODE_LENGTH_CHIPS), 0.0); + prn_codes_ptr_ = static_cast(volk_gnsssdr_malloc(static_cast(GPS_L2_M_CODE_LENGTH_CHIPS * NUM_PRNs) * sizeof(int), volk_gnsssdr_get_alignment())); for (uint32_t PRN = 1; PRN <= NUM_PRNs; PRN++) { gps_l2c_m_code_gen_float(ca_codes_f, PRN); for (unsigned int s = 0; s < 2 * static_cast(GPS_L2_M_CODE_LENGTH_CHIPS); s++) { - d_ca_codes[static_cast(GPS_L2_M_CODE_LENGTH_CHIPS) * (PRN - 1) + s] = static_cast(ca_codes_f[s]); + prn_codes_ptr_[static_cast(GPS_L2_M_CODE_LENGTH_CHIPS) * (PRN - 1) + s] = static_cast(ca_codes_f[s]); } } - trk_params_fpga.ca_codes = d_ca_codes; + trk_params_fpga.ca_codes = prn_codes_ptr_; trk_params_fpga.code_length_chips = GPS_L2_M_CODE_LENGTH_CHIPS; trk_params_fpga.code_samples_per_chip = 1; // 1 sample per chip // ################# MAKE TRACKING GNU Radio object ################### - tracking_fpga_sc = dll_pll_veml_make_tracking_fpga(trk_params_fpga); - - channel_ = 0; - DLOG(INFO) << "tracking(" << tracking_fpga_sc->unique_id() << ")"; + DLOG(INFO) << "role " << role_; + tracking_fpga_sc_sptr_ = dll_pll_veml_make_tracking_fpga(trk_params_fpga); + DLOG(INFO) << "tracking(" << tracking_fpga_sc_sptr_->unique_id() << ")"; if (in_streams_ > 1) { @@ -106,19 +110,19 @@ GpsL2MDllPllTrackingFpga::GpsL2MDllPllTrackingFpga( GpsL2MDllPllTrackingFpga::~GpsL2MDllPllTrackingFpga() { - volk_gnsssdr_free(d_ca_codes); + volk_gnsssdr_free(prn_codes_ptr_); } void GpsL2MDllPllTrackingFpga::start_tracking() { - tracking_fpga_sc->start_tracking(); + tracking_fpga_sc_sptr_->start_tracking(); } void GpsL2MDllPllTrackingFpga::stop_tracking() { - tracking_fpga_sc->stop_tracking(); + tracking_fpga_sc_sptr_->stop_tracking(); } @@ -132,19 +136,19 @@ void GpsL2MDllPllTrackingFpga::set_channel(unsigned int channel) // UIO device file std::string device_io_name; // find the uio device file corresponding to the tracking multicorrelator - if (find_uio_dev_file_name(device_io_name, device_name, channel - num_prev_assigned_ch) < 0) + if (find_uio_dev_file_name(device_io_name, device_name_, channel_ - num_prev_assigned_ch_) < 0) { - std::cout << "Cannot find the FPGA uio device file corresponding to device name " << device_name << std::endl; + std::cout << "Cannot find the FPGA uio device file corresponding to device name " << device_name_ << std::endl; throw std::exception(); } - tracking_fpga_sc->set_channel(channel, device_io_name); + tracking_fpga_sc_sptr_->set_channel(channel_, device_io_name); } void GpsL2MDllPllTrackingFpga::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) { - tracking_fpga_sc->set_gnss_synchro(p_gnss_synchro); + tracking_fpga_sc_sptr_->set_gnss_synchro(p_gnss_synchro); } @@ -168,11 +172,11 @@ void GpsL2MDllPllTrackingFpga::disconnect(gr::top_block_sptr top_block) gr::basic_block_sptr GpsL2MDllPllTrackingFpga::get_left_block() { - return tracking_fpga_sc; + return tracking_fpga_sc_sptr_; } gr::basic_block_sptr GpsL2MDllPllTrackingFpga::get_right_block() { - return tracking_fpga_sc; + return tracking_fpga_sc_sptr_; } diff --git a/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.h b/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.h index ab6914b7f..506e8fec6 100644 --- a/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.h +++ b/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.h @@ -93,17 +93,16 @@ public: private: const std::string default_device_name_GPS_L2 = "multicorrelator_resampler_S00_AXI"; // UIO device name - - std::string device_name; - uint32_t num_prev_assigned_ch; - static const uint32_t NUM_PRNs = 32; - dll_pll_veml_tracking_fpga_sptr tracking_fpga_sc; - unsigned int channel_; + + dll_pll_veml_tracking_fpga_sptr tracking_fpga_sc_sptr_; std::string role_; + std::string device_name_; + int* prn_codes_ptr_; + uint32_t num_prev_assigned_ch_; + unsigned int channel_; unsigned int in_streams_; unsigned int out_streams_; - int* d_ca_codes; }; diff --git a/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking.cc index 31896d6b7..d77303820 100644 --- a/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking.cc @@ -31,12 +31,18 @@ #include GpsL5DllPllTracking::GpsL5DllPllTracking( - 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 ConfigurationInterface* configuration, + const std::string& role, + unsigned int in_streams, + unsigned int out_streams) + : role_(role), + item_size_(sizeof(gr_complex)), + channel_(0), + in_streams_(in_streams), + out_streams_(out_streams) { Dll_Pll_Conf trk_params = Dll_Pll_Conf(); - DLOG(INFO) << "role " << role; - trk_params.SetFromConfiguration(configuration, role); + trk_params.SetFromConfiguration(configuration, role_); const auto vector_length = static_cast(std::round(static_cast(trk_params.fs_in) / (static_cast(GPS_L5I_CODE_RATE_CPS) / static_cast(GPS_L5I_CODE_LENGTH_CHIPS)))); trk_params.vector_length = vector_length; @@ -55,22 +61,23 @@ GpsL5DllPllTracking::GpsL5DllPllTracking( std::cout << TEXT_RED << "WARNING: GPS L5. PLL or DLL narrow tracking bandwidth is higher than wide tracking one" << TEXT_RESET << '\n'; } trk_params.system = 'G'; - const std::array sig_{'L', '5', '\0'}; - std::copy_n(sig_.data(), 3, trk_params.signal); + const std::array sig{'L', '5', '\0'}; + std::copy_n(sig.data(), 3, trk_params.signal); // ################# Make a GNU Radio Tracking block object ################ + DLOG(INFO) << "role " << role_; if (trk_params.item_type == "gr_complex") { - item_size_ = sizeof(gr_complex); - tracking_ = dll_pll_veml_make_tracking(trk_params); + tracking_sptr_ = dll_pll_veml_make_tracking(trk_params); + DLOG(INFO) << "tracking(" << tracking_sptr_->unique_id() << ")"; } else { item_size_ = 0; + tracking_sptr_ = nullptr; LOG(WARNING) << trk_params.item_type << " unknown tracking item type."; } - channel_ = 0; - DLOG(INFO) << "tracking(" << tracking_->unique_id() << ")"; + if (in_streams_ > 1) { LOG(ERROR) << "This implementation only supports one input stream"; @@ -84,13 +91,13 @@ GpsL5DllPllTracking::GpsL5DllPllTracking( void GpsL5DllPllTracking::stop_tracking() { - tracking_->stop_tracking(); + tracking_sptr_->stop_tracking(); } void GpsL5DllPllTracking::start_tracking() { - tracking_->start_tracking(); + tracking_sptr_->start_tracking(); } @@ -100,13 +107,13 @@ void GpsL5DllPllTracking::start_tracking() void GpsL5DllPllTracking::set_channel(unsigned int channel) { channel_ = channel; - tracking_->set_channel(channel); + tracking_sptr_->set_channel(channel); } void GpsL5DllPllTracking::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) { - tracking_->set_gnss_synchro(p_gnss_synchro); + tracking_sptr_->set_gnss_synchro(p_gnss_synchro); } @@ -130,11 +137,11 @@ void GpsL5DllPllTracking::disconnect(gr::top_block_sptr top_block) gr::basic_block_sptr GpsL5DllPllTracking::get_left_block() { - return tracking_; + return tracking_sptr_; } gr::basic_block_sptr GpsL5DllPllTracking::get_right_block() { - return tracking_; + return tracking_sptr_; } diff --git a/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking.h b/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking.h index 1cd1353dc..6aad72305 100644 --- a/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking.h +++ b/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking.h @@ -89,10 +89,10 @@ public: void stop_tracking() override; private: - dll_pll_veml_tracking_sptr tracking_; + dll_pll_veml_tracking_sptr tracking_sptr_; + std::string role_; size_t item_size_; unsigned int channel_; - std::string role_; unsigned int in_streams_; unsigned int out_streams_; }; diff --git a/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.cc b/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.cc index a3695aaa1..485afd7c3 100644 --- a/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.cc @@ -36,12 +36,18 @@ #include GpsL5DllPllTrackingFpga::GpsL5DllPllTrackingFpga( - 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 ConfigurationInterface *configuration, + const std::string &role, + unsigned int in_streams, + unsigned int out_streams) + : role_(role), + data_codes_ptr_(nullptr), + channel_(0), + in_streams_(in_streams), + out_streams_(out_streams) { Dll_Pll_Conf_Fpga trk_params_fpga = Dll_Pll_Conf_Fpga(); - DLOG(INFO) << "role " << role; - trk_params_fpga.SetFromConfiguration(configuration, role); + trk_params_fpga.SetFromConfiguration(configuration, role_); const auto vector_length = static_cast(std::round(static_cast(trk_params_fpga.fs_in) / (static_cast(GPS_L5I_CODE_RATE_CPS) / static_cast(GPS_L5I_CODE_LENGTH_CHIPS)))); trk_params_fpga.vector_length = vector_length; @@ -59,24 +65,24 @@ GpsL5DllPllTrackingFpga::GpsL5DllPllTrackingFpga( { std::cout << TEXT_RED << "WARNING: GPS L5. PLL or DLL narrow tracking bandwidth is higher than wide tracking one" << TEXT_RESET << '\n'; } - d_track_pilot = trk_params_fpga.track_pilot; + track_pilot_ = trk_params_fpga.track_pilot; trk_params_fpga.system = 'G'; - const std::array sig_{'L', '5', '\0'}; - std::copy_n(sig_.data(), 3, trk_params_fpga.signal); + const std::array sig{'L', '5', '\0'}; + std::copy_n(sig.data(), 3, trk_params_fpga.signal); // UIO device file - device_name = configuration->property(role + ".devicename", default_device_name_GPS_L5); + device_name_ = configuration->property(role_ + ".devicename", default_device_name_GPS_L5_); // compute the number of tracking channels that have already been instantiated. The order in which // GNSS-SDR instantiates the tracking channels i L1, L2, L5, E1, E5a uint32_t num_prev_assigned_ch_1C = configuration->property("Channels_1C.count", 0); uint32_t num_prev_assigned_ch_2S = 0; - if (configuration->property("Tracking_2S.devicename", std::string("")) != device_name) + if (configuration->property("Tracking_2S.devicename", std::string("")) != device_name_) { num_prev_assigned_ch_2S = configuration->property("Channels_2S.count", 0); } - num_prev_assigned_ch = num_prev_assigned_ch_1C + num_prev_assigned_ch_2S; + num_prev_assigned_ch_ = num_prev_assigned_ch_1C + num_prev_assigned_ch_2S; // ################# PRE-COMPUTE ALL THE CODES ################# uint32_t code_samples_per_chip = 1; @@ -85,22 +91,21 @@ GpsL5DllPllTrackingFpga::GpsL5DllPllTrackingFpga( volk_gnsssdr::vector data_code; volk_gnsssdr::vector tracking_code(code_length_chips, 0.0); - if (d_track_pilot) + if (track_pilot_) { data_code.resize(code_length_chips, 0.0); } - d_ca_codes = static_cast(volk_gnsssdr_malloc(static_cast(code_length_chips * NUM_PRNs) * sizeof(int32_t), volk_gnsssdr_get_alignment())); + prn_codes_ptr_ = static_cast(volk_gnsssdr_malloc(static_cast(code_length_chips * NUM_PRNs) * sizeof(int32_t), volk_gnsssdr_get_alignment())); - d_data_codes = nullptr; - if (d_track_pilot) + if (track_pilot_) { - d_data_codes = static_cast(volk_gnsssdr_malloc((static_cast(code_length_chips)) * NUM_PRNs * sizeof(int32_t), volk_gnsssdr_get_alignment())); + data_codes_ptr_ = static_cast(volk_gnsssdr_malloc((static_cast(code_length_chips)) * NUM_PRNs * sizeof(int32_t), volk_gnsssdr_get_alignment())); } for (uint32_t PRN = 1; PRN <= NUM_PRNs; PRN++) { - if (d_track_pilot) + if (track_pilot_) { gps_l5q_code_gen_float(tracking_code, PRN); gps_l5i_code_gen_float(data_code, PRN); @@ -114,7 +119,7 @@ GpsL5DllPllTrackingFpga::GpsL5DllPllTrackingFpga( tmp_value = 0; } tmp_value = tmp_value | LOCAL_CODE_FPGA_ENABLE_WRITE_MEMORY; - d_ca_codes[static_cast(code_length_chips) * (PRN - 1) + s] = tmp_value; + prn_codes_ptr_[static_cast(code_length_chips) * (PRN - 1) + s] = tmp_value; tmp_value = static_cast(data_code[s]); if (tmp_value < 0) @@ -122,7 +127,7 @@ GpsL5DllPllTrackingFpga::GpsL5DllPllTrackingFpga( tmp_value = 0; } tmp_value = tmp_value | LOCAL_CODE_FPGA_ENABLE_WRITE_MEMORY | LOCAL_CODE_FPGA_CORRELATOR_SELECT_COUNT; - d_data_codes[static_cast(code_length_chips) * (PRN - 1) + s] = tmp_value; + data_codes_ptr_[static_cast(code_length_chips) * (PRN - 1) + s] = tmp_value; } } else @@ -138,20 +143,20 @@ GpsL5DllPllTrackingFpga::GpsL5DllPllTrackingFpga( tmp_value = 0; } tmp_value = tmp_value | LOCAL_CODE_FPGA_ENABLE_WRITE_MEMORY; - d_ca_codes[static_cast(code_length_chips) * (PRN - 1) + s] = tmp_value; + prn_codes_ptr_[static_cast(code_length_chips) * (PRN - 1) + s] = tmp_value; } } } - trk_params_fpga.ca_codes = d_ca_codes; - trk_params_fpga.data_codes = d_data_codes; + trk_params_fpga.ca_codes = prn_codes_ptr_; + trk_params_fpga.data_codes = data_codes_ptr_; trk_params_fpga.code_length_chips = code_length_chips; trk_params_fpga.code_samples_per_chip = code_samples_per_chip; // 2 sample per chip trk_params_fpga.extended_correlation_in_fpga = false; // by default trk_params_fpga.extend_fpga_integration_periods = 1; // (number of FPGA integrations that are combined in the SW) trk_params_fpga.fpga_integration_period = 1; // (number of symbols that are effectively integrated in the FPGA) - if (d_track_pilot) + if (track_pilot_) { if (trk_params_fpga.extend_correlation_symbols > 1) { @@ -176,9 +181,9 @@ GpsL5DllPllTrackingFpga::GpsL5DllPllTrackingFpga( } // ################# MAKE TRACKING GNU Radio object ################### - tracking_fpga_sc = dll_pll_veml_make_tracking_fpga(trk_params_fpga); - channel_ = 0; - DLOG(INFO) << "tracking(" << tracking_fpga_sc->unique_id() << ")"; + DLOG(INFO) << "role " << role_; + tracking_fpga_sc_sptr_ = dll_pll_veml_make_tracking_fpga(trk_params_fpga); + DLOG(INFO) << "tracking(" << tracking_fpga_sc_sptr_->unique_id() << ")"; if (in_streams_ > 1) { @@ -193,23 +198,23 @@ GpsL5DllPllTrackingFpga::GpsL5DllPllTrackingFpga( GpsL5DllPllTrackingFpga::~GpsL5DllPllTrackingFpga() { - volk_gnsssdr_free(d_ca_codes); - if (d_track_pilot) + volk_gnsssdr_free(prn_codes_ptr_); + if (track_pilot_) { - volk_gnsssdr_free(d_data_codes); + volk_gnsssdr_free(data_codes_ptr_); } } void GpsL5DllPllTrackingFpga::start_tracking() { - tracking_fpga_sc->start_tracking(); + tracking_fpga_sc_sptr_->start_tracking(); } void GpsL5DllPllTrackingFpga::stop_tracking() { - tracking_fpga_sc->stop_tracking(); + tracking_fpga_sc_sptr_->stop_tracking(); } @@ -223,19 +228,19 @@ void GpsL5DllPllTrackingFpga::set_channel(unsigned int channel) // UIO device file std::string device_io_name; // find the uio device file corresponding to the tracking multicorrelator - if (find_uio_dev_file_name(device_io_name, device_name, channel - num_prev_assigned_ch) < 0) + if (find_uio_dev_file_name(device_io_name, device_name_, channel_ - num_prev_assigned_ch_) < 0) { - std::cout << "Cannot find the FPGA uio device file corresponding to device name " << device_name << std::endl; + std::cout << "Cannot find the FPGA uio device file corresponding to device name " << device_name_ << std::endl; throw std::exception(); } - tracking_fpga_sc->set_channel(channel, device_io_name); + tracking_fpga_sc_sptr_->set_channel(channel_, device_io_name); } void GpsL5DllPllTrackingFpga::set_gnss_synchro(Gnss_Synchro *p_gnss_synchro) { - tracking_fpga_sc->set_gnss_synchro(p_gnss_synchro); + tracking_fpga_sc_sptr_->set_gnss_synchro(p_gnss_synchro); } @@ -259,11 +264,11 @@ void GpsL5DllPllTrackingFpga::disconnect(gr::top_block_sptr top_block) gr::basic_block_sptr GpsL5DllPllTrackingFpga::get_left_block() { - return tracking_fpga_sc; + return tracking_fpga_sc_sptr_; } gr::basic_block_sptr GpsL5DllPllTrackingFpga::get_right_block() { - return tracking_fpga_sc; + return tracking_fpga_sc_sptr_; } diff --git a/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.h b/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.h index 9abedfd16..24fc37a14 100644 --- a/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.h +++ b/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.h @@ -122,7 +122,7 @@ public: void stop_tracking() override; private: - const std::string default_device_name_GPS_L5 = "multicorrelator_resampler_3_1_AXI"; // UIO device name + const std::string default_device_name_GPS_L5_ = "multicorrelator_resampler_3_1_AXI"; // UIO device name static const uint32_t NUM_PRNs = 32; // total number of PRNs @@ -131,17 +131,16 @@ private: static const int32_t LOCAL_CODE_FPGA_ENABLE_WRITE_MEMORY = 0x0C000000; // flag that enables WE (Write Enable) of the local code FPGA static const int32_t LOCAL_CODE_FPGA_CORRELATOR_SELECT_COUNT = 0x20000000; // flag that selects the writing of the pilot code in the FPGA (as opposed to the data code) - std::string device_name; - uint32_t num_prev_assigned_ch; - - dll_pll_veml_tracking_fpga_sptr tracking_fpga_sc; - uint32_t channel_; + dll_pll_veml_tracking_fpga_sptr tracking_fpga_sc_sptr_; std::string role_; + std::string device_name_; + int32_t* prn_codes_ptr_; + int32_t* data_codes_ptr_; + uint32_t channel_; + uint32_t num_prev_assigned_ch_; uint32_t in_streams_; uint32_t out_streams_; - bool d_track_pilot; - int32_t* d_ca_codes; - int32_t* d_data_codes; + bool track_pilot_; }; From aadc9e6a2666a17efcf7322bcb1737d9ea03143b Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 9 Dec 2022 12:00:28 +0100 Subject: [PATCH 52/59] Improve acquisition adapters constructors: prefer member initializers of the constructor instead of in the constructor body --- ...lileo_e1_pcps_8ms_ambiguous_acquisition.cc | 23 +++++------ .../galileo_e1_pcps_ambiguous_acquisition.cc | 33 +++++++-------- ...ileo_e1_pcps_ambiguous_acquisition_fpga.cc | 26 ++++++------ ...eo_e1_pcps_cccwsr_ambiguous_acquisition.cc | 21 ++++------ ...e1_pcps_quicksync_ambiguous_acquisition.cc | 20 ++++------ ...ileo_e1_pcps_tong_ambiguous_acquisition.cc | 32 +++++++-------- ...ileo_e5a_noncoherent_iq_acquisition_caf.cc | 26 ++++++------ .../adapters/galileo_e5a_pcps_acquisition.cc | 34 ++++++++-------- .../galileo_e5a_pcps_acquisition_fpga.cc | 28 ++++++------- .../adapters/galileo_e5b_pcps_acquisition.cc | 34 ++++++++-------- .../galileo_e5b_pcps_acquisition_fpga.cc | 25 ++++++------ ...gps_l1_ca_pcps_acquisition_fine_doppler.cc | 37 +++++++++-------- .../gps_l1_ca_pcps_assisted_acquisition.cc | 40 +++++++++---------- .../gps_l1_ca_pcps_quicksync_acquisition.cc | 24 +++++------ .../gps_l1_ca_pcps_tong_acquisition.cc | 23 +++++------ 15 files changed, 202 insertions(+), 224 deletions(-) diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.cc index 08884bdbc..4ba572b17 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.cc @@ -40,30 +40,28 @@ GalileoE1Pcps8msAmbiguousAcquisition::GalileoE1Pcps8msAmbiguousAcquisition( : configuration_(configuration), gnss_synchro_(nullptr), role_(role), + item_size_(sizeof(gr_complex)), threshold_(0.0), channel_(0), doppler_max_(configuration_->property(role + ".doppler_max", 5000)), doppler_step_(0), + sampled_ms_(configuration_->property(role + ".coherent_integration_time_ms", 4)), + max_dwells_(configuration_->property(role + ".max_dwells", 1)), in_streams_(in_streams), out_streams_(out_streams), dump_(configuration_->property(role + ".dump", false)) { const std::string default_item_type("gr_complex"); const std::string default_dump_filename("../data/acquisition.dat"); - - DLOG(INFO) << "role " << role; - - item_type_ = configuration_->property(role + ".item_type", - default_item_type); - + item_type_ = configuration_->property(role_ + ".item_type", default_item_type); int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 4000000); fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); + dump_filename_ = configuration_->property(role_ + ".dump_filename", default_dump_filename); if (FLAGS_doppler_max != 0) { doppler_max_ = FLAGS_doppler_max; } - sampled_ms_ = configuration_->property(role + ".coherent_integration_time_ms", 4); if (sampled_ms_ % 4 != 0) { @@ -73,11 +71,6 @@ GalileoE1Pcps8msAmbiguousAcquisition::GalileoE1Pcps8msAmbiguousAcquisition( << sampled_ms_ << " ms will be used."; } - max_dwells_ = configuration_->property(role + ".max_dwells", 1); - - dump_filename_ = configuration_->property(role + ".dump_filename", - default_dump_filename); - // -- Find number of samples per spreading code (4 ms) ----------------- code_length_ = static_cast(round( fs_in_ / (GALILEO_E1_CODE_CHIP_RATE_CPS / GALILEO_E1_B_CODE_LENGTH_CHIPS))); @@ -90,9 +83,9 @@ GalileoE1Pcps8msAmbiguousAcquisition::GalileoE1Pcps8msAmbiguousAcquisition( bool enable_monitor_output = configuration->property("AcquisitionMonitor.enable_monitor", false); + DLOG(INFO) << "role " << role_; if (item_type_ == "gr_complex") { - item_size_ = sizeof(gr_complex); acquisition_cc_ = galileo_pcps_8ms_make_acquisition_cc(sampled_ms_, max_dwells_, doppler_max_, fs_in_, samples_per_ms, code_length_, dump_, dump_filename_, enable_monitor_output); @@ -104,7 +97,9 @@ GalileoE1Pcps8msAmbiguousAcquisition::GalileoE1Pcps8msAmbiguousAcquisition( } else { - item_size_ = sizeof(gr_complex); + item_size_ = 0; + acquisition_cc_ = nullptr; + stream_to_vector_ = nullptr; LOG(WARNING) << item_type_ << " unknown acquisition item type"; } diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc index e36975a38..0a1dbe885 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc @@ -37,31 +37,31 @@ GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition( const ConfigurationInterface* configuration, const std::string& role, unsigned int in_streams, - unsigned int out_streams) : gnss_synchro_(nullptr), - configuration_(configuration), - role_(role), - threshold_(0.0), - doppler_center_(0), - channel_(0), - doppler_step_(0), - in_streams_(in_streams), - out_streams_(out_streams) + unsigned int out_streams) + : gnss_synchro_(nullptr), + configuration_(configuration), + role_(role), + threshold_(0.0), + doppler_center_(0), + channel_(0), + doppler_step_(0), + in_streams_(in_streams), + out_streams_(out_streams), + acquire_pilot_(configuration->property(role + ".acquire_pilot", false)) { acq_parameters_.ms_per_code = 4; - acq_parameters_.SetFromConfiguration(configuration_, role, GALILEO_E1_CODE_CHIP_RATE_CPS, GALILEO_E1_OPT_ACQ_FS_SPS); + acq_parameters_.SetFromConfiguration(configuration_, role_, GALILEO_E1_CODE_CHIP_RATE_CPS, GALILEO_E1_OPT_ACQ_FS_SPS); - DLOG(INFO) << "role " << role; + doppler_step_ = static_cast(acq_parameters_.doppler_step); + item_type_ = acq_parameters_.item_type; + item_size_ = acq_parameters_.it_size; + fs_in_ = acq_parameters_.fs_in; if (FLAGS_doppler_max != 0) { acq_parameters_.doppler_max = FLAGS_doppler_max; } doppler_max_ = acq_parameters_.doppler_max; - doppler_step_ = static_cast(acq_parameters_.doppler_step); - item_type_ = acq_parameters_.item_type; - item_size_ = acq_parameters_.it_size; - fs_in_ = acq_parameters_.fs_in; - acquire_pilot_ = configuration->property(role + ".acquire_pilot", false); code_length_ = static_cast(std::floor(static_cast(acq_parameters_.resampled_fs) / (GALILEO_E1_CODE_CHIP_RATE_CPS / GALILEO_E1_B_CODE_LENGTH_CHIPS))); vector_length_ = static_cast(std::floor(acq_parameters_.sampled_ms * acq_parameters_.samples_per_ms) * (acq_parameters_.bit_transition_flag ? 2.0 : 1.0)); @@ -69,6 +69,7 @@ GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition( sampled_ms_ = acq_parameters_.sampled_ms; + DLOG(INFO) << "role " << role_; acquisition_ = pcps_make_acquisition(acq_parameters_); DLOG(INFO) << "acquisition(" << acquisition_->unique_id() << ")"; diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc index 629179924..070d0a74c 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc @@ -34,26 +34,25 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga( const ConfigurationInterface* configuration, const std::string& role, unsigned int in_streams, - unsigned int out_streams) : gnss_synchro_(nullptr), - role_(role), - doppler_center_(0), - channel_(0), - doppler_step_(0), - in_streams_(in_streams), - out_streams_(out_streams) + unsigned int out_streams) + : gnss_synchro_(nullptr), + role_(role), + doppler_center_(0), + channel_(0), + doppler_step_(0), + in_streams_(in_streams), + out_streams_(out_streams), + acquire_pilot_(configuration->property(role + ".acquire_pilot", false)) { - acq_parameters_.SetFromConfiguration(configuration, role, fpga_downsampling_factor, fpga_buff_num, fpga_blk_exp, GALILEO_E1_CODE_CHIP_RATE_CPS, GALILEO_E1_B_CODE_LENGTH_CHIPS); - - DLOG(INFO) << "role " << role; + acq_parameters_.SetFromConfiguration(configuration, role_, fpga_downsampling_factor, fpga_buff_num, fpga_blk_exp, GALILEO_E1_CODE_CHIP_RATE_CPS, GALILEO_E1_B_CODE_LENGTH_CHIPS); + doppler_step_ = static_cast(acq_parameters_.doppler_step); + fs_in_ = acq_parameters_.fs_in; if (FLAGS_doppler_max != 0) { acq_parameters_.doppler_max = FLAGS_doppler_max; } doppler_max_ = acq_parameters_.doppler_max; - doppler_step_ = static_cast(acq_parameters_.doppler_step); - fs_in_ = acq_parameters_.fs_in; - acquire_pilot_ = configuration->property(role + ".acquire_pilot", false); // could be true in future versions uint32_t code_length = acq_parameters_.code_length; uint32_t nsamples_total = acq_parameters_.samples_per_code; @@ -131,6 +130,7 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga( acq_parameters_.all_fft_codes = d_all_fft_codes_.data(); + DLOG(INFO) << "role " << role_; acquisition_fpga_ = pcps_make_acquisition_fpga(acq_parameters_); if (in_streams_ > 1) diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.cc index 0f58f5d90..c7af648aa 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.cc @@ -32,29 +32,28 @@ GalileoE1PcpsCccwsrAmbiguousAcquisition::GalileoE1PcpsCccwsrAmbiguousAcquisition : configuration_(configuration), role_(role), gnss_synchro_(nullptr), + item_size_(sizeof(gr_complex)), threshold_(0.0), channel_(0), doppler_max_(configuration_->property(role + ".doppler_max", 5000)), doppler_step_(0), + sampled_ms_(configuration_->property(role + ".coherent_integration_time_ms", 4)), + max_dwells_(configuration_->property(role + ".max_dwells", 1)), in_streams_(in_streams), out_streams_(out_streams), dump_(configuration_->property(role + ".dump", false)) { const std::string default_item_type("gr_complex"); const std::string default_dump_filename("../data/acquisition.dat"); - - DLOG(INFO) << "role " << role; - - item_type_ = configuration_->property(role + ".item_type", default_item_type); - + item_type_ = configuration_->property(role_ + ".item_type", default_item_type); int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 4000000); fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); + dump_filename_ = configuration_->property(role_ + ".dump_filename", default_dump_filename); if (FLAGS_doppler_max != 0) { doppler_max_ = FLAGS_doppler_max; } - sampled_ms_ = configuration_->property(role + ".coherent_integration_time_ms", 4); if (sampled_ms_ % 4 != 0) { @@ -64,11 +63,6 @@ GalileoE1PcpsCccwsrAmbiguousAcquisition::GalileoE1PcpsCccwsrAmbiguousAcquisition << sampled_ms_ << " ms will be used."; } - max_dwells_ = configuration_->property(role + ".max_dwells", 1); - - dump_filename_ = configuration_->property(role + ".dump_filename", - default_dump_filename); - // -- Find number of samples per spreading code (4 ms) ----------------- code_length_ = static_cast(round( fs_in_ / (GALILEO_E1_CODE_CHIP_RATE_CPS / GALILEO_E1_B_CODE_LENGTH_CHIPS))); @@ -82,9 +76,9 @@ GalileoE1PcpsCccwsrAmbiguousAcquisition::GalileoE1PcpsCccwsrAmbiguousAcquisition bool enable_monitor_output = configuration_->property("AcquisitionMonitor.enable_monitor", false); + DLOG(INFO) << "role " << role_; if (item_type_ == "gr_complex") { - item_size_ = sizeof(gr_complex); acquisition_cc_ = pcps_cccwsr_make_acquisition_cc(sampled_ms_, max_dwells_, doppler_max_, fs_in_, samples_per_ms, code_length_, dump_, dump_filename_, enable_monitor_output); @@ -96,7 +90,8 @@ GalileoE1PcpsCccwsrAmbiguousAcquisition::GalileoE1PcpsCccwsrAmbiguousAcquisition } else { - item_size_ = sizeof(gr_complex); + item_size_ = 0; + acquisition_cc_ = nullptr; LOG(WARNING) << item_type_ << " unknown acquisition item type"; } diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.cc index 7c0da8f0a..2632418a7 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.cc @@ -40,30 +40,28 @@ GalileoE1PcpsQuickSyncAmbiguousAcquisition::GalileoE1PcpsQuickSyncAmbiguousAcqui : configuration_(configuration), role_(role), gnss_synchro_(nullptr), + item_size_(sizeof(gr_complex)), threshold_(0.0), channel_(0), doppler_max_(configuration_->property(role + ".doppler_max", 5000)), doppler_step_(0), + sampled_ms_(configuration_->property(role + ".coherent_integration_time_ms", 8)), in_streams_(in_streams), out_streams_(out_streams), + bit_transition_flag_(configuration_->property(role + ".bit_transition_flag", false)), dump_(configuration_->property(role + ".dump", false)) { const std::string default_item_type("gr_complex"); const std::string default_dump_filename("../data/acquisition.dat"); - - DLOG(INFO) << "role " << role; - - item_type_ = configuration_->property(role + ".item_type", - default_item_type); - + item_type_ = configuration_->property(role + ".item_type", default_item_type); int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 4000000); fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); + dump_filename_ = configuration_->property(role + ".dump_filename", default_dump_filename); if (FLAGS_doppler_max != 0) { doppler_max_ = FLAGS_doppler_max; } - sampled_ms_ = configuration_->property(role + ".coherent_integration_time_ms", 8); /* --- Find number of samples per spreading code (4 ms) -----------------*/ code_length_ = static_cast(round( @@ -71,6 +69,7 @@ GalileoE1PcpsQuickSyncAmbiguousAcquisition::GalileoE1PcpsQuickSyncAmbiguousAcqui auto samples_per_ms = static_cast(round(code_length_ / 4.0)); + DLOG(INFO) << "role " << role; /*Calculate the folding factor value based on the formula described in the paper. This may be a bug, but acquisition also work by variying the folding factor at va- lues different that the expressed in the paper. In adition, it is important to point @@ -100,7 +99,6 @@ GalileoE1PcpsQuickSyncAmbiguousAcquisition::GalileoE1PcpsQuickSyncAmbiguousAcqui } // vector_length_ = (sampled_ms_/folding_factor_) * code_length_; vector_length_ = sampled_ms_ * samples_per_ms; - bit_transition_flag_ = configuration_->property(role + ".bit_transition_flag", false); if (!bit_transition_flag_) { @@ -111,8 +109,6 @@ GalileoE1PcpsQuickSyncAmbiguousAcquisition::GalileoE1PcpsQuickSyncAmbiguousAcqui max_dwells_ = 2; } - dump_filename_ = configuration_->property(role + ".dump_filename", - default_dump_filename); bool enable_monitor_output = configuration_->property("AcquisitionMonitor.enable_monitor", false); @@ -124,7 +120,6 @@ GalileoE1PcpsQuickSyncAmbiguousAcquisition::GalileoE1PcpsQuickSyncAmbiguousAcqui << ", Code Length: " << code_length_; if (item_type_ == "gr_complex") { - item_size_ = sizeof(gr_complex); acquisition_cc_ = pcps_quicksync_make_acquisition_cc(folding_factor_, sampled_ms_, max_dwells_, doppler_max_, fs_in_, samples_per_ms, code_length_, bit_transition_flag_, @@ -138,7 +133,8 @@ GalileoE1PcpsQuickSyncAmbiguousAcquisition::GalileoE1PcpsQuickSyncAmbiguousAcqui } else { - item_size_ = sizeof(gr_complex); + acquisition_cc_ = nullptr; + item_size_ = 0; LOG(WARNING) << item_type_ << " unknown acquisition item type"; } diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.cc index 79b2433d6..59bd0e2a0 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.cc @@ -40,10 +40,15 @@ GalileoE1PcpsTongAmbiguousAcquisition::GalileoE1PcpsTongAmbiguousAcquisition( : configuration_(configuration), gnss_synchro_(nullptr), role_(role), + item_size_(sizeof(gr_complex)), threshold_(0.0), channel_(0), doppler_max_(configuration_->property(role + ".doppler_max", 5000)), doppler_step_(0), + sampled_ms_(configuration_->property(role + ".coherent_integration_time_ms", 4)), + tong_init_val_(configuration->property(role + ".tong_init_val", 1)), + tong_max_val_(configuration->property(role + ".tong_max_val", 2)), + tong_max_dwells_(configuration->property(role + ".tong_max_dwells", tong_max_val_ + 1)), in_streams_(in_streams), out_streams_(out_streams), dump_(configuration_->property(role + ".dump", false)) @@ -51,19 +56,12 @@ GalileoE1PcpsTongAmbiguousAcquisition::GalileoE1PcpsTongAmbiguousAcquisition( const std::string default_item_type("gr_complex"); const std::string default_dump_filename("../data/acquisition.dat"); - DLOG(INFO) << "role " << role; - - item_type_ = configuration_->property(role + ".item_type", - default_item_type); + DLOG(INFO) << "role " << role_; + item_type_ = configuration_->property(role_ + ".item_type", default_item_type); int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 4000000); fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - - if (FLAGS_doppler_max != 0) - { - doppler_max_ = FLAGS_doppler_max; - } - sampled_ms_ = configuration_->property(role + ".coherent_integration_time_ms", 4); + dump_filename_ = configuration_->property(role_ + ".dump_filename", default_dump_filename); if (sampled_ms_ % 4 != 0) { @@ -73,12 +71,10 @@ GalileoE1PcpsTongAmbiguousAcquisition::GalileoE1PcpsTongAmbiguousAcquisition( << sampled_ms_ << " ms will be used."; } - tong_init_val_ = configuration->property(role + ".tong_init_val", 1); - tong_max_val_ = configuration->property(role + ".tong_max_val", 2); - tong_max_dwells_ = configuration->property(role + ".tong_max_dwells", tong_max_val_ + 1); - - dump_filename_ = configuration_->property(role + ".dump_filename", - default_dump_filename); + if (FLAGS_doppler_max != 0) + { + doppler_max_ = FLAGS_doppler_max; + } bool enable_monitor_output = configuration_->property("AcquisitionMonitor.enable_monitor", false); @@ -95,7 +91,6 @@ GalileoE1PcpsTongAmbiguousAcquisition::GalileoE1PcpsTongAmbiguousAcquisition( if (item_type_ == "gr_complex") { - item_size_ = sizeof(gr_complex); acquisition_cc_ = pcps_tong_make_acquisition_cc(sampled_ms_, doppler_max_, fs_in_, samples_per_ms, code_length_, tong_init_val_, tong_max_val_, tong_max_dwells_, dump_, dump_filename_, enable_monitor_output); @@ -108,7 +103,8 @@ GalileoE1PcpsTongAmbiguousAcquisition::GalileoE1PcpsTongAmbiguousAcquisition( } else { - item_size_ = sizeof(gr_complex); + item_size_ = 0; + acquisition_cc_ = nullptr; LOG(WARNING) << item_type_ << " unknown acquisition item type"; } diff --git a/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.cc b/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.cc index 4bf6d2080..b51d12a73 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.cc +++ b/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.cc @@ -46,21 +46,24 @@ GalileoE5aNoncoherentIQAcquisitionCaf::GalileoE5aNoncoherentIQAcquisitionCaf( : configuration_(configuration), role_(role), gnss_synchro_(nullptr), + item_size_(sizeof(gr_complex)), threshold_(0.0), + Zero_padding(configuration_->property(role + ".Zero_padding", 0)), + CAF_window_hz_(configuration_->property(role + ".CAF_window_hz", 0)), channel_(0), doppler_max_(configuration_->property(role + ".doppler_max", 5000)), doppler_step_(0), + sampled_ms_(configuration_->property(role + ".coherent_integration_time_ms", 1)), + max_dwells_(configuration_->property(role + ".max_dwells", 1)), in_streams_(in_streams), out_streams_(out_streams), + bit_transition_flag_(configuration_->property(role + ".bit_transition_flag", false)), dump_(configuration_->property(role + ".dump", false)) { const std::string default_item_type("gr_complex"); const std::string default_dump_filename("../data/acquisition.dat"); - - DLOG(INFO) << "role " << role; - - item_type_ = configuration_->property(role + ".item_type", default_item_type); - + item_type_ = configuration_->property(role_ + ".item_type", default_item_type); + dump_filename_ = configuration_->property(role_ + ".dump_filename", default_dump_filename); int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 32000000); fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); @@ -68,9 +71,8 @@ GalileoE5aNoncoherentIQAcquisitionCaf::GalileoE5aNoncoherentIQAcquisitionCaf( { doppler_max_ = FLAGS_doppler_max; } - CAF_window_hz_ = configuration_->property(role + ".CAF_window_hz", 0); - Zero_padding = configuration_->property(role + ".Zero_padding", 0); - sampled_ms_ = configuration_->property(role + ".coherent_integration_time_ms", 1); + + DLOG(INFO) << "role " << role_; if (sampled_ms_ > 3) { sampled_ms_ = 3; @@ -84,10 +86,6 @@ GalileoE5aNoncoherentIQAcquisitionCaf::GalileoE5aNoncoherentIQAcquisitionCaf( std::cout << "Zero padding activated. Changing to 1ms code + 1ms zero padding\n"; } - max_dwells_ = configuration_->property(role + ".max_dwells", 1); - dump_filename_ = configuration_->property(role + ".dump_filename", default_dump_filename); - bit_transition_flag_ = configuration_->property(role + ".bit_transition_flag", false); - // -- Find number of samples per spreading code (1ms)------------------------- code_length_ = static_cast(round(static_cast(fs_in_) / GALILEO_E5A_CODE_CHIP_RATE_CPS * static_cast(GALILEO_E5A_CODE_LENGTH_CHIPS))); @@ -106,14 +104,14 @@ GalileoE5aNoncoherentIQAcquisitionCaf::GalileoE5aNoncoherentIQAcquisitionCaf( } if (item_type_ == "gr_complex") { - item_size_ = sizeof(gr_complex); acquisition_cc_ = galileo_e5a_noncoherentIQ_make_acquisition_caf_cc(sampled_ms_, max_dwells_, doppler_max_, fs_in_, code_length_, code_length_, bit_transition_flag_, dump_, dump_filename_, both_signal_components, CAF_window_hz_, Zero_padding, enable_monitor_output); } else { - item_size_ = sizeof(gr_complex); + item_size_ = 0; + acquisition_cc_ = nullptr; LOG(WARNING) << item_type_ << " unknown acquisition item type"; } diff --git a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.cc index 6e8574586..a62286f6b 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.cc @@ -37,32 +37,31 @@ GalileoE5aPcpsAcquisition::GalileoE5aPcpsAcquisition( const ConfigurationInterface* configuration, const std::string& role, unsigned int in_streams, - unsigned int out_streams) : gnss_synchro_(nullptr), - role_(role), - threshold_(0.0), - doppler_center_(0), - channel_(0), - doppler_step_(0), - in_streams_(in_streams), - out_streams_(out_streams) + unsigned int out_streams) + : gnss_synchro_(nullptr), + role_(role), + threshold_(0.0), + doppler_center_(0), + channel_(0), + doppler_step_(0), + in_streams_(in_streams), + out_streams_(out_streams), + acq_pilot_(configuration->property(role + ".acquire_pilot", false)), + acq_iq_(configuration->property(role + ".acquire_iq", false)) { acq_parameters_.ms_per_code = 1; - acq_parameters_.SetFromConfiguration(configuration, role, GALILEO_E5A_CODE_CHIP_RATE_CPS, GALILEO_E5A_OPT_ACQ_FS_SPS); - - DLOG(INFO) << "Role " << role; + acq_parameters_.SetFromConfiguration(configuration, role_, GALILEO_E5A_CODE_CHIP_RATE_CPS, GALILEO_E5A_OPT_ACQ_FS_SPS); + doppler_step_ = static_cast(acq_parameters_.doppler_step); + item_type_ = acq_parameters_.item_type; + item_size_ = acq_parameters_.it_size; + fs_in_ = acq_parameters_.fs_in; if (FLAGS_doppler_max != 0) { acq_parameters_.doppler_max = FLAGS_doppler_max; } doppler_max_ = acq_parameters_.doppler_max; - doppler_step_ = static_cast(acq_parameters_.doppler_step); - item_type_ = acq_parameters_.item_type; - item_size_ = acq_parameters_.it_size; - fs_in_ = acq_parameters_.fs_in; - acq_pilot_ = configuration->property(role + ".acquire_pilot", false); - acq_iq_ = configuration->property(role + ".acquire_iq", false); if (acq_iq_) { acq_pilot_ = false; @@ -74,6 +73,7 @@ GalileoE5aPcpsAcquisition::GalileoE5aPcpsAcquisition( sampled_ms_ = acq_parameters_.sampled_ms; + DLOG(INFO) << "Role " << role_; acquisition_ = pcps_make_acquisition(acq_parameters_); DLOG(INFO) << "acquisition(" << acquisition_->unique_id() << ")"; diff --git a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc index 444a56d7f..ed8601211 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc @@ -33,28 +33,27 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga( const ConfigurationInterface* configuration, const std::string& role, unsigned int in_streams, - unsigned int out_streams) : gnss_synchro_(nullptr), - role_(role), - doppler_center_(0), - channel_(0), - doppler_step_(0), - in_streams_(in_streams), - out_streams_(out_streams) + unsigned int out_streams) + : gnss_synchro_(nullptr), + role_(role), + doppler_center_(0), + channel_(0), + doppler_step_(0), + in_streams_(in_streams), + out_streams_(out_streams), + acq_pilot_(configuration->property(role + ".acquire_pilot", false)), + acq_iq_(configuration->property(role + ".acquire_iq", false)) { - acq_parameters_.SetFromConfiguration(configuration, role, fpga_downsampling_factor, fpga_buff_num, fpga_blk_exp, GALILEO_E5A_CODE_CHIP_RATE_CPS, GALILEO_E5A_CODE_LENGTH_CHIPS); - - DLOG(INFO) << "Role " << role; + acq_parameters_.SetFromConfiguration(configuration, role_, fpga_downsampling_factor, fpga_buff_num, fpga_blk_exp, GALILEO_E5A_CODE_CHIP_RATE_CPS, GALILEO_E5A_CODE_LENGTH_CHIPS); + doppler_step_ = static_cast(acq_parameters_.doppler_step); + fs_in_ = acq_parameters_.fs_in; if (FLAGS_doppler_max != 0) { acq_parameters_.doppler_max = FLAGS_doppler_max; } doppler_max_ = acq_parameters_.doppler_max; - doppler_step_ = static_cast(acq_parameters_.doppler_step); - fs_in_ = acq_parameters_.fs_in; - acq_pilot_ = configuration->property(role + ".acquire_pilot", false); - acq_iq_ = configuration->property(role + ".acquire_iq", false); if (acq_iq_) { acq_pilot_ = false; @@ -138,6 +137,7 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga( acq_parameters_.all_fft_codes = d_all_fft_codes_.data(); + DLOG(INFO) << "role " << role_; acquisition_fpga_ = pcps_make_acquisition_fpga(acq_parameters_); if (in_streams_ > 1) diff --git a/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition.cc index 8fa09c554..1480137ea 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition.cc @@ -37,32 +37,31 @@ namespace own = gsl; GalileoE5bPcpsAcquisition::GalileoE5bPcpsAcquisition(const ConfigurationInterface* configuration, const std::string& role, unsigned int in_streams, - unsigned int out_streams) : gnss_synchro_(nullptr), - role_(role), - threshold_(0.0), - doppler_center_(0), - channel_(0), - doppler_step_(0), - in_streams_(in_streams), - out_streams_(out_streams) + unsigned int out_streams) + : gnss_synchro_(nullptr), + role_(role), + threshold_(0.0), + doppler_center_(0), + channel_(0), + doppler_step_(0), + in_streams_(in_streams), + out_streams_(out_streams), + acq_pilot_(configuration->property(role + ".acquire_pilot", false)), + acq_iq_(configuration->property(role + ".acquire_iq", false)) { acq_parameters_.ms_per_code = 1; - acq_parameters_.SetFromConfiguration(configuration, role, GALILEO_E5B_CODE_CHIP_RATE_CPS, GALILEO_E5B_OPT_ACQ_FS_SPS); - - DLOG(INFO) << "Role " << role; + acq_parameters_.SetFromConfiguration(configuration, role_, GALILEO_E5B_CODE_CHIP_RATE_CPS, GALILEO_E5B_OPT_ACQ_FS_SPS); + doppler_step_ = static_cast(acq_parameters_.doppler_step); + item_type_ = acq_parameters_.item_type; + item_size_ = acq_parameters_.it_size; + fs_in_ = acq_parameters_.fs_in; if (FLAGS_doppler_max != 0) { acq_parameters_.doppler_max = FLAGS_doppler_max; } doppler_max_ = acq_parameters_.doppler_max; - doppler_step_ = static_cast(acq_parameters_.doppler_step); - item_type_ = acq_parameters_.item_type; - item_size_ = acq_parameters_.it_size; - fs_in_ = acq_parameters_.fs_in; - acq_pilot_ = configuration->property(role + ".acquire_pilot", false); - acq_iq_ = configuration->property(role + ".acquire_iq", false); if (acq_iq_) { acq_pilot_ = false; @@ -74,6 +73,7 @@ GalileoE5bPcpsAcquisition::GalileoE5bPcpsAcquisition(const ConfigurationInterfac sampled_ms_ = acq_parameters_.sampled_ms; + DLOG(INFO) << "role " << role_; acquisition_ = pcps_make_acquisition(acq_parameters_); DLOG(INFO) << "acquisition(" << acquisition_->unique_id() << ")"; diff --git a/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.cc index be2e26680..0c97f0184 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.cc @@ -32,26 +32,27 @@ GalileoE5bPcpsAcquisitionFpga::GalileoE5bPcpsAcquisitionFpga(const ConfigurationInterface* configuration, const std::string& role, unsigned int in_streams, - unsigned int out_streams) : gnss_synchro_(nullptr), - role_(role), - doppler_center_(0), - channel_(0), - doppler_step_(0), - in_streams_(in_streams), - out_streams_(out_streams) + unsigned int out_streams) + : gnss_synchro_(nullptr), + role_(role), + doppler_center_(0), + channel_(0), + doppler_step_(0), + in_streams_(in_streams), + out_streams_(out_streams), + acq_pilot_(configuration->property(role + ".acquire_pilot", false)), + acq_iq_(configuration->property(role + ".acquire_iq", false)) { - acq_parameters_.SetFromConfiguration(configuration, role, fpga_downsampling_factor, fpga_buff_num, fpga_blk_exp, GALILEO_E5B_CODE_CHIP_RATE_CPS, GALILEO_E5B_CODE_LENGTH_CHIPS); + acq_parameters_.SetFromConfiguration(configuration, role_, fpga_downsampling_factor, fpga_buff_num, fpga_blk_exp, GALILEO_E5B_CODE_CHIP_RATE_CPS, GALILEO_E5B_CODE_LENGTH_CHIPS); + doppler_step_ = static_cast(acq_parameters_.doppler_step); + fs_in_ = acq_parameters_.fs_in; if (FLAGS_doppler_max != 0) { acq_parameters_.doppler_max = FLAGS_doppler_max; } doppler_max_ = acq_parameters_.doppler_max; - doppler_step_ = static_cast(acq_parameters_.doppler_step); - fs_in_ = acq_parameters_.fs_in; - acq_pilot_ = configuration->property(role + ".acquire_pilot", false); - acq_iq_ = configuration->property(role + ".acquire_iq", false); if (acq_iq_) { acq_pilot_ = false; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fine_doppler.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fine_doppler.cc index c96e41c1c..0ba02b62c 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fine_doppler.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fine_doppler.cc @@ -31,36 +31,39 @@ GpsL1CaPcpsAcquisitionFineDoppler::GpsL1CaPcpsAcquisitionFineDoppler( const ConfigurationInterface* configuration, const std::string& role, unsigned int in_streams, - unsigned int out_streams) : role_(role), - doppler_max_(configuration->property(role + ".doppler_max", 5000)), - in_streams_(in_streams), - out_streams_(out_streams), - dump_(configuration->property(role + ".dump", false)) + unsigned int out_streams) + : role_(role), + gnss_synchro_(nullptr), + item_size_(sizeof(gr_complex)), + threshold_(0.0), + doppler_max_(configuration->property(role + ".doppler_max", 5000)), + max_dwells_(configuration->property(role + ".max_dwells", 1)), + channel_(0), + doppler_step_(0), + sampled_ms_(configuration->property(role + ".coherent_integration_time_ms", 1)), + in_streams_(in_streams), + out_streams_(out_streams), + dump_(configuration->property(role + ".dump", false)) { const std::string default_item_type("gr_complex"); std::string default_dump_filename = "./acquisition.mat"; - - DLOG(INFO) << "role " << role; Acq_Conf acq_parameters = Acq_Conf(); - item_type_ = configuration->property(role + ".item_type", default_item_type); + item_type_ = configuration->property(role_ + ".item_type", default_item_type); int64_t fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); fs_in_ = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); acq_parameters.fs_in = fs_in_; acq_parameters.samples_per_chip = static_cast(ceil(GPS_L1_CA_CHIP_PERIOD_S * static_cast(acq_parameters.fs_in))); acq_parameters.dump = dump_; - dump_filename_ = configuration->property(role + ".dump_filename", default_dump_filename); + dump_filename_ = configuration->property(role_ + ".dump_filename", default_dump_filename); acq_parameters.dump_filename = dump_filename_; if (FLAGS_doppler_max != 0) { doppler_max_ = FLAGS_doppler_max; } acq_parameters.doppler_max = doppler_max_; - sampled_ms_ = configuration->property(role + ".coherent_integration_time_ms", 1); acq_parameters.sampled_ms = sampled_ms_; - max_dwells_ = configuration->property(role + ".max_dwells", 1); acq_parameters.max_dwells = max_dwells_; - acq_parameters.blocking_on_standby = configuration->property(role + ".blocking_on_standby", false); // -- Find number of samples per spreading code ------------------------- @@ -68,22 +71,18 @@ GpsL1CaPcpsAcquisitionFineDoppler::GpsL1CaPcpsAcquisitionFineDoppler( acq_parameters.samples_per_ms = static_cast(vector_length_); code_ = std::vector>(vector_length_); + DLOG(INFO) << "role " << role_; if (item_type_ == "gr_complex") { - item_size_ = sizeof(gr_complex); acquisition_cc_ = pcps_make_acquisition_fine_doppler_cc(acq_parameters); } else { - item_size_ = sizeof(gr_complex); + item_size_ = 0; + acquisition_cc_ = nullptr; LOG(WARNING) << item_type_ << " unknown acquisition item type"; } - channel_ = 0; - threshold_ = 0.0; - doppler_step_ = 0; - gnss_synchro_ = nullptr; - if (in_streams_ > 1) { LOG(ERROR) << "This implementation only supports one input stream"; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.cc index a9175fcb8..9c9dfd7e3 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.cc @@ -30,18 +30,24 @@ GpsL1CaPcpsAssistedAcquisition::GpsL1CaPcpsAssistedAcquisition( const ConfigurationInterface* configuration, const std::string& role, unsigned int in_streams, - unsigned int out_streams) : role_(role), - doppler_max_(configuration->property(role + ".doppler_max", 5000)), - in_streams_(in_streams), - out_streams_(out_streams), - dump_(configuration->property(role + ".dump", false)) + unsigned int out_streams) + : role_(role), + gnss_synchro_(nullptr), + item_size_(sizeof(gr_complex)), + threshold_(0.0), + doppler_max_(configuration->property(role + ".doppler_max", 5000)), + max_dwells_(configuration->property(role + ".max_dwells", 1)), + channel_(0), + doppler_step_(0), + sampled_ms_(configuration->property(role + ".coherent_integration_time_ms", 1)), + in_streams_(in_streams), + out_streams_(out_streams), + dump_(configuration->property(role + ".dump", false)) { const std::string default_item_type("gr_complex"); std::string default_dump_filename = "./data/acquisition.dat"; - - DLOG(INFO) << "role " << role; - - item_type_ = configuration->property(role + ".item_type", default_item_type); + dump_filename_ = configuration->property(role_ + ".dump_filename", default_dump_filename); + item_type_ = configuration->property(role_ + ".item_type", default_item_type); int64_t fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); fs_in_ = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); @@ -49,10 +55,8 @@ GpsL1CaPcpsAssistedAcquisition::GpsL1CaPcpsAssistedAcquisition( { doppler_max_ = FLAGS_doppler_max; } - doppler_min_ = configuration->property(role + ".doppler_min", -doppler_max_); - sampled_ms_ = configuration->property(role + ".coherent_integration_time_ms", 1); - max_dwells_ = configuration->property(role + ".max_dwells", 1); - dump_filename_ = configuration->property(role + ".dump_filename", default_dump_filename); + doppler_min_ = configuration->property(role_ + ".doppler_min", -doppler_max_); + bool enable_monitor_output = configuration->property("AcquisitionMonitor.enable_monitor", false); // --- Find number of samples per spreading code ------------------------- @@ -60,24 +64,20 @@ GpsL1CaPcpsAssistedAcquisition::GpsL1CaPcpsAssistedAcquisition( code_ = std::vector>(vector_length_); + DLOG(INFO) << "role " << role_; if (item_type_ == "gr_complex") { - item_size_ = sizeof(gr_complex); acquisition_cc_ = pcps_make_assisted_acquisition_cc(max_dwells_, sampled_ms_, doppler_max_, doppler_min_, fs_in_, vector_length_, dump_, dump_filename_, enable_monitor_output); } else { - item_size_ = sizeof(gr_complex); + item_size_ = 0; + acquisition_cc_ = nullptr; LOG(WARNING) << item_type_ << " unknown acquisition item type"; } - channel_ = 0; - threshold_ = 0.0; - doppler_step_ = 0; - gnss_synchro_ = nullptr; - if (in_streams_ > 1) { LOG(ERROR) << "This implementation only supports one input stream"; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_quicksync_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_quicksync_acquisition.cc index a65d5b5ec..ee09ec085 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_quicksync_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_quicksync_acquisition.cc @@ -41,20 +41,20 @@ GpsL1CaPcpsQuickSyncAcquisition::GpsL1CaPcpsQuickSyncAcquisition( : configuration_(configuration), role_(role), gnss_synchro_(nullptr), + item_size_(sizeof(gr_complex)), threshold_(0.0), channel_(0), doppler_max_(configuration->property(role + ".doppler_max", 5000)), doppler_step_(0), + sampled_ms_(configuration_->property(role + ".coherent_integration_time_ms", 4)), in_streams_(in_streams), out_streams_(out_streams), + bit_transition_flag_(configuration_->property(role + ".bit_transition_flag", false)), dump_(configuration_->property(role + ".dump", false)) { const std::string default_item_type("gr_complex"); std::string default_dump_filename = "./data/acquisition.dat"; - - DLOG(INFO) << "role " << role; - - item_type_ = configuration_->property(role + ".item_type", default_item_type); + item_type_ = configuration_->property(role_ + ".item_type", default_item_type); int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000); fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); @@ -62,14 +62,13 @@ GpsL1CaPcpsQuickSyncAcquisition::GpsL1CaPcpsQuickSyncAcquisition( { doppler_max_ = FLAGS_doppler_max; } - sampled_ms_ = configuration_->property(role + ".coherent_integration_time_ms", 4); // -- Find number of samples per spreading code ------------------------- code_length_ = static_cast(round(fs_in_ / (GPS_L1_CA_CODE_RATE_CPS / GPS_L1_CA_CODE_LENGTH_CHIPS))); - /* Calculate the folding factor value based on the calculations */ + /* Calculate the folding factor value */ auto temp = static_cast(ceil(sqrt(log2(code_length_)))); - folding_factor_ = configuration_->property(role + ".folding_factor", temp); + folding_factor_ = configuration_->property(role_ + ".folding_factor", temp); if (sampled_ms_ % folding_factor_ != 0) { @@ -90,23 +89,24 @@ GpsL1CaPcpsQuickSyncAcquisition::GpsL1CaPcpsQuickSyncAcquisition( } vector_length_ = code_length_ * sampled_ms_; - bit_transition_flag_ = configuration_->property(role + ".bit_transition_flag", false); if (!bit_transition_flag_) { - max_dwells_ = configuration_->property(role + ".max_dwells", 1); + max_dwells_ = configuration_->property(role_ + ".max_dwells", 1); } else { max_dwells_ = 2; } - dump_filename_ = configuration_->property(role + ".dump_filename", default_dump_filename); + dump_filename_ = configuration_->property(role_ + ".dump_filename", default_dump_filename); bool enable_monitor_output = configuration_->property("AcquisitionMonitor.enable_monitor", false); int samples_per_ms = round(code_length_); code_ = std::vector>(code_length_); + + DLOG(INFO) << "role " << role_; /* Object relevant information for debugging */ LOG(INFO) << "Implementation: " << this->implementation() << ", Vector Length: " << vector_length_ @@ -117,7 +117,6 @@ GpsL1CaPcpsQuickSyncAcquisition::GpsL1CaPcpsQuickSyncAcquisition( if (item_type_ == "gr_complex") { - item_size_ = sizeof(gr_complex); acquisition_cc_ = pcps_quicksync_make_acquisition_cc(folding_factor_, sampled_ms_, max_dwells_, doppler_max_, fs_in_, samples_per_ms, code_length_, bit_transition_flag_, @@ -131,7 +130,8 @@ GpsL1CaPcpsQuickSyncAcquisition::GpsL1CaPcpsQuickSyncAcquisition( } else { - item_size_ = sizeof(gr_complex); + item_size_ = 0; + acquisition_cc_ = nullptr; LOG(WARNING) << item_type_ << " unknown acquisition item type"; } diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.cc index db90a4a94..bc31812fb 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.cc @@ -40,10 +40,15 @@ GpsL1CaPcpsTongAcquisition::GpsL1CaPcpsTongAcquisition( : configuration_(configuration), gnss_synchro_(nullptr), role_(role), + item_size_(sizeof(gr_complex)), threshold_(0.0), channel_(0), doppler_max_(configuration->property(role + ".doppler_max", 5000)), doppler_step_(0), + sampled_ms_(configuration_->property(role + ".coherent_integration_time_ms", 1)), + tong_init_val_(configuration->property(role + ".tong_init_val", 1)), + tong_max_val_(configuration->property(role + ".tong_max_val", 2)), + tong_max_dwells_(configuration->property(role + ".tong_max_dwells", tong_max_val_ + 1)), in_streams_(in_streams), out_streams_(out_streams), dump_(configuration_->property(role + ".dump", false)) @@ -51,25 +56,17 @@ GpsL1CaPcpsTongAcquisition::GpsL1CaPcpsTongAcquisition( const std::string default_item_type("gr_complex"); std::string default_dump_filename = "./data/acquisition.dat"; - DLOG(INFO) << "role " << role; - - item_type_ = configuration_->property(role + ".item_type", default_item_type); + DLOG(INFO) << "role " << role_; + item_type_ = configuration_->property(role_ + ".item_type", default_item_type); int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000); fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); + dump_filename_ = configuration_->property(role_ + ".dump_filename", default_dump_filename); if (FLAGS_doppler_max != 0) { doppler_max_ = FLAGS_doppler_max; } - sampled_ms_ = configuration_->property(role + ".coherent_integration_time_ms", 1); - - tong_init_val_ = configuration->property(role + ".tong_init_val", 1); - tong_max_val_ = configuration->property(role + ".tong_max_val", 2); - tong_max_dwells_ = configuration->property(role + ".tong_max_dwells", tong_max_val_ + 1); - - dump_filename_ = configuration_->property(role + ".dump_filename", default_dump_filename); - bool enable_monitor_output = configuration_->property("AcquisitionMonitor.enable_monitor", false); // -- Find number of samples per spreading code ------------------------- @@ -81,7 +78,6 @@ GpsL1CaPcpsTongAcquisition::GpsL1CaPcpsTongAcquisition( if (item_type_ == "gr_complex") { - item_size_ = sizeof(gr_complex); acquisition_cc_ = pcps_tong_make_acquisition_cc(sampled_ms_, doppler_max_, fs_in_, code_length_, code_length_, tong_init_val_, tong_max_val_, tong_max_dwells_, dump_, dump_filename_, enable_monitor_output); @@ -93,7 +89,8 @@ GpsL1CaPcpsTongAcquisition::GpsL1CaPcpsTongAcquisition( } else { - item_size_ = sizeof(gr_complex); + acquisition_cc_ = nullptr; + item_size_ = 0; LOG(WARNING) << item_type_ << " unknown acquisition item type"; } From f09da3ded65fb1f27b0d7bbcdab65562ad99ebeb Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 10 Dec 2022 08:55:17 +0100 Subject: [PATCH 53/59] Make clang-tidy happy --- .../galileo_e1_pcps_ambiguous_acquisition.cc | 10 ++++------ ...ileo_e1_pcps_ambiguous_acquisition_fpga.cc | 4 ++-- .../adapters/galileo_e5a_pcps_acquisition.cc | 19 +++++++++---------- .../galileo_e5a_pcps_acquisition_fpga.cc | 15 +++++++-------- .../adapters/galileo_e5b_pcps_acquisition.cc | 19 +++++++++---------- .../galileo_e5b_pcps_acquisition_fpga.cc | 15 +++++++-------- 6 files changed, 38 insertions(+), 44 deletions(-) diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc index 0a1dbe885..f4097b600 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc @@ -44,7 +44,6 @@ GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition( threshold_(0.0), doppler_center_(0), channel_(0), - doppler_step_(0), in_streams_(in_streams), out_streams_(out_streams), acquire_pilot_(configuration->property(role + ".acquire_pilot", false)) @@ -52,16 +51,15 @@ GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition( acq_parameters_.ms_per_code = 4; acq_parameters_.SetFromConfiguration(configuration_, role_, GALILEO_E1_CODE_CHIP_RATE_CPS, GALILEO_E1_OPT_ACQ_FS_SPS); - doppler_step_ = static_cast(acq_parameters_.doppler_step); - item_type_ = acq_parameters_.item_type; - item_size_ = acq_parameters_.it_size; - fs_in_ = acq_parameters_.fs_in; - if (FLAGS_doppler_max != 0) { acq_parameters_.doppler_max = FLAGS_doppler_max; } doppler_max_ = acq_parameters_.doppler_max; + doppler_step_ = static_cast(acq_parameters_.doppler_step); + item_type_ = acq_parameters_.item_type; + item_size_ = acq_parameters_.it_size; + fs_in_ = acq_parameters_.fs_in; code_length_ = static_cast(std::floor(static_cast(acq_parameters_.resampled_fs) / (GALILEO_E1_CODE_CHIP_RATE_CPS / GALILEO_E1_B_CODE_LENGTH_CHIPS))); vector_length_ = static_cast(std::floor(acq_parameters_.sampled_ms * acq_parameters_.samples_per_ms) * (acq_parameters_.bit_transition_flag ? 2.0 : 1.0)); diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc index 070d0a74c..926b680e4 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc @@ -46,13 +46,13 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga( { acq_parameters_.SetFromConfiguration(configuration, role_, fpga_downsampling_factor, fpga_buff_num, fpga_blk_exp, GALILEO_E1_CODE_CHIP_RATE_CPS, GALILEO_E1_B_CODE_LENGTH_CHIPS); - doppler_step_ = static_cast(acq_parameters_.doppler_step); - fs_in_ = acq_parameters_.fs_in; if (FLAGS_doppler_max != 0) { acq_parameters_.doppler_max = FLAGS_doppler_max; } doppler_max_ = acq_parameters_.doppler_max; + doppler_step_ = static_cast(acq_parameters_.doppler_step); + fs_in_ = acq_parameters_.fs_in; uint32_t code_length = acq_parameters_.code_length; uint32_t nsamples_total = acq_parameters_.samples_per_code; diff --git a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.cc index a62286f6b..3d9eee1fa 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.cc @@ -43,7 +43,6 @@ GalileoE5aPcpsAcquisition::GalileoE5aPcpsAcquisition( threshold_(0.0), doppler_center_(0), channel_(0), - doppler_step_(0), in_streams_(in_streams), out_streams_(out_streams), acq_pilot_(configuration->property(role + ".acquire_pilot", false)), @@ -52,20 +51,15 @@ GalileoE5aPcpsAcquisition::GalileoE5aPcpsAcquisition( acq_parameters_.ms_per_code = 1; acq_parameters_.SetFromConfiguration(configuration, role_, GALILEO_E5A_CODE_CHIP_RATE_CPS, GALILEO_E5A_OPT_ACQ_FS_SPS); - doppler_step_ = static_cast(acq_parameters_.doppler_step); - item_type_ = acq_parameters_.item_type; - item_size_ = acq_parameters_.it_size; - fs_in_ = acq_parameters_.fs_in; if (FLAGS_doppler_max != 0) { acq_parameters_.doppler_max = FLAGS_doppler_max; } doppler_max_ = acq_parameters_.doppler_max; - - if (acq_iq_) - { - acq_pilot_ = false; - } + doppler_step_ = static_cast(acq_parameters_.doppler_step); + item_type_ = acq_parameters_.item_type; + item_size_ = acq_parameters_.it_size; + fs_in_ = acq_parameters_.fs_in; code_length_ = static_cast(std::floor(static_cast(acq_parameters_.resampled_fs) / (GALILEO_E5A_CODE_CHIP_RATE_CPS / GALILEO_E5A_CODE_LENGTH_CHIPS))); vector_length_ = static_cast(std::floor(acq_parameters_.sampled_ms * acq_parameters_.samples_per_ms) * (acq_parameters_.bit_transition_flag ? 2.0 : 1.0)); @@ -77,6 +71,11 @@ GalileoE5aPcpsAcquisition::GalileoE5aPcpsAcquisition( acquisition_ = pcps_make_acquisition(acq_parameters_); DLOG(INFO) << "acquisition(" << acquisition_->unique_id() << ")"; + if (acq_iq_) + { + acq_pilot_ = false; + } + if (in_streams_ > 1) { LOG(ERROR) << "This implementation only supports one input stream"; diff --git a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc index ed8601211..497da79e9 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc @@ -38,7 +38,6 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga( role_(role), doppler_center_(0), channel_(0), - doppler_step_(0), in_streams_(in_streams), out_streams_(out_streams), acq_pilot_(configuration->property(role + ".acquire_pilot", false)), @@ -46,18 +45,13 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga( { acq_parameters_.SetFromConfiguration(configuration, role_, fpga_downsampling_factor, fpga_buff_num, fpga_blk_exp, GALILEO_E5A_CODE_CHIP_RATE_CPS, GALILEO_E5A_CODE_LENGTH_CHIPS); - doppler_step_ = static_cast(acq_parameters_.doppler_step); - fs_in_ = acq_parameters_.fs_in; if (FLAGS_doppler_max != 0) { acq_parameters_.doppler_max = FLAGS_doppler_max; } doppler_max_ = acq_parameters_.doppler_max; - - if (acq_iq_) - { - acq_pilot_ = false; - } + doppler_step_ = static_cast(acq_parameters_.doppler_step); + fs_in_ = acq_parameters_.fs_in; uint32_t code_length = acq_parameters_.code_length; uint32_t nsamples_total = acq_parameters_.samples_per_code; @@ -69,6 +63,11 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga( volk_gnsssdr::vector> fft_codes_padded(nsamples_total); d_all_fft_codes_ = volk_gnsssdr::vector(nsamples_total * GALILEO_E5A_NUMBER_OF_CODES); // memory containing all the possible fft codes for PRN 0 to 32 + if (acq_iq_) + { + acq_pilot_ = false; + } + float max; // temporary maxima search int32_t tmp; int32_t tmp2; diff --git a/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition.cc index 1480137ea..5f8af8baf 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition.cc @@ -43,7 +43,6 @@ GalileoE5bPcpsAcquisition::GalileoE5bPcpsAcquisition(const ConfigurationInterfac threshold_(0.0), doppler_center_(0), channel_(0), - doppler_step_(0), in_streams_(in_streams), out_streams_(out_streams), acq_pilot_(configuration->property(role + ".acquire_pilot", false)), @@ -52,20 +51,15 @@ GalileoE5bPcpsAcquisition::GalileoE5bPcpsAcquisition(const ConfigurationInterfac acq_parameters_.ms_per_code = 1; acq_parameters_.SetFromConfiguration(configuration, role_, GALILEO_E5B_CODE_CHIP_RATE_CPS, GALILEO_E5B_OPT_ACQ_FS_SPS); - doppler_step_ = static_cast(acq_parameters_.doppler_step); - item_type_ = acq_parameters_.item_type; - item_size_ = acq_parameters_.it_size; - fs_in_ = acq_parameters_.fs_in; if (FLAGS_doppler_max != 0) { acq_parameters_.doppler_max = FLAGS_doppler_max; } doppler_max_ = acq_parameters_.doppler_max; - - if (acq_iq_) - { - acq_pilot_ = false; - } + doppler_step_ = static_cast(acq_parameters_.doppler_step); + item_type_ = acq_parameters_.item_type; + item_size_ = acq_parameters_.it_size; + fs_in_ = acq_parameters_.fs_in; code_length_ = static_cast(std::floor(static_cast(acq_parameters_.resampled_fs) / (GALILEO_E5B_CODE_CHIP_RATE_CPS / GALILEO_E5B_CODE_LENGTH_CHIPS))); vector_length_ = static_cast(std::floor(acq_parameters_.sampled_ms * acq_parameters_.samples_per_ms) * (acq_parameters_.bit_transition_flag ? 2.0F : 1.0F)); @@ -77,6 +71,11 @@ GalileoE5bPcpsAcquisition::GalileoE5bPcpsAcquisition(const ConfigurationInterfac acquisition_ = pcps_make_acquisition(acq_parameters_); DLOG(INFO) << "acquisition(" << acquisition_->unique_id() << ")"; + if (acq_iq_) + { + acq_pilot_ = false; + } + if (in_streams_ > 1) { LOG(ERROR) << "This implementation only supports one input stream"; diff --git a/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.cc index 0c97f0184..f75d29db4 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.cc @@ -44,19 +44,13 @@ GalileoE5bPcpsAcquisitionFpga::GalileoE5bPcpsAcquisitionFpga(const Configuration acq_iq_(configuration->property(role + ".acquire_iq", false)) { acq_parameters_.SetFromConfiguration(configuration, role_, fpga_downsampling_factor, fpga_buff_num, fpga_blk_exp, GALILEO_E5B_CODE_CHIP_RATE_CPS, GALILEO_E5B_CODE_LENGTH_CHIPS); - - doppler_step_ = static_cast(acq_parameters_.doppler_step); - fs_in_ = acq_parameters_.fs_in; if (FLAGS_doppler_max != 0) { acq_parameters_.doppler_max = FLAGS_doppler_max; } doppler_max_ = acq_parameters_.doppler_max; - - if (acq_iq_) - { - acq_pilot_ = false; - } + doppler_step_ = static_cast(acq_parameters_.doppler_step); + fs_in_ = acq_parameters_.fs_in; uint32_t code_length = acq_parameters_.code_length; uint32_t nsamples_total = acq_parameters_.samples_per_code; @@ -68,6 +62,11 @@ GalileoE5bPcpsAcquisitionFpga::GalileoE5bPcpsAcquisitionFpga(const Configuration volk_gnsssdr::vector> fft_codes_padded(nsamples_total); d_all_fft_codes_ = volk_gnsssdr::vector(nsamples_total * GALILEO_E5B_NUMBER_OF_CODES); // memory containing all the possible fft codes for PRN 0 to 32 + if (acq_iq_) + { + acq_pilot_ = false; + } + float max; // temporary maxima search int32_t tmp; int32_t tmp2; From eb255dec9e0a7ccc9173a2fca787303614378a90 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 11 Dec 2022 10:21:32 +0100 Subject: [PATCH 54/59] Avoid throwing in Tlm_CRC_Stats destructor (fix bugprone-exception-escape check). More consistent private member naming. --- .../telemetry_decoder/libs/tlm_crc_stats.cc | 104 ++++++++++-------- .../telemetry_decoder/libs/tlm_crc_stats.h | 12 +- 2 files changed, 62 insertions(+), 54 deletions(-) diff --git a/src/algorithms/telemetry_decoder/libs/tlm_crc_stats.cc b/src/algorithms/telemetry_decoder/libs/tlm_crc_stats.cc index 840a3aba9..2a57d55ac 100644 --- a/src/algorithms/telemetry_decoder/libs/tlm_crc_stats.cc +++ b/src/algorithms/telemetry_decoder/libs/tlm_crc_stats.cc @@ -23,21 +23,21 @@ #include // for std::move -void Tlm_CRC_Stats::initialize(std::string dump_crc_stats_filename_) +void Tlm_CRC_Stats::initialize(std::string dump_crc_stats_filename) { - d_dump_crc_stats_filename = std::move(dump_crc_stats_filename_); + d_dump_crc_stats_filename = std::move(dump_crc_stats_filename); - enable_crc_stats = true; - num_crc_ok = 0; - num_crc_not_ok = 0; + d_enable_crc_stats = true; + d_num_crc_ok = 0; + d_num_crc_not_ok = 0; } -bool Tlm_CRC_Stats::set_channel(int32_t channel_) +bool Tlm_CRC_Stats::set_channel(int32_t channel) { std::string dump_path; - channel = channel_; + d_channel = channel; // Get path if (d_dump_crc_stats_filename.find_last_of('/') != std::string::npos) @@ -57,7 +57,7 @@ bool Tlm_CRC_Stats::set_channel(int32_t channel_) } d_dump_crc_stats_filename.append("_ch"); - d_dump_crc_stats_filename.append(std::to_string(channel)); + d_dump_crc_stats_filename.append(std::to_string(d_channel)); d_dump_crc_stats_filename.append(".txt"); d_dump_crc_stats_filename = dump_path + fs::path::preferred_separator + d_dump_crc_stats_filename; @@ -65,17 +65,17 @@ bool Tlm_CRC_Stats::set_channel(int32_t channel_) if (!gnss_sdr_create_directory(dump_path)) { std::cerr << "GNSS-SDR cannot create telemetry CRC stats dump file for the Telemetry block. The telemetry CRC statistics has been disabled. Wrong permissions?\n"; - enable_crc_stats = false; + d_enable_crc_stats = false; } - d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); + d_dump_file.exceptions(std::ofstream::failbit | std::ofstream::badbit); try { d_dump_file.open(d_dump_crc_stats_filename.c_str(), std::ios::out); } - catch (const std::ifstream::failure &e) + catch (const std::ofstream::failure &e) { LOG(WARNING) << "Exception opening telemetry CRC stats dump file " << e.what(); - enable_crc_stats = false; + d_enable_crc_stats = false; } return true; @@ -86,61 +86,69 @@ void Tlm_CRC_Stats::update_CRC_stats(bool CRC) { if (CRC) { - num_crc_ok++; + d_num_crc_ok++; } else { - num_crc_not_ok++; + d_num_crc_not_ok++; } } Tlm_CRC_Stats::~Tlm_CRC_Stats() { - uint32_t num_crc_tests = num_crc_ok + num_crc_not_ok; + const uint32_t num_crc_tests = d_num_crc_ok + d_num_crc_not_ok; float success_rate = 0.0; if (num_crc_tests > 0) { - success_rate = static_cast(num_crc_ok) / static_cast(num_crc_tests); + success_rate = static_cast(d_num_crc_ok) / static_cast(num_crc_tests); } - std::string txt_num_crc_tests("Num CRC Tests"); - uint32_t align_num_crc_tests = txt_num_crc_tests.length(); - std::string txt_success_tests(" | Successful Tests"); - uint32_t align_success_tests = txt_success_tests.length(); - std::string txt_success_rate(" | Success rate"); - uint32_t align_success_rate = txt_success_rate.length(); - std::string txt_delimiter(" |"); - uint32_t align_delimiter = txt_delimiter.length(); - if (enable_crc_stats) + try { - // write results to the telemetry CRC statistics output file - try - { - d_dump_file << txt_num_crc_tests << txt_success_tests << txt_success_rate << std::endl; - d_dump_file << std::setw(align_num_crc_tests) << num_crc_tests << txt_delimiter << std::setw(align_success_tests - align_delimiter) << num_crc_ok << txt_delimiter << std::setw(align_success_rate - align_delimiter) << std::setprecision(4) << success_rate << std::endl; - } - catch (const std::exception &ex) - { - DLOG(INFO) << "Telemetry CRC stats cannot write on the output file " << d_dump_crc_stats_filename.c_str(); - } + const std::string txt_num_crc_tests("Num CRC Tests"); + const auto align_num_crc_tests = txt_num_crc_tests.length(); + const std::string txt_success_tests(" | Successful Tests"); + const auto align_success_tests = txt_success_tests.length(); + const std::string txt_success_rate(" | Success rate"); + const auto align_success_rate = txt_success_rate.length(); + const std::string txt_delimiter(" |"); + const auto align_delimiter = txt_delimiter.length(); - const auto pos = d_dump_file.tellp(); - try + if (d_enable_crc_stats && d_dump_file.is_open()) { - d_dump_file.close(); - } - catch (const std::exception &ex) - { - LOG(WARNING) << "Exception in destructor closing the telemetry CRC stats dump file " << ex.what(); - } - if (pos == 0) - { - errorlib::error_code ec; - if (!fs::remove(fs::path(d_dump_crc_stats_filename), ec)) + // write results to the telemetry CRC statistics output file + try { - std::cerr << "Problem removing telemetry CRC stats temporary file " << d_dump_crc_stats_filename << '\n'; + d_dump_file << txt_num_crc_tests << txt_success_tests << txt_success_rate << std::endl; + d_dump_file << std::setw(align_num_crc_tests) << num_crc_tests << txt_delimiter << std::setw(align_success_tests - align_delimiter) << d_num_crc_ok << txt_delimiter << std::setw(align_success_rate - align_delimiter) << std::setprecision(4) << success_rate << std::endl; + } + catch (const std::exception &ex) + { + DLOG(INFO) << "Telemetry CRC stats cannot write on the output file " << d_dump_crc_stats_filename.c_str(); + } + + const auto pos = d_dump_file.tellp(); + try + { + d_dump_file.close(); + } + catch (const std::exception &ex) + { + LOG(WARNING) << "Exception in destructor closing the telemetry CRC stats dump file " << ex.what(); + } + if (pos == 0) + { + errorlib::error_code ec; + if (!fs::remove(fs::path(d_dump_crc_stats_filename), ec)) + { + std::cerr << "Problem removing telemetry CRC stats temporary file " << d_dump_crc_stats_filename << '\n'; + } } } } + catch (const std::exception &e) + { + std::cerr << "Problem in Tlm_CRC_Stats destructor: " << e.what() << '\n'; + } } diff --git a/src/algorithms/telemetry_decoder/libs/tlm_crc_stats.h b/src/algorithms/telemetry_decoder/libs/tlm_crc_stats.h index 110464ba1..9da8e4c9e 100644 --- a/src/algorithms/telemetry_decoder/libs/tlm_crc_stats.h +++ b/src/algorithms/telemetry_decoder/libs/tlm_crc_stats.h @@ -39,12 +39,12 @@ public: /*! * \brief Initialize the telemetry CRC statistics */ - void initialize(std::string dump_crc_stats_filename_); + void initialize(std::string dump_crc_stats_filename); /*! * \brief Initialize the channel number and output file */ - bool set_channel(int32_t channel_); + bool set_channel(int32_t channel); /*! * \brief Update the CRC statistics @@ -54,10 +54,10 @@ public: private: std::ofstream d_dump_file; std::string d_dump_crc_stats_filename; - uint32_t num_crc_ok{0}; - uint32_t num_crc_not_ok{0}; - int32_t channel{0}; - bool enable_crc_stats{false}; + uint32_t d_num_crc_ok{0}; + uint32_t d_num_crc_not_ok{0}; + int32_t d_channel{0}; + bool d_enable_crc_stats{false}; }; From 79d6a3f166caa65e612d2d46e714ddacbc970708 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 11 Dec 2022 12:48:00 +0100 Subject: [PATCH 55/59] Use ofstream instead of ifstream where appropriate --- src/algorithms/PVT/libs/rtklib_solver.cc | 2 +- .../observables/gnuradio_blocks/hybrid_observables_gs.cc | 6 +++--- .../gnuradio_blocks/beidou_b1i_telemetry_decoder_gs.cc | 6 +++--- .../gnuradio_blocks/beidou_b3i_telemetry_decoder_gs.cc | 6 +++--- .../gnuradio_blocks/galileo_telemetry_decoder_gs.cc | 6 +++--- .../gnuradio_blocks/glonass_l1_ca_telemetry_decoder_gs.cc | 6 +++--- .../gnuradio_blocks/glonass_l2_ca_telemetry_decoder_gs.cc | 6 +++--- .../gnuradio_blocks/gps_l1_ca_telemetry_decoder_gs.cc | 6 +++--- .../gnuradio_blocks/gps_l2c_telemetry_decoder_gs.cc | 6 +++--- .../gnuradio_blocks/gps_l5_telemetry_decoder_gs.cc | 6 +++--- .../tracking/gnuradio_blocks/dll_pll_veml_tracking.cc | 6 +++--- .../tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.cc | 6 +++--- .../gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc | 6 +++--- .../glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc | 6 +++--- .../glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc | 6 +++--- .../gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.cc | 6 +++--- .../glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc | 6 +++--- .../gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.cc | 6 +++--- .../gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.cc | 6 +++--- .../gnuradio_blocks/gps_l1_ca_gaussian_tracking_cc.cc | 6 +++--- .../gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.cc | 6 +++--- src/algorithms/tracking/gnuradio_blocks/kf_tracking.cc | 6 +++--- 22 files changed, 64 insertions(+), 64 deletions(-) diff --git a/src/algorithms/PVT/libs/rtklib_solver.cc b/src/algorithms/PVT/libs/rtklib_solver.cc index bab77a024..bb4fbd63d 100644 --- a/src/algorithms/PVT/libs/rtklib_solver.cc +++ b/src/algorithms/PVT/libs/rtklib_solver.cc @@ -1228,7 +1228,7 @@ bool Rtklib_Solver::get_PVT(const std::map &gnss_observables_ d_dump_file.write(reinterpret_cast(&d_dop[2]), sizeof(double)); d_dump_file.write(reinterpret_cast(&d_dop[3]), sizeof(double)); } - catch (const std::ifstream::failure &e) + catch (const std::ofstream::failure &e) { LOG(WARNING) << "Exception writing RTKLIB dump file " << e.what(); } diff --git a/src/algorithms/observables/gnuradio_blocks/hybrid_observables_gs.cc b/src/algorithms/observables/gnuradio_blocks/hybrid_observables_gs.cc index ea55fe1c7..b7f2c56be 100644 --- a/src/algorithms/observables/gnuradio_blocks/hybrid_observables_gs.cc +++ b/src/algorithms/observables/gnuradio_blocks/hybrid_observables_gs.cc @@ -149,13 +149,13 @@ hybrid_observables_gs::hybrid_observables_gs(const Obs_Conf &conf_) std::cerr << "GNSS-SDR cannot create dump file for the Observables block. Wrong permissions?\n"; d_dump = false; } - d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); + d_dump_file.exceptions(std::ofstream::failbit | std::ofstream::badbit); try { d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary); LOG(INFO) << "Observables dump enabled Log file: " << d_dump_filename.c_str(); } - catch (const std::ifstream::failure &e) + catch (const std::ofstream::failure &e) { LOG(WARNING) << "Exception opening observables dump file " << e.what(); d_dump = false; @@ -871,7 +871,7 @@ int hybrid_observables_gs::general_work(int noutput_items __attribute__((unused) d_dump_file.write(reinterpret_cast(&tmp_double), sizeof(double)); } } - catch (const std::ifstream::failure &e) + catch (const std::ofstream::failure &e) { LOG(WARNING) << "Exception writing observables dump file " << e.what(); d_dump = false; diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b1i_telemetry_decoder_gs.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b1i_telemetry_decoder_gs.cc index 729dd2af3..1cd4d849a 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b1i_telemetry_decoder_gs.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b1i_telemetry_decoder_gs.cc @@ -402,11 +402,11 @@ void beidou_b1i_telemetry_decoder_gs::set_channel(int32_t channel) { d_dump_filename.append(std::to_string(d_channel)); d_dump_filename.append(".dat"); - d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); + d_dump_file.exceptions(std::ofstream::failbit | std::ofstream::badbit); d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary); LOG(INFO) << "Telemetry decoder dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str(); } - catch (const std::ifstream::failure &e) + catch (const std::ofstream::failure &e) { LOG(WARNING) << "channel " << d_channel << ": exception opening Beidou TLM dump file. " << e.what(); } @@ -663,7 +663,7 @@ int beidou_b1i_telemetry_decoder_gs::general_work(int noutput_items __attribute_ tmp_int = static_cast(current_symbol.PRN); d_dump_file.write(reinterpret_cast(&tmp_int), sizeof(int32_t)); } - catch (const std::ifstream::failure &e) + catch (const std::ofstream::failure &e) { LOG(WARNING) << "Exception writing Telemetry GPS L5 dump file " << e.what(); } diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b3i_telemetry_decoder_gs.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b3i_telemetry_decoder_gs.cc index 0ea53fad5..8088f51d7 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b3i_telemetry_decoder_gs.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b3i_telemetry_decoder_gs.cc @@ -418,13 +418,13 @@ void beidou_b3i_telemetry_decoder_gs::set_channel(int32_t channel) { d_dump_filename.append(std::to_string(d_channel)); d_dump_filename.append(".dat"); - d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); + d_dump_file.exceptions(std::ofstream::failbit | std::ofstream::badbit); d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary); LOG(INFO) << "Telemetry decoder dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str(); } - catch (const std::ifstream::failure &e) + catch (const std::ofstream::failure &e) { LOG(WARNING) << "channel " << d_channel << ": exception opening Beidou TLM dump file. " @@ -692,7 +692,7 @@ int beidou_b3i_telemetry_decoder_gs::general_work( tmp_int = static_cast(current_symbol.PRN); d_dump_file.write(reinterpret_cast(&tmp_int), sizeof(int32_t)); } - catch (const std::ifstream::failure &e) + catch (const std::ofstream::failure &e) { LOG(WARNING) << "Exception writing Telemetry GPS L5 dump file " << e.what(); } diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_telemetry_decoder_gs.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_telemetry_decoder_gs.cc index 6b451b04a..def867de7 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_telemetry_decoder_gs.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_telemetry_decoder_gs.cc @@ -718,11 +718,11 @@ void galileo_telemetry_decoder_gs::set_channel(int32_t channel) { d_dump_filename.append(std::to_string(d_channel)); d_dump_filename.append(".dat"); - d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); + d_dump_file.exceptions(std::ofstream::failbit | std::ofstream::badbit); d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary); LOG(INFO) << "Telemetry decoder dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str(); } - catch (const std::ifstream::failure &e) + catch (const std::ofstream::failure &e) { LOG(WARNING) << "channel " << d_channel << " Exception opening trk dump file " << e.what(); } @@ -1276,7 +1276,7 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__(( tmp_int = static_cast(current_symbol.PRN); d_dump_file.write(reinterpret_cast(&tmp_int), sizeof(int32_t)); } - catch (const std::ifstream::failure &e) + catch (const std::ofstream::failure &e) { LOG(WARNING) << "Exception writing navigation data dump file " << e.what(); } diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_gs.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_gs.cc index ef9964a4a..44d0bf1f9 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_gs.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_gs.cc @@ -289,11 +289,11 @@ void glonass_l1_ca_telemetry_decoder_gs::set_channel(int32_t channel) { d_dump_filename.append(std::to_string(d_channel)); d_dump_filename.append(".dat"); - d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); + d_dump_file.exceptions(std::ofstream::failbit | std::ofstream::badbit); d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary); LOG(INFO) << "Telemetry decoder dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str(); } - catch (const std::ifstream::failure &e) + catch (const std::ofstream::failure &e) { LOG(WARNING) << "channel " << d_channel << ": exception opening Glonass TLM dump file. " << e.what(); } @@ -495,7 +495,7 @@ int glonass_l1_ca_telemetry_decoder_gs::general_work(int noutput_items __attribu tmp_int = static_cast(current_symbol.PRN); d_dump_file.write(reinterpret_cast(&tmp_int), sizeof(int32_t)); } - catch (const std::ifstream::failure &e) + catch (const std::ofstream::failure &e) { LOG(WARNING) << "Exception writing observables dump file " << e.what(); } diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l2_ca_telemetry_decoder_gs.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l2_ca_telemetry_decoder_gs.cc index b0a6d8812..a115907a6 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l2_ca_telemetry_decoder_gs.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l2_ca_telemetry_decoder_gs.cc @@ -288,11 +288,11 @@ void glonass_l2_ca_telemetry_decoder_gs::set_channel(int32_t channel) { d_dump_filename.append(std::to_string(d_channel)); d_dump_filename.append(".dat"); - d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); + d_dump_file.exceptions(std::ofstream::failbit | std::ofstream::badbit); d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary); LOG(INFO) << "Telemetry decoder dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str(); } - catch (const std::ifstream::failure &e) + catch (const std::ofstream::failure &e) { LOG(WARNING) << "channel " << d_channel << ": exception opening Glonass TLM dump file. " << e.what(); } @@ -497,7 +497,7 @@ int glonass_l2_ca_telemetry_decoder_gs::general_work(int noutput_items __attribu tmp_int = static_cast(current_symbol.PRN); d_dump_file.write(reinterpret_cast(&tmp_int), sizeof(int32_t)); } - catch (const std::ifstream::failure &e) + catch (const std::ofstream::failure &e) { LOG(WARNING) << "Exception writing observables dump file " << e.what(); } diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_gs.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_gs.cc index b44dc0abc..e03d02eaa 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_gs.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_gs.cc @@ -234,12 +234,12 @@ void gps_l1_ca_telemetry_decoder_gs::set_channel(int32_t channel) { d_dump_filename.append(std::to_string(d_channel)); d_dump_filename.append(".dat"); - d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); + d_dump_file.exceptions(std::ofstream::failbit | std::ofstream::badbit); d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary); LOG(INFO) << "Telemetry decoder dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str(); } - catch (const std::ifstream::failure &e) + catch (const std::ofstream::failure &e) { LOG(WARNING) << "channel " << d_channel << " Exception opening trk dump file " << e.what(); } @@ -646,7 +646,7 @@ int gps_l1_ca_telemetry_decoder_gs::general_work(int noutput_items __attribute__ tmp_int = static_cast(current_symbol.PRN); d_dump_file.write(reinterpret_cast(&tmp_int), sizeof(int32_t)); } - catch (const std::ifstream::failure &e) + catch (const std::ofstream::failure &e) { LOG(WARNING) << "Exception writing observables dump file " << e.what(); } diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l2c_telemetry_decoder_gs.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l2c_telemetry_decoder_gs.cc index d84b34d41..cd0c817f6 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l2c_telemetry_decoder_gs.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l2c_telemetry_decoder_gs.cc @@ -156,12 +156,12 @@ void gps_l2c_telemetry_decoder_gs::set_channel(int channel) { d_dump_filename.append(std::to_string(d_channel)); d_dump_filename.append(".dat"); - d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); + d_dump_file.exceptions(std::ofstream::failbit | std::ofstream::badbit); d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary); LOG(INFO) << "Telemetry decoder dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str(); } - catch (const std::ifstream::failure &e) + catch (const std::ofstream::failure &e) { LOG(WARNING) << "channel " << d_channel << " Exception opening Telemetry GPS L2 dump file " << e.what(); } @@ -336,7 +336,7 @@ int gps_l2c_telemetry_decoder_gs::general_work(int noutput_items __attribute__(( tmp_int = static_cast(current_synchro_data.PRN); d_dump_file.write(reinterpret_cast(&tmp_int), sizeof(int32_t)); } - catch (const std::ifstream::failure &e) + catch (const std::ofstream::failure &e) { LOG(WARNING) << "Exception writing Telemetry GPS L2 dump file " << e.what(); } diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l5_telemetry_decoder_gs.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l5_telemetry_decoder_gs.cc index 77ceed511..d4c915cc5 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l5_telemetry_decoder_gs.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l5_telemetry_decoder_gs.cc @@ -155,12 +155,12 @@ void gps_l5_telemetry_decoder_gs::set_channel(int32_t channel) { d_dump_filename.append(std::to_string(d_channel)); d_dump_filename.append(".dat"); - d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); + d_dump_file.exceptions(std::ofstream::failbit | std::ofstream::badbit); d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary); LOG(INFO) << "Telemetry decoder dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str(); } - catch (const std::ifstream::failure &e) + catch (const std::ofstream::failure &e) { LOG(WARNING) << "channel " << d_channel << " Exception opening Telemetry GPS L5 dump file " << e.what(); } @@ -352,7 +352,7 @@ int gps_l5_telemetry_decoder_gs::general_work(int noutput_items __attribute__((u tmp_int = static_cast(current_synchro_data.PRN); d_dump_file.write(reinterpret_cast(&tmp_int), sizeof(int32_t)); } - catch (const std::ifstream::failure &e) + catch (const std::ofstream::failure &e) { LOG(WARNING) << "Exception writing Telemetry GPS L5 dump file " << e.what(); } diff --git a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc index beb9c11b6..1d367d70e 100644 --- a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc +++ b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc @@ -1464,7 +1464,7 @@ void dll_pll_veml_tracking::log_data() uint32_t prn_ = d_acquisition_gnss_synchro->PRN; d_dump_file.write(reinterpret_cast(&prn_), sizeof(uint32_t)); } - catch (const std::ifstream::failure &e) + catch (const std::ofstream::failure &e) { LOG(WARNING) << "Exception writing trk dump file " << e.what(); } @@ -1690,11 +1690,11 @@ void dll_pll_veml_tracking::set_channel(uint32_t channel) { try { - d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); + d_dump_file.exceptions(std::ofstream::failbit | std::ofstream::badbit); d_dump_file.open(dump_filename_.c_str(), std::ios::out | std::ios::binary); LOG(INFO) << "Tracking dump enabled on channel " << d_channel << " Log file: " << dump_filename_.c_str(); } - catch (const std::ifstream::failure &e) + catch (const std::ofstream::failure &e) { LOG(WARNING) << "channel " << d_channel << " Exception opening trk dump file " << e.what(); } diff --git a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.cc b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.cc index 3c30b5fe2..923fc8fa0 100644 --- a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.cc +++ b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.cc @@ -1101,7 +1101,7 @@ void dll_pll_veml_tracking_fpga::log_data() uint32_t prn_ = d_acquisition_gnss_synchro->PRN; d_dump_file.write(reinterpret_cast(&prn_), sizeof(uint32_t)); } - catch (const std::ifstream::failure &e) + catch (const std::ofstream::failure &e) { LOG(WARNING) << "Exception writing trk dump file " << e.what(); } @@ -1329,11 +1329,11 @@ void dll_pll_veml_tracking_fpga::set_channel(uint32_t channel, const std::string { try { - d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); + d_dump_file.exceptions(std::ofstream::failbit | std::ofstream::badbit); d_dump_file.open(dump_filename_.c_str(), std::ios::out | std::ios::binary); LOG(INFO) << "Tracking dump enabled on channel " << d_channel << " Log file: " << dump_filename_.c_str(); } - catch (const std::ifstream::failure &e) + catch (const std::ofstream::failure &e) { LOG(WARNING) << "channel " << d_channel << " Exception opening trk dump file " << e.what(); } diff --git a/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc index 9f2a4bbef..4b6a44d14 100644 --- a/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc @@ -234,11 +234,11 @@ void Galileo_E1_Tcp_Connector_Tracking_cc::set_channel(uint32_t channel) { d_dump_filename.append(std::to_string(d_channel)); d_dump_filename.append(".dat"); - d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); + d_dump_file.exceptions(std::ofstream::failbit | std::ofstream::badbit); d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary); LOG(INFO) << "Tracking dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str(); } - catch (const std::ifstream::failure &e) + catch (const std::ofstream::failure &e) { LOG(WARNING) << "channel " << d_channel << " Exception opening trk dump file " << e.what(); } @@ -501,7 +501,7 @@ int Galileo_E1_Tcp_Connector_Tracking_cc::general_work(int noutput_items __attri uint32_t prn_ = d_acquisition_gnss_synchro->PRN; d_dump_file.write(reinterpret_cast(&prn_), sizeof(uint32_t)); } - catch (const std::ifstream::failure &e) + catch (const std::ofstream::failure &e) { LOG(WARNING) << "Exception writing trk dump file " << e.what(); } diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc index a0a7948c2..d3531eac8 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc @@ -513,11 +513,11 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_cc::set_channel(uint32_t channel) { d_dump_filename.append(std::to_string(d_channel)); d_dump_filename.append(".dat"); - d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); + d_dump_file.exceptions(std::ofstream::failbit | std::ofstream::badbit); d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary); LOG(INFO) << "Tracking dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str() << '\n'; } - catch (const std::ifstream::failure &e) + catch (const std::ofstream::failure &e) { LOG(WARNING) << "channel " << d_channel << " Exception opening trk dump file " << e.what(); } @@ -873,7 +873,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at uint32_t prn_ = d_acquisition_gnss_synchro->PRN; d_dump_file.write(reinterpret_cast(&prn_), sizeof(uint32_t)); } - catch (const std::ifstream::failure &e) + catch (const std::ofstream::failure &e) { LOG(WARNING) << "Exception writing trk dump file " << e.what(); } diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc index f106df5af..c7dc7c22c 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc @@ -516,11 +516,11 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_sc::set_channel(uint32_t channel) { d_dump_filename.append(std::to_string(d_channel)); d_dump_filename.append(".dat"); - d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); + d_dump_file.exceptions(std::ofstream::failbit | std::ofstream::badbit); d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary); LOG(INFO) << "Tracking dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str() << '\n'; } - catch (const std::ifstream::failure &e) + catch (const std::ofstream::failure &e) { LOG(WARNING) << "channel " << d_channel << " Exception opening trk dump file " << e.what(); } @@ -875,7 +875,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at uint32_t prn_ = d_acquisition_gnss_synchro->PRN; d_dump_file.write(reinterpret_cast(&prn_), sizeof(uint32_t)); } - catch (const std::ifstream::failure &e) + catch (const std::ofstream::failure &e) { LOG(WARNING) << "Exception writing trk dump file " << e.what(); } diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.cc index a2755d6d4..4962899df 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.cc @@ -453,11 +453,11 @@ void Glonass_L1_Ca_Dll_Pll_Tracking_cc::set_channel(uint32_t channel) { d_dump_filename.append(std::to_string(d_channel)); d_dump_filename.append(".dat"); - d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); + d_dump_file.exceptions(std::ofstream::failbit | std::ofstream::badbit); d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary); LOG(INFO) << "Tracking dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str(); } - catch (const std::ifstream::failure &e) + catch (const std::ofstream::failure &e) { LOG(WARNING) << "channel " << d_channel << " Exception opening trk dump file " << e.what(); } @@ -699,7 +699,7 @@ int Glonass_L1_Ca_Dll_Pll_Tracking_cc::general_work(int noutput_items __attribut uint32_t prn_ = d_acquisition_gnss_synchro->PRN; d_dump_file.write(reinterpret_cast(&prn_), sizeof(uint32_t)); } - catch (const std::ifstream::failure &e) + catch (const std::ofstream::failure &e) { LOG(WARNING) << "Exception writing trk dump file " << e.what(); } diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc index d59e9ecd3..bbba59cbf 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc @@ -512,11 +512,11 @@ void glonass_l2_ca_dll_pll_c_aid_tracking_cc::set_channel(uint32_t channel) { d_dump_filename.append(std::to_string(d_channel)); d_dump_filename.append(".dat"); - d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); + d_dump_file.exceptions(std::ofstream::failbit | std::ofstream::badbit); d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary); LOG(INFO) << "Tracking dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str() << '\n'; } - catch (const std::ifstream::failure &e) + catch (const std::ofstream::failure &e) { LOG(WARNING) << "channel " << d_channel << " Exception opening trk dump file " << e.what(); } @@ -868,7 +868,7 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at uint32_t prn_ = d_acquisition_gnss_synchro->PRN; d_dump_file.write(reinterpret_cast(&prn_), sizeof(uint32_t)); } - catch (const std::ifstream::failure &e) + catch (const std::ofstream::failure &e) { LOG(WARNING) << "Exception writing trk dump file " << e.what(); } diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.cc index 58295fe21..a1afb3c84 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.cc @@ -455,11 +455,11 @@ void Glonass_L2_Ca_Dll_Pll_Tracking_cc::set_channel(uint32_t channel) { d_dump_filename.append(std::to_string(d_channel)); d_dump_filename.append(".dat"); - d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); + d_dump_file.exceptions(std::ofstream::failbit | std::ofstream::badbit); d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary); LOG(INFO) << "Tracking dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str(); } - catch (const std::ifstream::failure &e) + catch (const std::ofstream::failure &e) { LOG(WARNING) << "channel " << d_channel << " Exception opening trk dump file " << e.what(); } @@ -701,7 +701,7 @@ int Glonass_L2_Ca_Dll_Pll_Tracking_cc::general_work(int noutput_items __attribut uint32_t prn_ = d_acquisition_gnss_synchro->PRN; d_dump_file.write(reinterpret_cast(&prn_), sizeof(uint32_t)); } - catch (const std::ifstream::failure &e) + catch (const std::ofstream::failure &e) { LOG(WARNING) << "Exception writing trk dump file " << e.what(); } diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.cc index 41cf605ae..1b6e7f2f6 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.cc @@ -282,11 +282,11 @@ void Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::set_channel(uint32_t channel) { d_dump_filename.append(boost::lexical_cast(d_channel)); d_dump_filename.append(".dat"); - d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); + d_dump_file.exceptions(std::ofstream::failbit | std::ofstream::badbit); d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary); LOG(INFO) << "Tracking dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str(); } - catch (const std::ifstream::failure *e) + catch (const std::ofstream::failure *e) { LOG(WARNING) << "channel " << d_channel << " Exception opening trk dump file " << e->what(); } @@ -540,7 +540,7 @@ int Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::general_work(int noutput_items __attribut uint32_t prn_ = d_acquisition_gnss_synchro->PRN; d_dump_file.write(reinterpret_cast(&prn_), sizeof(uint32_t)); } - catch (const std::ifstream::failure *e) + catch (const std::ofstream::failure *e) { LOG(WARNING) << "Exception writing trk dump file " << e->what(); } diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_gaussian_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_gaussian_tracking_cc.cc index 1092ed3a6..6faf12488 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_gaussian_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_gaussian_tracking_cc.cc @@ -575,11 +575,11 @@ void Gps_L1_Ca_Gaussian_Tracking_cc::set_channel(uint32_t channel) { d_dump_filename.append(std::to_string(d_channel)); d_dump_filename.append(".dat"); - d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); + d_dump_file.exceptions(std::ofstream::failbit | std::ofstream::badbit); d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary); LOG(INFO) << "Tracking dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str(); } - catch (const std::ifstream::failure &e) + catch (const std::ofstream::failure &e) { LOG(WARNING) << "channel " << d_channel << " Exception opening trk dump file " << e.what(); } @@ -879,7 +879,7 @@ int Gps_L1_Ca_Gaussian_Tracking_cc::general_work(int noutput_items __attribute__ uint32_t prn_ = d_acquisition_gnss_synchro->PRN; d_dump_file.write(reinterpret_cast(&prn_), sizeof(uint32_t)); } - catch (const std::ifstream::failure &e) + catch (const std::ofstream::failure &e) { LOG(WARNING) << "Exception writing trk dump file " << e.what(); } diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.cc index 06b2c262e..f646d7512 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.cc @@ -257,11 +257,11 @@ void Gps_L1_Ca_Tcp_Connector_Tracking_cc::set_channel(uint32_t channel) { d_dump_filename.append(std::to_string(d_channel)); d_dump_filename.append(".dat"); - d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); + d_dump_file.exceptions(std::ofstream::failbit | std::ofstream::badbit); d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary); LOG(INFO) << "Tracking dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str(); } - catch (const std::ifstream::failure &e) + catch (const std::ofstream::failure &e) { LOG(WARNING) << "channel " << d_channel << " Exception opening trk dump file " << e.what(); } @@ -531,7 +531,7 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work(int noutput_items __attrib uint32_t prn_ = d_acquisition_gnss_synchro->PRN; d_dump_file.write(reinterpret_cast(&prn_), sizeof(uint32_t)); } - catch (const std::ifstream::failure &e) + catch (const std::ofstream::failure &e) { LOG(WARNING) << "Exception writing trk dump file " << e.what(); } diff --git a/src/algorithms/tracking/gnuradio_blocks/kf_tracking.cc b/src/algorithms/tracking/gnuradio_blocks/kf_tracking.cc index 7b53a6f0f..a12be9774 100644 --- a/src/algorithms/tracking/gnuradio_blocks/kf_tracking.cc +++ b/src/algorithms/tracking/gnuradio_blocks/kf_tracking.cc @@ -1521,7 +1521,7 @@ void kf_tracking::log_data() uint32_t prn_ = d_acquisition_gnss_synchro->PRN; d_dump_file.write(reinterpret_cast(&prn_), sizeof(uint32_t)); } - catch (const std::ifstream::failure &e) + catch (const std::ofstream::failure &e) { LOG(WARNING) << "Exception writing trk dump file " << e.what(); } @@ -1747,11 +1747,11 @@ void kf_tracking::set_channel(uint32_t channel) { try { - d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); + d_dump_file.exceptions(std::ofstream::failbit | std::ofstream::badbit); d_dump_file.open(dump_filename_.c_str(), std::ios::out | std::ios::binary); LOG(INFO) << "Tracking dump enabled on channel " << d_channel << " Log file: " << dump_filename_.c_str(); } - catch (const std::ifstream::failure &e) + catch (const std::ofstream::failure &e) { LOG(WARNING) << "channel " << d_channel << " Exception opening trk dump file " << e.what(); } From bbada7f811a4b8a848d644c074a58be1df7b5c81 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 11 Dec 2022 13:31:24 +0100 Subject: [PATCH 56/59] Use ofstream instead of ifstream where appropriate --- src/algorithms/signal_source/libs/fpga_buffer_monitor.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/algorithms/signal_source/libs/fpga_buffer_monitor.cc b/src/algorithms/signal_source/libs/fpga_buffer_monitor.cc index 0f97b93a7..136409f12 100644 --- a/src/algorithms/signal_source/libs/fpga_buffer_monitor.cc +++ b/src/algorithms/signal_source/libs/fpga_buffer_monitor.cc @@ -111,11 +111,11 @@ Fpga_buffer_monitor::Fpga_buffer_monitor(const std::string &device_name, { try { - d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); + d_dump_file.exceptions(std::ofstream::failbit | std::ofstream::badbit); d_dump_file.open(dump_filename_.c_str(), std::ios::out | std::ios::binary); LOG(INFO) << "FPGA buffer monitor dump enabled. Log file: " << dump_filename_.c_str(); } - catch (const std::ifstream::failure &e) + catch (const std::ofstream::failure &e) { LOG(WARNING) << "Exception opening FPGA buffer monitor dump file " << e.what(); } From e4a3a060eef609393784b9d92ce819e0489a98d6 Mon Sep 17 00:00:00 2001 From: Vladislav P Date: Fri, 26 Aug 2022 16:27:01 +0300 Subject: [PATCH 57/59] Implement GLONASS string error correction Signed-off-by: Vladislav P --- src/core/system_parameters/GLONASS_L1_L2_CA.h | 1 + .../glonass_gnav_navigation_message.cc | 27 ++++++++++++++++--- .../glonass_gnav_navigation_message.h | 2 +- .../glonass_gnav_crc_test.cc | 12 +++++++-- 4 files changed, 36 insertions(+), 6 deletions(-) diff --git a/src/core/system_parameters/GLONASS_L1_L2_CA.h b/src/core/system_parameters/GLONASS_L1_L2_CA.h index e893f7df7..042754742 100644 --- a/src/core/system_parameters/GLONASS_L1_L2_CA.h +++ b/src/core/system_parameters/GLONASS_L1_L2_CA.h @@ -238,6 +238,7 @@ const std::vector GLONASS_GNAV_CRC_M_INDEX{20, 21, 22, 23, 24, 25, 26, const std::vector GLONASS_GNAV_CRC_N_INDEX{35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65}; const std::vector GLONASS_GNAV_CRC_P_INDEX{66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85}; const std::vector GLONASS_GNAV_CRC_Q_INDEX{9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85}; +const std::vector GLONASS_GNAV_ECC_LOCATOR{0, 0, 1, 8, 2, 9, 10, 11, 3, 12, 13, 14, 15, 16, 17, 18, 4, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 5, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 6, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84}; // GLONASS GNAV NAVIGATION MESSAGE STRUCTURE // NAVIGATION MESSAGE FIELDS POSITIONS diff --git a/src/core/system_parameters/glonass_gnav_navigation_message.cc b/src/core/system_parameters/glonass_gnav_navigation_message.cc index 3f1bcd12e..94ddd9073 100644 --- a/src/core/system_parameters/glonass_gnav_navigation_message.cc +++ b/src/core/system_parameters/glonass_gnav_navigation_message.cc @@ -36,7 +36,7 @@ Glonass_Gnav_Navigation_Message::Glonass_Gnav_Navigation_Message() } -bool Glonass_Gnav_Navigation_Message::CRC_test(const std::bitset& bits) const +bool Glonass_Gnav_Navigation_Message::CRC_test(std::bitset& bits) const { uint32_t sum_bits = 0; int32_t sum_hamming = 0; @@ -128,7 +128,28 @@ bool Glonass_Gnav_Navigation_Message::CRC_test(const std::bitset string_bits(frame_string); + std::bitset string_bits(frame_string); // Perform data verification and exit code if error in bit sequence flag_CRC_test = CRC_test(string_bits); diff --git a/src/core/system_parameters/glonass_gnav_navigation_message.h b/src/core/system_parameters/glonass_gnav_navigation_message.h index fcad9c79f..c51264ad8 100644 --- a/src/core/system_parameters/glonass_gnav_navigation_message.h +++ b/src/core/system_parameters/glonass_gnav_navigation_message.h @@ -55,7 +55,7 @@ public: * \brief Compute CRC for GLONASS GNAV strings * \param bits Bits of the string message where to compute CRC */ - bool CRC_test(const std::bitset& bits) const; + bool CRC_test(std::bitset& bits) const; /*! * \brief Computes the frame number being decoded given the satellite slot number diff --git a/src/tests/unit-tests/system-parameters/glonass_gnav_crc_test.cc b/src/tests/unit-tests/system-parameters/glonass_gnav_crc_test.cc index 88fc61e04..2280219d1 100644 --- a/src/tests/unit-tests/system-parameters/glonass_gnav_crc_test.cc +++ b/src/tests/unit-tests/system-parameters/glonass_gnav_crc_test.cc @@ -17,14 +17,14 @@ #include "glonass_gnav_navigation_message.h" #include -#include +#include TEST(GlonassCrcTest, GnssSdrCRCTest) { // test data std::string string1Real_14_18_00("0000100000111001001001000011101010101100010101001000001001011101010101110011110110101"); std::string string1Real_14_18_30("0000100000111001001011000011101010101100010101001000001001011101010101110011100001010"); - std::string string1Wrong_14_18_00("0000100000111001001001000011101010101100010101001000001001011101010101110011100001010"); + std::string string1Wrong_14_18_00("0000100000111001001001100011101010101100010101001000001001011101010101110011100001010"); auto gnav_msg = Glonass_Gnav_Navigation_Message(); std::bitset bits; @@ -34,4 +34,12 @@ TEST(GlonassCrcTest, GnssSdrCRCTest) ASSERT_TRUE(gnav_msg.CRC_test(bits)); bits = std::bitset(string1Wrong_14_18_00); ASSERT_FALSE(gnav_msg.CRC_test(bits)); + bits = std::bitset(string1Real_14_18_30); + for (int k = 8; k < 85; k++) + { + std::bitset corrupt_bits = bits; + corrupt_bits[k] = corrupt_bits[k] ? false : true; + ASSERT_TRUE(gnav_msg.CRC_test(corrupt_bits)); + ASSERT_TRUE(corrupt_bits == bits); + } } From 4e625b03d1b1fb44e6804155b638fb79e1ab9203 Mon Sep 17 00:00:00 2001 From: Vladislav P Date: Thu, 8 Sep 2022 00:19:03 +0300 Subject: [PATCH 58/59] Add test data from libswitnav Signed-off-by: Vladislav P --- .../glonass_gnav_crc_test.cc | 70 ++++++++++++++++++- 1 file changed, 69 insertions(+), 1 deletion(-) diff --git a/src/tests/unit-tests/system-parameters/glonass_gnav_crc_test.cc b/src/tests/unit-tests/system-parameters/glonass_gnav_crc_test.cc index 2280219d1..a6863d5b2 100644 --- a/src/tests/unit-tests/system-parameters/glonass_gnav_crc_test.cc +++ b/src/tests/unit-tests/system-parameters/glonass_gnav_crc_test.cc @@ -19,13 +19,63 @@ #include #include +void to_bitset(const uint32_t from[3], std::bitset &to) +{ + to.reset(); + for (int k = 0; k < 3; k++) + { + std::bitset tmp(from[k]); + to |= (tmp << (k * 32)); + } +} + + TEST(GlonassCrcTest, GnssSdrCRCTest) { // test data std::string string1Real_14_18_00("0000100000111001001001000011101010101100010101001000001001011101010101110011110110101"); std::string string1Real_14_18_30("0000100000111001001011000011101010101100010101001000001001011101010101110011100001010"); std::string string1Wrong_14_18_00("0000100000111001001001100011101010101100010101001000001001011101010101110011100001010"); - + const uint32_t test_case_good[][3] = { + /* Test data from libswiftnav (github.com/swift-nav/libswiftnav) */ + /* First, simply test one GLO nav message received from Novatel, + * we trust Novatel, so no errors must be */ + {0xc90cfb3e, 0x9743a301, 0x010749}, + {0xdd39f5fc, 0x24542d0c, 0x021760}, + {0x653bc7e9, 0x1e8ead92, 0x038006}, + {0x60342dfc, 0x41000002, 0x0481c7}, + {0x40000895, 0x00000003, 0x050d10}, + {0x530a7ecf, 0x059c4415, 0x06b082}, + {0xfd94beb6, 0x7a577e97, 0x070f46}, + {0xba02de6f, 0x988e6814, 0x08b101}, + {0x12064831, 0x87767698, 0x09e1a6}, + {0xaf870be5, 0x54ef2617, 0x0ab286}, + {0x0f06ba41, 0x9a3f2698, 0x0b8f7c}, + {0x2f012204, 0xf0c3c81a, 0x0cb309}, + {0x1c858601, 0x10c47e98, 0x0da065}, + {0x5205980b, 0xf49abc1a, 0x0eb40e}, + {0x15454437, 0x2504e698, 0x0f8c09}, + /* Second, take 1st string from other GLO nav message and introduce an + * error in data bits */ + {0xc90cfb81, 0x9743a301, 0x010748}, /* case 15, no errors */ + }; + const uint32_t test_case_correctable[][3] = { + /* single bit errors are correctable */ + {0xc90cfb81, 0x9743a301, 0x110748}, + {0xc90cfb81, 0x1743a301, 0x010748}, + {0x490cfb81, 0x9743a301, 0x010748}, + {0xc90cfb81, 0x9743a300, 0x010748}, + {0xc90cfb81, 0x9743a301, 0x010749}, + {0xc90cfb81, 0x9743a301, 0x000748}, + }; + const uint32_t test_case_uncorrectable[][3] = { + /* multiple bit errors are uncorrectable */ + {0xc90c3b81, 0x9743a301, 0x010748}, + {0xc90cfb81, 0x974fa301, 0x010748}, + {0xc90cfb81, 0x9743a301, 0x01074b}, + {0xc90cfb81, 0x9743a301, 0x010744}, + {0xc90cfb81, 0x9aaaa301, 0x010748}, + }; auto gnav_msg = Glonass_Gnav_Navigation_Message(); std::bitset bits; bits = std::bitset(string1Real_14_18_00); @@ -42,4 +92,22 @@ TEST(GlonassCrcTest, GnssSdrCRCTest) ASSERT_TRUE(gnav_msg.CRC_test(corrupt_bits)); ASSERT_TRUE(corrupt_bits == bits); } + for (unsigned k = 0; k < sizeof(test_case_good) / sizeof(test_case_good[0]); k++) + { + to_bitset(test_case_good[k], bits); + ASSERT_TRUE(gnav_msg.CRC_test(bits)); + } + for (unsigned k = 0; k < sizeof(test_case_correctable) / sizeof(test_case_correctable[0]); k++) + { + std::bitset corrupt_bits; + to_bitset(test_case_correctable[k], corrupt_bits); + ASSERT_TRUE(gnav_msg.CRC_test(corrupt_bits)); + ASSERT_TRUE(corrupt_bits == bits); + } + for (unsigned k = 0; k < sizeof(test_case_uncorrectable) / sizeof(test_case_uncorrectable[0]); k++) + { + std::bitset corrupt_bits; + to_bitset(test_case_uncorrectable[k], corrupt_bits); + ASSERT_FALSE(gnav_msg.CRC_test(corrupt_bits)); + } } From b422f7e48ce9e832c9ccaa5a0292827c82887ab0 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 11 Dec 2022 23:44:44 +0100 Subject: [PATCH 59/59] CI: Workaround for ubuntu build --- .github/workflows/main.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b8dff7302..6d5d91beb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -16,7 +16,16 @@ jobs: steps: - uses: actions/checkout@v3 - name: install dependencies - run: sudo apt-get update && sudo apt-get install -y ninja-build cmake libboost-dev libboost-date-time-dev libboost-system-dev libboost-filesystem-dev libboost-thread-dev libboost-chrono-dev libboost-serialization-dev liblog4cpp5-dev gnuradio-dev gr-osmosdr libpugixml-dev libpcap-dev libblas-dev liblapack-dev libarmadillo-dev libgflags-dev libgoogle-glog-dev libgnutls-openssl-dev libmatio-dev googletest protobuf-compiler libprotobuf-dev python3-mako liborc-0.4-dev + run: | + sudo apt-get update -y + sudo apt install -y libunwind-dev + sudo apt-get install -y --no-install-recommends ninja-build cmake \ + libboost-dev libboost-date-time-dev libboost-system-dev libboost-filesystem-dev \ + libboost-thread-dev libboost-chrono-dev libboost-serialization-dev \ + liblog4cpp5-dev gnuradio-dev gr-osmosdr libpugixml-dev libpcap-dev libblas-dev \ + liblapack-dev libarmadillo-dev libgflags-dev libgoogle-glog-dev \ + libgnutls-openssl-dev libmatio-dev googletest protobuf-compiler libprotobuf-dev \ + python3-mako liborc-0.4-dev - name: configure run: cd build && cmake -GNinja .. - name: build