mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-11-12 05:13:04 +00:00
Apply code formatting
This commit is contained in:
@@ -28,7 +28,7 @@ if(ENABLE_PLUTOSDR OR ENABLE_FMCOMMS2)
|
||||
endif(NOT IIO_FOUND)
|
||||
set(OPT_LIBRARIES ${OPT_LIBRARIES} ${IIO_LIBRARIES})
|
||||
set(OPT_DRIVER_INCLUDE_DIRS ${OPT_DRIVER_INCLUDE_DIRS} ${IIO_INCLUDE_DIRS})
|
||||
|
||||
|
||||
endif(ENABLE_PLUTOSDR OR ENABLE_FMCOMMS2)
|
||||
|
||||
if(ENABLE_FMCOMMS2 OR ENABLE_AD9361)
|
||||
@@ -43,14 +43,14 @@ if(ENABLE_FMCOMMS2 OR ENABLE_AD9361)
|
||||
endif(NOT LIBIIO_FOUND)
|
||||
set(OPT_LIBRARIES ${OPT_LIBRARIES} ${LIBIIO_LIBRARIES})
|
||||
set(OPT_DRIVER_INCLUDE_DIRS ${OPT_DRIVER_INCLUDE_DIRS} ${LIBIIO_INCLUDE_DIRS})
|
||||
|
||||
|
||||
###############################################
|
||||
# FMCOMMS2 based SDR Hardware
|
||||
###############################################
|
||||
if(IIO_FOUND)
|
||||
set(OPT_SIGNAL_SOURCE_LIB_SOURCES ad9361_manager.cc)
|
||||
endif(IIO_FOUND)
|
||||
|
||||
|
||||
endif(ENABLE_FMCOMMS2 OR ENABLE_AD9361)
|
||||
|
||||
if(ENABLE_AD9361)
|
||||
@@ -78,4 +78,3 @@ add_library(signal_source_lib ${SIGNAL_SOURCE_LIB_SOURCES} ${SIGNAL_SOURCE_LIB_H
|
||||
source_group(Headers FILES ${SIGNAL_SOURCE_LIB_HEADERS})
|
||||
|
||||
target_link_libraries(signal_source_lib ${OPT_LIBRARIES})
|
||||
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
*/
|
||||
|
||||
#include "fpga_switch.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
// FPGA stuff
|
||||
@@ -76,9 +75,9 @@ fpga_switch::fpga_switch(std::string device_name)
|
||||
printf("switch memory successfully mapped\n");
|
||||
}
|
||||
d_map_base = reinterpret_cast<volatile unsigned *>(mmap(NULL, PAGE_SIZE,
|
||||
PROT_READ | PROT_WRITE, MAP_SHARED, d_device_descriptor, 0));
|
||||
PROT_READ | PROT_WRITE, MAP_SHARED, d_device_descriptor, 0));
|
||||
|
||||
if (d_map_base == reinterpret_cast<void*>(-1))
|
||||
if (d_map_base == reinterpret_cast<void *>(-1))
|
||||
{
|
||||
LOG(WARNING) << "Cannot map the FPGA switch module into tracking memory";
|
||||
printf("could not map switch memory\n");
|
||||
@@ -100,18 +99,21 @@ fpga_switch::fpga_switch(std::string device_name)
|
||||
DLOG(INFO) << "Switch FPGA class created";
|
||||
}
|
||||
|
||||
|
||||
fpga_switch::~fpga_switch()
|
||||
{
|
||||
close_device();
|
||||
}
|
||||
|
||||
|
||||
void fpga_switch::set_switch_position(int switch_position)
|
||||
{
|
||||
d_map_base[0] = switch_position;
|
||||
}
|
||||
|
||||
|
||||
unsigned fpga_switch::fpga_switch_test_register(
|
||||
unsigned writeval)
|
||||
unsigned writeval)
|
||||
{
|
||||
unsigned readval;
|
||||
// write value to test register
|
||||
@@ -122,15 +124,14 @@ unsigned fpga_switch::fpga_switch_test_register(
|
||||
return readval;
|
||||
}
|
||||
|
||||
|
||||
void fpga_switch::close_device()
|
||||
{
|
||||
unsigned * aux = const_cast<unsigned*>(d_map_base);
|
||||
if (munmap(static_cast<void*>(aux), PAGE_SIZE) == -1)
|
||||
unsigned *aux = const_cast<unsigned *>(d_map_base);
|
||||
if (munmap(static_cast<void *>(aux), PAGE_SIZE) == -1)
|
||||
{
|
||||
printf("Failed to unmap memory uio\n");
|
||||
}
|
||||
|
||||
close(d_device_descriptor);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -47,15 +47,14 @@ public:
|
||||
fpga_switch(std::string device_name);
|
||||
~fpga_switch();
|
||||
void set_switch_position(int switch_position);
|
||||
|
||||
|
||||
private:
|
||||
int d_device_descriptor; // driver descriptor
|
||||
volatile unsigned *d_map_base; // driver memory map
|
||||
int d_device_descriptor; // driver descriptor
|
||||
volatile unsigned *d_map_base; // driver memory map
|
||||
|
||||
// private functions
|
||||
unsigned fpga_switch_test_register(unsigned writeval);
|
||||
void close_device(void);
|
||||
|
||||
void close_device(void);
|
||||
};
|
||||
|
||||
#endif /* GNSS_SDR_FPGA_SWITCH_H_ */
|
||||
|
||||
Reference in New Issue
Block a user