GNSS-SDR  0.0.21
An Open Source GNSS Software Defined Receiver
fpga_dynamic_bit_selection.h
Go to the documentation of this file.
1 /*!
2  * \file fpga_dynamic_bit_selection.h
3  * \brief Dynamic bit selection in the received signal.
4  * \authors <ul>
5  * <li> Marc Majoral, 2020. mmajoral(at)cttc.es
6  * </ul>
7  *
8  * Class that controls the Dynamic Bit Selection in the FPGA.
9  *
10  *
11  * -----------------------------------------------------------------------------
12  *
13  * GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
14  * This file is part of GNSS-SDR.
15  *
16  * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
17  * SPDX-License-Identifier: GPL-3.0-or-later
18  *
19  * -----------------------------------------------------------------------------
20  */
21 
22 #ifndef GNSS_SDR_FPGA_DYNAMIC_BIT_SELECTION_H
23 #define GNSS_SDR_FPGA_DYNAMIC_BIT_SELECTION_H
24 
25 #include <cstddef>
26 #include <cstdint>
27 #include <string>
28 #include <vector>
29 
30 /** \addtogroup Signal_Source
31  * \{ */
32 /** \addtogroup Signal_Source_libs
33  * \{ */
34 
35 
36 /*!
37  * \brief Class that controls the switch in the FPGA, which connects the FPGA acquisition and multicorrelator modules to
38  * either the DMA or the Analog Front-End.
39  */
41 {
42 public:
43  /*!
44  * \brief Constructor
45  */
46  explicit Fpga_dynamic_bit_selection(bool enable_rx1_band, bool enable_rx2_band);
47 
48  /*!
49  * \brief Destructor
50  */
52 
53  /*!
54  * \brief This function configures the switch in th eFPGA
55  */
56  void bit_selection(void);
57 
58 private:
59  const std::string dyn_bit_sel_device_name = std::string("dynamic_bits_selector"); // Switch dhnamic bit selector device name
60  static const size_t FPGA_PAGE_SIZE = 0x1000;
61  static const uint32_t Num_bits_ADC = 12; // Number of bits in the ADC
62  static const uint32_t Num_bits_FPGA = 4; // Number of bits after the bit selection
63  static const uint32_t shift_out_bits_default = Num_bits_ADC - Num_bits_FPGA; // take the most significant bits by default
64  static const uint32_t shift_out_bits_min = 0; // minimum possible value for the bit selection
65  static const uint32_t shift_out_bit_max = Num_bits_ADC - Num_bits_FPGA; // maximum possible value for the bit selection
66  // received signal power thresholds for the bit selection
67  // the received signal power is estimated as the averaged squared absolute value of the received signal samples
68  static const uint32_t Power_Threshold_High = 9000;
69  static const uint32_t Power_Threshold_Low = 3000;
70 
71  void open_device(volatile unsigned **d_map_base, int &d_dev_descr, int freq_band);
72  void bit_selection_per_rf_band(volatile unsigned *d_map_base, uint32_t &shift_out_bits);
73  void close_device(volatile unsigned *d_map_base, int &d_dev_descr);
74 
75  volatile unsigned *d_map_base_freq_band_1;
76  volatile unsigned *d_map_base_freq_band_2;
77  int d_dev_descr_freq_band_1;
78  int d_dev_descr_freq_band_2;
79  uint32_t d_shift_out_bits_freq_band_1;
80  uint32_t d_shift_out_bits_freq_band_2;
81  bool d_enable_rx1_band;
82  bool d_enable_rx2_band;
83 };
84 
85 
86 /** \} */
87 /** \} */
88 #endif // GNSS_SDR_FPGA_DYNAMIC_BIT_SELECTION_H
void bit_selection(void)
This function configures the switch in th eFPGA.
Fpga_dynamic_bit_selection(bool enable_rx1_band, bool enable_rx2_band)
Constructor.
Class that controls the switch in the FPGA, which connects the FPGA acquisition and multicorrelator m...
~Fpga_dynamic_bit_selection()
Destructor.