From 43103068fdaa7a2dea5fc92d8c367b02ce31b931 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 1 May 2018 10:16:30 +0200 Subject: [PATCH] Remove unused includes --- .../signal_source/libs/fpga_switch.cc | 43 ++++++------------- .../signal_source/libs/fpga_switch.h | 2 +- 2 files changed, 13 insertions(+), 32 deletions(-) diff --git a/src/algorithms/signal_source/libs/fpga_switch.cc b/src/algorithms/signal_source/libs/fpga_switch.cc index aae7da979..675c1c071 100644 --- a/src/algorithms/signal_source/libs/fpga_switch.cc +++ b/src/algorithms/signal_source/libs/fpga_switch.cc @@ -35,52 +35,33 @@ */ #include "fpga_switch.h" -#include - -// FPGA stuff -#include - -// libraries used by DMA test code and GIPO test code -#include -#include -#include -#include - -// libraries used by DMA test code -#include -#include -#include -#include - -// libraries used by GPIO test code -#include -#include -#include - -// logging #include +#include // for open, O_RDWR, O_SYNC +#include // for cout, endl +#include // for mmap -// string manipulation -#include // constants -#define PAGE_SIZE 0x10000 -#define TEST_REGISTER_TRACK_WRITEVAL 0x55AA +const size_t PAGE_SIZE = 0x10000; +const unsigned int TEST_REGISTER_TRACK_WRITEVAL = 0x55AA; fpga_switch::fpga_switch(std::string device_name) { if ((d_device_descriptor = open(device_name.c_str(), O_RDWR | O_SYNC)) == -1) { LOG(WARNING) << "Cannot open deviceio" << device_name; - printf("switch memory successfully mapped\n"); } - d_map_base = reinterpret_cast(mmap(NULL, PAGE_SIZE, + d_map_base = reinterpret_cast(mmap(nullptr, PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, d_device_descriptor, 0)); if (d_map_base == reinterpret_cast(-1)) { LOG(WARNING) << "Cannot map the FPGA switch module into tracking memory"; - printf("could not map switch memory\n"); + std::cout << "Could not map switch memory." << std::endl; + } + else + { + std::cout << "Switch memory successfully mapped." << std::endl; } // sanity check : check test register @@ -130,7 +111,7 @@ void fpga_switch::close_device() unsigned *aux = const_cast(d_map_base); if (munmap(static_cast(aux), PAGE_SIZE) == -1) { - printf("Failed to unmap memory uio\n"); + std::cout << "Failed to unmap memory uio" << std::endl; } close(d_device_descriptor); diff --git a/src/algorithms/signal_source/libs/fpga_switch.h b/src/algorithms/signal_source/libs/fpga_switch.h index 395aff425..bf60a17fe 100644 --- a/src/algorithms/signal_source/libs/fpga_switch.h +++ b/src/algorithms/signal_source/libs/fpga_switch.h @@ -37,7 +37,7 @@ #ifndef GNSS_SDR_FPGA_SWITCH_H_ #define GNSS_SDR_FPGA_SWITCH_H_ -#include +#include #define MAX_LENGTH_DEVICEIO_NAME 50