1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-14 12:10:34 +00:00

Merge branch 'next' of github.com:gnss-sdr/gnss-sdr into pps_lime

This commit is contained in:
Javier Arribas 2022-08-02 12:15:05 +02:00
commit 831cc2d7b6
125 changed files with 2228 additions and 1445 deletions

View File

@ -53,7 +53,7 @@ IncludeBlocks: Merge
IncludeCategories:
- Regex: '^.*.h"'
Priority: 1
- Regex: '^.*(benchmark|boost|gflags|glog|gnsssdr|gnuradio|gpstk|gsl|gtest|pmt|uhd|volk)/'
- Regex: '^.*(benchmark|boost|gflags|glog|gnsssdr|gnuradio|gnsstk|gsl|gtest|pmt|uhd|volk)/'
Priority: 2
- Regex: '^.*(armadillo|iio|matio|pugixml)'
Priority: 2

View File

@ -62,7 +62,7 @@ jobs:
- 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.0 core_monitor core_libs pvt_libs
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

File diff suppressed because it is too large Load Diff

View File

@ -385,9 +385,9 @@ $ sudo apt-get install libblas-dev liblapack-dev # For Debian/Ubuntu/Linux
$ sudo yum install lapack-devel blas-devel # For Fedora/CentOS/RHEL
$ sudo zypper install lapack-devel blas-devel # For OpenSUSE
$ sudo pacman -S blas lapack # For Arch Linux
$ wget https://sourceforge.net/projects/arma/files/armadillo-11.1.1.tar.xz
$ tar xvfz armadillo-11.1.1.tar.xz
$ cd armadillo-11.1.1
$ wget https://sourceforge.net/projects/arma/files/armadillo-11.2.1.tar.xz
$ tar xvfz armadillo-11.2.1.tar.xz
$ cd armadillo-11.2.1
$ cmake .
$ make
$ sudo make install
@ -428,8 +428,8 @@ $ sudo ldconfig
#### Download the [Google C++ Testing Framework](https://github.com/google/googletest "Googletest Homepage"), also known as Google Test:
```
$ wget https://github.com/google/googletest/archive/release-1.12.0.zip
$ unzip release-1.12.0.zip
$ wget https://github.com/google/googletest/archive/release-1.12.1.zip
$ unzip release-1.12.1.zip
```
Please **DO NOT build or install** Google Test. Every user needs to compile
@ -453,10 +453,10 @@ downloaded resides. Just type in your terminal (or add it to your
`$HOME/.bashrc` file for a permanent solution) the following line:
```
export GTEST_DIR=/home/username/googletest-release-1.12.0
export GTEST_DIR=/home/username/googletest-release-1.12.1
```
changing `/home/username/googletest-release-1.12.0` by the actual path where you
changing `/home/username/googletest-release-1.12.1` by the actual path where you
unpacked Google Test. If the CMake script does not find that folder, or the
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
@ -882,7 +882,7 @@ $ brew update && brew upgrade
$ brew install armadillo cmake hdf5 gflags glog gnuradio lapack libmatio log4cpp \
openssl pkg-config protobuf pugixml
$ pip3 install mako
$ brew cask install mactex # when completed, restart Terminal
$ brew install --cask mactex # when completed, restart Terminal
$ brew install graphviz doxygen
```
@ -969,9 +969,8 @@ compile time if they are not detected in your machine.
[https://github.com/carlesfernandez/docker-pybombs-gnsssdr](https://github.com/carlesfernandez/docker-pybombs-gnsssdr)
for instructions.
- **Snap package**: [Snaps](https://snapcraft.io) are universal Linux packages
aimed to work on any distribution or device, from IoT devices to servers,
desktops to mobile devices. Visit
- **Snap package**: [Snaps](https://snapcraft.io) are Linux packages aimed for
Ubuntu or Ubuntu-like distros. Visit
[https://github.com/carlesfernandez/snapcraft-sandbox](https://github.com/carlesfernandez/snapcraft-sandbox)
for instructions, or directly
[get the software from the Snap Store](https://snapcraft.io/gnss-sdr-next):
@ -2048,10 +2047,10 @@ PVT.rtcm_MT1077_rate_ms=1000
the user to post-process the received data to produce a more accurate result
(usually with other data unknown to the original receiver, such as better
models of the atmospheric conditions at time of measurement). RINEX files can
be used by software packages such as [GPSTk](https://github.com/SGL-UT/GPSTk),
[RTKLIB](http://www.rtklib.com/), and [gLAB](https://gage.upc.edu/gLAB/).
GNSS-SDR by default generates RINEX version
[3.02](ftp://igs.org/pub/data/format/rinex302.pdf). If
be used by software packages such as
[GNSSTK](https://github.com/SGL-UT/gnsstk), [RTKLIB](http://www.rtklib.com/),
and [gLAB](https://gage.upc.edu/gLAB/). GNSS-SDR by default generates RINEX
version [3.02](ftp://igs.org/pub/data/format/rinex302.pdf). If
[2.11](ftp://igs.org/pub/data/format/rinex211.txt) is needed, it can be
requested through the `rinex_version` parameter in the configuration file:

View File

@ -0,0 +1,147 @@
# GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
# This file is part of GNSS-SDR.
#
# SPDX-FileCopyrightText: 2022 C. Fernandez-Prades cfernandez(at)cttc.es
# SPDX-License-Identifier: BSD-3-Clause
# - Find gnsstk library
# Find the native gnsstk includes and library
# This module defines
# GNSSTK_INCLUDE_DIR, where to find Rinex3ObsBase.hpp, etc.
# GNSSTK_FOUND, If false, do not try to use GNSSTK.
# GNSSTK_LIBRARY, where to find the GNSSTK library.
#
# Provides the following imported target:
# Gnsstk::gnsstk
#
if(NOT COMMAND feature_summary)
include(FeatureSummary)
endif()
if(NOT GNSSTK_ROOT)
set(GNSSTK_ROOT_USER_DEFINED /usr/local)
else()
set(GNSSTK_ROOT_USER_DEFINED ${GNSSTK_ROOT})
endif()
if(DEFINED ENV{GNSSTK_ROOT})
set(GNSSTK_ROOT_USER_DEFINED
${GNSSTK_ROOT_USER_DEFINED}
$ENV{GNSSTK_ROOT}
)
endif()
unset(GNSSTK_INCLUDE_DIR CACHE)
unset(GNSSTK_USES_GPSTK_NAMESPACE CACHE)
find_path(GNSSTK_INCLUDE_DIR gnsstk/Rinex3ObsBase.hpp
PATHS ${GNSSTK_ROOT_USER_DEFINED}/include
/usr/include
/usr/local/include
/opt/local/include
)
set(GNSSTK_NAMES ${CMAKE_FIND_LIBRARY_PREFIXES}gnsstk${CMAKE_SHARED_LIBRARY_SUFFIX})
if(NOT GNSSTK_INCLUDE_DIR)
find_path(GNSSTK_INCLUDE_DIR gpstk/Rinex3ObsBase.hpp
PATHS ${GNSSTK_ROOT_USER_DEFINED}/include
/usr/include
/usr/local/include
/opt/local/include
)
if(GNSSTK_INCLUDE_DIR)
set(GNSSTK_NAMES gpstk ${CMAKE_FIND_LIBRARY_PREFIXES}gpstk${CMAKE_SHARED_LIBRARY_SUFFIX})
set(GNSSTK_USES_GPSTK_NAMESPACE TRUE)
endif()
endif()
include(GNUInstallDirs)
find_library(GNSSTK_LIBRARY NAMES ${GNSSTK_NAMES}
PATHS ${GNSSTK_ROOT_USER_DEFINED}/lib
${GNSSTK_ROOT_USER_DEFINED}/${CMAKE_INSTALL_LIBDIR}
/usr/local/lib
/usr/${CMAKE_INSTALL_LIBDIR}
/usr/local/${CMAKE_INSTALL_LIBDIR}
/opt/local/lib
)
if(GNSSTK_LIBRARY AND GNSSTK_INCLUDE_DIR)
set(OLD_PACKAGE_VERSION ${PACKAGE_VERSION})
unset(PACKAGE_VERSION)
if(GNSSTK_USES_GPSTK_NAMESPACE)
if(EXISTS ${GNSSTK_INCLUDE_DIR}/../share/cmake/GPSTK/GPSTKConfigVersion.cmake)
include(${GNSSTK_INCLUDE_DIR}/../share/cmake/GPSTK/GPSTKConfigVersion.cmake)
endif()
else()
if(EXISTS ${GNSSTK_INCLUDE_DIR}/../share/cmake/GNSSTK/GNSSTKConfigVersion.cmake)
include(${GNSSTK_INCLUDE_DIR}/../share/cmake/GNSSTK/GNSSTKConfigVersion.cmake)
endif()
endif()
if(PACKAGE_VERSION)
set(GNSSTK_VERSION ${PACKAGE_VERSION})
endif()
set(PACKAGE_VERSION ${OLD_PACKAGE_VERSION})
endif()
if(GNSSTK_VERSION)
if(GNSSTK_VERSION VERSION_LESS "9.0.0")
set(GNSSTK_OLDER_THAN_9 TRUE)
endif()
if(GNSSTK_VERSION VERSION_LESS "13.0.0")
set(GNSSTK_OLDER_THAN_13 TRUE)
endif()
endif()
if(EXISTS ${GNSSTK_INCLUDE_DIR}/gnsstk/GPSEphemerisStore.hpp)
set(GNSSTK_OLDER_THAN_13 TRUE)
endif()
# handle the QUIET and REQUIRED arguments and set GNSSTK_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GNSSTK DEFAULT_MSG GNSSTK_LIBRARY GNSSTK_INCLUDE_DIR)
if(GNSSTK_FOUND AND GNSSTK_VERSION)
set_package_properties(GNSSTK PROPERTIES
DESCRIPTION "The GNSSTk C++ Library (found: v${GNSSTK_VERSION})"
)
else()
set_package_properties(GNSSTK PROPERTIES
DESCRIPTION "The GNSSTk C++ Library"
)
endif()
if(GNSSTK_FOUND AND GNSSTK_USES_GPSTK_NAMESPACE AND NOT EXISTS ${GNSSTK_INCLUDE_DIR}/gpstk/SatelliteSystem.hpp)
set(GNSSTK_OLDER_THAN_8 TRUE)
endif()
set_package_properties(GNSSTK PROPERTIES
URL "https://github.com/SGL-UT/gnsstk/"
TYPE OPTIONAL
)
if(GNSSTK_FOUND AND NOT ENABLE_OWN_GNSSTK AND NOT TARGET Gnsstk::gnsstk)
add_library(Gnsstk::gnsstk SHARED IMPORTED)
if(GNSSTK_USES_GPSTK_NAMESPACE)
set_target_properties(Gnsstk::gnsstk PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
IMPORTED_LOCATION "${GNSSTK_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${GNSSTK_INCLUDE_DIR};${GNSSTK_INCLUDE_DIR}/gpstk"
INTERFACE_LINK_LIBRARIES "${GNSSTK_LIBRARY}"
)
else()
set_target_properties(Gnsstk::gnsstk PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
IMPORTED_LOCATION "${GNSSTK_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${GNSSTK_INCLUDE_DIR};${GNSSTK_INCLUDE_DIR}/gnsstk"
INTERFACE_LINK_LIBRARIES "${GNSSTK_LIBRARY}"
)
endif()
endif()
mark_as_advanced(GNSSTK_LIBRARY
GNSSTK_INCLUDE_DIR
GNSSTK_USES_GPSTK_NAMESPACE
GNSSTK_OLDER_THAN_8
GNSSTK_OLDER_THAN_9
GNSSTK_OLDER_THAN_13
)

View File

@ -346,6 +346,8 @@ if(GNURADIO_VERSION VERSION_GREATER 3.8.99)
if(GNURADIO_IIO_LIBRARIES)
message(STATUS " * INCLUDES=${GNURADIO_IIO_INCLUDE_DIRS}")
message(STATUS " * LIBS=${GNURADIO_IIO_LIBRARIES}")
else()
message(STATUS " * IIO GNU Radio Module not found.")
endif()
if(GNURADIO_IIO_LIBRARIES AND GNURADIO_IIO_INCLUDE_DIRS)
set(GNURADIO_IIO_FOUND TRUE)

View File

@ -1,99 +0,0 @@
# GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
# This file is part of GNSS-SDR.
#
# SPDX-FileCopyrightText: 2011-2020 C. Fernandez-Prades cfernandez(at)cttc.es
# SPDX-License-Identifier: BSD-3-Clause
# - Find gpstk library
# Find the native gpstk includes and library
# This module defines
# GPSTK_INCLUDE_DIR, where to find Rinex3ObsBase.hpp, etc.
# GPSTK_FOUND, If false, do not try to use GPSTK.
# GPSTK_LIBRARY, where to find the GPSTK library.
#
# Provides the following imported target:
# Gpstk::gpstk
#
if(NOT COMMAND feature_summary)
include(FeatureSummary)
endif()
if(NOT GPSTK_ROOT)
set(GPSTK_ROOT_USER_DEFINED /usr/local)
else()
set(GPSTK_ROOT_USER_DEFINED ${GPSTK_ROOT})
endif()
if(DEFINED ENV{GPSTK_ROOT})
set(GPSTK_ROOT_USER_DEFINED
${GPSTK_ROOT_USER_DEFINED}
$ENV{GPSTK_ROOT}
)
endif()
find_path(GPSTK_INCLUDE_DIR gpstk/Rinex3ObsBase.hpp
PATHS ${GPSTK_ROOT_USER_DEFINED}/include
/usr/include
/usr/local/include
/opt/local/include
)
set(GPSTK_NAMES gpstk libgpstk)
include(GNUInstallDirs)
find_library(GPSTK_LIBRARY NAMES ${GPSTK_NAMES}
PATHS ${GPSTK_ROOT_USER_DEFINED}/lib
${GPSTK_ROOT_USER_DEFINED}/${CMAKE_INSTALL_LIBDIR}
/usr/local/lib
/usr/${CMAKE_INSTALL_LIBDIR}
/usr/local/${CMAKE_INSTALL_LIBDIR}
/opt/local/lib
)
# handle the QUIET and REQUIRED arguments and set GPSTK_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GPSTK DEFAULT_MSG GPSTK_LIBRARY GPSTK_INCLUDE_DIR)
if(GPSTK_FOUND)
set(OLD_PACKAGE_VERSION ${PACKAGE_VERSION})
unset(PACKAGE_VERSION)
if(EXISTS ${CMAKE_INSTALL_FULL_DATADIR}/cmake/GPSTK/GPSTKConfigVersion.cmake)
include(${CMAKE_INSTALL_FULL_DATADIR}/cmake/GPSTK/GPSTKConfigVersion.cmake)
endif()
if(PACKAGE_VERSION)
set(GPSTK_VERSION ${PACKAGE_VERSION})
endif()
set(PACKAGE_VERSION ${OLD_PACKAGE_VERSION})
endif()
if(GPSTK_FOUND AND GPSTK_VERSION)
set_package_properties(GPSTK PROPERTIES
DESCRIPTION "Library and suite of applications for satellite navigation (found: v${GPSTK_VERSION})"
)
else()
set_package_properties(GPSTK PROPERTIES
DESCRIPTION "Library and suite of applications for satellite navigation"
)
endif()
if(GPSTK_FOUND AND NOT EXISTS ${GPSTK_INCLUDE_DIR}/gpstk/SatelliteSystem.hpp)
set(GPSTK_OLDER_THAN_8 TRUE)
endif()
set_package_properties(GPSTK PROPERTIES
URL "https://github.com/SGL-UT/GPSTk"
)
if(GPSTK_FOUND AND NOT ENABLE_OWN_GPSTK AND NOT TARGET Gpstk::gpstk)
add_library(Gpstk::gpstk SHARED IMPORTED)
set_target_properties(Gpstk::gpstk PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
IMPORTED_LOCATION "${GPSTK_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${GPSTK_INCLUDE_DIR};${GPSTK_INCLUDE_DIR}/gpstk"
INTERFACE_LINK_LIBRARIES "${GPSTK_LIBRARY}"
)
endif()
mark_as_advanced(GPSTK_LIBRARY GPSTK_INCLUDE_DIR)

View File

@ -0,0 +1,145 @@
# GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
# This file is part of GNSS-SDR.
#
# SPDX-FileCopyrightText: 2022 C. Fernandez-Prades cfernandez(at)cttc.es
# SPDX-License-Identifier: BSD-3-Clause
# Find the libunwind library
#
# LIBUNWIND_FOUND - True if libunwind was found.
# LIBUNWIND_LIBRARIES - The libraries needed to use libunwind
# LIBUNWIND_INCLUDE_DIR - Location of libunwind.h
# INPUT (Optional):
# LIBUNWIND_ROOT - path where include + lib of libunwind install is located
if(NOT COMMAND feature_summary)
include(FeatureSummary)
endif()
find_path(LIBUNWIND_INCLUDE_DIR
NAMES
libunwind.h
unwind.h
HINTS
/usr
/usr/local
/opt/local
PATH_SUFFIXES include
PATHS "${LIBUNWIND_ROOT}/include"
)
find_library(LIBUNWIND_GENERIC_LIBRARY
NAMES
libunwind
unwind
HINTS
/usr
/usr/local
/opt/local
PATH_SUFFIXES lib lib64
PATHS
"${LIBUNWIND_ROOT}/lib"
"${LIBUNWIND_ROOT}/lib64"
)
if(LIBUNWIND_INCLUDE_DIR)
if(LIBUNWIND_GENERIC_LIBRARY)
set(LIBUNWIND_LIBRARIES ${LIBUNWIND_GENERIC_LIBRARY})
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64|arm64)")
set(LIBUNWIND_ARCH "aarch64")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm")
set(LIBUNWIND_ARCH "arm")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "(x86_64)|(AMD64|amd64)|(corei7-64)")
set(LIBUNWIND_ARCH "x86_64")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^i.86$")
set(LIBUNWIND_ARCH "x86")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^ppc64")
set(LIBUNWIND_ARCH "ppc64")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^ppc")
set(LIBUNWIND_ARCH "ppc32")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^mips")
set(LIBUNWIND_ARCH "mips")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^hppa")
set(LIBUNWIND_ARCH "hppa")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^ia64")
set(LIBUNWIND_ARCH "ia64")
endif()
if(LIBUNWIND_ARCH)
find_library(LIBUNWIND_SPECIFIC_LIBRARY
NAMES
libunwind-${LIBUNWIND_ARCH}
"unwind-${LIBUNWIND_ARCH}"
HINTS
/usr
/usr/local
/opt/local
PATH_SUFFIXES lib lib64
PATHS "${LIBUNWIND_ROOT}"
)
if(NOT LIBUNWIND_SPECIFIC_LIBRARY)
message(STATUS " -- Failed to find unwind-${LIBUNWIND_ARCH}")
else()
set(LIBUNWIND_LIBRARIES ${LIBUNWIND_LIBRARIES} ${LIBUNWIND_SPECIFIC_LIBRARY})
endif()
endif()
endif()
else()
message(STATUS " -- Could NOT find libunwind.h")
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LIBUNWIND DEFAULT_MSG LIBUNWIND_INCLUDE_DIR)
if(LIBUNWIND_FOUND)
set(_Unwind_VERSION_HEADER ${LIBUNWIND_INCLUDE_DIR}/libunwind-common.h)
if(EXISTS ${_Unwind_VERSION_HEADER})
file(READ ${_Unwind_VERSION_HEADER} _Unwind_VERSION_CONTENTS)
string(REGEX REPLACE ".*#define UNW_VERSION_MAJOR[ \t]+([0-9]+).*" "\\1"
LIBUNWIND_VERSION_MAJOR "${_Unwind_VERSION_CONTENTS}")
string(REGEX REPLACE ".*#define UNW_VERSION_MINOR[ \t]+([0-9]+).*" "\\1"
LIBUNWIND_VERSION_MINOR "${_Unwind_VERSION_CONTENTS}")
string(REGEX REPLACE ".*#define UNW_VERSION_EXTRA[ \t]+([0-9]+).*" "\\1"
LIBUNWIND_VERSION_PATCH "${_Unwind_VERSION_CONTENTS}")
set(LIBUNWIND_VERSION ${LIBUNWIND_VERSION_MAJOR}.${LIBUNWIND_VERSION_MINOR})
if(CMAKE_MATCH_0)
# Third version component may be empty
set(LIBUNWIND_VERSION ${LIBUNWIND_VERSION}.${LIBUNWIND_VERSION_PATCH})
set(LIBUNWIND_VERSION_COMPONENTS 3)
else()
set(LIBUNWIND_VERSION_COMPONENTS 2)
endif()
endif()
endif()
if(LIBUNWIND_FOUND AND NOT TARGET Libunwind::libunwind)
if(LIBUNWIND_GENERIC_LIBRARY)
add_library(Libunwind::libunwind SHARED IMPORTED)
set_target_properties(Libunwind::libunwind PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
IMPORTED_LOCATION "${LIBUNWIND_GENERIC_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${LIBUNWIND_INCLUDE_DIR}"
INTERFACE_LINK_LIBRARIES "${LIBUNWIND_LIBRARIES}"
)
else()
add_library(Libunwind::libunwind INTERFACE IMPORTED)
set_target_properties(Libunwind::libunwind PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${LIBUNWIND_INCLUDE_DIR}"
)
endif()
endif()
set_package_properties(LIBUNWIND PROPERTIES
URL "https://www.nongnu.org/libunwind/"
)
if(LIBUNWIND_VERSION)
set_package_properties(LIBUNWIND PROPERTIES
DESCRIPTION "Portable and efficient C programming interface to determine the call-chain of a program (found: v${LIBUNWIND_VERSION})"
)
else()
set_package_properties(LIBUNWIND PROPERTIES
DESCRIPTION "Portable and efficient C programming interface to determine the call-chain of a program"
)
endif()
mark_as_advanced(LIBUNWIND_LIBRARIES LIBUNWIND_INCLUDE_DIR)

View File

@ -18,6 +18,8 @@ All notable changes to GNSS-SDR will be documented in this file.
- Fixed bug that made the PVT block to not resolve position anymore after a loss
of samples event.
- Improved non-coherent acquisition when `Acquisition_XX.blocking=false`.
- Implemented processing of BeiDou PRN 34 up to PRN 63 signals.
### Improvements in Interoperability:
@ -35,6 +37,13 @@ All notable changes to GNSS-SDR will be documented in this file.
**not** applied to the computed PVT solution. In the Galileo E6B-only
receiver, HAS messages are decoded and reported.
### Improvements in Maintainability:
- The now archived [GPSTk toolkit](https://github.com/SGL-UT/GPSTk), used in
some optional tests and applications, has been replaced by the new
[GNSSTk](https://github.com/SGL-UT/gnsstk) C++ Library. Compatibility with the
former GPSTk toolkit is maintained.
### Improvements in Portability:
- Improved detection of the BLAS library under macOS / Macports (the `lapack`
@ -47,6 +56,10 @@ All notable changes to GNSS-SDR will be documented in this file.
- Fixed running time error if the binary is built with the
`-Wp,-D_GLIBCXX_ASSERTIONS` compiler option. This is added by default in some
GNU/Linux distributions.
- Fixed linking against libunwind when the glog library is built locally.
- The configuration options at building time `-DENABLE_OWN_GLOG`,
`-DENABLE_OWN_ARMADILLO`, and `-DENABLE_OWN_GNSSTK` can now be switched `ON`
and `OFF` without the need to start from an empty buiding folder.
### Improvements in Usability:
@ -60,6 +73,11 @@ All notable changes to GNSS-SDR will be documented in this file.
load on the data link and thus allow more bandwidth.
- Added gain setting and reading for the XTRX board when using the
`Osmosdr_Signal_Source` implementation of a `SignalSource`.
- The `Osmosdr_Signal_Source` implementation learned a new parameter `if_bw` to
manually set the bandwidth of the bandpass filter on the radio frontend.
- The new configuration parameter `Channels_XX.RF_channel_ID` allows to specify
the signal source per channel group.
- Allowed the CMake project to be a sub-project.
See the definitions of concepts and metrics at
https://gnss-sdr.org/design-forces/
@ -90,7 +108,7 @@ https://gnss-sdr.org/design-forces/
- Added a script at `src/utils/scripts/download-galileo-almanac.sh` that
downloads an XML file with the latest Galileo almanac published by the
European GNSS Service Centre at https://www.gsc-europa.eu/product-almanacs
European GNSS Service Centre at https://www.gsc-europa.eu/gsc-products/almanac
See the definitions of concepts and metrics at
https://gnss-sdr.org/design-forces/
@ -991,7 +1009,8 @@ features and bug fixes:
- Improvements in the RTCM server stability.
- Improvements in the correctness of generated RINEX files.
- The receiver can read and make use of Galileo almanac XML files published by
the European GNSS Service Centre at https://www.gsc-europa.eu/product-almanacs
the European GNSS Service Centre at
https://www.gsc-europa.eu/gsc-products/almanac
- Own-defined XML schemas for navigation data published at
https://github.com/gnss-sdr/gnss-sdr/tree/next/docs/xml-schemas
- Added program `rinex2assist` to convert RINEX navigation files into XML files

View File

@ -514,7 +514,7 @@ Observables.dump_filename=./observables.dat
\subsection pvt 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 a simple least square
solution and leaves room for more sophisticated positioning methods. The integration with libraries and software tools that are able to deal with multi-constellation
data such as <a href="https://github.com/SGL-UT/GPSTk" target="_blank">GPSTk</a> or <a href="https://gage.upc.edu/gLAB/" target="_blank">gLAB</a> appears as a viable solution for high performance, completely customizable GNSS receivers.
data such as <a href="https://github.com/SGL-UT/gnsstk" target="_blank">GNSSTk</a> or <a href="https://gage.upc.edu/gLAB/" target="_blank">gLAB</a> appears as a viable solution for high performance, completely customizable GNSS receivers.
The common interface is PvtInterface. For instance, in order to use the implementation RTKLIB_PVT, add to the configuration file:
\verbatim

View File

@ -29,7 +29,7 @@ target_link_libraries(pvt_adapters
target_include_directories(pvt_adapters
PUBLIC
${CMAKE_SOURCE_DIR}/src/core/interfaces
${GNSSSDR_SOURCE_DIR}/src/core/interfaces
)
if(USE_OLD_BOOST_MATH_COMMON_FACTOR)

View File

@ -40,7 +40,7 @@ endif()
target_include_directories(pvt_gr_blocks
PUBLIC
${CMAKE_SOURCE_DIR}/src/core/interfaces
${GNSSSDR_SOURCE_DIR}/src/core/interfaces
)
if(USE_GENERIC_LAMBDAS)

View File

@ -142,6 +142,7 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels,
d_rinex_version(conf_.rinex_version),
d_rx_time(0.0),
d_local_counter_ms(0ULL),
d_timestamp_rx_clock_offset_correction_msg_ms(0LL),
d_rinexobs_rate_ms(conf_.rinexobs_rate_ms),
d_kml_rate_ms(conf_.kml_rate_ms),
d_gpx_rate_ms(conf_.gpx_rate_ms),
@ -155,6 +156,7 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels,
d_nchannels(nchannels),
d_type_of_rx(conf_.type_of_receiver),
d_observable_interval_ms(conf_.observable_interval_ms),
d_pvt_errors_counter(0),
d_dump(conf_.dump),
d_dump_mat(conf_.dump_mat && conf_.dump),
d_rinex_output_enabled(conf_.rinex_output_enabled),
@ -166,13 +168,10 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels,
d_flag_monitor_pvt_enabled(conf_.monitor_enabled),
d_flag_monitor_ephemeris_enabled(conf_.monitor_ephemeris_enabled),
d_show_local_time_zone(conf_.show_local_time_zone),
d_timestamp_rx_clock_offset_correction_msg_ms(0LL),
d_enable_rx_clock_correction(conf_.enable_rx_clock_correction),
d_an_printer_enabled(conf_.an_output_enabled),
d_log_timetag(conf_.log_source_timetag)
{
// debug
d_pvt_errors_counter = 0;
// Send feedback message to observables block with the receiver clock offset
this->message_port_register_out(pmt::mp("pvt_to_observables"));
// Experimental: VLT commands from PVT to tracking channels

View File

@ -243,6 +243,7 @@ private:
double d_rinex_version;
double d_rx_time;
uint64_t d_local_counter_ms;
uint64_t d_timestamp_rx_clock_offset_correction_msg_ms;
key_t d_sysv_msg_key;
int d_sysv_msqid;
@ -268,6 +269,7 @@ private:
uint32_t d_nchannels;
uint32_t d_type_of_rx;
uint32_t d_observable_interval_ms;
uint32_t d_pvt_errors_counter;
bool d_dump;
bool d_dump_mat;
@ -282,8 +284,6 @@ private:
bool d_flag_monitor_pvt_enabled;
bool d_flag_monitor_ephemeris_enabled;
bool d_show_local_time_zone;
uint64_t d_timestamp_rx_clock_offset_correction_msg_ms;
uint32_t d_pvt_errors_counter;
bool d_enable_rx_clock_correction;
bool d_enable_has_messages;
bool d_an_printer_enabled;

View File

@ -4,9 +4,9 @@
# SPDX-FileCopyrightText: 2010-2020 C. Fernandez-Prades cfernandez(at)cttc.es
# SPDX-License-Identifier: BSD-3-Clause
protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS ${CMAKE_SOURCE_DIR}/docs/protobuf/monitor_pvt.proto)
protobuf_generate_cpp(PROTO_SRCS2 PROTO_HDRS2 ${CMAKE_SOURCE_DIR}/docs/protobuf/gps_ephemeris.proto)
protobuf_generate_cpp(PROTO_SRCS3 PROTO_HDRS3 ${CMAKE_SOURCE_DIR}/docs/protobuf/galileo_ephemeris.proto)
protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS ${GNSSSDR_SOURCE_DIR}/docs/protobuf/monitor_pvt.proto)
protobuf_generate_cpp(PROTO_SRCS2 PROTO_HDRS2 ${GNSSSDR_SOURCE_DIR}/docs/protobuf/gps_ephemeris.proto)
protobuf_generate_cpp(PROTO_SRCS3 PROTO_HDRS3 ${GNSSSDR_SOURCE_DIR}/docs/protobuf/galileo_ephemeris.proto)
set(PVT_LIB_SOURCES
an_packet_printer.cc
@ -98,7 +98,7 @@ get_filename_component(PROTO_INCLUDE_HEADERS_DIR ${PROTO_HDRS} DIRECTORY)
# for concurrent_queue.h
target_include_directories(pvt_libs
PUBLIC
${CMAKE_SOURCE_DIR}/src/core/receiver
${GNSSSDR_SOURCE_DIR}/src/core/receiver
)
# Do not apply clang-tidy fixes to protobuf generated headers

View File

@ -1015,7 +1015,7 @@ private:
};
// Implementation of inline functions (modified versions from GPSTk https://github.com/SGL-UT/GPSTk)
// Implementation of inline functions (modified versions from GNSSTk https://github.com/SGL-UT/gnsstk)
inline std::string& Rinex_Printer::leftJustify(std::string& s,
std::string::size_type length,

View File

@ -32,7 +32,6 @@
#include <cmath> // for std::fmod, std::lround
#include <cstdlib> // for strtol
#include <iostream> // for std::cout
#include <sstream> // for std::stringstream
Rtcm::Rtcm(uint16_t port) : RTCM_port(port), server_is_running(false)

View File

@ -30,17 +30,18 @@
#include <boost/asio.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <glog/logging.h>
#include <algorithm> // for min
#include <algorithm> // for std::max, std::min, std::copy_n
#include <array>
#include <bitset>
#include <cstddef> // for size_t
#include <cstdint>
#include <cstring> // for memcpy
#include <deque>
#include <iomanip> // for std::setw
#include <list>
#include <map>
#include <memory>
#include <set>
#include <sstream> // for std::stringstream
#include <string>
#include <thread>
#include <utility>
@ -612,8 +613,10 @@ private:
inline void encode_header()
{
char header[header_length + 1] = "";
std::snprintf(header, header_length + 1, "GS%4d", std::max(std::min(static_cast<int>(body_length_), static_cast<int>(max_body_length)), 0));
std::memcpy(data_.data(), header, header_length);
std::stringstream ss;
ss << "GS" << std::setw(4) << std::max(std::min(static_cast<int>(body_length_), static_cast<int>(max_body_length)), 0);
std::copy_n(ss.str().c_str(), header_length + 1, header);
std::copy_n(header, header_length, data_.data());
}
private:
@ -895,7 +898,7 @@ private:
const char* char_msg = message.c_str();
msg.body_length(message.length());
std::memcpy(msg.body(), char_msg, msg.body_length());
std::copy_n(char_msg, msg.body_length(), msg.body());
msg.encode_header();
c->write(msg);
}

View File

@ -463,7 +463,7 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
std::map<int, Glonass_Gnav_Ephemeris>::const_iterator glonass_gnav_ephemeris_iter;
std::map<int, Beidou_Dnav_Ephemeris>::const_iterator beidou_ephemeris_iter;
const Glonass_Gnav_Utc_Model gnav_utc = this->glonass_gnav_utc_model;
const Glonass_Gnav_Utc_Model &gnav_utc = this->glonass_gnav_utc_model;
this->set_averaging_flag(flag_averaging);
@ -941,89 +941,89 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
if ((valid_obs + glo_valid_obs) > 3)
{
int result = 0;
nav_t nav_data{};
nav_data.eph = eph_data.data();
nav_data.geph = geph_data.data();
nav_data.n = valid_obs;
nav_data.ng = glo_valid_obs;
d_nav_data = {};
d_nav_data.eph = eph_data.data();
d_nav_data.geph = geph_data.data();
d_nav_data.n = valid_obs;
d_nav_data.ng = glo_valid_obs;
if (gps_iono.valid)
{
nav_data.ion_gps[0] = gps_iono.alpha0;
nav_data.ion_gps[1] = gps_iono.alpha1;
nav_data.ion_gps[2] = gps_iono.alpha2;
nav_data.ion_gps[3] = gps_iono.alpha3;
nav_data.ion_gps[4] = gps_iono.beta0;
nav_data.ion_gps[5] = gps_iono.beta1;
nav_data.ion_gps[6] = gps_iono.beta2;
nav_data.ion_gps[7] = gps_iono.beta3;
d_nav_data.ion_gps[0] = gps_iono.alpha0;
d_nav_data.ion_gps[1] = gps_iono.alpha1;
d_nav_data.ion_gps[2] = gps_iono.alpha2;
d_nav_data.ion_gps[3] = gps_iono.alpha3;
d_nav_data.ion_gps[4] = gps_iono.beta0;
d_nav_data.ion_gps[5] = gps_iono.beta1;
d_nav_data.ion_gps[6] = gps_iono.beta2;
d_nav_data.ion_gps[7] = gps_iono.beta3;
}
if (!(gps_iono.valid) and gps_cnav_iono.valid)
{
nav_data.ion_gps[0] = gps_cnav_iono.alpha0;
nav_data.ion_gps[1] = gps_cnav_iono.alpha1;
nav_data.ion_gps[2] = gps_cnav_iono.alpha2;
nav_data.ion_gps[3] = gps_cnav_iono.alpha3;
nav_data.ion_gps[4] = gps_cnav_iono.beta0;
nav_data.ion_gps[5] = gps_cnav_iono.beta1;
nav_data.ion_gps[6] = gps_cnav_iono.beta2;
nav_data.ion_gps[7] = gps_cnav_iono.beta3;
d_nav_data.ion_gps[0] = gps_cnav_iono.alpha0;
d_nav_data.ion_gps[1] = gps_cnav_iono.alpha1;
d_nav_data.ion_gps[2] = gps_cnav_iono.alpha2;
d_nav_data.ion_gps[3] = gps_cnav_iono.alpha3;
d_nav_data.ion_gps[4] = gps_cnav_iono.beta0;
d_nav_data.ion_gps[5] = gps_cnav_iono.beta1;
d_nav_data.ion_gps[6] = gps_cnav_iono.beta2;
d_nav_data.ion_gps[7] = gps_cnav_iono.beta3;
}
if (galileo_iono.ai0 != 0.0)
{
nav_data.ion_gal[0] = galileo_iono.ai0;
nav_data.ion_gal[1] = galileo_iono.ai1;
nav_data.ion_gal[2] = galileo_iono.ai2;
nav_data.ion_gal[3] = 0.0;
d_nav_data.ion_gal[0] = galileo_iono.ai0;
d_nav_data.ion_gal[1] = galileo_iono.ai1;
d_nav_data.ion_gal[2] = galileo_iono.ai2;
d_nav_data.ion_gal[3] = 0.0;
}
if (beidou_dnav_iono.valid)
{
nav_data.ion_cmp[0] = beidou_dnav_iono.alpha0;
nav_data.ion_cmp[1] = beidou_dnav_iono.alpha1;
nav_data.ion_cmp[2] = beidou_dnav_iono.alpha2;
nav_data.ion_cmp[3] = beidou_dnav_iono.alpha3;
nav_data.ion_cmp[4] = beidou_dnav_iono.beta0;
nav_data.ion_cmp[5] = beidou_dnav_iono.beta0;
nav_data.ion_cmp[6] = beidou_dnav_iono.beta0;
nav_data.ion_cmp[7] = beidou_dnav_iono.beta3;
d_nav_data.ion_cmp[0] = beidou_dnav_iono.alpha0;
d_nav_data.ion_cmp[1] = beidou_dnav_iono.alpha1;
d_nav_data.ion_cmp[2] = beidou_dnav_iono.alpha2;
d_nav_data.ion_cmp[3] = beidou_dnav_iono.alpha3;
d_nav_data.ion_cmp[4] = beidou_dnav_iono.beta0;
d_nav_data.ion_cmp[5] = beidou_dnav_iono.beta0;
d_nav_data.ion_cmp[6] = beidou_dnav_iono.beta0;
d_nav_data.ion_cmp[7] = beidou_dnav_iono.beta3;
}
if (gps_utc_model.valid)
{
nav_data.utc_gps[0] = gps_utc_model.A0;
nav_data.utc_gps[1] = gps_utc_model.A1;
nav_data.utc_gps[2] = gps_utc_model.tot;
nav_data.utc_gps[3] = gps_utc_model.WN_T;
nav_data.leaps = gps_utc_model.DeltaT_LS;
d_nav_data.utc_gps[0] = gps_utc_model.A0;
d_nav_data.utc_gps[1] = gps_utc_model.A1;
d_nav_data.utc_gps[2] = gps_utc_model.tot;
d_nav_data.utc_gps[3] = gps_utc_model.WN_T;
d_nav_data.leaps = gps_utc_model.DeltaT_LS;
}
if (!(gps_utc_model.valid) and gps_cnav_utc_model.valid)
{
nav_data.utc_gps[0] = gps_cnav_utc_model.A0;
nav_data.utc_gps[1] = gps_cnav_utc_model.A1;
nav_data.utc_gps[2] = gps_cnav_utc_model.tot;
nav_data.utc_gps[3] = gps_cnav_utc_model.WN_T;
nav_data.leaps = gps_cnav_utc_model.DeltaT_LS;
d_nav_data.utc_gps[0] = gps_cnav_utc_model.A0;
d_nav_data.utc_gps[1] = gps_cnav_utc_model.A1;
d_nav_data.utc_gps[2] = gps_cnav_utc_model.tot;
d_nav_data.utc_gps[3] = gps_cnav_utc_model.WN_T;
d_nav_data.leaps = gps_cnav_utc_model.DeltaT_LS;
}
if (glonass_gnav_utc_model.valid)
{
nav_data.utc_glo[0] = glonass_gnav_utc_model.d_tau_c; // ??
nav_data.utc_glo[1] = 0.0; // ??
nav_data.utc_glo[2] = 0.0; // ??
nav_data.utc_glo[3] = 0.0; // ??
d_nav_data.utc_glo[0] = glonass_gnav_utc_model.d_tau_c; // ??
d_nav_data.utc_glo[1] = 0.0; // ??
d_nav_data.utc_glo[2] = 0.0; // ??
d_nav_data.utc_glo[3] = 0.0; // ??
}
if (galileo_utc_model.A0 != 0.0)
{
nav_data.utc_gal[0] = galileo_utc_model.A0;
nav_data.utc_gal[1] = galileo_utc_model.A1;
nav_data.utc_gal[2] = galileo_utc_model.tot;
nav_data.utc_gal[3] = galileo_utc_model.WNot;
nav_data.leaps = galileo_utc_model.Delta_tLS;
d_nav_data.utc_gal[0] = galileo_utc_model.A0;
d_nav_data.utc_gal[1] = galileo_utc_model.A1;
d_nav_data.utc_gal[2] = galileo_utc_model.tot;
d_nav_data.utc_gal[3] = galileo_utc_model.WNot;
d_nav_data.leaps = galileo_utc_model.Delta_tLS;
}
if (beidou_dnav_utc_model.valid)
{
nav_data.utc_cmp[0] = beidou_dnav_utc_model.A0_UTC;
nav_data.utc_cmp[1] = beidou_dnav_utc_model.A1_UTC;
nav_data.utc_cmp[2] = 0.0; // ??
nav_data.utc_cmp[3] = 0.0; // ??
nav_data.leaps = beidou_dnav_utc_model.DeltaT_LS;
d_nav_data.utc_cmp[0] = beidou_dnav_utc_model.A0_UTC;
d_nav_data.utc_cmp[1] = beidou_dnav_utc_model.A1_UTC;
d_nav_data.utc_cmp[2] = 0.0; // ??
d_nav_data.utc_cmp[3] = 0.0; // ??
d_nav_data.leaps = beidou_dnav_utc_model.DeltaT_LS;
}
/* update carrier wave length using native function call in RTKlib */
@ -1031,11 +1031,11 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
{
for (int j = 0; j < NFREQ; j++)
{
nav_data.lam[i][j] = satwavelen(i + 1, d_rtklib_freq_index[j], &nav_data);
d_nav_data.lam[i][j] = satwavelen(i + 1, d_rtklib_freq_index[j], &d_nav_data);
}
}
result = rtkpos(&d_rtk, d_obs_data.data(), valid_obs + glo_valid_obs, &nav_data);
result = rtkpos(&d_rtk, d_obs_data.data(), valid_obs + glo_valid_obs, &d_nav_data);
if (result == 0)
{
@ -1136,7 +1136,7 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
// TOW
d_monitor_pvt.TOW_at_current_symbol_ms = gnss_observables_map.cbegin()->second.TOW_at_current_symbol_ms;
// WEEK
d_monitor_pvt.week = adjgpsweek(nav_data.eph[0].week, this->is_pre_2009());
d_monitor_pvt.week = adjgpsweek(d_nav_data.eph[0].week, this->is_pre_2009());
// PVT GPS time
d_monitor_pvt.RX_time = gnss_observables_map.cbegin()->second.RX_time;
// User clock offset [s]
@ -1202,7 +1202,7 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
tmp_uint32 = gnss_observables_map.cbegin()->second.TOW_at_current_symbol_ms;
d_dump_file.write(reinterpret_cast<char *>(&tmp_uint32), sizeof(uint32_t));
// WEEK
tmp_uint32 = adjgpsweek(nav_data.eph[0].week, this->is_pre_2009());
tmp_uint32 = adjgpsweek(d_nav_data.eph[0].week, this->is_pre_2009());
d_dump_file.write(reinterpret_cast<char *>(&tmp_uint32), sizeof(uint32_t));
// PVT GPS time
tmp_double = gnss_observables_map.cbegin()->second.RX_time;

View File

@ -128,6 +128,7 @@ private:
std::string d_dump_filename;
std::ofstream d_dump_file;
rtk_t d_rtk{};
nav_t d_nav_data{};
Monitor_Pvt d_monitor_pvt{};
uint32_t d_type_of_rx;
bool d_flag_dump_enabled;

View File

@ -1,7 +1,7 @@
# GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
# This file is part of GNSS-SDR.
#
# SPDX-FileCopyrightText: 2010-2020 C. Fernandez-Prades cfernandez(at)cttc.es
# SPDX-FileCopyrightText: 2010-2022 C. Fernandez-Prades cfernandez(at)cttc.es
# SPDX-License-Identifier: BSD-3-Clause
@ -123,14 +123,13 @@ if(ENABLE_FPGA)
target_link_libraries(acquisition_adapters
PRIVATE
algorithms_libs
core_libs
Volk::volk
)
endif()
target_include_directories(acquisition_adapters
PUBLIC
${CMAKE_SOURCE_DIR}/src/core/interfaces
${GNSSSDR_SOURCE_DIR}/src/core/interfaces
)
if(ENABLE_CLANG_TIDY)

View File

@ -9,7 +9,7 @@
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
* This file is part of GNSS-SDR.
*
* Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2022 (see AUTHORS file for a list of contributors)
* SPDX-License-Identifier: GPL-3.0-or-later
*
* -----------------------------------------------------------------------------
@ -21,7 +21,6 @@
#include "galileo_e1_signal_replica.h"
#include "gnss_sdr_fft.h"
#include "gnss_sdr_flags.h"
#include "uio_fpga.h"
#include <glog/logging.h>
#include <gnuradio/fft/fft.h> // for fft_complex
#include <gnuradio/gr_complex.h> // for gr_complex
@ -43,56 +42,21 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga(
in_streams_(in_streams),
out_streams_(out_streams)
{
pcpsconf_fpga_t acq_parameters;
std::string default_dump_filename = "./data/acquisition.dat";
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;
int64_t fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 4000000);
int64_t fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
acq_parameters.repeat_satellite = configuration->property(role + ".repeat_satellite", false);
DLOG(INFO) << role << " satellite repeat = " << acq_parameters.repeat_satellite;
uint32_t downsampling_factor = configuration->property(role + ".downsampling_factor", 4);
acq_parameters.downsampling_factor = downsampling_factor;
fs_in = fs_in / downsampling_factor;
acq_parameters.fs_in = fs_in;
doppler_max_ = configuration->property(role + ".doppler_max", 5000);
if (FLAGS_doppler_max != 0)
{
doppler_max_ = FLAGS_doppler_max;
acq_parameters_.doppler_max = FLAGS_doppler_max;
}
acq_parameters.doppler_max = doppler_max_;
doppler_max_ = acq_parameters_.doppler_max;
doppler_step_ = static_cast<unsigned int>(acq_parameters_.doppler_step);
fs_in_ = acq_parameters_.fs_in;
acquire_pilot_ = configuration->property(role + ".acquire_pilot", false); // could be true in future versions
// Find number of samples per spreading code (4 ms)
auto code_length = static_cast<uint32_t>(std::round(static_cast<double>(fs_in) / (GALILEO_E1_CODE_CHIP_RATE_CPS / GALILEO_E1_B_CODE_LENGTH_CHIPS)));
acq_parameters.code_length = code_length;
// The FPGA can only use FFT lengths that are a power of two.
float nbits = ceilf(log2f(static_cast<float>(code_length) * 2.0F));
uint32_t nsamples_total = pow(2, nbits);
uint32_t select_queue_Fpga = configuration->property(role + ".select_queue_Fpga", 0);
acq_parameters.select_queue_Fpga = select_queue_Fpga;
// UIO device file
std::string device_io_name;
// find the uio device file corresponding to the acquisition
if (find_uio_dev_file_name(device_io_name, acquisition_device_name, 0) < 0)
{
std::cout << "Cannot find the FPGA uio device file corresponding to device name " << acquisition_device_name << std::endl;
throw std::exception();
}
acq_parameters.device_name = device_io_name;
acq_parameters.samples_per_code = nsamples_total;
acq_parameters.excludelimit = static_cast<unsigned int>(1 + ceil((1.0 / GALILEO_E1_CODE_CHIP_RATE_CPS) * static_cast<float>(fs_in)));
uint32_t code_length = acq_parameters_.code_length;
uint32_t nsamples_total = acq_parameters_.samples_per_code;
// compute all the GALILEO E1 PRN Codes (this is done only once in the class constructor in order to avoid re-computing the PRN codes every time
// a channel is assigned)
@ -116,13 +80,13 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga(
// set local signal generator to Galileo E1 pilot component (1C)
std::array<char, 3> pilot_signal = {{'1', 'C', '\0'}};
galileo_e1_code_gen_complex_sampled(code, pilot_signal,
cboc, PRN, fs_in, 0, false);
cboc, PRN, fs_in_, 0, false);
}
else
{
std::array<char, 3> data_signal = {{'1', 'B', '\0'}};
galileo_e1_code_gen_complex_sampled(code, data_signal,
cboc, PRN, fs_in, 0, false);
cboc, PRN, fs_in_, 0, false);
}
for (uint32_t s = code_length; s < 2 * code_length; s++)
@ -165,16 +129,9 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga(
}
}
acq_parameters.all_fft_codes = d_all_fft_codes_.data();
acq_parameters_.all_fft_codes = d_all_fft_codes_.data();
acq_parameters.num_doppler_bins_step2 = configuration->property(role + ".second_nbins", 4);
acq_parameters.doppler_step2 = configuration->property(role + ".second_doppler_step", static_cast<float>(125.0));
acq_parameters.make_2_steps = configuration->property(role + ".make_two_steps", false);
acq_parameters.max_num_acqs = configuration->property(role + ".max_num_acqs", 2);
// reference for the FPGA FFT-IFFT attenuation factor
acq_parameters.total_block_exp = configuration->property(role + ".total_block_exp", 13);
acquisition_fpga_ = pcps_make_acquisition_fpga(acq_parameters);
acquisition_fpga_ = pcps_make_acquisition_fpga(acq_parameters_);
if (in_streams_ > 1)
{

View File

@ -9,7 +9,7 @@
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
* This file is part of GNSS-SDR.
*
* Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2022 (see AUTHORS file for a list of contributors)
* SPDX-License-Identifier: GPL-3.0-or-later
*
* -----------------------------------------------------------------------------
@ -18,7 +18,7 @@
#ifndef GNSS_SDR_GALILEO_E1_PCPS_AMBIGUOUS_ACQUISITION_FPGA_H
#define GNSS_SDR_GALILEO_E1_PCPS_AMBIGUOUS_ACQUISITION_FPGA_H
#include "acq_conf.h"
#include "acq_conf_fpga.h"
#include "channel_fsm.h"
#include "gnss_synchro.h"
#include "pcps_acquisition_fpga.h"
@ -181,7 +181,9 @@ public:
void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{};
private:
const std::string acquisition_device_name = "acquisition_S00_AXI"; // UIO device name
static const uint32_t fpga_downsampling_factor = 4; // downampling factor in the FPGA
static const uint32_t fpga_buff_num = 0; // L1/E1 band
static const uint32_t fpga_blk_exp = 13; // default block exponent
// the following flags are FPGA-specific and they are using arrange the values of the fft of the local code in the way the FPGA
// expects. This arrangement is done in the initialisation to avoid consuming unnecessary clock cycles during tracking.
@ -195,8 +197,10 @@ private:
volk_gnsssdr::vector<uint32_t> d_all_fft_codes_; // memory that contains all the code ffts
std::weak_ptr<ChannelFsm> channel_fsm_;
Gnss_Synchro* gnss_synchro_;
std::string dump_filename_;
const ConfigurationInterface* configuration_;
Acq_Conf_Fpga acq_parameters_;
std::string role_;
int64_t fs_in_;
int32_t doppler_center_;
uint32_t channel_;
uint32_t doppler_max_;

View File

@ -9,7 +9,7 @@
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
* This file is part of GNSS-SDR.
*
* Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2022 (see AUTHORS file for a list of contributors)
* SPDX-License-Identifier: GPL-3.0-or-later
*
* -----------------------------------------------------------------------------
@ -21,7 +21,6 @@
#include "galileo_e5_signal_replica.h"
#include "gnss_sdr_fft.h"
#include "gnss_sdr_flags.h"
#include "uio_fpga.h"
#include <glog/logging.h>
#include <gnuradio/gr_complex.h> // for gr_complex
#include <volk/volk.h> // for volk_32fc_conjugate_32fc
@ -42,29 +41,17 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga(
in_streams_(in_streams),
out_streams_(out_streams)
{
pcpsconf_fpga_t acq_parameters;
const std::string default_dump_filename("../data/acquisition.dat");
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;
int64_t fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 32000000);
int64_t fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
acq_parameters.repeat_satellite = configuration->property(role + ".repeat_satellite", false);
DLOG(INFO) << role << " satellite repeat = " << acq_parameters.repeat_satellite;
uint32_t downsampling_factor = configuration->property(role + ".downsampling_factor", 1);
acq_parameters.downsampling_factor = downsampling_factor;
fs_in = fs_in / downsampling_factor;
acq_parameters.fs_in = fs_in;
doppler_max_ = configuration->property(role + ".doppler_max", 5000);
if (FLAGS_doppler_max != 0)
{
doppler_max_ = FLAGS_doppler_max;
acq_parameters_.doppler_max = FLAGS_doppler_max;
}
acq_parameters.doppler_max = doppler_max_;
doppler_max_ = acq_parameters_.doppler_max;
doppler_step_ = static_cast<unsigned int>(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);
@ -73,27 +60,8 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga(
acq_pilot_ = false;
}
auto code_length = static_cast<uint32_t>(std::round(static_cast<double>(fs_in) / GALILEO_E5A_CODE_CHIP_RATE_CPS * static_cast<double>(GALILEO_E5A_CODE_LENGTH_CHIPS)));
acq_parameters.code_length = code_length;
// The FPGA can only use FFT lengths that are a power of two.
float nbits = ceilf(log2f(static_cast<float>(code_length) * 2.0F));
uint32_t nsamples_total = pow(2, nbits);
uint32_t select_queue_Fpga = configuration->property(role + ".select_queue_Fpga", 1);
acq_parameters.select_queue_Fpga = select_queue_Fpga;
// UIO device file
std::string device_io_name;
// find the uio device file corresponding to the acquisition
if (find_uio_dev_file_name(device_io_name, acquisition_device_name, 0) < 0)
{
std::cout << "Cannot find the FPGA uio device file corresponding to device name " << acquisition_device_name << std::endl;
throw std::exception();
}
acq_parameters.device_name = device_io_name;
acq_parameters.samples_per_code = nsamples_total;
acq_parameters.excludelimit = static_cast<unsigned int>(1 + ceil((1.0 / GALILEO_E5A_CODE_CHIP_RATE_CPS) * static_cast<float>(fs_in)));
uint32_t code_length = acq_parameters_.code_length;
uint32_t nsamples_total = acq_parameters_.samples_per_code;
// compute all the GALILEO E5 PRN Codes (this is done only once in the class constructor in order to avoid re-computing the PRN codes every time
// a channel is assigned)
@ -127,7 +95,7 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga(
signal_[1] = 'I';
}
galileo_e5_a_code_gen_complex_sampled(code, PRN, signal_, fs_in, 0);
galileo_e5_a_code_gen_complex_sampled(code, PRN, signal_, fs_in_, 0);
for (uint32_t s = code_length; s < 2 * code_length; s++)
{
@ -168,16 +136,9 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga(
}
}
acq_parameters.all_fft_codes = d_all_fft_codes_.data();
acq_parameters_.all_fft_codes = d_all_fft_codes_.data();
// reference for the FPGA FFT-IFFT attenuation factor
acq_parameters.total_block_exp = configuration->property(role + ".total_block_exp", 13);
acq_parameters.num_doppler_bins_step2 = configuration->property(role + ".second_nbins", 4);
acq_parameters.doppler_step2 = configuration->property(role + ".second_doppler_step", static_cast<float>(125.0));
acq_parameters.make_2_steps = configuration->property(role + ".make_two_steps", false);
acq_parameters.max_num_acqs = configuration->property(role + ".max_num_acqs", 2);
acquisition_fpga_ = pcps_make_acquisition_fpga(acq_parameters);
acquisition_fpga_ = pcps_make_acquisition_fpga(acq_parameters_);
if (in_streams_ > 1)
{

View File

@ -9,7 +9,7 @@
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
* This file is part of GNSS-SDR.
*
* Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2022 (see AUTHORS file for a list of contributors)
* SPDX-License-Identifier: GPL-3.0-or-later
*
* -----------------------------------------------------------------------------
@ -18,7 +18,7 @@
#ifndef GNSS_SDR_GALILEO_E5A_PCPS_ACQUISITION_FPGA_H
#define GNSS_SDR_GALILEO_E5A_PCPS_ACQUISITION_FPGA_H
#include "acq_conf_fpga.h"
#include "channel_fsm.h"
#include "gnss_synchro.h"
#include "pcps_acquisition_fpga.h"
@ -188,7 +188,9 @@ public:
void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{};
private:
const std::string acquisition_device_name = "acquisition_S00_AXI"; // UIO device name
static const uint32_t fpga_downsampling_factor = 1; // downampling factor in the FPGA
static const uint32_t fpga_buff_num = 1; // L5/E5a band
static const uint32_t fpga_blk_exp = 13; // default block exponent
// the following flags are FPGA-specific and they are using arrange the values of the fft of the local code in the way the FPGA
// expects. This arrangement is done in the initialisation to avoid consuming unnecessary clock cycles during tracking.
@ -202,9 +204,10 @@ private:
std::weak_ptr<ChannelFsm> channel_fsm_;
volk_gnsssdr::vector<uint32_t> 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_;
std::string item_type_;
std::string dump_filename_;
int64_t fs_in_;
int32_t doppler_center_;
uint32_t channel_;
uint32_t doppler_max_;

View File

@ -10,7 +10,7 @@
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
* This file is part of GNSS-SDR.
*
* Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2022 (see AUTHORS file for a list of contributors)
* SPDX-License-Identifier: GPL-3.0-or-later
*
* -----------------------------------------------------------------------------
@ -22,7 +22,6 @@
#include "galileo_e5_signal_replica.h"
#include "gnss_sdr_fft.h"
#include "gnss_sdr_flags.h"
#include "uio_fpga.h"
#include <glog/logging.h>
#include <gnuradio/gr_complex.h> // for gr_complex
#include <volk/volk.h> // for volk_32fc_conjugate_32fc
@ -41,29 +40,15 @@ GalileoE5bPcpsAcquisitionFpga::GalileoE5bPcpsAcquisitionFpga(const Configuration
in_streams_(in_streams),
out_streams_(out_streams)
{
pcpsconf_fpga_t acq_parameters;
std::string default_dump_filename = "../data/acquisition.dat";
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);
DLOG(INFO) << "Role " << role;
int64_t fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 32000000);
int64_t fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
acq_parameters.repeat_satellite = configuration->property(role + ".repeat_satellite", false);
DLOG(INFO) << role << " satellite repeat = " << acq_parameters.repeat_satellite;
uint32_t downsampling_factor = configuration->property(role + ".downsampling_factor", 1);
acq_parameters.downsampling_factor = downsampling_factor;
fs_in = fs_in / downsampling_factor;
acq_parameters.fs_in = fs_in;
doppler_max_ = configuration->property(role + ".doppler_max", 5000);
if (FLAGS_doppler_max != 0)
{
doppler_max_ = FLAGS_doppler_max;
acq_parameters_.doppler_max = FLAGS_doppler_max;
}
acq_parameters.doppler_max = doppler_max_;
doppler_max_ = acq_parameters_.doppler_max;
doppler_step_ = static_cast<unsigned int>(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);
@ -72,27 +57,8 @@ GalileoE5bPcpsAcquisitionFpga::GalileoE5bPcpsAcquisitionFpga(const Configuration
acq_pilot_ = false;
}
auto code_length = static_cast<uint32_t>(std::round(static_cast<double>(fs_in) / GALILEO_E5B_CODE_CHIP_RATE_CPS * static_cast<double>(GALILEO_E5B_CODE_LENGTH_CHIPS)));
acq_parameters.code_length = code_length;
// The FPGA can only use FFT lengths that are a power of two.
float nbits = ceilf(log2f(static_cast<float>(code_length) * 2.0F));
uint32_t nsamples_total = pow(2, nbits);
uint32_t select_queue_Fpga = configuration->property(role + ".select_queue_Fpga", 1);
acq_parameters.select_queue_Fpga = select_queue_Fpga;
// UIO device file
std::string device_io_name;
// find the uio device file corresponding to the acquisition
if (find_uio_dev_file_name(device_io_name, acquisition_device_name, 0) < 0)
{
std::cout << "Cannot find the FPGA uio device file corresponding to device name " << acquisition_device_name << std::endl;
throw std::exception();
}
acq_parameters.device_name = device_io_name;
acq_parameters.samples_per_code = nsamples_total;
acq_parameters.excludelimit = static_cast<unsigned int>(1 + ceil((1.0 / GALILEO_E5B_CODE_CHIP_RATE_CPS) * static_cast<float>(fs_in)));
uint32_t code_length = acq_parameters_.code_length;
uint32_t nsamples_total = acq_parameters_.samples_per_code;
// compute all the GALILEO E5b PRN Codes (this is done only once in the class constructor in order to avoid re-computing the PRN codes every time
// a channel is assigned)
@ -126,7 +92,7 @@ GalileoE5bPcpsAcquisitionFpga::GalileoE5bPcpsAcquisitionFpga(const Configuration
signal_[1] = 'I';
}
galileo_e5_b_code_gen_complex_sampled(code, PRN, signal_, fs_in, 0);
galileo_e5_b_code_gen_complex_sampled(code, PRN, signal_, fs_in_, 0);
for (uint32_t s = code_length; s < 2 * code_length; s++)
{
@ -167,16 +133,9 @@ GalileoE5bPcpsAcquisitionFpga::GalileoE5bPcpsAcquisitionFpga(const Configuration
}
}
acq_parameters.all_fft_codes = d_all_fft_codes_.data();
acq_parameters_.all_fft_codes = d_all_fft_codes_.data();
// reference for the FPGA FFT-IFFT attenuation factor
acq_parameters.total_block_exp = configuration->property(role + ".total_block_exp", 13);
acq_parameters.num_doppler_bins_step2 = configuration->property(role + ".second_nbins", 4);
acq_parameters.doppler_step2 = configuration->property(role + ".second_doppler_step", static_cast<float>(125.0));
acq_parameters.make_2_steps = configuration->property(role + ".make_two_steps", false);
acq_parameters.max_num_acqs = configuration->property(role + ".max_num_acqs", 2);
acquisition_fpga_ = pcps_make_acquisition_fpga(acq_parameters);
acquisition_fpga_ = pcps_make_acquisition_fpga(acq_parameters_);
if (in_streams_ > 1)
{

View File

@ -10,7 +10,7 @@
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
* This file is part of GNSS-SDR.
*
* Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2022 (see AUTHORS file for a list of contributors)
* SPDX-License-Identifier: GPL-3.0-or-later
*
* -----------------------------------------------------------------------------
@ -19,7 +19,7 @@
#ifndef GNSS_SDR_GALILEO_E5B_PCPS_ACQUISITION_FPGA_H
#define GNSS_SDR_GALILEO_E5B_PCPS_ACQUISITION_FPGA_H
#include "acq_conf_fpga.h"
#include "channel_fsm.h"
#include "gnss_synchro.h"
#include "pcps_acquisition_fpga.h"
@ -187,7 +187,9 @@ public:
void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{};
private:
const std::string acquisition_device_name = "acquisition_S00_AXI"; // UIO device name
static const uint32_t fpga_downsampling_factor = 1; // downampling factor in the FPGA
static const uint32_t fpga_buff_num = 1; // E5b band
static const uint32_t fpga_blk_exp = 13; // default block exponent
// the following flags are FPGA-specific and they are using arrange the values of the fft of the local code in the way the FPGA
// expects. This arrangement is done in the initialisation to avoid consuming unnecessary clock cycles during tracking.
@ -202,10 +204,10 @@ private:
std::weak_ptr<ChannelFsm> channel_fsm_;
Gnss_Synchro* gnss_synchro_;
std::string item_type_;
std::string dump_filename_;
const ConfigurationInterface* configuration_;
Acq_Conf_Fpga acq_parameters_;
std::string role_;
int64_t fs_in_;
int32_t doppler_center_;
uint32_t channel_;
uint32_t doppler_max_;

View File

@ -12,7 +12,7 @@
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
* This file is part of GNSS-SDR.
*
* Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2022 (see AUTHORS file for a list of contributors)
* SPDX-License-Identifier: GPL-3.0-or-later
*
* -----------------------------------------------------------------------------
@ -24,7 +24,6 @@
#include "gnss_sdr_fft.h"
#include "gnss_sdr_flags.h"
#include "gps_sdr_signal_replica.h"
#include "uio_fpga.h"
#include <glog/logging.h>
#include <gnuradio/gr_complex.h> // for gr_complex
#include <volk/volk.h> // for volk_32fc_conjugate_32fc
@ -44,47 +43,20 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga(
in_streams_(in_streams),
out_streams_(out_streams)
{
pcpsconf_fpga_t acq_parameters;
acq_parameters_.SetFromConfiguration(configuration, role, fpga_downsampling_factor, fpga_buff_num, fpga_blk_exp, GPS_L1_CA_CODE_RATE_CPS, GPS_L1_CA_CODE_LENGTH_CHIPS);
DLOG(INFO) << "role " << role;
int64_t fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000);
int64_t fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
acq_parameters.repeat_satellite = configuration->property(role + ".repeat_satellite", false);
DLOG(INFO) << role << " satellite repeat = " << acq_parameters.repeat_satellite;
uint32_t downsampling_factor = configuration->property(role + ".downsampling_factor", 4);
acq_parameters.downsampling_factor = downsampling_factor;
fs_in = fs_in / downsampling_factor;
acq_parameters.fs_in = fs_in;
doppler_max_ = configuration->property(role + ".doppler_max", 5000);
if (FLAGS_doppler_max != 0)
{
doppler_max_ = FLAGS_doppler_max;
acq_parameters_.doppler_max = FLAGS_doppler_max;
}
acq_parameters.doppler_max = doppler_max_;
auto code_length = static_cast<uint32_t>(std::round(static_cast<double>(fs_in) / (GPS_L1_CA_CODE_RATE_CPS / GPS_L1_CA_CODE_LENGTH_CHIPS)));
acq_parameters.code_length = code_length;
// The FPGA can only use FFT lengths that are a power of two.
float nbits = ceilf(log2f(static_cast<float>(code_length) * 2.0F));
uint32_t nsamples_total = pow(2, nbits);
uint32_t select_queue_Fpga = configuration->property(role + ".select_queue_Fpga", 0);
acq_parameters.select_queue_Fpga = select_queue_Fpga;
doppler_max_ = acq_parameters_.doppler_max;
doppler_step_ = static_cast<unsigned int>(acq_parameters_.doppler_step);
fs_in_ = acq_parameters_.fs_in;
// UIO device file
std::string device_io_name;
// find the uio device file corresponding to the acquisition
if (find_uio_dev_file_name(device_io_name, acquisition_device_name, 0) < 0)
{
std::cout << "Cannot find the FPGA uio device file corresponding to device name " << acquisition_device_name << std::endl;
throw std::exception();
}
acq_parameters.device_name = device_io_name;
acq_parameters.samples_per_code = nsamples_total;
acq_parameters.excludelimit = static_cast<unsigned int>(1 + ceil(GPS_L1_CA_CHIP_PERIOD_S * static_cast<float>(fs_in)));
uint32_t code_length = acq_parameters_.code_length;
uint32_t nsamples_total = acq_parameters_.samples_per_code;
// compute all the GPS L1 PRN Codes (this is done only once upon the class constructor in order to avoid re-computing the PRN codes every time
// a channel is assigned)
@ -101,7 +73,7 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga(
// temporary maxima search
for (uint32_t PRN = 1; PRN <= NUM_PRNs; PRN++)
{
gps_l1_ca_code_gen_complex_sampled(code, PRN, fs_in, 0); // generate PRN code
gps_l1_ca_code_gen_complex_sampled(code, PRN, fs_in_, 0); // generate PRN code
for (uint32_t s = code_length; s < 2 * code_length; s++)
{
@ -143,16 +115,9 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga(
}
// acq_parameters
acq_parameters.all_fft_codes = d_all_fft_codes_.data();
acq_parameters_.all_fft_codes = d_all_fft_codes_.data();
// reference for the FPGA FFT-IFFT attenuation factor
acq_parameters.total_block_exp = configuration->property(role + ".total_block_exp", 10);
acq_parameters.num_doppler_bins_step2 = configuration->property(role + ".second_nbins", 4);
acq_parameters.doppler_step2 = configuration->property(role + ".second_doppler_step", static_cast<float>(125.0));
acq_parameters.make_2_steps = configuration->property(role + ".make_two_steps", false);
acq_parameters.max_num_acqs = configuration->property(role + ".max_num_acqs", 2);
acquisition_fpga_ = pcps_make_acquisition_fpga(acq_parameters);
acquisition_fpga_ = pcps_make_acquisition_fpga(acq_parameters_);
if (in_streams_ > 1)
{

View File

@ -12,7 +12,7 @@
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
* This file is part of GNSS-SDR.
*
* Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2022 (see AUTHORS file for a list of contributors)
* SPDX-License-Identifier: GPL-3.0-or-later
*
* -----------------------------------------------------------------------------
@ -21,7 +21,7 @@
#ifndef GNSS_SDR_GPS_L1_CA_PCPS_ACQUISITION_FPGA_H
#define GNSS_SDR_GPS_L1_CA_PCPS_ACQUISITION_FPGA_H
#include "acq_conf_fpga.h"
#include "channel_fsm.h"
#include "gnss_synchro.h"
#include "pcps_acquisition_fpga.h"
@ -129,6 +129,8 @@ public:
/*!
* \brief Set statistics threshold of PCPS algorithm
*/
std::string item_type_;
void set_threshold(float threshold) override;
/*!
@ -184,7 +186,9 @@ public:
private:
static const uint32_t NUM_PRNs = 32;
const std::string acquisition_device_name = "acquisition_S00_AXI"; // UIO device name
static const uint32_t fpga_downsampling_factor = 4; // downampling factor in the FPGA
static const uint32_t fpga_buff_num = 0; // L1/E1 band
static const uint32_t fpga_blk_exp = 10; // default block exponent
// the following flags are FPGA-specific and they are using arrange the values of the fft of the local code in the way the FPGA
// expects. This arrangement is done in the initialisation to avoid consuming unnecessary clock cycles during tracking.
@ -198,7 +202,10 @@ private:
std::weak_ptr<ChannelFsm> channel_fsm_;
volk_gnsssdr::vector<uint32_t> 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_;
int32_t doppler_center_;
uint32_t channel_;
uint32_t doppler_max_;

View File

@ -11,7 +11,7 @@
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
* This file is part of GNSS-SDR.
*
* Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2022 (see AUTHORS file for a list of contributors)
* SPDX-License-Identifier: GPL-3.0-or-later
*
* -----------------------------------------------------------------------------
@ -24,7 +24,6 @@
#include "gnss_sdr_flags.h"
#include "gnss_synchro.h"
#include "gps_l2c_signal_replica.h"
#include "uio_fpga.h"
#include <glog/logging.h>
#include <gnuradio/gr_complex.h> // for gr_complex
#include <volk/volk.h> // for volk_32fc_conjugate_32fc
@ -45,47 +44,20 @@ GpsL2MPcpsAcquisitionFpga::GpsL2MPcpsAcquisitionFpga(
in_streams_(in_streams),
out_streams_(out_streams)
{
pcpsconf_fpga_t acq_parameters;
std::string default_dump_filename = "./acquisition.mat";
acq_parameters_.SetFromConfiguration(configuration, role, fpga_downsampling_factor, fpga_buff_num, fpga_blk_exp, GPS_L2_M_CODE_RATE_CPS, GPS_L2_M_CODE_LENGTH_CHIPS);
LOG(INFO) << "role " << role;
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.repeat_satellite = configuration->property(role + ".repeat_satellite", false);
DLOG(INFO) << role << " satellite repeat = " << acq_parameters.repeat_satellite;
doppler_max_ = configuration->property(role + ".doppler_max", 5000);
if (FLAGS_doppler_max != 0)
{
doppler_max_ = FLAGS_doppler_max;
acq_parameters_.doppler_max = FLAGS_doppler_max;
}
acq_parameters.doppler_max = doppler_max_;
doppler_max_ = acq_parameters_.doppler_max;
doppler_step_ = static_cast<unsigned int>(acq_parameters_.doppler_step);
fs_in_ = acq_parameters_.fs_in;
auto code_length = static_cast<unsigned int>(std::round(static_cast<double>(fs_in_) / (GPS_L2_M_CODE_RATE_CPS / static_cast<double>(GPS_L2_M_CODE_LENGTH_CHIPS))));
acq_parameters.code_length = code_length;
// The FPGA can only use FFT lengths that are a power of two.
float nbits = ceilf(log2f(static_cast<float>(code_length)));
unsigned int nsamples_total = pow(2, nbits);
unsigned int select_queue_Fpga = configuration->property(role + ".select_queue_Fpga", 0);
acq_parameters.select_queue_Fpga = select_queue_Fpga;
// UIO device file
std::string device_io_name;
// find the uio device file corresponding to the acquisition
if (find_uio_dev_file_name(device_io_name, acquisition_device_name, 0) < 0)
{
std::cout << "Cannot find the FPGA uio device file corresponding to device name " << acquisition_device_name << std::endl;
throw std::exception();
}
acq_parameters.device_name = device_io_name;
acq_parameters.samples_per_code = nsamples_total;
acq_parameters.downsampling_factor = configuration->property(role + ".downsampling_factor", 1.0);
acq_parameters.total_block_exp = configuration->property(role + ".total_block_exp", 14);
acq_parameters.excludelimit = static_cast<uint32_t>(std::round(static_cast<double>(fs_in_) / GPS_L2_M_CODE_RATE_CPS));
uint32_t code_length = acq_parameters_.code_length;
uint32_t nsamples_total = acq_parameters_.samples_per_code;
// compute all the GPS L2C PRN Codes (this is done only once upon the class constructor in order to avoid re-computing the PRN codes every time
// a channel is assigned)
@ -139,15 +111,9 @@ GpsL2MPcpsAcquisitionFpga::GpsL2MPcpsAcquisitionFpga(
}
}
acq_parameters.all_fft_codes = d_all_fft_codes_.data();
acq_parameters_.all_fft_codes = d_all_fft_codes_.data();
acquisition_fpga_ = pcps_make_acquisition_fpga(acq_parameters);
channel_ = 0;
doppler_step_ = 0;
gnss_synchro_ = nullptr;
threshold_ = 0.0;
acquisition_fpga_ = pcps_make_acquisition_fpga(acq_parameters_);
if (in_streams_ > 1)
{

View File

@ -11,7 +11,7 @@
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
* This file is part of GNSS-SDR.
*
* Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2022 (see AUTHORS file for a list of contributors)
* SPDX-License-Identifier: GPL-3.0-or-later
*
* -----------------------------------------------------------------------------
@ -20,6 +20,7 @@
#ifndef GNSS_SDR_GPS_L2_M_PCPS_ACQUISITION_FPGA_H
#define GNSS_SDR_GPS_L2_M_PCPS_ACQUISITION_FPGA_H
#include "acq_conf_fpga.h"
#include "channel_fsm.h"
#include "pcps_acquisition_fpga.h"
#include <gnuradio/runtime_types.h> // for basic_block_sptr, top_block_sptr
@ -148,7 +149,9 @@ public:
void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{};
private:
const std::string acquisition_device_name = "acquisition_S00_AXI"; // UIO device name
static const uint32_t fpga_downsampling_factor = 4; // downampling factor in the FPGA
static const uint32_t fpga_buff_num = 0; // L2 band
static const uint32_t fpga_blk_exp = 13; // default block exponent
static const uint32_t NUM_PRNs = 32;
static const uint32_t QUANT_BITS_LOCAL_CODE = 16;
@ -161,8 +164,8 @@ private:
volk_gnsssdr::vector<uint32_t> d_all_fft_codes_; // memory that contains all the code ffts
std::weak_ptr<ChannelFsm> channel_fsm_;
Gnss_Synchro* gnss_synchro_;
std::string item_type_;
std::string dump_filename_;
const ConfigurationInterface* configuration_;
Acq_Conf_Fpga acq_parameters_;
std::string role_;
int64_t fs_in_;
float threshold_;

View File

@ -12,7 +12,7 @@
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
* This file is part of GNSS-SDR.
*
* Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2022 (see AUTHORS file for a list of contributors)
* SPDX-License-Identifier: GPL-3.0-or-later
*
* -----------------------------------------------------------------------------
@ -24,7 +24,6 @@
#include "gnss_sdr_fft.h"
#include "gnss_sdr_flags.h"
#include "gps_l5_signal_replica.h"
#include "uio_fpga.h"
#include <glog/logging.h>
#include <gnuradio/gr_complex.h> // for gr_complex
#include <volk/volk.h> // for volk_32fc_conjugate_32fc
@ -45,51 +44,20 @@ GpsL5iPcpsAcquisitionFpga::GpsL5iPcpsAcquisitionFpga(
in_streams_(in_streams),
out_streams_(out_streams)
{
pcpsconf_fpga_t acq_parameters;
std::string default_dump_filename = "./data/acquisition.dat";
acq_parameters_.SetFromConfiguration(configuration, role, fpga_downsampling_factor, fpga_buff_num, fpga_blk_exp, GPS_L5I_CODE_RATE_CPS, GPS_L5I_CODE_LENGTH_CHIPS);
LOG(INFO) << "role " << role;
int64_t fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000);
int64_t fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
acq_parameters.repeat_satellite = configuration->property(role + ".repeat_satellite", false);
DLOG(INFO) << role << " satellite repeat = " << acq_parameters.repeat_satellite;
uint32_t downsampling_factor = configuration->property(role + ".downsampling_factor", 1);
acq_parameters.downsampling_factor = downsampling_factor;
fs_in = fs_in / downsampling_factor;
acq_parameters.fs_in = fs_in;
doppler_max_ = configuration->property(role + ".doppler_max", 5000);
if (FLAGS_doppler_max != 0)
{
doppler_max_ = FLAGS_doppler_max;
acq_parameters_.doppler_max = FLAGS_doppler_max;
}
acq_parameters.doppler_max = doppler_max_;
doppler_max_ = acq_parameters_.doppler_max;
doppler_step_ = static_cast<unsigned int>(acq_parameters_.doppler_step);
fs_in_ = acq_parameters_.fs_in;
// -- Find number of samples per spreading code -------------------------
auto code_length = static_cast<uint32_t>(std::round(static_cast<double>(fs_in) / (GPS_L5I_CODE_RATE_CPS / static_cast<double>(GPS_L5I_CODE_LENGTH_CHIPS))));
acq_parameters.code_length = code_length;
// The FPGA can only use FFT lengths that are a power of two.
float nbits = ceilf(log2f(static_cast<float>(code_length) * 2.0F));
uint32_t nsamples_total = pow(2, nbits);
uint32_t select_queue_Fpga = configuration->property(role + ".select_queue_Fpga", 1);
acq_parameters.select_queue_Fpga = select_queue_Fpga;
// UIO device file
std::string device_io_name;
// find the uio device file corresponding to the acquisition
if (find_uio_dev_file_name(device_io_name, acquisition_device_name, 0) < 0)
{
std::cout << "Cannot find the FPGA uio device file corresponding to device name " << acquisition_device_name << std::endl;
throw std::exception();
}
acq_parameters.device_name = device_io_name;
acq_parameters.samples_per_code = nsamples_total;
acq_parameters.excludelimit = static_cast<unsigned int>(1 + ceil((1.0 / GPS_L5I_CODE_RATE_CPS) * static_cast<float>(fs_in)));
uint32_t code_length = acq_parameters_.code_length;
uint32_t nsamples_total = acq_parameters_.samples_per_code;
// compute all the GPS L5 PRN Codes (this is done only once upon the class constructor in order to avoid re-computing the PRN codes every time
// a channel is assigned)
@ -106,7 +74,7 @@ GpsL5iPcpsAcquisitionFpga::GpsL5iPcpsAcquisitionFpga(
for (uint32_t PRN = 1; PRN <= NUM_PRNs; PRN++)
{
gps_l5i_code_gen_complex_sampled(code, PRN, fs_in);
gps_l5i_code_gen_complex_sampled(code, PRN, fs_in_);
for (uint32_t s = code_length; s < 2 * code_length; s++)
{
@ -146,16 +114,9 @@ GpsL5iPcpsAcquisitionFpga::GpsL5iPcpsAcquisitionFpga(
}
}
acq_parameters.all_fft_codes = d_all_fft_codes_.data();
acq_parameters_.all_fft_codes = d_all_fft_codes_.data();
// reference for the FPGA FFT-IFFT attenuation factor
acq_parameters.total_block_exp = configuration->property(role + ".total_block_exp", 13);
acq_parameters.num_doppler_bins_step2 = configuration->property(role + ".second_nbins", 4);
acq_parameters.doppler_step2 = configuration->property(role + ".second_doppler_step", static_cast<float>(125.0));
acq_parameters.make_2_steps = configuration->property(role + ".make_two_steps", false);
acq_parameters.max_num_acqs = configuration->property(role + ".max_num_acqs", 2);
acquisition_fpga_ = pcps_make_acquisition_fpga(acq_parameters);
acquisition_fpga_ = pcps_make_acquisition_fpga(acq_parameters_);
if (in_streams_ > 1)
{

View File

@ -12,7 +12,7 @@
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
* This file is part of GNSS-SDR.
*
* Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2022 (see AUTHORS file for a list of contributors)
* SPDX-License-Identifier: GPL-3.0-or-later
*
* -----------------------------------------------------------------------------
@ -21,6 +21,7 @@
#ifndef GNSS_SDR_GPS_L5I_PCPS_ACQUISITION_FPGA_H
#define GNSS_SDR_GPS_L5I_PCPS_ACQUISITION_FPGA_H
#include "acq_conf_fpga.h"
#include "channel_fsm.h"
#include "gnss_synchro.h"
#include "pcps_acquisition_fpga.h"
@ -185,7 +186,9 @@ public:
private:
static const uint32_t NUM_PRNs = 32;
const std::string acquisition_device_name = "acquisition_S00_AXI"; // UIO device name
static const uint32_t fpga_downsampling_factor = 1; // downampling factor in the FPGA
static const uint32_t fpga_buff_num = 1; // L5/E5a band
static const uint32_t fpga_blk_exp = 13; // default block exponent
// the following flags are FPGA-specific and they are using arrange the values of the fft of the local code in the way the FPGA
// expects. This arrangement is done in the initialisation to avoid consuming unnecessary clock cycles during tracking.
@ -201,9 +204,10 @@ private:
std::weak_ptr<ChannelFsm> channel_fsm_;
volk_gnsssdr::vector<uint32_t> d_all_fft_codes_; // memory that contains all the code ffts
Gnss_Synchro* gnss_synchro_;
std::string item_type_;
std::string dump_filename_;
const ConfigurationInterface* configuration_;
Acq_Conf_Fpga acq_parameters_;
std::string role_;
int64_t fs_in_;
int32_t doppler_center_;
uint32_t channel_;
uint32_t doppler_max_;

View File

@ -72,7 +72,7 @@ target_link_libraries(acquisition_gr_blocks
target_include_directories(acquisition_gr_blocks
PRIVATE
${CMAKE_SOURCE_DIR}/src/core/receiver
${GNSSSDR_SOURCE_DIR}/src/core/receiver
)
if(GNURADIO_USES_STD_POINTERS)
@ -97,7 +97,7 @@ if(ENABLE_OPENCL)
target_link_libraries(acquisition_gr_blocks PUBLIC OpenCL::OpenCL)
target_include_directories(acquisition_gr_blocks
PUBLIC
${CMAKE_SOURCE_DIR}/src/algorithms/libs/opencl
${GNSSSDR_SOURCE_DIR}/src/algorithms/libs/opencl
)
endif()
@ -113,5 +113,5 @@ endif()
set_property(TARGET acquisition_gr_blocks
APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src/algorithms/libs/opencl>
$<BUILD_INTERFACE:${GNSSSDR_SOURCE_DIR}/src/algorithms/libs/opencl>
)

View File

@ -909,7 +909,9 @@ int pcps_acquisition::general_work(int noutput_items __attribute__((unused)),
gr::thread::scoped_lock lk(d_setlock);
if (!d_active or d_worker_active)
{
if (!d_acq_parameters.blocking_on_standby)
// do not consume samples while performing a non-coherent integration
bool consume_samples = ((!d_active) || (d_active && (d_num_noncoherent_integrations_counter == d_acq_parameters.max_dwells)));
if ((!d_acq_parameters.blocking_on_standby) && consume_samples)
{
d_sample_counter += static_cast<uint64_t>(ninput_items[0]);
consume_each(ninput_items[0]);

View File

@ -11,7 +11,7 @@
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
* This file is part of GNSS-SDR.
*
* Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2022 (see AUTHORS file for a list of contributors)
* SPDX-License-Identifier: GPL-3.0-or-later
*
* -----------------------------------------------------------------------------
@ -27,14 +27,14 @@
#include <utility> // for move
pcps_acquisition_fpga_sptr pcps_make_acquisition_fpga(pcpsconf_fpga_t conf_)
pcps_acquisition_fpga_sptr pcps_make_acquisition_fpga(Acq_Conf_Fpga& conf_)
{
return pcps_acquisition_fpga_sptr(new pcps_acquisition_fpga(std::move(conf_)));
return pcps_acquisition_fpga_sptr(new pcps_acquisition_fpga(conf_));
}
pcps_acquisition_fpga::pcps_acquisition_fpga(pcpsconf_fpga_t conf_)
: d_acq_parameters(std::move(conf_)),
pcps_acquisition_fpga::pcps_acquisition_fpga(Acq_Conf_Fpga& conf_)
: d_acq_parameters(conf_),
d_gnss_synchro(nullptr),
d_sample_counter(0ULL),
d_threshold(0.0),

View File

@ -17,7 +17,7 @@
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
* This file is part of GNSS-SDR.
*
* Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2022 (see AUTHORS file for a list of contributors)
* SPDX-License-Identifier: GPL-3.0-or-later
*
* -----------------------------------------------------------------------------
@ -26,7 +26,7 @@
#ifndef GNSS_SDR_PCPS_ACQUISITION_FPGA_H
#define GNSS_SDR_PCPS_ACQUISITION_FPGA_H
#include "acq_conf_fpga.h"
#include "channel_fsm.h"
#include "fpga_acquisition.h"
#include <glog/logging.h>
@ -42,31 +42,11 @@
class Gnss_Synchro;
typedef struct
{
/* pcps acquisition configuration */
std::string device_name;
int64_t fs_in;
float doppler_step2;
uint32_t* all_fft_codes; // pointer to memory that contains all the code ffts
uint32_t doppler_max;
uint32_t select_queue_Fpga;
uint32_t downsampling_factor;
uint32_t total_block_exp;
uint32_t excludelimit;
uint32_t num_doppler_bins_step2;
uint32_t max_num_acqs;
int32_t samples_per_code;
int32_t code_length;
bool make_2_steps;
bool repeat_satellite;
} pcpsconf_fpga_t;
class pcps_acquisition_fpga;
using pcps_acquisition_fpga_sptr = std::shared_ptr<pcps_acquisition_fpga>;
pcps_acquisition_fpga_sptr pcps_make_acquisition_fpga(pcpsconf_fpga_t conf_);
pcps_acquisition_fpga_sptr pcps_make_acquisition_fpga(Acq_Conf_Fpga& conf_);
/*!
* \brief This class implements a Parallel Code Phase Search Acquisition that uses the FPGA.
@ -195,8 +175,8 @@ public:
void stop_acquisition();
private:
friend pcps_acquisition_fpga_sptr pcps_make_acquisition_fpga(pcpsconf_fpga_t conf_);
explicit pcps_acquisition_fpga(pcpsconf_fpga_t conf_);
friend pcps_acquisition_fpga_sptr pcps_make_acquisition_fpga(Acq_Conf_Fpga& conf_);
explicit pcps_acquisition_fpga(Acq_Conf_Fpga& conf_);
void send_negative_acquisition();
void send_positive_acquisition();
@ -206,7 +186,7 @@ private:
std::shared_ptr<Fpga_Acquisition> d_acquisition_fpga;
std::weak_ptr<ChannelFsm> d_channel_fsm;
pcpsconf_fpga_t d_acq_parameters;
Acq_Conf_Fpga d_acq_parameters;
Gnss_Synchro* d_gnss_synchro;

View File

@ -1,7 +1,7 @@
# GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
# This file is part of GNSS-SDR.
#
# SPDX-FileCopyrightText: 2010-2020 C. Fernandez-Prades cfernandez(at)cttc.es
# SPDX-FileCopyrightText: 2010-2022 C. Fernandez-Prades cfernandez(at)cttc.es
# SPDX-License-Identifier: BSD-3-Clause
@ -9,6 +9,8 @@ set(ACQUISITION_LIB_HEADERS acq_conf.h)
set(ACQUISITION_LIB_SOURCES acq_conf.cc)
if(ENABLE_FPGA)
set(ACQUISITION_LIB_SOURCES ${ACQUISITION_LIB_SOURCES} acq_conf_fpga.cc)
set(ACQUISITION_LIB_HEADERS ${ACQUISITION_LIB_HEADERS} acq_conf_fpga.h)
set(ACQUISITION_LIB_SOURCES ${ACQUISITION_LIB_SOURCES} fpga_acquisition.cc)
set(ACQUISITION_LIB_HEADERS ${ACQUISITION_LIB_HEADERS} fpga_acquisition.h)
endif()
@ -55,3 +57,11 @@ set_property(TARGET acquisition_libs
APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
)
if(ENABLE_FPGA)
target_link_libraries(acquisition_libs
PRIVATE
core_libs
)
endif()

View File

@ -0,0 +1,75 @@
/*!
* \file acq_conf_fpga.cc
* \brief Class that contains all the configuration parameters for generic
* acquisition block based on the PCPS algorithm running in the FPGA.
* \author Marc Majoral, 2022. 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 "acq_conf_fpga.h"
#include "item_type_helpers.h"
#include "uio_fpga.h"
#include <glog/logging.h>
#include <cmath>
#include <iostream>
void Acq_Conf_Fpga::SetFromConfiguration(const ConfigurationInterface *configuration,
const std::string &role, uint32_t downs_factor, uint32_t sel_queue_fpga, uint32_t blk_exp, double chip_rate, double code_length_chips)
{
// sampling frequency
const int64_t fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", fs_in);
fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
// max doppler
doppler_max = configuration->property(role + ".doppler_max", doppler_max);
// 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
code_length = static_cast<uint32_t>(std::round(static_cast<double>(fs_in) / (chip_rate / code_length_chips)));
// The FPGA can only use FFT lengths that are a power of two.
float nbits = ceilf(log2f(static_cast<float>(code_length) * 2.0F));
samples_per_code = pow(2, nbits);
// repeat satellite
repeat_satellite = configuration->property(role + ".repeat_satellite", false);
// FPGA buffer number
select_queue_Fpga = configuration->property(role + ".select_queue_Fpga", sel_queue_fpga);
// UIO device file
std::string device_io_name;
// find the uio device file corresponding to the acquisition
if (find_uio_dev_file_name(device_io_name, acquisition_device_name, 0) < 0)
{
std::cout << "Cannot find the FPGA uio device file corresponding to device name " << acquisition_device_name << std::endl;
throw std::exception();
}
device_name = device_io_name;
// exclusion limit
excludelimit = static_cast<unsigned int>(1 + ceil((1.0 / chip_rate) * static_cast<float>(fs_in)));
// acquisition step 2 parameters
num_doppler_bins_step2 = configuration->property(role + ".second_nbins", num_doppler_bins_step2);
doppler_step2 = configuration->property(role + ".second_doppler_step", doppler_step2);
doppler_step = configuration->property(role + ".doppler_step", doppler_step);
make_2_steps = configuration->property(role + ".make_two_steps", make_2_steps);
max_num_acqs = configuration->property(role + ".max_num_acqs", 2);
// reference for the FPGA FFT-IFFT attenuation factor
total_block_exp = configuration->property(role + ".total_block_exp", blk_exp);
}

View File

@ -0,0 +1,69 @@
/*!
* \file acq_conf_fpga.h
* \brief Class that contains all the configuration parameters for generic
* acquisition block based on the PCPS algorithm running in the FPGA.
* \author Marc Majoral, 2022. 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_ACQ_CONF_FPGA_H
#define GNSS_SDR_ACQ_CONF_FPGA_H
#include "configuration_interface.h"
#include <gnuradio/gr_complex.h>
#include <cstdint>
#include <string>
/** \addtogroup Acquisition
* \{ */
/** \addtogroup acquisition_libs acquisition_libs
* Library with utilities for GNSS signal acquisition
* \{ */
class Acq_Conf_Fpga
{
public:
Acq_Conf_Fpga() = default;
void SetFromConfiguration(const ConfigurationInterface *configuration, const std::string &role, uint32_t downs_factor, uint32_t sel_queue_fpga, uint32_t blk_exp, double chip_rate, double code_length_chips);
/* PCPS Acquisition configuration */
std::string device_name = "uio0";
uint32_t *all_fft_codes = NULL; // pointer to memory that contains all the code ffts
int64_t fs_in{4000000LL};
float doppler_step{250.0};
float doppler_step2{125.0};
uint32_t num_doppler_bins_step2{4U};
int32_t doppler_max{5000};
uint32_t select_queue_Fpga{0U};
uint32_t downsampling_factor{4U};
uint32_t total_block_exp{13U};
uint32_t excludelimit{5U};
uint32_t max_num_acqs{2U};
uint32_t samples_per_code{1U};
uint32_t code_length{16000U};
bool make_2_steps{false};
bool repeat_satellite{false};
private:
const std::string acquisition_device_name = "acquisition_S00_AXI"; // UIO device name
};
/** \} */
/** \} */
#endif // GNSS_SDR_ACQ_CONF_FPGA_H

View File

@ -31,8 +31,8 @@ target_link_libraries(channel_adapters
target_include_directories(channel_adapters
PUBLIC
${CMAKE_SOURCE_DIR}/src/core/interfaces
${CMAKE_SOURCE_DIR}/src/core/receiver
${GNSSSDR_SOURCE_DIR}/src/core/interfaces
${GNSSSDR_SOURCE_DIR}/src/core/receiver
)
if(ENABLE_CLANG_TIDY)

View File

@ -45,7 +45,7 @@ target_link_libraries(channel_libs
target_include_directories(channel_libs
PUBLIC
${CMAKE_SOURCE_DIR}/src/core/receiver
${GNSSSDR_SOURCE_DIR}/src/core/receiver
)
if(GNURADIO_USES_STD_POINTERS)

View File

@ -52,7 +52,7 @@ endif()
target_include_directories(conditioner_adapters
PUBLIC
${CMAKE_SOURCE_DIR}/src/core/interfaces
${GNSSSDR_SOURCE_DIR}/src/core/interfaces
)
if(ENABLE_CLANG_TIDY)

View File

@ -44,7 +44,7 @@ endif()
target_include_directories(data_type_adapters
PUBLIC
${CMAKE_SOURCE_DIR}/src/core/interfaces
${GNSSSDR_SOURCE_DIR}/src/core/interfaces
)
target_link_libraries(data_type_adapters

View File

@ -46,7 +46,7 @@ target_link_libraries(data_type_gr_blocks
target_include_directories(data_type_gr_blocks
PUBLIC
${CMAKE_SOURCE_DIR}/src/core/interfaces
${GNSSSDR_SOURCE_DIR}/src/core/interfaces
)
if(GNURADIO_USES_STD_POINTERS)

View File

@ -65,7 +65,7 @@ endif()
target_include_directories(input_filter_gr_blocks
PUBLIC
${CMAKE_SOURCE_DIR}/src/core/interfaces
${GNSSSDR_SOURCE_DIR}/src/core/interfaces
)
if(GNURADIO_USES_STD_POINTERS)

View File

@ -94,7 +94,7 @@ endif()
if(NOT has_span)
target_include_directories(algorithms_libs
PUBLIC
${CMAKE_SOURCE_DIR}/src/algorithms/libs/gsl/include
${GNSSSDR_SOURCE_DIR}/src/algorithms/libs/gsl/include
)
endif()
@ -164,7 +164,7 @@ endif()
target_include_directories(algorithms_libs
PUBLIC
${CMAKE_SOURCE_DIR}/src/core/interfaces
${GNSSSDR_SOURCE_DIR}/src/core/interfaces
)
target_compile_definitions(algorithms_libs
@ -221,7 +221,7 @@ target_link_libraries(gnss_sdr_flags
Gflags::gflags
)
if(${GFLAGS_GREATER_20})
if(GFLAGS_GREATER_20 OR ${LOCAL_GFLAGS})
target_compile_definitions(gnss_sdr_flags PRIVATE -DGFLAGS_GREATER_2_0=1)
endif()

View File

@ -26,11 +26,9 @@ const auto AUX_CEIL = [](float x) { return static_cast<int32_t>(static_cast<int6
void beidou_b1i_code_gen_int(own::span<int32_t> dest, int32_t prn, uint32_t chip_shift)
{
constexpr uint32_t code_length = 2046;
const std::array<int32_t, 33> delays = {712 /*PRN1*/, 1581, 1414, 1550, 581, 771, 1311, 1043, 1549, 359, 710, 1579, 1548, 1103, 579, 769, 358, 709, 1411, 1547,
1102, 578, 357, 1577, 1410, 1546, 1101, 707, 1576, 1409, 1545, 354 /*PRN32*/,
705};
const std::array<int32_t, 37> phase1 = {1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 8, 8, 8, 9, 9, 10};
const std::array<int32_t, 37> phase2 = {3, 4, 5, 6, 8, 9, 10, 11, 7, 4, 5, 6, 8, 9, 10, 11, 5, 6, 8, 9, 10, 11, 6, 8, 9, 10, 11, 8, 9, 10, 11, 9, 10, 11, 10, 11, 11};
const std::array<int32_t, 63> phase1 = {1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 8, 8, 8, 9, 9, 10, 2, 3, 3, 3, 3, 3, 4, 4, 5, 5, 5, 5, 6, 8, 9, 9, 3, 5, 7, 4, 4, 5, 5, 5, 5, 6};
const std::array<int32_t, 63> phase2 = {3, 4, 5, 6, 8, 9, 10, 11, 7, 4, 5, 6, 8, 9, 10, 11, 5, 6, 8, 9, 10, 11, 6, 8, 9, 10, 11, 8, 9, 10, 11, 9, 10, 11, 10, 11, 11, 7, 4, 6, 8, 10, 11, 5, 9, 6, 8, 10, 11, 9, 9, 10, 11, 7, 7, 9, 5, 9, 6, 8, 10, 11, 9};
const std::array<int32_t, 63> phase3 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3};
std::bitset<code_length> G1{};
std::bitset<code_length> G2{};
@ -50,7 +48,7 @@ void beidou_b1i_code_gen_int(own::span<int32_t> dest, int32_t prn, uint32_t chip
prn_idx = prn - 1;
// A simple error check
if ((prn_idx < 0) || (prn_idx > 32))
if ((prn_idx < 0) || (prn_idx > 62))
{
return;
}
@ -59,7 +57,7 @@ void beidou_b1i_code_gen_int(own::span<int32_t> dest, int32_t prn, uint32_t chip
for (lcv = 0; lcv < code_length; lcv++)
{
G1[lcv] = G1_register[0];
G2[lcv] = G2_register[-(phase1[prn_idx] - 11)] xor G2_register[-(phase2[prn_idx] - 11)];
G2[lcv] = G2_register[-(phase1[prn_idx] - 11)] xor G2_register[-(phase2[prn_idx] - 11)] xor (phase3[prn_idx] ? G2_register[-(phase3[prn_idx] - 11)] : 0);
feedback1 = G1_register[0] xor G1_register[1] xor G1_register[2] xor G1_register[3] xor G1_register[4] xor G1_register[10];
feedback2 = G2_register[0] xor G2_register[2] xor G2_register[3] xor G2_register[6] xor G2_register[7] xor G2_register[8] xor G2_register[9] xor G2_register[10];
@ -75,7 +73,7 @@ void beidou_b1i_code_gen_int(own::span<int32_t> dest, int32_t prn, uint32_t chip
}
// Set the delay
delay = code_length - delays[prn_idx] * 0; // *********************************
delay = code_length; // *********************************
delay += chip_shift;
delay %= code_length;

View File

@ -202,7 +202,7 @@ const int NSYSQZS = 0;
#define ENABDS
#ifdef ENABDS
const int MINPRNBDS = 1; //!< min satellite sat number of BeiDou
const int MAXPRNBDS = 37; //!< max satellite sat number of BeiDou
const int MAXPRNBDS = 63; //!< max satellite sat number of BeiDou
const int NSATBDS = (MAXPRNBDS - MINPRNBDS + 1); //!< number of BeiDou satellites
const int NSYSBDS = 1;
#else

View File

@ -34,6 +34,7 @@
#include "rtklib_preceph.h"
#include "rtklib_rtkcmn.h"
#include "rtklib_sbas.h"
#include <vector>
/* constants -----------------------------------------------------------------*/
@ -284,7 +285,7 @@ void eph2pos(gtime_t time, const eph_t *eph, double *rs, double *dts,
cosi = cos(i);
/* beidou geo satellite (ref [9]) */
if (sys == SYS_BDS && prn <= 5)
if (sys == SYS_BDS && (prn <= 5 || prn > 58))
{
O = eph->OMG0 + eph->OMGd * tk - omge * eph->toes;
sinO = sin(O);
@ -1023,7 +1024,7 @@ int satpos(gtime_t time, gtime_t teph, int sat, int ephopt,
void satposs(gtime_t teph, const obsd_t *obs, int n, const nav_t *nav,
int ephopt, double *rs, double *dts, double *var, int *svh)
{
gtime_t time[MAXOBS] = {};
std::vector<gtime_t> time(MAXOBS);
double dt;
double pr;
int i;

View File

@ -39,6 +39,7 @@
#include "rtklib_ionex.h"
#include "rtklib_rtkcmn.h"
#include <cstring>
#include <vector>
/* get index -----------------------------------------------------------------*/
int getindex(double value, const double *range)
@ -425,8 +426,8 @@ void readtec(const char *file, nav_t *nav, int opt)
double hgts[3] = {0};
double rb = 0.0;
double nexp = -1.0;
double dcb[MAXSAT] = {0};
double rms[MAXSAT] = {0};
std::vector<double> dcb(MAXSAT, 0);
std::vector<double> rms(MAXSAT, 0);
int i;
int n;
char *efiles[MAXEXFILE];
@ -463,7 +464,7 @@ void readtec(const char *file, nav_t *nav, int opt)
}
/* read ionex header */
if (readionexh(fp, lats, lons, hgts, &rb, &nexp, dcb, rms) <= 0.0)
if (readionexh(fp, lats, lons, hgts, &rb, &nexp, dcb.data(), rms.data()) <= 0.0)
{
trace(2, "ionex file format error %s\n", efiles[i]);
fclose(fp);

View File

@ -34,6 +34,7 @@
#include "rtklib_ionex.h"
#include "rtklib_sbas.h"
#include <cstring>
#include <vector>
/* pseudorange measurement error variance ------------------------------------*/
double varerr(const prcopt_t *opt, double el, int sys)
@ -988,8 +989,8 @@ int pntpos(const obsd_t *obs, int n, const nav_t *nav,
double *resp;
int i;
int stat;
int vsat[MAXOBS] = {0};
int svh[MAXOBS];
std::vector<int> vsat(MAXOBS, 0);
std::vector<int> svh(MAXOBS, 0);
sol->stat = SOLQ_NONE;
@ -1019,20 +1020,20 @@ int pntpos(const obsd_t *obs, int n, const nav_t *nav,
opt_.tropopt = TROPOPT_SAAS;
}
/* satellite positions, velocities and clocks */
satposs(sol->time, obs, n, nav, opt_.sateph, rs, dts, var, svh);
satposs(sol->time, obs, n, nav, opt_.sateph, rs, dts, var, svh.data());
/* estimate receiver position with pseudorange */
stat = estpos(obs, n, rs, dts, var, svh, nav, &opt_, sol, azel_, vsat, resp, msg);
stat = estpos(obs, n, rs, dts, var, svh.data(), nav, &opt_, sol, azel_, vsat.data(), resp, msg);
/* raim fde */
if (!stat && n >= 6 && opt->posopt[4])
{
stat = raim_fde(obs, n, rs, dts, var, svh, nav, &opt_, sol, azel_, vsat, resp, msg);
stat = raim_fde(obs, n, rs, dts, var, svh.data(), nav, &opt_, sol, azel_, vsat.data(), resp, msg);
}
/* estimate receiver velocity with doppler */
if (stat)
{
estvel(obs, n, rs, dts, nav, &opt_, sol, azel_, vsat);
estvel(obs, n, rs, dts, nav, &opt_, sol, azel_, vsat.data());
}
if (azel)

View File

@ -38,6 +38,7 @@
#include "rtklib_sbas.h"
#include "rtklib_tides.h"
#include <cstring>
#include <vector>
/* wave length of LC (m) -----------------------------------------------------*/
double lam_LC(int i, int j, int k)
@ -351,7 +352,7 @@ int sel_amb(int *sat1, int *sat2, double *N, double *var, int n)
{
int i;
int j;
int flgs[MAXSAT] = {0};
std::vector<int> flgs(MAXSAT, 0);
int max_flg = 0;
/* sort by variance */
@ -372,7 +373,7 @@ int sel_amb(int *sat1, int *sat2, double *N, double *var, int n)
/* select linearly independent satellite pair */
for (i = j = 0; i < n; i++)
{
if (!is_depend(sat1[i], sat2[i], flgs, &max_flg))
if (!is_depend(sat1[i], sat2[i], flgs.data(), &max_flg))
{
continue;
}
@ -546,7 +547,7 @@ int fix_amb_ILS(rtk_t *rtk, int *sat1, int *sat2, int *NW, int n)
int m = 0;
int info;
int stat;
int flgs[MAXSAT] = {0};
std::vector<int> flgs(MAXSAT, 0);
int max_flg = 0;
lam1 = LAM_CARR[0];
@ -565,7 +566,7 @@ int fix_amb_ILS(rtk_t *rtk, int *sat1, int *sat2, int *NW, int n)
for (i = 0; i < n; i++)
{
/* check linear independency */
if (!is_depend(sat1[i], sat2[i], flgs, &max_flg))
if (!is_depend(sat1[i], sat2[i], flgs.data(), &max_flg))
{
continue;
}
@ -1362,7 +1363,7 @@ void udbias_ppp(rtk_t *rtk, const obsd_t *obs, int n, const nav_t *nav)
{
double meas[2];
double var[2];
double bias[MAXOBS] = {0};
std::vector<double> bias(MAXOBS, 0.0);
double offset = 0.0;
double pos[3] = {0};
int i;
@ -1562,7 +1563,7 @@ int res_ppp(int iter __attribute__((unused)), const obsd_t *obs, int n, const do
double dtdx[3];
double dantr[NFREQ] = {0};
double dants[NFREQ] = {0};
double var[MAXOBS * 2];
std::vector<double> var(MAXOBS * 2, 0.0);
double dtrp = 0.0;
double vart = 0.0;
double varm[2] = {0};
@ -1781,7 +1782,7 @@ void pppos(rtk_t *rtk, const obsd_t *obs, int n, const nav_t *nav)
int i;
int nv;
int info;
int svh[MAXOBS];
std::vector<int> svh(MAXOBS);
int stat = SOLQ_SINGLE;
trace(3, "pppos : nx=%d n=%d\n", rtk->nx, n);
@ -1803,7 +1804,7 @@ void pppos(rtk_t *rtk, const obsd_t *obs, int n, const nav_t *nav)
tracemat(4, rtk->x, 1, NR_PPP(opt), 13, 4);
/* satellite positions and clocks */
satposs(obs[0].time, obs, n, nav, rtk->opt.sateph, rs, dts, var, svh);
satposs(obs[0].time, obs, n, nav, rtk->opt.sateph, rs, dts, var, svh.data());
/* exclude measurements of eclipsing satellite */
if (rtk->opt.posopt[3])
@ -1821,7 +1822,7 @@ void pppos(rtk_t *rtk, const obsd_t *obs, int n, const nav_t *nav)
for (i = 0; i < rtk->opt.niter; i++)
{
/* phase and code residuals */
if ((nv = res_ppp(i, obs, n, rs, dts, var, svh, nav, xp, rtk, v, H, R, azel)) <= 0)
if ((nv = res_ppp(i, obs, n, rs, dts, var, svh.data(), nav, xp, rtk, v, H, R, azel)) <= 0)
{
break;
}
@ -1842,7 +1843,7 @@ void pppos(rtk_t *rtk, const obsd_t *obs, int n, const nav_t *nav)
if (stat == SOLQ_PPP)
{
/* postfit residuals */
res_ppp(1, obs, n, rs, dts, var, svh, nav, xp, rtk, v, H, R, azel);
res_ppp(1, obs, n, rs, dts, var, svh.data(), nav, xp, rtk, v, H, R, azel);
/* update state and covariance matrix */
matcpy(rtk->x, xp, rtk->nx, 1);

View File

@ -43,6 +43,7 @@
#include "rtklib_preceph.h"
#include "rtklib_rtkcmn.h"
#include <cstring>
#include <vector>
/* satellite code to satellite system ----------------------------------------*/
int code2sys(char code)
@ -390,7 +391,7 @@ void readsp3(const char *file, nav_t *nav, int opt)
int j;
int n;
int ns;
int sats[MAXSAT] = {};
std::vector<int> sats(MAXSAT);
char *efiles[MAXEXFILE];
char *ext;
char type = ' ';
@ -431,10 +432,10 @@ void readsp3(const char *file, nav_t *nav, int opt)
continue;
}
/* read sp3 header */
ns = readsp3h(fp, &time, &type, sats, bfact, tsys);
ns = readsp3h(fp, &time, &type, sats.data(), bfact, tsys);
/* read sp3 body */
readsp3b(fp, type, sats, ns, bfact, tsys, j++, opt, nav);
readsp3b(fp, type, sats.data(), ns, bfact, tsys, j++, opt, nav);
fclose(fp);
}

View File

@ -31,6 +31,7 @@
#include "rtklib_rtkcmn.h"
#include <glog/logging.h>
#include <array>
#include <cassert>
#include <cstring>
#include <dirent.h>
@ -40,6 +41,7 @@
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
#include <vector>
const double GPST0[] = {1980, 1, 6, 0, 0, 0}; /* gps time reference */
@ -4496,7 +4498,7 @@ double satazel(const double *pos, const double *e, double *azel)
*-----------------------------------------------------------------------------*/
void dops(int ns, const double *azel, double elmin, double *dop)
{
double H[4 * MAXSAT];
std::vector<double> H(4 * MAXSAT);
double Q[16];
double cosel;
double sinel;
@ -4525,7 +4527,7 @@ void dops(int ns, const double *azel, double elmin, double *dop)
return;
}
matmul("NT", 4, 4, n, 1.0, H, H, 0.0, Q);
matmul("NT", 4, 4, n, 1.0, H.data(), H.data(), 0.0, Q);
if (!matinv(Q, 4))
{
dop[0] = std::sqrt(Q[0] + Q[5] + Q[10] + Q[15]); /* GDOP */
@ -5029,16 +5031,23 @@ void sunmoonpos(gtime_t tutc, const double *erpv, double *rsun,
*-----------------------------------------------------------------------------*/
void csmooth(obs_t *obs, int ns)
{
double Ps[2][MAXSAT][NFREQ] = {};
double Lp[2][MAXSAT][NFREQ] = {};
std::vector<std::array<double, NFREQ>> Ps[2];
std::vector<std::array<double, NFREQ>> Lp[2];
double dcp;
int i;
int j;
int s;
int r;
int n[2][MAXSAT][NFREQ] = {};
std::vector<std::array<int, NFREQ>> n[2];
obsd_t *p;
Ps[0].resize(MAXSAT);
Ps[1].resize(MAXSAT);
Lp[0].resize(MAXSAT);
Lp[1].resize(MAXSAT);
n[0].resize(MAXSAT);
n[1].resize(MAXSAT);
trace(3, "csmooth: nobs=%d,ns=%d\n", obs->n, ns);
for (i = 0; i < obs->n; i++)

View File

@ -37,6 +37,7 @@
#include "rtklib_tides.h"
#include <cmath>
#include <cstring>
#include <vector>
static int resamb_WLNL(rtk_t *rtk __attribute((unused)), const obsd_t *obs __attribute((unused)), const int *sat __attribute((unused)),
const int *iu __attribute((unused)), const int *ir __attribute((unused)), int ns __attribute__((unused)), const nav_t *nav __attribute((unused)),
@ -2029,7 +2030,7 @@ void restamb(rtk_t *rtk, const double *bias, int nb __attribute((unused)), doubl
int n;
int m;
int f;
int index[MAXSAT];
std::vector<int> index(MAXSAT);
int nv = 0;
int nf = NF_RTK(&rtk->opt);
@ -2083,7 +2084,7 @@ void holdamb(rtk_t *rtk, const double *xa)
int m;
int f;
int info;
int index[MAXSAT];
std::vector<int> index(MAXSAT);
int nb = rtk->nx - rtk->na;
int nv = 0;
int nf = NF_RTK(&rtk->opt);
@ -2371,13 +2372,13 @@ int relpos(rtk_t *rtk, const obsd_t *obs, int nu, int nr,
int ns;
int ny;
int nv;
int sat[MAXSAT];
int iu[MAXSAT];
int ir[MAXSAT];
std::vector<int> sat(MAXSAT);
std::vector<int> iu(MAXSAT);
std::vector<int> ir(MAXSAT);
int niter;
int info;
int vflg[MAXOBS * NFREQ * 2 + 1];
int svh[MAXOBS * 2];
std::vector<int> vflg(MAXOBS * NFREQ * 2 + 1);
std::vector<int> svh(MAXOBS * 2);
int stat = rtk->opt.mode <= PMODE_DGPS ? SOLQ_DGPS : SOLQ_FLOAT;
int nf = opt->ionoopt == IONOOPT_IFLC ? 1 : opt->nf;
@ -2401,10 +2402,10 @@ int relpos(rtk_t *rtk, const obsd_t *obs, int nu, int nr,
}
}
/* satellite positions/clocks */
satposs(time, obs, n, nav, opt->sateph, rs, dts, var, svh);
satposs(time, obs, n, nav, opt->sateph, rs, dts, var, svh.data());
/* undifferenced residuals for base station */
if (!zdres(1, obs + nu, nr, rs + nu * 6, dts + nu * 2, svh + nu, nav, rtk->rb, opt, 1,
if (!zdres(1, obs + nu, nr, rs + nu * 6, dts + nu * 2, &svh[nu], nav, rtk->rb, opt, 1,
y + nu * nf * 2, e + nu * 3, azel + nu * 2))
{
errmsg(rtk, "initial base station position error\n");
@ -2423,7 +2424,7 @@ int relpos(rtk_t *rtk, const obsd_t *obs, int nu, int nr,
dt = intpres(time, obs + nu, nr, nav, rtk, y + nu * nf * 2);
}
/* select common satellites between rover and base-station */
if ((ns = selsat(obs, azel, nu, nr, opt, sat, iu, ir)) <= 0)
if ((ns = selsat(obs, azel, nu, nr, opt, sat.data(), iu.data(), ir.data())) <= 0)
{
errmsg(rtk, "no common satellite\n");
@ -2436,7 +2437,7 @@ int relpos(rtk_t *rtk, const obsd_t *obs, int nu, int nr,
return 0;
}
/* temporal update of states */
udstate(rtk, obs, sat, iu, ir, ns, nav);
udstate(rtk, obs, sat.data(), iu.data(), ir.data(), ns, nav);
trace(4, "x(0)=");
tracemat(4, rtk->x, 1, NR_RTK(opt), 13, 4);
@ -2458,14 +2459,14 @@ int relpos(rtk_t *rtk, const obsd_t *obs, int nu, int nr,
for (i = 0; i < niter; i++)
{
/* undifferenced residuals for rover */
if (!zdres(0, obs, nu, rs, dts, svh, nav, xp, opt, 0, y, e, azel))
if (!zdres(0, obs, nu, rs, dts, svh.data(), nav, xp, opt, 0, y, e, azel))
{
errmsg(rtk, "rover initial position error\n");
stat = SOLQ_NONE;
break;
}
/* double-differenced residuals and partial derivatives */
if ((nv = ddres(rtk, nav, dt, xp, Pp, sat, y, e, azel, iu, ir, ns, v, H, R, vflg)) < 1)
if ((nv = ddres(rtk, nav, dt, xp, Pp, sat.data(), y, e, azel, iu.data(), ir.data(), ns, v, H, R, vflg.data())) < 1)
{
errmsg(rtk, "no double-differenced residual\n");
stat = SOLQ_NONE;
@ -2482,13 +2483,13 @@ int relpos(rtk_t *rtk, const obsd_t *obs, int nu, int nr,
trace(4, "x(%d)=", i + 1);
tracemat(4, xp, 1, NR_RTK(opt), 13, 4);
}
if (stat != SOLQ_NONE && zdres(0, obs, nu, rs, dts, svh, nav, xp, opt, 0, y, e, azel))
if (stat != SOLQ_NONE && zdres(0, obs, nu, rs, dts, svh.data(), nav, xp, opt, 0, y, e, azel))
{
/* post-fit residuals for float solution */
nv = ddres(rtk, nav, dt, xp, Pp, sat, y, e, azel, iu, ir, ns, v, nullptr, R, vflg);
nv = ddres(rtk, nav, dt, xp, Pp, sat.data(), y, e, azel, iu.data(), ir.data(), ns, v, nullptr, R, vflg.data());
/* validation of float solution */
if (valpos(rtk, v, R, vflg, nv, 4.0))
if (valpos(rtk, v, R, vflg.data(), nv, 4.0))
{
/* update state and covariance matrix */
matcpy(rtk->x, xp, rtk->nx, 1);
@ -2526,7 +2527,7 @@ int relpos(rtk_t *rtk, const obsd_t *obs, int nu, int nr,
/* resolve integer ambiguity by WL-NL */
if (stat != SOLQ_NONE && rtk->opt.modear == ARMODE_WLNL)
{
if (resamb_WLNL(rtk, obs, sat, iu, ir, ns, nav, azel))
if (resamb_WLNL(rtk, obs, sat.data(), iu.data(), ir.data(), ns, nav, azel))
{
stat = SOLQ_FIX;
}
@ -2534,7 +2535,7 @@ int relpos(rtk_t *rtk, const obsd_t *obs, int nu, int nr,
/* resolve integer ambiguity by TCAR */
else if (stat != SOLQ_NONE && rtk->opt.modear == ARMODE_TCAR)
{
if (resamb_TCAR(rtk, obs, sat, iu, ir, ns, nav, azel))
if (resamb_TCAR(rtk, obs, sat.data(), iu.data(), ir.data(), ns, nav, azel))
{
stat = SOLQ_FIX;
}
@ -2542,13 +2543,13 @@ int relpos(rtk_t *rtk, const obsd_t *obs, int nu, int nr,
/* resolve integer ambiguity by LAMBDA */
else if (stat != SOLQ_NONE && resamb_LAMBDA(rtk, bias, xa) > 1)
{
if (zdres(0, obs, nu, rs, dts, svh, nav, xa, opt, 0, y, e, azel))
if (zdres(0, obs, nu, rs, dts, svh.data(), nav, xa, opt, 0, y, e, azel))
{
/* post-fit reisiduals for fixed solution */
nv = ddres(rtk, nav, dt, xa, nullptr, sat, y, e, azel, iu, ir, ns, v, nullptr, R, vflg);
nv = ddres(rtk, nav, dt, xa, nullptr, sat.data(), y, e, azel, iu.data(), ir.data(), ns, v, nullptr, R, vflg.data());
/* validation of fixed solution */
if (valpos(rtk, v, R, vflg, nv, 4.0))
if (valpos(rtk, v, R, vflg.data(), nv, 4.0))
{
/* hold integer ambiguity */
if (++rtk->nfix >= rtk->opt.minfix &&

View File

@ -211,7 +211,7 @@ int decode_sbstype6(const sbsmsg_t *msg, sbssat_t *sbssat)
}
for (i = 0; i < sbssat->nsat && i < MAXSAT; i++)
{
if (sbssat->sat[i].fcorr.iodf != iodf[i / 39])
if (sbssat->sat[i].fcorr.iodf != iodf[i / 46])
{
continue;
}

View File

@ -37,6 +37,7 @@
#include <cctype>
#include <cmath>
#include <cstring>
#include <vector>
/* constants and macros ------------------------------------------------------*/
@ -1654,7 +1655,7 @@ int outnmea_gsa(unsigned char *buff, const sol_t *sol,
int sat;
int sys;
int nsat;
int prn[MAXSAT];
std::vector<int> prn(MAXSAT);
char *p = reinterpret_cast<char *>(buff);
char *q;
char *s;
@ -1683,7 +1684,7 @@ int outnmea_gsa(unsigned char *buff, const sol_t *sol,
{
continue;
}
sys = satsys(sat, prn + nsat);
sys = satsys(sat, &prn[nsat]);
if (sys != SYS_GPS && sys != SYS_SBS)
{
continue;
@ -1728,7 +1729,7 @@ int outnmea_gsa(unsigned char *buff, const sol_t *sol,
{
continue;
}
if (satsys(sat, prn + nsat) != SYS_GLO)
if (satsys(sat, &prn[nsat]) != SYS_GLO)
{
continue;
}
@ -1769,7 +1770,7 @@ int outnmea_gsa(unsigned char *buff, const sol_t *sol,
{
continue;
}
if (satsys(sat, prn + nsat) != SYS_GAL)
if (satsys(sat, &prn[nsat]) != SYS_GAL)
{
continue;
}
@ -1809,7 +1810,7 @@ int outnmea_gsa(unsigned char *buff, const sol_t *sol,
{
continue;
}
if (satsys(sat, prn + nsat) != SYS_BDS)
if (satsys(sat, &prn[nsat]) != SYS_BDS)
{
continue;
}
@ -1861,7 +1862,7 @@ int outnmea_gsv(unsigned char *buff, const sol_t *sol,
int prn;
int sys;
int nmsg;
int sats[MAXSAT];
std::vector<int> sats(MAXSAT);
char *p = reinterpret_cast<char *>(buff);
char *q;
char *s;

View File

@ -491,8 +491,8 @@ endif()
########################################################################
configure_file(
${CMAKE_SOURCE_DIR}/cmake/Modules/VolkGnsssdrConfig.cmake.in
${CMAKE_BINARY_DIR}/cmake/Modules/VolkGnsssdrConfig.cmake
${PROJECT_SOURCE_DIR}/cmake/Modules/VolkGnsssdrConfig.cmake.in
${PROJECT_BINARY_DIR}/cmake/Modules/VolkGnsssdrConfig.cmake
@ONLY
)

View File

@ -82,6 +82,7 @@ macro(add_cpu_features_headers_and_sources HDRS_LIST_NAME SRCS_LIST_NAME)
elseif(PROCESSOR_IS_X86)
list(APPEND ${HDRS_LIST_NAME} ${PROJECT_SOURCE_DIR}/include/cpuinfo_x86.h)
list(APPEND ${SRCS_LIST_NAME} ${PROJECT_SOURCE_DIR}/include/internal/cpuid_x86.h)
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)
else()

View File

@ -209,25 +209,41 @@ Please check the [CMake build instructions](cmake/README.md).
- Run `list_cpu_features`
```sh
cmake -S. -Bbuild -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=Release
cmake --build build --config Release -j
./build/list_cpu_features --json
```
```sh
cmake -S. -Bbuild -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=Release
cmake --build build --config Release -j
./build/list_cpu_features --json
```
_Note_: Use `--target ALL_BUILD` on the second line for `Visual Studio` and
`XCode`.
_Note_: Use `--target ALL_BUILD` on the second line for `Visual Studio` and
`XCode`.
- run tests
```sh
cmake -S. -Bbuild -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Debug
cmake --build build --config Debug -j
cmake --build build --config Debug --target test
```
```sh
cmake -S. -Bbuild -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Debug
cmake --build build --config Debug -j
cmake --build build --config Debug --target test
```
_Note_: Use `--target RUN_TESTS` on the last line for `Visual Studio` and
`--target RUN_TEST` for `XCode`.
_Note_: Use `--target RUN_TESTS` on the last line for `Visual Studio` and
`--target RUN_TEST` for `XCode`.
- install `cpu_features`
```sh
cmake --build build --config Release --target install -v
```
_Note_: Use `--target INSTALL` for `Visual Studio`.
_Note_: When using `Makefile` or `XCode` generator, you can use
[`DESTDIR`](https://www.gnu.org/software/make/manual/html_node/DESTDIR.html)
to install on a local repository.<br> e.g.
```sh
cmake --build build --config Release --target install -v -- DESTDIR=install
```
<a name="bindings"></a>

View File

@ -52,6 +52,22 @@
#define CPU_FEATURES_ARCH_PPC
#endif
#if defined(__riscv)
#define CPU_FEATURES_ARCH_RISCV
#endif
#if defined(__riscv) && defined(__riscv_xlen) && __riscv_xlen == 32
#define CPU_FEATURES_ARCH_RISCV32
#endif
#if defined(__riscv) && defined(__riscv_xlen) && __riscv_xlen == 64
#define CPU_FEATURES_ARCH_RISCV64
#endif
#if defined(__riscv) && defined(__riscv_xlen) && __riscv_xlen == 128
#define CPU_FEATURES_ARCH_RISCV128
#endif
////////////////////////////////////////////////////////////////////////////////
// Os
////////////////////////////////////////////////////////////////////////////////
@ -215,8 +231,121 @@
#else
#define CPU_FEATURES_COMPILED_MIPS_MSA 0
#endif // defined(__mips_msa)
#if defined(__mips3d)
#define CPU_FEATURES_COMPILED_MIPS_MIPS3D 1
#else
#define CPU_FEATURES_COMPILED_MIPS_MIPS3D 0
#endif
#endif // defined(CPU_FEATURES_ARCH_MIPS)
#if defined(CPU_FEATURES_ARCH_RISCV)
#if defined(__riscv_e)
#define CPU_FEATURES_COMPILED_RISCV_E 1
#else
#define CPU_FEATURES_COMPILED_RISCV_E 0
#endif
#if defined(__riscv_i)
#define CPU_FEATURES_COMPILED_RISCV_I 1
#else
#define CPU_FEATURES_COMPILED_RISCV_I 0
#endif
#if defined(__riscv_m)
#define CPU_FEATURES_COMPILED_RISCV_M 1
#else
#define CPU_FEATURES_COMPILED_RISCV_M 0
#endif
#if defined(__riscv_a)
#define CPU_FEATURES_COMPILED_RISCV_A 1
#else
#define CPU_FEATURES_COMPILED_RISCV_A 0
#endif
#if defined(__riscv_f)
#define CPU_FEATURES_COMPILED_RISCV_F 1
#else
#define CPU_FEATURES_COMPILED_RISCV_F 0
#endif
#if defined(__riscv_d)
#define CPU_FEATURES_COMPILED_RISCV_D 1
#else
#define CPU_FEATURES_COMPILED_RISCV_D 0
#endif
#if defined(__riscv_q)
#define CPU_FEATURES_COMPILED_RISCV_Q 1
#else
#define CPU_FEATURES_COMPILED_RISCV_Q 0
#endif
#if defined(__riscv_c)
#define CPU_FEATURES_COMPILED_RISCV_C 1
#else
#define CPU_FEATURES_COMPILED_RISCV_C 0
#endif
#if defined(__riscv_v)
#define CPU_FEATURES_COMPILED_RISCV_V 1
#else
#define CPU_FEATURES_COMPILED_RISCV_V 0
#endif
#if defined(__riscv_zba)
#define CPU_FEATURES_COMPILED_RISCV_ZBA 1
#else
#define CPU_FEATURES_COMPILED_RISCV_ZBA 0
#endif
#if defined(__riscv_zbb)
#define CPU_FEATURES_COMPILED_RISCV_ZBB 1
#else
#define CPU_FEATURES_COMPILED_RISCV_ZBB 0
#endif
#if defined(__riscv_zbc)
#define CPU_FEATURES_COMPILED_RISCV_ZBC 1
#else
#define CPU_FEATURES_COMPILED_RISCV_ZBC 0
#endif
#if defined(__riscv_zbs)
#define CPU_FEATURES_COMPILED_RISCV_ZBS 1
#else
#define CPU_FEATURES_COMPILED_RISCV_ZBS 0
#endif
#if defined(__riscv_zfh)
#define CPU_FEATURES_COMPILED_RISCV_ZFH 1
#else
#define CPU_FEATURES_COMPILED_RISCV_ZFH 0
#endif
#if defined(__riscv_zfhmin)
#define CPU_FEATURES_COMPILED_RISCV_ZFHMIN 1
#else
#define CPU_FEATURES_COMPILED_RISCV_ZFHMIN 0
#endif
#if defined(__riscv_zknd)
#define CPU_FEATURES_COMPILED_RISCV_ZKND 1
#else
#define CPU_FEATURES_COMPILED_RISCV_ZKND 0
#endif
#if defined(__riscv_zkne)
#define CPU_FEATURES_COMPILED_RISCV_ZKNE 1
#else
#define CPU_FEATURES_COMPILED_RISCV_ZKNE 0
#endif
#if defined(__riscv_zknh)
#define CPU_FEATURES_COMPILED_RISCV_ZKNH 1
#else
#define CPU_FEATURES_COMPILED_RISCV_ZKNH 0
#endif
#if defined(__riscv_zksed)
#define CPU_FEATURES_COMPILED_RISCV_ZKSED 1
#else
#define CPU_FEATURES_COMPILED_RISCV_ZKSED 0
#endif
#if defined(__riscv_zksh)
#define CPU_FEATURES_COMPILED_RISCV_ZKSH 1
#else
#define CPU_FEATURES_COMPILED_RISCV_ZKSH 0
#endif
#if defined(__riscv_zkr)
#define CPU_FEATURES_COMPILED_RISCV_ZKR 1
#else
#define CPU_FEATURES_COMPILED_RISCV_ZKR 0
#endif
#endif // defined(CPU_FEATURES_ARCH_RISCV)
////////////////////////////////////////////////////////////////////////////////
// Utils
////////////////////////////////////////////////////////////////////////////////
@ -233,6 +362,8 @@
// Communicates to the compiler that the function is now deprecated
#if defined(CPU_FEATURES_COMPILER_CLANG) || defined(CPU_FEATURES_COMPILER_GCC)
#define CPU_FEATURES_DEPRECATED(message) __attribute__((deprecated(message)))
#elif defined(CPU_FEATURES_COMPILER_MSC)
#define CPU_FEATURES_DEPRECATED(message) __declspec(deprecated(message))
#else
#define CPU_FEATURES_DEPRECATED(message)
#endif

View File

@ -62,6 +62,9 @@ typedef struct
int rng : 1; // True random number generator support.
int bti : 1; // Branch target identification.
int mte : 1; // Memory tagging extension.
int ecv : 1; // Enhanced counter virtualization.
int afp : 1; // Alternate floating-point behaviour.
int rpres : 1; // 12-bit reciprocal (square root) estimate precision.
// Make sure to update Aarch64FeaturesEnum below if you add a field here.
} Aarch64Features;
@ -133,6 +136,9 @@ typedef enum
AARCH64_RNG,
AARCH64_BTI,
AARCH64_MTE,
AARCH64_ECV,
AARCH64_AFP,
AARCH64_RPRES,
AARCH64_LAST_,
} Aarch64FeaturesEnum;

View File

@ -16,6 +16,15 @@ typedef struct
int eva : 1; // Enhanced Virtual Addressing
// https://www.mips.com/products/architectures/mips64/
int r6 : 1; // True if is release 6 of the processor.
int mips16 : 1; // Compressed instructions
int mdmx : 1; // MIPS Digital Media Extension
int mips3d : 1; // 3D graphics acceleration
// MIPS(r) Architecture for Programmers, Volume IV-c
int smart : 1; // Smart-card cryptography
// MIPS(r) Architecture for Programmers, Volume IV-d
int dsp : 1; // Digital Signal Processing
// MIPS(r) Architecture for Programmers, Volume IV-e
// https://www.mips.com/products/architectures/ase/dsp/
// Make sure to update MipsFeaturesEnum below if you add a field here.
} MipsFeatures;
@ -35,6 +44,11 @@ typedef enum
MIPS_MSA,
MIPS_EVA,
MIPS_R6,
MIPS_MIPS16,
MIPS_MDMX,
MIPS_MIPS3D,
MIPS_SMART,
MIPS_DSP,
MIPS_LAST_,
} MipsFeaturesEnum;

View File

@ -65,7 +65,7 @@ typedef struct
int avx512bitalg : 1;
int avx512vpopcntdq : 1;
int avx512_4vnniw : 1;
int avx512_4vbmi2 : 1;
int avx512_4vbmi2 : 1; // Note: this is an alias to avx512_4fmaps.
int avx512_second_fma : 1;
int avx512_4fmaps : 1;
int avx512_bf16 : 1;
@ -132,6 +132,7 @@ typedef enum
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
@ -158,6 +159,7 @@ typedef enum
AMD_ZEN_PLUS, // K17 ZEN+
AMD_ZEN2, // K17 ZEN 2
AMD_ZEN3, // K19 ZEN 3
AMD_ZEN4, // K19 ZEN 4
X86_MICROARCHITECTURE_LAST_,
} X86Microarchitecture;
@ -218,7 +220,7 @@ typedef enum
X86_AVX512BITALG,
X86_AVX512VPOPCNTDQ,
X86_AVX512_4VNNIW,
X86_AVX512_4VBMI2,
X86_AVX512_4VBMI2, // Note: this is an alias to X86_AVX512_4FMAPS.
X86_AVX512_SECOND_FMA,
X86_AVX512_4FMAPS,
X86_AVX512_BF16,

View File

@ -68,6 +68,9 @@ CPU_FEATURES_START_CPP_NAMESPACE
#define AARCH64_HWCAP2_RNG (1UL << 16)
#define AARCH64_HWCAP2_BTI (1UL << 17)
#define AARCH64_HWCAP2_MTE (1UL << 18)
#define AARCH64_HWCAP2_ECV (1UL << 19)
#define AARCH64_HWCAP2_AFP (1UL << 20)
#define AARCH64_HWCAP2_RPRES (1UL << 21)
// http://elixir.free-electrons.com/linux/latest/source/arch/arm/include/uapi/asm/hwcap.h
#define ARM_HWCAP_SWP (1UL << 0)
@ -102,6 +105,13 @@ CPU_FEATURES_START_CPP_NAMESPACE
#define MIPS_HWCAP_R6 (1UL << 0)
#define MIPS_HWCAP_MSA (1UL << 1)
#define MIPS_HWCAP_CRC32 (1UL << 2)
#define MIPS_HWCAP_MIPS16 (1UL << 3)
#define MIPS_HWCAP_MDMX (1UL << 4)
#define MIPS_HWCAP_MIPS3D (1UL << 5)
#define MIPS_HWCAP_SMARTMIPS (1UL << 6)
#define MIPS_HWCAP_DSP (1UL << 7)
#define MIPS_HWCAP_DSP2 (1UL << 8)
#define MIPS_HWCAP_DSP3 (1UL << 9)
// http://elixir.free-electrons.com/linux/latest/source/arch/powerpc/include/uapi/asm/cputable.h
#ifndef _UAPI__ASM_POWERPC_CPUTABLE_H
@ -154,6 +164,17 @@ CPU_FEATURES_START_CPP_NAMESPACE
#define PPC_FEATURE2_HTM_NO_SUSPEND 0x00080000
#endif
// 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'))
#define RISCV_HWCAP_D (1UL << ('D' - 'A'))
#define RISCV_HWCAP_E (1UL << ('E' - 'A'))
#define RISCV_HWCAP_F (1UL << ('F' - 'A'))
#define RISCV_HWCAP_I (1UL << ('I' - 'A'))
#define RISCV_HWCAP_M (1UL << ('M' - 'A'))
#define RISCV_HWCAP_V (1UL << ('V' - 'A'))
#define RISCV_HWCAP_Q (1UL << ('Q' - 'A'))
typedef struct
{
unsigned long hwcaps;

View File

@ -0,0 +1,21 @@
// SPDX-FileCopyrightText: 2022 Google LLC
// SPDX-License-Identifier: Apache-2.0
#ifndef CPU_FEATURES_INCLUDE_INTERNAL_WINDOWS_UTILS_H_
#define CPU_FEATURES_INCLUDE_INTERNAL_WINDOWS_UTILS_H_
#include <windows.h> // IsProcessorFeaturePresent
// modern WinSDK winnt.h contains newer features detection definitions
#if !defined(PF_SSSE3_INSTRUCTIONS_AVAILABLE)
#define PF_SSSE3_INSTRUCTIONS_AVAILABLE 36
#endif
#if !defined(PF_SSE4_1_INSTRUCTIONS_AVAILABLE)
#define PF_SSE4_1_INSTRUCTIONS_AVAILABLE 37
#endif
#if !defined(PF_SSE4_2_INSTRUCTIONS_AVAILABLE)
#define PF_SSE4_2_INSTRUCTIONS_AVAILABLE 38
#endif
#endif // CPU_FEATURES_INCLUDE_INTERNAL_WINDOWS_UTILS_H_

View File

@ -63,7 +63,10 @@
LINE(AARCH64_DGH, dgh, "dgh", 0, AARCH64_HWCAP2_DGH) \
LINE(AARCH64_RNG, rng, "rng", 0, AARCH64_HWCAP2_RNG) \
LINE(AARCH64_BTI, bti, "bti", 0, AARCH64_HWCAP2_BTI) \
LINE(AARCH64_MTE, mte, "mte", 0, AARCH64_HWCAP2_MTE)
LINE(AARCH64_MTE, mte, "mte", 0, AARCH64_HWCAP2_MTE) \
LINE(AARCH64_ECV, ecv, "ecv", 0, AARCH64_HWCAP2_ECV) \
LINE(AARCH64_AFP, afp, "afp", 0, AARCH64_HWCAP2_AFP) \
LINE(AARCH64_RPRES, rpres, "rpres", 0, AARCH64_HWCAP2_RPRES)
#define INTROSPECTION_PREFIX Aarch64
#define INTROSPECTION_ENUM_PREFIX AARCH64
#include "define_introspection_and_hwcaps.inl"

View File

@ -14,7 +14,12 @@
#define INTROSPECTION_TABLE \
LINE(MIPS_MSA, msa, "msa", MIPS_HWCAP_MSA, 0) \
LINE(MIPS_EVA, eva, "eva", 0, 0) \
LINE(MIPS_R6, r6, "r6", MIPS_HWCAP_R6, 0)
LINE(MIPS_R6, r6, "r6", MIPS_HWCAP_R6, 0) \
LINE(MIPS_MIPS16, mips16, "mips16", MIPS_HWCAP_MIPS16, 0) \
LINE(MIPS_MDMX, mdmx, "mdmx", MIPS_HWCAP_MDMX, 0) \
LINE(MIPS_MIPS3D, mips3d, "mips3d", MIPS_HWCAP_MIPS3D, 0) \
LINE(MIPS_SMART, smart, "smartmips", MIPS_HWCAP_SMARTMIPS, 0) \
LINE(MIPS_DSP, dsp, "dsp", MIPS_HWCAP_DSP, 0)
#define INTROSPECTION_PREFIX Mips
#define INTROSPECTION_ENUM_PREFIX MIPS
#include "define_introspection_and_hwcaps.inl"

View File

@ -561,6 +561,8 @@ X86Microarchitecture GetX86Microarchitecture(const X86Info* info)
return INTEL_CFL; // https://en.wikipedia.org/wiki/Coffee_Lake
case 11:
return INTEL_WHL; // https://en.wikipedia.org/wiki/Whiskey_Lake_(microarchitecture)
case 12:
return INTEL_CML; // https://en.wikichip.org/wiki/intel/microarchitectures/comet_lake
default:
return X86_UNKNOWN;
}
@ -579,6 +581,9 @@ X86Microarchitecture GetX86Microarchitecture(const X86Info* info)
case CPUID(0x06, 0x9A):
// https://en.wikichip.org/wiki/intel/microarchitectures/alder_lake
return INTEL_ADL;
case CPUID(0x06, 0xA5):
// 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;
@ -744,13 +749,19 @@ X86Microarchitecture GetX86Microarchitecture(const X86Info* info)
case CPUID(0x17, 0x98):
// https://en.wikichip.org/wiki/amd/microarchitectures/zen_2
return AMD_ZEN2;
case CPUID(0x19, 0x00):
case CPUID(0x19, 0x01):
case CPUID(0x19, 0x08):
case CPUID(0x19, 0x21):
case CPUID(0x19, 0x30):
case CPUID(0x19, 0x40):
case CPUID(0x19, 0x44):
case CPUID(0x19, 0x50):
// https://en.wikichip.org/wiki/amd/microarchitectures/zen_3
return AMD_ZEN3;
case CPUID(0x19, 0x10):
// https://en.wikichip.org/wiki/amd/microarchitectures/zen_4
return AMD_ZEN4;
default:
return X86_UNKNOWN;
}
@ -760,6 +771,7 @@ X86Microarchitecture GetX86Microarchitecture(const X86Info* info)
switch (CPUID(info->family, info->model))
{
case CPUID(0x18, 0x00):
case CPUID(0x18, 0x01):
return AMD_ZEN;
}
}
@ -1823,6 +1835,7 @@ CacheInfo GetX86CacheInfo(void)
LINE(INTEL_KBL) \
LINE(INTEL_CFL) \
LINE(INTEL_WHL) \
LINE(INTEL_CML) \
LINE(INTEL_CNL) \
LINE(INTEL_ICL) \
LINE(INTEL_TGL) \
@ -1848,7 +1861,8 @@ CacheInfo GetX86CacheInfo(void)
LINE(AMD_ZEN) \
LINE(AMD_ZEN_PLUS) \
LINE(AMD_ZEN2) \
LINE(AMD_ZEN3)
LINE(AMD_ZEN3) \
LINE(AMD_ZEN4)
const char* GetX86MicroarchitectureName(X86Microarchitecture value)
{

View File

@ -14,7 +14,7 @@ static void OverrideOsPreserves(OsPreserves* os_preserves)
// No override
}
#include <windows.h> // IsProcessorFeaturePresent
#include "internal/windows_utils.h"
#if defined(CPU_FEATURES_MOCK_CPUID_X86)
extern bool GetWindowsIsProcessorFeaturePresent(DWORD);
@ -35,16 +35,15 @@ static void DetectFeaturesFromOs(X86Info* info, X86Features* features)
GetWindowsIsProcessorFeaturePresent(PF_XMMI64_INSTRUCTIONS_AVAILABLE);
features->sse3 =
GetWindowsIsProcessorFeaturePresent(PF_SSE3_INSTRUCTIONS_AVAILABLE);
features->ssse3 =
GetWindowsIsProcessorFeaturePresent(PF_SSSE3_INSTRUCTIONS_AVAILABLE);
features->sse4_1 =
GetWindowsIsProcessorFeaturePresent(PF_SSE4_1_INSTRUCTIONS_AVAILABLE);
features->sse4_2 =
GetWindowsIsProcessorFeaturePresent(PF_SSE4_2_INSTRUCTIONS_AVAILABLE);
// https://github.com/google/cpu_features/issues/200
#if (_WIN32_WINNT >= 0x0601) // Win7+
if (GetX86Microarchitecture(info) == INTEL_WSM)
{
features->ssse3 = true;
features->sse4_1 = true;
features->sse4_2 = true;
}
#endif
// do not bother checking PF_AVX*
// cause AVX enabled processor will have XCR0 be exposed and this function will be skipped at all
}
#endif // CPU_FEATURES_OS_WINDOWS

View File

@ -43,7 +43,7 @@ char gGlobalBuffer[64 * 1024];
BumpAllocator gBumpAllocator = {.ptr = gGlobalBuffer,
.size = sizeof(gGlobalBuffer)};
static void internal_error()
static void internal_error(void)
{
fputs("internal error\n", stderr);
exit(EXIT_FAILURE);
@ -51,12 +51,12 @@ static void internal_error()
#define ALIGN 8
static void assertAligned()
static void assertAligned(void)
{
if ((uintptr_t)(gBumpAllocator.ptr) % ALIGN) internal_error();
}
static void BA_Align()
static void BA_Align(void)
{
while (gBumpAllocator.size && (uintptr_t)(gBumpAllocator.ptr) % ALIGN)
{
@ -128,10 +128,10 @@ static Node* CreateConstantString(const char* value)
}
// Adds a map node.
static Node* CreateMap() { return BA_CreateNode(NT_MAP); }
static Node* CreateMap(void) { return BA_CreateNode(NT_MAP); }
// Adds an array node.
static Node* CreateArray() { return BA_CreateNode(NT_ARRAY); }
static Node* CreateArray(void) { return BA_CreateNode(NT_ARRAY); }
// Adds a formatted string node.
static Node* CreatePrintfString(const char* format, ...)
@ -385,16 +385,15 @@ static void AddCacheInfo(Node* root, const CacheInfo* cache_info)
AddMapEntry(root, "cache_info", array);
}
static Node* CreateTree()
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();
FillX86BrandString(brand_string);
AddMapEntry(root, "arch", CreateString("x86"));
AddMapEntry(root, "brand", CreateString(brand_string));
AddMapEntry(root, "brand", CreateString(info.brand_string));
AddMapEntry(root, "family", CreateInt(info.family));
AddMapEntry(root, "model", CreateInt(info.model));
AddMapEntry(root, "stepping", CreateInt(info.stepping));

View File

@ -135,6 +135,20 @@ void DisableHardwareCapabilities()
SetHardwareCapabilities(0, 0);
}
TEST(CpuinfoAarch64Test, Aarch64FeaturesEnum)
{
const char *last_name = GetAarch64FeaturesEnumName(AARCH64_LAST_);
EXPECT_STREQ(last_name, "unknown_feature");
for (int i = static_cast<int>(AARCH64_FP); i != static_cast<int>(AARCH64_LAST_); ++i)
{
const auto feature = static_cast<Aarch64FeaturesEnum>(i);
const char *name = GetAarch64FeaturesEnumName(feature);
ASSERT_FALSE(name == nullptr);
EXPECT_STRNE(name, "");
EXPECT_STRNE(name, last_name);
}
}
TEST(CpuinfoAarch64Test, FromHardwareCap)
{
ResetHwcaps();
@ -208,7 +222,7 @@ TEST(CpuinfoAarch64Test, FromHardwareCap2)
TEST(CpuinfoAarch64Test, ARMCortexA53)
{
ResetHwcaps();
auto& fs = GetEmptyFilesystem();
auto &fs = GetEmptyFilesystem();
fs.CreateFile("/proc/cpuinfo",
R"(Processor : AArch64 Processor rev 3 (aarch64)
processor : 0
@ -283,6 +297,9 @@ CPU revision : 3)");
EXPECT_FALSE(info.features.rng);
EXPECT_FALSE(info.features.bti);
EXPECT_FALSE(info.features.mte);
EXPECT_FALSE(info.features.ecv);
EXPECT_FALSE(info.features.afp);
EXPECT_FALSE(info.features.rpres);
}
#endif

View File

@ -10,6 +10,21 @@ namespace cpu_features
{
namespace
{
TEST(CpuinfoArmTest, ArmFeaturesEnum)
{
const char* last_name = GetArmFeaturesEnumName(ARM_LAST_);
EXPECT_STREQ(last_name, "unknown_feature");
for (int i = static_cast<int>(ARM_SWP); i != static_cast<int>(ARM_LAST_); ++i)
{
const auto feature = static_cast<ArmFeaturesEnum>(i);
const char* name = GetArmFeaturesEnumName(feature);
ASSERT_FALSE(name == nullptr);
EXPECT_STRNE(name, "");
EXPECT_STRNE(name, last_name);
}
}
TEST(CpuinfoArmTest, FromHardwareCap)
{
ResetHwcaps();

View File

@ -12,6 +12,20 @@ namespace cpu_features
{
namespace
{
TEST(CpuinfoMipsTest, MipsFeaturesEnum)
{
const char* last_name = GetMipsFeaturesEnumName(MIPS_LAST_);
EXPECT_STREQ(last_name, "unknown_feature");
for (int i = static_cast<int>(MIPS_MSA); i != static_cast<int>(MIPS_LAST_); ++i)
{
const auto feature = static_cast<MipsFeaturesEnum>(i);
const char* name = GetMipsFeaturesEnumName(feature);
ASSERT_FALSE(name == nullptr);
EXPECT_STRNE(name, "");
EXPECT_STRNE(name, last_name);
}
}
TEST(CpuinfoMipsTest, FromHardwareCapBoth)
{
ResetHwcaps();
@ -60,6 +74,12 @@ VPE : 0
const auto info = GetMipsInfo();
EXPECT_FALSE(info.features.msa);
EXPECT_TRUE(info.features.eva);
EXPECT_FALSE(info.features.r6);
EXPECT_TRUE(info.features.mips16);
EXPECT_FALSE(info.features.mdmx);
EXPECT_FALSE(info.features.mips3d);
EXPECT_FALSE(info.features.smart);
EXPECT_TRUE(info.features.dsp);
}
TEST(CpuinfoMipsTest, AR7161)
@ -87,6 +107,7 @@ VCEI exceptions : not available
const auto info = GetMipsInfo();
EXPECT_FALSE(info.features.msa);
EXPECT_FALSE(info.features.eva);
EXPECT_TRUE(info.features.mips16);
}
TEST(CpuinfoMipsTest, Goldfish)
@ -115,5 +136,37 @@ VCEI exceptions : not available
EXPECT_FALSE(info.features.eva);
}
TEST(CpuinfoMipsTest, BCM1250)
{
ResetHwcaps();
auto& fs = GetEmptyFilesystem();
fs.CreateFile("/proc/cpuinfo", R"(system type : SiByte BCM91250A (SWARM)
processor : 0
cpu model : SiByte SB1 V0.2 FPU V0.2
BogoMIPS : 532.48
wait instruction : no
microsecond timers : yes
tlb_entries : 64
extra interrupt vector : yes
hardware watchpoint : yes, count: 1, address/irw mask: [0x0ff8]
isa : mips1 mips2 mips3 mips4 mips5 mips32r1 mips32r2 mips64r1 mips64r2
ASEs implemented : mdmx mips3d
shadow register sets : 1
kscratch registers : 0
package : 0
core : 0
VCED exceptions : not available
VCEI exceptions : not available
)");
const auto info = GetMipsInfo();
EXPECT_FALSE(info.features.msa);
EXPECT_FALSE(info.features.eva);
EXPECT_FALSE(info.features.mips16);
EXPECT_TRUE(info.features.mdmx);
EXPECT_TRUE(info.features.mips3d);
EXPECT_FALSE(info.features.smart);
EXPECT_FALSE(info.features.dsp);
}
} // namespace
} // namespace cpu_features

View File

@ -11,6 +11,20 @@ namespace cpu_features
{
namespace
{
TEST(CpustringsPPCTest, PPCFeaturesEnum)
{
const char* last_name = GetPPCFeaturesEnumName(PPC_LAST_);
EXPECT_STREQ(last_name, "unknown_feature");
for (int i = static_cast<int>(PPC_32); i != static_cast<int>(PPC_LAST_); ++i)
{
const auto feature = static_cast<PPCFeaturesEnum>(i);
const char* name = GetPPCFeaturesEnumName(feature);
ASSERT_FALSE(name == nullptr);
EXPECT_STRNE(name, "");
EXPECT_STRNE(name, last_name);
}
}
TEST(CpustringsPPCTest, FromHardwareCap)
{
ResetHwcaps();

View File

@ -77,9 +77,9 @@ private:
uint32_t xcr0_eax_;
};
static FakeCpu* g_fake_cpu_instance = nullptr;
static FakeCpu *g_fake_cpu_instance = nullptr;
static FakeCpu& cpu()
static FakeCpu &cpu()
{
assert(g_fake_cpu_instance != nullptr);
return *g_fake_cpu_instance;
@ -93,7 +93,7 @@ extern "C" Leaf GetCpuidLeaf(uint32_t leaf_id, int ecx)
extern "C" uint32_t GetXCR0Eax(void) { return cpu().GetXCR0Eax(); }
#if defined(CPU_FEATURES_OS_MACOS)
extern "C" bool GetDarwinSysCtlByName(const char* name)
extern "C" bool GetDarwinSysCtlByName(const char *name)
{
return cpu().GetDarwinSysCtlByName(name);
}
@ -124,6 +124,34 @@ protected:
}
};
TEST_F(CpuidX86Test, X86MicroarchitectureEnum)
{
const char *last_name = GetX86MicroarchitectureName(X86_MICROARCHITECTURE_LAST_);
EXPECT_STREQ(last_name, "unknown microarchitecture");
for (int i = static_cast<int>(X86_UNKNOWN); i != static_cast<int>(X86_MICROARCHITECTURE_LAST_); ++i)
{
const auto micro = static_cast<X86Microarchitecture>(i);
const char *name = GetX86MicroarchitectureName(micro);
ASSERT_FALSE(name == nullptr);
EXPECT_STRNE(name, "");
EXPECT_STRNE(name, last_name);
}
}
TEST_F(CpuidX86Test, X86FeaturesEnum)
{
const char *last_name = GetX86FeaturesEnumName(X86_LAST_);
EXPECT_STREQ(last_name, "unknown_feature");
for (int i = static_cast<int>(X86_FPU); i != static_cast<int>(X86_LAST_); ++i)
{
const auto feature = static_cast<X86FeaturesEnum>(i);
const char *name = GetX86FeaturesEnumName(feature);
ASSERT_FALSE(name == nullptr);
EXPECT_STRNE(name, "");
EXPECT_STRNE(name, last_name);
}
}
TEST_F(CpuidX86Test, SandyBridge)
{
cpu().SetOsBackupsExtendedRegisters(true);
@ -216,9 +244,8 @@ TEST_F(CpuidX86Test, Branding)
{{0x80000003, 0}, Leaf{0x37692029, 0x3035362D, 0x43205530, 0x40205550}},
{{0x80000004, 0}, Leaf{0x352E3220, 0x7A484730, 0x00000000, 0x00000000}},
});
char brand_string[49];
FillX86BrandString(brand_string);
EXPECT_STREQ(brand_string, "Intel(R) Core(TM) i7-6500U CPU @ 2.50GHz");
const auto info = GetX86Info();
EXPECT_STREQ(info.brand_string, "Intel(R) Core(TM) i7-6500U CPU @ 2.50GHz");
}
TEST_F(CpuidX86Test, KabyLakeCache)
@ -436,10 +463,6 @@ TEST_F(CpuidX86Test, AMD_K15_EXCAVATOR_STONEY_RIDGE)
"AMD A9-9410 RADEON R5, 5 COMPUTE CORES 2C+3G ");
EXPECT_EQ(GetX86Microarchitecture(&info),
X86Microarchitecture::AMD_EXCAVATOR);
char brand_string[49];
FillX86BrandString(brand_string);
EXPECT_STREQ(brand_string, "AMD A9-9410 RADEON R5, 5 COMPUTE CORES 2C+3G ");
}
// http://users.atw.hu/instlatx64/AuthenticAMD/AuthenticAMD0600F20_K15_AbuDhabi_CPUID0.txt
@ -465,9 +488,7 @@ TEST_F(CpuidX86Test, AMD_K15_PILEDRIVER_ABU_DHABI)
EXPECT_EQ(GetX86Microarchitecture(&info),
X86Microarchitecture::AMD_PILEDRIVER);
char brand_string[49];
FillX86BrandString(brand_string);
EXPECT_STREQ(brand_string, "AMD Opteron(tm) Processor 6376 ");
EXPECT_STREQ(info.brand_string, "AMD Opteron(tm) Processor 6376 ");
}
// http://users.atw.hu/instlatx64/AuthenticAMD/AuthenticAMD0600F20_K15_AbuDhabi_CPUID0.txt
@ -541,10 +562,6 @@ TEST_F(CpuidX86Test, AMD_K15_BULLDOZER_INTERLAGOS)
"AMD Opteron(TM) Processor 6238 ");
EXPECT_EQ(GetX86Microarchitecture(&info),
X86Microarchitecture::AMD_BULLDOZER);
char brand_string[49];
FillX86BrandString(brand_string);
EXPECT_STREQ(brand_string, "AMD Opteron(TM) Processor 6238 ");
}
// http://users.atw.hu/instlatx64/AuthenticAMD0630F81_K15_Godavari_CPUID.txt
@ -571,10 +588,6 @@ TEST_F(CpuidX86Test, AMD_K15_STREAMROLLER_GODAVARI)
"AMD A8-7670K Radeon R7, 10 Compute Cores 4C+6G ");
EXPECT_EQ(GetX86Microarchitecture(&info),
X86Microarchitecture::AMD_STREAMROLLER);
char brand_string[49];
FillX86BrandString(brand_string);
EXPECT_STREQ(brand_string, "AMD A8-7670K Radeon R7, 10 Compute Cores 4C+6G ");
}
// http://users.atw.hu/instlatx64/AuthenticAMD/AuthenticAMD0700F01_K16_Kabini_CPUID.txt
@ -598,10 +611,6 @@ TEST_F(CpuidX86Test, AMD_K16_JAGUAR_KABINI)
EXPECT_STREQ(info.brand_string,
"AMD A4-5000 APU with Radeon(TM) HD Graphics ");
EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::AMD_JAGUAR);
char brand_string[49];
FillX86BrandString(brand_string);
EXPECT_STREQ(brand_string, "AMD A4-5000 APU with Radeon(TM) HD Graphics ");
}
// http://users.atw.hu/instlatx64/AuthenticAMD/AuthenticAMD0730F01_K16_Beema_CPUID2.txt
@ -625,10 +634,6 @@ TEST_F(CpuidX86Test, AMD_K16_PUMA_BEEMA)
EXPECT_STREQ(info.brand_string,
"AMD A6-6310 APU with AMD Radeon R4 Graphics ");
EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::AMD_PUMA);
char brand_string[49];
FillX86BrandString(brand_string);
EXPECT_STREQ(brand_string, "AMD A6-6310 APU with AMD Radeon R4 Graphics ");
}
// http://users.atw.hu/instlatx64/AuthenticAMD/AuthenticAMD0820F01_K17_Dali_CPUID.txt
@ -652,10 +657,6 @@ TEST_F(CpuidX86Test, AMD_K17_ZEN_DALI)
EXPECT_STREQ(info.brand_string,
"AMD 3020e with Radeon Graphics ");
EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::AMD_ZEN);
char brand_string[49];
FillX86BrandString(brand_string);
EXPECT_STREQ(brand_string, "AMD 3020e with Radeon Graphics ");
}
// http://users.atw.hu/instlatx64/AuthenticAMD/AuthenticAMD0800F82_K17_ZenP_CPUID.txt
@ -679,10 +680,6 @@ TEST_F(CpuidX86Test, AMD_K17_ZEN_PLUS_PINNACLE_RIDGE)
EXPECT_STREQ(info.brand_string,
"AMD Ryzen 7 2700X Eight-Core Processor ");
EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::AMD_ZEN_PLUS);
char brand_string[49];
FillX86BrandString(brand_string);
EXPECT_STREQ(brand_string, "AMD Ryzen 7 2700X Eight-Core Processor ");
}
// http://users.atw.hu/instlatx64/AuthenticAMD/AuthenticAMD0840F70_K17_CPUID.txt
@ -705,10 +702,6 @@ TEST_F(CpuidX86Test, AMD_K17_ZEN2_XBOX_SERIES_X)
EXPECT_EQ(info.model, 0x47);
EXPECT_STREQ(info.brand_string, "AMD 4700S 8-Core Processor Desktop Kit");
EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::AMD_ZEN2);
char brand_string[49];
FillX86BrandString(brand_string);
EXPECT_STREQ(brand_string, "AMD 4700S 8-Core Processor Desktop Kit");
}
// http://users.atw.hu/instlatx64/HygonGenuine/HygonGenuine0900F02_Hygon_CPUID3.txt
@ -732,10 +725,6 @@ TEST_F(CpuidX86Test, AMD_K18_ZEN_DHYANA)
EXPECT_STREQ(info.brand_string,
"Hygon C86 3185 8-core Processor ");
EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::AMD_ZEN);
char brand_string[49];
FillX86BrandString(brand_string);
EXPECT_STREQ(brand_string, "Hygon C86 3185 8-core Processor ");
}
// http://users.atw.hu/instlatx64/HygonGenuine/HygonGenuine0900F02_Hygon_CPUID.txt
@ -808,10 +797,50 @@ TEST_F(CpuidX86Test, AMD_K19_ZEN3_VERMEER)
EXPECT_STREQ(info.brand_string,
"AMD Ryzen 9 5900X 12-Core Processor ");
EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::AMD_ZEN3);
}
char brand_string[49];
FillX86BrandString(brand_string);
EXPECT_STREQ(brand_string, "AMD Ryzen 9 5900X 12-Core Processor ");
// http://users.atw.hu/instlatx64/AuthenticAMD/AuthenticAMD0A40F41_K19_Rembrandt_03_CPUID.txt
TEST_F(CpuidX86Test, AMD_K19_ZEN3)
{
cpu().SetLeaves({
{{0x00000000, 0}, Leaf{0x00000010, 0x68747541, 0x444D4163, 0x69746E65}},
{{0x00000001, 0}, Leaf{0x00A40F41, 0x00100800, 0x7EF8320B, 0x178BFBFF}},
{{0x80000000, 0}, Leaf{0x80000023, 0x68747541, 0x444D4163, 0x69746E65}},
{{0x80000001, 0}, Leaf{0x00A40F41, 0x50000000, 0x75C237FF, 0x2FD3FBFF}},
{{0x80000002, 0}, Leaf{0x20444D41, 0x657A7952, 0x2039206E, 0x30303936}},
{{0x80000003, 0}, Leaf{0x77205848, 0x20687469, 0x65646152, 0x47206E6F}},
{{0x80000004, 0}, Leaf{0x68706172, 0x20736369, 0x20202020, 0x00202020}},
});
const auto info = GetX86Info();
EXPECT_STREQ(info.vendor, "AuthenticAMD");
EXPECT_EQ(info.family, 0x19);
EXPECT_EQ(info.model, 0x44);
EXPECT_STREQ(info.brand_string,
"AMD Ryzen 9 6900HX with Radeon Graphics ");
EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::AMD_ZEN3);
}
// http://users.atw.hu/instlatx64/HygonGenuine/HygonGenuine0900F11_Hygon_01_CPUID.txt
TEST_F(CpuidX86Test, AMD_K18_ZEN_DHYANA_OCTAL_CORE_C86_3250)
{
cpu().SetLeaves({
{{0x00000000, 0}, Leaf{0x0000000D, 0x6F677948, 0x656E6975, 0x6E65476E}},
{{0x00000001, 0}, Leaf{0x00900F11, 0x00100800, 0x76D8320B, 0x178BFBFF}},
{{0x80000000, 0}, Leaf{0x8000001F, 0x6F677948, 0x656E6975, 0x6E65476E}},
{{0x80000001, 0}, Leaf{0x00900F11, 0x60000000, 0x35C233FF, 0x2FD3FBFF}},
{{0x80000002, 0}, Leaf{0x6F677948, 0x3843206E, 0x32332036, 0x20203035}},
{{0x80000003, 0}, Leaf{0x6F632D38, 0x50206572, 0x65636F72, 0x726F7373}},
{{0x80000004, 0}, Leaf{0x20202020, 0x20202020, 0x20202020, 0x00202020}},
});
const auto info = GetX86Info();
EXPECT_EQ(info.model, 0x01);
EXPECT_EQ(info.family, 0x18);
EXPECT_STREQ(info.vendor, "HygonGenuine");
EXPECT_STREQ(info.brand_string,
"Hygon C86 3250 8-core Processor ");
EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::AMD_ZEN);
}
// https://github.com/InstLatx64/InstLatx64/blob/master/GenuineIntel/GenuineIntel00106A1_Nehalem_CPUID.txt
@ -823,6 +852,9 @@ TEST_F(CpuidX86Test, Nehalem)
cpu().SetWindowsIsProcessorFeaturePresent(PF_XMMI_INSTRUCTIONS_AVAILABLE);
cpu().SetWindowsIsProcessorFeaturePresent(PF_XMMI64_INSTRUCTIONS_AVAILABLE);
cpu().SetWindowsIsProcessorFeaturePresent(PF_SSE3_INSTRUCTIONS_AVAILABLE);
cpu().SetWindowsIsProcessorFeaturePresent(PF_SSSE3_INSTRUCTIONS_AVAILABLE);
cpu().SetWindowsIsProcessorFeaturePresent(PF_SSE4_1_INSTRUCTIONS_AVAILABLE);
cpu().SetWindowsIsProcessorFeaturePresent(PF_SSE4_2_INSTRUCTIONS_AVAILABLE);
#elif defined(CPU_FEATURES_OS_MACOS)
cpu().SetDarwinSysCtlByName("hw.optional.sse");
cpu().SetDarwinSysCtlByName("hw.optional.sse2");
@ -831,7 +863,7 @@ TEST_F(CpuidX86Test, Nehalem)
cpu().SetDarwinSysCtlByName("hw.optional.sse4_1");
cpu().SetDarwinSysCtlByName("hw.optional.sse4_2");
#elif defined(CPU_FEATURES_OS_FREEBSD)
auto& fs = GetEmptyFilesystem();
auto &fs = GetEmptyFilesystem();
fs.CreateFile("/var/run/dmesg.boot", R"(
---<<BOOT>>---
Copyright (c) 1992-2020 The FreeBSD Project.
@ -841,7 +873,7 @@ FreeBSD is a registered trademark of The FreeBSD Foundation.
real memory = 2147418112 (2047 MB)
)");
#elif defined(CPU_FEATURES_OS_LINUX) || defined(CPU_FEATURES_OS_ANDROID)
auto& fs = GetEmptyFilesystem();
auto &fs = GetEmptyFilesystem();
fs.CreateFile("/proc/cpuinfo", R"(processor :
flags : fpu mmx sse sse2 pni ssse3 sse4_1 sse4_2
)");
@ -883,20 +915,12 @@ flags : fpu mmx sse sse2 pni ssse3 sse4_1 sse4_2
"Genuine Intel(R) CPU @ 0000 @ 1.87GHz");
EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::INTEL_NHM);
char brand_string[49];
FillX86BrandString(brand_string);
EXPECT_STREQ(brand_string, "Genuine Intel(R) CPU @ 0000 @ 1.87GHz");
EXPECT_TRUE(info.features.sse);
EXPECT_TRUE(info.features.sse2);
EXPECT_TRUE(info.features.sse3);
#if !defined(CPU_FEATURES_OS_WINDOWS)
// Currently disabled on Windows as IsProcessorFeaturePresent do not support
// feature detection > sse3.
EXPECT_TRUE(info.features.ssse3);
EXPECT_TRUE(info.features.sse4_1);
EXPECT_TRUE(info.features.sse4_2);
#endif // !defined(CPU_FEATURES_OS_WINDOWS)
}
// https://github.com/InstLatx64/InstLatx64/blob/master/GenuineIntel/GenuineIntel0030673_Silvermont3_CPUID.txt
@ -908,6 +932,9 @@ TEST_F(CpuidX86Test, Atom)
cpu().SetWindowsIsProcessorFeaturePresent(PF_XMMI_INSTRUCTIONS_AVAILABLE);
cpu().SetWindowsIsProcessorFeaturePresent(PF_XMMI64_INSTRUCTIONS_AVAILABLE);
cpu().SetWindowsIsProcessorFeaturePresent(PF_SSE3_INSTRUCTIONS_AVAILABLE);
cpu().SetWindowsIsProcessorFeaturePresent(PF_SSSE3_INSTRUCTIONS_AVAILABLE);
cpu().SetWindowsIsProcessorFeaturePresent(PF_SSE4_1_INSTRUCTIONS_AVAILABLE);
cpu().SetWindowsIsProcessorFeaturePresent(PF_SSE4_2_INSTRUCTIONS_AVAILABLE);
#elif defined(CPU_FEATURES_OS_MACOS)
cpu().SetDarwinSysCtlByName("hw.optional.sse");
cpu().SetDarwinSysCtlByName("hw.optional.sse2");
@ -916,7 +943,7 @@ TEST_F(CpuidX86Test, Atom)
cpu().SetDarwinSysCtlByName("hw.optional.sse4_1");
cpu().SetDarwinSysCtlByName("hw.optional.sse4_2");
#elif defined(CPU_FEATURES_OS_FREEBSD)
auto& fs = GetEmptyFilesystem();
auto &fs = GetEmptyFilesystem();
fs.CreateFile("/var/run/dmesg.boot", R"(
---<<BOOT>>---
Copyright (c) 1992-2020 The FreeBSD Project.
@ -926,7 +953,7 @@ FreeBSD is a registered trademark of The FreeBSD Foundation.
real memory = 2147418112 (2047 MB)
)");
#elif defined(CPU_FEATURES_OS_LINUX) || defined(CPU_FEATURES_OS_ANDROID)
auto& fs = GetEmptyFilesystem();
auto &fs = GetEmptyFilesystem();
fs.CreateFile("/proc/cpuinfo", R"(
flags : fpu mmx sse sse2 pni ssse3 sse4_1 sse4_2
)");
@ -968,20 +995,12 @@ flags : fpu mmx sse sse2 pni ssse3 sse4_1 sse4_2
EXPECT_EQ(GetX86Microarchitecture(&info),
X86Microarchitecture::INTEL_ATOM_SMT);
char brand_string[49];
FillX86BrandString(brand_string);
EXPECT_STREQ(brand_string, " Intel(R) Celeron(R) CPU J1900 @ 1.99GHz");
EXPECT_TRUE(info.features.sse);
EXPECT_TRUE(info.features.sse2);
EXPECT_TRUE(info.features.sse3);
#if !defined(CPU_FEATURES_OS_WINDOWS)
// Currently disabled on Windows as IsProcessorFeaturePresent do not support
// feature detection > sse3.
EXPECT_TRUE(info.features.ssse3);
EXPECT_TRUE(info.features.sse4_1);
EXPECT_TRUE(info.features.sse4_2);
#endif // !defined(CPU_FEATURES_OS_WINDOWS)
}
// https://www.felixcloutier.com/x86/cpuid#example-3-1--example-of-cache-and-tlb-interpretation
@ -1047,7 +1066,7 @@ TEST_F(CpuidX86Test, P3)
#elif defined(CPU_FEATURES_OS_MACOS)
cpu().SetDarwinSysCtlByName("hw.optional.sse");
#elif defined(CPU_FEATURES_OS_FREEBSD)
auto& fs = GetEmptyFilesystem();
auto &fs = GetEmptyFilesystem();
fs.CreateFile("/var/run/dmesg.boot", R"(
---<<BOOT>>---
Copyright (c) 1992-2020 The FreeBSD Project.
@ -1056,7 +1075,7 @@ FreeBSD is a registered trademark of The FreeBSD Foundation.
real memory = 2147418112 (2047 MB)
)");
#elif defined(CPU_FEATURES_OS_LINUX) || defined(CPU_FEATURES_OS_ANDROID)
auto& fs = GetEmptyFilesystem();
auto &fs = GetEmptyFilesystem();
fs.CreateFile("/proc/cpuinfo", R"(
flags : fpu mmx sse
)");
@ -1076,21 +1095,13 @@ flags : fpu mmx sse
EXPECT_STREQ(info.brand_string, "");
EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::X86_UNKNOWN);
char brand_string[49];
FillX86BrandString(brand_string);
EXPECT_STREQ(brand_string, "");
EXPECT_TRUE(info.features.mmx);
EXPECT_TRUE(info.features.sse);
EXPECT_FALSE(info.features.sse2);
EXPECT_FALSE(info.features.sse3);
#if !defined(CPU_FEATURES_OS_WINDOWS)
// Currently disabled on Windows as IsProcessorFeaturePresent do not support
// feature detection > sse3.
EXPECT_FALSE(info.features.ssse3);
EXPECT_FALSE(info.features.sse4_1);
EXPECT_FALSE(info.features.sse4_2);
#endif // !defined(CPU_FEATURES_OS_WINDOWS)
}
// https://github.com/InstLatx64/InstLatx64/blob/master/GenuineIntel/GenuineIntel0000480_486_CPUID.txt
@ -1155,11 +1166,53 @@ TEST_F(CpuidX86Test, INTEL_KNIGHTS_LANDING)
X86Microarchitecture::INTEL_KNIGHTS_L);
}
// http://users.atw.hu/instlatx64/GenuineIntel/GenuineIntel00806EC_CometLake_CPUID2.txt
TEST_F(CpuidX86Test, INTEL_CML_U)
{
cpu().SetLeaves({
{{0x00000000, 0}, Leaf{0x00000016, 0x756E6547, 0x6C65746E, 0x49656E69}},
{{0x00000001, 0}, Leaf{0x000806EC, 0x00100800, 0x7FFAFBBF, 0xBFEBFBFF}},
});
const auto info = GetX86Info();
EXPECT_STREQ(info.vendor, "GenuineIntel");
EXPECT_EQ(info.family, 0x06);
EXPECT_EQ(info.model, 0x8E);
EXPECT_EQ(info.stepping, 0x0C);
EXPECT_EQ(GetX86Microarchitecture(&info),
X86Microarchitecture::INTEL_CML);
}
// http://users.atw.hu/instlatx64/GenuineIntel/GenuineIntel00A0652_CometLake_CPUID1.txt
TEST_F(CpuidX86Test, INTEL_CML_H)
{
cpu().SetLeaves({
{{0x00000000, 0}, Leaf{0x00000016, 0x756E6547, 0x6C65746E, 0x49656E69}},
{{0x00000001, 0}, Leaf{0x000A0652, 0x00100800, 0x7FFAFBBF, 0xBFEBFBFF}},
});
const auto info = GetX86Info();
EXPECT_STREQ(info.vendor, "GenuineIntel");
EXPECT_EQ(info.family, 0x06);
EXPECT_EQ(info.model, 0xA5);
EXPECT_EQ(GetX86Microarchitecture(&info),
X86Microarchitecture::INTEL_CML);
}
// https://github.com/google/cpu_features/issues/200
// http://users.atw.hu/instlatx64/GenuineIntel/GenuineIntel00206F2_Eagleton_CPUID.txt
#if defined(CPU_FEATURES_OS_WINDOWS)
TEST_F(CpuidX86Test, WIN_INTEL_WESTMERE_EX)
{
// Pre AVX cpus don't have xsave
cpu().SetOsBackupsExtendedRegisters(false);
cpu().SetWindowsIsProcessorFeaturePresent(PF_XMMI_INSTRUCTIONS_AVAILABLE);
cpu().SetWindowsIsProcessorFeaturePresent(PF_XMMI64_INSTRUCTIONS_AVAILABLE);
cpu().SetWindowsIsProcessorFeaturePresent(PF_SSE3_INSTRUCTIONS_AVAILABLE);
cpu().SetWindowsIsProcessorFeaturePresent(PF_SSSE3_INSTRUCTIONS_AVAILABLE);
cpu().SetWindowsIsProcessorFeaturePresent(PF_SSE4_1_INSTRUCTIONS_AVAILABLE);
cpu().SetWindowsIsProcessorFeaturePresent(PF_SSE4_2_INSTRUCTIONS_AVAILABLE);
cpu().SetLeaves({
{{0x00000000, 0}, Leaf{0x0000000B, 0x756E6547, 0x6C65746E, 0x49656E69}},
{{0x00000001, 0}, Leaf{0x000206F2, 0x00400800, 0x02BEE3FF, 0xBFEBFBFF}},
@ -1170,15 +1223,12 @@ TEST_F(CpuidX86Test, WIN_INTEL_WESTMERE_EX)
EXPECT_EQ(info.model, 0x2F);
EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::INTEL_WSM);
#if (_WIN32_WINNT < 0x0601) // before Win7
EXPECT_FALSE(info.features.ssse3);
EXPECT_FALSE(info.features.sse4_1);
EXPECT_FALSE(info.features.sse4_2);
#else
EXPECT_TRUE(info.features.sse);
EXPECT_TRUE(info.features.sse2);
EXPECT_TRUE(info.features.sse3);
EXPECT_TRUE(info.features.ssse3);
EXPECT_TRUE(info.features.sse4_1);
EXPECT_TRUE(info.features.sse4_2);
#endif
}
#endif // CPU_FEATURES_OS_WINDOWS

View File

@ -20,7 +20,7 @@ endif()
target_include_directories(obs_adapters
PUBLIC
${CMAKE_SOURCE_DIR}/src/core/interfaces
${GNSSSDR_SOURCE_DIR}/src/core/interfaces
)
target_link_libraries(obs_adapters

View File

@ -20,7 +20,7 @@ endif()
target_include_directories(obs_gr_blocks
PUBLIC
${CMAKE_SOURCE_DIR}/src/algorithms/libs
${GNSSSDR_SOURCE_DIR}/src/algorithms/libs
)
target_link_libraries(obs_gr_blocks
@ -47,7 +47,7 @@ endif()
target_include_directories(obs_gr_blocks
PUBLIC
${CMAKE_SOURCE_DIR}/src/core/interfaces
${GNSSSDR_SOURCE_DIR}/src/core/interfaces
)
if(GNURADIO_USES_STD_POINTERS)

View File

@ -45,7 +45,7 @@ target_link_libraries(resampler_adapters
target_include_directories(resampler_adapters
PUBLIC
${CMAKE_SOURCE_DIR}/src/core/interfaces
${GNSSSDR_SOURCE_DIR}/src/core/interfaces
)
if(GNURADIO_IS_38_OR_GREATER)

View File

@ -60,7 +60,7 @@ endif()
target_include_directories(resampler_gr_blocks
PUBLIC
${CMAKE_SOURCE_DIR}/src/core/interfaces
${GNSSSDR_SOURCE_DIR}/src/core/interfaces
)
if(ENABLE_CLANG_TIDY)

View File

@ -34,8 +34,8 @@ target_link_libraries(signal_generator_adapters
target_include_directories(signal_generator_adapters
PUBLIC
${CMAKE_SOURCE_DIR}/src/core/interfaces
${CMAKE_SOURCE_DIR}/src/core/receiver
${GNSSSDR_SOURCE_DIR}/src/core/interfaces
${GNSSSDR_SOURCE_DIR}/src/core/receiver
)
if(GNURADIO_USES_STD_POINTERS)

View File

@ -38,7 +38,7 @@ endif()
target_include_directories(signal_generator_gr_blocks
PUBLIC
${CMAKE_SOURCE_DIR}/src/core/interfaces
${GNSSSDR_SOURCE_DIR}/src/core/interfaces
)
# Workaround for CentOS 7

View File

@ -28,6 +28,7 @@
#include "gps_sdr_signal_replica.h"
#include <gnuradio/io_signature.h>
#include <volk_gnsssdr/volk_gnsssdr.h>
#include <algorithm>
#include <array>
#include <cmath>
#include <fstream>
@ -187,8 +188,8 @@ void signal_generator_c::generate_codes()
// Concatenate "num_of_codes_per_vector_" codes
for (unsigned int i = 0; i < num_of_codes_per_vector_[sat]; i++)
{
memcpy(&(sampled_code_data_[sat][i * samples_per_code_[sat]]),
code.data(), sizeof(gr_complex) * samples_per_code_[sat]);
std::copy_n(code.data(), samples_per_code_[sat],
&(sampled_code_data_[sat][i * samples_per_code_[sat]]));
}
}
else if (system_[sat] == "R")
@ -209,8 +210,8 @@ void signal_generator_c::generate_codes()
// Concatenate "num_of_codes_per_vector_" codes
for (unsigned int i = 0; i < num_of_codes_per_vector_[sat]; i++)
{
memcpy(&(sampled_code_data_[sat][i * samples_per_code_[sat]]),
code.data(), sizeof(gr_complex) * samples_per_code_[sat]);
std::copy_n(code.data(), samples_per_code_[sat],
&(sampled_code_data_[sat][i * samples_per_code_[sat]]));
}
}
else if (system_[sat] == "E")
@ -261,8 +262,8 @@ void signal_generator_c::generate_codes()
// Concatenate "num_of_codes_per_vector_" codes
for (unsigned int i = 0; i < num_of_codes_per_vector_[sat]; i++)
{
memcpy(&(sampled_code_data_[sat][i * samples_per_code_[sat]]),
code.data(), sizeof(gr_complex) * samples_per_code_[sat]);
std::copy_n(code.data(), samples_per_code_[sat],
&(sampled_code_data_[sat][i * samples_per_code_[sat]]));
}
// Generate E6C signal (100 code-periods, with secondary code)
galileo_e6_c_code_gen_complex_sampled(sampled_code_pilot_[sat], PRN_[sat], fs_in_,
@ -297,8 +298,8 @@ void signal_generator_c::generate_codes()
// Concatenate "num_of_codes_per_vector_" codes
for (unsigned int i = 0; i < num_of_codes_per_vector_[sat]; i++)
{
memcpy(&(sampled_code_data_[sat][i * samples_per_code_[sat]]),
code.data(), sizeof(gr_complex) * samples_per_code_[sat]);
std::copy_n(code.data(), samples_per_code_[sat],
&(sampled_code_data_[sat][i * samples_per_code_[sat]]));
}
// Generate E1C signal (25 code-periods, with secondary code)

View File

@ -148,7 +148,7 @@ endif()
target_include_directories(signal_source_adapters
PUBLIC
${CMAKE_SOURCE_DIR}/src/core/interfaces
${GNSSSDR_SOURCE_DIR}/src/core/interfaces
)
if(ENABLE_FPGA OR ENABLE_AD9361)

View File

@ -42,6 +42,7 @@ OsmosdrSignalSource::OsmosdrSignalSource(const ConfigurationInterface* configura
gain_(configuration->property(role + ".gain", 40.0)),
if_gain_(configuration->property(role + ".if_gain", 40.0)),
rf_gain_(configuration->property(role + ".rf_gain", 40.0)),
if_bw_(configuration->property(role + ".if_bw", 0.0)),
samples_(configuration->property(role + ".samples", static_cast<int64_t>(0))),
in_stream_(in_stream),
out_stream_(out_stream),
@ -118,6 +119,12 @@ OsmosdrSignalSource::OsmosdrSignalSource(const ConfigurationInterface* configura
}
}
// 5. set bandwidth
if (if_bw_ > 0.0)
{
osmosdr_source_->set_bandwidth(if_bw_, 0);
}
// Get actual bandwidth
std::cout << "Actual Bandwidth: " << osmosdr_source_->get_bandwidth(0) << " [Hz]...\n";
}

View File

@ -79,6 +79,7 @@ private:
double gain_;
double if_gain_;
double rf_gain_;
double if_bw_;
size_t item_size_;
int64_t samples_;

View File

@ -76,7 +76,7 @@ target_link_libraries(signal_source_gr_blocks
target_include_directories(signal_source_gr_blocks
PUBLIC
${CMAKE_SOURCE_DIR}/src/core/receiver
${GNSSSDR_SOURCE_DIR}/src/core/receiver
)
if(GNURADIO_USES_STD_POINTERS)

View File

@ -69,9 +69,9 @@ target_link_libraries(signal_source_libs
target_include_directories(signal_source_libs
PUBLIC
${CMAKE_SOURCE_DIR}/src/core/receiver
${CMAKE_SOURCE_DIR}/src/core/interfaces
${CMAKE_SOURCE_DIR}/src/algorithms/libs
${GNSSSDR_SOURCE_DIR}/src/core/receiver
${GNSSSDR_SOURCE_DIR}/src/core/interfaces
${GNSSSDR_SOURCE_DIR}/src/algorithms/libs
)
if(GNURADIO_USES_STD_POINTERS)

View File

@ -66,7 +66,7 @@ target_link_libraries(telemetry_decoder_adapters
target_include_directories(telemetry_decoder_adapters
PUBLIC
${CMAKE_SOURCE_DIR}/src/core/interfaces
${GNSSSDR_SOURCE_DIR}/src/core/interfaces
)
if(ENABLE_CLANG_TIDY)

View File

@ -79,12 +79,12 @@ endif()
target_include_directories(telemetry_decoder_gr_blocks
PUBLIC
${CMAKE_SOURCE_DIR}/src/core/interfaces
${GNSSSDR_SOURCE_DIR}/src/core/interfaces
)
target_include_directories(telemetry_decoder_gr_blocks
PRIVATE
${CMAKE_SOURCE_DIR}/src/algorithms/libs # for gnss_sdr_make_unique.h
${GNSSSDR_SOURCE_DIR}/src/algorithms/libs # for gnss_sdr_make_unique.h
)
if(has_rotl)

View File

@ -264,7 +264,7 @@ void beidou_b1i_telemetry_decoder_gs::decode_subframe(float *frame_symbols)
d_nav_msg_packet.nav_message = data_bits;
}
if (d_satellite.get_PRN() > 0 && d_satellite.get_PRN() < 6)
if ((d_satellite.get_PRN() > 0 && d_satellite.get_PRN() < 6) || d_satellite.get_PRN() > 58)
{
d_nav.d2_subframe_decoder(data_bits);
}
@ -339,7 +339,7 @@ void beidou_b1i_telemetry_decoder_gs::set_satellite(const Gnss_Satellite &satell
d_nav.set_signal_type(1); // BDS: data source (0:unknown,1:B1I,2:B1Q,3:B2I,4:B2Q,5:B3I,6:B3Q)
// Update tel dec parameters for D2 NAV Messages
if (sat_prn > 0 && sat_prn < 6)
if ((sat_prn > 0 && sat_prn < 6) || sat_prn > 58)
{
d_symbols_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS;
d_samples_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS;

View File

@ -356,7 +356,7 @@ void beidou_b3i_telemetry_decoder_gs::set_satellite(
d_nav.set_signal_type(5); // BDS: data source (0:unknown,1:B1I,2:B1Q,3:B2I,4:B2Q,5:B3I,6:B3Q)
// Update tel dec parameters for D2 NAV Messages
if (sat_prn > 0 && sat_prn < 6)
if ((sat_prn > 0 && sat_prn < 6) || sat_prn > 58)
{
d_symbols_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS;
d_samples_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS;

View File

@ -54,7 +54,7 @@ target_link_libraries(telemetry_decoder_libs
target_include_directories(telemetry_decoder_libs
PUBLIC
${CMAKE_SOURCE_DIR}/src/core/interfaces
${GNSSSDR_SOURCE_DIR}/src/core/interfaces
)
if(ENABLE_CLANG_TIDY)

View File

@ -105,7 +105,7 @@ target_link_libraries(tracking_adapters
target_include_directories(tracking_adapters
PUBLIC
${CMAKE_SOURCE_DIR}/src/core/interfaces
${GNSSSDR_SOURCE_DIR}/src/core/interfaces
)
if(ENABLE_FPGA)

View File

@ -96,7 +96,7 @@ endif()
target_include_directories(tracking_gr_blocks
PUBLIC
${CMAKE_SOURCE_DIR}/src/core/interfaces
${GNSSSDR_SOURCE_DIR}/src/core/interfaces
)
if(ENABLE_CUDA)

View File

@ -109,6 +109,7 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_)
d_state(0), // initial state: standby
d_current_prn_length_samples(static_cast<int32_t>(d_trk_parameters.vector_length)),
d_extend_correlation_symbols_count(0),
d_extend_correlation_symbols(d_trk_parameters.extend_correlation_symbols),
d_cn0_estimation_counter(0),
d_carrier_lock_fail_counter(0),
d_code_lock_fail_counter(0),
@ -652,6 +653,7 @@ void dll_pll_veml_tracking::start_tracking()
Signal_[0] = d_acquisition_gnss_synchro->Signal[0];
Signal_[1] = d_acquisition_gnss_synchro->Signal[1];
Signal_[2] = d_acquisition_gnss_synchro->Signal[2];
d_extend_correlation_symbols = d_trk_parameters.extend_correlation_symbols;
if (d_systemName == "GPS" and d_signal_type == "1C")
{
@ -757,7 +759,7 @@ void dll_pll_veml_tracking::start_tracking()
{
beidou_b1i_code_gen_float(d_tracking_code, d_acquisition_gnss_synchro->PRN, 0);
// GEO Satellites use different secondary code
if (d_acquisition_gnss_synchro->PRN > 0 and d_acquisition_gnss_synchro->PRN < 6)
if ((d_acquisition_gnss_synchro->PRN > 0 and d_acquisition_gnss_synchro->PRN < 6) or (d_acquisition_gnss_synchro->PRN > 58))
{
d_symbols_per_bit = BEIDOU_B1I_GEO_TELEMETRY_SYMBOLS_PER_BIT; // todo: enable after fixing beidou symbol synchronization
d_correlation_length_ms = 1;
@ -769,6 +771,10 @@ void dll_pll_veml_tracking::start_tracking()
d_secondary_code_string = BEIDOU_B1I_GEO_PREAMBLE_SYMBOLS_STR;
d_data_secondary_code_length = 0;
d_Prompt_circular_buffer.set_capacity(d_secondary_code_length);
if (d_extend_correlation_symbols > BEIDOU_B1I_GEO_TELEMETRY_SYMBOLS_PER_BIT)
{
d_extend_correlation_symbols = BEIDOU_B1I_GEO_TELEMETRY_SYMBOLS_PER_BIT;
}
}
else
{
@ -790,7 +796,7 @@ void dll_pll_veml_tracking::start_tracking()
{
beidou_b3i_code_gen_float(d_tracking_code, d_acquisition_gnss_synchro->PRN, 0);
// Update secondary code settings for geo satellites
if (d_acquisition_gnss_synchro->PRN > 0 and d_acquisition_gnss_synchro->PRN < 6)
if ((d_acquisition_gnss_synchro->PRN > 0 and d_acquisition_gnss_synchro->PRN < 6) or (d_acquisition_gnss_synchro->PRN > 58))
{
d_symbols_per_bit = BEIDOU_B3I_GEO_TELEMETRY_SYMBOLS_PER_BIT; // todo: enable after fixing beidou symbol synchronization
d_correlation_length_ms = 1;
@ -802,6 +808,10 @@ void dll_pll_veml_tracking::start_tracking()
d_secondary_code_string = BEIDOU_B3I_GEO_PREAMBLE_SYMBOLS_STR;
d_data_secondary_code_length = 0;
d_Prompt_circular_buffer.set_capacity(d_secondary_code_length);
if (d_extend_correlation_symbols > BEIDOU_B3I_GEO_TELEMETRY_SYMBOLS_PER_BIT)
{
d_extend_correlation_symbols = BEIDOU_B3I_GEO_TELEMETRY_SYMBOLS_PER_BIT;
}
}
else
{
@ -1876,12 +1886,12 @@ int dll_pll_veml_tracking::general_work(int noutput_items __attribute__((unused)
{
// UPDATE INTEGRATION TIME
d_extend_correlation_symbols_count = 0;
d_current_correlation_time_s = static_cast<float>(d_trk_parameters.extend_correlation_symbols) * static_cast<float>(d_code_period);
d_current_correlation_time_s = static_cast<float>(d_extend_correlation_symbols) * static_cast<float>(d_code_period);
d_state = 3; // next state is the extended correlator integrator
LOG(INFO) << "Enabled " << d_trk_parameters.extend_correlation_symbols * static_cast<int32_t>(d_code_period * 1000.0) << " ms extended correlator in channel "
LOG(INFO) << "Enabled " << d_extend_correlation_symbols * static_cast<int32_t>(d_code_period * 1000.0) << " ms extended correlator in channel "
<< d_channel
<< " for satellite " << Gnss_Satellite(d_systemName, d_acquisition_gnss_synchro->PRN);
std::cout << "Enabled " << d_trk_parameters.extend_correlation_symbols * static_cast<int32_t>(d_code_period * 1000.0) << " ms extended correlator in channel "
std::cout << "Enabled " << d_extend_correlation_symbols * static_cast<int32_t>(d_code_period * 1000.0) << " ms extended correlator in channel "
<< d_channel
<< " for satellite " << Gnss_Satellite(d_systemName, d_acquisition_gnss_synchro->PRN) << '\n';
// Set narrow taps delay values [chips]
@ -1947,7 +1957,7 @@ int dll_pll_veml_tracking::general_work(int noutput_items __attribute__((unused)
d_P_data_accu = gr_complex(0.0, 0.0);
}
d_extend_correlation_symbols_count++;
if (d_extend_correlation_symbols_count == (d_trk_parameters.extend_correlation_symbols - 1))
if (d_extend_correlation_symbols_count == (d_extend_correlation_symbols - 1))
{
d_extend_correlation_symbols_count = 0;
d_state = 4;
@ -1961,7 +1971,7 @@ int dll_pll_veml_tracking::general_work(int noutput_items __attribute__((unused)
save_correlation_results();
// check lock status
if (!cn0_and_tracking_lock_status(d_code_period * static_cast<double>(d_trk_parameters.extend_correlation_symbols)))
if (!cn0_and_tracking_lock_status(d_code_period * static_cast<double>(d_extend_correlation_symbols)))
{
clear_tracking_vars();
d_state = 0; // loss-of-lock detected

View File

@ -180,6 +180,7 @@ private:
int32_t d_n_correlator_taps;
int32_t d_current_prn_length_samples;
int32_t d_extend_correlation_symbols_count;
int32_t d_extend_correlation_symbols;
int32_t d_current_symbol;
int32_t d_current_data_symbol;
int32_t d_cn0_estimation_counter;

View File

@ -732,7 +732,7 @@ void kf_vtl_tracking::start_tracking()
{
beidou_b1i_code_gen_float(d_tracking_code, d_acquisition_gnss_synchro->PRN, 0);
// GEO Satellites use different secondary code
if (d_acquisition_gnss_synchro->PRN > 0 and d_acquisition_gnss_synchro->PRN < 6)
if ((d_acquisition_gnss_synchro->PRN > 0 and d_acquisition_gnss_synchro->PRN < 6) or d_acquisition_gnss_synchro->PRN > 58)
{
d_symbols_per_bit = BEIDOU_B1I_GEO_TELEMETRY_SYMBOLS_PER_BIT; // todo: enable after fixing beidou symbol synchronization
d_correlation_length_ms = 1;
@ -765,7 +765,7 @@ void kf_vtl_tracking::start_tracking()
{
beidou_b3i_code_gen_float(d_tracking_code, d_acquisition_gnss_synchro->PRN, 0);
// Update secondary code settings for geo satellites
if (d_acquisition_gnss_synchro->PRN > 0 and d_acquisition_gnss_synchro->PRN < 6)
if ((d_acquisition_gnss_synchro->PRN > 0 and d_acquisition_gnss_synchro->PRN < 6) or d_acquisition_gnss_synchro->PRN > 58)
{
d_symbols_per_bit = BEIDOU_B3I_GEO_TELEMETRY_SYMBOLS_PER_BIT; // todo: enable after fixing beidou symbol synchronization
d_correlation_length_ms = 1;
@ -844,18 +844,17 @@ void kf_vtl_tracking::init_kf(double acq_code_phase_chips, double acq_doppler_hz
const double Ti = d_correlation_length_ms * 0.001;
// state vector: code_phase_chips, carrier_phase_rads, carrier_freq_hz,carrier_freq_rate_hz, code_freq_chips_s
d_F = arma::mat(5, 5);
d_F << 1 << 0 << 0 << 0 << Ti << arma::endr
<< 0 << 1 << 2.0 * GNSS_PI * Ti << GNSS_PI * (Ti * Ti) << 0 << arma::endr
<< 0 << 0 << 1 << Ti << 0 << arma::endr
<< 0 << 0 << 0 << 1 << 0 << arma::endr
<< 0 << 0 << 0 << 0 << 1 << arma::endr;
d_F = {{1, 0, 0, 0, Ti},
{0, 1, 2.0 * GNSS_PI * Ti, GNSS_PI * (Ti * Ti), 0},
{0, 0, 1, Ti, 0},
{0, 0, 0, 1, 0},
{0, 0, 0, 0, 1}};
const double B = d_code_chip_rate / d_signal_carrier_freq; // carrier to code rate factor
d_H = arma::mat(2, 5);
d_H << 1 << 0 << -B * Ti / 2.0 << B * (Ti * Ti) / 6.0 << 0 << arma::endr
<< 0 << 1 << -GNSS_PI * Ti << GNSS_PI * (Ti * Ti) / 3.0 << 0 << arma::endr;
d_H = {{1, 0, -B * Ti / 2.0, B * (Ti * Ti) / 6.0, 0},
{0, 1, -GNSS_PI * Ti, GNSS_PI * (Ti * Ti) / 3.0, 0}};
// Phase noise variance
// const double CN0_lin = pow(10.0, d_trk_parameters.expected_cn0_dbhz / 10.0); // CN0 in Hz
// const double N_periods = 1; // Only 1 interval
@ -866,32 +865,26 @@ void kf_vtl_tracking::init_kf(double acq_code_phase_chips, double acq_doppler_hz
d_R = arma::mat(2, 2);
// d_R << Sigma2_Tau << 0 << arma::endr
// << 0 << Sigma2_Phase << arma::endr;
d_R << pow(d_trk_parameters.code_disc_sd_chips, 2.0) << 0 << arma::endr
<< 0 << pow(d_trk_parameters.carrier_disc_sd_rads, 2.0) << arma::endr;
d_R = {{pow(d_trk_parameters.code_disc_sd_chips, 2.0), 0},
{0, pow(d_trk_parameters.carrier_disc_sd_rads, 2.0)}};
// system covariance matrix (static)
d_Q = arma::mat(5, 5);
d_Q << pow(d_trk_parameters.code_phase_sd_chips, 2.0) << 0 << 0 << 0 << 0 << arma::endr
<< 0 << pow(d_trk_parameters.carrier_phase_sd_rad, 2.0) << 0 << 0 << 0 << arma::endr
<< 0 << 0 << pow(d_trk_parameters.carrier_freq_sd_hz, 2.0) << 0 << 0 << arma::endr
<< 0 << 0 << 0 << pow(d_trk_parameters.carrier_freq_rate_sd_hz_s, 2.0) << 0 << arma::endr
<< 0 << 0 << 0 << 0 << pow(d_trk_parameters.code_rate_sd_chips_s, 2.0) << arma::endr;
d_Q = {{pow(d_trk_parameters.code_phase_sd_chips, 2.0), 0, 0, 0, 0},
{0, pow(d_trk_parameters.carrier_phase_sd_rad, 2.0), 0, 0, 0},
{0, 0, pow(d_trk_parameters.carrier_freq_sd_hz, 2.0), 0, 0},
{0, 0, 0, pow(d_trk_parameters.carrier_freq_rate_sd_hz_s, 2.0), 0},
{0, 0, 0, 0, pow(d_trk_parameters.code_rate_sd_chips_s, 2.0)}};
// initial Kalman covariance matrix
d_P_old_old = arma::mat(5, 5);
d_P_old_old << pow(d_trk_parameters.init_code_phase_sd_chips, 2.0) << 0 << 0 << 0 << 0 << arma::endr
<< 0 << pow(d_trk_parameters.init_carrier_phase_sd_rad, 2.0) << 0 << 0 << 0 << arma::endr
<< 0 << 0 << pow(d_trk_parameters.init_carrier_freq_sd_hz, 2.0) << 0 << 0 << arma::endr
<< 0 << 0 << 0 << pow(d_trk_parameters.init_carrier_freq_rate_sd_hz_s, 2.0) << 0 << arma::endr
<< 0 << 0 << 0 << 0 << pow(d_trk_parameters.init_code_rate_sd_chips_s, 2.0) << arma::endr;
d_P_old_old = {{pow(d_trk_parameters.init_code_phase_sd_chips, 2.0), 0, 0, 0, 0},
{0, pow(d_trk_parameters.init_carrier_phase_sd_rad, 2.0), 0, 0, 0},
{0, 0, pow(d_trk_parameters.init_carrier_freq_rate_sd_hz_s, 2.0), 0, 0},
{0, 0, 0, pow(d_trk_parameters.init_carrier_freq_rate_sd_hz_s, 2.0), 0},
{0, 0, 0, 0, pow(d_trk_parameters.init_code_rate_sd_chips_s, 2.0)}};
// init state vector
d_x_old_old = arma::vec(5);
// states: code_phase_chips, carrier_phase_rads, carrier_freq_hz, carrier_freq_rate_hz_s, code_freq_rate_chips_s
d_x_old_old << acq_code_phase_chips << 0 << acq_doppler_hz << 0 << 0 << arma::endr;
d_x_old_old = {acq_code_phase_chips, 0, acq_doppler_hz, 0, 0};
// std::cout << "F: " << d_F << "\n";
// std::cout << "H: " << d_H << "\n";
// std::cout << "R: " << d_R << "\n";
@ -907,27 +900,26 @@ void kf_vtl_tracking::update_kf_narrow_integration_time()
const double Ti = d_current_correlation_time_s;
// state vector: code_phase_chips, carrier_phase_rads, carrier_freq_hz,carrier_freq_rate_hz, code_freq_chips_s
d_F << 1 << 0 << 0 << 0 << Ti << arma::endr
<< 0 << 1 << 2.0 * GNSS_PI * Ti << GNSS_PI * (Ti * Ti) << 0 << arma::endr
<< 0 << 0 << 1 << Ti << 0 << arma::endr
<< 0 << 0 << 0 << 1 << 0 << arma::endr
<< 0 << 0 << 0 << 0 << 1 << arma::endr;
d_F = {{1, 0, 0, 0, Ti},
{0, 1, 2.0 * GNSS_PI * Ti, GNSS_PI * (Ti * Ti), 0},
{0, 0, 1, Ti, 0},
{0, 0, 0, 1, 0},
{0, 0, 0, 0, 1}};
const double B = d_code_chip_rate / d_signal_carrier_freq; // carrier to code rate factor
d_H << 1 << 0 << -B * Ti / 2.0 << B * (Ti * Ti) / 6.0 << 0 << arma::endr
<< 0 << 1 << -GNSS_PI * Ti << GNSS_PI * (Ti * Ti) / 3.0 << 0 << arma::endr;
d_H = {{1, 0, -B * Ti / 2.0, B * (Ti * Ti) / 6.0, 0},
{0, 1, -GNSS_PI * Ti, GNSS_PI * (Ti * Ti) / 3.0, 0}};
// measurement covariance matrix (static)
d_R << pow(d_trk_parameters.code_disc_sd_chips, 2.0) << 0 << arma::endr
<< 0 << pow(d_trk_parameters.carrier_disc_sd_rads, 2.0) << arma::endr;
d_R = {{pow(d_trk_parameters.code_disc_sd_chips, 2.0), 0},
{0, pow(d_trk_parameters.carrier_disc_sd_rads, 2.0)}};
// system covariance matrix (static)
d_Q << pow(d_trk_parameters.narrow_code_phase_sd_chips, 2.0) << 0 << 0 << 0 << 0 << arma::endr
<< 0 << pow(d_trk_parameters.narrow_carrier_phase_sd_rad, 2.0) << 0 << 0 << 0 << arma::endr
<< 0 << 0 << pow(d_trk_parameters.narrow_carrier_freq_sd_hz, 2.0) << 0 << 0 << arma::endr
<< 0 << 0 << 0 << pow(d_trk_parameters.narrow_carrier_freq_rate_sd_hz_s, 2.0) << 0 << arma::endr
<< 0 << 0 << 0 << 0 << pow(d_trk_parameters.narrow_code_rate_sd_chips_s, 2.0) << arma::endr;
d_Q = {{pow(d_trk_parameters.narrow_code_phase_sd_chips, 2.0), 0, 0, 0, 0},
{0, pow(d_trk_parameters.narrow_carrier_phase_sd_rad, 2.0), 0, 0, 0},
{0, 0, pow(d_trk_parameters.narrow_carrier_freq_sd_hz, 2.0), 0, 0},
{0, 0, 0, pow(d_trk_parameters.narrow_carrier_freq_rate_sd_hz_s, 2.0), 0},
{0, 0, 0, 0, pow(d_trk_parameters.narrow_code_rate_sd_chips_s, 2.0)}};
}
@ -938,8 +930,8 @@ void kf_vtl_tracking::update_kf_cn0(double current_cn0_dbhz)
const double B = d_code_chip_rate / d_signal_carrier_freq; // carrier to code rate factor
d_H = arma::mat(2, 5);
d_H << 1 << 0 << -B * Ti / 2.0 << B * (Ti * Ti) / 6.0 << 0 << arma::endr
<< 0 << 1 << -GNSS_PI * Ti << GNSS_PI * (Ti * Ti) / 3.0 << 0 << arma::endr;
d_H = {{1, 0, -B * Ti / 2.0, B * (Ti * Ti) / 6.0, 0},
{0, 1, -GNSS_PI * Ti, GNSS_PI * (Ti * Ti) / 3.0, 0}};
// Phase noise variance
const double CN0_lin = pow(10.0, current_cn0_dbhz / 10.0); // CN0 in Hz
@ -949,8 +941,8 @@ void kf_vtl_tracking::update_kf_cn0(double current_cn0_dbhz)
// measurement covariance matrix (static)
d_R = arma::mat(2, 2);
d_R << Sigma2_Tau << 0 << arma::endr
<< 0 << Sigma2_Phase << arma::endr;
d_R = {{Sigma2_Tau, 0},
{0, Sigma2_Phase}};
}

View File

@ -144,7 +144,7 @@ endif()
target_include_directories(tracking_libs
PUBLIC
${CMAKE_SOURCE_DIR}/src/core/interfaces
${GNSSSDR_SOURCE_DIR}/src/core/interfaces
)
if(ENABLE_CLANG_TIDY)

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