GNSS-SDR  0.0.17
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 
29 /** \addtogroup Signal_Source
30  * \{ */
31 /** \addtogroup Signal_Source_libs
32  * \{ */
33 
34 
35 /*!
36  * \brief Class that controls the switch in the FPGA, which connects the FPGA acquisition and multicorrelator modules to
37  * either the DMA or the Analog Front-End.
38  */
40 {
41 public:
42  /*!
43  * \brief Constructor
44  */
45  explicit Fpga_dynamic_bit_selection(const std::string& device_name1, const std::string& device_name2);
46 
47  /*!
48  * \brief Destructor
49  */
51 
52  /*!
53  * \brief This function configures the switch in th eFPGA
54  */
55  // void set_switch_position(int32_t switch_position);
56  void bit_selection(void);
57 
58 private:
59  static const size_t FPGA_PAGE_SIZE = 0x10000;
60 
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 close_devices(void);
72 
73  uint32_t shift_out_bits_band1; // number of bits to shift for frequency band 1
74  uint32_t shift_out_bits_band2; // number of bits to shift for frequency band 2
75 
76  volatile unsigned* d_map_base1; // driver memory map corresponding to frequency band 1
77  int d_device_descriptor1; // driver descriptor corresponding to frequency band 1
78 
79  volatile unsigned* d_map_base2; // driver memory map corresponding to frequency band 2
80  int d_device_descriptor2; // driver descriptor corresponding to frequency band 2
81 };
82 
83 
84 /** \} */
85 /** \} */
86 #endif // GNSS_SDR_FPGA_DYNAMIC_BIT_SELECTION_H
Fpga_dynamic_bit_selection(const std::string &device_name1, const std::string &device_name2)
Constructor.
void bit_selection(void)
This function configures the switch in th eFPGA.
Class that controls the switch in the FPGA, which connects the FPGA acquisition and multicorrelator m...
~Fpga_dynamic_bit_selection()
Destructor.