2017-05-05 14:14:27 +00:00
|
|
|
/*!
|
2018-04-27 18:00:50 +00:00
|
|
|
* \file fpga_acquisition.h
|
|
|
|
* \brief High optimized FPGA vector correlator class
|
2017-05-05 14:14:27 +00:00
|
|
|
* \authors <ul>
|
2018-04-27 18:00:50 +00:00
|
|
|
* <li> Marc Majoral, 2018. mmajoral(at)cttc.cat
|
2017-05-05 14:14:27 +00:00
|
|
|
* </ul>
|
|
|
|
*
|
2018-04-27 18:00:50 +00:00
|
|
|
* Class that controls and executes a high optimized acquisition HW
|
|
|
|
* accelerator in the FPGA
|
2017-05-05 14:14:27 +00:00
|
|
|
*
|
|
|
|
* -------------------------------------------------------------------------
|
|
|
|
*
|
2018-05-13 20:49:11 +00:00
|
|
|
* Copyright (C) 2010-2018 (see AUTHORS file for a list of contributors)
|
2017-05-05 14:14:27 +00:00
|
|
|
*
|
|
|
|
* GNSS-SDR is a software defined Global Navigation
|
|
|
|
* Satellite Systems receiver
|
|
|
|
*
|
|
|
|
* This file is part of GNSS-SDR.
|
|
|
|
*
|
|
|
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2018-05-13 20:49:11 +00:00
|
|
|
* along with GNSS-SDR. If not, see <https://www.gnu.org/licenses/>.
|
2017-05-05 14:14:27 +00:00
|
|
|
*
|
|
|
|
* -------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
2018-04-27 18:00:50 +00:00
|
|
|
#ifndef GNSS_SDR_FPGA_ACQUISITION_H_
|
|
|
|
#define GNSS_SDR_FPGA_ACQUISITION_H_
|
2017-05-05 14:14:27 +00:00
|
|
|
|
2017-05-18 15:10:28 +00:00
|
|
|
#include <gnuradio/fft/fft.h>
|
2018-04-30 18:58:53 +00:00
|
|
|
#include <volk/volk.h>
|
2017-05-05 14:14:27 +00:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Class that implements carrier wipe-off and correlators.
|
|
|
|
*/
|
2018-04-27 18:00:50 +00:00
|
|
|
class fpga_acquisition
|
2017-05-05 14:14:27 +00:00
|
|
|
{
|
|
|
|
public:
|
2018-04-27 18:00:50 +00:00
|
|
|
fpga_acquisition(std::string device_name,
|
2018-04-30 18:58:53 +00:00
|
|
|
unsigned int nsamples,
|
|
|
|
unsigned int doppler_max,
|
2018-06-06 15:25:03 +00:00
|
|
|
unsigned int nsamples_total, long fs_in,
|
2018-04-30 18:58:53 +00:00
|
|
|
unsigned int sampled_ms, unsigned select_queue,
|
|
|
|
lv_16sc_t *all_fft_codes);
|
|
|
|
~fpga_acquisition();
|
|
|
|
bool init();
|
|
|
|
bool set_local_code(
|
|
|
|
unsigned int PRN);
|
2017-05-05 14:14:27 +00:00
|
|
|
bool free();
|
|
|
|
void run_acquisition(void);
|
|
|
|
void set_phase_step(unsigned int doppler_index);
|
2018-04-30 18:58:53 +00:00
|
|
|
void read_acquisition_results(uint32_t *max_index, float *max_magnitude,
|
|
|
|
unsigned *initial_sample, float *power_sum);
|
2017-05-05 14:14:27 +00:00
|
|
|
void block_samples();
|
|
|
|
void unblock_samples();
|
2018-04-27 18:00:50 +00:00
|
|
|
|
2017-05-18 15:10:28 +00:00
|
|
|
/*!
|
|
|
|
* \brief Set maximum Doppler grid search
|
|
|
|
* \param doppler_max - Maximum Doppler shift considered in the grid search [Hz].
|
|
|
|
*/
|
|
|
|
void set_doppler_max(unsigned int doppler_max)
|
|
|
|
{
|
|
|
|
d_doppler_max = doppler_max;
|
|
|
|
}
|
2018-04-27 18:00:50 +00:00
|
|
|
|
2017-05-18 15:10:28 +00:00
|
|
|
/*!
|
|
|
|
* \brief Set Doppler steps for the grid search
|
|
|
|
* \param doppler_step - Frequency bin of the search grid [Hz].
|
|
|
|
*/
|
|
|
|
void set_doppler_step(unsigned int doppler_step)
|
|
|
|
{
|
|
|
|
d_doppler_step = doppler_step;
|
|
|
|
}
|
|
|
|
|
2017-05-05 14:14:27 +00:00
|
|
|
private:
|
2017-05-18 15:10:28 +00:00
|
|
|
long d_fs_in;
|
|
|
|
// data related to the hardware module and the driver
|
2018-04-30 18:58:53 +00:00
|
|
|
int d_fd; // driver descriptor
|
|
|
|
volatile unsigned *d_map_base; // driver memory map
|
|
|
|
lv_16sc_t *d_all_fft_codes; // memory that contains all the code ffts
|
|
|
|
unsigned int d_vector_length; // number of samples incluing padding and number of ms
|
|
|
|
unsigned int d_nsamples_total; // number of samples including padding
|
|
|
|
unsigned int d_nsamples; // number of samples not including padding
|
|
|
|
unsigned int d_select_queue; // queue selection
|
|
|
|
std::string d_device_name; // HW device name
|
|
|
|
unsigned int d_doppler_max; // max doppler
|
|
|
|
unsigned int d_doppler_step; // doppler step
|
2017-05-05 14:14:27 +00:00
|
|
|
// FPGA private functions
|
|
|
|
unsigned fpga_acquisition_test_register(unsigned writeval);
|
|
|
|
void fpga_configure_acquisition_local_code(lv_16sc_t fft_local_code[]);
|
|
|
|
void configure_acquisition();
|
2018-03-02 11:23:10 +00:00
|
|
|
void reset_acquisition(void);
|
|
|
|
void close_device();
|
2017-05-05 14:14:27 +00:00
|
|
|
};
|
|
|
|
|
2018-04-27 18:00:50 +00:00
|
|
|
#endif /* GNSS_SDR_FPGA_ACQUISITION_H_ */
|