1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-15 04:30:33 +00:00

Merge branch 'span' into next

Use std::span when available, and gsl::span as a fallback
This commit is contained in:
Carles Fernandez 2020-05-08 08:29:02 +02:00
commit 9b071575c0
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
58 changed files with 380 additions and 155 deletions

View File

@ -533,9 +533,7 @@ set(FILESYSTEM_FOUND FALSE)
if(NOT (GNURADIO_VERSION VERSION_LESS 3.8) AND LOG4CPP_READY_FOR_CXX17) if(NOT (GNURADIO_VERSION VERSION_LESS 3.8) AND LOG4CPP_READY_FOR_CXX17)
# Check if we have std::filesystem # Check if we have std::filesystem
if(NOT (CMAKE_VERSION VERSION_LESS 3.8)) if(NOT (CMAKE_VERSION VERSION_LESS 3.8))
if((NOT (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")) if(NOT (ENABLE_UNIT_TESTING_EXTRA OR ENABLE_SYSTEM_TESTING_EXTRA OR ENABLE_FPGA)) # Fix for GPTSk
OR NOT (ENABLE_UNIT_TESTING_EXTRA OR ENABLE_SYSTEM_TESTING_EXTRA OR ENABLE_FPGA))
# Fix for GPTSk
find_package(FILESYSTEM COMPONENTS Final Experimental) find_package(FILESYSTEM COMPONENTS Final Experimental)
set_package_properties(FILESYSTEM PROPERTIES set_package_properties(FILESYSTEM PROPERTIES
URL "https://en.cppreference.com/w/cpp/filesystem" URL "https://en.cppreference.com/w/cpp/filesystem"
@ -557,6 +555,19 @@ endif()
################################################################################
# Detect availability of std::span
################################################################################
include(CheckCXXSourceCompiles)
check_cxx_source_compiles("
#include <span>
int main()
{ std::span<float> s; }"
has_span
)
################################################################################ ################################################################################
# Boost - https://www.boost.org # Boost - https://www.boost.org
################################################################################ ################################################################################

View File

@ -26,6 +26,7 @@ SPDX-FileCopyrightText: 2011-2020 Carles Fernandez-Prades <carles.fernandez@cttc
- The software can now be cross-compiled on Petalinux environments. - The software can now be cross-compiled on Petalinux environments.
- Fixes building with GCC 10 (gcc-10 and above flipped a default from `-fcommon` - Fixes building with GCC 10 (gcc-10 and above flipped a default from `-fcommon`
to `-fno-common`, causing an error due to multiple defined lambda functions). to `-fno-common`, causing an error due to multiple defined lambda functions).
- Make use of `std::span` if the compiler supports it.
### Improvements in Reliability: ### Improvements in Reliability:

View File

@ -106,6 +106,12 @@ if(GNURADIO_USES_STD_POINTERS)
) )
endif() endif()
if(has_span)
target_compile_definitions(acquisition_adapters
PRIVATE -DHAS_STD_SPAN=1
)
endif()
if(ENABLE_FPGA) if(ENABLE_FPGA)
target_link_libraries(acquisition_adapters target_link_libraries(acquisition_adapters
PRIVATE PRIVATE

View File

@ -30,6 +30,14 @@
#include <algorithm> #include <algorithm>
#include <memory> #include <memory>
#if HAS_STD_SPAN
#include <span>
namespace own = std;
#else
#include <gsl/gsl>
namespace own = gsl;
#endif
BeidouB1iPcpsAcquisition::BeidouB1iPcpsAcquisition( BeidouB1iPcpsAcquisition::BeidouB1iPcpsAcquisition(
ConfigurationInterface* configuration, ConfigurationInterface* configuration,
@ -140,7 +148,7 @@ void BeidouB1iPcpsAcquisition::set_local_code()
beidou_b1i_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_, 0); beidou_b1i_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_, 0);
gsl::span<gr_complex> code_span(code_.data(), vector_length_); own::span<gr_complex> code_span(code_.data(), vector_length_);
for (unsigned int i = 0; i < num_codes_; i++) for (unsigned int i = 0; i < num_codes_; i++)
{ {
std::copy_n(code.data(), code_length_, code_span.subspan(i * code_length_, code_length_).data()); std::copy_n(code.data(), code_length_, code_span.subspan(i * code_length_, code_length_).data());

View File

@ -27,6 +27,14 @@
#include <glog/logging.h> #include <glog/logging.h>
#include <algorithm> #include <algorithm>
#if HAS_STD_SPAN
#include <span>
namespace own = std;
#else
#include <gsl/gsl>
namespace own = gsl;
#endif
using google::LogMessage; using google::LogMessage;
BeidouB3iPcpsAcquisition::BeidouB3iPcpsAcquisition( BeidouB3iPcpsAcquisition::BeidouB3iPcpsAcquisition(
@ -137,7 +145,7 @@ void BeidouB3iPcpsAcquisition::set_local_code()
beidou_b3i_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_, 0); beidou_b3i_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_, 0);
gsl::span<gr_complex> code_span(code_.data(), vector_length_); own::span<gr_complex> code_span(code_.data(), vector_length_);
for (unsigned int i = 0; i < num_codes_; i++) for (unsigned int i = 0; i < num_codes_; i++)
{ {
std::copy_n(code.data(), code_length_, code_span.subspan(i * code_length_, code_length_).data()); std::copy_n(code.data(), code_length_, code_span.subspan(i * code_length_, code_length_).data());

View File

@ -27,6 +27,13 @@
#include <glog/logging.h> #include <glog/logging.h>
#include <algorithm> #include <algorithm>
#if HAS_STD_SPAN
#include <span>
namespace own = std;
#else
#include <gsl/gsl>
namespace own = gsl;
#endif
GalileoE1Pcps8msAmbiguousAcquisition::GalileoE1Pcps8msAmbiguousAcquisition( GalileoE1Pcps8msAmbiguousAcquisition::GalileoE1Pcps8msAmbiguousAcquisition(
ConfigurationInterface* configuration, ConfigurationInterface* configuration,
@ -208,7 +215,7 @@ void GalileoE1Pcps8msAmbiguousAcquisition::set_local_code()
galileo_e1_code_gen_complex_sampled(code, Signal_, galileo_e1_code_gen_complex_sampled(code, Signal_,
cboc, gnss_synchro_->PRN, fs_in_, 0, false); cboc, gnss_synchro_->PRN, fs_in_, 0, false);
gsl::span<gr_complex> code_span(code_.data(), vector_length_); own::span<gr_complex> code_span(code_.data(), vector_length_);
for (unsigned int i = 0; i < sampled_ms_ / 4; i++) for (unsigned int i = 0; i < sampled_ms_ / 4; i++)
{ {
std::copy_n(code.data(), code_length_, code_span.subspan(i * code_length_, code_length_).data()); std::copy_n(code.data(), code_length_, code_span.subspan(i * code_length_, code_length_).data());

View File

@ -28,6 +28,13 @@
#include <glog/logging.h> #include <glog/logging.h>
#include <algorithm> #include <algorithm>
#if HAS_STD_SPAN
#include <span>
namespace own = std;
#else
#include <gsl/gsl>
namespace own = gsl;
#endif
GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition( GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition(
ConfigurationInterface* configuration, ConfigurationInterface* configuration,
@ -182,7 +189,7 @@ void GalileoE1PcpsAmbiguousAcquisition::set_local_code()
} }
} }
gsl::span<gr_complex> code__span(code_.data(), vector_length_); own::span<gr_complex> code__span(code_.data(), vector_length_);
for (unsigned int i = 0; i < sampled_ms_ / 4; i++) for (unsigned int i = 0; i < sampled_ms_ / 4; i++)
{ {
std::copy_n(code.data(), code_length_, code__span.subspan(i * code_length_, code_length_).data()); std::copy_n(code.data(), code_length_, code__span.subspan(i * code_length_, code_length_).data());

View File

@ -27,6 +27,13 @@
#include <glog/logging.h> #include <glog/logging.h>
#include <algorithm> #include <algorithm>
#if HAS_STD_SPAN
#include <span>
namespace own = std;
#else
#include <gsl/gsl>
namespace own = gsl;
#endif
GalileoE1PcpsQuickSyncAmbiguousAcquisition::GalileoE1PcpsQuickSyncAmbiguousAcquisition( GalileoE1PcpsQuickSyncAmbiguousAcquisition::GalileoE1PcpsQuickSyncAmbiguousAcquisition(
ConfigurationInterface* configuration, ConfigurationInterface* configuration,
@ -242,7 +249,7 @@ void GalileoE1PcpsQuickSyncAmbiguousAcquisition::set_local_code()
galileo_e1_code_gen_complex_sampled(code, Signal_, galileo_e1_code_gen_complex_sampled(code, Signal_,
cboc, gnss_synchro_->PRN, fs_in_, 0, false); cboc, gnss_synchro_->PRN, fs_in_, 0, false);
gsl::span<gr_complex> code_span(code_.data(), vector_length_); own::span<gr_complex> code_span(code_.data(), vector_length_);
for (unsigned int i = 0; i < (sampled_ms_ / (folding_factor_ * 4)); i++) for (unsigned int i = 0; i < (sampled_ms_ / (folding_factor_ * 4)); i++)
{ {
std::copy_n(code.data(), code_length_, code_span.subspan(i * code_length_, code_length_).data()); std::copy_n(code.data(), code_length_, code_span.subspan(i * code_length_, code_length_).data());

View File

@ -27,6 +27,13 @@
#include <glog/logging.h> #include <glog/logging.h>
#include <algorithm> #include <algorithm>
#if HAS_STD_SPAN
#include <span>
namespace own = std;
#else
#include <gsl/gsl>
namespace own = gsl;
#endif
GalileoE1PcpsTongAmbiguousAcquisition::GalileoE1PcpsTongAmbiguousAcquisition( GalileoE1PcpsTongAmbiguousAcquisition::GalileoE1PcpsTongAmbiguousAcquisition(
ConfigurationInterface* configuration, ConfigurationInterface* configuration,
@ -211,7 +218,7 @@ void GalileoE1PcpsTongAmbiguousAcquisition::set_local_code()
galileo_e1_code_gen_complex_sampled(code, Signal_, galileo_e1_code_gen_complex_sampled(code, Signal_,
cboc, gnss_synchro_->PRN, fs_in_, 0, false); cboc, gnss_synchro_->PRN, fs_in_, 0, false);
gsl::span<gr_complex> code_span(code_.data(), vector_length_); own::span<gr_complex> code_span(code_.data(), vector_length_);
for (unsigned int i = 0; i < sampled_ms_ / 4; i++) for (unsigned int i = 0; i < sampled_ms_ / 4; i++)
{ {
std::copy_n(code.data(), code_length_, code_span.subspan(i * code_length_, code_length_).data()); std::copy_n(code.data(), code_length_, code_span.subspan(i * code_length_, code_length_).data());

View File

@ -33,6 +33,13 @@
#include <glog/logging.h> #include <glog/logging.h>
#include <algorithm> #include <algorithm>
#if HAS_STD_SPAN
#include <span>
namespace own = std;
#else
#include <gsl/gsl>
namespace own = gsl;
#endif
GalileoE5aNoncoherentIQAcquisitionCaf::GalileoE5aNoncoherentIQAcquisitionCaf( GalileoE5aNoncoherentIQAcquisitionCaf::GalileoE5aNoncoherentIQAcquisitionCaf(
ConfigurationInterface* configuration, ConfigurationInterface* configuration,
@ -226,8 +233,8 @@ void GalileoE5aNoncoherentIQAcquisitionCaf::set_local_code()
} }
// WARNING: 3ms are coherently integrated. Secondary sequence (1,1,1) // WARNING: 3ms are coherently integrated. Secondary sequence (1,1,1)
// is generated, and modulated in the 'block'. // is generated, and modulated in the 'block'.
gsl::span<gr_complex> codeQ_span(codeQ_.data(), vector_length_); own::span<gr_complex> codeQ_span(codeQ_.data(), vector_length_);
gsl::span<gr_complex> codeI_span(codeI_.data(), vector_length_); own::span<gr_complex> codeI_span(codeI_.data(), vector_length_);
if (Zero_padding == 0) // if no zero_padding if (Zero_padding == 0) // if no zero_padding
{ {
for (unsigned int i = 0; i < sampled_ms_; i++) for (unsigned int i = 0; i < sampled_ms_; i++)

View File

@ -27,6 +27,13 @@
#include <volk_gnsssdr/volk_gnsssdr_complex.h> #include <volk_gnsssdr/volk_gnsssdr_complex.h>
#include <algorithm> #include <algorithm>
#if HAS_STD_SPAN
#include <span>
namespace own = std;
#else
#include <gsl/gsl>
namespace own = gsl;
#endif
GalileoE5aPcpsAcquisition::GalileoE5aPcpsAcquisition(ConfigurationInterface* configuration, GalileoE5aPcpsAcquisition::GalileoE5aPcpsAcquisition(ConfigurationInterface* configuration,
const std::string& role, const std::string& role,
@ -166,7 +173,7 @@ void GalileoE5aPcpsAcquisition::set_local_code()
{ {
galileo_e5_a_code_gen_complex_sampled(code, signal_, gnss_synchro_->PRN, fs_in_, 0); galileo_e5_a_code_gen_complex_sampled(code, signal_, gnss_synchro_->PRN, fs_in_, 0);
} }
gsl::span<gr_complex> code_span(code_.data(), vector_length_); own::span<gr_complex> code_span(code_.data(), vector_length_);
for (unsigned int i = 0; i < sampled_ms_; i++) for (unsigned int i = 0; i < sampled_ms_; i++)
{ {
std::copy_n(code.data(), code_length_, code_span.subspan(i * code_length_, code_length_).data()); std::copy_n(code.data(), code_length_, code_span.subspan(i * code_length_, code_length_).data());

View File

@ -29,6 +29,13 @@
#include <glog/logging.h> #include <glog/logging.h>
#include <algorithm> #include <algorithm>
#if HAS_STD_SPAN
#include <span>
namespace own = std;
#else
#include <gsl/gsl>
namespace own = gsl;
#endif
GlonassL1CaPcpsAcquisition::GlonassL1CaPcpsAcquisition( GlonassL1CaPcpsAcquisition::GlonassL1CaPcpsAcquisition(
ConfigurationInterface* configuration, ConfigurationInterface* configuration,
@ -142,7 +149,7 @@ void GlonassL1CaPcpsAcquisition::set_local_code()
glonass_l1_ca_code_gen_complex_sampled(code, fs_in_, 0); glonass_l1_ca_code_gen_complex_sampled(code, fs_in_, 0);
gsl::span<gr_complex> code_span(code_.data(), vector_length_); own::span<gr_complex> code_span(code_.data(), vector_length_);
for (unsigned int i = 0; i < sampled_ms_; i++) for (unsigned int i = 0; i < sampled_ms_; i++)
{ {
std::copy_n(code.data(), code_length_, code_span.subspan(i * code_length_, code_length_).data()); std::copy_n(code.data(), code_length_, code_span.subspan(i * code_length_, code_length_).data());

View File

@ -28,6 +28,13 @@
#include <glog/logging.h> #include <glog/logging.h>
#include <algorithm> #include <algorithm>
#if HAS_STD_SPAN
#include <span>
namespace own = std;
#else
#include <gsl/gsl>
namespace own = gsl;
#endif
GlonassL2CaPcpsAcquisition::GlonassL2CaPcpsAcquisition( GlonassL2CaPcpsAcquisition::GlonassL2CaPcpsAcquisition(
ConfigurationInterface* configuration, ConfigurationInterface* configuration,
@ -141,7 +148,7 @@ void GlonassL2CaPcpsAcquisition::set_local_code()
glonass_l2_ca_code_gen_complex_sampled(code, fs_in_, 0); glonass_l2_ca_code_gen_complex_sampled(code, fs_in_, 0);
gsl::span<gr_complex> code_span(code_.data(), vector_length_); own::span<gr_complex> code_span(code_.data(), vector_length_);
for (unsigned int i = 0; i < sampled_ms_; i++) for (unsigned int i = 0; i < sampled_ms_; i++)
{ {
std::copy_n(code.data(), code_length_, code_span.subspan(i * code_length_, code_length_).data()); std::copy_n(code.data(), code_length_, code_span.subspan(i * code_length_, code_length_).data());

View File

@ -29,9 +29,15 @@
#include "gnss_sdr_flags.h" #include "gnss_sdr_flags.h"
#include "gps_sdr_signal_processing.h" #include "gps_sdr_signal_processing.h"
#include <glog/logging.h> #include <glog/logging.h>
#include <gsl/gsl>
#include <algorithm> #include <algorithm>
#if HAS_STD_SPAN
#include <span>
namespace own = std;
#else
#include <gsl/gsl>
namespace own = gsl;
#endif
GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition( GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition(
ConfigurationInterface* configuration, ConfigurationInterface* configuration,
@ -157,7 +163,7 @@ void GpsL1CaPcpsAcquisition::set_local_code()
{ {
gps_l1_ca_code_gen_complex_sampled(code, gnss_synchro_->PRN, acq_parameters_.fs_in, 0); gps_l1_ca_code_gen_complex_sampled(code, gnss_synchro_->PRN, acq_parameters_.fs_in, 0);
} }
gsl::span<gr_complex> code_span(code_.data(), vector_length_); own::span<gr_complex> code_span(code_.data(), vector_length_);
for (unsigned int i = 0; i < sampled_ms_; i++) for (unsigned int i = 0; i < sampled_ms_; i++)
{ {
std::copy_n(code.data(), code_length_, code_span.subspan(i * code_length_, code_length_).data()); std::copy_n(code.data(), code_length_, code_span.subspan(i * code_length_, code_length_).data());

View File

@ -59,7 +59,7 @@ GpsL1CaPcpsAssistedAcquisition::GpsL1CaPcpsAssistedAcquisition(
// --- Find number of samples per spreading code ------------------------- // --- Find number of samples per spreading code -------------------------
vector_length_ = round(fs_in_ / (GPS_L1_CA_CODE_RATE_CPS / GPS_L1_CA_CODE_LENGTH_CHIPS)); vector_length_ = round(fs_in_ / (GPS_L1_CA_CODE_RATE_CPS / GPS_L1_CA_CODE_LENGTH_CHIPS));
code_ = std::make_shared<std::complex<float>>(vector_length_); code_.reserve(vector_length_);
if (item_type_ == "gr_complex") if (item_type_ == "gr_complex")
{ {
@ -138,7 +138,7 @@ void GpsL1CaPcpsAssistedAcquisition::init()
void GpsL1CaPcpsAssistedAcquisition::set_local_code() void GpsL1CaPcpsAssistedAcquisition::set_local_code()
{ {
gps_l1_ca_code_gen_complex_sampled(code_, gnss_synchro_->PRN, fs_in_, 0); gps_l1_ca_code_gen_complex_sampled(code_, gnss_synchro_->PRN, fs_in_, 0);
acquisition_cc_->set_local_code(code_.get()); acquisition_cc_->set_local_code(code_.data());
} }

View File

@ -26,7 +26,6 @@
#include "channel_fsm.h" #include "channel_fsm.h"
#include "gnss_synchro.h" #include "gnss_synchro.h"
#include "pcps_assisted_acquisition_cc.h" #include "pcps_assisted_acquisition_cc.h"
#include <memory>
#include <string> #include <string>
#include <vector> #include <vector>
@ -150,7 +149,7 @@ private:
int64_t fs_in_; int64_t fs_in_;
bool dump_; bool dump_;
std::string dump_filename_; std::string dump_filename_;
std::shared_ptr<std::complex<float>> code_; std::vector<std::complex<float>> code_;
Gnss_Synchro* gnss_synchro_; Gnss_Synchro* gnss_synchro_;
std::string role_; std::string role_;
unsigned int in_streams_; unsigned int in_streams_;

View File

@ -27,6 +27,13 @@
#include <glog/logging.h> #include <glog/logging.h>
#include <algorithm> #include <algorithm>
#if HAS_STD_SPAN
#include <span>
namespace own = std;
#else
#include <gsl/gsl>
namespace own = gsl;
#endif
GpsL1CaPcpsOpenClAcquisition::GpsL1CaPcpsOpenClAcquisition( GpsL1CaPcpsOpenClAcquisition::GpsL1CaPcpsOpenClAcquisition(
ConfigurationInterface* configuration, ConfigurationInterface* configuration,
@ -198,7 +205,7 @@ void GpsL1CaPcpsOpenClAcquisition::set_local_code()
gps_l1_ca_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_, 0); gps_l1_ca_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_, 0);
gsl::span<gr_complex> code_span(code_.data(), vector_length_); own::span<gr_complex> code_span(code_.data(), vector_length_);
for (unsigned int i = 0; i < sampled_ms_; i++) for (unsigned int i = 0; i < sampled_ms_; i++)
{ {
std::copy_n(code.data(), code_length_, code_span.subspan(i * code_length_, code_length_).data()); std::copy_n(code.data(), code_length_, code_span.subspan(i * code_length_, code_length_).data());

View File

@ -28,6 +28,13 @@
#include <glog/logging.h> #include <glog/logging.h>
#include <algorithm> #include <algorithm>
#if HAS_STD_SPAN
#include <span>
namespace own = std;
#else
#include <gsl/gsl>
namespace own = gsl;
#endif
GpsL1CaPcpsQuickSyncAcquisition::GpsL1CaPcpsQuickSyncAcquisition( GpsL1CaPcpsQuickSyncAcquisition::GpsL1CaPcpsQuickSyncAcquisition(
ConfigurationInterface* configuration, ConfigurationInterface* configuration,
@ -224,7 +231,7 @@ void GpsL1CaPcpsQuickSyncAcquisition::set_local_code()
gps_l1_ca_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_, 0); gps_l1_ca_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_, 0);
gsl::span<gr_complex> code_span(code_.data(), vector_length_); own::span<gr_complex> code_span(code_.data(), vector_length_);
for (unsigned int i = 0; i < (sampled_ms_ / folding_factor_); i++) for (unsigned int i = 0; i < (sampled_ms_ / folding_factor_); i++)
{ {
std::copy_n(code.data(), code_length_, code_span.subspan(i * code_length_, code_length_).data()); std::copy_n(code.data(), code_length_, code_span.subspan(i * code_length_, code_length_).data());

View File

@ -27,6 +27,13 @@
#include <glog/logging.h> #include <glog/logging.h>
#include <algorithm> #include <algorithm>
#if HAS_STD_SPAN
#include <span>
namespace own = std;
#else
#include <gsl/gsl>
namespace own = gsl;
#endif
GpsL1CaPcpsTongAcquisition::GpsL1CaPcpsTongAcquisition( GpsL1CaPcpsTongAcquisition::GpsL1CaPcpsTongAcquisition(
ConfigurationInterface* configuration, ConfigurationInterface* configuration,
@ -186,7 +193,7 @@ void GpsL1CaPcpsTongAcquisition::set_local_code()
gps_l1_ca_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_, 0); gps_l1_ca_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_, 0);
gsl::span<gr_complex> code_span(code_.data(), vector_length_); own::span<gr_complex> code_span(code_.data(), vector_length_);
for (unsigned int i = 0; i < sampled_ms_; i++) for (unsigned int i = 0; i < sampled_ms_; i++)
{ {
std::copy_n(code.data(), code_length_, code_span.subspan(i * code_length_, code_length_).data()); std::copy_n(code.data(), code_length_, code_span.subspan(i * code_length_, code_length_).data());

View File

@ -29,6 +29,13 @@
#include <glog/logging.h> #include <glog/logging.h>
#include <algorithm> #include <algorithm>
#if HAS_STD_SPAN
#include <span>
namespace own = std;
#else
#include <gsl/gsl>
namespace own = gsl;
#endif
GpsL2MPcpsAcquisition::GpsL2MPcpsAcquisition( GpsL2MPcpsAcquisition::GpsL2MPcpsAcquisition(
ConfigurationInterface* configuration, ConfigurationInterface* configuration,
@ -156,7 +163,7 @@ void GpsL2MPcpsAcquisition::set_local_code()
gps_l2c_m_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_); gps_l2c_m_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_);
} }
gsl::span<gr_complex> code_span(code_.data(), vector_length_); own::span<gr_complex> code_span(code_.data(), vector_length_);
for (unsigned int i = 0; i < num_codes_; i++) for (unsigned int i = 0; i < num_codes_; i++)
{ {
std::copy_n(code.data(), code_length_, code_span.subspan(i * code_length_, code_length_).data()); std::copy_n(code.data(), code_length_, code_span.subspan(i * code_length_, code_length_).data());

View File

@ -28,7 +28,13 @@
#include "gps_l5_signal.h" #include "gps_l5_signal.h"
#include <glog/logging.h> #include <glog/logging.h>
#include <algorithm> #include <algorithm>
#if HAS_STD_SPAN
#include <span>
namespace own = std;
#else
#include <gsl/gsl>
namespace own = gsl;
#endif
GpsL5iPcpsAcquisition::GpsL5iPcpsAcquisition( GpsL5iPcpsAcquisition::GpsL5iPcpsAcquisition(
ConfigurationInterface* configuration, ConfigurationInterface* configuration,
@ -158,7 +164,7 @@ void GpsL5iPcpsAcquisition::set_local_code()
gps_l5i_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_); gps_l5i_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_);
} }
gsl::span<gr_complex> code_span(code_.data(), vector_length_); own::span<gr_complex> code_span(code_.data(), vector_length_);
for (unsigned int i = 0; i < num_codes_; i++) for (unsigned int i = 0; i < num_codes_; i++)
{ {
std::copy_n(code.data(), code_length_, code_span.subspan(i * code_length_, code_length_).data()); std::copy_n(code.data(), code_length_, code_span.subspan(i * code_length_, code_length_).data());

View File

@ -93,6 +93,12 @@ if(ENABLE_ARMA_NO_DEBUG)
) )
endif() endif()
if(has_span)
target_compile_definitions(acquisition_gr_blocks
PRIVATE -DHAS_STD_SPAN=1
)
endif()
if(ENABLE_OPENCL) if(ENABLE_OPENCL)
target_link_libraries(acquisition_gr_blocks PUBLIC OpenCL::OpenCL) target_link_libraries(acquisition_gr_blocks PUBLIC OpenCL::OpenCL)
target_include_directories(acquisition_gr_blocks target_include_directories(acquisition_gr_blocks

View File

@ -252,7 +252,7 @@ bool pcps_acquisition::is_fdma()
} }
void pcps_acquisition::update_local_carrier(gsl::span<gr_complex> carrier_vector, float freq) void pcps_acquisition::update_local_carrier(own::span<gr_complex> carrier_vector, float freq)
{ {
float phase_step_rad; float phase_step_rad;
if (acq_parameters.use_automatic_resampler) if (acq_parameters.use_automatic_resampler)
@ -264,7 +264,7 @@ void pcps_acquisition::update_local_carrier(gsl::span<gr_complex> carrier_vector
phase_step_rad = GPS_TWO_PI * freq / static_cast<float>(acq_parameters.fs_in); phase_step_rad = GPS_TWO_PI * freq / static_cast<float>(acq_parameters.fs_in);
} }
std::array<float, 1> _phase{}; std::array<float, 1> _phase{};
volk_gnsssdr_s32f_sincos_32fc(carrier_vector.data(), -phase_step_rad, _phase.data(), carrier_vector.length()); volk_gnsssdr_s32f_sincos_32fc(carrier_vector.data(), -phase_step_rad, _phase.data(), carrier_vector.size());
} }

View File

@ -54,7 +54,6 @@
#include <gnuradio/gr_complex.h> // for gr_complex #include <gnuradio/gr_complex.h> // for gr_complex
#include <gnuradio/thread/thread.h> // for scoped_lock #include <gnuradio/thread/thread.h> // for scoped_lock
#include <gnuradio/types.h> // for gr_vector_const_void_star #include <gnuradio/types.h> // for gr_vector_const_void_star
#include <gsl/gsl> // for Guidelines Support Library
#include <volk/volk_complex.h> // for lv_16sc_t #include <volk/volk_complex.h> // for lv_16sc_t
#include <volk_gnsssdr/volk_gnsssdr_alloc.h> // for volk_gnsssdr::vector #include <volk_gnsssdr/volk_gnsssdr_alloc.h> // for volk_gnsssdr::vector
#include <complex> #include <complex>
@ -62,6 +61,15 @@
#include <memory> #include <memory>
#include <string> #include <string>
#include <utility> #include <utility>
#if HAS_STD_SPAN
#include <span>
namespace own = std;
#else
#include <gsl/gsl>
namespace own = gsl;
#endif
#if GNURADIO_USES_STD_POINTERS #if GNURADIO_USES_STD_POINTERS
#else #else
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
@ -255,7 +263,7 @@ private:
Gnss_Synchro* d_gnss_synchro; Gnss_Synchro* d_gnss_synchro;
arma::fmat grid_; arma::fmat grid_;
arma::fmat narrow_grid_; arma::fmat narrow_grid_;
void update_local_carrier(gsl::span<gr_complex> carrier_vector, float freq); void update_local_carrier(own::span<gr_complex> carrier_vector, float freq);
void update_grid_doppler_wipeoffs(); void update_grid_doppler_wipeoffs();
void update_grid_doppler_wipeoffs_step2(); void update_grid_doppler_wipeoffs_step2();
void acquisition_core(uint64_t samp_count); void acquisition_core(uint64_t samp_count);

View File

@ -85,10 +85,12 @@ else()
target_link_libraries(algorithms_libs PRIVATE Boost::filesystem Boost::system) target_link_libraries(algorithms_libs PRIVATE Boost::filesystem Boost::system)
endif() endif()
target_include_directories(algorithms_libs if(NOT has_span)
target_include_directories(algorithms_libs
PUBLIC PUBLIC
${CMAKE_SOURCE_DIR}/src/algorithms/libs/gsl/include ${CMAKE_SOURCE_DIR}/src/algorithms/libs/gsl/include
) )
endif()
target_link_libraries(algorithms_libs target_link_libraries(algorithms_libs
PUBLIC PUBLIC
@ -110,6 +112,12 @@ if(GNURADIO_USES_STD_POINTERS)
) )
endif() endif()
if(has_span)
target_compile_definitions(algorithms_libs
PUBLIC -DHAS_STD_SPAN=1
)
endif()
if(ENABLE_OPENCL) if(ENABLE_OPENCL)
target_link_libraries(algorithms_libs PUBLIC OpenCL::OpenCL) target_link_libraries(algorithms_libs PUBLIC OpenCL::OpenCL)
target_include_directories(algorithms_libs PUBLIC target_include_directories(algorithms_libs PUBLIC

View File

@ -26,7 +26,7 @@
const auto AUX_CEIL = [](float x) { return static_cast<int32_t>(static_cast<int64_t>((x) + 1)); }; const auto AUX_CEIL = [](float x) { return static_cast<int32_t>(static_cast<int64_t>((x) + 1)); };
void beidou_b1i_code_gen_int(gsl::span<int32_t> _dest, int32_t _prn, uint32_t _chip_shift) void beidou_b1i_code_gen_int(own::span<int32_t> _dest, int32_t _prn, uint32_t _chip_shift)
{ {
const uint32_t _code_length = 2046; const uint32_t _code_length = 2046;
std::bitset<_code_length> G1{}; std::bitset<_code_length> G1{};
@ -101,12 +101,12 @@ void beidou_b1i_code_gen_int(gsl::span<int32_t> _dest, int32_t _prn, uint32_t _c
} }
void beidou_b1i_code_gen_float(gsl::span<float> _dest, int32_t _prn, uint32_t _chip_shift) void beidou_b1i_code_gen_float(own::span<float> _dest, int32_t _prn, uint32_t _chip_shift)
{ {
const uint32_t _code_length = 2046; const uint32_t _code_length = 2046;
std::array<int32_t, _code_length> b1i_code_int{}; std::array<int32_t, _code_length> b1i_code_int{};
beidou_b1i_code_gen_int(gsl::span<int32_t>(b1i_code_int.data(), _code_length), _prn, _chip_shift); beidou_b1i_code_gen_int(own::span<int32_t>(b1i_code_int.data(), _code_length), _prn, _chip_shift);
for (uint32_t ii = 0; ii < _code_length; ++ii) for (uint32_t ii = 0; ii < _code_length; ++ii)
{ {
@ -115,12 +115,12 @@ void beidou_b1i_code_gen_float(gsl::span<float> _dest, int32_t _prn, uint32_t _c
} }
void beidou_b1i_code_gen_complex(gsl::span<std::complex<float>> _dest, int32_t _prn, uint32_t _chip_shift) void beidou_b1i_code_gen_complex(own::span<std::complex<float>> _dest, int32_t _prn, uint32_t _chip_shift)
{ {
const uint32_t _code_length = 2046; const uint32_t _code_length = 2046;
std::array<int32_t, _code_length> b1i_code_int{}; std::array<int32_t, _code_length> b1i_code_int{};
beidou_b1i_code_gen_int(gsl::span<int32_t>(b1i_code_int.data(), _code_length), _prn, _chip_shift); beidou_b1i_code_gen_int(own::span<int32_t>(b1i_code_int.data(), _code_length), _prn, _chip_shift);
for (uint32_t ii = 0; ii < _code_length; ++ii) for (uint32_t ii = 0; ii < _code_length; ++ii)
{ {
@ -132,7 +132,7 @@ void beidou_b1i_code_gen_complex(gsl::span<std::complex<float>> _dest, int32_t _
/* /*
* Generates complex GPS L1 C/A code for the desired SV ID and sampled to specific sampling frequency * Generates complex GPS L1 C/A code for the desired SV ID and sampled to specific sampling frequency
*/ */
void beidou_b1i_code_gen_complex_sampled(gsl::span<std::complex<float>> _dest, uint32_t _prn, int32_t _fs, uint32_t _chip_shift) void beidou_b1i_code_gen_complex_sampled(own::span<std::complex<float>> _dest, uint32_t _prn, int32_t _fs, uint32_t _chip_shift)
{ {
// This function is based on the GNU software GPS for MATLAB in the Kay Borre book // This function is based on the GNU software GPS for MATLAB in the Kay Borre book
std::array<std::complex<float>, 2046> _code{}; std::array<std::complex<float>, 2046> _code{};

View File

@ -22,23 +22,29 @@
#ifndef GNSS_SDR_BEIDOU_B1I_SDR_SIGNAL_PROCESSING_H #ifndef GNSS_SDR_BEIDOU_B1I_SDR_SIGNAL_PROCESSING_H
#define GNSS_SDR_BEIDOU_B1I_SDR_SIGNAL_PROCESSING_H #define GNSS_SDR_BEIDOU_B1I_SDR_SIGNAL_PROCESSING_H
#include <gsl/gsl>
#include <complex> #include <complex>
#include <cstdint> #include <cstdint>
#if HAS_STD_SPAN
#include <span>
namespace own = std;
#else
#include <gsl/gsl>
namespace own = gsl;
#endif
//! Generates int32_t GPS L1 C/A code for the desired SV ID and code shift //! Generates int32_t GPS L1 C/A code for the desired SV ID and code shift
void beidou_b1i_code_gen_int(gsl::span<int32_t> _dest, int32_t _prn, uint32_t _chip_shift); void beidou_b1i_code_gen_int(own::span<int32_t> _dest, int32_t _prn, uint32_t _chip_shift);
//! Generates float GPS L1 C/A code for the desired SV ID and code shift //! Generates float GPS L1 C/A code for the desired SV ID and code shift
void beidou_b1i_code_gen_float(gsl::span<float> _dest, int32_t _prn, uint32_t _chip_shift); void beidou_b1i_code_gen_float(own::span<float> _dest, int32_t _prn, uint32_t _chip_shift);
//! Generates complex GPS L1 C/A code for the desired SV ID and code shift, and sampled to specific sampling frequency //! Generates complex GPS L1 C/A code for the desired SV ID and code shift, and sampled to specific sampling frequency
void beidou_b1i_code_gen_complex(gsl::span<std::complex<float>> _dest, int32_t _prn, uint32_t _chip_shift); void beidou_b1i_code_gen_complex(own::span<std::complex<float>> _dest, int32_t _prn, uint32_t _chip_shift);
//! Generates N complex GPS L1 C/A codes for the desired SV ID and code shift //! Generates N complex GPS L1 C/A codes for the desired SV ID and code shift
void beidou_b1i_code_gen_complex_sampled(gsl::span<std::complex<float>> _dest, uint32_t _prn, int32_t _fs, uint32_t _chip_shift, uint32_t _ncodes); void beidou_b1i_code_gen_complex_sampled(own::span<std::complex<float>> _dest, uint32_t _prn, int32_t _fs, uint32_t _chip_shift, uint32_t _ncodes);
//! Generates complex GPS L1 C/A code for the desired SV ID and code shift //! Generates complex GPS L1 C/A code for the desired SV ID and code shift
void beidou_b1i_code_gen_complex_sampled(gsl::span<std::complex<float>> _dest, uint32_t _prn, int32_t _fs, uint32_t _chip_shift); void beidou_b1i_code_gen_complex_sampled(own::span<std::complex<float>> _dest, uint32_t _prn, int32_t _fs, uint32_t _chip_shift);
#endif // GNSS_SDR_BEIDOU_B1I_SDR_SIGNAL_PROCESSING_H #endif // GNSS_SDR_BEIDOU_B1I_SDR_SIGNAL_PROCESSING_H

View File

@ -26,7 +26,7 @@
const auto AUX_CEIL = [](float x) { return static_cast<int32_t>(static_cast<int64_t>((x) + 1)); }; const auto AUX_CEIL = [](float x) { return static_cast<int32_t>(static_cast<int64_t>((x) + 1)); };
void beidou_b3i_code_gen_int(gsl::span<int> _dest, int32_t _prn, uint32_t _chip_shift) void beidou_b3i_code_gen_int(own::span<int> _dest, int32_t _prn, uint32_t _chip_shift)
{ {
const uint32_t _code_length = 10230; const uint32_t _code_length = 10230;
std::bitset<_code_length> G1{}; std::bitset<_code_length> G1{};
@ -168,7 +168,7 @@ void beidou_b3i_code_gen_int(gsl::span<int> _dest, int32_t _prn, uint32_t _chip_
} }
void beidou_b3i_code_gen_float(gsl::span<float> _dest, int32_t _prn, uint32_t _chip_shift) void beidou_b3i_code_gen_float(own::span<float> _dest, int32_t _prn, uint32_t _chip_shift)
{ {
const uint32_t _code_length = 10230; const uint32_t _code_length = 10230;
std::array<int, _code_length> b3i_code_int{}; std::array<int, _code_length> b3i_code_int{};
@ -182,7 +182,7 @@ void beidou_b3i_code_gen_float(gsl::span<float> _dest, int32_t _prn, uint32_t _c
} }
void beidou_b3i_code_gen_complex(gsl::span<std::complex<float>> _dest, int32_t _prn, uint32_t _chip_shift) void beidou_b3i_code_gen_complex(own::span<std::complex<float>> _dest, int32_t _prn, uint32_t _chip_shift)
{ {
const uint32_t _code_length = 10230; const uint32_t _code_length = 10230;
std::array<int, _code_length> b3i_code_int{}; std::array<int, _code_length> b3i_code_int{};
@ -196,7 +196,7 @@ void beidou_b3i_code_gen_complex(gsl::span<std::complex<float>> _dest, int32_t _
} }
void beidou_b3i_code_gen_complex_sampled(gsl::span<std::complex<float>> _dest, uint32_t _prn, int _fs, uint32_t _chip_shift) void beidou_b3i_code_gen_complex_sampled(own::span<std::complex<float>> _dest, uint32_t _prn, int _fs, uint32_t _chip_shift)
{ {
// This function is based on the GNU software GPS for MATLAB in the Kay Borre book // This function is based on the GNU software GPS for MATLAB in the Kay Borre book
std::array<std::complex<float>, 10230> _code{}; std::array<std::complex<float>, 10230> _code{};

View File

@ -22,23 +22,30 @@
#ifndef GNSS_SDR_BEIDOU_B3I_SIGNAL_PROCESSING_H #ifndef GNSS_SDR_BEIDOU_B3I_SIGNAL_PROCESSING_H
#define GNSS_SDR_BEIDOU_B3I_SIGNAL_PROCESSING_H #define GNSS_SDR_BEIDOU_B3I_SIGNAL_PROCESSING_H
#include <gsl/gsl>
#include <complex> #include <complex>
#include <cstdint> #include <cstdint>
#if HAS_STD_SPAN
#include <span>
namespace own = std;
#else
#include <gsl/gsl>
namespace own = gsl;
#endif
//! Generates int BeiDou B3I code for the desired SV ID and code shift //! Generates int BeiDou B3I code for the desired SV ID and code shift
void beidou_b3i_code_gen_int(gsl::span<int> _dest, int32_t _prn, uint32_t _chip_shift); void beidou_b3i_code_gen_int(own::span<int> _dest, int32_t _prn, uint32_t _chip_shift);
//! Generates float BeiDou B3I code for the desired SV ID and code shift //! Generates float BeiDou B3I code for the desired SV ID and code shift
void beidou_b3i_code_gen_float(gsl::span<float> _dest, int32_t _prn, uint32_t _chip_shift); void beidou_b3i_code_gen_float(own::span<float> _dest, int32_t _prn, uint32_t _chip_shift);
//! Generates complex BeiDou B3I code for the desired SV ID and code shift, and sampled to specific sampling frequency //! Generates complex BeiDou B3I code for the desired SV ID and code shift, and sampled to specific sampling frequency
void beidou_b3i_code_gen_complex(gsl::span<std::complex<float>> _dest, int32_t _prn, uint32_t _chip_shift); void beidou_b3i_code_gen_complex(own::span<std::complex<float>> _dest, int32_t _prn, uint32_t _chip_shift);
//! Generates N complex BeiDou B3I codes for the desired SV ID and code shift //! Generates N complex BeiDou B3I codes for the desired SV ID and code shift
void beidou_b3i_code_gen_complex_sampled(gsl::span<std::complex<float>> _dest, uint32_t _prn, int _fs, uint32_t _chip_shift, uint32_t _ncodes); void beidou_b3i_code_gen_complex_sampled(own::span<std::complex<float>> _dest, uint32_t _prn, int _fs, uint32_t _chip_shift, uint32_t _ncodes);
//! Generates complex BeiDou B3I code for the desired SV ID and code shift //! Generates complex BeiDou B3I code for the desired SV ID and code shift
void beidou_b3i_code_gen_complex_sampled(gsl::span<std::complex<float>> _dest, uint32_t _prn, int _fs, uint32_t _chip_shift); void beidou_b3i_code_gen_complex_sampled(own::span<std::complex<float>> _dest, uint32_t _prn, int _fs, uint32_t _chip_shift);
#endif // GNSS_SDR_BEIDOU_B3I_SIGNAL_PROCESSING_H #endif // GNSS_SDR_BEIDOU_B3I_SIGNAL_PROCESSING_H

View File

@ -28,7 +28,7 @@
#include <vector> #include <vector>
void galileo_e1_code_gen_int(gsl::span<int> _dest, const std::array<char, 3>& _Signal, int32_t _prn) void galileo_e1_code_gen_int(own::span<int> _dest, const std::array<char, 3>& _Signal, int32_t _prn)
{ {
std::string _galileo_signal = _Signal.data(); std::string _galileo_signal = _Signal.data();
int32_t prn = _prn - 1; int32_t prn = _prn - 1;
@ -59,7 +59,7 @@ void galileo_e1_code_gen_int(gsl::span<int> _dest, const std::array<char, 3>& _S
} }
void galileo_e1_sinboc_11_gen_int(gsl::span<int> _dest, gsl::span<const int> _prn) void galileo_e1_sinboc_11_gen_int(own::span<int> _dest, own::span<const int> _prn)
{ {
const uint32_t _length_in = GALILEO_E1_B_CODE_LENGTH_CHIPS; const uint32_t _length_in = GALILEO_E1_B_CODE_LENGTH_CHIPS;
auto _period = static_cast<uint32_t>(_dest.size() / _length_in); auto _period = static_cast<uint32_t>(_dest.size() / _length_in);
@ -77,7 +77,7 @@ void galileo_e1_sinboc_11_gen_int(gsl::span<int> _dest, gsl::span<const int> _pr
} }
void galileo_e1_sinboc_61_gen_int(gsl::span<int> _dest, gsl::span<const int> _prn) void galileo_e1_sinboc_61_gen_int(own::span<int> _dest, own::span<const int> _prn)
{ {
const uint32_t _length_in = GALILEO_E1_B_CODE_LENGTH_CHIPS; const uint32_t _length_in = GALILEO_E1_B_CODE_LENGTH_CHIPS;
auto _period = static_cast<uint32_t>(_dest.size() / _length_in); auto _period = static_cast<uint32_t>(_dest.size() / _length_in);
@ -96,7 +96,7 @@ void galileo_e1_sinboc_61_gen_int(gsl::span<int> _dest, gsl::span<const int> _pr
} }
void galileo_e1_code_gen_sinboc11_float(gsl::span<float> _dest, const std::array<char, 3>& _Signal, uint32_t _prn) void galileo_e1_code_gen_sinboc11_float(own::span<float> _dest, const std::array<char, 3>& _Signal, uint32_t _prn)
{ {
std::string _galileo_signal = _Signal.data(); std::string _galileo_signal = _Signal.data();
const auto _codeLength = static_cast<uint32_t>(GALILEO_E1_B_CODE_LENGTH_CHIPS); const auto _codeLength = static_cast<uint32_t>(GALILEO_E1_B_CODE_LENGTH_CHIPS);
@ -110,7 +110,7 @@ void galileo_e1_code_gen_sinboc11_float(gsl::span<float> _dest, const std::array
} }
void galileo_e1_gen_float(gsl::span<float> _dest, gsl::span<int> _prn, const std::array<char, 3>& _Signal) void galileo_e1_gen_float(own::span<float> _dest, own::span<int> _prn, const std::array<char, 3>& _Signal)
{ {
std::string _galileo_signal = _Signal.data(); std::string _galileo_signal = _Signal.data();
const uint32_t _codeLength = 12 * GALILEO_E1_B_CODE_LENGTH_CHIPS; const uint32_t _codeLength = 12 * GALILEO_E1_B_CODE_LENGTH_CHIPS;
@ -119,8 +119,8 @@ void galileo_e1_gen_float(gsl::span<float> _dest, gsl::span<int> _prn, const std
std::array<int32_t, 12 * 4092> sinboc_11{}; std::array<int32_t, 12 * 4092> sinboc_11{};
std::array<int32_t, 12 * 4092> sinboc_61{}; std::array<int32_t, 12 * 4092> sinboc_61{};
gsl::span<int32_t> sinboc_11_(sinboc_11.data(), _codeLength); own::span<int32_t> sinboc_11_(sinboc_11.data(), _codeLength);
gsl::span<int32_t> sinboc_61_(sinboc_61.data(), _codeLength); own::span<int32_t> sinboc_61_(sinboc_61.data(), _codeLength);
galileo_e1_sinboc_11_gen_int(sinboc_11_, _prn); // generate sinboc(1,1) 12 samples per chip galileo_e1_sinboc_11_gen_int(sinboc_11_, _prn); // generate sinboc(1,1) 12 samples per chip
galileo_e1_sinboc_61_gen_int(sinboc_61_, _prn); // generate sinboc(6,1) 12 samples per chip galileo_e1_sinboc_61_gen_int(sinboc_61_, _prn); // generate sinboc(6,1) 12 samples per chip
@ -144,7 +144,7 @@ void galileo_e1_gen_float(gsl::span<float> _dest, gsl::span<int> _prn, const std
} }
void galileo_e1_code_gen_float_sampled(gsl::span<float> _dest, const std::array<char, 3>& _Signal, void galileo_e1_code_gen_float_sampled(own::span<float> _dest, const std::array<char, 3>& _Signal,
bool _cboc, uint32_t _prn, int32_t _fs, uint32_t _chip_shift, bool _cboc, uint32_t _prn, int32_t _fs, uint32_t _chip_shift,
bool _secondary_flag) bool _secondary_flag)
{ {
@ -210,7 +210,7 @@ void galileo_e1_code_gen_float_sampled(gsl::span<float> _dest, const std::array<
} }
void galileo_e1_code_gen_complex_sampled(gsl::span<std::complex<float>> _dest, const std::array<char, 3>& _Signal, void galileo_e1_code_gen_complex_sampled(own::span<std::complex<float>> _dest, const std::array<char, 3>& _Signal,
bool _cboc, uint32_t _prn, int32_t _fs, uint32_t _chip_shift, bool _cboc, uint32_t _prn, int32_t _fs, uint32_t _chip_shift,
bool _secondary_flag) bool _secondary_flag)
{ {
@ -234,14 +234,14 @@ void galileo_e1_code_gen_complex_sampled(gsl::span<std::complex<float>> _dest, c
} }
void galileo_e1_code_gen_float_sampled(gsl::span<float> _dest, const std::array<char, 3>& _Signal, void galileo_e1_code_gen_float_sampled(own::span<float> _dest, const std::array<char, 3>& _Signal,
bool _cboc, uint32_t _prn, int32_t _fs, uint32_t _chip_shift) bool _cboc, uint32_t _prn, int32_t _fs, uint32_t _chip_shift)
{ {
galileo_e1_code_gen_float_sampled(_dest, _Signal, _cboc, _prn, _fs, _chip_shift, false); galileo_e1_code_gen_float_sampled(_dest, _Signal, _cboc, _prn, _fs, _chip_shift, false);
} }
void galileo_e1_code_gen_complex_sampled(gsl::span<std::complex<float>> _dest, const std::array<char, 3>& _Signal, void galileo_e1_code_gen_complex_sampled(own::span<std::complex<float>> _dest, const std::array<char, 3>& _Signal,
bool _cboc, uint32_t _prn, int32_t _fs, uint32_t _chip_shift) bool _cboc, uint32_t _prn, int32_t _fs, uint32_t _chip_shift)
{ {
galileo_e1_code_gen_complex_sampled(_dest, _Signal, _cboc, _prn, _fs, _chip_shift, false); galileo_e1_code_gen_complex_sampled(_dest, _Signal, _cboc, _prn, _fs, _chip_shift, false);

View File

@ -21,24 +21,30 @@
#ifndef GNSS_SDR_GALILEO_E1_SIGNAL_PROCESSING_H #ifndef GNSS_SDR_GALILEO_E1_SIGNAL_PROCESSING_H
#define GNSS_SDR_GALILEO_E1_SIGNAL_PROCESSING_H #define GNSS_SDR_GALILEO_E1_SIGNAL_PROCESSING_H
#include <gsl/gsl>
#include <array> #include <array>
#include <complex> #include <complex>
#include <cstdint> #include <cstdint>
#if HAS_STD_SPAN
#include <span>
namespace own = std;
#else
#include <gsl/gsl>
namespace own = gsl;
#endif
/*! /*!
* \brief This function generates Galileo E1 code (can select E1B or E1C sinboc). * \brief This function generates Galileo E1 code (can select E1B or E1C sinboc).
* *
*/ */
void galileo_e1_code_gen_sinboc11_float(gsl::span<float> _dest, const std::array<char, 3>& _Signal, uint32_t _prn); void galileo_e1_code_gen_sinboc11_float(own::span<float> _dest, const std::array<char, 3>& _Signal, uint32_t _prn);
/*! /*!
* \brief This function generates Galileo E1 code (can select E1B or E1C, cboc or sinboc * \brief This function generates Galileo E1 code (can select E1B or E1C, cboc or sinboc
* and the sample frequency _fs). * and the sample frequency _fs).
* *
*/ */
void galileo_e1_code_gen_float_sampled(gsl::span<float> _dest, const std::array<char, 3>& _Signal, void galileo_e1_code_gen_float_sampled(own::span<float> _dest, const std::array<char, 3>& _Signal,
bool _cboc, uint32_t _prn, int32_t _fs, uint32_t _chip_shift, bool _cboc, uint32_t _prn, int32_t _fs, uint32_t _chip_shift,
bool _secondary_flag); bool _secondary_flag);
@ -47,7 +53,7 @@ void galileo_e1_code_gen_float_sampled(gsl::span<float> _dest, const std::array<
* and the sample frequency _fs). * and the sample frequency _fs).
* *
*/ */
void galileo_e1_code_gen_float_sampled(gsl::span<float> _dest, const std::array<char, 3>& _Signal, void galileo_e1_code_gen_float_sampled(own::span<float> _dest, const std::array<char, 3>& _Signal,
bool _cboc, uint32_t _prn, int32_t _fs, uint32_t _chip_shift); bool _cboc, uint32_t _prn, int32_t _fs, uint32_t _chip_shift);
/*! /*!
@ -55,14 +61,14 @@ void galileo_e1_code_gen_float_sampled(gsl::span<float> _dest, const std::array<
* and the sample frequency _fs). * and the sample frequency _fs).
* *
*/ */
void galileo_e1_code_gen_complex_sampled(gsl::span<std::complex<float>> _dest, const std::array<char, 3>& _Signal, void galileo_e1_code_gen_complex_sampled(own::span<std::complex<float>> _dest, const std::array<char, 3>& _Signal,
bool _cboc, uint32_t _prn, int32_t _fs, uint32_t _chip_shift, bool _cboc, uint32_t _prn, int32_t _fs, uint32_t _chip_shift,
bool _secondary_flag); bool _secondary_flag);
/*! /*!
* \brief galileo_e1_code_gen_complex_sampled without _secondary_flag for backward compatibility. * \brief galileo_e1_code_gen_complex_sampled without _secondary_flag for backward compatibility.
*/ */
void galileo_e1_code_gen_complex_sampled(gsl::span<std::complex<float>> _dest, const std::array<char, 3>& _Signal, void galileo_e1_code_gen_complex_sampled(own::span<std::complex<float>> _dest, const std::array<char, 3>& _Signal,
bool _cboc, uint32_t _prn, int32_t _fs, uint32_t _chip_shift); bool _cboc, uint32_t _prn, int32_t _fs, uint32_t _chip_shift);
#endif // GNSS_SDR_GALILEO_E1_SIGNAL_PROCESSING_H #endif // GNSS_SDR_GALILEO_E1_SIGNAL_PROCESSING_H

View File

@ -27,7 +27,7 @@
#include <vector> #include <vector>
void galileo_e5_a_code_gen_complex_primary(gsl::span<std::complex<float>> _dest, int32_t _prn, const std::array<char, 3>& _Signal) void galileo_e5_a_code_gen_complex_primary(own::span<std::complex<float>> _dest, int32_t _prn, const std::array<char, 3>& _Signal)
{ {
uint32_t prn = _prn - 1; uint32_t prn = _prn - 1;
uint32_t index = 0; uint32_t index = 0;
@ -90,7 +90,7 @@ void galileo_e5_a_code_gen_complex_primary(gsl::span<std::complex<float>> _dest,
} }
void galileo_e5_a_code_gen_complex_sampled(gsl::span<std::complex<float>> _dest, const std::array<char, 3>& _Signal, void galileo_e5_a_code_gen_complex_sampled(own::span<std::complex<float>> _dest, const std::array<char, 3>& _Signal,
uint32_t _prn, int32_t _fs, uint32_t _chip_shift) uint32_t _prn, int32_t _fs, uint32_t _chip_shift)
{ {
uint32_t _samplesPerCode; uint32_t _samplesPerCode;

View File

@ -23,22 +23,27 @@
#ifndef GNSS_SDR_GALILEO_E5_SIGNAL_PROCESSING_H #ifndef GNSS_SDR_GALILEO_E5_SIGNAL_PROCESSING_H
#define GNSS_SDR_GALILEO_E5_SIGNAL_PROCESSING_H #define GNSS_SDR_GALILEO_E5_SIGNAL_PROCESSING_H
#include <gsl/gsl>
#include <array>
#include <complex> #include <complex>
#include <cstdint> #include <cstdint>
#if HAS_STD_SPAN
#include <span>
namespace own = std;
#else
#include <gsl/gsl>
namespace own = gsl;
#endif
/*! /*!
* \brief Generates Galileo E5a code at 1 sample/chip * \brief Generates Galileo E5a code at 1 sample/chip
* bool _pilot generates E5aQ code if true and E5aI (data signal) if false. * bool _pilot generates E5aQ code if true and E5aI (data signal) if false.
*/ */
void galileo_e5_a_code_gen_complex_primary(gsl::span<std::complex<float>> _dest, int32_t _prn, const std::array<char, 3>& _Signal); void galileo_e5_a_code_gen_complex_primary(own::span<std::complex<float>> _dest, int32_t _prn, const std::array<char, 3>& _Signal);
/*! /*!
* \brief Generates Galileo E5a complex code, shifted to the desired chip and sampled at a frequency fs * \brief Generates Galileo E5a complex code, shifted to the desired chip and sampled at a frequency fs
* bool _pilot generates E5aQ code if true and E5aI (data signal) if false. * bool _pilot generates E5aQ code if true and E5aI (data signal) if false.
*/ */
void galileo_e5_a_code_gen_complex_sampled(gsl::span<std::complex<float>> _dest, void galileo_e5_a_code_gen_complex_sampled(own::span<std::complex<float>> _dest,
const std::array<char, 3>& _Signal, uint32_t _prn, int32_t _fs, uint32_t _chip_shift); const std::array<char, 3>& _Signal, uint32_t _prn, int32_t _fs, uint32_t _chip_shift);

View File

@ -25,7 +25,7 @@
const auto AUX_CEIL = [](float x) { return static_cast<int32_t>(static_cast<int64_t>((x) + 1)); }; const auto AUX_CEIL = [](float x) { return static_cast<int32_t>(static_cast<int64_t>((x) + 1)); };
void glonass_l1_ca_code_gen_complex(gsl::span<std::complex<float>> _dest, uint32_t _chip_shift) void glonass_l1_ca_code_gen_complex(own::span<std::complex<float>> _dest, uint32_t _chip_shift)
{ {
const uint32_t _code_length = 511; const uint32_t _code_length = 511;
std::bitset<_code_length> G1{}; std::bitset<_code_length> G1{};
@ -91,7 +91,7 @@ void glonass_l1_ca_code_gen_complex(gsl::span<std::complex<float>> _dest, uint32
/* /*
* Generates complex GLONASS L1 C/A code for the desired SV ID and sampled to specific sampling frequency * Generates complex GLONASS L1 C/A code for the desired SV ID and sampled to specific sampling frequency
*/ */
void glonass_l1_ca_code_gen_complex_sampled(gsl::span<std::complex<float>> _dest, int32_t _fs, uint32_t _chip_shift) void glonass_l1_ca_code_gen_complex_sampled(own::span<std::complex<float>> _dest, int32_t _fs, uint32_t _chip_shift)
{ {
// This function is based on the GNU software GPS for MATLAB in the Kay Borre book // This function is based on the GNU software GPS for MATLAB in the Kay Borre book
std::array<std::complex<float>, 511> _code{}; std::array<std::complex<float>, 511> _code{};

View File

@ -22,17 +22,23 @@
#ifndef GNSS_SDR_GLONASS_SDR_SIGNAL_PROCESSING_H #ifndef GNSS_SDR_GLONASS_SDR_SIGNAL_PROCESSING_H
#define GNSS_SDR_GLONASS_SDR_SIGNAL_PROCESSING_H #define GNSS_SDR_GLONASS_SDR_SIGNAL_PROCESSING_H
#include <gsl/gsl>
#include <complex> #include <complex>
#include <cstdint> #include <cstdint>
#if HAS_STD_SPAN
#include <span>
namespace own = std;
#else
#include <gsl/gsl>
namespace own = gsl;
#endif
//! Generates complex GLONASS L1 C/A code for the desired SV ID and code shift, and sampled to specific sampling frequency //! Generates complex GLONASS L1 C/A code for the desired SV ID and code shift, and sampled to specific sampling frequency
void glonass_l1_ca_code_gen_complex(gsl::span<std::complex<float>> _dest, uint32_t _chip_shift); void glonass_l1_ca_code_gen_complex(own::span<std::complex<float>> _dest, uint32_t _chip_shift);
//! Generates N complex GLONASS L1 C/A codes for the desired SV ID and code shift //! Generates N complex GLONASS L1 C/A codes for the desired SV ID and code shift
void glonass_l1_ca_code_gen_complex_sampled(gsl::span<std::complex<float>> _dest, int32_t _fs, uint32_t _chip_shift, uint32_t _ncodes); void glonass_l1_ca_code_gen_complex_sampled(own::span<std::complex<float>> _dest, int32_t _fs, uint32_t _chip_shift, uint32_t _ncodes);
//! Generates complex GLONASS L1 C/A code for the desired SV ID and code shift //! Generates complex GLONASS L1 C/A code for the desired SV ID and code shift
void glonass_l1_ca_code_gen_complex_sampled(gsl::span<std::complex<float>> _dest, int32_t _fs, uint32_t _chip_shift); void glonass_l1_ca_code_gen_complex_sampled(own::span<std::complex<float>> _dest, int32_t _fs, uint32_t _chip_shift);
#endif // GNSS_SDR_GLONASS_SDR_SIGNAL_PROCESSING_H #endif // GNSS_SDR_GLONASS_SDR_SIGNAL_PROCESSING_H

View File

@ -25,7 +25,7 @@
const auto AUX_CEIL = [](float x) { return static_cast<int32_t>(static_cast<int64_t>((x) + 1)); }; const auto AUX_CEIL = [](float x) { return static_cast<int32_t>(static_cast<int64_t>((x) + 1)); };
void glonass_l2_ca_code_gen_complex(gsl::span<std::complex<float>> _dest, uint32_t _chip_shift) void glonass_l2_ca_code_gen_complex(own::span<std::complex<float>> _dest, uint32_t _chip_shift)
{ {
const uint32_t _code_length = 511; const uint32_t _code_length = 511;
std::bitset<_code_length> G1{}; std::bitset<_code_length> G1{};
@ -91,7 +91,7 @@ void glonass_l2_ca_code_gen_complex(gsl::span<std::complex<float>> _dest, uint32
/* /*
* Generates complex GLONASS L2 C/A code for the desired SV ID and sampled to specific sampling frequency * Generates complex GLONASS L2 C/A code for the desired SV ID and sampled to specific sampling frequency
*/ */
void glonass_l2_ca_code_gen_complex_sampled(gsl::span<std::complex<float>> _dest, int32_t _fs, uint32_t _chip_shift) void glonass_l2_ca_code_gen_complex_sampled(own::span<std::complex<float>> _dest, int32_t _fs, uint32_t _chip_shift)
{ {
// This function is based on the GNU software GPS for MATLAB in the Kay Borre book // This function is based on the GNU software GPS for MATLAB in the Kay Borre book
std::array<std::complex<float>, 511> _code{}; std::array<std::complex<float>, 511> _code{};

View File

@ -22,17 +22,23 @@
#ifndef GNSS_SDR_GLONASS_L2_SIGNAL_PROCESSING_H #ifndef GNSS_SDR_GLONASS_L2_SIGNAL_PROCESSING_H
#define GNSS_SDR_GLONASS_L2_SIGNAL_PROCESSING_H #define GNSS_SDR_GLONASS_L2_SIGNAL_PROCESSING_H
#include <gsl/gsl>
#include <complex> #include <complex>
#include <cstdint> #include <cstdint>
#if HAS_STD_SPAN
#include <span>
namespace own = std;
#else
#include <gsl/gsl>
namespace own = gsl;
#endif
//! Generates complex GLONASS L2 C/A code for the desired SV ID and code shift, and sampled to specific sampling frequency //! Generates complex GLONASS L2 C/A code for the desired SV ID and code shift, and sampled to specific sampling frequency
void glonass_l2_ca_code_gen_complex(gsl::span<std::complex<float>> _dest, uint32_t _chip_shift); void glonass_l2_ca_code_gen_complex(own::span<std::complex<float>> _dest, uint32_t _chip_shift);
//! Generates N complex GLONASS L2 C/A codes for the desired SV ID and code shift //! Generates N complex GLONASS L2 C/A codes for the desired SV ID and code shift
void glonass_l2_ca_code_gen_complex_sampled(gsl::span<std::complex<float>> _dest, int32_t _fs, uint32_t _chip_shift, uint32_t _ncodes); void glonass_l2_ca_code_gen_complex_sampled(own::span<std::complex<float>> _dest, int32_t _fs, uint32_t _chip_shift, uint32_t _ncodes);
//! Generates complex GLONASS L2 C/A code for the desired SV ID and code shift //! Generates complex GLONASS L2 C/A code for the desired SV ID and code shift
void glonass_l2_ca_code_gen_complex_sampled(gsl::span<std::complex<float>> _dest, int32_t _fs, uint32_t _chip_shift); void glonass_l2_ca_code_gen_complex_sampled(own::span<std::complex<float>> _dest, int32_t _fs, uint32_t _chip_shift);
#endif // GNSS_SDR_GLONASS_L2_SIGNAL_PROCESSING_H #endif // GNSS_SDR_GLONASS_L2_SIGNAL_PROCESSING_H

View File

@ -28,7 +28,7 @@
const auto AUX_CEIL2 = [](float x) { return static_cast<int32_t>(static_cast<int64_t>((x) + 1)); }; const auto AUX_CEIL2 = [](float x) { return static_cast<int32_t>(static_cast<int64_t>((x) + 1)); };
void complex_exp_gen(gsl::span<std::complex<float>> _dest, double _f, double _fs) void complex_exp_gen(own::span<std::complex<float>> _dest, double _f, double _fs)
{ {
gr::fxpt_nco d_nco; gr::fxpt_nco d_nco;
d_nco.set_freq((GPS_TWO_PI * _f) / _fs); d_nco.set_freq((GPS_TWO_PI * _f) / _fs);
@ -36,7 +36,7 @@ void complex_exp_gen(gsl::span<std::complex<float>> _dest, double _f, double _fs
} }
void complex_exp_gen_conj(gsl::span<std::complex<float>> _dest, double _f, double _fs) void complex_exp_gen_conj(own::span<std::complex<float>> _dest, double _f, double _fs)
{ {
gr::fxpt_nco d_nco; gr::fxpt_nco d_nco;
d_nco.set_freq(-(GPS_TWO_PI * _f) / _fs); d_nco.set_freq(-(GPS_TWO_PI * _f) / _fs);
@ -44,7 +44,7 @@ void complex_exp_gen_conj(gsl::span<std::complex<float>> _dest, double _f, doubl
} }
void hex_to_binary_converter(gsl::span<int32_t> _dest, char _from) void hex_to_binary_converter(own::span<int32_t> _dest, char _from)
{ {
switch (_from) switch (_from)
{ {
@ -150,7 +150,7 @@ void hex_to_binary_converter(gsl::span<int32_t> _dest, char _from)
} }
void resampler(const gsl::span<float> _from, gsl::span<float> _dest, float _fs_in, void resampler(const own::span<float> _from, own::span<float> _dest, float _fs_in,
float _fs_out) float _fs_out)
{ {
uint32_t _codeValueIndex; uint32_t _codeValueIndex;
@ -173,7 +173,7 @@ void resampler(const gsl::span<float> _from, gsl::span<float> _dest, float _fs_i
} }
void resampler(gsl::span<const std::complex<float>> _from, gsl::span<std::complex<float>> _dest, float _fs_in, void resampler(own::span<const std::complex<float>> _from, own::span<std::complex<float>> _dest, float _fs_in,
float _fs_out) float _fs_out)
{ {
uint32_t _codeValueIndex; uint32_t _codeValueIndex;

View File

@ -24,41 +24,47 @@
#ifndef GNSS_SDR_GNSS_SIGNAL_PROCESSING_H #ifndef GNSS_SDR_GNSS_SIGNAL_PROCESSING_H
#define GNSS_SDR_GNSS_SIGNAL_PROCESSING_H #define GNSS_SDR_GNSS_SIGNAL_PROCESSING_H
#include <gsl/gsl>
#include <complex> #include <complex>
#include <cstdint> #include <cstdint>
#if HAS_STD_SPAN
#include <span>
namespace own = std;
#else
#include <gsl/gsl>
namespace own = gsl;
#endif
/*! /*!
* \brief This function generates a complex exponential in _dest. * \brief This function generates a complex exponential in _dest.
* *
*/ */
void complex_exp_gen(gsl::span<std::complex<float>> _dest, double _f, double _fs); void complex_exp_gen(own::span<std::complex<float>> _dest, double _f, double _fs);
/*! /*!
* \brief This function generates a conjugate complex exponential in _dest. * \brief This function generates a conjugate complex exponential in _dest.
* *
*/ */
void complex_exp_gen_conj(gsl::span<std::complex<float>> _dest, double _f, double _fs); void complex_exp_gen_conj(own::span<std::complex<float>> _dest, double _f, double _fs);
/*! /*!
* \brief This function makes a conversion from hex (the input is a char) * \brief This function makes a conversion from hex (the input is a char)
* to binary (the output are 4 ints with +1 or -1 values). * to binary (the output are 4 ints with +1 or -1 values).
* *
*/ */
void hex_to_binary_converter(gsl::span<int32_t> _dest, char _from); void hex_to_binary_converter(own::span<int32_t> _dest, char _from);
/*! /*!
* \brief This function resamples a sequence of float values. * \brief This function resamples a sequence of float values.
* *
*/ */
void resampler(const gsl::span<float> _from, gsl::span<float> _dest, void resampler(const own::span<float> _from, own::span<float> _dest,
float _fs_in, float _fs_out); float _fs_in, float _fs_out);
/*! /*!
* \brief This function resamples a sequence of complex values. * \brief This function resamples a sequence of complex values.
* *
*/ */
void resampler(gsl::span<const std::complex<float>> _from, gsl::span<std::complex<float>> _dest, void resampler(own::span<const std::complex<float>> _from, own::span<std::complex<float>> _dest,
float _fs_in, float _fs_out); float _fs_in, float _fs_out);
#endif // GNSS_SDR_GNSS_SIGNAL_PROCESSING_H #endif // GNSS_SDR_GNSS_SIGNAL_PROCESSING_H

View File

@ -32,7 +32,7 @@ uint32_t gps_l2c_m_shift(uint32_t x)
} }
void gps_l2c_m_code(gsl::span<int32_t> _dest, uint32_t _prn) void gps_l2c_m_code(own::span<int32_t> _dest, uint32_t _prn)
{ {
uint32_t x; uint32_t x;
x = GPS_L2C_M_INIT_REG[_prn - 1]; x = GPS_L2C_M_INIT_REG[_prn - 1];
@ -44,7 +44,7 @@ void gps_l2c_m_code(gsl::span<int32_t> _dest, uint32_t _prn)
} }
void gps_l2c_m_code_gen_complex(gsl::span<std::complex<float>> _dest, uint32_t _prn) void gps_l2c_m_code_gen_complex(own::span<std::complex<float>> _dest, uint32_t _prn)
{ {
std::array<int32_t, GPS_L2_M_CODE_LENGTH_CHIPS> _code{}; std::array<int32_t, GPS_L2_M_CODE_LENGTH_CHIPS> _code{};
if (_prn > 0 and _prn < 51) if (_prn > 0 and _prn < 51)
@ -59,7 +59,7 @@ void gps_l2c_m_code_gen_complex(gsl::span<std::complex<float>> _dest, uint32_t _
} }
void gps_l2c_m_code_gen_float(gsl::span<float> _dest, uint32_t _prn) void gps_l2c_m_code_gen_float(own::span<float> _dest, uint32_t _prn)
{ {
std::array<int32_t, GPS_L2_M_CODE_LENGTH_CHIPS> _code{}; std::array<int32_t, GPS_L2_M_CODE_LENGTH_CHIPS> _code{};
if (_prn > 0 and _prn < 51) if (_prn > 0 and _prn < 51)
@ -77,7 +77,7 @@ void gps_l2c_m_code_gen_float(gsl::span<float> _dest, uint32_t _prn)
/* /*
* Generates complex GPS L2C M code for the desired SV ID and sampled to specific sampling frequency * Generates complex GPS L2C M code for the desired SV ID and sampled to specific sampling frequency
*/ */
void gps_l2c_m_code_gen_complex_sampled(gsl::span<std::complex<float>> _dest, uint32_t _prn, int32_t _fs) void gps_l2c_m_code_gen_complex_sampled(own::span<std::complex<float>> _dest, uint32_t _prn, int32_t _fs)
{ {
std::array<int32_t, GPS_L2_M_CODE_LENGTH_CHIPS> _code{}; std::array<int32_t, GPS_L2_M_CODE_LENGTH_CHIPS> _code{};
if (_prn > 0 and _prn < 51) if (_prn > 0 and _prn < 51)

View File

@ -22,15 +22,21 @@
#ifndef GNSS_SDR_GPS_L2C_SIGNAL_H #ifndef GNSS_SDR_GPS_L2C_SIGNAL_H
#define GNSS_SDR_GPS_L2C_SIGNAL_H #define GNSS_SDR_GPS_L2C_SIGNAL_H
#include <gsl/gsl>
#include <complex> #include <complex>
#include <cstdint> #include <cstdint>
#if HAS_STD_SPAN
#include <span>
namespace own = std;
#else
#include <gsl/gsl>
namespace own = gsl;
#endif
//! Generates complex GPS L2C M code for the desired SV ID //! Generates complex GPS L2C M code for the desired SV ID
void gps_l2c_m_code_gen_complex(gsl::span<std::complex<float>> _dest, uint32_t _prn); void gps_l2c_m_code_gen_complex(own::span<std::complex<float>> _dest, uint32_t _prn);
void gps_l2c_m_code_gen_float(gsl::span<float> _dest, uint32_t _prn); void gps_l2c_m_code_gen_float(own::span<float> _dest, uint32_t _prn);
//! Generates complex GPS L2C M code for the desired SV ID, and sampled to specific sampling frequency //! Generates complex GPS L2C M code for the desired SV ID, and sampled to specific sampling frequency
void gps_l2c_m_code_gen_complex_sampled(gsl::span<std::complex<float>> _dest, uint32_t _prn, int32_t _fs); void gps_l2c_m_code_gen_complex_sampled(own::span<std::complex<float>> _dest, uint32_t _prn, int32_t _fs);
#endif // GNSS_SDR_GPS_L2C_SIGNAL_H #endif // GNSS_SDR_GPS_L2C_SIGNAL_H

View File

@ -121,7 +121,7 @@ std::deque<bool> make_l5q_xb()
} }
void make_l5i(gsl::span<int32_t> _dest, int32_t prn) void make_l5i(own::span<int32_t> _dest, int32_t prn)
{ {
int32_t xb_offset = GPS_L5I_INIT_REG[prn]; int32_t xb_offset = GPS_L5I_INIT_REG[prn];
@ -141,7 +141,7 @@ void make_l5i(gsl::span<int32_t> _dest, int32_t prn)
} }
void make_l5q(gsl::span<int32_t> _dest, int32_t prn) void make_l5q(own::span<int32_t> _dest, int32_t prn)
{ {
int32_t xb_offset = GPS_L5Q_INIT_REG[prn]; int32_t xb_offset = GPS_L5Q_INIT_REG[prn];
@ -161,7 +161,7 @@ void make_l5q(gsl::span<int32_t> _dest, int32_t prn)
} }
void gps_l5i_code_gen_complex(gsl::span<std::complex<float>> _dest, uint32_t _prn) void gps_l5i_code_gen_complex(own::span<std::complex<float>> _dest, uint32_t _prn)
{ {
std::array<int32_t, GPS_L5I_CODE_LENGTH_CHIPS> _code{}; std::array<int32_t, GPS_L5I_CODE_LENGTH_CHIPS> _code{};
if (_prn > 0 and _prn < 51) if (_prn > 0 and _prn < 51)
@ -176,7 +176,7 @@ void gps_l5i_code_gen_complex(gsl::span<std::complex<float>> _dest, uint32_t _pr
} }
void gps_l5i_code_gen_float(gsl::span<float> _dest, uint32_t _prn) void gps_l5i_code_gen_float(own::span<float> _dest, uint32_t _prn)
{ {
std::array<int32_t, GPS_L5I_CODE_LENGTH_CHIPS> _code{}; std::array<int32_t, GPS_L5I_CODE_LENGTH_CHIPS> _code{};
if (_prn > 0 and _prn < 51) if (_prn > 0 and _prn < 51)
@ -194,7 +194,7 @@ void gps_l5i_code_gen_float(gsl::span<float> _dest, uint32_t _prn)
/* /*
* Generates complex GPS L5i code for the desired SV ID and sampled to specific sampling frequency * Generates complex GPS L5i code for the desired SV ID and sampled to specific sampling frequency
*/ */
void gps_l5i_code_gen_complex_sampled(gsl::span<std::complex<float>> _dest, uint32_t _prn, int32_t _fs) void gps_l5i_code_gen_complex_sampled(own::span<std::complex<float>> _dest, uint32_t _prn, int32_t _fs)
{ {
std::array<int32_t, GPS_L5I_CODE_LENGTH_CHIPS> _code{}; std::array<int32_t, GPS_L5I_CODE_LENGTH_CHIPS> _code{};
if (_prn > 0 and _prn < 51) if (_prn > 0 and _prn < 51)
@ -236,7 +236,7 @@ void gps_l5i_code_gen_complex_sampled(gsl::span<std::complex<float>> _dest, uint
} }
void gps_l5q_code_gen_complex(gsl::span<std::complex<float>> _dest, uint32_t _prn) void gps_l5q_code_gen_complex(own::span<std::complex<float>> _dest, uint32_t _prn)
{ {
std::array<int32_t, GPS_L5Q_CODE_LENGTH_CHIPS> _code{}; std::array<int32_t, GPS_L5Q_CODE_LENGTH_CHIPS> _code{};
if (_prn > 0 and _prn < 51) if (_prn > 0 and _prn < 51)
@ -251,7 +251,7 @@ void gps_l5q_code_gen_complex(gsl::span<std::complex<float>> _dest, uint32_t _pr
} }
void gps_l5q_code_gen_float(gsl::span<float> _dest, uint32_t _prn) void gps_l5q_code_gen_float(own::span<float> _dest, uint32_t _prn)
{ {
std::array<int32_t, GPS_L5Q_CODE_LENGTH_CHIPS> _code{}; std::array<int32_t, GPS_L5Q_CODE_LENGTH_CHIPS> _code{};
if (_prn > 0 and _prn < 51) if (_prn > 0 and _prn < 51)
@ -269,7 +269,7 @@ void gps_l5q_code_gen_float(gsl::span<float> _dest, uint32_t _prn)
/* /*
* Generates complex GPS L5Q code for the desired SV ID and sampled to specific sampling frequency * Generates complex GPS L5Q code for the desired SV ID and sampled to specific sampling frequency
*/ */
void gps_l5q_code_gen_complex_sampled(gsl::span<std::complex<float>> _dest, uint32_t _prn, int32_t _fs) void gps_l5q_code_gen_complex_sampled(own::span<std::complex<float>> _dest, uint32_t _prn, int32_t _fs)
{ {
std::array<int32_t, GPS_L5Q_CODE_LENGTH_CHIPS> _code{}; std::array<int32_t, GPS_L5Q_CODE_LENGTH_CHIPS> _code{};
if (_prn > 0 and _prn < 51) if (_prn > 0 and _prn < 51)

View File

@ -22,27 +22,33 @@
#ifndef GNSS_SDR_GPS_L5_SIGNAL_H #ifndef GNSS_SDR_GPS_L5_SIGNAL_H
#define GNSS_SDR_GPS_L5_SIGNAL_H #define GNSS_SDR_GPS_L5_SIGNAL_H
#include <gsl/gsl>
#include <complex> #include <complex>
#include <cstdint> #include <cstdint>
#if HAS_STD_SPAN
#include <span>
namespace own = std;
#else
#include <gsl/gsl>
namespace own = gsl;
#endif
//! Generates complex GPS L5I code for the desired SV ID //! Generates complex GPS L5I code for the desired SV ID
void gps_l5i_code_gen_complex(gsl::span<std::complex<float>> _dest, uint32_t _prn); void gps_l5i_code_gen_complex(own::span<std::complex<float>> _dest, uint32_t _prn);
//! Generates real GPS L5I code for the desired SV ID //! Generates real GPS L5I code for the desired SV ID
void gps_l5i_code_gen_float(gsl::span<float> _dest, uint32_t _prn); void gps_l5i_code_gen_float(own::span<float> _dest, uint32_t _prn);
//! Generates complex GPS L5Q code for the desired SV ID //! Generates complex GPS L5Q code for the desired SV ID
void gps_l5q_code_gen_complex(gsl::span<std::complex<float>> _dest, uint32_t _prn); void gps_l5q_code_gen_complex(own::span<std::complex<float>> _dest, uint32_t _prn);
//! Generates real GPS L5Q code for the desired SV ID //! Generates real GPS L5Q code for the desired SV ID
void gps_l5q_code_gen_float(gsl::span<float> _dest, uint32_t _prn); void gps_l5q_code_gen_float(own::span<float> _dest, uint32_t _prn);
//! Generates complex GPS L5I code for the desired SV ID, and sampled to specific sampling frequency //! Generates complex GPS L5I code for the desired SV ID, and sampled to specific sampling frequency
void gps_l5i_code_gen_complex_sampled(gsl::span<std::complex<float>> _dest, uint32_t _prn, int32_t _fs); void gps_l5i_code_gen_complex_sampled(own::span<std::complex<float>> _dest, uint32_t _prn, int32_t _fs);
//! Generates complex GPS L5Q code for the desired SV ID, and sampled to specific sampling frequency //! Generates complex GPS L5Q code for the desired SV ID, and sampled to specific sampling frequency
void gps_l5q_code_gen_complex_sampled(gsl::span<std::complex<float>> _dest, uint32_t _prn, int32_t _fs); void gps_l5q_code_gen_complex_sampled(own::span<std::complex<float>> _dest, uint32_t _prn, int32_t _fs);
#endif // GNSS_SDR_GPS_L5_SIGNAL_H #endif // GNSS_SDR_GPS_L5_SIGNAL_H

View File

@ -25,7 +25,7 @@
const auto AUX_CEIL = [](float x) { return static_cast<int32_t>(static_cast<int64_t>((x) + 1)); }; const auto AUX_CEIL = [](float x) { return static_cast<int32_t>(static_cast<int64_t>((x) + 1)); };
void gps_l1_ca_code_gen_int(gsl::span<int32_t> _dest, int32_t _prn, uint32_t _chip_shift) void gps_l1_ca_code_gen_int(own::span<int32_t> _dest, int32_t _prn, uint32_t _chip_shift)
{ {
const uint32_t _code_length = 1023; const uint32_t _code_length = 1023;
std::bitset<_code_length> G1{}; std::bitset<_code_length> G1{};
@ -110,7 +110,7 @@ void gps_l1_ca_code_gen_int(gsl::span<int32_t> _dest, int32_t _prn, uint32_t _ch
} }
void gps_l1_ca_code_gen_float(gsl::span<float> _dest, int32_t _prn, uint32_t _chip_shift) void gps_l1_ca_code_gen_float(own::span<float> _dest, int32_t _prn, uint32_t _chip_shift)
{ {
const uint32_t _code_length = 1023; const uint32_t _code_length = 1023;
std::array<int32_t, _code_length> ca_code_int{}; std::array<int32_t, _code_length> ca_code_int{};
@ -124,7 +124,7 @@ void gps_l1_ca_code_gen_float(gsl::span<float> _dest, int32_t _prn, uint32_t _ch
} }
void gps_l1_ca_code_gen_complex(gsl::span<std::complex<float>> _dest, int32_t _prn, uint32_t _chip_shift) void gps_l1_ca_code_gen_complex(own::span<std::complex<float>> _dest, int32_t _prn, uint32_t _chip_shift)
{ {
const uint32_t _code_length = 1023; const uint32_t _code_length = 1023;
std::array<int32_t, _code_length> ca_code_int{}; std::array<int32_t, _code_length> ca_code_int{};
@ -142,7 +142,7 @@ void gps_l1_ca_code_gen_complex(gsl::span<std::complex<float>> _dest, int32_t _p
* Generates complex GPS L1 C/A code for the desired SV ID and sampled to specific sampling frequency * Generates complex GPS L1 C/A code for the desired SV ID and sampled to specific sampling frequency
* NOTICE: the number of samples is rounded towards zero (integer truncation) * NOTICE: the number of samples is rounded towards zero (integer truncation)
*/ */
void gps_l1_ca_code_gen_complex_sampled(gsl::span<std::complex<float>> _dest, uint32_t _prn, int32_t _fs, uint32_t _chip_shift) void gps_l1_ca_code_gen_complex_sampled(own::span<std::complex<float>> _dest, uint32_t _prn, int32_t _fs, uint32_t _chip_shift)
{ {
// This function is based on the GNU software GPS for MATLAB in the Kay Borre book // This function is based on the GNU software GPS for MATLAB in the Kay Borre book
std::array<std::complex<float>, 1023> _code{}; std::array<std::complex<float>, 1023> _code{};

View File

@ -22,23 +22,29 @@
#ifndef GNSS_SDR_GPS_SDR_SIGNAL_PROCESSING_H #ifndef GNSS_SDR_GPS_SDR_SIGNAL_PROCESSING_H
#define GNSS_SDR_GPS_SDR_SIGNAL_PROCESSING_H #define GNSS_SDR_GPS_SDR_SIGNAL_PROCESSING_H
#include <gsl/gsl>
#include <complex> #include <complex>
#include <cstdint> #include <cstdint>
#if HAS_STD_SPAN
#include <span>
namespace own = std;
#else
#include <gsl/gsl>
namespace own = gsl;
#endif
//! Generates int GPS L1 C/A code for the desired SV ID and code shift //! Generates int GPS L1 C/A code for the desired SV ID and code shift
void gps_l1_ca_code_gen_int(gsl::span<int32_t> _dest, int32_t _prn, uint32_t _chip_shift); void gps_l1_ca_code_gen_int(own::span<int32_t> _dest, int32_t _prn, uint32_t _chip_shift);
//! Generates float GPS L1 C/A code for the desired SV ID and code shift //! Generates float GPS L1 C/A code for the desired SV ID and code shift
void gps_l1_ca_code_gen_float(gsl::span<float> _dest, int32_t _prn, uint32_t _chip_shift); void gps_l1_ca_code_gen_float(own::span<float> _dest, int32_t _prn, uint32_t _chip_shift);
//! Generates complex GPS L1 C/A code for the desired SV ID and code shift, and sampled to specific sampling frequency //! Generates complex GPS L1 C/A code for the desired SV ID and code shift, and sampled to specific sampling frequency
void gps_l1_ca_code_gen_complex(gsl::span<std::complex<float>> _dest, int32_t _prn, uint32_t _chip_shift); void gps_l1_ca_code_gen_complex(own::span<std::complex<float>> _dest, int32_t _prn, uint32_t _chip_shift);
//! Generates N complex GPS L1 C/A codes for the desired SV ID and code shift //! Generates N complex GPS L1 C/A codes for the desired SV ID and code shift
void gps_l1_ca_code_gen_complex_sampled(gsl::span<std::complex<float>> _dest, uint32_t _prn, int32_t _fs, uint32_t _chip_shift, uint32_t _ncodes); void gps_l1_ca_code_gen_complex_sampled(own::span<std::complex<float>> _dest, uint32_t _prn, int32_t _fs, uint32_t _chip_shift, uint32_t _ncodes);
//! Generates complex GPS L1 C/A code for the desired SV ID and code shift //! Generates complex GPS L1 C/A code for the desired SV ID and code shift
void gps_l1_ca_code_gen_complex_sampled(gsl::span<std::complex<float>> _dest, uint32_t _prn, int32_t _fs, uint32_t _chip_shift); void gps_l1_ca_code_gen_complex_sampled(own::span<std::complex<float>> _dest, uint32_t _prn, int32_t _fs, uint32_t _chip_shift);
#endif // GNSS_SDR_GPS_SDR_SIGNAL_PROCESSING_H #endif // GNSS_SDR_GPS_SDR_SIGNAL_PROCESSING_H

View File

@ -80,7 +80,7 @@ GpsL1CaDllPllTrackingFpga::GpsL1CaDllPllTrackingFpga(
d_ca_codes = static_cast<int32_t*>(volk_gnsssdr_malloc(static_cast<int32_t>(GPS_L1_CA_CODE_LENGTH_CHIPS * NUM_PRNs) * sizeof(int32_t), volk_gnsssdr_get_alignment())); d_ca_codes = static_cast<int32_t*>(volk_gnsssdr_malloc(static_cast<int32_t>(GPS_L1_CA_CODE_LENGTH_CHIPS * NUM_PRNs) * sizeof(int32_t), volk_gnsssdr_get_alignment()));
for (uint32_t PRN = 1; PRN <= NUM_PRNs; PRN++) for (uint32_t PRN = 1; PRN <= NUM_PRNs; PRN++)
{ {
gps_l1_ca_code_gen_int(gsl::span<int32_t>(&d_ca_codes[static_cast<int32_t>(GPS_L1_CA_CODE_LENGTH_CHIPS) * (PRN - 1)], &d_ca_codes[static_cast<int32_t>(GPS_L1_CA_CODE_LENGTH_CHIPS) * (PRN)]), PRN, 0); gps_l1_ca_code_gen_int(own::span<int32_t>(&d_ca_codes[static_cast<int32_t>(GPS_L1_CA_CODE_LENGTH_CHIPS) * (PRN - 1)], &d_ca_codes[static_cast<int32_t>(GPS_L1_CA_CODE_LENGTH_CHIPS) * (PRN)]), PRN, 0);
// The code is generated as a series of 1s and -1s. In order to store the values using only one bit, a -1 is stored as a 0 in the FPGA // The code is generated as a series of 1s and -1s. In order to store the values using only one bit, a -1 is stored as a 0 in the FPGA
for (uint32_t k = 0; k < GPS_L1_CA_CODE_LENGTH_CHIPS; k++) for (uint32_t k = 0; k < GPS_L1_CA_CODE_LENGTH_CHIPS; k++)

View File

@ -130,6 +130,12 @@ else()
) )
endif() endif()
if(has_span)
target_compile_definitions(tracking_gr_blocks
PUBLIC -DHAS_STD_SPAN=1
)
endif()
if(ENABLE_CLANG_TIDY) if(ENABLE_CLANG_TIDY)
if(CLANG_TIDY_EXE) if(CLANG_TIDY_EXE)
set_target_properties(tracking_gr_blocks set_target_properties(tracking_gr_blocks

View File

@ -47,7 +47,6 @@
#include <glog/logging.h> #include <glog/logging.h>
#include <gnuradio/io_signature.h> // for io_signature #include <gnuradio/io_signature.h> // for io_signature
#include <gnuradio/thread/thread.h> // for scoped_lock #include <gnuradio/thread/thread.h> // for scoped_lock
#include <gsl/gsl>
#include <matio.h> // for Mat_VarCreate #include <matio.h> // for Mat_VarCreate
#include <pmt/pmt_sugar.h> // for mp #include <pmt/pmt_sugar.h> // for mp
#include <volk_gnsssdr/volk_gnsssdr.h> #include <volk_gnsssdr/volk_gnsssdr.h>

View File

@ -39,7 +39,6 @@
#include <glog/logging.h> #include <glog/logging.h>
#include <gnuradio/io_signature.h> // for io_signature #include <gnuradio/io_signature.h> // for io_signature
#include <gnuradio/thread/thread.h> // for scoped_lock #include <gnuradio/thread/thread.h> // for scoped_lock
#include <gsl/gsl>
#include <matio.h> // for Mat_VarCreate #include <matio.h> // for Mat_VarCreate
#include <pmt/pmt_sugar.h> // for mp #include <pmt/pmt_sugar.h> // for mp
#include <volk_gnsssdr/volk_gnsssdr.h> #include <volk_gnsssdr/volk_gnsssdr.h>

View File

@ -268,7 +268,7 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_cc::start_tracking()
d_code_loop_filter.initialize(); // initialize the code filter d_code_loop_filter.initialize(); // initialize the code filter
// generate local reference ALWAYS starting at chip 1 (1 sample per chip) // generate local reference ALWAYS starting at chip 1 (1 sample per chip)
glonass_l1_ca_code_gen_complex(gsl::span<gr_complex>(d_ca_code.data(), GLONASS_L1_CA_CODE_LENGTH_CHIPS), 0); glonass_l1_ca_code_gen_complex(own::span<gr_complex>(d_ca_code.data(), GLONASS_L1_CA_CODE_LENGTH_CHIPS), 0);
multicorrelator_cpu.set_local_code_and_taps(static_cast<int32_t>(GLONASS_L1_CA_CODE_LENGTH_CHIPS), d_ca_code.data(), d_local_code_shift_chips.data()); multicorrelator_cpu.set_local_code_and_taps(static_cast<int32_t>(GLONASS_L1_CA_CODE_LENGTH_CHIPS), d_ca_code.data(), d_local_code_shift_chips.data());
std::fill_n(d_correlator_outs.begin(), d_n_correlator_taps, gr_complex(0.0, 0.0)); std::fill_n(d_correlator_outs.begin(), d_n_correlator_taps, gr_complex(0.0, 0.0));

View File

@ -215,7 +215,7 @@ void Glonass_L2_Ca_Dll_Pll_Tracking_cc::start_tracking()
d_code_loop_filter.initialize(); // initialize the code filter d_code_loop_filter.initialize(); // initialize the code filter
// generate local reference ALWAYS starting at chip 1 (1 sample per chip) // generate local reference ALWAYS starting at chip 1 (1 sample per chip)
glonass_l2_ca_code_gen_complex(gsl::span<gr_complex>(d_ca_code.data(), GLONASS_L2_CA_CODE_LENGTH_CHIPS), 0); glonass_l2_ca_code_gen_complex(own::span<gr_complex>(d_ca_code.data(), GLONASS_L2_CA_CODE_LENGTH_CHIPS), 0);
multicorrelator_cpu.set_local_code_and_taps(static_cast<int32_t>(GLONASS_L2_CA_CODE_LENGTH_CHIPS), d_ca_code.data(), d_local_code_shift_chips.data()); multicorrelator_cpu.set_local_code_and_taps(static_cast<int32_t>(GLONASS_L2_CA_CODE_LENGTH_CHIPS), d_ca_code.data(), d_local_code_shift_chips.data());
std::fill_n(d_correlator_outs.begin(), d_n_correlator_taps, gr_complex(0.0, 0.0)); std::fill_n(d_correlator_outs.begin(), d_n_correlator_taps, gr_complex(0.0, 0.0));

View File

@ -207,7 +207,7 @@ void Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::start_tracking()
d_code_loop_filter.initialize(); // initialize the code filter d_code_loop_filter.initialize(); // initialize the code filter
// generate local reference ALWAYS starting at chip 1 (1 sample per chip) // generate local reference ALWAYS starting at chip 1 (1 sample per chip)
gps_l1_ca_code_gen_complex(gsl::span<gr_complex>(d_ca_code, static_cast<int32_t>(GPS_L1_CA_CODE_LENGTH_CHIPS)), d_acquisition_gnss_synchro->PRN, 0); gps_l1_ca_code_gen_complex(own::span<gr_complex>(d_ca_code, static_cast<int32_t>(GPS_L1_CA_CODE_LENGTH_CHIPS)), d_acquisition_gnss_synchro->PRN, 0);
multicorrelator_gpu->set_local_code_and_taps(static_cast<int32_t>(GPS_L1_CA_CODE_LENGTH_CHIPS), d_ca_code, d_local_code_shift_chips, d_n_correlator_taps); multicorrelator_gpu->set_local_code_and_taps(static_cast<int32_t>(GPS_L1_CA_CODE_LENGTH_CHIPS), d_ca_code, d_local_code_shift_chips, d_n_correlator_taps);

View File

@ -35,7 +35,6 @@
#include "tracking_discriminators.h" #include "tracking_discriminators.h"
#include <glog/logging.h> #include <glog/logging.h>
#include <gnuradio/io_signature.h> #include <gnuradio/io_signature.h>
#include <gsl/gsl>
#include <matio.h> #include <matio.h>
#include <volk_gnsssdr/volk_gnsssdr.h> #include <volk_gnsssdr/volk_gnsssdr.h>
#include <algorithm> #include <algorithm>

View File

@ -20,10 +20,15 @@
#include "gnss_signal_processing.h" #include "gnss_signal_processing.h"
#include "gps_sdr_signal_processing.h" #include "gps_sdr_signal_processing.h"
#include <gsl/gsl>
#include <chrono> #include <chrono>
#include <complex> #include <complex>
#if HAS_STD_SPAN
#include <span>
namespace gsl = std;
#else
#include <gsl/gsl>
#endif
TEST(CodeGenerationTest, CodeGenGPSL1Test) TEST(CodeGenerationTest, CodeGenGPSL1Test)
{ {
@ -38,7 +43,7 @@ TEST(CodeGenerationTest, CodeGenGPSL1Test)
for (int i = 0; i < iterations; i++) for (int i = 0; i < iterations; i++)
{ {
gps_l1_ca_code_gen_complex(gsl::span<std::complex<float>>(_dest, 1023), _prn, _chip_shift); gps_l1_ca_code_gen_complex(own::span<std::complex<float>>(_dest, 1023), _prn, _chip_shift);
} }
end = std::chrono::system_clock::now(); end = std::chrono::system_clock::now();
@ -67,7 +72,7 @@ TEST(CodeGenerationTest, CodeGenGPSL1SampledTest)
for (int i = 0; i < iterations; i++) for (int i = 0; i < iterations; i++)
{ {
gps_l1_ca_code_gen_complex_sampled(gsl::span<std::complex<float>>(_dest, _samplesPerCode), _prn, _fs, _chip_shift); gps_l1_ca_code_gen_complex_sampled(own::span<std::complex<float>>(_dest, _samplesPerCode), _prn, _fs, _chip_shift);
} }
end = std::chrono::system_clock::now(); end = std::chrono::system_clock::now();
@ -95,7 +100,7 @@ TEST(CodeGenerationTest, ComplexConjugateTest)
for (int i = 0; i < iterations; i++) for (int i = 0; i < iterations; i++)
{ {
complex_exp_gen_conj(gsl::span<std::complex<float>>(_dest, _samplesPerCode), _f, _fs); complex_exp_gen_conj(own::span<std::complex<float>>(_dest, _samplesPerCode), _f, _fs);
} }
end = std::chrono::system_clock::now(); end = std::chrono::system_clock::now();

View File

@ -21,10 +21,16 @@
#include "GPS_L1_CA.h" #include "GPS_L1_CA.h"
#include "gnss_signal_processing.h" #include "gnss_signal_processing.h"
#include <armadillo> #include <armadillo>
#include <gsl/gsl>
#include <chrono> #include <chrono>
#include <complex> #include <complex>
#if HAS_STD_SPAN
#include <span>
namespace gsl = std;
#else
#include <gsl/gsl>
#endif
DEFINE_int32(size_carrier_test, 100000, "Size of the arrays used for complex carrier testing"); DEFINE_int32(size_carrier_test, 100000, "Size of the arrays used for complex carrier testing");
@ -110,7 +116,7 @@ TEST(ComplexCarrierTest, OwnComplexImplementation)
std::chrono::time_point<std::chrono::system_clock> start, end; std::chrono::time_point<std::chrono::system_clock> start, end;
start = std::chrono::system_clock::now(); start = std::chrono::system_clock::now();
complex_exp_gen(gsl::span<std::complex<float>>(output, static_cast<unsigned int>(FLAGS_size_carrier_test)), _f, _fs); complex_exp_gen(own::span<std::complex<float>>(output, static_cast<unsigned int>(FLAGS_size_carrier_test)), _f, _fs);
end = std::chrono::system_clock::now(); end = std::chrono::system_clock::now();
std::chrono::duration<double> elapsed_seconds = end - start; std::chrono::duration<double> elapsed_seconds = end - start;

View File

@ -96,7 +96,7 @@ TEST(CpuMulticorrelatorRealCodesTest, MeasureExecutionTime)
// local code resampler on GPU // local code resampler on GPU
// generate local reference (1 sample per chip) // generate local reference (1 sample per chip)
gps_l1_ca_code_gen_float(gsl::span<float>(d_ca_code, static_cast<int>(GPS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(float)), 1, 0); gps_l1_ca_code_gen_float(own::span<float>(d_ca_code, static_cast<int>(GPS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(float)), 1, 0);
// generate inut signal // generate inut signal
std::random_device r; std::random_device r;
std::default_random_engine e1(r()); std::default_random_engine e1(r());

View File

@ -93,7 +93,7 @@ TEST(CpuMulticorrelatorTest, MeasureExecutionTime)
// local code resampler on GPU // local code resampler on GPU
// generate local reference (1 sample per chip) // generate local reference (1 sample per chip)
gps_l1_ca_code_gen_complex(gsl::span<gr_complex>(d_ca_code, static_cast<int>(GPS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(gr_complex)), 1, 0); gps_l1_ca_code_gen_complex(own::span<gr_complex>(d_ca_code, static_cast<int>(GPS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(gr_complex)), 1, 0);
// generate inut signal // generate inut signal
std::random_device r; std::random_device r;
std::default_random_engine e1(r()); std::default_random_engine e1(r());

View File

@ -85,7 +85,7 @@ TEST(GpuMulticorrelatorTest, MeasureExecutionTime)
// --- Perform initializations ------------------------------ // --- Perform initializations ------------------------------
// local code resampler on GPU // local code resampler on GPU
// generate local reference (1 sample per chip) // generate local reference (1 sample per chip)
gps_l1_ca_code_gen_complex(gsl::span<gr_complex>(d_ca_code, static_cast<int>(GPS_L1_CA_CODE_LENGTH_CHIPS)), 1, 0); gps_l1_ca_code_gen_complex(own::span<gr_complex>(d_ca_code, static_cast<int>(GPS_L1_CA_CODE_LENGTH_CHIPS)), 1, 0);
// generate inut signal // generate inut signal
for (int n = 0; n < 2 * d_vector_length; n++) for (int n = 0; n < 2 * d_vector_length; n++)
{ {