The tracking modules determine the uio device file that is assigned to them using the hardware accelerator device name in the FPGA

This commit is contained in:
Marc Majoral 2020-11-27 10:51:06 +01:00
parent a53109c718
commit 630f1932f2
16 changed files with 115 additions and 85 deletions

View File

@ -30,6 +30,7 @@
#include "dll_pll_conf_fpga.h"
#include "galileo_e1_signal_replica.h"
#include "gnss_sdr_flags.h"
#include "uio_fpga.h"
#include <glog/logging.h>
#include <volk_gnsssdr/volk_gnsssdr_alloc.h>
#include <array>
@ -63,15 +64,14 @@ GalileoE1DllPllVemlTrackingFpga::GalileoE1DllPllVemlTrackingFpga(
const std::array<char, 3> sig_{'1', 'B', '\0'};
std::memcpy(trk_params_fpga.signal, sig_.data(), 3);
// FPGA configuration parameters
// obtain the number of the first uio device corresponding to a HW accelerator in the FPGA
// that can be assigned to the tracking of the E1 signal
trk_params_fpga.dev_file_num = configuration->property(role + ".dev_file_num", 15);
// UIO device file
device_name = configuration->property(role + ".devicename", default_device_name);
// compute the number of tracking channels that have already been instantiated. The order in which
// GNSS-SDR instantiates the tracking channels i L1, L2, L5, E1, E5a
trk_params_fpga.num_prev_assigned_ch = configuration->property("Channels_1C.count", 0) +
configuration->property("Channels_2S.count", 0) +
configuration->property("Channels_L5.count", 0);
num_prev_assigned_ch = configuration->property("Channels_1C.count", 0) +
configuration->property("Channels_2S.count", 0) +
configuration->property("Channels_L5.count", 0);
// ################# PRE-COMPUTE ALL THE CODES #################
uint32_t code_samples_per_chip = 2;
@ -184,7 +184,16 @@ void GalileoE1DllPllVemlTrackingFpga::start_tracking()
void GalileoE1DllPllVemlTrackingFpga::set_channel(unsigned int channel)
{
channel_ = channel;
tracking_fpga_sc->set_channel(channel);
// UIO device file
std::string device_io_name;
// find the uio device file corresponding to the GNSS reset module
if (find_uio_dev_file_name(device_io_name, device_name, channel - num_prev_assigned_ch) < 0)
{
std::cout << "Cannot find the FPGA uio device file corresponding to device name " << device_name << std::endl;
throw std::exception();
}
tracking_fpga_sc->set_channel(channel, device_io_name);
}

View File

@ -126,11 +126,16 @@ public:
void stop_tracking() override;
private:
const std::string default_device_name = "multicorrelator_resampler_5_1_AXI"; // UIO device name
// the following flags are FPGA-specific and they are using arrange the values of the local code in the way the FPGA
// expects. This arrangement is done in the initialisation to avoid consuming unnecessary clock cycles during tracking.
static const int32_t LOCAL_CODE_FPGA_ENABLE_WRITE_MEMORY = 0x0C000000; // flag that enables WE (Write Enable) of the local code FPGA
static const int32_t LOCAL_CODE_FPGA_CORRELATOR_SELECT_COUNT = 0x20000000; // flag that selects the writing of the pilot code in the FPGA (as opposed to the data code)
std::string device_name;
uint32_t num_prev_assigned_ch;
dll_pll_veml_tracking_fpga_sptr tracking_fpga_sc;
uint32_t channel_;
std::string role_;

View File

@ -25,6 +25,7 @@
#include "dll_pll_conf_fpga.h"
#include "galileo_e5_signal_replica.h"
#include "gnss_sdr_flags.h"
#include "uio_fpga.h"
#include <glog/logging.h>
#include <volk_gnsssdr/volk_gnsssdr_alloc.h>
#include <array>
@ -60,19 +61,18 @@ GalileoE5aDllPllTrackingFpga::GalileoE5aDllPllTrackingFpga(
d_data_codes = nullptr;
// FPGA configuration parameters
// obtain the number of the first uio device corresponding to a HW accelerator in the FPGA
// that can be assigned to the tracking of the E5a signal
trk_params_fpga.dev_file_num = configuration->property(role + ".dev_file_num", 27);
// UIO device file
device_name = configuration->property(role + ".devicename", default_device_name);
// compute the number of tracking channels that have already been instantiated. The order in which
// GNSS-SDR instantiates the tracking channels i L1, L2, L5, E1, E5a
// However E5a can use the same tracking HW accelerators as L5 (but not simultaneously).
// Therefore for the proper assignment of the FPGA tracking device file numbers to the E5a tracking channels,
// the number of channels that have already been assigned to L5 must not be substracted to this channel number,
// so they are not counted here.
trk_params_fpga.num_prev_assigned_ch = configuration->property("Channels_1C.count", 0) +
configuration->property("Channels_2S.count", 0) +
configuration->property("Channels_1B.count", 0);
num_prev_assigned_ch = configuration->property("Channels_1C.count", 0) +
configuration->property("Channels_2S.count", 0) +
configuration->property("Channels_1B.count", 0);
// ################# PRE-COMPUTE ALL THE CODES #################
uint32_t code_samples_per_chip = 1;
@ -207,7 +207,16 @@ void GalileoE5aDllPllTrackingFpga::stop_tracking()
void GalileoE5aDllPllTrackingFpga::set_channel(unsigned int channel)
{
channel_ = channel;
tracking_fpga_sc->set_channel(channel);
// UIO device file
std::string device_io_name;
// find the uio device file corresponding to the GNSS reset module
if (find_uio_dev_file_name(device_io_name, device_name, channel - num_prev_assigned_ch) < 0)
{
std::cout << "Cannot find the FPGA uio device file corresponding to device name " << device_name << std::endl;
throw std::exception();
}
tracking_fpga_sc->set_channel(channel, device_io_name);
}

View File

@ -119,11 +119,15 @@ public:
void stop_tracking() override;
private:
const std::string default_device_name = "multicorrelator_resampler_3_1_AXI"; // UIO device name
// the following flags are FPGA-specific and they are using arrange the values of the local code in the way the FPGA
// expects. This arrangement is done in the initialisation to avoid consuming unnecessary clock cycles during tracking.
static const int32_t LOCAL_CODE_FPGA_ENABLE_WRITE_MEMORY = 0x0C000000; // flag that enables WE (Write Enable) of the local code FPGA
static const int32_t LOCAL_CODE_FPGA_CORRELATOR_SELECT_COUNT = 0x20000000; // flag that selects the writing of the pilot code in the FPGA (as opposed to the data code)
std::string device_name;
uint32_t num_prev_assigned_ch;
dll_pll_veml_tracking_fpga_sptr tracking_fpga_sc;
uint32_t channel_;

View File

@ -30,6 +30,7 @@
#include "dll_pll_conf_fpga.h"
#include "gnss_sdr_flags.h"
#include "gps_sdr_signal_replica.h"
#include "uio_fpga.h"
#include <glog/logging.h>
#include <volk_gnsssdr/volk_gnsssdr.h>
#include <array>
@ -68,13 +69,12 @@ GpsL1CaDllPllTrackingFpga::GpsL1CaDllPllTrackingFpga(
const std::array<char, 3> sig_{'1', 'C', '\0'};
std::memcpy(trk_params_fpga.signal, sig_.data(), 3);
// FPGA configuration parameters
// obtain the number of the first uio device corresponding to a HW accelerator in the FPGA
// that can be assigned to the tracking of the L1 signal
trk_params_fpga.dev_file_num = configuration->property(role + ".dev_file_num", 3);
// UIO device file
device_name = configuration->property(role + ".devicename", default_device_name);
// compute the number of tracking channels that have already been instantiated. The order in which
// GNSS-SDR instantiates the tracking channels i L1, l2, L5, E1, E5a
trk_params_fpga.num_prev_assigned_ch = 0;
num_prev_assigned_ch = 0;
// ################# PRE-COMPUTE ALL THE CODES #################
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()));
@ -153,7 +153,17 @@ void GpsL1CaDllPllTrackingFpga::stop_tracking()
void GpsL1CaDllPllTrackingFpga::set_channel(unsigned int channel)
{
channel_ = channel;
tracking_fpga_sc->set_channel(channel);
// UIO device file
std::string device_io_name;
// find the uio device file corresponding to the GNSS reset module
if (find_uio_dev_file_name(device_io_name, device_name, channel - num_prev_assigned_ch) < 0)
{
std::cout << "Cannot find the FPGA uio device file corresponding to device name " << device_name << std::endl;
throw std::exception();
}
tracking_fpga_sc->set_channel(channel, device_io_name);
}

View File

@ -124,12 +124,16 @@ public:
void stop_tracking() override;
private:
const std::string default_device_name = "multicorrelator_resampler_S00_AXI"; // UIO device name
static const uint32_t NUM_PRNs = 32; // total number of PRNs
static const int32_t GPS_CA_BIT_DURATION_MS = 20;
// the following flag is FPGA-specific and they are using arrange the values of the local code in the way the FPGA
// expects. This arrangement is done in the initialisation to avoid consuming unnecessary clock cycles during tracking.
static const int32_t LOCAL_CODE_FPGA_ENABLE_WRITE_MEMORY = 0x0C000000; // flag that enables WE (Write Enable) of the local code FPGA
std::string device_name;
uint32_t num_prev_assigned_ch;
dll_pll_veml_tracking_fpga_sptr tracking_fpga_sc;
uint32_t channel_;

View File

@ -32,6 +32,7 @@
#include "gnss_sdr_flags.h"
#include "gnss_synchro.h"
#include "gps_l2c_signal_replica.h"
#include "uio_fpga.h"
#include <glog/logging.h>
#include <volk_gnsssdr/volk_gnsssdr_alloc.h>
#include <array>
@ -66,12 +67,12 @@ GpsL2MDllPllTrackingFpga::GpsL2MDllPllTrackingFpga(
const std::array<char, 3> sig_{'2', 'S', '\0'};
std::memcpy(trk_params_fpga.signal, sig_.data(), 3);
// FPGA configuration parameters
// obtain the number of the first uio device file that is assigned to the FPGA L2 tracking multicorrelator HW accelerators
trk_params_fpga.dev_file_num = configuration->property(role + ".dev_file_num", 27);
// UIO device file
device_name = configuration->property(role + ".devicename", default_device_name);
// compute the number of tracking channels that have already been instantiated. The order in which
// GNSS-SDR instantiates the tracking channels i L1, L2, L5, E1, E5a
trk_params_fpga.num_prev_assigned_ch = configuration->property("Channels_1C.count", 0);
num_prev_assigned_ch = configuration->property("Channels_1C.count", 0);
volk_gnsssdr::vector<float> ca_codes_f(static_cast<unsigned int>(GPS_L2_M_CODE_LENGTH_CHIPS), 0.0);
// ################# PRE-COMPUTE ALL THE CODES #################
@ -130,7 +131,17 @@ void GpsL2MDllPllTrackingFpga::stop_tracking()
void GpsL2MDllPllTrackingFpga::set_channel(unsigned int channel)
{
channel_ = channel;
tracking_fpga_sc->set_channel(channel);
// UIO device file
std::string device_io_name;
// find the uio device file corresponding to the GNSS reset module
if (find_uio_dev_file_name(device_io_name, device_name, channel - num_prev_assigned_ch) < 0)
{
std::cout << "Cannot find the FPGA uio device file corresponding to device name " << device_name << std::endl;
throw std::exception();
}
tracking_fpga_sc->set_channel(channel, device_io_name);
}

View File

@ -95,6 +95,11 @@ public:
void stop_tracking() override;
private:
const std::string default_device_name = "multicorrelator_resampler_S00_AXI"; // UIO device name
std::string device_name;
uint32_t num_prev_assigned_ch;
static const uint32_t NUM_PRNs = 32;
dll_pll_veml_tracking_fpga_sptr tracking_fpga_sc;
unsigned int channel_;

View File

@ -32,6 +32,7 @@
#include "dll_pll_conf_fpga.h"
#include "gnss_sdr_flags.h"
#include "gps_l5_signal_replica.h"
#include "uio_fpga.h"
#include <glog/logging.h>
#include <volk_gnsssdr/volk_gnsssdr_alloc.h>
#include <array>
@ -65,14 +66,13 @@ GpsL5DllPllTrackingFpga::GpsL5DllPllTrackingFpga(
const std::array<char, 3> sig_{'L', '5', '\0'};
std::memcpy(trk_params_fpga.signal, sig_.data(), 3);
// FPGA configuration parameters
// obtain the number of the first uio device corresponding to a HW accelerator in the FPGA
// that can be assigned to the tracking of the L5 signal
trk_params_fpga.dev_file_num = configuration->property(role + ".dev_file_num", 27);
// UIO device file
device_name = configuration->property(role + ".devicename", default_device_name);
// compute the number of tracking channels that have already been instantiated. The order in which
// GNSS-SDR instantiates the tracking channels i L1, L2, L5, E1, E5a
trk_params_fpga.num_prev_assigned_ch = configuration->property("Channels_1C.count", 0) +
configuration->property("Channels_2S.count", 0);
num_prev_assigned_ch = configuration->property("Channels_1C.count", 0) +
configuration->property("Channels_2S.count", 0);
// ################# PRE-COMPUTE ALL THE CODES #################
uint32_t code_samples_per_chip = 1;
@ -215,7 +215,17 @@ void GpsL5DllPllTrackingFpga::stop_tracking()
void GpsL5DllPllTrackingFpga::set_channel(unsigned int channel)
{
channel_ = channel;
tracking_fpga_sc->set_channel(channel);
// UIO device file
std::string device_io_name;
// find the uio device file corresponding to the GNSS reset module
if (find_uio_dev_file_name(device_io_name, device_name, channel - num_prev_assigned_ch) < 0)
{
std::cout << "Cannot find the FPGA uio device file corresponding to device name " << device_name << std::endl;
throw std::exception();
}
tracking_fpga_sc->set_channel(channel, device_io_name);
}

View File

@ -125,6 +125,8 @@ public:
void stop_tracking() override;
private:
const std::string default_device_name = "multicorrelator_resampler_3_1_AXI"; // UIO device name
static const uint32_t NUM_PRNs = 32; // total number of PRNs
// the following flags are FPGA-specific and they are using arrange the values of the local code in the way the FPGA
@ -132,6 +134,9 @@ private:
static const int32_t LOCAL_CODE_FPGA_ENABLE_WRITE_MEMORY = 0x0C000000; // flag that enables WE (Write Enable) of the local code FPGA
static const int32_t LOCAL_CODE_FPGA_CORRELATOR_SELECT_COUNT = 0x20000000; // flag that selects the writing of the pilot code in the FPGA (as opposed to the data code)
std::string device_name;
uint32_t num_prev_assigned_ch;
dll_pll_veml_tracking_fpga_sptr tracking_fpga_sc;
uint32_t channel_;
std::string role_;

View File

@ -466,12 +466,9 @@ dll_pll_veml_tracking_fpga::dll_pll_veml_tracking_fpga(const Dll_Pll_Conf_Fpga &
}
}
// create multicorrelator class
const std::string device_name = d_trk_parameters.device_name;
const uint32_t dev_file_num = d_trk_parameters.dev_file_num;
const uint32_t num_prev_assigned_ch = d_trk_parameters.num_prev_assigned_ch;
int32_t *ca_codes = d_trk_parameters.ca_codes;
int32_t *data_codes = d_trk_parameters.data_codes;
d_multicorrelator_fpga = std::make_shared<Fpga_Multicorrelator_8sc>(d_n_correlator_taps, device_name, dev_file_num, num_prev_assigned_ch, ca_codes, data_codes, d_code_length_chips, d_trk_parameters.track_pilot, d_code_samples_per_chip);
d_multicorrelator_fpga = std::make_shared<Fpga_Multicorrelator_8sc>(d_n_correlator_taps, ca_codes, data_codes, d_code_length_chips, d_trk_parameters.track_pilot, d_code_samples_per_chip);
d_multicorrelator_fpga->set_output_vectors(d_correlator_outs.data(), d_Prompt_Data.data());
d_sample_counter_next = 0ULL;
@ -1313,12 +1310,12 @@ int32_t dll_pll_veml_tracking_fpga::save_matfile() const
}
void dll_pll_veml_tracking_fpga::set_channel(uint32_t channel)
void dll_pll_veml_tracking_fpga::set_channel(uint32_t channel, std::string device_io_name)
{
gr::thread::scoped_lock l(d_setlock);
d_channel = channel;
d_multicorrelator_fpga->set_channel(d_channel);
d_multicorrelator_fpga->open_channel(device_io_name, channel);
LOG(INFO) << "Tracking Channel set to " << d_channel;
// ############# ENABLE DATA FILE LOG #################
if (d_dump)

View File

@ -69,7 +69,7 @@ public:
/*!
* \brief Set the channel number and configure some multicorrelator parameters
*/
void set_channel(uint32_t channel);
void set_channel(uint32_t channel, std::string device_io_name);
/*!
* \brief This function is used with two purposes:

View File

@ -75,8 +75,6 @@ Dll_Pll_Conf_Fpga::Dll_Pll_Conf_Fpga()
signal[1] = 'C';
signal[2] = '\0';
device_name = "/dev/uio";
dev_file_num = 3;
num_prev_assigned_ch = 0;
code_length_chips = 0U;
code_samples_per_chip = 0U;
ca_codes = nullptr;

View File

@ -68,8 +68,6 @@ public:
uint32_t bit_synchronization_time_limit_s;
uint32_t vector_length;
uint32_t smoother_length;
uint32_t dev_file_num;
uint32_t num_prev_assigned_ch;
uint32_t code_length_chips;
uint32_t code_samples_per_chip;
uint32_t extend_fpga_integration_periods;

View File

@ -50,9 +50,6 @@ const float PHASE_CARR_MAX_DIV_PI = 683565275.5764316; // 2^(31)/pi
const float TWO_PI = 6.283185307179586;
Fpga_Multicorrelator_8sc::Fpga_Multicorrelator_8sc(int32_t n_correlators,
const std::string &device_name,
uint32_t dev_file_num,
uint32_t num_prev_assigned_ch,
int32_t *ca_codes,
int32_t *data_codes,
uint32_t code_length_chips,
@ -60,10 +57,6 @@ Fpga_Multicorrelator_8sc::Fpga_Multicorrelator_8sc(int32_t n_correlators,
uint32_t code_samples_per_chip)
{
d_n_correlators = n_correlators;
d_device_name = device_name;
d_dev_file_num = dev_file_num;
d_num_prev_assigned_ch = num_prev_assigned_ch;
d_track_pilot = track_pilot;
d_device_descriptor = 0;
d_map_base = nullptr;
@ -91,7 +84,6 @@ Fpga_Multicorrelator_8sc::Fpga_Multicorrelator_8sc(int32_t n_correlators,
d_rem_carr_phase_rad_int = 0;
d_phase_step_rad_int = 0;
d_initial_sample_counter = 0;
d_channel = 0;
d_correlator_length_samples = 0;
d_code_phase_step_chips_num = 0;
d_code_length_chips = code_length_chips;
@ -203,28 +195,11 @@ bool Fpga_Multicorrelator_8sc::free()
}
void Fpga_Multicorrelator_8sc::set_channel(uint32_t channel)
void Fpga_Multicorrelator_8sc::open_channel(std::string device_io_name, uint32_t channel)
{
char device_io_name[max_length_deviceio_name] = ""; // driver io name
d_channel = channel;
// open the device corresponding to the assigned channel
std::string mergedname;
std::stringstream devicebasetemp;
uint32_t numdevice = d_dev_file_num + d_channel - d_num_prev_assigned_ch;
devicebasetemp << numdevice;
mergedname = d_device_name + devicebasetemp.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 << '\n';
if ((d_device_descriptor = open(device_io_name, O_RDWR | O_SYNC)) == -1)
if ((d_device_descriptor = open(device_io_name.c_str(), O_RDWR | O_SYNC)) == -1)
{
LOG(WARNING) << "Cannot open deviceio" << device_io_name;
std::cout << "Cannot open deviceio" << device_io_name << '\n';
@ -235,7 +210,7 @@ void Fpga_Multicorrelator_8sc::set_channel(uint32_t channel)
if (d_map_base == reinterpret_cast<void *>(-1))
{
LOG(WARNING) << "Cannot map the FPGA tracking module "
<< d_channel << "into user memory";
<< channel << "into user memory";
std::cout << "Cannot map deviceio" << device_io_name << '\n';
}

View File

@ -47,9 +47,6 @@ public:
* \brief Constructor
*/
Fpga_Multicorrelator_8sc(int32_t n_correlators,
const std::string &device_name,
uint32_t dev_file_num,
uint32_t num_prev_assigned_ch,
int32_t *ca_codes,
int32_t *data_codes,
uint32_t code_length_chips,
@ -95,9 +92,9 @@ public:
bool free();
/*!
* \brief Set channel number and open the FPGA device driver
* \brief Open the FPGA device driver
*/
void set_channel(uint32_t channel);
void open_channel(std::string device_io_name, uint32_t channel);
/*!
* \brief Set the initial sample number where the tracking process begins
@ -193,7 +190,6 @@ private:
static const uint32_t enable_secondary_code = 2; // bit 1 of drop_samples_reg_addr
static const uint32_t init_secondary_code_addresses = 4; // bit 2 of drop_samples_reg_addr
static const uint32_t page_size = 0x10000;
static const uint32_t max_length_deviceio_name = 50;
static const uint32_t max_code_resampler_counter = 1 << 31; // 2^(number of bits of precision of the code resampler)
static const uint32_t local_code_fpga_clear_address_counter = 0x10000000;
static const uint32_t test_register_track_writeval = 0x55AA;
@ -237,7 +233,6 @@ private:
volatile uint32_t *d_map_base; // driver memory map
// configuration data received from the interface
uint32_t d_channel; // channel number
uint32_t d_correlator_length_samples;
uint32_t d_code_samples_per_chip;
@ -247,11 +242,6 @@ private:
int32_t d_phase_step_rad_int;
int32_t d_carrier_phase_rate_step_rad_int;
// driver
std::string d_device_name;
uint32_t d_dev_file_num;
uint32_t d_num_prev_assigned_ch;
// PRN codes
int32_t *d_ca_codes;
int32_t *d_data_codes;