1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-06-25 22:43:14 +00:00

Add missing includes, use \n instead of endl

This commit is contained in:
Carles Fernandez 2020-07-16 19:07:58 +02:00
parent 9b029ec027
commit 08fa55c585
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
2 changed files with 9 additions and 7 deletions

View File

@ -25,7 +25,7 @@
#include "fpga_dynamic_bit_selection.h"
#include <glog/logging.h>
#include <fcntl.h> // for open, O_RDWR, O_SYNC
#include <iostream> // for cout, endl
#include <iostream> // for cout
#include <sys/mman.h> // for mmap
Fpga_dynamic_bit_selection::Fpga_dynamic_bit_selection(const std::string &device_name1, const std::string &device_name2)
@ -41,7 +41,7 @@ Fpga_dynamic_bit_selection::Fpga_dynamic_bit_selection(const std::string &device
if (d_map_base1 == reinterpret_cast<void *>(-1))
{
LOG(WARNING) << "Cannot map the FPGA dynamic bit selection module in frequency band 1 into tracking memory";
std::cout << "Could not map dynamic bit selection memory corresponding to frequency band 1." << std::endl;
std::cout << "Could not map dynamic bit selection memory corresponding to frequency band 1.\n";
}
// dynamic bits selection corresponding to frequency band 2
@ -55,7 +55,7 @@ Fpga_dynamic_bit_selection::Fpga_dynamic_bit_selection(const std::string &device
if (d_map_base2 == reinterpret_cast<void *>(-1))
{
LOG(WARNING) << "Cannot map the FPGA dynamic bit selection module in frequency band 2 into tracking memory";
std::cout << "Could not map dynamic bit selection memory corresponding to frequency band 2." << std::endl;
std::cout << "Could not map dynamic bit selection memory corresponding to frequency band 2.\n";
}
// initialize default bit selection
@ -71,6 +71,7 @@ Fpga_dynamic_bit_selection::~Fpga_dynamic_bit_selection()
close_devices();
}
void Fpga_dynamic_bit_selection::bit_selection(void)
{
// estimated signal power corresponding to frequency band 1
@ -117,18 +118,19 @@ void Fpga_dynamic_bit_selection::bit_selection(void)
d_map_base2[0] = shift_out_bits_band2;
}
void Fpga_dynamic_bit_selection::close_devices()
{
auto *aux = const_cast<unsigned *>(d_map_base1);
if (munmap(static_cast<void *>(aux), FPGA_PAGE_SIZE) == -1)
{
std::cout << "Failed to unmap memory uio" << std::endl;
std::cout << "Failed to unmap memory uio\n";
}
aux = const_cast<unsigned *>(d_map_base2);
if (munmap(static_cast<void *>(aux), FPGA_PAGE_SIZE) == -1)
{
std::cout << "Failed to unmap memory uio" << std::endl;
std::cout << "Failed to unmap memory uio\n";
}
close(d_device_descriptor1);

View File

@ -25,6 +25,8 @@
#ifndef GNSS_SDR_FPGA_DYNAMIC_BIT_SELECTION_H
#define GNSS_SDR_FPGA_DYNAMIC_BIT_SELECTION_H
#include <cstddef>
#include <cstdint>
#include <string>
/*!
@ -63,13 +65,11 @@ private:
static const uint32_t Power_Threshold_High = 15000;
static const uint32_t Power_Threshold_Low = 6000;
void close_devices(void);
uint32_t shift_out_bits_band1; // number of bits to shift for frequency band 1
uint32_t shift_out_bits_band2; // number of bits to shift for frequency band 2
volatile unsigned* d_map_base1; // driver memory map corresponding to frequency band 1
int d_device_descriptor1; // driver descriptor corresponding to frequency band 1