2020-07-16 13:42:55 +00:00
|
|
|
/*!
|
|
|
|
* \file fpga_dynamic_bit_selection.h
|
|
|
|
* \brief Dynamic bit selection in the received signal.
|
|
|
|
* \authors <ul>
|
|
|
|
* <li> Marc Majoral, 2020. mmajoral(at)cttc.es
|
|
|
|
* </ul>
|
|
|
|
*
|
|
|
|
* Class that controls the Dynamic Bit Selection in the FPGA.
|
|
|
|
*
|
|
|
|
*
|
2020-07-28 14:57:15 +00:00
|
|
|
* -----------------------------------------------------------------------------
|
2020-07-16 13:42:55 +00:00
|
|
|
*
|
2020-12-30 12:35:06 +00:00
|
|
|
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
|
2020-07-16 13:42:55 +00:00
|
|
|
* This file is part of GNSS-SDR.
|
|
|
|
*
|
2020-12-30 12:35:06 +00:00
|
|
|
* Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
|
2020-07-16 13:42:55 +00:00
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
*
|
2020-07-28 14:57:15 +00:00
|
|
|
* -----------------------------------------------------------------------------
|
2020-07-16 13:42:55 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef GNSS_SDR_FPGA_DYNAMIC_BIT_SELECTION_H
|
|
|
|
#define GNSS_SDR_FPGA_DYNAMIC_BIT_SELECTION_H
|
|
|
|
|
2020-07-16 17:07:58 +00:00
|
|
|
#include <cstddef>
|
|
|
|
#include <cstdint>
|
2020-07-16 13:42:55 +00:00
|
|
|
#include <string>
|
2023-09-13 15:19:10 +00:00
|
|
|
#include <vector>
|
2020-07-16 13:42:55 +00:00
|
|
|
|
2020-11-01 12:37:19 +00:00
|
|
|
/** \addtogroup Signal_Source
|
|
|
|
* \{ */
|
|
|
|
/** \addtogroup Signal_Source_libs
|
|
|
|
* \{ */
|
|
|
|
|
|
|
|
|
2020-07-16 13:42:55 +00:00
|
|
|
/*!
|
|
|
|
* \brief Class that controls the switch in the FPGA, which connects the FPGA acquisition and multicorrelator modules to
|
|
|
|
* either the DMA or the Analog Front-End.
|
|
|
|
*/
|
|
|
|
class Fpga_dynamic_bit_selection
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/*!
|
|
|
|
* \brief Constructor
|
|
|
|
*/
|
2023-12-20 15:32:40 +00:00
|
|
|
explicit Fpga_dynamic_bit_selection(bool enable_rx1_band, bool enable_rx2_band);
|
2020-07-16 13:42:55 +00:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Destructor
|
|
|
|
*/
|
|
|
|
~Fpga_dynamic_bit_selection();
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief This function configures the switch in th eFPGA
|
|
|
|
*/
|
|
|
|
void bit_selection(void);
|
|
|
|
|
|
|
|
private:
|
2023-09-13 15:19:10 +00:00
|
|
|
const std::string switch_device_name = std::string("AXIS_Switch_v1_0_0"); // Switch UIO device name
|
|
|
|
const std::string dyn_bit_sel_device_name = std::string("dynamic_bits_selector"); // Switch dhnamic bit selector device name
|
2022-04-19 13:53:00 +00:00
|
|
|
static const size_t FPGA_PAGE_SIZE = 0x1000;
|
2020-07-16 13:42:55 +00:00
|
|
|
static const uint32_t Num_bits_ADC = 12; // Number of bits in the ADC
|
|
|
|
static const uint32_t Num_bits_FPGA = 4; // Number of bits after the bit selection
|
|
|
|
static const uint32_t shift_out_bits_default = Num_bits_ADC - Num_bits_FPGA; // take the most significant bits by default
|
|
|
|
static const uint32_t shift_out_bits_min = 0; // minimum possible value for the bit selection
|
|
|
|
static const uint32_t shift_out_bit_max = Num_bits_ADC - Num_bits_FPGA; // maximum possible value for the bit selection
|
|
|
|
// received signal power thresholds for the bit selection
|
|
|
|
// the received signal power is estimated as the averaged squared absolute value of the received signal samples
|
2020-09-23 08:59:10 +00:00
|
|
|
static const uint32_t Power_Threshold_High = 9000;
|
|
|
|
static const uint32_t Power_Threshold_Low = 3000;
|
2020-07-16 13:42:55 +00:00
|
|
|
|
2023-12-20 15:32:40 +00:00
|
|
|
void open_device(volatile unsigned **d_map_base, int &d_dev_descr, int freq_band);
|
|
|
|
void bit_selection_per_rf_band(volatile unsigned *d_map_base, uint32_t shift_out_bits);
|
|
|
|
void close_device(volatile unsigned *d_map_base, int &d_dev_descr);
|
2020-07-16 13:42:55 +00:00
|
|
|
|
2023-12-20 15:32:40 +00:00
|
|
|
volatile unsigned *d_map_base_freq_band_1;
|
|
|
|
volatile unsigned *d_map_base_freq_band_2;
|
|
|
|
int d_dev_descr_freq_band_1;
|
|
|
|
int d_dev_descr_freq_band_2;
|
|
|
|
uint32_t d_shift_out_bits_freq_band_1;
|
|
|
|
uint32_t d_shift_out_bits_freq_band_2;
|
|
|
|
bool d_enable_rx1_band;
|
|
|
|
bool d_enable_rx2_band;
|
2020-07-16 13:42:55 +00:00
|
|
|
};
|
|
|
|
|
2020-11-01 12:37:19 +00:00
|
|
|
|
|
|
|
/** \} */
|
|
|
|
/** \} */
|
2020-07-16 13:42:55 +00:00
|
|
|
#endif // GNSS_SDR_FPGA_DYNAMIC_BIT_SELECTION_H
|