GNSS-SDR 0.0.21
An Open Source GNSS Software Defined Receiver
Loading...
Searching...
No Matches
fpga_buffer_monitor.h
Go to the documentation of this file.
1/*!
2 * \file fpga_buffer_monitor.h
3 * \brief Check receiver buffer overflow and monitor the status of the receiver
4 * buffers.
5 * \authors
6 * <ul>
7 * <li> Marc Majoral, 2021. mmajoral(at)cttc.es
8 * </ul>
9 *
10 * Class that checks the receiver buffer overflow flags and monitors the status
11 * of the receiver buffers.
12 *
13 *
14 * -----------------------------------------------------------------------------
15 *
16 * GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
17 * This file is part of GNSS-SDR.
18 *
19 * Copyright (C) 2010-2021 (see AUTHORS file for a list of contributors)
20 * SPDX-License-Identifier: GPL-3.0-or-later
21 *
22 * -----------------------------------------------------------------------------
23 */
24
25#ifndef GNSS_SDR_FPGA_BUFFER_MONITOR_H
26#define GNSS_SDR_FPGA_BUFFER_MONITOR_H
27
28#include <cstdint> // for int32_t
29#include <fstream> // for std::ofstream
30#include <string> // for std::string
31
32/** \addtogroup Signal_Source
33 * \{ */
34/** \addtogroup Signal_Source_libs
35 * \{ */
36
37
38/*!
39 * \brief Class that checks the receiver buffer overflow flags and monitors the
40 * status of the receiver buffers.
41 */
43{
44public:
45 /*!
46 * \brief Constructor
47 */
48 explicit Fpga_buffer_monitor(uint32_t num_freq_bands,
49 bool dump,
50 std::string dump_filename);
51 // explicit Fpga_buffer_monitor(const std::string& device_name,
52 // uint32_t num_freq_bands,
53 // bool dump,
54 // std::string dump_filename);
55
56 /*!
57 * \brief Destructor
58 */
60
61 /*!
62 * \brief This function checks buffer overflow and monitors the FPGA buffer status
63 */
65
66private:
67 const std::string BUFFER_MONITOR_DEVICE_NAME = std::string("buffer_monitor"); // buffer monitor device name
68 static const size_t FPGA_PAGE_SIZE = 0x1000;
69 static const uint32_t test_register_writeval = 0x55AA;
70 static const uint32_t num_sapmples_per_buffer_element = 2;
71 // write addresses
72 static const uint32_t reset_overflow_flags_and_max_buff_size_reg_addr = 0;
73 // read-write addresses
74 static const uint32_t test_reg_addr = 7;
75 // read addresses
76 static const uint32_t current_buff_occ_freq_band_0_reg_addr = 0;
77 static const uint32_t current_buff_occ_freq_band_1_reg_addr = 1;
78 static const uint32_t max_buff_occ_freq_band_0_reg_addr = 2;
79 static const uint32_t max_buff_occ_freq_band_1_reg_addr = 3;
80 static const uint32_t overflow_flags_reg_addr = 4;
81 // FPGA-related constants
82 static const uint32_t overflow_freq_band_0_bit_pos = 1;
83 static const uint32_t overflow_freq_band_1_bit_pos = 2;
84
85 int32_t buffer_monitor_test_register();
86 void close_device();
87
88 std::string d_dump_filename;
89 std::ofstream d_dump_file;
90
91 volatile unsigned* d_map_base; // driver memory map corresponding to the FPGA buffer monitor
92 int d_device_descriptor; // driver descriptor corresponding to the FPGA buffer monitor
93
94 uint32_t d_num_freq_bands;
95
96 uint32_t d_max_buff_occ_freq_band_0;
97 uint32_t d_max_buff_occ_freq_band_1;
98
99 bool d_dump;
100};
101
102
103/** \} */
104/** \} */
105#endif // GNSS_SDR_FPGA_BUFFER_MONITOR_H
Fpga_buffer_monitor(uint32_t num_freq_bands, bool dump, std::string dump_filename)
Constructor.
~Fpga_buffer_monitor()
Destructor.
bool check_buffer_overflow_and_monitor_buffer_status()
This function checks buffer overflow and monitors the FPGA buffer status.