mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-10-26 04:57:40 +00:00
Merge branch 'fpga' of https://github.com/gnss-sdr/gnss-sdr into merge-fpga
Applied checks and formatting
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
/*!
|
||||
* \file galileo_e1_dll_pll_veml_tracking.cc
|
||||
* \file galileo_e1_dll_pll_veml_tracking_fpga.cc
|
||||
* \brief Adapts a DLL+PLL VEML (Very Early Minus Late) tracking loop block
|
||||
* to a TrackingInterface for Galileo E1 signals
|
||||
* 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:
|
||||
@@ -11,7 +12,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
|
||||
@@ -42,8 +43,6 @@
|
||||
#include "gnss_sdr_flags.h"
|
||||
#include <glog/logging.h>
|
||||
|
||||
//#define NUM_PRNs_GALILEO_E1 50
|
||||
|
||||
using google::LogMessage;
|
||||
|
||||
void GalileoE1DllPllVemlTrackingFpga::stop_tracking()
|
||||
@@ -54,14 +53,13 @@ GalileoE1DllPllVemlTrackingFpga::GalileoE1DllPllVemlTrackingFpga(
|
||||
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);
|
||||
int32_t fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000);
|
||||
int32_t fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
|
||||
trk_param_fpga.fs_in = fs_in;
|
||||
bool dump = configuration->property(role + ".dump", false);
|
||||
trk_param_fpga.dump = dump;
|
||||
@@ -80,7 +78,7 @@ GalileoE1DllPllVemlTrackingFpga::GalileoE1DllPllVemlTrackingFpga(
|
||||
trk_param_fpga.pll_bw_narrow_hz = pll_bw_narrow_hz;
|
||||
float dll_bw_narrow_hz = configuration->property(role + ".dll_bw_narrow_hz", 0.25);
|
||||
trk_param_fpga.dll_bw_narrow_hz = dll_bw_narrow_hz;
|
||||
int extend_correlation_symbols = configuration->property(role + ".extend_correlation_symbols", 1);
|
||||
int32_t extend_correlation_symbols = configuration->property(role + ".extend_correlation_symbols", 1);
|
||||
float early_late_space_chips = configuration->property(role + ".early_late_space_chips", 0.15);
|
||||
trk_param_fpga.early_late_space_chips = early_late_space_chips;
|
||||
float very_early_late_space_chips = configuration->property(role + ".very_early_late_space_chips", 0.6);
|
||||
@@ -107,18 +105,18 @@ GalileoE1DllPllVemlTrackingFpga::GalileoE1DllPllVemlTrackingFpga(
|
||||
trk_param_fpga.track_pilot = track_pilot;
|
||||
d_track_pilot = track_pilot;
|
||||
trk_param_fpga.extend_correlation_symbols = extend_correlation_symbols;
|
||||
int vector_length = std::round(fs_in / (GALILEO_E1_CODE_CHIP_RATE_HZ / GALILEO_E1_B_CODE_LENGTH_CHIPS));
|
||||
int32_t vector_length = std::round(fs_in / (GALILEO_E1_CODE_CHIP_RATE_HZ / GALILEO_E1_B_CODE_LENGTH_CHIPS));
|
||||
trk_param_fpga.vector_length = vector_length;
|
||||
trk_param_fpga.system = 'E';
|
||||
char sig_[3] = "1B";
|
||||
std::memcpy(trk_param_fpga.signal, sig_, 3);
|
||||
int cn0_samples = configuration->property(role + ".cn0_samples", 20);
|
||||
int32_t cn0_samples = configuration->property(role + ".cn0_samples", 20);
|
||||
if (FLAGS_cn0_samples != 20) cn0_samples = FLAGS_cn0_samples;
|
||||
trk_param_fpga.cn0_samples = cn0_samples;
|
||||
int cn0_min = configuration->property(role + ".cn0_min", 25);
|
||||
int32_t cn0_min = configuration->property(role + ".cn0_min", 25);
|
||||
if (FLAGS_cn0_min != 25) cn0_min = FLAGS_cn0_min;
|
||||
trk_param_fpga.cn0_min = cn0_min;
|
||||
int max_lock_fail = configuration->property(role + ".max_lock_fail", 50);
|
||||
int32_t max_lock_fail = configuration->property(role + ".max_lock_fail", 50);
|
||||
if (FLAGS_max_lock_fail != 50) max_lock_fail = FLAGS_max_lock_fail;
|
||||
trk_param_fpga.max_lock_fail = max_lock_fail;
|
||||
double carrier_lock_th = configuration->property(role + ".carrier_lock_th", 0.85);
|
||||
@@ -129,63 +127,51 @@ GalileoE1DllPllVemlTrackingFpga::GalileoE1DllPllVemlTrackingFpga(
|
||||
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;
|
||||
unsigned int device_base = configuration->property(role + ".device_base", 1);
|
||||
uint32_t device_base = configuration->property(role + ".device_base", 15);
|
||||
trk_param_fpga.device_base = device_base;
|
||||
//unsigned int multicorr_type = configuration->property(role + ".multicorr_type", 1);
|
||||
trk_param_fpga.multicorr_type = 1; // 0 -> 3 correlators, 1 -> 5 correlators
|
||||
|
||||
//################# PRE-COMPUTE ALL THE CODES #################
|
||||
unsigned int code_samples_per_chip = 2;
|
||||
d_ca_codes = static_cast<int*>(volk_gnsssdr_malloc(static_cast<int>(GALILEO_E1_B_CODE_LENGTH_CHIPS) * code_samples_per_chip * GALILEO_E1_NUMBER_OF_CODES * sizeof(int), volk_gnsssdr_get_alignment()));
|
||||
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;
|
||||
|
||||
if (trk_param_fpga.track_pilot)
|
||||
{
|
||||
d_data_codes = static_cast<int*>(volk_gnsssdr_malloc((static_cast<unsigned int>(GALILEO_E1_B_CODE_LENGTH_CHIPS)) * code_samples_per_chip * GALILEO_E1_NUMBER_OF_CODES * sizeof(int), volk_gnsssdr_get_alignment()));
|
||||
}
|
||||
ca_codes_f = static_cast<float*>(volk_gnsssdr_malloc(static_cast<int>(GALILEO_E1_B_CODE_LENGTH_CHIPS) * code_samples_per_chip * sizeof(float), volk_gnsssdr_get_alignment()));
|
||||
|
||||
if (trk_param_fpga.track_pilot)
|
||||
{
|
||||
data_codes_f = static_cast<float*>(volk_gnsssdr_malloc((static_cast<unsigned int>(GALILEO_E1_B_CODE_LENGTH_CHIPS)) * code_samples_per_chip * sizeof(float), volk_gnsssdr_get_alignment()));
|
||||
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)
|
||||
{
|
||||
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()));
|
||||
}
|
||||
|
||||
//printf("pppppppp trk_param_fpga.track_pilot = %d\n", trk_param_fpga.track_pilot);
|
||||
|
||||
//int kk;
|
||||
|
||||
for (unsigned int PRN = 1; PRN <= GALILEO_E1_NUMBER_OF_CODES; PRN++)
|
||||
for (uint32_t PRN = 1; PRN <= GALILEO_E1_NUMBER_OF_CODES; PRN++)
|
||||
{
|
||||
char data_signal[3] = "1B";
|
||||
if (trk_param_fpga.track_pilot)
|
||||
{
|
||||
//printf("yes tracking pilot !!!!!!!!!!!!!!!\n");
|
||||
char pilot_signal[3] = "1C";
|
||||
galileo_e1_code_gen_sinboc11_float(ca_codes_f, pilot_signal, PRN);
|
||||
galileo_e1_code_gen_sinboc11_float(data_codes_f, data_signal, PRN);
|
||||
|
||||
for (unsigned int s = 0; s < 2 * GALILEO_E1_B_CODE_LENGTH_CHIPS; s++)
|
||||
for (uint32_t s = 0; s < 2 * GALILEO_E1_B_CODE_LENGTH_CHIPS; s++)
|
||||
{
|
||||
d_ca_codes[static_cast<int>(GALILEO_E1_B_CODE_LENGTH_CHIPS) * 2 * (PRN - 1) + s] = static_cast<int>(ca_codes_f[s]);
|
||||
d_data_codes[static_cast<int>(GALILEO_E1_B_CODE_LENGTH_CHIPS) * 2 * (PRN - 1) + s] = static_cast<int>(data_codes_f[s]);
|
||||
//printf("%f %d | ", data_codes_f[s], d_data_codes[static_cast<int>(GALILEO_E1_B_CODE_LENGTH_CHIPS)* 2 * (PRN - 1) + s]);
|
||||
d_ca_codes[static_cast<int32_t>(GALILEO_E1_B_CODE_LENGTH_CHIPS) * 2 * (PRN - 1) + s] = static_cast<int32_t>(ca_codes_f[s]);
|
||||
d_data_codes[static_cast<int32_t>(GALILEO_E1_B_CODE_LENGTH_CHIPS) * 2 * (PRN - 1) + s] = static_cast<int32_t>(data_codes_f[s]);
|
||||
}
|
||||
//printf("\n next \n");
|
||||
//scanf ("%d",&kk);
|
||||
}
|
||||
else
|
||||
{
|
||||
//printf("no tracking pilot\n");
|
||||
galileo_e1_code_gen_sinboc11_float(ca_codes_f, data_signal, PRN);
|
||||
|
||||
for (unsigned int s = 0; s < 2 * GALILEO_E1_B_CODE_LENGTH_CHIPS; s++)
|
||||
for (uint32_t s = 0; s < 2 * GALILEO_E1_B_CODE_LENGTH_CHIPS; s++)
|
||||
{
|
||||
d_ca_codes[static_cast<int>(GALILEO_E1_B_CODE_LENGTH_CHIPS) * 2 * (PRN - 1) + s] = static_cast<int>(ca_codes_f[s]);
|
||||
//printf("%f %d | ", ca_codes_f[s], d_ca_codes[static_cast<int>(GALILEO_E1_B_CODE_LENGTH_CHIPS)* 2 * (PRN - 1) + s]);
|
||||
d_ca_codes[static_cast<int32_t>(GALILEO_E1_B_CODE_LENGTH_CHIPS) * 2 * (PRN - 1) + s] = static_cast<int32_t>(ca_codes_f[s]);
|
||||
}
|
||||
//printf("\n next \n");
|
||||
//scanf ("%d",&kk);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,7 +202,6 @@ GalileoE1DllPllVemlTrackingFpga::~GalileoE1DllPllVemlTrackingFpga()
|
||||
|
||||
void GalileoE1DllPllVemlTrackingFpga::start_tracking()
|
||||
{
|
||||
//tracking_->start_tracking();
|
||||
tracking_fpga_sc->start_tracking();
|
||||
}
|
||||
|
||||
@@ -227,14 +212,12 @@ void GalileoE1DllPllVemlTrackingFpga::start_tracking()
|
||||
void GalileoE1DllPllVemlTrackingFpga::set_channel(unsigned int channel)
|
||||
{
|
||||
channel_ = channel;
|
||||
//tracking_->set_channel(channel);
|
||||
tracking_fpga_sc->set_channel(channel);
|
||||
}
|
||||
|
||||
|
||||
void GalileoE1DllPllVemlTrackingFpga::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro)
|
||||
{
|
||||
//tracking_->set_gnss_synchro(p_gnss_synchro);
|
||||
tracking_fpga_sc->set_gnss_synchro(p_gnss_synchro);
|
||||
}
|
||||
|
||||
@@ -259,13 +242,11 @@ void GalileoE1DllPllVemlTrackingFpga::disconnect(gr::top_block_sptr top_block)
|
||||
|
||||
gr::basic_block_sptr GalileoE1DllPllVemlTrackingFpga::get_left_block()
|
||||
{
|
||||
//return tracking_;
|
||||
return tracking_fpga_sc;
|
||||
}
|
||||
|
||||
|
||||
gr::basic_block_sptr GalileoE1DllPllVemlTrackingFpga::get_right_block()
|
||||
{
|
||||
//return tracking_;
|
||||
return tracking_fpga_sc;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
/*!
|
||||
* \file galileo_e1_dll_pll_veml_tracking.h
|
||||
* \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
|
||||
* 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:
|
||||
@@ -11,7 +12,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
|
||||
@@ -63,7 +64,7 @@ public:
|
||||
return role_;
|
||||
}
|
||||
|
||||
//! Returns "Galileo_E1_DLL_PLL_VEML_Tracking"
|
||||
//! Returns "Galileo_E1_DLL_PLL_VEML_Tracking_Fpga"
|
||||
inline std::string implementation() override
|
||||
{
|
||||
return "Galileo_E1_DLL_PLL_VEML_Tracking_Fpga";
|
||||
@@ -100,15 +101,14 @@ public:
|
||||
|
||||
|
||||
private:
|
||||
//dll_pll_veml_tracking_sptr tracking_;
|
||||
dll_pll_veml_tracking_fpga_sptr tracking_fpga_sc;
|
||||
size_t item_size_;
|
||||
unsigned int channel_;
|
||||
uint32_t channel_;
|
||||
std::string role_;
|
||||
unsigned int in_streams_;
|
||||
unsigned int out_streams_;
|
||||
int* d_ca_codes;
|
||||
int* d_data_codes;
|
||||
uint32_t in_streams_;
|
||||
uint32_t out_streams_;
|
||||
int32_t* d_ca_codes;
|
||||
int32_t* d_data_codes;
|
||||
bool d_track_pilot;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,19 +1,20 @@
|
||||
/*!
|
||||
* \file galileo_e5a_dll_pll_tracking.cc
|
||||
* \file galileo_e5a_dll_pll_tracking_fpga.cc
|
||||
* \brief Adapts a code DLL + carrier PLL
|
||||
* tracking block to a TrackingInterface for Galileo E5a signals
|
||||
* 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
|
||||
* 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>
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* 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
|
||||
@@ -54,16 +55,13 @@ GalileoE5aDllPllTrackingFpga::GalileoE5aDllPllTrackingFpga(
|
||||
ConfigurationInterface *configuration, const std::string &role,
|
||||
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
|
||||
{
|
||||
//printf("creating the E5A tracking");
|
||||
|
||||
|
||||
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", 12000000);
|
||||
int fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
|
||||
int32_t fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 12000000);
|
||||
int32_t fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
|
||||
trk_param_fpga.fs_in = fs_in;
|
||||
bool dump = configuration->property(role + ".dump", false);
|
||||
trk_param_fpga.dump = dump;
|
||||
@@ -84,9 +82,9 @@ GalileoE5aDllPllTrackingFpga::GalileoE5aDllPllTrackingFpga(
|
||||
trk_param_fpga.dll_bw_narrow_hz = dll_bw_narrow_hz;
|
||||
float early_late_space_chips = configuration->property(role + ".early_late_space_chips", 0.5);
|
||||
trk_param_fpga.early_late_space_chips = early_late_space_chips;
|
||||
int vector_length = std::round(fs_in / (GALILEO_E5A_CODE_CHIP_RATE_HZ / GALILEO_E5A_CODE_LENGTH_CHIPS));
|
||||
int32_t vector_length = std::round(fs_in / (GALILEO_E5A_CODE_CHIP_RATE_HZ / GALILEO_E5A_CODE_LENGTH_CHIPS));
|
||||
trk_param_fpga.vector_length = vector_length;
|
||||
int extend_correlation_symbols = configuration->property(role + ".extend_correlation_symbols", 1);
|
||||
int32_t extend_correlation_symbols = configuration->property(role + ".extend_correlation_symbols", 1);
|
||||
float early_late_space_narrow_chips = configuration->property(role + ".early_late_space_narrow_chips", 0.15);
|
||||
trk_param_fpga.early_late_space_narrow_chips = early_late_space_narrow_chips;
|
||||
bool track_pilot = configuration->property(role + ".track_pilot", false);
|
||||
@@ -112,13 +110,13 @@ GalileoE5aDllPllTrackingFpga::GalileoE5aDllPllTrackingFpga(
|
||||
trk_param_fpga.system = 'E';
|
||||
char sig_[3] = "5X";
|
||||
std::memcpy(trk_param_fpga.signal, sig_, 3);
|
||||
int cn0_samples = configuration->property(role + ".cn0_samples", 20);
|
||||
int32_t cn0_samples = configuration->property(role + ".cn0_samples", 20);
|
||||
if (FLAGS_cn0_samples != 20) cn0_samples = FLAGS_cn0_samples;
|
||||
trk_param_fpga.cn0_samples = cn0_samples;
|
||||
int cn0_min = configuration->property(role + ".cn0_min", 25);
|
||||
int32_t cn0_min = configuration->property(role + ".cn0_min", 25);
|
||||
if (FLAGS_cn0_min != 25) cn0_min = FLAGS_cn0_min;
|
||||
trk_param_fpga.cn0_min = cn0_min;
|
||||
int max_lock_fail = configuration->property(role + ".max_lock_fail", 50);
|
||||
int32_t max_lock_fail = configuration->property(role + ".max_lock_fail", 50);
|
||||
if (FLAGS_max_lock_fail != 50) max_lock_fail = FLAGS_max_lock_fail;
|
||||
trk_param_fpga.max_lock_fail = max_lock_fail;
|
||||
double carrier_lock_th = configuration->property(role + ".carrier_lock_th", 0.85);
|
||||
@@ -129,93 +127,53 @@ GalileoE5aDllPllTrackingFpga::GalileoE5aDllPllTrackingFpga(
|
||||
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;
|
||||
unsigned int device_base = configuration->property(role + ".device_base", 1);
|
||||
uint32_t device_base = configuration->property(role + ".device_base", 27);
|
||||
trk_param_fpga.device_base = device_base;
|
||||
//unsigned int multicorr_type = configuration->property(role + ".multicorr_type", 1);
|
||||
trk_param_fpga.multicorr_type = 1; // 0 -> 3 correlators, 1 -> up to 5+1 correlators
|
||||
|
||||
//################# PRE-COMPUTE ALL THE CODES #################
|
||||
unsigned int code_samples_per_chip = 1;
|
||||
auto code_length_chips = static_cast<unsigned int>(GALILEO_E5A_CODE_LENGTH_CHIPS);
|
||||
uint32_t code_samples_per_chip = 1;
|
||||
auto code_length_chips = static_cast<uint32_t>(GALILEO_E5A_CODE_LENGTH_CHIPS);
|
||||
|
||||
auto *aux_code = static_cast<gr_complex *>(volk_gnsssdr_malloc(sizeof(gr_complex) * code_length_chips * code_samples_per_chip, volk_gnsssdr_get_alignment()));
|
||||
|
||||
float *tracking_code;
|
||||
float *data_code;
|
||||
d_ca_codes = static_cast<int32_t *>(volk_gnsssdr_malloc(static_cast<int32_t>(code_length_chips) * code_samples_per_chip * GALILEO_E5A_NUMBER_OF_CODES * sizeof(int32_t), volk_gnsssdr_get_alignment()));
|
||||
|
||||
if (trk_param_fpga.track_pilot)
|
||||
{
|
||||
data_code = static_cast<float *>(volk_gnsssdr_malloc(code_samples_per_chip * code_length_chips * sizeof(float), volk_gnsssdr_get_alignment()));
|
||||
}
|
||||
tracking_code = static_cast<float *>(volk_gnsssdr_malloc(code_samples_per_chip * code_length_chips * sizeof(float), volk_gnsssdr_get_alignment()));
|
||||
|
||||
d_ca_codes = static_cast<int *>(volk_gnsssdr_malloc(static_cast<int>(code_length_chips) * code_samples_per_chip * GALILEO_E5A_NUMBER_OF_CODES * sizeof(int), volk_gnsssdr_get_alignment()));
|
||||
|
||||
if (trk_param_fpga.track_pilot)
|
||||
{
|
||||
d_data_codes = static_cast<int *>(volk_gnsssdr_malloc((static_cast<unsigned int>(code_length_chips)) * code_samples_per_chip * GALILEO_E5A_NUMBER_OF_CODES * sizeof(int), volk_gnsssdr_get_alignment()));
|
||||
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 (unsigned int PRN = 1; PRN <= GALILEO_E5A_NUMBER_OF_CODES; PRN++)
|
||||
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 *>(trk_param_fpga.signal.c_str()));
|
||||
galileo_e5_a_code_gen_complex_primary(aux_code, PRN, const_cast<char *>(sig_));
|
||||
if (trk_param_fpga.track_pilot)
|
||||
{
|
||||
//d_secondary_code_string = const_cast<std::string *>(&Galileo_E5a_Q_SECONDARY_CODE[PRN - 1]);
|
||||
for (unsigned int i = 0; i < code_length_chips; i++)
|
||||
for (uint32_t s = 0; s < code_length_chips; s++)
|
||||
{
|
||||
tracking_code[i] = aux_code[i].imag();
|
||||
data_code[i] = aux_code[i].real();
|
||||
}
|
||||
for (unsigned int s = 0; s < code_length_chips; s++)
|
||||
{
|
||||
d_ca_codes[static_cast<int>(code_length_chips) * (PRN - 1) + s] = static_cast<int>(tracking_code[s]);
|
||||
d_data_codes[static_cast<int>(code_length_chips) * (PRN - 1) + s] = static_cast<int>(data_code[s]);
|
||||
//printf("%f %d | ", data_codes_f[s], d_data_codes[static_cast<int>(Galileo_E1_B_CODE_LENGTH_CHIPS)* 2 * (PRN - 1) + s]);
|
||||
d_ca_codes[static_cast<int32_t>(code_length_chips) * (PRN - 1) + s] = static_cast<int32_t>(aux_code[s].imag());
|
||||
d_data_codes[static_cast<int32_t>(code_length_chips) * (PRN - 1) + s] = static_cast<int32_t>(aux_code[s].real());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (unsigned int i = 0; i < code_length_chips; i++)
|
||||
for (uint32_t s = 0; s < code_length_chips; s++)
|
||||
{
|
||||
tracking_code[i] = aux_code[i].real();
|
||||
}
|
||||
|
||||
for (unsigned int s = 0; s < code_length_chips; s++)
|
||||
{
|
||||
d_ca_codes[static_cast<int>(code_length_chips) * (PRN - 1) + s] = static_cast<int>(tracking_code[s]);
|
||||
//printf("%f %d | ", ca_codes_f[s], d_ca_codes[static_cast<int>(Galileo_E1_B_CODE_LENGTH_CHIPS)* 2 * (PRN - 1) + s]);
|
||||
d_ca_codes[static_cast<int32_t>(code_length_chips) * (PRN - 1) + s] = static_cast<int32_t>(aux_code[s].real());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
volk_gnsssdr_free(aux_code);
|
||||
volk_gnsssdr_free(tracking_code);
|
||||
if (trk_param_fpga.track_pilot)
|
||||
{
|
||||
volk_gnsssdr_free(data_code);
|
||||
}
|
||||
trk_param_fpga.ca_codes = d_ca_codes;
|
||||
trk_param_fpga.data_codes = d_data_codes;
|
||||
trk_param_fpga.code_length_chips = code_length_chips;
|
||||
trk_param_fpga.code_samples_per_chip = code_samples_per_chip; // 2 sample per chip
|
||||
//################# MAKE TRACKING GNURadio object ###################
|
||||
tracking_fpga_sc = dll_pll_veml_make_tracking_fpga(trk_param_fpga);
|
||||
// if (item_type.compare("gr_complex") == 0)
|
||||
// {
|
||||
// item_size_ = sizeof(gr_complex);
|
||||
// tracking_ = dll_pll_veml_make_tracking(trk_param_fpga);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// item_size_ = sizeof(gr_complex);
|
||||
// LOG(WARNING) << item_type << " unknown tracking item type.";
|
||||
// }
|
||||
channel_ = 0;
|
||||
|
||||
//DLOG(INFO) << "tracking(" << tracking_->unique_id() << ")";
|
||||
DLOG(INFO) << "tracking(" << tracking_fpga_sc->unique_id() << ")";
|
||||
}
|
||||
|
||||
@@ -232,7 +190,6 @@ GalileoE5aDllPllTrackingFpga::~GalileoE5aDllPllTrackingFpga()
|
||||
|
||||
void GalileoE5aDllPllTrackingFpga::start_tracking()
|
||||
{
|
||||
//tracking_->start_tracking();
|
||||
tracking_fpga_sc->start_tracking();
|
||||
}
|
||||
|
||||
@@ -242,16 +199,13 @@ void GalileoE5aDllPllTrackingFpga::start_tracking()
|
||||
*/
|
||||
void GalileoE5aDllPllTrackingFpga::set_channel(unsigned int channel)
|
||||
{
|
||||
//printf("blabla channel = %d\n", channel);
|
||||
channel_ = channel;
|
||||
//tracking_->set_channel(channel);
|
||||
tracking_fpga_sc->set_channel(channel);
|
||||
}
|
||||
|
||||
|
||||
void GalileoE5aDllPllTrackingFpga::set_gnss_synchro(Gnss_Synchro *p_gnss_synchro)
|
||||
{
|
||||
//tracking_->set_gnss_synchro(p_gnss_synchro);
|
||||
tracking_fpga_sc->set_gnss_synchro(p_gnss_synchro);
|
||||
}
|
||||
|
||||
@@ -276,13 +230,11 @@ void GalileoE5aDllPllTrackingFpga::disconnect(gr::top_block_sptr top_block)
|
||||
|
||||
gr::basic_block_sptr GalileoE5aDllPllTrackingFpga::get_left_block()
|
||||
{
|
||||
//return tracking_;
|
||||
return tracking_fpga_sc;
|
||||
}
|
||||
|
||||
|
||||
gr::basic_block_sptr GalileoE5aDllPllTrackingFpga::get_right_block()
|
||||
{
|
||||
//return tracking_;
|
||||
return tracking_fpga_sc;
|
||||
}
|
||||
|
||||
@@ -1,19 +1,20 @@
|
||||
/*!
|
||||
* \file galileo_e5a_dll_pll_tracking.h
|
||||
* \file galileo_e5a_dll_pll_tracking_fpga.h
|
||||
* \brief Adapts a code DLL + carrier PLL
|
||||
* tracking block to a TrackingInterface for Galileo E5a signals
|
||||
* 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
|
||||
* 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>
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* 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
|
||||
@@ -63,10 +64,10 @@ public:
|
||||
return role_;
|
||||
}
|
||||
|
||||
//! Returns "Galileo_E5a_DLL_PLL_Tracking"
|
||||
//! Returns "Galileo_E5a_DLL_PLL_Tracking_Fpga"
|
||||
inline std::string implementation() override
|
||||
{
|
||||
return "Galileo_E5a_DLL_PLL_Tracking";
|
||||
return "Galileo_E5a_DLL_PLL_Tracking_Fpga";
|
||||
}
|
||||
|
||||
inline size_t item_size() override
|
||||
@@ -99,14 +100,14 @@ public:
|
||||
private:
|
||||
dll_pll_veml_tracking_fpga_sptr tracking_fpga_sc;
|
||||
size_t item_size_;
|
||||
unsigned int channel_;
|
||||
uint32_t channel_;
|
||||
std::string role_;
|
||||
unsigned int in_streams_;
|
||||
unsigned int out_streams_;
|
||||
uint32_t in_streams_;
|
||||
uint32_t out_streams_;
|
||||
|
||||
|
||||
int* d_ca_codes;
|
||||
int* d_data_codes;
|
||||
int32_t* d_ca_codes;
|
||||
int32_t* d_data_codes;
|
||||
bool d_track_pilot;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*!
|
||||
* \file gps_l1_ca_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 that uses the FPGA
|
||||
* \author Marc Majoral, 2018, mmajoral(at)cttc.es
|
||||
* 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
|
||||
*
|
||||
@@ -13,7 +13,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
|
||||
@@ -60,10 +60,8 @@ GpsL1CaDllPllTrackingFpga::GpsL1CaDllPllTrackingFpga(
|
||||
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);
|
||||
int32_t fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000);
|
||||
int32_t fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
|
||||
trk_param_fpga.fs_in = fs_in;
|
||||
bool dump = configuration->property(role + ".dump", false);
|
||||
trk_param_fpga.dump = dump;
|
||||
@@ -86,9 +84,9 @@ GpsL1CaDllPllTrackingFpga::GpsL1CaDllPllTrackingFpga(
|
||||
trk_param_fpga.early_late_space_chips = early_late_space_chips;
|
||||
float early_late_space_narrow_chips = configuration->property(role + ".early_late_space_narrow_chips", 0.5);
|
||||
trk_param_fpga.early_late_space_narrow_chips = early_late_space_narrow_chips;
|
||||
int vector_length = std::round(fs_in / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS));
|
||||
int32_t vector_length = std::round(fs_in / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS));
|
||||
trk_param_fpga.vector_length = vector_length;
|
||||
int symbols_extended_correlator = configuration->property(role + ".extend_correlation_symbols", 1);
|
||||
int32_t symbols_extended_correlator = configuration->property(role + ".extend_correlation_symbols", 1);
|
||||
if (symbols_extended_correlator < 1)
|
||||
{
|
||||
symbols_extended_correlator = 1;
|
||||
@@ -115,13 +113,13 @@ GpsL1CaDllPllTrackingFpga::GpsL1CaDllPllTrackingFpga(
|
||||
trk_param_fpga.system = 'G';
|
||||
char sig_[3] = "1C";
|
||||
std::memcpy(trk_param_fpga.signal, sig_, 3);
|
||||
int cn0_samples = configuration->property(role + ".cn0_samples", 20);
|
||||
int32_t cn0_samples = configuration->property(role + ".cn0_samples", 20);
|
||||
if (FLAGS_cn0_samples != 20) cn0_samples = FLAGS_cn0_samples;
|
||||
trk_param_fpga.cn0_samples = cn0_samples;
|
||||
int cn0_min = configuration->property(role + ".cn0_min", 25);
|
||||
int32_t cn0_min = configuration->property(role + ".cn0_min", 25);
|
||||
if (FLAGS_cn0_min != 25) cn0_min = FLAGS_cn0_min;
|
||||
trk_param_fpga.cn0_min = cn0_min;
|
||||
int max_lock_fail = configuration->property(role + ".max_lock_fail", 50);
|
||||
int32_t max_lock_fail = configuration->property(role + ".max_lock_fail", 50);
|
||||
if (FLAGS_max_lock_fail != 50) max_lock_fail = FLAGS_max_lock_fail;
|
||||
trk_param_fpga.max_lock_fail = max_lock_fail;
|
||||
double carrier_lock_th = configuration->property(role + ".carrier_lock_th", 0.85);
|
||||
@@ -132,16 +130,15 @@ GpsL1CaDllPllTrackingFpga::GpsL1CaDllPllTrackingFpga(
|
||||
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;
|
||||
unsigned int device_base = configuration->property(role + ".device_base", 1);
|
||||
uint32_t device_base = configuration->property(role + ".device_base", 3);
|
||||
trk_param_fpga.device_base = device_base;
|
||||
//unsigned int multicorr_type = configuration->property(role + ".multicorr_type", 0);
|
||||
trk_param_fpga.multicorr_type = 0; //multicorr_type : 0 -> 3 correlators, 1 -> 5 correlators
|
||||
|
||||
//################# PRE-COMPUTE ALL THE CODES #################
|
||||
d_ca_codes = static_cast<int*>(volk_gnsssdr_malloc(static_cast<int>(GPS_L1_CA_CODE_LENGTH_CHIPS * NUM_PRNs) * sizeof(int), volk_gnsssdr_get_alignment()));
|
||||
for (unsigned int PRN = 1; PRN <= NUM_PRNs; PRN++)
|
||||
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++)
|
||||
{
|
||||
gps_l1_ca_code_gen_int(&d_ca_codes[(int(GPS_L1_CA_CODE_LENGTH_CHIPS)) * (PRN - 1)], PRN, 0);
|
||||
gps_l1_ca_code_gen_int(&d_ca_codes[(int32_t(GPS_L1_CA_CODE_LENGTH_CHIPS)) * (PRN - 1)], PRN, 0);
|
||||
}
|
||||
trk_param_fpga.ca_codes = d_ca_codes;
|
||||
trk_param_fpga.code_length_chips = GPS_L1_CA_CODE_LENGTH_CHIPS;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*!
|
||||
* \file gps_l1_ca_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 that uses the FPGA
|
||||
* \author Marc Majoral, 2018. mmajoral(at)cttc.es
|
||||
* 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
|
||||
*
|
||||
@@ -13,7 +13,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
|
||||
@@ -101,11 +101,11 @@ public:
|
||||
private:
|
||||
dll_pll_veml_tracking_fpga_sptr tracking_fpga_sc;
|
||||
size_t item_size_;
|
||||
unsigned int channel_;
|
||||
uint32_t channel_;
|
||||
std::string role_;
|
||||
unsigned int in_streams_;
|
||||
unsigned int out_streams_;
|
||||
int* d_ca_codes;
|
||||
uint32_t in_streams_;
|
||||
uint32_t out_streams_;
|
||||
int32_t* d_ca_codes;
|
||||
};
|
||||
|
||||
#endif // GNSS_SDR_GPS_L1_CA_DLL_PLL_TRACKING_FPGA_H_
|
||||
|
||||
@@ -63,7 +63,7 @@ public:
|
||||
return role_;
|
||||
}
|
||||
|
||||
//! Returns "GPS_L2_M_DLL_PLL_Tracking"
|
||||
//! Returns "GPS_L2_M_DLL_PLL_Tracking_Fpga"
|
||||
inline std::string implementation() override
|
||||
{
|
||||
return "GPS_L2_M_DLL_PLL_Tracking_Fpga";
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
* \file gps_l5_dll_pll_tracking.cc
|
||||
* \brief Interface of an adapter of a DLL+PLL tracking loop block
|
||||
* for GPS L5 to a TrackingInterface
|
||||
* \author Marc Majoral, 2019. mmajoral(at)cttc.cat
|
||||
* \author Javier Arribas, 2017. jarribas(at)cttc.es
|
||||
*
|
||||
* Code DLL + carrier PLL according to the algorithms described in:
|
||||
@@ -11,7 +12,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
|
||||
@@ -55,15 +56,11 @@ GpsL5DllPllTrackingFpga::GpsL5DllPllTrackingFpga(
|
||||
ConfigurationInterface *configuration, const std::string &role,
|
||||
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
|
||||
{
|
||||
//printf("L5 TRK CLASS CREATED\n");
|
||||
//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);
|
||||
int32_t fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 12500000);
|
||||
int32_t fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
|
||||
trk_param_fpga.fs_in = fs_in;
|
||||
bool dump = configuration->property(role + ".dump", false);
|
||||
trk_param_fpga.dump = dump;
|
||||
@@ -84,9 +81,9 @@ GpsL5DllPllTrackingFpga::GpsL5DllPllTrackingFpga(
|
||||
trk_param_fpga.dll_bw_narrow_hz = dll_bw_narrow_hz;
|
||||
float early_late_space_chips = configuration->property(role + ".early_late_space_chips", 0.5);
|
||||
trk_param_fpga.early_late_space_chips = early_late_space_chips;
|
||||
int vector_length = std::round(static_cast<double>(fs_in) / (static_cast<double>(GPS_L5I_CODE_RATE_HZ) / static_cast<double>(GPS_L5I_CODE_LENGTH_CHIPS)));
|
||||
int32_t vector_length = std::round(static_cast<double>(fs_in) / (static_cast<double>(GPS_L5I_CODE_RATE_HZ) / static_cast<double>(GPS_L5I_CODE_LENGTH_CHIPS)));
|
||||
trk_param_fpga.vector_length = vector_length;
|
||||
int extend_correlation_symbols = configuration->property(role + ".extend_correlation_symbols", 1);
|
||||
int32_t extend_correlation_symbols = configuration->property(role + ".extend_correlation_symbols", 1);
|
||||
float early_late_space_narrow_chips = configuration->property(role + ".early_late_space_narrow_chips", 0.15);
|
||||
trk_param_fpga.early_late_space_narrow_chips = early_late_space_narrow_chips;
|
||||
bool track_pilot = configuration->property(role + ".track_pilot", false);
|
||||
@@ -112,32 +109,30 @@ GpsL5DllPllTrackingFpga::GpsL5DllPllTrackingFpga(
|
||||
trk_param_fpga.system = 'G';
|
||||
char sig_[3] = "L5";
|
||||
std::memcpy(trk_param_fpga.signal, sig_, 3);
|
||||
int cn0_samples = configuration->property(role + ".cn0_samples", 20);
|
||||
int32_t cn0_samples = configuration->property(role + ".cn0_samples", 20);
|
||||
if (FLAGS_cn0_samples != 20) cn0_samples = FLAGS_cn0_samples;
|
||||
trk_param_fpga.cn0_samples = cn0_samples;
|
||||
int cn0_min = configuration->property(role + ".cn0_min", 25);
|
||||
int32_t cn0_min = configuration->property(role + ".cn0_min", 25);
|
||||
if (FLAGS_cn0_min != 25) cn0_min = FLAGS_cn0_min;
|
||||
trk_param_fpga.cn0_min = cn0_min;
|
||||
int max_lock_fail = configuration->property(role + ".max_lock_fail", 50);
|
||||
int32_t max_lock_fail = configuration->property(role + ".max_lock_fail", 50);
|
||||
if (FLAGS_max_lock_fail != 50) max_lock_fail = FLAGS_max_lock_fail;
|
||||
trk_param_fpga.max_lock_fail = max_lock_fail;
|
||||
double carrier_lock_th = configuration->property(role + ".carrier_lock_th", 0.85);
|
||||
double carrier_lock_th = configuration->property(role + ".carrier_lock_th", 0.75);
|
||||
if (FLAGS_carrier_lock_th != 0.85) carrier_lock_th = FLAGS_carrier_lock_th;
|
||||
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;
|
||||
unsigned int device_base = configuration->property(role + ".device_base", 1);
|
||||
uint32_t device_base = configuration->property(role + ".device_base", 27);
|
||||
trk_param_fpga.device_base = device_base;
|
||||
//unsigned int multicorr_type = configuration->property(role + ".multicorr_type", 0);
|
||||
trk_param_fpga.multicorr_type = 0; //multicorr_type : 0 -> 3 correlators, 1 -> 5 correlators
|
||||
|
||||
//################# PRE-COMPUTE ALL THE CODES #################
|
||||
unsigned int code_samples_per_chip = 1;
|
||||
auto code_length_chips = static_cast<unsigned int>(GPS_L5I_CODE_LENGTH_CHIPS);
|
||||
//printf("TRK code_length_chips = %d\n", code_length_chips);
|
||||
uint32_t code_samples_per_chip = 1;
|
||||
auto code_length_chips = static_cast<uint32_t>(GPS_L5I_CODE_LENGTH_CHIPS);
|
||||
|
||||
float *tracking_code;
|
||||
float *data_code;
|
||||
@@ -149,42 +144,37 @@ GpsL5DllPllTrackingFpga::GpsL5DllPllTrackingFpga(
|
||||
data_code = static_cast<float *>(volk_gnsssdr_malloc(code_length_chips * sizeof(float), volk_gnsssdr_get_alignment()));
|
||||
}
|
||||
|
||||
d_ca_codes = static_cast<int *>(volk_gnsssdr_malloc(static_cast<int>(code_length_chips * NUM_PRNs) * sizeof(int), volk_gnsssdr_get_alignment()));
|
||||
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 = static_cast<int *>(volk_gnsssdr_malloc((static_cast<unsigned int>(code_length_chips)) * NUM_PRNs * sizeof(int), volk_gnsssdr_get_alignment()));
|
||||
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()));
|
||||
}
|
||||
|
||||
//printf("start \n");
|
||||
for (unsigned int PRN = 1; PRN <= NUM_PRNs; PRN++)
|
||||
for (uint32_t PRN = 1; PRN <= NUM_PRNs; PRN++)
|
||||
{
|
||||
if (track_pilot)
|
||||
if (trk_param_fpga.track_pilot)
|
||||
{
|
||||
gps_l5q_code_gen_float(tracking_code, PRN);
|
||||
gps_l5i_code_gen_float(data_code, PRN);
|
||||
|
||||
|
||||
for (unsigned int s = 0; s < code_length_chips; s++)
|
||||
for (uint32_t s = 0; s < code_length_chips; s++)
|
||||
{
|
||||
d_ca_codes[static_cast<int>(code_length_chips) * (PRN - 1) + s] = static_cast<int>(tracking_code[s]);
|
||||
d_data_codes[static_cast<int>(code_length_chips) * (PRN - 1) + s] = static_cast<int>(data_code[s]);
|
||||
//printf("%f %d | ", data_codes_f[s], d_data_codes[static_cast<int>(Galileo_E1_B_CODE_LENGTH_CHIPS)* 2 * (PRN - 1) + 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);
|
||||
for (unsigned int s = 0; s < code_length_chips; s++)
|
||||
for (uint32_t s = 0; s < code_length_chips; s++)
|
||||
{
|
||||
d_ca_codes[static_cast<int>(code_length_chips) * (PRN - 1) + s] = static_cast<int>(data_code[s]);
|
||||
//printf("%f %d | ", ca_codes_f[s], d_ca_codes[static_cast<int>(Galileo_E1_B_CODE_LENGTH_CHIPS)* 2 * (PRN - 1) + s]);
|
||||
d_ca_codes[static_cast<int32_t>(code_length_chips) * (PRN - 1) + s] = static_cast<int32_t>(tracking_code[s]);
|
||||
}
|
||||
}
|
||||
}
|
||||
//printf("end \n");
|
||||
|
||||
|
||||
delete[] tracking_code;
|
||||
if (trk_param_fpga.track_pilot)
|
||||
@@ -195,20 +185,7 @@ GpsL5DllPllTrackingFpga::GpsL5DllPllTrackingFpga(
|
||||
trk_param_fpga.data_codes = d_data_codes;
|
||||
trk_param_fpga.code_length_chips = code_length_chips;
|
||||
trk_param_fpga.code_samples_per_chip = code_samples_per_chip; // 2 sample per chip
|
||||
//################# MAKE TRACKING GNURadio object ###################
|
||||
// if (item_type.compare("gr_complex") == 0)
|
||||
// {
|
||||
// item_size_ = sizeof(gr_complex);
|
||||
// tracking_ = dll_pll_veml_make_tracking(trk_param_fpga);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// item_size_ = sizeof(gr_complex);
|
||||
// LOG(WARNING) << item_type << " unknown tracking item type.";
|
||||
// }
|
||||
//printf("call \n");
|
||||
tracking_fpga_sc = dll_pll_veml_make_tracking_fpga(trk_param_fpga);
|
||||
//printf("end2 \n");
|
||||
channel_ = 0;
|
||||
DLOG(INFO) << "tracking(" << tracking_fpga_sc->unique_id() << ")";
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
* \file gps_l5_dll_pll_tracking.h
|
||||
* \brief Interface of an adapter of a DLL+PLL tracking loop block
|
||||
* for GPS L5 to a TrackingInterface
|
||||
* \author Marc Majoral, 2019. mmajoral(at)cttc.cat
|
||||
* \author Javier Arribas, 2017. jarribas(at)cttc.es
|
||||
*
|
||||
* Code DLL + carrier PLL according to the algorithms described in:
|
||||
@@ -11,7 +12,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
|
||||
@@ -95,16 +96,15 @@ public:
|
||||
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_;
|
||||
uint32_t channel_;
|
||||
std::string role_;
|
||||
unsigned int in_streams_;
|
||||
unsigned int out_streams_;
|
||||
uint32_t in_streams_;
|
||||
uint32_t out_streams_;
|
||||
bool d_track_pilot;
|
||||
int* d_ca_codes;
|
||||
int* d_data_codes;
|
||||
int32_t* d_ca_codes;
|
||||
int32_t* d_data_codes;
|
||||
};
|
||||
|
||||
#endif // GNSS_SDR_GPS_L5_DLL_PLL_TRACKING_FPGA_H_
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,19 +1,13 @@
|
||||
/*!
|
||||
* \file gps_l1_ca_dll_pll_tracking_fpga.h
|
||||
* \brief Interface of a code DLL + carrier PLL tracking block
|
||||
* \author Marc Majoral, 2018. marc.majoral(at)cttc.es
|
||||
* Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
|
||||
* Javier Arribas, 2011. jarribas(at)cttc.es
|
||||
* Cillian O'Driscoll, 2017. cillian.odriscoll(at)gmail.com
|
||||
*
|
||||
* Code DLL + carrier PLL according to the algorithms described in:
|
||||
* K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S.H.Jensen,
|
||||
* A Software-Defined GPS and Galileo Receiver. A Single-Frequency Approach,
|
||||
* Birkhauser, 2007
|
||||
* \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
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* 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
|
||||
@@ -31,7 +25,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with GNSS-SDR. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -49,18 +43,18 @@
|
||||
#include <fstream>
|
||||
#include <map>
|
||||
#include <queue>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
//#include <string>
|
||||
|
||||
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_);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief This class implements a DLL + PLL tracking loop block
|
||||
* \brief This class implements a code DLL + carrier PLL tracking block.
|
||||
*/
|
||||
class dll_pll_veml_tracking_fpga : public gr::block
|
||||
{
|
||||
@@ -71,6 +65,7 @@ public:
|
||||
void set_gnss_synchro(Gnss_Synchro *p_gnss_synchro);
|
||||
void start_tracking();
|
||||
void stop_tracking();
|
||||
|
||||
int general_work(int noutput_items, gr_vector_int &ninput_items,
|
||||
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items);
|
||||
|
||||
@@ -84,6 +79,7 @@ private:
|
||||
|
||||
bool cn0_and_tracking_lock_status(double coh_integration_time_s);
|
||||
bool acquire_secondary();
|
||||
void do_correlation_step(void);
|
||||
void run_dll_pll();
|
||||
void update_tracking_vars();
|
||||
void clear_tracking_vars();
|
||||
@@ -91,9 +87,10 @@ private:
|
||||
void log_data(bool integrating);
|
||||
int32_t save_matfile();
|
||||
|
||||
void run_state_2(Gnss_Synchro ¤t_synchro_data);
|
||||
|
||||
// tracking configuration vars
|
||||
Dll_Pll_Conf_Fpga trk_parameters;
|
||||
//dllpllconf_fpga_t trk_parameters;
|
||||
bool d_veml;
|
||||
bool d_cloop;
|
||||
uint32_t d_channel;
|
||||
@@ -119,14 +116,20 @@ private:
|
||||
|
||||
//tracking state machine
|
||||
int32_t d_state;
|
||||
bool d_synchonizing;
|
||||
//Integration period in samples
|
||||
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
|
||||
as an enhancement to increase the performance
|
||||
*/
|
||||
gr_complex *d_correlator_outs;
|
||||
gr_complex *d_Very_Early;
|
||||
gr_complex *d_Early;
|
||||
@@ -148,10 +151,14 @@ private:
|
||||
gr_complex *d_Prompt_Data;
|
||||
|
||||
double d_code_phase_step_chips;
|
||||
double d_code_phase_rate_step_chips;
|
||||
boost::circular_buffer<std::pair<double, double>> d_code_ph_history;
|
||||
double d_carrier_phase_step_rad;
|
||||
double d_carrier_phase_rate_step_rad;
|
||||
boost::circular_buffer<std::pair<double, double>> d_carr_ph_history;
|
||||
// remaining code phase and carrier phase between tracking loops
|
||||
double d_rem_code_phase_samples;
|
||||
double d_rem_carr_phase_rad;
|
||||
float d_rem_carr_phase_rad;
|
||||
|
||||
// PLL and DLL filter library
|
||||
Tracking_2nd_DLL_filter d_code_loop_filter;
|
||||
@@ -166,12 +173,10 @@ private:
|
||||
double d_carr_error_filt_hz;
|
||||
double d_code_error_chips;
|
||||
double d_code_error_filt_chips;
|
||||
double d_K_blk_samples;
|
||||
double d_code_freq_chips;
|
||||
double d_carrier_doppler_hz;
|
||||
double d_acc_carrier_phase_rad;
|
||||
double d_rem_code_phase_chips;
|
||||
double d_code_phase_samples;
|
||||
double T_chip_seconds;
|
||||
double T_prn_seconds;
|
||||
double T_prn_samples;
|
||||
@@ -181,11 +186,13 @@ private:
|
||||
// processing samples counters
|
||||
uint64_t d_sample_counter;
|
||||
uint64_t d_acq_sample_stamp;
|
||||
|
||||
uint64_t d_absolute_samples_offset;
|
||||
|
||||
// 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;
|
||||
@@ -202,7 +209,6 @@ private:
|
||||
int32_t d_correlation_length_samples;
|
||||
int32_t d_next_prn_length_samples;
|
||||
uint64_t d_sample_counter_next;
|
||||
uint32_t d_pull_in = 0U;
|
||||
};
|
||||
|
||||
#endif //GNSS_SDR_DLL_PLL_VEML_TRACKING_FPGA_H
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
/*!
|
||||
* \file dll_pll_conf.cc
|
||||
* \file dll_pll_conf_fpga.cc
|
||||
* \brief Class that contains all the configuration parameters for generic
|
||||
* tracking block based on a DLL and a PLL.
|
||||
* tracking block based on a DLL and a PLL for the FPGA.
|
||||
* \author Marc Majoral, 2019. mmajoral(at)cttc.cat
|
||||
* \author Javier Arribas, 2018. jarribas(at)cttc.es
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2018 (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
|
||||
@@ -36,12 +37,14 @@
|
||||
Dll_Pll_Conf_Fpga::Dll_Pll_Conf_Fpga()
|
||||
{
|
||||
/* DLL/PLL tracking configuration */
|
||||
high_dyn = false;
|
||||
smoother_length = 10;
|
||||
fs_in = 0.0;
|
||||
vector_length = 0U;
|
||||
dump = false;
|
||||
dump_mat = true;
|
||||
dump_filename = std::string("./dll_pll_dump.dat");
|
||||
pll_bw_hz = 40.0;
|
||||
pll_bw_hz = 35.0;
|
||||
dll_bw_hz = 2.0;
|
||||
pll_bw_narrow_hz = 5.0;
|
||||
dll_bw_narrow_hz = 0.75;
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
/*!
|
||||
* \file dll_pll_conf.h
|
||||
* \brief Class that contains all the configuration parameters for generic tracking block based on a DLL and a PLL.
|
||||
* \file dll_pll_conf_fpga.h
|
||||
* \brief Class that contains all the configuration parameters for generic
|
||||
* tracking block based on a DLL and a PLL for the FPGA.
|
||||
* \author Marc Majoral, 2019. mmajoral(at)cttc.cat
|
||||
* \author Javier Arribas, 2018. jarribas(at)cttc.es
|
||||
*
|
||||
* Class that contains all the configuration parameters for generic tracking block based on a DLL and a PLL.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2018 (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
|
||||
@@ -54,9 +56,11 @@ public:
|
||||
float early_late_space_narrow_chips;
|
||||
float very_early_late_space_narrow_chips;
|
||||
int32_t extend_correlation_symbols;
|
||||
bool high_dyn;
|
||||
int32_t cn0_samples;
|
||||
int32_t cn0_min;
|
||||
int32_t max_lock_fail;
|
||||
uint32_t smoother_length;
|
||||
double carrier_lock_th;
|
||||
bool track_pilot;
|
||||
char system;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* \file fpga_multicorrelator_8sc.cc
|
||||
* \brief High optimized FPGA vector correlator class
|
||||
* \authors <ul>
|
||||
* <li> Marc Majoral, 2017. mmajoral(at)cttc.cat
|
||||
* <li> Marc Majoral, 2019. mmajoral(at)cttc.cat
|
||||
* <li> Javier Arribas, 2015. jarribas(at)cttc.es
|
||||
* </ul>
|
||||
*
|
||||
@@ -11,7 +11,7 @@
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2018 (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,41 +35,23 @@
|
||||
*/
|
||||
|
||||
#include "fpga_multicorrelator.h"
|
||||
#include <cmath>
|
||||
|
||||
// FPGA stuff
|
||||
#include <new>
|
||||
|
||||
// libraries used by DMA test code and GIPO test code
|
||||
#include <cerrno>
|
||||
#include <cstdio>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
// libraries used by DMA test code
|
||||
#include <glog/logging.h>
|
||||
#include <cassert>
|
||||
#include <cerrno>
|
||||
#include <cmath>
|
||||
#include <csignal>
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <fcntl.h>
|
||||
#include <new>
|
||||
#include <string>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
// libraries used by GPIO test code
|
||||
#include <csignal>
|
||||
#include <cstdlib>
|
||||
#include <sys/mman.h>
|
||||
|
||||
// logging
|
||||
#include <glog/logging.h>
|
||||
|
||||
// string manipulation
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
// constants
|
||||
#include "GPS_L1_CA.h"
|
||||
|
||||
//#include "gps_sdr_signal_processing.h"
|
||||
|
||||
#define NUM_PRNs 32
|
||||
// FPGA register access constants
|
||||
#define PAGE_SIZE 0x10000
|
||||
#define MAX_LENGTH_DEVICEIO_NAME 50
|
||||
#define CODE_RESAMPLER_NUM_BITS_PRECISION 20
|
||||
@@ -84,54 +66,50 @@
|
||||
#define LOCAL_CODE_FPGA_ENABLE_WRITE_MEMORY 0x0C000000
|
||||
#define TEST_REGISTER_TRACK_WRITEVAL 0x55AA
|
||||
|
||||
uint64_t fpga_multicorrelator_8sc::read_sample_counter()
|
||||
|
||||
uint64_t Fpga_Multicorrelator_8sc::read_sample_counter()
|
||||
{
|
||||
uint64_t sample_counter_tmp, sample_counter_msw_tmp;
|
||||
sample_counter_tmp = d_map_base[d_SAMPLE_COUNTER_REG_ADDR_LSW];
|
||||
sample_counter_msw_tmp = d_map_base[d_SAMPLE_COUNTER_REG_ADDR_MSW];
|
||||
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 d_map_base[d_SAMPLE_COUNTER_REG_ADDR];
|
||||
return sample_counter_tmp;
|
||||
}
|
||||
|
||||
void fpga_multicorrelator_8sc::set_initial_sample(uint64_t samples_offset)
|
||||
void Fpga_Multicorrelator_8sc::set_initial_sample(uint64_t samples_offset)
|
||||
{
|
||||
d_initial_sample_counter = samples_offset;
|
||||
//printf("www writing d map base %d = d_initial_sample_counter = %d\n", d_INITIAL_COUNTER_VALUE_REG_ADDR, d_initial_sample_counter);
|
||||
d_map_base[d_INITIAL_COUNTER_VALUE_REG_ADDR_LSW] = (d_initial_sample_counter & 0xFFFFFFFF);
|
||||
d_map_base[d_INITIAL_COUNTER_VALUE_REG_ADDR_MSW] = (d_initial_sample_counter >> 32) & 0xFFFFFFFF;
|
||||
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(int32_t code_length_chips,
|
||||
// float *shifts_chips, int32_t PRN)
|
||||
|
||||
void fpga_multicorrelator_8sc::set_local_code_and_taps(float *shifts_chips, float *prompt_data_shift, int32_t PRN)
|
||||
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;
|
||||
//d_code_length_chips = code_length_chips;
|
||||
fpga_multicorrelator_8sc::fpga_configure_tracking_gps_local_code(PRN);
|
||||
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)
|
||||
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)
|
||||
void Fpga_Multicorrelator_8sc::update_local_code(float rem_code_phase_chips)
|
||||
{
|
||||
d_rem_code_phase_chips = rem_code_phase_chips;
|
||||
//printf("uuuuu d_rem_code_phase_chips = %f\n", d_rem_code_phase_chips);
|
||||
fpga_multicorrelator_8sc::fpga_compute_code_shift_parameters();
|
||||
fpga_multicorrelator_8sc::fpga_configure_code_parameters_in_fpga();
|
||||
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(
|
||||
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);
|
||||
@@ -139,27 +117,24 @@ void fpga_multicorrelator_8sc::Carrier_wipeoff_multicorrelator_resampler(
|
||||
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();
|
||||
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;
|
||||
//printf("$$$$$ waiting for interrupt ... \n");
|
||||
nb = read(d_device_descriptor, &irq_count, sizeof(irq_count));
|
||||
//printf("$$$$$ interrupt received ... \n");
|
||||
if (nb != sizeof(irq_count))
|
||||
{
|
||||
printf("Tracking_module Read failed to retrieve 4 bytes!\n");
|
||||
printf("Tracking_module Interrupt number %d\n", 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::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)
|
||||
{
|
||||
//printf("tracking fpga class created\n");
|
||||
d_n_correlators = n_correlators;
|
||||
d_device_name = std::move(device_name);
|
||||
d_device_base = device_base;
|
||||
@@ -195,111 +170,26 @@ fpga_multicorrelator_8sc::fpga_multicorrelator_8sc(int32_t n_correlators,
|
||||
d_initial_sample_counter = 0;
|
||||
d_channel = 0;
|
||||
d_correlator_length_samples = 0,
|
||||
//d_code_length = code_length;
|
||||
d_code_length_chips = code_length_chips;
|
||||
d_code_length_chips = code_length_chips;
|
||||
d_ca_codes = ca_codes;
|
||||
d_data_codes = data_codes;
|
||||
d_multicorr_type = multicorr_type;
|
||||
|
||||
d_code_samples_per_chip = code_samples_per_chip;
|
||||
// set up register mapping
|
||||
|
||||
// write-only registers
|
||||
d_CODE_PHASE_STEP_CHIPS_NUM_REG_ADDR = 0;
|
||||
d_INITIAL_INDEX_REG_BASE_ADDR = 1;
|
||||
// if (d_multicorr_type == 0)
|
||||
// {
|
||||
// // multicorrelator with 3 correlators (16 registers only)
|
||||
// d_INITIAL_INTERP_COUNTER_REG_BASE_ADDR = 4;
|
||||
// d_NSAMPLES_MINUS_1_REG_ADDR = 7;
|
||||
// d_CODE_LENGTH_MINUS_1_REG_ADDR = 8;
|
||||
// d_REM_CARR_PHASE_RAD_REG_ADDR = 9;
|
||||
// d_PHASE_STEP_RAD_REG_ADDR = 10;
|
||||
// d_PROG_MEMS_ADDR = 11;
|
||||
// d_DROP_SAMPLES_REG_ADDR = 12;
|
||||
// d_INITIAL_COUNTER_VALUE_REG_ADDR = 13;
|
||||
// d_START_FLAG_ADDR = 14;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// other types of multicorrelators (32 registers)
|
||||
d_INITIAL_INTERP_COUNTER_REG_BASE_ADDR = 7;
|
||||
d_NSAMPLES_MINUS_1_REG_ADDR = 13;
|
||||
d_CODE_LENGTH_MINUS_1_REG_ADDR = 14;
|
||||
d_REM_CARR_PHASE_RAD_REG_ADDR = 15;
|
||||
d_PHASE_STEP_RAD_REG_ADDR = 16;
|
||||
d_PROG_MEMS_ADDR = 17;
|
||||
d_DROP_SAMPLES_REG_ADDR = 18;
|
||||
d_INITIAL_COUNTER_VALUE_REG_ADDR_LSW = 19;
|
||||
d_INITIAL_COUNTER_VALUE_REG_ADDR_MSW = 20;
|
||||
d_START_FLAG_ADDR = 30;
|
||||
// }
|
||||
|
||||
//printf("d_n_correlators = %d\n", d_n_correlators);
|
||||
//printf("d_multicorr_type = %d\n", d_multicorr_type);
|
||||
// read-write registers
|
||||
// if (d_multicorr_type == 0)
|
||||
// {
|
||||
// // multicorrelator with 3 correlators (16 registers only)
|
||||
// d_TEST_REG_ADDR = 15;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// other types of multicorrelators (32 registers)
|
||||
d_TEST_REG_ADDR = 31;
|
||||
// }
|
||||
|
||||
// result 2's complement saturation value
|
||||
// if (d_multicorr_type == 0)
|
||||
// {
|
||||
// // multicorrelator with 3 correlators (16 registers only)
|
||||
// d_result_SAT_value = 1048576; // 21 bits 2's complement -> 2^20
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// // other types of multicorrelators (32 registers)
|
||||
// d_result_SAT_value = 4194304; // 23 bits 2's complement -> 2^22
|
||||
// }
|
||||
|
||||
// read only registers
|
||||
d_RESULT_REG_REAL_BASE_ADDR = 1;
|
||||
// if (d_multicorr_type == 0)
|
||||
// {
|
||||
// // multicorrelator with 3 correlators (16 registers only)
|
||||
// d_RESULT_REG_IMAG_BASE_ADDR = 4;
|
||||
// d_RESULT_REG_DATA_REAL_BASE_ADDR = 0; // no pilot tracking
|
||||
// d_RESULT_REG_DATA_IMAG_BASE_ADDR = 0;
|
||||
// d_SAMPLE_COUNTER_REG_ADDR = 7;
|
||||
//
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// other types of multicorrelators (32 registers)
|
||||
d_RESULT_REG_IMAG_BASE_ADDR = 7;
|
||||
d_RESULT_REG_DATA_REAL_BASE_ADDR = 6; // no pilot tracking
|
||||
d_RESULT_REG_DATA_IMAG_BASE_ADDR = 12;
|
||||
d_SAMPLE_COUNTER_REG_ADDR_LSW = 13;
|
||||
d_SAMPLE_COUNTER_REG_ADDR_MSW = 14;
|
||||
|
||||
// }
|
||||
|
||||
//printf("d_SAMPLE_COUNTER_REG_ADDR = %d\n", d_SAMPLE_COUNTER_REG_ADDR);
|
||||
//printf("mmmmmmmmmmmmm d_n_correlators = %d\n", d_n_correlators);
|
||||
DLOG(INFO) << "TRACKING FPGA CLASS CREATED";
|
||||
}
|
||||
|
||||
|
||||
fpga_multicorrelator_8sc::~fpga_multicorrelator_8sc()
|
||||
Fpga_Multicorrelator_8sc::~Fpga_Multicorrelator_8sc()
|
||||
{
|
||||
//delete[] d_ca_codes;
|
||||
close_device();
|
||||
}
|
||||
|
||||
|
||||
bool fpga_multicorrelator_8sc::free()
|
||||
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)
|
||||
@@ -318,9 +208,8 @@ bool fpga_multicorrelator_8sc::free()
|
||||
}
|
||||
|
||||
|
||||
void fpga_multicorrelator_8sc::set_channel(uint32_t channel)
|
||||
void Fpga_Multicorrelator_8sc::set_channel(uint32_t channel)
|
||||
{
|
||||
//printf("www trk set channel\n");
|
||||
char device_io_name[MAX_LENGTH_DEVICEIO_NAME]; // driver io name
|
||||
d_channel = channel;
|
||||
|
||||
@@ -332,20 +221,13 @@ void fpga_multicorrelator_8sc::set_channel(uint32_t channel)
|
||||
mergedname = d_device_name + devicebasetemp.str();
|
||||
strcpy(device_io_name, mergedname.c_str());
|
||||
|
||||
//printf("ppps opening device %s\n", device_io_name);
|
||||
std::cout << "trk device_io_name = " << device_io_name << std::endl;
|
||||
|
||||
if ((d_device_descriptor = open(device_io_name, O_RDWR | O_SYNC)) == -1)
|
||||
{
|
||||
LOG(WARNING) << "Cannot open deviceio" << device_io_name;
|
||||
std::cout << "Cannot open deviceio" << device_io_name << std::endl;
|
||||
|
||||
//printf("error opening device\n");
|
||||
}
|
||||
// else
|
||||
// {
|
||||
// std::cout << "deviceio" << device_io_name << " opened successfully" << std::endl;
|
||||
//
|
||||
// }
|
||||
d_map_base = reinterpret_cast<volatile uint32_t *>(mmap(nullptr, PAGE_SIZE,
|
||||
PROT_READ | PROT_WRITE, MAP_SHARED, d_device_descriptor, 0));
|
||||
|
||||
@@ -354,79 +236,47 @@ void fpga_multicorrelator_8sc::set_channel(uint32_t channel)
|
||||
LOG(WARNING) << "Cannot map the FPGA tracking module "
|
||||
<< d_channel << "into user memory";
|
||||
std::cout << "Cannot map deviceio" << device_io_name << std::endl;
|
||||
//printf("error mapping registers\n");
|
||||
}
|
||||
// else
|
||||
// {
|
||||
// std::cout << "deviceio" << device_io_name << "mapped successfully" << std::endl;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// printf("trk mapping registers succes\n"); // this is for debug -- remove !
|
||||
// }
|
||||
|
||||
// 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";
|
||||
printf("tracking test register sanity check failed\n");
|
||||
|
||||
//printf("lslslls test sanity check reg failure\n");
|
||||
std::cout << "tracking test register sanity check failed" << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG(INFO) << "Test register sanity check success !";
|
||||
//printf("tracking test register sanity check success\n");
|
||||
//printf("lslslls test sanity check reg success\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
uint32_t fpga_multicorrelator_8sc::fpga_acquisition_test_register(
|
||||
uint32_t Fpga_Multicorrelator_8sc::fpga_acquisition_test_register(
|
||||
uint32_t writeval)
|
||||
{
|
||||
//printf("d_TEST_REG_ADDR = %d\n", d_TEST_REG_ADDR);
|
||||
|
||||
uint32_t readval = 0;
|
||||
// write value to test register
|
||||
d_map_base[d_TEST_REG_ADDR] = writeval;
|
||||
d_map_base[TEST_REG_ADDR] = writeval;
|
||||
// read value from test register
|
||||
readval = d_map_base[d_TEST_REG_ADDR];
|
||||
readval = d_map_base[TEST_REG_ADDR];
|
||||
// return read value
|
||||
return readval;
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
uint32_t select_pilot_corelator = LOCAL_CODE_FPGA_CORRELATOR_SELECT_COUNT;
|
||||
// select_fpga_correlator = 0;
|
||||
|
||||
//printf("kkk d_n_correlators = %x\n", d_n_correlators);
|
||||
//printf("kkk d_code_length_chips = %d\n", d_code_length_chips);
|
||||
//printf("programming mems d map base %d\n", d_PROG_MEMS_ADDR);
|
||||
|
||||
//FILE *fp;
|
||||
//char str[80];
|
||||
//sprintf(str, "generated_code_PRN%d", PRN);
|
||||
//fp = fopen(str,"w");
|
||||
// for (s = 0; s < d_n_correlators; s++)
|
||||
// {
|
||||
|
||||
//printf("kkk select_fpga_correlator = %x\n", select_fpga_correlator);
|
||||
|
||||
d_map_base[d_PROG_MEMS_ADDR] = LOCAL_CODE_FPGA_CLEAR_ADDRESS_COUNTER;
|
||||
d_map_base[PROG_MEMS_ADDR] = LOCAL_CODE_FPGA_CLEAR_ADDRESS_COUNTER;
|
||||
for (k = 0; k < d_code_length_chips * d_code_samples_per_chip; k++)
|
||||
{
|
||||
//if (d_local_code_in[k] == 1)
|
||||
//printf("kkk d_ca_codes %d = %d\n", k, d_ca_codes[((int(d_code_length)) * (PRN - 1)) + k]);
|
||||
//fprintf(fp, "%d\n", d_ca_codes[((int(d_code_length_chips)) * d_code_samples_per_chip * (PRN - 1)) + k]);
|
||||
if (d_ca_codes[((int(d_code_length_chips)) * d_code_samples_per_chip * (PRN - 1)) + k] == 1)
|
||||
if (d_ca_codes[((int32_t(d_code_length_chips)) * d_code_samples_per_chip * (PRN - 1)) + k] == 1)
|
||||
{
|
||||
code_chip = 1;
|
||||
}
|
||||
@@ -436,22 +286,14 @@ void fpga_multicorrelator_8sc::fpga_configure_tracking_gps_local_code(int32_t PR
|
||||
}
|
||||
|
||||
// copy the local code to the FPGA memory one by one
|
||||
d_map_base[d_PROG_MEMS_ADDR] = LOCAL_CODE_FPGA_ENABLE_WRITE_MEMORY | code_chip; // | select_fpga_correlator;
|
||||
d_map_base[PROG_MEMS_ADDR] = LOCAL_CODE_FPGA_ENABLE_WRITE_MEMORY | code_chip; // | select_fpga_correlator;
|
||||
}
|
||||
// select_fpga_correlator = select_fpga_correlator
|
||||
// + LOCAL_CODE_FPGA_CORRELATOR_SELECT_COUNT;
|
||||
// }
|
||||
//fclose(fp);
|
||||
//printf("kkk d_track_pilot = %d\n", d_track_pilot);
|
||||
if (d_track_pilot)
|
||||
{
|
||||
//printf("kkk select_fpga_correlator = %x\n", select_fpga_correlator);
|
||||
|
||||
d_map_base[d_PROG_MEMS_ADDR] = LOCAL_CODE_FPGA_CLEAR_ADDRESS_COUNTER;
|
||||
d_map_base[PROG_MEMS_ADDR] = LOCAL_CODE_FPGA_CLEAR_ADDRESS_COUNTER;
|
||||
for (k = 0; k < d_code_length_chips * d_code_samples_per_chip; k++)
|
||||
{
|
||||
//if (d_local_code_in[k] == 1)
|
||||
if (d_data_codes[((int(d_code_length_chips)) * d_code_samples_per_chip * (PRN - 1)) + k] == 1)
|
||||
if (d_data_codes[((int32_t(d_code_length_chips)) * d_code_samples_per_chip * (PRN - 1)) + k] == 1)
|
||||
{
|
||||
code_chip = 1;
|
||||
}
|
||||
@@ -459,53 +301,38 @@ void fpga_multicorrelator_8sc::fpga_configure_tracking_gps_local_code(int32_t PR
|
||||
{
|
||||
code_chip = 0;
|
||||
}
|
||||
//printf("%d %d | ", d_data_codes, code_chip);
|
||||
// copy the local code to the FPGA memory one by one
|
||||
d_map_base[d_PROG_MEMS_ADDR] = LOCAL_CODE_FPGA_ENABLE_WRITE_MEMORY | code_chip | select_pilot_corelator;
|
||||
d_map_base[PROG_MEMS_ADDR] = LOCAL_CODE_FPGA_ENABLE_WRITE_MEMORY | code_chip | select_pilot_corelator;
|
||||
}
|
||||
}
|
||||
//printf("\n");
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
|
||||
//printf("ppp d_rem_code_phase_chips = %f\n", d_rem_code_phase_chips);
|
||||
for (i = 0; i < d_n_correlators; i++)
|
||||
{
|
||||
//printf("ppp d_shifts_chips %d = %f\n", i, d_shifts_chips[i]);
|
||||
//printf("ppp d_code_samples_per_chip = %d\n", d_code_samples_per_chip);
|
||||
temp_calculation = floor(
|
||||
d_shifts_chips[i] - d_rem_code_phase_chips);
|
||||
|
||||
//printf("ppp d_rem_code_phase_chips = %f\n", d_rem_code_phase_chips);
|
||||
//printf("ppp temp calculation %d = %f ================================ \n", i, temp_calculation);
|
||||
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
|
||||
}
|
||||
//printf("ppp d_rem_code_phase_chips = %f\n", d_rem_code_phase_chips);
|
||||
//printf("ppp temp calculation %d = %f ================================ \n", i, temp_calculation);
|
||||
d_initial_index[i] = static_cast<uint32_t>((static_cast<int32_t>(temp_calculation)) % (d_code_length_chips * d_code_samples_per_chip));
|
||||
//printf("ppp d_initial_index %d = %d\n", i, d_initial_index[i]);
|
||||
temp_calculation = fmod(d_shifts_chips[i] - d_rem_code_phase_chips,
|
||||
1.0);
|
||||
//printf("ppp fmod %d = fmod(%f, 1) = %f\n", i, d_shifts_chips[i] - d_rem_code_phase_chips, temp_calculation);
|
||||
if (temp_calculation < 0)
|
||||
{
|
||||
temp_calculation = temp_calculation + 1.0; // fmod operator does not work as in Matlab with negative numbers
|
||||
}
|
||||
|
||||
d_initial_interp_counter[i] = static_cast<uint32_t>(floor(MAX_CODE_RESAMPLER_COUNTER * temp_calculation));
|
||||
//printf("ppp d_initial_interp_counter %d = %d\n", i, d_initial_interp_counter[i]);
|
||||
//printf("MAX_CODE_RESAMPLER_COUNTER = %d\n", MAX_CODE_RESAMPLER_COUNTER);
|
||||
}
|
||||
if (d_track_pilot)
|
||||
{
|
||||
//printf("tracking pilot !!!!!!!!!!!!!!!!\n");
|
||||
temp_calculation = floor(
|
||||
d_prompt_data_shift[0] - d_rem_code_phase_chips);
|
||||
|
||||
@@ -522,47 +349,37 @@ void fpga_multicorrelator_8sc::fpga_compute_code_shift_parameters(void)
|
||||
}
|
||||
d_initial_interp_counter[d_n_correlators] = static_cast<uint32_t>(floor(MAX_CODE_RESAMPLER_COUNTER * temp_calculation));
|
||||
}
|
||||
//while(1);
|
||||
}
|
||||
|
||||
|
||||
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++)
|
||||
{
|
||||
//printf("www writing d map base %d = d_initial_index %d = %d\n", d_INITIAL_INDEX_REG_BASE_ADDR + i, i, d_initial_index[i]);
|
||||
d_map_base[d_INITIAL_INDEX_REG_BASE_ADDR + i] = d_initial_index[i];
|
||||
//d_map_base[1 + d_n_correlators + i] = d_initial_interp_counter[i];
|
||||
//printf("www writing d map base %d = d_initial_interp_counter %d = %d\n", d_INITIAL_INTERP_COUNTER_REG_BASE_ADDR + i, i, d_initial_interp_counter[i]);
|
||||
d_map_base[d_INITIAL_INTERP_COUNTER_REG_BASE_ADDR + i] = d_initial_interp_counter[i];
|
||||
d_map_base[INITIAL_INDEX_REG_BASE_ADDR + i] = d_initial_index[i];
|
||||
d_map_base[INITIAL_INTERP_COUNTER_REG_BASE_ADDR + i] = d_initial_interp_counter[i];
|
||||
}
|
||||
if (d_track_pilot)
|
||||
{
|
||||
//printf("www writing d map base %d = d_initial_index %d = %d\n", d_INITIAL_INDEX_REG_BASE_ADDR + d_n_correlators, d_n_correlators, d_initial_index[d_n_correlators]);
|
||||
d_map_base[d_INITIAL_INDEX_REG_BASE_ADDR + d_n_correlators] = d_initial_index[d_n_correlators];
|
||||
//d_map_base[1 + d_n_correlators + i] = d_initial_interp_counter[i];
|
||||
//printf("www writing d map base %d = d_initial_interp_counter %d = %d\n", d_INITIAL_INTERP_COUNTER_REG_BASE_ADDR + d_n_correlators, d_n_correlators, d_initial_interp_counter[d_n_correlators]);
|
||||
d_map_base[d_INITIAL_INTERP_COUNTER_REG_BASE_ADDR + d_n_correlators] = d_initial_interp_counter[d_n_correlators];
|
||||
d_map_base[INITIAL_INDEX_REG_BASE_ADDR + d_n_correlators] = d_initial_index[d_n_correlators];
|
||||
d_map_base[INITIAL_INTERP_COUNTER_REG_BASE_ADDR + d_n_correlators] = d_initial_interp_counter[d_n_correlators];
|
||||
}
|
||||
|
||||
//printf("www writing d map base %d = d_code_length_chips*d_code_samples_per_chip - 1 = %d\n", d_CODE_LENGTH_MINUS_1_REG_ADDR, (d_code_length_chips*d_code_samples_per_chip) - 1);
|
||||
d_map_base[d_CODE_LENGTH_MINUS_1_REG_ADDR] = (d_code_length_chips * d_code_samples_per_chip) - 1; // number of samples - 1
|
||||
d_map_base[CODE_LENGTH_MINUS_1_REG_ADDR] = (d_code_length_chips * d_code_samples_per_chip) - 1; // number of samples - 1
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
|
||||
d_code_phase_step_chips_num = static_cast<uint32_t>(roundf(MAX_CODE_RESAMPLER_COUNTER * d_code_phase_step_chips));
|
||||
if (d_code_phase_step_chips > 1.0)
|
||||
{
|
||||
printf("Warning : d_code_phase_step_chips = %f cannot be bigger than one\n", d_code_phase_step_chips);
|
||||
std::cout << "Warning : d_code_phase_step_chips = " << d_code_phase_step_chips << " cannot be bigger than one" << std::endl;
|
||||
}
|
||||
|
||||
//printf("d_rem_carrier_phase_in_rad = %f\n", d_rem_carrier_phase_in_rad);
|
||||
|
||||
if (d_rem_carrier_phase_in_rad > M_PI)
|
||||
{
|
||||
d_rem_carrier_phase_in_rad_temp = -2 * M_PI + d_rem_carrier_phase_in_rad;
|
||||
@@ -584,158 +401,77 @@ void fpga_multicorrelator_8sc::fpga_compute_signal_parameters_in_fpga(void)
|
||||
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
|
||||
|
||||
//printf("d_phase_step_rad_int = %d\n", d_phase_step_rad_int);
|
||||
if (d_phase_step_rad < 0)
|
||||
{
|
||||
d_phase_step_rad_int = -d_phase_step_rad_int;
|
||||
}
|
||||
|
||||
//printf("d_phase_step_rad_int = %d\n", d_phase_step_rad_int);
|
||||
}
|
||||
|
||||
|
||||
void fpga_multicorrelator_8sc::fpga_configure_signal_parameters_in_fpga(void)
|
||||
void Fpga_Multicorrelator_8sc::fpga_configure_signal_parameters_in_fpga(void)
|
||||
{
|
||||
//printf("www d map base %d = d_code_phase_step_chips_num = %d\n", d_CODE_PHASE_STEP_CHIPS_NUM_REG_ADDR, d_code_phase_step_chips_num);
|
||||
d_map_base[d_CODE_PHASE_STEP_CHIPS_NUM_REG_ADDR] = d_code_phase_step_chips_num;
|
||||
d_map_base[CODE_PHASE_STEP_CHIPS_NUM_REG_ADDR] = d_code_phase_step_chips_num;
|
||||
|
||||
//printf("www d map base %d = d_correlator_length_samples - 1 = %d\n", d_NSAMPLES_MINUS_1_REG_ADDR, d_correlator_length_samples - 1);
|
||||
d_map_base[d_NSAMPLES_MINUS_1_REG_ADDR] = d_correlator_length_samples - 1;
|
||||
d_map_base[NSAMPLES_MINUS_1_REG_ADDR] = d_correlator_length_samples - 1;
|
||||
|
||||
//printf("www d map base %d = d_rem_carr_phase_rad_int = %d\n", d_REM_CARR_PHASE_RAD_REG_ADDR, d_rem_carr_phase_rad_int);
|
||||
d_map_base[d_REM_CARR_PHASE_RAD_REG_ADDR] = d_rem_carr_phase_rad_int;
|
||||
d_map_base[REM_CARR_PHASE_RAD_REG_ADDR] = d_rem_carr_phase_rad_int;
|
||||
|
||||
//printf("www d map base %d = d_phase_step_rad_int = %d\n", d_PHASE_STEP_RAD_REG_ADDR, d_phase_step_rad_int);
|
||||
d_map_base[d_PHASE_STEP_RAD_REG_ADDR] = d_phase_step_rad_int;
|
||||
d_map_base[PHASE_STEP_RAD_REG_ADDR] = d_phase_step_rad_int;
|
||||
}
|
||||
|
||||
|
||||
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));
|
||||
|
||||
// writing 1 to reg 14 launches the tracking
|
||||
//printf("www writing 1 to d map base %d = start flag\n", d_START_FLAG_ADDR);
|
||||
d_map_base[d_START_FLAG_ADDR] = 1;
|
||||
//while(1);
|
||||
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;
|
||||
int32_t k;
|
||||
|
||||
//printf("www reading trk results\n");
|
||||
for (k = 0; k < d_n_correlators; k++)
|
||||
{
|
||||
readval_real = d_map_base[d_RESULT_REG_REAL_BASE_ADDR + k];
|
||||
//printf("read real before checking d map base %d = %d\n", d_RESULT_REG_BASE_ADDR + k, readval_real);
|
||||
//// if (readval_real > debug_max_readval_real[k])
|
||||
//// {
|
||||
//// debug_max_readval_real[k] = readval_real;
|
||||
//// }
|
||||
// if (readval_real >= d_result_SAT_value) // 0x100000 (21 bits two's complement)
|
||||
// {
|
||||
// readval_real = -2*d_result_SAT_value + readval_real;
|
||||
// }
|
||||
//// if (readval_real > debug_max_readval_real_after_check[k])
|
||||
//// {
|
||||
//// debug_max_readval_real_after_check[k] = readval_real;
|
||||
//// }
|
||||
//printf("read real d map base %d = %d\n", d_RESULT_REG_BASE_ADDR + k, readval_real);
|
||||
readval_imag = d_map_base[d_RESULT_REG_IMAG_BASE_ADDR + k];
|
||||
//printf("read imag before checking d map base %d = %d\n", d_RESULT_REG_BASE_ADDR + k, readval_imag);
|
||||
//// if (readval_imag > debug_max_readval_imag[k])
|
||||
//// {
|
||||
//// debug_max_readval_imag[k] = readval_imag;
|
||||
//// }
|
||||
//
|
||||
// if (readval_imag >= d_result_SAT_value) // 0x100000 (21 bits two's complement)
|
||||
// {
|
||||
// readval_imag = -2*d_result_SAT_value + readval_imag;
|
||||
// }
|
||||
//// if (readval_imag > debug_max_readval_imag_after_check[k])
|
||||
//// {
|
||||
//// debug_max_readval_imag_after_check[k] = readval_real;
|
||||
//// }
|
||||
//printf("read imag d map base %d = %d\n", d_RESULT_REG_BASE_ADDR + k, readval_imag);
|
||||
readval_real = d_map_base[RESULT_REG_REAL_BASE_ADDR + k];
|
||||
readval_imag = d_map_base[RESULT_REG_IMAG_BASE_ADDR + k];
|
||||
d_corr_out[k] = gr_complex(readval_real, readval_imag);
|
||||
|
||||
// if (printcounter > 100)
|
||||
// {
|
||||
// printcounter = 0;
|
||||
// for (int32_t ll=0;ll<d_n_correlators;ll++)
|
||||
// {
|
||||
// printf("debug_max_readval_real %d = %d\n", ll, debug_max_readval_real[ll]);
|
||||
// printf("debug_max_readval_imag %d = %d\n", ll, debug_max_readval_imag[ll]);
|
||||
// printf("debug_max_readval_real_%d after_check = %d\n", ll, debug_max_readval_real_after_check[ll]);
|
||||
// printf("debug_max_readval_imag_%d after_check = %d\n", ll, debug_max_readval_imag_after_check[ll]);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// printcounter = printcounter + 1;
|
||||
// }
|
||||
}
|
||||
if (d_track_pilot)
|
||||
{
|
||||
//printf("reading pilot !!!\n");
|
||||
readval_real = d_map_base[d_RESULT_REG_DATA_REAL_BASE_ADDR];
|
||||
// if (readval_real >= d_result_SAT_value) // 0x100000 (21 bits two's complement)
|
||||
// {
|
||||
// readval_real = -2*d_result_SAT_value + readval_real;
|
||||
// }
|
||||
|
||||
readval_imag = d_map_base[d_RESULT_REG_DATA_IMAG_BASE_ADDR];
|
||||
// if (readval_imag >= d_result_SAT_value) // 0x100000 (21 bits two's complement)
|
||||
// {
|
||||
// readval_imag = -2*d_result_SAT_value + readval_imag;
|
||||
// }
|
||||
readval_real = d_map_base[RESULT_REG_REAL_BASE_ADDR + d_n_correlators];
|
||||
readval_imag = d_map_base[RESULT_REG_IMAG_BASE_ADDR + d_n_correlators];
|
||||
d_Prompt_Data[0] = gr_complex(readval_real, readval_imag);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void fpga_multicorrelator_8sc::unlock_channel(void)
|
||||
void Fpga_Multicorrelator_8sc::unlock_channel(void)
|
||||
{
|
||||
// unlock the channel to let the next samples go through
|
||||
//printf("www writing 1 to d map base %d = drop samples\n", d_DROP_SAMPLES_REG_ADDR);
|
||||
d_map_base[d_DROP_SAMPLES_REG_ADDR] = 1; // unlock the channel
|
||||
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)
|
||||
{
|
||||
printf("Failed to unmap memory uio\n");
|
||||
std::cout << "Failed to unmap memory uio" << std::endl;
|
||||
}
|
||||
close(d_device_descriptor);
|
||||
}
|
||||
|
||||
|
||||
void fpga_multicorrelator_8sc::lock_channel(void)
|
||||
void Fpga_Multicorrelator_8sc::lock_channel(void)
|
||||
{
|
||||
// lock the channel for processing
|
||||
//printf("www writing 0 to d map base %d = drop samples\n", d_DROP_SAMPLES_REG_ADDR);
|
||||
d_map_base[d_DROP_SAMPLES_REG_ADDR] = 0; // lock the channel
|
||||
d_map_base[DROP_SAMPLES_REG_ADDR] = 0; // lock the channel
|
||||
}
|
||||
|
||||
//void fpga_multicorrelator_8sc::read_sample_counters(int32_t *sample_counter, int32_t *secondary_sample_counter, int32_t *counter_corr_0_in, int32_t *counter_corr_0_out)
|
||||
//{
|
||||
// *sample_counter = d_map_base[11];
|
||||
// *secondary_sample_counter = d_map_base[8];
|
||||
// *counter_corr_0_in = d_map_base[10];
|
||||
// *counter_corr_0_out = d_map_base[9];
|
||||
//
|
||||
//}
|
||||
|
||||
//void fpga_multicorrelator_8sc::reset_multicorrelator(void)
|
||||
//{
|
||||
// d_map_base[14] = 2; // writing a 2 to d_map_base[14] resets the multicorrelator
|
||||
//}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*!
|
||||
* \file fpga_multicorrelator_8sc.h
|
||||
* \brief High optimized FPGA vector correlator class for lv_16sc_t (short int32_t complex)
|
||||
* \brief High optimized FPGA vector correlator class
|
||||
* \authors <ul>
|
||||
* <li> Marc Majoral, 2017. mmajoral(at)cttc.cat
|
||||
* <li> Marc Majoral, 2019. mmajoral(at)cttc.cat
|
||||
* <li> Javier Arribas, 2016. jarribas(at)cttc.es
|
||||
* </ul>
|
||||
*
|
||||
@@ -11,7 +11,7 @@
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2017 (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
|
||||
@@ -41,32 +41,49 @@
|
||||
#include <volk_gnsssdr/volk_gnsssdr.h>
|
||||
#include <cstdint>
|
||||
|
||||
#define MAX_LENGTH_DEVICEIO_NAME 50
|
||||
// FPGA register addresses
|
||||
|
||||
// write addresses
|
||||
#define CODE_PHASE_STEP_CHIPS_NUM_REG_ADDR 0
|
||||
#define INITIAL_INDEX_REG_BASE_ADDR 1
|
||||
#define INITIAL_INTERP_COUNTER_REG_BASE_ADDR 7
|
||||
#define NSAMPLES_MINUS_1_REG_ADDR 13
|
||||
#define CODE_LENGTH_MINUS_1_REG_ADDR 14
|
||||
#define REM_CARR_PHASE_RAD_REG_ADDR 15
|
||||
#define PHASE_STEP_RAD_REG_ADDR 16
|
||||
#define PROG_MEMS_ADDR 17
|
||||
#define DROP_SAMPLES_REG_ADDR 18
|
||||
#define INITIAL_COUNTER_VALUE_REG_ADDR_LSW 19
|
||||
#define INITIAL_COUNTER_VALUE_REG_ADDR_MSW 20
|
||||
#define STOP_TRACKING_REG_ADDR 23
|
||||
#define START_FLAG_ADDR 30
|
||||
// read-write addresses
|
||||
#define TEST_REG_ADDR 31
|
||||
// read addresses
|
||||
#define RESULT_REG_REAL_BASE_ADDR 1
|
||||
#define RESULT_REG_IMAG_BASE_ADDR 7
|
||||
#define SAMPLE_COUNTER_REG_ADDR_LSW 13
|
||||
#define SAMPLE_COUNTER_REG_ADDR_MSW 14
|
||||
|
||||
|
||||
/*!
|
||||
* \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();
|
||||
//bool set_output_vectors(gr_complex* corr_out);
|
||||
~Fpga_Multicorrelator_8sc();
|
||||
void set_output_vectors(gr_complex *corr_out, gr_complex *Prompt_Data);
|
||||
// bool set_local_code_and_taps(
|
||||
// int32_t code_length_chips, const int* local_code_in,
|
||||
// float *shifts_chips, int32_t PRN);
|
||||
//bool set_local_code_and_taps(
|
||||
void set_local_code_and_taps(
|
||||
// int32_t code_length_chips,
|
||||
float *shifts_chips, float *prompt_data_shift, int32_t PRN);
|
||||
//bool set_output_vectors(lv_16sc_t* corr_out);
|
||||
void update_local_code(float rem_code_phase_chips);
|
||||
//bool Carrier_wipeoff_multicorrelator_resampler(
|
||||
void 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);
|
||||
bool free();
|
||||
void set_channel(uint32_t channel);
|
||||
@@ -74,10 +91,8 @@ public:
|
||||
uint64_t read_sample_counter();
|
||||
void lock_channel(void);
|
||||
void unlock_channel(void);
|
||||
//void read_sample_counters(int32_t *sample_counter, int32_t *secondary_sample_counter, int32_t *counter_corr_0_in, int32_t *counter_corr_0_out); // debug
|
||||
|
||||
private:
|
||||
//const int32_t *d_local_code_in;
|
||||
gr_complex *d_corr_out;
|
||||
gr_complex *d_Prompt_Data;
|
||||
float *d_shifts_chips;
|
||||
@@ -113,37 +128,11 @@ private:
|
||||
int32_t *d_ca_codes;
|
||||
int32_t *d_data_codes;
|
||||
|
||||
//uint32_t d_code_length; // nominal number of chips
|
||||
|
||||
uint32_t d_code_samples_per_chip;
|
||||
bool d_track_pilot;
|
||||
|
||||
uint32_t d_multicorr_type;
|
||||
|
||||
// register addresses
|
||||
// write-only regs
|
||||
uint32_t d_CODE_PHASE_STEP_CHIPS_NUM_REG_ADDR;
|
||||
uint32_t d_INITIAL_INDEX_REG_BASE_ADDR;
|
||||
uint32_t d_INITIAL_INTERP_COUNTER_REG_BASE_ADDR;
|
||||
uint32_t d_NSAMPLES_MINUS_1_REG_ADDR;
|
||||
uint32_t d_CODE_LENGTH_MINUS_1_REG_ADDR;
|
||||
uint32_t d_REM_CARR_PHASE_RAD_REG_ADDR;
|
||||
uint32_t d_PHASE_STEP_RAD_REG_ADDR;
|
||||
uint32_t d_PROG_MEMS_ADDR;
|
||||
uint32_t d_DROP_SAMPLES_REG_ADDR;
|
||||
uint32_t d_INITIAL_COUNTER_VALUE_REG_ADDR_LSW;
|
||||
uint32_t d_INITIAL_COUNTER_VALUE_REG_ADDR_MSW;
|
||||
uint32_t d_START_FLAG_ADDR;
|
||||
// read-write regs
|
||||
uint32_t d_TEST_REG_ADDR;
|
||||
// read-only regs
|
||||
uint32_t d_RESULT_REG_REAL_BASE_ADDR;
|
||||
uint32_t d_RESULT_REG_IMAG_BASE_ADDR;
|
||||
uint32_t d_RESULT_REG_DATA_REAL_BASE_ADDR;
|
||||
uint32_t d_RESULT_REG_DATA_IMAG_BASE_ADDR;
|
||||
uint32_t d_SAMPLE_COUNTER_REG_ADDR_LSW;
|
||||
uint32_t d_SAMPLE_COUNTER_REG_ADDR_MSW;
|
||||
|
||||
// private functions
|
||||
uint32_t fpga_acquisition_test_register(uint32_t writeval);
|
||||
void fpga_configure_tracking_gps_local_code(int32_t PRN);
|
||||
@@ -153,17 +142,7 @@ private:
|
||||
void fpga_configure_signal_parameters_in_fpga(void);
|
||||
void fpga_launch_multicorrelator_fpga(void);
|
||||
void read_tracking_gps_results(void);
|
||||
//void reset_multicorrelator(void);
|
||||
void close_device(void);
|
||||
|
||||
uint32_t d_result_SAT_value;
|
||||
|
||||
int32_t debug_max_readval_real[5] = {0, 0, 0, 0, 0};
|
||||
int32_t debug_max_readval_imag[5] = {0, 0, 0, 0, 0};
|
||||
|
||||
int32_t debug_max_readval_real_after_check[5] = {0, 0, 0, 0, 0};
|
||||
int32_t debug_max_readval_imag_after_check[5] = {0, 0, 0, 0, 0};
|
||||
int32_t printcounter = 0;
|
||||
};
|
||||
|
||||
#endif /* GNSS_SDR_FPGA_MULTICORRELATOR_H_ */
|
||||
|
||||
Reference in New Issue
Block a user