1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-10-25 20:47:39 +00:00

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

This commit is contained in:
Marc Majoral
2019-03-18 19:37:19 +01:00
345 changed files with 3502 additions and 2905 deletions

View File

@@ -98,6 +98,9 @@ target_link_libraries(tracking_adapters
tracking_gr_blocks
algorithms_libs
gnss_sdr_flags
Gnuradio::runtime
PRIVATE
Volkgnsssdr::volkgnsssdr
)
target_include_directories(tracking_adapters

View File

@@ -42,7 +42,6 @@
#include "gnss_sdr_flags.h"
#include <glog/logging.h>
using google::LogMessage;
BeidouB1iDllPllTracking::BeidouB1iDllPllTracking(
ConfigurationInterface* configuration, const std::string& role,

View File

@@ -43,9 +43,6 @@
#include <glog/logging.h>
using google::LogMessage;
GalileoE1DllPllVemlTracking::GalileoE1DllPllVemlTracking(
ConfigurationInterface* configuration, const std::string& role,
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)

View File

@@ -3,7 +3,6 @@
* \brief Adapts a DLL+PLL VEML (Very Early Minus Late) tracking loop block
* to a TrackingInterface for Galileo E1 signals for the FPGA
* \author Marc Majoral, 2019. mmajoral(at)cttc.cat
* \author Luis Esteve, 2012. luis(at)epsilon-formacion.com
*
* Code DLL + carrier PLL according to the algorithms described in:
* K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S.H.Jensen,
@@ -39,15 +38,16 @@
#include "Galileo_E1.h"
#include "configuration_interface.h"
#include "display.h"
#include "dll_pll_conf_fpga.h"
#include "galileo_e1_signal_processing.h"
#include "gnss_sdr_flags.h"
#include "gnss_synchro.h"
#include <glog/logging.h>
#include <volk_gnsssdr/volk_gnsssdr.h>
#include <cmath> // for round
#include <cstring> // for memcpy
#include <iostream> // for operator<<,
using google::LogMessage;
void GalileoE1DllPllVemlTrackingFpga::stop_tracking()
{
}
GalileoE1DllPllVemlTrackingFpga::GalileoE1DllPllVemlTrackingFpga(
ConfigurationInterface* configuration, const std::string& role,
@@ -135,16 +135,16 @@ GalileoE1DllPllVemlTrackingFpga::GalileoE1DllPllVemlTrackingFpga(
uint32_t code_samples_per_chip = 2;
d_ca_codes = static_cast<int32_t*>(volk_gnsssdr_malloc(static_cast<int32_t>(GALILEO_E1_B_CODE_LENGTH_CHIPS) * code_samples_per_chip * GALILEO_E1_NUMBER_OF_CODES * sizeof(int32_t), volk_gnsssdr_get_alignment()));
float* ca_codes_f;
float* data_codes_f;
float* data_codes_f = nullptr;
d_data_codes = nullptr;
if (trk_param_fpga.track_pilot)
if (d_track_pilot)
{
d_data_codes = static_cast<int32_t*>(volk_gnsssdr_malloc((static_cast<uint32_t>(GALILEO_E1_B_CODE_LENGTH_CHIPS)) * code_samples_per_chip * GALILEO_E1_NUMBER_OF_CODES * sizeof(int32_t), volk_gnsssdr_get_alignment()));
}
ca_codes_f = static_cast<float*>(volk_gnsssdr_malloc(static_cast<int32_t>(GALILEO_E1_B_CODE_LENGTH_CHIPS) * code_samples_per_chip * sizeof(float), volk_gnsssdr_get_alignment()));
if (trk_param_fpga.track_pilot)
if (d_track_pilot)
{
data_codes_f = static_cast<float*>(volk_gnsssdr_malloc((static_cast<uint32_t>(GALILEO_E1_B_CODE_LENGTH_CHIPS)) * code_samples_per_chip * sizeof(float), volk_gnsssdr_get_alignment()));
}
@@ -152,7 +152,7 @@ GalileoE1DllPllVemlTrackingFpga::GalileoE1DllPllVemlTrackingFpga(
for (uint32_t PRN = 1; PRN <= GALILEO_E1_NUMBER_OF_CODES; PRN++)
{
char data_signal[3] = "1B";
if (trk_param_fpga.track_pilot)
if (d_track_pilot)
{
char pilot_signal[3] = "1C";
galileo_e1_code_gen_sinboc11_float(ca_codes_f, pilot_signal, PRN);
@@ -176,9 +176,9 @@ GalileoE1DllPllVemlTrackingFpga::GalileoE1DllPllVemlTrackingFpga(
}
delete[] ca_codes_f;
if (trk_param_fpga.track_pilot)
if (d_track_pilot)
{
delete[] data_codes_f;
volk_gnsssdr_free(data_codes_f);
}
trk_param_fpga.ca_codes = d_ca_codes;
trk_param_fpga.data_codes = d_data_codes;
@@ -200,6 +200,12 @@ GalileoE1DllPllVemlTrackingFpga::~GalileoE1DllPllVemlTrackingFpga()
}
}
void GalileoE1DllPllVemlTrackingFpga::stop_tracking()
{
}
void GalileoE1DllPllVemlTrackingFpga::start_tracking()
{
tracking_fpga_sc->start_tracking();
@@ -227,7 +233,7 @@ void GalileoE1DllPllVemlTrackingFpga::connect(gr::top_block_sptr top_block)
if (top_block)
{ /* top_block is not null */
};
//nothing to connect, now the tracking uses gr_sync_decimator
// nothing to connect, now the tracking uses gr_sync_decimator
}
@@ -236,7 +242,7 @@ void GalileoE1DllPllVemlTrackingFpga::disconnect(gr::top_block_sptr top_block)
if (top_block)
{ /* top_block is not null */
};
//nothing to disconnect, now the tracking uses gr_sync_decimator
// nothing to disconnect, now the tracking uses gr_sync_decimator
}

View File

@@ -1,9 +1,8 @@
/*!
* \file galileo_e1_dll_pll_veml_tracking_fpga.h
* \brief Adapts a DLL+PLL VEML (Very Early Minus Late) tracking loop block
* to a TrackingInterface for Galileo E1 signals for the FPGA
* \brief Adapts a DLL+PLL VEML (Very Early Minus Late) tracking loop block
* to a TrackingInterface for Galileo E1 signals for the FPGA
* \author Marc Majoral, 2019. mmajoral(at)cttc.cat
* \author Luis Esteve, 2012. luis(at)epsilon-formacion.com
*
* Code DLL + carrier PLL according to the algorithms described in:
* K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S.H.Jensen,
@@ -40,9 +39,12 @@
#include "dll_pll_veml_tracking_fpga.h"
#include "tracking_interface.h"
#include <string>
#include <gnuradio/runtime_types.h> // for basic_block_sptr, basic_block_sptr
#include <cstddef> // for size_t
#include <cstdint> // for uint32_t
#include <string> // for string
class Gnss_Synchro;
class ConfigurationInterface;
/*!
@@ -72,7 +74,7 @@ public:
inline size_t item_size() override
{
return item_size_;
return sizeof(int);
}
void connect(gr::top_block_sptr top_block) override;
@@ -88,7 +90,7 @@ public:
/*!
* \brief Set acquisition/tracking common Gnss_Synchro object pointer
* to efficiently exchange synchronization data between acquisition and
* tracking blocks
* tracking blocks
*/
void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) override;
@@ -99,10 +101,8 @@ public:
*/
void stop_tracking() override;
private:
dll_pll_veml_tracking_fpga_sptr tracking_fpga_sc;
size_t item_size_;
uint32_t channel_;
std::string role_;
uint32_t in_streams_;

View File

@@ -43,9 +43,6 @@
#include <utility>
using google::LogMessage;
GalileoE1TcpConnectorTracking::GalileoE1TcpConnectorTracking(
ConfigurationInterface* configuration, const std::string& role,
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)

View File

@@ -2,8 +2,6 @@
* \file galileo_e5a_dll_pll_tracking.cc
* \brief Adapts a code DLL + carrier PLL
* tracking block to a TrackingInterface for Galileo E5a signals
* \brief Adapts a PCPS acquisition block to an AcquisitionInterface for
* Galileo E5a data and pilot Signals
* \author Marc Sales, 2014. marcsales92(at)gmail.com
* \based on work from:
* <ul>
@@ -43,8 +41,6 @@
#include "gnss_sdr_flags.h"
#include <glog/logging.h>
using google::LogMessage;
GalileoE5aDllPllTracking::GalileoE5aDllPllTracking(
ConfigurationInterface* configuration, const std::string& role,

View File

@@ -2,8 +2,6 @@
* \file galileo_e5a_dll_pll_tracking.h
* \brief Adapts a code DLL + carrier PLL
* tracking block to a TrackingInterface for Galileo E5a signals
* \brief Adapts a PCPS acquisition block to an AcquisitionInterface for
* Galileo E5a data and pilot Signals
* \author Marc Sales, 2014. marcsales92(at)gmail.com
* \based on work from:
* <ul>

View File

@@ -2,15 +2,7 @@
* \file galileo_e5a_dll_pll_tracking_fpga.cc
* \brief Adapts a code DLL + carrier PLL
* tracking block to a TrackingInterface for Galileo E5a signals for the FPGA
* \brief Adapts a PCPS acquisition block to an AcquisitionInterface for
* Galileo E5a data and pilot Signals for the FPGA
* \author Marc Sales, 2014. marcsales92(at)gmail.com
* \based on work from:
* <ul>
* <li> Marc Majoral, 2019. mmajoral(at)cttc.cat
* <li> Javier Arribas, 2011. jarribas(at)cttc.es
* <li> Luis Esteve, 2012. luis(at)epsilon-formacion.com
* </ul>
* \author Marc Majoral, 2019. mmajoral(at)cttc.cat
*
* -------------------------------------------------------------------------
*
@@ -41,15 +33,18 @@
#include "Galileo_E5a.h"
#include "configuration_interface.h"
#include "display.h"
#include "dll_pll_conf_fpga.h"
#include "galileo_e5_signal_processing.h"
#include "gnss_sdr_flags.h"
#include "gnss_synchro.h"
#include <glog/logging.h>
#include <gnuradio/gr_complex.h> // for gr_complex
#include <volk_gnsssdr/volk_gnsssdr.h>
#include <cmath> // for round
#include <complex>
#include <cstring> // for memcpy
#include <iostream>
using google::LogMessage;
void GalileoE5aDllPllTrackingFpga::stop_tracking()
{
}
GalileoE5aDllPllTrackingFpga::GalileoE5aDllPllTrackingFpga(
ConfigurationInterface *configuration, const std::string &role,
@@ -122,6 +117,7 @@ GalileoE5aDllPllTrackingFpga::GalileoE5aDllPllTrackingFpga(
double carrier_lock_th = configuration->property(role + ".carrier_lock_th", 0.85);
if (FLAGS_carrier_lock_th != 0.85) carrier_lock_th = FLAGS_carrier_lock_th;
trk_param_fpga.carrier_lock_th = carrier_lock_th;
d_data_codes = nullptr;
// FPGA configuration parameters
std::string default_device_name = "/dev/uio";
@@ -144,7 +140,6 @@ GalileoE5aDllPllTrackingFpga::GalileoE5aDllPllTrackingFpga(
d_data_codes = static_cast<int32_t *>(volk_gnsssdr_malloc((static_cast<uint32_t>(code_length_chips)) * code_samples_per_chip * GALILEO_E5A_NUMBER_OF_CODES * sizeof(int32_t), volk_gnsssdr_get_alignment()));
}
for (uint32_t PRN = 1; PRN <= GALILEO_E5A_NUMBER_OF_CODES; PRN++)
{
galileo_e5_a_code_gen_complex_primary(aux_code, PRN, const_cast<char *>(sig_));
@@ -194,6 +189,11 @@ void GalileoE5aDllPllTrackingFpga::start_tracking()
}
void GalileoE5aDllPllTrackingFpga::stop_tracking()
{
}
/*
* Set tracking channel unique ID
*/

View File

@@ -2,15 +2,7 @@
* \file galileo_e5a_dll_pll_tracking_fpga.h
* \brief Adapts a code DLL + carrier PLL
* tracking block to a TrackingInterface for Galileo E5a signals for the FPGA
* \brief Adapts a PCPS acquisition block to an AcquisitionInterface for
* Galileo E5a data and pilot Signals for the FPGA
* \author Marc Sales, 2014. marcsales92(at)gmail.com
* \based on work from:
* <ul>
* <li> Marc Majoral, 2019. mmajoral(at)cttc.cat
* <li> Javier Arribas, 2011. jarribas(at)cttc.es
* <li> Luis Esteve, 2012. luis(at)epsilon-formacion.com
* </ul>
* \author Marc Majoral, 2019. mmajoral(at)cttc.cat
*
* -------------------------------------------------------------------------
*
@@ -42,8 +34,12 @@
#include "dll_pll_veml_tracking_fpga.h"
#include "tracking_interface.h"
#include <gnuradio/runtime_types.h> // for basic_block_sptr
#include <cstdint> // For uint32_t
#include <stddef.h> // for size_t
#include <string>
class Gnss_Synchro;
class ConfigurationInterface;
/*!
@@ -72,7 +68,7 @@ public:
inline size_t item_size() override
{
return item_size_;
return sizeof(int);
}
void connect(gr::top_block_sptr top_block) override;
@@ -99,13 +95,11 @@ public:
private:
dll_pll_veml_tracking_fpga_sptr tracking_fpga_sc;
size_t item_size_;
uint32_t channel_;
std::string role_;
uint32_t in_streams_;
uint32_t out_streams_;
int32_t* d_ca_codes;
int32_t* d_data_codes;
bool d_track_pilot;

View File

@@ -44,9 +44,6 @@
#include <glog/logging.h>
using google::LogMessage;
GlonassL1CaDllPllCAidTracking::GlonassL1CaDllPllCAidTracking(
ConfigurationInterface* configuration, const std::string& role,
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)

View File

@@ -43,9 +43,6 @@
#include <glog/logging.h>
using google::LogMessage;
GlonassL1CaDllPllTracking::GlonassL1CaDllPllTracking(
ConfigurationInterface* configuration, const std::string& role,
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)

View File

@@ -42,9 +42,6 @@
#include <glog/logging.h>
using google::LogMessage;
GlonassL2CaDllPllCAidTracking::GlonassL2CaDllPllCAidTracking(
ConfigurationInterface* configuration, const std::string& role,
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)

View File

@@ -41,9 +41,6 @@
#include <glog/logging.h>
using google::LogMessage;
GlonassL2CaDllPllTracking::GlonassL2CaDllPllTracking(
ConfigurationInterface* configuration, const std::string& role,
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)

View File

@@ -43,9 +43,6 @@
#include <glog/logging.h>
using google::LogMessage;
GpsL1CaDllPllCAidTracking::GpsL1CaDllPllCAidTracking(
ConfigurationInterface* configuration, const std::string& role,
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)

View File

@@ -43,8 +43,6 @@
#include "gnss_sdr_flags.h"
#include <glog/logging.h>
using google::LogMessage;
GpsL1CaDllPllTracking::GpsL1CaDllPllTracking(
ConfigurationInterface* configuration, const std::string& role,

View File

@@ -3,8 +3,6 @@
* \brief Implementation of an adapter of a DLL+PLL tracking loop block
* for GPS L1 C/A to a TrackingInterface for the FPGA
* \author Marc Majoral, 2019, mmajoral(at)cttc.es
* Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
* Javier Arribas, 2011. jarribas(at)cttc.es
*
* Code DLL + carrier PLL according to the algorithms described in:
* K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S.H.Jensen,
@@ -40,17 +38,18 @@
#include "GPS_L1_CA.h"
#include "configuration_interface.h"
#include "display.h"
#include "dll_pll_conf_fpga.h"
#include "gnss_sdr_flags.h"
#include "gnss_synchro.h"
#include "gps_sdr_signal_processing.h"
#include <glog/logging.h>
#include <volk_gnsssdr/volk_gnsssdr.h>
#include <cmath> // for round
#include <cstring> // for memcpy
#include <iostream>
#define NUM_PRNs 32
using google::LogMessage;
void GpsL1CaDllPllTrackingFpga::stop_tracking()
{
}
GpsL1CaDllPllTrackingFpga::GpsL1CaDllPllTrackingFpga(
ConfigurationInterface* configuration, const std::string& role,
@@ -150,16 +149,24 @@ GpsL1CaDllPllTrackingFpga::GpsL1CaDllPllTrackingFpga(
DLOG(INFO) << "tracking(" << tracking_fpga_sc->unique_id() << ")";
}
GpsL1CaDllPllTrackingFpga::~GpsL1CaDllPllTrackingFpga()
{
delete[] d_ca_codes;
}
void GpsL1CaDllPllTrackingFpga::start_tracking()
{
tracking_fpga_sc->start_tracking();
}
void GpsL1CaDllPllTrackingFpga::stop_tracking()
{
}
/*
* Set tracking channel unique ID
*/
@@ -169,11 +176,13 @@ void GpsL1CaDllPllTrackingFpga::set_channel(unsigned int channel)
tracking_fpga_sc->set_channel(channel);
}
void GpsL1CaDllPllTrackingFpga::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro)
{
tracking_fpga_sc->set_gnss_synchro(p_gnss_synchro);
}
void GpsL1CaDllPllTrackingFpga::connect(gr::top_block_sptr top_block)
{
if (top_block)

View File

@@ -3,8 +3,6 @@
* \brief Interface of an adapter of a DLL+PLL tracking loop block
* for GPS L1 C/A to a TrackingInterface for the FPGA
* \author Marc Majoral, 2019, mmajoral(at)cttc.es
* Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
* Javier Arribas, 2011. jarribas(at)cttc.es
*
* Code DLL + carrier PLL according to the algorithms described in:
* K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S.H.Jensen,
@@ -41,9 +39,12 @@
#include "dll_pll_veml_tracking_fpga.h"
#include "tracking_interface.h"
#include <gnuradio/runtime_types.h>
#include <cstddef>
#include <string>
class Gnss_Synchro;
class ConfigurationInterface;
/*!
@@ -72,7 +73,7 @@ public:
inline size_t item_size() override
{
return item_size_;
return sizeof(int);
}
void connect(gr::top_block_sptr top_block) override;
@@ -100,7 +101,6 @@ public:
private:
dll_pll_veml_tracking_fpga_sptr tracking_fpga_sc;
size_t item_size_;
uint32_t channel_;
std::string role_;
uint32_t in_streams_;

View File

@@ -42,12 +42,6 @@
#include <glog/logging.h>
using google::LogMessage;
void GpsL1CaDllPllTrackingGPU::stop_tracking()
{
}
GpsL1CaDllPllTrackingGPU::GpsL1CaDllPllTrackingGPU(
ConfigurationInterface* configuration, std::string role,
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
@@ -118,6 +112,12 @@ void GpsL1CaDllPllTrackingGPU::start_tracking()
tracking_->start_tracking();
}
void GpsL1CaDllPllTrackingGPU::stop_tracking()
{
}
/*
* Set tracking channel unique ID
*/
@@ -127,11 +127,13 @@ void GpsL1CaDllPllTrackingGPU::set_channel(unsigned int channel)
tracking_->set_channel(channel);
}
void GpsL1CaDllPllTrackingGPU::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro)
{
tracking_->set_gnss_synchro(p_gnss_synchro);
}
void GpsL1CaDllPllTrackingGPU::connect(gr::top_block_sptr top_block)
{
if (top_block)
@@ -140,6 +142,7 @@ void GpsL1CaDllPllTrackingGPU::connect(gr::top_block_sptr top_block)
//nothing to connect, now the tracking uses gr_sync_decimator
}
void GpsL1CaDllPllTrackingGPU::disconnect(gr::top_block_sptr top_block)
{
if (top_block)
@@ -148,11 +151,13 @@ void GpsL1CaDllPllTrackingGPU::disconnect(gr::top_block_sptr top_block)
//nothing to disconnect, now the tracking uses gr_sync_decimator
}
gr::basic_block_sptr GpsL1CaDllPllTrackingGPU::get_left_block()
{
return tracking_;
}
gr::basic_block_sptr GpsL1CaDllPllTrackingGPU::get_right_block()
{
return tracking_;

View File

@@ -45,9 +45,6 @@
#include <glog/logging.h>
using google::LogMessage;
GpsL1CaKfTracking::GpsL1CaKfTracking(
ConfigurationInterface* configuration, const std::string& role,
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)

View File

@@ -42,9 +42,6 @@
#include <utility>
using google::LogMessage;
GpsL1CaTcpConnectorTracking::GpsL1CaTcpConnectorTracking(
ConfigurationInterface* configuration, const std::string& role,
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)

View File

@@ -43,9 +43,6 @@
#include <glog/logging.h>
using google::LogMessage;
GpsL2MDllPllTracking::GpsL2MDllPllTracking(
ConfigurationInterface* configuration, const std::string& role,
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)

View File

@@ -1,8 +1,8 @@
/*!
* \file gps_l2_m_dll_pll_tracking.cc
* \file gps_l2_m_dll_pll_tracking_fpga.cc
* \brief Implementation of an adapter of a DLL+PLL tracking loop block
* for GPS L1 C/A to a TrackingInterface
* \author Javier Arribas, 2015. jarribas(at)cttc.es
* for GPS L2C to a TrackingInterface for the FPGA
* \author Javier Arribas, 2019. jarribas(at)cttc.es
*
* Code DLL + carrier PLL according to the algorithms described in:
* K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S.H.Jensen,
@@ -11,7 +11,7 @@
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2015 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2019 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
@@ -39,28 +39,27 @@
#include "GPS_L2C.h"
#include "configuration_interface.h"
#include "display.h"
#include "dll_pll_conf_fpga.h"
#include "gnss_sdr_flags.h"
#include "gnss_synchro.h"
#include "gps_l2c_signal.h"
#include <glog/logging.h>
#include <volk_gnsssdr/volk_gnsssdr.h>
#include <cmath> // for round
#include <cstring> // for memcpy
#include <iostream>
#define NUM_PRNs 32
using google::LogMessage;
void GpsL2MDllPllTrackingFpga::stop_tracking()
{
}
GpsL2MDllPllTrackingFpga::GpsL2MDllPllTrackingFpga(
ConfigurationInterface* configuration, const std::string& role,
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
{
//dllpllconf_t trk_param;
Dll_Pll_Conf_Fpga trk_param_fpga = Dll_Pll_Conf_Fpga();
DLOG(INFO) << "role " << role;
//################# CONFIGURATION PARAMETERS ########################
//std::string default_item_type = "gr_complex";
//std::string item_type = configuration->property(role + ".item_type", default_item_type);
int fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000);
int fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
trk_param_fpga.fs_in = fs_in;
@@ -123,15 +122,12 @@ GpsL2MDllPllTrackingFpga::GpsL2MDllPllTrackingFpga(
//unsigned int multicorr_type = configuration->property(role + ".multicorr_type", 0);
trk_param_fpga.multicorr_type = 0; //multicorr_type : 0 -> 3 correlators, 1 -> 5 correlators
//d_tracking_code = static_cast<float *>(volk_gnsssdr_malloc(2 * static_cast<unsigned int>(GPS_L2_M_CODE_LENGTH_CHIPS) * sizeof(float), volk_gnsssdr_get_alignment()));
d_ca_codes = static_cast<int*>(volk_gnsssdr_malloc(static_cast<unsigned int>(GPS_L2_M_CODE_LENGTH_CHIPS) * NUM_PRNs * sizeof(int), volk_gnsssdr_get_alignment()));
auto* ca_codes_f = static_cast<float*>(volk_gnsssdr_malloc(static_cast<unsigned int>(GPS_L2_M_CODE_LENGTH_CHIPS) * sizeof(float), volk_gnsssdr_get_alignment()));
//################# PRE-COMPUTE ALL THE CODES #################
d_ca_codes = static_cast<int*>(volk_gnsssdr_malloc(static_cast<int>(GPS_L2_M_CODE_LENGTH_CHIPS * NUM_PRNs) * sizeof(int), volk_gnsssdr_get_alignment()));
for (unsigned int PRN = 1; PRN <= NUM_PRNs; PRN++)
{
//gps_l1_ca_code_gen_int(&d_ca_codes[(int(GPS_L1_CA_CODE_LENGTH_CHIPS)) * (PRN - 1)], PRN, 0);
gps_l2c_m_code_gen_float(ca_codes_f, PRN);
for (unsigned int s = 0; s < 2 * static_cast<unsigned int>(GPS_L2_M_CODE_LENGTH_CHIPS); s++)
{
@@ -139,27 +135,13 @@ GpsL2MDllPllTrackingFpga::GpsL2MDllPllTrackingFpga(
}
}
delete[] ca_codes_f;
volk_gnsssdr_free(ca_codes_f);
trk_param_fpga.ca_codes = d_ca_codes;
trk_param_fpga.code_length_chips = GPS_L2_M_CODE_LENGTH_CHIPS;
trk_param_fpga.code_samples_per_chip = 1; // 1 sample per chip
//################# MAKE TRACKING GNURadio object ###################
// //################# MAKE TRACKING GNURadio object ###################
// if (item_type.compare("gr_complex") == 0)
// {
// item_size_ = sizeof(gr_complex);
// tracking_ = dll_pll_veml_make_tracking(trk_param);
// }
// else
// {
// item_size_ = sizeof(gr_complex);
// LOG(WARNING) << item_type << " unknown tracking item type.";
// }
//################# MAKE TRACKING GNURadio object ###################
//################# MAKE TRACKING GNU Radio object ###################
tracking_fpga_sc = dll_pll_veml_make_tracking_fpga(trk_param_fpga);
channel_ = 0;
@@ -167,30 +149,35 @@ GpsL2MDllPllTrackingFpga::GpsL2MDllPllTrackingFpga(
}
GpsL2MDllPllTrackingFpga::~GpsL2MDllPllTrackingFpga() = default;
GpsL2MDllPllTrackingFpga::~GpsL2MDllPllTrackingFpga()
{
volk_gnsssdr_free(d_ca_codes);
}
void GpsL2MDllPllTrackingFpga::start_tracking()
{
//tracking_->start_tracking();
tracking_fpga_sc->start_tracking();
}
void GpsL2MDllPllTrackingFpga::stop_tracking()
{
}
/*
* Set tracking channel unique ID
*/
void GpsL2MDllPllTrackingFpga::set_channel(unsigned int channel)
{
channel_ = channel;
//tracking_->set_channel(channel);
tracking_fpga_sc->set_channel(channel);
}
void GpsL2MDllPllTrackingFpga::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro)
{
//tracking_->set_gnss_synchro(p_gnss_synchro);
tracking_fpga_sc->set_gnss_synchro(p_gnss_synchro);
}
@@ -200,7 +187,7 @@ void GpsL2MDllPllTrackingFpga::connect(gr::top_block_sptr top_block)
if (top_block)
{ /* top_block is not null */
};
//nothing to connect, now the tracking uses gr_sync_decimator
// nothing to connect
}
@@ -209,19 +196,17 @@ void GpsL2MDllPllTrackingFpga::disconnect(gr::top_block_sptr top_block)
if (top_block)
{ /* top_block is not null */
};
//nothing to disconnect, now the tracking uses gr_sync_decimator
// nothing to disconnect
}
gr::basic_block_sptr GpsL2MDllPllTrackingFpga::get_left_block()
{
//return tracking_;
return tracking_fpga_sc;
}
gr::basic_block_sptr GpsL2MDllPllTrackingFpga::get_right_block()
{
//return tracking_;
return tracking_fpga_sc;
}

View File

@@ -1,9 +1,8 @@
/*!
* \file gps_l2_m_dll_pll_tracking.h
* \file gps_l2_m_dll_pll_tracking_fpga.h
* \brief Interface of an adapter of a DLL+PLL tracking loop block
* for GPS L1 C/A to a TrackingInterface
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
* Javier Arribas, 2011. jarribas(at)cttc.es
* for GPS L2C to a TrackingInterface for the FPGA
* \author Marc Majoral, 2019, mmajoral(at)cttc.es
*
* Code DLL + carrier PLL according to the algorithms described in:
* K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S.H.Jensen,
@@ -12,7 +11,7 @@
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2015 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2019 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
@@ -35,14 +34,16 @@
* -------------------------------------------------------------------------
*/
#ifndef GNSS_SDR_gps_l2_m_dll_pll_tracking_FPGA_H_
#define GNSS_SDR_gps_l2_m_dll_pll_tracking_FPGA_H_
#ifndef GNSS_SDR_GPS_L2_M_DLL_PLL_TRACKING_FPGA_H_
#define GNSS_SDR_GPS_L2_M_DLL_PLL_TRACKING_FPGA_H_
#include "tracking_interface.h"
//#include "dll_pll_veml_tracking.h"
#include "dll_pll_veml_tracking_fpga.h"
#include "tracking_interface.h"
#include <gnuradio/runtime_types.h>
#include <cstddef>
#include <string>
class Gnss_Synchro;
class ConfigurationInterface;
/*!
@@ -71,7 +72,7 @@ public:
inline size_t item_size() override
{
return item_size_;
return sizeof(int);
}
void connect(gr::top_block_sptr top_block) override;
@@ -91,15 +92,14 @@ public:
void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) override;
void start_tracking() override;
/*!
* \brief Stop running tracking
*/
void stop_tracking() override;
private:
//dll_pll_veml_tracking_sptr tracking_;
dll_pll_veml_tracking_fpga_sptr tracking_fpga_sc;
size_t item_size_;
unsigned int channel_;
std::string role_;
unsigned int in_streams_;
@@ -107,4 +107,4 @@ private:
int* d_ca_codes;
};
#endif // GNSS_SDR_gps_l2_m_dll_pll_tracking_FPGA_H_
#endif // GNSS_SDR_GPS_L2_M_DLL_PLL_TRACKING_FPGA_H_

View File

@@ -43,9 +43,6 @@
#include <glog/logging.h>
using google::LogMessage;
GpsL5DllPllTracking::GpsL5DllPllTracking(
ConfigurationInterface* configuration, const std::string& role,
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)

View File

@@ -1,9 +1,9 @@
/*!
* \file gps_l5_dll_pll_tracking.cc
* \file gps_l5_dll_pll_tracking_fpga.cc
* \brief Interface of an adapter of a DLL+PLL tracking loop block
* for GPS L5 to a TrackingInterface
* for GPS L5 to a TrackingInterface for the FPGA
* \author Marc Majoral, 2019. mmajoral(at)cttc.cat
* \author Javier Arribas, 2017. jarribas(at)cttc.es
* Javier Arribas, 2019. jarribas(at)cttc.es
*
* Code DLL + carrier PLL according to the algorithms described in:
* K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S.H.Jensen,
@@ -40,17 +40,18 @@
#include "GPS_L5.h"
#include "configuration_interface.h"
#include "display.h"
#include "dll_pll_conf_fpga.h"
#include "gnss_sdr_flags.h"
#include "gnss_synchro.h"
#include "gps_l5_signal.h"
#include <glog/logging.h>
#include <volk_gnsssdr/volk_gnsssdr.h>
#include <cmath> // for round
#include <cstring> // for memcpy
#include <iostream>
#define NUM_PRNs 32
using google::LogMessage;
void GpsL5DllPllTrackingFpga::stop_tracking()
{
}
GpsL5DllPllTrackingFpga::GpsL5DllPllTrackingFpga(
ConfigurationInterface *configuration, const std::string &role,
@@ -123,7 +124,6 @@ GpsL5DllPllTrackingFpga::GpsL5DllPllTrackingFpga(
trk_param_fpga.carrier_lock_th = carrier_lock_th;
// FPGA configuration parameters
std::string default_device_name = "/dev/uio";
std::string device_name = configuration->property(role + ".devicename", default_device_name);
trk_param_fpga.device_name = device_name;
@@ -135,37 +135,40 @@ GpsL5DllPllTrackingFpga::GpsL5DllPllTrackingFpga(
auto code_length_chips = static_cast<uint32_t>(GPS_L5I_CODE_LENGTH_CHIPS);
float *tracking_code;
float *data_code;
float *data_code = nullptr;
tracking_code = static_cast<float *>(volk_gnsssdr_malloc(code_length_chips * sizeof(float), volk_gnsssdr_get_alignment()));
if (trk_param_fpga.track_pilot)
if (track_pilot)
{
data_code = static_cast<float *>(volk_gnsssdr_malloc(code_length_chips * sizeof(float), volk_gnsssdr_get_alignment()));
for (uint32_t i = 0; i < code_length_chips; i++)
{
data_code[i] = 0.0;
}
}
d_ca_codes = static_cast<int32_t *>(volk_gnsssdr_malloc(static_cast<int32_t>(code_length_chips * NUM_PRNs) * sizeof(int32_t), volk_gnsssdr_get_alignment()));
if (trk_param_fpga.track_pilot)
d_data_codes = nullptr;
if (track_pilot)
{
d_data_codes = static_cast<int32_t *>(volk_gnsssdr_malloc((static_cast<uint32_t>(code_length_chips)) * NUM_PRNs * sizeof(int32_t), volk_gnsssdr_get_alignment()));
}
for (uint32_t PRN = 1; PRN <= NUM_PRNs; PRN++)
{
if (trk_param_fpga.track_pilot)
if (track_pilot)
{
gps_l5q_code_gen_float(tracking_code, PRN);
gps_l5i_code_gen_float(data_code, PRN);
for (uint32_t s = 0; s < code_length_chips; s++)
{
d_ca_codes[static_cast<int32_t>(code_length_chips) * (PRN - 1) + s] = static_cast<int32_t>(tracking_code[s]);
d_data_codes[static_cast<int32_t>(code_length_chips) * (PRN - 1) + s] = static_cast<int32_t>(data_code[s]);
}
}
else
{
gps_l5i_code_gen_float(tracking_code, PRN);
@@ -176,10 +179,10 @@ GpsL5DllPllTrackingFpga::GpsL5DllPllTrackingFpga(
}
}
delete[] tracking_code;
if (trk_param_fpga.track_pilot)
volk_gnsssdr_free(tracking_code);
if (track_pilot)
{
delete[] data_code;
volk_gnsssdr_free(data_code);
}
trk_param_fpga.ca_codes = d_ca_codes;
trk_param_fpga.data_codes = d_data_codes;
@@ -193,10 +196,10 @@ GpsL5DllPllTrackingFpga::GpsL5DllPllTrackingFpga(
GpsL5DllPllTrackingFpga::~GpsL5DllPllTrackingFpga()
{
delete[] d_ca_codes;
volk_gnsssdr_free(d_ca_codes);
if (d_track_pilot)
{
delete[] d_data_codes;
volk_gnsssdr_free(d_data_codes);
}
}
@@ -207,6 +210,11 @@ void GpsL5DllPllTrackingFpga::start_tracking()
}
void GpsL5DllPllTrackingFpga::stop_tracking()
{
}
/*
* Set tracking channel unique ID
*/

View File

@@ -1,9 +1,9 @@
/*!
* \file gps_l5_dll_pll_tracking.h
* \file gps_l5_dll_pll_tracking_fpga.h
* \brief Interface of an adapter of a DLL+PLL tracking loop block
* for GPS L5 to a TrackingInterface
* for GPS L5 to a TrackingInterface for the FPGA
* \author Marc Majoral, 2019. mmajoral(at)cttc.cat
* \author Javier Arribas, 2017. jarribas(at)cttc.es
* Javier Arribas, 2019. jarribas(at)cttc.es
*
* Code DLL + carrier PLL according to the algorithms described in:
* K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S.H.Jensen,
@@ -40,8 +40,12 @@
#include "dll_pll_veml_tracking_fpga.h"
#include "tracking_interface.h"
#include <gnuradio/runtime_types.h>
#include <cstddef>
#include <cstdint>
#include <string>
class Gnss_Synchro;
class ConfigurationInterface;
/*!
@@ -62,15 +66,15 @@ public:
return role_;
}
//! Returns "GPS_L5_DLL_PLL_Tracking"
//! Returns "GPS_L5_DLL_PLL_Tracking_Fpga"
inline std::string implementation() override
{
return "GPS_L5_DLL_PLL_Tracking";
return "GPS_L5_DLL_PLL_Tracking_Fpga";
}
inline size_t item_size() override
{
return item_size_;
return sizeof(int);
}
void connect(gr::top_block_sptr top_block) override;
@@ -90,6 +94,7 @@ public:
void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) override;
void start_tracking() override;
/*!
* \brief Stop running tracking
*/
@@ -97,7 +102,6 @@ public:
private:
dll_pll_veml_tracking_fpga_sptr tracking_fpga_sc;
size_t item_size_;
uint32_t channel_;
std::string role_;
uint32_t in_streams_;

View File

@@ -45,7 +45,9 @@
#include "beidou_b1i_signal_processing.h"
#include "galileo_e1_signal_processing.h"
#include "galileo_e5_signal_processing.h"
#include "gnss_satellite.h"
#include "gnss_sdr_create_directory.h"
#include "gnss_synchro.h"
#include "gps_l2c_signal.h"
#include "gps_l5_signal.h"
#include "gps_sdr_signal_processing.h"
@@ -53,17 +55,19 @@
#include "tracking_discriminators.h"
#include <boost/filesystem/path.hpp>
#include <glog/logging.h>
#include <gnuradio/io_signature.h>
#include <matio.h>
#include <gnuradio/io_signature.h> // for io_signature
#include <gnuradio/thread/thread.h> // for scoped_lock
#include <matio.h> // for Mat_VarCreate
#include <pmt/pmt_sugar.h> // for mp
#include <volk_gnsssdr/volk_gnsssdr.h>
#include <algorithm>
#include <cmath>
#include <exception>
#include <iostream>
#include <numeric>
#include <sstream>
#include <algorithm> // for fill_n
#include <cmath> // for fmod, round, floor
#include <complex> // for complex
#include <cstdlib> // for abs, size_t
#include <exception> // for exception
#include <iostream> // for cout, cerr
#include <map> // for map
using google::LogMessage;
dll_pll_veml_tracking_sptr dll_pll_veml_make_tracking(const Dll_Pll_Conf &conf_)
{
@@ -153,8 +157,8 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_) : gr::bl
n++;
}
}
d_symbol_history.resize(GPS_CA_PREAMBLE_LENGTH_SYMBOLS); // Change fixed buffer size
d_symbol_history.clear(); // Clear all the elements in the buffer
d_symbol_history.set_capacity(GPS_CA_PREAMBLE_LENGTH_SYMBOLS); // Change fixed buffer size
d_symbol_history.clear(); // Clear all the elements in the buffer
}
else if (signal_type == "2S")
{
@@ -405,6 +409,7 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_) : gr::bl
}
// --- Initializations ---
d_Prompt_circular_buffer.set_capacity(d_secondary_code_length);
multicorrelator_cpu.set_high_dynamics_resampler(trk_parameters.high_dyn);
// Initial code frequency basis of NCO
d_code_freq_chips = d_code_chip_rate;
@@ -446,13 +451,13 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_) : gr::bl
clear_tracking_vars();
if (trk_parameters.smoother_length > 0)
{
d_carr_ph_history.resize(trk_parameters.smoother_length * 2);
d_code_ph_history.resize(trk_parameters.smoother_length * 2);
d_carr_ph_history.set_capacity(trk_parameters.smoother_length * 2);
d_code_ph_history.set_capacity(trk_parameters.smoother_length * 2);
}
else
{
d_carr_ph_history.resize(1);
d_code_ph_history.resize(1);
d_carr_ph_history.set_capacity(1);
d_code_ph_history.set_capacity(1);
}
d_dump = trk_parameters.dump;
@@ -607,7 +612,7 @@ void dll_pll_veml_tracking::start_tracking()
n++;
}
}
d_symbol_history.resize(22); // Change fixed buffer size
d_symbol_history.set_capacity(22); // Change fixed buffer size
d_symbol_history.clear();
}
}
@@ -649,7 +654,7 @@ void dll_pll_veml_tracking::start_tracking()
// enable tracking pull-in
d_state = 1;
d_cloop = true;
d_Prompt_buffer_deque.clear();
d_Prompt_circular_buffer.clear();
d_last_prompt = gr_complex(0.0, 0.0);
}
@@ -710,7 +715,7 @@ bool dll_pll_veml_tracking::acquire_secondary()
int32_t corr_value = 0;
for (uint32_t i = 0; i < d_secondary_code_length; i++)
{
if (d_Prompt_buffer_deque.at(i).real() < 0.0) // symbols clipping
if (d_Prompt_circular_buffer[i].real() < 0.0) // symbols clipping
{
if (d_secondary_code_string->at(i) == '0')
{
@@ -866,7 +871,7 @@ void dll_pll_veml_tracking::clear_tracking_vars()
d_code_error_chips = 0.0;
d_code_error_filt_chips = 0.0;
d_current_symbol = 0;
d_Prompt_buffer_deque.clear();
d_Prompt_circular_buffer.clear();
d_last_prompt = gr_complex(0.0, 0.0);
d_carrier_phase_rate_step_rad = 0.0;
d_code_phase_rate_step_chips = 0.0;
@@ -902,9 +907,9 @@ void dll_pll_veml_tracking::update_tracking_vars()
double tmp_samples = 0.0;
for (unsigned int k = 0; k < trk_parameters.smoother_length; k++)
{
tmp_cp1 += d_carr_ph_history.at(k).first;
tmp_cp2 += d_carr_ph_history.at(trk_parameters.smoother_length * 2 - k - 1).first;
tmp_samples += d_carr_ph_history.at(trk_parameters.smoother_length * 2 - k - 1).second;
tmp_cp1 += d_carr_ph_history[k].first;
tmp_cp2 += d_carr_ph_history[trk_parameters.smoother_length * 2 - k - 1].first;
tmp_samples += d_carr_ph_history[trk_parameters.smoother_length * 2 - k - 1].second;
}
tmp_cp1 /= static_cast<double>(trk_parameters.smoother_length);
tmp_cp2 /= static_cast<double>(trk_parameters.smoother_length);
@@ -916,7 +921,6 @@ void dll_pll_veml_tracking::update_tracking_vars()
d_rem_carr_phase_rad += static_cast<float>(d_carrier_phase_step_rad * static_cast<double>(d_current_prn_length_samples) + 0.5 * d_carrier_phase_rate_step_rad * static_cast<double>(d_current_prn_length_samples) * static_cast<double>(d_current_prn_length_samples));
d_rem_carr_phase_rad = fmod(d_rem_carr_phase_rad, PI_2);
// carrier phase accumulator
//double a = d_carrier_phase_step_rad * static_cast<double>(d_current_prn_length_samples);
//double b = 0.5 * d_carrier_phase_rate_step_rad * static_cast<double>(d_current_prn_length_samples) * static_cast<double>(d_current_prn_length_samples);
@@ -936,9 +940,9 @@ void dll_pll_veml_tracking::update_tracking_vars()
double tmp_samples = 0.0;
for (unsigned int k = 0; k < trk_parameters.smoother_length; k++)
{
tmp_cp1 += d_code_ph_history.at(k).first;
tmp_cp2 += d_code_ph_history.at(trk_parameters.smoother_length * 2 - k - 1).first;
tmp_samples += d_code_ph_history.at(trk_parameters.smoother_length * 2 - k - 1).second;
tmp_cp1 += d_code_ph_history[k].first;
tmp_cp2 += d_code_ph_history[trk_parameters.smoother_length * 2 - k - 1].first;
tmp_samples += d_code_ph_history[trk_parameters.smoother_length * 2 - k - 1].second;
}
tmp_cp1 /= static_cast<double>(trk_parameters.smoother_length);
tmp_cp2 /= static_cast<double>(trk_parameters.smoother_length);
@@ -1503,8 +1507,8 @@ int dll_pll_veml_tracking::general_work(int noutput_items __attribute__((unused)
if (d_secondary)
{
// ####### SECONDARY CODE LOCK #####
d_Prompt_buffer_deque.push_back(*d_Prompt);
if (d_Prompt_buffer_deque.size() == d_secondary_code_length)
d_Prompt_circular_buffer.push_back(*d_Prompt);
if (d_Prompt_circular_buffer.size() == d_secondary_code_length)
{
next_state = acquire_secondary();
if (next_state)
@@ -1514,8 +1518,6 @@ int dll_pll_veml_tracking::general_work(int noutput_items __attribute__((unused)
std::cout << systemName << " " << signal_pretty_name << " secondary code locked in channel " << d_channel
<< " for satellite " << Gnss_Satellite(systemName, d_acquisition_gnss_synchro->PRN) << std::endl;
}
d_Prompt_buffer_deque.pop_front();
}
}
else if (d_symbols_per_bit > 1) //Signal does not have secondary code. Search a bit transition by sign change
@@ -1528,9 +1530,10 @@ int dll_pll_veml_tracking::general_work(int noutput_items __attribute__((unused)
int32_t corr_value = 0;
if ((static_cast<int32_t>(d_symbol_history.size()) == d_preamble_length_symbols)) // and (d_make_correlation or !d_flag_frame_sync))
{
for (int32_t i = 0; i < d_preamble_length_symbols; i++)
int i = 0;
for (const auto &iter : d_symbol_history)
{
if (d_symbol_history.at(i) < 0) // symbols clipping
if (iter < 0.0) // symbols clipping
{
corr_value -= d_preambles_symbols[i];
}
@@ -1538,6 +1541,7 @@ int dll_pll_veml_tracking::general_work(int noutput_items __attribute__((unused)
{
corr_value += d_preambles_symbols[i];
}
i++;
}
}
if (corr_value == d_preamble_length_symbols)
@@ -1606,7 +1610,7 @@ int dll_pll_veml_tracking::general_work(int noutput_items __attribute__((unused)
d_L_accu = gr_complex(0.0, 0.0);
d_VL_accu = gr_complex(0.0, 0.0);
d_last_prompt = gr_complex(0.0, 0.0);
d_Prompt_buffer_deque.clear();
d_Prompt_circular_buffer.clear();
d_current_symbol = 0;
if (d_enable_extended_integration)

View File

@@ -34,17 +34,21 @@
#include "cpu_multicorrelator_real_codes.h"
#include "dll_pll_conf.h"
#include "gnss_synchro.h"
#include "tracking_2nd_DLL_filter.h"
#include "tracking_2nd_PLL_filter.h"
#include <boost/circular_buffer.hpp>
#include <gnuradio/block.h>
#include <fstream>
#include <map>
#include <queue>
#include <string>
#include <utility>
#include <boost/shared_ptr.hpp> // for boost::shared_ptr
#include <gnuradio/block.h> // for block
#include <gnuradio/gr_complex.h> // for gr_complex
#include <gnuradio/types.h> // for gr_vector_int, gr_vector...
#include <pmt/pmt.h> // for pmt_t
#include <cstdint> // for int32_t
#include <fstream> // for string, ofstream
#include <string> // for string
#include <utility> // for pair
class Gnss_Synchro;
class dll_pll_veml_tracking;
using dll_pll_veml_tracking_sptr = boost::shared_ptr<dll_pll_veml_tracking>;
@@ -92,7 +96,7 @@ private:
uint32_t d_channel;
Gnss_Synchro *d_acquisition_gnss_synchro;
//Signal parameters
// Signal parameters
bool d_secondary;
bool interchange_iq;
double d_signal_carrier_freq;
@@ -111,9 +115,10 @@ private:
int32_t d_preamble_length_symbols;
boost::circular_buffer<float> d_symbol_history;
//tracking state machine
// tracking state machine
int32_t d_state;
//Integration period in samples
// Integration period in samples
int32_t d_correlation_length_ms;
int32_t d_n_correlator_taps;
@@ -188,11 +193,10 @@ private:
// CN0 estimation and lock detector
int32_t d_cn0_estimation_counter;
int32_t d_carrier_lock_fail_counter;
std::deque<float> d_carrier_lock_detector_queue;
double d_carrier_lock_test;
double d_CN0_SNV_dB_Hz;
double d_carrier_lock_threshold;
std::deque<gr_complex> d_Prompt_buffer_deque;
boost::circular_buffer<gr_complex> d_Prompt_circular_buffer;
gr_complex *d_Prompt_buffer;
// file dump

View File

@@ -2,8 +2,7 @@
* \file dll_pll_veml_tracking_fpga.cc
* \brief Implementation of a code DLL + carrier PLL tracking block using an FPGA
* \author Marc Majoral, 2019. marc.majoral(at)cttc.es
* \author Antonio Ramos, 2018 antonio.ramosdet(at)gmail.com
* \author Javier Arribas, 2018. jarribas(at)cttc.es
* \author Javier Arribas, 2019. jarribas(at)cttc.es
*
* Code DLL + carrier PLL according to the algorithms described in:
* [1] K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S.H.Jensen,
@@ -42,28 +41,26 @@
#include "Galileo_E1.h"
#include "Galileo_E5a.h"
#include "MATH_CONSTANTS.h"
#include "control_message_factory.h"
#include "galileo_e1_signal_processing.h"
#include "galileo_e5_signal_processing.h"
#include "fpga_multicorrelator.h"
#include "gnss_satellite.h"
#include "gnss_sdr_create_directory.h"
#include "gps_l2c_signal.h"
#include "gps_l5_signal.h"
#include "gps_sdr_signal_processing.h"
#include "gnss_synchro.h"
#include "lock_detectors.h"
#include "tracking_discriminators.h"
#include <boost/filesystem/path.hpp>
#include <glog/logging.h>
#include <gnuradio/io_signature.h>
#include <matio.h>
#include <pmt/pmt_sugar.h> // for mp
#include <volk_gnsssdr/volk_gnsssdr.h>
#include <algorithm>
#include <cmath>
#include <complex>
#include <cstdlib> // for abs, size_t
#include <exception>
#include <iostream>
#include <numeric>
#include <sstream>
#include <map>
using google::LogMessage;
dll_pll_veml_tracking_fpga_sptr dll_pll_veml_make_tracking_fpga(const Dll_Pll_Conf_Fpga &conf_)
{
@@ -315,7 +312,6 @@ dll_pll_veml_tracking_fpga::dll_pll_veml_tracking_fpga(const Dll_Pll_Conf_Fpga &
d_prompt_data_shift = &d_local_code_shift_chips[1];
}
if (trk_parameters.extend_correlation_symbols > 1)
{
d_enable_extended_integration = true;
@@ -387,7 +383,7 @@ dll_pll_veml_tracking_fpga::dll_pll_veml_tracking_fpga(const Dll_Pll_Conf_Fpga &
d_dump_filename = trk_parameters.dump_filename;
std::string dump_path;
// Get path
if (d_dump_filename.find_last_of("/") != std::string::npos)
if (d_dump_filename.find_last_of('/') != std::string::npos)
{
std::string dump_filename_ = d_dump_filename.substr(d_dump_filename.find_last_of('/') + 1);
dump_path = d_dump_filename.substr(0, d_dump_filename.find_last_of('/'));
@@ -421,8 +417,9 @@ dll_pll_veml_tracking_fpga::dll_pll_veml_tracking_fpga(const Dll_Pll_Conf_Fpga &
int32_t *ca_codes = trk_parameters.ca_codes;
int32_t *data_codes = trk_parameters.data_codes;
uint32_t multicorr_type = trk_parameters.multicorr_type;
multicorrelator_fpga = std::make_shared<fpga_multicorrelator_8sc>(d_n_correlator_taps, device_name, device_base, ca_codes, data_codes, d_code_length_chips, trk_parameters.track_pilot, multicorr_type, d_code_samples_per_chip);
multicorrelator_fpga = std::make_shared<Fpga_Multicorrelator_8sc>(d_n_correlator_taps, device_name, device_base, ca_codes, data_codes, d_code_length_chips, trk_parameters.track_pilot, multicorr_type, d_code_samples_per_chip);
multicorrelator_fpga->set_output_vectors(d_correlator_outs, d_Prompt_Data);
d_sample_counter_next = 0ULL;
}
@@ -498,7 +495,6 @@ void dll_pll_veml_tracking_fpga::start_tracking()
std::cout << "Tracking of " << systemName << " " << signal_pretty_name << " signal started on channel " << d_channel << " for satellite " << Gnss_Satellite(systemName, d_acquisition_gnss_synchro->PRN) << std::endl;
DLOG(INFO) << "Starting tracking of satellite " << Gnss_Satellite(systemName, d_acquisition_gnss_synchro->PRN) << " on channel " << d_channel;
multicorrelator_fpga->set_local_code_and_taps(d_local_code_shift_chips, d_prompt_data_shift, d_acquisition_gnss_synchro->PRN);
// enable tracking pull-in
d_state = 1;
@@ -510,7 +506,7 @@ void dll_pll_veml_tracking_fpga::start_tracking()
dll_pll_veml_tracking_fpga::~dll_pll_veml_tracking_fpga()
{
if (signal_type.compare("1C") == 0)
if (signal_type == "1C")
{
volk_gnsssdr_free(d_gps_l1ca_preambles_symbols);
}
@@ -677,7 +673,6 @@ void dll_pll_veml_tracking_fpga::run_dll_pll()
// New carrier Doppler frequency estimation
d_carrier_doppler_hz = d_acq_carrier_doppler_hz + d_carr_error_filt_hz;
// ################## DLL ##########################################################
// DLL discriminator
if (d_veml)
@@ -753,7 +748,6 @@ void dll_pll_veml_tracking_fpga::update_tracking_vars()
d_rem_carr_phase_rad += static_cast<float>(d_carrier_phase_step_rad * static_cast<double>(d_current_prn_length_samples) + 0.5 * d_carrier_phase_rate_step_rad * static_cast<double>(d_current_prn_length_samples) * static_cast<double>(d_current_prn_length_samples));
d_rem_carr_phase_rad = fmod(d_rem_carr_phase_rad, PI_2);
// carrier phase accumulator
d_acc_carrier_phase_rad -= (d_carrier_phase_step_rad * static_cast<double>(d_current_prn_length_samples) + 0.5 * d_carrier_phase_rate_step_rad * static_cast<double>(d_current_prn_length_samples) * static_cast<double>(d_current_prn_length_samples));
@@ -998,29 +992,28 @@ int32_t dll_pll_veml_tracking_fpga::save_matfile()
{
return 1;
}
float *abs_VE = new float[num_epoch];
float *abs_E = new float[num_epoch];
float *abs_P = new float[num_epoch];
float *abs_L = new float[num_epoch];
float *abs_VL = new float[num_epoch];
float *Prompt_I = new float[num_epoch];
float *Prompt_Q = new float[num_epoch];
uint64_t *PRN_start_sample_count = new uint64_t[num_epoch];
float *acc_carrier_phase_rad = new float[num_epoch];
float *carrier_doppler_hz = new float[num_epoch];
float *carrier_doppler_rate_hz = new float[num_epoch];
float *code_freq_chips = new float[num_epoch];
float *code_freq_rate_chips = new float[num_epoch];
float *carr_error_hz = new float[num_epoch];
float *carr_error_filt_hz = new float[num_epoch];
float *code_error_chips = new float[num_epoch];
float *code_error_filt_chips = new float[num_epoch];
float *CN0_SNV_dB_Hz = new float[num_epoch];
float *carrier_lock_test = new float[num_epoch];
float *aux1 = new float[num_epoch];
double *aux2 = new double[num_epoch];
uint32_t *PRN = new uint32_t[num_epoch];
auto *abs_VE = new float[num_epoch];
auto *abs_E = new float[num_epoch];
auto *abs_P = new float[num_epoch];
auto *abs_L = new float[num_epoch];
auto *abs_VL = new float[num_epoch];
auto *Prompt_I = new float[num_epoch];
auto *Prompt_Q = new float[num_epoch];
auto *PRN_start_sample_count = new uint64_t[num_epoch];
auto *acc_carrier_phase_rad = new float[num_epoch];
auto *carrier_doppler_hz = new float[num_epoch];
auto *carrier_doppler_rate_hz = new float[num_epoch];
auto *code_freq_chips = new float[num_epoch];
auto *code_freq_rate_chips = new float[num_epoch];
auto *carr_error_hz = new float[num_epoch];
auto *carr_error_filt_hz = new float[num_epoch];
auto *code_error_chips = new float[num_epoch];
auto *code_error_filt_chips = new float[num_epoch];
auto *CN0_SNV_dB_Hz = new float[num_epoch];
auto *carrier_lock_test = new float[num_epoch];
auto *aux1 = new float[num_epoch];
auto *aux2 = new double[num_epoch];
auto *PRN = new uint32_t[num_epoch];
try
{
@@ -1249,15 +1242,23 @@ void dll_pll_veml_tracking_fpga::stop_tracking()
d_state = 0;
}
int dll_pll_veml_tracking_fpga::general_work(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
void dll_pll_veml_tracking_fpga::reset(void)
{
Gnss_Synchro **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]);
multicorrelator_fpga->unlock_channel();
}
int dll_pll_veml_tracking_fpga::general_work(int noutput_items __attribute__((unused)),
gr_vector_int &ninput_items __attribute__((unused)),
gr_vector_const_void_star &input_items __attribute__((unused)),
gr_vector_void_star &output_items)
{
auto **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]);
Gnss_Synchro current_synchro_data = Gnss_Synchro();
d_current_prn_length_samples = d_next_prn_length_samples;
switch (d_state)
{
case 0: // Standby - Consume samples at full throttle, do nothing
@@ -1300,7 +1301,6 @@ int dll_pll_veml_tracking_fpga::general_work(int noutput_items __attribute__((un
current_synchro_data.Tracking_sample_counter = absolute_samples_offset;
d_sample_counter_next = d_sample_counter;
// Signal alignment (skip samples until the incoming signal is aligned with local replica)
// Doppler effect Fd = (C / (C + Vr)) * F
@@ -1478,6 +1478,7 @@ int dll_pll_veml_tracking_fpga::general_work(int noutput_items __attribute__((un
return 0;
}
void dll_pll_veml_tracking_fpga::run_state_2(Gnss_Synchro &current_synchro_data)
{
d_sample_counter = d_sample_counter_next;
@@ -1650,9 +1651,3 @@ void dll_pll_veml_tracking_fpga::run_state_2(Gnss_Synchro &current_synchro_data)
}
}
}
void dll_pll_veml_tracking_fpga::reset(void)
{
multicorrelator_fpga->unlock_channel();
}

View File

@@ -2,8 +2,7 @@
* \file dll_pll_veml_tracking_fpga.h
* \brief Implementation of a code DLL + carrier PLL tracking block using an FPGA.
* \author Marc Majoral, 2019. marc.majoral(at)cttc.es
* \author Javier Arribas, 2018. jarribas(at)cttc.es
* \author Antonio Ramos, 2018 antonio.ramosdet(at)gmail.com
* \author Javier Arribas, 2019. jarribas(at)cttc.es
*
* -------------------------------------------------------------------------
*
@@ -34,21 +33,26 @@
#define GNSS_SDR_DLL_PLL_VEML_TRACKING_FPGA_H
#include "dll_pll_conf_fpga.h"
#include "fpga_multicorrelator.h"
#include "gnss_synchro.h"
#include "tracking_2nd_DLL_filter.h"
#include "tracking_2nd_PLL_filter.h"
#include <boost/circular_buffer.hpp>
#include <boost/shared_ptr.hpp>
#include <gnuradio/block.h>
#include <fstream>
#include <map>
#include <queue>
#include <gnuradio/gr_complex.h> // for gr_complex
#include <gnuradio/types.h> // for gr_vector_const_void_star
#include <pmt/pmt.h> // for pmt_t
#include <cstdint>
#include <deque> // for deque
#include <fstream> // for ofstream
#include <memory> // for shared_ptr
#include <string>
#include <utility>
//#include <string>
class Fpga_Multicorrelator_8sc;
class Gnss_Synchro;
class dll_pll_veml_tracking_fpga;
typedef boost::shared_ptr<dll_pll_veml_tracking_fpga> dll_pll_veml_tracking_fpga_sptr;
using dll_pll_veml_tracking_fpga_sptr = boost::shared_ptr<dll_pll_veml_tracking_fpga>;
dll_pll_veml_tracking_fpga_sptr dll_pll_veml_make_tracking_fpga(const Dll_Pll_Conf_Fpga &conf_);
@@ -120,11 +124,9 @@ private:
int32_t d_correlation_length_ms;
int32_t d_n_correlator_taps;
float *d_tracking_code;
float *d_data_code;
float *d_local_code_shift_chips;
float *d_prompt_data_shift;
std::shared_ptr<fpga_multicorrelator_8sc> multicorrelator_fpga;
std::shared_ptr<Fpga_Multicorrelator_8sc> multicorrelator_fpga;
/* TODO: currently the multicorrelator does not support adding extra correlator
with different local code, thus we need extra multicorrelator instance.
Implement this functionality inside multicorrelator class

View File

@@ -55,8 +55,6 @@
#include <utility>
using google::LogMessage;
galileo_e1_tcp_connector_tracking_cc_sptr galileo_e1_tcp_connector_make_tracking_cc(
int64_t fs_in,
uint32_t vector_length,

View File

@@ -58,7 +58,6 @@
#define CN0_ESTIMATION_SAMPLES 10
using google::LogMessage;
glonass_l1_ca_dll_pll_c_aid_tracking_cc_sptr
glonass_l1_ca_dll_pll_c_aid_make_tracking_cc(

View File

@@ -56,7 +56,6 @@
#define CN0_ESTIMATION_SAMPLES 10
using google::LogMessage;
glonass_l1_ca_dll_pll_c_aid_tracking_sc_sptr
glonass_l1_ca_dll_pll_c_aid_make_tracking_sc(

View File

@@ -55,7 +55,6 @@
#define CN0_ESTIMATION_SAMPLES 10
using google::LogMessage;
glonass_l1_ca_dll_pll_tracking_cc_sptr
glonass_l1_ca_dll_pll_make_tracking_cc(

View File

@@ -55,7 +55,6 @@
#define CN0_ESTIMATION_SAMPLES 10
using google::LogMessage;
glonass_l2_ca_dll_pll_c_aid_tracking_cc_sptr
glonass_l2_ca_dll_pll_c_aid_make_tracking_cc(

View File

@@ -54,7 +54,6 @@
#define CN0_ESTIMATION_SAMPLES 10
using google::LogMessage;
glonass_l2_ca_dll_pll_c_aid_tracking_sc_sptr
glonass_l2_ca_dll_pll_c_aid_make_tracking_sc(

View File

@@ -55,7 +55,6 @@
#define CN0_ESTIMATION_SAMPLES 10
using google::LogMessage;
glonass_l2_ca_dll_pll_tracking_cc_sptr
glonass_l2_ca_dll_pll_make_tracking_cc(

View File

@@ -47,8 +47,6 @@
#include <utility>
using google::LogMessage;
gps_l1_ca_dll_pll_c_aid_tracking_cc_sptr
gps_l1_ca_dll_pll_c_aid_make_tracking_cc(
int64_t fs_in,

View File

@@ -47,8 +47,6 @@
#include <utility>
using google::LogMessage;
gps_l1_ca_dll_pll_c_aid_tracking_sc_sptr
gps_l1_ca_dll_pll_c_aid_make_tracking_sc(
int64_t fs_in,

View File

@@ -44,8 +44,6 @@
#include <sstream>
using google::LogMessage;
gps_l1_ca_dll_pll_tracking_gpu_cc_sptr
gps_l1_ca_dll_pll_make_tracking_gpu_cc(
int64_t fs_in,

View File

@@ -55,8 +55,6 @@
#include <utility>
using google::LogMessage;
gps_l1_ca_kf_tracking_cc_sptr
gps_l1_ca_kf_make_tracking_cc(
uint32_t order,

View File

@@ -53,8 +53,6 @@
#include <utility>
using google::LogMessage;
gps_l1_ca_tcp_connector_tracking_cc_sptr
gps_l1_ca_tcp_connector_make_tracking_cc(
int64_t fs_in,

View File

@@ -1,12 +1,12 @@
/*!
* \file fpga_multicorrelator_8sc.cc
* \brief High optimized FPGA vector correlator class
* \file fpga_multicorrelator.cc
* \brief FPGA vector correlator class
* \authors <ul>
* <li> Marc Majoral, 2019. mmajoral(at)cttc.cat
* <li> Javier Arribas, 2015. jarribas(at)cttc.es
* <li> Javier Arribas, 2019. jarribas(at)cttc.es
* </ul>
*
* Class that controls and executes a high optimized vector correlator
* Class that controls and executes a highly optimized vector correlator
* class in the FPGA
*
* -------------------------------------------------------------------------
@@ -36,19 +36,12 @@
#include "fpga_multicorrelator.h"
#include <glog/logging.h>
#include <cassert>
#include <cerrno>
#include <volk_gnsssdr/volk_gnsssdr.h>
#include <cmath>
#include <csignal>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <fcntl.h>
#include <new>
#include <fcntl.h> // for O_RDWR, O_RSYNC
#include <string>
#include <sys/mman.h>
#include <sys/stat.h>
#include <unistd.h>
#include <sys/mman.h> // for PROT_READ, PROT_WRITE, MAP_SHARED
#include <utility>
// FPGA register access constants
@@ -66,72 +59,20 @@
#define LOCAL_CODE_FPGA_ENABLE_WRITE_MEMORY 0x0C000000
#define TEST_REGISTER_TRACK_WRITEVAL 0x55AA
#ifndef TEMP_FAILURE_RETRY
#define TEMP_FAILURE_RETRY(exp) \
({ \
decltype(exp) _rc; \
do \
{ \
_rc = (exp); \
} \
while (_rc == -1 && errno == EINTR); \
_rc; \
})
#endif
uint64_t fpga_multicorrelator_8sc::read_sample_counter()
{
uint64_t sample_counter_tmp, sample_counter_msw_tmp;
sample_counter_tmp = d_map_base[SAMPLE_COUNTER_REG_ADDR_LSW];
sample_counter_msw_tmp = d_map_base[SAMPLE_COUNTER_REG_ADDR_MSW];
sample_counter_msw_tmp = sample_counter_msw_tmp << 32;
sample_counter_tmp = sample_counter_tmp + sample_counter_msw_tmp; // 2^32
return sample_counter_tmp;
}
void fpga_multicorrelator_8sc::set_initial_sample(uint64_t samples_offset)
{
d_initial_sample_counter = samples_offset;
d_map_base[INITIAL_COUNTER_VALUE_REG_ADDR_LSW] = (d_initial_sample_counter & 0xFFFFFFFF);
d_map_base[INITIAL_COUNTER_VALUE_REG_ADDR_MSW] = (d_initial_sample_counter >> 32) & 0xFFFFFFFF;
}
void fpga_multicorrelator_8sc::set_local_code_and_taps(float *shifts_chips, float *prompt_data_shift, int32_t PRN)
{
d_shifts_chips = shifts_chips;
d_prompt_data_shift = prompt_data_shift;
fpga_multicorrelator_8sc::fpga_configure_tracking_gps_local_code(PRN);
}
void fpga_multicorrelator_8sc::set_output_vectors(gr_complex *corr_out, gr_complex *Prompt_Data)
{
d_corr_out = corr_out;
d_Prompt_Data = Prompt_Data;
}
void fpga_multicorrelator_8sc::update_local_code(float rem_code_phase_chips)
{
d_rem_code_phase_chips = rem_code_phase_chips;
fpga_multicorrelator_8sc::fpga_compute_code_shift_parameters();
fpga_multicorrelator_8sc::fpga_configure_code_parameters_in_fpga();
}
void fpga_multicorrelator_8sc::Carrier_wipeoff_multicorrelator_resampler(
float rem_carrier_phase_in_rad, float phase_step_rad,
float carrier_phase_rate_step_rad,
float rem_code_phase_chips, float code_phase_step_chips,
float code_phase_rate_step_chips,
int32_t signal_length_samples)
{
update_local_code(rem_code_phase_chips);
d_rem_carrier_phase_in_rad = rem_carrier_phase_in_rad;
d_code_phase_step_chips = code_phase_step_chips;
d_phase_step_rad = phase_step_rad;
d_correlator_length_samples = signal_length_samples;
fpga_multicorrelator_8sc::fpga_compute_signal_parameters_in_fpga();
fpga_multicorrelator_8sc::fpga_configure_signal_parameters_in_fpga();
fpga_multicorrelator_8sc::fpga_launch_multicorrelator_fpga();
int32_t irq_count;
ssize_t nb;
nb = read(d_device_descriptor, &irq_count, sizeof(irq_count));
if (nb != sizeof(irq_count))
{
std::cout << "Tracking_module Read failed to retrieve 4 bytes!" << std::endl;
std::cout << "Tracking_module Interrupt number " << irq_count << std::endl;
}
fpga_multicorrelator_8sc::read_tracking_gps_results();
}
fpga_multicorrelator_8sc::fpga_multicorrelator_8sc(int32_t n_correlators,
Fpga_Multicorrelator_8sc::Fpga_Multicorrelator_8sc(int32_t n_correlators,
std::string device_name, uint32_t device_base, int32_t *ca_codes, int32_t *data_codes, uint32_t code_length_chips, bool track_pilot,
uint32_t multicorr_type, uint32_t code_samples_per_chip)
{
@@ -159,6 +100,7 @@ fpga_multicorrelator_8sc::fpga_multicorrelator_8sc(int32_t n_correlators,
}
d_shifts_chips = nullptr;
d_prompt_data_shift = nullptr;
d_Prompt_Data = nullptr;
d_corr_out = nullptr;
d_code_length_chips = 0;
d_rem_code_phase_chips = 0;
@@ -169,7 +111,8 @@ fpga_multicorrelator_8sc::fpga_multicorrelator_8sc(int32_t n_correlators,
d_phase_step_rad_int = 0;
d_initial_sample_counter = 0;
d_channel = 0;
d_correlator_length_samples = 0,
d_correlator_length_samples = 0;
d_code_phase_step_chips_num = 0;
d_code_length_chips = code_length_chips;
d_ca_codes = ca_codes;
d_data_codes = data_codes;
@@ -180,16 +123,95 @@ fpga_multicorrelator_8sc::fpga_multicorrelator_8sc(int32_t n_correlators,
}
fpga_multicorrelator_8sc::~fpga_multicorrelator_8sc()
Fpga_Multicorrelator_8sc::~Fpga_Multicorrelator_8sc()
{
close_device();
if (d_initial_index != nullptr)
{
volk_gnsssdr_free(d_initial_index);
}
if (d_initial_interp_counter != nullptr)
{
volk_gnsssdr_free(d_initial_interp_counter);
}
}
bool fpga_multicorrelator_8sc::free()
uint64_t Fpga_Multicorrelator_8sc::read_sample_counter()
{
uint64_t sample_counter_tmp, sample_counter_msw_tmp;
sample_counter_tmp = d_map_base[SAMPLE_COUNTER_REG_ADDR_LSW];
sample_counter_msw_tmp = d_map_base[SAMPLE_COUNTER_REG_ADDR_MSW];
sample_counter_msw_tmp = sample_counter_msw_tmp << 32;
sample_counter_tmp = sample_counter_tmp + sample_counter_msw_tmp; // 2^32
return sample_counter_tmp;
}
void Fpga_Multicorrelator_8sc::set_initial_sample(uint64_t samples_offset)
{
d_initial_sample_counter = samples_offset;
d_map_base[INITIAL_COUNTER_VALUE_REG_ADDR_LSW] = (d_initial_sample_counter & 0xFFFFFFFF);
d_map_base[INITIAL_COUNTER_VALUE_REG_ADDR_MSW] = (d_initial_sample_counter >> 32) & 0xFFFFFFFF;
}
void Fpga_Multicorrelator_8sc::set_local_code_and_taps(float *shifts_chips, float *prompt_data_shift, int32_t PRN)
{
d_shifts_chips = shifts_chips;
d_prompt_data_shift = prompt_data_shift;
Fpga_Multicorrelator_8sc::fpga_configure_tracking_gps_local_code(PRN);
}
void Fpga_Multicorrelator_8sc::set_output_vectors(gr_complex *corr_out, gr_complex *Prompt_Data)
{
d_corr_out = corr_out;
d_Prompt_Data = Prompt_Data;
}
void Fpga_Multicorrelator_8sc::update_local_code(float rem_code_phase_chips)
{
d_rem_code_phase_chips = rem_code_phase_chips;
Fpga_Multicorrelator_8sc::fpga_compute_code_shift_parameters();
Fpga_Multicorrelator_8sc::fpga_configure_code_parameters_in_fpga();
}
void Fpga_Multicorrelator_8sc::Carrier_wipeoff_multicorrelator_resampler(
float rem_carrier_phase_in_rad,
float phase_step_rad,
float carrier_phase_rate_step_rad __attribute__((unused)),
float rem_code_phase_chips,
float code_phase_step_chips __attribute__((unused)),
float code_phase_rate_step_chips __attribute__((unused)),
int32_t signal_length_samples)
{
update_local_code(rem_code_phase_chips);
d_rem_carrier_phase_in_rad = rem_carrier_phase_in_rad;
d_code_phase_step_chips = code_phase_step_chips;
d_phase_step_rad = phase_step_rad;
d_correlator_length_samples = signal_length_samples;
Fpga_Multicorrelator_8sc::fpga_compute_signal_parameters_in_fpga();
Fpga_Multicorrelator_8sc::fpga_configure_signal_parameters_in_fpga();
Fpga_Multicorrelator_8sc::fpga_launch_multicorrelator_fpga();
int32_t irq_count;
ssize_t nb;
nb = read(d_device_descriptor, &irq_count, sizeof(irq_count));
if (nb != sizeof(irq_count))
{
std::cout << "Tracking_module Read failed to retrieve 4 bytes!" << std::endl;
std::cout << "Tracking_module Interrupt number " << irq_count << std::endl;
}
Fpga_Multicorrelator_8sc::read_tracking_gps_results();
}
bool Fpga_Multicorrelator_8sc::free()
{
// unlock the channel
fpga_multicorrelator_8sc::unlock_channel();
Fpga_Multicorrelator_8sc::unlock_channel();
// free the FPGA dynamically created variables
if (d_initial_index != nullptr)
@@ -208,7 +230,7 @@ bool fpga_multicorrelator_8sc::free()
}
void fpga_multicorrelator_8sc::set_channel(uint32_t channel)
void Fpga_Multicorrelator_8sc::set_channel(uint32_t channel)
{
char device_io_name[MAX_LENGTH_DEVICEIO_NAME]; // driver io name
d_channel = channel;
@@ -219,8 +241,14 @@ void fpga_multicorrelator_8sc::set_channel(uint32_t channel)
int32_t numdevice = d_device_base + d_channel;
devicebasetemp << numdevice;
mergedname = d_device_name + devicebasetemp.str();
strcpy(device_io_name, mergedname.c_str());
if (mergedname.size() > MAX_LENGTH_DEVICEIO_NAME)
{
mergedname = mergedname.substr(0, MAX_LENGTH_DEVICEIO_NAME);
}
mergedname.copy(device_io_name, mergedname.size() + 1);
device_io_name[mergedname.size()] = '\0';
std::cout << "trk device_io_name = " << device_io_name << std::endl;
if ((d_device_descriptor = open(device_io_name, O_RDWR | O_SYNC)) == -1)
@@ -238,14 +266,14 @@ void fpga_multicorrelator_8sc::set_channel(uint32_t channel)
std::cout << "Cannot map deviceio" << device_io_name << std::endl;
}
// sanity check : check test register
// sanity check: check test register
uint32_t writeval = TEST_REGISTER_TRACK_WRITEVAL;
uint32_t readval;
readval = fpga_multicorrelator_8sc::fpga_acquisition_test_register(writeval);
readval = Fpga_Multicorrelator_8sc::fpga_acquisition_test_register(writeval);
if (writeval != readval)
{
LOG(WARNING) << "Test register sanity check failed";
std::cout << "tracking test register sanity check failed" << std::endl;
std::cout << "Tracking test register sanity check failed" << std::endl;
}
else
{
@@ -254,7 +282,7 @@ void fpga_multicorrelator_8sc::set_channel(uint32_t channel)
}
uint32_t fpga_multicorrelator_8sc::fpga_acquisition_test_register(
uint32_t Fpga_Multicorrelator_8sc::fpga_acquisition_test_register(
uint32_t writeval)
{
uint32_t readval = 0;
@@ -267,7 +295,7 @@ uint32_t fpga_multicorrelator_8sc::fpga_acquisition_test_register(
}
void fpga_multicorrelator_8sc::fpga_configure_tracking_gps_local_code(int32_t PRN)
void Fpga_Multicorrelator_8sc::fpga_configure_tracking_gps_local_code(int32_t PRN)
{
uint32_t k;
uint32_t code_chip;
@@ -307,23 +335,21 @@ void fpga_multicorrelator_8sc::fpga_configure_tracking_gps_local_code(int32_t PR
}
void fpga_multicorrelator_8sc::fpga_compute_code_shift_parameters(void)
void Fpga_Multicorrelator_8sc::fpga_compute_code_shift_parameters(void)
{
float temp_calculation;
int32_t i;
for (i = 0; i < d_n_correlators; i++)
{
temp_calculation = floor(
d_shifts_chips[i] - d_rem_code_phase_chips);
temp_calculation = floor(d_shifts_chips[i] - d_rem_code_phase_chips);
if (temp_calculation < 0)
{
temp_calculation = temp_calculation + (d_code_length_chips * d_code_samples_per_chip); // % operator does not work as in Matlab with negative numbers
}
d_initial_index[i] = static_cast<uint32_t>((static_cast<int32_t>(temp_calculation)) % (d_code_length_chips * d_code_samples_per_chip));
temp_calculation = fmod(d_shifts_chips[i] - d_rem_code_phase_chips,
1.0);
temp_calculation = fmod(d_shifts_chips[i] - d_rem_code_phase_chips, 1.0);
if (temp_calculation < 0)
{
temp_calculation = temp_calculation + 1.0; // fmod operator does not work as in Matlab with negative numbers
@@ -333,16 +359,14 @@ void fpga_multicorrelator_8sc::fpga_compute_code_shift_parameters(void)
}
if (d_track_pilot)
{
temp_calculation = floor(
d_prompt_data_shift[0] - d_rem_code_phase_chips);
temp_calculation = floor(d_prompt_data_shift[0] - d_rem_code_phase_chips);
if (temp_calculation < 0)
{
temp_calculation = temp_calculation + (d_code_length_chips * d_code_samples_per_chip); // % operator does not work as in Matlab with negative numbers
}
d_initial_index[d_n_correlators] = static_cast<uint32_t>((static_cast<int32_t>(temp_calculation)) % (d_code_length_chips * d_code_samples_per_chip));
temp_calculation = fmod(d_prompt_data_shift[0] - d_rem_code_phase_chips,
1.0);
temp_calculation = fmod(d_prompt_data_shift[0] - d_rem_code_phase_chips, 1.0);
if (temp_calculation < 0)
{
temp_calculation = temp_calculation + 1.0; // fmod operator does not work as in Matlab with negative numbers
@@ -352,7 +376,7 @@ void fpga_multicorrelator_8sc::fpga_compute_code_shift_parameters(void)
}
void fpga_multicorrelator_8sc::fpga_configure_code_parameters_in_fpga(void)
void Fpga_Multicorrelator_8sc::fpga_configure_code_parameters_in_fpga(void)
{
int32_t i;
for (i = 0; i < d_n_correlators; i++)
@@ -370,7 +394,7 @@ void fpga_multicorrelator_8sc::fpga_configure_code_parameters_in_fpga(void)
}
void fpga_multicorrelator_8sc::fpga_compute_signal_parameters_in_fpga(void)
void Fpga_Multicorrelator_8sc::fpga_compute_signal_parameters_in_fpga(void)
{
float d_rem_carrier_phase_in_rad_temp;
@@ -392,14 +416,12 @@ void fpga_multicorrelator_8sc::fpga_compute_signal_parameters_in_fpga(void)
{
d_rem_carrier_phase_in_rad_temp = d_rem_carrier_phase_in_rad;
}
d_rem_carr_phase_rad_int = static_cast<int32_t>(roundf(
(fabs(d_rem_carrier_phase_in_rad_temp) / M_PI) * pow(2, PHASE_CARR_NBITS_FRAC)));
d_rem_carr_phase_rad_int = static_cast<int32_t>(roundf((fabs(d_rem_carrier_phase_in_rad_temp) / M_PI) * pow(2, PHASE_CARR_NBITS_FRAC)));
if (d_rem_carrier_phase_in_rad_temp < 0)
{
d_rem_carr_phase_rad_int = -d_rem_carr_phase_rad_int;
}
d_phase_step_rad_int = static_cast<int32_t>(roundf(
(fabs(d_phase_step_rad) / M_PI) * pow(2, PHASE_CARR_NBITS_FRAC))); // the FPGA accepts a range for the phase step between -pi and +pi
d_phase_step_rad_int = static_cast<int32_t>(roundf((fabs(d_phase_step_rad) / M_PI) * pow(2, PHASE_CARR_NBITS_FRAC))); // the FPGA accepts a range for the phase step between -pi and +pi
if (d_phase_step_rad < 0)
{
@@ -408,7 +430,7 @@ void fpga_multicorrelator_8sc::fpga_compute_signal_parameters_in_fpga(void)
}
void fpga_multicorrelator_8sc::fpga_configure_signal_parameters_in_fpga(void)
void Fpga_Multicorrelator_8sc::fpga_configure_signal_parameters_in_fpga(void)
{
d_map_base[CODE_PHASE_STEP_CHIPS_NUM_REG_ADDR] = d_code_phase_step_chips_num;
@@ -420,18 +442,21 @@ void fpga_multicorrelator_8sc::fpga_configure_signal_parameters_in_fpga(void)
}
void fpga_multicorrelator_8sc::fpga_launch_multicorrelator_fpga(void)
void Fpga_Multicorrelator_8sc::fpga_launch_multicorrelator_fpga(void)
{
// enable interrupts
int32_t reenable = 1;
write(d_device_descriptor, reinterpret_cast<void *>(&reenable), sizeof(int32_t));
ssize_t nbytes = TEMP_FAILURE_RETRY(write(d_device_descriptor, reinterpret_cast<void *>(&reenable), sizeof(int32_t)));
if (nbytes != sizeof(int32_t))
{
std::cerr << "Error launching the FPGA multicorrelator" << std::endl;
}
// writing 1 to reg 14 launches the tracking
d_map_base[START_FLAG_ADDR] = 1;
}
void fpga_multicorrelator_8sc::read_tracking_gps_results(void)
void Fpga_Multicorrelator_8sc::read_tracking_gps_results(void)
{
int32_t readval_real;
int32_t readval_imag;
@@ -452,14 +477,15 @@ void fpga_multicorrelator_8sc::read_tracking_gps_results(void)
}
void fpga_multicorrelator_8sc::unlock_channel(void)
void Fpga_Multicorrelator_8sc::unlock_channel(void)
{
// unlock the channel to let the next samples go through
d_map_base[DROP_SAMPLES_REG_ADDR] = 1; // unlock the channel
d_map_base[STOP_TRACKING_REG_ADDR] = 1; // set the tracking module back to idle
}
void fpga_multicorrelator_8sc::close_device()
void Fpga_Multicorrelator_8sc::close_device()
{
auto *aux = const_cast<uint32_t *>(d_map_base);
if (munmap(static_cast<void *>(aux), PAGE_SIZE) == -1)
@@ -470,7 +496,7 @@ void fpga_multicorrelator_8sc::close_device()
}
void fpga_multicorrelator_8sc::lock_channel(void)
void Fpga_Multicorrelator_8sc::lock_channel(void)
{
// lock the channel for processing
d_map_base[DROP_SAMPLES_REG_ADDR] = 0; // lock the channel

View File

@@ -1,12 +1,12 @@
/*!
* \file fpga_multicorrelator_8sc.h
* \brief High optimized FPGA vector correlator class
* \file fpga_multicorrelator.h
* \brief FPGA vector correlator class
* \authors <ul>
* <li> Marc Majoral, 2019. mmajoral(at)cttc.cat
* <li> Javier Arribas, 2016. jarribas(at)cttc.es
* <li> Javier Arribas, 2019. jarribas(at)cttc.es
* </ul>
*
* Class that controls and executes a high optimized vector correlator
* Class that controls and executes a highly optimized vector correlator
* class in the FPGA
*
* -------------------------------------------------------------------------
@@ -38,7 +38,6 @@
#define GNSS_SDR_FPGA_MULTICORRELATOR_8SC_H_
#include <gnuradio/block.h>
#include <volk_gnsssdr/volk_gnsssdr.h>
#include <cstdint>
// FPGA register addresses
@@ -69,12 +68,12 @@
/*!
* \brief Class that implements carrier wipe-off and correlators.
*/
class fpga_multicorrelator_8sc
class Fpga_Multicorrelator_8sc
{
public:
fpga_multicorrelator_8sc(int32_t n_correlators, std::string device_name,
Fpga_Multicorrelator_8sc(int32_t n_correlators, std::string device_name,
uint32_t device_base, int32_t *ca_codes, int32_t *data_codes, uint32_t code_length_chips, bool track_pilot, uint32_t multicorr_type, uint32_t code_samples_per_chip);
~fpga_multicorrelator_8sc();
~Fpga_Multicorrelator_8sc();
void set_output_vectors(gr_complex *corr_out, gr_complex *Prompt_Data);
void set_local_code_and_taps(
float *shifts_chips, float *prompt_data_shift, int32_t PRN);
@@ -98,7 +97,7 @@ private:
float *d_shifts_chips;
float *d_prompt_data_shift;
int32_t d_code_length_chips;
int32_t d_n_correlators;
int32_t d_n_correlators; // number of correlators
// data related to the hardware module and the driver
int32_t d_device_descriptor; // driver descriptor
@@ -106,7 +105,6 @@ private:
// configuration data received from the interface
uint32_t d_channel; // channel number
uint32_t d_ncorrelators; // number of correlators
uint32_t d_correlator_length_samples;
float d_rem_code_phase_chips;
float d_code_phase_step_chips;